@iccandle/widget-web-trading 0.0.0 → 0.0.2
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 +143 -12
- package/dist/web-trading-widget.cjs +21 -26
- package/dist/web-trading-widget.css +1 -1
- package/dist/web-trading-widget.d.ts +12 -18
- package/dist/web-trading-widget.js +5732 -5541
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
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(
|
|
1
|
+
"use strict";var ph=Object.defineProperty;var pc=e=>{throw TypeError(e)};var hh=(e,t,n)=>t in e?ph(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rt=(e,t,n)=>hh(e,typeof t!="symbol"?t+"":t,n),Li=(e,t,n)=>t.has(e)||pc("Cannot "+n);var C=(e,t,n)=>(Li(e,t,"read from private field"),n?n.call(e):t.get(e)),X=(e,t,n)=>t.has(e)?pc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),V=(e,t,n,r)=>(Li(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(Li(e,t,"access private method"),n);var is=(e,t,n,r)=>({set _(s){V(e,t,s,n)},get _(){return C(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),S=require("react"),mh=require("react-dom");function Pu(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 _=Pu(S),Yr=Pu(mh);function hc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gh(...e){return t=>{let n=!1;const r=e.map(s=>{const i=hc(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():hc(e[s],null)}}}}function Oe(...e){return _.useCallback(gh(...e),e)}function dr(e){const t=_.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const c=[];mc(s)&&typeof os=="function"&&(s=os(s._payload)),_.Children.forEach(s,m=>{var h;if(xh(m)){a=!0;const g=m;let p="child"in g.props?g.props.child:g.props.children;mc(p)&&typeof os=="function"&&(p=os(p._payload)),o=vh(g,p),c.push((h=o==null?void 0:o.props)==null?void 0:h.children)}else c.push(m)}),o?o=_.cloneElement(o,void 0,c):!a&&_.Children.count(s)===1&&_.isValidElement(s)&&(o=s);const l=o?_h(o):void 0,d=Oe(r,l);if(!o){if(s||s===0)throw new Error(a?Th(e):Eh(e));return s}const f=wh(i,o.props??{});return o.type!==_.Fragment&&(f.ref=r?d:l),_.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var yh=dr("Slot"),bh=Symbol.for("radix.slottable"),vh=(e,t)=>{if("child"in e.props){const n=e.props.child;return _.isValidElement(n)?_.cloneElement(n,void 0,e.props.children(n.props.children)):null}return _.isValidElement(t)?t:null};function wh(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 _h(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 xh(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bh}var Sh=Symbol.for("react.lazy");function mc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Sh&&"_payload"in e&&Ch(e._payload)}function Ch(e){return typeof e=="object"&&e!==null&&"then"in e}var Eh=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Th=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,os=_[" use ".trim().toString()];function ku(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=ku(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ou(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=ku(e))&&(r&&(r+=" "),r+=t);return r}const gc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yc=Ou,Au=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return yc(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(l=>{const d=n==null?void 0:n[l],f=i==null?void 0:i[l];if(d===null)return null;const m=gc(d)||gc(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(g=>{let[p,y]=g;return Array.isArray(y)?y.includes({...i,...a}[p]):{...i,...a}[p]===y})?[...l,f,m]:l},[]);return yc(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},cn=[{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"}],Ph={[-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 kh(){const e=-new Date().getTimezoneOffset()/60,t=Ph[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Ir="tv:latest-symbol";function Oh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=Ru(t))&&(r&&(r+=" "),r+=n);return r}function Ru(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=Ru(e[r]))&&(n&&(n+=" "),n+=t);return n}var ra="-";function Ah(e){var t=Nh(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var c=a.split(ra);return c[0]===""&&c.length!==1&&c.shift(),Nu(c,t)||Rh(a)}function o(a,c){var l=n[a]||[];return c&&s[a]?[].concat(l,s[a]):l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function Nu(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?Nu(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(ra);return(o=t.validators.find(function(a){var c=a.validator;return c(i)}))==null?void 0:o.classGroupId}}var bc=/^\[(.+)\]$/;function Rh(e){if(bc.test(e)){var t=bc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Nh(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Lh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];lo(a,r,o,t)}),r}function lo(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:vc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(Dh(s)){lo(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];lo(c,vc(t,a),n,r)})})}function vc(e,t){var n=e;return t.split(ra).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Dh(e){return e.isThemeGetter}function Lh(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 jh(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 Du="!";function Mh(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),g=h.startsWith(Du),p=g?h.substring(1):h,y=d&&d>l?d-l:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:y}}}function Ih(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 Uh(e){return{cache:jh(e.cacheSize),splitModifiers:Mh(e),...Ah(e)}}var Fh=/\s+/;function Bh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(Fh).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 g=Ih(c).join(":"),p=l?g+Du:g;return{isTailwindClass:!0,modifierId:p,classGroupId:m,originalClassName:o,hasPostfixModifier:h}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,c=o.classGroupId,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 $h(){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,g){return g(h)},d());return r=Uh(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=Bh(l,r);return i(l,f),f}return function(){return o(Oh.apply(null,arguments))}}function Ce(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var Lu=/^\[(?:([a-z-]+):)?(.+)\]$/i,Vh=/^\d+\/\d+$/,Hh=new Set(["px","full","screen"]),zh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wh=/\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$/,Gh=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function ct(e){return gn(e)||Hh.has(e)||Vh.test(e)||uo(e)}function uo(e){return Un(e,"length",Xh)}function Kh(e){return Un(e,"size",ju)}function qh(e){return Un(e,"position",ju)}function Zh(e){return Un(e,"url",Jh)}function as(e){return Un(e,"number",gn)}function gn(e){return!Number.isNaN(Number(e))}function Yh(e){return e.endsWith("%")&&gn(e.slice(0,-1))}function Or(e){return wc(e)||Un(e,"number",wc)}function he(e){return Lu.test(e)}function Ar(){return!0}function Ft(e){return zh.test(e)}function Qh(e){return Un(e,"",em)}function Un(e,t,n){var r=Lu.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function Xh(e){return Wh.test(e)}function ju(){return!1}function Jh(e){return e.startsWith("url(")}function wc(e){return Number.isInteger(Number(e))}function em(e){return Gh.test(e)}function tm(){var e=Ce("colors"),t=Ce("spacing"),n=Ce("blur"),r=Ce("brightness"),s=Ce("borderColor"),i=Ce("borderRadius"),o=Ce("borderSpacing"),a=Ce("borderWidth"),c=Ce("contrast"),l=Ce("grayscale"),d=Ce("hueRotate"),f=Ce("invert"),m=Ce("gap"),h=Ce("gradientColorStops"),g=Ce("gradientColorStopPositions"),p=Ce("inset"),y=Ce("margin"),b=Ce("opacity"),v=Ce("padding"),x=Ce("saturate"),w=Ce("scale"),E=Ce("sepia"),k=Ce("skew"),T=Ce("space"),R=Ce("translate"),A=function(){return["auto","contain","none"]},O=function(){return["auto","hidden","clip","visible","scroll"]},D=function(){return["auto",he,t]},L=function(){return[he,t]},j=function(){return["",ct]},U=function(){return["auto",gn,he]},G=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},H=function(){return["solid","dashed","dotted","double","none"]},B=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"]},I=function(){return["","0",he]},K=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},M=function(){return[gn,as]},le=function(){return[gn,he]};return{cacheSize:500,theme:{colors:[Ar],spacing:[ct],blur:["none","",Ft,he],brightness:M(),borderColor:[e],borderRadius:["none","","full",Ft,he],borderSpacing:L(),borderWidth:j(),contrast:M(),grayscale:I(),hueRotate:le(),invert:I(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[Yh,uo],inset:D(),margin:D(),opacity:M(),padding:L(),saturate:M(),scale:M(),sepia:I(),skew:le(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",he]}],container:["container"],columns:[{columns:[Ft]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(G(),[he])}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Or]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",he]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",Or]}],"grid-cols":[{"grid-cols":[Ar]}],"col-start-end":[{col:["auto",{span:["full",Or]},he]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[Ar]}],"row-start-end":[{row:["auto",{span:[Or]},he]}],"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",he]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",he]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal"].concat(N())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(N(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(N(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",he,t]}],"min-w":[{"min-w":["min","max","fit",he,ct]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Ft]},Ft,he]}],h:[{h:[he,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",he,ct]}],"max-h":[{"max-h":[he,t,"min","max","fit"]}],"font-size":[{text:["base",Ft,uo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",as]}],"font-family":[{font:[Ar]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",he]}],"line-clamp":[{"line-clamp":["none",gn,as]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",he,ct]}],"list-image":[{"list-image":["none",he]}],"list-style-type":[{list:["none","disc","decimal",he]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(H(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",ct]}],"underline-offset":[{"underline-offset":["auto",he,ct]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he]}],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",he]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(G(),[qh])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Kh]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Zh]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[].concat(H(),["hidden"])}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:H()}],"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(H())}],"outline-offset":[{"outline-offset":[he,ct]}],"outline-w":[{outline:[ct]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ct]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ft,Qh]}],"shadow-color":[{shadow:[Ar]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":B()}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ft,he]}],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":[b]}],"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",he]}],duration:[{duration:le()}],ease:[{ease:["linear","in","out","in-out",he]}],delay:[{delay:le()}],animate:[{animate:["none","spin","ping","pulse","bounce",he]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Or,he]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",he]}],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",he]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",he]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ct,as]}],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 nm=$h(tm);function De(...e){return nm(Ou(e))}const rm=({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})}),sm=Au("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=_.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?yh:"button";return u.jsxs(f,{className:De(sm({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(rm,{className:a})})]}),e]})});Pt.displayName="Button";function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function xr(e,t=[]){let n=[];function r(i,o){const a=_.createContext(o);a.displayName=i+"Context";const c=n.length;n=[...n,o];const l=f=>{var b;const{scope:m,children:h,...g}=f,p=((b=m==null?void 0:m[e])==null?void 0:b[c])||a,y=_.useMemo(()=>g,Object.values(g));return u.jsx(p.Provider,{value:y,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,g=_.useContext(h);if(g)return g;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=>_.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return _.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[r,im(s,...t)]}function im(...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 _.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ue=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},om=_[" useId ".trim().toString()]||(()=>{}),am=0;function Jt(e){const[t,n]=_.useState(om());return Ue(()=>{n(r=>r??String(am++))},[e]),e||(t?`radix-${t}`:"")}var cm=_[" useInsertionEffect ".trim().toString()]||Ue;function fr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=lm({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:s;{const d=_.useRef(e!==void 0);_.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=_.useCallback(d=>{var f;if(a){const m=um(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 lm({defaultProp:e,onChange:t}){const[n,r]=_.useState(e),s=_.useRef(n),i=_.useRef(t);return cm(()=>{i.current=t},[t]),_.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function um(e){return typeof e=="function"}var dm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=dm.reduce((e,t)=>{const n=dr(`Primitive.${t}`),r=_.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 fm(e,t){e&&Yr.flushSync(()=>e.dispatchEvent(t))}function Rn(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}function pm(e,t=globalThis==null?void 0:globalThis.document){const n=Rn(e);_.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 hm="DismissableLayer",fo="dismissableLayer.update",mm="dismissableLayer.pointerDownOutside",gm="dismissableLayer.focusOutside",_c,sa=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ia=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...l}=e,d=_.useContext(sa),[f,m]=_.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=_.useState({}),p=Oe(t,A=>m(A)),y=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=y.indexOf(b),x=f?y.indexOf(f):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,E=x>=v,k=_.useRef(!1),T=wm(A=>{const O=A.target;if(!(O instanceof Node))return;const D=[...d.branches].some(L=>L.contains(O));!E||D||(i==null||i(A),a==null||a(A),A.defaultPrevented||c==null||c())},{ownerDocument:h,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:d.dismissableSurfaces}),R=_m(A=>{if(r&&k.current)return;const O=A.target;[...d.branches].some(L=>L.contains(O))||(o==null||o(A),a==null||a(A),A.defaultPrevented||c==null||c())},h);return pm(A=>{x===d.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&c&&(A.preventDefault(),c()))},h),_.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(_c=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),xc(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=_c))}},[f,h,n,d]),_.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),xc())},[f,d]),_.useEffect(()=>{const A=()=>g({});return document.addEventListener(fo,A),()=>document.removeEventListener(fo,A)},[]),u.jsx(we.div,{...l,ref:p,style:{pointerEvents:w?E?"auto":"none":void 0,...e.style},onFocusCapture:Se(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Se(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Se(e.onPointerDownCapture,T.onPointerDownCapture)})});ia.displayName=hm;var ym="DismissableLayerBranch",bm=_.forwardRef((e,t)=>{const n=_.useContext(sa),r=_.useRef(null),s=Oe(t,r);return _.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(we.div,{...e,ref:s})});bm.displayName=ym;function vm(){const e=_.useContext(sa),[t,n]=_.useState(null);return _.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function wm(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=Rn(e),a=_.useRef(!1),c=_.useRef(!1),l=_.useRef(new Map),d=_.useRef(()=>{});return _.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 g(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||Mu(mm,o,w,{discrete:!0})};const w={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},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of y)n.addEventListener(v,h,!0),n.addEventListener(v,g);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",p),n.removeEventListener("click",d.current);for(const v of y)n.removeEventListener(v,h,!0),n.removeEventListener(v,g)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function _m(e,t=globalThis==null?void 0:globalThis.document){const n=Rn(e),r=_.useRef(!1);return _.useEffect(()=>{const s=i=>{i.target&&!r.current&&Mu(gm,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 xc(){const e=new CustomEvent(fo);document.dispatchEvent(e)}function Mu(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?fm(s,i):s.dispatchEvent(i)}var ji="focusScope.autoFocusOnMount",Mi="focusScope.autoFocusOnUnmount",Sc={bubbles:!1,cancelable:!0},xm="FocusScope",oa=_.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,c]=_.useState(null),l=Rn(s),d=Rn(i),f=_.useRef(null),m=Oe(t,p=>c(p)),h=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let p=function(x){if(h.paused||!a)return;const w=x.target;a.contains(w)?f.current=w:Bt(f.current,{select:!0})},y=function(x){if(h.paused||!a)return;const w=x.relatedTarget;w!==null&&(a.contains(w)||Bt(f.current,{select:!0}))},b=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",y);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,h.paused]),_.useEffect(()=>{if(a){Ec.add(h);const p=document.activeElement;if(!a.contains(p)){const b=new CustomEvent(ji,Sc);a.addEventListener(ji,l),a.dispatchEvent(b),b.defaultPrevented||(Sm(km(Iu(a)),{select:!0}),document.activeElement===p&&Bt(a))}return()=>{a.removeEventListener(ji,l),setTimeout(()=>{const b=new CustomEvent(Mi,Sc);a.addEventListener(Mi,d),a.dispatchEvent(b),b.defaultPrevented||Bt(p??document.body,{select:!0}),a.removeEventListener(Mi,d),Ec.remove(h)},0)}}},[a,l,d,h]);const g=_.useCallback(p=>{if(!n&&!r||h.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(y&&b){const v=p.currentTarget,[x,w]=Cm(v);x&&w?!p.shiftKey&&b===w?(p.preventDefault(),n&&Bt(x,{select:!0})):p.shiftKey&&b===x&&(p.preventDefault(),n&&Bt(w,{select:!0})):b===v&&p.preventDefault()}},[n,r,h.paused]);return u.jsx(we.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});oa.displayName=xm;function Sm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Bt(r,{select:t}),document.activeElement!==n)return}function Cm(e){const t=Iu(e),n=Cc(t,e),r=Cc(t.reverse(),e);return[n,r]}function Iu(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 Cc(e,t){for(const n of e)if(!Em(n,{upTo:t}))return n}function Em(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 Tm(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&&Tm(e)&&t&&e.select()}}var Ec=Pm();function Pm(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Tc(e,t),e.unshift(t)},remove(t){var n;e=Tc(e,t),(n=e[0])==null||n.resume()}}}function Tc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function km(e){return e.filter(t=>t.tagName!=="A")}var Om="Portal",aa=_.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,i]=_.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(we.div,{...r,ref:t}),o):null});aa.displayName=Om;function Am(e,t){return _.useReducer((n,r)=>t[n][r]??n,e)}var Sr=e=>{const{present:t,children:n}=e,r=Rm(t),s=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),i=Nm(r.ref,Dm(s));return typeof n=="function"||r.isPresent?_.cloneElement(s,{ref:i}):null};Sr.displayName="Presence";function Rm(e){const[t,n]=_.useState(),r=_.useRef(null),s=_.useRef(e),i=_.useRef("none"),o=e?"mounted":"unmounted",[a,c]=Am(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const l=cs(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=cs(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=cs(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&p&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=h=>{h.target===t&&(i.current=cs(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:_.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function Pc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Nm(...e){const t=_.useRef(e);return t.current=e,_.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const a=Pc(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():Pc(r[o],null)}}},[])}function cs(e){return(e==null?void 0:e.animationName)||"none"}function Dm(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 ls=0,vt=null;function Uu(){_.useEffect(()=>{vt||(vt={start:kc(),end:kc()});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),ls++,()=>{ls===1&&(vt==null||vt.start.remove(),vt==null||vt.end.remove(),vt=null),ls=Math.max(0,ls-1)}},[])}function kc(){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 Fu(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 Lm(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 Es="right-scroll-bar-position",Ts="width-before-scroll-bar",jm="with-scroll-bars-hidden",Mm="--removed-body-scroll-bar-size";function Ii(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Im(e,t){var n=S.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var Um=typeof window<"u"?_.useLayoutEffect:_.useEffect,Oc=new WeakMap;function Fm(e,t){var n=Im(null,function(r){return e.forEach(function(s){return Ii(s,r)})});return Um(function(){var r=Oc.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||Ii(a,null)}),i.forEach(function(a){s.has(a)||Ii(a,o)})}Oc.set(n,e)},[e]),n}function Bm(e){return e}function $m(e,t){t===void 0&&(t=Bm);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 Vm(e){e===void 0&&(e={});var t=$m(null);return t.options=Et({async:!0,ssr:!1},e),t}var Bu=function(e){var t=e.sideCar,n=Fu(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 _.createElement(r,Et({},n))};Bu.isSideCarExport=!0;function Hm(e,t){return e.useMedium(t),Bu}var $u=Vm(),Ui=function(){},ii=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:Ui,onWheelCapture:Ui,onTouchMoveCapture:Ui}),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,g=e.noIsolation,p=e.inert,y=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,x=e.gapMode,w=Fu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,k=Fm([n,t]),T=Et(Et({},w),s);return _.createElement(_.Fragment,null,d&&_.createElement(E,{sideCar:$u,removeScrollBar:l,shards:f,noRelative:h,noIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:x}),o?_.cloneElement(_.Children.only(a),Et(Et({},T),{ref:k})):_.createElement(v,Et({},T,{className:c,ref:k}),a))});ii.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ii.classNames={fullWidth:Ts,zeroRight:Es};var zm=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Wm(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=zm();return t&&e.setAttribute("nonce",t),e}function Gm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Km(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=Wm())&&(Gm(t,n),Km(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Zm=function(){var e=qm();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Vu=function(){var e=Zm(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Ym={left:0,top:0,right:0,gap:0},Fi=function(e){return parseInt(e||"",10)||0},Qm=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[Fi(n),Fi(r),Fi(s)]},Xm=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Ym;var t=Qm(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])}},Jm=Vu(),Yn="data-scroll-locked",eg=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(jm,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
5
5
|
}
|
|
@@ -16,29 +16,29 @@
|
|
|
16
16
|
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.`).concat(
|
|
19
|
+
.`).concat(Es,` {
|
|
20
20
|
right: `).concat(a,"px ").concat(r,`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.`).concat(
|
|
23
|
+
.`).concat(Ts,` {
|
|
24
24
|
margin-right: `).concat(a,"px ").concat(r,`;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.`).concat(
|
|
27
|
+
.`).concat(Es," .").concat(Es,` {
|
|
28
28
|
right: 0 `).concat(r,`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.`).concat(
|
|
31
|
+
.`).concat(Ts," .").concat(Ts,` {
|
|
32
32
|
margin-right: 0 `).concat(r,`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
body[`).concat(Yn,`] {
|
|
36
|
-
`).concat(
|
|
36
|
+
`).concat(Mm,": ").concat(a,`px;
|
|
37
37
|
}
|
|
38
|
-
`)},
|
|
38
|
+
`)},Ac=function(){var e=parseInt(document.body.getAttribute(Yn)||"0",10);return isFinite(e)?e:0},tg=function(){_.useEffect(function(){return document.body.setAttribute(Yn,(Ac()+1).toString()),function(){var e=Ac()-1;e<=0?document.body.removeAttribute(Yn):document.body.setAttribute(Yn,e.toString())}},[])},ng=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;tg();var i=_.useMemo(function(){return Xm(s)},[s]);return _.createElement(Jm,{styles:eg(i,!t,s,n?"":"!important")})},po=!1;if(typeof window<"u")try{var us=Object.defineProperty({},"passive",{get:function(){return po=!0,!0}});window.addEventListener("test",us,us),window.removeEventListener("test",us,us)}catch{po=!1}var Vn=po?{passive:!1}:!1,rg=function(e){return e.tagName==="TEXTAREA"},Hu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!rg(e)&&n[t]==="visible")},sg=function(e){return Hu(e,"overflowY")},ig=function(e){return Hu(e,"overflowX")},Rc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=zu(e,r);if(s){var i=Wu(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},og=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},ag=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},zu=function(e,t){return e==="v"?sg(t):ig(t)},Wu=function(e,t){return e==="v"?og(t):ag(t)},cg=function(e,t){return e==="h"&&t==="rtl"?-1:1},lg=function(e,t,n,r,s){var i=cg(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=Wu(e,a),g=h[0],p=h[1],y=h[2],b=p-y-i*g;(g||b)&&zu(e,a)&&(f+=b,m+=g);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(l=!0),l},ds=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Nc=function(e){return[e.deltaX,e.deltaY]},Dc=function(e){return e&&"current"in e?e.current:e},ug=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dg=function(e){return`
|
|
39
39
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
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={};/**
|
|
41
|
+
`)},fg=0,Hn=[];function pg(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),s=_.useState(fg++)[0],i=_.useState(Vu)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=Lm([e.lockRef.current],(e.shards||[]).map(Dc),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=_.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var b=ds(p),v=n.current,x="deltaX"in p?p.deltaX:v[0]-b[0],w="deltaY"in p?p.deltaY:v[1]-b[1],E,k=p.target,T=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in p&&T==="h"&&k.type==="range")return!1;var R=window.getSelection(),A=R&&R.anchorNode,O=A?A===k||A.contains(k):!1;if(O)return!1;var D=Rc(T,k);if(!D)return!0;if(D?E=T:(E=T==="v"?"h":"v",D=Rc(T,k)),!D)return!1;if(!r.current&&"changedTouches"in p&&(x||w)&&(r.current=E),!E)return!0;var L=r.current||E;return lg(L,y,p,L==="h"?x:w)},[]),c=_.useCallback(function(p){var y=p;if(!(!Hn.length||Hn[Hn.length-1]!==i)){var b="deltaY"in y?Nc(y):ds(y),v=t.current.filter(function(E){return E.name===y.type&&(E.target===y.target||y.target===E.shadowParent)&&ug(E.delta,b)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(Dc).filter(Boolean).filter(function(E){return E.contains(y.target)}),w=x.length>0?a(y,x[0]):!o.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),l=_.useCallback(function(p,y,b,v){var x={name:p,delta:y,target:b,should:v,shadowParent:hg(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(w){return w!==x})},1)},[]),d=_.useCallback(function(p){n.current=ds(p),r.current=void 0},[]),f=_.useCallback(function(p){l(p.type,Nc(p),p.target,a(p,e.lockRef.current))},[]),m=_.useCallback(function(p){l(p.type,ds(p),p.target,a(p,e.lockRef.current))},[]);_.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,g=e.inert;return _.createElement(_.Fragment,null,g?_.createElement(i,{styles:dg(s)}):null,h?_.createElement(ng,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const mg=Hm($u,pg);var ca=_.forwardRef(function(e,t){return _.createElement(ii,Et({},e,{ref:t,sideCar:mg}))});ca.classNames=ii.classNames;var gg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},zn=new WeakMap,fs=new WeakMap,ps={},Bi=0,Gu=function(e){return e&&(e.host||Gu(e.parentNode))},yg=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Gu(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})},bg=function(e,t,n,r){var s=yg(t,Array.isArray(e)?e:[e]);ps[n]||(ps[n]=new WeakMap);var i=ps[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),g=h!==null&&h!=="false",p=(zn.get(m)||0)+1,y=(i.get(m)||0)+1;zn.set(m,p),i.set(m,y),o.push(m),p===1&&g&&fs.set(m,!0),y===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return d(t),a.clear(),Bi++,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||(fs.has(f)||f.removeAttribute(r),fs.delete(f)),h||f.removeAttribute(n)}),Bi--,Bi||(zn=new WeakMap,zn=new WeakMap,fs=new WeakMap,ps={})}},Ku=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=gg(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),bg(r,s,n,"aria-hidden")):function(){return null}},oi="Dialog",[qu]=xr(oi),[vg,mt]=qu(oi),Zu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=_.useRef(null),c=_.useRef(null),[l,d]=fr({prop:r,defaultProp:s??!1,onChange:i,caller:oi});return u.jsx(vg,{scope:t,triggerRef:a,contentRef:c,contentId:Jt(),titleId:Jt(),descriptionId:Jt(),open:l,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};Zu.displayName=oi;var Yu="DialogTrigger",wg=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(Yu,n),i=Oe(t,s.triggerRef);return u.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":ha(s.open),...r,ref:i,onClick:Se(e.onClick,s.onOpenToggle)})});wg.displayName=Yu;var la="DialogPortal",[_g,Qu]=qu(la,{forceMount:void 0}),Xu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=mt(la,t);return u.jsx(_g,{scope:t,forceMount:n,children:_.Children.map(r,o=>u.jsx(Sr,{present:n||i.open,children:u.jsx(aa,{asChild:!0,container:s,children:o})}))})};Xu.displayName=la;var js="DialogOverlay",ua=_.forwardRef((e,t)=>{const n=Qu(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(Sg,{...s,ref:t})}):null});ua.displayName=js;var xg=dr("DialogOverlay.RemoveScroll"),Sg=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(js,n),i=vm(),o=Oe(t,i);return u.jsx(ca,{as:xg,allowPinchZoom:!0,shards:[s.contentRef],children:u.jsx(we.div,{"data-state":ha(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),pr="DialogContent",da=_.forwardRef((e,t)=>{const n=Qu(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(Cg,{...s,ref:t}):u.jsx(Eg,{...s,ref:t})})});da.displayName=pr;var Cg=_.forwardRef((e,t)=>{const n=mt(pr,e.__scopeDialog),r=_.useRef(null),s=Oe(t,n.contentRef,r);return _.useEffect(()=>{const i=r.current;if(i)return Ku(i)},[]),u.jsx(Ju,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Se(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:Se(e.onFocusOutside,i=>i.preventDefault())})}),Eg=_.forwardRef((e,t)=>{const n=mt(pr,e.__scopeDialog),r=_.useRef(!1),s=_.useRef(!1);return u.jsx(Ju,{...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()}})}),Ju=_.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=mt(pr,n);return Uu(),u.jsx(u.Fragment,{children:u.jsx(oa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:u.jsx(ia,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ha(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),ed="DialogTitle",fa=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(ed,n);return u.jsx(we.h2,{id:s.titleId,...r,ref:t})});fa.displayName=ed;var td="DialogDescription",pa=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(td,n);return u.jsx(we.p,{id:s.descriptionId,...r,ref:t})});pa.displayName=td;var nd="DialogClose",Tg=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=mt(nd,n);return u.jsx(we.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>s.onOpenChange(!1))})});Tg.displayName=nd;function ha(e){return e?"open":"closed"}const Pg=Zu,kg=Xu,rd=_.forwardRef(({className:e,...t},n)=>u.jsx(ua,{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}));rd.displayName=ua.displayName;const sd=_.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>u.jsxs(kg,{children:[u.jsx(rd,{className:t}),u.jsx(da,{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})]}));sd.displayName=da.displayName;const id=({className:e,...t})=>u.jsx("div",{className:De("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});id.displayName="DialogHeader";const od=({className:e,...t})=>u.jsx("div",{className:De("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});od.displayName="DialogFooter";const ad=_.forwardRef(({className:e,...t},n)=>u.jsx(fa,{ref:n,className:De("text-lg font-semibold leading-none tracking-tight",e),...t}));ad.displayName=fa.displayName;const cd=_.forwardRef(({className:e,...t},n)=>u.jsx(pa,{ref:n,className:De("text-sm text-muted-foreground",e),...t}));cd.displayName=pa.displayName;function Lc(e,[t,n]){return Math.min(n,Math.max(t,e))}function ld(e){const t=e+"CollectionProvider",[n,r]=xr(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:y,children:b}=p,v=_.useRef(null),x=_.useRef(new Map).current;return u.jsx(s,{scope:y,itemMap:x,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",c=dr(a),l=_.forwardRef((p,y)=>{const{scope:b,children:v}=p,x=i(a,b),w=Oe(y,x.collectionRef);return u.jsx(c,{ref:w,children:v})});l.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=dr(d),h=_.forwardRef((p,y)=>{const{scope:b,children:v,...x}=p,w=_.useRef(null),E=Oe(y,w),k=i(d,b);return _.useEffect(()=>(k.itemMap.set(w,{ref:w,...x}),()=>void k.itemMap.delete(w))),u.jsx(m,{[f]:"",ref:E,children:v})});h.displayName=d;function g(p){const y=i(e+"CollectionConsumer",p);return _.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((k,T)=>x.indexOf(k.ref.current)-x.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:l,ItemSlot:h},g,r]}var Og=_.createContext(void 0);function ud(e){const t=_.useContext(Og);return e||t||"ltr"}const Ag=["top","right","bottom","left"],nn=Math.min,et=Math.max,Ms=Math.round,hs=Math.floor,kt=e=>({x:e,y:e}),Rg={left:"right",right:"left",bottom:"top",top:"bottom"};function ho(e,t,n){return et(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 ma(e){return e==="x"?"y":"x"}function ga(e){return e==="y"?"height":"width"}function Tt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ya(e){return ma(Tt(e))}function Ng(e,t,n){n===void 0&&(n=!1);const r=Cr(e),s=ya(e),i=ga(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 Dg(e){const t=Is(e);return[mo(e),t,mo(t)]}function mo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const jc=["left","right"],Mc=["right","left"],Lg=["top","bottom"],jg=["bottom","top"];function Mg(e,t,n){switch(e){case"top":case"bottom":return n?t?Mc:jc:t?jc:Mc;case"left":case"right":return t?Lg:jg;default:return[]}}function Ig(e,t,n,r){const s=Cr(e);let i=Mg(Mt(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(mo)))),i}function Is(e){const t=Mt(e);return Rg[t]+e.slice(t.length)}function Ug(e){return{top:0,right:0,bottom:0,left:0,...e}}function dd(e){return typeof e!="number"?Ug(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 Ic(e,t,n){let{reference:r,floating:s}=e;const i=Tt(t),o=ya(t),a=ga(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 Fg(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),g=dd(h),y=a[m?f==="floating"?"reference":"floating":f],b=Us(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary: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)),w=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:(b.top-E.top+g.top)/w.y,bottom:(E.bottom-b.bottom+g.bottom)/w.y,left:(b.left-E.left+g.left)/w.x,right:(E.right-b.right+g.right)/w.x}}const Bg=50,$g=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Fg},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}=Ic(l,r,c),m=r,h=0;const g={};for(let p=0;p<i.length;p++){const y=i[p];if(!y)continue;const{name:b,fn:v}=y,{x,y:w,data:E,reset:k}=await v({x:d,y:f,initialPlacement:r,placement:m,strategy:s,middlewareData:g,rects:l,platform:a,elements:{reference:e,floating:t}});d=x??d,f=w??f,g[b]={...g[b],...E},k&&h<Bg&&(h++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(l=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):k.rects),{x:d,y:f}=Ic(l,m,c)),p=-1)}return{x:d,y:f,placement:m,strategy:s,middlewareData:g}},Vg=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=dd(d),m={x:n,y:r},h=ya(s),g=ga(h),p=await o.getDimensions(l),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",w=i.reference[g]+i.reference[h]-m[h]-i.floating[g],E=m[h]-i.reference[h],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let T=k?k[x]:0;(!T||!await(o.isElement==null?void 0:o.isElement(k)))&&(T=a.floating[x]||i.floating[g]);const R=w/2-E/2,A=T/2-p[g]/2-1,O=nn(f[b],A),D=nn(f[v],A),L=O,j=T-p[g]-D,U=T/2-p[g]/2+R,G=ho(L,U,j),H=!c.arrow&&Cr(s)!=null&&U!==G&&i.reference[g]/2-(U<L?O:D)-p[g]/2<0,B=H?U<L?U-L:U-j:0;return{[h]:m[h]+B,data:{[h]:G,centerOffset:U-G-B,...H&&{alignmentOffset:B}},reset:H}}}),Hg=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:g="none",flipAlignment:p=!0,...y}=jt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Mt(s),v=Tt(a),x=Mt(a)===a,w=await(c.isRTL==null?void 0:c.isRTL(l.floating)),E=m||(x||!p?[Is(a)]:Dg(a)),k=g!=="none";!m&&k&&E.push(...Ig(a,p,g,w));const T=[a,...E],R=await c.detectOverflow(t,y),A=[];let O=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&A.push(R[b]),f){const U=Ng(s,o,w);A.push(R[U[0]],R[U[1]])}if(O=[...O,{placement:s,overflows:A}],!A.every(U=>U<=0)){var D,L;const U=(((D=i.flip)==null?void 0:D.index)||0)+1,G=T[U];if(G&&(!(f==="alignment"?v!==Tt(G):!1)||O.every(N=>Tt(N.placement)===v?N.overflows[0]>0:!0)))return{data:{index:U,overflows:O},reset:{placement:G}};let H=(L=O.filter(B=>B.overflows[0]<=0).sort((B,N)=>B.overflows[1]-N.overflows[1])[0])==null?void 0:L.placement;if(!H)switch(h){case"bestFit":{var j;const B=(j=O.filter(N=>{if(k){const I=Tt(N.placement);return I===v||I==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(I=>I>0).reduce((I,K)=>I+K,0)]).sort((N,I)=>N[1]-I[1])[0])==null?void 0:j[0];B&&(H=B);break}case"initialPlacement":H=a;break}if(s!==H)return{reset:{placement:H}}}return{}}}};function Uc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Fc(e){return Ag.some(t=>e[t]>=0)}const zg=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=Uc(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Fc(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=Uc(o,n.floating);return{data:{escapedOffsets:a,escaped:Fc(a)}}}default:return{}}}}},fd=new Set(["left","top"]);async function Wg(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=fd.has(o)?-1:1,d=i&&c?-1:1,f=jt(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(h=a==="end"?g*-1:g),c?{x:h*d,y:m*l}:{x:m*l,y:h*d}}const Gg=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 Wg(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}}}}},Kg=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:c={fn:b=>{let{x:v,y:x}=b;return{x:v,y:x}}},...l}=jt(e,t),d={x:n,y:r},f=await i.detectOverflow(t,l),m=Tt(Mt(s)),h=ma(m);let g=d[h],p=d[m];if(o){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=g+f[b],w=g-f[v];g=ho(x,g,w)}if(a){const b=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=p+f[b],w=p-f[v];p=ho(x,p,w)}const y=c.fn({...t,[h]:g,[m]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:o,[m]:a}}}}}},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=ma(f);let h=d[m],g=d[f];const p=jt(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const x=m==="y"?"height":"width",w=i.reference[m]-i.floating[x]+y.mainAxis,E=i.reference[m]+i.reference[x]-y.mainAxis;h<w?h=w:h>E&&(h=E)}if(l){var b,v;const x=m==="y"?"width":"height",w=fd.has(Mt(s)),E=i.reference[f]-i.floating[x]+(w&&((b=o.offset)==null?void 0:b[f])||0)+(w?0:y.crossAxis),k=i.reference[f]+i.reference[x]+(w?0:((v=o.offset)==null?void 0:v[f])||0)-(w?y.crossAxis:0);g<E?g=E:g>k&&(g=k)}return{[m]:h,[f]:g}}}},Zg=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:g,height:p}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=f,y=m==="end"?"top":"bottom");const v=p-d.top-d.bottom,x=g-d.left-d.right,w=nn(p-d[y],v),E=nn(g-d[b],x),k=!t.middlewareData.shift;let T=w,R=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=v),k&&!m){const O=et(d.left,0),D=et(d.right,0),L=et(d.top,0),j=et(d.bottom,0);h?R=g-2*(O!==0||D!==0?O+D:et(d.left,d.right)):T=p-2*(L!==0||j!==0?L+j:et(d.top,d.bottom))}await c({...t,availableWidth:R,availableHeight:T});const A=await o.getDimensions(a.floating);return g!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function ai(){return typeof window<"u"}function Er(e){return pd(e)?(e.nodeName||"").toLowerCase():"#document"}function tt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function At(e){var t;return(t=(pd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function pd(e){return ai()?e instanceof Node||e instanceof tt(e).Node:!1}function pt(e){return ai()?e instanceof Element||e instanceof tt(e).Element:!1}function Ut(e){return ai()?e instanceof HTMLElement||e instanceof tt(e).HTMLElement:!1}function Bc(e){return!ai()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof tt(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 Yg(e){return/^(table|td|th)$/.test(Er(e))}function ci(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Qg=/transform|translate|scale|rotate|perspective|filter/,Xg=/paint|layout|strict|content/,mn=e=>!!e&&e!=="none";let $i;function ba(e){const t=pt(e)?ht(e):e;return mn(t.transform)||mn(t.translate)||mn(t.scale)||mn(t.rotate)||mn(t.perspective)||!va()&&(mn(t.backdropFilter)||mn(t.filter))||Qg.test(t.willChange||"")||Xg.test(t.contain||"")}function Jg(e){let t=rn(e);for(;Ut(t)&&!hr(t);){if(ba(t))return t;if(ci(t))return null;t=rn(t)}return null}function va(){return $i==null&&($i=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),$i}function hr(e){return/^(html|body|#document)$/.test(Er(e))}function ht(e){return tt(e).getComputedStyle(e)}function li(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||Bc(e)&&e.host||At(e);return Bc(t)?t.host:t}function hd(e){const t=rn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ut(t)&&Qr(t)?t:hd(t)}function Ur(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=hd(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=tt(s);if(i){const a=go(o);return t.concat(o,o.visualViewport||[],Qr(s)?s:[],a&&n?Ur(a):[])}else return t.concat(s,Ur(s,[],n))}function go(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function md(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 wa(e){return pt(e)?e:e.contextElement}function Qn(e){const t=wa(e);if(!Ut(t))return kt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=md(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 ey=kt(0);function gd(e){const t=tt(e);return!va()||!t.visualViewport?ey:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ty(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==tt(e)?!1:t}function Nn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=wa(e);let o=kt(1);t&&(r?pt(r)&&(o=Qn(r)):o=Qn(e));const a=ty(i,n,r)?gd(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=tt(i),h=r&&pt(r)?tt(r):r;let g=m,p=go(g);for(;p&&r&&h!==g;){const y=Qn(p),b=p.getBoundingClientRect(),v=ht(p),x=b.left+(p.clientLeft+parseFloat(v.paddingLeft))*y.x,w=b.top+(p.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,l*=y.y,d*=y.x,f*=y.y,c+=x,l+=w,g=tt(p),p=go(g)}}return Us({width:d,height:f,x:c,y:l})}function ui(e,t){const n=li(e).scrollLeft;return t?t.left+n:Nn(At(e)).left+n}function yd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ui(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function ny(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=At(r),a=t?ci(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=li(r)),f)){const h=Nn(r);l=Qn(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const m=o&&!f&&!i?yd(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 ry(e){return Array.from(e.getClientRects())}function sy(e){const t=At(e),n=li(e),r=e.ownerDocument.body,s=et(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=et(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+ui(e);const a=-n.scrollTop;return ht(r).direction==="rtl"&&(o+=et(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const $c=25;function iy(e,t){const n=tt(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=va();(!d||d&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const l=ui(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,g=Math.abs(r.clientWidth-f.clientWidth-h);g<=$c&&(i-=g)}else l<=$c&&(i+=l);return{width:i,height:o,x:a,y:c}}function oy(e,t){const n=Nn(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 Vc(e,t,n){let r;if(t==="viewport")r=iy(e,n);else if(t==="document")r=sy(At(e));else if(pt(t))r=oy(t,n);else{const s=gd(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Us(r)}function bd(e,t){const n=rn(e);return n===t||!pt(n)||hr(n)?!1:ht(n).position==="fixed"||bd(n,t)}function ay(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=ba(o);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Qr(o)&&!c&&bd(e,o))?r=r.filter(d=>d!==o):s=a,o=rn(o)}return t.set(e,r),r}function cy(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?ci(t)?[]:ay(t,this._c):[].concat(n),r],a=Vc(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=Vc(t,o[m],s);c=et(h.top,c),l=nn(h.right,l),d=nn(h.bottom,d),f=et(h.left,f)}return{width:l-f,height:d-c,x:f,y:c}}function ly(e){const{width:t,height:n}=md(e);return{width:t,height:n}}function uy(e,t,n){const r=Ut(t),s=At(t),i=n==="fixed",o=Nn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=kt(0);function l(){c.x=ui(s)}if(r||!r&&!i)if((Er(t)!=="body"||Qr(s))&&(a=li(t)),r){const h=Nn(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?yd(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 Vi(e){return ht(e).position==="static"}function Hc(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 vd(e,t){const n=tt(e);if(ci(e))return n;if(!Ut(e)){let s=rn(e);for(;s&&!hr(s);){if(pt(s)&&!Vi(s))return s;s=rn(s)}return n}let r=Hc(e,t);for(;r&&Yg(r)&&Vi(r);)r=Hc(r,t);return r&&hr(r)&&Vi(r)&&!ba(r)?n:r||Jg(e)||n}const dy=async function(e){const t=this.getOffsetParent||vd,n=this.getDimensions,r=await n(e.floating);return{reference:uy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fy(e){return ht(e).direction==="rtl"}const py={convertOffsetParentRelativeRectToViewportRelativeRect:ny,getDocumentElement:At,getClippingRect:cy,getOffsetParent:vd,getElementRects:dy,getClientRects:ry,getDimensions:ly,getScale:Qn,isElement:pt,isRTL:fy};function wd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hy(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 g=hs(f),p=hs(s.clientWidth-(d+m)),y=hs(s.clientHeight-(f+h)),b=hs(d),x={rootMargin:-g+"px "+-p+"px "+-y+"px "+-b+"px",threshold:et(0,nn(1,c))||1};let w=!0;function E(k){const T=k[0].intersectionRatio;if(T!==c){if(!w)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!wd(l,e.getBoundingClientRect())&&o(),w=!1}try{n=new IntersectionObserver(E,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(e)}return o(!0),i}function my(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=wa(e),d=s||i?[...l?Ur(l):[],...t?Ur(t):[]]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=l&&a?hy(l,n):null;let m=-1,h=null;o&&(h=new ResizeObserver(b=>{let[v]=b;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 g,p=c?Nn(e):null;c&&y();function y(){const b=Nn(e);p&&!wd(p,b)&&n(),p=b,g=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const gy=Gg,yy=Kg,by=Hg,vy=Zg,wy=zg,zc=Vg,_y=qg,xy=(e,t,n)=>{const r=new Map,s={platform:py,...n},i={...s.platform,_c:r};return $g(e,t,{...s,platform:i})};var Sy=typeof document<"u",Cy=function(){},Ps=Sy?S.useLayoutEffect:Cy;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 _d(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wc(e,t){const n=_d(e);return Math.round(t*n)/n}function Hi(e){const t=_.useRef(e);return Ps(()=>{t.current=e}),t}function Ey(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]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=_.useState(r);Fs(m,r)||h(r);const[g,p]=_.useState(null),[y,b]=_.useState(null),v=_.useCallback(N=>{N!==k.current&&(k.current=N,p(N))},[]),x=_.useCallback(N=>{N!==T.current&&(T.current=N,b(N))},[]),w=i||g,E=o||y,k=_.useRef(null),T=_.useRef(null),R=_.useRef(d),A=c!=null,O=Hi(c),D=Hi(s),L=Hi(l),j=_.useCallback(()=>{if(!k.current||!T.current)return;const N={placement:t,strategy:n,middleware:m};D.current&&(N.platform=D.current),xy(k.current,T.current,N).then(I=>{const K={...I,isPositioned:L.current!==!1};U.current&&!Fs(R.current,K)&&(R.current=K,Yr.flushSync(()=>{f(K)}))})},[m,t,n,D,L]);Ps(()=>{l===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,f(N=>({...N,isPositioned:!1})))},[l]);const U=_.useRef(!1);Ps(()=>(U.current=!0,()=>{U.current=!1}),[]),Ps(()=>{if(w&&(k.current=w),E&&(T.current=E),w&&E){if(O.current)return O.current(w,E,j);j()}},[w,E,j,O,A]);const G=_.useMemo(()=>({reference:k,floating:T,setReference:v,setFloating:x}),[v,x]),H=_.useMemo(()=>({reference:w,floating:E}),[w,E]),B=_.useMemo(()=>{const N={position:n,left:0,top:0};if(!H.floating)return N;const I=Wc(H.floating,d.x),K=Wc(H.floating,d.y);return a?{...N,transform:"translate("+I+"px, "+K+"px)",..._d(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:K}},[n,a,H.floating,d.x,d.y]);return _.useMemo(()=>({...d,update:j,refs:G,elements:H,floatingStyles:B}),[d,j,G,H,B])}const Ty=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?zc({element:r.current,padding:s}).fn(n):{}:r?zc({element:r,padding:s}).fn(n):{}}}},Py=(e,t)=>{const n=gy(e);return{name:n.name,fn:n.fn,options:[e,t]}},ky=(e,t)=>{const n=yy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oy=(e,t)=>({fn:_y(e).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=wy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dy=(e,t)=>{const n=Ty(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Ly="Arrow",xd=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return u.jsx(we.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"})})});xd.displayName=Ly;var jy=xd;function My(e){const[t,n]=_.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 _a="Popper",[Sd,Cd]=xr(_a),[Iy,Ed]=Sd(_a),Td=e=>{const{__scopePopper:t,children:n}=e,[r,s]=_.useState(null),[i,o]=_.useState(void 0);return u.jsx(Iy,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};Td.displayName=_a;var Pd="PopperAnchor",kd=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=Ed(Pd,n),o=_.useRef(null),a=i.onAnchorChange,c=_.useCallback(g=>{o.current=g,g&&a(g)},[a]),l=Oe(t,c),d=_.useRef(null);_.useEffect(()=>{if(!r)return;const g=d.current;d.current=r.current,g!==d.current&&a(d.current)});const f=i.placementState&&Sa(i.placementState),m=f==null?void 0:f[0],h=f==null?void 0:f[1];return r?null:u.jsx(we.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...s,ref:l})});kd.displayName=Pd;var xa="PopperContent",[Uy,Fy]=Sd(xa),Od=_.forwardRef((e,t)=>{var ce,fe,ye,ie,ne,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:g,...p}=e,y=Ed(xa,n),[b,v]=_.useState(null),x=Oe(t,ke=>v(ke)),[w,E]=_.useState(null),k=My(w),T=(k==null?void 0:k.width)??0,R=(k==null?void 0:k.height)??0,A=r+(i!=="center"?"-"+i:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},D=Array.isArray(l)?l:[l],L=D.length>0,j={padding:O,boundary:D.filter($y),altBoundary:L},{refs:U,floatingStyles:G,placement:H,isPositioned:B,middlewareData:N}=Ey({strategy:"fixed",placement:A,whileElementsMounted:(...ke)=>my(...ke,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[Py({mainAxis:s+R,alignmentAxis:o}),c&&ky({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Oy():void 0,...j}),c&&Ay({...j}),Ry({...j,apply:({elements:ke,rects:Ee,availableWidth:J,availableHeight:Te})=>{const{width:Me,height:We}=Ee.reference,at=ke.floating.style;at.setProperty("--radix-popper-available-width",`${J}px`),at.setProperty("--radix-popper-available-height",`${Te}px`),at.setProperty("--radix-popper-anchor-width",`${Me}px`),at.setProperty("--radix-popper-anchor-height",`${We}px`)}}),w&&Dy({element:w,padding:a}),Vy({arrowWidth:T,arrowHeight:R}),m&&Ny({strategy:"referenceHidden",...j,boundary:L?j.boundary:void 0})]}),I=y.setPlacementState;Ue(()=>(I(H),()=>{I(void 0)}),[H,I]);const[K,M]=Sa(H),le=Rn(g);Ue(()=>{B&&(le==null||le())},[B,le]);const oe=(ce=N.arrow)==null?void 0:ce.x,ae=(fe=N.arrow)==null?void 0:fe.y,$=((ye=N.arrow)==null?void 0:ye.centerOffset)!==0,[q,Z]=_.useState();return Ue(()=>{b&&Z(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:B?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(ie=N.transformOrigin)==null?void 0:ie.x,(ne=N.transformOrigin)==null?void 0:ne.y].join(" "),...((je=N.hide)==null?void 0:je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(Uy,{scope:n,placedSide:K,placedAlign:M,onArrowChange:E,arrowX:oe,arrowY:ae,shouldHideArrow:$,children:u.jsx(we.div,{"data-side":K,"data-align":M,...p,ref:x,style:{...p.style,animation:B?void 0:"none"}})})})});Od.displayName=xa;var Ad="PopperArrow",By={top:"bottom",right:"left",bottom:"top",left:"right"},Rd=_.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Fy(Ad,r),o=By[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(jy,{...s,ref:n,style:{...s.style,display:"block"}})})});Rd.displayName=Ad;function $y(e){return e!==null}var Vy=e=>({name:"transformOrigin",options:e,fn(t){var y,b,v;const{placement:n,rects:r,middlewareData:s}=t,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[l,d]=Sa(n),f={start:"0%",center:"50%",end:"100%"}[d],m=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,h=(((v=s.arrow)==null?void 0:v.y)??0)+c/2;let g="",p="";return l==="bottom"?(g=o?f:`${m}px`,p=`${-c}px`):l==="top"?(g=o?f:`${m}px`,p=`${r.floating.height+c}px`):l==="right"?(g=`${-c}px`,p=o?f:`${h}px`):l==="left"&&(g=`${r.floating.width+c}px`,p=o?f:`${h}px`),{data:{x:g,y:p}}}});function Sa(e){const[t,n="center"]=e.split("-");return[t,n]}var Hy=Td,zy=kd,Wy=Od,Gy=Rd;function Ky(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Nd=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",Zy=_.forwardRef((e,t)=>u.jsx(we.span,{...e,ref:t,style:{...Nd,...e.style}}));Zy.displayName=qy;var Yy=[" ","Enter","ArrowUp","ArrowDown"],Qy=[" ","Enter"],Dn="Select",[di,fi,Xy]=ld(Dn),[Fn]=xr(Dn,[Xy,Cd]),pi=Cd(),[Jy,ln]=Fn(Dn),[eb,tb]=Fn(Dn),nb="SelectProvider";function Dd(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:g,internal_do_not_use_render:p}=e,y=pi(t),[b,v]=_.useState(null),[x,w]=_.useState(null),[E,k]=_.useState(!1),T=ud(l),[R,A]=fr({prop:r,defaultProp:s??!1,onChange:i,caller:Dn}),[O,D]=fr({prop:o,defaultProp:a,onChange:c,caller:Dn}),L=_.useRef(null),j=b?!!g||!!b.closest("form"):!0,[U,G]=_.useState(new Set),H=Jt(),B=Array.from(U).map(M=>M.props.value).join(";"),N=_.useCallback(M=>{G(le=>new Set(le).add(M))},[]),I=_.useCallback(M=>{G(le=>{const oe=new Set(le);return oe.delete(M),oe})},[]),K={required:h,trigger:b,onTriggerChange:v,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:E,onValueNodeHasChildrenChange:k,contentId:H,value:O,onValueChange:D,open:R,onOpenChange:A,dir:T,triggerPointerDownPosRef:L,disabled:m,name:d,autoComplete:f,form:g,nativeOptions:U,nativeSelectKey:B,isFormControl:j};return u.jsx(Hy,{...y,children:u.jsx(Jy,{scope:t,...K,children:u.jsx(di.Provider,{scope:t,children:u.jsx(eb,{scope:t,onNativeOptionAdd:N,onNativeOptionRemove:I,children:yb(p)?p(K):n})})})})}Dd.displayName=nb;var Ld=e=>{const{__scopeSelect:t,children:n,...r}=e;return u.jsx(Dd,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>u.jsxs(u.Fragment,{children:[n,s?u.jsx(tf,{__scopeSelect:t}):null]})})};Ld.displayName=Dn;var jd="SelectTrigger",Ca=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=pi(n),o=ln(jd,n),a=o.disabled||r,c=Oe(t,o.onTriggerChange),l=fi(n),d=_.useRef("touch"),[f,m,h]=nf(p=>{const y=l().filter(x=>!x.disabled),b=y.find(x=>x.value===o.value),v=rf(y,p,b);v!==void 0&&o.onValueChange(v.value)}),g=p=>{a||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return u.jsx(zy,{asChild:!0,...i,children:u.jsx(we.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":hi(o.value)?"":void 0,...s,ref:c,onClick:Se(s.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&g(p)}),onPointerDown:Se(s.onPointerDown,p=>{d.current=p.pointerType;const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:Se(s.onKeyDown,p=>{const y=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(y&&p.key===" ")&&Yy.includes(p.key)&&(g(),p.preventDefault())})})})});Ca.displayName=jd;var Md="SelectValue",Id=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,c=ln(Md,n),{onValueNodeHasChildrenChange:l}=c,d=i!==void 0,f=Oe(t,c.onValueNodeChange);Ue(()=>{l(d)},[l,d]);const m=hi(c.value);return u.jsx(we.span,{...a,asChild:m?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:u.jsx(_.Fragment,{children:m?o:i},m?"placeholder":"value")})});Id.displayName=Md;var rb="SelectIcon",Ud=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return u.jsx(we.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Ud.displayName=rb;var Fd="SelectPortal",[sb,ib]=Fn(Fd,{forceMount:void 0}),Bd=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return u.jsx(sb,{scope:e.__scopeSelect,forceMount:n,children:u.jsx(aa,{asChild:!0,...r})})};Bd.displayName=Fd;var sn="SelectContent",Ea=_.forwardRef((e,t)=>{const n=ib(sn,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=ln(sn,e.__scopeSelect),[o,a]=_.useState();return Ue(()=>{a(new DocumentFragment)},[]),u.jsx(Sr,{present:r||i.open,children:({present:c})=>c?u.jsx(Hd,{...s,ref:t}):u.jsx($d,{...s,fragment:o})})});Ea.displayName=sn;var $d=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Yr.createPortal(u.jsx(Vd,{scope:n,children:u.jsx(di.Slot,{scope:n,children:u.jsx("div",{ref:t,children:r})})}),s):null});$d.displayName="SelectContentFragment";var lt=10,[Vd,un]=Fn(sn),ob="SelectContentImpl",ab=dr("SelectContent.RemoveScroll"),Hd=_.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:g,hideWhenDetached:p,avoidCollisions:y,...b}=e,v=ln(sn,n),[x,w]=_.useState(null),[E,k]=_.useState(null),T=Oe(t,Z=>w(Z)),[R,A]=_.useState(null),[O,D]=_.useState(null),L=fi(n),[j,U]=_.useState(!1),G=_.useRef(!1);_.useEffect(()=>{if(x)return Ku(x)},[x]),Uu();const H=_.useCallback(Z=>{const[ce,...fe]=L().map(ne=>ne.ref.current),[ye]=fe.slice(-1),ie=document.activeElement;for(const ne of Z)if(ne===ie||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===ce&&E&&(E.scrollTop=0),ne===ye&&E&&(E.scrollTop=E.scrollHeight),ne==null||ne.focus(),document.activeElement!==ie))return},[L,E]),B=_.useCallback(()=>H([R,x]),[H,R,x]);_.useEffect(()=>{j&&B()},[j,B]);const{onOpenChange:N,triggerPointerDownPosRef:I}=v;_.useEffect(()=>{if(x){let Z={x:0,y:0};const ce=ye=>{var ie,ne;Z={x:Math.abs(Math.round(ye.pageX)-(((ie=I.current)==null?void 0:ie.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((ne=I.current)==null?void 0:ne.y)??0))}},fe=ye=>{Z.x<=10&&Z.y<=10?ye.preventDefault():ye.composedPath().includes(x)||N(!1),document.removeEventListener("pointermove",ce),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",fe,{capture:!0})}}},[x,N,I]),_.useEffect(()=>{const Z=()=>N(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[N]);const[K,M]=nf(Z=>{const ce=L().filter(ie=>!ie.disabled),fe=ce.find(ie=>ie.ref.current===document.activeElement),ye=rf(ce,Z,fe);ye&&setTimeout(()=>{var ie;return(ie=ye.ref.current)==null?void 0:ie.focus()})}),le=_.useCallback((Z,ce,fe)=>{const ye=!G.current&&!fe;(v.value!==void 0&&v.value===ce||ye)&&(A(Z),ye&&(G.current=!0))},[v.value]),oe=_.useCallback(()=>x==null?void 0:x.focus(),[x]),ae=_.useCallback((Z,ce,fe)=>{const ye=!G.current&&!fe;(v.value!==void 0&&v.value===ce||ye)&&D(Z)},[v.value]),$=r==="popper"?yo:zd,q=$===yo?{side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:p,avoidCollisions:y}:{};return u.jsx(Vd,{scope:n,content:x,viewport:E,onViewportChange:k,itemRefCallback:le,selectedItem:R,onItemLeave:oe,itemTextRefCallback:ae,focusSelectedItem:B,selectedItemText:O,position:r,isPositioned:j,searchRef:K,children:u.jsx(ca,{as:ab,allowPinchZoom:!0,children:u.jsx(oa,{asChild:!0,trapped:v.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:Se(s,Z=>{var ce;(ce=v.trigger)==null||ce.focus({preventScroll:!0}),Z.preventDefault()}),children:u.jsx(ia,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:u.jsx($,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:Z=>Z.preventDefault(),...b,...q,onPlaced:()=>U(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Se(b.onKeyDown,Z=>{const ce=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!ce&&Z.key.length===1&&M(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ye=L().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const ie=Z.target,ne=ye.indexOf(ie);ye=ye.slice(ne+1)}setTimeout(()=>H(ye)),Z.preventDefault()}})})})})})})});Hd.displayName=ob;var cb="SelectItemAlignedPosition",zd=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=ln(sn,n),o=un(sn,n),[a,c]=_.useState(null),[l,d]=_.useState(null),f=Oe(t,T=>d(T)),m=fi(n),h=_.useRef(!1),g=_.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:b,focusSelectedItem:v}=o,x=_.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&l&&p&&y&&b){const T=i.trigger.getBoundingClientRect(),R=l.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(i.dir!=="rtl"){const ie=O.left-R.left,ne=A.left-ie,je=T.left-ne,ke=T.width+je,Ee=Math.max(ke,R.width),J=window.innerWidth-lt,Te=Lc(ne,[lt,Math.max(lt,J-Ee)]);a.style.minWidth=ke+"px",a.style.left=Te+"px"}else{const ie=R.right-O.right,ne=window.innerWidth-A.right-ie,je=window.innerWidth-T.right-ne,ke=T.width+je,Ee=Math.max(ke,R.width),J=window.innerWidth-lt,Te=Lc(ne,[lt,Math.max(lt,J-Ee)]);a.style.minWidth=ke+"px",a.style.right=Te+"px"}const D=m(),L=window.innerHeight-lt*2,j=p.scrollHeight,U=window.getComputedStyle(l),G=parseInt(U.borderTopWidth,10),H=parseInt(U.paddingTop,10),B=parseInt(U.borderBottomWidth,10),N=parseInt(U.paddingBottom,10),I=G+H+j+N+B,K=Math.min(y.offsetHeight*5,I),M=window.getComputedStyle(p),le=parseInt(M.paddingTop,10),oe=parseInt(M.paddingBottom,10),ae=T.top+T.height/2-lt,$=L-ae,q=y.offsetHeight/2,Z=y.offsetTop+q,ce=G+H+Z,fe=I-ce;if(ce<=ae){const ie=D.length>0&&y===D[D.length-1].ref.current;a.style.bottom="0px";const ne=l.clientHeight-p.offsetTop-p.offsetHeight,je=Math.max($,q+(ie?oe:0)+ne+B),ke=ce+je;a.style.height=ke+"px"}else{const ie=D.length>0&&y===D[0].ref.current;a.style.top="0px";const je=Math.max(ae,G+p.offsetTop+(ie?le:0)+q)+fe;a.style.height=je+"px",p.scrollTop=ce-ae+p.offsetTop}a.style.margin=`${lt}px 0`,a.style.minHeight=K+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,a,l,p,y,b,i.dir,r]);Ue(()=>x(),[x]);const[w,E]=_.useState();Ue(()=>{l&&E(window.getComputedStyle(l).zIndex)},[l]);const k=_.useCallback(T=>{T&&g.current===!0&&(x(),v==null||v(),g.current=!1)},[x,v]);return u.jsx(ub,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:u.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:u.jsx(we.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});zd.displayName=cb;var lb="SelectPopperPosition",yo=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=lt,...i}=e,o=pi(n);return u.jsx(Wy,{...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)"}})});yo.displayName=lb;var[ub,Ta]=Fn(sn,{}),bo="SelectViewport",Wd=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=un(bo,n),o=Ta(bo,n),a=Oe(t,i.onViewportChange),c=_.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(di.Slot,{scope:n,children:u.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Se(s.onScroll,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 g=window.innerHeight-lt*2,p=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(p,y);if(b<g){const v=b+h,x=Math.min(g,v),w=v-x;f.style.height=x+"px",f.style.bottom==="0px"&&(d.scrollTop=w>0?w:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Wd.displayName=bo;var Gd="SelectGroup",[db,fb]=Fn(Gd),pb=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Jt();return u.jsx(db,{scope:n,id:s,children:u.jsx(we.div,{role:"group","aria-labelledby":s,...r,ref:t})})});pb.displayName=Gd;var Kd="SelectLabel",Pa=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=fb(Kd,n);return u.jsx(we.div,{id:s.id,...r,ref:t})});Pa.displayName=Kd;var Bs="SelectItem",[hb,qd]=Fn(Bs),ka=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=ln(Bs,n),c=un(Bs,n),l=a.value===r,[d,f]=_.useState(i??""),[m,h]=_.useState(!1),g=Oe(t,v=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,v,r,s)}),p=Jt(),y=_.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return u.jsx(hb,{scope:n,value:r,disabled:s,textId:p,isSelected:l,onItemTextChange:_.useCallback(v=>{f(x=>x||((v==null?void 0:v.textContent)??"").trim())},[]),children:u.jsx(di.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:u.jsx(we.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:g,onFocus:Se(o.onFocus,()=>h(!0)),onBlur:Se(o.onBlur,()=>h(!1)),onClick:Se(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Se(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Se(o.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:Se(o.onPointerMove,v=>{var x;y.current=v.pointerType,s?(x=c.onItemLeave)==null||x.call(c):y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(o.onPointerLeave,v=>{var x;v.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:Se(o.onKeyDown,v=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&v.key===" "||(Qy.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});ka.displayName=Bs;var Lr="SelectItemText",Zd=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=ln(Lr,n),a=un(Lr,n),c=qd(Lr,n),l=tb(Lr,n),[d,f]=_.useState(null),m=Oe(t,b=>f(b),c.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,c.value,c.disabled)}),h=d==null?void 0:d.textContent,g=_.useMemo(()=>u.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:y}=l;return Ue(()=>(p(g),()=>y(g)),[p,y,g]),u.jsxs(u.Fragment,{children:[u.jsx(we.span,{id:c.textId,...i,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!hi(o.value)?Yr.createPortal(i.children,o.valueNode):null]})});Zd.displayName=Lr;var Yd="SelectItemIndicator",Qd=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return qd(Yd,n).isSelected?u.jsx(we.span,{"aria-hidden":!0,...r,ref:t}):null});Qd.displayName=Yd;var vo="SelectScrollUpButton",Oa=_.forwardRef((e,t)=>{const n=un(vo,e.__scopeSelect),r=Ta(vo,e.__scopeSelect),[s,i]=_.useState(!1),o=Oe(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(Xd,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});Oa.displayName=vo;var wo="SelectScrollDownButton",Aa=_.forwardRef((e,t)=>{const n=un(wo,e.__scopeSelect),r=Ta(wo,e.__scopeSelect),[s,i]=_.useState(!1),o=Oe(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(Xd,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});Aa.displayName=wo;var Xd=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=un("SelectScrollButton",n),o=_.useRef(null),a=fi(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.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(we.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Se(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Se(s.onPointerMove,()=>{var l;(l=i.onItemLeave)==null||l.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Se(s.onPointerLeave,()=>{c()})})}),mb="SelectSeparator",Ra=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return u.jsx(we.div,{"aria-hidden":!0,...r,ref:t})});Ra.displayName=mb;var Jd="SelectArrow",gb=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=pi(n);return un(Jd,n).position==="popper"?u.jsx(Gy,{...s,...r,ref:t}):null});gb.displayName=Jd;var ef="SelectBubbleInput",tf=_.forwardRef(({__scopeSelect:e,...t},n)=>{const r=ln(ef,e),{value:s,onValueChange:i,required:o,disabled:a,name:c,autoComplete:l,form:d}=r,{nativeOptions:f,nativeSelectKey:m}=r,h=_.useRef(null),g=Oe(n,h),p=s??"",y=Ky(p),b=Array.from(f).some(v=>(v.props.value??"")==="");return _.useEffect(()=>{const v=h.current;if(!v)return;const x=window.HTMLSelectElement.prototype,E=Object.getOwnPropertyDescriptor(x,"value").set;if(y!==p&&E){const k=new Event("change",{bubbles:!0});E.call(v,p),v.dispatchEvent(k)}},[y,p]),u.jsxs(we.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:a,form:d,onChange:v=>i(v.target.value),...t,style:{...Nd,...t.style},ref:g,defaultValue:p,children:[hi(s)&&!b?u.jsx("option",{value:""}):null,Array.from(f)]},m)});tf.displayName=ef;function yb(e){return typeof e=="function"}function hi(e){return e===""||e===void 0}function nf(e){const t=Rn(e),n=_.useRef(""),r=_.useRef(0),s=_.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=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function rf(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=bb(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 bb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Na(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 vb=["color"],wb=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Na(e,vb);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),S.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),_b=["color"],Da=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Na(e,_b);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),S.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),xb=["color"],Sb=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Na(e,xb);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),S.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const _o=Ld,xo=Id,$s=_.forwardRef(({className:e,children:t,...n},r)=>u.jsxs(Ca,{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(Ud,{asChild:!0,children:u.jsx(Da,{className:"h-4 w-4 opacity-50"})})]}));$s.displayName=Ca.displayName;const sf=_.forwardRef(({className:e,...t},n)=>u.jsx(Oa,{ref:n,className:De("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(Sb,{className:"h-4 w-4"})}));sf.displayName=Oa.displayName;const of=_.forwardRef(({className:e,...t},n)=>u.jsx(Aa,{ref:n,className:De("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(Da,{className:"h-4 w-4"})}));of.displayName=Aa.displayName;const Vs=_.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>u.jsx(Bd,{children:u.jsxs(Ea,{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(sf,{}),u.jsx(Wd,{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(of,{})]})}));Vs.displayName=Ea.displayName;const Cb=_.forwardRef(({className:e,...t},n)=>u.jsx(Pa,{ref:n,className:De("px-2 py-1.5 text-sm font-semibold",e),...t}));Cb.displayName=Pa.displayName;const Hs=_.forwardRef(({className:e,children:t,...n},r)=>u.jsxs(ka,{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(Qd,{children:u.jsx(wb,{className:"h-4 w-4"})})}),u.jsx(Zd,{children:t})]}));Hs.displayName=ka.displayName;const Eb=_.forwardRef(({className:e,...t},n)=>u.jsx(Ra,{ref:n,className:De("-mx-1 my-1 h-px bg-muted",e),...t}));Eb.displayName=Ra.displayName;function af({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r}){var c;const[s,i]=S.useState(""),o=s||((c=n[0])==null?void 0:c.login)||"",a=!t&&n.length>0&&o!=="";return u.jsx(Pg,{open:e,children:u.jsxs(sd,{className:"web-trading-widget-account-modal",onPointerDownOutside:l=>l.preventDefault(),onEscapeKeyDown:l=>l.preventDefault(),children:[u.jsxs(id,{children:[u.jsx(ad,{children:"Select trading account"}),u.jsx(cd,{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(_o,{value:o,onValueChange:i,children:[u.jsx($s,{className:"web-trading-widget-account-modal__select",children:u.jsx(xo,{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(od,{children:u.jsx(Pt,{type:"button",disabled:!a,onClick:()=>r(o),children:"Continue"})})]})})}var Tb={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 Pb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),it=(e,t)=>{const n=S.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...c},l)=>S.createElement("svg",{ref:l,...Tb,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${Pb(e)}`,...c},[...t.map(([d,f])=>S.createElement(d,f)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},cf=it("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),kb=it("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Ob=it("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Ab=it("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),lf=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"}]]),uf=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"}]]),Rb=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"}]]),Nb=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"}]]),df=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"}]]),Db=it("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Lb=it("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),dn=it("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function jb(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function La(e){const t=Qe(e).toUpperCase();if(t)return cn.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 Mb(e){const t=La(e);return t!=null&&t.pricescale?jb(t.pricescale):5}function ff(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=Qe(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function Ib(e){const t=La(e);return(t==null?void 0:t.type)==="commodity"?100:1e5}const ja="USD";function Xr(e){return Qe(e).toUpperCase()}function mi(e){const t=Xr(e);return t.length>=6?t.slice(3):ja}function Ma(e){if(e!==ja&&e==="JPY")return"USDJPY"}function Ub(e,t,n,r,s){const i=mi(e),o=Ma(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 Fb(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let l=(e==="buy"?a-t:t-a)*s*Ib(i);const d=mi(i),f=Ub(i,e,n,r,o);if(f!==void 0)l/=f;else if(d!==ja)return null;return Math.round(l*100)/100}function Bb(e){const t=new Set;for(const n of e){const r=Ma(mi(n));r&&Xr(n)!==r&&t.add(r)}return[...t]}function $b(e,t){const n=Xr(e);if(n===t)return!0;const r=Ma(mi(e));return r===t&&n!==r}function Vb(e,t,n,r,s){if(!$b(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=Fb(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:c,marketBid:o,marketAsk:a,profit:l??e.profit}}function Qe(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function gi(e){return Qe(e)||"—"}const 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 yi(e){return zs.find(t=>t.mode===e)??zs[0]}function bi(e){return yi(e).isMarket}function pf(e,t){const n=yi(e);return n.orderType!==null?n.orderType:t==="buy"?Ze.BUY:Ze.SELL}function Ws(e){return e%2===1?"sell":"buy"}function Ia(e){return e>=Ze.BUY_LIMIT&&e<=Ze.SELL_STOP_LIMIT}function Ua(e){return e===Ze.BUY_STOP_LIMIT||e===Ze.SELL_STOP_LIMIT}function hf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const dt={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},mf=[{value:dt.GTC,label:"GTC"},{value:dt.TODAY,label:"Today"},{value:dt.SPECIFIED,label:"Specified"},{value:dt.SPECIFIED_DAY,label:"Specified Day"}];function Fa(e){return e===dt.SPECIFIED}function Ba(e){return e===dt.SPECIFIED_DAY}function Hb(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function zb(e,t){var n;return((n=e[0])==null?void 0:n.login)??""}function $a(e,t=cn){return t.find(n=>n.ticker===e)}function Wb(e,t=cn){var s;const n=Qe(e).toUpperCase();if(!n)return null;const r=t.find(i=>{var o;return Qe(i.resolve_symbol??"").toUpperCase()===n||((o=i.display_name)==null?void 0:o.toUpperCase())===n||i.ticker.replace(/_/g,"").toUpperCase()===n||i.ticker.toUpperCase()===n});return r?r.ticker:((s=La(e))==null?void 0:s.ticker)??null}function gf(e,t=cn){const n=$a(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Qe(r).toUpperCase()}function vi(e,t=cn){const n=$a(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function fn(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function pn(e,t=cn){const n=$a(e,t);return(n==null?void 0:n.pricescale)??1e5}function Pe(e,t){return e.toFixed(t)}function Tr(e){return 1/10**e}function yf(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 bf(e,t,n){if(Fa(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(Ba(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function wi(e,t,n){return e===dt.GTC||e===dt.TODAY?!0:bf(e,t,n)!==void 0}const Gb={},Gc=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(g=>g(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Gb?"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},Kb=e=>e?Gc(e):Gc;function qb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={exports:{}},zi={},gs={exports:{}},Wi={};/**
|
|
42
42
|
* @license React
|
|
43
43
|
* use-sync-external-store-shim.production.js
|
|
44
44
|
*
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
*
|
|
47
47
|
* This source code is licensed under the MIT license found in the
|
|
48
48
|
* LICENSE file in the root directory of this source tree.
|
|
49
|
-
*/var
|
|
49
|
+
*/var Kc;function Zb(){if(Kc)return Wi;Kc=1;var e=S;function t(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,m){var h=m(),g=r({inst:{value:h,getSnapshot:m}}),p=g[0].inst,y=g[1];return i(function(){p.value=h,p.getSnapshot=m,c(p)&&y({inst:p})},[f,h,m]),s(function(){return c(p)&&y({inst:p}),f(function(){c(p)&&y({inst:p})})},[f]),o(h),h}function c(f){var m=f.getSnapshot;f=f.value;try{var h=m();return!n(f,h)}catch{return!0}}function l(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Wi.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Wi}var Gi={};/**
|
|
50
50
|
* @license React
|
|
51
51
|
* use-sync-external-store-shim.development.js
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the MIT license found in the
|
|
56
56
|
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var
|
|
57
|
+
*/var qc;function Yb(){return qc||(qc=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}function t(h,g){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=g();if(!f){var y=g();i(p,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:p,getSnapshot:g}});var b=y[0].inst,v=y[1];return c(function(){b.value=p,b.getSnapshot=g,n(b)&&v({inst:b})},[h,p,g]),a(function(){return n(b)&&v({inst:b}),h(function(){n(b)&&v({inst:b})})},[h]),l(p),p}function n(h){var g=h.getSnapshot;h=h.value;try{var p=g();return!i(h,p)}catch{return!0}}function r(h,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=S,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,l=s.useDebugValue,d=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Gi.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())})()),Gi}var Zc;function vf(){return Zc||(Zc=1,process.env.NODE_ENV==="production"?gs.exports=Zb():gs.exports=Yb()),gs.exports}/**
|
|
58
58
|
* @license React
|
|
59
59
|
* use-sync-external-store-shim/with-selector.production.js
|
|
60
60
|
*
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
*
|
|
63
63
|
* This source code is licensed under the MIT license found in the
|
|
64
64
|
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var
|
|
65
|
+
*/var Yc;function Qb(){if(Yc)return zi;Yc=1;var e=S,t=vf();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 zi.useSyncExternalStoreWithSelector=function(l,d,f,m,h){var g=i(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=a(function(){function b(k){if(!v){if(v=!0,x=k,k=m(k),h!==void 0&&p.hasValue){var T=p.value;if(h(T,k))return w=T}return w=k}if(T=w,r(x,k))return T;var R=m(k);return h!==void 0&&h(T,R)?(x=k,T):(x=k,w=R)}var v=!1,x,w,E=f===void 0?null:f;return[function(){return b(d())},E===null?void 0:function(){return b(E())}]},[d,f,m,h]);var y=s(l,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),c(y),y},zi}var Ki={};/**
|
|
66
66
|
* @license React
|
|
67
67
|
* use-sync-external-store-shim/with-selector.development.js
|
|
68
68
|
*
|
|
@@ -70,26 +70,21 @@
|
|
|
70
70
|
*
|
|
71
71
|
* This source code is licensed under the MIT license found in the
|
|
72
72
|
* LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/var 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]&&
|
|
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(
|
|
77
|
-
`):" "+
|
|
73
|
+
*/var Qc;function Xb(){return Qc||(Qc=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=S,n=vf(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Ki.useSyncExternalStoreWithSelector=function(l,d,f,m,h){var g=i(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=a(function(){function b(k){if(!v){if(v=!0,x=k,k=m(k),h!==void 0&&p.hasValue){var T=p.value;if(h(T,k))return w=T}return w=k}if(T=w,r(x,k))return T;var R=m(k);return h!==void 0&&h(T,R)?(x=k,T):(x=k,w=R)}var v=!1,x,w,E=f===void 0?null:f;return[function(){return b(d())},E===null?void 0:function(){return b(E())}]},[d,f,m,h]);var y=s(l,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ki}var Xc;function Jb(){return Xc||(Xc=1,process.env.NODE_ENV==="production"?ms.exports=Qb():ms.exports=Xb()),ms.exports}var ev=Jb();const tv=qb(ev),wf={},{useDebugValue:nv}=S,{useSyncExternalStoreWithSelector:rv}=tv;let Jc=!1;const sv=e=>e;function iv(e,t=sv,n){(wf?"production":void 0)!=="production"&&n&&!Jc&&(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"),Jc=!0);const r=rv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return nv(r),r}const el=e=>{(wf?"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"?Kb(e):e,n=(r,s)=>iv(t,r,s);return Object.assign(n,t),n},_i=e=>e?el(e):el,tl={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},ue=_i(e=>({...tl,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({...tl})}));function qi(e,t){return e.toFixed(t)}function ov({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:l,scanResultUrl:d,onDragHandlePointerDown:f,onExpandedChange:m,onExpand:h,onPlaceOrder:g}){const[p,y]=S.useState(String(r)),[b,v]=S.useState(null),[x,w]=S.useState(d),E=ue(N=>N.setOrderSide),k=ue(N=>N.setVolumeLots);d!==x&&(w(d),v(null));const T=b??!!d;S.useEffect(()=>{m()},[T,m]);const R=()=>{const N=!T;N&&h(),v(N)},A=Number(fn(pn(e))),O=t!==null?Pe(t,A):"—",D=n!==null?Pe(n,A):"—",j=!o&&!a&&c!==""&&(t!==null&&n!==null),U=N=>{const I=Number(p),K=Number.isFinite(I)&&I>0?I:r,M=Math.max(i,K+N*s),le=qi(M,2);y(le),k(M)},G=()=>{const N=Number(p);if(!Number.isFinite(N)||N<=0){y(qi(r,2)),k(r);return}const I=Math.max(i,N),K=qi(I,2);y(K),k(I)},H=N=>{t===null||n===null||E({side:N,entryPrice:N==="buy"?n:t})},B=N=>{if(t===null||n===null||!c)return;const I=Number(p),K=Math.max(i,Number.isFinite(I)&&I>0?I:r);E({side:N,entryPrice:N==="buy"?n:t}),g({login:c,side:N,volumeLots:K,bid:t,ask:n})};return u.jsx("div",{className:`web-trading-widget-mini-order${T?" web-trading-widget-mini-order--expanded":" web-trading-widget-mini-order--collapsed"}`,children:u.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[u.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:f,className:`web-trading-widget-mini-order__drag-handle${l?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:u.jsx(uf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),T?u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button",disabled:!j,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>H("sell"),onClick:()=>B("sell"),children:[u.jsx("span",{className:"web-trading-widget-mini-order__price",children:O}),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:!j,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>U(-1),children:u.jsx(cf,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),u.jsx("input",{type:"text",inputMode:"decimal",value:p,disabled:!j,onChange:N=>y(N.target.value),onBlur:G,className:"web-trading-widget-mini-order__volume-input"}),u.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!j,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>U(1),children:u.jsx(Ab,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),u.jsxs("button",{type:"button",disabled:!j,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>H("buy"),onClick:()=>B("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:D})]})]}):null,u.jsx("button",{type:"button","aria-label":T?"Collapse quick order panel":"Expand quick order panel","aria-expanded":T,className:"web-trading-widget-mini-order__toggle",onClick:R,children:T?u.jsx(kb,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):u.jsx(Ob,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const av="web-trading-widget-mini-exec-panel-position",_f={x:56,y:96};function nl(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 rl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function cv(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):_f.x,y:16}}function lv(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 sl(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function xf(e){const t=(e==null?void 0:e.storageKey)??av,n=(e==null?void 0:e.defaultPosition)??_f,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=S.useRef(null),[o,a]=S.useState(n),[c,l]=S.useState(!1),d=S.useRef(n),f=S.useRef(null);S.useEffect(()=>{d.current=o},[o]);const m=S.useCallback(p=>{const y=i.current,b=nl(p,y);d.current=b,a(b),y&&rl(y,b)},[]),h=S.useCallback(()=>{m(d.current)},[m]);S.useEffect(()=>{if(!s)return;const p=lv(t);if(p){m(p);return}const y=r?cv(r,i.current):null;m(y??d.current)},[m,r,s,t]);const g=S.useCallback(p=>{p.preventDefault(),p.stopPropagation();const y=p.currentTarget,b=i.current;if(!b)return;const v=p.pointerId;y.setPointerCapture(v);const x=p.clientX,w=p.clientY,E=d.current;l(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const k=(A,O)=>{const D=nl({x:E.x+(A-x),y:E.y+(O-w)},b);d.current=D,rl(b,D)},T=A=>{if(A.pointerId===v){sl(y,v),y.removeEventListener("pointermove",R),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),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{}}},R=A=>{A.pointerId===v&&(A.preventDefault(),k(A.clientX,A.clientY))};y.addEventListener("pointermove",R),y.addEventListener("pointerup",T),y.addEventListener("pointercancel",T),f.current=()=>{sl(y,v),y.removeEventListener("pointermove",R),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),document.body.style.cursor="",document.body.style.userSelect="",l(!1)}},[t]);return S.useEffect(()=>{const p=()=>{m(d.current)};return window.addEventListener("resize",p),()=>{var y;window.removeEventListener("resize",p),(y=f.current)==null||y.call(f),f.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[m]),{panelRef:i,position:o,isDragging:c,onDragStart:g,reclamp:h}}const Sf=200,uv=201,dv=203,fv=204,Cf=0,pv=2,Ef=0;function xi(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function Va(e){return Math.round(e*1e4)}function hv(e){return e>=2&&e<=7}function mv(e){return{Action:fv,Order:Number(e.orderTicket),Login:xi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function gv(e){return{Action:dv,Order:Number(e.orderTicket),Login:xi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:Va(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 yv(e){const t=e.positionSide==="buy"?1:0;return{Action:Sf,Login:xi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:Cf,Volume:Va(e.volumeLots),Digits:e.digits,TypeTime:Ef,Comment:e.comment??"",Position:Number(e.positionTicket)}}function bv(e){const t=!hv(e.orderType);return{Action:t?Sf:uv,Login:xi(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?Cf:pv,Volume:Va(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??Ef,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 vv(e){return{async sendRequest(t){return e.post("/api/dealer/send_request",t,{headers:{"Content-Type":"application/json"}})},async getPositions(t){return t.trim()?e.get(`/api/trade/position/page?login=${encodeURIComponent(t)}&offset=0&total=50`):null},async getOrders(t){return t.trim()?e.get(`/api/trade/order/page?login=${encodeURIComponent(t)}&offset=0&total=10`):null}}}const wv=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 _v(e){const t=Nt(e);return t===void 0?.01:t/1e4}function xv(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function Sv(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 ks(e){return wv.has(e)}function ys(e,t){var v,x,w;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const s=xv(r),{retcode:i,price:o}=Sv(r),a=ks(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=Qe(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,g=Nt(s==null?void 0:s.ResultMarketBid),p=Nt(s==null?void 0:s.ResultMarketAsk),y=m==="buy"?g??h:p??h,b=Mb(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:gi(d),side:m,volumeLots:_v(s==null?void 0:s.Volume)||t.volumeLots,openPrice:h,currentPrice:y,stopLoss:Nt(s==null?void 0:s.PriceSL),takeProfit:Nt(s==null?void 0:s.PriceTP),comment:((w=s==null?void 0:s.Comment)==null?void 0:w.trim())||t.comment,digits:Math.round(b),retcode:i,isSuccess:a,marketBid:g,marketAsk:p}}function Cv(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Ev(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=vi(n.symbolTicker,t),o=Number(fn(pn(n.symbolTicker,t))),a=bi(n.executionMode),c=Ua(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&&!wi(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:bf(l,n.expirationDateTime??"",n.expirationDay??"");try{const m=bv({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:Ia(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),g=ys(h,{login:r,symbol:i,side:Ws(n.orderType),volumeLots:s,openPrice:d,digits:o,comment:n.comment.trim()});return g!=null&&g.isSuccess?{success:!0,ticket:g.ticket,side:g.side,volumeLots:g.volumeLots,displaySymbol:g.displaySymbol,price:g.openPrice}:{success:!1,message:h&&typeof h=="object"&&"message"in h&&typeof h.message=="string"?h.message:"Order was not accepted by the dealer."}}catch(m){return{success:!1,message:m instanceof Error?m.message:"Failed to place order."}}},async closePosition(n){try{const r=Cv(n),s=yv({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=ys(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&&!ks(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=mv({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=ys(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!ks(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=gv({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=ys(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&&!ks(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:Tv}=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},Pv=(e,t)=>e!=null&&Fr(e,t)?e[t]:void 0,Ha=(e=>t=>{const n=Tv.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),gt=e=>(e=e.toLowerCase(),t=>Ha(t)===e),Si=e=>t=>typeof t===e,{isArray:Ln}=Array,gr=Si("undefined");function Pr(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 kv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&kf(e.buffer),t}const Ov=Si("string"),Ye=Si("function"),Of=Si("number"),kr=e=>e!==null&&typeof e=="object",Av=e=>e===!0||e===!1,Os=e=>{if(!kr(e))return!1;const t=mr(e);return(t===null||t===Object.prototype||mr(t)===null)&&!Fr(e,Pf)&&!Fr(e,Jr)},Rv=e=>{if(!kr(e)||Pr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Nv=gt("Date"),Dv=gt("File"),Lv=e=>!!(e&&typeof e.uri<"u"),jv=e=>e&&typeof e.getParts<"u",Mv=gt("Blob"),Iv=gt("FileList"),Uv=e=>kr(e)&&Ye(e.pipe);function Fv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const il=Fv(),ol=typeof il.FormData<"u"?il.FormData:void 0,Bv=e=>{if(!e)return!1;if(ol&&e instanceof ol)return!0;const t=mr(e);if(!t||t===Object.prototype||!Ye(e.append))return!1;const n=Ha(e);return n==="formdata"||n==="object"&&Ye(e.toString)&&e.toString()==="[object FormData]"},$v=gt("URLSearchParams"),[Vv,Hv,zv,Wv]=["ReadableStream","Request","Response","Headers"].map(gt),Gv=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]),Ln(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Pr(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(Pr(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 yn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Rf=e=>!gr(e)&&e!==yn;function So(...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;Os(c)&&Os(i)?r[a]=So(c,i):Os(i)?r[a]=So({},i):Ln(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||Pr(a)||(es(a,s),typeof a!="object"||Ln(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let l=0;l<c.length;l++){const d=c[l];sw.call(a,d)&&s(a[d],d)}}return r}const Kv=(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),qv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Zv=(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)},Yv=(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},Qv=(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},Xv=e=>{if(!e)return null;if(Ln(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},Jv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&mr(Uint8Array)),ew=(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])}},tw=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},nw=gt("HTMLFormElement"),rw=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:sw}=Object.prototype,iw=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)},ow=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+"'")})}})},aw=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Ln(e)?r(e):r(String(e).split(t)),n},cw=()=>{},lw=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function uw(e){return!!(e&&Ye(e.append)&&e[Pf]==="FormData"&&e[Jr])}const dw=e=>{const t=new WeakSet,n=r=>{if(kr(r)){if(t.has(r))return;if(Pr(r))return r;if(!("toJSON"in r)){t.add(r);const s=Ln(r)?[]:{};return es(r,(i,o)=>{const a=n(i);!gr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},fw=gt("AsyncFunction"),pw=e=>e&&(kr(e)||Ye(e))&&Ye(e.then)&&Ye(e.catch),Df=((e,t)=>e?setImmediate:t?((n,r)=>(yn.addEventListener("message",({source:s,data:i})=>{s===yn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),yn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ye(yn.postMessage)),hw=typeof queueMicrotask<"u"?queueMicrotask.bind(yn):typeof process<"u"&&process.nextTick||Df,Lf=e=>e!=null&&Ye(e[Jr]),mw=e=>e!=null&&Fr(e,Jr)&&Lf(e),P={isArray:Ln,isArrayBuffer:kf,isBuffer:Pr,isFormData:Bv,isArrayBufferView:kv,isString:Ov,isNumber:Of,isBoolean:Av,isObject:kr,isPlainObject:Os,isEmptyObject:Rv,isReadableStream:Vv,isRequest:Hv,isResponse:zv,isHeaders:Wv,isUndefined:gr,isDate:Nv,isFile:Dv,isReactNativeBlob:Lv,isReactNative:jv,isBlob:Mv,isRegExp:iw,isFunction:Ye,isStream:Uv,isURLSearchParams:$v,isTypedArray:Jv,isFileList:Iv,forEach:es,merge:So,extend:Kv,trim:Gv,stripBOM:qv,inherits:Zv,toFlatObject:Yv,kindOf:Ha,kindOfTest:gt,endsWith:Qv,toArray:Xv,forEachEntry:ew,matchAll:tw,isHTMLForm:nw,hasOwnProperty:Gs,hasOwnProp:Gs,hasOwnInPrototypeChain:Fr,getSafeProp:Pv,reduceDescriptors:Nf,freezeMethods:ow,toObjectSet:aw,toCamelCase:rw,noop:cw,toFiniteNumber:lw,findKey:Af,global:yn,isContextDefined:Rf,isSpecCompliantForm:uw,toJSONObject:dw,isAsyncFn:fw,isThenable:pw,setImmediate:Df,asap:hw,isIterable:Lf,isSafeIterable:mw},gw=P.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),yw=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]&&gw[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function bw(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 vw=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ww=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function za(e,t){return P.isArray(e)?e.map(n=>za(n,t)):bw(String(e).replace(t,""))}const _w=e=>za(e,vw),xw=e=>za(e,ww);function jf(e){const t=Object.create(null);return P.forEach(e.toJSON(),(n,r)=>{t[r]=xw(n)}),t}const al=Symbol("internals");function Rr(e){return e&&String(e).trim().toLowerCase()}function As(e){return e===!1||e==null?e:P.isArray(e)?e.map(As):_w(String(e))}function Sw(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 Cw=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Zi(e,t,n,r,s){if(P.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!P.isString(t)){if(P.isString(r))return t.indexOf(r)!==-1;if(P.isRegExp(r))return r.test(t)}}function Ew(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Tw(e,t){const n=P.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let ze=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,c,l){const d=Rr(c);if(!d)return;const f=P.findKey(s,d);(!f||s[f]===void 0||l===!0||l===void 0&&s[f]!==!1)&&(s[f||c]=As(a))}const o=(a,c)=>P.forEach(a,(l,d)=>i(l,d,c));if(P.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(P.isString(t)&&(t=t.trim())&&!Cw(t))o(yw(t),n);else if(P.isObject(t)&&P.isSafeIterable(t)){let a=Object.create(null),c,l;for(const d of t){if(!P.isArray(d))throw new TypeError("Object iterator must return a key-value pair");l=d[0],P.hasOwnProp(a,l)?(c=a[l],a[l]=P.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=Rr(t),t){const r=P.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Sw(s);if(P.isFunction(n))return n.call(this,s,r);if(P.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Rr(t),t){const r=P.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Zi(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Rr(o),o){const a=P.findKey(r,o);a&&(!n||Zi(r,r[a],a,n))&&(delete r[a],s=!0)}}return P.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||Zi(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return P.forEach(this,(s,i)=>{const o=P.findKey(r,i);if(o){n[o]=As(s),delete n[i];return}const a=t?Ew(i):String(i).trim();a!==i&&delete n[i],n[a]=As(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return P.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&P.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
75
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[al]=this[al]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Rr(o);r[a]||(Tw(s,o),r[a]=!0)}return P.isArray(t)?t.forEach(i):i(t),this}};ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);P.reduceDescriptors(ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});P.freezeMethods(ze);const Pw="[REDACTED ****]";function kw(e){if(P.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(P.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Ow(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||P.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof ze&&(i=i.toJSON()),r.push(i);let o;if(P.isArray(i))o=[],i.forEach((a,c)=>{const l=s(a);P.isUndefined(l)||(o[c]=l)});else{if(!P.isPlainObject(i)&&kw(i))return r.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const l=n.has(a.toLowerCase())?Pw:s(c);P.isUndefined(l)||(o[a]=l)}}return r.pop(),o};return s(e)}let W=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&&P.hasOwnProp(t,"redact")?t.redact:void 0,r=P.isArray(n)&&n.length>0?Ow(t,n):P.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};W.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";W.ERR_BAD_OPTION="ERR_BAD_OPTION";W.ECONNABORTED="ECONNABORTED";W.ETIMEDOUT="ETIMEDOUT";W.ECONNREFUSED="ECONNREFUSED";W.ERR_NETWORK="ERR_NETWORK";W.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";W.ERR_DEPRECATED="ERR_DEPRECATED";W.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";W.ERR_BAD_REQUEST="ERR_BAD_REQUEST";W.ERR_CANCELED="ERR_CANCELED";W.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";W.ERR_INVALID_URL="ERR_INVALID_URL";W.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Aw=null,If=100;function Co(e){return P.isPlainObject(e)||P.isArray(e)}function Uf(e){return P.endsWith(e,"[]")?e.slice(0,-2):e}function Yi(e,t,n){return e?e.concat(t).map(function(s,i){return s=Uf(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Rw(e){return P.isArray(e)&&!e.some(Co)}const Nw=P.toFlatObject(P,{},null,function(t){return/^is[A-Z]/.test(t)});function Ci(e,t,n){if(!P.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=P.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,x){return!P.isUndefined(x[v])});const r=n.metaTokens,s=n.visitor||g,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?If:n.maxDepth,l=a&&P.isSpecCompliantForm(t),d=[];if(!P.isFunction(s))throw new TypeError("visitor must be a function");function f(b){if(b===null)return"";if(P.isDate(b))return b.toISOString();if(P.isBoolean(b))return b.toString();if(!l&&P.isBlob(b))throw new W("Blob is not supported. Use a Buffer instead.");return P.isArrayBuffer(b)||P.isTypedArray(b)?l&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b){if(b>c)throw new W("Object is too deeply nested ("+b+" levels). Max depth: "+c,W.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(b,v){if(c===1/0)return JSON.stringify(b);const x=[];return JSON.stringify(b,function(E,k){if(!P.isObject(k))return k;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(k),m(v+x.length-1),k})}function g(b,v,x){let w=b;if(P.isReactNative(t)&&P.isReactNativeBlob(b))return t.append(Yi(x,v,i),f(b)),!1;if(b&&!x&&typeof b=="object"){if(P.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=h(b,1);else if(P.isArray(b)&&Rw(b)||(P.isFileList(b)||P.endsWith(v,"[]"))&&(w=P.toArray(b)))return v=Uf(v),w.forEach(function(k,T){!(P.isUndefined(k)||k===null)&&t.append(o===!0?Yi([v],T,i):o===null?v:v+"[]",f(k))}),!1}return Co(b)?!0:(t.append(Yi(x,v,i),f(b)),!1)}const p=Object.assign(Nw,{defaultVisitor:g,convertValue:f,isVisitable:Co});function y(b,v,x=0){if(!P.isUndefined(b)){if(m(x),d.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));d.push(b),P.forEach(b,function(E,k){(!(P.isUndefined(E)||E===null)&&s.call(t,E,P.isString(k)?k.trim():k,v,p))===!0&&y(E,v?v.concat(k):[k],x+1)}),d.pop()}}if(!P.isObject(e))throw new TypeError("data must be an object");return y(e),t}function cl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function Wa(e,t){this._pairs=[],e&&Ci(e,this,t)}const Ff=Wa.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,cl)}:cl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Dw(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=P.isFunction(n)?{serialize:n}:n,s=P.getSafeProp(r,"encode")||Dw,i=P.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=P.isURLSearchParams(t)?t.toString():new Wa(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class ll{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){P.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Ga={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Lw=typeof URLSearchParams<"u"?URLSearchParams:Wa,jw=typeof FormData<"u"?FormData:null,Mw=typeof Blob<"u"?Blob:null,Iw={isBrowser:!0,classes:{URLSearchParams:Lw,FormData:jw,Blob:Mw},protocols:["http","https","file","blob","url","data"]},Ka=typeof window<"u"&&typeof document<"u",Eo=typeof navigator=="object"&&navigator||void 0,Uw=Ka&&(!Eo||["ReactNative","NativeScript","NS"].indexOf(Eo.product)<0),Fw=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Bw=Ka&&window.location.href||"http://localhost",$w=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ka,hasStandardBrowserEnv:Uw,hasStandardBrowserWebWorkerEnv:Fw,navigator:Eo,origin:Bw},Symbol.toStringTag,{value:"Module"})),Be={...$w,...Iw};function Vw(e,t){return Ci(e,new Be.classes.URLSearchParams,{visitor:function(n,r,s,i){return Be.isNode&&P.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const ul=If;function $f(e){if(e>ul)throw new W("FormData field is too deeply nested ("+e+" levels). Max depth: "+ul,W.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Hw(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 zw(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&&P.isArray(s)?s.length:o,c?(P.hasOwnProp(s,o)?s[o]=P.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!P.hasOwnProp(s,o)||!P.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&P.isArray(s[o])&&(s[o]=zw(s[o])),!a)}if(P.isFormData(e)&&P.isFunction(e.entries)){const n={};return P.forEachEntry(e,(r,s)=>{t(Hw(r),s,n,0)}),n}return null}const Wn=(e,t)=>e!=null&&P.hasOwnProp(e,t)?e[t]:void 0;function Ww(e,t,n){if(P.isString(e))try{return(t||JSON.parse)(e),P.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ts={transitional:Ga,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=P.isObject(t);if(i&&P.isHTMLForm(t)&&(t=new FormData(t)),P.isFormData(t))return s?JSON.stringify(Vf(t)):t;if(P.isArrayBuffer(t)||P.isBuffer(t)||P.isStream(t)||P.isFile(t)||P.isBlob(t)||P.isReadableStream(t))return t;if(P.isArrayBufferView(t))return t.buffer;if(P.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=Wn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Vw(t,c).toString();if((a=P.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=Wn(this,"env"),d=l&&l.FormData;return Ci(a?{"files[]":t}:t,d&&new d,c)}}return i||s?(n.setContentType("application/json",!1),Ww(t)):t}],transformResponse:[function(t){const n=Wn(this,"transitional")||ts.transitional,r=n&&n.forcedJSONParsing,s=Wn(this,"responseType"),i=s==="json";if(P.isResponse(t)||P.isReadableStream(t))return t;if(t&&P.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Wn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?W.from(c,W.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}}};P.forEach(["delete","get","head","post","put","patch","query"],e=>{ts.headers[e]={}});function Qi(e,t){const n=this||ts,r=t||n,s=ze.from(r.headers);let i=r.data;return P.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Hf(e){return!!(e&&e.__CANCEL__)}let ns=class extends W{constructor(t,n,r){super(t??"canceled",W.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 W("Request failed with status code "+n.status,n.status>=400&&n.status<500?W.ERR_BAD_REQUEST:W.ERR_BAD_RESPONSE,n.config,n.request,n))}function Gw(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Kw(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 qw(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 Ks=(e,t,n=3)=>{let r=0;const s=Kw(50,250);return qw(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,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)},dl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},fl=e=>(...t)=>P.asap(()=>e(...t)),Zw=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,Yw=Be.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];P.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),P.isString(r)&&a.push(`path=${r}`),P.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),P.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)return decodeURIComponent(r.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Qw(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Xw(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Jw=/^https?:(?!\/\/)/i,e_=/[\t\n\r]/g;function t_(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function n_(e){return t_(e).replace(e_,"")}function pl(e,t){if(typeof e=="string"&&Jw.test(n_(e)))throw new W('Invalid URL: missing "//" after protocol',W.ERR_INVALID_URL,t)}function Wf(e,t,n,r){pl(t,r);let s=!Qw(t);return e&&(s||n===!1)?(pl(e,r),Xw(e,t)):t}const hl=e=>e instanceof ze?{...e}:e;function jn(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 P.isPlainObject(d)&&P.isPlainObject(f)?P.merge.call({caseless:h},d,f):P.isPlainObject(f)?P.merge({},f):P.isArray(f)?f.slice():f}function s(d,f,m,h){if(P.isUndefined(f)){if(!P.isUndefined(d))return r(void 0,d,m,h)}else return r(d,f,m,h)}function i(d,f){if(!P.isUndefined(f))return r(void 0,f)}function o(d,f){if(P.isUndefined(f)){if(!P.isUndefined(d))return r(void 0,d)}else return r(void 0,f)}function a(d){const f=P.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!P.isUndefined(f))if(P.isPlainObject(f)){if(P.hasOwnProp(f,d))return f[d]}else return;const m=P.hasOwnProp(e,"transitional")?e.transitional:void 0;if(P.isPlainObject(m)&&P.hasOwnProp(m,d))return m[d]}function c(d,f,m){if(P.hasOwnProp(t,m))return r(d,f);if(P.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(hl(d),hl(f),m,!0)};return P.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=P.hasOwnProp(l,f)?l[f]:s,h=P.hasOwnProp(e,f)?e[f]:void 0,g=P.hasOwnProp(t,f)?t[f]:void 0,p=m(h,g,f);P.isUndefined(p)&&m!==c||(n[f]=p)}),P.hasOwnProp(t,"validateStatus")&&P.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(P.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const r_=["content-type","content-length"];function s_(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{r_.includes(r.toLowerCase())&&e.set(r,s)})}const i_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Gf(e){const t=jn({},e),n=m=>P.hasOwnProp(t,m)?t[m]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const c=n("auth"),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=P.getSafeProp(c,"username")||"",h=P.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(h?i_(h):"")))}if(P.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||P.isReactNative(r)?a.setContentType(void 0):P.isFunction(r.getHeaders)&&s_(a,r.getHeaders(),n("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(P.isFunction(s)&&(s=s(t)),s===!0||s==null&&Zw(t.url))){const h=i&&o&&Yw.read(o);h&&a.set(i,h)}return t}const o_=typeof XMLHttpRequest<"u",a_=o_&&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,g;function p(){h&&h(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function b(){if(!y)return;const x=ze.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),E={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};zf(function(T){n(T),p()},function(T){r(T),p()},E),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(b)},y.onabort=function(){y&&(r(new W("Request aborted",W.ECONNABORTED,e,y)),p(),y=null)},y.onerror=function(w){const E=w&&w.message?w.message:"Network Error",k=new W(E,W.ERR_NETWORK,e,y);k.event=w||null,r(k),p(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||Ga;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),r(new W(w,E.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,y)),p(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&P.forEach(jf(o),function(w,E){y.setRequestHeader(E,w)}),P.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),l&&([m,g]=Ks(l,!0),y.addEventListener("progress",m)),c&&y.upload&&([f,h]=Ks(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(d=x=>{y&&(r(!x||x.type?new ns(null,e,y):x),y.abort(),p(),y=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const v=Gw(s.url);if(v&&!Be.protocols.includes(v)){r(new W("Unsupported protocol "+v+":",W.ERR_BAD_REQUEST,e));return}y.send(i||null)})},c_=(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 W?l:new ns(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,s(new W(`timeout of ${t}ms exceeded`,W.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>P.asap(o),a},l_=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},u_=async function*(e,t){for await(const n of d_(e))yield*l_(n,t)},d_=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()}},ml=(e,t,n,r)=>{const s=u_(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})},qs=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,f_=(e,t,n)=>t+2<n&&qs(e.charCodeAt(t+1))&&qs(e.charCodeAt(t+2));function p_(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let o=r.length;const a=r.length;for(let h=0;h<a;h++)if(r.charCodeAt(h)===37&&h+2<a){const g=r.charCodeAt(h+1),p=r.charCodeAt(h+2);qs(g)&&qs(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&&f_(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 qa="1.18.0",gl=64*1024,{isFunction:bs}=P,h_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),yl=e=>{if(!P.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},bl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},m_=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},g_=e=>{const t=P.global!==void 0&&P.global!==null?P.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=P.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?bs(s):typeof fetch=="function",c=bs(i),l=bs(o);if(!a)return!1;const d=a&&bs(n),f=a&&(typeof r=="function"?(b=>v=>b.encode(v))(new r):async b=>new Uint8Array(await new i(b).arrayBuffer())),m=c&&d&&bl(()=>{let b=!1;const v=new i(Be.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),x=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!x}),h=l&&d&&bl(()=>P.isReadableStream(new o("").body)),g={stream:h&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(v,x)=>{let w=v&&v[b];if(w)return w.call(v);throw new W(`Response type '${b}' is not supported`,W.ERR_NOT_SUPPORT,x)})});const p=async b=>{if(b==null)return 0;if(P.isBlob(b))return b.size;if(P.isSpecCompliantForm(b))return(await new i(Be.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(P.isArrayBufferView(b)||P.isArrayBuffer(b))return b.byteLength;if(P.isURLSearchParams(b)&&(b=b+""),P.isString(b))return(await f(b)).byteLength},y=async(b,v)=>{const x=P.toFiniteNumber(b.getContentLength());return x??p(v)};return async b=>{let{url:v,method:x,data:w,signal:E,cancelToken:k,timeout:T,onDownloadProgress:R,onUploadProgress:A,responseType:O,headers:D,withCredentials:L="same-origin",fetchOptions:j,maxContentLength:U,maxBodyLength:G}=Gf(b);const H=P.isNumber(U)&&U>-1,B=P.isNumber(G)&&G>-1,N=q=>P.hasOwnProp(b,q)?b[q]:void 0;let I=s||fetch;O=O?(O+"").toLowerCase():"text";let K=c_([E,k&&k.toAbortSignal()],T),M=null;const le=K&&K.unsubscribe&&(()=>{K.unsubscribe()});let oe,ae=null;const $=()=>new W("Request body larger than maxBodyLength limit",W.ERR_BAD_REQUEST,b,M);try{let q;const Z=N("auth");if(Z){const J=P.getSafeProp(Z,"username")||"",Te=P.getSafeProp(Z,"password")||"";q={username:J,password:Te}}if(m_(v)){const J=new URL(v,Be.origin);if(!q&&(J.username||J.password)){const Te=yl(J.username),Me=yl(J.password);q={username:Te,password:Me}}(J.username||J.password)&&(J.username="",J.password="",v=J.href)}if(q&&(D.delete("authorization"),D.set("Authorization","Basic "+btoa(h_((q.username||"")+":"+(q.password||""))))),H&&typeof v=="string"&&v.startsWith("data:")&&p_(v)>U)throw new W("maxContentLength size of "+U+" exceeded",W.ERR_BAD_RESPONSE,b,M);if(B&&x!=="get"&&x!=="head"){const J=await p(w);if(typeof J=="number"&&isFinite(J)&&(oe=J,J>G))throw $()}const ce=B&&(P.isReadableStream(w)||P.isStream(w)),fe=(J,Te,Me)=>ml(J,gl,We=>{if(B&&We>G)throw ae=$();Te&&Te(We)},Me);if(m&&x!=="get"&&x!=="head"&&(A||ce)){if(oe=oe??await y(D,w),oe!==0||ce){let J=new i(v,{method:"POST",body:w,duplex:"half"}),Te;if(P.isFormData(w)&&(Te=J.headers.get("content-type"))&&D.setContentType(Te),J.body){const[Me,We]=A&&dl(oe,Ks(fl(A)))||[];w=fe(J.body,Me,We)}}}else if(ce&&!c&&d&&x!=="get"&&x!=="head")w=fe(w);else if(ce&&c&&!m&&x!=="get"&&x!=="head")throw new W("Stream request bodies are not supported by the current fetch implementation",W.ERR_NOT_SUPPORT,b,M);P.isString(L)||(L=L?"include":"omit");const ye=c&&"credentials"in i.prototype;if(P.isFormData(w)){const J=D.getContentType();J&&/^multipart\/form-data/i.test(J)&&!/boundary=/i.test(J)&&D.delete("content-type")}D.set("User-Agent","axios/"+qa,!1);const ie={...j,signal:K,method:x.toUpperCase(),headers:jf(D.normalize()),body:w,duplex:"half",credentials:ye?L:void 0};M=c&&new i(v,ie);let ne=await(c?I(M,j):I(v,ie));const je=ze.from(ne.headers);if(H){const J=P.toFiniteNumber(je.getContentLength());if(J!=null&&J>U)throw new W("maxContentLength size of "+U+" exceeded",W.ERR_BAD_RESPONSE,b,M)}const ke=h&&(O==="stream"||O==="response");if(h&&ne.body&&(R||H||ke&&le)){const J={};["status","statusText","headers"].forEach($e=>{J[$e]=ne[$e]});const Te=P.toFiniteNumber(je.getContentLength()),[Me,We]=R&&dl(Te,Ks(fl(R),!0))||[];let at=0;const ee=$e=>{if(H&&(at=$e,at>U))throw new W("maxContentLength size of "+U+" exceeded",W.ERR_BAD_RESPONSE,b,M);Me&&Me($e)};ne=new o(ml(ne.body,gl,ee,()=>{We&&We(),le&&le()}),J)}O=O||"text";let Ee=await g[P.findKey(g,O)||"text"](ne,b);if(H&&!h&&!ke){let J;if(Ee!=null&&(typeof Ee.byteLength=="number"?J=Ee.byteLength:typeof Ee.size=="number"?J=Ee.size:typeof Ee=="string"&&(J=typeof r=="function"?new r().encode(Ee).byteLength:Ee.length)),typeof J=="number"&&J>U)throw new W("maxContentLength size of "+U+" exceeded",W.ERR_BAD_RESPONSE,b,M)}return!ke&&le&&le(),await new Promise((J,Te)=>{zf(J,Te,{data:Ee,headers:ze.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:M})})}catch(q){if(le&&le(),K&&K.aborted&&K.reason instanceof W){const Z=K.reason;throw Z.config=b,M&&(Z.request=M),q!==Z&&(Z.cause=q),Z}throw ae?(M&&!ae.request&&(ae.request=M),ae):q instanceof W?(M&&!q.request&&(q.request=M),q):q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new W("Network Error",W.ERR_NETWORK,b,M,q&&q.response),{cause:q.cause||q}):W.from(q,q&&q.code,b,M,q&&q.response)}}},y_=new Map,Kf=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,c,l,d=y_;for(;a--;)c=i[a],l=d.get(c),l===void 0&&d.set(c,l=a?new Map:g_(t)),d=l;return l};Kf();const Za={http:Aw,xhr:a_,fetch:{get:Kf}};P.forEach(Za,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const vl=e=>`- ${e}`,b_=e=>P.isFunction(e)||e===null||e===!1;function v_(e,t){e=P.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!b_(r)&&(s=Za[(a=String(r)).toLowerCase()],s===void 0))throw new W(`Unknown adapter '${a}'`);if(s&&(P.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,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(vl).join(`
|
|
77
|
+
`):" "+vl(o[0]):"as no adapter specified";throw new W("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const qf={getAdapter:v_,adapters:Za};function Xi(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ns(null,e)}function wl(e){return Xi(e),e.headers=ze.from(e.headers),e.data=Qi.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),qf.getAdapter(e.adapter||ts.adapter,e)(e).then(function(r){Xi(e),e.response=r;try{r.data=Qi.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=ze.from(r.headers),r},function(r){if(!Hf(r)&&(Xi(e),r&&r.response)){e.response=r.response;try{r.response.data=Qi.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=ze.from(r.response.headers)}return Promise.reject(r)})}const Ei={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ei[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const _l={};Ei.transitional=function(t,n,r){function s(i,o){return"[Axios v"+qa+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new W(s(o," has been removed"+(n?" in "+n:"")),W.ERR_DEPRECATED);return n&&!_l[o]&&(_l[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}};Ei.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function w_(e,t,n){if(typeof e!="object")throw new W("options must be an object",W.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 W("option "+i+" must be "+c,W.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new W("Unknown option "+i,W.ERR_BAD_OPTION)}}const Rs={assertOptions:w_,validators:Ei},Ve=Rs.validators;let On=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ll,response:new ll}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
|
|
78
78
|
`);return o===-1?"":s.stack.slice(o+1)})();try{if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(`
|
|
79
79
|
`),a=o===-1?-1:i.indexOf(`
|
|
80
80
|
`,o+1),c=a===-1?"":i.slice(a+1);String(r.stack).endsWith(c)||(r.stack+=`
|
|
81
|
-
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=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">
|
|
81
|
+
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=jn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Rs.assertOptions(r,{silentJSONParsing:Ve.transitional(Ve.boolean),forcedJSONParsing:Ve.transitional(Ve.boolean),clarifyTimeoutError:Ve.transitional(Ve.boolean),legacyInterceptorReqResOrdering:Ve.transitional(Ve.boolean),advertiseZstdAcceptEncoding:Ve.transitional(Ve.boolean),validateStatusUndefinedResolves:Ve.transitional(Ve.boolean)},!1),s!=null&&(P.isFunction(s)?n.paramsSerializer={serialize:s}:Rs.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),Rs.assertOptions(n,{baseUrl:Ve.spelling("baseURL"),withXsrfToken:Ve.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&P.merge(i.common,i[n.method]);i&&P.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete i[g]}),n.headers=ze.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(n)===!1)return;c=c&&p.synchronous;const y=n.transitional||Ga;y&&y.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 g=[wl.bind(this),void 0];for(g.unshift(...a),g.push(...l),m=g.length,d=Promise.resolve(n);f<m;)d=d.then(g[f++],g[f++]);return d}m=a.length;let h=n;for(;f<m;){const g=a[f++],p=a[f++];try{h=g(h)}catch(y){p.call(this,y);break}}try{d=wl.call(this,h)}catch(g){return Promise.reject(g)}for(f=0,m=l.length;f<m;)d=d.then(l[f++],l[f++]);return d}getUri(t){t=jn(this.defaults,t);const n=Wf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Bf(n,t.params,t.paramsSerializer)}};P.forEach(["delete","get","head","options"],function(t){On.prototype[t]=function(n,r){return this.request(jn(r||{},{method:t,url:n,data:r&&P.hasOwnProp(r,"data")?r.data:void 0}))}});P.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,a){return this.request(jn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}On.prototype[t]=n(),t!=="query"&&(On.prototype[t+"Form"]=n(!0))});let __=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 x_(e){return function(n){return e.apply(null,n)}}function S_(e){return P.isObject(e)&&e.isAxiosError===!0}const To={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(To).forEach(([e,t])=>{To[t]=e});function Yf(e){const t=new On(e),n=Tf(On.prototype.request,t);return P.extend(n,On.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Yf(jn(e,s))},n}const Ae=Yf(ts);Ae.Axios=On;Ae.CanceledError=ns;Ae.CancelToken=__;Ae.isCancel=Hf;Ae.VERSION=qa;Ae.toFormData=Ci;Ae.AxiosError=W;Ae.Cancel=Ae.CanceledError;Ae.all=function(t){return Promise.all(t)};Ae.spread=x_;Ae.isAxiosError=S_;Ae.mergeConfig=jn;Ae.AxiosHeaders=ze;Ae.formToJSON=e=>Vf(P.isHTMLForm(e)?new FormData(e):e);Ae.getAdapter=qf.getAdapter;Ae.HttpStatusCode=To;Ae.default=Ae;const{Axios:bC,AxiosError:vC,CanceledError:wC,isCancel:_C,CancelToken:xC,VERSION:SC,all:CC,Cancel:EC,isAxiosError:Qf,spread:TC,toFormData:PC,AxiosHeaders:kC,HttpStatusCode:OC,formToJSON:AC,getAdapter:RC,mergeConfig:NC,create:DC}=Ae,C_="Bearer ",Xf="web-trading-token";function E_(){return typeof window>"u"?null:localStorage.getItem(Xf)}function Mn(e){return e.replace(/\/$/,"")}function xl(e){const t=Mn(e);async function n(r){const s=E_();return(await Ae({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${C_}${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 Sl(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function T_(e){const t=e.filter(n=>Sl(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(Sl)}function P_(e){const t=e,n=(t==null?void 0:t.accounts)??[];return T_(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 k_(e){try{const t=new URL(Mn(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 Mn(e)}}function O_(e){try{const t=new URL(Mn(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 A_(e){try{const t=new URL(Mn(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 R_=["XAU_USD","EUR_USD","GBP_USD","USD_JPY","BTCUSDT"],N_=cn.filter(e=>R_.includes(e.ticker));function Jf(){return N_}function D_(e){const t=Mn(e),n=xl(t),r=k_(t),s=xl(r),i=vv(n),o=Jf();return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:O_(t),publicTickWebSocketUrl:A_(t),dealer:i,trading:Ev(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return P_(a)}}}const ep=S.createContext(null);function tp({baseUrl:e,children:t}){const n=S.useMemo(()=>D_(e),[e]);return u.jsx(ep.Provider,{value:n,children:t})}function hn(){const e=S.useContext(ep);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function L_(){return hn().tickWebSocketUrl}function j_(){return hn().publicTickWebSocketUrl}const M_="wss://public-ticks.opheleo.com";function Ya(e){const[t,n]=S.useState(null),r=j_();return S.useEffect(()=>{const s=vi(e).toUpperCase();let i=null,o=!1;const a=r||M_,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 g=Number(m.b),p=Number(m.a);if(!(!Number.isFinite(g)||!Number.isFinite(p))){n({bid:g,ask:p});break}}}catch{}},i.onclose=()=>{o||setTimeout(c,3e3)}};return c(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function I_({symbolTicker:e,scanResultUrl:t,orderState:n}){const r=Ya(e),{panelRef:s,position:i,isDragging:o,onDragStart:a,reclamp:c}=xf(),{panel:l,isSubmitting:d,defaultVolumeLots:f,volumeStep:m,minVolumeLots:h,accountOptions:g,selectedLogin:p,isAccountsLoading:y,hasConfirmedAccount:b,confirmAccountSelection:v,placeMarketOrder:x}=n,w=ue(A=>A.setDraft),E=ue(A=>A.clearDraft),k=Number(fn(pn(e))),T=Tr(k);S.useEffect(()=>{b&&w({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:f,digits:k,priceStep:T})},[f,k,b,T,w]),S.useEffect(()=>{(l==="closed"||l==="confirmation")&&E()},[E,l]);const R=A=>{x({symbolTicker:e,login:A.login,executionMode:"market",side:A.side,orderType:A.side==="buy"?Ze.BUY:Ze.SELL,volumeLots:A.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:dt.GTC,expirationDateTime:"",expirationDay:"",bid:A.bid,ask:A.ask})};return u.jsxs(u.Fragment,{children:[u.jsx(af,{open:!b,isAccountsLoading:y,accountOptions:g,onConfirm:v}),b&&u.jsx("div",{ref:s,style:{left:i.x,top:i.y},className:`web-trading-widget-new-order-overlay${o?" web-trading-widget-new-order-overlay--dragging":""}`,children:u.jsx(ov,{symbolTicker:e,bid:(r==null?void 0:r.bid)??null,ask:(r==null?void 0:r.ask)??null,defaultVolumeLots:f,volumeStep:m,minVolumeLots:h,isSubmitting:d,isAccountsLoading:y,selectedLogin:p,isDragging:o,scanResultUrl:t,onDragHandlePointerDown:a,onExpandedChange:c,onExpand:c,onPlaceOrder:R})})]})}function U_(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 F_(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:U_(e.ticket,t.ticket)}function Cl(e){return[...e].sort(F_)}function El(e){return Qe(e).toUpperCase()}const ge=_i(e=>({positions:[],orders:[],liveQuotes:{},selectedLogin:"",selectedPositionTicket:null,selectedOrderTicket:null,setSelectedLogin:t=>{e({selectedLogin:t})},setSelectedPositionTicket:t=>{e(n=>({selectedPositionTicket:t,selectedOrderTicket:t!==null?null:n.selectedOrderTicket}))},setSelectedOrderTicket:t=>{e(n=>({selectedOrderTicket:t,selectedPositionTicket:t!==null?null:n.selectedPositionTicket}))},setPositions:t=>{e({positions:Cl(t)})},setOrders:t=>{e({orders:Cl(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=El(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Vb(a,s,n,r,o)),orders:i.orders.map(a=>{if(El(a.symbol)!==s)return a;const c=a.side==="buy"?n:r;return{...a,currentPrice:c}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),B_="wss://symbols.opheleo.com";function $_(e,t){const n=new Set;for(const r of e){const s=Qe(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=Qe(r.symbol).toUpperCase();s&&n.add(s)}for(const r of Bb([...n]))n.add(r);return[...n].sort().join("|")}function V_(e){return $_(e.positions,e.orders)}function H_(){const e=ge(V_),t=ge(r=>r.updateQuotes),n=L_();S.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||B_,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 g=Number(m.bid),p=Number(m.ask);if(!Number.isFinite(g)||!Number.isFinite(p))return;t(h,g,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 H_(),null}const rp={buy:"#2563eb",sell:"#dc2626"},Ji={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},eo={linewidth:1,linestyle:2,fontsize:11},sp={stopLoss:"#f97316",takeProfit:"#22c55e"},ip=e=>rp[e],Po=(e,t)=>e==="entry"?t!=null?ip(t):rp.sell:sp[e],Tl=(e,t)=>{if(e==="entry")return Po(e,t.side);const{side:n,entryPrice:r,linePrice:s,volumeLots:i}=t;if(n!=null&&r!==null&&r!==void 0&&s!==void 0&&i!==void 0){const o=op(n,r,s,i);return ap(o)}return sp[e]},op=(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=op(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}`},G_=(e,t)=>e.toFixed(t),ap=e=>e>0?Ji.positive:e<0?Ji.negative:Ji.neutral,K_=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},Pl=e=>{const t=ip(e.side),n=ap(e.profit);return{text:K_(e),linecolor:t,textcolor:n,linewidth:eo.linewidth,linestyle:eo.linestyle,fontsize:eo.fontsize,showPrice:!0,horzLabelsAlign:"left"}},kl=e=>ft(e),q_=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",to=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Ol=(e,t,n)=>{if(e==="entry")return G_(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"} ${Pe(t,n.digits)}`},Z_=({chartWidget:e})=>{const t=ue(w=>w.source),n=ue(w=>w.entryPrice),r=ue(w=>w.stopLoss),s=ue(w=>w.takeProfit),i=ue(w=>w.side),o=ue(w=>w.showEntryLine),a=ue(w=>w.volumeLots),c=ue(w=>w.digits),l=ue(w=>w.priceStep),d=ue(w=>w.setStopLoss),f=ue(w=>w.setTakeProfit),m=S.useRef({}),h=S.useRef(null),g=S.useRef(null),p=S.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:c,priceStep:l});S.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 y=S.useCallback(w=>{if(!e)return;const E=m.current[w];if(E){try{e.activeChart().removeEntity(E)}catch{}delete m.current[w]}},[e]),b=S.useCallback((w,E,k,T)=>{const R=Po(E,T.side),A=Tl(E,{side:T.side,entryPrice:T.entryPrice,linePrice:k,volumeLots:T.volumeLots});w.setProperties({text:Ol(E,k,T),linecolor:R,textcolor:A,showPrice:!0,horzLabelsAlign:"left"})},[]),v=S.useCallback(async(w,E,k)=>{var L;if(!e)return;if(E===void 0){y(w);return}if(h.current===w)return;const T=e.activeChart(),R=Po(w,k.side),A=Tl(w,{side:k.side,entryPrice:k.entryPrice,linePrice:E,volumeLots:k.volumeLots}),O=Ol(w,E,k),D=m.current[w];if(D)try{const j=T.getShapeById(D);w==="entry"&&to(j);const U=(L=j.getPoints()[0])==null?void 0:L.price;if(U!==void 0&&Math.abs(U-E)<k.priceStep/2){j.setProperties({text:O,linecolor:R,textcolor:A,showPrice:!0,horzLabelsAlign:"left"});return}const G=j.getPoints();if(G.length>0){j.setPoints(G.map(H=>({...H,price:E}))),j.setProperties({text:O,linecolor:R,textcolor:A,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete m.current[w]}try{const j=T.getVisibleRange(),U=await T.createShape({time:j.from,price:E},{shape:"horizontal_line",text:O,disableSave:!0,lock:w==="entry",disableSelection:w==="entry",overrides:{linecolor:R,textcolor:A,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(w==="entry")try{to(T.getShapeById(U))}catch{}m.current[w]=U}catch{}},[e,y]),x=S.useCallback(async w=>{const E=kl(w.stopLoss),k=kl(w.takeProfit);w.showEntryLine&&w.entryPrice!==null?await v("entry",w.entryPrice,w):await v("entry",void 0,w),await v("stopLoss",E,w),await v("takeProfit",k,w)},[v]);S.useEffect(()=>{if(!e||t===null)return;const w=(E,k)=>{var R,A,O;const T=(R=Object.entries(m.current).find(([,D])=>D===E))==null?void 0:R[0];if(!(!T||!q_(T))){if(T==="entry"){if(k==="move"||k==="points_changed"){const D=p.current;if(D.entryPrice!==null)try{const L=e.activeChart().getShapeById(E),j=(A=L.getPoints()[0])==null?void 0:A.price;if(j!==void 0&&Math.abs(j-D.entryPrice)>=D.priceStep/2){const U=L.getPoints();U.length>0&&L.setPoints(U.map(G=>({...G,price:D.entryPrice})))}to(L)}catch{}}return}if(k==="remove"){h.current=null,T==="stopLoss"&&d(""),T==="takeProfit"&&f(""),delete m.current[T];return}if(!(k!=="move"&&k!=="points_changed"))try{const D=e.activeChart().getShapeById(E),L=(O=D.getPoints()[0])==null?void 0:O.price;if(!Number.isFinite(L)||L<=0)return;const j=p.current;if(k==="points_changed"){h.current=T,b(D,T,L,j),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>{h.current=null;const H=Pe(L,p.current.digits);T==="stopLoss"?d(H):f(H)},120);return}g.current!==null&&(clearTimeout(g.current),g.current=null),h.current=null;const U=Pe(L,j.digits),G=T==="stopLoss"?{...j,stopLoss:U}:{...j,takeProfit:U};T==="stopLoss"?d(U):f(U),b(D,T,L,G)}catch{h.current=null}}};try{e.subscribe("drawing_event",w)}catch{}return()=>{h.current=null,g.current!==null&&(clearTimeout(g.current),g.current=null);try{e.unsubscribe("drawing_event",w)}catch{}Object.keys(m.current).forEach(E=>{y(E)}),m.current={}}},[e,y,d,f,t,b]),S.useEffect(()=>{if(!e||t===null)return;let w=!1;try{e.onChartReady(()=>{w||x(p.current)})}catch{}return()=>{w=!0}},[e,t,n,r,s,i,o,a,c,l,x])},Al=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},cp=(e,t)=>Qe(e.symbol).toUpperCase()===t,Y_=e=>ge.getState().positions.filter(t=>cp(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),Rl=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return gf(s.ticker,n)}catch{}return t},Q_=(e,t,n)=>{var i;const r=(i=e.getPoints()[0])==null?void 0:i.price;if(r!==void 0&&Math.abs(r-t)<Number.EPSILON){e.setProperties(n);return}const s=e.getPoints();s.length>0&&e.setPoints(s.map(o=>({...o,price:t}))),e.setProperties(n)},X_=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=ge(g=>g.positions),s=S.useRef(new Map),i=S.useRef(0),o=S.useMemo(()=>gf(t,n),[t,n]),a=S.useMemo(()=>r.filter(g=>cp(g,o)).map(g=>`${g.ticket}:${g.openPrice}:${g.type}:${g.digits}:${g.volumeLots}:${g.profit.toFixed(2)}`).sort().join("|"),[o,r]),c=S.useCallback(g=>{if(!e)return;const p=s.current.get(g);if(p){try{e.activeChart().removeEntity(p)}catch{}s.current.delete(g)}},[e]),l=S.useCallback(()=>{for(const g of[...s.current.keys()])c(g);s.current.clear()},[c]),d=S.useCallback(async(g,p,y)=>{const b=Pl({side:p.type,volumeLots:p.volumeLots,profit:p.profit}),x={time:g.getVisibleRange().from,price:p.openPrice},w=await g.createShape(x,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(y!==i.current){try{g.removeEntity(w)}catch{}return null}try{Al(g.getShapeById(w))}catch{}return w},[]),f=S.useCallback(async(g,p)=>{if(!e||p!==i.current)return;const y=e.activeChart(),b=Pl({side:g.type,volumeLots:g.volumeLots,profit:g.profit}),v=s.current.get(g.ticket);if(v)try{Q_(y.getShapeById(v),g.openPrice,b),Al(y.getShapeById(v));return}catch{s.current.delete(g.ticket)}if(p===i.current)try{const x=await d(y,g,p);if(!x)return;s.current.set(g.ticket,x)}catch{}},[e,d]),m=S.useCallback(async(g,p)=>{if(!e||g!==i.current)return;const y=Y_(p),b=new Set(y.map(v=>v.ticket));for(const v of s.current.keys())b.has(v)||c(v);for(const v of y){if(g!==i.current)return;await f(v,g)}},[e,c,f]),h=S.useCallback(g=>{if(!e)return;const p=i.current+1;i.current=p,g!=null&&g.resetLineIds&&l();const y=(g==null?void 0:g.symbolKey)??Rl(e,o,n);m(p,y)},[o,e,l,n,m]);S.useEffect(()=>{if(!e)return;let g=!1,p=null;const y=()=>{g||h({resetLineIds:!0,symbolKey:Rl(e,o,n)})};let b=!1;const v=()=>{b=!0,y()},x=()=>{g||!b||(b=!1,h({symbolKey:o}))};try{e.onChartReady(()=>{if(!g)try{p=e.activeChart(),h({resetLineIds:!0,symbolKey:o}),p.onSymbolChanged().subscribe(null,v),p.onDataLoaded().subscribe(null,x)}catch{}})}catch{}return()=>{if(g=!0,i.current+=1,p)try{p.onSymbolChanged().unsubscribe(null,v),p.onDataLoaded().unsubscribe(null,x)}catch{}l()}},[o,e,l,h,n]),S.useEffect(()=>{if(!e)return;let g=!1;try{e.onChartReady(()=>{g||h({symbolKey:o})})}catch{}return()=>{g=!0}},[o,e,a,h])},lp=({chartWidget:e,symbolTicker:t,symbols:n})=>(X_({chartWidget:e,symbolTicker:t,symbols:n}),Z_({chartWidget:e}),null),J_=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
87
82
|
<rect x="1" y="1" width="16" height="16" rx="5" fill="#3B82F6" fill-opacity="0.18" stroke="#3B82F6" stroke-width="1"/>
|
|
88
83
|
<circle cx="9" cy="6.5" r="2.5" fill="none" stroke="#3B82F6" stroke-width="1.5"/>
|
|
89
84
|
<path d="M4 14.5c0-2.8 2.2-5 5-5s5 2.2 5 5" fill="none" stroke="#3B82F6" stroke-width="1.5" stroke-linecap="round"/>
|
|
90
|
-
</svg>`,
|
|
85
|
+
</svg>`,up=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
91
86
|
<circle cx="9" cy="9" r="6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-opacity="0.25"/>
|
|
92
87
|
<path d="M9 2.5a6.5 6.5 0 0 1 6.5 6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
93
|
-
</svg>`,
|
|
88
|
+
</svg>`,ex=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
94
89
|
<path d="M4.5 9.25 7.5 12.25 13.5 6.25" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/>
|
|
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;
|
|
90
|
+
</svg>`,dp="data-opheleo-account-dropdown";function tx(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 fp(e){const[t]=e.label.split(" · ");return t??e.label}function nx(e){return`My Account — ${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function rx(e,t){const n=fp(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function Qa(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function pp(e){return e.isAccountsLoading||e.isAccountDataLoading}function hp(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=Qa(e);if(!t)return"My Account";const n=fp(t);return`My Account · ${t.login} · ${n}`}function sx(e){return pp(e)?up:J_}function ix(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:rx(n,r),icon:r?ex:void 0,onSelect:()=>{r||t(n.login)}}})}function ox(e,t){var s,i;const n=e.querySelector(`[${dp}="true"]`);if(n instanceof HTMLElement)return n;const r=e.querySelectorAll('button, [role="button"], div');for(const o of r){if(!(o instanceof HTMLElement))continue;const a=((s=o.textContent)==null?void 0:s.trim())??"";if(!a.includes("My Account")&&a!==t)continue;let c=o;for(;c&&c!==e;){const l=((i=c.textContent)==null?void 0:i.trim())??"";if(c.tagName==="BUTTON"||c.getAttribute("role")==="button"||l.includes("My Account")&&c.querySelector("svg"))return c;c=c.parentElement}}return null}function ax(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 cx(e,t){e.setAttribute(dp,"true"),tx(e);const n=Qa(t);if(!pp(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}ax(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function lx(e,t){if(!(e!=null&&e.isConnected))return;const n=hp(t),r=()=>{const s=ox(e,n);s&&cx(s,t)};r(),requestAnimationFrame(r)}async function ux(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:up,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function Nl(e,t,n,r){if(!e||(r==null?void 0:r.isConnected)===!1)return;const s=Qa(t);try{e.applyOptions({title:hp(t),tooltip:s?nx(s):"Select your trading account",icon:sx(t),items:ix(t,n)})}catch{return}lx(r??null,t)}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(){}},vn,Wt,Xn,yu,dx=(yu=class extends rs{constructor(){super();X(this,vn);X(this,Wt);X(this,Xn);V(this,Xn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){C(this,Wt)||this.setEventListener(C(this,Xn))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,Wt))==null||t.call(this),V(this,Wt,void 0))}setEventListener(t){var n;V(this,Xn,t),(n=C(this,Wt))==null||n.call(this),V(this,Wt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){C(this,vn)!==t&&(V(this,vn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof C(this,vn)=="boolean"?C(this,vn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},vn=new WeakMap,Wt=new WeakMap,Xn=new WeakMap,yu),Xa=new dx,fx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_t,wn,bu,px=(bu=class{constructor(){X(this,_t,fx);X(this,wn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&C(this,wn)&&e!==C(this,_t)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:C(this,_t),provider:e}),V(this,_t,e),process.env.NODE_ENV!=="production"&&V(this,wn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&V(this,wn,!0),C(this,_t).setTimeout(e,t)}clearTimeout(e){C(this,_t).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&V(this,wn,!0),C(this,_t).setInterval(e,t)}clearInterval(e){C(this,_t).clearInterval(e)}},_t=new WeakMap,wn=new WeakMap,bu),bn=new px;function hx(e){setTimeout(e,0)}var mx=typeof window>"u"||"Deno"in globalThis;function qe(){}function gx(e,t){return typeof e=="function"?e(t):e}function ko(e){return typeof e=="number"&&e>=0&&e!==1/0}function mp(e,t){return Math.max(e+(t||0)-Date.now(),0)}function en(e,t){return typeof e=="function"?e(t):e}function Je(e,t){return typeof e=="function"?e(t):e}function Dl(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Ja(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 Ll(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 Ja(e,t){return((t==null?void 0:t.queryKeyHashFn)||Br)(e)}function Br(e){return JSON.stringify(e,(t,n)=>Ro(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 yx=Object.prototype.hasOwnProperty;function Oo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=jl(e)&&jl(t);if(!r&&!(Ro(e)&&Ro(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:yx.call(e,f))&&l++;continue}if(m===null||h===null||typeof m!="object"||typeof h!="object"){c[f]=h;continue}const g=Oo(m,h,n+1);c[f]=g,g===m&&l++}return i===a&&l===i?e:c}function Ao(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 jl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ro(e){if(!Ml(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ml(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ml(e){return Object.prototype.toString.call(e)==="[object Object]"}function bx(e){return new Promise(t=>{bn.setTimeout(t,e)})}function No(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 Oo(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 Oo(e,t)}return t}function vx(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function wx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zs=Symbol();function gp(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 yp(e,t){return typeof e=="function"?e(...t):!!e}function _x(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=()=>mx;return{isServer(){return e()},setIsServer(t){e=t}}})();function Do(){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 xx=hx;function Sx(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=xx;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=Sx(),Jn,Gt,er,vu,Cx=(vu=class extends rs{constructor(){super();X(this,Jn,!0);X(this,Gt);X(this,er);V(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(){C(this,Gt)||this.setEventListener(C(this,er))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,Gt))==null||t.call(this),V(this,Gt,void 0))}setEventListener(t){var n;V(this,er,t),(n=C(this,Gt))==null||n.call(this),V(this,Gt,t(this.setOnline.bind(this)))}setOnline(t){C(this,Jn)!==t&&(V(this,Jn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return C(this,Jn)}},Jn=new WeakMap,Gt=new WeakMap,er=new WeakMap,vu),Ys=new Cx;function Ex(e){return Math.min(1e3*2**e,3e4)}function bp(e){return(e??"online")==="online"?Ys.isOnline():!0}var Lo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function vp(e){let t=!1,n=0,r;const s=Do(),i=()=>s.status!=="pending",o=p=>{var y;if(!i()){const b=new Lo(p);m(b),(y=e.onCancel)==null||y.call(e,b)}},a=()=>{t=!0},c=()=>{t=!1},l=()=>Xa.isFocused()&&(e.networkMode==="always"||Ys.isOnline())&&e.canRun(),d=()=>bp(e.networkMode)&&e.canRun(),f=p=>{i()||(r==null||r(),s.resolve(p))},m=p=>{i()||(r==null||r(),s.reject(p))},h=()=>new Promise(p=>{var y;r=b=>{(i()||l())&&p(b)},(y=e.onPause)==null||y.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),g=()=>{if(i())return;let p;const y=n===0?e.initialPromise:void 0;try{p=y??e.fn()}catch(b){p=Promise.reject(b)}Promise.resolve(p).then(f).catch(b=>{var k;if(i())return;const v=e.retry??(Vr.isServer()?0:3),x=e.retryDelay??Ex,w=typeof x=="function"?x(n,b):x,E=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!E){m(b);return}n++,(k=e.onFail)==null||k.call(e,n,b),bx(w).then(()=>l()?void 0:h()).then(()=>{t?m(b):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?g():h().then(g),s)}}var _n,wu,wp=(wu=class{constructor(){X(this,_n)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ko(this.gcTime)&&V(this,_n,bn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vr.isServer()?1/0:300*1e3))}clearGcTimeout(){C(this,_n)!==void 0&&(bn.clearTimeout(C(this,_n)),V(this,_n,void 0))}},_n=new WeakMap,wu);function Tx(e){return{onFetch:(t,n)=>{var d,f,m,h,g;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=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const l=async()=>{let p=!1;const y=x=>{_x(x,()=>t.signal,()=>p=!0)},b=gp(t.options,t.fetchOptions),v=async(x,w,E)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&x.pages.length)return Promise.resolve(x);const T=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:w,direction:E?"backward":"forward",meta:t.options.meta};return y(D),D})(),R=await b(T),{maxPages:A}=t.options,O=E?wx:vx;return{pages:O(x.pages,R,A),pageParams:O(x.pageParams,w,A)}};if(s&&i.length){const x=s==="backward",w=x?Px:Il,E={pages:i,pageParams:o},k=w(r,E);a=await v(E,k,x)}else{const x=e??i.length;do{const w=c===0?o[0]??r.initialPageParam:Il(r,a);if(c>0&&w==null)break;a=await v(a,w),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var p,y;return(y=(p=t.options).persister)==null?void 0:y.call(p,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=l}}}function Il(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 Px(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,xn,nr,st,Sn,Ie,Wr,Cn,Xe,_p,Rt,_u,kx=(_u=class extends wp{constructor(t){super();X(this,Xe);X(this,tr);X(this,xn);X(this,nr);X(this,st);X(this,Sn);X(this,Ie);X(this,Wr);X(this,Cn);V(this,Cn,!1),V(this,Wr,t.defaultOptions),this.setOptions(t.options),this.observers=[],V(this,Sn,t.client),V(this,st,C(this,Sn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,V(this,xn,Fl(this.options)),this.state=t.state??C(this,xn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,tr)}get promise(){var t;return(t=C(this,Ie))==null?void 0:t.promise}setOptions(t){if(this.options={...C(this,Wr),...t},t!=null&&t._type&&V(this,tr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Fl(this.options);n.data!==void 0&&(this.setState(Ul(n.data,n.dataUpdatedAt)),V(this,xn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,st).remove(this)}setData(t,n){const r=No(this.state.data,t,this.options);return pe(this,Xe,Rt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){pe(this,Xe,Rt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=C(this,Ie))==null?void 0:r.promise;return(s=C(this,Ie))==null||s.cancel(t),n?n.then(qe).catch(qe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,xn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Je(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:!mp(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,Ie))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,Ie))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),C(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||(C(this,Ie)&&(C(this,Cn)||pe(this,Xe,_p).call(this)?C(this,Ie).cancel({revert:!0}):C(this,Ie).cancelRetry()),this.scheduleGc()),C(this,st).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Xe,Rt).call(this,{type:"invalidate"})}async fetch(t,n){var l,d,f,m,h,g,p,y,b,v,x;if(this.state.fetchStatus!=="idle"&&((l=C(this,Ie))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(C(this,Ie))return C(this,Ie).continueRetry(),C(this,Ie).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(E=>E.options.queryFn);w&&this.setOptions(w.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=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(V(this,Cn,!0),r.signal)})},i=()=>{const w=gp(this.options,n),k=(()=>{const T={client:C(this,Sn),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return V(this,Cn,!1),this.options.persister?this.options.persister(w,k,this):w(k)},a=(()=>{const w={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:C(this,Sn),state:this.state,fetchFn:i};return s(w),w})(),c=C(this,tr)==="infinite"?Tx(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),V(this,nr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&pe(this,Xe,Rt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),V(this,Ie,vp({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof Lo&&w.revert&&this.setState({...C(this,nr),fetchStatus:"idle"}),r.abort()},onFail:(w,E)=>{pe(this,Xe,Rt).call(this,{type:"failed",failureCount:w,error:E})},onPause:()=>{pe(this,Xe,Rt).call(this,{type:"pause"})},onContinue:()=>{pe(this,Xe,Rt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await C(this,Ie).start();if(w===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(w),(h=(m=C(this,st).config).onSuccess)==null||h.call(m,w,this),(p=(g=C(this,st).config).onSettled)==null||p.call(g,w,this.state.error,this),w}catch(w){if(w instanceof Lo){if(w.silent)return C(this,Ie).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw pe(this,Xe,Rt).call(this,{type:"error",error:w}),(b=(y=C(this,st).config).onError)==null||b.call(y,w,this),(x=(v=C(this,st).config).onSettled)==null||x.call(v,this.state.data,w,this),w}finally{this.scheduleGc()}}},tr=new WeakMap,xn=new WeakMap,nr=new WeakMap,st=new WeakMap,Sn=new WeakMap,Ie=new WeakMap,Wr=new WeakMap,Cn=new WeakMap,Xe=new WeakSet,_p=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,...xp(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Ul(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return V(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()}),C(this,st).notify({query:this,type:"updated",action:t})})},_u);function xp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:bp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ul(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Fl(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 Ke,me,Gr,Ge,En,rr,Dt,Kt,Kr,sr,ir,Tn,Pn,qt,or,_e,jr,jo,Mo,Io,Uo,Fo,Bo,$o,Sp,xu,Ox=(xu=class extends rs{constructor(t,n){super();X(this,_e);X(this,Ke);X(this,me);X(this,Gr);X(this,Ge);X(this,En);X(this,rr);X(this,Dt);X(this,Kt);X(this,Kr);X(this,sr);X(this,ir);X(this,Tn);X(this,Pn);X(this,qt);X(this,or,new Set);this.options=n,V(this,Ke,t),V(this,Kt,null),V(this,Dt,Do()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,me).addObserver(this),Bl(C(this,me),this.options)?pe(this,_e,jr).call(this):this.updateResult(),pe(this,_e,Uo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vo(C(this,me),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vo(C(this,me),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,_e,Fo).call(this),pe(this,_e,Bo).call(this),C(this,me).removeObserver(this)}setOptions(t){const n=this.options,r=C(this,me);if(this.options=C(this,Ke).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Je(this.options.enabled,C(this,me))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,_e,$o).call(this),C(this,me).setOptions(this.options),n._defaulted&&!Ao(this.options,n)&&C(this,Ke).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,me),observer:this});const s=this.hasListeners();s&&$l(C(this,me),r,this.options,n)&&pe(this,_e,jr).call(this),this.updateResult(),s&&(C(this,me)!==r||Je(this.options.enabled,C(this,me))!==Je(n.enabled,C(this,me))||en(this.options.staleTime,C(this,me))!==en(n.staleTime,C(this,me)))&&pe(this,_e,jo).call(this);const i=pe(this,_e,Mo).call(this);s&&(C(this,me)!==r||Je(this.options.enabled,C(this,me))!==Je(n.enabled,C(this,me))||i!==C(this,qt))&&pe(this,_e,Io).call(this,i)}getOptimisticResult(t){const n=C(this,Ke).getQueryCache().build(C(this,Ke),t),r=this.createResult(n,t);return Rx(this,r)&&(V(this,Ge,r),V(this,rr,this.options),V(this,En,C(this,me).state)),r}getCurrentResult(){return C(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&&C(this,Dt).status==="pending"&&C(this,Dt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){C(this,or).add(t)}getCurrentQuery(){return C(this,me)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=C(this,Ke).defaultQueryOptions(t),r=C(this,Ke).getQueryCache().build(C(this,Ke),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,_e,jr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,Ge)))}createResult(t,n){var A;const r=C(this,me),s=this.options,i=C(this,Ge),o=C(this,En),a=C(this,rr),l=t!==r?t.state:C(this,Gr),{state:d}=t;let f={...d},m=!1,h;if(n._optimisticResults){const O=this.hasListeners(),D=!O&&Bl(t,n),L=O&&$l(t,r,n,s);(D||L)&&(f={...f,...xp(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:p,status:y}=f;h=f.data;let b=!1;if(n.placeholderData!==void 0&&h===void 0&&y==="pending"){let O;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(O=i.data,b=!0):O=typeof n.placeholderData=="function"?n.placeholderData((A=C(this,ir))==null?void 0:A.state.data,C(this,ir)):n.placeholderData,O!==void 0&&(y="success",h=No(i==null?void 0:i.data,O,n),m=!0)}if(n.select&&h!==void 0&&!b)if(i&&h===(o==null?void 0:o.data)&&n.select===C(this,Kr))h=C(this,sr);else try{V(this,Kr,n.select),h=n.select(h),h=No(i==null?void 0:i.data,h,n),V(this,sr,h),V(this,Kt,null)}catch(O){V(this,Kt,O)}C(this,Kt)&&(g=C(this,Kt),h=C(this,sr),p=Date.now(),y="error");const v=f.fetchStatus==="fetching",x=y==="pending",w=y==="error",E=x&&v,k=h!==void 0,R={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:w,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:f.dataUpdatedAt,error:g,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:w&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:w&&k,isStale:ec(t,n),refetch:this.refetch,promise:C(this,Dt),isEnabled:Je(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const O=R.data!==void 0,D=R.status==="error"&&!O,L=G=>{D?G.reject(R.error):O&&G.resolve(R.data)},j=()=>{const G=V(this,Dt,R.promise=Do());L(G)},U=C(this,Dt);switch(U.status){case"pending":t.queryHash===r.queryHash&&L(U);break;case"fulfilled":(D||R.data!==U.value)&&j();break;case"rejected":(!D||R.error!==U.reason)&&j();break}}return R}updateResult(){const t=C(this,Ge),n=this.createResult(C(this,me),this.options);if(V(this,En,C(this,me).state),V(this,rr,this.options),C(this,En).data!==void 0&&V(this,ir,C(this,me)),Ao(n,t))return;V(this,Ge,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!C(this,or).size)return!0;const o=new Set(i??C(this,or));return this.options.throwOnError&&o.add("error"),Object.keys(C(this,Ge)).some(a=>{const c=a;return C(this,Ge)[c]!==t[c]&&o.has(c)})};pe(this,_e,Sp).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,_e,Uo).call(this)}},Ke=new WeakMap,me=new WeakMap,Gr=new WeakMap,Ge=new WeakMap,En=new WeakMap,rr=new WeakMap,Dt=new WeakMap,Kt=new WeakMap,Kr=new WeakMap,sr=new WeakMap,ir=new WeakMap,Tn=new WeakMap,Pn=new WeakMap,qt=new WeakMap,or=new WeakMap,_e=new WeakSet,jr=function(t){pe(this,_e,$o).call(this);let n=C(this,me).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(qe)),n},jo=function(){pe(this,_e,Fo).call(this);const t=en(this.options.staleTime,C(this,me));if(Vr.isServer()||C(this,Ge).isStale||!ko(t))return;const r=mp(C(this,Ge).dataUpdatedAt,t)+1;V(this,Tn,bn.setTimeout(()=>{C(this,Ge).isStale||this.updateResult()},r))},Mo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,me)):this.options.refetchInterval)??!1},Io=function(t){pe(this,_e,Bo).call(this),V(this,qt,t),!(Vr.isServer()||Je(this.options.enabled,C(this,me))===!1||!ko(C(this,qt))||C(this,qt)===0)&&V(this,Pn,bn.setInterval(()=>{(this.options.refetchIntervalInBackground||Xa.isFocused())&&pe(this,_e,jr).call(this)},C(this,qt)))},Uo=function(){pe(this,_e,jo).call(this),pe(this,_e,Io).call(this,pe(this,_e,Mo).call(this))},Fo=function(){C(this,Tn)!==void 0&&(bn.clearTimeout(C(this,Tn)),V(this,Tn,void 0))},Bo=function(){C(this,Pn)!==void 0&&(bn.clearInterval(C(this,Pn)),V(this,Pn,void 0))},$o=function(){const t=C(this,Ke).getQueryCache().build(C(this,Ke),this.options);if(t===C(this,me))return;const n=C(this,me);V(this,me,t),V(this,Gr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Sp=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(C(this,Ge))}),C(this,Ke).getQueryCache().notify({query:C(this,me),type:"observerResultsUpdated"})})},xu);function Ax(e,t){return Je(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Je(t.retryOnMount,e)===!1)}function Bl(e,t){return Ax(e,t)||e.state.data!==void 0&&Vo(e,t,t.refetchOnMount)}function Vo(e,t,n){if(Je(t.enabled,e)!==!1&&en(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ec(e,t)}return!1}function $l(e,t,n,r){return(e!==t||Je(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ec(e,n)}function ec(e,t){return Je(t.enabled,e)!==!1&&e.isStaleByTime(en(t.staleTime,e))}function Rx(e,t){return!Ao(e.getCurrentResult(),t)}var qr,xt,He,kn,St,$t,Su,Nx=(Su=class extends wp{constructor(t){super();X(this,St);X(this,qr);X(this,xt);X(this,He);X(this,kn);V(this,qr,t.client),this.mutationId=t.mutationId,V(this,He,t.mutationCache),V(this,xt,[]),this.state=t.state||Dx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){C(this,xt).includes(t)||(C(this,xt).push(t),this.clearGcTimeout(),C(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){V(this,xt,C(this,xt).filter(n=>n!==t)),this.scheduleGc(),C(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){C(this,xt).length||(this.state.status==="pending"?this.scheduleGc():C(this,He).remove(this))}continue(){var t;return((t=C(this,kn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,l,d,f,m,h,g,p,y,b,v,x,w,E,k,T;const n=()=>{pe(this,St,$t).call(this,{type:"continue"})},r={client:C(this,qr),meta:this.options.meta,mutationKey:this.options.mutationKey};V(this,kn,vp({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,A)=>{pe(this,St,$t).call(this,{type:"failed",failureCount:R,error:A})},onPause:()=>{pe(this,St,$t).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,He).canRun(this)}));const s=this.state.status==="pending",i=!C(this,kn).canStart();try{if(s)n();else{pe(this,St,$t).call(this,{type:"pending",variables:t,isPaused:i}),C(this,He).config.onMutate&&await C(this,He).config.onMutate(t,this,r);const A=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));A!==this.state.context&&pe(this,St,$t).call(this,{type:"pending",context:A,variables:t,isPaused:i})}const R=await C(this,kn).start();return await((l=(c=C(this,He).config).onSuccess)==null?void 0:l.call(c,R,t,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,R,t,this.state.context,r)),await((h=(m=C(this,He).config).onSettled)==null?void 0:h.call(m,R,null,this.state.variables,this.state.context,this,r)),await((p=(g=this.options).onSettled)==null?void 0:p.call(g,R,null,t,this.state.context,r)),pe(this,St,$t).call(this,{type:"success",data:R}),R}catch(R){try{await((b=(y=C(this,He).config).onError)==null?void 0:b.call(y,R,t,this.state.context,this,r))}catch(A){Promise.reject(A)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,R,t,this.state.context,r))}catch(A){Promise.reject(A)}try{await((E=(w=C(this,He).config).onSettled)==null?void 0:E.call(w,void 0,R,this.state.variables,this.state.context,this,r))}catch(A){Promise.reject(A)}try{await((T=(k=this.options).onSettled)==null?void 0:T.call(k,void 0,R,t,this.state.context,r))}catch(A){Promise.reject(A)}throw pe(this,St,$t).call(this,{type:"error",error:R}),R}finally{C(this,He).runNext(this)}}},qr=new WeakMap,xt=new WeakMap,He=new WeakMap,kn=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(()=>{C(this,xt).forEach(r=>{r.onMutationUpdate(t)}),C(this,He).notify({mutation:this,type:"updated",action:t})})},Su);function Dx(){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,Cu,Lx=(Cu=class extends rs{constructor(t={}){super();X(this,Lt);X(this,ut);X(this,Zr);this.config=t,V(this,Lt,new Set),V(this,ut,new Map),V(this,Zr,0)}build(t,n,r){const s=new Nx({client:t,mutationCache:this,mutationId:++is(this,Zr)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){C(this,Lt).add(t);const n=vs(t);if(typeof n=="string"){const r=C(this,ut).get(n);r?r.push(t):C(this,ut).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(C(this,Lt).delete(t)){const n=vs(t);if(typeof n=="string"){const r=C(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&&C(this,ut).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=vs(t);if(typeof n=="string"){const r=C(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=vs(t);if(typeof n=="string"){const s=(r=C(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(()=>{C(this,Lt).forEach(t=>{this.notify({type:"removed",mutation:t})}),C(this,Lt).clear(),C(this,ut).clear()})}getAll(){return Array.from(C(this,Lt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ll(n,r))}findAll(t={}){return this.getAll().filter(n=>Ll(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(qe))))}},Lt=new WeakMap,ut=new WeakMap,Zr=new WeakMap,Cu);function vs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ct,Eu,jx=(Eu=class extends rs{constructor(t={}){super();X(this,Ct);this.config=t,V(this,Ct,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Ja(s,n);let o=this.get(i);return o||(o=new kx({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){C(this,Ct).has(t.queryHash)||(C(this,Ct).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=C(this,Ct).get(t.queryHash);n&&(t.destroy(),n===t&&C(this,Ct).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return C(this,Ct).get(t)}getAll(){return[...C(this,Ct).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Dl(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Dl(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,Eu),Re,Zt,Yt,ar,cr,Qt,lr,ur,Tu,Mx=(Tu=class{constructor(e={}){X(this,Re);X(this,Zt);X(this,Yt);X(this,ar);X(this,cr);X(this,Qt);X(this,lr);X(this,ur);V(this,Re,e.queryCache||new jx),V(this,Zt,e.mutationCache||new Lx),V(this,Yt,e.defaultOptions||{}),V(this,ar,new Map),V(this,cr,new Map),V(this,Qt,0)}mount(){is(this,Qt)._++,C(this,Qt)===1&&(V(this,lr,Xa.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Re).onFocus())})),V(this,ur,Ys.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Re).onOnline())})))}unmount(){var e,t;is(this,Qt)._--,C(this,Qt)===0&&((e=C(this,lr))==null||e.call(this),V(this,lr,void 0),(t=C(this,ur))==null||t.call(this),V(this,ur,void 0))}isFetching(e){return C(this,Re).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,Zt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,Re).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=C(this,Re).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 C(this,Re).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=C(this,Re).get(r.queryHash),i=s==null?void 0:s.state.data,o=gx(t,i);if(o!==void 0)return C(this,Re).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>C(this,Re).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,Re).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=C(this,Re);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=C(this,Re);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(()=>C(this,Re).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(qe).catch(qe)}invalidateQueries(e,t={}){return Fe.batch(()=>(C(this,Re).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(()=>C(this,Re).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(qe)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(qe)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=C(this,Re).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(qe).catch(qe)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(qe).catch(qe)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Ys.isOnline()?C(this,Zt).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,Re)}getMutationCache(){return C(this,Zt)}getDefaultOptions(){return C(this,Yt)}setDefaultOptions(e){V(this,Yt,e)}setQueryDefaults(e,t){C(this,ar).set(Br(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...C(this,ar).values()],n={};return t.forEach(r=>{$r(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){C(this,cr).set(Br(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...C(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={...C(this,Yt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ja(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:{...C(this,Yt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,Re).clear(),C(this,Zt).clear()}},Re=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,ar=new WeakMap,cr=new WeakMap,Qt=new WeakMap,lr=new WeakMap,ur=new WeakMap,Tu),Cp=_.createContext(void 0),Ep=e=>{const t=_.useContext(Cp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ix=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Cp.Provider,{value:e,children:t})),Tp=_.createContext(!1),Ux=()=>_.useContext(Tp);Tp.Provider;function Fx(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Bx=_.createContext(Fx()),$x=()=>_.useContext(Bx),Vx=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?yp(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Hx=e=>{_.useEffect(()=>{e.clearReset()},[e])},zx=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||yp(n,[e.error,r])),Wx=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))}},Gx=(e,t)=>e.isLoading&&e.isFetching&&!t,Kx=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Vl=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qx(e,t,n){var h,g,p,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Ux(),s=$x(),i=Ep(),o=i.defaultQueryOptions(e);(g=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||g.call(h,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":c?"optimistic":void 0,Wx(o),Vx(o,s,a),Hx(s);const l=!i.getQueryCache().get(o.queryHash),[d]=_.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),m=!r&&c;if(_.useSyncExternalStore(_.useCallback(b=>{const v=m?d.subscribe(Fe.batchCalls(b)):qe;return d.updateResult(),v},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),_.useEffect(()=>{d.setOptions(o)},[o,d]),Kx(o,f))throw Vl(o,d,s);if(zx({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||y.call(p,o,f),o.experimental_prefetchInRender&&!Vr.isServer()&&Gx(f,r)){const b=l?Vl(o,d,s):a==null?void 0:a.promise;b==null||b.catch(qe).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Ti(e,t){return qx(e,Ox)}const Zx="widget-accounts",Pp="widget-positions",kp="widget-orders",Yx=2e4;function no(e){const t=String(e.getUTCDate()).padStart(2,"0"),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0"),i=String(e.getUTCSeconds()).padStart(2,"0");return`${n}.${t} ${r}:${s}:${i}`}function Qx(e){const t=["seconds","Seconds","timestamp","Timestamp","value","Value","time","Time"];for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function tc(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return no(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 no(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?no(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=Qx(e);if(n!==void 0)return tc(n)}return"—"}const Op=["time","Time","openTime","open_time","OpenTime","TimeOpen","timeOpen","timeCreate","TimeCreate","timeSetup","TimeSetup","setupTime","setup_time","createdAt","created_at","createTime","CreateTime","timestamp","Timestamp","openDate","OpenDate","date","Date"],Xx={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 Pi(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=Pi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function ws(e,t){const n=Pi(e,t);if(n!==void 0)return String(n)}function Jx(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","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 Ho(e){return e===void 0?.01:e>=100?e/1e4:e}function eS(e,t){return ff(t,e)}function tS(e){const t=Pi(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:Xx[n]??(n%2===1?"sell":"buy"),side:Ws(n),typeNum:n}}function nS(e,t){const n=wt(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return Ho(n);const r=wt(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?Ho(r):0}function rS(e,t){const n=ws(e,["ticket","Ticket","order","Order","id","ID"]),r=ws(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Qe(r),{label:i,side:o,typeNum:a}=tS(e),c=wt(e,["typeTime","TypeTime"])??0,l=Ho(wt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),d=nS(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,g=wt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),p=wt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),y=ws(e,["comment","Comment"])??"",b=eS(e,s),v=tc(Pi(e,Op));return{ticket:n,login:ws(e,["login","Login"])??t,symbol:s,displaySymbol:gi(s),time:v,typeLabel:i,orderType:a,typeTime:c,side:o,volumeLots:l,volumeFilledLots:d,orderPrice:f,priceTrigger:m,stopLoss:g,takeProfit:p,currentPrice:h,comment:y,digits:b}}function sS(e,t){return Jx(e).map(n=>rS(n,t)).filter(n=>n!==null)}function ki(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Vt(e,t){const n=ki(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function _s(e,t){const n=ki(e,t);if(n!==void 0)return String(n)}function iS(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 oS(e){return e===void 0?.01:e>=100?e/1e4:e}function aS(e){const t=ki(e,["type","Type","action","Action","side","Side"]);if(typeof t=="string"){const r=t.toLowerCase();if(r.includes("sell"))return"sell";if(r.includes("buy"))return"buy"}const n=Vt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function cS(e,t){return ff(t,e)}function lS(e,t){const n=_s(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=_s(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Qe(r),i=aS(e),o=oS(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=_s(e,["comment","Comment"])??"",g=cS(e,s),p=tc(ki(e,Op));return{ticket:n,login:_s(e,["login","Login"])??t,symbol:s,displaySymbol:gi(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:g}}function uS(e,t){return iS(e).map(n=>lS(n,t)).filter(n=>n!==null)}function ss(){return Jf()}function Ap(){const e=hn(),{data:t,isLoading:n,isError:r}=Ti({queryKey:[Zx,e.baseUrl],queryFn:()=>e.getAccounts()});return{accounts:t??[],isLoading:n,isError:r}}function dS(e){const t=hn();return Ti({queryKey:[Pp,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:Yx})}function fS(e){const t=hn();return Ti({queryKey:[kp,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function pS(){const e=Ep(),t=hn();return S.useCallback((n,r)=>{e.invalidateQueries({queryKey:[Pp,t.baseUrl,n]}),(r===void 0||Ia(r))&&e.invalidateQueries({queryKey:[kp,t.baseUrl,n]})},[t.baseUrl,e])}function Oi(){const e=hn(),t=pS();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n){const r=await e.trading.closePosition(n);return r.success&&t(n.login),r},async deleteOrder(n){const r=await e.trading.deleteOrder(n);return r.success&&t(n.login,n.orderType),r},async modifyOrder(n,r){const s=await e.trading.modifyOrder(n,r);return s.success&&t(n.login,n.orderType),s}}}function hS(e,t){return e!=null?uS(e,t):[]}function mS(e,t){return e!=null?sS(e,t):[]}function nc(e){const t=ge(l=>l.setPositions),n=ge(l=>l.setOrders),{data:r,isLoading:s,isError:i}=dS(e),{data:o,isLoading:a,isError:c}=fS(e);return S.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(hS(r,e)),o!=null&&n(mS(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||c)}}function gS({symbolTicker:e,controlsRef:t,chartWidget:n,chartContainer:r,scanResultUrl:s,orderState:i}){const{openMarketPanel:o,setSelectedLogin:a,accountOptions:c,selectedLogin:l,isAccountsLoading:d}=i,{isLoading:f}=nc(l),m=ss(),[h,g]=S.useState(l),p=S.useRef(null),y=S.useCallback(v=>{v!==l&&a(v)},[l,a]),b=f&&l!==h;return S.useEffect(()=>{!f&&l!==h&&g(l)},[f,h,l]),S.useEffect(()=>(t.current={open:o,setSelectedLogin:a},()=>{t.current=null}),[t,o,a]),S.useEffect(()=>{if(!n)return;let v=!1;return(async()=>{try{const w=await ux(n,()=>!v);if(v){w==null||w.remove();return}p.current=w,Nl(p.current,{accountOptions:c,selectedLogin:l,isAccountsLoading:d,isAccountDataLoading:b},y,r)}catch{}})(),()=>{var w;v=!0,(w=p.current)==null||w.remove(),p.current=null}},[r,n]),S.useEffect(()=>{Nl(p.current,{accountOptions:c,selectedLogin:l,isAccountsLoading:d,isAccountDataLoading:b},y,r)},[c,r,y,d,b,l]),u.jsxs(u.Fragment,{children:[u.jsx(lp,{chartWidget:n,symbolTicker:e,symbols:m}),u.jsx(np,{}),u.jsx(I_,{symbolTicker:e,scanResultUrl:s,orderState:i})]})}const Hl=224,zl=32,rc=120;function Rp(){return typeof window>"u"?560:Math.max(rc,Math.floor(window.innerHeight*.7))}function yS(e){return Math.min(Rp(),Math.max(rc,e))}function bS(){const[e,t]=S.useState(Hl),[n,r]=S.useState(!1),s=S.useRef(Hl);S.useEffect(()=>{s.current=e},[e]);const i=S.useCallback(d=>{t(yS(d))},[]),o=S.useCallback(()=>{i(s.current+zl)},[i]),a=S.useCallback(()=>{i(s.current-zl)},[i]),c=S.useCallback(d=>{const f=d,m=s.current;r(!0);const h=p=>{const y=f-p.clientY;i(m+y)},g=()=>{r(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",g),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",g),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[i]);S.useEffect(()=>{const 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>rc,onResizeStart:c,incrementHeight:o,decrementHeight:a}}const vS=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),wS=2e4;let ro=0;function _S(){return ro=(ro+1)%Number.MAX_VALUE,ro.toString()}const so=new Map,Wl=(e,t)=>{if(so.has(e))return;const n=setTimeout(()=>{so.delete(e),Ns({type:"REMOVE_TOAST",toastId:e})},t||wS);so.set(e,n)},xS=(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);Wl(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{Wl(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)}}},SS=[];let io={toasts:[]};function Ns(e){io=xS(io,e),SS.forEach(t=>{t(io)})}function xe({duration:e=2e4,description:t,...n}){const r=_S(),s=typeof t=="string"?vS(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 CS(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function ES(){const{closePosition:e,deleteOrder:t}=Oi(),n=ge(p=>p.removePosition),r=ge(p=>p.removeOrder),s=ge(p=>p.setSelectedPositionTicket),i=ge(p=>p.setSelectedOrderTicket),[o,a]=S.useState(new Set),[c,l]=S.useState(!1),d=S.useCallback((p,y)=>{a(b=>{const v=new Set(b);return y?v.add(p):v.delete(p),v})},[]),f=S.useCallback(p=>o.has(p),[o]),m=S.useCallback(async p=>{const y=`position-${p.ticket}`;d(y,!0);try{const b=await e(p);if(!b.success){xe({variant:"destructive",description:b.message||"Failed to close position."});return}n(p.ticket),s(null),xe({description:`Position #${p.ticket} closed at ${CS(p).toFixed(p.digits)}.`})}catch(b){const v=b instanceof Error?b.message:"Failed to close position.";xe({variant:"destructive",description:v})}finally{d(y,!1)}},[e,n,d,s]),h=S.useCallback(async p=>{if(p.length===0||c)return;if(!e){xe({variant:"destructive",description:"Close position is not configured."});return}l(!0);let y=0,b=0;for(const v of p){const x=`position-${v.ticket}`;d(x,!0);try{if(!(await e(v)).success){b+=1;continue}n(v.ticket),y+=1}catch{b+=1}finally{d(x,!1)}}s(null),xe(b===0?{description:y===1?"1 position closed.":`${y} positions closed.`}:y===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${y}, failed ${b}.`}),l(!1)},[c,e,n,d,s]),g=S.useCallback(async p=>{const y=`order-${p.ticket}`;d(y,!0);try{const b=await t(p);if(!b.success){xe({variant:"destructive",description:b.message||"Failed to delete order."});return}r(p.ticket),i(null),xe({description:`Order #${p.ticket} deleted.`})}catch(b){const v=b instanceof Error?b.message:"Failed to delete order.";xe({variant:"destructive",description:v})}finally{d(y,!1)}},[t,r,d,i]);return{closePosition:m,closeAllPositions:h,deleteOrder:g,isClosingAll:c,isRowBusy:f}}function Ht(e,t=2){return e.toFixed(t)}function Np(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function TS(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 zo(){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 PS(){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 kS({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s,totalPnL:i,scrollRef:o,onScroll:a}){const c=i>0?"web-trading-widget-text-profit-positive":i<0?"web-trading-widget-text-profit-negative":"";return u.jsx("div",{className:"web-trading-widget-terminal__stats",children:u.jsx("div",{ref:o,className:"web-trading-widget-terminal__header-scroll",onScroll:a,children:u.jsxs("table",{className:"web-trading-widget-terminal__table",children:[u.jsx(zo,{}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsx("td",{colSpan:10,className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:u.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[u.jsxs("span",{children:["Balance: ",Ht(e)]}),u.jsxs("span",{children:["Equity: ",Ht(t)]}),u.jsxs("span",{children:["Margin: ",Ht(n)]}),u.jsxs("span",{children:["Free margin: ",Ht(r)]}),u.jsxs("span",{children:["Level: ",s!==void 0?`${Ht(s,2)}%`:"0.00%"]})]})}),u.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${c}`,children:Ht(i)}),u.jsx("td",{className:"web-trading-widget-terminal__cell"}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}function OS({positionCount:e,isClosingAll:t,onCloseAllPositions:n}){const r=e>0;return u.jsx("div",{className:"web-trading-widget-terminal__toolbar",children:u.jsx("div",{className:"web-trading-widget-terminal__toolbar-actions",children:r?u.jsx("button",{type:"button",disabled:t,onClick:n,className:"web-trading-widget-terminal__close-all-btn",children:t?"Closing…":"Close all"}):null})})}function AS({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:Pe(e.openPrice,e.digits)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0?Pe(e.stopLoss,e.digits):""}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0?Pe(e.takeProfit,e.digits):""}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Pe(e.currentPrice,e.digits)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Ht(e.swap):""}),u.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:Ht(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(dn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function RS({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:Pe(e.orderPrice,e.digits)}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0?Pe(e.stopLoss,e.digits):""}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0?Pe(e.takeProfit,e.digits):""}),u.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Pe(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(dn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function Dp({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r}){const s=ss(),{accounts:i,isLoading:o}=Ap(),a=bS(),{height:c,isResizing:l,onResizeStart:d}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:a,f=ge($=>$.selectedLogin),m=ge($=>$.selectedPositionTicket),h=ge($=>$.selectedOrderTicket),g=ge($=>$.setSelectedPositionTicket),p=ge($=>$.setSelectedOrderTicket),{isLoading:y}=nc(f),b=ge($=>$.positions),v=ge($=>$.orders),{closePosition:x,closeAllPositions:w,deleteOrder:E,isClosingAll:k,isRowBusy:T}=ES(),R=o||y,A=S.useMemo(()=>f?b.filter($=>$.login===f):b,[b,f]),O=S.useMemo(()=>f?v.filter($=>$.login===f):v,[v,f]),D=S.useMemo(()=>{const $=i.find(q=>q.login===f);return($==null?void 0:$.tradeStat)??null},[i,f]),L=S.useMemo(()=>A.map($=>$.ticket).sort().join("|"),[A]),j=S.useMemo(()=>D?`${D.balance}:${D.credit??0}:${D.equity}:${D.margin}|${L}`:"",[D,L]),U=S.useMemo(()=>{if(!D||A.length===0)return 0;const $=Np(A);return D.equity-D.balance-(D.credit??0)-$},[j]),G=S.useMemo(()=>TS(D,A,U),[D,A,U]),H=A.length===0&&O.length===0,B=S.useRef(null),N=S.useRef(null),I=S.useRef(null),K=S.useCallback(()=>{w(A)},[w,A]),M=S.useCallback($=>{const q=Wb($,s);q&&(n==null||n(q))},[n,s]),le=S.useCallback($=>{g($.ticket),M($.symbol)},[g,M]),oe=S.useCallback($=>{p($.ticket),M($.symbol)},[p,M]),ae=S.useCallback($=>{const q=B.current,Z=N.current,ce=I.current;if(!q||!Z)return;const fe=$==="header"?q.scrollLeft:$==="body"?Z.scrollLeft:(ce==null?void 0:ce.scrollLeft)??0;$!=="header"&&(q.scrollLeft=fe),$!=="body"&&(Z.scrollLeft=fe),ce&&$!=="footer"&&(ce.scrollLeft=fe)},[]);return u.jsxs(u.Fragment,{children:[!e&&l?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:c},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":c,className:"web-trading-widget-terminal__resize-bar",onMouseDown:$=>{$.preventDefault(),d($.clientY)},children:u.jsx(lf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),u.jsx(OS,{positionCount:A.length,isClosingAll:k,onCloseAllPositions:K}),u.jsx("div",{ref:B,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>ae("header"),children:u.jsxs("table",{className:"web-trading-widget-terminal__table",children:[u.jsx(zo,{}),u.jsx(PS,{})]})}),u.jsx("div",{ref:N,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>ae("body"),children:u.jsxs("table",{className:"web-trading-widget-terminal__table",children:[u.jsx(zo,{}),u.jsxs("tbody",{children:[R&&H?u.jsx("tr",{children:u.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!R&&H?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"}),r?u.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,A.map($=>u.jsx(AS,{position:$,isSelected:m===$.ticket,isClosing:T(`position-${$.ticket}`),onSelect:()=>le($),onClose:()=>void x($)},`position-${$.ticket}`)),O.map($=>u.jsx(RS,{order:$,isSelected:h===$.ticket,isDeleting:T(`order-${$.ticket}`),onSelect:()=>oe($),onDelete:()=>void E($)},`order-${$.ticket}`))]})]})}),u.jsx(kS,{balance:G.balance,equity:G.equity,margin:G.margin,marginFree:G.marginFree,marginLevel:G.marginLevel,totalPnL:G.totalProfit,scrollRef:I,onScroll:()=>ae("footer")})]})]})}const Wo=224,Qs=120;function NS(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)):Wo}function DS(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 LS(e,t){return Math.min(DS(t),Math.max(Qs,e))}function jS({containerRef:e,isOpen:t=!1}={}){const[n,r]=S.useState(Wo),[s,i]=S.useState(!1),o=S.useRef(Wo);S.useEffect(()=>{o.current=n},[n]);const a=S.useCallback(l=>{r(LS(l,e))},[e]);S.useEffect(()=>{if(!t)return;const l=Math.max(o.current,NS(e));a(l)},[e,t,a]);const c=S.useCallback(l=>{const d=l,f=o.current;i(!0);const m=g=>{const p=d-g.clientY;a(f+p)},h=()=>{i(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return S.useEffect(()=>{const 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]=S.useState(()=>new Mx({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return u.jsx(Ix,{client:t,children:e})}function jp({containerRef:e,onCreateNewOrder:t}){const[n,r]=S.useState(!1),{height:s,isResizing:i,onResizeStart:o}=jS({containerRef:e,isOpen:n}),a=ge(g=>g.selectedLogin),c=ge(g=>g.orders),l=ge(g=>g.positions),d=S.useMemo(()=>a?c.filter(g=>g.login===a):c,[a,c]),f=S.useMemo(()=>a?l.filter(g=>g.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(Rb,{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:g=>{g.preventDefault(),o(g.clientY)},children:u.jsx(lf,{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(dn,{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 MS({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 An=S.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}));An.displayName="Input";var Ai="Collapsible",[IS,Mp]=xr(Ai),[US,sc]=IS(Ai),Ip=_.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:Ai});return u.jsx(US,{scope:n,disabled:i,contentId:Jt(),open:c,onOpenToggle:_.useCallback(()=>l(d=>!d),[l]),children:u.jsx(we.div,{"data-state":oc(c),"data-disabled":i?"":void 0,...a,ref:t})})});Ip.displayName=Ai;var Up="CollapsibleTrigger",Fp=_.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=sc(Up,n);return u.jsx(we.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":oc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:Se(e.onClick,s.onOpenToggle)})});Fp.displayName=Up;var ic="CollapsibleContent",Bp=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=sc(ic,e.__scopeCollapsible);return u.jsx(Sr,{present:n||s.open,children:({present:i})=>u.jsx(FS,{...r,ref:t,present:i})})});Bp.displayName=ic;var FS=_.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=sc(ic,n),[a,c]=_.useState(r),l=_.useRef(null),d=Oe(t,l),f=_.useRef(0),m=f.current,h=_.useRef(0),g=h.current,p=o.open||a,y=_.useRef(p),b=_.useRef(void 0);return _.useEffect(()=>{const v=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(v)},[]),Ue(()=>{const v=l.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const x=v.getBoundingClientRect();f.current=x.height,h.current=x.width,y.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[o.open,r]),u.jsx(we.div,{"data-state":oc(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":g?`${g}px`:void 0,...e.style},children:p&&s})});function oc(e){return e?"open":"closed"}var BS=Ip,$S=Fp,VS=Bp,yt="Accordion",HS=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ac,zS,WS]=ld(yt),[Ri]=xr(yt,[WS,Mp]),cc=Mp(),$p=_.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return u.jsx(ac.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?u.jsx(ZS,{...i,ref:t}):u.jsx(qS,{...s,ref:t})})});$p.displayName=yt;var[Vp,GS]=Ri(yt),[Hp,KS]=Ri(yt,{collapsible:!1}),qS=_.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:_.useMemo(()=>a?[a]:[],[a]),onItemOpen:c,onItemClose:_.useCallback(()=>i&&c(""),[i,c]),children:u.jsx(Hp,{scope:e.__scopeAccordion,collapsible:i,children:u.jsx(zp,{...o,ref:t})})})}),ZS=_.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=fr({prop:n,defaultProp:r??[],onChange:s,caller:yt}),c=_.useCallback(d=>a((f=[])=>[...f,d]),[a]),l=_.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})})})}),[YS,Ni]=Ri(yt),zp=_.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=_.useRef(null),c=Oe(a,t),l=zS(n),f=ud(s)==="ltr",m=Se(e.onKeyDown,h=>{var R;if(!HS.includes(h.key))return;const g=h.target,p=l().filter(A=>{var O;return!((O=A.ref.current)!=null&&O.disabled)}),y=p.findIndex(A=>A.ref.current===g),b=p.length;if(y===-1)return;h.preventDefault();let v=y;const x=0,w=b-1,E=()=>{v=y+1,v>w&&(v=x)},k=()=>{v=y-1,v<x&&(v=w)};switch(h.key){case"Home":v=x;break;case"End":v=w;break;case"ArrowRight":i==="horizontal"&&(f?E():k());break;case"ArrowDown":i==="vertical"&&E();break;case"ArrowLeft":i==="horizontal"&&(f?k():E());break;case"ArrowUp":i==="vertical"&&k();break}const T=v%b;(R=p[T].ref.current)==null||R.focus()});return u.jsx(YS,{scope:n,disabled:r,direction:s,orientation:i,children:u.jsx(ac.Slot,{scope:n,children:u.jsx(we.div,{...o,"data-orientation":i,ref:c,onKeyDown:r?void 0:m})})})}),Xs="AccordionItem",[QS,lc]=Ri(Xs),Wp=_.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Ni(Xs,n),o=GS(Xs,n),a=cc(n),c=Jt(),l=r&&o.value.includes(r)||!1,d=i.disabled||e.disabled;return u.jsx(QS,{scope:n,open:l,disabled:d,triggerId:c,children:u.jsx(BS,{"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",Kp=_.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ni(yt,n),i=lc(Gp,n);return u.jsx(we.h3,{"data-orientation":s.orientation,"data-state":Qp(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Kp.displayName=Gp;var Go="AccordionTrigger",qp=_.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ni(yt,n),i=lc(Go,n),o=KS(Go,n),a=cc(n);return u.jsx(ac.ItemSlot,{scope:n,children:u.jsx($S,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});qp.displayName=Go;var Zp="AccordionContent",Yp=_.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ni(yt,n),i=lc(Zp,n),o=cc(n);return u.jsx(VS,{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 XS=$p,JS=Wp,e0=Kp,Xp=qp,Jp=Yp;const t0=XS,Gn=_.forwardRef(({className:e,...t},n)=>u.jsx(JS,{ref:n,className:De("border-b",e),...t}));Gn.displayName="AccordionItem";const Kn=_.forwardRef(({className:e,children:t,...n},r)=>u.jsx(e0,{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(Da,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Kn.displayName=Xp.displayName;const qn=_.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})}));qn.displayName=Jp.displayName;function Gl(e){const t=e.trim().replace(/,/g,"");if(!t)return null;const n=Number(t);return Number.isFinite(n)?n:null}function Kl(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=g=>{if(c)return;const p=Gl(t),y=a!=null&&Number.isFinite(a)?a:s??0,v=(p??y)+g*r,x=s!==void 0?Math.max(s,v):v;x<=0||n(Kl(x,i))},m=()=>{const g=Gl(t);if(g===null||g<=0){t.trim()!==""&&n("");return}n(Kl(g,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(dn,{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(Db,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),u.jsx("input",{type:"text",inputMode:"decimal",value:t,placeholder:o,disabled:c,onChange:g=>n(g.target.value),onBlur:m,className:"web-trading-widget-stepper__input"}),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(Lb,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function n0({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,g]=S.useState("market"),[p,y]=S.useState(String(r)),[b,v]=S.useState(""),[x,w]=S.useState(""),E=ue(ee=>ee.stopLoss),k=ue(ee=>ee.takeProfit),T=ue(ee=>ee.setStopLoss),R=ue(ee=>ee.setTakeProfit),A=ue(ee=>ee.setVolumeLots),O=ue(ee=>ee.setOrderSide),[D,L]=S.useState(""),[j,U]=S.useState(dt.GTC),[G,H]=S.useState(""),[B,N]=S.useState(""),I=Number(fn(pn(e))),K=Tr(I),M=yf(t,n),le=t!==null?Pe(t,I):"—",oe=n!==null?Pe(n,I):"—",ae=bi(h),$=hf(h),q=yi(h),Z=q.label,ce=!ae&&q.orderType!==null&&q.orderType%2===1,fe=S.useMemo(()=>M!==null?M:t??n,[n,t,M]),ye=ee=>{y(ee);const $e=Number(ee);Number.isFinite($e)&&$e>0&&A($e)},ie=ee=>t===null||n===null?null:ae?ee==="buy"?n:t:ft(b)??(ee==="buy"?n:t),ne=ee=>{const $e=ie(ee);$e!==null&&O({side:ee,entryPrice:$e})},je=ee=>{if(t===null||n===null||!c)return;const $e=Math.max(i,Number(p)||i),Di=pf(h,ee),Bn=ie(ee);Bn!==null&&O({side:ee,entryPrice:Bn}),m({login:c,executionMode:h,side:ee,orderType:Di,volumeLots:$e,stopLoss:E,takeProfit:k,priceOrder:b,priceTrigger:x,comment:D,typeTime:j,expirationDateTime:G,expirationDay:B,bid:t,ask:n})},ke=t!==null&&n!==null,Ee=ae||ft(b)!==void 0,J=!$||ft(x)!==void 0,Te=ae||wi(j,G,B),Me=!o&&!a&&c!==""&&ke&&Ee&&J&&Te,We=!ae&&Fa(j),at=!ae&&Ba(j);return u.jsxs("div",{className:"web-trading-widget-market-panel",children:[u.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[u.jsxs(_o,{value:h,onValueChange:ee=>g(ee),children:[u.jsx($s,{className:"web-trading-widget-market-panel__select-trigger",children:u.jsx(xo,{})}),u.jsx(Vs,{children:zs.map(ee=>u.jsx(Hs,{value:ee.mode,children:ee.label},ee.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(df,{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(dn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),u.jsxs(t0,{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(Kn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),u.jsx(qn,{className:"web-trading-widget-market-panel__accordion-content",children:u.jsx(Ne,{label:"Lots",value:p,onChange:ye,step:s,min:i,decimals:2})})]}),ae?null:u.jsxs(Gn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),u.jsx(qn,{className:"web-trading-widget-market-panel__accordion-content",children:$?u.jsxs(u.Fragment,{children:[u.jsx(Ne,{label:"Stop Price",value:x,onChange:w,step:K,decimals:I,basePrice:fe,placeholder:M!==null?Pe(M,I):"—"}),u.jsx(Ne,{label:"Limit Price",value:b,onChange:v,step:K,decimals:I,basePrice:fe,placeholder:M!==null?Pe(M,I):"—"})]}):u.jsx(Ne,{label:"Price",value:b,onChange:v,step:K,decimals:I,basePrice:fe,placeholder:M!==null?Pe(M,I):"—"})})]}),u.jsxs(Gn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),u.jsx(qn,{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:T,step:K,decimals:I,basePrice:t,placeholder:t!==null?le:"—",clearable:!0}),u.jsx(Ne,{label:"Take Profit",value:k,onChange:R,step:K,decimals:I,basePrice:n,placeholder:n!==null?oe:"—",clearable:!0})]})})]}),ae?null:u.jsxs(Gn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),u.jsxs(qn,{className:"web-trading-widget-market-panel__accordion-content",children:[u.jsxs(_o,{value:String(j),onValueChange:ee=>U(Number(ee)),children:[u.jsx($s,{className:"web-trading-widget-market-panel__select-full",children:u.jsx(xo,{})}),u.jsx(Vs,{children:mf.map(ee=>u.jsx(Hs,{value:String(ee.value),children:ee.label},ee.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(An,{type:"datetime-local",value:G,onChange:ee=>H(ee.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(An,{type:"date",value:B,onChange:ee=>N(ee.target.value)})]}):null]})]}),u.jsxs(Gn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[u.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),u.jsx(qn,{className:"web-trading-widget-market-panel__accordion-content",children:u.jsx(An,{value:D,onChange:ee=>L(ee.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:le}),u.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:oe})]}),ae?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:()=>ne("sell"),onClick:()=>je("sell"),children:"Sell by Market"}),u.jsx(Pt,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Me,onMouseDown:()=>ne("buy"),onClick:()=>je("buy"),children:"Buy by Market"})]}):u.jsxs(Pt,{type:"button",variant:ce?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${ce?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Me,onMouseDown:()=>{const ee=q.orderType!==null&&q.orderType%2===1?"sell":"buy";ne(ee)},onClick:()=>{const ee=q.orderType!==null&&q.orderType%2===1?"sell":"buy";je(ee)},children:["Place ",Z]})]})]})}function eh({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(fn(pn(t))),s=Pe(e.price,r),i=e.side==="sell"?"sell":"buy",o=gi(e.symbol||vi(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(dn,{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 xs(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function oo(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}=Oi(),s=ge(B=>B.removeOrder),[i,o]=S.useState(String(e.volumeLots)),[a,c]=S.useState(String(e.orderPrice)),[l,d]=S.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),f=ue(B=>B.stopLoss),m=ue(B=>B.takeProfit),h=ue(B=>B.setStopLoss),g=ue(B=>B.setTakeProfit),p=ue(B=>B.setDraft),y=ue(B=>B.clearDraft),[b,v]=S.useState(e.comment),[x,w]=S.useState(!1),[E,k]=S.useState(!1),T=Tr(e.digits);S.useEffect(()=>(p({source:"order",entryPrice:e.orderPrice,stopLoss:e.stopLoss!==void 0?String(e.stopLoss):"",takeProfit:e.takeProfit!==void 0?String(e.takeProfit):"",side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:T}),()=>{y()}),[y,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,T,p]);const R=Ua(e.orderType),A=e.volumeLots,O=Number(a)||e.orderPrice,D=oo(l),L=x||E,j=!R||D!==void 0&&Number.isFinite(O)&&O>0,U=S.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${A.toFixed(2)} ${e.displaySymbol} at ${xs(O,e.digits)}`,[e,O,A]),G=async()=>{if(!j){xe({variant:"destructive",description:R?"Please set both stop and limit prices.":"Please set an order price."});return}w(!0);try{const B=await r(e,{volumeLots:A,priceOrder:O,priceTrigger:R?D:void 0,stopLoss:oo(f),takeProfit:oo(m),comment:b.trim()||"order modify"});if(!B.success){xe({variant:"destructive",description:B.message||"Failed to modify order."});return}t(),xe({description:`Order #${e.ticket} updated.`})}catch(B){const N=B instanceof Error?B.message:"Failed to modify order.";xe({variant:"destructive",description:N})}finally{w(!1)}},H=async()=>{k(!0);try{const B=await n(e);if(!B.success){xe({variant:"destructive",description:B.message||"Failed to delete order."});return}s(e.ticket),t(),xe({description:`Order #${e.ticket} deleted.`})}catch(B){const N=B instanceof Error?B.message:"Failed to delete order.";xe({variant:"destructive",description:N})}finally{k(!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," ",A.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",R&&D!==void 0?`${xs(D,e.digits)} / ${xs(O,e.digits)}`:xs(O,e.digits)]}),u.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:u.jsx(dn,{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}),R?u.jsxs(u.Fragment,{children:[u.jsx(Ne,{label:"Stop Price",value:l,onChange:d,step:T,decimals:e.digits,basePrice:e.currentPrice}),u.jsx(Ne,{label:"Limit Price",value:a,onChange:c,step:T,decimals:e.digits,basePrice:e.currentPrice})]}):u.jsx(Ne,{label:"Price",value:a,onChange:c,step:T,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:T,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"}),u.jsx(Ne,{label:"Take Profit",value:m,onChange:g,step:T,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(An,{value:b,onChange:B=>v(B.target.value)})]}),u.jsx(Pt,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:L||!j,onClick:()=>void G(),children:"Modify"}),u.jsx(Pt,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:L,onClick:()=>void H(),children:U})]})]})}function Ss(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function r0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function nh({position:e,onClose:t}){const{closePosition:n}=Oi(),r=ge(E=>E.removePosition),[s,i]=S.useState(String(e.volumeLots)),o=ue(E=>E.stopLoss),a=ue(E=>E.takeProfit),c=ue(E=>E.setStopLoss),l=ue(E=>E.setTakeProfit),d=ue(E=>E.setDraft),f=ue(E=>E.clearDraft),[m,h]=S.useState(e.comment),[g,p]=S.useState(!1),y=Tr(e.digits);S.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:y}),()=>{f()}),[f,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,y,d]);const b=r0(e),v=e.volumeLots,x=S.useMemo(()=>{const E=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${v.toFixed(2)} ${e.displaySymbol} ${Ss(e.openPrice,e.digits)} at ${Ss(b,e.digits)} with Profit ${E}`},[b,e,v]),w=async()=>{p(!0);try{const E=await n(e);if(!E.success){xe({variant:"destructive",description:E.message||"Failed to close position."});return}r(e.ticket),t(),xe({description:`Position #${e.ticket} closed.`})}catch(E){const k=E instanceof Error?E.message:"Failed to close position.";xe({variant:"destructive",description:k})}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," ",Ss(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(dn,{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(An,{readOnly:!0,disabled:!0,value:Ss(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:y,decimals:e.digits,basePrice:e.marketBid??e.openPrice,placeholder:"—"}),u.jsx(Ne,{label:"Take Profit",value:a,onChange:l,step:y,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(An,{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:g,onClick:()=>void w(),children:x})]})]})}function ql({symbolTicker:e,orderState:t}){const n=Ya(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:c,isAccountsLoading:l,hasConfirmedAccount:d,dismissConfirmation:f,placeMarketOrder:m}=t,h=ge(T=>T.positions),g=ge(T=>T.orders),p=ge(T=>T.selectedPositionTicket),y=ge(T=>T.selectedOrderTicket),b=ge(T=>T.setSelectedPositionTicket),v=ge(T=>T.setSelectedOrderTicket),x=p!==null?h.find(T=>T.ticket===p)??null:null,w=y!==null?g.find(T=>T.ticket===y)??null:null,E=r!==null,k=S.useCallback(T=>{m({symbolTicker:e,login:T.login,executionMode:T.executionMode,side:T.side,orderType:T.orderType,volumeLots:T.volumeLots,stopLoss:T.stopLoss,takeProfit:T.takeProfit,priceOrder:T.priceOrder,priceTrigger:T.priceTrigger,comment:T.comment,typeTime:T.typeTime,expirationDateTime:T.expirationDateTime,expirationDay:T.expirationDay,bid:T.bid,ask:T.ask})},[m,e]);return x!==null?u.jsx(nh,{position:x,onClose:()=>b(null)}):w!==null?u.jsx(th,{order:w,onClose:()=>v(null)}):E&&r!==null?u.jsx(eh,{confirmation:r,symbolTicker:e,onDismiss:f}):d?u.jsx(n0,{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:k}):u.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function Zl({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 s0({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade"}){const i=!!n,[o,a]=S.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(Zl,{label:"Trade",isActive:o==="trade",onClick:()=>a("trade")}),u.jsx(Zl,{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(ql,{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(ql,{symbolTicker:e,orderState:t})})})}const i0=.01,o0=.01,Yl=.01;function a0({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=S.useState("closed"),[s,i]=S.useState(null),[o,a]=S.useState(!1),[c,l]=S.useState(!1),[d,f]=S.useState(null),m=ge(O=>O.setSelectedLogin),{accounts:h,isLoading:g}=Ap(),{submitOrder:p}=Oi(),y=S.useMemo(()=>Hb(h),[h]),b=S.useMemo(()=>zb(h),[h]),v=S.useMemo(()=>d!==null&&y.some(O=>O.login===d)?d:b,[y,b,d]);S.useEffect(()=>{v&&m(v)},[v,m]);const x=S.useCallback(O=>{f(O),m(O)},[m]),w=S.useCallback(O=>{O&&(x(O),l(!0),i(null),r(t))},[t,x]),E=S.useCallback(()=>{i(null),r("market")},[]),k=S.useCallback(()=>{i(null),r("mini")},[]),T=S.useCallback(()=>{i(null),r("mini")},[]),R=S.useCallback(()=>{i(null),r("mini")},[]),A=S.useCallback(async O=>{const D=O.login.trim();if(!D){xe({variant:"destructive",description:"Please select a trading account."});return}const L=Math.max(Yl,O.volumeLots),j=vi(O.symbolTicker,e);Number(fn(pn(O.symbolTicker,e)));const U=bi(O.executionMode),G=Ua(O.orderType),H=ft(O.priceOrder),B=ft(O.priceTrigger);if(!U&&H===void 0){xe({variant:"destructive",description:G?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(G&&B===void 0){xe({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!U&&!wi(O.typeTime,O.expirationDateTime,O.expirationDay)){xe({variant:"destructive",description:"Please set an expiration date for this order."});return}const N=U?O.side==="buy"?O.ask:O.bid:H??(O.side==="buy"?O.ask:O.bid);a(!0);try{const I=await p({login:D,symbolTicker:O.symbolTicker,executionMode:O.executionMode,side:Ws(O.orderType),orderType:O.orderType,volumeLots:L,stopLoss:ft(O.stopLoss),takeProfit:ft(O.takeProfit),priceOrder:Ia(O.orderType)?H:void 0,priceTrigger:G?B:void 0,comment:O.comment.trim(),typeTime:O.typeTime,expirationDateTime:O.expirationDateTime,expirationDay:O.expirationDay,bid:O.bid,ask:O.ask});if(!I.success){xe({variant:"destructive",description:I.message||"Order was not accepted."});return}i({ticket:I.ticket??"",side:I.side??Ws(O.orderType),volumeLots:I.volumeLots??L,symbol:I.displaySymbol??j,price:I.price??N}),r("confirmation")}catch(I){const K=I instanceof Error?I.message:"Failed to place order.";xe({variant:"destructive",description:K})}finally{a(!1)}},[p,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:i0,volumeStep:o0,minVolumeLots:Yl,accountOptions:y,selectedLogin:v,setSelectedLogin:x,isAccountsLoading:g,hasConfirmedAccount:c,confirmAccountSelection:w,openMarketPanel:E,openMiniPanel:k,closePanels:T,dismissConfirmation:R,placeMarketOrder:A}}function Js(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Ir);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function rh(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function c0({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=S.useMemo(()=>Js(t),[t]),a=S.useRef(o),c=S.useRef(e),[l,d]=S.useState(null);S.useEffect(()=>{c.current=e},[e]),S.useEffect(()=>{if(!n){d(null);return}const m=()=>{const g=n.querySelector(":scope > div");d(g)};m();const h=new MutationObserver(m);return h.observe(n,{childList:!0}),()=>{h.disconnect()}},[n]);const f=S.useCallback(m=>{if(m===a.current)return;const h=t.find(p=>p.ticker===m);if(!h)return;a.current=m,localStorage.setItem(Ir,m),r(m),s(null);const g=c.current;if(g)try{g.onChartReady(()=>{g.activeChart().setSymbol(h.ticker)})}catch{}},[s,r,t]);return S.useEffect(()=>(i.current=f,()=>{i.current=null}),[f,i]),S.useEffect(()=>{if(!e)return;let m=!1,h=null;try{e.onChartReady(()=>{if(m)return;let g;try{g=e.activeChart()}catch{return}const p=y=>{const b=g.symbol(),v=rh(b,t,o);v!==a.current&&s(null);try{e.resetCache()}catch{}a.current=v,localStorage.setItem(Ir,v),r(v)};g.onSymbolChanged().subscribe(null,p),h=()=>{try{g.onSymbolChanged().unsubscribe(null,p)}catch{}}})}catch{}return()=>{m=!0,h==null||h()}},[e,s,r,o,t]),{chartContainer:l}}const l0=Au("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 u0({className:e,variant:t,...n}){return u.jsx("div",{className:De(l0({variant:t}),e),...n})}function sh(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Ds(){return sh()!==null}const Ql="/charting_library/charting_library.js";function d0({onLoad:e}){return S.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 Xl=_i(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),ih=_i(e=>({newsSelectedCandles:null,newsPlayEndTimestamp:null,gapCount:0,isReplayMode:!1,setNewsSelectedCandles:t=>e({newsSelectedCandles:t}),setNewsPlayEndTimestamp:t=>e({newsPlayEndTimestamp:t}),setGapCount:t=>e({gapCount:t}),setReplayMode:t=>e({isReplayMode:t})})),Ko=8,oh=4,qo=5,Zo=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,f0=e=>{const t=new Date(e+Ko*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=qo:n===6?r<=oh:!0},p0=e=>{const t=new Date(e+Ko*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<qo||n===6&&r>=oh){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(qo,0,0,0),t.getTime()-Ko*60*60*1e3}return e},h0=(e,t,n)=>{const r=Zo(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,f0(i)||(i=p0(i)),s.push(i);return s},m0=(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 h0(e,t,n);const s=Zo(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},g0=(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},Jl="wss://symbols.opheleo.com";function y0(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function eu(e){return e.trim().toUpperCase()}function b0(e,t){return Math.floor(e/t)*t}let Nr;async function v0(e){const t=new URLSearchParams({symbol:e.symbol,timeframe:e.timeframe,...e.endTimestamp&&{endTimestamp:e.endTimestamp.toString()}});return e.last_evaluated_key&&t.append("last_evaluated_key",e.last_evaluated_key),Ae({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class w0{constructor(t,n,r=cn,s=Jl){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||Jl}onReady(t){setTimeout(()=>t(this.configuration),0)}resolveSymbol(t,n,r){const s=this.symbols.find(o=>o.ticker===t),i=this.symbols.find(o=>o.display_name===t);try{setTimeout(()=>{const o={name:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",timezone:"America/New_York",minmov:1,session:(s==null?void 0:s.session)||(i==null?void 0:i.session)||"24x7",has_intraday:!0,visible_plots_set:"ohlc",library_custom_fields:{ticker:(s==null?void 0:s.ticker)||(i==null?void 0:i.ticker)||localStorage.getItem("tv:latest-symbol")||"XAU_USD"},description:(s==null?void 0:s.description)||(i==null?void 0:i.description)||"",type:(s==null?void 0:s.type)||(i==null?void 0:i.type)||"",pricescale:(s==null?void 0:s.pricescale)||(i==null?void 0:i.pricescale)||1e5,ticker:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",exchange:"FX",format:"price",listed_exchange:"FX",logo_urls:(s==null?void 0:s.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))||(i==null?void 0:i.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))};n(o)},0)}catch{r("Symbol not found")}}getBars(t,n,r,s,i){var f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.ticker===t.ticker||m.display_name===t.name||m.display_name===t.ticker),c={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Nr=void 0),!r.firstDataRequest)if(Nr)c.last_evaluated_key=Nr;else{s([],{noData:!0});return}const d=Xl.getState().playEndTimestamp;d&&(c.endTimestamp=d,Xl.getState().setPlayEndTimestamp(null),Nr=void 0),(async()=>{var m;try{const{data:h}=await v0(c);if(h.data_status==="threshold_limited"){s([],{noData:!0});return}if(h.data_status==="end_of_data"){s([],{noData:!0});return}if(!((m=h.items)!=null&&m.length)){s([],{noData:!0});return}Nr=h.last_evaluated_key;const p=[...h.items].map(x=>({open:x.o,high:x.h,low:x.l,close:x.c,time:g0(x.timestamp,n)})),y=ih.getState(),{gapCount:b,isReplayMode:v}=y;if(v&&event){const x=m0(p[p.length-1].time,n,b||0,t.session);if(x.length>0){const w=p[p.length-1].close;for(const E of x)p.push({open:w,high:w,low:w,close:w,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?eu(a.resolve_symbol):eu(t.ticker||t.name||""),l=y0(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=b0(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 _0=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])},Yo="An unknown error occurred",Ls=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return Yo;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 Yo},x0=e=>{var t;if(Qf(e)){const n=(t=e.response)!=null&&t.data?Ls(e.response.data):void 0;return n&&n!==Yo?n:Ls(e)}return Ls(e)},S0=({queryKey:e,queryFn:t,...n})=>Ti({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw xe({variant:"destructive",title:"Error",description:x0(Qf(i)?(s=i.response)==null?void 0:s.data:i)}),null}},...n});var ve;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(ve||(ve={}));var tu;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(tu||(tu={}));const Y=ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zt=e=>{switch(typeof e){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(e)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Y.promise:typeof Map<"u"&&e instanceof Map?Y.map:typeof Set<"u"&&e instanceof Set?Y.set:typeof Date<"u"&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},F=ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class 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,ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}It.create=e=>new It(e);const Qo=(e,t)=>{let n;switch(e.code){case F.invalid_type:e.received===Y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case F.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ve.jsonStringifyReplacer)}`;break;case F.unrecognized_keys:n=`Unrecognized key(s) in object: ${ve.joinValues(e.keys,", ")}`;break;case F.invalid_union:n="Invalid input";break;case F.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ve.joinValues(e.options)}`;break;case F.invalid_enum_value:n=`Invalid enum value. Expected ${ve.joinValues(e.options)}, received '${e.received}'`;break;case F.invalid_arguments:n="Invalid function arguments";break;case F.invalid_return_type:n="Invalid function return type";break;case F.invalid_date:n="Invalid date";break;case F.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ve.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case F.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 F.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 F.custom:n="Invalid input";break;case F.invalid_intersection_types:n="Intersection results could not be merged";break;case F.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case F.not_finite:n="Number must be finite";break;default:n=t.defaultError,ve.assertNever(e)}return{message:n}};let C0=Qo;function E0(){return C0}const T0=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 z(e,t){const n=E0(),r=T0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Qo?void 0:Qo].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 re;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 re;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 re=Object.freeze({status:"aborted"}),Mr=e=>({status:"dirty",value:e}),ot=e=>({status:"valid",value:e}),nu=e=>e.status==="aborted",ru=e=>e.status==="dirty",yr=e=>e.status==="valid",ei=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 su=(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 de(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,a)=>{const{message:c}=e;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}class be{get description(){return this._def.description}_getType(t){return zt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nt,ctx:{common:t.parent.common,data:t.data,parsedType:zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ei(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)},s=this._parseSync({data:t,path:r.path,parent:r});return su(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:zt(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:zt(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(ei(s)?s:Promise.resolve(s));return su(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:F.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:se.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 si.create(this,this._def)}or(t){return ni.create([this,t],this._def)}and(t){return ri.create(this,t,this._def)}transform(t){return new wr({...de(this._def),schema:this,typeName:se.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ea({...de(this._def),innerType:this,defaultValue:n,typeName:se.ZodDefault})}brand(){return new Z0({typeName:se.ZodBranded,type:this,...de(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ta({...de(this._def),innerType:this,catchValue:n,typeName:se.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return uc.create(this,t)}readonly(){return na.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const P0=/^c[^\s-]{8,}$/i,k0=/^[0-9a-z]+$/,O0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,A0=/^[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,R0=/^[a-z0-9_-]{21}$/i,N0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,D0=/^[-+]?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)?)??$/,L0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,j0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ao;const M0=/^(?:(?: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])$/,I0=/^(?:(?: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])$/,U0=/^(([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]))$/,F0=/^(([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])$/,B0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ah="((\\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])))",V0=new RegExp(`^${ah}$`);function ch(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 H0(e){return new RegExp(`^${ch(e)}$`)}function z0(e){let t=`${ah}T${ch(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 W0(e,t){return!!((t==="v4"||!t)&&M0.test(e)||(t==="v6"||!t)&&U0.test(e))}function G0(e,t){if(!N0.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 K0(e,t){return!!((t==="v4"||!t)&&I0.test(e)||(t==="v6"||!t)&&F0.test(e))}class Xt extends be{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Y.string){const i=this._getOrReturnCtx(t);return z(i,{code:F.invalid_type,expected:Y.string,received:i.parsedType}),re}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),z(s,{code:F.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),z(s,{code:F.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?z(s,{code:F.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&z(s,{code:F.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")L0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"email",code:F.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")ao||(ao=new RegExp(j0,"u")),ao.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"emoji",code:F.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")A0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"uuid",code:F.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")R0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"nanoid",code:F.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")P0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"cuid",code:F.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")k0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"cuid2",code:F.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")O0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"ulid",code:F.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),z(s,{validation:"url",code:F.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),z(s,{validation:"regex",code:F.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),z(s,{code:F.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),z(s,{code:F.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),z(s,{code:F.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?z0(i).test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{code:F.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?V0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{code:F.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?H0(i).test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{code:F.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?D0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"duration",code:F.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?W0(t.data,i.version)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"ip",code:F.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?G0(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"jwt",code:F.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?K0(t.data,i.version)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"cidr",code:F.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?B0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"base64",code:F.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?$0.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"base64url",code:F.invalid_string,message:i.message}),r.dirty()):ve.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:F.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:se.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...de(e)});function q0(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 be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Y.number){const i=this._getOrReturnCtx(t);return z(i,{code:F.invalid_type,expected:Y.number,received:i.parsedType}),re}let r;const s=new nt;for(const i of this._def.checks)i.kind==="int"?ve.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),z(r,{code:F.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),z(r,{code:F.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),z(r,{code:F.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?q0(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),z(r,{code:F.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),z(r,{code:F.not_finite,message:i.message}),s.dirty()):ve.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Q.toString(n))}setLimit(t,n,r,s){return new 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"&&ve.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}br.create=e=>new br({checks:[],typeName:se.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...de(e)});class Hr extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Y.bigint)return this._getInvalidInput(t);let r;const s=new 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),z(r,{code:F.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),z(r,{code:F.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),z(r,{code:F.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):ve.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return z(n,{code:F.invalid_type,expected:Y.bigint,received:n.parsedType}),re}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:se.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...de(e)});class Xo extends be{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Y.boolean){const r=this._getOrReturnCtx(t);return z(r,{code:F.invalid_type,expected:Y.boolean,received:r.parsedType}),re}return ot(t.data)}}Xo.create=e=>new Xo({typeName:se.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...de(e)});class ti extends be{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Y.date){const i=this._getOrReturnCtx(t);return z(i,{code:F.invalid_type,expected:Y.date,received:i.parsedType}),re}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return z(i,{code:F.invalid_date}),re}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),z(s,{code:F.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),z(s,{code:F.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):ve.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ti({...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}}ti.create=e=>new ti({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:se.ZodDate,...de(e)});class iu extends be{_parse(t){if(this._getType(t)!==Y.symbol){const r=this._getOrReturnCtx(t);return z(r,{code:F.invalid_type,expected:Y.symbol,received:r.parsedType}),re}return ot(t.data)}}iu.create=e=>new iu({typeName:se.ZodSymbol,...de(e)});class ou extends be{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return z(r,{code:F.invalid_type,expected:Y.undefined,received:r.parsedType}),re}return ot(t.data)}}ou.create=e=>new ou({typeName:se.ZodUndefined,...de(e)});class au extends be{_parse(t){if(this._getType(t)!==Y.null){const r=this._getOrReturnCtx(t);return z(r,{code:F.invalid_type,expected:Y.null,received:r.parsedType}),re}return ot(t.data)}}au.create=e=>new au({typeName:se.ZodNull,...de(e)});class cu extends be{constructor(){super(...arguments),this._any=!0}_parse(t){return ot(t.data)}}cu.create=e=>new cu({typeName:se.ZodAny,...de(e)});class lu extends be{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ot(t.data)}}lu.create=e=>new lu({typeName:se.ZodUnknown,...de(e)});class an extends be{_parse(t){const n=this._getOrReturnCtx(t);return z(n,{code:F.invalid_type,expected:Y.never,received:n.parsedType}),re}}an.create=e=>new an({typeName:se.ZodNever,...de(e)});class uu extends be{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return z(r,{code:F.invalid_type,expected:Y.void,received:r.parsedType}),re}return ot(t.data)}}uu.create=e=>new uu({typeName:se.ZodVoid,...de(e)});class Ot extends be{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Y.array)return z(n,{code:F.invalid_type,expected:Y.array,received:n.parsedType}),re;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(z(n,{code:o?F.too_big:F.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&&(z(n,{code:F.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&&(z(n,{code:F.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:se.ZodArray,...de(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 In?In.create(e.items.map(t=>Zn(t))):e}class Le extends be{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=ve.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Y.object){const l=this._getOrReturnCtx(t);return z(l,{code:F.invalid_type,expected:Y.object,received:l.parsedType}),re}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&&(z(s,{code:F.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:se.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Le({...this._def,catchall:t})}pick(t){const n={};for(const r of ve.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Le({...this._def,shape:()=>n})}omit(t){const n={};for(const r of ve.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Le({...this._def,shape:()=>n})}deepPartial(){return Zn(this)}partial(t){const n={};for(const r of ve.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new Le({...this._def,shape:()=>n})}required(t){const n={};for(const r of ve.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof tn;)i=i._def.innerType;n[r]=i}return new Le({...this._def,shape:()=>n})}keyof(){return lh(ve.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:se.ZodObject,...de(t)});Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:se.ZodObject,...de(t)});Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:se.ZodObject,...de(t)});class ni extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new It(a.ctx.common.issues));return z(n,{code:F.invalid_union,unionErrors:o}),re}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 z(n,{code:F.invalid_union,unionErrors:a}),re}}get options(){return this._def.options}}ni.create=(e,t)=>new ni({options:e,typeName:se.ZodUnion,...de(t)});function Jo(e,t){const n=zt(e),r=zt(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){const s=ve.objectKeys(t),i=ve.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const c=Jo(e[a],t[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],a=t[i],c=Jo(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===Y.date&&r===Y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ri extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(nu(i)||nu(o))return re;const a=Jo(i.value,o.value);return a.valid?((ru(i)||ru(o))&&n.dirty(),{status:n.value,value:a.data}):(z(r,{code:F.invalid_intersection_types}),re)};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}))}}ri.create=(e,t,n)=>new ri({left:e,right:t,typeName:se.ZodIntersection,...de(n)});class In extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.array)return z(r,{code:F.invalid_type,expected:Y.array,received:r.parsedType}),re;if(r.data.length<this._def.items.length)return z(r,{code:F.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),re;!this._def.rest&&r.data.length>this._def.items.length&&(z(r,{code:F.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 In({...this._def,rest:t})}}In.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new In({items:e,typeName:se.ZodTuple,rest:null,...de(t)})};class du extends be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.map)return z(r,{code:F.invalid_type,expected:Y.map,received:r.parsedType}),re;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 re;(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 re;(l.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(l.value,d.value)}return{status:n.value,value:a}}}}du.create=(e,t,n)=>new du({valueType:t,keyType:e,typeName:se.ZodMap,...de(n)});class zr extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.set)return z(r,{code:F.invalid_type,expected:Y.set,received:r.parsedType}),re;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(z(r,{code:F.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&&(z(r,{code:F.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 re;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:se.ZodSet,...de(t)});class fu extends be{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}fu.create=(e,t)=>new fu({getter:e,typeName:se.ZodLazy,...de(t)});class pu extends be{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return z(n,{received:n.data,code:F.invalid_literal,expected:this._def.value}),re}return{status:"valid",value:t.data}}get value(){return this._def.value}}pu.create=(e,t)=>new pu({value:e,typeName:se.ZodLiteral,...de(t)});function lh(e,t){return new vr({values:e,typeName:se.ZodEnum,...de(t)})}class vr extends be{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return z(n,{expected:ve.joinValues(r),received:n.parsedType,code:F.invalid_type}),re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return z(n,{received:n.data,code:F.invalid_enum_value,options:r}),re}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=lh;class hu extends be{_parse(t){const n=ve.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Y.string&&r.parsedType!==Y.number){const s=ve.objectValues(n);return z(r,{expected:ve.joinValues(s),received:r.parsedType,code:F.invalid_type}),re}if(this._cache||(this._cache=new Set(ve.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=ve.objectValues(n);return z(r,{received:r.data,code:F.invalid_enum_value,options:s}),re}return ot(t.data)}get enum(){return this._def.values}}hu.create=(e,t)=>new hu({values:e,typeName:se.ZodNativeEnum,...de(t)});class si extends be{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Y.promise&&n.common.async===!1)return z(n,{code:F.invalid_type,expected:Y.promise,received:n.parsedType}),re;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return ot(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}si.create=(e,t)=>new si({type:e,typeName:se.ZodPromise,...de(t)});class wr extends be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===se.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=>{z(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 re;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?re:c.status==="dirty"||n.value==="dirty"?Mr(c.value):c});{if(n.value==="aborted")return re;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?re:a.status==="dirty"||n.value==="dirty"?Mr(a.value):a}}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?re:(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"?re:(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 re;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})):re);ve.assertNever(s)}}wr.create=(e,t,n)=>new wr({schema:e,typeName:se.ZodEffects,effect:t,...de(n)});wr.createWithPreprocess=(e,t,n)=>new wr({schema:t,effect:{type:"preprocess",transform:e},typeName:se.ZodEffects,...de(n)});class tn extends be{_parse(t){return this._getType(t)===Y.undefined?ot(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}tn.create=(e,t)=>new tn({innerType:e,typeName:se.ZodOptional,...de(t)});class _r extends be{_parse(t){return this._getType(t)===Y.null?ot(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}_r.create=(e,t)=>new _r({innerType:e,typeName:se.ZodNullable,...de(t)});class ea extends be{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Y.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ea.create=(e,t)=>new ea({innerType:e,typeName:se.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...de(t)});class ta extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ei(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}}ta.create=(e,t)=>new ta({innerType:e,typeName:se.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...de(t)});class mu extends be{_parse(t){if(this._getType(t)!==Y.nan){const r=this._getOrReturnCtx(t);return z(r,{code:F.invalid_type,expected:Y.nan,received:r.parsedType}),re}return{status:"valid",value:t.data}}}mu.create=e=>new mu({typeName:se.ZodNaN,...de(e)});class Z0 extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class uc extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?re:i.status==="dirty"?(n.dirty(),Mr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?re:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new uc({in:t,out:n,typeName:se.ZodPipeline})}}class na extends be{_parse(t){const n=this._def.innerType._parse(t),r=s=>(yr(s)&&(s.value=Object.freeze(s.value)),s);return ei(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}na.create=(e,t)=>new na({innerType:e,typeName:se.ZodReadonly,...de(t)});var se;(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"})(se||(se={}));const co=Xt.create,Cs=br.create,Y0=Xo.create;an.create;Ot.create;const Q0=Le.create;ni.create;ri.create;In.create;vr.create;si.create;tn.create;_r.create;const X0="https://api.opheleo.com",J0="Bearer ",eC="Authorization";Q0({id:co(),userId:co(),createdAt:Cs(),updatedAt:Cs(),active:Y0(),perDayUsage:Cs(),userEmail:co().email(),maxPerDayUsage:Cs()});async function tC(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Ae({baseURL:Mn(n??X0),url:e,method:t,headers:r?{[eC]:`${J0}${r}`}:void 0})).data}async function nC(e){return tC("/iccandle/v1/iccandle-user-usage/me","get",e)}const rC=e=>{const t=e==null?void 0:e.platformApiBase;return S0({queryKey:["iccandle-user-usage",t],queryFn:()=>nC(t),...e})},sC=S.createContext(null);function iC(){const e=S.useContext(sC);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function oC({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=iC(),c=hn(),l=ss(),d=S.useRef([]),f=S.useRef(null),m=S.useRef(a),h=S.useRef(null),g=S.useRef(null),p=S.useMemo(()=>Js(l),[l]),y=S.useRef(p),b=S.useRef("60"),{setGapCount:v,setReplayMode:x}=ih();S.useEffect(()=>{v(0),x(!1)},[v,x]),S.useEffect(()=>{Ds()&&T(!0)},[]);const[w,E]=S.useState(null),[k,T]=S.useState(!1),[R,A]=S.useState(null),O=S.useCallback(N=>{if(N===y.current)return;const I=l.find(M=>M.ticker===N);if(!I)return;y.current=N,localStorage.setItem(Ir,N),t(N);const K=f.current;if(K)try{K.onChartReady(()=>{K.activeChart().setSymbol(I.ticker)})}catch{}},[t,l]);S.useEffect(()=>(i.current=O,()=>{i.current=null}),[O,i]);const D=S.useRef([]),L=S.useMemo(()=>new w0(D,"selector",l,c.tickWebSocketUrl),[c.tickWebSocketUrl,l]),{data:j,isLoading:U}=rC({enabled:!0,platformApiBase:c.platformApiBase}),G=!U&&j?j.perDayUsage>=j.maxPerDayUsage:!1;S.useEffect(()=>{s(w)},[w,s]),S.useEffect(()=>{r(R)},[R,r]),S.useEffect(()=>{if(!k||!w)return;if(f.current){A(null),r(null);try{f.current.remove()}catch{}f.current=null}const N=Js(l);y.current=N,b.current="60";const I=sh();if(!I)return;const K=new I({container:w,library_path:"/charting_library/",datafeed:L,symbol:N,interval:"60",autosize:!0,theme:m.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>_0(d),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:kh(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let M=!1;return f.current=K,K.onChartReady(()=>{M||f.current!==K||A(K)}),()=>{if(M=!0,A(null),r(null),f.current){try{f.current.remove()}catch{}f.current=null}}},[w,L,r,k]),S.useEffect(()=>{if(!R)return;let N=!1;try{R.onChartReady(()=>{N||(async()=>{try{const I=R.activeChart(),K=await I.createStudy("Generated Candles - By iC Candle",!0,!0);if(N||(K&&I.bringToFront([K]),await R.headerReady(),N)||(await new Promise(oe=>{setTimeout(()=>{if(!N)try{I.clearMarks(2)}catch{}oe(!0)},150)}),N))return;localStorage.setItem("tv:selected-news-events","[]"),I.refreshMarks();const M=oe=>{const ae=I.symbol(),$=rh(ae,l,p);$!==y.current&&(n(null),d.current=[]);try{R.resetCache()}catch{}y.current=$,localStorage.setItem(Ir,$),t($)},le=oe=>{oe!==b.current&&(n(null),d.current=[]);try{R.resetCache()}catch{}b.current=oe};h.current=M,g.current=le,I.onSymbolChanged().subscribe(null,M),I.onIntervalChanged().subscribe(null,le)}catch{}})()})}catch{}return()=>{N=!0,h.current=null,g.current=null}},[R,e,n,t,p,l]),S.useEffect(()=>{if(!R||!a)return;let N=!1;try{R.onChartReady(()=>{N||R.changeTheme(a).catch(()=>{})})}catch{}return()=>{N=!0}},[R,a]);const H=S.useCallback(()=>{T(!0)},[]),B=G?u.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:u.jsxs(u0,{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"}),j&&u.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[j.perDayUsage," of ",j.maxPerDayUsage," scans used today"]})]})}):null;return u.jsxs(u.Fragment,{children:[o??B,u.jsx(d0,{onLoad:H}),u.jsx("div",{ref:E,className:"web-trading-widget-advanced__container"})]})}const uh=S.createContext(null);function gu({value:e,children:t}){return u.jsx(uh.Provider,{value:e,children:t})}function aC(){const e=S.useContext(uh);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Dr({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(cf,{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 cC=new Set(["volume-setting","risk-management"]);function lC({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[g,p]=S.useState(!1),[y,b]=S.useState("market"),[v,x]=S.useState(String(r)),[w,E]=S.useState(""),[k,T]=S.useState(""),R=ue(te=>te.stopLoss),A=ue(te=>te.takeProfit),O=ue(te=>te.setStopLoss),D=ue(te=>te.setTakeProfit),L=ue(te=>te.setVolumeLots),j=ue(te=>te.setOrderSide),[U,G]=S.useState(""),[H,B]=S.useState(dt.GTC),[N,I]=S.useState(""),[K,M]=S.useState(""),[le,oe]=S.useState(()=>new Set(cC));S.useEffect(()=>{f()},[g,f]);const ae=Number(fn(pn(e))),$=Tr(ae),q=yf(t,n),Z=t!==null?Pe(t,ae):"—",ce=n!==null?Pe(n,ae):"—",fe=bi(y),ye=hf(y),ie=yi(y),ne=ie.label,je=!fe&&ie.orderType!==null&&ie.orderType%2===1,ke=S.useMemo(()=>q!==null?q:t??n,[n,t,q]),Ee=te=>{oe(bt=>{const $n=new Set(bt);return $n.has(te)?$n.delete(te):$n.add(te),$n})},J=te=>{x(te);const bt=Number(te);Number.isFinite(bt)&&bt>0&&L(bt)},Te=te=>t===null||n===null?null:fe?te==="buy"?n:t:ft(w)??(te==="buy"?n:t),Me=te=>{const bt=Te(te);bt!==null&&j({side:te,entryPrice:bt})},We=te=>{if(t===null||n===null||!c)return;const bt=Math.max(i,Number(v)||i),$n=pf(y,te),fc=Te(te);fc!==null&&j({side:te,entryPrice:fc}),h({login:c,executionMode:y,side:te,orderType:$n,volumeLots:bt,stopLoss:R,takeProfit:A,priceOrder:w,priceTrigger:k,comment:U,typeTime:H,expirationDateTime:N,expirationDay:K,bid:t,ask:n})},at=t!==null&&n!==null,ee=fe||ft(w)!==void 0,$e=!ye||ft(k)!==void 0,Di=fe||wi(H,N,K),Bn=!o&&!a&&c!==""&&at&&ee&&$e&&Di,dh=!fe&&Fa(H),fh=!fe&&Ba(H),dc=()=>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${g?" 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(uf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),u.jsx("select",{value:y,className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",onChange:te=>b(te.target.value),children:zs.map(te=>u.jsx("option",{value:te.mode,children:te.label},te.mode))}),u.jsx("div",{className:"web-trading-widget-market-panel__header-actions",children:u.jsx("button",{type:"button","aria-label":g?"Expand order panel":"Collapse order panel","aria-expanded":!g,className:"web-trading-widget-market-panel__header-btn",onClick:()=>p(te=>!te),children:g?u.jsx(Nb,{className:"web-trading-widget-icon web-trading-widget-icon--md"}):u.jsx(df,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})})]}),g?null:u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[u.jsx(Dr,{id:"volume-setting",title:"Volume Setting",isOpen:le.has("volume-setting"),onToggle:()=>Ee("volume-setting"),children:u.jsx(Ne,{label:"Lots",value:v,onChange:J,step:s,min:i,decimals:2})}),fe?null:u.jsx(Dr,{id:"order-price",title:"Order Price",isOpen:le.has("order-price"),onToggle:()=>Ee("order-price"),children:ye?u.jsxs(u.Fragment,{children:[u.jsx(Ne,{label:"Stop Price",value:k,onChange:T,step:$,decimals:ae,basePrice:ke,placeholder:q!==null?Pe(q,ae):"—"}),u.jsx(Ne,{label:"Limit Price",value:w,onChange:E,step:$,decimals:ae,basePrice:ke,placeholder:q!==null?Pe(q,ae):"—"})]}):u.jsx(Ne,{label:"Price",value:w,onChange:E,step:$,decimals:ae,basePrice:ke,placeholder:q!==null?Pe(q,ae):"—"})}),u.jsx(Dr,{id:"risk-management",title:"Risk Management",isOpen:le.has("risk-management"),onToggle:()=>Ee("risk-management"),children:u.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[u.jsx(Ne,{label:"Stop Loss",value:R,onChange:O,step:$,decimals:ae,basePrice:t,placeholder:t!==null?Z:"—",clearable:!0}),u.jsx(Ne,{label:"Take Profit",value:A,onChange:D,step:$,decimals:ae,basePrice:n,placeholder:n!==null?ce:"—",clearable:!0})]})}),fe?null:u.jsxs(Dr,{id:"expiration",title:"Expiration",isOpen:le.has("expiration"),onToggle:()=>Ee("expiration"),children:[u.jsx("select",{value:String(H),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:te=>B(Number(te.target.value)),children:mf.map(te=>u.jsx("option",{value:String(te.value),children:te.label},te.value))}),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 time"}),u.jsx("input",{type:"datetime-local",value:N,className:"web-trading-widget-market-panel__input",onChange:te=>I(te.target.value)})]}):null,fh?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:K,className:"web-trading-widget-market-panel__input",onChange:te=>M(te.target.value)})]}):null]}),u.jsx(Dr,{id:"comment",title:"Comment",isOpen:le.has("comment"),onToggle:()=>Ee("comment"),children:u.jsx("input",{type:"text",value:U,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:te=>G(te.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:Z}),u.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:ce})]})})]}),fe?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(dc()),onClick:()=>We(dc()),children:["Place ",ne]})]})}function uC({symbolTicker:e,chartWidget:t,orderState:n}){const r=ss(),s=Ya(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:c,volumeStep:l,minVolumeLots:d,selectedLogin:f,isAccountsLoading:m,hasConfirmedAccount:h,closePanels:g,dismissConfirmation:p,placeMarketOrder:y}=n,b=ge(M=>M.positions),v=ge(M=>M.orders),x=ge(M=>M.selectedPositionTicket),w=ge(M=>M.selectedOrderTicket),E=ge(M=>M.setSelectedPositionTicket),k=ge(M=>M.setSelectedOrderTicket),T=x!==null?b.find(M=>M.ticket===x)??null:null,R=w!==null?v.find(M=>M.ticket===w)??null:null,A=h&&i==="confirmation"&&o!==null,O=h&&i!=="confirmation"&&i!=="closed"&&T===null&&R===null,{panelRef:D,position:L,isDragging:j,onDragStart:U,reclamp:G}=xf({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:O}),H=ue(M=>M.setDraft),B=ue(M=>M.clearDraft),N=Number(fn(pn(e))),I=Tr(N);S.useEffect(()=>{h&&H({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:c,digits:N,priceStep:I})},[c,N,h,I,H]),S.useEffect(()=>{(i==="closed"||i==="confirmation")&&B()},[B,i]);const K=T!==null||R!==null;return!h&&!K?null:u.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[u.jsx(lp,{chartWidget:t,symbolTicker:e,symbols:r}),K&&T!==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:T,onClose:()=>E(null)})}):null,K&&R!==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:R,onClose:()=>k(null)})}):null,A&&o!==null?u.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:u.jsx(eh,{confirmation:o,symbolTicker:e,onDismiss:p})}):null,O?u.jsx("div",{ref:D,style:{left:L.x,top:L.y},className:`web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--draggable web-trading-widget-new-order-overlay--exec-panel${j?" web-trading-widget-new-order-overlay--dragging":""}`,children:u.jsx(lC,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:c,volumeStep:l,minVolumeLots:d,isSubmitting:a,isAccountsLoading:m,selectedLogin:f,isDragging:j,onDragHandlePointerDown:U,onLayoutChange:G,onClose:g,onPlaceOrder:M=>void y({symbolTicker:e,login:M.login,executionMode:M.executionMode,side:M.side,orderType:M.orderType,volumeLots:M.volumeLots,stopLoss:M.stopLoss,takeProfit:M.takeProfit,priceOrder:M.priceOrder,priceTrigger:M.priceTrigger,comment:M.comment,typeTime:M.typeTime,expirationDateTime:M.expirationDateTime,expirationDay:M.expirationDay,bid:M.bid,ask:M.ask})})}):null]})}function dC(){const e=aC();return u.jsx(oC,{...e})}function fC({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,chartWidget:s}){const i=s!==void 0,o=ss(),a=a0({symbols:o,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),c=S.useRef(null),l=S.useRef(null),[d,f]=S.useState(null),m=S.useCallback(j=>{f(j)},[]),[h,g]=S.useState(null),[p,y]=S.useState(null),b=i?s??null:h,[v,x]=S.useState(()=>Js(o)),[w,E]=S.useState(n??null);S.useEffect(()=>{E(n??null)},[n]),nc(a.selectedLogin);const k=S.useCallback(j=>{x(j)},[]),T=S.useCallback(j=>{E(j),r==null||r(j)},[r]),{chartContainer:R}=c0({chartWidget:i?b:null,symbols:o,chartSlotElement:i?d:null,onSymbolTickerChange:k,onScanResultUrlChange:T,selectSymbolTickerRef:l}),A=i?R:p,O=S.useCallback(j=>{var U;(U=l.current)==null||U.call(l,j)},[]),D=S.useMemo(()=>({controlsRef:c,onSymbolTickerChange:k,onScanResultUrlChange:T,onChartWidgetChange:i?()=>{}:g,onChartContainerChange:i?()=>{}:y,selectSymbolTickerRef:l}),[T,k,i]);S.useEffect(()=>{if(t==="news")return c.current={open:a.openMarketPanel,setSelectedLogin:a.setSelectedLogin},()=>{c.current=null}},[a.openMarketPanel,a.setSelectedLogin,t]);const L=e??(i?null:u.jsx(dC,{}));return t==="news"?u.jsx(gu,{value:D,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(af,{open:!a.hasConfirmedAccount,isAccountsLoading:a.isAccountsLoading,accountOptions:a.accountOptions,onConfirm:a.confirmAccountSelection}),u.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[i?u.jsx("div",{ref:m,className:"web-trading-widget-trading-layout__host-chart-slot",children:L}):L,u.jsx(uC,{symbolTicker:v,chartWidget:b,orderState:a})]})]}),u.jsx(jp,{onCreateNewOrder:()=>{var j;return(j=c.current)==null?void 0:j.open()}})]})}):u.jsx(gu,{value:D,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(gS,{controlsRef:c,symbolTicker:v,chartWidget:b,chartContainer:A,scanResultUrl:w,orderState:a}),u.jsx("div",{ref:i?m:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:L})]}),u.jsx(s0,{symbolTicker:v,orderState:a,scanResultUrl:w,initialTab:w?"scan":"trade"},w??"trade-only")]}),u.jsx(Dp,{symbolTicker:v,onSymbolChange:O,onCreateNewOrder:()=>{var j;return(j=c.current)==null?void 0:j.open()}})]})})}function pC({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultUrlChange:s,children:i,chartWidget:o}){return S.useEffect(()=>{typeof window>"u"||t&&localStorage.setItem(Xf,t)},[t]),u.jsx(Lp,{children:u.jsx(tp,{baseUrl:e,children:u.jsx(fC,{variant:n,scanResultUrl:r,onScanResultUrlChange:s,chartWidget:o,children:i})})})}exports.ChartNewsOrdersOverlay=MS;exports.WebTradingWidget=pC;
|