@iccandle/widget-web-trading 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/dist/web-trading-widget.cjs +95 -0
- package/dist/web-trading-widget.css +1 -0
- package/dist/web-trading-widget.d.ts +180 -0
- package/dist/web-trading-widget.js +19996 -0
- package/package.json +83 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";var fh=Object.defineProperty;var cc=e=>{throw TypeError(e)};var ph=(e,t,n)=>t in e?fh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rt=(e,t,n)=>ph(e,typeof t!="symbol"?t+"":t,n),Ni=(e,t,n)=>t.has(e)||cc("Cannot "+n);var S=(e,t,n)=>(Ni(e,t,"read from private field"),n?n.call(e):t.get(e)),Q=(e,t,n)=>t.has(e)?cc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),$=(e,t,n,r)=>(Ni(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),de=(e,t,n)=>(Ni(e,t,"access private method"),n);var ss=(e,t,n,r)=>({set _(s){$(e,t,s,n)},get _(){return S(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),C=require("react"),hh=require("react-dom");function Eu(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=Eu(C),Yr=Eu(hh);function lc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mh(...e){return t=>{let n=!1;const r=e.map(s=>{const i=lc(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():lc(e[s],null)}}}}function ke(...e){return w.useCallback(mh(...e),e)}function dr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const c=[];uc(s)&&typeof is=="function"&&(s=is(s._payload)),w.Children.forEach(s,m=>{var h;if(_h(m)){a=!0;const b=m;let p="child"in b.props?b.props.child:b.props.children;uc(p)&&typeof is=="function"&&(p=is(p._payload)),o=bh(b,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 l=o?wh(o):void 0,d=ke(r,l);if(!o){if(s||s===0)throw new Error(a?Eh(e):Ch(e));return s}const f=vh(i,o.props??{});return o.type!==w.Fragment&&(f.ref=r?d:l),w.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var gh=dr("Slot"),yh=Symbol.for("radix.slottable"),bh=(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 vh(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 wh(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 _h(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yh}var xh=Symbol.for("react.lazy");function uc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===xh&&"_payload"in e&&Sh(e._payload)}function Sh(e){return typeof e=="object"&&e!==null&&"then"in e}var Ch=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Eh=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,is=w[" use ".trim().toString()];function Tu(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=Tu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Pu(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Tu(e))&&(r&&(r+=" "),r+=t);return r}const dc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,fc=Pu,ku=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return fc(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(l=>{const d=n==null?void 0:n[l],f=i==null?void 0:i[l];if(d===null)return null;const m=dc(d)||dc(f);return s[l][m]}),a=n&&Object.entries(n).reduce((l,d)=>{let[f,m]=d;return m===void 0||(l[f]=m),l},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((l,d)=>{let{class:f,className:m,...h}=d;return Object.entries(h).every(b=>{let[p,g]=b;return Array.isArray(g)?g.includes({...i,...a}[p]):{...i,...a}[p]===g})?[...l,f,m]:l},[]);return fc(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},In=[{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"}],Th={[-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 Ph(){const e=-new Date().getTimezoneOffset()/60,t=Th[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Ou="tv:latest-symbol";function kh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=Au(t))&&(r&&(r+=" "),r+=n);return r}function Au(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=Au(e[r]))&&(n&&(n+=" "),n+=t);return n}var Xo="-";function Oh(e){var t=Rh(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var c=a.split(Xo);return c[0]===""&&c.length!==1&&c.shift(),Ru(c,t)||Ah(a)}function o(a,c){var l=n[a]||[];return c&&s[a]?[].concat(l,s[a]):l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function Ru(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?Ru(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(Xo);return(o=t.validators.find(function(a){var c=a.validator;return c(i)}))==null?void 0:o.classGroupId}}var pc=/^\[(.+)\]$/;function Ah(e){if(pc.test(e)){var t=pc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Rh(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Dh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];oo(a,r,o,t)}),r}function oo(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:hc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(Nh(s)){oo(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(function(o){var a=o[0],c=o[1];oo(c,hc(t,a),n,r)})})}function hc(e,t){var n=e;return t.split(Xo).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Nh(e){return e.isThemeGetter}function Dh(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],l=a[1];return[t+c,l]})):o});return[r,i]}):e}function Lh(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 Nu="!";function jh(e){var t=e.separator||":",n=t.length===1,r=t[0],s=t.length;return function(o){for(var a=[],c=0,l=0,d,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(l,f)),l=f+s;continue}if(m==="/"){d=f;continue}}m==="["?c++:m==="]"&&c--}var h=a.length===0?o:o.substring(l),b=h.startsWith(Nu),p=b?h.substring(1):h,g=d&&d>l?d-l:void 0;return{modifiers:a,hasImportantModifier:b,baseClassName:p,maybePostfixModifierPosition:g}}}function Mh(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 Ih(e){return{cache:Lh(e.cacheSize),splitModifiers:jh(e),...Oh(e)}}var Uh=/\s+/;function Fh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(Uh).map(function(o){var a=n(o),c=a.modifiers,l=a.hasImportantModifier,d=a.baseClassName,f=a.maybePostfixModifierPosition,m=r(f?d.substring(0,f):d),h=!!f;if(!m){if(!f)return{isTailwindClass:!1,originalClassName:o};if(m=r(d),!m)return{isTailwindClass:!1,originalClassName:o};h=!1}var b=Mh(c).join(":"),p=l?b+Nu:b;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,l=o.hasPostfixModifier,d=a+c;return i.has(d)?!1:(i.add(d),s(c,l).forEach(function(f){return i.add(a+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Bh(){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(l){var d=t[0],f=t.slice(1),m=f.reduce(function(h,b){return b(h)},d());return r=Ih(m),s=r.cache.get,i=r.cache.set,o=c,c(l)}function c(l){var d=s(l);if(d)return d;var f=Fh(l,r);return i(l,f),f}return function(){return o(kh.apply(null,arguments))}}function Se(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var Du=/^\[(?:([a-z-]+):)?(.+)\]$/i,$h=/^\d+\/\d+$/,Vh=new Set(["px","full","screen"]),Hh=/^(\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$/,Wh=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function ct(e){return mn(e)||Vh.has(e)||$h.test(e)||ao(e)}function ao(e){return Un(e,"length",Qh)}function Gh(e){return Un(e,"size",Lu)}function qh(e){return Un(e,"position",Lu)}function Kh(e){return Un(e,"url",Xh)}function os(e){return Un(e,"number",mn)}function mn(e){return!Number.isNaN(Number(e))}function Zh(e){return e.endsWith("%")&&mn(e.slice(0,-1))}function Ar(e){return mc(e)||Un(e,"number",mc)}function fe(e){return Du.test(e)}function Rr(){return!0}function Ft(e){return Hh.test(e)}function Yh(e){return Un(e,"",Jh)}function Un(e,t,n){var r=Du.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function Qh(e){return zh.test(e)}function Lu(){return!1}function Xh(e){return e.startsWith("url(")}function mc(e){return Number.isInteger(Number(e))}function Jh(e){return Wh.test(e)}function em(){var e=Se("colors"),t=Se("spacing"),n=Se("blur"),r=Se("brightness"),s=Se("borderColor"),i=Se("borderRadius"),o=Se("borderSpacing"),a=Se("borderWidth"),c=Se("contrast"),l=Se("grayscale"),d=Se("hueRotate"),f=Se("invert"),m=Se("gap"),h=Se("gradientColorStops"),b=Se("gradientColorStopPositions"),p=Se("inset"),g=Se("margin"),y=Se("opacity"),v=Se("padding"),x=Se("saturate"),_=Se("scale"),E=Se("sepia"),P=Se("skew"),k=Se("space"),O=Se("translate"),R=function(){return["auto","contain","none"]},A=function(){return["auto","hidden","clip","visible","scroll"]},L=function(){return["auto",fe,t]},D=function(){return[fe,t]},B=function(){return["",ct]},U=function(){return["auto",mn,fe]},W=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},z=function(){return["solid","dashed","dotted","double","none"]},j=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},N=function(){return["start","end","center","between","around","evenly","stretch"]},F=function(){return["","0",fe]},M=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},Y=function(){return[mn,os]},se=function(){return[mn,fe]};return{cacheSize:500,theme:{colors:[Rr],spacing:[ct],blur:["none","",Ft,fe],brightness:Y(),borderColor:[e],borderRadius:["none","","full",Ft,fe],borderSpacing:D(),borderWidth:B(),contrast:Y(),grayscale:F(),hueRotate:se(),invert:F(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[Zh,ao],inset:L(),margin:L(),opacity:Y(),padding:D(),saturate:Y(),scale:Y(),sepia:F(),skew:se(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",fe]}],container:["container"],columns:[{columns:[Ft]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"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(W(),[fe])}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",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",fe]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Ar]}],"grid-cols":[{"grid-cols":[Rr]}],"col-start-end":[{col:["auto",{span:["full",Ar]},fe]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[Rr]}],"row-start-end":[{row:["auto",{span:[Ar]},fe]}],"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",fe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",fe]}],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:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",fe,t]}],"min-w":[{"min-w":["min","max","fit",fe,ct]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Ft]},Ft,fe]}],h:[{h:[fe,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",fe,ct]}],"max-h":[{"max-h":[fe,t,"min","max","fit"]}],"font-size":[{text:["base",Ft,ao]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",os]}],"font-family":[{font:[Rr]}],"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",fe]}],"line-clamp":[{"line-clamp":["none",mn,os]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fe,ct]}],"list-image":[{"list-image":["none",fe]}],"list-style-type":[{list:["none","disc","decimal",fe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(z(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",ct]}],"underline-offset":[{"underline-offset":["auto",fe,ct]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe]}],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",fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(W(),[qh])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Gh]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Kh]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[].concat(z(),["hidden"])}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:z()}],"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(z())}],"outline-offset":[{"outline-offset":[fe,ct]}],"outline-w":[{outline:[ct]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[ct]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ft,Yh]}],"shadow-color":[{shadow:[Rr]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":j()}],"bg-blend":[{"bg-blend":j()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ft,fe]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"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",fe]}],duration:[{duration:se()}],ease:[{ease:["linear","in","out","in-out",fe]}],delay:[{delay:se()}],animate:[{animate:["none","spin","ping","pulse","bounce",fe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Ar,fe]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",fe]}],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",fe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",fe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ct,os]}],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 tm=Bh(em);function De(...e){return tm(Pu(e))}const nm=({className:e=""})=>u.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:u.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",className:e})}),rm=ku("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"}}),Pt=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:s,asChild:i=!1,disabled:o,loaderClassName:a="",loaderParentClassName:c="",...l},d)=>{const f=i?gh:"button";return u.jsxs(f,{className:De(rm({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:d,disabled:s||o,...l,children:[s&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"absolute left-0 z-10 h-full w-full rounded-md bg-white"}),u.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:u.jsx(nm,{className:a})})]}),e]})});Pt.displayName="Button";function xe(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 xr(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 l=f=>{var y;const{scope:m,children:h,...b}=f,p=((y=m==null?void 0:m[e])==null?void 0:y[c])||a,g=w.useMemo(()=>b,Object.values(b));return u.jsx(p.Provider,{value:g,children:h})};l.displayName=i+"Provider";function d(f,m){var p;const h=((p=m==null?void 0:m[e])==null?void 0:p[c])||a,b=w.useContext(h);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[l,d]}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,sm(s,...t)]}function sm(...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:l})=>{const f=c(i)[`__scope${l}`];return{...a,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ue=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},im=w[" useId ".trim().toString()]||(()=>{}),om=0;function Jt(e){const[t,n]=w.useState(im());return Ue(()=>{n(r=>r??String(om++))},[e]),e||(t?`radix-${t}`:"")}var am=w[" useInsertionEffect ".trim().toString()]||Ue;function fr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=cm({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:s;{const d=w.useRef(e!==void 0);w.useEffect(()=>{const f=d.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.`),d.current=a},[a,r])}const l=w.useCallback(d=>{var f;if(a){const m=lm(d)?d(e):d;m!==e&&((f=o.current)==null||f.call(o,m))}else i(d)},[a,e,i,o]);return[c,l]}function cm({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return am(()=>{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 lm(e){return typeof e=="function"}var um=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ve=um.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),u.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function dm(e,t){e&&Yr.flushSync(()=>e.dispatchEvent(t))}function An(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 fm(e,t=globalThis==null?void 0:globalThis.document){const n=An(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 pm="DismissableLayer",co="dismissableLayer.update",hm="dismissableLayer.pointerDownOutside",mm="dismissableLayer.focusOutside",gc,Jo=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ea=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...l}=e,d=w.useContext(Jo),[f,m]=w.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=w.useState({}),p=ke(t,R=>m(R)),g=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(y),x=f?g.indexOf(f):-1,_=d.layersWithOutsidePointerEventsDisabled.size>0,E=x>=v,P=w.useRef(!1),k=vm(R=>{const A=R.target;if(!(A instanceof Node))return;const L=[...d.branches].some(D=>D.contains(A));!E||L||(i==null||i(R),a==null||a(R),R.defaultPrevented||c==null||c())},{ownerDocument:h,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:d.dismissableSurfaces}),O=wm(R=>{if(r&&P.current)return;const A=R.target;[...d.branches].some(D=>D.contains(A))||(o==null||o(R),a==null||a(R),R.defaultPrevented||c==null||c())},h);return fm(R=>{x===d.layers.size-1&&(s==null||s(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},h),w.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(gc=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),yc(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=gc))}},[f,h,n,d]),w.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),yc())},[f,d]),w.useEffect(()=>{const R=()=>b({});return document.addEventListener(co,R),()=>document.removeEventListener(co,R)},[]),u.jsx(ve.div,{...l,ref:p,style:{pointerEvents:_?E?"auto":"none":void 0,...e.style},onFocusCapture:xe(e.onFocusCapture,O.onFocusCapture),onBlurCapture:xe(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:xe(e.onPointerDownCapture,k.onPointerDownCapture)})});ea.displayName=pm;var gm="DismissableLayerBranch",ym=w.forwardRef((e,t)=>{const n=w.useContext(Jo),r=w.useRef(null),s=ke(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(ve.div,{...e,ref:s})});ym.displayName=gm;function bm(){const e=w.useContext(Jo),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function vm(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=An(e),a=w.useRef(!1),c=w.useRef(!1),l=w.useRef(new Map),d=w.useRef(()=>{});return w.useEffect(()=>{function f(){c.current=!1,s.current=!1,l.current.clear()}function m(){return Array.from(l.current.values()).some(Boolean)}function h(v){if(!c.current)return;const x=v.target;x instanceof Node&&[...i].some(E=>E.contains(x))||l.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{c.current&&d.current()},0)}function b(v){c.current&&l.current.set(v.type,!1)}const p=v=>{if(v.target&&!a.current){let x=function(){n.removeEventListener("click",d.current);const E=m();f(),E||ju(hm,o,_,{discrete:!0})};const _={originalEvent:v};c.current=!0,s.current=r&&v.button===0,l.current.clear(),!r||v.button!==0?x():(n.removeEventListener("click",d.current),d.current=x,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},g=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of g)n.addEventListener(v,h,!0),n.addEventListener(v,b);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",p),n.removeEventListener("click",d.current);for(const v of g)n.removeEventListener(v,h,!0),n.removeEventListener(v,b)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function wm(e,t=globalThis==null?void 0:globalThis.document){const n=An(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&ju(mm,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 yc(){const e=new CustomEvent(co);document.dispatchEvent(e)}function ju(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?dm(s,i):s.dispatchEvent(i)}var Di="focusScope.autoFocusOnMount",Li="focusScope.autoFocusOnUnmount",bc={bubbles:!1,cancelable:!0},_m="FocusScope",ta=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,c]=w.useState(null),l=An(s),d=An(i),f=w.useRef(null),m=ke(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=_:Bt(f.current,{select:!0})},g=function(x){if(h.paused||!a)return;const _=x.relatedTarget;_!==null&&(a.contains(_)||Bt(f.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const E of x)E.removedNodes.length>0&&Bt(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",g);const v=new MutationObserver(y);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",g),v.disconnect()}}},[r,a,h.paused]),w.useEffect(()=>{if(a){wc.add(h);const p=document.activeElement;if(!a.contains(p)){const y=new CustomEvent(Di,bc);a.addEventListener(Di,l),a.dispatchEvent(y),y.defaultPrevented||(xm(Pm(Mu(a)),{select:!0}),document.activeElement===p&&Bt(a))}return()=>{a.removeEventListener(Di,l),setTimeout(()=>{const y=new CustomEvent(Li,bc);a.addEventListener(Li,d),a.dispatchEvent(y),y.defaultPrevented||Bt(p??document.body,{select:!0}),a.removeEventListener(Li,d),wc.remove(h)},0)}}},[a,l,d,h]);const b=w.useCallback(p=>{if(!n&&!r||h.paused)return;const g=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(g&&y){const v=p.currentTarget,[x,_]=Sm(v);x&&_?!p.shiftKey&&y===_?(p.preventDefault(),n&&Bt(x,{select:!0})):p.shiftKey&&y===x&&(p.preventDefault(),n&&Bt(_,{select:!0})):y===v&&p.preventDefault()}},[n,r,h.paused]);return u.jsx(ve.div,{tabIndex:-1,...o,ref:m,onKeyDown:b})});ta.displayName=_m;function xm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Bt(r,{select:t}),document.activeElement!==n)return}function Sm(e){const t=Mu(e),n=vc(t,e),r=vc(t.reverse(),e);return[n,r]}function Mu(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 vc(e,t){for(const n of e)if(!Cm(n,{upTo:t}))return n}function Cm(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 Em(e){return e instanceof HTMLInputElement&&"select"in e}function Bt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Em(e)&&t&&e.select()}}var wc=Tm();function Tm(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=_c(e,t),e.unshift(t)},remove(t){var n;e=_c(e,t),(n=e[0])==null||n.resume()}}}function _c(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Pm(e){return e.filter(t=>t.tagName!=="A")}var km="Portal",na=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,i]=w.useState(!1);Ue(()=>i(!0),[]);const o=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Yr.createPortal(u.jsx(ve.div,{...r,ref:t}),o):null});na.displayName=km;function Om(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Sr=e=>{const{present:t,children:n}=e,r=Am(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Rm(r.ref,Nm(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};Sr.displayName="Presence";function Am(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,c]=Om(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const l=as(r.current);i.current=a==="mounted"?l:"none"},[a]),Ue(()=>{const l=r.current,d=s.current;if(d!==e){const m=i.current,h=as(l);e?c("MOUNT"):h==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&m!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Ue(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,f=h=>{const p=as(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&p&&(c("ANIMATION_END"),!s.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},m=h=>{h.target===t&&(i.current=as(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(l),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(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function xc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rm(...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=xc(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():xc(r[o],null)}}},[])}function as(e){return(e==null?void 0:e.animationName)||"none"}function Nm(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cs=0,vt=null;function Iu(){w.useEffect(()=>{vt||(vt={start:Sc(),end:Sc()});const{start:e,end:t}=vt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),cs++,()=>{cs===1&&(vt==null||vt.start.remove(),vt==null||vt.end.remove(),vt=null),cs=Math.max(0,cs-1)}},[])}function Sc(){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 Et=function(){return Et=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},Et.apply(this,arguments)};function Uu(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 Dm(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 Cs="right-scroll-bar-position",Es="width-before-scroll-bar",Lm="with-scroll-bars-hidden",jm="--removed-body-scroll-bar-size";function ji(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Mm(e,t){var n=C.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var Im=typeof window<"u"?w.useLayoutEffect:w.useEffect,Cc=new WeakMap;function Um(e,t){var n=Mm(null,function(r){return e.forEach(function(s){return ji(s,r)})});return Im(function(){var r=Cc.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||ji(a,null)}),i.forEach(function(a){s.has(a)||ji(a,o)})}Cc.set(n,e)},[e]),n}function Fm(e){return e}function Bm(e,t){t===void 0&&(t=Fm);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 d=o;o=[],d.forEach(i)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(d){o.push(d),l()},filter:function(d){return o=o.filter(d),n}}}};return s}function $m(e){e===void 0&&(e={});var t=Bm(null);return t.options=Et({async:!0,ssr:!1},e),t}var Fu=function(e){var t=e.sideCar,n=Uu(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,Et({},n))};Fu.isSideCarExport=!0;function Vm(e,t){return e.useMedium(t),Fu}var Bu=$m(),Mi=function(){},si=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:Mi,onWheelCapture:Mi,onTouchMoveCapture:Mi}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,h=e.noRelative,b=e.noIsolation,p=e.inert,g=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,x=e.gapMode,_=Uu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,P=Um([n,t]),k=Et(Et({},_),s);return w.createElement(w.Fragment,null,d&&w.createElement(E,{sideCar:Bu,removeScrollBar:l,shards:f,noRelative:h,noIsolation:b,inert:p,setCallbacks:i,allowPinchZoom:!!g,lockRef:n,gapMode:x}),o?w.cloneElement(w.Children.only(a),Et(Et({},k),{ref:P})):w.createElement(v,Et({},k,{className:c,ref:P}),a))});si.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};si.classNames={fullWidth:Es,zeroRight:Cs};var Hm=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=Hm();return t&&e.setAttribute("nonce",t),e}function Wm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Gm(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var qm=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zm())&&(Wm(t,n),Gm(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Km=function(){var e=qm();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},$u=function(){var e=Km(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Zm={left:0,top:0,right:0,gap:0},Ii=function(e){return parseInt(e||"",10)||0},Ym=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[Ii(n),Ii(r),Ii(s)]},Qm=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Zm;var t=Ym(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])}},Xm=$u(),Yn="data-scroll-locked",Jm=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(Lm,` {
|
|
3
|
+
overflow: hidden `).concat(r,`;
|
|
4
|
+
padding-right: `).concat(a,"px ").concat(r,`;
|
|
5
|
+
}
|
|
6
|
+
body[`).concat(Yn,`] {
|
|
7
|
+
overflow: hidden `).concat(r,`;
|
|
8
|
+
overscroll-behavior: contain;
|
|
9
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
10
|
+
padding-left: `.concat(s,`px;
|
|
11
|
+
padding-top: `).concat(i,`px;
|
|
12
|
+
padding-right: `).concat(o,`px;
|
|
13
|
+
margin-left:0;
|
|
14
|
+
margin-top:0;
|
|
15
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
16
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.`).concat(Cs,` {
|
|
20
|
+
right: `).concat(a,"px ").concat(r,`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.`).concat(Es,` {
|
|
24
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.`).concat(Cs," .").concat(Cs,` {
|
|
28
|
+
right: 0 `).concat(r,`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.`).concat(Es," .").concat(Es,` {
|
|
32
|
+
margin-right: 0 `).concat(r,`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
body[`).concat(Yn,`] {
|
|
36
|
+
`).concat(jm,": ").concat(a,`px;
|
|
37
|
+
}
|
|
38
|
+
`)},Ec=function(){var e=parseInt(document.body.getAttribute(Yn)||"0",10);return isFinite(e)?e:0},eg=function(){w.useEffect(function(){return document.body.setAttribute(Yn,(Ec()+1).toString()),function(){var e=Ec()-1;e<=0?document.body.removeAttribute(Yn):document.body.setAttribute(Yn,e.toString())}},[])},tg=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;eg();var i=w.useMemo(function(){return Qm(s)},[s]);return w.createElement(Xm,{styles:Jm(i,!t,s,n?"":"!important")})},lo=!1;if(typeof window<"u")try{var ls=Object.defineProperty({},"passive",{get:function(){return lo=!0,!0}});window.addEventListener("test",ls,ls),window.removeEventListener("test",ls,ls)}catch{lo=!1}var Vn=lo?{passive:!1}:!1,ng=function(e){return e.tagName==="TEXTAREA"},Vu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ng(e)&&n[t]==="visible")},rg=function(e){return Vu(e,"overflowY")},sg=function(e){return Vu(e,"overflowX")},Tc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Hu(e,r);if(s){var i=zu(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ig=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},og=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Hu=function(e,t){return e==="v"?rg(t):sg(t)},zu=function(e,t){return e==="v"?ig(t):og(t)},ag=function(e,t){return e==="h"&&t==="rtl"?-1:1},cg=function(e,t,n,r,s){var i=ag(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,c=t.contains(a),l=!1,d=o>0,f=0,m=0;do{if(!a)break;var h=zu(e,a),b=h[0],p=h[1],g=h[2],y=p-g-i*b;(b||y)&&Hu(e,a)&&(f+=y,m+=b);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(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(l=!0),l},us=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Pc=function(e){return[e.deltaX,e.deltaY]},kc=function(e){return e&&"current"in e?e.current:e},lg=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ug=function(e){return`
|
|
39
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
+
`)},dg=0,Hn=[];function fg(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(dg++)[0],i=w.useState($u)[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=Dm([e.lockRef.current],(e.shards||[]).map(kc),!0).filter(Boolean);return p.forEach(function(g){return g.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(p,g){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var y=us(p),v=n.current,x="deltaX"in p?p.deltaX:v[0]-y[0],_="deltaY"in p?p.deltaY:v[1]-y[1],E,P=p.target,k=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in p&&k==="h"&&P.type==="range")return!1;var O=window.getSelection(),R=O&&O.anchorNode,A=R?R===P||R.contains(P):!1;if(A)return!1;var L=Tc(k,P);if(!L)return!0;if(L?E=k:(E=k==="v"?"h":"v",L=Tc(k,P)),!L)return!1;if(!r.current&&"changedTouches"in p&&(x||_)&&(r.current=E),!E)return!0;var D=r.current||E;return cg(D,g,p,D==="h"?x:_)},[]),c=w.useCallback(function(p){var g=p;if(!(!Hn.length||Hn[Hn.length-1]!==i)){var y="deltaY"in g?Pc(g):us(g),v=t.current.filter(function(E){return E.name===g.type&&(E.target===g.target||g.target===E.shadowParent)&&lg(E.delta,y)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(kc).filter(Boolean).filter(function(E){return E.contains(g.target)}),_=x.length>0?a(g,x[0]):!o.current.noIsolation;_&&g.cancelable&&g.preventDefault()}}},[]),l=w.useCallback(function(p,g,y,v){var x={name:p,delta:g,target:y,should:v,shadowParent:pg(y)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(_){return _!==x})},1)},[]),d=w.useCallback(function(p){n.current=us(p),r.current=void 0},[]),f=w.useCallback(function(p){l(p.type,Pc(p),p.target,a(p,e.lockRef.current))},[]),m=w.useCallback(function(p){l(p.type,us(p),p.target,a(p,e.lockRef.current))},[]);w.useEffect(function(){return Hn.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Vn),document.addEventListener("touchmove",c,Vn),document.addEventListener("touchstart",d,Vn),function(){Hn=Hn.filter(function(p){return p!==i}),document.removeEventListener("wheel",c,Vn),document.removeEventListener("touchmove",c,Vn),document.removeEventListener("touchstart",d,Vn)}},[]);var h=e.removeScrollBar,b=e.inert;return w.createElement(w.Fragment,null,b?w.createElement(i,{styles:ug(s)}):null,h?w.createElement(tg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function pg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hg=Vm(Bu,fg);var ra=w.forwardRef(function(e,t){return w.createElement(si,Et({},e,{ref:t,sideCar:hg}))});ra.classNames=si.classNames;var mg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},zn=new WeakMap,ds=new WeakMap,fs={},Ui=0,Wu=function(e){return e&&(e.host||Wu(e.parentNode))},gg=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Wu(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})},yg=function(e,t,n,r){var s=gg(t,Array.isArray(e)?e:[e]);fs[n]||(fs[n]=new WeakMap);var i=fs[n],o=[],a=new Set,c=new Set(s),l=function(f){!f||a.has(f)||(a.add(f),l(f.parentNode))};s.forEach(l);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))d(m);else try{var h=m.getAttribute(r),b=h!==null&&h!=="false",p=(zn.get(m)||0)+1,g=(i.get(m)||0)+1;zn.set(m,p),i.set(m,g),o.push(m),p===1&&b&&ds.set(m,!0),g===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),a.clear(),Ui++,function(){o.forEach(function(f){var m=zn.get(f)-1,h=i.get(f)-1;zn.set(f,m),i.set(f,h),m||(ds.has(f)||f.removeAttribute(r),ds.delete(f)),h||f.removeAttribute(n)}),Ui--,Ui||(zn=new WeakMap,zn=new WeakMap,ds=new WeakMap,fs={})}},Gu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=mg(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),yg(r,s,n,"aria-hidden")):function(){return null}},ii="Dialog",[qu]=xr(ii),[bg,mt]=qu(ii),Ku=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=w.useRef(null),c=w.useRef(null),[l,d]=fr({prop:r,defaultProp:s??!1,onChange:i,caller:ii});return u.jsx(bg,{scope:t,triggerRef:a,contentRef:c,contentId:Jt(),titleId:Jt(),descriptionId:Jt(),open:l,onOpenChange:d,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};Ku.displayName=ii;var Zu="DialogTrigger",vg=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(Zu,n),i=ke(t,s.triggerRef);return u.jsx(ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":la(s.open),...r,ref:i,onClick:xe(e.onClick,s.onOpenToggle)})});vg.displayName=Zu;var sa="DialogPortal",[wg,Yu]=qu(sa,{forceMount:void 0}),Qu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=mt(sa,t);return u.jsx(wg,{scope:t,forceMount:n,children:w.Children.map(r,o=>u.jsx(Sr,{present:n||i.open,children:u.jsx(na,{asChild:!0,container:s,children:o})}))})};Qu.displayName=sa;var js="DialogOverlay",ia=w.forwardRef((e,t)=>{const n=Yu(js,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=mt(js,e.__scopeDialog);return i.modal?u.jsx(Sr,{present:r||i.open,children:u.jsx(xg,{...s,ref:t})}):null});ia.displayName=js;var _g=dr("DialogOverlay.RemoveScroll"),xg=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(js,n),i=bm(),o=ke(t,i);return u.jsx(ra,{as:_g,allowPinchZoom:!0,shards:[s.contentRef],children:u.jsx(ve.div,{"data-state":la(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),pr="DialogContent",oa=w.forwardRef((e,t)=>{const n=Yu(pr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=mt(pr,e.__scopeDialog);return u.jsx(Sr,{present:r||i.open,children:i.modal?u.jsx(Sg,{...s,ref:t}):u.jsx(Cg,{...s,ref:t})})});oa.displayName=pr;var Sg=w.forwardRef((e,t)=>{const n=mt(pr,e.__scopeDialog),r=w.useRef(null),s=ke(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return Gu(i)},[]),u.jsx(Xu,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:xe(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:xe(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:xe(e.onFocusOutside,i=>i.preventDefault())})}),Cg=w.forwardRef((e,t)=>{const n=mt(pr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return u.jsx(Xu,{...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,l;(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;((l=n.triggerRef.current)==null?void 0:l.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Xu=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=mt(pr,n);return Iu(),u.jsx(u.Fragment,{children:u.jsx(ta,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:u.jsx(ea,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":la(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),Ju="DialogTitle",aa=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(Ju,n);return u.jsx(ve.h2,{id:s.titleId,...r,ref:t})});aa.displayName=Ju;var ed="DialogDescription",ca=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(ed,n);return u.jsx(ve.p,{id:s.descriptionId,...r,ref:t})});ca.displayName=ed;var td="DialogClose",Eg=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(td,n);return u.jsx(ve.button,{type:"button",...r,ref:t,onClick:xe(e.onClick,()=>s.onOpenChange(!1))})});Eg.displayName=td;function la(e){return e?"open":"closed"}const Tg=Ku,Pg=Qu,nd=w.forwardRef(({className:e,...t},n)=>u.jsx(ia,{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}));nd.displayName=ia.displayName;const rd=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>u.jsxs(Pg,{children:[u.jsx(nd,{className:t}),u.jsx(oa,{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})]}));rd.displayName=oa.displayName;const sd=({className:e,...t})=>u.jsx("div",{className:De("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});sd.displayName="DialogHeader";const id=({className:e,...t})=>u.jsx("div",{className:De("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});id.displayName="DialogFooter";const od=w.forwardRef(({className:e,...t},n)=>u.jsx(aa,{ref:n,className:De("text-lg font-semibold leading-none tracking-tight",e),...t}));od.displayName=aa.displayName;const ad=w.forwardRef(({className:e,...t},n)=>u.jsx(ca,{ref:n,className:De("text-sm text-muted-foreground",e),...t}));ad.displayName=ca.displayName;function Oc(e,[t,n]){return Math.min(n,Math.max(t,e))}function cd(e){const t=e+"CollectionProvider",[n,r]=xr(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:y}=p,v=w.useRef(null),x=w.useRef(new Map).current;return u.jsx(s,{scope:g,itemMap:x,collectionRef:v,children:y})};o.displayName=t;const a=e+"CollectionSlot",c=dr(a),l=w.forwardRef((p,g)=>{const{scope:y,children:v}=p,x=i(a,y),_=ke(g,x.collectionRef);return u.jsx(c,{ref:_,children:v})});l.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=dr(d),h=w.forwardRef((p,g)=>{const{scope:y,children:v,...x}=p,_=w.useRef(null),E=ke(g,_),P=i(d,y);return w.useEffect(()=>(P.itemMap.set(_,{ref:_,...x}),()=>void P.itemMap.delete(_))),u.jsx(m,{[f]:"",ref:E,children:v})});h.displayName=d;function b(p){const g=i(e+"CollectionConsumer",p);return w.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((P,k)=>x.indexOf(P.ref.current)-x.indexOf(k.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:l,ItemSlot:h},b,r]}var kg=w.createContext(void 0);function ld(e){const t=w.useContext(kg);return e||t||"ltr"}const Og=["top","right","bottom","left"],nn=Math.min,Je=Math.max,Ms=Math.round,ps=Math.floor,kt=e=>({x:e,y:e}),Ag={left:"right",right:"left",bottom:"top",top:"bottom"};function uo(e,t,n){return Je(e,nn(t,n))}function jt(e,t){return typeof e=="function"?e(t):e}function Mt(e){return e.split("-")[0]}function Cr(e){return e.split("-")[1]}function ua(e){return e==="x"?"y":"x"}function da(e){return e==="y"?"height":"width"}function Tt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fa(e){return ua(Tt(e))}function Rg(e,t,n){n===void 0&&(n=!1);const r=Cr(e),s=fa(e),i=da(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Is(o)),[o,Is(o)]}function Ng(e){const t=Is(e);return[fo(e),t,fo(t)]}function fo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ac=["left","right"],Rc=["right","left"],Dg=["top","bottom"],Lg=["bottom","top"];function jg(e,t,n){switch(e){case"top":case"bottom":return n?t?Rc:Ac:t?Ac:Rc;case"left":case"right":return t?Dg:Lg;default:return[]}}function Mg(e,t,n,r){const s=Cr(e);let i=jg(Mt(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(fo)))),i}function Is(e){const t=Mt(e);return Ag[t]+e.slice(t.length)}function Ig(e){return{top:0,right:0,bottom:0,left:0,...e}}function ud(e){return typeof e!="number"?Ig(e):{top:e,right:e,bottom:e,left:e}}function Us(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 Nc(e,t,n){let{reference:r,floating:s}=e;const i=Tt(t),o=fa(t),a=da(o),c=Mt(t),l=i==="y",d=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:d,y:r.y-s.height};break;case"bottom":h={x:d,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(Cr(t)){case"start":h[o]-=m*(n&&l?-1:1);break;case"end":h[o]+=m*(n&&l?-1:1);break}return h}async function Ug(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:h=0}=jt(t,e),b=ud(h),g=a[m?f==="floating"?"reference":"floating":f],y=Us(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,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},E=Us(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-E.top+b.top)/_.y,bottom:(E.bottom-y.bottom+b.bottom)/_.y,left:(y.left-E.left+b.left)/_.x,right:(E.right-y.right+b.right)/_.x}}const Fg=50,Bg=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Ug},c=await(o.isRTL==null?void 0:o.isRTL(t));let l=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=Nc(l,r,c),m=r,h=0;const b={};for(let p=0;p<i.length;p++){const g=i[p];if(!g)continue;const{name:y,fn:v}=g,{x,y:_,data:E,reset:P}=await v({x:d,y:f,initialPlacement:r,placement:m,strategy:s,middlewareData:b,rects:l,platform:a,elements:{reference:e,floating:t}});d=x??d,f=_??f,b[y]={...b[y],...E},P&&h<Fg&&(h++,typeof P=="object"&&(P.placement&&(m=P.placement),P.rects&&(l=P.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):P.rects),{x:d,y:f}=Nc(l,m,c)),p=-1)}return{x:d,y:f,placement:m,strategy:s,middlewareData:b}},$g=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:l,padding:d=0}=jt(e,t)||{};if(l==null)return{};const f=ud(d),m={x:n,y:r},h=fa(s),b=da(h),p=await o.getDimensions(l),g=h==="y",y=g?"top":"left",v=g?"bottom":"right",x=g?"clientHeight":"clientWidth",_=i.reference[b]+i.reference[h]-m[h]-i.floating[b],E=m[h]-i.reference[h],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let k=P?P[x]:0;(!k||!await(o.isElement==null?void 0:o.isElement(P)))&&(k=a.floating[x]||i.floating[b]);const O=_/2-E/2,R=k/2-p[b]/2-1,A=nn(f[y],R),L=nn(f[v],R),D=A,B=k-p[b]-L,U=k/2-p[b]/2+O,W=uo(D,U,B),z=!c.arrow&&Cr(s)!=null&&U!==W&&i.reference[b]/2-(U<D?A:L)-p[b]/2<0,j=z?U<D?U-D:U-B:0;return{[h]:m[h]+j,data:{[h]:W,centerOffset:U-W-j,...z&&{alignmentOffset:j}},reset:z}}}),Vg=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:l}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:p=!0,...g}=jt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Mt(s),v=Tt(a),x=Mt(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(l.floating)),E=m||(x||!p?[Is(a)]:Ng(a)),P=b!=="none";!m&&P&&E.push(...Mg(a,p,b,_));const k=[a,...E],O=await c.detectOverflow(t,g),R=[];let A=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&R.push(O[y]),f){const U=Rg(s,o,_);R.push(O[U[0]],O[U[1]])}if(A=[...A,{placement:s,overflows:R}],!R.every(U=>U<=0)){var L,D;const U=(((L=i.flip)==null?void 0:L.index)||0)+1,W=k[U];if(W&&(!(f==="alignment"?v!==Tt(W):!1)||A.every(N=>Tt(N.placement)===v?N.overflows[0]>0:!0)))return{data:{index:U,overflows:A},reset:{placement:W}};let z=(D=A.filter(j=>j.overflows[0]<=0).sort((j,N)=>j.overflows[1]-N.overflows[1])[0])==null?void 0:D.placement;if(!z)switch(h){case"bestFit":{var B;const j=(B=A.filter(N=>{if(P){const F=Tt(N.placement);return F===v||F==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(F=>F>0).reduce((F,M)=>F+M,0)]).sort((N,F)=>N[1]-F[1])[0])==null?void 0:B[0];j&&(z=j);break}case"initialPlacement":z=a;break}if(s!==z)return{reset:{placement:z}}}return{}}}};function Dc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Lc(e){return Og.some(t=>e[t]>=0)}const Hg=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=Dc(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Lc(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=Dc(o,n.floating);return{data:{escapedOffsets:a,escaped:Lc(a)}}}default:return{}}}}},dd=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=Cr(n),c=Tt(n)==="y",l=dd.has(o)?-1:1,d=i&&c?-1:1,f=jt(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(h=a==="end"?b*-1:b),c?{x:h*d,y:m*l}:{x:m*l,y:h*d}}const Wg=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}}}}},Gg=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:y=>{let{x:v,y:x}=y;return{x:v,y:x}}},...l}=jt(e,t),d={x:n,y:r},f=await i.detectOverflow(t,l),m=Tt(Mt(s)),h=ua(m);let b=d[h],p=d[m];if(o){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=b+f[y],_=b-f[v];b=uo(x,b,_)}if(a){const y=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=p+f[y],_=p-f[v];p=uo(x,p,_)}const g=c.fn({...t,[h]:b,[m]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:o,[m]:a}}}}}},qg=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:l=!0}=jt(e,t),d={x:n,y:r},f=Tt(s),m=ua(f);let h=d[m],b=d[f];const p=jt(a,t),g=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]+g.mainAxis,E=i.reference[m]+i.reference[x]-g.mainAxis;h<_?h=_:h>E&&(h=E)}if(l){var y,v;const x=m==="y"?"width":"height",_=dd.has(Mt(s)),E=i.reference[f]-i.floating[x]+(_&&((y=o.offset)==null?void 0:y[f])||0)+(_?0:g.crossAxis),P=i.reference[f]+i.reference[x]+(_?0:((v=o.offset)==null?void 0:v[f])||0)-(_?g.crossAxis:0);b<E?b=E:b>P&&(b=P)}return{[m]:h,[f]:b}}}},Kg=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=()=>{},...l}=jt(e,t),d=await o.detectOverflow(t,l),f=Mt(s),m=Cr(s),h=Tt(s)==="y",{width:b,height:p}=i.floating;let g,y;f==="top"||f==="bottom"?(g=f,y=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(y=f,g=m==="end"?"top":"bottom");const v=p-d.top-d.bottom,x=b-d.left-d.right,_=nn(p-d[g],v),E=nn(b-d[y],x),P=!t.middlewareData.shift;let k=_,O=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=v),P&&!m){const A=Je(d.left,0),L=Je(d.right,0),D=Je(d.top,0),B=Je(d.bottom,0);h?O=b-2*(A!==0||L!==0?A+L:Je(d.left,d.right)):k=p-2*(D!==0||B!==0?D+B:Je(d.top,d.bottom))}await c({...t,availableWidth:O,availableHeight:k});const R=await o.getDimensions(a.floating);return b!==R.width||p!==R.height?{reset:{rects:!0}}:{}}}};function oi(){return typeof window<"u"}function Er(e){return fd(e)?(e.nodeName||"").toLowerCase():"#document"}function et(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function At(e){var t;return(t=(fd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fd(e){return oi()?e instanceof Node||e instanceof et(e).Node:!1}function pt(e){return oi()?e instanceof Element||e instanceof et(e).Element:!1}function Ut(e){return oi()?e instanceof HTMLElement||e instanceof et(e).HTMLElement:!1}function jc(e){return!oi()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof et(e).ShadowRoot}function Qr(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ht(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Zg(e){return/^(table|td|th)$/.test(Er(e))}function ai(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Yg=/transform|translate|scale|rotate|perspective|filter/,Qg=/paint|layout|strict|content/,hn=e=>!!e&&e!=="none";let Fi;function pa(e){const t=pt(e)?ht(e):e;return hn(t.transform)||hn(t.translate)||hn(t.scale)||hn(t.rotate)||hn(t.perspective)||!ha()&&(hn(t.backdropFilter)||hn(t.filter))||Yg.test(t.willChange||"")||Qg.test(t.contain||"")}function Xg(e){let t=rn(e);for(;Ut(t)&&!hr(t);){if(pa(t))return t;if(ai(t))return null;t=rn(t)}return null}function ha(){return Fi==null&&(Fi=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Fi}function hr(e){return/^(html|body|#document)$/.test(Er(e))}function ht(e){return et(e).getComputedStyle(e)}function ci(e){return pt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rn(e){if(Er(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jc(e)&&e.host||At(e);return jc(t)?t.host:t}function pd(e){const t=rn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ut(t)&&Qr(t)?t:pd(t)}function Ur(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=pd(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=et(s);if(i){const a=po(o);return t.concat(o,o.visualViewport||[],Qr(s)?s:[],a&&n?Ur(a):[])}else return t.concat(s,Ur(s,[],n))}function po(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hd(e){const t=ht(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ut(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=Ms(n)!==i||Ms(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function ma(e){return pt(e)?e:e.contextElement}function Qn(e){const t=ma(e);if(!Ut(t))return kt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=hd(t);let o=(i?Ms(n.width):n.width)/r,a=(i?Ms(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Jg=kt(0);function md(e){const t=et(e);return!ha()||!t.visualViewport?Jg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ey(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==et(e)?!1:t}function Rn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=ma(e);let o=kt(1);t&&(r?pt(r)&&(o=Qn(r)):o=Qn(e));const a=ey(i,n,r)?md(i):kt(0);let c=(s.left+a.x)/o.x,l=(s.top+a.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(i){const m=et(i),h=r&&pt(r)?et(r):r;let b=m,p=po(b);for(;p&&r&&h!==b;){const g=Qn(p),y=p.getBoundingClientRect(),v=ht(p),x=y.left+(p.clientLeft+parseFloat(v.paddingLeft))*g.x,_=y.top+(p.clientTop+parseFloat(v.paddingTop))*g.y;c*=g.x,l*=g.y,d*=g.x,f*=g.y,c+=x,l+=_,b=et(p),p=po(b)}}return Us({width:d,height:f,x:c,y:l})}function li(e,t){const n=ci(e).scrollLeft;return t?t.left+n:Rn(At(e)).left+n}function gd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-li(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function ty(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=At(r),a=t?ai(t.floating):!1;if(r===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},l=kt(1);const d=kt(0),f=Ut(r);if((f||!f&&!i)&&((Er(r)!=="body"||Qr(o))&&(c=ci(r)),f)){const h=Rn(r);l=Qn(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const m=o&&!f&&!i?gd(o,c):kt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x+m.x,y:n.y*l.y-c.scrollTop*l.y+d.y+m.y}}function ny(e){return Array.from(e.getClientRects())}function ry(e){const t=At(e),n=ci(e),r=e.ownerDocument.body,s=Je(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Je(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+li(e);const a=-n.scrollTop;return ht(r).direction==="rtl"&&(o+=Je(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const Mc=25;function sy(e,t){const n=et(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 d=ha();(!d||d&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const l=li(r);if(l<=0){const d=r.ownerDocument,f=d.body,m=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(r.clientWidth-f.clientWidth-h);b<=Mc&&(i-=b)}else l<=Mc&&(i+=l);return{width:i,height:o,x:a,y:c}}function iy(e,t){const n=Rn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ut(e)?Qn(e):kt(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,c=s*i.x,l=r*i.y;return{width:o,height:a,x:c,y:l}}function Ic(e,t,n){let r;if(t==="viewport")r=sy(e,n);else if(t==="document")r=ry(At(e));else if(pt(t))r=iy(t,n);else{const s=md(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Us(r)}function yd(e,t){const n=rn(e);return n===t||!pt(n)||hr(n)?!1:ht(n).position==="fixed"||yd(n,t)}function oy(e,t){const n=t.get(e);if(n)return n;let r=Ur(e,[],!1).filter(a=>pt(a)&&Er(a)!=="body"),s=null;const i=ht(e).position==="fixed";let o=i?rn(e):e;for(;pt(o)&&!hr(o);){const a=ht(o),c=pa(o);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Qr(o)&&!c&&yd(e,o))?r=r.filter(d=>d!==o):s=a,o=rn(o)}return t.set(e,r),r}function ay(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?ai(t)?[]:oy(t,this._c):[].concat(n),r],a=Ic(t,o[0],s);let c=a.top,l=a.right,d=a.bottom,f=a.left;for(let m=1;m<o.length;m++){const h=Ic(t,o[m],s);c=Je(h.top,c),l=nn(h.right,l),d=nn(h.bottom,d),f=Je(h.left,f)}return{width:l-f,height:d-c,x:f,y:c}}function cy(e){const{width:t,height:n}=hd(e);return{width:t,height:n}}function ly(e,t,n){const r=Ut(t),s=At(t),i=n==="fixed",o=Rn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=kt(0);function l(){c.x=li(s)}if(r||!r&&!i)if((Er(t)!=="body"||Qr(s))&&(a=ci(t)),r){const h=Rn(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&l();i&&!r&&s&&l();const d=s&&!r&&!i?gd(s,a):kt(0),f=o.left+a.scrollLeft-c.x-d.x,m=o.top+a.scrollTop-c.y-d.y;return{x:f,y:m,width:o.width,height:o.height}}function Bi(e){return ht(e).position==="static"}function Uc(e,t){if(!Ut(e)||ht(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return At(e)===n&&(n=n.ownerDocument.body),n}function bd(e,t){const n=et(e);if(ai(e))return n;if(!Ut(e)){let s=rn(e);for(;s&&!hr(s);){if(pt(s)&&!Bi(s))return s;s=rn(s)}return n}let r=Uc(e,t);for(;r&&Zg(r)&&Bi(r);)r=Uc(r,t);return r&&hr(r)&&Bi(r)&&!pa(r)?n:r||Xg(e)||n}const uy=async function(e){const t=this.getOffsetParent||bd,n=this.getDimensions,r=await n(e.floating);return{reference:ly(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dy(e){return ht(e).direction==="rtl"}const fy={convertOffsetParentRelativeRectToViewportRelativeRect:ty,getDocumentElement:At,getClippingRect:ay,getOffsetParent:bd,getElementRects:uy,getClientRects:ny,getDimensions:cy,getScale:Qn,isElement:pt,isRTL:dy};function vd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function py(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 l=e.getBoundingClientRect(),{left:d,top:f,width:m,height:h}=l;if(a||t(),!m||!h)return;const b=ps(f),p=ps(s.clientWidth-(d+m)),g=ps(s.clientHeight-(f+h)),y=ps(d),x={rootMargin:-b+"px "+-p+"px "+-g+"px "+-y+"px",threshold:Je(0,nn(1,c))||1};let _=!0;function E(P){const k=P[0].intersectionRatio;if(k!==c){if(!_)return o();k?o(!1,k):r=setTimeout(()=>{o(!1,1e-7)},1e3)}k===1&&!vd(l,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(E,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(e)}return o(!0),i}function hy(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,l=ma(e),d=s||i?[...l?Ur(l):[],...t?Ur(t):[]]:[];d.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const f=l&&a?py(l,n):null;let m=-1,h=null;o&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===l&&h&&t&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(t)})),n()}),l&&!c&&h.observe(l),t&&h.observe(t));let b,p=c?Rn(e):null;c&&g();function g(){const y=Rn(e);p&&!vd(p,y)&&n(),p=y,b=requestAnimationFrame(g)}return n(),()=>{var y;d.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(b)}}const my=Wg,gy=Gg,yy=Vg,by=Kg,vy=Hg,Fc=$g,wy=qg,_y=(e,t,n)=>{const r=new Map,s={platform:fy,...n},i={...s.platform,_c:r};return Bg(e,t,{...s,platform:i})};var xy=typeof document<"u",Sy=function(){},Ts=xy?C.useLayoutEffect:Sy;function Fs(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(!Fs(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)&&!Fs(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function wd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bc(e,t){const n=wd(e);return Math.round(t*n)/n}function $i(e){const t=w.useRef(e);return Ts(()=>{t.current=e}),t}function Cy(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:l}=e,[d,f]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=w.useState(r);Fs(m,r)||h(r);const[b,p]=w.useState(null),[g,y]=w.useState(null),v=w.useCallback(N=>{N!==P.current&&(P.current=N,p(N))},[]),x=w.useCallback(N=>{N!==k.current&&(k.current=N,y(N))},[]),_=i||b,E=o||g,P=w.useRef(null),k=w.useRef(null),O=w.useRef(d),R=c!=null,A=$i(c),L=$i(s),D=$i(l),B=w.useCallback(()=>{if(!P.current||!k.current)return;const N={placement:t,strategy:n,middleware:m};L.current&&(N.platform=L.current),_y(P.current,k.current,N).then(F=>{const M={...F,isPositioned:D.current!==!1};U.current&&!Fs(O.current,M)&&(O.current=M,Yr.flushSync(()=>{f(M)}))})},[m,t,n,L,D]);Ts(()=>{l===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(N=>({...N,isPositioned:!1})))},[l]);const U=w.useRef(!1);Ts(()=>(U.current=!0,()=>{U.current=!1}),[]),Ts(()=>{if(_&&(P.current=_),E&&(k.current=E),_&&E){if(A.current)return A.current(_,E,B);B()}},[_,E,B,A,R]);const W=w.useMemo(()=>({reference:P,floating:k,setReference:v,setFloating:x}),[v,x]),z=w.useMemo(()=>({reference:_,floating:E}),[_,E]),j=w.useMemo(()=>{const N={position:n,left:0,top:0};if(!z.floating)return N;const F=Bc(z.floating,d.x),M=Bc(z.floating,d.y);return a?{...N,transform:"translate("+F+"px, "+M+"px)",...wd(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:M}},[n,a,z.floating,d.x,d.y]);return w.useMemo(()=>({...d,update:B,refs:W,elements:z,floatingStyles:j}),[d,B,W,z,j])}const Ey=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?Fc({element:r.current,padding:s}).fn(n):{}:r?Fc({element:r,padding:s}).fn(n):{}}}},Ty=(e,t)=>{const n=my(e);return{name:n.name,fn:n.fn,options:[e,t]}},Py=(e,t)=>{const n=gy(e);return{name:n.name,fn:n.fn,options:[e,t]}},ky=(e,t)=>({fn:wy(e).fn,options:[e,t]}),Oy=(e,t)=>{const n=yy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ay=(e,t)=>{const n=by(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ry=(e,t)=>{const n=vy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ny=(e,t)=>{const n=Ey(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Dy="Arrow",_d=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return u.jsx(ve.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});_d.displayName=Dy;var Ly=_d;function jy(e){const[t,n]=w.useState(void 0);return Ue(()=>{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,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ga="Popper",[xd,Sd]=xr(ga),[My,Cd]=xd(ga),Ed=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return u.jsx(My,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};Ed.displayName=ga;var Td="PopperAnchor",Pd=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=Cd(Td,n),o=w.useRef(null),a=i.onAnchorChange,c=w.useCallback(b=>{o.current=b,b&&a(b)},[a]),l=ke(t,c),d=w.useRef(null);w.useEffect(()=>{if(!r)return;const b=d.current;d.current=r.current,b!==d.current&&a(d.current)});const f=i.placementState&&ba(i.placementState),m=f==null?void 0:f[0],h=f==null?void 0:f[1];return r?null:u.jsx(ve.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...s,ref:l})});Pd.displayName=Td;var ya="PopperContent",[Iy,Uy]=xd(ya),kd=w.forwardRef((e,t)=>{var ue,me,ge,ie,te,je;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:b,...p}=e,g=Cd(ya,n),[y,v]=w.useState(null),x=ke(t,Pe=>v(Pe)),[_,E]=w.useState(null),P=jy(_),k=(P==null?void 0:P.width)??0,O=(P==null?void 0:P.height)??0,R=r+(i!=="center"?"-"+i:""),A=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},L=Array.isArray(l)?l:[l],D=L.length>0,B={padding:A,boundary:L.filter(By),altBoundary:D},{refs:U,floatingStyles:W,placement:z,isPositioned:j,middlewareData:N}=Cy({strategy:"fixed",placement:R,whileElementsMounted:(...Pe)=>hy(...Pe,{animationFrame:h==="always"}),elements:{reference:g.anchor},middleware:[Ty({mainAxis:s+O,alignmentAxis:o}),c&&Py({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?ky():void 0,...B}),c&&Oy({...B}),Ay({...B,apply:({elements:Pe,rects:Ce,availableWidth:X,availableHeight:Ee})=>{const{width:Me,height:We}=Ce.reference,at=Pe.floating.style;at.setProperty("--radix-popper-available-width",`${X}px`),at.setProperty("--radix-popper-available-height",`${Ee}px`),at.setProperty("--radix-popper-anchor-width",`${Me}px`),at.setProperty("--radix-popper-anchor-height",`${We}px`)}}),_&&Ny({element:_,padding:a}),$y({arrowWidth:k,arrowHeight:O}),m&&Ry({strategy:"referenceHidden",...B,boundary:D?B.boundary:void 0})]}),F=g.setPlacementState;Ue(()=>(F(z),()=>{F(void 0)}),[z,F]);const[M,Y]=ba(z),se=An(b);Ue(()=>{j&&(se==null||se())},[j,se]);const le=(ue=N.arrow)==null?void 0:ue.x,oe=(me=N.arrow)==null?void 0:me.y,Re=((ge=N.arrow)==null?void 0:ge.centerOffset)!==0,[Z,K]=w.useState();return Ue(()=>{y&&K(window.getComputedStyle(y).zIndex)},[y]),u.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:j?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[(ie=N.transformOrigin)==null?void 0:ie.x,(te=N.transformOrigin)==null?void 0:te.y].join(" "),...((je=N.hide)==null?void 0:je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(Iy,{scope:n,placedSide:M,placedAlign:Y,onArrowChange:E,arrowX:le,arrowY:oe,shouldHideArrow:Re,children:u.jsx(ve.div,{"data-side":M,"data-align":Y,...p,ref:x,style:{...p.style,animation:j?void 0:"none"}})})})});kd.displayName=ya;var Od="PopperArrow",Fy={top:"bottom",right:"left",bottom:"top",left:"right"},Ad=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Uy(Od,r),o=Fy[i.placedSide];return u.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:u.jsx(Ly,{...s,ref:n,style:{...s.style,display:"block"}})})});Ad.displayName=Od;function By(e){return e!==null}var $y=e=>({name:"transformOrigin",options:e,fn(t){var g,y,v;const{placement:n,rects:r,middlewareData:s}=t,o=((g=s.arrow)==null?void 0:g.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[l,d]=ba(n),f={start:"0%",center:"50%",end:"100%"}[d],m=(((y=s.arrow)==null?void 0:y.x)??0)+a/2,h=(((v=s.arrow)==null?void 0:v.y)??0)+c/2;let b="",p="";return l==="bottom"?(b=o?f:`${m}px`,p=`${-c}px`):l==="top"?(b=o?f:`${m}px`,p=`${r.floating.height+c}px`):l==="right"?(b=`${-c}px`,p=o?f:`${h}px`):l==="left"&&(b=`${r.floating.width+c}px`,p=o?f:`${h}px`),{data:{x:b,y:p}}}});function ba(e){const[t,n="center"]=e.split("-");return[t,n]}var Vy=Ed,Hy=Pd,zy=kd,Wy=Ad;function Gy(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 Rd=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"}),qy="VisuallyHidden",Ky=w.forwardRef((e,t)=>u.jsx(ve.span,{...e,ref:t,style:{...Rd,...e.style}}));Ky.displayName=qy;var Zy=[" ","Enter","ArrowUp","ArrowDown"],Yy=[" ","Enter"],Nn="Select",[ui,di,Qy]=cd(Nn),[Fn]=xr(Nn,[Qy,Sd]),fi=Sd(),[Xy,cn]=Fn(Nn),[Jy,eb]=Fn(Nn),tb="SelectProvider";function Nd(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:l,name:d,autoComplete:f,disabled:m,required:h,form:b,internal_do_not_use_render:p}=e,g=fi(t),[y,v]=w.useState(null),[x,_]=w.useState(null),[E,P]=w.useState(!1),k=ld(l),[O,R]=fr({prop:r,defaultProp:s??!1,onChange:i,caller:Nn}),[A,L]=fr({prop:o,defaultProp:a,onChange:c,caller:Nn}),D=w.useRef(null),B=y?!!b||!!y.closest("form"):!0,[U,W]=w.useState(new Set),z=Jt(),j=Array.from(U).map(Y=>Y.props.value).join(";"),N=w.useCallback(Y=>{W(se=>new Set(se).add(Y))},[]),F=w.useCallback(Y=>{W(se=>{const le=new Set(se);return le.delete(Y),le})},[]),M={required:h,trigger:y,onTriggerChange:v,valueNode:x,onValueNodeChange:_,valueNodeHasChildren:E,onValueNodeHasChildrenChange:P,contentId:z,value:A,onValueChange:L,open:O,onOpenChange:R,dir:k,triggerPointerDownPosRef:D,disabled:m,name:d,autoComplete:f,form:b,nativeOptions:U,nativeSelectKey:j,isFormControl:B};return u.jsx(Vy,{...g,children:u.jsx(Xy,{scope:t,...M,children:u.jsx(ui.Provider,{scope:t,children:u.jsx(Jy,{scope:t,onNativeOptionAdd:N,onNativeOptionRemove:F,children:gb(p)?p(M):n})})})})}Nd.displayName=tb;var Dd=e=>{const{__scopeSelect:t,children:n,...r}=e;return u.jsx(Nd,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>u.jsxs(u.Fragment,{children:[n,s?u.jsx(ef,{__scopeSelect:t}):null]})})};Dd.displayName=Nn;var Ld="SelectTrigger",va=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=fi(n),o=cn(Ld,n),a=o.disabled||r,c=ke(t,o.onTriggerChange),l=di(n),d=w.useRef("touch"),[f,m,h]=tf(p=>{const g=l().filter(x=>!x.disabled),y=g.find(x=>x.value===o.value),v=nf(g,p,y);v!==void 0&&o.onValueChange(v.value)}),b=p=>{a||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return u.jsx(Hy,{asChild:!0,...i,children:u.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":pi(o.value)?"":void 0,...s,ref:c,onClick:xe(s.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&b(p)}),onPointerDown:xe(s.onPointerDown,p=>{d.current=p.pointerType;const g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(b(p),p.preventDefault())}),onKeyDown:xe(s.onKeyDown,p=>{const g=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(g&&p.key===" ")&&Zy.includes(p.key)&&(b(),p.preventDefault())})})})});va.displayName=Ld;var jd="SelectValue",Md=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,c=cn(jd,n),{onValueNodeHasChildrenChange:l}=c,d=i!==void 0,f=ke(t,c.onValueNodeChange);Ue(()=>{l(d)},[l,d]);const m=pi(c.value);return u.jsx(ve.span,{...a,asChild:m?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:u.jsx(w.Fragment,{children:m?o:i},m?"placeholder":"value")})});Md.displayName=jd;var nb="SelectIcon",Id=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return u.jsx(ve.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Id.displayName=nb;var Ud="SelectPortal",[rb,sb]=Fn(Ud,{forceMount:void 0}),Fd=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return u.jsx(rb,{scope:e.__scopeSelect,forceMount:n,children:u.jsx(na,{asChild:!0,...r})})};Fd.displayName=Ud;var sn="SelectContent",wa=w.forwardRef((e,t)=>{const n=sb(sn,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=cn(sn,e.__scopeSelect),[o,a]=w.useState();return Ue(()=>{a(new DocumentFragment)},[]),u.jsx(Sr,{present:r||i.open,children:({present:c})=>c?u.jsx(Vd,{...s,ref:t}):u.jsx(Bd,{...s,fragment:o})})});wa.displayName=sn;var Bd=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Yr.createPortal(u.jsx($d,{scope:n,children:u.jsx(ui.Slot,{scope:n,children:u.jsx("div",{ref:t,children:r})})}),s):null});Bd.displayName="SelectContentFragment";var lt=10,[$d,ln]=Fn(sn),ib="SelectContentImpl",ob=dr("SelectContent.RemoveScroll"),Vd=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:b,hideWhenDetached:p,avoidCollisions:g,...y}=e,v=cn(sn,n),[x,_]=w.useState(null),[E,P]=w.useState(null),k=ke(t,K=>_(K)),[O,R]=w.useState(null),[A,L]=w.useState(null),D=di(n),[B,U]=w.useState(!1),W=w.useRef(!1);w.useEffect(()=>{if(x)return Gu(x)},[x]),Iu();const z=w.useCallback(K=>{const[ue,...me]=D().map(te=>te.ref.current),[ge]=me.slice(-1),ie=document.activeElement;for(const te of K)if(te===ie||(te==null||te.scrollIntoView({block:"nearest"}),te===ue&&E&&(E.scrollTop=0),te===ge&&E&&(E.scrollTop=E.scrollHeight),te==null||te.focus(),document.activeElement!==ie))return},[D,E]),j=w.useCallback(()=>z([O,x]),[z,O,x]);w.useEffect(()=>{B&&j()},[B,j]);const{onOpenChange:N,triggerPointerDownPosRef:F}=v;w.useEffect(()=>{if(x){let K={x:0,y:0};const ue=ge=>{var ie,te;K={x:Math.abs(Math.round(ge.pageX)-(((ie=F.current)==null?void 0:ie.x)??0)),y:Math.abs(Math.round(ge.pageY)-(((te=F.current)==null?void 0:te.y)??0))}},me=ge=>{K.x<=10&&K.y<=10?ge.preventDefault():ge.composedPath().includes(x)||N(!1),document.removeEventListener("pointermove",ue),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",me,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",me,{capture:!0})}}},[x,N,F]),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[M,Y]=tf(K=>{const ue=D().filter(ie=>!ie.disabled),me=ue.find(ie=>ie.ref.current===document.activeElement),ge=nf(ue,K,me);ge&&setTimeout(()=>{var ie;return(ie=ge.ref.current)==null?void 0:ie.focus()})}),se=w.useCallback((K,ue,me)=>{const ge=!W.current&&!me;(v.value!==void 0&&v.value===ue||ge)&&(R(K),ge&&(W.current=!0))},[v.value]),le=w.useCallback(()=>x==null?void 0:x.focus(),[x]),oe=w.useCallback((K,ue,me)=>{const ge=!W.current&&!me;(v.value!==void 0&&v.value===ue||ge)&&L(K)},[v.value]),Re=r==="popper"?ho:Hd,Z=Re===ho?{side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:b,hideWhenDetached:p,avoidCollisions:g}:{};return u.jsx($d,{scope:n,content:x,viewport:E,onViewportChange:P,itemRefCallback:se,selectedItem:O,onItemLeave:le,itemTextRefCallback:oe,focusSelectedItem:j,selectedItemText:A,position:r,isPositioned:B,searchRef:M,children:u.jsx(ra,{as:ob,allowPinchZoom:!0,children:u.jsx(ta,{asChild:!0,trapped:v.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:xe(s,K=>{var ue;(ue=v.trigger)==null||ue.focus({preventScroll:!0}),K.preventDefault()}),children:u.jsx(ea,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:u.jsx(Re,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:K=>K.preventDefault(),...y,...Z,onPlaced:()=>U(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:xe(y.onKeyDown,K=>{const ue=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!ue&&K.key.length===1&&Y(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ge=D().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ge=ge.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const ie=K.target,te=ge.indexOf(ie);ge=ge.slice(te+1)}setTimeout(()=>z(ge)),K.preventDefault()}})})})})})})});Vd.displayName=ib;var ab="SelectItemAlignedPosition",Hd=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=cn(sn,n),o=ln(sn,n),[a,c]=w.useState(null),[l,d]=w.useState(null),f=ke(t,k=>d(k)),m=di(n),h=w.useRef(!1),b=w.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:y,focusSelectedItem:v}=o,x=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&l&&p&&g&&y){const k=i.trigger.getBoundingClientRect(),O=l.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),A=y.getBoundingClientRect();if(i.dir!=="rtl"){const ie=A.left-O.left,te=R.left-ie,je=k.left-te,Pe=k.width+je,Ce=Math.max(Pe,O.width),X=window.innerWidth-lt,Ee=Oc(te,[lt,Math.max(lt,X-Ce)]);a.style.minWidth=Pe+"px",a.style.left=Ee+"px"}else{const ie=O.right-A.right,te=window.innerWidth-R.right-ie,je=window.innerWidth-k.right-te,Pe=k.width+je,Ce=Math.max(Pe,O.width),X=window.innerWidth-lt,Ee=Oc(te,[lt,Math.max(lt,X-Ce)]);a.style.minWidth=Pe+"px",a.style.right=Ee+"px"}const L=m(),D=window.innerHeight-lt*2,B=p.scrollHeight,U=window.getComputedStyle(l),W=parseInt(U.borderTopWidth,10),z=parseInt(U.paddingTop,10),j=parseInt(U.borderBottomWidth,10),N=parseInt(U.paddingBottom,10),F=W+z+B+N+j,M=Math.min(g.offsetHeight*5,F),Y=window.getComputedStyle(p),se=parseInt(Y.paddingTop,10),le=parseInt(Y.paddingBottom,10),oe=k.top+k.height/2-lt,Re=D-oe,Z=g.offsetHeight/2,K=g.offsetTop+Z,ue=W+z+K,me=F-ue;if(ue<=oe){const ie=L.length>0&&g===L[L.length-1].ref.current;a.style.bottom="0px";const te=l.clientHeight-p.offsetTop-p.offsetHeight,je=Math.max(Re,Z+(ie?le:0)+te+j),Pe=ue+je;a.style.height=Pe+"px"}else{const ie=L.length>0&&g===L[0].ref.current;a.style.top="0px";const je=Math.max(oe,W+p.offsetTop+(ie?se:0)+Z)+me;a.style.height=je+"px",p.scrollTop=ue-oe+p.offsetTop}a.style.margin=`${lt}px 0`,a.style.minHeight=M+"px",a.style.maxHeight=D+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,a,l,p,g,y,i.dir,r]);Ue(()=>x(),[x]);const[_,E]=w.useState();Ue(()=>{l&&E(window.getComputedStyle(l).zIndex)},[l]);const P=w.useCallback(k=>{k&&b.current===!0&&(x(),v==null||v(),b.current=!1)},[x,v]);return u.jsx(lb,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:P,children:u.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:u.jsx(ve.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Hd.displayName=ab;var cb="SelectPopperPosition",ho=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=lt,...i}=e,o=fi(n);return u.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)"}})});ho.displayName=cb;var[lb,_a]=Fn(sn,{}),mo="SelectViewport",zd=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=ln(mo,n),o=_a(mo,n),a=ke(t,i.onViewportChange),c=w.useRef(0);return u.jsxs(u.Fragment,{children:[u.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}),u.jsx(ui.Slot,{scope:n,children:u.jsx(ve.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:xe(s.onScroll,l=>{const d=l.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const h=Math.abs(c.current-d.scrollTop);if(h>0){const b=window.innerHeight-lt*2,p=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),y=Math.max(p,g);if(y<b){const v=y+h,x=Math.min(b,v),_=v-x;f.style.height=x+"px",f.style.bottom==="0px"&&(d.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});zd.displayName=mo;var Wd="SelectGroup",[ub,db]=Fn(Wd),fb=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Jt();return u.jsx(ub,{scope:n,id:s,children:u.jsx(ve.div,{role:"group","aria-labelledby":s,...r,ref:t})})});fb.displayName=Wd;var Gd="SelectLabel",xa=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=db(Gd,n);return u.jsx(ve.div,{id:s.id,...r,ref:t})});xa.displayName=Gd;var Bs="SelectItem",[pb,qd]=Fn(Bs),Sa=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=cn(Bs,n),c=ln(Bs,n),l=a.value===r,[d,f]=w.useState(i??""),[m,h]=w.useState(!1),b=ke(t,v=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,v,r,s)}),p=Jt(),g=w.useRef("touch"),y=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return u.jsx(pb,{scope:n,value:r,disabled:s,textId:p,isSelected:l,onItemTextChange:w.useCallback(v=>{f(x=>x||((v==null?void 0:v.textContent)??"").trim())},[]),children:u.jsx(ui.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:u.jsx(ve.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":l&&m,"data-state":l?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:b,onFocus:xe(o.onFocus,()=>h(!0)),onBlur:xe(o.onBlur,()=>h(!1)),onClick:xe(o.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:xe(o.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:xe(o.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:xe(o.onPointerMove,v=>{var x;g.current=v.pointerType,s?(x=c.onItemLeave)==null||x.call(c):g.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xe(o.onPointerLeave,v=>{var x;v.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:xe(o.onKeyDown,v=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&v.key===" "||(Yy.includes(v.key)&&y(),v.key===" "&&v.preventDefault())})})})})});Sa.displayName=Bs;var jr="SelectItemText",Kd=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=cn(jr,n),a=ln(jr,n),c=qd(jr,n),l=eb(jr,n),[d,f]=w.useState(null),m=ke(t,y=>f(y),c.onItemTextChange,y=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,y,c.value,c.disabled)}),h=d==null?void 0:d.textContent,b=w.useMemo(()=>u.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=l;return Ue(()=>(p(b),()=>g(b)),[p,g,b]),u.jsxs(u.Fragment,{children:[u.jsx(ve.span,{id:c.textId,...i,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!pi(o.value)?Yr.createPortal(i.children,o.valueNode):null]})});Kd.displayName=jr;var Zd="SelectItemIndicator",Yd=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return qd(Zd,n).isSelected?u.jsx(ve.span,{"aria-hidden":!0,...r,ref:t}):null});Yd.displayName=Zd;var go="SelectScrollUpButton",Ca=w.forwardRef((e,t)=>{const n=ln(go,e.__scopeSelect),r=_a(go,e.__scopeSelect),[s,i]=w.useState(!1),o=ke(t,r.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollTop>0;i(l)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?u.jsx(Qd,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});Ca.displayName=go;var yo="SelectScrollDownButton",Ea=w.forwardRef((e,t)=>{const n=ln(yo,e.__scopeSelect),r=_a(yo,e.__scopeSelect),[s,i]=w.useState(!1),o=ke(t,r.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<l;i(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?u.jsx(Qd,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});Ea.displayName=yo;var Qd=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=ln("SelectScrollButton",n),o=w.useRef(null),a=di(n),c=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>c(),[c]),Ue(()=>{var d;const l=a().find(f=>f.ref.current===document.activeElement);(d=l==null?void 0:l.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),u.jsx(ve.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:xe(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:xe(s.onPointerMove,()=>{var l;(l=i.onItemLeave)==null||l.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:xe(s.onPointerLeave,()=>{c()})})}),hb="SelectSeparator",Ta=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return u.jsx(ve.div,{"aria-hidden":!0,...r,ref:t})});Ta.displayName=hb;var Xd="SelectArrow",mb=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=fi(n);return ln(Xd,n).position==="popper"?u.jsx(Wy,{...s,...r,ref:t}):null});mb.displayName=Xd;var Jd="SelectBubbleInput",ef=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=cn(Jd,e),{value:s,onValueChange:i,required:o,disabled:a,name:c,autoComplete:l,form:d}=r,{nativeOptions:f,nativeSelectKey:m}=r,h=w.useRef(null),b=ke(n,h),p=s??"",g=Gy(p),y=Array.from(f).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=h.current;if(!v)return;const x=window.HTMLSelectElement.prototype,E=Object.getOwnPropertyDescriptor(x,"value").set;if(g!==p&&E){const P=new Event("change",{bubbles:!0});E.call(v,p),v.dispatchEvent(P)}},[g,p]),u.jsxs(ve.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:a,form:d,onChange:v=>i(v.target.value),...t,style:{...Rd,...t.style},ref:b,defaultValue:p,children:[pi(s)&&!y?u.jsx("option",{value:""}):null,Array.from(f)]},m)});ef.displayName=Jd;function gb(e){return typeof e=="function"}function pi(e){return e===""||e===void 0}function tf(e){const t=An(e),n=w.useRef(""),r=w.useRef(0),s=w.useCallback(o=>{const a=n.current+o;t(a),(function c(l){n.current=l,window.clearTimeout(r.current),l!==""&&(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 nf(e,t,n){const s=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=yb(e,Math.max(i,0));s.length===1&&(o=o.filter(l=>l!==n));const c=o.find(l=>l.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function yb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Pa(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 bb=["color"],vb=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Pa(e,bb);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),wb=["color"],ka=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Pa(e,wb);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),_b=["color"],xb=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Pa(e,_b);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const bo=Dd,vo=Md,$s=w.forwardRef(({className:e,children:t,...n},r)=>u.jsxs(va,{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,u.jsx(Id,{asChild:!0,children:u.jsx(ka,{className:"h-4 w-4 opacity-50"})})]}));$s.displayName=va.displayName;const rf=w.forwardRef(({className:e,...t},n)=>u.jsx(Ca,{ref:n,className:De("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(xb,{className:"h-4 w-4"})}));rf.displayName=Ca.displayName;const sf=w.forwardRef(({className:e,...t},n)=>u.jsx(Ea,{ref:n,className:De("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(ka,{className:"h-4 w-4"})}));sf.displayName=Ea.displayName;const Vs=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>u.jsx(Fd,{children:u.jsxs(wa,{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:[u.jsx(rf,{}),u.jsx(zd,{className:De("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),u.jsx(sf,{})]})}));Vs.displayName=wa.displayName;const Sb=w.forwardRef(({className:e,...t},n)=>u.jsx(xa,{ref:n,className:De("px-2 py-1.5 text-sm font-semibold",e),...t}));Sb.displayName=xa.displayName;const Hs=w.forwardRef(({className:e,children:t,...n},r)=>u.jsxs(Sa,{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:[u.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(Yd,{children:u.jsx(vb,{className:"h-4 w-4"})})}),u.jsx(Kd,{children:t})]}));Hs.displayName=Sa.displayName;const Cb=w.forwardRef(({className:e,...t},n)=>u.jsx(Ta,{ref:n,className:De("-mx-1 my-1 h-px bg-muted",e),...t}));Cb.displayName=Ta.displayName;function of({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r}){var c;const[s,i]=C.useState(""),o=s||((c=n[0])==null?void 0:c.login)||"",a=!t&&n.length>0&&o!=="";return u.jsx(Tg,{open:e,children:u.jsxs(rd,{className:"web-trading-widget-account-modal",onPointerDownOutside:l=>l.preventDefault(),onEscapeKeyDown:l=>l.preventDefault(),children:[u.jsxs(sd,{children:[u.jsx(od,{children:"Select trading account"}),u.jsx(ad,{children:"Choose an account to continue trading on the chart."})]}),t?u.jsx("p",{className:"web-trading-widget-account-modal__loading",children:"Loading accounts…"}):n.length===0?u.jsx("p",{className:"web-trading-widget-account-modal__error",children:"No trading accounts available."}):u.jsxs(bo,{value:o,onValueChange:i,children:[u.jsx($s,{className:"web-trading-widget-account-modal__select",children:u.jsx(vo,{placeholder:"Select account"})}),u.jsx(Vs,{children:n.map(l=>u.jsxs(Hs,{value:l.login,children:[l.label," (",l.balance.toFixed(2)," ",l.currency,")"]},l.login))})]}),u.jsx(id,{children:u.jsx(Pt,{type:"button",disabled:!a,onClick:()=>r(o),children:"Continue"})})]})})}var Eb={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 Tb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),it=(e,t)=>{const n=C.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...c},l)=>C.createElement("svg",{ref:l,...Eb,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${Tb(e)}`,...c},[...t.map(([d,f])=>C.createElement(d,f)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},af=it("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Pb=it("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),kb=it("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Ob=it("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),cf=it("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"}]]),lf=it("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"}]]),Ab=it("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"}]]),Rb=it("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]),uf=it("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"}]]),Nb=it("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Db=it("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),un=it("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Ze={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:Ze.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:Ze.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:Ze.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:Ze.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:Ze.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:Ze.SELL_STOP_LIMIT,isMarket:!1}];function hi(e){return zs.find(t=>t.mode===e)??zs[0]}function mi(e){return hi(e).isMarket}function df(e,t){const n=hi(e);return n.orderType!==null?n.orderType:t==="buy"?Ze.BUY:Ze.SELL}function Ws(e){return e%2===1?"sell":"buy"}function Oa(e){return e>=Ze.BUY_LIMIT&&e<=Ze.SELL_STOP_LIMIT}function Aa(e){return e===Ze.BUY_STOP_LIMIT||e===Ze.SELL_STOP_LIMIT}function ff(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const dt={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},pf=[{value:dt.GTC,label:"GTC"},{value:dt.TODAY,label:"Today"},{value:dt.SPECIFIED,label:"Specified"},{value:dt.SPECIFIED_DAY,label:"Specified Day"}];function Ra(e){return e===dt.SPECIFIED}function Na(e){return e===dt.SPECIFIED_DAY}function Lb(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function jb(e,t){var n;return((n=e[0])==null?void 0:n.login)??""}function hf(e,t=In){return t.find(n=>n.ticker===e)}function Tr(e,t=In){const n=hf(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function dn(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function fn(e,t=In){const n=hf(e,t);return(n==null?void 0:n.pricescale)??1e5}function Te(e,t){return e.toFixed(t)}function Pr(e){return 1/10**e}function mf(e,t){return e===null||t===null?null:(e+t)/2}function ft(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function gf(e,t,n){if(Ra(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(Na(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function gi(e,t,n){return e===dt.GTC||e===dt.TODAY?!0:gf(e,t,n)!==void 0}const Mb={},$c=e=>{let t;const n=new Set,r=(d,f)=>{const m=typeof d=="function"?d(t):d;if(!Object.is(m,t)){const h=t;t=f??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Mb?"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()}},l=t=e(r,s,c);return c},Ib=e=>e?$c(e):$c;function Ub(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hs={exports:{}},Vi={},ms={exports:{}},Hi={};/**
|
|
42
|
+
* @license React
|
|
43
|
+
* use-sync-external-store-shim.production.js
|
|
44
|
+
*
|
|
45
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
46
|
+
*
|
|
47
|
+
* This source code is licensed under the MIT license found in the
|
|
48
|
+
* LICENSE file in the root directory of this source tree.
|
|
49
|
+
*/var Vc;function Fb(){if(Vc)return Hi;Vc=1;var e=C;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(),b=r({inst:{value:h,getSnapshot:m}}),p=b[0].inst,g=b[1];return i(function(){p.value=h,p.getSnapshot=m,c(p)&&g({inst:p})},[f,h,m]),s(function(){return c(p)&&g({inst:p}),f(function(){c(p)&&g({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 l(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Hi.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Hi}var zi={};/**
|
|
50
|
+
* @license React
|
|
51
|
+
* use-sync-external-store-shim.development.js
|
|
52
|
+
*
|
|
53
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the MIT license found in the
|
|
56
|
+
* LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/var Hc;function Bb(){return Hc||(Hc=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,b){return h===b&&(h!==0||1/h===1/b)||h!==h&&b!==b}function t(h,b){d||s.startTransition===void 0||(d=!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=b();if(!f){var g=b();i(p,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}g=o({inst:{value:p,getSnapshot:b}});var y=g[0].inst,v=g[1];return c(function(){y.value=p,y.getSnapshot=b,n(y)&&v({inst:y})},[h,p,b]),a(function(){return n(y)&&v({inst:y}),h(function(){n(y)&&v({inst:y})})},[h]),l(p),p}function n(h){var b=h.getSnapshot;h=h.value;try{var p=b();return!i(h,p)}catch{return!0}}function r(h,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=C,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,l=s.useDebugValue,d=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;zi.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())})()),zi}var zc;function yf(){return zc||(zc=1,process.env.NODE_ENV==="production"?ms.exports=Fb():ms.exports=Bb()),ms.exports}/**
|
|
58
|
+
* @license React
|
|
59
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
60
|
+
*
|
|
61
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the MIT license found in the
|
|
64
|
+
* LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/var Wc;function $b(){if(Wc)return Vi;Wc=1;var e=C,t=yf();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}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 Vi.useSyncExternalStoreWithSelector=function(l,d,f,m,h){var b=i(null);if(b.current===null){var p={hasValue:!1,value:null};b.current=p}else p=b.current;b=a(function(){function y(P){if(!v){if(v=!0,x=P,P=m(P),h!==void 0&&p.hasValue){var k=p.value;if(h(k,P))return _=k}return _=P}if(k=_,r(x,P))return k;var O=m(P);return h!==void 0&&h(k,O)?(x=P,k):(x=P,_=O)}var v=!1,x,_,E=f===void 0?null:f;return[function(){return y(d())},E===null?void 0:function(){return y(E())}]},[d,f,m,h]);var g=s(l,b[0],b[1]);return o(function(){p.hasValue=!0,p.value=g},[g]),c(g),g},Vi}var Wi={};/**
|
|
66
|
+
* @license React
|
|
67
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
68
|
+
*
|
|
69
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
70
|
+
*
|
|
71
|
+
* This source code is licensed under the MIT license found in the
|
|
72
|
+
* LICENSE file in the root directory of this source tree.
|
|
73
|
+
*/var Gc;function Vb(){return Gc||(Gc=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=C,n=yf(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Wi.useSyncExternalStoreWithSelector=function(l,d,f,m,h){var b=i(null);if(b.current===null){var p={hasValue:!1,value:null};b.current=p}else p=b.current;b=a(function(){function y(P){if(!v){if(v=!0,x=P,P=m(P),h!==void 0&&p.hasValue){var k=p.value;if(h(k,P))return _=k}return _=P}if(k=_,r(x,P))return k;var O=m(P);return h!==void 0&&h(k,O)?(x=P,k):(x=P,_=O)}var v=!1,x,_,E=f===void 0?null:f;return[function(){return y(d())},E===null?void 0:function(){return y(E())}]},[d,f,m,h]);var g=s(l,b[0],b[1]);return o(function(){p.hasValue=!0,p.value=g},[g]),c(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Wi}var qc;function Hb(){return qc||(qc=1,process.env.NODE_ENV==="production"?hs.exports=$b():hs.exports=Vb()),hs.exports}var zb=Hb();const Wb=Ub(zb),bf={},{useDebugValue:Gb}=C,{useSyncExternalStoreWithSelector:qb}=Wb;let Kc=!1;const Kb=e=>e;function Zb(e,t=Kb,n){(bf?"production":void 0)!=="production"&&n&&!Kc&&(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"),Kc=!0);const r=qb(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Gb(r),r}const Zc=e=>{(bf?"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"?Ib(e):e,n=(r,s)=>Zb(t,r,s);return Object.assign(n,t),n},yi=e=>e?Zc(e):Zc,Yc={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},ae=yi(e=>({...Yc,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({...Yc})}));function Gi(e,t){return e.toFixed(t)}function Yb({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:l,onDragHandlePointerDown:d,onPlaceOrder:f}){const[m,h]=C.useState(String(r)),b=ae(R=>R.setOrderSide),p=ae(R=>R.setVolumeLots),g=Number(dn(fn(e))),y=t!==null?Te(t,g):"—",v=n!==null?Te(n,g):"—",_=!o&&!a&&c!==""&&(t!==null&&n!==null),E=R=>{const A=Number(m),L=Number.isFinite(A)&&A>0?A:r,D=Math.max(i,L+R*s),B=Gi(D,2);h(B),p(D)},P=()=>{const R=Number(m);if(!Number.isFinite(R)||R<=0){h(Gi(r,2)),p(r);return}const A=Math.max(i,R),L=Gi(A,2);h(L),p(A)},k=R=>{t===null||n===null||b({side:R,entryPrice:R==="buy"?n:t})},O=R=>{if(t===null||n===null||!c)return;const A=Number(m),L=Math.max(i,Number.isFinite(A)&&A>0?A:r);b({side:R,entryPrice:R==="buy"?n:t}),f({login:c,side:R,volumeLots:L,bid:t,ask:n})};return u.jsx("div",{className:"web-trading-widget-mini-order web-trading-widget-mini-order--expanded",children:u.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[u.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:d,className:`web-trading-widget-mini-order__drag-handle${l?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:u.jsx(lf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button",disabled:!_,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>k("sell"),onClick:()=>O("sell"),children:[u.jsx("span",{className:"web-trading-widget-mini-order__price",children:y}),u.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),u.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[u.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!_,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>E(-1),children:u.jsx(af,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),u.jsx("input",{type:"text",inputMode:"decimal",value:m,disabled:!_,onChange:R=>h(R.target.value),onBlur:P,className:"web-trading-widget-mini-order__volume-input"}),u.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!_,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>E(1),children:u.jsx(Ob,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),u.jsxs("button",{type:"button",disabled:!_,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>k("buy"),onClick:()=>O("buy"),children:[u.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),u.jsx("span",{className:"web-trading-widget-mini-order__price",children:v})]})]}),u.jsxs("button",{type:"button","aria-label":"Collapse quick order panel","aria-expanded":!0,className:"web-trading-widget-mini-order__toggle",children:[u.jsx(kb,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}),") : (",u.jsx(Pb,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})]})]})})}const Qb="web-trading-widget-mini-exec-panel-position",vf={x:56,y:96};function Qc(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 Xc(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function Xb(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):vf.x,y:16}}function Jb(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 Jc(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function wf(e){const t=(e==null?void 0:e.storageKey)??Qb,n=(e==null?void 0:e.defaultPosition)??vf,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=C.useRef(null),[o,a]=C.useState(n),[c,l]=C.useState(!1),d=C.useRef(n),f=C.useRef(null);C.useEffect(()=>{d.current=o},[o]);const m=C.useCallback(p=>{const g=i.current,y=Qc(p,g);d.current=y,a(y),g&&Xc(g,y)},[]),h=C.useCallback(()=>{m(d.current)},[m]);C.useEffect(()=>{if(!s)return;const p=Jb(t);if(p){m(p);return}const g=r?Xb(r,i.current):null;m(g??d.current)},[m,r,s,t]);const b=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=p.currentTarget,y=i.current;if(!y)return;const v=p.pointerId;g.setPointerCapture(v);const x=p.clientX,_=p.clientY,E=d.current;l(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const P=(R,A)=>{const L=Qc({x:E.x+(R-x),y:E.y+(A-_)},y);d.current=L,Xc(y,L)},k=R=>{if(R.pointerId===v){Jc(g,v),g.removeEventListener("pointermove",O),g.removeEventListener("pointerup",k),g.removeEventListener("pointercancel",k),f.current=null,l(!1),a(d.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(d.current))}catch{}}},O=R=>{R.pointerId===v&&(R.preventDefault(),P(R.clientX,R.clientY))};g.addEventListener("pointermove",O),g.addEventListener("pointerup",k),g.addEventListener("pointercancel",k),f.current=()=>{Jc(g,v),g.removeEventListener("pointermove",O),g.removeEventListener("pointerup",k),g.removeEventListener("pointercancel",k),document.body.style.cursor="",document.body.style.userSelect="",l(!1)}},[t]);return C.useEffect(()=>{const p=()=>{m(d.current)};return window.addEventListener("resize",p),()=>{var g;window.removeEventListener("resize",p),(g=f.current)==null||g.call(f),f.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[m]),{panelRef:i,position:o,isDragging:c,onDragStart:b,reclamp:h}}const _f=200,ev=201,tv=203,nv=204,xf=0,rv=2,Sf=0;function bi(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function Da(e){return Math.round(e*1e4)}function sv(e){return e>=2&&e<=7}function iv(e){return{Action:nv,Order:Number(e.orderTicket),Login:bi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function ov(e){return{Action:tv,Order:Number(e.orderTicket),Login:bi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:Da(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 av(e){const t=e.positionSide==="buy"?1:0;return{Action:_f,Login:bi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:xf,Volume:Da(e.volumeLots),Digits:e.digits,TypeTime:Sf,Comment:e.comment??"",Position:Number(e.positionTicket)}}function cv(e){const t=!sv(e.orderType);return{Action:t?_f:ev,Login:bi(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?xf:rv,Volume:Da(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??Sf,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 lv(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}}}function uv(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function Cf(e){const t=tt(e).toUpperCase();if(t)return In.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 dv(e){const t=Cf(e);return t!=null&&t.pricescale?uv(t.pricescale):5}function Ef(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=tt(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function fv(e){const t=Cf(e);return(t==null?void 0:t.type)==="commodity"?100:1e5}const La="USD";function Xr(e){return tt(e).toUpperCase()}function vi(e){const t=Xr(e);return t.length>=6?t.slice(3):La}function ja(e){if(e!==La&&e==="JPY")return"USDJPY"}function pv(e,t,n,r,s){const i=vi(e),o=ja(i);if(!o)return;if(Xr(e)===o){const l=t==="buy"?n:r;return l>0?l:void 0}const a=s[o];if(!a)return;const c=(a.bid+a.ask)/2;return c>0?c:void 0}function hv(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let l=(e==="buy"?a-t:t-a)*s*fv(i);const d=vi(i),f=pv(i,e,n,r,o);if(f!==void 0)l/=f;else if(d!==La)return null;return Math.round(l*100)/100}function mv(e){const t=new Set;for(const n of e){const r=ja(vi(n));r&&Xr(n)!==r&&t.add(r)}return[...t]}function gv(e,t){const n=Xr(e);if(n===t)return!0;const r=ja(vi(e));return r===t&&n!==r}function yv(e,t,n,r,s){if(!gv(e.symbol,t))return e;const i=Xr(e.symbol)===t,o=i?n:e.marketBid??e.currentPrice,a=i?r:e.marketAsk??e.currentPrice,c=e.type==="buy"?o:a,l=hv(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:c,marketBid:o,marketAsk:a,profit:l??e.profit}}function tt(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function wi(e){return tt(e)||"—"}const bv=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 vv(e){const t=Nt(e);return t===void 0?.01:t/1e4}function wv(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function _v(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 Ps(e){return bv.has(e)}function gs(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=wv(r),{retcode:i,price:o}=_v(r),a=Ps(i),c=(s==null?void 0:s.ResultDeal)||(s==null?void 0:s.ResultOrder)||(s==null?void 0:s.Order),l=((v=s==null?void 0:s.Symbol)==null?void 0:v.trim())||t.symbol,d=tt(l),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,b=Nt(s==null?void 0:s.ResultMarketBid),p=Nt(s==null?void 0:s.ResultMarketAsk),g=m==="buy"?b??h:p??h,y=dv(d);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:d,displaySymbol:wi(d),side:m,volumeLots:vv(s==null?void 0:s.Volume)||t.volumeLots,openPrice:h,currentPrice:g,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(y),retcode:i,isSuccess:a,marketBid:b,marketAsk:p}}function xv(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Sv(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=Tr(n.symbolTicker,t),o=Number(dn(fn(n.symbolTicker,t))),a=mi(n.executionMode),c=Aa(n.orderType),l=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&&!gi(l,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const d=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),f=a?void 0:gf(l,n.expirationDateTime??"",n.expirationDay??"");try{const m=cv({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:Oa(n.orderType)?n.priceOrder:void 0,priceTrigger:c?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:l,timeExpiration:f}),h=await e.sendRequest(m),b=gs(h,{login:r,symbol:i,side:Ws(n.orderType),volumeLots:s,openPrice:d,digits:o,comment:n.comment.trim()});return b!=null&&b.isSuccess?{success:!0,ticket:b.ticket,side:b.side,volumeLots:b.volumeLots,displaySymbol:b.displaySymbol,price:b.openPrice}:{success:!1,message:h&&typeof h=="object"&&"message"in h&&typeof h.message=="string"?h.message:"Order was not accepted by the dealer."}}catch(m){return{success:!1,message:m instanceof Error?m.message:"Failed to place order."}}},async closePosition(n){try{const r=xv(n),s=av({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=gs(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&&!Ps(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=iv({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=gs(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ps(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=ov({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=gs(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&&!Ps(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 Tf(e,t){return function(){return e.apply(t,arguments)}}const{toString:Cv}=Object.prototype,{getPrototypeOf:mr}=Object,{iterator:Jr,toStringTag:Pf}=Symbol,Gs=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Fr=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),Gs(n,t))return!0;n=mr(n)}return!1},Ev=(e,t)=>e!=null&&Fr(e,t)?e[t]:void 0,Ma=(e=>t=>{const n=Cv.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),gt=e=>(e=e.toLowerCase(),t=>Ma(t)===e),_i=e=>t=>typeof t===e,{isArray:Dn}=Array,gr=_i("undefined");function kr(e){return e!==null&&!gr(e)&&e.constructor!==null&&!gr(e.constructor)&&Ye(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const kf=gt("ArrayBuffer");function Tv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&kf(e.buffer),t}const Pv=_i("string"),Ye=_i("function"),Of=_i("number"),Or=e=>e!==null&&typeof e=="object",kv=e=>e===!0||e===!1,ks=e=>{if(!Or(e))return!1;const t=mr(e);return(t===null||t===Object.prototype||mr(t)===null)&&!Fr(e,Pf)&&!Fr(e,Jr)},Ov=e=>{if(!Or(e)||kr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Av=gt("Date"),Rv=gt("File"),Nv=e=>!!(e&&typeof e.uri<"u"),Dv=e=>e&&typeof e.getParts<"u",Lv=gt("Blob"),jv=gt("FileList"),Mv=e=>Or(e)&&Ye(e.pipe);function Iv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const el=Iv(),tl=typeof el.FormData<"u"?el.FormData:void 0,Uv=e=>{if(!e)return!1;if(tl&&e instanceof tl)return!0;const t=mr(e);if(!t||t===Object.prototype||!Ye(e.append))return!1;const n=Ma(e);return n==="formdata"||n==="object"&&Ye(e.toString)&&e.toString()==="[object FormData]"},Fv=gt("URLSearchParams"),[Bv,$v,Vv,Hv]=["ReadableStream","Request","Response","Headers"].map(gt),zv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function es(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Dn(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(kr(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(r=0;r<o;r++)a=i[r],t.call(null,e[a],a,e)}}function Af(e,t){if(kr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const gn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Rf=e=>!gr(e)&&e!==gn;function wo(...e){const{caseless:t,skipUndefined:n}=Rf(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&Af(r,o)||o,c=Gs(r,a)?r[a]:void 0;ks(c)&&ks(i)?r[a]=wo(c,i):ks(i)?r[a]=wo({},i):Dn(i)?r[a]=i.slice():(!n||!gr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||kr(a)||(es(a,s),typeof a!="object"||Dn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let l=0;l<c.length;l++){const d=c[l];nw.call(a,d)&&s(a[d],d)}}return r}const Wv=(e,t,n,{allOwnKeys:r}={})=>(es(t,(s,i)=>{n&&Ye(s)?Object.defineProperty(e,i,{__proto__:null,value:Tf(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),Gv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),qv=(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)},Kv=(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&&mr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Zv=(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},Yv=e=>{if(!e)return null;if(Dn(e))return e;let t=e.length;if(!Of(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Qv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&mr(Uint8Array)),Xv=(e,t)=>{const r=(e&&e[Jr]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Jv=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},ew=gt("HTMLFormElement"),tw=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:nw}=Object.prototype,rw=gt("RegExp"),Nf=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};es(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},sw=e=>{Nf(e,(t,n)=>{if(Ye(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Ye(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+"'")})}})},iw=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Dn(e)?r(e):r(String(e).split(t)),n},ow=()=>{},aw=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function cw(e){return!!(e&&Ye(e.append)&&e[Pf]==="FormData"&&e[Jr])}const lw=e=>{const t=new WeakSet,n=r=>{if(Or(r)){if(t.has(r))return;if(kr(r))return r;if(!("toJSON"in r)){t.add(r);const s=Dn(r)?[]:{};return es(r,(i,o)=>{const a=n(i);!gr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},uw=gt("AsyncFunction"),dw=e=>e&&(Or(e)||Ye(e))&&Ye(e.then)&&Ye(e.catch),Df=((e,t)=>e?setImmediate:t?((n,r)=>(gn.addEventListener("message",({source:s,data:i})=>{s===gn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),gn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ye(gn.postMessage)),fw=typeof queueMicrotask<"u"?queueMicrotask.bind(gn):typeof process<"u"&&process.nextTick||Df,Lf=e=>e!=null&&Ye(e[Jr]),pw=e=>e!=null&&Fr(e,Jr)&&Lf(e),T={isArray:Dn,isArrayBuffer:kf,isBuffer:kr,isFormData:Uv,isArrayBufferView:Tv,isString:Pv,isNumber:Of,isBoolean:kv,isObject:Or,isPlainObject:ks,isEmptyObject:Ov,isReadableStream:Bv,isRequest:$v,isResponse:Vv,isHeaders:Hv,isUndefined:gr,isDate:Av,isFile:Rv,isReactNativeBlob:Nv,isReactNative:Dv,isBlob:Lv,isRegExp:rw,isFunction:Ye,isStream:Mv,isURLSearchParams:Fv,isTypedArray:Qv,isFileList:jv,forEach:es,merge:wo,extend:Wv,trim:zv,stripBOM:Gv,inherits:qv,toFlatObject:Kv,kindOf:Ma,kindOfTest:gt,endsWith:Zv,toArray:Yv,forEachEntry:Xv,matchAll:Jv,isHTMLForm:ew,hasOwnProperty:Gs,hasOwnProp:Gs,hasOwnInPrototypeChain:Fr,getSafeProp:Ev,reduceDescriptors:Nf,freezeMethods:sw,toObjectSet:iw,toCamelCase:tw,noop:ow,toFiniteNumber:aw,findKey:Af,global:gn,isContextDefined:Rf,isSpecCompliantForm:cw,toJSONObject:lw,isAsyncFn:uw,isThenable:dw,setImmediate:Df,asap:fw,isIterable:Lf,isSafeIterable:pw},hw=T.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"]),mw=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]&&hw[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function gw(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 yw=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),bw=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Ia(e,t){return T.isArray(e)?e.map(n=>Ia(n,t)):gw(String(e).replace(t,""))}const vw=e=>Ia(e,yw),ww=e=>Ia(e,bw);function jf(e){const t=Object.create(null);return T.forEach(e.toJSON(),(n,r)=>{t[r]=ww(n)}),t}const nl=Symbol("internals");function Nr(e){return e&&String(e).trim().toLowerCase()}function Os(e){return e===!1||e==null?e:T.isArray(e)?e.map(Os):vw(String(e))}function _w(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 xw=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function qi(e,t,n,r,s){if(T.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!T.isString(t)){if(T.isString(r))return t.indexOf(r)!==-1;if(T.isRegExp(r))return r.test(t)}}function Sw(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Cw(e,t){const n=T.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,l){const d=Nr(c);if(!d)return;const f=T.findKey(s,d);(!f||s[f]===void 0||l===!0||l===void 0&&s[f]!==!1)&&(s[f||c]=Os(a))}const o=(a,c)=>T.forEach(a,(l,d)=>i(l,d,c));if(T.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(T.isString(t)&&(t=t.trim())&&!xw(t))o(mw(t),n);else if(T.isObject(t)&&T.isSafeIterable(t)){let a=Object.create(null),c,l;for(const d of t){if(!T.isArray(d))throw new TypeError("Object iterator must return a key-value pair");l=d[0],T.hasOwnProp(a,l)?(c=a[l],a[l]=T.isArray(c)?[...c,d[1]]:[c,d[1]]):a[l]=d[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Nr(t),t){const r=T.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return _w(s);if(T.isFunction(n))return n.call(this,s,r);if(T.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Nr(t),t){const r=T.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||qi(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Nr(o),o){const a=T.findKey(r,o);a&&(!n||qi(r,r[a],a,n))&&(delete r[a],s=!0)}}return T.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||qi(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return T.forEach(this,(s,i)=>{const o=T.findKey(r,i);if(o){n[o]=Os(s),delete n[i];return}const a=t?Sw(i):String(i).trim();a!==i&&delete n[i],n[a]=Os(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return T.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&T.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[nl]=this[nl]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Nr(o);r[a]||(Cw(s,o),r[a]=!0)}return T.isArray(t)?t.forEach(i):i(t),this}};ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});T.freezeMethods(ze);const Ew="[REDACTED ****]";function Tw(e){if(T.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(T.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Pw(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||T.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof ze&&(i=i.toJSON()),r.push(i);let o;if(T.isArray(i))o=[],i.forEach((a,c)=>{const l=s(a);T.isUndefined(l)||(o[c]=l)});else{if(!T.isPlainObject(i)&&Tw(i))return r.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const l=n.has(a.toLowerCase())?Ew:s(c);T.isUndefined(l)||(o[a]=l)}}return r.pop(),o};return s(e)}let H=class Mf extends Error{static from(t,n,r,s,i,o){const a=new Mf(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&&T.hasOwnProp(t,"redact")?t.redact:void 0,r=T.isArray(n)&&n.length>0?Pw(t,n):T.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}}};H.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";H.ERR_BAD_OPTION="ERR_BAD_OPTION";H.ECONNABORTED="ECONNABORTED";H.ETIMEDOUT="ETIMEDOUT";H.ECONNREFUSED="ECONNREFUSED";H.ERR_NETWORK="ERR_NETWORK";H.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";H.ERR_DEPRECATED="ERR_DEPRECATED";H.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";H.ERR_BAD_REQUEST="ERR_BAD_REQUEST";H.ERR_CANCELED="ERR_CANCELED";H.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";H.ERR_INVALID_URL="ERR_INVALID_URL";H.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const kw=null,If=100;function _o(e){return T.isPlainObject(e)||T.isArray(e)}function Uf(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function Ki(e,t,n){return e?e.concat(t).map(function(s,i){return s=Uf(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Ow(e){return T.isArray(e)&&!e.some(_o)}const Aw=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function xi(e,t,n){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=T.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,x){return!T.isUndefined(x[v])});const r=n.metaTokens,s=n.visitor||b,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?If:n.maxDepth,l=a&&T.isSpecCompliantForm(t),d=[];if(!T.isFunction(s))throw new TypeError("visitor must be a function");function f(y){if(y===null)return"";if(T.isDate(y))return y.toISOString();if(T.isBoolean(y))return y.toString();if(!l&&T.isBlob(y))throw new H("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(y)||T.isTypedArray(y)?l&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function m(y){if(y>c)throw new H("Object is too deeply nested ("+y+" levels). Max depth: "+c,H.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(y,v){if(c===1/0)return JSON.stringify(y);const x=[];return JSON.stringify(y,function(E,P){if(!T.isObject(P))return P;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(P),m(v+x.length-1),P})}function b(y,v,x){let _=y;if(T.isReactNative(t)&&T.isReactNativeBlob(y))return t.append(Ki(x,v,i),f(y)),!1;if(y&&!x&&typeof y=="object"){if(T.endsWith(v,"{}"))v=r?v:v.slice(0,-2),y=h(y,1);else if(T.isArray(y)&&Ow(y)||(T.isFileList(y)||T.endsWith(v,"[]"))&&(_=T.toArray(y)))return v=Uf(v),_.forEach(function(P,k){!(T.isUndefined(P)||P===null)&&t.append(o===!0?Ki([v],k,i):o===null?v:v+"[]",f(P))}),!1}return _o(y)?!0:(t.append(Ki(x,v,i),f(y)),!1)}const p=Object.assign(Aw,{defaultVisitor:b,convertValue:f,isVisitable:_o});function g(y,v,x=0){if(!T.isUndefined(y)){if(m(x),d.indexOf(y)!==-1)throw new Error("Circular reference detected in "+v.join("."));d.push(y),T.forEach(y,function(E,P){(!(T.isUndefined(E)||E===null)&&s.call(t,E,T.isString(P)?P.trim():P,v,p))===!0&&g(E,v?v.concat(P):[P],x+1)}),d.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return g(e),t}function rl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function Ua(e,t){this._pairs=[],e&&xi(e,this,t)}const Ff=Ua.prototype;Ff.append=function(t,n){this._pairs.push([t,n])};Ff.toString=function(t){const n=t?function(r){return t.call(this,r,rl)}:rl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Rw(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Bf(e,t,n){if(!t)return e;const r=T.isFunction(n)?{serialize:n}:n,s=T.getSafeProp(r,"encode")||Rw,i=T.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=T.isURLSearchParams(t)?t.toString():new Ua(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class sl{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){T.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Fa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Nw=typeof URLSearchParams<"u"?URLSearchParams:Ua,Dw=typeof FormData<"u"?FormData:null,Lw=typeof Blob<"u"?Blob:null,jw={isBrowser:!0,classes:{URLSearchParams:Nw,FormData:Dw,Blob:Lw},protocols:["http","https","file","blob","url","data"]},Ba=typeof window<"u"&&typeof document<"u",xo=typeof navigator=="object"&&navigator||void 0,Mw=Ba&&(!xo||["ReactNative","NativeScript","NS"].indexOf(xo.product)<0),Iw=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Uw=Ba&&window.location.href||"http://localhost",Fw=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ba,hasStandardBrowserEnv:Mw,hasStandardBrowserWebWorkerEnv:Iw,navigator:xo,origin:Uw},Symbol.toStringTag,{value:"Module"})),Be={...Fw,...jw};function Bw(e,t){return xi(e,new Be.classes.URLSearchParams,{visitor:function(n,r,s,i){return Be.isNode&&T.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const il=If;function $f(e){if(e>il)throw new H("FormData field is too deeply nested ("+e+" levels). Max depth: "+il,H.ERR_FORM_DATA_DEPTH_EXCEEDED)}function $w(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)$f(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function Vw(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 Vf(e){function t(n,r,s,i){$f(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=n.length;return o=!o&&T.isArray(s)?s.length:o,c?(T.hasOwnProp(s,o)?s[o]=T.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!T.hasOwnProp(s,o)||!T.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&T.isArray(s[o])&&(s[o]=Vw(s[o])),!a)}if(T.isFormData(e)&&T.isFunction(e.entries)){const n={};return T.forEachEntry(e,(r,s)=>{t($w(r),s,n,0)}),n}return null}const Wn=(e,t)=>e!=null&&T.hasOwnProp(e,t)?e[t]:void 0;function Hw(e,t,n){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ts={transitional:Fa,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=T.isObject(t);if(i&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return s?JSON.stringify(Vf(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=Wn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Bw(t,c).toString();if((a=T.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=Wn(this,"env"),d=l&&l.FormData;return xi(a?{"files[]":t}:t,d&&new d,c)}}return i||s?(n.setContentType("application/json",!1),Hw(t)):t}],transformResponse:[function(t){const n=Wn(this,"transitional")||ts.transitional,r=n&&n.forcedJSONParsing,s=Wn(this,"responseType"),i=s==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Wn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?H.from(c,H.ERR_BAD_RESPONSE,this,null,Wn(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}}};T.forEach(["delete","get","head","post","put","patch","query"],e=>{ts.headers[e]={}});function Zi(e,t){const n=this||ts,r=t||n,s=ze.from(r.headers);let i=r.data;return T.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Hf(e){return!!(e&&e.__CANCEL__)}let ns=class extends H{constructor(t,n,r){super(t??"canceled",H.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function zf(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new H("Request failed with status code "+n.status,n.status>=400&&n.status<500?H.ERR_BAD_REQUEST:H.ERR_BAD_RESPONSE,n.config,n.request,n))}function zw(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Ww(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 l=Date.now(),d=r[i];o||(o=l),n[s]=c,r[s]=l;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),l-o<t)return;const h=d&&l-d;return h?Math.round(m*1e3/h):void 0}}function Gw(e,t){let n=0,r=1e3/t,s,i;const o=(l,d=Date.now())=>{n=d,s=null,i&&(clearTimeout(i),i=null),e(...l)};return[(...l)=>{const d=Date.now(),f=d-n;f>=r?o(l,d):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const qs=(e,t,n=3)=>{let r=0;const s=Ww(50,250);return Gw(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,l=Math.max(0,c-r),d=s(l);r=Math.max(r,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:l,rate:d||void 0,estimated:d&&a?(a-c)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},ol=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},al=e=>(...t)=>T.asap(()=>e(...t)),qw=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,Kw=Be.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];T.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),T.isString(r)&&a.push(`path=${r}`),T.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),T.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 Zw(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Yw(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Qw=/^https?:(?!\/\/)/i,Xw=/[\t\n\r]/g;function Jw(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function e_(e){return Jw(e).replace(Xw,"")}function cl(e,t){if(typeof e=="string"&&Qw.test(e_(e)))throw new H('Invalid URL: missing "//" after protocol',H.ERR_INVALID_URL,t)}function Wf(e,t,n,r){cl(t,r);let s=!Zw(t);return e&&(s||n===!1)?(cl(e,r),Yw(e,t)):t}const ll=e=>e instanceof ze?{...e}:e;function Ln(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(d,f,m,h){return T.isPlainObject(d)&&T.isPlainObject(f)?T.merge.call({caseless:h},d,f):T.isPlainObject(f)?T.merge({},f):T.isArray(f)?f.slice():f}function s(d,f,m,h){if(T.isUndefined(f)){if(!T.isUndefined(d))return r(void 0,d,m,h)}else return r(d,f,m,h)}function i(d,f){if(!T.isUndefined(f))return r(void 0,f)}function o(d,f){if(T.isUndefined(f)){if(!T.isUndefined(d))return r(void 0,d)}else return r(void 0,f)}function a(d){const f=T.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!T.isUndefined(f))if(T.isPlainObject(f)){if(T.hasOwnProp(f,d))return f[d]}else return;const m=T.hasOwnProp(e,"transitional")?e.transitional:void 0;if(T.isPlainObject(m)&&T.hasOwnProp(m,d))return m[d]}function c(d,f,m){if(T.hasOwnProp(t,m))return r(d,f);if(T.hasOwnProp(e,m))return r(void 0,d)}const l={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:(d,f,m)=>s(ll(d),ll(f),m,!0)};return T.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=T.hasOwnProp(l,f)?l[f]:s,h=T.hasOwnProp(e,f)?e[f]:void 0,b=T.hasOwnProp(t,f)?t[f]:void 0,p=m(h,b,f);T.isUndefined(p)&&m!==c||(n[f]=p)}),T.hasOwnProp(t,"validateStatus")&&T.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(T.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const t_=["content-type","content-length"];function n_(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{t_.includes(r.toLowerCase())&&e.set(r,s)})}const r_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Gf(e){const t=Ln({},e),n=m=>T.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"),l=n("baseURL"),d=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=ze.from(a),t.url=Bf(Wf(l,f,d,t),n("params"),n("paramsSerializer")),c){const m=T.getSafeProp(c,"username")||"",h=T.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(h?r_(h):"")))}if(T.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||T.isReactNative(r)?a.setContentType(void 0):T.isFunction(r.getHeaders)&&n_(a,r.getHeaders(),n("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(T.isFunction(s)&&(s=s(t)),s===!0||s==null&&qw(t.url))){const h=i&&o&&Kw.read(o);h&&a.set(i,h)}return t}const s_=typeof XMLHttpRequest<"u",i_=s_&&function(e){return new Promise(function(n,r){const s=Gf(e);let i=s.data;const o=ze.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=s,d,f,m,h,b;function p(){h&&h(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let g=new XMLHttpRequest;g.open(s.method.toUpperCase(),s.url,!0),g.timeout=s.timeout;function y(){if(!g)return;const x=ze.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),E={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:x,config:e,request:g};zf(function(k){n(k),p()},function(k){r(k),p()},E),g=null}"onloadend"in g?g.onloadend=y:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.startsWith("file:"))||setTimeout(y)},g.onabort=function(){g&&(r(new H("Request aborted",H.ECONNABORTED,e,g)),p(),g=null)},g.onerror=function(_){const E=_&&_.message?_.message:"Network Error",P=new H(E,H.ERR_NETWORK,e,g);P.event=_||null,r(P),p(),g=null},g.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||Fa;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new H(_,E.clarifyTimeoutError?H.ETIMEDOUT:H.ECONNABORTED,e,g)),p(),g=null},i===void 0&&o.setContentType(null),"setRequestHeader"in g&&T.forEach(jf(o),function(_,E){g.setRequestHeader(E,_)}),T.isUndefined(s.withCredentials)||(g.withCredentials=!!s.withCredentials),a&&a!=="json"&&(g.responseType=s.responseType),l&&([m,b]=qs(l,!0),g.addEventListener("progress",m)),c&&g.upload&&([f,h]=qs(c),g.upload.addEventListener("progress",f),g.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(d=x=>{g&&(r(!x||x.type?new ns(null,e,g):x),g.abort(),p(),g=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const v=zw(s.url);if(v&&!Be.protocols.includes(v)){r(new H("Unsupported protocol "+v+":",H.ERR_BAD_REQUEST,e));return}g.send(i||null)})},o_=(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 l=c instanceof Error?c:this.reason;n.abort(l instanceof H?l:new ns(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,s(new H(`timeout of ${t}ms exceeded`,H.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=()=>T.asap(o),a},a_=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},c_=async function*(e,t){for await(const n of l_(e))yield*a_(n,t)},l_=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()}},ul=(e,t,n,r)=>{const s=c_(e,t);let i=0,o,a=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:l,value:d}=await s.next();if(l){a(),c.close();return}let f=d.byteLength;if(n){let m=i+=f;n(m)}c.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Ks=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,u_=(e,t,n)=>t+2<n&&Ks(e.charCodeAt(t+1))&&Ks(e.charCodeAt(t+2));function d_(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let o=r.length;const a=r.length;for(let h=0;h<a;h++)if(r.charCodeAt(h)===37&&h+2<a){const b=r.charCodeAt(h+1),p=r.charCodeAt(h+2);Ks(b)&&Ks(p)&&(o-=2,h+=2)}let c=0,l=a-1;const d=h=>h>=2&&r.charCodeAt(h-2)===37&&r.charCodeAt(h-1)===51&&(r.charCodeAt(h)===68||r.charCodeAt(h)===100);l>=0&&(r.charCodeAt(l)===61?(c++,l--):d(l)&&(c++,l-=3)),c===1&&l>=0&&(r.charCodeAt(l)===61||d(l))&&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&&u_(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 l=r.charCodeAt(o+1);l>=56320&&l<=57343?(i+=4,o++):i+=3}else i+=3}return i}const $a="1.18.0",dl=64*1024,{isFunction:ys}=T,f_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),fl=e=>{if(!T.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},pl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},p_=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},h_=e=>{const t=T.global!==void 0&&T.global!==null?T.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=T.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?ys(s):typeof fetch=="function",c=ys(i),l=ys(o);if(!a)return!1;const d=a&&ys(n),f=a&&(typeof r=="function"?(y=>v=>y.encode(v))(new r):async y=>new Uint8Array(await new i(y).arrayBuffer())),m=c&&d&&pl(()=>{let y=!1;const v=new i(Be.origin,{body:new n,method:"POST",get duplex(){return y=!0,"half"}}),x=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),y&&!x}),h=l&&d&&pl(()=>T.isReadableStream(new o("").body)),b={stream:h&&(y=>y.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!b[y]&&(b[y]=(v,x)=>{let _=v&&v[y];if(_)return _.call(v);throw new H(`Response type '${y}' is not supported`,H.ERR_NOT_SUPPORT,x)})});const p=async y=>{if(y==null)return 0;if(T.isBlob(y))return y.size;if(T.isSpecCompliantForm(y))return(await new i(Be.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(T.isArrayBufferView(y)||T.isArrayBuffer(y))return y.byteLength;if(T.isURLSearchParams(y)&&(y=y+""),T.isString(y))return(await f(y)).byteLength},g=async(y,v)=>{const x=T.toFiniteNumber(y.getContentLength());return x??p(v)};return async y=>{let{url:v,method:x,data:_,signal:E,cancelToken:P,timeout:k,onDownloadProgress:O,onUploadProgress:R,responseType:A,headers:L,withCredentials:D="same-origin",fetchOptions:B,maxContentLength:U,maxBodyLength:W}=Gf(y);const z=T.isNumber(U)&&U>-1,j=T.isNumber(W)&&W>-1,N=Z=>T.hasOwnProp(y,Z)?y[Z]:void 0;let F=s||fetch;A=A?(A+"").toLowerCase():"text";let M=o_([E,P&&P.toAbortSignal()],k),Y=null;const se=M&&M.unsubscribe&&(()=>{M.unsubscribe()});let le,oe=null;const Re=()=>new H("Request body larger than maxBodyLength limit",H.ERR_BAD_REQUEST,y,Y);try{let Z;const K=N("auth");if(K){const X=T.getSafeProp(K,"username")||"",Ee=T.getSafeProp(K,"password")||"";Z={username:X,password:Ee}}if(p_(v)){const X=new URL(v,Be.origin);if(!Z&&(X.username||X.password)){const Ee=fl(X.username),Me=fl(X.password);Z={username:Ee,password:Me}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(Z&&(L.delete("authorization"),L.set("Authorization","Basic "+btoa(f_((Z.username||"")+":"+(Z.password||""))))),z&&typeof v=="string"&&v.startsWith("data:")&&d_(v)>U)throw new H("maxContentLength size of "+U+" exceeded",H.ERR_BAD_RESPONSE,y,Y);if(j&&x!=="get"&&x!=="head"){const X=await p(_);if(typeof X=="number"&&isFinite(X)&&(le=X,X>W))throw Re()}const ue=j&&(T.isReadableStream(_)||T.isStream(_)),me=(X,Ee,Me)=>ul(X,dl,We=>{if(j&&We>W)throw oe=Re();Ee&&Ee(We)},Me);if(m&&x!=="get"&&x!=="head"&&(R||ue)){if(le=le??await g(L,_),le!==0||ue){let X=new i(v,{method:"POST",body:_,duplex:"half"}),Ee;if(T.isFormData(_)&&(Ee=X.headers.get("content-type"))&&L.setContentType(Ee),X.body){const[Me,We]=R&&ol(le,qs(al(R)))||[];_=me(X.body,Me,We)}}}else if(ue&&!c&&d&&x!=="get"&&x!=="head")_=me(_);else if(ue&&c&&!m&&x!=="get"&&x!=="head")throw new H("Stream request bodies are not supported by the current fetch implementation",H.ERR_NOT_SUPPORT,y,Y);T.isString(D)||(D=D?"include":"omit");const ge=c&&"credentials"in i.prototype;if(T.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/"+$a,!1);const ie={...B,signal:M,method:x.toUpperCase(),headers:jf(L.normalize()),body:_,duplex:"half",credentials:ge?D:void 0};Y=c&&new i(v,ie);let te=await(c?F(Y,B):F(v,ie));const je=ze.from(te.headers);if(z){const X=T.toFiniteNumber(je.getContentLength());if(X!=null&&X>U)throw new H("maxContentLength size of "+U+" exceeded",H.ERR_BAD_RESPONSE,y,Y)}const Pe=h&&(A==="stream"||A==="response");if(h&&te.body&&(O||z||Pe&&se)){const X={};["status","statusText","headers"].forEach($e=>{X[$e]=te[$e]});const Ee=T.toFiniteNumber(je.getContentLength()),[Me,We]=O&&ol(Ee,qs(al(O),!0))||[];let at=0;const J=$e=>{if(z&&(at=$e,at>U))throw new H("maxContentLength size of "+U+" exceeded",H.ERR_BAD_RESPONSE,y,Y);Me&&Me($e)};te=new o(ul(te.body,dl,J,()=>{We&&We(),se&&se()}),X)}A=A||"text";let Ce=await b[T.findKey(b,A)||"text"](te,y);if(z&&!h&&!Pe){let X;if(Ce!=null&&(typeof Ce.byteLength=="number"?X=Ce.byteLength:typeof Ce.size=="number"?X=Ce.size:typeof Ce=="string"&&(X=typeof r=="function"?new r().encode(Ce).byteLength:Ce.length)),typeof X=="number"&&X>U)throw new H("maxContentLength size of "+U+" exceeded",H.ERR_BAD_RESPONSE,y,Y)}return!Pe&&se&&se(),await new Promise((X,Ee)=>{zf(X,Ee,{data:Ce,headers:ze.from(te.headers),status:te.status,statusText:te.statusText,config:y,request:Y})})}catch(Z){if(se&&se(),M&&M.aborted&&M.reason instanceof H){const K=M.reason;throw K.config=y,Y&&(K.request=Y),Z!==K&&(K.cause=Z),K}throw oe?(Y&&!oe.request&&(oe.request=Y),oe):Z instanceof H?(Y&&!Z.request&&(Z.request=Y),Z):Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message)?Object.assign(new H("Network Error",H.ERR_NETWORK,y,Y,Z&&Z.response),{cause:Z.cause||Z}):H.from(Z,Z&&Z.code,y,Y,Z&&Z.response)}}},m_=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,l,d=m_;for(;a--;)c=i[a],l=d.get(c),l===void 0&&d.set(c,l=a?new Map:h_(t)),d=l;return l};qf();const Va={http:kw,xhr:i_,fetch:{get:qf}};T.forEach(Va,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const hl=e=>`- ${e}`,g_=e=>T.isFunction(e)||e===null||e===!1;function y_(e,t){e=T.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,!g_(r)&&(s=Va[(a=String(r)).toLowerCase()],s===void 0))throw new H(`Unknown adapter '${a}'`);if(s&&(T.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
76
|
+
`+o.map(hl).join(`
|
|
77
|
+
`):" "+hl(o[0]):"as no adapter specified";throw new H("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Kf={getAdapter:y_,adapters:Va};function Yi(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ns(null,e)}function ml(e){return Yi(e),e.headers=ze.from(e.headers),e.data=Zi.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Kf.getAdapter(e.adapter||ts.adapter,e)(e).then(function(r){Yi(e),e.response=r;try{r.data=Zi.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=ze.from(r.headers),r},function(r){if(!Hf(r)&&(Yi(e),r&&r.response)){e.response=r.response;try{r.response.data=Zi.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=ze.from(r.response.headers)}return Promise.reject(r)})}const Si={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Si[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const gl={};Si.transitional=function(t,n,r){function s(i,o){return"[Axios v"+$a+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new H(s(o," has been removed"+(n?" in "+n:"")),H.ERR_DEPRECATED);return n&&!gl[o]&&(gl[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}};Si.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function b_(e,t,n){if(typeof e!="object")throw new H("options must be an object",H.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 H("option "+i+" must be "+c,H.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new H("Unknown option "+i,H.ERR_BAD_OPTION)}}const As={assertOptions:b_,validators:Si},Ve=As.validators;let kn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new sl,response:new sl}}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
|
+
`);return o===-1?"":s.stack.slice(o+1)})();try{if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(`
|
|
79
|
+
`),a=o===-1?-1:i.indexOf(`
|
|
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=Ln(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&As.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&&(T.isFunction(s)?n.paramsSerializer={serialize:s}:As.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),As.assertOptions(n,{baseUrl:Ve.spelling("baseURL"),withXsrfToken:Ve.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&T.merge(i.common,i[n.method]);i&&T.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete i[b]}),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 g=n.transitional||Fa;g&&g.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const l=[];this.interceptors.response.forEach(function(p){l.push(p.fulfilled,p.rejected)});let d,f=0,m;if(!c){const b=[ml.bind(this),void 0];for(b.unshift(...a),b.push(...l),m=b.length,d=Promise.resolve(n);f<m;)d=d.then(b[f++],b[f++]);return d}m=a.length;let h=n;for(;f<m;){const b=a[f++],p=a[f++];try{h=b(h)}catch(g){p.call(this,g);break}}try{d=ml.call(this,h)}catch(b){return Promise.reject(b)}for(f=0,m=l.length;f<m;)d=d.then(l[f++],l[f++]);return d}getUri(t){t=Ln(this.defaults,t);const n=Wf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Bf(n,t.params,t.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(t){kn.prototype[t]=function(n,r){return this.request(Ln(r||{},{method:t,url:n,data:r&&T.hasOwnProp(r,"data")?r.data:void 0}))}});T.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,a){return this.request(Ln(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}kn.prototype[t]=n(),t!=="query"&&(kn.prototype[t+"Form"]=n(!0))});let v_=class Zf{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 ns(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 Zf(function(s){t=s}),cancel:t}}};function w_(e){return function(n){return e.apply(null,n)}}function __(e){return T.isObject(e)&&e.isAxiosError===!0}const So={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(So).forEach(([e,t])=>{So[t]=e});function Yf(e){const t=new kn(e),n=Tf(kn.prototype.request,t);return T.extend(n,kn.prototype,t,{allOwnKeys:!0}),T.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Yf(Ln(e,s))},n}const Oe=Yf(ts);Oe.Axios=kn;Oe.CanceledError=ns;Oe.CancelToken=v_;Oe.isCancel=Hf;Oe.VERSION=$a;Oe.toFormData=xi;Oe.AxiosError=H;Oe.Cancel=Oe.CanceledError;Oe.all=function(t){return Promise.all(t)};Oe.spread=w_;Oe.isAxiosError=__;Oe.mergeConfig=Ln;Oe.AxiosHeaders=ze;Oe.formToJSON=e=>Vf(T.isHTMLForm(e)?new FormData(e):e);Oe.getAdapter=Kf.getAdapter;Oe.HttpStatusCode=So;Oe.default=Oe;const{Axios:hC,AxiosError:mC,CanceledError:gC,isCancel:yC,CancelToken:bC,VERSION:vC,all:wC,Cancel:_C,isAxiosError:Qf,spread:xC,toFormData:SC,AxiosHeaders:CC,HttpStatusCode:EC,formToJSON:TC,getAdapter:PC,mergeConfig:kC,create:OC}=Oe,x_="Bearer ",Xf="web-trading-token";function S_(){return typeof window>"u"?null:localStorage.getItem(Xf)}function jn(e){return e.replace(/\/$/,"")}function yl(e){const t=jn(e);async function n(r){const s=S_();return(await Oe({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${x_}${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 bl(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function C_(e){const t=e.filter(n=>bl(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(bl)}function E_(e){const t=e,n=(t==null?void 0:t.accounts)??[];return C_(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 T_(e){try{const t=new URL(jn(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 jn(e)}}function P_(e){try{const t=new URL(jn(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 k_(e){try{const t=new URL(jn(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 O_=["XAU_USD","EUR_USD","GBP_USD","USD_JPY","BTCUSDT"],A_=In.filter(e=>O_.includes(e.ticker));function Jf(){return A_}function R_(e){const t=jn(e),n=yl(t),r=T_(t),s=yl(r),i=lv(n),o=Jf();return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:P_(t),publicTickWebSocketUrl:k_(t),dealer:i,trading:Sv(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return E_(a)}}}const ep=C.createContext(null);function tp({baseUrl:e,children:t}){const n=C.useMemo(()=>R_(e),[e]);return u.jsx(ep.Provider,{value:n,children:t})}function pn(){const e=C.useContext(ep);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function N_(){return pn().tickWebSocketUrl}function D_(){return pn().publicTickWebSocketUrl}const L_="wss://public-ticks.opheleo.com";function Ha(e){const[t,n]=C.useState(null),r=D_();return C.useEffect(()=>{const s=Tr(e).toUpperCase();let i=null,o=!1;const a=r||L_,c=()=>{i=new WebSocket(a),i.onmessage=l=>{var d;try{const f=JSON.parse(l.data);if(f.type!=="tick"||!Array.isArray(f.ticks))return;for(const m of f.ticks){if(((d=m.s)==null?void 0:d.trim().toUpperCase())!==s)continue;const b=Number(m.b),p=Number(m.a);if(!(!Number.isFinite(b)||!Number.isFinite(p))){n({bid:b,ask:p});break}}}catch{}},i.onclose=()=>{o||setTimeout(c,3e3)}};return c(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function j_({symbolTicker:e,orderState:t}){const n=Ha(e),{panelRef:r,position:s,isDragging:i,onDragStart:o,reclamp:a}=wf(),{panel:c,isSubmitting:l,defaultVolumeLots:d,volumeStep:f,minVolumeLots:m,accountOptions:h,selectedLogin:b,isAccountsLoading:p,hasConfirmedAccount:g,confirmAccountSelection:y,placeMarketOrder:v}=t,x=ae(O=>O.setDraft),_=ae(O=>O.clearDraft),E=Number(dn(fn(e))),P=Pr(E);C.useEffect(()=>{g&&x({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:d,digits:E,priceStep:P})},[d,E,g,P,x]),C.useEffect(()=>{(c==="closed"||c==="confirmation")&&_()},[_,c]);const k=O=>{v({symbolTicker:e,login:O.login,executionMode:"market",side:O.side,orderType:O.side==="buy"?Ze.BUY:Ze.SELL,volumeLots:O.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:dt.GTC,expirationDateTime:"",expirationDay:"",bid:O.bid,ask:O.ask})};return u.jsxs(u.Fragment,{children:[u.jsx(of,{open:!g,isAccountsLoading:p,accountOptions:h,onConfirm:y}),g&&u.jsx("div",{ref:r,style:{left:s.x,top:s.y},className:`web-trading-widget-new-order-overlay${i?" web-trading-widget-new-order-overlay--dragging":""}`,children:u.jsx(Yb,{symbolTicker:e,bid:(n==null?void 0:n.bid)??null,ask:(n==null?void 0:n.ask)??null,defaultVolumeLots:d,volumeStep:f,minVolumeLots:m,isSubmitting:l,isAccountsLoading:p,selectedLogin:b,isDragging:i,onDragHandlePointerDown:o,onExpandedChange:a,onExpand:a,onPlaceOrder:k})})]})}function M_(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 I_(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:M_(e.ticket,t.ticket)}function vl(e){return[...e].sort(I_)}function wl(e){return tt(e).toUpperCase()}const he=yi(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:vl(t)})},setOrders:t=>{e({orders:vl(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=wl(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>yv(a,s,n,r,o)),orders:i.orders.map(a=>{if(wl(a.symbol)!==s)return a;const c=a.side==="buy"?n:r;return{...a,currentPrice:c}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),U_="wss://symbols.opheleo.com";function F_(e,t){const n=new Set;for(const r of e){const s=tt(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=tt(r.symbol).toUpperCase();s&&n.add(s)}for(const r of mv([...n]))n.add(r);return[...n].sort().join("|")}function B_(e){return F_(e.positions,e.orders)}function $_(){const e=he(B_),t=he(r=>r.updateQuotes),n=N_();C.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||U_,a=c=>{const l=new WebSocket(o);s.set(c,l),l.onopen=()=>{if(i){l.close(1e3,"Unmounted");return}l.send(JSON.stringify({action:"select_symbol",symbol:c}))},l.onmessage=d=>{var f;try{const m=JSON.parse(d.data),h=(f=m.symbol)==null?void 0:f.trim().toUpperCase();if(!h||h!==c)return;const b=Number(m.bid),p=Number(m.ask);if(!Number.isFinite(b)||!Number.isFinite(p))return;t(h,b,p)}catch{}},l.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 np(){return $_(),null}const rp={buy:"#2563eb",sell:"#dc2626"},V_={stopLoss:"#f97316",takeProfit:"#22c55e"},sp=e=>rp[e],_l=(e,t)=>e==="entry"?t!=null?sp(t):rp.sell:V_[e],H_=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,z_=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),W_=e=>{const t=H_(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=z_(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},ip=(e,t)=>e.toFixed(t),xl=e=>ft(e),G_=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",Qi=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Sl=(e,t,n)=>{if(e==="entry")return ip(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?W_({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Te(t,n.digits)}`},q_=({chartWidget:e})=>{const t=ae(_=>_.source),n=ae(_=>_.entryPrice),r=ae(_=>_.stopLoss),s=ae(_=>_.takeProfit),i=ae(_=>_.side),o=ae(_=>_.showEntryLine),a=ae(_=>_.volumeLots),c=ae(_=>_.digits),l=ae(_=>_.priceStep),d=ae(_=>_.setStopLoss),f=ae(_=>_.setTakeProfit),m=C.useRef({}),h=C.useRef(null),b=C.useRef(null),p=C.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:c,priceStep:l});C.useEffect(()=>{p.current={entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:c,priceStep:l}},[c,n,l,o,i,r,s,a]);const g=C.useCallback(_=>{if(!e)return;const E=m.current[_];if(E){try{e.activeChart().removeEntity(E)}catch{}delete m.current[_]}},[e]),y=C.useCallback((_,E,P,k)=>{const O=_l(E,k.side);_.setProperties({text:Sl(E,P,k),linecolor:O,textcolor:O,showPrice:!0,horzLabelsAlign:"left"})},[]),v=C.useCallback(async(_,E,P)=>{var L;if(!e)return;if(E===void 0){g(_);return}if(h.current===_)return;const k=e.activeChart(),O=_l(_,P.side),R=Sl(_,E,P),A=m.current[_];if(A)try{const D=k.getShapeById(A);_==="entry"&&Qi(D);const B=(L=D.getPoints()[0])==null?void 0:L.price;if(B!==void 0&&Math.abs(B-E)<P.priceStep/2){D.setProperties({text:R,linecolor:O,textcolor:O,showPrice:!0,horzLabelsAlign:"left"});return}const U=D.getPoints();if(U.length>0){D.setPoints(U.map(W=>({...W,price:E}))),D.setProperties({text:R,linecolor:O,textcolor:O,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete m.current[_]}try{const D=k.getVisibleRange(),B=await k.createShape({time:D.from,price:E},{shape:"horizontal_line",text:R,disableSave:!0,lock:_==="entry",disableSelection:_==="entry",overrides:{linecolor:O,textcolor:O,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(_==="entry")try{Qi(k.getShapeById(B))}catch{}m.current[_]=B}catch{}},[e,g]),x=C.useCallback(async _=>{const E=xl(_.stopLoss),P=xl(_.takeProfit);_.showEntryLine&&_.entryPrice!==null?await v("entry",_.entryPrice,_):await v("entry",void 0,_),await v("stopLoss",E,_),await v("takeProfit",P,_)},[v]);C.useEffect(()=>{if(!e||t===null)return;const _=(E,P)=>{var O,R,A;const k=(O=Object.entries(m.current).find(([,L])=>L===E))==null?void 0:O[0];if(!(!k||!G_(k))){if(k==="entry"){if(P==="move"||P==="points_changed"){const L=p.current;if(L.entryPrice!==null)try{const D=e.activeChart().getShapeById(E),B=(R=D.getPoints()[0])==null?void 0:R.price;if(B!==void 0&&Math.abs(B-L.entryPrice)>=L.priceStep/2){const U=D.getPoints();U.length>0&&D.setPoints(U.map(W=>({...W,price:L.entryPrice})))}Qi(D)}catch{}}return}if(P==="remove"){h.current=null,k==="stopLoss"&&d(""),k==="takeProfit"&&f(""),delete m.current[k];return}if(!(P!=="move"&&P!=="points_changed"))try{const L=e.activeChart().getShapeById(E),D=(A=L.getPoints()[0])==null?void 0:A.price;if(!Number.isFinite(D)||D<=0)return;const B=p.current;if(P==="points_changed"){h.current=k,y(L,k,D,B),b.current!==null&&clearTimeout(b.current),b.current=setTimeout(()=>{h.current=null;const z=Te(D,p.current.digits);k==="stopLoss"?d(z):f(z)},120);return}b.current!==null&&(clearTimeout(b.current),b.current=null),h.current=null;const U=Te(D,B.digits),W=k==="stopLoss"?{...B,stopLoss:U}:{...B,takeProfit:U};k==="stopLoss"?d(U):f(U),y(L,k,D,W)}catch{h.current=null}}};try{e.subscribe("drawing_event",_)}catch{}return()=>{h.current=null,b.current!==null&&(clearTimeout(b.current),b.current=null);try{e.unsubscribe("drawing_event",_)}catch{}Object.keys(m.current).forEach(E=>{g(E)}),m.current={}}},[e,g,d,f,t,y]),C.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,l,x])},Cl=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},op=(e,t)=>tt(e.symbol).toUpperCase()===t,K_=e=>he.getState().positions.filter(t=>op(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits})),El=(e,t)=>{var n;try{const r=e.activeChart().symbol(),s=(n=In.find(i=>i.display_name===r))==null?void 0:n.ticker;return s?tt(Tr(s)).toUpperCase():t}catch{return t}},Z_=({chartWidget:e,symbolTicker:t})=>{const n=he(f=>f.positions),r=C.useRef(new Map),s=C.useRef(0),i=C.useMemo(()=>tt(Tr(t)).toUpperCase(),[t]),o=C.useMemo(()=>n.filter(f=>op(f,i)).map(f=>`${f.ticket}:${f.openPrice}:${f.type}:${f.digits}`).sort().join("|"),[i,n]),a=C.useCallback(f=>{if(!e)return;const m=r.current.get(f);if(m){try{e.activeChart().removeEntity(m)}catch{}r.current.delete(f)}},[e]),c=C.useCallback(async(f,m)=>{var y;if(!e||m!==s.current)return;const h=e.activeChart(),b=sp(f.type),p=ip(f.openPrice,f.digits),g=r.current.get(f.ticket);if(g)try{const v=h.getShapeById(g);Cl(v);const x=(y=v.getPoints()[0])==null?void 0:y.price;if(x!==void 0&&Math.abs(x-f.openPrice)<Number.EPSILON){v.setProperties({text:p,linecolor:b,textcolor:b,showPrice:!0,horzLabelsAlign:"left"});return}const _=v.getPoints();if(_.length>0){v.setPoints(_.map(E=>({...E,price:f.openPrice}))),v.setProperties({text:p,linecolor:b,textcolor:b,showPrice:!0,horzLabelsAlign:"left"});return}}catch{r.current.delete(f.ticket)}if(m===s.current)try{const v=h.getVisibleRange(),x=await h.createShape({time:v.from,price:f.openPrice},{shape:"horizontal_line",text:p,disableSave:!0,lock:!0,disableSelection:!0,overrides:{linecolor:b,textcolor:b,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(m!==s.current){try{h.removeEntity(x)}catch{}return}try{Cl(h.getShapeById(x))}catch{}r.current.set(f.ticket,x)}catch{}},[e]),l=C.useCallback(async(f,m)=>{if(!e||f!==s.current)return;const h=K_(m),b=new Set(h.map(p=>p.ticket));for(const p of r.current.keys())b.has(p)||a(p);for(const p of h){if(f!==s.current)return;await c(p,f)}},[e,a,c]),d=C.useCallback(f=>{if(!e)return;f!=null&&f.resetLineIds&&r.current.clear();const m=(f==null?void 0:f.symbolKey)??El(e,i),h=s.current+1;s.current=h,l(h,m)},[i,e,l]);C.useEffect(()=>{if(!e)return;let f=!1,m=null;const h=()=>{f||d({resetLineIds:!0,symbolKey:El(e,i)})};let b=!1;const p=()=>{b=!0,h()},g=()=>{f||!b||(b=!1,d())};try{e.onChartReady(()=>{if(!f)try{m=e.activeChart(),d(),m.onSymbolChanged().subscribe(null,p),m.onDataLoaded().subscribe(null,g)}catch{}})}catch{}return()=>{if(f=!0,s.current+=1,m)try{m.onSymbolChanged().unsubscribe(null,p),m.onDataLoaded().unsubscribe(null,g)}catch{}for(const y of[...r.current.keys()])a(y);r.current.clear()}},[i,e,a,d]),C.useEffect(()=>{e&&d({symbolKey:i})},[i,e,o,d])},ap=({chartWidget:e,symbolTicker:t})=>(Z_({chartWidget:e,symbolTicker:t}),q_({chartWidget:e}),null),Y_=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
82
|
+
<circle cx="9" cy="9" r="8" fill="none" stroke="#d1d5db" stroke-width="1"/>
|
|
83
|
+
<path d="M9 1 A8 8 0 0 0 9 17 Z" fill="#ef4444"/>
|
|
84
|
+
<path d="M9 1 A8 8 0 0 1 9 17 Z" fill="#3b82f6"/>
|
|
85
|
+
<path d="M9 4.5 L11.5 10.5 L9 9.25 L6.5 10.5 Z" fill="#fff"/>
|
|
86
|
+
</svg>`,Q_=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
87
|
+
<rect x="1" y="1" width="16" height="16" rx="5" fill="#3B82F6" fill-opacity="0.18" stroke="#3B82F6" stroke-width="1"/>
|
|
88
|
+
<circle cx="9" cy="6.5" r="2.5" fill="none" stroke="#3B82F6" stroke-width="1.5"/>
|
|
89
|
+
<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"/>
|
|
90
|
+
</svg>`,cp=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
91
|
+
<circle cx="9" cy="9" r="6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-opacity="0.25"/>
|
|
92
|
+
<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"/>
|
|
93
|
+
</svg>`,X_=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
94
|
+
<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"/>
|
|
95
|
+
</svg>`,za="data-opheleo-account-dropdown",Rs="data-opheleo-account-title",Xi="data-opheleo-account-icon",J_=[0,16,50,150];function lp(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 up(e){const[t]=e.label.split(" · ");return t??e.label}function ex(e){return`My Account — ${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function tx(e,t){const n=up(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function Wa(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function dp(e){return e.isAccountsLoading||e.isAccountDataLoading}function Ga(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=Wa(e);if(!t)return"My Account";const n=up(t);return`My Account · ${t.login} · ${n}`}function fp(e){return dp(e)?cp:Q_}function nx(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:tx(n,r),icon:r?X_:void 0,onSelect:()=>{r||t(n.login)}}})}function Tl(e,t){var r;if(e.matches(`[${za}="true"]`)||e.querySelector(`[${Rs}]`))return!0;const n=((r=e.textContent)==null?void 0:r.trim())??"";return n.includes("My Account")||n===t}function rx(e,t){const n=e.querySelector(`[${za}="true"]`);if(n instanceof HTMLElement&&n.isConnected)return n;const r=e.querySelectorAll('button, [role="button"]');for(const i of r)if(i instanceof HTMLElement&&Tl(i,t))return i;const s=e.querySelectorAll("div, span");for(const i of s){if(!(i instanceof HTMLElement)||!Tl(i,t))continue;let o=i;for(;o&&o!==e;){if(o.tagName==="BUTTON"||o.getAttribute("role")==="button")return o;o=o.parentElement}}return null}function sx(e,t){var o;const n=Ga(t),r=fp(t);let s=e.querySelector(`[${Xi}]`);s instanceof HTMLElement||(s=document.createElement("span"),s.setAttribute(Xi,"true"),s.style.display="inline-flex",s.style.alignItems="center",s.style.flexShrink="0",e.prepend(s)),s.innerHTML!==r&&(s.innerHTML=r);let i=e.querySelector(`[${Rs}]`);i instanceof HTMLElement||(i=document.createElement("span"),i.setAttribute(Rs,"true"),i.style.display="inline",i.style.visibility="visible",i.style.opacity="1",i.style.whiteSpace="nowrap",i.style.overflow="visible",i.style.textOverflow="clip",i.style.maxWidth="none",i.style.flexShrink="0",s.insertAdjacentElement("afterend",i)),i.textContent!==n&&(i.textContent=n);for(const a of e.children){if(!(a instanceof HTMLElement)||a.hasAttribute(Rs)||a.hasAttribute(Xi))continue;const c=((o=a.textContent)==null?void 0:o.trim())??"";(a.querySelector("svg")!==null||c.includes("My Account"))&&(a.style.display="none")}}function ix(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 ox(e,t){e.setAttribute(za,"true"),lp(e),e.style.overflow="visible",e.style.minWidth="auto",sx(e,t);const n=Wa(t);if(!dp(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}ix(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function ax(e,t){if(!(e!=null&&e.isConnected))return;const n=Ga(t),r=()=>{const s=rx(e,n);s&&ox(s,t)};for(const s of J_){if(s===0){r();continue}if(s===16){requestAnimationFrame(r);continue}window.setTimeout(r,s)}}async function cx(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:cp,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function Pl(e,t,n,r){if(!e||(r==null?void 0:r.isConnected)===!1)return;const s=Wa(t);try{e.applyOptions({title:Ga(t),tooltip:s?ex(s):"Select your trading account",icon:fp(t),items:nx(t,n)})}catch{return}ax(r??null,t)}async function pp(e,t){await e.headerReady();const n=e.createButton({align:"right",useTradingViewStyle:!1});return typeof n=="string"||(n.setAttribute("title","New Order"),n.setAttribute("aria-label","New Order"),lp(n),n.innerHTML=`${Y_}<span>New Order</span>`,n.addEventListener("click",t)),n}var rs=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(){}},bn,Wt,Xn,mu,lx=(mu=class extends rs{constructor(){super();Q(this,bn);Q(this,Wt);Q(this,Xn);$(this,Xn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){S(this,Wt)||this.setEventListener(S(this,Xn))}onUnsubscribe(){var t;this.hasListeners()||((t=S(this,Wt))==null||t.call(this),$(this,Wt,void 0))}setEventListener(t){var n;$(this,Xn,t),(n=S(this,Wt))==null||n.call(this),$(this,Wt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){S(this,bn)!==t&&($(this,bn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof S(this,bn)=="boolean"?S(this,bn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},bn=new WeakMap,Wt=new WeakMap,Xn=new WeakMap,mu),qa=new lx,ux={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_t,vn,gu,dx=(gu=class{constructor(){Q(this,_t,ux);Q(this,vn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&S(this,vn)&&e!==S(this,_t)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:S(this,_t),provider:e}),$(this,_t,e),process.env.NODE_ENV!=="production"&&$(this,vn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&$(this,vn,!0),S(this,_t).setTimeout(e,t)}clearTimeout(e){S(this,_t).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&$(this,vn,!0),S(this,_t).setInterval(e,t)}clearInterval(e){S(this,_t).clearInterval(e)}},_t=new WeakMap,vn=new WeakMap,gu),yn=new dx;function fx(e){setTimeout(e,0)}var px=typeof window>"u"||"Deno"in globalThis;function Ke(){}function hx(e,t){return typeof e=="function"?e(t):e}function Co(e){return typeof e=="number"&&e>=0&&e!==1/0}function hp(e,t){return Math.max(e+(t||0)-Date.now(),0)}function en(e,t){return typeof e=="function"?e(t):e}function Xe(e,t){return typeof e=="function"?e(t):e}function kl(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Ka(o,t.options))return!1}else if(!$r(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 Ol(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Br(t.options.mutationKey)!==Br(i))return!1}else if(!$r(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Ka(e,t){return((t==null?void 0:t.queryKeyHashFn)||Br)(e)}function Br(e){return JSON.stringify(e,(t,n)=>Po(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function $r(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>$r(e[n],t[n])):!1}var mx=Object.prototype.hasOwnProperty;function Eo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Al(e)&&Al(t);if(!r&&!(Po(e)&&Po(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 l=0;for(let d=0;d<a;d++){const f=r?d:o[d],m=e[f],h=t[f];if(m===h){c[f]=m,(r?d<i:mx.call(e,f))&&l++;continue}if(m===null||h===null||typeof m!="object"||typeof h!="object"){c[f]=h;continue}const b=Eo(m,h,n+1);c[f]=b,b===m&&l++}return i===a&&l===i?e:c}function To(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 Al(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Po(e){if(!Rl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Rl(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Rl(e){return Object.prototype.toString.call(e)==="[object Object]"}function gx(e){return new Promise(t=>{yn.setTimeout(t,e)})}function ko(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 Eo(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 Eo(e,t)}return t}function yx(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function bx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zs=Symbol();function mp(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Zs&&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===Zs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gp(e,t){return typeof e=="function"?e(...t):!!e}function vx(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 Vr=(()=>{let e=()=>px;return{isServer(){return e()},setIsServer(t){e=t}}})();function Oo(){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 wx=fx;function _x(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=wx;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=_x(),Jn,Gt,er,yu,xx=(yu=class extends rs{constructor(){super();Q(this,Jn,!0);Q(this,Gt);Q(this,er);$(this,er,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(){S(this,Gt)||this.setEventListener(S(this,er))}onUnsubscribe(){var t;this.hasListeners()||((t=S(this,Gt))==null||t.call(this),$(this,Gt,void 0))}setEventListener(t){var n;$(this,er,t),(n=S(this,Gt))==null||n.call(this),$(this,Gt,t(this.setOnline.bind(this)))}setOnline(t){S(this,Jn)!==t&&($(this,Jn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return S(this,Jn)}},Jn=new WeakMap,Gt=new WeakMap,er=new WeakMap,yu),Ys=new xx;function Sx(e){return Math.min(1e3*2**e,3e4)}function yp(e){return(e??"online")==="online"?Ys.isOnline():!0}var Ao=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function bp(e){let t=!1,n=0,r;const s=Oo(),i=()=>s.status!=="pending",o=p=>{var g;if(!i()){const y=new Ao(p);m(y),(g=e.onCancel)==null||g.call(e,y)}},a=()=>{t=!0},c=()=>{t=!1},l=()=>qa.isFocused()&&(e.networkMode==="always"||Ys.isOnline())&&e.canRun(),d=()=>yp(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 g;r=y=>{(i()||l())&&p(y)},(g=e.onPause)==null||g.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),b=()=>{if(i())return;let p;const g=n===0?e.initialPromise:void 0;try{p=g??e.fn()}catch(y){p=Promise.reject(y)}Promise.resolve(p).then(f).catch(y=>{var P;if(i())return;const v=e.retry??(Vr.isServer()?0:3),x=e.retryDelay??Sx,_=typeof x=="function"?x(n,y):x,E=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,y);if(t||!E){m(y);return}n++,(P=e.onFail)==null||P.call(e,n,y),gx(_).then(()=>l()?void 0:h()).then(()=>{t?m(y):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?b():h().then(b),s)}}var wn,bu,vp=(bu=class{constructor(){Q(this,wn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Co(this.gcTime)&&$(this,wn,yn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vr.isServer()?1/0:300*1e3))}clearGcTimeout(){S(this,wn)!==void 0&&(yn.clearTimeout(S(this,wn)),$(this,wn,void 0))}},wn=new WeakMap,bu);function Cx(e){return{onFetch:(t,n)=>{var d,f,m,h,b;const r=t.options,s=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((h=t.state.data)==null?void 0:h.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const l=async()=>{let p=!1;const g=x=>{vx(x,()=>t.signal,()=>p=!0)},y=mp(t.options,t.fetchOptions),v=async(x,_,E)=>{if(p)return Promise.reject(t.signal.reason);if(_==null&&x.pages.length)return Promise.resolve(x);const k=(()=>{const L={client:t.client,queryKey:t.queryKey,pageParam:_,direction:E?"backward":"forward",meta:t.options.meta};return g(L),L})(),O=await y(k),{maxPages:R}=t.options,A=E?bx:yx;return{pages:A(x.pages,O,R),pageParams:A(x.pageParams,_,R)}};if(s&&i.length){const x=s==="backward",_=x?Ex:Nl,E={pages:i,pageParams:o},P=_(r,E);a=await v(E,P,x)}else{const x=e??i.length;do{const _=c===0?o[0]??r.initialPageParam:Nl(r,a);if(c>0&&_==null)break;a=await v(a,_),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var p,g;return(g=(p=t.options).persister)==null?void 0:g.call(p,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=l}}}function Nl(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 Ex(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 tr,_n,nr,st,xn,Ie,Wr,Sn,Qe,wp,Rt,vu,Tx=(vu=class extends vp{constructor(t){super();Q(this,Qe);Q(this,tr);Q(this,_n);Q(this,nr);Q(this,st);Q(this,xn);Q(this,Ie);Q(this,Wr);Q(this,Sn);$(this,Sn,!1),$(this,Wr,t.defaultOptions),this.setOptions(t.options),this.observers=[],$(this,xn,t.client),$(this,st,S(this,xn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,$(this,_n,Ll(this.options)),this.state=t.state??S(this,_n),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return S(this,tr)}get promise(){var t;return(t=S(this,Ie))==null?void 0:t.promise}setOptions(t){if(this.options={...S(this,Wr),...t},t!=null&&t._type&&$(this,tr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Ll(this.options);n.data!==void 0&&(this.setState(Dl(n.data,n.dataUpdatedAt)),$(this,_n,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&S(this,st).remove(this)}setData(t,n){const r=ko(this.state.data,t,this.options);return de(this,Qe,Rt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){de(this,Qe,Rt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=S(this,Ie))==null?void 0:r.promise;return(s=S(this,Ie))==null||s.cancel(t),n?n.then(Ke).catch(Ke):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return S(this,_n)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Xe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Zs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>en(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:!hp(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=S(this,Ie))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=S(this,Ie))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),S(this,st).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(S(this,Ie)&&(S(this,Sn)||de(this,Qe,wp).call(this)?S(this,Ie).cancel({revert:!0}):S(this,Ie).cancelRetry()),this.scheduleGc()),S(this,st).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||de(this,Qe,Rt).call(this,{type:"invalidate"})}async fetch(t,n){var l,d,f,m,h,b,p,g,y,v,x;if(this.state.fetchStatus!=="idle"&&((l=S(this,Ie))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(S(this,Ie))return S(this,Ie).continueRetry(),S(this,Ie).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(E=>E.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:()=>($(this,Sn,!0),r.signal)})},i=()=>{const _=mp(this.options,n),P=(()=>{const k={client:S(this,xn),queryKey:this.queryKey,meta:this.meta};return s(k),k})();return $(this,Sn,!1),this.options.persister?this.options.persister(_,P,this):_(P)},a=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:S(this,xn),state:this.state,fetchFn:i};return s(_),_})(),c=S(this,tr)==="infinite"?Cx(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),$(this,nr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&de(this,Qe,Rt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),$(this,Ie,bp({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof Ao&&_.revert&&this.setState({...S(this,nr),fetchStatus:"idle"}),r.abort()},onFail:(_,E)=>{de(this,Qe,Rt).call(this,{type:"failed",failureCount:_,error:E})},onPause:()=>{de(this,Qe,Rt).call(this,{type:"pause"})},onContinue:()=>{de(this,Qe,Rt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const _=await S(this,Ie).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=S(this,st).config).onSuccess)==null||h.call(m,_,this),(p=(b=S(this,st).config).onSettled)==null||p.call(b,_,this.state.error,this),_}catch(_){if(_ instanceof Ao){if(_.silent)return S(this,Ie).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw de(this,Qe,Rt).call(this,{type:"error",error:_}),(y=(g=S(this,st).config).onError)==null||y.call(g,_,this),(x=(v=S(this,st).config).onSettled)==null||x.call(v,this.state.data,_,this),_}finally{this.scheduleGc()}}},tr=new WeakMap,_n=new WeakMap,nr=new WeakMap,st=new WeakMap,xn=new WeakMap,Ie=new WeakMap,Wr=new WeakMap,Sn=new WeakMap,Qe=new WeakSet,wp=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,..._p(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Dl(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return $(this,nr,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()}),S(this,st).notify({query:this,type:"updated",action:t})})},vu);function _p(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:yp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Dl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ll(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 qe,pe,Gr,Ge,Cn,rr,Dt,qt,qr,sr,ir,En,Tn,Kt,or,we,Mr,Ro,No,Do,Lo,jo,Mo,Io,xp,wu,Px=(wu=class extends rs{constructor(t,n){super();Q(this,we);Q(this,qe);Q(this,pe);Q(this,Gr);Q(this,Ge);Q(this,Cn);Q(this,rr);Q(this,Dt);Q(this,qt);Q(this,qr);Q(this,sr);Q(this,ir);Q(this,En);Q(this,Tn);Q(this,Kt);Q(this,or,new Set);this.options=n,$(this,qe,t),$(this,qt,null),$(this,Dt,Oo()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(S(this,pe).addObserver(this),jl(S(this,pe),this.options)?de(this,we,Mr).call(this):this.updateResult(),de(this,we,Lo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Uo(S(this,pe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Uo(S(this,pe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,de(this,we,jo).call(this),de(this,we,Mo).call(this),S(this,pe).removeObserver(this)}setOptions(t){const n=this.options,r=S(this,pe);if(this.options=S(this,qe).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Xe(this.options.enabled,S(this,pe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");de(this,we,Io).call(this),S(this,pe).setOptions(this.options),n._defaulted&&!To(this.options,n)&&S(this,qe).getQueryCache().notify({type:"observerOptionsUpdated",query:S(this,pe),observer:this});const s=this.hasListeners();s&&Ml(S(this,pe),r,this.options,n)&&de(this,we,Mr).call(this),this.updateResult(),s&&(S(this,pe)!==r||Xe(this.options.enabled,S(this,pe))!==Xe(n.enabled,S(this,pe))||en(this.options.staleTime,S(this,pe))!==en(n.staleTime,S(this,pe)))&&de(this,we,Ro).call(this);const i=de(this,we,No).call(this);s&&(S(this,pe)!==r||Xe(this.options.enabled,S(this,pe))!==Xe(n.enabled,S(this,pe))||i!==S(this,Kt))&&de(this,we,Do).call(this,i)}getOptimisticResult(t){const n=S(this,qe).getQueryCache().build(S(this,qe),t),r=this.createResult(n,t);return Ox(this,r)&&($(this,Ge,r),$(this,rr,this.options),$(this,Cn,S(this,pe).state)),r}getCurrentResult(){return S(this,Ge)}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&&S(this,Dt).status==="pending"&&S(this,Dt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){S(this,or).add(t)}getCurrentQuery(){return S(this,pe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=S(this,qe).defaultQueryOptions(t),r=S(this,qe).getQueryCache().build(S(this,qe),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return de(this,we,Mr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),S(this,Ge)))}createResult(t,n){var R;const r=S(this,pe),s=this.options,i=S(this,Ge),o=S(this,Cn),a=S(this,rr),l=t!==r?t.state:S(this,Gr),{state:d}=t;let f={...d},m=!1,h;if(n._optimisticResults){const A=this.hasListeners(),L=!A&&jl(t,n),D=A&&Ml(t,r,n,s);(L||D)&&(f={...f,..._p(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:p,status:g}=f;h=f.data;let y=!1;if(n.placeholderData!==void 0&&h===void 0&&g==="pending"){let A;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(A=i.data,y=!0):A=typeof n.placeholderData=="function"?n.placeholderData((R=S(this,ir))==null?void 0:R.state.data,S(this,ir)):n.placeholderData,A!==void 0&&(g="success",h=ko(i==null?void 0:i.data,A,n),m=!0)}if(n.select&&h!==void 0&&!y)if(i&&h===(o==null?void 0:o.data)&&n.select===S(this,qr))h=S(this,sr);else try{$(this,qr,n.select),h=n.select(h),h=ko(i==null?void 0:i.data,h,n),$(this,sr,h),$(this,qt,null)}catch(A){$(this,qt,A)}S(this,qt)&&(b=S(this,qt),h=S(this,sr),p=Date.now(),g="error");const v=f.fetchStatus==="fetching",x=g==="pending",_=g==="error",E=x&&v,P=h!==void 0,O={status:g,fetchStatus:f.fetchStatus,isPending:x,isSuccess:g==="success",isError:_,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>l.dataUpdateCount||f.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!x,isLoadingError:_&&!P,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:_&&P,isStale:Za(t,n),refetch:this.refetch,promise:S(this,Dt),isEnabled:Xe(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const A=O.data!==void 0,L=O.status==="error"&&!A,D=W=>{L?W.reject(O.error):A&&W.resolve(O.data)},B=()=>{const W=$(this,Dt,O.promise=Oo());D(W)},U=S(this,Dt);switch(U.status){case"pending":t.queryHash===r.queryHash&&D(U);break;case"fulfilled":(L||O.data!==U.value)&&B();break;case"rejected":(!L||O.error!==U.reason)&&B();break}}return O}updateResult(){const t=S(this,Ge),n=this.createResult(S(this,pe),this.options);if($(this,Cn,S(this,pe).state),$(this,rr,this.options),S(this,Cn).data!==void 0&&$(this,ir,S(this,pe)),To(n,t))return;$(this,Ge,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!S(this,or).size)return!0;const o=new Set(i??S(this,or));return this.options.throwOnError&&o.add("error"),Object.keys(S(this,Ge)).some(a=>{const c=a;return S(this,Ge)[c]!==t[c]&&o.has(c)})};de(this,we,xp).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&de(this,we,Lo).call(this)}},qe=new WeakMap,pe=new WeakMap,Gr=new WeakMap,Ge=new WeakMap,Cn=new WeakMap,rr=new WeakMap,Dt=new WeakMap,qt=new WeakMap,qr=new WeakMap,sr=new WeakMap,ir=new WeakMap,En=new WeakMap,Tn=new WeakMap,Kt=new WeakMap,or=new WeakMap,we=new WeakSet,Mr=function(t){de(this,we,Io).call(this);let n=S(this,pe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ke)),n},Ro=function(){de(this,we,jo).call(this);const t=en(this.options.staleTime,S(this,pe));if(Vr.isServer()||S(this,Ge).isStale||!Co(t))return;const r=hp(S(this,Ge).dataUpdatedAt,t)+1;$(this,En,yn.setTimeout(()=>{S(this,Ge).isStale||this.updateResult()},r))},No=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(S(this,pe)):this.options.refetchInterval)??!1},Do=function(t){de(this,we,Mo).call(this),$(this,Kt,t),!(Vr.isServer()||Xe(this.options.enabled,S(this,pe))===!1||!Co(S(this,Kt))||S(this,Kt)===0)&&$(this,Tn,yn.setInterval(()=>{(this.options.refetchIntervalInBackground||qa.isFocused())&&de(this,we,Mr).call(this)},S(this,Kt)))},Lo=function(){de(this,we,Ro).call(this),de(this,we,Do).call(this,de(this,we,No).call(this))},jo=function(){S(this,En)!==void 0&&(yn.clearTimeout(S(this,En)),$(this,En,void 0))},Mo=function(){S(this,Tn)!==void 0&&(yn.clearInterval(S(this,Tn)),$(this,Tn,void 0))},Io=function(){const t=S(this,qe).getQueryCache().build(S(this,qe),this.options);if(t===S(this,pe))return;const n=S(this,pe);$(this,pe,t),$(this,Gr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},xp=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(S(this,Ge))}),S(this,qe).getQueryCache().notify({query:S(this,pe),type:"observerResultsUpdated"})})},wu);function kx(e,t){return Xe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Xe(t.retryOnMount,e)===!1)}function jl(e,t){return kx(e,t)||e.state.data!==void 0&&Uo(e,t,t.refetchOnMount)}function Uo(e,t,n){if(Xe(t.enabled,e)!==!1&&en(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Za(e,t)}return!1}function Ml(e,t,n,r){return(e!==t||Xe(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Za(e,n)}function Za(e,t){return Xe(t.enabled,e)!==!1&&e.isStaleByTime(en(t.staleTime,e))}function Ox(e,t){return!To(e.getCurrentResult(),t)}var Kr,xt,He,Pn,St,$t,_u,Ax=(_u=class extends vp{constructor(t){super();Q(this,St);Q(this,Kr);Q(this,xt);Q(this,He);Q(this,Pn);$(this,Kr,t.client),this.mutationId=t.mutationId,$(this,He,t.mutationCache),$(this,xt,[]),this.state=t.state||Rx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){S(this,xt).includes(t)||(S(this,xt).push(t),this.clearGcTimeout(),S(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){$(this,xt,S(this,xt).filter(n=>n!==t)),this.scheduleGc(),S(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){S(this,xt).length||(this.state.status==="pending"?this.scheduleGc():S(this,He).remove(this))}continue(){var t;return((t=S(this,Pn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,l,d,f,m,h,b,p,g,y,v,x,_,E,P,k;const n=()=>{de(this,St,$t).call(this,{type:"continue"})},r={client:S(this,Kr),meta:this.options.meta,mutationKey:this.options.mutationKey};$(this,Pn,bp({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(O,R)=>{de(this,St,$t).call(this,{type:"failed",failureCount:O,error:R})},onPause:()=>{de(this,St,$t).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>S(this,He).canRun(this)}));const s=this.state.status==="pending",i=!S(this,Pn).canStart();try{if(s)n();else{de(this,St,$t).call(this,{type:"pending",variables:t,isPaused:i}),S(this,He).config.onMutate&&await S(this,He).config.onMutate(t,this,r);const R=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));R!==this.state.context&&de(this,St,$t).call(this,{type:"pending",context:R,variables:t,isPaused:i})}const O=await S(this,Pn).start();return await((l=(c=S(this,He).config).onSuccess)==null?void 0:l.call(c,O,t,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,O,t,this.state.context,r)),await((h=(m=S(this,He).config).onSettled)==null?void 0:h.call(m,O,null,this.state.variables,this.state.context,this,r)),await((p=(b=this.options).onSettled)==null?void 0:p.call(b,O,null,t,this.state.context,r)),de(this,St,$t).call(this,{type:"success",data:O}),O}catch(O){try{await((y=(g=S(this,He).config).onError)==null?void 0:y.call(g,O,t,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,O,t,this.state.context,r))}catch(R){Promise.reject(R)}try{await((E=(_=S(this,He).config).onSettled)==null?void 0:E.call(_,void 0,O,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((k=(P=this.options).onSettled)==null?void 0:k.call(P,void 0,O,t,this.state.context,r))}catch(R){Promise.reject(R)}throw de(this,St,$t).call(this,{type:"error",error:O}),O}finally{S(this,He).runNext(this)}}},Kr=new WeakMap,xt=new WeakMap,He=new WeakMap,Pn=new WeakMap,St=new WeakSet,$t=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(()=>{S(this,xt).forEach(r=>{r.onMutationUpdate(t)}),S(this,He).notify({mutation:this,type:"updated",action:t})})},_u);function Rx(){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,Zr,xu,Nx=(xu=class extends rs{constructor(t={}){super();Q(this,Lt);Q(this,ut);Q(this,Zr);this.config=t,$(this,Lt,new Set),$(this,ut,new Map),$(this,Zr,0)}build(t,n,r){const s=new Ax({client:t,mutationCache:this,mutationId:++ss(this,Zr)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){S(this,Lt).add(t);const n=bs(t);if(typeof n=="string"){const r=S(this,ut).get(n);r?r.push(t):S(this,ut).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(S(this,Lt).delete(t)){const n=bs(t);if(typeof n=="string"){const r=S(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&&S(this,ut).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=bs(t);if(typeof n=="string"){const r=S(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=bs(t);if(typeof n=="string"){const s=(r=S(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(()=>{S(this,Lt).forEach(t=>{this.notify({type:"removed",mutation:t})}),S(this,Lt).clear(),S(this,ut).clear()})}getAll(){return Array.from(S(this,Lt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ol(n,r))}findAll(t={}){return this.getAll().filter(n=>Ol(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))))}},Lt=new WeakMap,ut=new WeakMap,Zr=new WeakMap,xu);function bs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ct,Su,Dx=(Su=class extends rs{constructor(t={}){super();Q(this,Ct);this.config=t,$(this,Ct,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Ka(s,n);let o=this.get(i);return o||(o=new Tx({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){S(this,Ct).has(t.queryHash)||(S(this,Ct).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=S(this,Ct).get(t.queryHash);n&&(t.destroy(),n===t&&S(this,Ct).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return S(this,Ct).get(t)}getAll(){return[...S(this,Ct).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>kl(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>kl(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()})})}},Ct=new WeakMap,Su),Ae,Zt,Yt,ar,cr,Qt,lr,ur,Cu,Lx=(Cu=class{constructor(e={}){Q(this,Ae);Q(this,Zt);Q(this,Yt);Q(this,ar);Q(this,cr);Q(this,Qt);Q(this,lr);Q(this,ur);$(this,Ae,e.queryCache||new Dx),$(this,Zt,e.mutationCache||new Nx),$(this,Yt,e.defaultOptions||{}),$(this,ar,new Map),$(this,cr,new Map),$(this,Qt,0)}mount(){ss(this,Qt)._++,S(this,Qt)===1&&($(this,lr,qa.subscribe(async e=>{e&&(await this.resumePausedMutations(),S(this,Ae).onFocus())})),$(this,ur,Ys.subscribe(async e=>{e&&(await this.resumePausedMutations(),S(this,Ae).onOnline())})))}unmount(){var e,t;ss(this,Qt)._--,S(this,Qt)===0&&((e=S(this,lr))==null||e.call(this),$(this,lr,void 0),(t=S(this,ur))==null||t.call(this),$(this,ur,void 0))}isFetching(e){return S(this,Ae).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return S(this,Zt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=S(this,Ae).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=S(this,Ae).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(en(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return S(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=S(this,Ae).get(r.queryHash),i=s==null?void 0:s.state.data,o=hx(t,i);if(o!==void 0)return S(this,Ae).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>S(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=S(this,Ae).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=S(this,Ae);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=S(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(()=>S(this,Ae).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ke).catch(Ke)}invalidateQueries(e,t={}){return Fe.batch(()=>(S(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(()=>S(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=S(this,Ae).build(this,t);return n.isStaleByTime(en(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 Ys.isOnline()?S(this,Zt).resumePausedMutations():Promise.resolve()}getQueryCache(){return S(this,Ae)}getMutationCache(){return S(this,Zt)}getDefaultOptions(){return S(this,Yt)}setDefaultOptions(e){$(this,Yt,e)}setQueryDefaults(e,t){S(this,ar).set(Br(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...S(this,ar).values()],n={};return t.forEach(r=>{$r(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){S(this,cr).set(Br(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...S(this,cr).values()],n={};return t.forEach(r=>{$r(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...S(this,Yt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ka(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===Zs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...S(this,Yt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){S(this,Ae).clear(),S(this,Zt).clear()}},Ae=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,ar=new WeakMap,cr=new WeakMap,Qt=new WeakMap,lr=new WeakMap,ur=new WeakMap,Cu),Sp=w.createContext(void 0),Cp=e=>{const t=w.useContext(Sp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},jx=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Sp.Provider,{value:e,children:t})),Ep=w.createContext(!1),Mx=()=>w.useContext(Ep);Ep.Provider;function Ix(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ux=w.createContext(Ix()),Fx=()=>w.useContext(Ux),Bx=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?gp(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},$x=e=>{w.useEffect(()=>{e.clearReset()},[e])},Vx=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||gp(n,[e.error,r])),Hx=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))}},zx=(e,t)=>e.isLoading&&e.isFetching&&!t,Wx=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Il=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Gx(e,t,n){var h,b,p,g;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Mx(),s=Fx(),i=Cp(),o=i.defaultQueryOptions(e);(b=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||b.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,Hx(o),Bx(o,s,a),$x(s);const l=!i.getQueryCache().get(o.queryHash),[d]=w.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),m=!r&&c;if(w.useSyncExternalStore(w.useCallback(y=>{const v=m?d.subscribe(Fe.batchCalls(y)):Ke;return d.updateResult(),v},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),w.useEffect(()=>{d.setOptions(o)},[o,d]),Wx(o,f))throw Il(o,d,s);if(Vx({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((g=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||g.call(p,o,f),o.experimental_prefetchInRender&&!Vr.isServer()&&zx(f,r)){const y=l?Il(o,d,s):a==null?void 0:a.promise;y==null||y.catch(Ke).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Ci(e,t){return Gx(e,Px)}const qx="widget-accounts",Tp="widget-positions",Pp="widget-orders",Kx=2e4;function Ji(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 Zx(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 Ya(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return Ji(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 Ji(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?Ji(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=Zx(e);if(n!==void 0)return Ya(n)}return"—"}const kp=["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"],Yx={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 Ei(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=Ei(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function vs(e,t){const n=Ei(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(l=>typeof l=="object"&&l!==null)}}}return[]}function Fo(e){return e===void 0?.01:e>=100?e/1e4:e}function Xx(e,t){return Ef(t,e)}function Jx(e){const t=Ei(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=wt(e,["type","Type","orderType","OrderType"])??2;return{label:Yx[n]??(n%2===1?"sell":"buy"),side:Ws(n),typeNum:n}}function eS(e,t){const n=wt(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return Fo(n);const r=wt(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?Fo(r):0}function tS(e,t){const n=vs(e,["ticket","Ticket","order","Order","id","ID"]),r=vs(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=tt(r),{label:i,side:o,typeNum:a}=Jx(e),c=wt(e,["typeTime","TypeTime"])??0,l=Fo(wt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),d=eS(e),f=wt(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,m=wt(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),h=wt(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??f,b=wt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),p=wt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),g=vs(e,["comment","Comment"])??"",y=Xx(e,s),v=Ya(Ei(e,kp));return{ticket:n,login:vs(e,["login","Login"])??t,symbol:s,displaySymbol:wi(s),time:v,typeLabel:i,orderType:a,typeTime:c,side:o,volumeLots:l,volumeFilledLots:d,orderPrice:f,priceTrigger:m,stopLoss:b,takeProfit:p,currentPrice:h,comment:g,digits:y}}function nS(e,t){return Qx(e).map(n=>tS(n,t)).filter(n=>n!==null)}function Ti(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Vt(e,t){const n=Ti(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function ws(e,t){const n=Ti(e,t);if(n!==void 0)return String(n)}function rS(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(l=>typeof l=="object"&&l!==null)}}}return[]}function sS(e){return e===void 0?.01:e>=100?e/1e4:e}function iS(e){const t=Ti(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=Vt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function oS(e,t){return Ef(t,e)}function aS(e,t){const n=ws(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=ws(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=tt(r),i=iS(e),o=sS(Vt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Vt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,c=Vt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,l=Vt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),d=Vt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),f=Vt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,m=Vt(e,["swap","Swap"])??0,h=ws(e,["comment","Comment"])??"",b=oS(e,s),p=Ya(Ti(e,kp));return{ticket:n,login:ws(e,["login","Login"])??t,symbol:s,displaySymbol:wi(s),time:p,type:i,volumeLots:o,openPrice:a,stopLoss:l,takeProfit:d,currentPrice:c,marketBid:c,marketAsk:c,swap:m,profit:f,comment:h,digits:b}}function cS(e,t){return rS(e).map(n=>aS(n,t)).filter(n=>n!==null)}function Op(){return Jf()}function Ap(){const e=pn(),{data:t,isLoading:n,isError:r}=Ci({queryKey:[qx,e.baseUrl],queryFn:()=>e.getAccounts()});return{accounts:t??[],isLoading:n,isError:r}}function lS(e){const t=pn();return Ci({queryKey:[Tp,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:Kx})}function uS(e){const t=pn();return Ci({queryKey:[Pp,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function dS(){const e=Cp(),t=pn();return C.useCallback((n,r)=>{e.invalidateQueries({queryKey:[Tp,t.baseUrl,n]}),(r===void 0||Oa(r))&&e.invalidateQueries({queryKey:[Pp,t.baseUrl,n]})},[t.baseUrl,e])}function Pi(){const e=pn(),t=dS();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 fS(e,t){return e!=null?cS(e,t):[]}function pS(e,t){return e!=null?nS(e,t):[]}function Qa(e){const t=he(l=>l.setPositions),n=he(l=>l.setOrders),{data:r,isLoading:s,isError:i}=lS(e),{data:o,isLoading:a,isError:c}=uS(e);return C.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(fS(r,e)),o!=null&&n(pS(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||c)}}function hS({symbolTicker:e,controlsRef:t,chartWidget:n,chartContainer:r,orderState:s}){const{openMarketPanel:i,setSelectedLogin:o,accountOptions:a,selectedLogin:c,isAccountsLoading:l}=s,{isLoading:d}=Qa(c),[f,m]=C.useState(c),h=C.useRef(null),b=C.useCallback(g=>{g!==c&&o(g)},[c,o]),p=d&&c!==f;return C.useEffect(()=>{!d&&c!==f&&m(c)},[d,f,c]),C.useEffect(()=>(t.current={open:i,setSelectedLogin:o},()=>{t.current=null}),[t,i,o]),C.useEffect(()=>{if(!n)return;let g=!1;return(async()=>{try{if(await new Promise(x=>{try{n.onChartReady(()=>x())}catch{x()}}),g)return;const v=await cx(n,()=>!g);if(g){v==null||v.remove();return}h.current=v,Pl(v,{accountOptions:a,selectedLogin:c,isAccountsLoading:l,isAccountDataLoading:p},b,r)}catch{}})(),()=>{var v;g=!0,(v=h.current)==null||v.remove(),h.current=null}},[a,r,n,b,l,p,c]),C.useEffect(()=>{Pl(h.current,{accountOptions:a,selectedLogin:c,isAccountsLoading:l,isAccountDataLoading:p},b,r)},[a,r,b,l,p,c]),u.jsxs(u.Fragment,{children:[u.jsx(ap,{chartWidget:n,symbolTicker:e}),u.jsx(np,{}),u.jsx(j_,{symbolTicker:e,orderState:s})]})}const Ul=224,Fl=32,Xa=120;function Rp(){return typeof window>"u"?560:Math.max(Xa,Math.floor(window.innerHeight*.7))}function mS(e){return Math.min(Rp(),Math.max(Xa,e))}function gS(){const[e,t]=C.useState(Ul),[n,r]=C.useState(!1),s=C.useRef(Ul);C.useEffect(()=>{s.current=e},[e]);const i=C.useCallback(d=>{t(mS(d))},[]),o=C.useCallback(()=>{i(s.current+Fl)},[i]),a=C.useCallback(()=>{i(s.current-Fl)},[i]),c=C.useCallback(d=>{const f=d,m=s.current;r(!0);const h=p=>{const g=f-p.clientY;i(m+g)},b=()=>{r(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",b),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",b),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[i]);C.useEffect(()=>{const d=()=>{i(s.current)};return window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const l=Rp();return{height:e,isResizing:n,canIncrement:e<l,canDecrement:e>Xa,onResizeStart:c,incrementHeight:o,decrementHeight:a}}const yS=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),bS=2e4;let eo=0;function vS(){return eo=(eo+1)%Number.MAX_VALUE,eo.toString()}const to=new Map,Bl=(e,t)=>{if(to.has(e))return;const n=setTimeout(()=>{to.delete(e),Ns({type:"REMOVE_TOAST",toastId:e})},t||bS);to.set(e,n)},wS=(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);Bl(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{Bl(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)}}},_S=[];let no={toasts:[]};function Ns(e){no=wS(no,e),_S.forEach(t=>{t(no)})}function _e({duration:e=2e4,description:t,...n}){const r=vS(),s=typeof t=="string"?yS(t):t,i=a=>Ns({type:"UPDATE_TOAST",toast:{...a,description:s,id:r}}),o=()=>{Ns({type:"DISMISS_TOAST",toastId:r})};return Ns({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 xS(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function SS(){const{closePosition:e,deleteOrder:t}=Pi(),n=he(p=>p.removePosition),r=he(p=>p.removeOrder),s=he(p=>p.setSelectedPositionTicket),i=he(p=>p.setSelectedOrderTicket),[o,a]=C.useState(new Set),[c,l]=C.useState(!1),d=C.useCallback((p,g)=>{a(y=>{const v=new Set(y);return g?v.add(p):v.delete(p),v})},[]),f=C.useCallback(p=>o.has(p),[o]),m=C.useCallback(async p=>{const g=`position-${p.ticket}`;d(g,!0);try{const y=await e(p);if(!y.success){_e({variant:"destructive",description:y.message||"Failed to close position."});return}n(p.ticket),s(null),_e({description:`Position #${p.ticket} closed at ${xS(p).toFixed(p.digits)}.`})}catch(y){const v=y instanceof Error?y.message:"Failed to close position.";_e({variant:"destructive",description:v})}finally{d(g,!1)}},[e,n,d,s]),h=C.useCallback(async p=>{if(p.length===0||c)return;if(!e){_e({variant:"destructive",description:"Close position is not configured."});return}l(!0);let g=0,y=0;for(const v of p){const x=`position-${v.ticket}`;d(x,!0);try{if(!(await e(v)).success){y+=1;continue}n(v.ticket),g+=1}catch{y+=1}finally{d(x,!1)}}s(null),_e(y===0?{description:g===1?"1 position closed.":`${g} positions closed.`}:g===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${g}, failed ${y}.`}),l(!1)},[c,e,n,d,s]),b=C.useCallback(async p=>{const g=`order-${p.ticket}`;d(g,!0);try{const y=await t(p);if(!y.success){_e({variant:"destructive",description:y.message||"Failed to delete order."});return}r(p.ticket),i(null),_e({description:`Order #${p.ticket} deleted.`})}catch(y){const v=y instanceof Error?y.message:"Failed to delete order.";_e({variant:"destructive",description:v})}finally{d(g,!1)}},[t,r,d,i]);return{closePosition:m,closeAllPositions:h,deleteOrder:b,isClosingAll:c,isRowBusy:f}}function zt(e,t=2){return e.toFixed(t)}function Np(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function CS(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=Np(t),a=r+s+o+n,c=a-i,l=i>0?a/i*100:void 0;return{balance:r,equity:a,margin:i,marginFree:c,marginLevel:l,totalProfit:o}}function $l(){return u.jsxs("colgroup",{children:[u.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),u.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),u.jsx("col",{className:"web-trading-widget-terminal-col--time"}),u.jsx("col",{className:"web-trading-widget-terminal-col--type"}),u.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),u.jsx("col",{className:"web-trading-widget-terminal-col--price"}),u.jsx("col",{className:"web-trading-widget-terminal-col--sl"}),u.jsx("col",{className:"web-trading-widget-terminal-col--tp"}),u.jsx("col",{className:"web-trading-widget-terminal-col--price2"}),u.jsx("col",{className:"web-trading-widget-terminal-col--swap"}),u.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),u.jsx("col",{}),u.jsx("col",{className:"web-trading-widget-terminal-col--close"})]})}function ES(){return u.jsx("thead",{children:u.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Ticket"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Server time"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Type"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"S / L"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"T / P"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Swap"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"}),u.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":"Close"})]})})}function TS({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s}){return u.jsx("div",{className:"web-trading-widget-terminal__stats",children:u.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[u.jsxs("span",{children:["Balance: ",zt(e)]}),u.jsxs("span",{children:["Equity: ",zt(t)]}),u.jsxs("span",{children:["Margin: ",zt(n)]}),u.jsxs("span",{children:["Free margin: ",zt(r)]}),u.jsxs("span",{children:["Level: ",s!==void 0?`${zt(s,2)}%`:"0.00%"]})]})})}function PS({totalProfit:e,positionCount:t,isClosingAll:n,onCloseAllPositions:r}){const s=t>0,i=e>0?"web-trading-widget-text-profit-positive":e<0?"web-trading-widget-text-profit-negative":"";return u.jsx("div",{className:"web-trading-widget-terminal__toolbar",children:u.jsxs("div",{className:"web-trading-widget-terminal__toolbar-actions",children:[s?u.jsx("button",{type:"button",disabled:n,onClick:r,className:"web-trading-widget-terminal__close-all-btn",children:n?"Closing…":"Close all"}):null,u.jsxs("span",{className:`web-trading-widget-terminal__toolbar-profit ${i}`,children:[zt(e)," ",u.jsx("span",{children:"USD"})]})]})})}function kS({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 u.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[u.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),u.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),u.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.type}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.volumeLots.toFixed(2)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Te(e.openPrice,e.digits)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0?Te(e.stopLoss,e.digits):""}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0?Te(e.takeProfit,e.digits):""}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Te(e.currentPrice,e.digits)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?zt(e.swap):""}),u.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:zt(e.profit)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:u.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:u.jsx(un,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function OS({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 u.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[u.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),u.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),u.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.typeLabel}),u.jsxs("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:[e.volumeLots.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)]}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Te(e.orderPrice,e.digits)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0?Te(e.stopLoss,e.digits):""}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0?Te(e.takeProfit,e.digits):""}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Te(e.currentPrice,e.digits)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:u.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:u.jsx(un,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function Dp({embedded:e=!1,onCreateNewOrder:t}){const{accounts:n,isLoading:r}=Ap(),s=gS(),{height:i,isResizing:o,onResizeStart:a}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:s,c=he(N=>N.selectedLogin),l=he(N=>N.selectedPositionTicket),d=he(N=>N.selectedOrderTicket),f=he(N=>N.setSelectedPositionTicket),m=he(N=>N.setSelectedOrderTicket),{isLoading:h}=Qa(c),b=he(N=>N.positions),p=he(N=>N.orders),{closePosition:g,closeAllPositions:y,deleteOrder:v,isClosingAll:x,isRowBusy:_}=SS(),E=r||h,P=C.useMemo(()=>c?b.filter(N=>N.login===c):b,[b,c]),k=C.useMemo(()=>c?p.filter(N=>N.login===c):p,[p,c]),O=C.useMemo(()=>{const N=n.find(F=>F.login===c);return(N==null?void 0:N.tradeStat)??null},[n,c]),R=C.useMemo(()=>P.map(N=>N.ticket).sort().join("|"),[P]),A=C.useMemo(()=>O?`${O.balance}:${O.credit??0}:${O.equity}:${O.margin}|${R}`:"",[O,R]),L=C.useMemo(()=>{if(!O||P.length===0)return 0;const N=Np(P);return O.equity-O.balance-(O.credit??0)-N},[A]),D=C.useMemo(()=>CS(O,P,L),[O,P,L]),B=P.length===0&&k.length===0,U=C.useRef(null),W=C.useRef(null),z=C.useCallback(()=>{y(P)},[y,P]),j=C.useCallback(N=>{const F=U.current,M=W.current;if(!(!F||!M)){if(N==="body"){F.scrollLeft=M.scrollLeft;return}M.scrollLeft=F.scrollLeft}},[]);return u.jsxs(u.Fragment,{children:[!e&&o?u.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,u.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height:i},children:[e?null:u.jsx("div",{className:"web-trading-widget-terminal__resize-bar-wrap",children:u.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":i,className:"web-trading-widget-terminal__resize-bar",onMouseDown:N=>{N.preventDefault(),a(N.clientY)},children:u.jsx(cf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),u.jsx(PS,{totalProfit:D.totalProfit,positionCount:P.length,isClosingAll:x,onCloseAllPositions:z}),u.jsx("div",{ref:U,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>j("header"),children:u.jsxs("table",{className:"web-trading-widget-terminal__table",children:[u.jsx($l,{}),u.jsx(ES,{})]})}),u.jsx("div",{ref:W,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>j("body"),children:u.jsxs("table",{className:"web-trading-widget-terminal__table",children:[u.jsx($l,{}),u.jsxs("tbody",{children:[E&&B?u.jsx("tr",{children:u.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!E&&B?u.jsx("tr",{children:u.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:u.jsxs("div",{className:"web-trading-widget-terminal__empty-inner",children:[u.jsx("p",{className:"web-trading-widget-terminal__empty-text",children:"You don't have any positions"}),t?u.jsx("button",{type:"button",onClick:t,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,P.map(N=>u.jsx(kS,{position:N,isSelected:l===N.ticket,isClosing:_(`position-${N.ticket}`),onSelect:()=>f(N.ticket),onClose:()=>void g(N)},`position-${N.ticket}`)),k.map(N=>u.jsx(OS,{order:N,isSelected:d===N.ticket,isDeleting:_(`order-${N.ticket}`),onSelect:()=>m(N.ticket),onDelete:()=>void v(N)},`order-${N.ticket}`))]})]})}),u.jsx(TS,{balance:D.balance,equity:D.equity,margin:D.margin,marginFree:D.marginFree,marginLevel:D.marginLevel})]})]})}const Bo=224,Qs=120;function AS(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(Qs,Math.floor(t*.35)):Bo}function RS(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(Qs,Math.floor(t*.85)):typeof window>"u"?560:Math.max(Qs,Math.floor(window.innerHeight*.7))}function NS(e,t){return Math.min(RS(t),Math.max(Qs,e))}function DS({containerRef:e,isOpen:t=!1}={}){const[n,r]=C.useState(Bo),[s,i]=C.useState(!1),o=C.useRef(Bo);C.useEffect(()=>{o.current=n},[n]);const a=C.useCallback(l=>{r(NS(l,e))},[e]);C.useEffect(()=>{if(!t)return;const l=Math.max(o.current,AS(e));a(l)},[e,t,a]);const c=C.useCallback(l=>{const d=l,f=o.current;i(!0);const m=b=>{const p=d-b.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 C.useEffect(()=>{const l=()=>{a(o.current)};return window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l),document.body.style.cursor="",document.body.style.userSelect=""}},[a]),{height:n,isResizing:s,onResizeStart:c}}function Lp({children:e}){const[t]=C.useState(()=>new Lx({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return u.jsx(jx,{client:t,children:e})}function jp({containerRef:e,onCreateNewOrder:t}){const[n,r]=C.useState(!1),{height:s,isResizing:i,onResizeStart:o}=DS({containerRef:e,isOpen:n}),a=he(b=>b.selectedLogin),c=he(b=>b.orders),l=he(b=>b.positions),d=C.useMemo(()=>a?c.filter(b=>b.login===a):c,[a,c]),f=C.useMemo(()=>a?l.filter(b=>b.login===a):l,[a,l]),m=d.length+f.length,h=()=>{r(!1),t==null||t()};return u.jsxs("div",{className:"web-trading-widget-news-orders-overlay-root",children:[u.jsxs("button",{type:"button",className:"web-trading-widget-news-orders-overlay__trigger","aria-label":"Open terminal","aria-expanded":n,onClick:()=>r(!0),children:[u.jsx(Ab,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),u.jsx("span",{children:"Orders"}),m>0?u.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:m}):null]}),n?u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"web-trading-widget-news-orders__backdrop","aria-label":"Close terminal panel",onClick:()=>r(!1)}),u.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:s},children:[i?u.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,u.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:u.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":s,className:"web-trading-widget-terminal__resize-bar",onMouseDown:b=>{b.preventDefault(),o(b.clientY)},children:u.jsx(cf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),u.jsxs("div",{className:"web-trading-widget-news-orders__panel-header",children:[u.jsx("h2",{className:"web-trading-widget-news-orders__panel-title",children:"Terminal"}),u.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":"Close terminal panel",onClick:()=>r(!1),children:u.jsx(un,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),u.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:u.jsx(Dp,{embedded:!0,onCreateNewOrder:t?h:void 0})})]})]}):null]})}function LS({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return u.jsx(Lp,{children:u.jsx(tp,{baseUrl:e,children:u.jsx(jp,{containerRef:t,onCreateNewOrder:n})})})}const On=C.forwardRef(({className:e,type:t,...n},r)=>u.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}));On.displayName="Input";var ki="Collapsible",[jS,Mp]=xr(ki),[MS,Ja]=jS(ki),Ip=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[c,l]=fr({prop:r,defaultProp:s??!1,onChange:o,caller:ki});return u.jsx(MS,{scope:n,disabled:i,contentId:Jt(),open:c,onOpenToggle:w.useCallback(()=>l(d=>!d),[l]),children:u.jsx(ve.div,{"data-state":tc(c),"data-disabled":i?"":void 0,...a,ref:t})})});Ip.displayName=ki;var Up="CollapsibleTrigger",Fp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Ja(Up,n);return u.jsx(ve.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":tc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:xe(e.onClick,s.onOpenToggle)})});Fp.displayName=Up;var ec="CollapsibleContent",Bp=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Ja(ec,e.__scopeCollapsible);return u.jsx(Sr,{present:n||s.open,children:({present:i})=>u.jsx(IS,{...r,ref:t,present:i})})});Bp.displayName=ec;var IS=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=Ja(ec,n),[a,c]=w.useState(r),l=w.useRef(null),d=ke(t,l),f=w.useRef(0),m=f.current,h=w.useRef(0),b=h.current,p=o.open||a,g=w.useRef(p),y=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),Ue(()=>{const v=l.current;if(v){y.current=y.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,g.current||(v.style.transitionDuration=y.current.transitionDuration,v.style.animationName=y.current.animationName),c(r)}},[o.open,r]),u.jsx(ve.div,{"data-state":tc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:p&&s})});function tc(e){return e?"open":"closed"}var US=Ip,FS=Fp,BS=Bp,yt="Accordion",$S=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[nc,VS,HS]=cd(yt),[Oi]=xr(yt,[HS,Mp]),rc=Mp(),$p=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return u.jsx(nc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?u.jsx(qS,{...i,ref:t}):u.jsx(GS,{...s,ref:t})})});$p.displayName=yt;var[Vp,zS]=Oi(yt),[Hp,WS]=Oi(yt,{collapsible:!1}),GS=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,c]=fr({prop:n,defaultProp:r??"",onChange:s,caller:yt});return u.jsx(Vp,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:c,onItemClose:w.useCallback(()=>i&&c(""),[i,c]),children:u.jsx(Hp,{scope:e.__scopeAccordion,collapsible:i,children:u.jsx(zp,{...o,ref:t})})})}),qS=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=fr({prop:n,defaultProp:r??[],onChange:s,caller:yt}),c=w.useCallback(d=>a((f=[])=>[...f,d]),[a]),l=w.useCallback(d=>a((f=[])=>f.filter(m=>m!==d)),[a]);return u.jsx(Vp,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:u.jsx(Hp,{scope:e.__scopeAccordion,collapsible:!0,children:u.jsx(zp,{...i,ref:t})})})}),[KS,Ai]=Oi(yt),zp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),c=ke(a,t),l=VS(n),f=ld(s)==="ltr",m=xe(e.onKeyDown,h=>{var O;if(!$S.includes(h.key))return;const b=h.target,p=l().filter(R=>{var A;return!((A=R.ref.current)!=null&&A.disabled)}),g=p.findIndex(R=>R.ref.current===b),y=p.length;if(g===-1)return;h.preventDefault();let v=g;const x=0,_=y-1,E=()=>{v=g+1,v>_&&(v=x)},P=()=>{v=g-1,v<x&&(v=_)};switch(h.key){case"Home":v=x;break;case"End":v=_;break;case"ArrowRight":i==="horizontal"&&(f?E():P());break;case"ArrowDown":i==="vertical"&&E();break;case"ArrowLeft":i==="horizontal"&&(f?P():E());break;case"ArrowUp":i==="vertical"&&P();break}const k=v%y;(O=p[k].ref.current)==null||O.focus()});return u.jsx(KS,{scope:n,disabled:r,direction:s,orientation:i,children:u.jsx(nc.Slot,{scope:n,children:u.jsx(ve.div,{...o,"data-orientation":i,ref:c,onKeyDown:r?void 0:m})})})}),Xs="AccordionItem",[ZS,sc]=Oi(Xs),Wp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Ai(Xs,n),o=zS(Xs,n),a=rc(n),c=Jt(),l=r&&o.value.includes(r)||!1,d=i.disabled||e.disabled;return u.jsx(ZS,{scope:n,open:l,disabled:d,triggerId:c,children:u.jsx(US,{"data-orientation":i.orientation,"data-state":Qp(l),...a,...s,ref:t,disabled:d,open:l,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});Wp.displayName=Xs;var Gp="AccordionHeader",qp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ai(yt,n),i=sc(Gp,n);return u.jsx(ve.h3,{"data-orientation":s.orientation,"data-state":Qp(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});qp.displayName=Gp;var $o="AccordionTrigger",Kp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ai(yt,n),i=sc($o,n),o=WS($o,n),a=rc(n);return u.jsx(nc.ItemSlot,{scope:n,children:u.jsx(FS,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});Kp.displayName=$o;var Zp="AccordionContent",Yp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ai(yt,n),i=sc(Zp,n),o=rc(n);return u.jsx(BS,{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}})});Yp.displayName=Zp;function Qp(e){return e?"open":"closed"}var YS=$p,QS=Wp,XS=qp,Xp=Kp,Jp=Yp;const JS=YS,Gn=w.forwardRef(({className:e,...t},n)=>u.jsx(QS,{ref:n,className:De("border-b",e),...t}));Gn.displayName="AccordionItem";const qn=w.forwardRef(({className:e,children:t,...n},r)=>u.jsx(XS,{className:"flex",children:u.jsxs(Xp,{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,u.jsx(ka,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));qn.displayName=Xp.displayName;const Kn=w.forwardRef(({className:e,children:t,...n},r)=>u.jsx(Jp,{ref:r,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:u.jsx("div",{className:De("pb-4 pt-0",e),children:t})}));Kn.displayName=Jp.displayName;function Vl(e){const t=e.trim().replace(/,/g,"");if(!t)return null;const n=Number(t);return Number.isFinite(n)?n:null}function Hl(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:l=!1}){const d=t.trim()!=="",f=b=>{if(c)return;const p=Vl(t),g=a!=null&&Number.isFinite(a)?a:s??0,v=(p??g)+b*r,x=s!==void 0?Math.max(s,v):v;x<=0||n(Hl(x,i))},m=()=>{const b=Vl(t);if(b===null||b<=0){t.trim()!==""&&n("");return}n(Hl(b,i))},h=()=>{c||n("")};return u.jsxs("div",{className:"web-trading-widget-stepper",children:[u.jsxs("div",{className:"web-trading-widget-stepper__header",children:[u.jsx("span",{className:"web-trading-widget-stepper__label",children:e}),l&&d?u.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:c,onClick:h,children:u.jsx(un,{className:"web-trading-widget-icon web-trading-widget-icon--xs"})}):null]}),u.jsxs("div",{className:`web-trading-widget-stepper__control${c?" web-trading-widget-stepper__control--disabled":""}`,children:[u.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:u.jsx(Nb,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),u.jsx("input",{type:"text",inputMode:"decimal",value:t,placeholder:o,disabled:c,onChange:b=>n(b.target.value),onBlur:m,className:"web-trading-widget-stepper__input"}),u.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:u.jsx(Db,{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:l=!1,onMinimize:d,onClose:f,onPlaceOrder:m}){const[h,b]=C.useState("market"),[p,g]=C.useState(String(r)),[y,v]=C.useState(""),[x,_]=C.useState(""),E=ae(J=>J.stopLoss),P=ae(J=>J.takeProfit),k=ae(J=>J.setStopLoss),O=ae(J=>J.setTakeProfit),R=ae(J=>J.setVolumeLots),A=ae(J=>J.setOrderSide),[L,D]=C.useState(""),[B,U]=C.useState(dt.GTC),[W,z]=C.useState(""),[j,N]=C.useState(""),F=Number(dn(fn(e))),M=Pr(F),Y=mf(t,n),se=t!==null?Te(t,F):"—",le=n!==null?Te(n,F):"—",oe=mi(h),Re=ff(h),Z=hi(h),K=Z.label,ue=!oe&&Z.orderType!==null&&Z.orderType%2===1,me=C.useMemo(()=>Y!==null?Y:t??n,[n,t,Y]),ge=J=>{g(J);const $e=Number(J);Number.isFinite($e)&&$e>0&&R($e)},ie=J=>t===null||n===null?null:oe?J==="buy"?n:t:ft(y)??(J==="buy"?n:t),te=J=>{const $e=ie(J);$e!==null&&A({side:J,entryPrice:$e})},je=J=>{if(t===null||n===null||!c)return;const $e=Math.max(i,Number(p)||i),Ri=df(h,J),Bn=ie(J);Bn!==null&&A({side:J,entryPrice:Bn}),m({login:c,executionMode:h,side:J,orderType:Ri,volumeLots:$e,stopLoss:E,takeProfit:P,priceOrder:y,priceTrigger:x,comment:L,typeTime:B,expirationDateTime:W,expirationDay:j,bid:t,ask:n})},Pe=t!==null&&n!==null,Ce=oe||ft(y)!==void 0,X=!Re||ft(x)!==void 0,Ee=oe||gi(B,W,j),Me=!o&&!a&&c!==""&&Pe&&Ce&&X&&Ee,We=!oe&&Ra(B),at=!oe&&Na(B);return u.jsxs("div",{className:"web-trading-widget-market-panel",children:[u.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[u.jsxs(bo,{value:h,onValueChange:J=>b(J),children:[u.jsx($s,{className:"web-trading-widget-market-panel__select-trigger",children:u.jsx(vo,{})}),u.jsx(Vs,{children:zs.map(J=>u.jsx(Hs,{value:J.mode,children:J.label},J.mode))})]}),l?null:u.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[u.jsx("button",{type:"button","aria-label":"Minimize to quick order panel",className:"web-trading-widget-market-panel__header-btn",onClick:d,children:u.jsx(uf,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),u.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-market-panel__header-btn",onClick:f,children:u.jsx(un,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),u.jsxs(JS,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[u.jsxs(Gn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),u.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:u.jsx(Ne,{label:"Lots",value:p,onChange:ge,step:s,min:i,decimals:2})})]}),oe?null:u.jsxs(Gn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),u.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:Re?u.jsxs(u.Fragment,{children:[u.jsx(Ne,{label:"Stop Price",value:x,onChange:_,step:M,decimals:F,basePrice:me,placeholder:Y!==null?Te(Y,F):"—"}),u.jsx(Ne,{label:"Limit Price",value:y,onChange:v,step:M,decimals:F,basePrice:me,placeholder:Y!==null?Te(Y,F):"—"})]}):u.jsx(Ne,{label:"Price",value:y,onChange:v,step:M,decimals:F,basePrice:me,placeholder:Y!==null?Te(Y,F):"—"})})]}),u.jsxs(Gn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),u.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:u.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[u.jsx(Ne,{label:"Stop Loss",value:E,onChange:k,step:M,decimals:F,basePrice:t,placeholder:t!==null?se:"—",clearable:!0}),u.jsx(Ne,{label:"Take Profit",value:P,onChange:O,step:M,decimals:F,basePrice:n,placeholder:n!==null?le:"—",clearable:!0})]})})]}),oe?null:u.jsxs(Gn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),u.jsxs(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:[u.jsxs(bo,{value:String(B),onValueChange:J=>U(Number(J)),children:[u.jsx($s,{className:"web-trading-widget-market-panel__select-full",children:u.jsx(vo,{})}),u.jsx(Vs,{children:pf.map(J=>u.jsx(Hs,{value:String(J.value),children:J.label},J.value))})]}),We?u.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[u.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),u.jsx(On,{type:"datetime-local",value:W,onChange:J=>z(J.target.value)})]}):null,at?u.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[u.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),u.jsx(On,{type:"date",value:j,onChange:J=>N(J.target.value)})]}):null]})]}),u.jsxs(Gn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),u.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:u.jsx(On,{value:L,onChange:J=>D(J.target.value),placeholder:""})})]})]}),u.jsxs("div",{className:"web-trading-widget-market-panel__footer",children:[u.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[u.jsx("span",{children:se}),u.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:le})]}),oe?u.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[u.jsx(Pt,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!Me,onMouseDown:()=>te("sell"),onClick:()=>je("sell"),children:"Sell by Market"}),u.jsx(Pt,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Me,onMouseDown:()=>te("buy"),onClick:()=>je("buy"),children:"Buy by Market"})]}):u.jsxs(Pt,{type:"button",variant:ue?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${ue?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Me,onMouseDown:()=>{const J=Z.orderType!==null&&Z.orderType%2===1?"sell":"buy";te(J)},onClick:()=>{const J=Z.orderType!==null&&Z.orderType%2===1?"sell":"buy";je(J)},children:["Place ",K]})]})]})}function eh({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(dn(fn(t))),s=Te(e.price,r),i=e.side==="sell"?"sell":"buy",o=wi(e.symbol||Tr(t));return u.jsxs("div",{className:"web-trading-widget-confirmation",children:[u.jsx("div",{className:"web-trading-widget-confirmation__close-row",children:u.jsx("button",{type:"button","aria-label":"Close confirmation",className:"web-trading-widget-confirmation__close-btn",onClick:n,children:u.jsx(un,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})}),u.jsxs("div",{className:"web-trading-widget-confirmation__body",children:[u.jsxs("p",{className:"web-trading-widget-confirmation__summary",children:[u.jsxs("span",{className:"web-trading-widget-confirmation__ticket",children:["#",e.ticket]})," ",u.jsx("span",{className:`web-trading-widget-confirmation__side web-trading-widget-confirmation__side--${e.side}`,children:i})," ",e.volumeLots.toFixed(2)," ",o]}),u.jsxs("p",{className:"web-trading-widget-confirmation__price",children:["at ",s]}),u.jsx("p",{className:"web-trading-widget-confirmation__status",children:"Placed"}),u.jsx(Pt,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:"OK"})]})]})}function _s(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function ro(e){const t=e.trim();if(!t)return;const n=Number(t);return Number.isFinite(n)?n:void 0}function th({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=Pi(),s=he(j=>j.removeOrder),[i,o]=C.useState(String(e.volumeLots)),[a,c]=C.useState(String(e.orderPrice)),[l,d]=C.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),f=ae(j=>j.stopLoss),m=ae(j=>j.takeProfit),h=ae(j=>j.setStopLoss),b=ae(j=>j.setTakeProfit),p=ae(j=>j.setDraft),g=ae(j=>j.clearDraft),[y,v]=C.useState(e.comment),[x,_]=C.useState(!1),[E,P]=C.useState(!1),k=Pr(e.digits);C.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:k}),()=>{g()}),[g,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,k,p]);const O=Aa(e.orderType),R=e.volumeLots,A=Number(a)||e.orderPrice,L=ro(l),D=x||E,B=!O||L!==void 0&&Number.isFinite(A)&&A>0,U=C.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${R.toFixed(2)} ${e.displaySymbol} at ${_s(A,e.digits)}`,[e,A,R]),W=async()=>{if(!B){_e({variant:"destructive",description:O?"Please set both stop and limit prices.":"Please set an order price."});return}_(!0);try{const j=await r(e,{volumeLots:R,priceOrder:A,priceTrigger:O?L:void 0,stopLoss:ro(f),takeProfit:ro(m),comment:y.trim()||"order modify"});if(!j.success){_e({variant:"destructive",description:j.message||"Failed to modify order."});return}t(),_e({description:`Order #${e.ticket} updated.`})}catch(j){const N=j instanceof Error?j.message:"Failed to modify order.";_e({variant:"destructive",description:N})}finally{_(!1)}},z=async()=>{P(!0);try{const j=await n(e);if(!j.success){_e({variant:"destructive",description:j.message||"Failed to delete order."});return}s(e.ticket),t(),_e({description:`Order #${e.ticket} deleted.`})}catch(j){const N=j instanceof Error?j.message:"Failed to delete order.";_e({variant:"destructive",description:N})}finally{P(!1)}};return u.jsxs("div",{className:"web-trading-widget-detail-panel",children:[u.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[u.jsxs("p",{className:`web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--${e.side}`,children:["#",e.ticket," ",e.typeLabel," ",R.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",O&&L!==void 0?`${_s(L,e.digits)} / ${_s(A,e.digits)}`:_s(A,e.digits)]}),u.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:u.jsx(un,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),u.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[u.jsx(Ne,{label:"Lots",value:i,onChange:o,step:.01,min:.01,decimals:2,disabled:!0}),O?u.jsxs(u.Fragment,{children:[u.jsx(Ne,{label:"Stop Price",value:l,onChange:d,step:k,decimals:e.digits,basePrice:e.currentPrice}),u.jsx(Ne,{label:"Limit Price",value:a,onChange:c,step:k,decimals:e.digits,basePrice:e.currentPrice})]}):u.jsx(Ne,{label:"Price",value:a,onChange:c,step:k,decimals:e.digits,basePrice:e.currentPrice}),u.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[u.jsx(Ne,{label:"Stop Loss",value:f,onChange:h,step:k,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"}),u.jsx(Ne,{label:"Take Profit",value:m,onChange:b,step:k,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"})]}),u.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[u.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),u.jsx(On,{value:y,onChange:j=>v(j.target.value)})]}),u.jsx(Pt,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:D||!B,onClick:()=>void W(),children:"Modify"}),u.jsx(Pt,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:D,onClick:()=>void z(),children:U})]})]})}function xs(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 nh({position:e,onClose:t}){const{closePosition:n}=Pi(),r=he(E=>E.removePosition),[s,i]=C.useState(String(e.volumeLots)),o=ae(E=>E.stopLoss),a=ae(E=>E.takeProfit),c=ae(E=>E.setStopLoss),l=ae(E=>E.setTakeProfit),d=ae(E=>E.setDraft),f=ae(E=>E.clearDraft),[m,h]=C.useState(e.comment),[b,p]=C.useState(!1),g=Pr(e.digits);C.useEffect(()=>(d({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:g}),()=>{f()}),[f,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,g,d]);const y=t0(e),v=e.volumeLots,x=C.useMemo(()=>{const E=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${v.toFixed(2)} ${e.displaySymbol} ${xs(e.openPrice,e.digits)} at ${xs(y,e.digits)} with Profit ${E}`},[y,e,v]),_=async()=>{p(!0);try{const E=await n(e);if(!E.success){_e({variant:"destructive",description:E.message||"Failed to close position."});return}r(e.ticket),t(),_e({description:`Position #${e.ticket} closed.`})}catch(E){const P=E instanceof Error?E.message:"Failed to close position.";_e({variant:"destructive",description:P})}finally{p(!1)}};return u.jsxs("div",{className:"web-trading-widget-detail-panel",children:[u.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[u.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," ",xs(e.openPrice,e.digits)]}),u.jsx("button",{type:"button","aria-label":"Close position panel",className:"web-trading-widget-icon-btn",onClick:t,children:u.jsx(un,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),u.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[u.jsx(Ne,{label:"Lots",value:s,onChange:i,step:.01,min:.01,decimals:2,disabled:!0}),u.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[u.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Price"}),u.jsx(On,{readOnly:!0,disabled:!0,value:xs(e.openPrice,e.digits),className:"web-trading-widget-detail-panel__input-muted"})]}),u.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[u.jsx(Ne,{label:"Stop Loss",value:o,onChange:c,step:g,decimals:e.digits,basePrice:e.marketBid??e.openPrice,placeholder:"—"}),u.jsx(Ne,{label:"Take Profit",value:a,onChange:l,step:g,decimals:e.digits,basePrice:e.marketAsk??e.openPrice,placeholder:"—"})]}),u.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[u.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),u.jsx(On,{value:m,onChange:E=>h(E.target.value)})]}),u.jsx(Pt,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:!0,children:"Modify"}),u.jsx(Pt,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:b,onClick:()=>void _(),children:x})]})]})}function zl({symbolTicker:e,orderState:t}){const n=Ha(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:c,isAccountsLoading:l,hasConfirmedAccount:d,dismissConfirmation:f,placeMarketOrder:m}=t,h=he(k=>k.positions),b=he(k=>k.orders),p=he(k=>k.selectedPositionTicket),g=he(k=>k.selectedOrderTicket),y=he(k=>k.setSelectedPositionTicket),v=he(k=>k.setSelectedOrderTicket),x=p!==null?h.find(k=>k.ticket===p)??null:null,_=g!==null?b.find(k=>k.ticket===g)??null:null,E=r!==null,P=C.useCallback(k=>{m({symbolTicker:e,login:k.login,executionMode:k.executionMode,side:k.side,orderType:k.orderType,volumeLots:k.volumeLots,stopLoss:k.stopLoss,takeProfit:k.takeProfit,priceOrder:k.priceOrder,priceTrigger:k.priceTrigger,comment:k.comment,typeTime:k.typeTime,expirationDateTime:k.expirationDateTime,expirationDay:k.expirationDay,bid:k.bid,ask:k.ask})},[m,e]);return x!==null?u.jsx(nh,{position:x,onClose:()=>y(null)}):_!==null?u.jsx(th,{order:_,onClose:()=>v(null)}):E&&r!==null?u.jsx(eh,{confirmation:r,symbolTicker:e,onDismiss:f}):d?u.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:l,selectedLogin:c,onPlaceOrder:P}):u.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function Wl({label:e,isActive:t,onClick:n}){return u.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 n0({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade"}){const i=!!n,[o,a]=C.useState(s);return u.jsx("aside",{className:`web-trading-widget-side-panel${i?" web-trading-widget-side-panel--with-scan":""}`,children:i?u.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[u.jsxs("div",{role:"tablist","aria-label":"Chart side panel",className:"web-trading-widget-side-panel__tablist",children:[u.jsx(Wl,{label:"Trade",isActive:o==="trade",onClick:()=>a("trade")}),u.jsx(Wl,{label:"Scan Result",isActive:o==="scan",onClick:()=>a("scan")})]}),u.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[u.jsx("div",{role:"tabpanel",hidden:o!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:u.jsx(zl,{symbolTicker:e,orderState:t})}),u.jsx("div",{role:"tabpanel",hidden:o!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:u.jsx("iframe",{src:n??void 0,title:"Scan result",className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):u.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:u.jsx(zl,{symbolTicker:e,orderState:t})})})}const r0=.01,s0=.01,Gl=.01;function i0({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=C.useState("closed"),[s,i]=C.useState(null),[o,a]=C.useState(!1),[c,l]=C.useState(!1),[d,f]=C.useState(null),m=he(A=>A.setSelectedLogin),{accounts:h,isLoading:b}=Ap(),{submitOrder:p}=Pi(),g=C.useMemo(()=>Lb(h),[h]),y=C.useMemo(()=>jb(h),[h]),v=C.useMemo(()=>d!==null&&g.some(A=>A.login===d)?d:y,[g,y,d]);C.useEffect(()=>{v&&m(v)},[v,m]);const x=C.useCallback(A=>{f(A),m(A)},[m]),_=C.useCallback(A=>{A&&(x(A),l(!0),i(null),r(t))},[t,x]),E=C.useCallback(()=>{i(null),r("market")},[]),P=C.useCallback(()=>{i(null),r("mini")},[]),k=C.useCallback(()=>{i(null),r("mini")},[]),O=C.useCallback(()=>{i(null),r("mini")},[]),R=C.useCallback(async A=>{const L=A.login.trim();if(!L){_e({variant:"destructive",description:"Please select a trading account."});return}const D=Math.max(Gl,A.volumeLots),B=Tr(A.symbolTicker,e);Number(dn(fn(A.symbolTicker,e)));const U=mi(A.executionMode),W=Aa(A.orderType),z=ft(A.priceOrder),j=ft(A.priceTrigger);if(!U&&z===void 0){_e({variant:"destructive",description:W?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(W&&j===void 0){_e({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!U&&!gi(A.typeTime,A.expirationDateTime,A.expirationDay)){_e({variant:"destructive",description:"Please set an expiration date for this order."});return}const N=U?A.side==="buy"?A.ask:A.bid:z??(A.side==="buy"?A.ask:A.bid);a(!0);try{const F=await p({login:L,symbolTicker:A.symbolTicker,executionMode:A.executionMode,side:Ws(A.orderType),orderType:A.orderType,volumeLots:D,stopLoss:ft(A.stopLoss),takeProfit:ft(A.takeProfit),priceOrder:Oa(A.orderType)?z:void 0,priceTrigger:W?j:void 0,comment:A.comment.trim(),typeTime:A.typeTime,expirationDateTime:A.expirationDateTime,expirationDay:A.expirationDay,bid:A.bid,ask:A.ask});if(!F.success){_e({variant:"destructive",description:F.message||"Order was not accepted."});return}i({ticket:F.ticket??"",side:F.side??Ws(A.orderType),volumeLots:F.volumeLots??D,symbol:F.displaySymbol??B,price:F.price??N}),r("confirmation")}catch(F){const M=F instanceof Error?F.message:"Failed to place order.";_e({variant:"destructive",description:M})}finally{a(!1)}},[p,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:r0,volumeStep:s0,minVolumeLots:Gl,accountOptions:g,selectedLogin:v,setSelectedLogin:x,isAccountsLoading:b,hasConfirmedAccount:c,confirmAccountSelection:_,openMarketPanel:E,openMiniPanel:P,closePanels:k,dismissConfirmation:O,placeMarketOrder:R}}const o0=ku("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 a0({className:e,variant:t,...n}){return u.jsx("div",{className:De(o0({variant:t}),e),...n})}function rh(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Ds(){return rh()!==null}const ql="/charting_library/charting_library.js";function c0({onLoad:e}){return C.useEffect(()=>{if(Ds()){e();return}const t=document.querySelector(`script[src="${ql}"]`);if(t){const r=()=>{Ds()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=ql,n.async=!1,n.onload=()=>{Ds()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const Kl=yi(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),sh=yi(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})})),Vo=8,ih=4,Ho=5,zo=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,l0=e=>{const t=new Date(e+Vo*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=Ho:n===6?r<=ih:!0},u0=e=>{const t=new Date(e+Vo*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<Ho||n===6&&r>=ih){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(Ho,0,0,0),t.getTime()-Vo*60*60*1e3}return e},d0=(e,t,n)=>{const r=zo(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,l0(i)||(i=u0(i)),s.push(i);return s},f0=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=zo(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return d0(e,t,n);const s=zo(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},p0=(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},Zl="wss://symbols.opheleo.com";function h0(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Yl(e){return e.trim().toUpperCase()}function m0(e,t){return Math.floor(e/t)*t}let Dr;async function g0(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),Oe({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class y0{constructor(t,n,r=In,s=Zl){rt(this,"futureBarsRef");rt(this,"type");rt(this,"symbols");rt(this,"tickWebSocketUrl");rt(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});rt(this,"ws",null);rt(this,"isWsConnecting",!1);rt(this,"wsSelectedSymbol",null);rt(this,"subscriptions",new Map);rt(this,"lastBarsCache",new Map);rt(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||Zl}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 d=Kl.getState().playEndTimestamp;d&&(c.endTimestamp=d,Kl.getState().setPlayEndTimestamp(null),Dr=void 0),(async()=>{var m;try{const{data:h}=await g0(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}Dr=h.last_evaluated_key;const p=[...h.items].map(x=>({open:x.o,high:x.h,low:x.l,close:x.c,time:p0(x.timestamp,n)})),g=sh.getState(),{gapCount:y,isReplayMode:v}=g;if(v&&event){const x=f0(p[p.length-1].time,n,y||0,t.session);if(x.length>0){const _=p[p.length-1].close;for(const E of x)p.push({open:_,high:_,low:_,close:_,time:E})}}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?Yl(a.resolve_symbol):Yl(t.ticker||t.name||""),l=h0(n),d=`${c}|${n}`;this.subscriptions.set(s,{symbol:c,resolution:n,periodMs:l,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(d)??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=m0(r,o.periodMs);let l=o.liveCandle;l?c>l.time?l={time:c,open:s,high:s,low:s,close:s,volume:0}:l={...l,high:Math.max(l.high,s),low:Math.min(l.low,s),close:s}:l={time:c,open:s,high:s,low:s,close:s,volume:0},o.liveCandle=l,this.lastBarsCache.set(a,l),this.subscriptions.set(i,o),(f=>{var m,h;(h=(m=this.futureBarsRef)==null?void 0:m.current)!=null&&h.length||o.onTick(f)})(l)}}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:l,currency:d})=>{!a||!Number.isFinite(c)||c<=0||i.some(f=>String(f.id)===String(a))||i.push({id:a,time:c/1e3,color:"green",label:l.slice(0,1)||"N",tooltip:[l],...d?{imageUrl:`/images/symbols/${d}.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:l,currency:d,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:l.slice(0,1),tooltip:[l,`Current Forecast: ${f||"-"}`,`Previous Forecast: ${m||"-"}`,`Previous Actual: ${h||"-"}`],...d?{imageUrl:`https://cdn.iccandle.ai/web-assets/${d??"USD"}.svg`}:{}})}catch{}s(i)}}const b0=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])},Wo="An unknown error occurred",Ls=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return Wo;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Ls(e[t]);if(n)return n}return Wo},v0=e=>{var t;if(Qf(e)){const n=(t=e.response)!=null&&t.data?Ls(e.response.data):void 0;return n&&n!==Wo?n:Ls(e)}return Ls(e)},w0=({queryKey:e,queryFn:t,...n})=>Ci({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw _e({variant:"destructive",title:"Error",description:v0(Qf(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 Ql;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Ql||(Ql={}));const G=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ht=e=>{switch(typeof e){case"undefined":return G.undefined;case"string":return G.string;case"number":return Number.isNaN(e)?G.nan:G.number;case"boolean":return G.boolean;case"function":return G.function;case"bigint":return G.bigint;case"symbol":return G.symbol;case"object":return Array.isArray(e)?G.array:e===null?G.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?G.promise:typeof Map<"u"&&e instanceof Map?G.map:typeof Set<"u"&&e instanceof Set?G.set:typeof Date<"u"&&e instanceof Date?G.date:G.object;default:return G.unknown}},I=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 l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(o))):a[l]=a[l]||{_errors:[]},a=a[l],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 Go=(e,t)=>{let n;switch(e.code){case I.invalid_type:e.received===G.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,be.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(e.keys,", ")}`;break;case I.invalid_union:n="Invalid input";break;case I.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(e.options)}`;break;case I.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:n="Invalid function arguments";break;case I.invalid_return_type:n="Invalid function return type";break;case I.invalid_date:n="Invalid date";break;case I.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 I.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 I.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 I.custom:n="Invalid input";break;case I.invalid_intersection_types:n="Intersection results could not be merged";break;case I.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:n="Number must be finite";break;default:n=t.defaultError,be.assertNever(e)}return{message:n}};let _0=Go;function x0(){return _0}const S0=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(l=>!!l).slice().reverse();for(const l of c)a=l(o,{data:t,defaultError:a}).message;return{...s,path:i,message:a}};function V(e,t){const n=x0(),r=S0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Go?void 0:Go].filter(s=>!!s)});e.common.issues.push(r)}class nt{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 ne;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 nt.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 ne;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 ne=Object.freeze({status:"aborted"}),Ir=e=>({status:"dirty",value:e}),ot=e=>({status:"valid",value:e}),Xl=e=>e.status==="aborted",Jl=e=>e.status==="dirty",yr=e=>e.status==="valid",Js=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 on{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 eu=(e,t)=>{if(yr(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 ce(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 ye{get description(){return this._def.description}_getType(t){return Ht(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nt,ctx:{common:t.parent.common,data:t.data,parsedType:Ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Js(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:Ht(t)},s=this._parseSync({data:t,path:r.path,parent:r});return eu(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:Ht(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return yr(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=>yr(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:Ht(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(Js(s)?s:Promise.resolve(s));return eu(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:I.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 wr({schema:this,typeName:re.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 tn.create(this,this._def)}nullable(){return _r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ot.create(this)}promise(){return ri.create(this,this._def)}or(t){return ti.create([this,t],this._def)}and(t){return ni.create(this,t,this._def)}transform(t){return new wr({...ce(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Zo({...ce(this._def),innerType:this,defaultValue:n,typeName:re.ZodDefault})}brand(){return new G0({typeName:re.ZodBranded,type:this,...ce(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Yo({...ce(this._def),innerType:this,catchValue:n,typeName:re.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ic.create(this,t)}readonly(){return Qo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const C0=/^c[^\s-]{8,}$/i,E0=/^[0-9a-z]+$/,T0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,P0=/^[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,k0=/^[a-z0-9_-]{21}$/i,O0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A0=/^[-+]?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)?)??$/,R0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,N0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let so;const D0=/^(?:(?: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])$/,L0=/^(?:(?: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])$/,j0=/^(([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]))$/,M0=/^(([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])$/,I0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,U0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,oh="((\\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])))",F0=new RegExp(`^${oh}$`);function ah(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 B0(e){return new RegExp(`^${ah(e)}$`)}function $0(e){let t=`${oh}T${ah(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 V0(e,t){return!!((t==="v4"||!t)&&D0.test(e)||(t==="v6"||!t)&&j0.test(e))}function H0(e,t){if(!O0.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 z0(e,t){return!!((t==="v4"||!t)&&L0.test(e)||(t==="v6"||!t)&&M0.test(e))}class Xt extends ye{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==G.string){const i=this._getOrReturnCtx(t);return V(i,{code:I.invalid_type,expected:G.string,received:i.parsedType}),ne}const r=new nt;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:I.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),V(s,{code:I.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?V(s,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&V(s,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")R0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"email",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")so||(so=new RegExp(N0,"u")),so.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"emoji",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")P0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"uuid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")k0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"nanoid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")C0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cuid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")E0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cuid2",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")T0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"ulid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),V(s,{validation:"url",code:I.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),V(s,{validation:"regex",code:I.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),V(s,{code:I.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),V(s,{code:I.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),V(s,{code:I.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?$0(i).test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:I.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?F0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:I.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?B0(i).test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:I.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?A0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"duration",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?V0(t.data,i.version)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"ip",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?H0(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"jwt",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?z0(t.data,i.version)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cidr",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?I0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"base64",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?U0.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"base64url",code:I.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:I.invalid_string,...q.errToObj(r)})}_addCheck(t){return new Xt({...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 Xt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xt({...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}}Xt.create=e=>new Xt({checks:[],typeName:re.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...ce(e)});function W0(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 br extends ye{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)!==G.number){const i=this._getOrReturnCtx(t);return V(i,{code:I.invalid_type,expected:G.number,received:i.parsedType}),ne}let r;const s=new nt;for(const i of this._def.checks)i.kind==="int"?be.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),V(r,{code:I.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),V(r,{code:I.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),V(r,{code:I.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?W0(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),V(r,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),V(r,{code:I.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,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 br({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:q.toString(s)}]})}_addCheck(t){return new br({...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"&&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)}}br.create=e=>new br({checks:[],typeName:re.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ce(e)});class Hr extends ye{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)!==G.bigint)return this._getInvalidInput(t);let r;const s=new nt;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),V(r,{code:I.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),V(r,{code:I.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),V(r,{code:I.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 V(n,{code:I.invalid_type,expected:G.bigint,received:n.parsedType}),ne}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 Hr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:q.toString(s)}]})}_addCheck(t){return new Hr({...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}}Hr.create=e=>new Hr({checks:[],typeName:re.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...ce(e)});class qo extends ye{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==G.boolean){const r=this._getOrReturnCtx(t);return V(r,{code:I.invalid_type,expected:G.boolean,received:r.parsedType}),ne}return ot(t.data)}}qo.create=e=>new qo({typeName:re.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ce(e)});class ei extends ye{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==G.date){const i=this._getOrReturnCtx(t);return V(i,{code:I.invalid_type,expected:G.date,received:i.parsedType}),ne}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return V(i,{code:I.invalid_date}),ne}const r=new nt;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:I.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),V(s,{code:I.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 ei({...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}}ei.create=e=>new ei({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:re.ZodDate,...ce(e)});class tu extends ye{_parse(t){if(this._getType(t)!==G.symbol){const r=this._getOrReturnCtx(t);return V(r,{code:I.invalid_type,expected:G.symbol,received:r.parsedType}),ne}return ot(t.data)}}tu.create=e=>new tu({typeName:re.ZodSymbol,...ce(e)});class nu extends ye{_parse(t){if(this._getType(t)!==G.undefined){const r=this._getOrReturnCtx(t);return V(r,{code:I.invalid_type,expected:G.undefined,received:r.parsedType}),ne}return ot(t.data)}}nu.create=e=>new nu({typeName:re.ZodUndefined,...ce(e)});class ru extends ye{_parse(t){if(this._getType(t)!==G.null){const r=this._getOrReturnCtx(t);return V(r,{code:I.invalid_type,expected:G.null,received:r.parsedType}),ne}return ot(t.data)}}ru.create=e=>new ru({typeName:re.ZodNull,...ce(e)});class su extends ye{constructor(){super(...arguments),this._any=!0}_parse(t){return ot(t.data)}}su.create=e=>new su({typeName:re.ZodAny,...ce(e)});class iu extends ye{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ot(t.data)}}iu.create=e=>new iu({typeName:re.ZodUnknown,...ce(e)});class an extends ye{_parse(t){const n=this._getOrReturnCtx(t);return V(n,{code:I.invalid_type,expected:G.never,received:n.parsedType}),ne}}an.create=e=>new an({typeName:re.ZodNever,...ce(e)});class ou extends ye{_parse(t){if(this._getType(t)!==G.undefined){const r=this._getOrReturnCtx(t);return V(r,{code:I.invalid_type,expected:G.void,received:r.parsedType}),ne}return ot(t.data)}}ou.create=e=>new ou({typeName:re.ZodVoid,...ce(e)});class Ot extends ye{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==G.array)return V(n,{code:I.invalid_type,expected:G.array,received:n.parsedType}),ne;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(V(n,{code:o?I.too_big:I.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&&(V(n,{code:I.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&&(V(n,{code:I.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 on(n,o,n.path,a)))).then(o=>nt.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new on(n,o,n.path,a)));return nt.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:re.ZodArray,...ce(t)});function Zn(e){if(e instanceof Le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=tn.create(Zn(r))}return new Le({...e._def,shape:()=>t})}else return e instanceof Ot?new Ot({...e._def,type:Zn(e.element)}):e instanceof tn?tn.create(Zn(e.unwrap())):e instanceof _r?_r.create(Zn(e.unwrap())):e instanceof Mn?Mn.create(e.items.map(t=>Zn(t))):e}class Le extends ye{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)!==G.object){const l=this._getOrReturnCtx(t);return V(l,{code:I.invalid_type,expected:G.object,received:l.parsedType}),ne}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof an&&this._def.unknownKeys==="strip"))for(const l in s.data)o.includes(l)||a.push(l);const c=[];for(const l of o){const d=i[l],f=s.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new on(s,f,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof an){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(l==="strict")a.length>0&&(V(s,{code:I.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new on(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of c){const f=await d.key,m=await d.value;l.push({key:f,value:m,alwaysSet:d.alwaysSet})}return l}).then(l=>nt.mergeObjectSync(r,l)):nt.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:re.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 Zn(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 tn;)i=i._def.innerType;n[r]=i}return new Le({...this._def,shape:()=>n})}keyof(){return ch(be.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:re.ZodObject,...ce(t)});Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:re.ZodObject,...ce(t)});Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:re.ZodObject,...ce(t)});class ti extends ye{_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 V(n,{code:I.invalid_union,unionErrors:o}),ne}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 l={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(c=>new It(c));return V(n,{code:I.invalid_union,unionErrors:a}),ne}}get options(){return this._def.options}}ti.create=(e,t)=>new ti({options:e,typeName:re.ZodUnion,...ce(t)});function Ko(e,t){const n=Ht(e),r=Ht(t);if(e===t)return{valid:!0,data:e};if(n===G.object&&r===G.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=Ko(e[a],t[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===G.array&&r===G.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=Ko(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===G.date&&r===G.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ni extends ye{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(Xl(i)||Xl(o))return ne;const a=Ko(i.value,o.value);return a.valid?((Jl(i)||Jl(o))&&n.dirty(),{status:n.value,value:a.data}):(V(r,{code:I.invalid_intersection_types}),ne)};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}))}}ni.create=(e,t,n)=>new ni({left:e,right:t,typeName:re.ZodIntersection,...ce(n)});class Mn extends ye{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==G.array)return V(r,{code:I.invalid_type,expected:G.array,received:r.parsedType}),ne;if(r.data.length<this._def.items.length)return V(r,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&r.data.length>this._def.items.length&&(V(r,{code:I.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 on(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>nt.mergeArray(n,o)):nt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Mn({...this._def,rest:t})}}Mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Mn({items:e,typeName:re.ZodTuple,rest:null,...ce(t)})};class au extends ye{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!==G.map)return V(r,{code:I.invalid_type,expected:G.map,received:r.parsedType}),ne;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,c],l)=>({key:s._parse(new on(r,a,r.path,[l,"key"])),value:i._parse(new on(r,c,r.path,[l,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return ne;(l.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(l.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return ne;(l.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(l.value,d.value)}return{status:n.value,value:a}}}}au.create=(e,t,n)=>new au({valueType:t,keyType:e,typeName:re.ZodMap,...ce(n)});class zr extends ye{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==G.set)return V(r,{code:I.invalid_type,expected:G.set,received:r.parsedType}),ne;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(V(r,{code:I.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&&(V(r,{code:I.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 l=new Set;for(const d of c){if(d.status==="aborted")return ne;d.status==="dirty"&&n.dirty(),l.add(d.value)}return{status:n.value,value:l}}const a=[...r.data.values()].map((c,l)=>i._parse(new on(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(t,n){return new zr({...this._def,minSize:{value:t,message:q.toString(n)}})}max(t,n){return new zr({...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)}}zr.create=(e,t)=>new zr({valueType:e,minSize:null,maxSize:null,typeName:re.ZodSet,...ce(t)});class cu extends ye{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})}}cu.create=(e,t)=>new cu({getter:e,typeName:re.ZodLazy,...ce(t)});class lu extends ye{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return V(n,{received:n.data,code:I.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:t.data}}get value(){return this._def.value}}lu.create=(e,t)=>new lu({value:e,typeName:re.ZodLiteral,...ce(t)});function ch(e,t){return new vr({values:e,typeName:re.ZodEnum,...ce(t)})}class vr extends ye{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return V(n,{expected:be.joinValues(r),received:n.parsedType,code:I.invalid_type}),ne}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 V(n,{received:n.data,code:I.invalid_enum_value,options:r}),ne}return ot(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 vr.create(t,{...this._def,...n})}exclude(t,n=this._def){return vr.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}vr.create=ch;class uu extends ye{_parse(t){const n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==G.string&&r.parsedType!==G.number){const s=be.objectValues(n);return V(r,{expected:be.joinValues(s),received:r.parsedType,code:I.invalid_type}),ne}if(this._cache||(this._cache=new Set(be.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=be.objectValues(n);return V(r,{received:r.data,code:I.invalid_enum_value,options:s}),ne}return ot(t.data)}get enum(){return this._def.values}}uu.create=(e,t)=>new uu({values:e,typeName:re.ZodNativeEnum,...ce(t)});class ri extends ye{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==G.promise&&n.common.async===!1)return V(n,{code:I.invalid_type,expected:G.promise,received:n.parsedType}),ne;const r=n.parsedType===G.promise?n.data:Promise.resolve(n.data);return ot(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ri.create=(e,t)=>new ri({type:e,typeName:re.ZodPromise,...ce(t)});class wr extends ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.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=>{V(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 ne;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?ne:c.status==="dirty"||n.value==="dirty"?Ir(c.value):c});{if(n.value==="aborted")return ne;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ne: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"?ne:(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"?ne:(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(!yr(o))return ne;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=>yr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):ne);be.assertNever(s)}}wr.create=(e,t,n)=>new wr({schema:e,typeName:re.ZodEffects,effect:t,...ce(n)});wr.createWithPreprocess=(e,t,n)=>new wr({schema:t,effect:{type:"preprocess",transform:e},typeName:re.ZodEffects,...ce(n)});class tn extends ye{_parse(t){return this._getType(t)===G.undefined?ot(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}tn.create=(e,t)=>new tn({innerType:e,typeName:re.ZodOptional,...ce(t)});class _r extends ye{_parse(t){return this._getType(t)===G.null?ot(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}_r.create=(e,t)=>new _r({innerType:e,typeName:re.ZodNullable,...ce(t)});class Zo extends ye{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===G.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Zo.create=(e,t)=>new Zo({innerType:e,typeName:re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ce(t)});class Yo extends ye{_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 Js(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}}Yo.create=(e,t)=>new Yo({innerType:e,typeName:re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ce(t)});class du extends ye{_parse(t){if(this._getType(t)!==G.nan){const r=this._getOrReturnCtx(t);return V(r,{code:I.invalid_type,expected:G.nan,received:r.parsedType}),ne}return{status:"valid",value:t.data}}}du.create=e=>new du({typeName:re.ZodNaN,...ce(e)});class G0 extends ye{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ic extends ye{_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"?ne: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"?ne:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new ic({in:t,out:n,typeName:re.ZodPipeline})}}class Qo extends ye{_parse(t){const n=this._def.innerType._parse(t),r=s=>(yr(s)&&(s.value=Object.freeze(s.value)),s);return Js(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Qo.create=(e,t)=>new Qo({innerType:e,typeName:re.ZodReadonly,...ce(t)});var re;(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"})(re||(re={}));const io=Xt.create,Ss=br.create,q0=qo.create;an.create;Ot.create;const K0=Le.create;ti.create;ni.create;Mn.create;vr.create;ri.create;tn.create;_r.create;const Z0="https://api.opheleo.com",Y0="Bearer ",Q0="Authorization";K0({id:io(),userId:io(),createdAt:Ss(),updatedAt:Ss(),active:q0(),perDayUsage:Ss(),userEmail:io().email(),maxPerDayUsage:Ss()});async function X0(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Oe({baseURL:jn(n??Z0),url:e,method:t,headers:r?{[Q0]:`${Y0}${r}`}:void 0})).data}async function J0(e){return X0("/iccandle/v1/iccandle-user-usage/me","get",e)}const eC=e=>{const t=e==null?void 0:e.platformApiBase;return w0({queryKey:["iccandle-user-usage",t],queryFn:()=>J0(t),...e})},tC=C.createContext(null);function nC(){const e=C.useContext(tC);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Lr({title:e,isOpen:t,onToggle:n,children:r}){return u.jsxs("div",{className:"web-trading-widget-market-panel__accordion-item",children:[u.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,u.jsx(af,{className:"web-trading-widget-icon web-trading-widget-icon--md web-trading-widget-text-muted"})]}),t?u.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:l,onDragHandlePointerDown:d,onLayoutChange:f,onClose:m,onPlaceOrder:h}){const[b,p]=C.useState(!1),[g,y]=C.useState("market"),[v,x]=C.useState(String(r)),[_,E]=C.useState(""),[P,k]=C.useState(""),O=ae(ee=>ee.stopLoss),R=ae(ee=>ee.takeProfit),A=ae(ee=>ee.setStopLoss),L=ae(ee=>ee.setTakeProfit),D=ae(ee=>ee.setVolumeLots),B=ae(ee=>ee.setOrderSide),[U,W]=C.useState(""),[z,j]=C.useState(dt.GTC),[N,F]=C.useState(""),[M,Y]=C.useState(""),[se,le]=C.useState(()=>new Set(rC));C.useEffect(()=>{f()},[b,f]);const oe=Number(dn(fn(e))),Re=Pr(oe),Z=mf(t,n),K=t!==null?Te(t,oe):"—",ue=n!==null?Te(n,oe):"—",me=mi(g),ge=ff(g),ie=hi(g),te=ie.label,je=!me&&ie.orderType!==null&&ie.orderType%2===1,Pe=C.useMemo(()=>Z!==null?Z:t??n,[n,t,Z]),Ce=ee=>{le(bt=>{const $n=new Set(bt);return $n.has(ee)?$n.delete(ee):$n.add(ee),$n})},X=ee=>{x(ee);const bt=Number(ee);Number.isFinite(bt)&&bt>0&&D(bt)},Ee=ee=>t===null||n===null?null:me?ee==="buy"?n:t:ft(_)??(ee==="buy"?n:t),Me=ee=>{const bt=Ee(ee);bt!==null&&B({side:ee,entryPrice:bt})},We=ee=>{if(t===null||n===null||!c)return;const bt=Math.max(i,Number(v)||i),$n=df(g,ee),ac=Ee(ee);ac!==null&&B({side:ee,entryPrice:ac}),h({login:c,executionMode:g,side:ee,orderType:$n,volumeLots:bt,stopLoss:O,takeProfit:R,priceOrder:_,priceTrigger:P,comment:U,typeTime:z,expirationDateTime:N,expirationDay:M,bid:t,ask:n})},at=t!==null&&n!==null,J=me||ft(_)!==void 0,$e=!ge||ft(P)!==void 0,Ri=me||gi(z,N,M),Bn=!o&&!a&&c!==""&&at&&J&&$e&&Ri,uh=!me&&Ra(z),dh=!me&&Na(z),oc=()=>ie.orderType!==null&&ie.orderType%2===1?"sell":"buy";return u.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${b?" web-trading-widget-market-panel--collapsed":""}`,children:[u.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[u.jsx("button",{type:"button","aria-label":"Move order panel",onPointerDown:d,className:`web-trading-widget-market-panel__drag-handle${l?" web-trading-widget-market-panel__drag-handle--grabbing":""}`,children:u.jsx(lf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),u.jsx("select",{value:g,className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",onChange:ee=>y(ee.target.value),children:zs.map(ee=>u.jsx("option",{value:ee.mode,children:ee.label},ee.mode))}),u.jsx("div",{className:"web-trading-widget-market-panel__header-actions",children:u.jsx("button",{type:"button","aria-label":b?"Expand order panel":"Collapse order panel","aria-expanded":!b,className:"web-trading-widget-market-panel__header-btn",onClick:()=>p(ee=>!ee),children:b?u.jsx(Rb,{className:"web-trading-widget-icon web-trading-widget-icon--md"}):u.jsx(uf,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})})]}),b?null:u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[u.jsx(Lr,{id:"volume-setting",title:"Volume Setting",isOpen:se.has("volume-setting"),onToggle:()=>Ce("volume-setting"),children:u.jsx(Ne,{label:"Lots",value:v,onChange:X,step:s,min:i,decimals:2})}),me?null:u.jsx(Lr,{id:"order-price",title:"Order Price",isOpen:se.has("order-price"),onToggle:()=>Ce("order-price"),children:ge?u.jsxs(u.Fragment,{children:[u.jsx(Ne,{label:"Stop Price",value:P,onChange:k,step:Re,decimals:oe,basePrice:Pe,placeholder:Z!==null?Te(Z,oe):"—"}),u.jsx(Ne,{label:"Limit Price",value:_,onChange:E,step:Re,decimals:oe,basePrice:Pe,placeholder:Z!==null?Te(Z,oe):"—"})]}):u.jsx(Ne,{label:"Price",value:_,onChange:E,step:Re,decimals:oe,basePrice:Pe,placeholder:Z!==null?Te(Z,oe):"—"})}),u.jsx(Lr,{id:"risk-management",title:"Risk Management",isOpen:se.has("risk-management"),onToggle:()=>Ce("risk-management"),children:u.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[u.jsx(Ne,{label:"Stop Loss",value:O,onChange:A,step:Re,decimals:oe,basePrice:t,placeholder:t!==null?K:"—",clearable:!0}),u.jsx(Ne,{label:"Take Profit",value:R,onChange:L,step:Re,decimals:oe,basePrice:n,placeholder:n!==null?ue:"—",clearable:!0})]})}),me?null:u.jsxs(Lr,{id:"expiration",title:"Expiration",isOpen:se.has("expiration"),onToggle:()=>Ce("expiration"),children:[u.jsx("select",{value:String(z),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:ee=>j(Number(ee.target.value)),children:pf.map(ee=>u.jsx("option",{value:String(ee.value),children:ee.label},ee.value))}),uh?u.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[u.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),u.jsx("input",{type:"datetime-local",value:N,className:"web-trading-widget-market-panel__input",onChange:ee=>F(ee.target.value)})]}):null,dh?u.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[u.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),u.jsx("input",{type:"date",value:M,className:"web-trading-widget-market-panel__input",onChange:ee=>Y(ee.target.value)})]}):null]}),u.jsx(Lr,{id:"comment",title:"Comment",isOpen:se.has("comment"),onToggle:()=>Ce("comment"),children:u.jsx("input",{type:"text",value:U,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:ee=>W(ee.target.value)})})]}),u.jsx("div",{className:"web-trading-widget-market-panel__footer",children:u.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[u.jsx("span",{children:K}),u.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:ue})]})})]}),me?u.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[u.jsx("button",{type:"button",className:"web-trading-widget-market-panel__sell-btn",disabled:!Bn,onMouseDown:()=>Me("sell"),onClick:()=>We("sell"),children:"Sell by Market"}),u.jsx("button",{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Bn,onMouseDown:()=>Me("buy"),onClick:()=>We("buy"),children:"Buy by Market"})]}):u.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${je?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Bn,onMouseDown:()=>Me(oc()),onClick:()=>We(oc()),children:["Place ",te]})]})}function fu(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Ou);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function iC({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,headerSlot:i}){const{resolvedTheme:o}=nC(),a=pn(),c=Op(),l=C.useRef([]),d=C.useRef(null),f=C.useRef(o),m=C.useRef(null),h=C.useRef(null),b=C.useMemo(()=>fu(c),[c]),p=C.useRef(b),g=C.useRef("60"),y=C.useRef(null),{setGapCount:v,setReplayMode:x}=sh();C.useEffect(()=>{v(0),x(!1)},[v,x]),C.useEffect(()=>{Ds()&&k(!0)},[]);const[_,E]=C.useState(null),[P,k]=C.useState(!1),[O,R]=C.useState(null),A=C.useRef([]),L=C.useMemo(()=>new y0(A,"selector",c,a.tickWebSocketUrl),[a.tickWebSocketUrl,c]),{data:D,isLoading:B}=eC({enabled:!0,platformApiBase:a.platformApiBase}),U=!B&&D?D.perDayUsage>=D.maxPerDayUsage:!1;C.useEffect(()=>{s(_)},[_,s]),C.useEffect(()=>{r(O)},[O,r]),C.useEffect(()=>{if(!P||!_)return;if(d.current){R(null),r(null);try{d.current.remove()}catch{}d.current=null}const j=fu(c);p.current=j,g.current="60";const N=rh();if(!N)return;const F=new N({container:_,library_path:"/charting_library/",datafeed:L,symbol:j,interval:"60",autosize:!0,theme:f.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:()=>b0(l),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Ph(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let M=!1;return d.current=F,F.onChartReady(()=>{M||d.current!==F||R(F)}),()=>{if(M=!0,R(null),r(null),d.current){try{d.current.remove()}catch{}d.current=null}}},[_,L,r,P]),C.useEffect(()=>{if(!O)return;let j=!1;try{O.onChartReady(()=>{j||(async()=>{try{const N=O.activeChart(),F=await N.createStudy("Generated Candles - By iC Candle",!0,!0);if(j||(F&&N.bringToFront([F]),await O.headerReady(),j))return;try{y.current=await pp(O,()=>{var se;(se=e.current)==null||se.open()})}catch{}if(j||(await new Promise(se=>{setTimeout(()=>{if(!j)try{N.clearMarks(2)}catch{}se(!0)},150)}),j))return;localStorage.setItem("tv:selected-news-events","[]"),N.refreshMarks();const M=se=>{var Re;const le=N.symbol(),oe=((Re=c.find(Z=>Z.display_name===le))==null?void 0:Re.ticker)??b;oe!==p.current&&(n(null),l.current=[]);try{O.resetCache()}catch{}p.current=oe,localStorage.setItem(Ou,oe),t(oe)},Y=se=>{se!==g.current&&(n(null),l.current=[]);try{O.resetCache()}catch{}g.current=se};m.current=M,h.current=Y,N.onSymbolChanged().subscribe(null,M),N.onIntervalChanged().subscribe(null,Y)}catch{}})()})}catch{}return()=>{j=!0,m.current=null,h.current=null,y.current=null}},[O,e,n,t,b,c]),C.useEffect(()=>{if(!O||!o)return;let j=!1;try{O.onChartReady(()=>{j||O.changeTheme(o).catch(()=>{})})}catch{}return()=>{j=!0}},[O,o]);const W=C.useCallback(()=>{k(!0)},[]),z=U?u.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:u.jsxs(a0,{variant:"destructive",className:"web-trading-widget-advanced__scan-limit-badge",children:[u.jsx("span",{className:"web-trading-widget-advanced__scan-limit-badge-title",children:"Daily scan limit reached"}),D&&u.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[D.perDayUsage," of ",D.maxPerDayUsage," scans used today"]})]})}):null;return u.jsxs(u.Fragment,{children:[i??z,u.jsx(c0,{onLoad:W}),u.jsx("div",{ref:E,className:"web-trading-widget-advanced__container"})]})}const lh=C.createContext(null);function pu({value:e,children:t}){return u.jsx(lh.Provider,{value:e,children:t})}function oC(){const e=C.useContext(lh);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function aC({symbolTicker:e,chartWidget:t,orderState:n}){const r=Ha(e),{panel:s,confirmation:i,isSubmitting:o,defaultVolumeLots:a,volumeStep:c,minVolumeLots:l,selectedLogin:d,isAccountsLoading:f,hasConfirmedAccount:m,closePanels:h,dismissConfirmation:b,placeMarketOrder:p}=n,g=he(M=>M.positions),y=he(M=>M.orders),v=he(M=>M.selectedPositionTicket),x=he(M=>M.selectedOrderTicket),_=he(M=>M.setSelectedPositionTicket),E=he(M=>M.setSelectedOrderTicket),P=v!==null?g.find(M=>M.ticket===v)??null:null,k=x!==null?y.find(M=>M.ticket===x)??null:null,O=m&&s==="confirmation"&&i!==null,R=m&&s!=="confirmation"&&s!=="closed"&&P===null&&k===null,{panelRef:A,position:L,isDragging:D,onDragStart:B,reclamp:U}=wf({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:R}),W=ae(M=>M.setDraft),z=ae(M=>M.clearDraft),j=Number(dn(fn(e))),N=Pr(j);C.useEffect(()=>{m&&W({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:a,digits:j,priceStep:N})},[a,j,m,N,W]),C.useEffect(()=>{(s==="closed"||s==="confirmation")&&z()},[z,s]);const F=P!==null||k!==null;return!m&&!F?null:u.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[u.jsx(ap,{chartWidget:t,symbolTicker:e}),F&&P!==null?u.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:u.jsx(nh,{position:P,onClose:()=>_(null)})}):null,F&&k!==null?u.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:u.jsx(th,{order:k,onClose:()=>E(null)})}):null,O&&i!==null?u.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:u.jsx(eh,{confirmation:i,symbolTicker:e,onDismiss:b})}):null,R?u.jsx("div",{ref:A,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${D?" web-trading-widget-new-order-overlay--dragging":""}`,children:u.jsx(sC,{symbolTicker:e,bid:(r==null?void 0:r.bid)??null,ask:(r==null?void 0:r.ask)??null,defaultVolumeLots:a,volumeStep:c,minVolumeLots:l,isSubmitting:o,isAccountsLoading:f,selectedLogin:d,isDragging:D,onDragHandlePointerDown:B,onLayoutChange:U,onClose:h,onPlaceOrder:M=>void p({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]})}function hu(){const e=oC();return u.jsx(iC,{...e})}function cC({children:e,variant:t="chart",scanResultUrl:n}){const r=Op(),s=i0({symbols:r,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),i=C.useRef(null),[o,a]=C.useState(null),[c,l]=C.useState(null),[d,f]=C.useState("XAU_USD"),[m,h]=C.useState(n??null);C.useEffect(()=>{h(n??null)},[n]),Qa(s.selectedLogin);const b=C.useCallback(y=>{f(y)},[]),p=C.useCallback(y=>{h(y)},[]),g=C.useMemo(()=>({controlsRef:i,onSymbolTickerChange:b,onScanResultUrlChange:p,onChartWidgetChange:a,onChartContainerChange:l}),[p,b]);return C.useEffect(()=>{if(t==="news")return i.current={open:s.openMarketPanel,setSelectedLogin:s.setSelectedLogin},()=>{i.current=null}},[s.openMarketPanel,s.setSelectedLogin,t]),t==="news"?u.jsx(pu,{value:g,children:u.jsxs("div",{className:"web-trading-widget-trading-layout web-trading-widget-trading-layout--news",children:[u.jsxs("div",{className:"web-trading-widget-trading-layout__chart-slot",children:[u.jsx(np,{}),u.jsx(of,{open:!s.hasConfirmedAccount,isAccountsLoading:s.isAccountsLoading,accountOptions:s.accountOptions,onConfirm:s.confirmAccountSelection}),u.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[e??u.jsx(hu,{}),u.jsx(aC,{symbolTicker:d,chartWidget:o,orderState:s})]})]}),u.jsx(jp,{onCreateNewOrder:()=>{var y;return(y=i.current)==null?void 0:y.open()}})]})}):u.jsx(pu,{value:g,children:u.jsxs("div",{className:"web-trading-widget-trading-layout",children:[u.jsxs("div",{className:"web-trading-widget-trading-layout__body",children:[u.jsxs("div",{className:"web-trading-widget-trading-layout__chart-area",children:[u.jsx(hS,{controlsRef:i,symbolTicker:d,chartWidget:o,chartContainer:c,scanResultUrl:m,orderState:s}),u.jsx("div",{className:"web-trading-widget-trading-layout__chart-slot",children:e??u.jsx(hu,{})})]}),u.jsx(n0,{symbolTicker:d,orderState:s,scanResultUrl:m,initialTab:m?"scan":"trade"},m??"trade-only")]}),u.jsx(Dp,{onCreateNewOrder:()=>{var y;return(y=i.current)==null?void 0:y.open()}})]})})}function lC({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,children:s}){return C.useEffect(()=>{typeof window>"u"||(t&&(console.log("setting token",t),localStorage.setItem(Xf,t)),console.log("token",t))},[t]),u.jsx(Lp,{children:u.jsx(tp,{baseUrl:e,children:u.jsx(cC,{variant:n,scanResultUrl:r,children:s})})})}exports.ChartNewsOrdersOverlay=LS;exports.WebTradingWidget=lC;exports.registerNewOrderToolbarButton=pp;
|