@nabeeltahirdeveloper/chart-sdk 2.3.27-beta → 2.3.28-beta

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.
@@ -3,13 +3,13 @@
3
3
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[gh]=this[gh]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=Tr(s);i[o]||(Xm(r,s),i[o]=!0)}return de.isArray(e)?e.forEach(n):n(e),this}};pA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),de.reduceDescriptors(pA.prototype,({value:A},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>A,set(i){this[t]=i}}}),de.freezeMethods(pA);function Go(A,e){const t=this||vr,i=e||t,r=pA.from(i.headers);let n=i.data;return de.forEach(A,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function mh(A){return!!(A&&A.__CANCEL__)}let br=class extends tt{constructor(e,t,i){super(e??"canceled",tt.ERR_CANCELED,t,i),this.name="CanceledError",this.__CANCEL__=!0}};function wh(A,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?A(t):e(new tt("Request failed with status code "+t.status,[tt.ERR_BAD_REQUEST,tt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Jm(A){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(A);return e&&e[1]||""}function Zm(A,e){A=A||10;const t=new Array(A),i=new Array(A);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),h=i[n];s||(s=c),t[r]=l,i[r]=c;let m=n,v=0;for(;m!==r;)v+=t[m++],m=m%A;if(r=(r+1)%A,r===n&&(n=(n+1)%A),c-s<e)return;const x=h&&c-h;return x?Math.round(v*1e3/x):void 0}}function Ym(A,e){let t=0,i=1e3/e,r,n;const s=(c,h=Date.now())=>{t=h,r=null,n&&(clearTimeout(n),n=null),A(...c)};return[(...c)=>{const h=Date.now(),m=h-t;m>=i?s(c,h):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},i-m)))},()=>r&&s(r)]}const En=(A,e,t=3)=>{let i=0;const r=Zm(50,250);return Ym(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-i,c=r(l),h=s<=o;i=s;const m={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};A(m)},t)},Bh=(A,e)=>{const t=A!=null;return[i=>e[0]({lengthComputable:t,total:A,loaded:i}),e[1]]},yh=A=>(...e)=>de.asap(()=>A(...e)),qm=eA.hasStandardBrowserEnv?((A,e)=>t=>(t=new URL(t,eA.origin),A.protocol===t.protocol&&A.host===t.host&&(e||A.port===t.port)))(new URL(eA.origin),eA.navigator&&/(msie|trident)/i.test(eA.navigator.userAgent)):()=>!0,jm=eA.hasStandardBrowserEnv?{write(A,e,t,i,r,n,s){if(typeof document>"u")return;const o=[`${A}=${encodeURIComponent(e)}`];de.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),de.isString(i)&&o.push(`path=${i}`),de.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),de.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(A){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+A+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(A){this.write(A,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function e1(A){return typeof A!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(A)}function t1(A,e){return e?A.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):A}function Ch(A,e,t){let i=!e1(e);return A&&(i||t==!1)?t1(A,e):e}const vh=A=>A instanceof pA?{...A}:A;function Ei(A,e){e=e||{};const t={};function i(c,h,m,v){return de.isPlainObject(c)&&de.isPlainObject(h)?de.merge.call({caseless:v},c,h):de.isPlainObject(h)?de.merge({},h):de.isArray(h)?h.slice():h}function r(c,h,m,v){if(de.isUndefined(h)){if(!de.isUndefined(c))return i(void 0,c,m,v)}else return i(c,h,m,v)}function n(c,h){if(!de.isUndefined(h))return i(void 0,h)}function s(c,h){if(de.isUndefined(h)){if(!de.isUndefined(c))return i(void 0,c)}else return i(void 0,h)}function o(c,h,m){if(m in e)return i(c,h);if(m in A)return i(void 0,c)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,h,m)=>r(vh(c),vh(h),m,!0)};return de.forEach(Object.keys({...A,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const m=de.hasOwnProp(l,h)?l[h]:r,v=m(A[h],e[h],h);de.isUndefined(v)&&m!==o||(t[h]=v)}),t}const Th=A=>{const e=Ei({},A);let{data:t,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=pA.from(s),e.url=ph(Ch(e.baseURL,e.url,e.allowAbsoluteUrls),A.params,A.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),de.isFormData(t)){if(eA.hasStandardBrowserEnv||eA.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(de.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([h,m])=>{c.includes(h.toLowerCase())&&s.set(h,m)})}}if(eA.hasStandardBrowserEnv&&(i&&de.isFunction(i)&&(i=i(e)),i||i!==!1&&qm(e.url))){const l=r&&n&&jm.read(n);l&&s.set(r,l)}return e},A1=typeof XMLHttpRequest<"u"&&function(A){return new Promise(function(t,i){const r=Th(A);let n=r.data;const s=pA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,h,m,v,x,F;function T(){x&&x(),F&&F(),r.cancelToken&&r.cancelToken.unsubscribe(h),r.signal&&r.signal.removeEventListener("abort",h)}let S=new XMLHttpRequest;S.open(r.method.toUpperCase(),r.url,!0),S.timeout=r.timeout;function I(){if(!S)return;const N=pA.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),H={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:N,config:A,request:S};wh(function(re){t(re),T()},function(re){i(re),T()},H),S=null}"onloadend"in S?S.onloadend=I:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(I)},S.onabort=function(){S&&(i(new tt("Request aborted",tt.ECONNABORTED,A,S)),S=null)},S.onerror=function(J){const H=J&&J.message?J.message:"Network Error",z=new tt(H,tt.ERR_NETWORK,A,S);z.event=J||null,i(z),S=null},S.ontimeout=function(){let J=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const H=r.transitional||Ko;r.timeoutErrorMessage&&(J=r.timeoutErrorMessage),i(new tt(J,H.clarifyTimeoutError?tt.ETIMEDOUT:tt.ECONNABORTED,A,S)),S=null},n===void 0&&s.setContentType(null),"setRequestHeader"in S&&de.forEach(s.toJSON(),function(J,H){S.setRequestHeader(H,J)}),de.isUndefined(r.withCredentials)||(S.withCredentials=!!r.withCredentials),o&&o!=="json"&&(S.responseType=r.responseType),c&&([v,F]=En(c,!0),S.addEventListener("progress",v)),l&&S.upload&&([m,x]=En(l),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(r.cancelToken||r.signal)&&(h=N=>{S&&(i(!N||N.type?new br(null,A,S):N),S.abort(),S=null)},r.cancelToken&&r.cancelToken.subscribe(h),r.signal&&(r.signal.aborted?h():r.signal.addEventListener("abort",h)));const Q=Jm(r.url);if(Q&&eA.protocols.indexOf(Q)===-1){i(new tt("Unsupported protocol "+Q+":",tt.ERR_BAD_REQUEST,A));return}S.send(n||null)})},i1=(A,e)=>{const{length:t}=A=A?A.filter(Boolean):[];if(e||t){let i=new AbortController,r;const n=function(c){if(!r){r=!0,o();const h=c instanceof Error?c:this.reason;i.abort(h instanceof tt?h:new br(h instanceof Error?h.message:h))}};let s=e&&setTimeout(()=>{s=null,n(new tt(`timeout of ${e}ms exceeded`,tt.ETIMEDOUT))},e);const o=()=>{A&&(s&&clearTimeout(s),s=null,A.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),A=null)};A.forEach(c=>c.addEventListener("abort",n));const{signal:l}=i;return l.unsubscribe=()=>de.asap(o),l}},r1=function*(A,e){let t=A.byteLength;if(t<e){yield A;return}let i=0,r;for(;i<t;)r=i+e,yield A.slice(i,r),i=r},n1=async function*(A,e){for await(const t of s1(A))yield*r1(t,e)},s1=async function*(A){if(A[Symbol.asyncIterator]){yield*A;return}const e=A.getReader();try{for(;;){const{done:t,value:i}=await e.read();if(t)break;yield i}}finally{await e.cancel()}},bh=(A,e,t,i)=>{const r=n1(A,e);let n=0,s,o=l=>{s||(s=!0,i&&i(l))};return new ReadableStream({async pull(l){try{const{done:c,value:h}=await r.next();if(c){o(),l.close();return}let m=h.byteLength;if(t){let v=n+=m;t(v)}l.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},xh=64*1024,{isFunction:Ln}=de,o1=(({Request:A,Response:e})=>({Request:A,Response:e}))(de.global),{ReadableStream:Qh,TextEncoder:Fh}=de.global,Uh=(A,...e)=>{try{return!!A(...e)}catch{return!1}},a1=A=>{A=de.merge.call({skipUndefined:!0},o1,A);const{fetch:e,Request:t,Response:i}=A,r=e?Ln(e):typeof fetch=="function",n=Ln(t),s=Ln(i);if(!r)return!1;const o=r&&Ln(Qh),l=r&&(typeof Fh=="function"?(F=>T=>F.encode(T))(new Fh):async F=>new Uint8Array(await new t(F).arrayBuffer())),c=n&&o&&Uh(()=>{let F=!1;const T=new t(eA.origin,{body:new Qh,method:"POST",get duplex(){return F=!0,"half"}}).headers.has("Content-Type");return F&&!T}),h=s&&o&&Uh(()=>de.isReadableStream(new i("").body)),m={stream:h&&(F=>F.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(F=>{!m[F]&&(m[F]=(T,S)=>{let I=T&&T[F];if(I)return I.call(T);throw new tt(`Response type '${F}' is not supported`,tt.ERR_NOT_SUPPORT,S)})});const v=async F=>{if(F==null)return 0;if(de.isBlob(F))return F.size;if(de.isSpecCompliantForm(F))return(await new t(eA.origin,{method:"POST",body:F}).arrayBuffer()).byteLength;if(de.isArrayBufferView(F)||de.isArrayBuffer(F))return F.byteLength;if(de.isURLSearchParams(F)&&(F=F+""),de.isString(F))return(await l(F)).byteLength},x=async(F,T)=>{const S=de.toFiniteNumber(F.getContentLength());return S??v(T)};return async F=>{let{url:T,method:S,data:I,signal:Q,cancelToken:N,timeout:J,onDownloadProgress:H,onUploadProgress:z,responseType:re,headers:q,withCredentials:ie="same-origin",fetchOptions:G}=Th(F),ne=e||fetch;re=re?(re+"").toLowerCase():"text";let le=i1([Q,N&&N.toAbortSignal()],J),ee=null;const we=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let j;try{if(z&&c&&S!=="get"&&S!=="head"&&(j=await x(q,I))!==0){let fe=new t(T,{method:"POST",body:I,duplex:"half"}),Qe;if(de.isFormData(I)&&(Qe=fe.headers.get("content-type"))&&q.setContentType(Qe),fe.body){const[me,xe]=Bh(j,En(yh(z)));I=bh(fe.body,xh,me,xe)}}de.isString(ie)||(ie=ie?"include":"omit");const ge=n&&"credentials"in t.prototype,ae={...G,signal:le,method:S.toUpperCase(),headers:q.normalize().toJSON(),body:I,duplex:"half",credentials:ge?ie:void 0};ee=n&&new t(T,ae);let pe=await(n?ne(ee,G):ne(T,ae));const ue=h&&(re==="stream"||re==="response");if(h&&(H||ue&&we)){const fe={};["status","statusText","headers"].forEach(Se=>{fe[Se]=pe[Se]});const Qe=de.toFiniteNumber(pe.headers.get("content-length")),[me,xe]=H&&Bh(Qe,En(yh(H),!0))||[];pe=new i(bh(pe.body,xh,me,()=>{xe&&xe(),we&&we()}),fe)}re=re||"text";let oe=await m[de.findKey(m,re)||"text"](pe,F);return!ue&&we&&we(),await new Promise((fe,Qe)=>{wh(fe,Qe,{data:oe,headers:pA.from(pe.headers),status:pe.status,statusText:pe.statusText,config:F,request:ee})})}catch(ge){throw we&&we(),ge&&ge.name==="TypeError"&&/Load failed|fetch/i.test(ge.message)?Object.assign(new tt("Network Error",tt.ERR_NETWORK,F,ee,ge&&ge.response),{cause:ge.cause||ge}):tt.from(ge,ge&&ge.code,F,ee,ge&&ge.response)}}},l1=new Map,Sh=A=>{let e=A&&A.env||{};const{fetch:t,Request:i,Response:r}=e,n=[i,r,t];let s=n.length,o=s,l,c,h=l1;for(;o--;)l=n[o],c=h.get(l),c===void 0&&h.set(l,c=o?new Map:a1(e)),h=c;return c};Sh();const Ro={http:Lm,xhr:A1,fetch:{get:Sh}};de.forEach(Ro,(A,e)=>{if(A){try{Object.defineProperty(A,"name",{value:e})}catch{}Object.defineProperty(A,"adapterName",{value:e})}});const Eh=A=>`- ${A}`,c1=A=>de.isFunction(A)||A===null||A===!1;function h1(A,e){A=de.isArray(A)?A:[A];const{length:t}=A;let i,r;const n={};for(let s=0;s<t;s++){i=A[s];let o;if(r=i,!c1(i)&&(r=Ro[(o=String(i)).toLowerCase()],r===void 0))throw new tt(`Unknown adapter '${o}'`);if(r&&(de.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
4
4
  `+s.map(Eh).join(`
5
5
  `):" "+Eh(s[0]):"as no adapter specified";throw new tt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const Lh={getAdapter:h1,adapters:Ro};function $o(A){if(A.cancelToken&&A.cancelToken.throwIfRequested(),A.signal&&A.signal.aborted)throw new br(null,A)}function Mh(A){return $o(A),A.headers=pA.from(A.headers),A.data=Go.call(A,A.transformRequest),["post","put","patch"].indexOf(A.method)!==-1&&A.headers.setContentType("application/x-www-form-urlencoded",!1),Lh.getAdapter(A.adapter||vr.adapter,A)(A).then(function(i){return $o(A),i.data=Go.call(A,A.transformResponse,i),i.headers=pA.from(i.headers),i},function(i){return mh(i)||($o(A),i&&i.response&&(i.response.data=Go.call(A,A.transformResponse,i.response),i.response.headers=pA.from(i.response.headers))),Promise.reject(i)})}const Hh="1.13.5",Mn={};["object","boolean","number","function","string","symbol"].forEach((A,e)=>{Mn[A]=function(i){return typeof i===A||"a"+(e<1?"n ":" ")+A}});const Ih={};Mn.transitional=function(e,t,i){function r(n,s){return"[Axios v"+Hh+"] Transitional option '"+n+"'"+s+(i?". "+i:"")}return(n,s,o)=>{if(e===!1)throw new tt(r(s," has been removed"+(t?" in "+t:"")),tt.ERR_DEPRECATED);return t&&!Ih[s]&&(Ih[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(n,s,o):!0}},Mn.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function u1(A,e,t){if(typeof A!="object")throw new tt("options must be an object",tt.ERR_BAD_OPTION_VALUE);const i=Object.keys(A);let r=i.length;for(;r-- >0;){const n=i[r],s=e[n];if(s){const o=A[n],l=o===void 0||s(o,n,A);if(l!==!0)throw new tt("option "+n+" must be "+l,tt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new tt("Unknown option "+n,tt.ERR_BAD_OPTION)}}const Hn={assertOptions:u1,validators:Mn},TA=Hn.validators;let Li=class{constructor(e){this.defaults=e||{},this.interceptors={request:new dh,response:new dh}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?n&&!String(i.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(i.stack+=`
6
- `+n):i.stack=n}catch{}}throw i}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ei(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:n}=t;i!==void 0&&Hn.assertOptions(i,{silentJSONParsing:TA.transitional(TA.boolean),forcedJSONParsing:TA.transitional(TA.boolean),clarifyTimeoutError:TA.transitional(TA.boolean),legacyInterceptorReqResOrdering:TA.transitional(TA.boolean)},!1),r!=null&&(de.isFunction(r)?t.paramsSerializer={serialize:r}:Hn.assertOptions(r,{encode:TA.function,serialize:TA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Hn.assertOptions(t,{baseUrl:TA.spelling("baseURL"),withXsrfToken:TA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&de.merge(n.common,n[t.method]);n&&de.forEach(["delete","get","head","post","put","patch","common"],F=>{delete n[F]}),t.headers=pA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(T){if(typeof T.runWhen=="function"&&T.runWhen(t)===!1)return;l=l&&T.synchronous;const S=t.transitional||Ko;S&&S.legacyInterceptorReqResOrdering?o.unshift(T.fulfilled,T.rejected):o.push(T.fulfilled,T.rejected)});const c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});let h,m=0,v;if(!l){const F=[Mh.bind(this),void 0];for(F.unshift(...o),F.push(...c),v=F.length,h=Promise.resolve(t);m<v;)h=h.then(F[m++],F[m++]);return h}v=o.length;let x=t;for(;m<v;){const F=o[m++],T=o[m++];try{x=F(x)}catch(S){T.call(this,S);break}}try{h=Mh.call(this,x)}catch(F){return Promise.reject(F)}for(m=0,v=c.length;m<v;)h=h.then(c[m++],c[m++]);return h}getUri(e){e=Ei(this.defaults,e);const t=Ch(e.baseURL,e.url,e.allowAbsoluteUrls);return ph(t,e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],function(e){Li.prototype[e]=function(t,i){return this.request(Ei(i||{},{method:e,url:t,data:(i||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function t(i){return function(n,s,o){return this.request(Ei(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Li.prototype[e]=t(),Li.prototype[e+"Form"]=t(!0)});let p1=class hf{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(n){t=n});const i=this;this.promise.then(r=>{if(!i._listeners)return;let n=i._listeners.length;for(;n-- >0;)i._listeners[n](r);i._listeners=null}),this.promise.then=r=>{let n;const s=new Promise(o=>{i.subscribe(o),n=o}).then(r);return s.cancel=function(){i.unsubscribe(n)},s},e(function(n,s,o){i.reason||(i.reason=new br(n,s,o),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=i=>{e.abort(i)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new hf(function(r){e=r}),cancel:e}}};function d1(A){return function(t){return A.apply(null,t)}}function f1(A){return de.isObject(A)&&A.isAxiosError===!0}const Xo={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(Xo).forEach(([A,e])=>{Xo[e]=A});function Ph(A){const e=new Li(A),t=eh(Li.prototype.request,e);return de.extend(t,Li.prototype,e,{allOwnKeys:!0}),de.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Ph(Ei(A,r))},t}const Bt=Ph(vr);Bt.Axios=Li,Bt.CanceledError=br,Bt.CancelToken=p1,Bt.isCancel=mh,Bt.VERSION=Hh,Bt.toFormData=Un,Bt.AxiosError=tt,Bt.Cancel=Bt.CanceledError,Bt.all=function(e){return Promise.all(e)},Bt.spread=d1,Bt.isAxiosError=f1,Bt.mergeConfig=Ei,Bt.AxiosHeaders=pA,Bt.formToJSON=A=>fh(de.isHTMLForm(A)?new FormData(A):A),Bt.getAdapter=Lh.getAdapter,Bt.HttpStatusCode=Xo,Bt.default=Bt;const{Axios:Yb,AxiosError:qb,CanceledError:jb,isCancel:ex,CancelToken:tx,VERSION:Ax,all:ix,Cancel:rx,isAxiosError:nx,spread:sx,toFormData:ox,AxiosHeaders:ax,HttpStatusCode:lx,formToJSON:cx,getAdapter:hx,mergeConfig:ux}=Bt,VA=Object.create(null);VA.open="0",VA.close="1",VA.ping="2",VA.pong="3",VA.message="4",VA.upgrade="5",VA.noop="6";const In=Object.create(null);Object.keys(VA).forEach(A=>{In[VA[A]]=A});const Jo={type:"error",data:"parser error"},Dh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_h=typeof ArrayBuffer=="function",kh=A=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(A):A&&A.buffer instanceof ArrayBuffer,Zo=({type:A,data:e},t,i)=>Dh&&e instanceof Blob?t?i(e):Oh(e,i):_h&&(e instanceof ArrayBuffer||kh(e))?t?i(e):Oh(new Blob([e]),i):i(VA[A]+(e||"")),Oh=(A,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+(i||""))},t.readAsDataURL(A)};function Nh(A){return A instanceof Uint8Array?A:A instanceof ArrayBuffer?new Uint8Array(A):new Uint8Array(A.buffer,A.byteOffset,A.byteLength)}let Yo;function g1(A,e){if(Dh&&A.data instanceof Blob)return A.data.arrayBuffer().then(Nh).then(e);if(_h&&(A.data instanceof ArrayBuffer||kh(A.data)))return e(Nh(A.data));Zo(A,!1,t=>{Yo||(Yo=new TextEncoder),e(Yo.encode(t))})}const Kh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let A=0;A<Kh.length;A++)xr[Kh.charCodeAt(A)]=A;const m1=A=>{let e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);const c=new ArrayBuffer(e),h=new Uint8Array(c);for(i=0;i<t;i+=4)n=xr[A.charCodeAt(i)],s=xr[A.charCodeAt(i+1)],o=xr[A.charCodeAt(i+2)],l=xr[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},w1=typeof ArrayBuffer=="function",qo=(A,e)=>{if(typeof A!="string")return{type:"message",data:zh(A,e)};const t=A.charAt(0);return t==="b"?{type:"message",data:B1(A.substring(1),e)}:In[t]?A.length>1?{type:In[t],data:A.substring(1)}:{type:In[t]}:Jo},B1=(A,e)=>{if(w1){const t=m1(A);return zh(t,e)}else return{base64:!0,data:A}},zh=(A,e)=>e==="blob"?A instanceof Blob?A:new Blob([A]):A instanceof ArrayBuffer?A:A.buffer,Vh="",y1=(A,e)=>{const t=A.length,i=new Array(t);let r=0;A.forEach((n,s)=>{Zo(n,!1,o=>{i[s]=o,++r===t&&e(i.join(Vh))})})},C1=(A,e)=>{const t=A.split(Vh),i=[];for(let r=0;r<t.length;r++){const n=qo(t[r],e);if(i.push(n),n.type==="error")break}return i};function v1(){return new TransformStream({transform(A,e){g1(A,t=>{const i=t.length;let r;if(i<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,i);else if(i<65536){r=new Uint8Array(3);const n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{r=new Uint8Array(9);const n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}A.data&&typeof A.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let jo;function Pn(A){return A.reduce((e,t)=>e+t.length,0)}function Dn(A,e){if(A[0].length===e)return A.shift();const t=new Uint8Array(e);let i=0;for(let r=0;r<e;r++)t[r]=A[0][i++],i===A[0].length&&(A.shift(),i=0);return A.length&&i<A[0].length&&(A[0]=A[0].slice(i)),t}function T1(A,e){jo||(jo=new TextDecoder);const t=[];let i=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(i===0){if(Pn(t)<1)break;const l=Dn(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?i=3:r===126?i=1:i=2}else if(i===1){if(Pn(t)<2)break;const l=Dn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),i=3}else if(i===2){if(Pn(t)<8)break;const l=Dn(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(Jo);break}r=h*Math.pow(2,32)+c.getUint32(4),i=3}else{if(Pn(t)<r)break;const l=Dn(t,r);o.enqueue(qo(n?l:jo.decode(l),e)),i=0}if(r===0||r>A){o.enqueue(Jo);break}}}})}const Wh=4;function kt(A){if(A)return b1(A)}function b1(A){for(var e in kt.prototype)A[e]=kt.prototype[e];return A}kt.prototype.on=kt.prototype.addEventListener=function(A,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+A]=this._callbacks["$"+A]||[]).push(e),this},kt.prototype.once=function(A,e){function t(){this.off(A,t),e.apply(this,arguments)}return t.fn=e,this.on(A,t),this},kt.prototype.off=kt.prototype.removeListener=kt.prototype.removeAllListeners=kt.prototype.removeEventListener=function(A,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+A];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+A],this;for(var i,r=0;r<t.length;r++)if(i=t[r],i===e||i.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+A],this},kt.prototype.emit=function(A){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+A],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(t){t=t.slice(0);for(var i=0,r=t.length;i<r;++i)t[i].apply(this,e)}return this},kt.prototype.emitReserved=kt.prototype.emit,kt.prototype.listeners=function(A){return this._callbacks=this._callbacks||{},this._callbacks["$"+A]||[]},kt.prototype.hasListeners=function(A){return!!this.listeners(A).length};const _n=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),bA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),x1="arraybuffer";function px(){}function Gh(A,...e){return e.reduce((t,i)=>(A.hasOwnProperty(i)&&(t[i]=A[i]),t),{})}const Q1=bA.setTimeout,F1=bA.clearTimeout;function kn(A,e){e.useNativeTimers?(A.setTimeoutFn=Q1.bind(bA),A.clearTimeoutFn=F1.bind(bA)):(A.setTimeoutFn=bA.setTimeout.bind(bA),A.clearTimeoutFn=bA.clearTimeout.bind(bA))}const U1=1.33;function S1(A){return typeof A=="string"?E1(A):Math.ceil((A.byteLength||A.size)*U1)}function E1(A){let e=0,t=0;for(let i=0,r=A.length;i<r;i++)e=A.charCodeAt(i),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(i++,t+=4);return t}function Rh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function L1(A){let e="";for(let t in A)A.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(A[t]));return e}function M1(A){let e={},t=A.split("&");for(let i=0,r=t.length;i<r;i++){let n=t[i].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class H1 extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class ea extends kt{constructor(e){super(),this.writable=!1,kn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,i){return super.emitReserved("error",new H1(e,t,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=qo(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=L1(e);return t.length?"?"+t:""}}class I1 extends ea{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};C1(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,y1(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Rh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let $h=!1;try{$h=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const P1=$h;function D1(){}class _1 extends I1{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let i=location.port;i||(i=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}class WA extends kt{constructor(e,t,i){super(),this.createRequest=e,kn(this,i),this._opts=i,this._method=i.method||"GET",this._uri=t,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;const t=Gh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(t);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&i.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var r;i.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=WA.requestsCount++,WA.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=D1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete WA.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(WA.requestsCount=0,WA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xh);else if(typeof addEventListener=="function"){const A="onpagehide"in bA?"pagehide":"unload";addEventListener(A,Xh,!1)}}function Xh(){for(let A in WA.requests)WA.requests.hasOwnProperty(A)&&WA.requests[A].abort()}const k1=(function(){const A=Jh({xdomain:!1});return A&&A.responseType!==null})();class O1 extends _1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=k1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new WA(Jh,this.uri(),e)}}function Jh(A){const e=A.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||P1))return new XMLHttpRequest}catch{}if(!e)try{return new bA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Zh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class N1 extends ea{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,i=Zh?{}:Gh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,i)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],r=t===e.length-1;Zo(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}r&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Rh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const ta=bA.WebSocket||bA.MozWebSocket;class K1 extends N1{createSocket(e,t,i){return Zh?new ta(e,t,i):t?new ta(e,t):new ta(e)}doWrite(e,t){this.ws.send(t)}}class z1 extends ea{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=T1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),r=v1();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{i.read().then(({done:o,value:l})=>{o||(this.onPacket(l),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],r=t===e.length-1;this._writer.write(i).then(()=>{r&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const V1={websocket:K1,webtransport:z1,polling:O1},W1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,G1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Aa(A){if(A.length>8e3)throw"URI too long";const e=A,t=A.indexOf("["),i=A.indexOf("]");t!=-1&&i!=-1&&(A=A.substring(0,t)+A.substring(t,i).replace(/:/g,";")+A.substring(i,A.length));let r=W1.exec(A||""),n={},s=14;for(;s--;)n[G1[s]]=r[s]||"";return t!=-1&&i!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=R1(n,n.path),n.queryKey=$1(n,n.query),n}function R1(A,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function $1(A,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,n){r&&(t[r]=n)}),t}const ia=typeof addEventListener=="function"&&typeof removeEventListener=="function",On=[];ia&&addEventListener("offline",()=>{On.forEach(A=>A())},!1);class ci extends kt{constructor(e,t){if(super(),this.binaryType=x1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const i=Aa(e);t.hostname=i.host,t.secure=i.protocol==="https"||i.protocol==="wss",t.port=i.port,i.query&&(t.query=i.query)}else t.host&&(t.hostname=Aa(t.host).host);kn(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(i=>{const r=i.prototype.name;this.transports.push(r),this._transportsByName[r]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=M1(this.opts.query)),ia&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},On.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Wh,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ci.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ci.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i<this.writeBuffer.length;i++){const r=this.writeBuffer[i].data;if(r&&(t+=S1(r)),i>0&&t>this._maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,_n(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,i){return this._sendPacket("message",e,t,i),this}send(e,t,i){return this._sendPacket("message",e,t,i),this}_sendPacket(e,t,i,r){if(typeof t=="function"&&(r=t,t=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const n={type:e,data:t,options:i};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(ci.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ia&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=On.indexOf(this._offlineEventListener);i!==-1&&On.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ci.protocol=Wh;class X1 extends ci{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),i=!1;ci.priorWebsocketSuccess=!1;const r=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ci.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function n(){i||(i=!0,h(),t.close(),t=null)}const s=m=>{const v=new Error("probe error: "+m);v.transport=t.name,n(),this.emitReserved("upgradeError",v)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const h=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}let J1=class extends X1{constructor(e,t={}){const i=typeof e=="object"?e:t;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(r=>V1[r]).filter(r=>!!r)),super(e,i)}};function Z1(A,e="",t){let i=A;t=t||typeof location<"u"&&location,A==null&&(A=t.protocol+"//"+t.host),typeof A=="string"&&(A.charAt(0)==="/"&&(A.charAt(1)==="/"?A=t.protocol+A:A=t.host+A),/^(https?|wss?):\/\//.test(A)||(typeof t<"u"?A=t.protocol+"//"+A:A="https://"+A),i=Aa(A)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+e,i.href=i.protocol+"://"+n+(t&&t.port===i.port?"":":"+i.port),i}const Y1=typeof ArrayBuffer=="function",q1=A=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(A):A.buffer instanceof ArrayBuffer,Yh=Object.prototype.toString,j1=typeof Blob=="function"||typeof Blob<"u"&&Yh.call(Blob)==="[object BlobConstructor]",ew=typeof File=="function"||typeof File<"u"&&Yh.call(File)==="[object FileConstructor]";function ra(A){return Y1&&(A instanceof ArrayBuffer||q1(A))||j1&&A instanceof Blob||ew&&A instanceof File}function Nn(A,e){if(!A||typeof A!="object")return!1;if(Array.isArray(A)){for(let t=0,i=A.length;t<i;t++)if(Nn(A[t]))return!0;return!1}if(ra(A))return!0;if(A.toJSON&&typeof A.toJSON=="function"&&arguments.length===1)return Nn(A.toJSON(),!0);for(const t in A)if(Object.prototype.hasOwnProperty.call(A,t)&&Nn(A[t]))return!0;return!1}function tw(A){const e=[],t=A.data,i=A;return i.data=na(t,e),i.attachments=e.length,{packet:i,buffers:e}}function na(A,e){if(!A)return A;if(ra(A)){const t={_placeholder:!0,num:e.length};return e.push(A),t}else if(Array.isArray(A)){const t=new Array(A.length);for(let i=0;i<A.length;i++)t[i]=na(A[i],e);return t}else if(typeof A=="object"&&!(A instanceof Date)){const t={};for(const i in A)Object.prototype.hasOwnProperty.call(A,i)&&(t[i]=na(A[i],e));return t}return A}function Aw(A,e){return A.data=sa(A.data,e),delete A.attachments,A}function sa(A,e){if(!A)return A;if(A&&A._placeholder===!0){if(typeof A.num=="number"&&A.num>=0&&A.num<e.length)return e[A.num];throw new Error("illegal attachments")}else if(Array.isArray(A))for(let t=0;t<A.length;t++)A[t]=sa(A[t],e);else if(typeof A=="object")for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&(A[t]=sa(A[t],e));return A}const iw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ct;(function(A){A[A.CONNECT=0]="CONNECT",A[A.DISCONNECT=1]="DISCONNECT",A[A.EVENT=2]="EVENT",A[A.ACK=3]="ACK",A[A.CONNECT_ERROR=4]="CONNECT_ERROR",A[A.BINARY_EVENT=5]="BINARY_EVENT",A[A.BINARY_ACK=6]="BINARY_ACK"})(ct||(ct={}));class rw{constructor(e){this.replacer=e}encode(e){return(e.type===ct.EVENT||e.type===ct.ACK)&&Nn(e)?this.encodeAsBinary({type:e.type===ct.EVENT?ct.BINARY_EVENT:ct.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ct.BINARY_EVENT||e.type===ct.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=tw(e),i=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(i),r}}class oa extends kt{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const i=t.type===ct.BINARY_EVENT;i||t.type===ct.BINARY_ACK?(t.type=i?ct.EVENT:ct.ACK,this.reconstructor=new nw(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(ra(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const i={type:Number(e.charAt(0))};if(ct[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ct.BINARY_EVENT||i.type===ct.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");i.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););i.nsp=e.substring(n,t)}else i.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const n=t+1;for(;++t;){const s=e.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===e.length)break}i.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(oa.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ct.CONNECT:return qh(t);case ct.DISCONNECT:return t===void 0;case ct.CONNECT_ERROR:return typeof t=="string"||qh(t);case ct.EVENT:case ct.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&iw.indexOf(t[0])===-1);case ct.ACK:case ct.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class nw{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Aw(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function qh(A){return Object.prototype.toString.call(A)==="[object Object]"}const sw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:oa,Encoder:rw,get PacketType(){return ct}},Symbol.toStringTag,{value:"Module"}));function HA(A,e,t){return A.on(e,t),function(){A.off(e,t)}}const ow=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class jh extends kt{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[HA(e,"open",this.onopen.bind(this)),HA(e,"packet",this.onpacket.bind(this)),HA(e,"error",this.onerror.bind(this)),HA(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var i,r,n;if(ow.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ct.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,m=t.pop();this._registerAckCallback(h,m),s.id=h}const o=(r=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var i;const r=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((i,r)=>{const n=(s,o)=>s?r(s):i(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ct.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ct.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ct.EVENT:case ct.BINARY_EVENT:this.onevent(e);break;case ct.ACK:case ct.BINARY_ACK:this.onack(e);break;case ct.DISCONNECT:this.ondisconnect();break;case ct.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let i=!1;return function(...r){i||(i=!0,t.packet({type:ct.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ct.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const i of t)i.apply(this,e.data)}}}function Ri(A){A=A||{},this.ms=A.min||100,this.max=A.max||1e4,this.factor=A.factor||2,this.jitter=A.jitter>0&&A.jitter<=1?A.jitter:0,this.attempts=0}Ri.prototype.duration=function(){var A=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*A);A=(Math.floor(e*10)&1)==0?A-t:A+t}return Math.min(A,this.max)|0},Ri.prototype.reset=function(){this.attempts=0},Ri.prototype.setMin=function(A){this.ms=A},Ri.prototype.setMax=function(A){this.max=A},Ri.prototype.setJitter=function(A){this.jitter=A};class aa extends kt{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,kn(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ri({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||sw;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new J1(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=HA(t,"open",function(){i.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=HA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(HA(e,"ping",this.onping.bind(this)),HA(e,"data",this.ondata.bind(this)),HA(e,"error",this.onerror.bind(this)),HA(e,"close",this.onclose.bind(this)),HA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){_n(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new jh(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;i<t.length;i++)this.engine.write(t[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Qr={};function Kn(A,e){typeof A=="object"&&(e=A,A=void 0),e=e||{};const t=Z1(A,e.path||"/socket.io"),i=t.source,r=t.id,n=t.path,s=Qr[r]&&n in Qr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new aa(i,e):(Qr[r]||(Qr[r]=new aa(i,e)),l=Qr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Kn,{Manager:aa,Socket:jh,io:Kn,connect:Kn});function la(A){if(!A)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(A,e),i=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${i}`}catch{return String(A).trim().replace(/\/+$/,"")}}let yA=la("http://localhost:8000");function eu(A){const e=la(A);e&&e!==yA&&(yA=e,Mt&&(Mt.disconnect(),Mt.removeAllListeners(),Mt=null))}let Mt=null;function aw(){const A=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=A();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:yA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=Kn(yA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),i=()=>{const r=A();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:yA,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",r=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:r,socketId:t.id})}),t.on("connect_error",r=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:r?.message,description:r?.description,context:r?.context,type:r?.type,baseUrl:yA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=i();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:yA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:yA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function ca(){const A=la(Mt?.io?.uri||null);return!Mt||Mt.io&&A&&yA&&A!==yA?(Mt&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:A,newBaseUrl:yA,wasConnected:Mt.connected,reason:"baseUrl changed"}),Mt.disconnect(),Mt.removeAllListeners(),Mt=null),Mt=aw()):Mt.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Mt.id,connected:Mt.connected,baseUrl:yA,uri:A}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Mt.id,baseUrl:yA}),Mt}function lw(A,e){const t=ca();return t.on(A,e),()=>t.off(A,e)}function cw(A,e){Mt&&Mt.off(A,e)}function hw(A,e){ca().emit(A,e)}function uw(){return Mt?Mt.connected?"connected":"connecting":"disconnected"}const zn={getSocket:ca,on:lw,off:cw,emit:hw,getStatus:uw,setBaseUrl:eu},pw={},tu=Y.createContext(),$t=()=>{const A=Y.useContext(tu);if(!A)throw new Error("useTrading must be used within TradingProvider");return A},dw=({children:A,baseUrl:e,endpoints:t,accountId:i,initialSymbol:r,initialTimeframe:n,indicators:s,indicatorSettings:o})=>{const l=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ys&&Ys.tagName.toUpperCase()==="SCRIPT"&&Ys.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&pw?.VITE_BASE_URL)??"http://localhost:5002";zn.setBaseUrl(l);const h={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},m=t?.params||{},[v,x]=Y.useState(r||"BTC/USD"),[F,T]=Y.useState(n||"M1"),[S,I]=Y.useState([]),[Q,N]=Y.useState(!0),[J,H]=Y.useState([]),[z,re]=Y.useState(!1),[q,ie]=Y.useState(1e5),[G,ne]=Y.useState(null),[le,ee]=Y.useState([]),[we,j]=Y.useState(!0),[ge,ae]=Y.useState(!1),[pe,ue]=Y.useState(!0),[oe,fe]=Y.useState("candles"),[Qe,me]=Y.useState(!1),[xe,Se]=Y.useState(null),[Me,$e]=Y.useState("dark"),[Ye,Ie]=Y.useState(null),[We,De]=Y.useState(!1),[Ze,nt]=Y.useState(!1),[dt,He]=Y.useState(!1),[zt,ye]=Y.useState(!1),[Te,ve]=Y.useState(!1),[be,Le]=Y.useState(!1),[Ee,Ke]=Y.useState(!1),[wt,Dt]=Y.useState(!1),[ni,ZA]=Y.useState(!1),[aA,si]=Y.useState(!1),[_A,YA]=Y.useState([]),Zt=Y.useRef(null),Yt=Y.useRef(new Map),Qt=Y.useRef(null),Lt=1e3,Ct=Y.useCallback(async()=>{if(i)try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;re(!0);const Ve=await Bt.get(`${l}/trades/account/${i}`,{headers:{Authorization:`Bearer ${ze}`}});let At=[];Array.isArray(Ve.data)?At=Ve.data:Ve.data?.data&&Array.isArray(Ve.data.data)&&(At=Ve.data.data);const st=At.filter(Ge=>Ge.closePrice===null||Ge.closePrice===void 0).map(Ge=>({id:Ge.id,ticket:23,symbol:Ge.symbol,type:Ge.type,volume:Ge.volume,openPrice:Ge.openPrice??Ge.price,stopLoss:Ge.stopLoss,takeProfit:Ge.takeProfit,comment:Ge.comment||"",status:"OPEN",swap:0,profit:Ge.profit||0,profitCurrency:"USD",time:new Date(Ge.openedAt||Ge.openAt||Date.now()).toLocaleTimeString(),openAt:Ge.openedAt||Ge.openAt,closeAt:Ge.closedAt||Ge.closeAt}));H(st)}catch(ze){console.error("❌ Error fetching orders:",ze.response?.data||ze.message),H([])}finally{re(!1)}},[l,i]),Ut=Y.useCallback((ze,Ve)=>!Ve||!ze.price||isNaN(Ve)||isNaN(ze.price)?ze.profit||0:(ze?.type?.toUpperCase()==="BUY"?Ve-ze.price:ze.price-Ve)*ze.volume,[]),Vt=Y.useCallback(async()=>{try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;const Ve=await Bt.get(`${l}${h.account}`,{headers:{Authorization:`Bearer ${ze}`}});if(Ve.data&&Ve.data.data){const At=parseFloat(Ve.data.data.balance);isNaN(At)||ie(At)}}catch(ze){console.error("❌ Error fetching user balance:",ze.response?.data||ze.message)}},[l]),je=Y.useCallback(async()=>{if(i)try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;const Ve=await Bt.get(`${l}/trades/account/${i}`,{headers:{Authorization:`Bearer ${ze}`}});let At=[];Array.isArray(Ve.data)?At=Ve.data:Ve.data?.data&&Array.isArray(Ve.data.data)&&(At=Ve.data.data);const st=At.filter(Ge=>Ge.closePrice!==null&&Ge.closePrice!==void 0).map(Ge=>({id:Ge.id,ticket:23,symbol:Ge.symbol,type:Ge.type,volume:Ge.volume,openPrice:Ge.openPrice??Ge.price,closePrice:Ge.closePrice,stopLoss:Ge.stopLoss,takeProfit:Ge.takeProfit,profit:Ge.profit??Ge.profitLoss??0,profitCurrency:"USD",openAt:Ge.openedAt||Ge.openAt,closeAt:Ge.closedAt||Ge.closeAt,closeReason:Ge.closeReason||"",status:"CLOSED"}));YA(st)}catch(ze){console.error("❌ Error fetching history orders:",ze.response?.data||ze.message),YA([])}},[l,i]),_e=Y.useMemo(()=>{const ze=q,Ve=J.reduce((at,Ne)=>at+Ne.volume*Ne.price*.01,0),At=J.reduce((at,Ne)=>{const Wt=S.find(lA=>lA.symbol===Ne.symbol);if(Wt){const lA=Ne.type?.toUpperCase()==="BUY"?parseFloat(Wt.bid||0):parseFloat(Wt.ask||0);if(lA&&lA>0&&!isNaN(lA))return at+Ut(Ne,lA)}return at+(Ne.profit||0)},0),st=ze+At,Ge=st-Ve,ft=Ve>0?st/Ve*100:0;return{balance:ze,equity:st,margin:Ve,freeMargin:Ge,level:ft.toFixed(2)}},[J,S,q,Ut]);Y.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&i&&(Ct(),Vt(),je())},[Ct,Vt,je,i]),Y.useEffect(()=>{(async()=>{try{N(!0);const Ve=h.symbols.includes("?")?`${l}${h.symbols}`:`${l}${h.symbols}`,At=localStorage.getItem("token")??localStorage.getItem("authToken"),st=await Bt.get(Ve,{headers:At?{Authorization:`Bearer ${At}`}:{}});let Ge=[];Array.isArray(st.data)?Ge=st.data:st.data&&st.data.data&&Array.isArray(st.data.data)?Ge=st.data.data:st.data&&st.data.prices&&Array.isArray(st.data.prices)?Ge=st.data.prices:st.data&&Array.isArray(st.data)&&(Ge=st.data);const ft=Ge.map(at=>{const Ne=at.symbol||at.name||"",Wt=at.category||null;return Ne&&(at.bid!==void 0||at.price!==void 0)?{symbol:Ne,bid:at.bid??at.price??0,ask:at.ask??at.price??0,change:at.change??0,category:Wt}:{...at,symbol:Ne,category:Wt}});ft.length>0?(I(ft),ft.find(Ne=>Ne.symbol===v)||x(ft[0].symbol)):I([])}catch(Ve){console.error("❌ Error fetching symbols:",Ve.response?.data||Ve.message),I([])}finally{N(!1)}})()},[l,h.symbols]);const Je=Y.useCallback(()=>{const ze=Yt.current;if(ze.size===0)return;const Ve=new Map(ze);ze.clear(),I(At=>At.map(st=>{const Ge=Ve.get(st.symbol);return Ge?{...st,...Ge}:st})),H(At=>{let st=!1;const Ge=At.map(ft=>{const at=Ve.get(ft.symbol);if(!at)return ft;const Ne=ft.type?.toUpperCase()==="BUY"?parseFloat(at.bid||0):parseFloat(at.ask||0);if(!Ne||isNaN(Ne)||Ne<=0)return ft;const Wt=Ut(ft,Ne);return Wt===ft.profit?ft:(st=!0,{...ft,profit:Wt})});return st?Ge:At})},[Ut]);Y.useEffect(()=>{Zt.current||(Zt.current=zn.getSocket());const ze=Zt.current,Ve=()=>{console.log("✅ TradingContext: Connected"),i&&Number.isFinite(Number(i))&&ze.emit("joinUserRoom",{userId:Number(i)})},At=()=>console.log("⚠️ TradingContext: Disconnected"),st=ft=>{ft?.symbol&&(Yt.current.set(ft.symbol,ft),Qt.current||(Qt.current=setTimeout(()=>{Qt.current=null,Je()},Lt)))},Ge=async ft=>{if(ft){if(ft.newBalance!==void 0){const at=parseFloat(ft.newBalance);isNaN(at)||ie(at)}if(window.notify){const at=ft.profitLoss||ft.profit||0,Ne=at>=0?`+${at.toFixed(2)}`:at.toFixed(2),Wt=ft.symbol||"Trade",lA=ft.reason||"Closed";window.notify(`Trade Closed: ${lA} | ${Wt} | P/L: ${Ne} USD`,at>=0?"success":"error")}ft.tradeId&&H(at=>at.filter(Ne=>Ne.id!==ft.tradeId)),await Ct(),await Vt()}};return ze.on("connect",Ve),ze.on("disconnect",At),ze.on("priceUpdate",st),ze.on("tradeClosed",Ge),ze.connected&&i&&Number.isFinite(Number(i))&&ze.emit("joinUserRoom",{userId:Number(i)}),()=>{ze.off("connect",Ve),ze.off("disconnect",At),ze.off("priceUpdate",st),ze.off("tradeClosed",Ge),Qt.current&&(clearTimeout(Qt.current),Qt.current=null),Yt.current.clear()}},[Je,Ct,Vt]),Y.useEffect(()=>{try{const ze=document.documentElement;if(!ze)return;ze.dataset.theme=Me}catch{}},[Me]);const et=Y.useMemo(()=>S.find(ze=>ze.symbol===v)||{bid:"0.00000",ask:"0.00000",change:0},[S,v]),bt=Y.useMemo(()=>({selectedSymbol:v,setSelectedSymbol:x,selectedTimeframe:F,setSelectedTimeframe:T,symbols:S,setSymbols:I,symbolsLoading:Q,orders:J,setOrders:H,ordersLoading:z,fetchOrders:Ct,fetchUserBalance:Vt,userBalance:q,setUserBalance:ie,accountSummary:_e,currentSymbolData:et,activeTool:G,setActiveTool:ne,chartObjects:le,setChartObjects:ee,showGrid:we,setShowGrid:j,snapToGrid:ge,setSnapToGrid:ae,drawingsVisible:pe,setDrawingsVisible:ue,chartType:oe,setChartType:fe,chartLocked:Qe,setChartLocked:me,selectedTradeForModify:xe,setSelectedTradeForModify:Se,theme:Me,setTheme:$e,candleColors:Ye,setCandleColors:Ie,showTradeOrders:We,setShowTradeOrders:De,showTradePosition:Ze,setShowTradePosition:nt,showTradeHistory:dt,setShowTradeHistory:He,showSLTP:zt,setShowSLTP:ye,showAskPrice:Te,setShowAskPrice:ve,showChartControls:be,setShowChartControls:Le,showTradeNotification:Ee,setShowTradeNotification:Ke,showCrosshair:wt,setShowCrosshair:Dt,showOHLC:ni,setShowOHLC:ZA,baseUrl:l,endpoints:h,endpointParams:m,accountId:i,isShow:aA,setIsShow:si,historyOrders:_A,setHistoryOrders:YA,fetchHistoryOrders:je,indicators:s,indicatorSettings:o}),[v,F,S,Q,J,z,Ct,Vt,q,_e,et,G,le,we,ge,pe,oe,Qe,xe,Me,Ye,We,Ze,dt,zt,Te,be,Ee,wt,ni,l,h,m,aA,_A,je,s,o]);return a.jsx(tu.Provider,{value:bt,children:A})};var Au={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},iu=Y.createContext&&Y.createContext(Au),fw=["attr","size","title"];function gw(A,e){if(A==null)return{};var t=mw(A,e),i,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(A);for(r=0;r<n.length;r++)i=n[r],!(e.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(A,i)&&(t[i]=A[i])}return t}function mw(A,e){if(A==null)return{};var t={};for(var i in A)if(Object.prototype.hasOwnProperty.call(A,i)){if(e.indexOf(i)>=0)continue;t[i]=A[i]}return t}function Vn(){return Vn=Object.assign?Object.assign.bind():function(A){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(A[i]=t[i])}return A},Vn.apply(this,arguments)}function ru(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(A,r).enumerable})),t.push.apply(t,i)}return t}function Wn(A){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ru(Object(t),!0).forEach(function(i){ww(A,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):ru(Object(t)).forEach(function(i){Object.defineProperty(A,i,Object.getOwnPropertyDescriptor(t,i))})}return A}function ww(A,e,t){return e=Bw(e),e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function Bw(A){var e=yw(A,"string");return typeof e=="symbol"?e:e+""}function yw(A,e){if(typeof A!="object"||!A)return A;var t=A[Symbol.toPrimitive];if(t!==void 0){var i=t.call(A,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(A)}function nu(A){return A&&A.map((e,t)=>Y.createElement(e.tag,Wn({key:t},e.attr),nu(e.child)))}function nA(A){return e=>Y.createElement(Cw,Vn({attr:Wn({},A.attr)},e),nu(A.child))}function Cw(A){var e=t=>{var{attr:i,size:r,title:n}=A,s=gw(A,fw),o=r||t.size||"1em",l;return t.className&&(l=t.className),A.className&&(l=(l?l+" ":"")+A.className),Y.createElement("svg",Vn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,i,s,{className:l,style:Wn(Wn({color:A.color||t.color},t.style),A.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Y.createElement("title",null,n),A.children)};return iu!==void 0?Y.createElement(iu.Consumer,null,t=>e(t)):e(Au)}function vw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(A)}function Tw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(A)}function bw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(A)}function xw(A){return nA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(A)}function su(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(A)}function Qw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(A)}function Fw(A){return nA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(A)}function Uw(A){return nA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(A)}function Sw(A){return nA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(A)}function Ew(A){return nA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(A)}const Lw={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ou=({bidPrice:A,askPrice:e,userAccountId:t,onTradeExecuted:i,onExecuteTrade:r,forceParentExecution:n=!1})=>{const{theme:s,selectedSymbol:o,fetchOrders:l,baseUrl:c,endpoints:h}=$t(),m=s==="light",[v,x]=Y.useState("0.01"),[F,T]=Y.useState(""),[S,I]=Y.useState(!1),Q=m?"bg-slate-100":"bg-[#12161d]",N=m?"text-slate-700":"text-white",J=m?"hover:bg-slate-200":"hover:bg-[#1e2635]",H=re=>{const q=parseFloat(v)||.01,ie=Math.max(.01,q+re);x(ie.toFixed(2))},z=async re=>{T("");const q=re,ie=parseFloat(q==="BUY"?e:A),G=parseFloat(v);if(!G||G<=0||isNaN(G)){T("Please enter a valid volume (minimum 0.01)");return}if(G<.01){T("Volume must be at least 0.01");return}if(!ie||ie<=0||isNaN(ie)){T("Invalid price. Please refresh and try again.");return}const ne=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ne){T("Please login to place trades");return}I(!0);const le=typeof o=="object"?o?.symbol:o;if(r){try{await Promise.resolve(r({symbol:le,type:q,lotSize:G,entryPrice:ie,stopLoss:null,takeProfit:null})),l&&l(),i&&i()}catch(we){const j=we?.message||"Trade execution failed";T(j)}finally{I(!1)}return}if(n){T("Trade handler not configured"),I(!1);return}const ee={accountId:t,symbol:le,type:q,volume:G,openPrice:ie,takeProfit:null,stopLoss:null};try{const we=c||Lw?.VITE_BASE_URL||"http://localhost:8000",j=h?.trades||"/api/trades",ge=await Bt.post(`${we}${j}`,ee,{headers:{Authorization:`Bearer ${ne}`,"Content-Type":"application/json"}});if(ge.status<200||ge.status>=300){T(ge.data?.message||`Failed to place trade (${ge.status})`);return}l&&l(),i&&i()}catch(we){const j=we?.response?.data?.message||we?.message||"Network error. Please try again.";T(j)}finally{I(!1)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[a.jsxs("button",{onClick:()=>z("SELL"),disabled:S,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:A?Number(A).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${Q}`,children:[a.jsx("button",{type:"button",onClick:()=>H(-.01),className:`w-5 flex items-center justify-center ${N} ${J} transition-colors`,children:a.jsx(su,{size:8})}),a.jsx("input",{type:"number",value:v,onChange:re=>{const q=re.target.value;(q===""||/^\d*\.?\d{0,2}$/.test(q))&&x(q)},onBlur:()=>{const re=parseFloat(v);x(isNaN(re)||re<.01?"0.01":re.toFixed(2))},className:`w-14 text-center focus:outline-none ${Q} ${N}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>H(.01),className:`w-5 flex items-center justify-center ${N} ${J} transition-colors`,children:a.jsx(Qw,{size:8})})]}),a.jsxs("button",{onClick:()=>z("BUY"),disabled:S,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),F&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:F})]})},Mw={},au=({isOpen:A,onClose:e,orderType:t,bidPrice:i,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:m,selectedTimeframe:v,setOrders:x,symbols:F,fetchOrders:T,theme:S,baseUrl:I,endpoints:Q}=$t(),N=S==="light",J={getContractSpec:be=>{const Le=String(be||"").toUpperCase();return Le.includes("BTC")||Le.includes("ETH")||Le.includes("SOL")||Le.includes("XRP")||Le.includes("ADA")||Le.includes("DOGE")||Le.includes("BNB")||Le.includes("AVAX")||Le.includes("DOT")||Le.includes("LINK")||Le.endsWith("USDT")?{contractSize:1}:Le.includes("XAU")||Le.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:be,volume:Le})=>{const Ee=J.getContractSpec(be);return(parseFloat(Le)||0)*(Ee.contractSize||1)}},H=h||J,[z,re]=Y.useState("0.01"),[q,ie]=Y.useState(""),[G,ne]=Y.useState(""),[le,ee]=Y.useState(""),[we,j]=Y.useState(!1),[ge,ae]=Y.useState(null),[pe,ue]=Y.useState(""),[oe,fe]=Y.useState(t||"BUY"),[Qe,me]=Y.useState(parseFloat(i)||0),[xe,Se]=Y.useState(parseFloat(r)||0),[Me,$e]=Y.useState("text-white"),[Ye,Ie]=Y.useState("text-white"),We=Y.useRef(parseFloat(i)||0),De=Y.useRef(parseFloat(r)||0);Y.useEffect(()=>{if(!A)return;const be=zn.getSocket(),Le=Ke=>{if(!(!Ke||!Ke.symbol)&&Ke.symbol.toUpperCase()===m?.toUpperCase()){const wt=parseFloat(Ke.bid)||0,Dt=parseFloat(Ke.ask)||0;wt>0&&(wt>We.current?($e("text-green-400"),setTimeout(()=>$e("text-white"),500)):wt<We.current&&We.current>0&&($e("text-red-400"),setTimeout(()=>$e("text-white"),500)),me(wt),We.current=wt),Dt>0&&(Dt>De.current?(Ie("text-green-400"),setTimeout(()=>Ie("text-white"),500)):Dt<De.current&&De.current>0&&(Ie("text-red-400"),setTimeout(()=>Ie("text-white"),500)),Se(Dt),De.current=Dt)}};be.on("priceUpdate",Le);const Ee=F.find(Ke=>Ke.symbol===m);if(Ee){const Ke=parseFloat(Ee.bid)||0,wt=parseFloat(Ee.ask)||0;Ke>0&&(me(Ke),We.current=Ke),wt>0&&(Se(wt),De.current=wt)}return()=>{be.off("priceUpdate",Le)}},[A,m,F]),Y.useEffect(()=>{if(A){re(o?String(o):"0.01"),ie(""),ne(""),ee(""),ue(""),fe(t||"BUY");const be=parseFloat(i)||0,Le=parseFloat(r)||0;be>0&&(me(be),We.current=be),Le>0&&(Se(Le),De.current=Le)}},[A,t,o]);const Ze=Qe||0,nt=xe||0,dt=be=>{const Le=parseFloat(z)||.01,Ee=Math.max(.01,Le+be);re(Ee.toFixed(2))},He=be=>{const Le=parseFloat(q)||0,Ee=parseFloat(oe==="BUY"?xe:Qe)||0;if(!Ee){ue("Current price not available. Please wait...");return}let Ke=Le+be;oe==="BUY"?Ke=Math.max(1e-5,Math.min(Ke,Ee-1e-5)):Ke=Math.max(Ee+1e-5,Ke),ie(Ke>0?Ke.toFixed(5):""),ue("")},zt=be=>{const Le=parseFloat(G)||0,Ee=parseFloat(oe==="BUY"?xe:Qe)||0;if(!Ee){ue("Current price not available. Please wait...");return}let Ke=Le+be;oe==="BUY"?Ke=Math.max(Ee+1e-5,Ke):Ke=Math.max(1e-5,Math.min(Ke,Ee-1e-5)),ne(Ke>0?Ke.toFixed(5):""),ue("")},ye=async be=>{ue("");const Le=be||oe,Ee=parseFloat(Le==="BUY"?xe:Qe),Ke=parseFloat(z),wt=q?parseFloat(q):null,Dt=G?parseFloat(G):null;if(!Ke||Ke<=0||isNaN(Ke)){ue("Please enter a valid volume (minimum 0.01)");return}if(Ke<.01){ue("Volume must be at least 0.01");return}if(!Ee||Ee<=0||isNaN(Ee)){ue("Invalid price. Please refresh and try again.");return}if(wt!==null&&wt!==""){if(isNaN(wt)||wt<=0){ue("Stop Loss must be a valid positive number");return}if(Le==="BUY"&&wt>=Ee){ue("Stop Loss must be below the current price for BUY orders");return}if(Le==="SELL"&&wt<=Ee){ue("Stop Loss must be above the current price for SELL orders");return}}if(Dt!==null&&Dt!==""){if(isNaN(Dt)||Dt<=0){ue("Take Profit must be a valid positive number");return}if(Le==="BUY"){if(Dt<=Ee){ue(`Take Profit must be above the entry price (${Ee.toFixed(5)}) for BUY orders`);return}}else if(Le==="SELL"&&Dt>=Ee){ue(`Take Profit must be below the entry price (${Ee.toFixed(5)}) for SELL orders`);return}}fe(Le),ae(Le),j(!0);const ni=new Date,ZA=ni.toLocaleTimeString(),aA=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,si=localStorage.getItem("token")??localStorage.getItem("authToken");if(!si){ue("Please login to place trades"),j(!1),ae(null);return}const _A={accountId:s,symbol:m,type:Le,volume:Ke,price:Ee,takeProfit:Dt,stopLoss:wt,comment:le.trim()||null},YA={ticket:aA.substring(0,8),symbol:m,type:Le,volume:parseFloat(Ke),price:parseFloat(Ee),time:ZA,stopLoss:wt?parseFloat(wt):null,takeProfit:Dt?parseFloat(Dt):null,swap:0,profit:0,profitCurrency:"USD",comment:le.trim()||"",id:aA,status:"OPEN",openAt:ni.toISOString()};if(!l&&x&&x(Zt=>[...Zt,YA]),c&&!n){ue("Execution handler is required in forceParentExecution mode"),j(!1),ae(null);return}if(n){j(!1),ae(null),e();const Zt={symbol:m,type:Le,lotSize:Ke,entryPrice:Ee,stopLoss:wt,takeProfit:Dt,comment:le.trim()||null};Promise.resolve(n(Zt)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),T&&T()}).catch(Yt=>{console.error("❌ Trade execution failed:",Yt),!l&&x&&x(Qt=>Qt.filter(Lt=>Lt.id!==aA))})}else{if(c){ue("Fallback API path disabled in forceParentExecution mode"),j(!1),ae(null);return}j(!1),ae(null),e();const Zt=I||Mw?.VITE_BASE_URL||"http://localhost:8000",Yt=Q?.trades||"/api/trades";Bt.post(`${Zt}${Yt}`,_A,{headers:{Authorization:`Bearer ${si}`,"Content-Type":"application/json"}}).then(Qt=>{if(Qt.data&&Qt.data.data){const Lt=Qt.data.data.trade;!l&&x&&x(Ct=>Ct.map(Ut=>Ut.id===aA?{...Ut,id:Lt.id,ticket:Lt.id.substring(0,8),time:ZA,openAt:Lt.openAt}:Ut)),console.log("✅ Trade saved successfully:",Lt),window.notify&&window.notify(`Trade placed successfully: ${Lt.symbol} ${Lt.type}`,"success")}else{!l&&x&&x(Ct=>Ct.filter(Ut=>Ut.id!==aA));const Lt=Qt.data?.message||"Failed to place trade";window.notify&&window.notify(Lt,"error")}}).catch(Qt=>{console.error("Error placing trade:",Qt),!l&&x&&x(Ct=>Ct.filter(Ut=>Ut.id!==aA));let Lt="Failed to place trade";if(Qt.response){const Ct=Qt.response.status,Ut=Qt.response.data;Ct===400?Lt=Ut?.message||"Invalid trade data. Please check your inputs.":Ct===401?Lt="Authentication failed. Please login again.":Ct===404?Lt=Ut?.message||"Symbol not found. Please select a valid symbol.":Ct===500?Lt="Server error. Please try again later.":Lt=Ut?.message||`Error: ${Ct}`}else Qt.request&&(Lt="Network error. Please check your internet connection.");window.notify&&window.notify(Lt,"error")})}},ve=(H?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return A?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${N?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${N?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${N?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${N?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${N?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[pe&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:pe}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[ve," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>dt(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:z,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d{0,2}$/.test(Le))&&(re(Le),ue(""))},onBlur:()=>{const be=parseFloat(z);re(isNaN(be)||be<.01?"0.01":be.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),a.jsx("button",{type:"button",onClick:()=>dt(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>He(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:q,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d*$/.test(Le))&&(ie(Le),ue(""))},onBlur:be=>{const Le=parseFloat(be.target.value);!isNaN(Le)&&Le>0?ie(Le.toFixed(5)):be.target.value===""&&ie("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>He(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>zt(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:G,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d*$/.test(Le))&&(ne(Le),ue(""))},onBlur:be=>{const Le=parseFloat(be.target.value);!isNaN(Le)&&Le>0?ne(Le.toFixed(5)):be.target.value===""&&ne("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>zt(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${N?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:le,onChange:be=>ee(be.target.value),placeholder:"Optional comment",rows:2,className:`w-full px-3 py-2 rounded text-sm focus:outline-none focus:border-secondary resize-none ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${N?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${Me} font-medium transition-colors duration-400`,children:Ze>0?Ze.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Ye} font-medium transition-colors duration-400`,children:nt>0?nt.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>ye("SELL"),disabled:we,className:"px-4 py-3 bg-rose-600 hover:bg-rose-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:we&&ge==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),a.jsx("button",{onClick:()=>ye("BUY"),disabled:we,className:"px-4 py-3 bg-sky-600 hover:bg-sky-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:we&&ge==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null},Hw={text:"Text",trendline:"Trend Line",parallellines:"Parallel Channel",fibonacci:"Fibonacci Retracement",rectangle:"Rectangle",pricelevel:"Horizontal Line",horizontalray:"Horizontal Ray",verticalline:"Vertical Line",infoline:"Info Line",rulerline:"Ruler Line",arrowedline:"Arrowed Line",rayline:"Ray",extendedline:"Extended Line",crossline:"Cross Line",trendbyangle:"Trend By Angle",disjointchannel:"Disjoint Channel",flattopbottom:"Flat Top/Bottom",regressionchannel:"Regression Channel",stddevchannel:"StdDev Channel",andrewspitchfork:"Andrew's Pitchfork",gannline:"Gann Line",gannfan:"Gann Fan",ganngrid:"Gann Grid",circle:"Circle",triangle:"Triangle",ellipse:"Ellipse",equidistantchannel:"Equidistant Channel"},Iw=[10,11,12,14,16,20,24,28,30,40],Gn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],hi={width:"78%",height:"78%",display:"block"},lu={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Pw(A){return A?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function Nt(A,e="#5f8f96"){if(typeof A!="string")return e;const t=A.trim();if(!t)return e;const i=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(i)?i.toLowerCase():e}const Dw=()=>a.jsx(Sw,{style:hi}),_w=()=>a.jsx(Ew,{style:hi}),kw=()=>a.jsx(xw,{style:hi}),Ow=()=>a.jsx(Uw,{style:hi}),Nw=()=>a.jsx(Tw,{style:hi}),Kw=()=>a.jsx(vw,{style:hi}),zw=()=>a.jsx(bw,{style:hi}),Vw=()=>a.jsx(su,{style:hi}),ha=({size:A,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:A,height:A},children:e});function Fr({checked:A,onClick:e,hideLeftBorder:t,tokens:i,children:r,title:n}){return a.jsx("button",{type:"button",onClick:e,title:n,style:{display:"flex",width:30,height:30,alignItems:"center",justifyContent:"center",border:`1px solid ${i.border}`,borderLeftWidth:t?0:1,background:A?i.activeFill:"transparent",color:A?i.activeText:i.text,cursor:"pointer",padding:0},children:a.jsx(ha,{size:"18px",children:r})})}function ke({checked:A,onChange:e,label:t,tokens:i,disabled:r=!1}){return a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:r?.5:1,cursor:r?"default":"pointer"},children:[a.jsx("input",{type:"checkbox",checked:A,onChange:n=>e(n.target.checked),disabled:r,style:lu}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${i.border}`,background:i.fieldBg},children:A&&a.jsx("span",{style:{width:10,height:10,background:i.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:i.text},children:t})]})}function ht({value:A,onChange:e,onBlur:t,disabled:i=!1,tokens:r}){const n=Nt(A,"#5f8f96"),s=(A||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:i?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:i?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:h=>e(h.target.value),disabled:i,style:{...lu,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:h=>{const m=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:i,style:c})]})}function mt({tokens:A,disabled:e=!1,style:t={},...i}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?A.fieldDisabledBg:A.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?A.fieldDisabledBg:A.fieldBg,color:e?A.fieldDisabledText:A.text,...t},...i})}function ui({value:A,onChange:e,tokens:t,disabled:i=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:A,onChange:e,disabled:i,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${i?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:i?t.fieldDisabledBg:t.fieldBg,color:i?t.fieldDisabledText:t.text,cursor:i?"default":"pointer",opacity:i?.5:1},children:n}),a.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(Vw,{})})]})}function Ww({draft:A,setDraft:e,tokens:t}){const i=A.visibleTimeframes?.length===Gn.length,r=()=>{e(s=>({...s,visibleTimeframes:i?[]:Gn.map(o=>o.key)}))},n=s=>{e(o=>{const l=o.visibleTimeframes||[];return{...o,visibleTimeframes:l.includes(s)?l.filter(c=>c!==s):[...l,s]}})};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsx(ke,{checked:i,onChange:r,label:"Show on all the timeframes",tokens:t}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:Gn.map(s=>a.jsx(ke,{checked:(A.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:i},s.key))})]})}function Gw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{i(n,Nt(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.color||"#5f8f96",onChange:n=>i("color",n),onBlur:()=>r("color",A.color,"#5f8f96"),tokens:t}),a.jsx(ui,{value:A.fontSize||12,onChange:n=>i("fontSize",Number(n.target.value)),tokens:t,width:84,children:Iw.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Fr,{checked:A.fontWeight==="bold",onClick:()=>i("fontWeight",A.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(kw,{})}),a.jsx(Fr,{checked:A.fontStyle==="italic",onClick:()=>i("fontStyle",A.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Ow,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Fr,{checked:A.textAlign==="left",onClick:()=>i("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(Nw,{})}),a.jsx(Fr,{checked:A.textAlign==="center",onClick:()=>i("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Kw,{})}),a.jsx(Fr,{checked:A.textAlign==="right",onClick:()=>i("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(zw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(ke,{checked:!!A.textWrap,onChange:n=>i("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(ke,{checked:!!A.borderEnabled,onChange:n=>i("borderEnabled",n),label:"Border",tokens:t}),a.jsx(ht,{value:A.borderColor||"#5f8f96",onChange:n=>i("borderColor",n),onBlur:()=>r("borderColor",A.borderColor,"#5f8f96"),disabled:!A.borderEnabled,tokens:t}),a.jsx(mt,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!A.borderEnabled,value:A.borderOpacity??.1,onChange:n=>i("borderOpacity",Number(n.target.value))}),a.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!A.borderEnabled,value:A.borderWidth??1,onChange:n=>i("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:A.borderWidth??1})]}),a.jsx(ke,{checked:!!A.bgEnabled,onChange:n=>i("bgEnabled",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.bgColor||"#5f8f96",onChange:n=>i("bgColor",n),onBlur:()=>r("bgColor",A.bgColor,"#5f8f96"),disabled:!A.bgEnabled,tokens:t}),a.jsx(mt,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!A.bgEnabled,value:A.bgOpacity??.1,onChange:n=>i("bgOpacity",Number(n.target.value))}),a.jsx("div",{})]}),a.jsx("textarea",{value:A.text||"",onChange:n=>i("text",n.target.value),placeholder:"Your text",rows:4,style:{width:"100%",resize:"none",border:`1px solid ${t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text}})]})}function Rw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#7aa6ae",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Rn({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#22c55e",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsAngle,onChange:n=>i("statsAngle",n),label:"Angle",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function $w({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showArea!==!1,onChange:n=>i("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function Xw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsAngle,onChange:n=>i("statsAngle",n),label:"Angle",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Jw({draft:A,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:i=>{const r=Number(i.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function dA(A){if(!A)return"";const e=new Date(A*1e3),t=i=>String(i).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function xA({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:n}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:n}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]})]})}function cu({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=!A.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:s=>i("lineColor",s),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:s=>i("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showPrice!==!1,onChange:s=>i("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(ke,{checked:!!A.showText,onChange:s=>i("showText",s),label:"Show text",tokens:t}),a.jsx(ht,{value:A.textColor||"#ffffff",onChange:s=>i("textColor",s),onBlur:()=>r("textColor",A.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(ui,{value:A.textHAlign??"center",onChange:s=>i("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(ui,{value:A.textVAlign??"top",onChange:s=>i("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:A.textContent||"",onChange:s=>i("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function Zw({draft:A,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"Price"}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:i=>{const r=Number(i.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Yw({draft:A,setDraft:e,tokens:t}){const i={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.originTime),style:r}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function qw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showDate!==!1,onChange:n=>i("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function jw({draft:A,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.rawTime),style:t})]})})}function eB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#7aa6ae",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function tB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#06a0e3",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:!!A.showTime,onChange:n=>i("showTime",n),label:"Show time",tokens:t}),a.jsx(ke,{checked:!!A.showPrice,onChange:n=>i("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function AB({draft:A,setDraft:e,tokens:t}){const i={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.rawTime),style:r}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function iB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=(s,o,l,c,h,m)=>a.jsxs(a.Fragment,{children:[a.jsx(ke,{checked:!!A[h],onChange:v=>i(h,v),label:s,tokens:t}),a.jsx(ht,{value:A[o]||m,onChange:v=>i(o,v),onBlur:()=>r(o,A[o],m),tokens:t}),a.jsx(mt,{tokens:t,value:A[l]??.35,onChange:v=>{const x=parseFloat(v.target.value);Number.isFinite(x)&&i(l,Math.max(0,Math.min(1,x)))},style:{width:60}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A[c]??1,onChange:v=>i(c,Number(v.target.value)),style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A[c]??1})]})]});return a.jsxs("div",{style:{padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr auto 2fr",gap:14,marginBottom:14},children:[n("Base line","baseLineColor","baseLineOpacity","baseLineWidth","showBaseLine","#ff0000"),n("Upper line","upperLineColor","upperLineOpacity","upperLineWidth","showUpperLine","#0000ff"),n("Lower line","lowerLineColor","lowerLineOpacity","lowerLineWidth","showLowerLine","#0000ff")]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:s=>i("showBackground",s),label:"Background",tokens:t}),a.jsx("span",{style:{fontSize:12,color:t.text},children:"Opacity"}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:70},children:"Extension"}),a.jsx(ke,{checked:!!A.extendLeft,onChange:s=>i("extendLeft",s),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.extendRight,onChange:s=>i("extendRight",s),label:"Right",tokens:t})]}),a.jsx(ke,{checked:!!A.showPearsonsR,onChange:s=>i("showPearsonsR",s),label:"Show Pearson's R",tokens:t})]})]})}function rB({draft:A,tokens:e}){const t={height:30,width:"100%",border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText},i={display:"grid",gridTemplateColumns:"100px 1fr",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:t})]}),a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:e.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:t})]})]})}function nB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.strokeColor||"#8b5cf6",onChange:n=>i("strokeColor",n),onBlur:()=>r("strokeColor",A.strokeColor,"#8b5cf6"),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??1,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr auto 2fr",gap:14},children:[a.jsx(ke,{checked:!!A.showMiddleLine,onChange:n=>i("showMiddleLine",n),label:"Middle line",tokens:t}),a.jsx(ht,{value:A.middleLineColor||"#8b5cf6",onChange:n=>i("middleLineColor",n),onBlur:()=>r("middleLineColor",A.middleLineColor,"#8b5cf6"),tokens:t,disabled:!A.showMiddleLine}),a.jsx(mt,{tokens:t,disabled:!A.showMiddleLine,value:A.middleLineOpacity??.5,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("middleLineOpacity",Math.max(0,Math.min(1,s)))},style:{width:60}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.middleLineWidth??1,onChange:n=>i("middleLineWidth",Number(n.target.value)),disabled:!A.showMiddleLine,style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.middleLineWidth??1})]}),a.jsx(ke,{checked:!!A.showBackground,onChange:n=>i("showBackground",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.backgroundColor||"#b4a7d6",onChange:n=>i("backgroundColor",n),onBlur:()=>r("backgroundColor",A.backgroundColor,"#b4a7d6"),tokens:t,disabled:!A.showBackground}),a.jsx(mt,{tokens:t,disabled:!A.showBackground,value:A.backgroundOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("backgroundOpacity",Math.max(0,Math.min(1,s)))},style:{width:60}}),a.jsx("div",{})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]})]})}function sB({draft:A,setDraft:e,tokens:t}){const i=(o,l)=>{const c=parseFloat(l);Number.isFinite(c)&&e(h=>({...h,[o]:c}))},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText},n={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},s={display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:r}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:o=>i("point1Price",o.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:r}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:o=>i("point2Price",o.target.value)})]}),a.jsxs("div",{style:s,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:o=>i("point3Price",o.target.value)})]})]})}function oB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>e(c=>{const h=c.rays?[...c.rays]:[];return h[s]={...h[s],[o]:l},{...c,rays:h}}),n=[...A.rays??[]].reverse();return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsx("div",{style:{display:"grid",gridTemplateColumns:"60px 1fr 2fr 1fr",gap:8,alignItems:"center"},children:n.map((s,o)=>{const l=(A.rays??[]).findIndex(c=>c.ratio===s.ratio);return a.jsxs(Y.Fragment,{children:[a.jsx(mt,{tokens:t,value:s.label,onChange:c=>{const h=parseFloat(c.target.value);Number.isFinite(h)&&h>0&&r(l,"ratio",h),r(l,"label",c.target.value)},onBlur:c=>{const h=parseFloat(c.target.value);Number.isFinite(h)&&h>0&&(r(l,"ratio",h),r(l,"label",h%1===0?h.toFixed(2):String(h)))},style:{width:60}}),a.jsx(ht,{value:s.color||"#888888",onChange:c=>r(l,"color",c),onBlur:()=>r(l,"color",Nt(s.color,"#888888")),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:s.width??1,onChange:c=>r(l,"width",Number(c.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:s.width??1})]}),a.jsx("div",{})]},o)})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.backgroundColor||"#3b82f6",onChange:s=>i("backgroundColor",s),onBlur:()=>i("backgroundColor",Nt(A.backgroundColor,"#3b82f6")),tokens:t}),a.jsx("span",{style:{fontSize:12,color:t.text},children:"Background"}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:60}})]}),a.jsx(ke,{checked:!!A.showLabels,onChange:s=>i("showLabels",s),label:"Show labels",tokens:t})]})}function aB({draft:A,setDraft:e,tokens:t}){const i=(r,n)=>e(s=>({...s,[r]:n}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Divisions"}),a.jsx(mt,{tokens:t,value:A.divisions??8,min:2,max:50,step:1,onChange:r=>i("divisions",Number(r.target.value)),onBlur:r=>i("divisions",Math.max(2,Math.min(50,parseInt(r.target.value)||8))),style:{width:60}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Line color"}),a.jsx(ht,{value:A.lineColor??"#94a3b8",onChange:r=>i("lineColor",r),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Line width"}),a.jsx("input",{type:"range",min:1,max:5,step:1,value:A.lineWidth??1,onChange:r=>i("lineWidth",Number(r.target.value)),style:{flex:1}}),a.jsx("span",{style:{fontSize:11,color:t.mutedText,minWidth:16,textAlign:"right"},children:A.lineWidth??1})]}),a.jsx(ke,{label:"Show background",checked:A.showBackground!==!1,onChange:r=>i("showBackground",r),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Background"}),a.jsx(ht,{value:A.backgroundColor??"#3b82f6",onChange:r=>i("backgroundColor",r),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.08,min:0,max:1,step:.01,onChange:r=>i("backgroundOpacity",parseFloat(r.target.value)||0),onBlur:r=>i("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(r.target.value)||0))),style:{width:60}})]})]})}function lB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=(s,o,l)=>e(c=>{const h=c.levels?[...c.levels]:[];return h[s]={...h[s],[o]:l},{...c,levels:h}});return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.medianColor||"#a50000",onChange:s=>i("medianColor",s),onBlur:()=>r("medianColor",A.medianColor,"#a50000"),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.medianWidth??1,onChange:s=>i("medianWidth",Number(s.target.value)),style:{flex:1,width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.medianWidth??1})]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"auto 40px 1fr 2fr",gap:8,alignItems:"center"},children:(A.levels??[]).map((s,o)=>a.jsxs(Y.Fragment,{children:[a.jsx("input",{type:"checkbox",checked:!!s.enabled,onChange:l=>n(o,"enabled",l.target.checked),style:{accentColor:t.headerBlue,margin:0}}),a.jsx("span",{style:{fontSize:12,color:t.text},children:s.label}),a.jsx(ht,{value:s.color||"#888888",onChange:l=>n(o,"color",l),onBlur:()=>n(o,"color",Nt(s.color,"#888888")),tokens:t,disabled:!s.enabled}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:s.width??1,onChange:l=>n(o,"width",Number(l.target.value)),disabled:!s.enabled,style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:s.width??1})]})]},s.k))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:s=>i("showBackground",s),label:"Background",tokens:t}),a.jsx(mt,{tokens:t,disabled:!A.showBackground,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:60}})]})]})}function cB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=parseFloat(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText},n={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:r}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:r}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point3Time),style:r}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:s=>i("point3Price",s.target.value)})]})]})}function ua({draft:A,setDraft:e,tokens:t,strokeDefault:i="#7aa6ae",bgDefault:r="#b4a7d6"}){const n=(s,o)=>e(l=>({...l,[s]:o}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.strokeColor||i,onChange:s=>n("strokeColor",s),onBlur:()=>n("strokeColor",Nt(A.strokeColor,i)),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??1,onChange:s=>n("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{fontSize:12,color:t.text,minWidth:12,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:A.showBackground!==!1,onChange:s=>n("showBackground",s),label:"Background",tokens:t}),a.jsx(ht,{value:A.backgroundColor||r,onChange:s=>n("backgroundColor",s),onBlur:()=>n("backgroundColor",Nt(A.backgroundColor,r)),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,min:0,max:1,step:.01,onChange:s=>n("backgroundOpacity",parseFloat(s.target.value)||0),onBlur:s=>n("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(s.target.value)||0))),style:{width:60}})]})]})}function hB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function uB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function pB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function dB({draft:A,setDraft:e,tokens:t}){const i=(h,m)=>e(v=>({...v,[h]:m})),r=h=>{if(!h)return"";const m=new Date(h*1e3),v=String(m.getUTCDate()).padStart(2,"0"),x=String(m.getUTCMonth()+1).padStart(2,"0"),F=m.getUTCFullYear(),T=String(m.getUTCHours()).padStart(2,"0"),S=String(m.getUTCMinutes()).padStart(2,"0"),I=String(m.getUTCSeconds()).padStart(2,"0");return`${v}.${x}.${F} ${T}:${S}:${I}`},n={display:"grid",gridTemplateColumns:"110px 1fr 100px",gap:8,alignItems:"center",marginBottom:6},s={fontSize:12,color:t.mutedText},o={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 6px",fontSize:12,background:t.fieldDisabledBg,color:t.fieldDisabledText,boxSizing:"border-box"},l={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 6px",fontSize:12,background:t.fieldBg,color:t.text,boxSizing:"border-box",outline:"none"},c=[{label:"#1 (Bar, Price)",timeKey:"point1Time",priceKey:"point1Price"},{label:"#2 (Bar, Price)",timeKey:"point2Time",priceKey:"point2Price"},{label:"#3 (Bar, Price)",timeKey:"point3Time",priceKey:"point3Price"}];return a.jsx("div",{style:{padding:"12px 16px"},children:c.map(({label:h,timeKey:m,priceKey:v})=>a.jsxs("div",{style:n,children:[a.jsx("span",{style:s,children:h}),a.jsx("input",{style:o,value:r(A[m]),readOnly:!0}),a.jsx("input",{type:"number",style:l,value:A[v]??0,step:"0.00001",onChange:x=>i(v,parseFloat(x.target.value)||0)})]},h))})}function fB({draft:A,setDraft:e,tokens:t}){const i=(r,n)=>e(s=>({...s,[r]:n}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ht,{value:A.strokeColor??"#7aa6ae",onChange:r=>i("strokeColor",r),tokens:t}),a.jsx("input",{type:"range",min:1,max:5,step:1,value:A.lineWidth??1,onChange:r=>i("lineWidth",Number(r.target.value)),style:{flex:1}}),a.jsx("span",{style:{fontSize:11,color:t.mutedText,minWidth:16,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ke,{label:"Background",checked:A.showBackground!==!1,onChange:r=>i("showBackground",r),tokens:t}),a.jsx(ht,{value:A.backgroundColor??"#94a3b8",onChange:r=>i("backgroundColor",r),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.18,min:0,max:1,step:.01,onChange:r=>i("backgroundOpacity",r),onBlur:r=>i("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(r)||0))),style:{width:60}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[a.jsx("span",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Extension"}),a.jsx(ke,{label:"Left",checked:!!A.extendLeft,onChange:r=>i("extendLeft",r),tokens:t}),a.jsx(ke,{label:"Right",checked:!!A.extendRight,onChange:r=>i("extendRight",r),tokens:t})]})]})}function gB({draft:A,tokens:e}){const t=[{label:"#1 (Bar, Price)",time:A.point1Time,price:A.point1Price},{label:"#2 (Bar, Price)",time:A.point1Time,price:A.point4Price},{label:"#3 (Bar, Price)",time:A.point2Time,price:A.point1Price},{label:"#4 (Bar, Price)",time:A.point2Time,price:A.point4Price}],i={height:28,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 6px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText},r={height:28,width:80,border:`1px solid ${e.fieldBorder}`,padding:"0 6px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"12px 16px"},children:t.map((n,s)=>a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"110px 1fr 80px",alignItems:"center",gap:6},children:[a.jsx("span",{style:{fontSize:12,color:e.mutedText},children:n.label}),a.jsx("input",{readOnly:!0,value:n.time?new Date(n.time*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).replace(",",""):"—",style:i}),a.jsx("input",{readOnly:!0,value:n.price!=null?Number(n.price).toFixed(5):"—",style:r})]},s))})}function hu({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#129f5c",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:n=>i("showBackground",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.fillColor||"#6aa84f",onChange:n=>i("fillColor",n),onBlur:()=>r("fillColor",A.fillColor,"#6aa84f"),tokens:t}),a.jsx(mt,{tokens:t,value:A.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showPrices,onChange:n=>i("showPrices",n),label:"Prices",tokens:t}),a.jsx(ht,{value:A.pricesColor||"#129f5c",onChange:n=>i("pricesColor",n),onBlur:()=>r("pricesColor",A.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]})]})}function uu({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:n}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:n}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:s=>i("point3Price",s.target.value)})]})]})}function mB(A){if(!A)return{};const e={visibleTimeframes:A.visibleTimeframes||Gn.map(t=>t.key)};if(A.type==="gannline"){const t=typeof A.series?.options=="function"?A.series.options():{};return{...e,lineColor:t.color??A.lineColor??"#7aa6ae",lineWidth:t.lineWidth??A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsDistance:A.statsDistance??!1,point1Price:A.point1?.price??0,point1Time:A.point1?.rawTime??A.point1?.time??0,point2Price:A.point2?.price??0,point2Time:A.point2?.rawTime??A.point2?.time??0}}if(A.type==="trendline"){const t=typeof A.series?.options=="function"?A.series.options():{};return{...e,lineColor:t.color??A.lineColor??"#22c55e",lineWidth:t.lineWidth??A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.point1?.price??0,point1Time:A.point1?.rawTime??A.point1?.time??0,point2Price:A.point2?.price??0,point2Time:A.point2?.rawTime??A.point2?.time??0}}if(A.type==="text")return{...e,text:A.primitive?.text??A.text??"Text",color:A.primitive?.color??"#5f8f96",fontSize:A.primitive?.fontSize??12,fontWeight:A.primitive?.fontWeight??"normal",fontStyle:A.primitive?.fontStyle??"normal",textAlign:A.primitive?.textAlign??"center",textWrap:A.primitive?.textWrap??!1,borderEnabled:A.primitive?.borderEnabled??!1,borderColor:A.primitive?.borderColor??"#5f8f96",borderOpacity:A.primitive?.borderOpacity??.1,borderWidth:A.primitive?.borderWidth??1,bgEnabled:A.primitive?.bgEnabled??!1,bgColor:A.primitive?.bgColor??"#5f8f96",bgOpacity:A.primitive?.bgOpacity??.1,price:A.price};if(A.type==="pricelevel")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showPrice:A.showPrice??!0,showText:A.showText??!1,textContent:A.textContent??"",textColor:A.textColor??"#ffffff",textHAlign:A.textHAlign??"center",textVAlign:A.textVAlign??"top",price:A.price};if(A.type==="horizontalray")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showPrice:A.showPrice??!0,showText:A.showText??!1,textContent:A.textContent??"",textColor:A.textColor??"#ffffff",textHAlign:A.textHAlign??"center",textVAlign:A.textVAlign??"top",price:A.price,originTime:A.rawOriginTime??A.originTime};if(A.type==="verticalline")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showDate:A.showDate!==!1,rawTime:A.rawTime};if(A.type==="infoline")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!0,statsPriceRange:A.statsPriceRange??!0,statsBarsRange:A.statsBarsRange??!0,statsDateRange:A.statsDateRange??!0,statsAngle:A.statsAngle??!0,statsDistance:A.statsDistance??!0,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="arrowedline")return{...e,lineColor:A.lineColor??"#f59e0b",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight!==!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="rayline")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="extendedline")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft!==!1,rayRight:A.rayRight!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="crossline")return{...e,lineColor:A.lineColor??"#06a0e3",lineWidth:A.lineWidth??2,showTime:A.showTime??!1,showPrice:A.showPrice??!1,rawTime:A.p?.rawTime??0,price:A.p?.price??0};if(A.type==="trendbyangle")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="disjointchannel")return{...e,lineColor:A.lineColor??"#129f5c",lineWidth:A.lineWidth??2,fillColor:A.fillColor??"#6aa84f",fillOpacity:A.fillOpacity??.1,showBackground:A.showBackground!==!1,showPrices:A.showPrices!==!1,pricesColor:A.pricesColor??"#129f5c",rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p3?.price??0,point2Time:A.p3?.rawTime??0,point3Price:A.p2?.price??0};if(A.type==="flattopbottom")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,fillColor:A.fillColor??"#3b82f6",fillOpacity:A.fillOpacity??.12,showBackground:A.showBackground!==!1,showPrices:A.showPrices!==!1,pricesColor:A.pricesColor??"#3b82f6",rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p3?.price??0,point2Time:A.p3?.rawTime??0,point3Price:A.p2?.price??0};if(A.type==="gannfan"){const t=A.primitive,i=[{ratio:.125,label:"0.13",color:"#a06b00",width:1},{ratio:.25,label:"0.25",color:"#699e00",width:1},{ratio:.333333,label:"0.30",color:"#009b00",width:1},{ratio:.5,label:"0.50",color:"#009965",width:1},{ratio:1,label:"1.00",color:"#808080",width:1},{ratio:2,label:"2.00",color:"#006599",width:1},{ratio:3,label:"3.00",color:"#000099",width:1},{ratio:4,label:"4.00",color:"#660099",width:1},{ratio:8,label:"8.00",color:"#a50000",width:1}],r=A.rays??(t?._rays?t._rays.map(n=>({...n})):i);return{...e,rays:r,showLabels:t?t.showLabels??!0:A.showLabels??!0,backgroundColor:t?.backgroundColor??A.backgroundColor??"#3b82f6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}}if(A.type==="ganngrid"){const t=A.primitive;return{...e,divisions:t?.divisions??A.divisions??8,lineColor:t?.lineColor??A.lineColor??"#94a3b8",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#3b82f6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.08,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}}if(A.type==="triangle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0,point3Time:A.p3?.rawTime??0,point3Price:A.p3?.price??0}}if(A.type==="circle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0}}if(A.type==="ellipse"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0}}if(A.type==="rectangle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#94a3b8",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.18,extendLeft:t?.extendLeft??A.extendLeft??!1,extendRight:t?.extendRight??A.extendRight??!1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point4Price:A.p2?.price??0}}return A.type==="andrewspitchfork"?{...e,medianColor:A.medianColor??"#a50000",medianWidth:A.medianWidth??1,showBackground:A.showBackground!==!1,backgroundOpacity:A.backgroundOpacity??.1,levels:A.levels??[{k:.25,label:"0.25",color:"#a06b00",width:1,enabled:!0},{k:.38,label:"0.38",color:"#699e00",width:1,enabled:!0},{k:.5,label:"0.50",color:"#009b00",width:1,enabled:!0},{k:.62,label:"0.62",color:"#009965",width:1,enabled:!0},{k:.75,label:"0.75",color:"#006599",width:1,enabled:!0},{k:1,label:"1.00",color:"#000099",width:1,enabled:!0},{k:1.5,label:"1.50",color:"#660099",width:1,enabled:!0},{k:1.75,label:"1.75",color:"#990066",width:1,enabled:!0},{k:2,label:"2.00",color:"#a50000",width:1,enabled:!0}],point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0,point3Time:A.p3?.rawTime??0,point1Price:A.p1?.price??0,point2Price:A.p2?.price??0,point3Price:A.p3?.price??0}:A.type==="equidistantchannel"?{...e,strokeColor:A.strokeColor??"#8b5cf6",lineWidth:A.lineWidth??1,showMiddleLine:A.showMiddleLine??!1,middleLineColor:A.middleLineColor??"#8b5cf6",middleLineOpacity:A.middleLineOpacity??.5,middleLineWidth:A.middleLineWidth??1,showBackground:A.showBackground!==!1,backgroundColor:A.backgroundColor??"#b4a7d6",backgroundOpacity:A.backgroundOpacity??.1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0,point1Price:A.p1?.price??0,point2Price:A.p2?.price??0,point3Price:A.p3?.price??0}:A.type==="regressionchannel"||A.type==="stddevchannel"?{...e,baseLineColor:A.baseLineColor??"#ff0000",baseLineOpacity:A.baseLineOpacity??.35,baseLineWidth:A.baseLineWidth??1,showBaseLine:A.showBaseLine!==!1,upperLineColor:A.upperLineColor??"#0000ff",upperLineOpacity:A.upperLineOpacity??.35,upperLineWidth:A.upperLineWidth??1,showUpperLine:A.showUpperLine!==!1,lowerLineColor:A.lowerLineColor??"#0000ff",lowerLineOpacity:A.lowerLineOpacity??.35,lowerLineWidth:A.lowerLineWidth??1,showLowerLine:A.showLowerLine!==!1,showBackground:A.showBackground!==!1,backgroundOpacity:A.backgroundOpacity??.1,extendLeft:A.extendLeft??!1,extendRight:A.extendRight??!1,showPearsonsR:A.showPearsonsR!==!1,point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0}:A.type==="rulerline"?{...e,lineColor:A.lineColor??"#3b82f6",showArea:A.showArea!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways!==!1,statsPriceRange:A.statsPriceRange!==!1,statsBarsRange:A.statsBarsRange!==!1,statsDateRange:A.statsDateRange!==!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}:e}const pu=({isOpen:A,onClose:e,chartObject:t,onUpdate:i})=>{const{theme:r}=$t(),s=Pw(r==="light"),[o,l]=Y.useState("style"),[c,h]=Y.useState({}),[m,v]=Y.useState(null),x=Y.useRef(null),F=Y.useRef(null);Y.useEffect(()=>{t&&(h(mB(t)),l("style"))},[t]),Y.useEffect(()=>{A||v(null)},[A]);const T=H=>{if(H.button!==0)return;H.preventDefault();const z=x.current;if(!z)return;const re=z.offsetParent,q=re?re.getBoundingClientRect():{left:0,top:0},ie=z.getBoundingClientRect(),G=ie.left-q.left,ne=ie.top-q.top;F.current={startMX:H.clientX,startMY:H.clientY,startX:G,startY:ne},v({x:G,y:ne});const le=we=>{const{startMX:j,startMY:ge,startX:ae,startY:pe}=F.current;v({x:ae+we.clientX-j,y:pe+we.clientY-ge})},ee=()=>{F.current=null,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ee)};document.addEventListener("mousemove",le),document.addEventListener("mouseup",ee)};if(!A||!t)return null;const S=Hw[t.type]||t.type,I=["style","coordinates","visualization"],Q=()=>{if(o==="visualization")return a.jsx(Ww,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Gw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Jw,{draft:c,setDraft:h,tokens:s})}if(t.type==="gannline"){if(o==="style")return a.jsx(Rw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(cu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Zw,{draft:c,setDraft:h,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(cu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Yw,{draft:c,setDraft:h,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(qw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(jw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Xw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx($w,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(tB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(AB,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(eB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(hu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(uu,{draft:c,setDraft:h,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(hu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(uu,{draft:c,setDraft:h,tokens:s})}if(t.type==="gannfan"){if(o==="style")return a.jsx(oB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="ganngrid"){if(o==="style")return a.jsx(aB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="triangle"){if(o==="style")return a.jsx(uB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(dB,{draft:c,setDraft:h,tokens:s})}if(t.type==="circle"){if(o==="style")return a.jsx(hB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="ellipse"){if(o==="style")return a.jsx(pB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rectangle"){if(o==="style")return a.jsx(fB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(gB,{draft:c,tokens:s})}if(t.type==="andrewspitchfork"){if(o==="style")return a.jsx(lB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(cB,{draft:c,setDraft:h,tokens:s})}if(t.type==="equidistantchannel"){if(o==="style")return a.jsx(nB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(sB,{draft:c,setDraft:h,tokens:s})}if(t.type==="regressionchannel"||t.type==="stddevchannel"){if(o==="style")return a.jsx(iB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(rB,{draft:c,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},N=()=>{i(c),e()};return a.jsxs("div",{ref:x,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...m===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:m.y,left:m.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:T,style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText,cursor:"grab"},children:a.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(ha,{size:"18px",children:a.jsx(Dw,{})})})]})}),a.jsx("button",{type:"button",onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0 4px",background:s.headerBlue,color:s.headerText,border:"none",cursor:"pointer"},children:a.jsx(ha,{size:"20px",children:a.jsx(_w,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:I.map(H=>{const z=o===H;return a.jsxs("button",{type:"button",onClick:()=>l(H),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:z?s.text:s.mutedText,cursor:"pointer"},children:[H.charAt(0).toUpperCase()+H.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},H)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:Q()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick:N,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,border:"none",cursor:"pointer",background:s.greenHover,color:"#ffffff",boxShadow:`inset 0 0 0 1px ${s.greenActive}`},children:"Update"}),a.jsx("button",{type:"button",onClick:e,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,cursor:"pointer",border:`1px solid ${s.green}`,background:"transparent",color:s.green},children:"Cancel"})]})]})};var pa=function(A,e){return pa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])},pa(A,e)};function IA(A,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pa(A,e);function t(){this.constructor=A}A.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var da=function(){return da=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},da.apply(this,arguments)};function sA(A,e,t,i){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(h){try{c(i.next(h))}catch(m){s(m)}}function l(h){try{c(i.throw(h))}catch(m){s(m)}}function c(h){h.done?n(h.value):r(h.value).then(o,l)}c((i=i.apply(A,[])).next())})}function tA(A,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(h){return l([c,h])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(n=c[0]&2?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){t.label=c[1];break}if(c[0]===6&&t.label<n[1]){t.label=n[1],n=c;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(c);break}n[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(A,t)}catch(h){c=[6,h],r=0}finally{i=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function $n(A,e,t){if(arguments.length===2)for(var i=0,r=e.length,n;i<r;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return A.concat(n||e)}for(var ti=(function(){function A(e,t,i,r){this.left=e,this.top=t,this.width=i,this.height=r}return A.prototype.add=function(e,t,i,r){return new A(this.left+e,this.top+t,this.width+i,this.height+r)},A.fromClientRect=function(e,t){return new A(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},A.fromDOMRectList=function(e,t){var i=Array.from(t).find(function(r){return r.width!==0});return i?new A(i.left+e.windowBounds.left,i.top+e.windowBounds.top,i.width,i.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A})(),Xn=function(A,e){return ti.fromClientRect(A,e.getBoundingClientRect())},wB=function(A){var e=A.body,t=A.documentElement;if(!e||!t)throw new Error("Unable to get document size");var i=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new ti(0,0,i,r)},Jn=function(A){for(var e=[],t=0,i=A.length;t<i;){var r=A.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var n=A.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},It=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],r=-1,n="";++r<t;){var s=A[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(n+=String.fromCharCode.apply(String,i),i.length=0)}return n},du="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BB=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<du.length;Zn++)BB[du.charCodeAt(Zn)]=Zn;for(var fu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=typeof Uint8Array>"u"?[]:new Uint8Array(256),Yn=0;Yn<fu.length;Yn++)Ur[fu.charCodeAt(Yn)]=Yn;for(var yB=function(A){var e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(i=0;i<t;i+=4)n=Ur[A.charCodeAt(i)],s=Ur[A.charCodeAt(i+1)],o=Ur[A.charCodeAt(i+2)],l=Ur[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},CB=function(A){for(var e=A.length,t=[],i=0;i<e;i+=2)t.push(A[i+1]<<8|A[i]);return t},vB=function(A){for(var e=A.length,t=[],i=0;i<e;i+=4)t.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return t},Mi=5,fa=11,ga=2,TB=fa-Mi,gu=65536>>Mi,bB=1<<Mi,ma=bB-1,xB=1024>>Mi,QB=gu+xB,FB=QB,UB=32,SB=FB+UB,EB=65536>>fa,LB=1<<TB,MB=LB-1,mu=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},HB=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},IB=function(A,e){var t=yB(A),i=Array.isArray(t)?vB(t):new Uint32Array(t),r=Array.isArray(t)?CB(t):new Uint16Array(t),n=24,s=mu(r,n/2,i[4]/2),o=i[5]===2?mu(r,(n+i[4])/2):HB(i,Math.ceil((n+i[4])/4));return new PB(i[0],i[1],i[2],i[3],s,o)},PB=(function(){function A(e,t,i,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=n,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Mi],t=(t<<ga)+(e&ma),this.data[t];if(e<=65535)return t=this.index[gu+(e-55296>>Mi)],t=(t<<ga)+(e&ma),this.data[t];if(e<this.highStart)return t=SB-EB+(e>>fa),t=this.index[t],t+=e>>Mi&MB,t=this.index[t],t=(t<<ga)+(e&ma),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",DB=typeof Uint8Array>"u"?[]:new Uint8Array(256),qn=0;qn<wu.length;qn++)DB[wu.charCodeAt(qn)]=qn;var _B="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Bu=50,kB=1,yu=2,Cu=3,OB=4,NB=5,vu=7,Tu=8,bu=9,pi=10,wa=11,xu=12,Ba=13,KB=14,Sr=15,ya=16,jn=17,Er=18,zB=19,Qu=20,Ca=21,Lr=22,va=23,$i=24,CA=25,Mr=26,Hr=27,Xi=28,VB=29,Hi=30,WB=31,es=32,ts=33,Ta=34,ba=35,xa=36,Ir=37,Qa=38,As=39,is=40,Fa=41,Fu=42,GB=43,RB=[9001,65288],Uu="!",lt="×",rs="÷",Ua=IB(_B),Ai=[Hi,xa],Sa=[kB,yu,Cu,NB],Su=[pi,Tu],Eu=[Hr,Mr],$B=Sa.concat(Su),Lu=[Qa,As,is,Ta,ba],XB=[Sr,Ba],JB=function(A,e){e===void 0&&(e="strict");var t=[],i=[],r=[];return A.forEach(function(n,s){var o=Ua.get(n);if(o>Bu?(r.push(!0),o-=Bu):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return i.push(s),t.push(ya);if(o===OB||o===wa){if(s===0)return i.push(s),t.push(Hi);var l=t[s-1];return $B.indexOf(l)===-1?(i.push(i[s-1]),t.push(l)):(i.push(s),t.push(Hi))}if(i.push(s),o===WB)return t.push(e==="strict"?Ca:Ir);if(o===Fu||o===VB)return t.push(Hi);if(o===GB)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Ir):t.push(Hi);t.push(o)}),[i,t,r]},Ea=function(A,e,t,i){var r=i[t];if(Array.isArray(A)?A.indexOf(r)!==-1:A===r)for(var n=t;n<=i.length;){n++;var s=i[n];if(s===e)return!0;if(s!==pi)break}if(r===pi)for(var n=t;n>0;){n--;var o=i[n];if(Array.isArray(A)?A.indexOf(o)!==-1:A===o)for(var l=t;l<=i.length;){l++;var s=i[l];if(s===e)return!0;if(s!==pi)break}if(o!==pi)break}return!1},Mu=function(A,e){for(var t=A;t>=0;){var i=e[t];if(i===pi)t--;else return i}return 0},ZB=function(A,e,t,i,r){if(t[i]===0)return lt;var n=i-1;if(Array.isArray(r)&&r[n]===!0)return lt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,h=e[o];if(l===yu&&h===Cu)return lt;if(Sa.indexOf(l)!==-1)return Uu;if(Sa.indexOf(h)!==-1||Su.indexOf(h)!==-1)return lt;if(Mu(n,e)===Tu)return rs;if(Ua.get(A[n])===wa||(l===es||l===ts)&&Ua.get(A[o])===wa||l===vu||h===vu||l===bu||[pi,Ba,Sr].indexOf(l)===-1&&h===bu||[jn,Er,zB,$i,Xi].indexOf(h)!==-1||Mu(n,e)===Lr||Ea(va,Lr,n,e)||Ea([jn,Er],Ca,n,e)||Ea(xu,xu,n,e))return lt;if(l===pi)return rs;if(l===va||h===va)return lt;if(h===ya||l===ya)return rs;if([Ba,Sr,Ca].indexOf(h)!==-1||l===KB||c===xa&&XB.indexOf(l)!==-1||l===Xi&&h===xa||h===Qu||Ai.indexOf(h)!==-1&&l===CA||Ai.indexOf(l)!==-1&&h===CA||l===Hr&&[Ir,es,ts].indexOf(h)!==-1||[Ir,es,ts].indexOf(l)!==-1&&h===Mr||Ai.indexOf(l)!==-1&&Eu.indexOf(h)!==-1||Eu.indexOf(l)!==-1&&Ai.indexOf(h)!==-1||[Hr,Mr].indexOf(l)!==-1&&(h===CA||[Lr,Sr].indexOf(h)!==-1&&e[o+1]===CA)||[Lr,Sr].indexOf(l)!==-1&&h===CA||l===CA&&[CA,Xi,$i].indexOf(h)!==-1)return lt;if([CA,Xi,$i,jn,Er].indexOf(h)!==-1)for(var m=n;m>=0;){var v=e[m];if(v===CA)return lt;if([Xi,$i].indexOf(v)!==-1)m--;else break}if([Hr,Mr].indexOf(h)!==-1)for(var m=[jn,Er].indexOf(l)!==-1?s:n;m>=0;){var v=e[m];if(v===CA)return lt;if([Xi,$i].indexOf(v)!==-1)m--;else break}if(Qa===l&&[Qa,As,Ta,ba].indexOf(h)!==-1||[As,Ta].indexOf(l)!==-1&&[As,is].indexOf(h)!==-1||[is,ba].indexOf(l)!==-1&&h===is||Lu.indexOf(l)!==-1&&[Qu,Mr].indexOf(h)!==-1||Lu.indexOf(h)!==-1&&l===Hr||Ai.indexOf(l)!==-1&&Ai.indexOf(h)!==-1||l===$i&&Ai.indexOf(h)!==-1||Ai.concat(CA).indexOf(l)!==-1&&h===Lr&&RB.indexOf(A[o])===-1||Ai.concat(CA).indexOf(h)!==-1&&l===Er)return lt;if(l===Fa&&h===Fa){for(var x=t[n],F=1;x>0&&(x--,e[x]===Fa);)F++;if(F%2!==0)return lt}return l===es&&h===ts?lt:rs},YB=function(A,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=JB(A,e.lineBreak),i=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[CA,Hi,Fu].indexOf(o)!==-1?Ir:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&A[l]>=19968&&A[l]<=40959}):void 0;return[i,r,s]},qB=(function(){function A(e,t,i,r){this.codePoints=e,this.required=t===Uu,this.start=i,this.end=r}return A.prototype.slice=function(){return It.apply(void 0,this.codePoints.slice(this.start,this.end))},A})(),jB=function(A,e){var t=Jn(A),i=YB(t,e),r=i[0],n=i[1],s=i[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var h=lt;c<o&&(h=ZB(t,n,r,++c,s))===lt;);if(h!==lt||c===o){var m=new qB(t,h,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},e2=1,t2=2,Pr=4,Hu=8,ns=10,Iu=47,Dr=92,A2=9,i2=32,ss=34,_r=61,r2=35,n2=36,s2=37,os=39,as=40,kr=41,o2=95,fA=45,a2=33,l2=60,c2=62,h2=64,u2=91,p2=93,d2=61,f2=123,ls=63,g2=125,Pu=124,m2=126,w2=128,Du=65533,La=42,Ii=43,B2=44,y2=58,C2=59,Or=46,v2=0,T2=8,b2=11,x2=14,Q2=31,F2=127,GA=-1,_u=48,ku=97,Ou=101,U2=102,S2=117,E2=122,Nu=65,Ku=69,zu=70,L2=85,M2=90,AA=function(A){return A>=_u&&A<=57},H2=function(A){return A>=55296&&A<=57343},Ji=function(A){return AA(A)||A>=Nu&&A<=zu||A>=ku&&A<=U2},I2=function(A){return A>=ku&&A<=E2},P2=function(A){return A>=Nu&&A<=M2},D2=function(A){return I2(A)||P2(A)},_2=function(A){return A>=w2},cs=function(A){return A===ns||A===A2||A===i2},hs=function(A){return D2(A)||_2(A)||A===o2},Vu=function(A){return hs(A)||AA(A)||A===fA},k2=function(A){return A>=v2&&A<=T2||A===b2||A>=x2&&A<=Q2||A===F2},di=function(A,e){return A!==Dr?!1:e!==ns},us=function(A,e,t){return A===fA?hs(e)||di(e,t):hs(A)?!0:!!(A===Dr&&di(A,e))},Ma=function(A,e,t){return A===Ii||A===fA?AA(e)?!0:e===Or&&AA(t):AA(A===Or?e:A)},O2=function(A){var e=0,t=1;(A[e]===Ii||A[e]===fA)&&(A[e]===fA&&(t=-1),e++);for(var i=[];AA(A[e]);)i.push(A[e++]);var r=i.length?parseInt(It.apply(void 0,i),10):0;A[e]===Or&&e++;for(var n=[];AA(A[e]);)n.push(A[e++]);var s=n.length,o=s?parseInt(It.apply(void 0,n),10):0;(A[e]===Ku||A[e]===Ou)&&e++;var l=1;(A[e]===Ii||A[e]===fA)&&(A[e]===fA&&(l=-1),e++);for(var c=[];AA(A[e]);)c.push(A[e++]);var h=c.length?parseInt(It.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*h)},N2={type:2},K2={type:3},z2={type:4},V2={type:13},W2={type:8},G2={type:21},R2={type:9},$2={type:10},X2={type:11},J2={type:12},Z2={type:14},ps={type:23},Y2={type:1},q2={type:25},j2={type:24},ey={type:26},ty={type:27},Ay={type:28},iy={type:29},ry={type:31},Ha={type:32},Wu=(function(){function A(){this._value=[]}return A.prototype.write=function(e){this._value=this._value.concat(Jn(e))},A.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Ha;)e.push(t),t=this.consumeToken();return e},A.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ss:return this.consumeStringToken(ss);case r2:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Vu(t)||di(i,r)){var n=us(t,i,r)?t2:e2,s=this.consumeName();return{type:5,value:s,flags:n}}break;case n2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),V2;break;case os:return this.consumeStringToken(os);case as:return N2;case kr:return K2;case La:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),Z2;break;case Ii:if(Ma(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case B2:return z2;case fA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Ma(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(us(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===fA&&c===c2)return this.consumeCodePoint(),this.consumeCodePoint(),j2;break;case Or:if(Ma(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Iu:if(this.peekCodePoint(0)===La)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===La&&(h=this.consumeCodePoint(),h===Iu))return this.consumeToken();if(h===GA)return this.consumeToken()}break;case y2:return ey;case C2:return ty;case l2:if(this.peekCodePoint(0)===a2&&this.peekCodePoint(1)===fA&&this.peekCodePoint(2)===fA)return this.consumeCodePoint(),this.consumeCodePoint(),q2;break;case h2:var m=this.peekCodePoint(0),v=this.peekCodePoint(1),x=this.peekCodePoint(2);if(us(m,v,x)){var s=this.consumeName();return{type:7,value:s}}break;case u2:return Ay;case Dr:if(di(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case p2:return iy;case d2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),W2;break;case f2:return X2;case g2:return J2;case S2:case L2:var F=this.peekCodePoint(0),T=this.peekCodePoint(1);return F===Ii&&(Ji(T)||T===ls)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Pu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),R2;if(this.peekCodePoint(0)===Pu)return this.consumeCodePoint(),G2;break;case m2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),$2;break;case GA:return Ha}return cs(e)?(this.consumeWhiteSpace(),ry):AA(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):hs(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:It(e)}},A.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},A.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},A.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},A.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Ji(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;t===ls&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i){var r=parseInt(It.apply(void 0,e.map(function(l){return l===ls?_u:l})),16),n=parseInt(It.apply(void 0,e.map(function(l){return l===ls?zu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(It.apply(void 0,e),16);if(this.peekCodePoint(0)===fA&&Ji(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Ji(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(It.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},A.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===as?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===as?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},A.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===GA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===os||t===ss){var i=this.consumeStringToken(this.consumeCodePoint());return i.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===GA||this.peekCodePoint(0)===kr)?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),ps)}for(;;){var r=this.consumeCodePoint();if(r===GA||r===kr)return{type:22,value:It.apply(void 0,e)};if(cs(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===GA||this.peekCodePoint(0)===kr?(this.consumeCodePoint(),{type:22,value:It.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ps);if(r===ss||r===os||r===as||k2(r))return this.consumeBadUrlRemnants(),ps;if(r===Dr)if(di(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ps;else e.push(r)}},A.prototype.consumeWhiteSpace=function(){for(;cs(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kr||e===GA)return;di(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(e){for(var t=5e4,i="";e>0;){var r=Math.min(t,e);i+=It.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),i},A.prototype.consumeStringToken=function(e){var t="",i=0;do{var r=this._value[i];if(r===GA||r===void 0||r===e)return t+=this.consumeStringSlice(i),{type:0,value:t};if(r===ns)return this._value.splice(0,i),Y2;if(r===Dr){var n=this._value[i+1];n!==GA&&n!==void 0&&(n===ns?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):di(r,n)&&(t+=this.consumeStringSlice(i),t+=It(this.consumeEscapedCodePoint()),i=-1))}i++}while(!0)},A.prototype.consumeNumber=function(){var e=[],t=Pr,i=this.peekCodePoint(0);for((i===Ii||i===fA)&&e.push(this.consumeCodePoint());AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(i===Or&&AA(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Hu;AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((i===Ku||i===Ou)&&((r===Ii||r===fA)&&AA(n)||AA(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Hu;AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[O2(e),t]},A.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(us(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:i,unit:o}}return r===s2?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},A.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Ji(e)){for(var t=It(e);Ji(this.peekCodePoint(0))&&t.length<6;)t+=It(this.consumeCodePoint());cs(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return i===0||H2(i)||i>1114111?Du:i}return e===GA?Du:e},A.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Vu(t))e+=It(t);else if(di(t,this.peekCodePoint(0)))e+=It(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},A})(),Gu=(function(){function A(e){this._tokens=e}return A.create=function(e){var t=new Wu;return t.write(e),new A(t.read())},A.parseValue=function(e){return A.create(e).parseComponentValue()},A.parseValues=function(e){return A.create(e).parseComponentValues()},A.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},A.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},A.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(i.type===32||sy(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},A.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(i.type===32||i.type===3)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Ha:e},A.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},A})(),Nr=function(A){return A.type===15},Zi=function(A){return A.type===17},yt=function(A){return A.type===20},ny=function(A){return A.type===0},Ia=function(A,e){return yt(A)&&A.value===e},Ru=function(A){return A.type!==31},Yi=function(A){return A.type!==31&&A.type!==4},RA=function(A){var e=[],t=[];return A.forEach(function(i){if(i.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}i.type!==31&&t.push(i)}),t.length&&e.push(t),e},sy=function(A,e){return e===11&&A.type===12||e===28&&A.type===29?!0:e===2&&A.type===3},fi=function(A){return A.type===17||A.type===15},Ot=function(A){return A.type===16||fi(A)},$u=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},Xt={type:17,number:0,flags:Pr},Pa={type:16,number:50,flags:Pr},gi={type:16,number:100,flags:Pr},Kr=function(A,e,t){var i=A[0],r=A[1];return[xt(i,e),xt(typeof r<"u"?r:i,t)]},xt=function(A,e){if(A.type===16)return A.number/100*e;if(Nr(A))switch(A.unit){case"rem":case"em":return 16*A.number;default:return A.number}return A.number},Xu="deg",Ju="grad",Zu="rad",Yu="turn",ds={name:"angle",parse:function(A,e){if(e.type===15)switch(e.unit){case Xu:return Math.PI*e.number/180;case Ju:return Math.PI/200*e.number;case Zu:return e.number;case Yu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},qu=function(A){return A.type===15&&(A.unit===Xu||A.unit===Ju||A.unit===Zu||A.unit===Yu)},ju=function(A){var e=A.filter(yt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Xt,Xt];case"to top":case"bottom":return QA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Xt,gi];case"to right":case"left":return QA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[gi,gi];case"to bottom":case"top":return QA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[gi,Xt];case"to left":case"right":return QA(270)}return 0},QA=function(A){return Math.PI*A/180},mi={name:"color",parse:function(A,e){if(e.type===18){var t=oy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(A,e.values)}if(e.type===5){if(e.value.length===3){var i=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3);return Bi(parseInt(i+i,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(e.value.length===4){var i=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return Bi(parseInt(i+i,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var i=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6);return Bi(parseInt(i,16),parseInt(r,16),parseInt(n,16),1)}if(e.value.length===8){var i=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return Bi(parseInt(i,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=ii[e.value.toUpperCase()];if(typeof o<"u")return o}return ii.TRANSPARENT}},wi=function(A){return(255&A)===0},Gt=function(A){var e=255&A,t=255&A>>8,i=255&A>>16,r=255&A>>24;return e<255?"rgba("+r+","+i+","+t+","+e/255+")":"rgb("+r+","+i+","+t+")"},Bi=function(A,e,t,i){return(A<<24|e<<16|t<<8|Math.round(i*255)<<0)>>>0},ep=function(A,e){if(A.type===17)return A.number;if(A.type===16){var t=e===3?1:255;return e===3?A.number/100*t:Math.round(A.number/100*t)}return 0},tp=function(A,e){var t=e.filter(Yi);if(t.length===3){var i=t.map(ep),r=i[0],n=i[1],s=i[2];return Bi(r,n,s,1)}if(t.length===4){var o=t.map(ep),r=o[0],n=o[1],s=o[2],l=o[3];return Bi(r,n,s,l)}return 0};function Da(A,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-A)*t*6+A:t<1/2?e:t<2/3?(e-A)*6*(2/3-t)+A:A}var Ap=function(A,e){var t=e.filter(Yi),i=t[0],r=t[1],n=t[2],s=t[3],o=(i.type===17?QA(i.number):ds.parse(A,i))/(Math.PI*2),l=Ot(r)?r.number/100:0,c=Ot(n)?n.number/100:0,h=typeof s<"u"&&Ot(s)?xt(s,1):1;if(l===0)return Bi(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,v=c*2-m,x=Da(v,m,o+1/3),F=Da(v,m,o),T=Da(v,m,o-1/3);return Bi(x*255,F*255,T*255,h)},oy={hsl:Ap,hsla:Ap,rgb:tp,rgba:tp},zr=function(A,e){return mi.parse(A,Gu.create(e).parseComponentValue())},ii={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},ay={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(yt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ly={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fs=function(A,e){var t=mi.parse(A,e[0]),i=e[1];return i&&Ot(i)?{color:t,stop:i}:{color:t,stop:null}},ip=function(A,e){var t=A[0],i=A[A.length-1];t.stop===null&&(t.stop=Xt),i.stop===null&&(i.stop=gi);for(var r=[],n=0,s=0;s<A.length;s++){var o=A[s].stop;if(o!==null){var l=xt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var h=r[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,v=r[c-1],x=(h-v)/(m+1),F=1;F<=m;F++)r[c+F-1]=x*F;c=null}}return A.map(function(T,S){var I=T.color;return{color:I,stop:Math.max(Math.min(1,r[S]/e),0)}})},cy=function(A,e,t){var i=e/2,r=t/2,n=xt(A[0],e)-i,s=r-xt(A[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},hy=function(A,e,t){var i=typeof A=="number"?A:cy(A,e,t),r=Math.abs(e*Math.sin(i))+Math.abs(t*Math.cos(i)),n=e/2,s=t/2,o=r/2,l=Math.sin(i-Math.PI/2)*o,c=Math.cos(i-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},PA=function(A,e){return Math.sqrt(A*A+e*e)},rp=function(A,e,t,i,r){var n=[[0,0],[0,e],[A,0],[A,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],h=PA(t-l,i-c);return(r?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},uy=function(A,e,t,i,r){var n=0,s=0;switch(A.size){case 0:A.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):A.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-i)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(A.shape===0)n=s=Math.min(PA(e,t),PA(e,t-r),PA(e-i,t),PA(e-i,t-r));else if(A.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-i)),l=rp(i,r,e,t,!0),c=l[0],h=l[1];n=PA(c-e,(h-t)/o),s=o*n}break;case 1:A.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):A.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-i)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(A.shape===0)n=s=Math.max(PA(e,t),PA(e,t-r),PA(e-i,t),PA(e-i,t-r));else if(A.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-i)),m=rp(i,r,e,t,!1),c=m[0],h=m[1];n=PA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(A.size)&&(n=xt(A.size[0],i),s=A.size.length===2?xt(A.size[1],r):n),[n,s]},py=function(A,e){var t=QA(180),i=[];return RA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=ju(r);return}else if(qu(s)){t=ds.parse(A,s);return}}var o=fs(A,r);i.push(o)}),{angle:t,stops:i,type:1}},gs=function(A,e){var t=QA(180),i=[];return RA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=ju(r);return}else if(qu(s)){t=(ds.parse(A,s)+QA(270))%QA(360);return}}var o=fs(A,r);i.push(o)}),{angle:t,stops:i,type:1}},dy=function(A,e){var t=QA(180),i=[],r=1,n=0,s=3,o=[];return RA(e).forEach(function(l,c){var h=l[0];if(c===0){if(yt(h)&&h.value==="linear"){r=1;return}else if(yt(h)&&h.value==="radial"){r=2;return}}if(h.type===18){if(h.name==="from"){var m=mi.parse(A,h.values[0]);i.push({stop:Xt,color:m})}else if(h.name==="to"){var m=mi.parse(A,h.values[0]);i.push({stop:gi,color:m})}else if(h.name==="color-stop"){var v=h.values.filter(Yi);if(v.length===2){var m=mi.parse(A,v[1]),x=v[0];Zi(x)&&i.push({stop:{type:16,number:x.number*100,flags:x.flags},color:m})}}}}),r===1?{angle:(t+QA(180))%QA(360),stops:i,type:r}:{size:s,shape:n,stops:i,position:o,type:r}},np="closest-side",sp="farthest-side",op="closest-corner",ap="farthest-corner",lp="circle",cp="ellipse",hp="cover",up="contain",fy=function(A,e){var t=0,i=3,r=[],n=[];return RA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,v){if(c)if(yt(v))switch(v.value){case"center":return n.push(Pa),m;case"top":case"left":return n.push(Xt),m;case"right":case"bottom":return n.push(gi),m}else(Ot(v)||fi(v))&&n.push(v);else if(yt(v))switch(v.value){case lp:return t=0,!1;case cp:return t=1,!1;case"at":return c=!0,!1;case np:return i=0,!1;case hp:case sp:return i=1,!1;case up:case op:return i=2,!1;case ap:return i=3,!1}else if(fi(v)||Ot(v))return Array.isArray(i)||(i=[]),i.push(v),!1;return m},l)}if(l){var h=fs(A,s);r.push(h)}}),{size:i,shape:t,stops:r,position:n,type:2}},ms=function(A,e){var t=0,i=3,r=[],n=[];return RA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(h,m){if(yt(m))switch(m.value){case"center":return n.push(Pa),!1;case"top":case"left":return n.push(Xt),!1;case"right":case"bottom":return n.push(gi),!1}else if(Ot(m)||fi(m))return n.push(m),!1;return h},l):o===1&&(l=s.reduce(function(h,m){if(yt(m))switch(m.value){case lp:return t=0,!1;case cp:return t=1,!1;case up:case np:return i=0,!1;case sp:return i=1,!1;case op:return i=2,!1;case hp:case ap:return i=3,!1}else if(fi(m)||Ot(m))return Array.isArray(i)||(i=[]),i.push(m),!1;return h},l)),l){var c=fs(A,s);r.push(c)}}),{size:i,shape:t,stops:r,position:n,type:2}},gy=function(A){return A.type===1},my=function(A){return A.type===2},_a={name:"image",parse:function(A,e){if(e.type===22){var t={url:e.value,type:0};return A.cache.addImage(e.value),t}if(e.type===18){var i=pp[e.name];if(typeof i>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return i(A,e.values)}throw new Error("Unsupported image type "+e.type)}};function wy(A){return!(A.type===20&&A.value==="none")&&(A.type!==18||!!pp[A.name])}var pp={"linear-gradient":py,"-moz-linear-gradient":gs,"-ms-linear-gradient":gs,"-o-linear-gradient":gs,"-webkit-linear-gradient":gs,"radial-gradient":fy,"-moz-radial-gradient":ms,"-ms-radial-gradient":ms,"-o-radial-gradient":ms,"-webkit-radial-gradient":ms,"-webkit-gradient":dy},By={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(i){return Yi(i)&&wy(i)}).map(function(i){return _a.parse(A,i)})}},yy={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(yt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Cy={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,e){return RA(e).map(function(t){return t.filter(Ot)}).map($u)}},vy={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,e){return RA(e).map(function(t){return t.filter(yt).map(function(i){return i.value}).join(" ")}).map(Ty)}},Ty=function(A){switch(A){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}},qi;(function(A){A.AUTO="auto",A.CONTAIN="contain",A.COVER="cover"})(qi||(qi={}));var by={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,e){return RA(e).map(function(t){return t.filter(xy)})}},xy=function(A){return yt(A)||Ot(A)},ws=function(A){return{name:"border-"+A+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Qy=ws("top"),Fy=ws("right"),Uy=ws("bottom"),Sy=ws("left"),Bs=function(A){return{name:"border-radius-"+A,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return $u(t.filter(Ot))}}},Ey=Bs("top-left"),Ly=Bs("top-right"),My=Bs("bottom-right"),Hy=Bs("bottom-left"),ys=function(A){return{name:"border-"+A+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Iy=ys("top"),Py=ys("right"),Dy=ys("bottom"),_y=ys("left"),Cs=function(A){return{name:"border-"+A+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Nr(t)?t.number:0}}},ky=Cs("top"),Oy=Cs("right"),Ny=Cs("bottom"),Ky=Cs("left"),zy={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vy={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,e){return e==="rtl"?1:0}},Wy={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).reduce(function(t,i){return t|Gy(i.value)},0)}},Gy=function(A){switch(A){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Ry={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},$y={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},vs;(function(A){A.NORMAL="normal",A.STRICT="strict"})(vs||(vs={}));var Xy={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){return e==="strict"?vs.STRICT:vs.NORMAL}},Jy={name:"line-height",initialValue:"normal",prefix:!1,type:4},dp=function(A,e){return yt(A)&&A.value==="normal"?1.2*e:A.type===17?e*A.number:Ot(A)?xt(A,e):e},Zy={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,e){return e.type===20&&e.value==="none"?null:_a.parse(A,e)}},Yy={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,e){return e==="inside"?0:1}},ka={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Ts=function(A){return{name:"margin-"+A,initialValue:"0",prefix:!1,type:4}},qy=Ts("top"),jy=Ts("right"),eC=Ts("bottom"),tC=Ts("left"),AC={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},iC={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){return e==="break-word"?"break-word":"normal"}},bs=function(A){return{name:"padding-"+A,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},rC=bs("top"),nC=bs("right"),sC=bs("bottom"),oC=bs("left"),aC={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},lC={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},cC={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&Ia(e[0],"none")?[]:RA(e).map(function(t){for(var i={color:ii.TRANSPARENT,offsetX:Xt,offsetY:Xt,blur:Xt},r=0,n=0;n<t.length;n++){var s=t[n];fi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:i.blur=s,r++):i.color=mi.parse(A,s)}return i})}},hC={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},uC={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=fC[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},pC=function(A){var e=A.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},dC=function(A){var e=A.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],i=e[1];e[2],e[3];var r=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,i,r,n,s,o]:null},fC={matrix:pC,matrix3d:dC},fp={type:16,number:50,flags:Pr},gC=[fp,fp],mC={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,e){var t=e.filter(Ot);return t.length!==2?gC:[t[0],t[1]]}},wC={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Vr;(function(A){A.NORMAL="normal",A.BREAK_ALL="break-all",A.KEEP_ALL="keep-all"})(Vr||(Vr={}));for(var BC={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-all":return Vr.BREAK_ALL;case"keep-all":return Vr.KEEP_ALL;default:return Vr.NORMAL}}},yC={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,e){if(e.type===20)return{auto:!0,order:0};if(Zi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},gp={name:"time",parse:function(A,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},CC={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,e){return Zi(e)?e.number:1}},vC={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},TC={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},bC={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,e){var t=[],i=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:i.push(t.join(" ")),t.length=0;break}}),t.length&&i.push(t.join(" ")),i.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},xC={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},QC={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,e){return Zi(e)?e.number:yt(e)&&e.value==="bold"?700:400}},FC={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.filter(yt).map(function(t){return t.value})}},UC={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Kt=function(A,e){return(A&e)!==0},SC={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},EC={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var i=[],r=e.filter(Ru),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Zi(o)?o.number:1;i.push({counter:s.value,increment:l})}}return i}},LC={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return[];for(var t=[],i=e.filter(Ru),r=0;r<i.length;r++){var n=i[r],s=i[r+1];if(yt(n)&&n.value!=="none"){var o=s&&Zi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},MC={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,e){return e.filter(Nr).map(function(t){return gp.parse(A,t)})}},HC={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var i=[],r=e.filter(ny);if(r.length%2!==0)return null;for(var n=0;n<r.length;n+=2){var s=r[n].value,o=r[n+1].value;i.push({open:s,close:o})}return i}},mp=function(A,e,t){if(!A)return"";var i=A[Math.min(e,A.length-1)];return i?t?i.open:i.close:""},IC={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&Ia(e[0],"none")?[]:RA(e).map(function(t){for(var i={color:255,offsetX:Xt,offsetY:Xt,blur:Xt,spread:Xt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];Ia(s,"inset")?i.inset=!0:fi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:r===2?i.blur=s:i.spread=s,r++):i.color=mi.parse(A,s)}return i})}},PC={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,e){var t=[0,1,2],i=[];return e.filter(yt).forEach(function(r){switch(r.value){case"stroke":i.push(1);break;case"fill":i.push(0);break;case"markers":i.push(2);break}}),t.forEach(function(r){i.indexOf(r)===-1&&i.push(r)}),i}},DC={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},_C={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,e){return Nr(e)?e.number:0}},kC=(function(){function A(e,t){var i,r;this.animationDuration=Oe(e,MC,t.animationDuration),this.backgroundClip=Oe(e,ay,t.backgroundClip),this.backgroundColor=Oe(e,ly,t.backgroundColor),this.backgroundImage=Oe(e,By,t.backgroundImage),this.backgroundOrigin=Oe(e,yy,t.backgroundOrigin),this.backgroundPosition=Oe(e,Cy,t.backgroundPosition),this.backgroundRepeat=Oe(e,vy,t.backgroundRepeat),this.backgroundSize=Oe(e,by,t.backgroundSize),this.borderTopColor=Oe(e,Qy,t.borderTopColor),this.borderRightColor=Oe(e,Fy,t.borderRightColor),this.borderBottomColor=Oe(e,Uy,t.borderBottomColor),this.borderLeftColor=Oe(e,Sy,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,Ey,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,Ly,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,My,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,Hy,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,Iy,t.borderTopStyle),this.borderRightStyle=Oe(e,Py,t.borderRightStyle),this.borderBottomStyle=Oe(e,Dy,t.borderBottomStyle),this.borderLeftStyle=Oe(e,_y,t.borderLeftStyle),this.borderTopWidth=Oe(e,ky,t.borderTopWidth),this.borderRightWidth=Oe(e,Oy,t.borderRightWidth),this.borderBottomWidth=Oe(e,Ny,t.borderBottomWidth),this.borderLeftWidth=Oe(e,Ky,t.borderLeftWidth),this.boxShadow=Oe(e,IC,t.boxShadow),this.color=Oe(e,zy,t.color),this.direction=Oe(e,Vy,t.direction),this.display=Oe(e,Wy,t.display),this.float=Oe(e,Ry,t.cssFloat),this.fontFamily=Oe(e,bC,t.fontFamily),this.fontSize=Oe(e,xC,t.fontSize),this.fontStyle=Oe(e,UC,t.fontStyle),this.fontVariant=Oe(e,FC,t.fontVariant),this.fontWeight=Oe(e,QC,t.fontWeight),this.letterSpacing=Oe(e,$y,t.letterSpacing),this.lineBreak=Oe(e,Xy,t.lineBreak),this.lineHeight=Oe(e,Jy,t.lineHeight),this.listStyleImage=Oe(e,Zy,t.listStyleImage),this.listStylePosition=Oe(e,Yy,t.listStylePosition),this.listStyleType=Oe(e,ka,t.listStyleType),this.marginTop=Oe(e,qy,t.marginTop),this.marginRight=Oe(e,jy,t.marginRight),this.marginBottom=Oe(e,eC,t.marginBottom),this.marginLeft=Oe(e,tC,t.marginLeft),this.opacity=Oe(e,CC,t.opacity);var n=Oe(e,AC,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,iC,t.overflowWrap),this.paddingTop=Oe(e,rC,t.paddingTop),this.paddingRight=Oe(e,nC,t.paddingRight),this.paddingBottom=Oe(e,sC,t.paddingBottom),this.paddingLeft=Oe(e,oC,t.paddingLeft),this.paintOrder=Oe(e,PC,t.paintOrder),this.position=Oe(e,lC,t.position),this.textAlign=Oe(e,aC,t.textAlign),this.textDecorationColor=Oe(e,vC,(i=t.textDecorationColor)!==null&&i!==void 0?i:t.color),this.textDecorationLine=Oe(e,TC,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,cC,t.textShadow),this.textTransform=Oe(e,hC,t.textTransform),this.transform=Oe(e,uC,t.transform),this.transformOrigin=Oe(e,mC,t.transformOrigin),this.visibility=Oe(e,wC,t.visibility),this.webkitTextStrokeColor=Oe(e,DC,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,_C,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,BC,t.wordBreak),this.zIndex=Oe(e,yC,t.zIndex)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},A.prototype.isTransparent=function(){return wi(this.backgroundColor)},A.prototype.isTransformed=function(){return this.transform!==null},A.prototype.isPositioned=function(){return this.position!==0},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return this.float!==0},A.prototype.isInlineLevel=function(){return Kt(this.display,4)||Kt(this.display,33554432)||Kt(this.display,268435456)||Kt(this.display,536870912)||Kt(this.display,67108864)||Kt(this.display,134217728)},A})(),OC=(function(){function A(e,t){this.content=Oe(e,SC,t.content),this.quotes=Oe(e,HC,t.quotes)}return A})(),wp=(function(){function A(e,t){this.counterIncrement=Oe(e,EC,t.counterIncrement),this.counterReset=Oe(e,LC,t.counterReset)}return A})(),Oe=function(A,e,t){var i=new Wu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;i.write(r);var n=new Gu(i.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(A,yt(s)?s.value:e.initialValue);case 0:return e.parse(A,n.parseComponentValue());case 1:return e.parse(A,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return ds.parse(A,n.parseComponentValue());case"color":return mi.parse(A,n.parseComponentValue());case"image":return _a.parse(A,n.parseComponentValue());case"length":var o=n.parseComponentValue();return fi(o)?o:Xt;case"length-percentage":var l=n.parseComponentValue();return Ot(l)?l:Xt;case"time":return gp.parse(A,n.parseComponentValue())}break}},NC="data-html2canvas-debug",KC=function(A){var e=A.getAttribute(NC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Oa=function(A,e){var t=KC(A);return t===1||e===t},$A=(function(){function A(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Oa(t,3))debugger;this.styles=new kC(e,window.getComputedStyle(t,null)),ja(t)&&(this.styles.animationDuration.some(function(i){return i>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Xn(this.context,t),Oa(t,4)&&(this.flags|=16)}return A})(),zC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Bp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wr=typeof Uint8Array>"u"?[]:new Uint8Array(256),xs=0;xs<Bp.length;xs++)Wr[Bp.charCodeAt(xs)]=xs;for(var VC=function(A){var e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(i=0;i<t;i+=4)n=Wr[A.charCodeAt(i)],s=Wr[A.charCodeAt(i+1)],o=Wr[A.charCodeAt(i+2)],l=Wr[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},WC=function(A){for(var e=A.length,t=[],i=0;i<e;i+=2)t.push(A[i+1]<<8|A[i]);return t},GC=function(A){for(var e=A.length,t=[],i=0;i<e;i+=4)t.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return t},Pi=5,Na=11,Ka=2,RC=Na-Pi,yp=65536>>Pi,$C=1<<Pi,za=$C-1,XC=1024>>Pi,JC=yp+XC,ZC=JC,YC=32,qC=ZC+YC,jC=65536>>Na,ev=1<<RC,tv=ev-1,Cp=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},Av=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},iv=function(A,e){var t=VC(A),i=Array.isArray(t)?GC(t):new Uint32Array(t),r=Array.isArray(t)?WC(t):new Uint16Array(t),n=24,s=Cp(r,n/2,i[4]/2),o=i[5]===2?Cp(r,(n+i[4])/2):Av(i,Math.ceil((n+i[4])/4));return new rv(i[0],i[1],i[2],i[3],s,o)},rv=(function(){function A(e,t,i,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=n,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Pi],t=(t<<Ka)+(e&za),this.data[t];if(e<=65535)return t=this.index[yp+(e-55296>>Pi)],t=(t<<Ka)+(e&za),this.data[t];if(e<this.highStart)return t=qC-jC+(e>>Na),t=this.index[t],t+=e>>Pi&tv,t=this.index[t],t=(t<<Ka)+(e&za),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),vp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nv=typeof Uint8Array>"u"?[]:new Uint8Array(256),Qs=0;Qs<vp.length;Qs++)nv[vp.charCodeAt(Qs)]=Qs;var sv=1,Va=2,Wa=3,Tp=4,bp=5,ov=7,xp=8,Ga=9,Ra=10,Qp=11,Fp=12,Up=13,Sp=14,$a=15,av=function(A){for(var e=[],t=0,i=A.length;t<i;){var r=A.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var n=A.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},lv=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],r=-1,n="";++r<t;){var s=A[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(n+=String.fromCharCode.apply(String,i),i.length=0)}return n},cv=iv(zC),FA="×",Xa="÷",hv=function(A){return cv.get(A)},uv=function(A,e,t){var i=t-2,r=e[i],n=e[t-1],s=e[t];if(n===Va&&s===Wa)return FA;if(n===Va||n===Wa||n===Tp||s===Va||s===Wa||s===Tp)return Xa;if(n===xp&&[xp,Ga,Qp,Fp].indexOf(s)!==-1||(n===Qp||n===Ga)&&(s===Ga||s===Ra)||(n===Fp||n===Ra)&&s===Ra||s===Up||s===bp||s===ov||n===sv)return FA;if(n===Up&&s===Sp){for(;r===bp;)r=e[--i];if(r===Sp)return FA}if(n===$a&&s===$a){for(var o=0;r===$a;)o++,r=e[--i];if(o%2===0)return FA}return Xa},pv=function(A){var e=av(A),t=e.length,i=0,r=0,n=e.map(hv);return{next:function(){if(i>=t)return{done:!0,value:null};for(var s=FA;i<t&&(s=uv(e,n,++i))===FA;);if(s!==FA||i===t){var o=lv.apply(null,e.slice(r,i));return r=i,{value:o,done:!1}}return{done:!0,value:null}}}},dv=function(A){for(var e=pv(A),t=[],i;!(i=e.next()).done;)i.value&&t.push(i.value.slice());return t},fv=function(A){var e=123;if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var i=A.createElement("boundtest");i.style.height=e+"px",i.style.display="block",A.body.appendChild(i),t.selectNode(i);var r=t.getBoundingClientRect(),n=Math.round(r.height);if(A.body.removeChild(i),n===e)return!0}}return!1},gv=function(A){var e=A.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",A.body.appendChild(e);var t=A.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var i=e.firstChild,r=Jn(i.data).map(function(l){return It(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(i,n),t.setEnd(i,n+l.length);var h=t.getBoundingClientRect();n+=l.length;var m=h.x>s.x||h.y>s.y;return s=h,c===0?!0:m});return A.body.removeChild(e),o},mv=function(){return typeof new Image().crossOrigin<"u"},wv=function(){return typeof new XMLHttpRequest().responseType=="string"},Bv=function(A){var e=new Image,t=A.createElement("canvas"),i=t.getContext("2d");if(!i)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{i.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},Ep=function(A){return A[0]===0&&A[1]===255&&A[2]===0&&A[3]===255},yv=function(A){var e=A.createElement("canvas"),t=100;e.width=t,e.height=t;var i=e.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,t,t);var r=new Image,n=e.toDataURL();r.src=n;var s=Ja(t,t,0,0,r);return i.fillStyle="red",i.fillRect(0,0,t,t),Lp(s).then(function(o){i.drawImage(o,0,0);var l=i.getImageData(0,0,t,t).data;i.fillStyle="red",i.fillRect(0,0,t,t);var c=A.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",Ep(l)?Lp(Ja(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return i.drawImage(o,0,0),Ep(i.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ja=function(A,e,t,i,r){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",A.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",i.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(r),s},Lp=function(A){return new Promise(function(e,t){var i=new Image;i.onload=function(){return e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},Jt={get SUPPORT_RANGE_BOUNDS(){var A=fv(document);return Object.defineProperty(Jt,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=Jt.SUPPORT_RANGE_BOUNDS&&gv(document);return Object.defineProperty(Jt,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=Bv(document);return Object.defineProperty(Jt,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A=typeof Array.from=="function"&&typeof window.fetch=="function"?yv(document):Promise.resolve(!1);return Object.defineProperty(Jt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=mv();return Object.defineProperty(Jt,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A=wv();return Object.defineProperty(Jt,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Jt,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Jt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},Gr=(function(){function A(e,t){this.text=e,this.bounds=t}return A})(),Cv=function(A,e,t,i){var r=bv(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Jt.SUPPORT_RANGE_BOUNDS){var l=Mp(i,s,o.length).getClientRects();if(l.length>1){var c=Za(o),h=0;c.forEach(function(v){n.push(new Gr(v,ti.fromDOMRectList(A,Mp(i,h+s,v.length).getClientRects()))),h+=v.length})}else n.push(new Gr(o,ti.fromDOMRectList(A,l)))}else{var m=i.splitText(o.length);n.push(new Gr(o,vv(A,i))),i=m}else Jt.SUPPORT_RANGE_BOUNDS||(i=i.splitText(o.length));s+=o.length}),n},vv=function(A,e){var t=e.ownerDocument;if(t){var i=t.createElement("html2canvaswrapper");i.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(i,e);var n=Xn(A,i);return i.firstChild&&r.replaceChild(i.firstChild,i),n}}return ti.EMPTY},Mp=function(A,e,t){var i=A.ownerDocument;if(!i)throw new Error("Node has no owner document");var r=i.createRange();return r.setStart(A,e),r.setEnd(A,e+t),r},Za=function(A){if(Jt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(A)).map(function(t){return t.segment})}return dv(A)},Tv=function(A,e){if(Jt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(A)).map(function(i){return i.segment})}return Qv(A,e)},bv=function(A,e){return e.letterSpacing!==0?Za(A):Tv(A,e)},xv=[32,160,4961,65792,65793,4153,4241],Qv=function(A,e){for(var t=jB(A,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),i=[],r,n=function(){if(r.value){var s=r.value.slice(),o=Jn(s),l="";o.forEach(function(c){xv.indexOf(c)===-1?l+=It(c):(l.length&&i.push(l),i.push(It(c)),l="")}),l.length&&i.push(l)}};!(r=t.next()).done;)n();return i},Fv=(function(){function A(e,t,i){this.text=Uv(t.data,i.textTransform),this.textBounds=Cv(e,this.text,i,t)}return A})(),Uv=function(A,e){switch(e){case 1:return A.toLowerCase();case 3:return A.replace(Sv,Ev);case 2:return A.toUpperCase();default:return A}},Sv=/(^|\s|:|-|\(|\))([a-z])/g,Ev=function(A,e,t){return A.length>0?e+t.toUpperCase():A},Hp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return e})($A),Ip=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return e})($A),Pp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this,n=new XMLSerializer,s=Xn(t,i);return i.setAttribute("width",s.width+"px"),i.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(i)),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})($A),Dp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.value=i.value,r}return e})($A),Ya=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.start=i.start,r.reversed=typeof i.reversed=="boolean"&&i.reversed===!0,r}return e})($A),Lv=[{type:15,flags:0,unit:"px",number:3}],Mv=[{type:16,flags:0,number:50}],Hv=function(A){return A.width>A.height?new ti(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new ti(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A},Iv=function(A){var e=A.type===Pv?new Array(A.value.length+1).join("•"):A.value;return e.length===0?A.placeholder||"":e},Fs="checkbox",Us="radio",Pv="password",_p=707406591,qa=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=Iv(i),(r.type===Fs||r.type===Us)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=Hv(r.bounds)),r.type){case Fs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Lv;break;case Us:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Mv;break}return r}return e})($A),kp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this,n=i.options[i.selectedIndex||0];return r.value=n&&n.text||"",r}return e})($A),Op=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.value=i.value,r}return e})($A),Np=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;r.src=i.src,r.width=parseInt(i.width,10)||0,r.height=parseInt(i.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(i.contentWindow&&i.contentWindow.document&&i.contentWindow.document.documentElement){r.tree=zp(t,i.contentWindow.document.documentElement);var n=i.contentWindow.document.documentElement?zr(t,getComputedStyle(i.contentWindow.document.documentElement).backgroundColor):ii.TRANSPARENT,s=i.contentWindow.document.body?zr(t,getComputedStyle(i.contentWindow.document.body).backgroundColor):ii.TRANSPARENT;r.backgroundColor=wi(n)?wi(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})($A),Dv=["OL","UL","MENU"],Ss=function(A,e,t,i){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,Vp(r)&&r.data.trim().length>0)t.textNodes.push(new Fv(A,r,t.styles));else if(ji(r))if(Jp(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Ss(A,o,t,i)});else{var s=Kp(A,r);s.styles.isVisible()&&(_v(r,s,i)?s.flags|=4:kv(s.styles)&&(s.flags|=2),Dv.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Ss(A,r.shadowRoot,s,i):!Ls(r)&&!Wp(r)&&!Ms(r)&&Ss(A,r,s,i))}},Kp=function(A,e){return tl(e)?new Hp(A,e):Gp(e)?new Ip(A,e):Wp(e)?new Pp(A,e):Ov(e)?new Dp(A,e):Nv(e)?new Ya(A,e):Kv(e)?new qa(A,e):Ms(e)?new kp(A,e):Ls(e)?new Op(A,e):$p(e)?new Np(A,e):new $A(A,e)},zp=function(A,e){var t=Kp(A,e);return t.flags|=4,Ss(A,e,t,t),t},_v=function(A,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||el(A)&&t.styles.isTransparent()},kv=function(A){return A.isPositioned()||A.isFloating()},Vp=function(A){return A.nodeType===Node.TEXT_NODE},ji=function(A){return A.nodeType===Node.ELEMENT_NODE},ja=function(A){return ji(A)&&typeof A.style<"u"&&!Es(A)},Es=function(A){return typeof A.className=="object"},Ov=function(A){return A.tagName==="LI"},Nv=function(A){return A.tagName==="OL"},Kv=function(A){return A.tagName==="INPUT"},zv=function(A){return A.tagName==="HTML"},Wp=function(A){return A.tagName==="svg"},el=function(A){return A.tagName==="BODY"},Gp=function(A){return A.tagName==="CANVAS"},Rp=function(A){return A.tagName==="VIDEO"},tl=function(A){return A.tagName==="IMG"},$p=function(A){return A.tagName==="IFRAME"},Xp=function(A){return A.tagName==="STYLE"},Vv=function(A){return A.tagName==="SCRIPT"},Ls=function(A){return A.tagName==="TEXTAREA"},Ms=function(A){return A.tagName==="SELECT"},Jp=function(A){return A.tagName==="SLOT"},Zp=function(A){return A.tagName.indexOf("-")>0},Wv=(function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},A.prototype.pop=function(e){var t=this;e.forEach(function(i){return t.counters[i].pop()})},A.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,n=!0;i!==null&&i.forEach(function(o){var l=t.counters[o.counter];l&&o.increment!==0&&(n=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=o.increment)});var s=[];return n&&r.forEach(function(o){var l=t.counters[o.counter];s.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),s},A})(),Yp={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},qp={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Gv={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Rv={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},er=function(A,e,t,i,r,n){return A<e||A>t?$r(A,r,n.length>0):i.integers.reduce(function(s,o,l){for(;A>=o;)A-=o,s+=i.values[l];return s},"")+n},jp=function(A,e,t,i){var r="";do t||A--,r=i(A)+r,A/=e;while(A*e>=e);return r},Pt=function(A,e,t,i,r){var n=t-e+1;return(A<0?"-":"")+(jp(Math.abs(A),n,i,function(s){return It(Math.floor(s%n)+e)})+r)},Di=function(A,e,t){t===void 0&&(t=". ");var i=e.length;return jp(Math.abs(A),i,!1,function(r){return e[Math.floor(r%i)]})+t},tr=1,yi=2,Ci=4,Rr=8,ri=function(A,e,t,i,r,n){if(A<-9999||A>9999)return $r(A,4,r.length>0);var s=Math.abs(A),o=r;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var c=s%10;c===0&&Kt(n,tr)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Kt(n,yi)||c===1&&l===1&&Kt(n,Ci)&&A>100||c===1&&l>1&&Kt(n,Rr)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),s=Math.floor(s/10)}return(A<0?i:"")+o},ed="十百千萬",td="拾佰仟萬",Ad="マイナス",Al="마이너스",$r=function(A,e,t){var i=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=Pt(A,48,57,!0,i);return o.length<4?"0"+o:o;case 4:return Di(A,"〇一二三四五六七八九",r);case 6:return er(A,1,3999,Yp,3,i).toLowerCase();case 7:return er(A,1,3999,Yp,3,i);case 8:return Pt(A,945,969,!1,i);case 9:return Pt(A,97,122,!1,i);case 10:return Pt(A,65,90,!1,i);case 11:return Pt(A,1632,1641,!0,i);case 12:case 49:return er(A,1,9999,qp,3,i);case 35:return er(A,1,9999,qp,3,i).toLowerCase();case 13:return Pt(A,2534,2543,!0,i);case 14:case 30:return Pt(A,6112,6121,!0,i);case 15:return Di(A,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Di(A,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ri(A,"零一二三四五六七八九",ed,"負",r,yi|Ci|Rr);case 47:return ri(A,"零壹貳參肆伍陸柒捌玖",td,"負",r,tr|yi|Ci|Rr);case 42:return ri(A,"零一二三四五六七八九",ed,"负",r,yi|Ci|Rr);case 41:return ri(A,"零壹贰叁肆伍陆柒捌玖",td,"负",r,tr|yi|Ci|Rr);case 26:return ri(A,"〇一二三四五六七八九","十百千万",Ad,r,0);case 25:return ri(A,"零壱弐参四伍六七八九","拾百千万",Ad,r,tr|yi|Ci);case 31:return ri(A,"영일이삼사오육칠팔구","십백천만",Al,n,tr|yi|Ci);case 33:return ri(A,"零一二三四五六七八九","十百千萬",Al,n,0);case 32:return ri(A,"零壹貳參四五六七八九","拾百千",Al,n,tr|yi|Ci);case 18:return Pt(A,2406,2415,!0,i);case 20:return er(A,1,19999,Rv,3,i);case 21:return Pt(A,2790,2799,!0,i);case 22:return Pt(A,2662,2671,!0,i);case 22:return er(A,1,10999,Gv,3,i);case 23:return Di(A,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Di(A,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Pt(A,3302,3311,!0,i);case 28:return Di(A,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Di(A,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Pt(A,3792,3801,!0,i);case 37:return Pt(A,6160,6169,!0,i);case 38:return Pt(A,4160,4169,!0,i);case 39:return Pt(A,2918,2927,!0,i);case 40:return Pt(A,1776,1785,!0,i);case 43:return Pt(A,3046,3055,!0,i);case 44:return Pt(A,3174,3183,!0,i);case 45:return Pt(A,3664,3673,!0,i);case 46:return Pt(A,3872,3881,!0,i);default:return Pt(A,48,57,!0,i)}},id="data-html2canvas-ignore",rd=(function(){function A(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Wv,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return A.prototype.toIFrame=function(e,t){var i=this,r=$v(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=r.contentWindow,l=o.document,c=Zv(r).then(function(){return sA(i,void 0,void 0,function(){var h,m;return tA(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(eT),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),h=this.options.onclone,m=this.clonedReferenceElement,typeof m>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Jv(l)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(qv(document.doctype)+"<html></html>"),jv(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},A.prototype.createElementClone=function(e){if(Oa(e,2))debugger;if(Gp(e))return this.createCanvasClone(e);if(Rp(e))return this.createVideoClone(e);if(Xp(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return tl(t)&&(tl(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Zp(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return il(e.style,t),t},A.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},A.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),s=r.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var l=o.getContextAttributes();l?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},A.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},A.prototype.appendChildNode=function(e,t,i){(!ji(t)||!Vv(t)&&!t.hasAttribute(id)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!ji(t)||!Xp(t))&&e.appendChild(this.cloneNode(t,i))},A.prototype.cloneChildNodes=function(e,t,i){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(ji(n)&&Jp(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,i)})}else this.appendChildNode(t,n,i)},A.prototype.cloneNode=function(e,t){if(Vp(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&ji(e)&&(ja(e)||Es(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=i.getComputedStyle(e),s=i.getComputedStyle(e,":before"),o=i.getComputedStyle(e,":after");this.referenceElement===e&&ja(r)&&(this.clonedReferenceElement=r),el(r)&&iT(r);var l=this.counters.parse(new wp(this.context,n)),c=this.resolvePseudoContent(e,r,s,Xr.BEFORE);Zp(e)&&(t=!0),Rp(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var h=this.resolvePseudoContent(e,r,o,Xr.AFTER);return h&&r.appendChild(h),this.counters.pop(l),(n&&(this.options.copyStyles||Es(e))&&!$p(e)||t)&&il(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ls(e)||Ms(e))&&(Ls(r)||Ms(r))&&(r.value=e.value),r}return e.cloneNode(!1)},A.prototype.resolvePseudoContent=function(e,t,i,r){var n=this;if(i){var s=i.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||i.display==="none")){this.counters.parse(new wp(this.context,i));var l=new OC(this.context,i),c=o.createElement("html2canvaspseudoelement");il(i,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var v=o.createElement("img");v.src=m.value,v.style.opacity="1",c.appendChild(v)}else if(m.type===18){if(m.name==="attr"){var x=m.values.filter(yt);x.length&&c.appendChild(o.createTextNode(e.getAttribute(x[0].value)||""))}else if(m.name==="counter"){var F=m.values.filter(Yi),T=F[0],S=F[1];if(T&&yt(T)){var I=n.counters.getCounterValue(T.value),Q=S&&yt(S)?ka.parse(n.context,S.value):3;c.appendChild(o.createTextNode($r(I,Q,!1)))}}else if(m.name==="counters"){var N=m.values.filter(Yi),T=N[0],J=N[1],S=N[2];if(T&&yt(T)){var H=n.counters.getCounterValues(T.value),z=S&&yt(S)?ka.parse(n.context,S.value):3,re=J&&J.type===0?J.value:"",q=H.map(function(ne){return $r(ne,z,!1)}).join(re);c.appendChild(o.createTextNode(q))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(mp(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(mp(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=rl+" "+nl;var h=r===Xr.BEFORE?" "+rl:" "+nl;return Es(t)?t.className.baseValue+=h:t.className+=h,c}}},A.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},A})(),Xr;(function(A){A[A.BEFORE=0]="BEFORE",A[A.AFTER=1]="AFTER"})(Xr||(Xr={}));var $v=function(A,e){var t=A.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(id,"true"),A.body.appendChild(t),t},Xv=function(A){return new Promise(function(e){if(A.complete){e();return}if(!A.src){e();return}A.onload=e,A.onerror=e})},Jv=function(A){return Promise.all([].slice.call(A.images,0).map(Xv))},Zv=function(A){return new Promise(function(e,t){var i=A.contentWindow;if(!i)return t("No window assigned for iframe");var r=i.document;i.onload=A.onload=function(){i.onload=A.onload=null;var n=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(n),e(A))},50)}})},Yv=["all","d","content"],il=function(A,e){for(var t=A.length-1;t>=0;t--){var i=A.item(t);Yv.indexOf(i)===-1&&e.style.setProperty(i,A.getPropertyValue(i))}return e},qv=function(A){var e="";return A&&(e+="<!DOCTYPE ",A.name&&(e+=A.name),A.internalSubset&&(e+=A.internalSubset),A.publicId&&(e+='"'+A.publicId+'"'),A.systemId&&(e+='"'+A.systemId+'"'),e+=">"),e},jv=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},eT=function(A){var e=A[0],t=A[1],i=A[2];e.scrollLeft=t,e.scrollTop=i},tT=":before",AT=":after",rl="___html2canvas___pseudoelement_before",nl="___html2canvas___pseudoelement_after",nd=`{
6
+ `+n):i.stack=n}catch{}}throw i}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ei(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:n}=t;i!==void 0&&Hn.assertOptions(i,{silentJSONParsing:TA.transitional(TA.boolean),forcedJSONParsing:TA.transitional(TA.boolean),clarifyTimeoutError:TA.transitional(TA.boolean),legacyInterceptorReqResOrdering:TA.transitional(TA.boolean)},!1),r!=null&&(de.isFunction(r)?t.paramsSerializer={serialize:r}:Hn.assertOptions(r,{encode:TA.function,serialize:TA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Hn.assertOptions(t,{baseUrl:TA.spelling("baseURL"),withXsrfToken:TA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&de.merge(n.common,n[t.method]);n&&de.forEach(["delete","get","head","post","put","patch","common"],F=>{delete n[F]}),t.headers=pA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(T){if(typeof T.runWhen=="function"&&T.runWhen(t)===!1)return;l=l&&T.synchronous;const S=t.transitional||Ko;S&&S.legacyInterceptorReqResOrdering?o.unshift(T.fulfilled,T.rejected):o.push(T.fulfilled,T.rejected)});const c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});let h,m=0,v;if(!l){const F=[Mh.bind(this),void 0];for(F.unshift(...o),F.push(...c),v=F.length,h=Promise.resolve(t);m<v;)h=h.then(F[m++],F[m++]);return h}v=o.length;let x=t;for(;m<v;){const F=o[m++],T=o[m++];try{x=F(x)}catch(S){T.call(this,S);break}}try{h=Mh.call(this,x)}catch(F){return Promise.reject(F)}for(m=0,v=c.length;m<v;)h=h.then(c[m++],c[m++]);return h}getUri(e){e=Ei(this.defaults,e);const t=Ch(e.baseURL,e.url,e.allowAbsoluteUrls);return ph(t,e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],function(e){Li.prototype[e]=function(t,i){return this.request(Ei(i||{},{method:e,url:t,data:(i||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function t(i){return function(n,s,o){return this.request(Ei(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Li.prototype[e]=t(),Li.prototype[e+"Form"]=t(!0)});let p1=class hf{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(n){t=n});const i=this;this.promise.then(r=>{if(!i._listeners)return;let n=i._listeners.length;for(;n-- >0;)i._listeners[n](r);i._listeners=null}),this.promise.then=r=>{let n;const s=new Promise(o=>{i.subscribe(o),n=o}).then(r);return s.cancel=function(){i.unsubscribe(n)},s},e(function(n,s,o){i.reason||(i.reason=new br(n,s,o),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=i=>{e.abort(i)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new hf(function(r){e=r}),cancel:e}}};function d1(A){return function(t){return A.apply(null,t)}}function f1(A){return de.isObject(A)&&A.isAxiosError===!0}const Xo={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(Xo).forEach(([A,e])=>{Xo[e]=A});function Ph(A){const e=new Li(A),t=eh(Li.prototype.request,e);return de.extend(t,Li.prototype,e,{allOwnKeys:!0}),de.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Ph(Ei(A,r))},t}const Bt=Ph(vr);Bt.Axios=Li,Bt.CanceledError=br,Bt.CancelToken=p1,Bt.isCancel=mh,Bt.VERSION=Hh,Bt.toFormData=Un,Bt.AxiosError=tt,Bt.Cancel=Bt.CanceledError,Bt.all=function(e){return Promise.all(e)},Bt.spread=d1,Bt.isAxiosError=f1,Bt.mergeConfig=Ei,Bt.AxiosHeaders=pA,Bt.formToJSON=A=>fh(de.isHTMLForm(A)?new FormData(A):A),Bt.getAdapter=Lh.getAdapter,Bt.HttpStatusCode=Xo,Bt.default=Bt;const{Axios:Yb,AxiosError:qb,CanceledError:jb,isCancel:ex,CancelToken:tx,VERSION:Ax,all:ix,Cancel:rx,isAxiosError:nx,spread:sx,toFormData:ox,AxiosHeaders:ax,HttpStatusCode:lx,formToJSON:cx,getAdapter:hx,mergeConfig:ux}=Bt,VA=Object.create(null);VA.open="0",VA.close="1",VA.ping="2",VA.pong="3",VA.message="4",VA.upgrade="5",VA.noop="6";const In=Object.create(null);Object.keys(VA).forEach(A=>{In[VA[A]]=A});const Jo={type:"error",data:"parser error"},Dh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_h=typeof ArrayBuffer=="function",kh=A=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(A):A&&A.buffer instanceof ArrayBuffer,Zo=({type:A,data:e},t,i)=>Dh&&e instanceof Blob?t?i(e):Oh(e,i):_h&&(e instanceof ArrayBuffer||kh(e))?t?i(e):Oh(new Blob([e]),i):i(VA[A]+(e||"")),Oh=(A,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+(i||""))},t.readAsDataURL(A)};function Nh(A){return A instanceof Uint8Array?A:A instanceof ArrayBuffer?new Uint8Array(A):new Uint8Array(A.buffer,A.byteOffset,A.byteLength)}let Yo;function g1(A,e){if(Dh&&A.data instanceof Blob)return A.data.arrayBuffer().then(Nh).then(e);if(_h&&(A.data instanceof ArrayBuffer||kh(A.data)))return e(Nh(A.data));Zo(A,!1,t=>{Yo||(Yo=new TextEncoder),e(Yo.encode(t))})}const Kh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let A=0;A<Kh.length;A++)xr[Kh.charCodeAt(A)]=A;const m1=A=>{let e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);const c=new ArrayBuffer(e),h=new Uint8Array(c);for(i=0;i<t;i+=4)n=xr[A.charCodeAt(i)],s=xr[A.charCodeAt(i+1)],o=xr[A.charCodeAt(i+2)],l=xr[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},w1=typeof ArrayBuffer=="function",qo=(A,e)=>{if(typeof A!="string")return{type:"message",data:zh(A,e)};const t=A.charAt(0);return t==="b"?{type:"message",data:B1(A.substring(1),e)}:In[t]?A.length>1?{type:In[t],data:A.substring(1)}:{type:In[t]}:Jo},B1=(A,e)=>{if(w1){const t=m1(A);return zh(t,e)}else return{base64:!0,data:A}},zh=(A,e)=>e==="blob"?A instanceof Blob?A:new Blob([A]):A instanceof ArrayBuffer?A:A.buffer,Vh="",y1=(A,e)=>{const t=A.length,i=new Array(t);let r=0;A.forEach((n,s)=>{Zo(n,!1,o=>{i[s]=o,++r===t&&e(i.join(Vh))})})},C1=(A,e)=>{const t=A.split(Vh),i=[];for(let r=0;r<t.length;r++){const n=qo(t[r],e);if(i.push(n),n.type==="error")break}return i};function v1(){return new TransformStream({transform(A,e){g1(A,t=>{const i=t.length;let r;if(i<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,i);else if(i<65536){r=new Uint8Array(3);const n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{r=new Uint8Array(9);const n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}A.data&&typeof A.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let jo;function Pn(A){return A.reduce((e,t)=>e+t.length,0)}function Dn(A,e){if(A[0].length===e)return A.shift();const t=new Uint8Array(e);let i=0;for(let r=0;r<e;r++)t[r]=A[0][i++],i===A[0].length&&(A.shift(),i=0);return A.length&&i<A[0].length&&(A[0]=A[0].slice(i)),t}function T1(A,e){jo||(jo=new TextDecoder);const t=[];let i=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(i===0){if(Pn(t)<1)break;const l=Dn(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?i=3:r===126?i=1:i=2}else if(i===1){if(Pn(t)<2)break;const l=Dn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),i=3}else if(i===2){if(Pn(t)<8)break;const l=Dn(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(Jo);break}r=h*Math.pow(2,32)+c.getUint32(4),i=3}else{if(Pn(t)<r)break;const l=Dn(t,r);o.enqueue(qo(n?l:jo.decode(l),e)),i=0}if(r===0||r>A){o.enqueue(Jo);break}}}})}const Wh=4;function kt(A){if(A)return b1(A)}function b1(A){for(var e in kt.prototype)A[e]=kt.prototype[e];return A}kt.prototype.on=kt.prototype.addEventListener=function(A,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+A]=this._callbacks["$"+A]||[]).push(e),this},kt.prototype.once=function(A,e){function t(){this.off(A,t),e.apply(this,arguments)}return t.fn=e,this.on(A,t),this},kt.prototype.off=kt.prototype.removeListener=kt.prototype.removeAllListeners=kt.prototype.removeEventListener=function(A,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+A];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+A],this;for(var i,r=0;r<t.length;r++)if(i=t[r],i===e||i.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+A],this},kt.prototype.emit=function(A){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+A],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(t){t=t.slice(0);for(var i=0,r=t.length;i<r;++i)t[i].apply(this,e)}return this},kt.prototype.emitReserved=kt.prototype.emit,kt.prototype.listeners=function(A){return this._callbacks=this._callbacks||{},this._callbacks["$"+A]||[]},kt.prototype.hasListeners=function(A){return!!this.listeners(A).length};const _n=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),bA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),x1="arraybuffer";function px(){}function Gh(A,...e){return e.reduce((t,i)=>(A.hasOwnProperty(i)&&(t[i]=A[i]),t),{})}const Q1=bA.setTimeout,F1=bA.clearTimeout;function kn(A,e){e.useNativeTimers?(A.setTimeoutFn=Q1.bind(bA),A.clearTimeoutFn=F1.bind(bA)):(A.setTimeoutFn=bA.setTimeout.bind(bA),A.clearTimeoutFn=bA.clearTimeout.bind(bA))}const U1=1.33;function S1(A){return typeof A=="string"?E1(A):Math.ceil((A.byteLength||A.size)*U1)}function E1(A){let e=0,t=0;for(let i=0,r=A.length;i<r;i++)e=A.charCodeAt(i),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(i++,t+=4);return t}function Rh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function L1(A){let e="";for(let t in A)A.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(A[t]));return e}function M1(A){let e={},t=A.split("&");for(let i=0,r=t.length;i<r;i++){let n=t[i].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class H1 extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class ea extends kt{constructor(e){super(),this.writable=!1,kn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,i){return super.emitReserved("error",new H1(e,t,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=qo(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=L1(e);return t.length?"?"+t:""}}class I1 extends ea{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};C1(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,y1(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Rh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let $h=!1;try{$h=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const P1=$h;function D1(){}class _1 extends I1{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let i=location.port;i||(i=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}class WA extends kt{constructor(e,t,i){super(),this.createRequest=e,kn(this,i),this._opts=i,this._method=i.method||"GET",this._uri=t,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;const t=Gh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(t);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&i.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var r;i.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=WA.requestsCount++,WA.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=D1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete WA.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(WA.requestsCount=0,WA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xh);else if(typeof addEventListener=="function"){const A="onpagehide"in bA?"pagehide":"unload";addEventListener(A,Xh,!1)}}function Xh(){for(let A in WA.requests)WA.requests.hasOwnProperty(A)&&WA.requests[A].abort()}const k1=(function(){const A=Jh({xdomain:!1});return A&&A.responseType!==null})();class O1 extends _1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=k1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new WA(Jh,this.uri(),e)}}function Jh(A){const e=A.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||P1))return new XMLHttpRequest}catch{}if(!e)try{return new bA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Zh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class N1 extends ea{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,i=Zh?{}:Gh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,i)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],r=t===e.length-1;Zo(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}r&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Rh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const ta=bA.WebSocket||bA.MozWebSocket;class K1 extends N1{createSocket(e,t,i){return Zh?new ta(e,t,i):t?new ta(e,t):new ta(e)}doWrite(e,t){this.ws.send(t)}}class z1 extends ea{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=T1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),r=v1();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{i.read().then(({done:o,value:l})=>{o||(this.onPacket(l),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],r=t===e.length-1;this._writer.write(i).then(()=>{r&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const V1={websocket:K1,webtransport:z1,polling:O1},W1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,G1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Aa(A){if(A.length>8e3)throw"URI too long";const e=A,t=A.indexOf("["),i=A.indexOf("]");t!=-1&&i!=-1&&(A=A.substring(0,t)+A.substring(t,i).replace(/:/g,";")+A.substring(i,A.length));let r=W1.exec(A||""),n={},s=14;for(;s--;)n[G1[s]]=r[s]||"";return t!=-1&&i!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=R1(n,n.path),n.queryKey=$1(n,n.query),n}function R1(A,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function $1(A,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,n){r&&(t[r]=n)}),t}const ia=typeof addEventListener=="function"&&typeof removeEventListener=="function",On=[];ia&&addEventListener("offline",()=>{On.forEach(A=>A())},!1);class ci extends kt{constructor(e,t){if(super(),this.binaryType=x1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const i=Aa(e);t.hostname=i.host,t.secure=i.protocol==="https"||i.protocol==="wss",t.port=i.port,i.query&&(t.query=i.query)}else t.host&&(t.hostname=Aa(t.host).host);kn(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(i=>{const r=i.prototype.name;this.transports.push(r),this._transportsByName[r]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=M1(this.opts.query)),ia&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},On.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Wh,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ci.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ci.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i<this.writeBuffer.length;i++){const r=this.writeBuffer[i].data;if(r&&(t+=S1(r)),i>0&&t>this._maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,_n(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,i){return this._sendPacket("message",e,t,i),this}send(e,t,i){return this._sendPacket("message",e,t,i),this}_sendPacket(e,t,i,r){if(typeof t=="function"&&(r=t,t=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const n={type:e,data:t,options:i};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(ci.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ia&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=On.indexOf(this._offlineEventListener);i!==-1&&On.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ci.protocol=Wh;class X1 extends ci{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),i=!1;ci.priorWebsocketSuccess=!1;const r=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ci.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function n(){i||(i=!0,h(),t.close(),t=null)}const s=m=>{const v=new Error("probe error: "+m);v.transport=t.name,n(),this.emitReserved("upgradeError",v)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const h=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}let J1=class extends X1{constructor(e,t={}){const i=typeof e=="object"?e:t;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(r=>V1[r]).filter(r=>!!r)),super(e,i)}};function Z1(A,e="",t){let i=A;t=t||typeof location<"u"&&location,A==null&&(A=t.protocol+"//"+t.host),typeof A=="string"&&(A.charAt(0)==="/"&&(A.charAt(1)==="/"?A=t.protocol+A:A=t.host+A),/^(https?|wss?):\/\//.test(A)||(typeof t<"u"?A=t.protocol+"//"+A:A="https://"+A),i=Aa(A)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+e,i.href=i.protocol+"://"+n+(t&&t.port===i.port?"":":"+i.port),i}const Y1=typeof ArrayBuffer=="function",q1=A=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(A):A.buffer instanceof ArrayBuffer,Yh=Object.prototype.toString,j1=typeof Blob=="function"||typeof Blob<"u"&&Yh.call(Blob)==="[object BlobConstructor]",ew=typeof File=="function"||typeof File<"u"&&Yh.call(File)==="[object FileConstructor]";function ra(A){return Y1&&(A instanceof ArrayBuffer||q1(A))||j1&&A instanceof Blob||ew&&A instanceof File}function Nn(A,e){if(!A||typeof A!="object")return!1;if(Array.isArray(A)){for(let t=0,i=A.length;t<i;t++)if(Nn(A[t]))return!0;return!1}if(ra(A))return!0;if(A.toJSON&&typeof A.toJSON=="function"&&arguments.length===1)return Nn(A.toJSON(),!0);for(const t in A)if(Object.prototype.hasOwnProperty.call(A,t)&&Nn(A[t]))return!0;return!1}function tw(A){const e=[],t=A.data,i=A;return i.data=na(t,e),i.attachments=e.length,{packet:i,buffers:e}}function na(A,e){if(!A)return A;if(ra(A)){const t={_placeholder:!0,num:e.length};return e.push(A),t}else if(Array.isArray(A)){const t=new Array(A.length);for(let i=0;i<A.length;i++)t[i]=na(A[i],e);return t}else if(typeof A=="object"&&!(A instanceof Date)){const t={};for(const i in A)Object.prototype.hasOwnProperty.call(A,i)&&(t[i]=na(A[i],e));return t}return A}function Aw(A,e){return A.data=sa(A.data,e),delete A.attachments,A}function sa(A,e){if(!A)return A;if(A&&A._placeholder===!0){if(typeof A.num=="number"&&A.num>=0&&A.num<e.length)return e[A.num];throw new Error("illegal attachments")}else if(Array.isArray(A))for(let t=0;t<A.length;t++)A[t]=sa(A[t],e);else if(typeof A=="object")for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&(A[t]=sa(A[t],e));return A}const iw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ct;(function(A){A[A.CONNECT=0]="CONNECT",A[A.DISCONNECT=1]="DISCONNECT",A[A.EVENT=2]="EVENT",A[A.ACK=3]="ACK",A[A.CONNECT_ERROR=4]="CONNECT_ERROR",A[A.BINARY_EVENT=5]="BINARY_EVENT",A[A.BINARY_ACK=6]="BINARY_ACK"})(ct||(ct={}));class rw{constructor(e){this.replacer=e}encode(e){return(e.type===ct.EVENT||e.type===ct.ACK)&&Nn(e)?this.encodeAsBinary({type:e.type===ct.EVENT?ct.BINARY_EVENT:ct.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ct.BINARY_EVENT||e.type===ct.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=tw(e),i=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(i),r}}class oa extends kt{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const i=t.type===ct.BINARY_EVENT;i||t.type===ct.BINARY_ACK?(t.type=i?ct.EVENT:ct.ACK,this.reconstructor=new nw(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(ra(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const i={type:Number(e.charAt(0))};if(ct[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ct.BINARY_EVENT||i.type===ct.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");i.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););i.nsp=e.substring(n,t)}else i.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const n=t+1;for(;++t;){const s=e.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===e.length)break}i.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(oa.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ct.CONNECT:return qh(t);case ct.DISCONNECT:return t===void 0;case ct.CONNECT_ERROR:return typeof t=="string"||qh(t);case ct.EVENT:case ct.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&iw.indexOf(t[0])===-1);case ct.ACK:case ct.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class nw{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Aw(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function qh(A){return Object.prototype.toString.call(A)==="[object Object]"}const sw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:oa,Encoder:rw,get PacketType(){return ct}},Symbol.toStringTag,{value:"Module"}));function HA(A,e,t){return A.on(e,t),function(){A.off(e,t)}}const ow=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class jh extends kt{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[HA(e,"open",this.onopen.bind(this)),HA(e,"packet",this.onpacket.bind(this)),HA(e,"error",this.onerror.bind(this)),HA(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var i,r,n;if(ow.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ct.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,m=t.pop();this._registerAckCallback(h,m),s.id=h}const o=(r=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var i;const r=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((i,r)=>{const n=(s,o)=>s?r(s):i(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ct.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ct.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ct.EVENT:case ct.BINARY_EVENT:this.onevent(e);break;case ct.ACK:case ct.BINARY_ACK:this.onack(e);break;case ct.DISCONNECT:this.ondisconnect();break;case ct.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let i=!1;return function(...r){i||(i=!0,t.packet({type:ct.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ct.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const i of t)i.apply(this,e.data)}}}function Ri(A){A=A||{},this.ms=A.min||100,this.max=A.max||1e4,this.factor=A.factor||2,this.jitter=A.jitter>0&&A.jitter<=1?A.jitter:0,this.attempts=0}Ri.prototype.duration=function(){var A=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*A);A=(Math.floor(e*10)&1)==0?A-t:A+t}return Math.min(A,this.max)|0},Ri.prototype.reset=function(){this.attempts=0},Ri.prototype.setMin=function(A){this.ms=A},Ri.prototype.setMax=function(A){this.max=A},Ri.prototype.setJitter=function(A){this.jitter=A};class aa extends kt{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,kn(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ri({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||sw;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new J1(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=HA(t,"open",function(){i.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=HA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(HA(e,"ping",this.onping.bind(this)),HA(e,"data",this.ondata.bind(this)),HA(e,"error",this.onerror.bind(this)),HA(e,"close",this.onclose.bind(this)),HA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){_n(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new jh(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;i<t.length;i++)this.engine.write(t[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Qr={};function Kn(A,e){typeof A=="object"&&(e=A,A=void 0),e=e||{};const t=Z1(A,e.path||"/socket.io"),i=t.source,r=t.id,n=t.path,s=Qr[r]&&n in Qr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new aa(i,e):(Qr[r]||(Qr[r]=new aa(i,e)),l=Qr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Kn,{Manager:aa,Socket:jh,io:Kn,connect:Kn});function la(A){if(!A)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(A,e),i=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${i}`}catch{return String(A).trim().replace(/\/+$/,"")}}let yA=la("http://localhost:8000");function eu(A){const e=la(A);e&&e!==yA&&(yA=e,Mt&&(Mt.disconnect(),Mt.removeAllListeners(),Mt=null))}let Mt=null;function aw(){const A=()=>{try{return sessionStorage.getItem("token")||sessionStorage.getItem("authToken")||sessionStorage.getItem("accessToken")||sessionStorage.getItem("jwt_token")}catch{return null}},e=A();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:yA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=Kn(yA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),i=()=>{const r=A();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:yA,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",r=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:r,socketId:t.id})}),t.on("connect_error",r=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:r?.message,description:r?.description,context:r?.context,type:r?.type,baseUrl:yA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=i();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:yA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:yA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function ca(){const A=la(Mt?.io?.uri||null);return!Mt||Mt.io&&A&&yA&&A!==yA?(Mt&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:A,newBaseUrl:yA,wasConnected:Mt.connected,reason:"baseUrl changed"}),Mt.disconnect(),Mt.removeAllListeners(),Mt=null),Mt=aw()):Mt.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Mt.id,connected:Mt.connected,baseUrl:yA,uri:A}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Mt.id,baseUrl:yA}),Mt}function lw(A,e){const t=ca();return t.on(A,e),()=>t.off(A,e)}function cw(A,e){Mt&&Mt.off(A,e)}function hw(A,e){ca().emit(A,e)}function uw(){return Mt?Mt.connected?"connected":"connecting":"disconnected"}const zn={getSocket:ca,on:lw,off:cw,emit:hw,getStatus:uw,setBaseUrl:eu},pw={},tu=Y.createContext(),$t=()=>{const A=Y.useContext(tu);if(!A)throw new Error("useTrading must be used within TradingProvider");return A},dw=({children:A,baseUrl:e,endpoints:t,accountId:i,initialSymbol:r,initialTimeframe:n,indicators:s,indicatorSettings:o})=>{const l=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ys&&Ys.tagName.toUpperCase()==="SCRIPT"&&Ys.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&pw?.VITE_BASE_URL)??"http://localhost:5002";zn.setBaseUrl(l);const h={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},m=t?.params||{},[v,x]=Y.useState(r||"BTC/USD"),[F,T]=Y.useState(n||"M1"),[S,I]=Y.useState([]),[Q,N]=Y.useState(!0),[J,H]=Y.useState([]),[z,re]=Y.useState(!1),[q,ie]=Y.useState(1e5),[G,ne]=Y.useState(null),[le,ee]=Y.useState([]),[we,j]=Y.useState(!0),[ge,ae]=Y.useState(!1),[pe,ue]=Y.useState(!0),[oe,fe]=Y.useState("candles"),[Qe,me]=Y.useState(!1),[xe,Se]=Y.useState(null),[Me,$e]=Y.useState("dark"),[Ye,Ie]=Y.useState(null),[We,De]=Y.useState(!1),[Ze,nt]=Y.useState(!1),[dt,He]=Y.useState(!1),[zt,ye]=Y.useState(!1),[Te,ve]=Y.useState(!1),[be,Le]=Y.useState(!1),[Ee,Ke]=Y.useState(!1),[wt,Dt]=Y.useState(!1),[ni,ZA]=Y.useState(!1),[aA,si]=Y.useState(!1),[_A,YA]=Y.useState([]),Zt=Y.useRef(null),Yt=Y.useRef(new Map),Qt=Y.useRef(null),Lt=1e3,Ct=Y.useCallback(async()=>{if(i)try{const ze=sessionStorage.getItem("token")??sessionStorage.getItem("authToken");if(!ze)return;re(!0);const Ve=await Bt.get(`${l}/trades/account/${i}`,{headers:{Authorization:`Bearer ${ze}`}});let At=[];Array.isArray(Ve.data)?At=Ve.data:Ve.data?.data&&Array.isArray(Ve.data.data)&&(At=Ve.data.data);const st=At.filter(Ge=>Ge.closePrice===null||Ge.closePrice===void 0).map(Ge=>({id:Ge.id,ticket:23,symbol:Ge.symbol,type:Ge.type,volume:Ge.volume,openPrice:Ge.openPrice??Ge.price,stopLoss:Ge.stopLoss,takeProfit:Ge.takeProfit,comment:Ge.comment||"",status:"OPEN",swap:0,profit:Ge.profit||0,profitCurrency:"USD",time:new Date(Ge.openedAt||Ge.openAt||Date.now()).toLocaleTimeString(),openAt:Ge.openedAt||Ge.openAt,closeAt:Ge.closedAt||Ge.closeAt}));H(st)}catch(ze){console.error("❌ Error fetching orders:",ze.response?.data||ze.message),H([])}finally{re(!1)}},[l,i]),Ut=Y.useCallback((ze,Ve)=>!Ve||!ze.price||isNaN(Ve)||isNaN(ze.price)?ze.profit||0:(ze?.type?.toUpperCase()==="BUY"?Ve-ze.price:ze.price-Ve)*ze.volume,[]),Vt=Y.useCallback(async()=>{try{const ze=sessionStorage.getItem("token")??sessionStorage.getItem("authToken");if(!ze)return;const Ve=await Bt.get(`${l}${h.account}`,{headers:{Authorization:`Bearer ${ze}`}});if(Ve.data&&Ve.data.data){const At=parseFloat(Ve.data.data.balance);isNaN(At)||ie(At)}}catch(ze){console.error("❌ Error fetching user balance:",ze.response?.data||ze.message)}},[l]),je=Y.useCallback(async()=>{if(i)try{const ze=sessionStorage.getItem("token")??sessionStorage.getItem("authToken");if(!ze)return;const Ve=await Bt.get(`${l}/trades/account/${i}`,{headers:{Authorization:`Bearer ${ze}`}});let At=[];Array.isArray(Ve.data)?At=Ve.data:Ve.data?.data&&Array.isArray(Ve.data.data)&&(At=Ve.data.data);const st=At.filter(Ge=>Ge.closePrice!==null&&Ge.closePrice!==void 0).map(Ge=>({id:Ge.id,ticket:23,symbol:Ge.symbol,type:Ge.type,volume:Ge.volume,openPrice:Ge.openPrice??Ge.price,closePrice:Ge.closePrice,stopLoss:Ge.stopLoss,takeProfit:Ge.takeProfit,profit:Ge.profit??Ge.profitLoss??0,profitCurrency:"USD",openAt:Ge.openedAt||Ge.openAt,closeAt:Ge.closedAt||Ge.closeAt,closeReason:Ge.closeReason||"",status:"CLOSED"}));YA(st)}catch(ze){console.error("❌ Error fetching history orders:",ze.response?.data||ze.message),YA([])}},[l,i]),_e=Y.useMemo(()=>{const ze=q,Ve=J.reduce((at,Ne)=>at+Ne.volume*Ne.price*.01,0),At=J.reduce((at,Ne)=>{const Wt=S.find(lA=>lA.symbol===Ne.symbol);if(Wt){const lA=Ne.type?.toUpperCase()==="BUY"?parseFloat(Wt.bid||0):parseFloat(Wt.ask||0);if(lA&&lA>0&&!isNaN(lA))return at+Ut(Ne,lA)}return at+(Ne.profit||0)},0),st=ze+At,Ge=st-Ve,ft=Ve>0?st/Ve*100:0;return{balance:ze,equity:st,margin:Ve,freeMargin:Ge,level:ft.toFixed(2)}},[J,S,q,Ut]);Y.useEffect(()=>{(sessionStorage.getItem("token")??sessionStorage.getItem("authToken"))&&i&&(Ct(),Vt(),je())},[Ct,Vt,je,i]),Y.useEffect(()=>{(async()=>{try{N(!0);const Ve=h.symbols.includes("?")?`${l}${h.symbols}`:`${l}${h.symbols}`,At=sessionStorage.getItem("token")??sessionStorage.getItem("authToken"),st=await Bt.get(Ve,{headers:At?{Authorization:`Bearer ${At}`}:{}});let Ge=[];Array.isArray(st.data)?Ge=st.data:st.data&&st.data.data&&Array.isArray(st.data.data)?Ge=st.data.data:st.data&&st.data.prices&&Array.isArray(st.data.prices)?Ge=st.data.prices:st.data&&Array.isArray(st.data)&&(Ge=st.data);const ft=Ge.map(at=>{const Ne=at.symbol||at.name||"",Wt=at.category||null;return Ne&&(at.bid!==void 0||at.price!==void 0)?{symbol:Ne,bid:at.bid??at.price??0,ask:at.ask??at.price??0,change:at.change??0,category:Wt}:{...at,symbol:Ne,category:Wt}});ft.length>0?(I(ft),ft.find(Ne=>Ne.symbol===v)||x(ft[0].symbol)):I([])}catch(Ve){console.error("❌ Error fetching symbols:",Ve.response?.data||Ve.message),I([])}finally{N(!1)}})()},[l,h.symbols]);const Je=Y.useCallback(()=>{const ze=Yt.current;if(ze.size===0)return;const Ve=new Map(ze);ze.clear(),I(At=>At.map(st=>{const Ge=Ve.get(st.symbol);return Ge?{...st,...Ge}:st})),H(At=>{let st=!1;const Ge=At.map(ft=>{const at=Ve.get(ft.symbol);if(!at)return ft;const Ne=ft.type?.toUpperCase()==="BUY"?parseFloat(at.bid||0):parseFloat(at.ask||0);if(!Ne||isNaN(Ne)||Ne<=0)return ft;const Wt=Ut(ft,Ne);return Wt===ft.profit?ft:(st=!0,{...ft,profit:Wt})});return st?Ge:At})},[Ut]);Y.useEffect(()=>{Zt.current||(Zt.current=zn.getSocket());const ze=Zt.current,Ve=()=>{console.log("✅ TradingContext: Connected"),i&&Number.isFinite(Number(i))&&ze.emit("joinUserRoom",{userId:Number(i)})},At=()=>console.log("⚠️ TradingContext: Disconnected"),st=ft=>{ft?.symbol&&(Yt.current.set(ft.symbol,ft),Qt.current||(Qt.current=setTimeout(()=>{Qt.current=null,Je()},Lt)))},Ge=async ft=>{if(ft){if(ft.newBalance!==void 0){const at=parseFloat(ft.newBalance);isNaN(at)||ie(at)}if(window.notify){const at=ft.profitLoss||ft.profit||0,Ne=at>=0?`+${at.toFixed(2)}`:at.toFixed(2),Wt=ft.symbol||"Trade",lA=ft.reason||"Closed";window.notify(`Trade Closed: ${lA} | ${Wt} | P/L: ${Ne} USD`,at>=0?"success":"error")}ft.tradeId&&H(at=>at.filter(Ne=>Ne.id!==ft.tradeId)),await Ct(),await Vt()}};return ze.on("connect",Ve),ze.on("disconnect",At),ze.on("priceUpdate",st),ze.on("tradeClosed",Ge),ze.connected&&i&&Number.isFinite(Number(i))&&ze.emit("joinUserRoom",{userId:Number(i)}),()=>{ze.off("connect",Ve),ze.off("disconnect",At),ze.off("priceUpdate",st),ze.off("tradeClosed",Ge),Qt.current&&(clearTimeout(Qt.current),Qt.current=null),Yt.current.clear()}},[Je,Ct,Vt]),Y.useEffect(()=>{try{const ze=document.documentElement;if(!ze)return;ze.dataset.theme=Me}catch{}},[Me]);const et=Y.useMemo(()=>S.find(ze=>ze.symbol===v)||{bid:"0.00000",ask:"0.00000",change:0},[S,v]),bt=Y.useMemo(()=>({selectedSymbol:v,setSelectedSymbol:x,selectedTimeframe:F,setSelectedTimeframe:T,symbols:S,setSymbols:I,symbolsLoading:Q,orders:J,setOrders:H,ordersLoading:z,fetchOrders:Ct,fetchUserBalance:Vt,userBalance:q,setUserBalance:ie,accountSummary:_e,currentSymbolData:et,activeTool:G,setActiveTool:ne,chartObjects:le,setChartObjects:ee,showGrid:we,setShowGrid:j,snapToGrid:ge,setSnapToGrid:ae,drawingsVisible:pe,setDrawingsVisible:ue,chartType:oe,setChartType:fe,chartLocked:Qe,setChartLocked:me,selectedTradeForModify:xe,setSelectedTradeForModify:Se,theme:Me,setTheme:$e,candleColors:Ye,setCandleColors:Ie,showTradeOrders:We,setShowTradeOrders:De,showTradePosition:Ze,setShowTradePosition:nt,showTradeHistory:dt,setShowTradeHistory:He,showSLTP:zt,setShowSLTP:ye,showAskPrice:Te,setShowAskPrice:ve,showChartControls:be,setShowChartControls:Le,showTradeNotification:Ee,setShowTradeNotification:Ke,showCrosshair:wt,setShowCrosshair:Dt,showOHLC:ni,setShowOHLC:ZA,baseUrl:l,endpoints:h,endpointParams:m,accountId:i,isShow:aA,setIsShow:si,historyOrders:_A,setHistoryOrders:YA,fetchHistoryOrders:je,indicators:s,indicatorSettings:o}),[v,F,S,Q,J,z,Ct,Vt,q,_e,et,G,le,we,ge,pe,oe,Qe,xe,Me,Ye,We,Ze,dt,zt,Te,be,Ee,wt,ni,l,h,m,aA,_A,je,s,o]);return a.jsx(tu.Provider,{value:bt,children:A})};var Au={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},iu=Y.createContext&&Y.createContext(Au),fw=["attr","size","title"];function gw(A,e){if(A==null)return{};var t=mw(A,e),i,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(A);for(r=0;r<n.length;r++)i=n[r],!(e.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(A,i)&&(t[i]=A[i])}return t}function mw(A,e){if(A==null)return{};var t={};for(var i in A)if(Object.prototype.hasOwnProperty.call(A,i)){if(e.indexOf(i)>=0)continue;t[i]=A[i]}return t}function Vn(){return Vn=Object.assign?Object.assign.bind():function(A){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(A[i]=t[i])}return A},Vn.apply(this,arguments)}function ru(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(A,r).enumerable})),t.push.apply(t,i)}return t}function Wn(A){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ru(Object(t),!0).forEach(function(i){ww(A,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):ru(Object(t)).forEach(function(i){Object.defineProperty(A,i,Object.getOwnPropertyDescriptor(t,i))})}return A}function ww(A,e,t){return e=Bw(e),e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function Bw(A){var e=yw(A,"string");return typeof e=="symbol"?e:e+""}function yw(A,e){if(typeof A!="object"||!A)return A;var t=A[Symbol.toPrimitive];if(t!==void 0){var i=t.call(A,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(A)}function nu(A){return A&&A.map((e,t)=>Y.createElement(e.tag,Wn({key:t},e.attr),nu(e.child)))}function nA(A){return e=>Y.createElement(Cw,Vn({attr:Wn({},A.attr)},e),nu(A.child))}function Cw(A){var e=t=>{var{attr:i,size:r,title:n}=A,s=gw(A,fw),o=r||t.size||"1em",l;return t.className&&(l=t.className),A.className&&(l=(l?l+" ":"")+A.className),Y.createElement("svg",Vn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,i,s,{className:l,style:Wn(Wn({color:A.color||t.color},t.style),A.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Y.createElement("title",null,n),A.children)};return iu!==void 0?Y.createElement(iu.Consumer,null,t=>e(t)):e(Au)}function vw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(A)}function Tw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(A)}function bw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(A)}function xw(A){return nA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(A)}function su(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(A)}function Qw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(A)}function Fw(A){return nA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(A)}function Uw(A){return nA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(A)}function Sw(A){return nA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(A)}function Ew(A){return nA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(A)}const Lw={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ou=({bidPrice:A,askPrice:e,userAccountId:t,onTradeExecuted:i,onExecuteTrade:r,forceParentExecution:n=!1})=>{const{theme:s,selectedSymbol:o,fetchOrders:l,baseUrl:c,endpoints:h}=$t(),m=s==="light",[v,x]=Y.useState("0.01"),[F,T]=Y.useState(""),[S,I]=Y.useState(!1),Q=m?"bg-slate-100":"bg-[#12161d]",N=m?"text-slate-700":"text-white",J=m?"hover:bg-slate-200":"hover:bg-[#1e2635]",H=re=>{const q=parseFloat(v)||.01,ie=Math.max(.01,q+re);x(ie.toFixed(2))},z=async re=>{T("");const q=re,ie=parseFloat(q==="BUY"?e:A),G=parseFloat(v);if(!G||G<=0||isNaN(G)){T("Please enter a valid volume (minimum 0.01)");return}if(G<.01){T("Volume must be at least 0.01");return}if(!ie||ie<=0||isNaN(ie)){T("Invalid price. Please refresh and try again.");return}const ne=sessionStorage.getItem("token")??sessionStorage.getItem("authToken");if(!ne){T("Please login to place trades");return}I(!0);const le=typeof o=="object"?o?.symbol:o;if(r){try{await Promise.resolve(r({symbol:le,type:q,lotSize:G,entryPrice:ie,stopLoss:null,takeProfit:null})),l&&l(),i&&i()}catch(we){const j=we?.message||"Trade execution failed";T(j)}finally{I(!1)}return}if(n){T("Trade handler not configured"),I(!1);return}const ee={accountId:t,symbol:le,type:q,volume:G,openPrice:ie,takeProfit:null,stopLoss:null};try{const we=c||Lw?.VITE_BASE_URL||"http://localhost:8000",j=h?.trades||"/api/trades",ge=await Bt.post(`${we}${j}`,ee,{headers:{Authorization:`Bearer ${ne}`,"Content-Type":"application/json"}});if(ge.status<200||ge.status>=300){T(ge.data?.message||`Failed to place trade (${ge.status})`);return}l&&l(),i&&i()}catch(we){const j=we?.response?.data?.message||we?.message||"Network error. Please try again.";T(j)}finally{I(!1)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[a.jsxs("button",{onClick:()=>z("SELL"),disabled:S,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:A?Number(A).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${Q}`,children:[a.jsx("button",{type:"button",onClick:()=>H(-.01),className:`w-5 flex items-center justify-center ${N} ${J} transition-colors`,children:a.jsx(su,{size:8})}),a.jsx("input",{type:"number",value:v,onChange:re=>{const q=re.target.value;(q===""||/^\d*\.?\d{0,2}$/.test(q))&&x(q)},onBlur:()=>{const re=parseFloat(v);x(isNaN(re)||re<.01?"0.01":re.toFixed(2))},className:`w-14 text-center focus:outline-none ${Q} ${N}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>H(.01),className:`w-5 flex items-center justify-center ${N} ${J} transition-colors`,children:a.jsx(Qw,{size:8})})]}),a.jsxs("button",{onClick:()=>z("BUY"),disabled:S,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),F&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:F})]})},Mw={},au=({isOpen:A,onClose:e,orderType:t,bidPrice:i,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:m,selectedTimeframe:v,setOrders:x,symbols:F,fetchOrders:T,theme:S,baseUrl:I,endpoints:Q}=$t(),N=S==="light",J={getContractSpec:be=>{const Le=String(be||"").toUpperCase();return Le.includes("BTC")||Le.includes("ETH")||Le.includes("SOL")||Le.includes("XRP")||Le.includes("ADA")||Le.includes("DOGE")||Le.includes("BNB")||Le.includes("AVAX")||Le.includes("DOT")||Le.includes("LINK")||Le.endsWith("USDT")?{contractSize:1}:Le.includes("XAU")||Le.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:be,volume:Le})=>{const Ee=J.getContractSpec(be);return(parseFloat(Le)||0)*(Ee.contractSize||1)}},H=h||J,[z,re]=Y.useState("0.01"),[q,ie]=Y.useState(""),[G,ne]=Y.useState(""),[le,ee]=Y.useState(""),[we,j]=Y.useState(!1),[ge,ae]=Y.useState(null),[pe,ue]=Y.useState(""),[oe,fe]=Y.useState(t||"BUY"),[Qe,me]=Y.useState(parseFloat(i)||0),[xe,Se]=Y.useState(parseFloat(r)||0),[Me,$e]=Y.useState("text-white"),[Ye,Ie]=Y.useState("text-white"),We=Y.useRef(parseFloat(i)||0),De=Y.useRef(parseFloat(r)||0);Y.useEffect(()=>{if(!A)return;const be=zn.getSocket(),Le=Ke=>{if(!(!Ke||!Ke.symbol)&&Ke.symbol.toUpperCase()===m?.toUpperCase()){const wt=parseFloat(Ke.bid)||0,Dt=parseFloat(Ke.ask)||0;wt>0&&(wt>We.current?($e("text-green-400"),setTimeout(()=>$e("text-white"),500)):wt<We.current&&We.current>0&&($e("text-red-400"),setTimeout(()=>$e("text-white"),500)),me(wt),We.current=wt),Dt>0&&(Dt>De.current?(Ie("text-green-400"),setTimeout(()=>Ie("text-white"),500)):Dt<De.current&&De.current>0&&(Ie("text-red-400"),setTimeout(()=>Ie("text-white"),500)),Se(Dt),De.current=Dt)}};be.on("priceUpdate",Le);const Ee=F.find(Ke=>Ke.symbol===m);if(Ee){const Ke=parseFloat(Ee.bid)||0,wt=parseFloat(Ee.ask)||0;Ke>0&&(me(Ke),We.current=Ke),wt>0&&(Se(wt),De.current=wt)}return()=>{be.off("priceUpdate",Le)}},[A,m,F]),Y.useEffect(()=>{if(A){re(o?String(o):"0.01"),ie(""),ne(""),ee(""),ue(""),fe(t||"BUY");const be=parseFloat(i)||0,Le=parseFloat(r)||0;be>0&&(me(be),We.current=be),Le>0&&(Se(Le),De.current=Le)}},[A,t,o]);const Ze=Qe||0,nt=xe||0,dt=be=>{const Le=parseFloat(z)||.01,Ee=Math.max(.01,Le+be);re(Ee.toFixed(2))},He=be=>{const Le=parseFloat(q)||0,Ee=parseFloat(oe==="BUY"?xe:Qe)||0;if(!Ee){ue("Current price not available. Please wait...");return}let Ke=Le+be;oe==="BUY"?Ke=Math.max(1e-5,Math.min(Ke,Ee-1e-5)):Ke=Math.max(Ee+1e-5,Ke),ie(Ke>0?Ke.toFixed(5):""),ue("")},zt=be=>{const Le=parseFloat(G)||0,Ee=parseFloat(oe==="BUY"?xe:Qe)||0;if(!Ee){ue("Current price not available. Please wait...");return}let Ke=Le+be;oe==="BUY"?Ke=Math.max(Ee+1e-5,Ke):Ke=Math.max(1e-5,Math.min(Ke,Ee-1e-5)),ne(Ke>0?Ke.toFixed(5):""),ue("")},ye=async be=>{ue("");const Le=be||oe,Ee=parseFloat(Le==="BUY"?xe:Qe),Ke=parseFloat(z),wt=q?parseFloat(q):null,Dt=G?parseFloat(G):null;if(!Ke||Ke<=0||isNaN(Ke)){ue("Please enter a valid volume (minimum 0.01)");return}if(Ke<.01){ue("Volume must be at least 0.01");return}if(!Ee||Ee<=0||isNaN(Ee)){ue("Invalid price. Please refresh and try again.");return}if(wt!==null&&wt!==""){if(isNaN(wt)||wt<=0){ue("Stop Loss must be a valid positive number");return}if(Le==="BUY"&&wt>=Ee){ue("Stop Loss must be below the current price for BUY orders");return}if(Le==="SELL"&&wt<=Ee){ue("Stop Loss must be above the current price for SELL orders");return}}if(Dt!==null&&Dt!==""){if(isNaN(Dt)||Dt<=0){ue("Take Profit must be a valid positive number");return}if(Le==="BUY"){if(Dt<=Ee){ue(`Take Profit must be above the entry price (${Ee.toFixed(5)}) for BUY orders`);return}}else if(Le==="SELL"&&Dt>=Ee){ue(`Take Profit must be below the entry price (${Ee.toFixed(5)}) for SELL orders`);return}}fe(Le),ae(Le),j(!0);const ni=new Date,ZA=ni.toLocaleTimeString(),aA=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,si=sessionStorage.getItem("token")??sessionStorage.getItem("authToken");if(!si){ue("Please login to place trades"),j(!1),ae(null);return}const _A={accountId:s,symbol:m,type:Le,volume:Ke,price:Ee,takeProfit:Dt,stopLoss:wt,comment:le.trim()||null},YA={ticket:aA.substring(0,8),symbol:m,type:Le,volume:parseFloat(Ke),price:parseFloat(Ee),time:ZA,stopLoss:wt?parseFloat(wt):null,takeProfit:Dt?parseFloat(Dt):null,swap:0,profit:0,profitCurrency:"USD",comment:le.trim()||"",id:aA,status:"OPEN",openAt:ni.toISOString()};if(!l&&x&&x(Zt=>[...Zt,YA]),c&&!n){ue("Execution handler is required in forceParentExecution mode"),j(!1),ae(null);return}if(n){j(!1),ae(null),e();const Zt={symbol:m,type:Le,lotSize:Ke,entryPrice:Ee,stopLoss:wt,takeProfit:Dt,comment:le.trim()||null};Promise.resolve(n(Zt)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),T&&T()}).catch(Yt=>{console.error("❌ Trade execution failed:",Yt),!l&&x&&x(Qt=>Qt.filter(Lt=>Lt.id!==aA))})}else{if(c){ue("Fallback API path disabled in forceParentExecution mode"),j(!1),ae(null);return}j(!1),ae(null),e();const Zt=I||Mw?.VITE_BASE_URL||"http://localhost:8000",Yt=Q?.trades||"/api/trades";Bt.post(`${Zt}${Yt}`,_A,{headers:{Authorization:`Bearer ${si}`,"Content-Type":"application/json"}}).then(Qt=>{if(Qt.data&&Qt.data.data){const Lt=Qt.data.data.trade;!l&&x&&x(Ct=>Ct.map(Ut=>Ut.id===aA?{...Ut,id:Lt.id,ticket:Lt.id.substring(0,8),time:ZA,openAt:Lt.openAt}:Ut)),console.log("✅ Trade saved successfully:",Lt),window.notify&&window.notify(`Trade placed successfully: ${Lt.symbol} ${Lt.type}`,"success")}else{!l&&x&&x(Ct=>Ct.filter(Ut=>Ut.id!==aA));const Lt=Qt.data?.message||"Failed to place trade";window.notify&&window.notify(Lt,"error")}}).catch(Qt=>{console.error("Error placing trade:",Qt),!l&&x&&x(Ct=>Ct.filter(Ut=>Ut.id!==aA));let Lt="Failed to place trade";if(Qt.response){const Ct=Qt.response.status,Ut=Qt.response.data;Ct===400?Lt=Ut?.message||"Invalid trade data. Please check your inputs.":Ct===401?Lt="Authentication failed. Please login again.":Ct===404?Lt=Ut?.message||"Symbol not found. Please select a valid symbol.":Ct===500?Lt="Server error. Please try again later.":Lt=Ut?.message||`Error: ${Ct}`}else Qt.request&&(Lt="Network error. Please check your internet connection.");window.notify&&window.notify(Lt,"error")})}},ve=(H?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return A?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${N?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${N?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${N?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${N?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${N?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[pe&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:pe}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[ve," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>dt(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:z,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d{0,2}$/.test(Le))&&(re(Le),ue(""))},onBlur:()=>{const be=parseFloat(z);re(isNaN(be)||be<.01?"0.01":be.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),a.jsx("button",{type:"button",onClick:()=>dt(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>He(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:q,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d*$/.test(Le))&&(ie(Le),ue(""))},onBlur:be=>{const Le=parseFloat(be.target.value);!isNaN(Le)&&Le>0?ie(Le.toFixed(5)):be.target.value===""&&ie("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>He(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>zt(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:G,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d*$/.test(Le))&&(ne(Le),ue(""))},onBlur:be=>{const Le=parseFloat(be.target.value);!isNaN(Le)&&Le>0?ne(Le.toFixed(5)):be.target.value===""&&ne("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>zt(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${N?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:le,onChange:be=>ee(be.target.value),placeholder:"Optional comment",rows:2,className:`w-full px-3 py-2 rounded text-sm focus:outline-none focus:border-secondary resize-none ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${N?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${Me} font-medium transition-colors duration-400`,children:Ze>0?Ze.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Ye} font-medium transition-colors duration-400`,children:nt>0?nt.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>ye("SELL"),disabled:we,className:"px-4 py-3 bg-rose-600 hover:bg-rose-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:we&&ge==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),a.jsx("button",{onClick:()=>ye("BUY"),disabled:we,className:"px-4 py-3 bg-sky-600 hover:bg-sky-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:we&&ge==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null},Hw={text:"Text",trendline:"Trend Line",parallellines:"Parallel Channel",fibonacci:"Fibonacci Retracement",rectangle:"Rectangle",pricelevel:"Horizontal Line",horizontalray:"Horizontal Ray",verticalline:"Vertical Line",infoline:"Info Line",rulerline:"Ruler Line",arrowedline:"Arrowed Line",rayline:"Ray",extendedline:"Extended Line",crossline:"Cross Line",trendbyangle:"Trend By Angle",disjointchannel:"Disjoint Channel",flattopbottom:"Flat Top/Bottom",regressionchannel:"Regression Channel",stddevchannel:"StdDev Channel",andrewspitchfork:"Andrew's Pitchfork",gannline:"Gann Line",gannfan:"Gann Fan",ganngrid:"Gann Grid",circle:"Circle",triangle:"Triangle",ellipse:"Ellipse",equidistantchannel:"Equidistant Channel"},Iw=[10,11,12,14,16,20,24,28,30,40],Gn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],hi={width:"78%",height:"78%",display:"block"},lu={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Pw(A){return A?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function Nt(A,e="#5f8f96"){if(typeof A!="string")return e;const t=A.trim();if(!t)return e;const i=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(i)?i.toLowerCase():e}const Dw=()=>a.jsx(Sw,{style:hi}),_w=()=>a.jsx(Ew,{style:hi}),kw=()=>a.jsx(xw,{style:hi}),Ow=()=>a.jsx(Uw,{style:hi}),Nw=()=>a.jsx(Tw,{style:hi}),Kw=()=>a.jsx(vw,{style:hi}),zw=()=>a.jsx(bw,{style:hi}),Vw=()=>a.jsx(su,{style:hi}),ha=({size:A,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:A,height:A},children:e});function Fr({checked:A,onClick:e,hideLeftBorder:t,tokens:i,children:r,title:n}){return a.jsx("button",{type:"button",onClick:e,title:n,style:{display:"flex",width:30,height:30,alignItems:"center",justifyContent:"center",border:`1px solid ${i.border}`,borderLeftWidth:t?0:1,background:A?i.activeFill:"transparent",color:A?i.activeText:i.text,cursor:"pointer",padding:0},children:a.jsx(ha,{size:"18px",children:r})})}function ke({checked:A,onChange:e,label:t,tokens:i,disabled:r=!1}){return a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:r?.5:1,cursor:r?"default":"pointer"},children:[a.jsx("input",{type:"checkbox",checked:A,onChange:n=>e(n.target.checked),disabled:r,style:lu}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${i.border}`,background:i.fieldBg},children:A&&a.jsx("span",{style:{width:10,height:10,background:i.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:i.text},children:t})]})}function ht({value:A,onChange:e,onBlur:t,disabled:i=!1,tokens:r}){const n=Nt(A,"#5f8f96"),s=(A||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:i?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:i?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:h=>e(h.target.value),disabled:i,style:{...lu,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:h=>{const m=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:i,style:c})]})}function mt({tokens:A,disabled:e=!1,style:t={},...i}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?A.fieldDisabledBg:A.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?A.fieldDisabledBg:A.fieldBg,color:e?A.fieldDisabledText:A.text,...t},...i})}function ui({value:A,onChange:e,tokens:t,disabled:i=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:A,onChange:e,disabled:i,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${i?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:i?t.fieldDisabledBg:t.fieldBg,color:i?t.fieldDisabledText:t.text,cursor:i?"default":"pointer",opacity:i?.5:1},children:n}),a.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(Vw,{})})]})}function Ww({draft:A,setDraft:e,tokens:t}){const i=A.visibleTimeframes?.length===Gn.length,r=()=>{e(s=>({...s,visibleTimeframes:i?[]:Gn.map(o=>o.key)}))},n=s=>{e(o=>{const l=o.visibleTimeframes||[];return{...o,visibleTimeframes:l.includes(s)?l.filter(c=>c!==s):[...l,s]}})};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsx(ke,{checked:i,onChange:r,label:"Show on all the timeframes",tokens:t}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:Gn.map(s=>a.jsx(ke,{checked:(A.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:i},s.key))})]})}function Gw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{i(n,Nt(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.color||"#5f8f96",onChange:n=>i("color",n),onBlur:()=>r("color",A.color,"#5f8f96"),tokens:t}),a.jsx(ui,{value:A.fontSize||12,onChange:n=>i("fontSize",Number(n.target.value)),tokens:t,width:84,children:Iw.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Fr,{checked:A.fontWeight==="bold",onClick:()=>i("fontWeight",A.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(kw,{})}),a.jsx(Fr,{checked:A.fontStyle==="italic",onClick:()=>i("fontStyle",A.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Ow,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Fr,{checked:A.textAlign==="left",onClick:()=>i("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(Nw,{})}),a.jsx(Fr,{checked:A.textAlign==="center",onClick:()=>i("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Kw,{})}),a.jsx(Fr,{checked:A.textAlign==="right",onClick:()=>i("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(zw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(ke,{checked:!!A.textWrap,onChange:n=>i("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(ke,{checked:!!A.borderEnabled,onChange:n=>i("borderEnabled",n),label:"Border",tokens:t}),a.jsx(ht,{value:A.borderColor||"#5f8f96",onChange:n=>i("borderColor",n),onBlur:()=>r("borderColor",A.borderColor,"#5f8f96"),disabled:!A.borderEnabled,tokens:t}),a.jsx(mt,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!A.borderEnabled,value:A.borderOpacity??.1,onChange:n=>i("borderOpacity",Number(n.target.value))}),a.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!A.borderEnabled,value:A.borderWidth??1,onChange:n=>i("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:A.borderWidth??1})]}),a.jsx(ke,{checked:!!A.bgEnabled,onChange:n=>i("bgEnabled",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.bgColor||"#5f8f96",onChange:n=>i("bgColor",n),onBlur:()=>r("bgColor",A.bgColor,"#5f8f96"),disabled:!A.bgEnabled,tokens:t}),a.jsx(mt,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!A.bgEnabled,value:A.bgOpacity??.1,onChange:n=>i("bgOpacity",Number(n.target.value))}),a.jsx("div",{})]}),a.jsx("textarea",{value:A.text||"",onChange:n=>i("text",n.target.value),placeholder:"Your text",rows:4,style:{width:"100%",resize:"none",border:`1px solid ${t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text}})]})}function Rw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#7aa6ae",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Rn({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#22c55e",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsAngle,onChange:n=>i("statsAngle",n),label:"Angle",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function $w({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showArea!==!1,onChange:n=>i("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function Xw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsAngle,onChange:n=>i("statsAngle",n),label:"Angle",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Jw({draft:A,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:i=>{const r=Number(i.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function dA(A){if(!A)return"";const e=new Date(A*1e3),t=i=>String(i).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function xA({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:n}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:n}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]})]})}function cu({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=!A.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:s=>i("lineColor",s),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:s=>i("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showPrice!==!1,onChange:s=>i("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(ke,{checked:!!A.showText,onChange:s=>i("showText",s),label:"Show text",tokens:t}),a.jsx(ht,{value:A.textColor||"#ffffff",onChange:s=>i("textColor",s),onBlur:()=>r("textColor",A.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(ui,{value:A.textHAlign??"center",onChange:s=>i("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(ui,{value:A.textVAlign??"top",onChange:s=>i("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:A.textContent||"",onChange:s=>i("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function Zw({draft:A,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"Price"}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:i=>{const r=Number(i.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Yw({draft:A,setDraft:e,tokens:t}){const i={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.originTime),style:r}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function qw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showDate!==!1,onChange:n=>i("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function jw({draft:A,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.rawTime),style:t})]})})}function eB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#7aa6ae",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function tB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#06a0e3",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:!!A.showTime,onChange:n=>i("showTime",n),label:"Show time",tokens:t}),a.jsx(ke,{checked:!!A.showPrice,onChange:n=>i("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function AB({draft:A,setDraft:e,tokens:t}){const i={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.rawTime),style:r}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function iB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=(s,o,l,c,h,m)=>a.jsxs(a.Fragment,{children:[a.jsx(ke,{checked:!!A[h],onChange:v=>i(h,v),label:s,tokens:t}),a.jsx(ht,{value:A[o]||m,onChange:v=>i(o,v),onBlur:()=>r(o,A[o],m),tokens:t}),a.jsx(mt,{tokens:t,value:A[l]??.35,onChange:v=>{const x=parseFloat(v.target.value);Number.isFinite(x)&&i(l,Math.max(0,Math.min(1,x)))},style:{width:60}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A[c]??1,onChange:v=>i(c,Number(v.target.value)),style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A[c]??1})]})]});return a.jsxs("div",{style:{padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr auto 2fr",gap:14,marginBottom:14},children:[n("Base line","baseLineColor","baseLineOpacity","baseLineWidth","showBaseLine","#ff0000"),n("Upper line","upperLineColor","upperLineOpacity","upperLineWidth","showUpperLine","#0000ff"),n("Lower line","lowerLineColor","lowerLineOpacity","lowerLineWidth","showLowerLine","#0000ff")]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:s=>i("showBackground",s),label:"Background",tokens:t}),a.jsx("span",{style:{fontSize:12,color:t.text},children:"Opacity"}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:70},children:"Extension"}),a.jsx(ke,{checked:!!A.extendLeft,onChange:s=>i("extendLeft",s),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.extendRight,onChange:s=>i("extendRight",s),label:"Right",tokens:t})]}),a.jsx(ke,{checked:!!A.showPearsonsR,onChange:s=>i("showPearsonsR",s),label:"Show Pearson's R",tokens:t})]})]})}function rB({draft:A,tokens:e}){const t={height:30,width:"100%",border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText},i={display:"grid",gridTemplateColumns:"100px 1fr",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:t})]}),a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:e.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:t})]})]})}function nB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.strokeColor||"#8b5cf6",onChange:n=>i("strokeColor",n),onBlur:()=>r("strokeColor",A.strokeColor,"#8b5cf6"),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??1,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr auto 2fr",gap:14},children:[a.jsx(ke,{checked:!!A.showMiddleLine,onChange:n=>i("showMiddleLine",n),label:"Middle line",tokens:t}),a.jsx(ht,{value:A.middleLineColor||"#8b5cf6",onChange:n=>i("middleLineColor",n),onBlur:()=>r("middleLineColor",A.middleLineColor,"#8b5cf6"),tokens:t,disabled:!A.showMiddleLine}),a.jsx(mt,{tokens:t,disabled:!A.showMiddleLine,value:A.middleLineOpacity??.5,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("middleLineOpacity",Math.max(0,Math.min(1,s)))},style:{width:60}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.middleLineWidth??1,onChange:n=>i("middleLineWidth",Number(n.target.value)),disabled:!A.showMiddleLine,style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.middleLineWidth??1})]}),a.jsx(ke,{checked:!!A.showBackground,onChange:n=>i("showBackground",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.backgroundColor||"#b4a7d6",onChange:n=>i("backgroundColor",n),onBlur:()=>r("backgroundColor",A.backgroundColor,"#b4a7d6"),tokens:t,disabled:!A.showBackground}),a.jsx(mt,{tokens:t,disabled:!A.showBackground,value:A.backgroundOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("backgroundOpacity",Math.max(0,Math.min(1,s)))},style:{width:60}}),a.jsx("div",{})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]})]})}function sB({draft:A,setDraft:e,tokens:t}){const i=(o,l)=>{const c=parseFloat(l);Number.isFinite(c)&&e(h=>({...h,[o]:c}))},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText},n={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},s={display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:r}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:o=>i("point1Price",o.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:r}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:o=>i("point2Price",o.target.value)})]}),a.jsxs("div",{style:s,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:o=>i("point3Price",o.target.value)})]})]})}function oB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>e(c=>{const h=c.rays?[...c.rays]:[];return h[s]={...h[s],[o]:l},{...c,rays:h}}),n=[...A.rays??[]].reverse();return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsx("div",{style:{display:"grid",gridTemplateColumns:"60px 1fr 2fr 1fr",gap:8,alignItems:"center"},children:n.map((s,o)=>{const l=(A.rays??[]).findIndex(c=>c.ratio===s.ratio);return a.jsxs(Y.Fragment,{children:[a.jsx(mt,{tokens:t,value:s.label,onChange:c=>{const h=parseFloat(c.target.value);Number.isFinite(h)&&h>0&&r(l,"ratio",h),r(l,"label",c.target.value)},onBlur:c=>{const h=parseFloat(c.target.value);Number.isFinite(h)&&h>0&&(r(l,"ratio",h),r(l,"label",h%1===0?h.toFixed(2):String(h)))},style:{width:60}}),a.jsx(ht,{value:s.color||"#888888",onChange:c=>r(l,"color",c),onBlur:()=>r(l,"color",Nt(s.color,"#888888")),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:s.width??1,onChange:c=>r(l,"width",Number(c.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:s.width??1})]}),a.jsx("div",{})]},o)})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.backgroundColor||"#3b82f6",onChange:s=>i("backgroundColor",s),onBlur:()=>i("backgroundColor",Nt(A.backgroundColor,"#3b82f6")),tokens:t}),a.jsx("span",{style:{fontSize:12,color:t.text},children:"Background"}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:60}})]}),a.jsx(ke,{checked:!!A.showLabels,onChange:s=>i("showLabels",s),label:"Show labels",tokens:t})]})}function aB({draft:A,setDraft:e,tokens:t}){const i=(r,n)=>e(s=>({...s,[r]:n}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Divisions"}),a.jsx(mt,{tokens:t,value:A.divisions??8,min:2,max:50,step:1,onChange:r=>i("divisions",Number(r.target.value)),onBlur:r=>i("divisions",Math.max(2,Math.min(50,parseInt(r.target.value)||8))),style:{width:60}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Line color"}),a.jsx(ht,{value:A.lineColor??"#94a3b8",onChange:r=>i("lineColor",r),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Line width"}),a.jsx("input",{type:"range",min:1,max:5,step:1,value:A.lineWidth??1,onChange:r=>i("lineWidth",Number(r.target.value)),style:{flex:1}}),a.jsx("span",{style:{fontSize:11,color:t.mutedText,minWidth:16,textAlign:"right"},children:A.lineWidth??1})]}),a.jsx(ke,{label:"Show background",checked:A.showBackground!==!1,onChange:r=>i("showBackground",r),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Background"}),a.jsx(ht,{value:A.backgroundColor??"#3b82f6",onChange:r=>i("backgroundColor",r),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.08,min:0,max:1,step:.01,onChange:r=>i("backgroundOpacity",parseFloat(r.target.value)||0),onBlur:r=>i("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(r.target.value)||0))),style:{width:60}})]})]})}function lB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=(s,o,l)=>e(c=>{const h=c.levels?[...c.levels]:[];return h[s]={...h[s],[o]:l},{...c,levels:h}});return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.medianColor||"#a50000",onChange:s=>i("medianColor",s),onBlur:()=>r("medianColor",A.medianColor,"#a50000"),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.medianWidth??1,onChange:s=>i("medianWidth",Number(s.target.value)),style:{flex:1,width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.medianWidth??1})]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"auto 40px 1fr 2fr",gap:8,alignItems:"center"},children:(A.levels??[]).map((s,o)=>a.jsxs(Y.Fragment,{children:[a.jsx("input",{type:"checkbox",checked:!!s.enabled,onChange:l=>n(o,"enabled",l.target.checked),style:{accentColor:t.headerBlue,margin:0}}),a.jsx("span",{style:{fontSize:12,color:t.text},children:s.label}),a.jsx(ht,{value:s.color||"#888888",onChange:l=>n(o,"color",l),onBlur:()=>n(o,"color",Nt(s.color,"#888888")),tokens:t,disabled:!s.enabled}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:s.width??1,onChange:l=>n(o,"width",Number(l.target.value)),disabled:!s.enabled,style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:s.width??1})]})]},s.k))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:s=>i("showBackground",s),label:"Background",tokens:t}),a.jsx(mt,{tokens:t,disabled:!A.showBackground,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:60}})]})]})}function cB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=parseFloat(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText},n={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:r}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:r}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point3Time),style:r}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:s=>i("point3Price",s.target.value)})]})]})}function ua({draft:A,setDraft:e,tokens:t,strokeDefault:i="#7aa6ae",bgDefault:r="#b4a7d6"}){const n=(s,o)=>e(l=>({...l,[s]:o}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.strokeColor||i,onChange:s=>n("strokeColor",s),onBlur:()=>n("strokeColor",Nt(A.strokeColor,i)),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??1,onChange:s=>n("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{fontSize:12,color:t.text,minWidth:12,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:A.showBackground!==!1,onChange:s=>n("showBackground",s),label:"Background",tokens:t}),a.jsx(ht,{value:A.backgroundColor||r,onChange:s=>n("backgroundColor",s),onBlur:()=>n("backgroundColor",Nt(A.backgroundColor,r)),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,min:0,max:1,step:.01,onChange:s=>n("backgroundOpacity",parseFloat(s.target.value)||0),onBlur:s=>n("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(s.target.value)||0))),style:{width:60}})]})]})}function hB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function uB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function pB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function dB({draft:A,setDraft:e,tokens:t}){const i=(h,m)=>e(v=>({...v,[h]:m})),r=h=>{if(!h)return"";const m=new Date(h*1e3),v=String(m.getUTCDate()).padStart(2,"0"),x=String(m.getUTCMonth()+1).padStart(2,"0"),F=m.getUTCFullYear(),T=String(m.getUTCHours()).padStart(2,"0"),S=String(m.getUTCMinutes()).padStart(2,"0"),I=String(m.getUTCSeconds()).padStart(2,"0");return`${v}.${x}.${F} ${T}:${S}:${I}`},n={display:"grid",gridTemplateColumns:"110px 1fr 100px",gap:8,alignItems:"center",marginBottom:6},s={fontSize:12,color:t.mutedText},o={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 6px",fontSize:12,background:t.fieldDisabledBg,color:t.fieldDisabledText,boxSizing:"border-box"},l={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 6px",fontSize:12,background:t.fieldBg,color:t.text,boxSizing:"border-box",outline:"none"},c=[{label:"#1 (Bar, Price)",timeKey:"point1Time",priceKey:"point1Price"},{label:"#2 (Bar, Price)",timeKey:"point2Time",priceKey:"point2Price"},{label:"#3 (Bar, Price)",timeKey:"point3Time",priceKey:"point3Price"}];return a.jsx("div",{style:{padding:"12px 16px"},children:c.map(({label:h,timeKey:m,priceKey:v})=>a.jsxs("div",{style:n,children:[a.jsx("span",{style:s,children:h}),a.jsx("input",{style:o,value:r(A[m]),readOnly:!0}),a.jsx("input",{type:"number",style:l,value:A[v]??0,step:"0.00001",onChange:x=>i(v,parseFloat(x.target.value)||0)})]},h))})}function fB({draft:A,setDraft:e,tokens:t}){const i=(r,n)=>e(s=>({...s,[r]:n}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ht,{value:A.strokeColor??"#7aa6ae",onChange:r=>i("strokeColor",r),tokens:t}),a.jsx("input",{type:"range",min:1,max:5,step:1,value:A.lineWidth??1,onChange:r=>i("lineWidth",Number(r.target.value)),style:{flex:1}}),a.jsx("span",{style:{fontSize:11,color:t.mutedText,minWidth:16,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ke,{label:"Background",checked:A.showBackground!==!1,onChange:r=>i("showBackground",r),tokens:t}),a.jsx(ht,{value:A.backgroundColor??"#94a3b8",onChange:r=>i("backgroundColor",r),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.18,min:0,max:1,step:.01,onChange:r=>i("backgroundOpacity",r),onBlur:r=>i("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(r)||0))),style:{width:60}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[a.jsx("span",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Extension"}),a.jsx(ke,{label:"Left",checked:!!A.extendLeft,onChange:r=>i("extendLeft",r),tokens:t}),a.jsx(ke,{label:"Right",checked:!!A.extendRight,onChange:r=>i("extendRight",r),tokens:t})]})]})}function gB({draft:A,tokens:e}){const t=[{label:"#1 (Bar, Price)",time:A.point1Time,price:A.point1Price},{label:"#2 (Bar, Price)",time:A.point1Time,price:A.point4Price},{label:"#3 (Bar, Price)",time:A.point2Time,price:A.point1Price},{label:"#4 (Bar, Price)",time:A.point2Time,price:A.point4Price}],i={height:28,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 6px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText},r={height:28,width:80,border:`1px solid ${e.fieldBorder}`,padding:"0 6px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"12px 16px"},children:t.map((n,s)=>a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"110px 1fr 80px",alignItems:"center",gap:6},children:[a.jsx("span",{style:{fontSize:12,color:e.mutedText},children:n.label}),a.jsx("input",{readOnly:!0,value:n.time?new Date(n.time*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).replace(",",""):"—",style:i}),a.jsx("input",{readOnly:!0,value:n.price!=null?Number(n.price).toFixed(5):"—",style:r})]},s))})}function hu({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#129f5c",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:n=>i("showBackground",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.fillColor||"#6aa84f",onChange:n=>i("fillColor",n),onBlur:()=>r("fillColor",A.fillColor,"#6aa84f"),tokens:t}),a.jsx(mt,{tokens:t,value:A.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showPrices,onChange:n=>i("showPrices",n),label:"Prices",tokens:t}),a.jsx(ht,{value:A.pricesColor||"#129f5c",onChange:n=>i("pricesColor",n),onBlur:()=>r("pricesColor",A.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]})]})}function uu({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:n}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:n}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:s=>i("point3Price",s.target.value)})]})]})}function mB(A){if(!A)return{};const e={visibleTimeframes:A.visibleTimeframes||Gn.map(t=>t.key)};if(A.type==="gannline"){const t=typeof A.series?.options=="function"?A.series.options():{};return{...e,lineColor:t.color??A.lineColor??"#7aa6ae",lineWidth:t.lineWidth??A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsDistance:A.statsDistance??!1,point1Price:A.point1?.price??0,point1Time:A.point1?.rawTime??A.point1?.time??0,point2Price:A.point2?.price??0,point2Time:A.point2?.rawTime??A.point2?.time??0}}if(A.type==="trendline"){const t=typeof A.series?.options=="function"?A.series.options():{};return{...e,lineColor:t.color??A.lineColor??"#22c55e",lineWidth:t.lineWidth??A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.point1?.price??0,point1Time:A.point1?.rawTime??A.point1?.time??0,point2Price:A.point2?.price??0,point2Time:A.point2?.rawTime??A.point2?.time??0}}if(A.type==="text")return{...e,text:A.primitive?.text??A.text??"Text",color:A.primitive?.color??"#5f8f96",fontSize:A.primitive?.fontSize??12,fontWeight:A.primitive?.fontWeight??"normal",fontStyle:A.primitive?.fontStyle??"normal",textAlign:A.primitive?.textAlign??"center",textWrap:A.primitive?.textWrap??!1,borderEnabled:A.primitive?.borderEnabled??!1,borderColor:A.primitive?.borderColor??"#5f8f96",borderOpacity:A.primitive?.borderOpacity??.1,borderWidth:A.primitive?.borderWidth??1,bgEnabled:A.primitive?.bgEnabled??!1,bgColor:A.primitive?.bgColor??"#5f8f96",bgOpacity:A.primitive?.bgOpacity??.1,price:A.price};if(A.type==="pricelevel")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showPrice:A.showPrice??!0,showText:A.showText??!1,textContent:A.textContent??"",textColor:A.textColor??"#ffffff",textHAlign:A.textHAlign??"center",textVAlign:A.textVAlign??"top",price:A.price};if(A.type==="horizontalray")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showPrice:A.showPrice??!0,showText:A.showText??!1,textContent:A.textContent??"",textColor:A.textColor??"#ffffff",textHAlign:A.textHAlign??"center",textVAlign:A.textVAlign??"top",price:A.price,originTime:A.rawOriginTime??A.originTime};if(A.type==="verticalline")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showDate:A.showDate!==!1,rawTime:A.rawTime};if(A.type==="infoline")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!0,statsPriceRange:A.statsPriceRange??!0,statsBarsRange:A.statsBarsRange??!0,statsDateRange:A.statsDateRange??!0,statsAngle:A.statsAngle??!0,statsDistance:A.statsDistance??!0,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="arrowedline")return{...e,lineColor:A.lineColor??"#f59e0b",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight!==!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="rayline")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="extendedline")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft!==!1,rayRight:A.rayRight!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="crossline")return{...e,lineColor:A.lineColor??"#06a0e3",lineWidth:A.lineWidth??2,showTime:A.showTime??!1,showPrice:A.showPrice??!1,rawTime:A.p?.rawTime??0,price:A.p?.price??0};if(A.type==="trendbyangle")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="disjointchannel")return{...e,lineColor:A.lineColor??"#129f5c",lineWidth:A.lineWidth??2,fillColor:A.fillColor??"#6aa84f",fillOpacity:A.fillOpacity??.1,showBackground:A.showBackground!==!1,showPrices:A.showPrices!==!1,pricesColor:A.pricesColor??"#129f5c",rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p3?.price??0,point2Time:A.p3?.rawTime??0,point3Price:A.p2?.price??0};if(A.type==="flattopbottom")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,fillColor:A.fillColor??"#3b82f6",fillOpacity:A.fillOpacity??.12,showBackground:A.showBackground!==!1,showPrices:A.showPrices!==!1,pricesColor:A.pricesColor??"#3b82f6",rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p3?.price??0,point2Time:A.p3?.rawTime??0,point3Price:A.p2?.price??0};if(A.type==="gannfan"){const t=A.primitive,i=[{ratio:.125,label:"0.13",color:"#a06b00",width:1},{ratio:.25,label:"0.25",color:"#699e00",width:1},{ratio:.333333,label:"0.30",color:"#009b00",width:1},{ratio:.5,label:"0.50",color:"#009965",width:1},{ratio:1,label:"1.00",color:"#808080",width:1},{ratio:2,label:"2.00",color:"#006599",width:1},{ratio:3,label:"3.00",color:"#000099",width:1},{ratio:4,label:"4.00",color:"#660099",width:1},{ratio:8,label:"8.00",color:"#a50000",width:1}],r=A.rays??(t?._rays?t._rays.map(n=>({...n})):i);return{...e,rays:r,showLabels:t?t.showLabels??!0:A.showLabels??!0,backgroundColor:t?.backgroundColor??A.backgroundColor??"#3b82f6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}}if(A.type==="ganngrid"){const t=A.primitive;return{...e,divisions:t?.divisions??A.divisions??8,lineColor:t?.lineColor??A.lineColor??"#94a3b8",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#3b82f6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.08,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}}if(A.type==="triangle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0,point3Time:A.p3?.rawTime??0,point3Price:A.p3?.price??0}}if(A.type==="circle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0}}if(A.type==="ellipse"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0}}if(A.type==="rectangle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#94a3b8",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.18,extendLeft:t?.extendLeft??A.extendLeft??!1,extendRight:t?.extendRight??A.extendRight??!1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point4Price:A.p2?.price??0}}return A.type==="andrewspitchfork"?{...e,medianColor:A.medianColor??"#a50000",medianWidth:A.medianWidth??1,showBackground:A.showBackground!==!1,backgroundOpacity:A.backgroundOpacity??.1,levels:A.levels??[{k:.25,label:"0.25",color:"#a06b00",width:1,enabled:!0},{k:.38,label:"0.38",color:"#699e00",width:1,enabled:!0},{k:.5,label:"0.50",color:"#009b00",width:1,enabled:!0},{k:.62,label:"0.62",color:"#009965",width:1,enabled:!0},{k:.75,label:"0.75",color:"#006599",width:1,enabled:!0},{k:1,label:"1.00",color:"#000099",width:1,enabled:!0},{k:1.5,label:"1.50",color:"#660099",width:1,enabled:!0},{k:1.75,label:"1.75",color:"#990066",width:1,enabled:!0},{k:2,label:"2.00",color:"#a50000",width:1,enabled:!0}],point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0,point3Time:A.p3?.rawTime??0,point1Price:A.p1?.price??0,point2Price:A.p2?.price??0,point3Price:A.p3?.price??0}:A.type==="equidistantchannel"?{...e,strokeColor:A.strokeColor??"#8b5cf6",lineWidth:A.lineWidth??1,showMiddleLine:A.showMiddleLine??!1,middleLineColor:A.middleLineColor??"#8b5cf6",middleLineOpacity:A.middleLineOpacity??.5,middleLineWidth:A.middleLineWidth??1,showBackground:A.showBackground!==!1,backgroundColor:A.backgroundColor??"#b4a7d6",backgroundOpacity:A.backgroundOpacity??.1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0,point1Price:A.p1?.price??0,point2Price:A.p2?.price??0,point3Price:A.p3?.price??0}:A.type==="regressionchannel"||A.type==="stddevchannel"?{...e,baseLineColor:A.baseLineColor??"#ff0000",baseLineOpacity:A.baseLineOpacity??.35,baseLineWidth:A.baseLineWidth??1,showBaseLine:A.showBaseLine!==!1,upperLineColor:A.upperLineColor??"#0000ff",upperLineOpacity:A.upperLineOpacity??.35,upperLineWidth:A.upperLineWidth??1,showUpperLine:A.showUpperLine!==!1,lowerLineColor:A.lowerLineColor??"#0000ff",lowerLineOpacity:A.lowerLineOpacity??.35,lowerLineWidth:A.lowerLineWidth??1,showLowerLine:A.showLowerLine!==!1,showBackground:A.showBackground!==!1,backgroundOpacity:A.backgroundOpacity??.1,extendLeft:A.extendLeft??!1,extendRight:A.extendRight??!1,showPearsonsR:A.showPearsonsR!==!1,point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0}:A.type==="rulerline"?{...e,lineColor:A.lineColor??"#3b82f6",showArea:A.showArea!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways!==!1,statsPriceRange:A.statsPriceRange!==!1,statsBarsRange:A.statsBarsRange!==!1,statsDateRange:A.statsDateRange!==!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}:e}const pu=({isOpen:A,onClose:e,chartObject:t,onUpdate:i})=>{const{theme:r}=$t(),s=Pw(r==="light"),[o,l]=Y.useState("style"),[c,h]=Y.useState({}),[m,v]=Y.useState(null),x=Y.useRef(null),F=Y.useRef(null);Y.useEffect(()=>{t&&(h(mB(t)),l("style"))},[t]),Y.useEffect(()=>{A||v(null)},[A]);const T=H=>{if(H.button!==0)return;H.preventDefault();const z=x.current;if(!z)return;const re=z.offsetParent,q=re?re.getBoundingClientRect():{left:0,top:0},ie=z.getBoundingClientRect(),G=ie.left-q.left,ne=ie.top-q.top;F.current={startMX:H.clientX,startMY:H.clientY,startX:G,startY:ne},v({x:G,y:ne});const le=we=>{const{startMX:j,startMY:ge,startX:ae,startY:pe}=F.current;v({x:ae+we.clientX-j,y:pe+we.clientY-ge})},ee=()=>{F.current=null,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ee)};document.addEventListener("mousemove",le),document.addEventListener("mouseup",ee)};if(!A||!t)return null;const S=Hw[t.type]||t.type,I=["style","coordinates","visualization"],Q=()=>{if(o==="visualization")return a.jsx(Ww,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Gw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Jw,{draft:c,setDraft:h,tokens:s})}if(t.type==="gannline"){if(o==="style")return a.jsx(Rw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(cu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Zw,{draft:c,setDraft:h,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(cu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Yw,{draft:c,setDraft:h,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(qw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(jw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Xw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx($w,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(tB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(AB,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(eB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(hu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(uu,{draft:c,setDraft:h,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(hu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(uu,{draft:c,setDraft:h,tokens:s})}if(t.type==="gannfan"){if(o==="style")return a.jsx(oB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="ganngrid"){if(o==="style")return a.jsx(aB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="triangle"){if(o==="style")return a.jsx(uB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(dB,{draft:c,setDraft:h,tokens:s})}if(t.type==="circle"){if(o==="style")return a.jsx(hB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="ellipse"){if(o==="style")return a.jsx(pB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rectangle"){if(o==="style")return a.jsx(fB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(gB,{draft:c,tokens:s})}if(t.type==="andrewspitchfork"){if(o==="style")return a.jsx(lB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(cB,{draft:c,setDraft:h,tokens:s})}if(t.type==="equidistantchannel"){if(o==="style")return a.jsx(nB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(sB,{draft:c,setDraft:h,tokens:s})}if(t.type==="regressionchannel"||t.type==="stddevchannel"){if(o==="style")return a.jsx(iB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(rB,{draft:c,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},N=()=>{i(c),e()};return a.jsxs("div",{ref:x,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...m===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:m.y,left:m.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:T,style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText,cursor:"grab"},children:a.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(ha,{size:"18px",children:a.jsx(Dw,{})})})]})}),a.jsx("button",{type:"button",onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0 4px",background:s.headerBlue,color:s.headerText,border:"none",cursor:"pointer"},children:a.jsx(ha,{size:"20px",children:a.jsx(_w,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:I.map(H=>{const z=o===H;return a.jsxs("button",{type:"button",onClick:()=>l(H),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:z?s.text:s.mutedText,cursor:"pointer"},children:[H.charAt(0).toUpperCase()+H.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},H)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:Q()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick:N,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,border:"none",cursor:"pointer",background:s.greenHover,color:"#ffffff",boxShadow:`inset 0 0 0 1px ${s.greenActive}`},children:"Update"}),a.jsx("button",{type:"button",onClick:e,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,cursor:"pointer",border:`1px solid ${s.green}`,background:"transparent",color:s.green},children:"Cancel"})]})]})};var pa=function(A,e){return pa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])},pa(A,e)};function IA(A,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pa(A,e);function t(){this.constructor=A}A.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var da=function(){return da=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},da.apply(this,arguments)};function sA(A,e,t,i){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(h){try{c(i.next(h))}catch(m){s(m)}}function l(h){try{c(i.throw(h))}catch(m){s(m)}}function c(h){h.done?n(h.value):r(h.value).then(o,l)}c((i=i.apply(A,[])).next())})}function tA(A,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(h){return l([c,h])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(n=c[0]&2?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){t.label=c[1];break}if(c[0]===6&&t.label<n[1]){t.label=n[1],n=c;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(c);break}n[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(A,t)}catch(h){c=[6,h],r=0}finally{i=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function $n(A,e,t){if(arguments.length===2)for(var i=0,r=e.length,n;i<r;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return A.concat(n||e)}for(var ti=(function(){function A(e,t,i,r){this.left=e,this.top=t,this.width=i,this.height=r}return A.prototype.add=function(e,t,i,r){return new A(this.left+e,this.top+t,this.width+i,this.height+r)},A.fromClientRect=function(e,t){return new A(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},A.fromDOMRectList=function(e,t){var i=Array.from(t).find(function(r){return r.width!==0});return i?new A(i.left+e.windowBounds.left,i.top+e.windowBounds.top,i.width,i.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A})(),Xn=function(A,e){return ti.fromClientRect(A,e.getBoundingClientRect())},wB=function(A){var e=A.body,t=A.documentElement;if(!e||!t)throw new Error("Unable to get document size");var i=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new ti(0,0,i,r)},Jn=function(A){for(var e=[],t=0,i=A.length;t<i;){var r=A.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var n=A.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},It=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],r=-1,n="";++r<t;){var s=A[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(n+=String.fromCharCode.apply(String,i),i.length=0)}return n},du="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BB=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<du.length;Zn++)BB[du.charCodeAt(Zn)]=Zn;for(var fu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=typeof Uint8Array>"u"?[]:new Uint8Array(256),Yn=0;Yn<fu.length;Yn++)Ur[fu.charCodeAt(Yn)]=Yn;for(var yB=function(A){var e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(i=0;i<t;i+=4)n=Ur[A.charCodeAt(i)],s=Ur[A.charCodeAt(i+1)],o=Ur[A.charCodeAt(i+2)],l=Ur[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},CB=function(A){for(var e=A.length,t=[],i=0;i<e;i+=2)t.push(A[i+1]<<8|A[i]);return t},vB=function(A){for(var e=A.length,t=[],i=0;i<e;i+=4)t.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return t},Mi=5,fa=11,ga=2,TB=fa-Mi,gu=65536>>Mi,bB=1<<Mi,ma=bB-1,xB=1024>>Mi,QB=gu+xB,FB=QB,UB=32,SB=FB+UB,EB=65536>>fa,LB=1<<TB,MB=LB-1,mu=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},HB=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},IB=function(A,e){var t=yB(A),i=Array.isArray(t)?vB(t):new Uint32Array(t),r=Array.isArray(t)?CB(t):new Uint16Array(t),n=24,s=mu(r,n/2,i[4]/2),o=i[5]===2?mu(r,(n+i[4])/2):HB(i,Math.ceil((n+i[4])/4));return new PB(i[0],i[1],i[2],i[3],s,o)},PB=(function(){function A(e,t,i,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=n,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Mi],t=(t<<ga)+(e&ma),this.data[t];if(e<=65535)return t=this.index[gu+(e-55296>>Mi)],t=(t<<ga)+(e&ma),this.data[t];if(e<this.highStart)return t=SB-EB+(e>>fa),t=this.index[t],t+=e>>Mi&MB,t=this.index[t],t=(t<<ga)+(e&ma),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",DB=typeof Uint8Array>"u"?[]:new Uint8Array(256),qn=0;qn<wu.length;qn++)DB[wu.charCodeAt(qn)]=qn;var _B="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Bu=50,kB=1,yu=2,Cu=3,OB=4,NB=5,vu=7,Tu=8,bu=9,pi=10,wa=11,xu=12,Ba=13,KB=14,Sr=15,ya=16,jn=17,Er=18,zB=19,Qu=20,Ca=21,Lr=22,va=23,$i=24,CA=25,Mr=26,Hr=27,Xi=28,VB=29,Hi=30,WB=31,es=32,ts=33,Ta=34,ba=35,xa=36,Ir=37,Qa=38,As=39,is=40,Fa=41,Fu=42,GB=43,RB=[9001,65288],Uu="!",lt="×",rs="÷",Ua=IB(_B),Ai=[Hi,xa],Sa=[kB,yu,Cu,NB],Su=[pi,Tu],Eu=[Hr,Mr],$B=Sa.concat(Su),Lu=[Qa,As,is,Ta,ba],XB=[Sr,Ba],JB=function(A,e){e===void 0&&(e="strict");var t=[],i=[],r=[];return A.forEach(function(n,s){var o=Ua.get(n);if(o>Bu?(r.push(!0),o-=Bu):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return i.push(s),t.push(ya);if(o===OB||o===wa){if(s===0)return i.push(s),t.push(Hi);var l=t[s-1];return $B.indexOf(l)===-1?(i.push(i[s-1]),t.push(l)):(i.push(s),t.push(Hi))}if(i.push(s),o===WB)return t.push(e==="strict"?Ca:Ir);if(o===Fu||o===VB)return t.push(Hi);if(o===GB)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Ir):t.push(Hi);t.push(o)}),[i,t,r]},Ea=function(A,e,t,i){var r=i[t];if(Array.isArray(A)?A.indexOf(r)!==-1:A===r)for(var n=t;n<=i.length;){n++;var s=i[n];if(s===e)return!0;if(s!==pi)break}if(r===pi)for(var n=t;n>0;){n--;var o=i[n];if(Array.isArray(A)?A.indexOf(o)!==-1:A===o)for(var l=t;l<=i.length;){l++;var s=i[l];if(s===e)return!0;if(s!==pi)break}if(o!==pi)break}return!1},Mu=function(A,e){for(var t=A;t>=0;){var i=e[t];if(i===pi)t--;else return i}return 0},ZB=function(A,e,t,i,r){if(t[i]===0)return lt;var n=i-1;if(Array.isArray(r)&&r[n]===!0)return lt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,h=e[o];if(l===yu&&h===Cu)return lt;if(Sa.indexOf(l)!==-1)return Uu;if(Sa.indexOf(h)!==-1||Su.indexOf(h)!==-1)return lt;if(Mu(n,e)===Tu)return rs;if(Ua.get(A[n])===wa||(l===es||l===ts)&&Ua.get(A[o])===wa||l===vu||h===vu||l===bu||[pi,Ba,Sr].indexOf(l)===-1&&h===bu||[jn,Er,zB,$i,Xi].indexOf(h)!==-1||Mu(n,e)===Lr||Ea(va,Lr,n,e)||Ea([jn,Er],Ca,n,e)||Ea(xu,xu,n,e))return lt;if(l===pi)return rs;if(l===va||h===va)return lt;if(h===ya||l===ya)return rs;if([Ba,Sr,Ca].indexOf(h)!==-1||l===KB||c===xa&&XB.indexOf(l)!==-1||l===Xi&&h===xa||h===Qu||Ai.indexOf(h)!==-1&&l===CA||Ai.indexOf(l)!==-1&&h===CA||l===Hr&&[Ir,es,ts].indexOf(h)!==-1||[Ir,es,ts].indexOf(l)!==-1&&h===Mr||Ai.indexOf(l)!==-1&&Eu.indexOf(h)!==-1||Eu.indexOf(l)!==-1&&Ai.indexOf(h)!==-1||[Hr,Mr].indexOf(l)!==-1&&(h===CA||[Lr,Sr].indexOf(h)!==-1&&e[o+1]===CA)||[Lr,Sr].indexOf(l)!==-1&&h===CA||l===CA&&[CA,Xi,$i].indexOf(h)!==-1)return lt;if([CA,Xi,$i,jn,Er].indexOf(h)!==-1)for(var m=n;m>=0;){var v=e[m];if(v===CA)return lt;if([Xi,$i].indexOf(v)!==-1)m--;else break}if([Hr,Mr].indexOf(h)!==-1)for(var m=[jn,Er].indexOf(l)!==-1?s:n;m>=0;){var v=e[m];if(v===CA)return lt;if([Xi,$i].indexOf(v)!==-1)m--;else break}if(Qa===l&&[Qa,As,Ta,ba].indexOf(h)!==-1||[As,Ta].indexOf(l)!==-1&&[As,is].indexOf(h)!==-1||[is,ba].indexOf(l)!==-1&&h===is||Lu.indexOf(l)!==-1&&[Qu,Mr].indexOf(h)!==-1||Lu.indexOf(h)!==-1&&l===Hr||Ai.indexOf(l)!==-1&&Ai.indexOf(h)!==-1||l===$i&&Ai.indexOf(h)!==-1||Ai.concat(CA).indexOf(l)!==-1&&h===Lr&&RB.indexOf(A[o])===-1||Ai.concat(CA).indexOf(h)!==-1&&l===Er)return lt;if(l===Fa&&h===Fa){for(var x=t[n],F=1;x>0&&(x--,e[x]===Fa);)F++;if(F%2!==0)return lt}return l===es&&h===ts?lt:rs},YB=function(A,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=JB(A,e.lineBreak),i=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[CA,Hi,Fu].indexOf(o)!==-1?Ir:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&A[l]>=19968&&A[l]<=40959}):void 0;return[i,r,s]},qB=(function(){function A(e,t,i,r){this.codePoints=e,this.required=t===Uu,this.start=i,this.end=r}return A.prototype.slice=function(){return It.apply(void 0,this.codePoints.slice(this.start,this.end))},A})(),jB=function(A,e){var t=Jn(A),i=YB(t,e),r=i[0],n=i[1],s=i[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var h=lt;c<o&&(h=ZB(t,n,r,++c,s))===lt;);if(h!==lt||c===o){var m=new qB(t,h,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},e2=1,t2=2,Pr=4,Hu=8,ns=10,Iu=47,Dr=92,A2=9,i2=32,ss=34,_r=61,r2=35,n2=36,s2=37,os=39,as=40,kr=41,o2=95,fA=45,a2=33,l2=60,c2=62,h2=64,u2=91,p2=93,d2=61,f2=123,ls=63,g2=125,Pu=124,m2=126,w2=128,Du=65533,La=42,Ii=43,B2=44,y2=58,C2=59,Or=46,v2=0,T2=8,b2=11,x2=14,Q2=31,F2=127,GA=-1,_u=48,ku=97,Ou=101,U2=102,S2=117,E2=122,Nu=65,Ku=69,zu=70,L2=85,M2=90,AA=function(A){return A>=_u&&A<=57},H2=function(A){return A>=55296&&A<=57343},Ji=function(A){return AA(A)||A>=Nu&&A<=zu||A>=ku&&A<=U2},I2=function(A){return A>=ku&&A<=E2},P2=function(A){return A>=Nu&&A<=M2},D2=function(A){return I2(A)||P2(A)},_2=function(A){return A>=w2},cs=function(A){return A===ns||A===A2||A===i2},hs=function(A){return D2(A)||_2(A)||A===o2},Vu=function(A){return hs(A)||AA(A)||A===fA},k2=function(A){return A>=v2&&A<=T2||A===b2||A>=x2&&A<=Q2||A===F2},di=function(A,e){return A!==Dr?!1:e!==ns},us=function(A,e,t){return A===fA?hs(e)||di(e,t):hs(A)?!0:!!(A===Dr&&di(A,e))},Ma=function(A,e,t){return A===Ii||A===fA?AA(e)?!0:e===Or&&AA(t):AA(A===Or?e:A)},O2=function(A){var e=0,t=1;(A[e]===Ii||A[e]===fA)&&(A[e]===fA&&(t=-1),e++);for(var i=[];AA(A[e]);)i.push(A[e++]);var r=i.length?parseInt(It.apply(void 0,i),10):0;A[e]===Or&&e++;for(var n=[];AA(A[e]);)n.push(A[e++]);var s=n.length,o=s?parseInt(It.apply(void 0,n),10):0;(A[e]===Ku||A[e]===Ou)&&e++;var l=1;(A[e]===Ii||A[e]===fA)&&(A[e]===fA&&(l=-1),e++);for(var c=[];AA(A[e]);)c.push(A[e++]);var h=c.length?parseInt(It.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*h)},N2={type:2},K2={type:3},z2={type:4},V2={type:13},W2={type:8},G2={type:21},R2={type:9},$2={type:10},X2={type:11},J2={type:12},Z2={type:14},ps={type:23},Y2={type:1},q2={type:25},j2={type:24},ey={type:26},ty={type:27},Ay={type:28},iy={type:29},ry={type:31},Ha={type:32},Wu=(function(){function A(){this._value=[]}return A.prototype.write=function(e){this._value=this._value.concat(Jn(e))},A.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Ha;)e.push(t),t=this.consumeToken();return e},A.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ss:return this.consumeStringToken(ss);case r2:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Vu(t)||di(i,r)){var n=us(t,i,r)?t2:e2,s=this.consumeName();return{type:5,value:s,flags:n}}break;case n2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),V2;break;case os:return this.consumeStringToken(os);case as:return N2;case kr:return K2;case La:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),Z2;break;case Ii:if(Ma(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case B2:return z2;case fA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Ma(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(us(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===fA&&c===c2)return this.consumeCodePoint(),this.consumeCodePoint(),j2;break;case Or:if(Ma(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Iu:if(this.peekCodePoint(0)===La)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===La&&(h=this.consumeCodePoint(),h===Iu))return this.consumeToken();if(h===GA)return this.consumeToken()}break;case y2:return ey;case C2:return ty;case l2:if(this.peekCodePoint(0)===a2&&this.peekCodePoint(1)===fA&&this.peekCodePoint(2)===fA)return this.consumeCodePoint(),this.consumeCodePoint(),q2;break;case h2:var m=this.peekCodePoint(0),v=this.peekCodePoint(1),x=this.peekCodePoint(2);if(us(m,v,x)){var s=this.consumeName();return{type:7,value:s}}break;case u2:return Ay;case Dr:if(di(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case p2:return iy;case d2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),W2;break;case f2:return X2;case g2:return J2;case S2:case L2:var F=this.peekCodePoint(0),T=this.peekCodePoint(1);return F===Ii&&(Ji(T)||T===ls)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Pu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),R2;if(this.peekCodePoint(0)===Pu)return this.consumeCodePoint(),G2;break;case m2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),$2;break;case GA:return Ha}return cs(e)?(this.consumeWhiteSpace(),ry):AA(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):hs(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:It(e)}},A.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},A.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},A.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},A.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Ji(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;t===ls&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i){var r=parseInt(It.apply(void 0,e.map(function(l){return l===ls?_u:l})),16),n=parseInt(It.apply(void 0,e.map(function(l){return l===ls?zu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(It.apply(void 0,e),16);if(this.peekCodePoint(0)===fA&&Ji(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Ji(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(It.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},A.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===as?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===as?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},A.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===GA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===os||t===ss){var i=this.consumeStringToken(this.consumeCodePoint());return i.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===GA||this.peekCodePoint(0)===kr)?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),ps)}for(;;){var r=this.consumeCodePoint();if(r===GA||r===kr)return{type:22,value:It.apply(void 0,e)};if(cs(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===GA||this.peekCodePoint(0)===kr?(this.consumeCodePoint(),{type:22,value:It.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ps);if(r===ss||r===os||r===as||k2(r))return this.consumeBadUrlRemnants(),ps;if(r===Dr)if(di(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ps;else e.push(r)}},A.prototype.consumeWhiteSpace=function(){for(;cs(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kr||e===GA)return;di(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(e){for(var t=5e4,i="";e>0;){var r=Math.min(t,e);i+=It.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),i},A.prototype.consumeStringToken=function(e){var t="",i=0;do{var r=this._value[i];if(r===GA||r===void 0||r===e)return t+=this.consumeStringSlice(i),{type:0,value:t};if(r===ns)return this._value.splice(0,i),Y2;if(r===Dr){var n=this._value[i+1];n!==GA&&n!==void 0&&(n===ns?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):di(r,n)&&(t+=this.consumeStringSlice(i),t+=It(this.consumeEscapedCodePoint()),i=-1))}i++}while(!0)},A.prototype.consumeNumber=function(){var e=[],t=Pr,i=this.peekCodePoint(0);for((i===Ii||i===fA)&&e.push(this.consumeCodePoint());AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(i===Or&&AA(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Hu;AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((i===Ku||i===Ou)&&((r===Ii||r===fA)&&AA(n)||AA(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Hu;AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[O2(e),t]},A.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(us(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:i,unit:o}}return r===s2?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},A.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Ji(e)){for(var t=It(e);Ji(this.peekCodePoint(0))&&t.length<6;)t+=It(this.consumeCodePoint());cs(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return i===0||H2(i)||i>1114111?Du:i}return e===GA?Du:e},A.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Vu(t))e+=It(t);else if(di(t,this.peekCodePoint(0)))e+=It(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},A})(),Gu=(function(){function A(e){this._tokens=e}return A.create=function(e){var t=new Wu;return t.write(e),new A(t.read())},A.parseValue=function(e){return A.create(e).parseComponentValue()},A.parseValues=function(e){return A.create(e).parseComponentValues()},A.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},A.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},A.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(i.type===32||sy(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},A.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(i.type===32||i.type===3)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Ha:e},A.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},A})(),Nr=function(A){return A.type===15},Zi=function(A){return A.type===17},yt=function(A){return A.type===20},ny=function(A){return A.type===0},Ia=function(A,e){return yt(A)&&A.value===e},Ru=function(A){return A.type!==31},Yi=function(A){return A.type!==31&&A.type!==4},RA=function(A){var e=[],t=[];return A.forEach(function(i){if(i.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}i.type!==31&&t.push(i)}),t.length&&e.push(t),e},sy=function(A,e){return e===11&&A.type===12||e===28&&A.type===29?!0:e===2&&A.type===3},fi=function(A){return A.type===17||A.type===15},Ot=function(A){return A.type===16||fi(A)},$u=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},Xt={type:17,number:0,flags:Pr},Pa={type:16,number:50,flags:Pr},gi={type:16,number:100,flags:Pr},Kr=function(A,e,t){var i=A[0],r=A[1];return[xt(i,e),xt(typeof r<"u"?r:i,t)]},xt=function(A,e){if(A.type===16)return A.number/100*e;if(Nr(A))switch(A.unit){case"rem":case"em":return 16*A.number;default:return A.number}return A.number},Xu="deg",Ju="grad",Zu="rad",Yu="turn",ds={name:"angle",parse:function(A,e){if(e.type===15)switch(e.unit){case Xu:return Math.PI*e.number/180;case Ju:return Math.PI/200*e.number;case Zu:return e.number;case Yu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},qu=function(A){return A.type===15&&(A.unit===Xu||A.unit===Ju||A.unit===Zu||A.unit===Yu)},ju=function(A){var e=A.filter(yt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Xt,Xt];case"to top":case"bottom":return QA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Xt,gi];case"to right":case"left":return QA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[gi,gi];case"to bottom":case"top":return QA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[gi,Xt];case"to left":case"right":return QA(270)}return 0},QA=function(A){return Math.PI*A/180},mi={name:"color",parse:function(A,e){if(e.type===18){var t=oy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(A,e.values)}if(e.type===5){if(e.value.length===3){var i=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3);return Bi(parseInt(i+i,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(e.value.length===4){var i=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return Bi(parseInt(i+i,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var i=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6);return Bi(parseInt(i,16),parseInt(r,16),parseInt(n,16),1)}if(e.value.length===8){var i=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return Bi(parseInt(i,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=ii[e.value.toUpperCase()];if(typeof o<"u")return o}return ii.TRANSPARENT}},wi=function(A){return(255&A)===0},Gt=function(A){var e=255&A,t=255&A>>8,i=255&A>>16,r=255&A>>24;return e<255?"rgba("+r+","+i+","+t+","+e/255+")":"rgb("+r+","+i+","+t+")"},Bi=function(A,e,t,i){return(A<<24|e<<16|t<<8|Math.round(i*255)<<0)>>>0},ep=function(A,e){if(A.type===17)return A.number;if(A.type===16){var t=e===3?1:255;return e===3?A.number/100*t:Math.round(A.number/100*t)}return 0},tp=function(A,e){var t=e.filter(Yi);if(t.length===3){var i=t.map(ep),r=i[0],n=i[1],s=i[2];return Bi(r,n,s,1)}if(t.length===4){var o=t.map(ep),r=o[0],n=o[1],s=o[2],l=o[3];return Bi(r,n,s,l)}return 0};function Da(A,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-A)*t*6+A:t<1/2?e:t<2/3?(e-A)*6*(2/3-t)+A:A}var Ap=function(A,e){var t=e.filter(Yi),i=t[0],r=t[1],n=t[2],s=t[3],o=(i.type===17?QA(i.number):ds.parse(A,i))/(Math.PI*2),l=Ot(r)?r.number/100:0,c=Ot(n)?n.number/100:0,h=typeof s<"u"&&Ot(s)?xt(s,1):1;if(l===0)return Bi(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,v=c*2-m,x=Da(v,m,o+1/3),F=Da(v,m,o),T=Da(v,m,o-1/3);return Bi(x*255,F*255,T*255,h)},oy={hsl:Ap,hsla:Ap,rgb:tp,rgba:tp},zr=function(A,e){return mi.parse(A,Gu.create(e).parseComponentValue())},ii={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},ay={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(yt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ly={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fs=function(A,e){var t=mi.parse(A,e[0]),i=e[1];return i&&Ot(i)?{color:t,stop:i}:{color:t,stop:null}},ip=function(A,e){var t=A[0],i=A[A.length-1];t.stop===null&&(t.stop=Xt),i.stop===null&&(i.stop=gi);for(var r=[],n=0,s=0;s<A.length;s++){var o=A[s].stop;if(o!==null){var l=xt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var h=r[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,v=r[c-1],x=(h-v)/(m+1),F=1;F<=m;F++)r[c+F-1]=x*F;c=null}}return A.map(function(T,S){var I=T.color;return{color:I,stop:Math.max(Math.min(1,r[S]/e),0)}})},cy=function(A,e,t){var i=e/2,r=t/2,n=xt(A[0],e)-i,s=r-xt(A[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},hy=function(A,e,t){var i=typeof A=="number"?A:cy(A,e,t),r=Math.abs(e*Math.sin(i))+Math.abs(t*Math.cos(i)),n=e/2,s=t/2,o=r/2,l=Math.sin(i-Math.PI/2)*o,c=Math.cos(i-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},PA=function(A,e){return Math.sqrt(A*A+e*e)},rp=function(A,e,t,i,r){var n=[[0,0],[0,e],[A,0],[A,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],h=PA(t-l,i-c);return(r?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},uy=function(A,e,t,i,r){var n=0,s=0;switch(A.size){case 0:A.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):A.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-i)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(A.shape===0)n=s=Math.min(PA(e,t),PA(e,t-r),PA(e-i,t),PA(e-i,t-r));else if(A.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-i)),l=rp(i,r,e,t,!0),c=l[0],h=l[1];n=PA(c-e,(h-t)/o),s=o*n}break;case 1:A.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):A.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-i)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(A.shape===0)n=s=Math.max(PA(e,t),PA(e,t-r),PA(e-i,t),PA(e-i,t-r));else if(A.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-i)),m=rp(i,r,e,t,!1),c=m[0],h=m[1];n=PA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(A.size)&&(n=xt(A.size[0],i),s=A.size.length===2?xt(A.size[1],r):n),[n,s]},py=function(A,e){var t=QA(180),i=[];return RA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=ju(r);return}else if(qu(s)){t=ds.parse(A,s);return}}var o=fs(A,r);i.push(o)}),{angle:t,stops:i,type:1}},gs=function(A,e){var t=QA(180),i=[];return RA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=ju(r);return}else if(qu(s)){t=(ds.parse(A,s)+QA(270))%QA(360);return}}var o=fs(A,r);i.push(o)}),{angle:t,stops:i,type:1}},dy=function(A,e){var t=QA(180),i=[],r=1,n=0,s=3,o=[];return RA(e).forEach(function(l,c){var h=l[0];if(c===0){if(yt(h)&&h.value==="linear"){r=1;return}else if(yt(h)&&h.value==="radial"){r=2;return}}if(h.type===18){if(h.name==="from"){var m=mi.parse(A,h.values[0]);i.push({stop:Xt,color:m})}else if(h.name==="to"){var m=mi.parse(A,h.values[0]);i.push({stop:gi,color:m})}else if(h.name==="color-stop"){var v=h.values.filter(Yi);if(v.length===2){var m=mi.parse(A,v[1]),x=v[0];Zi(x)&&i.push({stop:{type:16,number:x.number*100,flags:x.flags},color:m})}}}}),r===1?{angle:(t+QA(180))%QA(360),stops:i,type:r}:{size:s,shape:n,stops:i,position:o,type:r}},np="closest-side",sp="farthest-side",op="closest-corner",ap="farthest-corner",lp="circle",cp="ellipse",hp="cover",up="contain",fy=function(A,e){var t=0,i=3,r=[],n=[];return RA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,v){if(c)if(yt(v))switch(v.value){case"center":return n.push(Pa),m;case"top":case"left":return n.push(Xt),m;case"right":case"bottom":return n.push(gi),m}else(Ot(v)||fi(v))&&n.push(v);else if(yt(v))switch(v.value){case lp:return t=0,!1;case cp:return t=1,!1;case"at":return c=!0,!1;case np:return i=0,!1;case hp:case sp:return i=1,!1;case up:case op:return i=2,!1;case ap:return i=3,!1}else if(fi(v)||Ot(v))return Array.isArray(i)||(i=[]),i.push(v),!1;return m},l)}if(l){var h=fs(A,s);r.push(h)}}),{size:i,shape:t,stops:r,position:n,type:2}},ms=function(A,e){var t=0,i=3,r=[],n=[];return RA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(h,m){if(yt(m))switch(m.value){case"center":return n.push(Pa),!1;case"top":case"left":return n.push(Xt),!1;case"right":case"bottom":return n.push(gi),!1}else if(Ot(m)||fi(m))return n.push(m),!1;return h},l):o===1&&(l=s.reduce(function(h,m){if(yt(m))switch(m.value){case lp:return t=0,!1;case cp:return t=1,!1;case up:case np:return i=0,!1;case sp:return i=1,!1;case op:return i=2,!1;case hp:case ap:return i=3,!1}else if(fi(m)||Ot(m))return Array.isArray(i)||(i=[]),i.push(m),!1;return h},l)),l){var c=fs(A,s);r.push(c)}}),{size:i,shape:t,stops:r,position:n,type:2}},gy=function(A){return A.type===1},my=function(A){return A.type===2},_a={name:"image",parse:function(A,e){if(e.type===22){var t={url:e.value,type:0};return A.cache.addImage(e.value),t}if(e.type===18){var i=pp[e.name];if(typeof i>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return i(A,e.values)}throw new Error("Unsupported image type "+e.type)}};function wy(A){return!(A.type===20&&A.value==="none")&&(A.type!==18||!!pp[A.name])}var pp={"linear-gradient":py,"-moz-linear-gradient":gs,"-ms-linear-gradient":gs,"-o-linear-gradient":gs,"-webkit-linear-gradient":gs,"radial-gradient":fy,"-moz-radial-gradient":ms,"-ms-radial-gradient":ms,"-o-radial-gradient":ms,"-webkit-radial-gradient":ms,"-webkit-gradient":dy},By={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(i){return Yi(i)&&wy(i)}).map(function(i){return _a.parse(A,i)})}},yy={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(yt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Cy={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,e){return RA(e).map(function(t){return t.filter(Ot)}).map($u)}},vy={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,e){return RA(e).map(function(t){return t.filter(yt).map(function(i){return i.value}).join(" ")}).map(Ty)}},Ty=function(A){switch(A){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}},qi;(function(A){A.AUTO="auto",A.CONTAIN="contain",A.COVER="cover"})(qi||(qi={}));var by={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,e){return RA(e).map(function(t){return t.filter(xy)})}},xy=function(A){return yt(A)||Ot(A)},ws=function(A){return{name:"border-"+A+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Qy=ws("top"),Fy=ws("right"),Uy=ws("bottom"),Sy=ws("left"),Bs=function(A){return{name:"border-radius-"+A,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return $u(t.filter(Ot))}}},Ey=Bs("top-left"),Ly=Bs("top-right"),My=Bs("bottom-right"),Hy=Bs("bottom-left"),ys=function(A){return{name:"border-"+A+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Iy=ys("top"),Py=ys("right"),Dy=ys("bottom"),_y=ys("left"),Cs=function(A){return{name:"border-"+A+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Nr(t)?t.number:0}}},ky=Cs("top"),Oy=Cs("right"),Ny=Cs("bottom"),Ky=Cs("left"),zy={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vy={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,e){return e==="rtl"?1:0}},Wy={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).reduce(function(t,i){return t|Gy(i.value)},0)}},Gy=function(A){switch(A){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Ry={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},$y={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},vs;(function(A){A.NORMAL="normal",A.STRICT="strict"})(vs||(vs={}));var Xy={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){return e==="strict"?vs.STRICT:vs.NORMAL}},Jy={name:"line-height",initialValue:"normal",prefix:!1,type:4},dp=function(A,e){return yt(A)&&A.value==="normal"?1.2*e:A.type===17?e*A.number:Ot(A)?xt(A,e):e},Zy={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,e){return e.type===20&&e.value==="none"?null:_a.parse(A,e)}},Yy={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,e){return e==="inside"?0:1}},ka={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Ts=function(A){return{name:"margin-"+A,initialValue:"0",prefix:!1,type:4}},qy=Ts("top"),jy=Ts("right"),eC=Ts("bottom"),tC=Ts("left"),AC={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},iC={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){return e==="break-word"?"break-word":"normal"}},bs=function(A){return{name:"padding-"+A,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},rC=bs("top"),nC=bs("right"),sC=bs("bottom"),oC=bs("left"),aC={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},lC={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},cC={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&Ia(e[0],"none")?[]:RA(e).map(function(t){for(var i={color:ii.TRANSPARENT,offsetX:Xt,offsetY:Xt,blur:Xt},r=0,n=0;n<t.length;n++){var s=t[n];fi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:i.blur=s,r++):i.color=mi.parse(A,s)}return i})}},hC={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},uC={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=fC[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},pC=function(A){var e=A.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},dC=function(A){var e=A.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],i=e[1];e[2],e[3];var r=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,i,r,n,s,o]:null},fC={matrix:pC,matrix3d:dC},fp={type:16,number:50,flags:Pr},gC=[fp,fp],mC={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,e){var t=e.filter(Ot);return t.length!==2?gC:[t[0],t[1]]}},wC={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Vr;(function(A){A.NORMAL="normal",A.BREAK_ALL="break-all",A.KEEP_ALL="keep-all"})(Vr||(Vr={}));for(var BC={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-all":return Vr.BREAK_ALL;case"keep-all":return Vr.KEEP_ALL;default:return Vr.NORMAL}}},yC={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,e){if(e.type===20)return{auto:!0,order:0};if(Zi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},gp={name:"time",parse:function(A,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},CC={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,e){return Zi(e)?e.number:1}},vC={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},TC={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},bC={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,e){var t=[],i=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:i.push(t.join(" ")),t.length=0;break}}),t.length&&i.push(t.join(" ")),i.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},xC={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},QC={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,e){return Zi(e)?e.number:yt(e)&&e.value==="bold"?700:400}},FC={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.filter(yt).map(function(t){return t.value})}},UC={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Kt=function(A,e){return(A&e)!==0},SC={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},EC={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var i=[],r=e.filter(Ru),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Zi(o)?o.number:1;i.push({counter:s.value,increment:l})}}return i}},LC={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return[];for(var t=[],i=e.filter(Ru),r=0;r<i.length;r++){var n=i[r],s=i[r+1];if(yt(n)&&n.value!=="none"){var o=s&&Zi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},MC={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,e){return e.filter(Nr).map(function(t){return gp.parse(A,t)})}},HC={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var i=[],r=e.filter(ny);if(r.length%2!==0)return null;for(var n=0;n<r.length;n+=2){var s=r[n].value,o=r[n+1].value;i.push({open:s,close:o})}return i}},mp=function(A,e,t){if(!A)return"";var i=A[Math.min(e,A.length-1)];return i?t?i.open:i.close:""},IC={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&Ia(e[0],"none")?[]:RA(e).map(function(t){for(var i={color:255,offsetX:Xt,offsetY:Xt,blur:Xt,spread:Xt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];Ia(s,"inset")?i.inset=!0:fi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:r===2?i.blur=s:i.spread=s,r++):i.color=mi.parse(A,s)}return i})}},PC={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,e){var t=[0,1,2],i=[];return e.filter(yt).forEach(function(r){switch(r.value){case"stroke":i.push(1);break;case"fill":i.push(0);break;case"markers":i.push(2);break}}),t.forEach(function(r){i.indexOf(r)===-1&&i.push(r)}),i}},DC={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},_C={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,e){return Nr(e)?e.number:0}},kC=(function(){function A(e,t){var i,r;this.animationDuration=Oe(e,MC,t.animationDuration),this.backgroundClip=Oe(e,ay,t.backgroundClip),this.backgroundColor=Oe(e,ly,t.backgroundColor),this.backgroundImage=Oe(e,By,t.backgroundImage),this.backgroundOrigin=Oe(e,yy,t.backgroundOrigin),this.backgroundPosition=Oe(e,Cy,t.backgroundPosition),this.backgroundRepeat=Oe(e,vy,t.backgroundRepeat),this.backgroundSize=Oe(e,by,t.backgroundSize),this.borderTopColor=Oe(e,Qy,t.borderTopColor),this.borderRightColor=Oe(e,Fy,t.borderRightColor),this.borderBottomColor=Oe(e,Uy,t.borderBottomColor),this.borderLeftColor=Oe(e,Sy,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,Ey,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,Ly,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,My,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,Hy,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,Iy,t.borderTopStyle),this.borderRightStyle=Oe(e,Py,t.borderRightStyle),this.borderBottomStyle=Oe(e,Dy,t.borderBottomStyle),this.borderLeftStyle=Oe(e,_y,t.borderLeftStyle),this.borderTopWidth=Oe(e,ky,t.borderTopWidth),this.borderRightWidth=Oe(e,Oy,t.borderRightWidth),this.borderBottomWidth=Oe(e,Ny,t.borderBottomWidth),this.borderLeftWidth=Oe(e,Ky,t.borderLeftWidth),this.boxShadow=Oe(e,IC,t.boxShadow),this.color=Oe(e,zy,t.color),this.direction=Oe(e,Vy,t.direction),this.display=Oe(e,Wy,t.display),this.float=Oe(e,Ry,t.cssFloat),this.fontFamily=Oe(e,bC,t.fontFamily),this.fontSize=Oe(e,xC,t.fontSize),this.fontStyle=Oe(e,UC,t.fontStyle),this.fontVariant=Oe(e,FC,t.fontVariant),this.fontWeight=Oe(e,QC,t.fontWeight),this.letterSpacing=Oe(e,$y,t.letterSpacing),this.lineBreak=Oe(e,Xy,t.lineBreak),this.lineHeight=Oe(e,Jy,t.lineHeight),this.listStyleImage=Oe(e,Zy,t.listStyleImage),this.listStylePosition=Oe(e,Yy,t.listStylePosition),this.listStyleType=Oe(e,ka,t.listStyleType),this.marginTop=Oe(e,qy,t.marginTop),this.marginRight=Oe(e,jy,t.marginRight),this.marginBottom=Oe(e,eC,t.marginBottom),this.marginLeft=Oe(e,tC,t.marginLeft),this.opacity=Oe(e,CC,t.opacity);var n=Oe(e,AC,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,iC,t.overflowWrap),this.paddingTop=Oe(e,rC,t.paddingTop),this.paddingRight=Oe(e,nC,t.paddingRight),this.paddingBottom=Oe(e,sC,t.paddingBottom),this.paddingLeft=Oe(e,oC,t.paddingLeft),this.paintOrder=Oe(e,PC,t.paintOrder),this.position=Oe(e,lC,t.position),this.textAlign=Oe(e,aC,t.textAlign),this.textDecorationColor=Oe(e,vC,(i=t.textDecorationColor)!==null&&i!==void 0?i:t.color),this.textDecorationLine=Oe(e,TC,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,cC,t.textShadow),this.textTransform=Oe(e,hC,t.textTransform),this.transform=Oe(e,uC,t.transform),this.transformOrigin=Oe(e,mC,t.transformOrigin),this.visibility=Oe(e,wC,t.visibility),this.webkitTextStrokeColor=Oe(e,DC,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,_C,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,BC,t.wordBreak),this.zIndex=Oe(e,yC,t.zIndex)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},A.prototype.isTransparent=function(){return wi(this.backgroundColor)},A.prototype.isTransformed=function(){return this.transform!==null},A.prototype.isPositioned=function(){return this.position!==0},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return this.float!==0},A.prototype.isInlineLevel=function(){return Kt(this.display,4)||Kt(this.display,33554432)||Kt(this.display,268435456)||Kt(this.display,536870912)||Kt(this.display,67108864)||Kt(this.display,134217728)},A})(),OC=(function(){function A(e,t){this.content=Oe(e,SC,t.content),this.quotes=Oe(e,HC,t.quotes)}return A})(),wp=(function(){function A(e,t){this.counterIncrement=Oe(e,EC,t.counterIncrement),this.counterReset=Oe(e,LC,t.counterReset)}return A})(),Oe=function(A,e,t){var i=new Wu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;i.write(r);var n=new Gu(i.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(A,yt(s)?s.value:e.initialValue);case 0:return e.parse(A,n.parseComponentValue());case 1:return e.parse(A,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return ds.parse(A,n.parseComponentValue());case"color":return mi.parse(A,n.parseComponentValue());case"image":return _a.parse(A,n.parseComponentValue());case"length":var o=n.parseComponentValue();return fi(o)?o:Xt;case"length-percentage":var l=n.parseComponentValue();return Ot(l)?l:Xt;case"time":return gp.parse(A,n.parseComponentValue())}break}},NC="data-html2canvas-debug",KC=function(A){var e=A.getAttribute(NC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Oa=function(A,e){var t=KC(A);return t===1||e===t},$A=(function(){function A(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Oa(t,3))debugger;this.styles=new kC(e,window.getComputedStyle(t,null)),ja(t)&&(this.styles.animationDuration.some(function(i){return i>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Xn(this.context,t),Oa(t,4)&&(this.flags|=16)}return A})(),zC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Bp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wr=typeof Uint8Array>"u"?[]:new Uint8Array(256),xs=0;xs<Bp.length;xs++)Wr[Bp.charCodeAt(xs)]=xs;for(var VC=function(A){var e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(i=0;i<t;i+=4)n=Wr[A.charCodeAt(i)],s=Wr[A.charCodeAt(i+1)],o=Wr[A.charCodeAt(i+2)],l=Wr[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},WC=function(A){for(var e=A.length,t=[],i=0;i<e;i+=2)t.push(A[i+1]<<8|A[i]);return t},GC=function(A){for(var e=A.length,t=[],i=0;i<e;i+=4)t.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return t},Pi=5,Na=11,Ka=2,RC=Na-Pi,yp=65536>>Pi,$C=1<<Pi,za=$C-1,XC=1024>>Pi,JC=yp+XC,ZC=JC,YC=32,qC=ZC+YC,jC=65536>>Na,ev=1<<RC,tv=ev-1,Cp=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},Av=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},iv=function(A,e){var t=VC(A),i=Array.isArray(t)?GC(t):new Uint32Array(t),r=Array.isArray(t)?WC(t):new Uint16Array(t),n=24,s=Cp(r,n/2,i[4]/2),o=i[5]===2?Cp(r,(n+i[4])/2):Av(i,Math.ceil((n+i[4])/4));return new rv(i[0],i[1],i[2],i[3],s,o)},rv=(function(){function A(e,t,i,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=n,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Pi],t=(t<<Ka)+(e&za),this.data[t];if(e<=65535)return t=this.index[yp+(e-55296>>Pi)],t=(t<<Ka)+(e&za),this.data[t];if(e<this.highStart)return t=qC-jC+(e>>Na),t=this.index[t],t+=e>>Pi&tv,t=this.index[t],t=(t<<Ka)+(e&za),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),vp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nv=typeof Uint8Array>"u"?[]:new Uint8Array(256),Qs=0;Qs<vp.length;Qs++)nv[vp.charCodeAt(Qs)]=Qs;var sv=1,Va=2,Wa=3,Tp=4,bp=5,ov=7,xp=8,Ga=9,Ra=10,Qp=11,Fp=12,Up=13,Sp=14,$a=15,av=function(A){for(var e=[],t=0,i=A.length;t<i;){var r=A.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var n=A.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},lv=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],r=-1,n="";++r<t;){var s=A[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(n+=String.fromCharCode.apply(String,i),i.length=0)}return n},cv=iv(zC),FA="×",Xa="÷",hv=function(A){return cv.get(A)},uv=function(A,e,t){var i=t-2,r=e[i],n=e[t-1],s=e[t];if(n===Va&&s===Wa)return FA;if(n===Va||n===Wa||n===Tp||s===Va||s===Wa||s===Tp)return Xa;if(n===xp&&[xp,Ga,Qp,Fp].indexOf(s)!==-1||(n===Qp||n===Ga)&&(s===Ga||s===Ra)||(n===Fp||n===Ra)&&s===Ra||s===Up||s===bp||s===ov||n===sv)return FA;if(n===Up&&s===Sp){for(;r===bp;)r=e[--i];if(r===Sp)return FA}if(n===$a&&s===$a){for(var o=0;r===$a;)o++,r=e[--i];if(o%2===0)return FA}return Xa},pv=function(A){var e=av(A),t=e.length,i=0,r=0,n=e.map(hv);return{next:function(){if(i>=t)return{done:!0,value:null};for(var s=FA;i<t&&(s=uv(e,n,++i))===FA;);if(s!==FA||i===t){var o=lv.apply(null,e.slice(r,i));return r=i,{value:o,done:!1}}return{done:!0,value:null}}}},dv=function(A){for(var e=pv(A),t=[],i;!(i=e.next()).done;)i.value&&t.push(i.value.slice());return t},fv=function(A){var e=123;if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var i=A.createElement("boundtest");i.style.height=e+"px",i.style.display="block",A.body.appendChild(i),t.selectNode(i);var r=t.getBoundingClientRect(),n=Math.round(r.height);if(A.body.removeChild(i),n===e)return!0}}return!1},gv=function(A){var e=A.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",A.body.appendChild(e);var t=A.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var i=e.firstChild,r=Jn(i.data).map(function(l){return It(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(i,n),t.setEnd(i,n+l.length);var h=t.getBoundingClientRect();n+=l.length;var m=h.x>s.x||h.y>s.y;return s=h,c===0?!0:m});return A.body.removeChild(e),o},mv=function(){return typeof new Image().crossOrigin<"u"},wv=function(){return typeof new XMLHttpRequest().responseType=="string"},Bv=function(A){var e=new Image,t=A.createElement("canvas"),i=t.getContext("2d");if(!i)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{i.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},Ep=function(A){return A[0]===0&&A[1]===255&&A[2]===0&&A[3]===255},yv=function(A){var e=A.createElement("canvas"),t=100;e.width=t,e.height=t;var i=e.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,t,t);var r=new Image,n=e.toDataURL();r.src=n;var s=Ja(t,t,0,0,r);return i.fillStyle="red",i.fillRect(0,0,t,t),Lp(s).then(function(o){i.drawImage(o,0,0);var l=i.getImageData(0,0,t,t).data;i.fillStyle="red",i.fillRect(0,0,t,t);var c=A.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",Ep(l)?Lp(Ja(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return i.drawImage(o,0,0),Ep(i.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ja=function(A,e,t,i,r){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",A.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",i.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(r),s},Lp=function(A){return new Promise(function(e,t){var i=new Image;i.onload=function(){return e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},Jt={get SUPPORT_RANGE_BOUNDS(){var A=fv(document);return Object.defineProperty(Jt,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=Jt.SUPPORT_RANGE_BOUNDS&&gv(document);return Object.defineProperty(Jt,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=Bv(document);return Object.defineProperty(Jt,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A=typeof Array.from=="function"&&typeof window.fetch=="function"?yv(document):Promise.resolve(!1);return Object.defineProperty(Jt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=mv();return Object.defineProperty(Jt,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A=wv();return Object.defineProperty(Jt,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Jt,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Jt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},Gr=(function(){function A(e,t){this.text=e,this.bounds=t}return A})(),Cv=function(A,e,t,i){var r=bv(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Jt.SUPPORT_RANGE_BOUNDS){var l=Mp(i,s,o.length).getClientRects();if(l.length>1){var c=Za(o),h=0;c.forEach(function(v){n.push(new Gr(v,ti.fromDOMRectList(A,Mp(i,h+s,v.length).getClientRects()))),h+=v.length})}else n.push(new Gr(o,ti.fromDOMRectList(A,l)))}else{var m=i.splitText(o.length);n.push(new Gr(o,vv(A,i))),i=m}else Jt.SUPPORT_RANGE_BOUNDS||(i=i.splitText(o.length));s+=o.length}),n},vv=function(A,e){var t=e.ownerDocument;if(t){var i=t.createElement("html2canvaswrapper");i.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(i,e);var n=Xn(A,i);return i.firstChild&&r.replaceChild(i.firstChild,i),n}}return ti.EMPTY},Mp=function(A,e,t){var i=A.ownerDocument;if(!i)throw new Error("Node has no owner document");var r=i.createRange();return r.setStart(A,e),r.setEnd(A,e+t),r},Za=function(A){if(Jt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(A)).map(function(t){return t.segment})}return dv(A)},Tv=function(A,e){if(Jt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(A)).map(function(i){return i.segment})}return Qv(A,e)},bv=function(A,e){return e.letterSpacing!==0?Za(A):Tv(A,e)},xv=[32,160,4961,65792,65793,4153,4241],Qv=function(A,e){for(var t=jB(A,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),i=[],r,n=function(){if(r.value){var s=r.value.slice(),o=Jn(s),l="";o.forEach(function(c){xv.indexOf(c)===-1?l+=It(c):(l.length&&i.push(l),i.push(It(c)),l="")}),l.length&&i.push(l)}};!(r=t.next()).done;)n();return i},Fv=(function(){function A(e,t,i){this.text=Uv(t.data,i.textTransform),this.textBounds=Cv(e,this.text,i,t)}return A})(),Uv=function(A,e){switch(e){case 1:return A.toLowerCase();case 3:return A.replace(Sv,Ev);case 2:return A.toUpperCase();default:return A}},Sv=/(^|\s|:|-|\(|\))([a-z])/g,Ev=function(A,e,t){return A.length>0?e+t.toUpperCase():A},Hp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return e})($A),Ip=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return e})($A),Pp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this,n=new XMLSerializer,s=Xn(t,i);return i.setAttribute("width",s.width+"px"),i.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(i)),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})($A),Dp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.value=i.value,r}return e})($A),Ya=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.start=i.start,r.reversed=typeof i.reversed=="boolean"&&i.reversed===!0,r}return e})($A),Lv=[{type:15,flags:0,unit:"px",number:3}],Mv=[{type:16,flags:0,number:50}],Hv=function(A){return A.width>A.height?new ti(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new ti(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A},Iv=function(A){var e=A.type===Pv?new Array(A.value.length+1).join("•"):A.value;return e.length===0?A.placeholder||"":e},Fs="checkbox",Us="radio",Pv="password",_p=707406591,qa=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=Iv(i),(r.type===Fs||r.type===Us)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=Hv(r.bounds)),r.type){case Fs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Lv;break;case Us:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Mv;break}return r}return e})($A),kp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this,n=i.options[i.selectedIndex||0];return r.value=n&&n.text||"",r}return e})($A),Op=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.value=i.value,r}return e})($A),Np=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;r.src=i.src,r.width=parseInt(i.width,10)||0,r.height=parseInt(i.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(i.contentWindow&&i.contentWindow.document&&i.contentWindow.document.documentElement){r.tree=zp(t,i.contentWindow.document.documentElement);var n=i.contentWindow.document.documentElement?zr(t,getComputedStyle(i.contentWindow.document.documentElement).backgroundColor):ii.TRANSPARENT,s=i.contentWindow.document.body?zr(t,getComputedStyle(i.contentWindow.document.body).backgroundColor):ii.TRANSPARENT;r.backgroundColor=wi(n)?wi(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})($A),Dv=["OL","UL","MENU"],Ss=function(A,e,t,i){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,Vp(r)&&r.data.trim().length>0)t.textNodes.push(new Fv(A,r,t.styles));else if(ji(r))if(Jp(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Ss(A,o,t,i)});else{var s=Kp(A,r);s.styles.isVisible()&&(_v(r,s,i)?s.flags|=4:kv(s.styles)&&(s.flags|=2),Dv.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Ss(A,r.shadowRoot,s,i):!Ls(r)&&!Wp(r)&&!Ms(r)&&Ss(A,r,s,i))}},Kp=function(A,e){return tl(e)?new Hp(A,e):Gp(e)?new Ip(A,e):Wp(e)?new Pp(A,e):Ov(e)?new Dp(A,e):Nv(e)?new Ya(A,e):Kv(e)?new qa(A,e):Ms(e)?new kp(A,e):Ls(e)?new Op(A,e):$p(e)?new Np(A,e):new $A(A,e)},zp=function(A,e){var t=Kp(A,e);return t.flags|=4,Ss(A,e,t,t),t},_v=function(A,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||el(A)&&t.styles.isTransparent()},kv=function(A){return A.isPositioned()||A.isFloating()},Vp=function(A){return A.nodeType===Node.TEXT_NODE},ji=function(A){return A.nodeType===Node.ELEMENT_NODE},ja=function(A){return ji(A)&&typeof A.style<"u"&&!Es(A)},Es=function(A){return typeof A.className=="object"},Ov=function(A){return A.tagName==="LI"},Nv=function(A){return A.tagName==="OL"},Kv=function(A){return A.tagName==="INPUT"},zv=function(A){return A.tagName==="HTML"},Wp=function(A){return A.tagName==="svg"},el=function(A){return A.tagName==="BODY"},Gp=function(A){return A.tagName==="CANVAS"},Rp=function(A){return A.tagName==="VIDEO"},tl=function(A){return A.tagName==="IMG"},$p=function(A){return A.tagName==="IFRAME"},Xp=function(A){return A.tagName==="STYLE"},Vv=function(A){return A.tagName==="SCRIPT"},Ls=function(A){return A.tagName==="TEXTAREA"},Ms=function(A){return A.tagName==="SELECT"},Jp=function(A){return A.tagName==="SLOT"},Zp=function(A){return A.tagName.indexOf("-")>0},Wv=(function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},A.prototype.pop=function(e){var t=this;e.forEach(function(i){return t.counters[i].pop()})},A.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,n=!0;i!==null&&i.forEach(function(o){var l=t.counters[o.counter];l&&o.increment!==0&&(n=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=o.increment)});var s=[];return n&&r.forEach(function(o){var l=t.counters[o.counter];s.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),s},A})(),Yp={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},qp={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Gv={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Rv={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},er=function(A,e,t,i,r,n){return A<e||A>t?$r(A,r,n.length>0):i.integers.reduce(function(s,o,l){for(;A>=o;)A-=o,s+=i.values[l];return s},"")+n},jp=function(A,e,t,i){var r="";do t||A--,r=i(A)+r,A/=e;while(A*e>=e);return r},Pt=function(A,e,t,i,r){var n=t-e+1;return(A<0?"-":"")+(jp(Math.abs(A),n,i,function(s){return It(Math.floor(s%n)+e)})+r)},Di=function(A,e,t){t===void 0&&(t=". ");var i=e.length;return jp(Math.abs(A),i,!1,function(r){return e[Math.floor(r%i)]})+t},tr=1,yi=2,Ci=4,Rr=8,ri=function(A,e,t,i,r,n){if(A<-9999||A>9999)return $r(A,4,r.length>0);var s=Math.abs(A),o=r;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var c=s%10;c===0&&Kt(n,tr)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Kt(n,yi)||c===1&&l===1&&Kt(n,Ci)&&A>100||c===1&&l>1&&Kt(n,Rr)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),s=Math.floor(s/10)}return(A<0?i:"")+o},ed="十百千萬",td="拾佰仟萬",Ad="マイナス",Al="마이너스",$r=function(A,e,t){var i=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=Pt(A,48,57,!0,i);return o.length<4?"0"+o:o;case 4:return Di(A,"〇一二三四五六七八九",r);case 6:return er(A,1,3999,Yp,3,i).toLowerCase();case 7:return er(A,1,3999,Yp,3,i);case 8:return Pt(A,945,969,!1,i);case 9:return Pt(A,97,122,!1,i);case 10:return Pt(A,65,90,!1,i);case 11:return Pt(A,1632,1641,!0,i);case 12:case 49:return er(A,1,9999,qp,3,i);case 35:return er(A,1,9999,qp,3,i).toLowerCase();case 13:return Pt(A,2534,2543,!0,i);case 14:case 30:return Pt(A,6112,6121,!0,i);case 15:return Di(A,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Di(A,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ri(A,"零一二三四五六七八九",ed,"負",r,yi|Ci|Rr);case 47:return ri(A,"零壹貳參肆伍陸柒捌玖",td,"負",r,tr|yi|Ci|Rr);case 42:return ri(A,"零一二三四五六七八九",ed,"负",r,yi|Ci|Rr);case 41:return ri(A,"零壹贰叁肆伍陆柒捌玖",td,"负",r,tr|yi|Ci|Rr);case 26:return ri(A,"〇一二三四五六七八九","十百千万",Ad,r,0);case 25:return ri(A,"零壱弐参四伍六七八九","拾百千万",Ad,r,tr|yi|Ci);case 31:return ri(A,"영일이삼사오육칠팔구","십백천만",Al,n,tr|yi|Ci);case 33:return ri(A,"零一二三四五六七八九","十百千萬",Al,n,0);case 32:return ri(A,"零壹貳參四五六七八九","拾百千",Al,n,tr|yi|Ci);case 18:return Pt(A,2406,2415,!0,i);case 20:return er(A,1,19999,Rv,3,i);case 21:return Pt(A,2790,2799,!0,i);case 22:return Pt(A,2662,2671,!0,i);case 22:return er(A,1,10999,Gv,3,i);case 23:return Di(A,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Di(A,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Pt(A,3302,3311,!0,i);case 28:return Di(A,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Di(A,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Pt(A,3792,3801,!0,i);case 37:return Pt(A,6160,6169,!0,i);case 38:return Pt(A,4160,4169,!0,i);case 39:return Pt(A,2918,2927,!0,i);case 40:return Pt(A,1776,1785,!0,i);case 43:return Pt(A,3046,3055,!0,i);case 44:return Pt(A,3174,3183,!0,i);case 45:return Pt(A,3664,3673,!0,i);case 46:return Pt(A,3872,3881,!0,i);default:return Pt(A,48,57,!0,i)}},id="data-html2canvas-ignore",rd=(function(){function A(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Wv,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return A.prototype.toIFrame=function(e,t){var i=this,r=$v(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=r.contentWindow,l=o.document,c=Zv(r).then(function(){return sA(i,void 0,void 0,function(){var h,m;return tA(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(eT),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),h=this.options.onclone,m=this.clonedReferenceElement,typeof m>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Jv(l)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(qv(document.doctype)+"<html></html>"),jv(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},A.prototype.createElementClone=function(e){if(Oa(e,2))debugger;if(Gp(e))return this.createCanvasClone(e);if(Rp(e))return this.createVideoClone(e);if(Xp(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return tl(t)&&(tl(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Zp(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return il(e.style,t),t},A.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},A.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),s=r.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var l=o.getContextAttributes();l?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},A.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},A.prototype.appendChildNode=function(e,t,i){(!ji(t)||!Vv(t)&&!t.hasAttribute(id)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!ji(t)||!Xp(t))&&e.appendChild(this.cloneNode(t,i))},A.prototype.cloneChildNodes=function(e,t,i){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(ji(n)&&Jp(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,i)})}else this.appendChildNode(t,n,i)},A.prototype.cloneNode=function(e,t){if(Vp(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&ji(e)&&(ja(e)||Es(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=i.getComputedStyle(e),s=i.getComputedStyle(e,":before"),o=i.getComputedStyle(e,":after");this.referenceElement===e&&ja(r)&&(this.clonedReferenceElement=r),el(r)&&iT(r);var l=this.counters.parse(new wp(this.context,n)),c=this.resolvePseudoContent(e,r,s,Xr.BEFORE);Zp(e)&&(t=!0),Rp(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var h=this.resolvePseudoContent(e,r,o,Xr.AFTER);return h&&r.appendChild(h),this.counters.pop(l),(n&&(this.options.copyStyles||Es(e))&&!$p(e)||t)&&il(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ls(e)||Ms(e))&&(Ls(r)||Ms(r))&&(r.value=e.value),r}return e.cloneNode(!1)},A.prototype.resolvePseudoContent=function(e,t,i,r){var n=this;if(i){var s=i.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||i.display==="none")){this.counters.parse(new wp(this.context,i));var l=new OC(this.context,i),c=o.createElement("html2canvaspseudoelement");il(i,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var v=o.createElement("img");v.src=m.value,v.style.opacity="1",c.appendChild(v)}else if(m.type===18){if(m.name==="attr"){var x=m.values.filter(yt);x.length&&c.appendChild(o.createTextNode(e.getAttribute(x[0].value)||""))}else if(m.name==="counter"){var F=m.values.filter(Yi),T=F[0],S=F[1];if(T&&yt(T)){var I=n.counters.getCounterValue(T.value),Q=S&&yt(S)?ka.parse(n.context,S.value):3;c.appendChild(o.createTextNode($r(I,Q,!1)))}}else if(m.name==="counters"){var N=m.values.filter(Yi),T=N[0],J=N[1],S=N[2];if(T&&yt(T)){var H=n.counters.getCounterValues(T.value),z=S&&yt(S)?ka.parse(n.context,S.value):3,re=J&&J.type===0?J.value:"",q=H.map(function(ne){return $r(ne,z,!1)}).join(re);c.appendChild(o.createTextNode(q))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(mp(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(mp(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=rl+" "+nl;var h=r===Xr.BEFORE?" "+rl:" "+nl;return Es(t)?t.className.baseValue+=h:t.className+=h,c}}},A.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},A})(),Xr;(function(A){A[A.BEFORE=0]="BEFORE",A[A.AFTER=1]="AFTER"})(Xr||(Xr={}));var $v=function(A,e){var t=A.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(id,"true"),A.body.appendChild(t),t},Xv=function(A){return new Promise(function(e){if(A.complete){e();return}if(!A.src){e();return}A.onload=e,A.onerror=e})},Jv=function(A){return Promise.all([].slice.call(A.images,0).map(Xv))},Zv=function(A){return new Promise(function(e,t){var i=A.contentWindow;if(!i)return t("No window assigned for iframe");var r=i.document;i.onload=A.onload=function(){i.onload=A.onload=null;var n=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(n),e(A))},50)}})},Yv=["all","d","content"],il=function(A,e){for(var t=A.length-1;t>=0;t--){var i=A.item(t);Yv.indexOf(i)===-1&&e.style.setProperty(i,A.getPropertyValue(i))}return e},qv=function(A){var e="";return A&&(e+="<!DOCTYPE ",A.name&&(e+=A.name),A.internalSubset&&(e+=A.internalSubset),A.publicId&&(e+='"'+A.publicId+'"'),A.systemId&&(e+='"'+A.systemId+'"'),e+=">"),e},jv=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},eT=function(A){var e=A[0],t=A[1],i=A[2];e.scrollLeft=t,e.scrollTop=i},tT=":before",AT=":after",rl="___html2canvas___pseudoelement_before",nl="___html2canvas___pseudoelement_after",nd=`{
7
7
  content: "" !important;
8
8
  display: none !important;
9
9
  }`,iT=function(A){rT(A,"."+rl+tT+nd+`
10
10
  .`+nl+AT+nd)},rT=function(A,e){var t=A.ownerDocument;if(t){var i=t.createElement("style");i.textContent=e,A.appendChild(i)}},sd=(function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),nT=(function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(ol(e)||lT(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return sA(this,void 0,void 0,function(){var t,i,r,n,s=this;return tA(this,function(o){switch(o.label){case 0:return t=sd.isSameOrigin(e),i=!sl(e)&&this._options.useCORS===!0&&Jt.SUPPORT_CORS_IMAGES&&!t,r=!sl(e)&&!t&&!ol(e)&&typeof this._options.proxy=="string"&&Jt.SUPPORT_CORS_XHR&&!i,!t&&this._options.allowTaint===!1&&!sl(e)&&!ol(e)&&!r&&!i?[2]:(n=e,r?[4,this.proxy(n)]:[3,2]);case 1:n=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(l,c){var h=new Image;h.onload=function(){return l(h)},h.onerror=c,(cT(n)||i)&&(h.crossOrigin="anonymous"),h.src=n,h.complete===!0&&setTimeout(function(){return l(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(n,s){var o=Jt.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var m=new FileReader;m.addEventListener("load",function(){return n(m.result)},!1),m.addEventListener("error",function(v){return s(v)},!1),m.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=i.indexOf("?")>-1?"&":"?";if(l.open("GET",""+i+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var h=t._options.imageTimeout;l.timeout=h,l.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+r)}}l.send()})},A})(),sT=/^data:image\/svg\+xml/i,oT=/^data:image\/.*;base64,/i,aT=/^data:image\/.*/i,lT=function(A){return Jt.SUPPORT_SVG_DRAWING||!hT(A)},sl=function(A){return aT.test(A)},cT=function(A){return oT.test(A)},ol=function(A){return A.substr(0,4)==="blob"},hT=function(A){return A.substr(-3).toLowerCase()==="svg"||sT.test(A)},Pe=(function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A})(),Ar=function(A,e,t){return new Pe(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},Hs=(function(){function A(e,t,i,r){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=r}return A.prototype.subdivide=function(e,t){var i=Ar(this.start,this.startControl,e),r=Ar(this.startControl,this.endControl,e),n=Ar(this.endControl,this.end,e),s=Ar(i,r,e),o=Ar(r,n,e),l=Ar(s,o,e);return t?new A(this.start,i,s,l):new A(l,o,n,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),UA=function(A){return A.type===1},uT=(function(){function A(e){var t=e.styles,i=e.bounds,r=Kr(t.borderTopLeftRadius,i.width,i.height),n=r[0],s=r[1],o=Kr(t.borderTopRightRadius,i.width,i.height),l=o[0],c=o[1],h=Kr(t.borderBottomRightRadius,i.width,i.height),m=h[0],v=h[1],x=Kr(t.borderBottomLeftRadius,i.width,i.height),F=x[0],T=x[1],S=[];S.push((n+l)/i.width),S.push((F+m)/i.width),S.push((s+T)/i.height),S.push((c+v)/i.height);var I=Math.max.apply(Math,S);I>1&&(n/=I,s/=I,l/=I,c/=I,m/=I,v/=I,F/=I,T/=I);var Q=i.width-l,N=i.height-v,J=i.width-m,H=i.height-T,z=t.borderTopWidth,re=t.borderRightWidth,q=t.borderBottomWidth,ie=t.borderLeftWidth,G=xt(t.paddingTop,e.bounds.width),ne=xt(t.paddingRight,e.bounds.width),le=xt(t.paddingBottom,e.bounds.width),ee=xt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?St(i.left+ie/3,i.top+z/3,n-ie/3,s-z/3,gt.TOP_LEFT):new Pe(i.left+ie/3,i.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?St(i.left+Q,i.top+z/3,l-re/3,c-z/3,gt.TOP_RIGHT):new Pe(i.left+i.width-re/3,i.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||v>0?St(i.left+J,i.top+N,m-re/3,v-q/3,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re/3,i.top+i.height-q/3),this.bottomLeftBorderDoubleOuterBox=F>0||T>0?St(i.left+ie/3,i.top+H,F-ie/3,T-q/3,gt.BOTTOM_LEFT):new Pe(i.left+ie/3,i.top+i.height-q/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?St(i.left+ie*2/3,i.top+z*2/3,n-ie*2/3,s-z*2/3,gt.TOP_LEFT):new Pe(i.left+ie*2/3,i.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?St(i.left+Q,i.top+z*2/3,l-re*2/3,c-z*2/3,gt.TOP_RIGHT):new Pe(i.left+i.width-re*2/3,i.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||v>0?St(i.left+J,i.top+N,m-re*2/3,v-q*2/3,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re*2/3,i.top+i.height-q*2/3),this.bottomLeftBorderDoubleInnerBox=F>0||T>0?St(i.left+ie*2/3,i.top+H,F-ie*2/3,T-q*2/3,gt.BOTTOM_LEFT):new Pe(i.left+ie*2/3,i.top+i.height-q*2/3),this.topLeftBorderStroke=n>0||s>0?St(i.left+ie/2,i.top+z/2,n-ie/2,s-z/2,gt.TOP_LEFT):new Pe(i.left+ie/2,i.top+z/2),this.topRightBorderStroke=n>0||s>0?St(i.left+Q,i.top+z/2,l-re/2,c-z/2,gt.TOP_RIGHT):new Pe(i.left+i.width-re/2,i.top+z/2),this.bottomRightBorderStroke=m>0||v>0?St(i.left+J,i.top+N,m-re/2,v-q/2,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re/2,i.top+i.height-q/2),this.bottomLeftBorderStroke=F>0||T>0?St(i.left+ie/2,i.top+H,F-ie/2,T-q/2,gt.BOTTOM_LEFT):new Pe(i.left+ie/2,i.top+i.height-q/2),this.topLeftBorderBox=n>0||s>0?St(i.left,i.top,n,s,gt.TOP_LEFT):new Pe(i.left,i.top),this.topRightBorderBox=l>0||c>0?St(i.left+Q,i.top,l,c,gt.TOP_RIGHT):new Pe(i.left+i.width,i.top),this.bottomRightBorderBox=m>0||v>0?St(i.left+J,i.top+N,m,v,gt.BOTTOM_RIGHT):new Pe(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=F>0||T>0?St(i.left,i.top+H,F,T,gt.BOTTOM_LEFT):new Pe(i.left,i.top+i.height),this.topLeftPaddingBox=n>0||s>0?St(i.left+ie,i.top+z,Math.max(0,n-ie),Math.max(0,s-z),gt.TOP_LEFT):new Pe(i.left+ie,i.top+z),this.topRightPaddingBox=l>0||c>0?St(i.left+Math.min(Q,i.width-re),i.top+z,Q>i.width+re?0:Math.max(0,l-re),Math.max(0,c-z),gt.TOP_RIGHT):new Pe(i.left+i.width-re,i.top+z),this.bottomRightPaddingBox=m>0||v>0?St(i.left+Math.min(J,i.width-ie),i.top+Math.min(N,i.height-q),Math.max(0,m-re),Math.max(0,v-q),gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re,i.top+i.height-q),this.bottomLeftPaddingBox=F>0||T>0?St(i.left+ie,i.top+Math.min(H,i.height-q),Math.max(0,F-ie),Math.max(0,T-q),gt.BOTTOM_LEFT):new Pe(i.left+ie,i.top+i.height-q),this.topLeftContentBox=n>0||s>0?St(i.left+ie+ee,i.top+z+G,Math.max(0,n-(ie+ee)),Math.max(0,s-(z+G)),gt.TOP_LEFT):new Pe(i.left+ie+ee,i.top+z+G),this.topRightContentBox=l>0||c>0?St(i.left+Math.min(Q,i.width+ie+ee),i.top+z+G,Q>i.width+ie+ee?0:l-ie+ee,c-(z+G),gt.TOP_RIGHT):new Pe(i.left+i.width-(re+ne),i.top+z+G),this.bottomRightContentBox=m>0||v>0?St(i.left+Math.min(J,i.width-(ie+ee)),i.top+Math.min(N,i.height+z+G),Math.max(0,m-(re+ne)),v-(q+le),gt.BOTTOM_RIGHT):new Pe(i.left+i.width-(re+ne),i.top+i.height-(q+le)),this.bottomLeftContentBox=F>0||T>0?St(i.left+ie+ee,i.top+H,Math.max(0,F-(ie+ee)),T-(q+le),gt.BOTTOM_LEFT):new Pe(i.left+ie+ee,i.top+i.height-(q+le))}return A})(),gt;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(gt||(gt={}));var St=function(A,e,t,i,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=i*n,l=A+t,c=e+i;switch(r){case gt.TOP_LEFT:return new Hs(new Pe(A,c),new Pe(A,c-o),new Pe(l-s,e),new Pe(l,e));case gt.TOP_RIGHT:return new Hs(new Pe(A,e),new Pe(A+s,e),new Pe(l,c-o),new Pe(l,c));case gt.BOTTOM_RIGHT:return new Hs(new Pe(l,e),new Pe(l,e+o),new Pe(A+s,c),new Pe(A,c));case gt.BOTTOM_LEFT:default:return new Hs(new Pe(l,c),new Pe(l-s,c),new Pe(A,e+o),new Pe(A,e))}},Is=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},pT=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Ps=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},dT=(function(){function A(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6}return A})(),Ds=(function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A})(),fT=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),gT=function(A){return A.type===0},od=function(A){return A.type===1},mT=function(A){return A.type===2},ad=function(A,e){return A.length===e.length?A.some(function(t,i){return t===e[i]}):!1},wT=function(A,e,t,i,r){return A.map(function(n,s){switch(s){case 0:return n.add(e,t);case 1:return n.add(e+i,t);case 2:return n.add(e+i,t+r);case 3:return n.add(e,t+r)}return n})},ld=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),cd=(function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new uT(this.container),this.container.styles.opacity<1&&this.effects.push(new fT(this.container.styles.opacity)),this.container.styles.transform!==null){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new dT(i,r,n))}if(this.container.styles.overflowX!==0){var s=Is(this.curves),o=Ps(this.curves);ad(s,o)?this.effects.push(new Ds(s,6)):(this.effects.push(new Ds(s,2)),this.effects.push(new Ds(o,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,i=this.parent,r=this.effects.slice(0);i;){var n=i.effects.filter(function(l){return!od(l)});if(t||i.container.styles.position!==0||!i.parent){if(r.unshift.apply(r,n),t=[2,3].indexOf(i.container.styles.position)===-1,i.container.styles.overflowX!==0){var s=Is(i.curves),o=Ps(i.curves);ad(s,o)||r.unshift(new Ds(o,6))}}else r.unshift.apply(r,n);i=i.parent}return r.filter(function(l){return Kt(l.target,e)})},A})(),al=function(A,e,t,i){A.container.elements.forEach(function(r){var n=Kt(r.flags,4),s=Kt(r.flags,2),o=new cd(r,A);Kt(r.styles.display,2048)&&i.push(o);var l=Kt(r.flags,8)?[]:i;if(n||s){var c=n||r.styles.isPositioned()?t:e,h=new ld(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var m=r.styles.zIndex.order;if(m<0){var v=0;c.negativeZIndex.some(function(F,T){return m>F.element.container.styles.zIndex.order?(v=T,!1):v>0}),c.negativeZIndex.splice(v,0,h)}else if(m>0){var x=0;c.positiveZIndex.some(function(F,T){return m>=F.element.container.styles.zIndex.order?(x=T+1,!1):x>0}),c.positiveZIndex.splice(x,0,h)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?c.nonPositionedFloats.push(h):c.nonPositionedInlineLevel.push(h);al(o,h,n?h:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),al(o,e,t,l);Kt(r.flags,8)&&hd(r,l)})},hd=function(A,e){for(var t=A instanceof Ya?A.start:1,i=A instanceof Ya?A.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Dp&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=$r(t,n.container.styles.listStyleType,!0),t+=i?-1:1}},BT=function(A){var e=new cd(A,null),t=new ld(e),i=[];return al(e,t,t,i),hd(e.container,i),t},ud=function(A,e){switch(e){case 0:return SA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return SA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return SA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return SA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},yT=function(A,e){switch(e){case 0:return SA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return SA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return SA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return SA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},CT=function(A,e){switch(e){case 0:return SA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return SA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return SA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return SA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},vT=function(A,e){switch(e){case 0:return _s(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return _s(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return _s(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return _s(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},_s=function(A,e){var t=[];return UA(A)?t.push(A.subdivide(.5,!1)):t.push(A),UA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},SA=function(A,e,t,i){var r=[];return UA(A)?r.push(A.subdivide(.5,!1)):r.push(A),UA(t)?r.push(t.subdivide(.5,!0)):r.push(t),UA(i)?r.push(i.subdivide(.5,!0).reverse()):r.push(i),UA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},pd=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},ks=function(A){var e=A.styles,t=A.bounds,i=xt(e.paddingLeft,t.width),r=xt(e.paddingRight,t.width),n=xt(e.paddingTop,t.width),s=xt(e.paddingBottom,t.width);return t.add(i+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+i+r),-(e.borderTopWidth+e.borderBottomWidth+n+s))},TT=function(A,e){return A===0?e.bounds:A===2?ks(e):pd(e)},bT=function(A,e){return A===0?e.bounds:A===2?ks(e):pd(e)},ll=function(A,e,t){var i=TT(rr(A.styles.backgroundOrigin,e),A),r=bT(rr(A.styles.backgroundClip,e),A),n=xT(rr(A.styles.backgroundSize,e),t,i),s=n[0],o=n[1],l=Kr(rr(A.styles.backgroundPosition,e),i.width-s,i.height-o),c=QT(rr(A.styles.backgroundRepeat,e),l,n,i,r),h=Math.round(i.left+l[0]),m=Math.round(i.top+l[1]);return[c,h,m,s,o]},ir=function(A){return yt(A)&&A.value===qi.AUTO},Os=function(A){return typeof A=="number"},xT=function(A,e,t){var i=e[0],r=e[1],n=e[2],s=A[0],o=A[1];if(!s)return[0,0];if(Ot(s)&&o&&Ot(o))return[xt(s,t.width),xt(o,t.height)];var l=Os(n);if(yt(s)&&(s.value===qi.CONTAIN||s.value===qi.COVER)){if(Os(n)){var c=t.width/t.height;return c<n!=(s.value===qi.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var h=Os(i),m=Os(r),v=h||m;if(ir(s)&&(!o||ir(o))){if(h&&m)return[i,r];if(!l&&!v)return[t.width,t.height];if(v&&l){var x=h?i:r*n,F=m?r:i/n;return[x,F]}var T=h?i:t.width,S=m?r:t.height;return[T,S]}if(l){var I=0,Q=0;return Ot(s)?I=xt(s,t.width):Ot(o)&&(Q=xt(o,t.height)),ir(s)?I=Q*n:(!o||ir(o))&&(Q=I/n),[I,Q]}var N=null,J=null;if(Ot(s)?N=xt(s,t.width):o&&Ot(o)&&(J=xt(o,t.height)),N!==null&&(!o||ir(o))&&(J=h&&m?N/i*r:t.height),J!==null&&ir(s)&&(N=h&&m?J/r*i:t.width),N!==null&&J!==null)return[N,J];throw new Error("Unable to calculate background-size for element")},rr=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},QT=function(A,e,t,i,r){var n=e[0],s=e[1],o=t[0],l=t[1];switch(A){case 2:return[new Pe(Math.round(i.left),Math.round(i.top+s)),new Pe(Math.round(i.left+i.width),Math.round(i.top+s)),new Pe(Math.round(i.left+i.width),Math.round(l+i.top+s)),new Pe(Math.round(i.left),Math.round(l+i.top+s))];case 3:return[new Pe(Math.round(i.left+n),Math.round(i.top)),new Pe(Math.round(i.left+n+o),Math.round(i.top)),new Pe(Math.round(i.left+n+o),Math.round(i.height+i.top)),new Pe(Math.round(i.left+n),Math.round(i.height+i.top))];case 1:return[new Pe(Math.round(i.left+n),Math.round(i.top+s)),new Pe(Math.round(i.left+n+o),Math.round(i.top+s)),new Pe(Math.round(i.left+n+o),Math.round(i.top+s+l)),new Pe(Math.round(i.left+n),Math.round(i.top+s+l))];default:return[new Pe(Math.round(r.left),Math.round(r.top)),new Pe(Math.round(r.left+r.width),Math.round(r.top)),new Pe(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Pe(Math.round(r.left),Math.round(r.height+r.top))]}},FT="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",dd="Hidden Text",UT=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var i=this._document.createElement("div"),r=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;i.style.visibility="hidden",i.style.fontFamily=e,i.style.fontSize=t,i.style.margin="0",i.style.padding="0",i.style.whiteSpace="nowrap",s.appendChild(i),r.src=FT,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(dd)),i.appendChild(n),i.appendChild(r);var o=r.offsetTop-n.offsetTop+2;i.removeChild(n),i.appendChild(this._document.createTextNode(dd)),i.style.lineHeight="normal",r.style.verticalAlign="super";var l=r.offsetTop-i.offsetTop+2;return s.removeChild(i),{baseline:o,middle:l}},A.prototype.getMetrics=function(e,t){var i=e+" "+t;return typeof this._data[i]>"u"&&(this._data[i]=this.parseMetrics(e,t)),this._data[i]},A})(),fd=(function(){function A(e,t){this.context=e,this.options=t}return A})(),ST=1e4,ET=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r._activeEffects=[],r.canvas=i.canvas?i.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),i.canvas||(r.canvas.width=Math.floor(i.width*i.scale),r.canvas.height=Math.floor(i.height*i.scale),r.canvas.style.width=i.width+"px",r.canvas.style.height=i.height+"px"),r.fontMetrics=new UT(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-i.x,-i.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+i.width+"x"+i.height+") with scale "+i.scale),r}return e.prototype.applyEffects=function(t){for(var i=this;this._activeEffects.length;)this.popEffect();t.forEach(function(r){return i.applyEffect(r)})},e.prototype.applyEffect=function(t){this.ctx.save(),mT(t)&&(this.ctx.globalAlpha=t.opacity),gT(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),od(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return sA(this,void 0,void 0,function(){var i;return tA(this,function(r){switch(r.label){case 0:return i=t.element.container.styles,i.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return sA(this,void 0,void 0,function(){return tA(this,function(i){switch(i.label){case 0:if(Kt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return i.sent(),[4,this.renderNodeContent(t)];case 2:i.sent(),i.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,i,r){var n=this;if(i===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=Za(t.text);s.reduce(function(o,l){return n.ctx.fillText(l,o,t.bounds.top+r),o+n.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var i=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),r=PT(t.fontFamily).join(", "),n=Nr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,i,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,i){return sA(this,void 0,void 0,function(){var r,n,s,o,l,c,h,m,v=this;return tA(this,function(x){return r=this.createFontStyle(i),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=i.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,h=l.middle,m=i.paintOrder,t.textBounds.forEach(function(F){m.forEach(function(T){switch(T){case 0:v.ctx.fillStyle=Gt(i.color),v.renderTextWithLetterSpacing(F,i.letterSpacing,c);var S=i.textShadow;S.length&&F.text.trim().length&&(S.slice(0).reverse().forEach(function(I){v.ctx.shadowColor=Gt(I.color),v.ctx.shadowOffsetX=I.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=I.offsetY.number*v.options.scale,v.ctx.shadowBlur=I.blur.number,v.renderTextWithLetterSpacing(F,i.letterSpacing,c)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),i.textDecorationLine.length&&(v.ctx.fillStyle=Gt(i.textDecorationColor||i.color),i.textDecorationLine.forEach(function(I){switch(I){case 1:v.ctx.fillRect(F.bounds.left,Math.round(F.bounds.top+c),F.bounds.width,1);break;case 2:v.ctx.fillRect(F.bounds.left,Math.round(F.bounds.top),F.bounds.width,1);break;case 3:v.ctx.fillRect(F.bounds.left,Math.ceil(F.bounds.top+h),F.bounds.width,1);break}}));break;case 1:i.webkitTextStrokeWidth&&F.text.trim().length&&(v.ctx.strokeStyle=Gt(i.webkitTextStrokeColor),v.ctx.lineWidth=i.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(F.text,F.bounds.left,F.bounds.top+c)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,i,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=ks(t),s=Ps(i);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return sA(this,void 0,void 0,function(){var i,r,n,s,o,l,Q,Q,c,h,m,v,J,x,F,H,T,S,I,Q,N,J,H;return tA(this,function(z){switch(z.label){case 0:this.applyEffects(t.getEffects(4)),i=t.container,r=t.curves,n=i.styles,s=0,o=i.textNodes,z.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,n)]):[3,4];case 2:z.sent(),z.label=3;case 3:return s++,[3,1];case 4:if(!(i instanceof Hp))return[3,8];z.label=5;case 5:return z.trys.push([5,7,,8]),[4,this.context.cache.match(i.src)];case 6:return Q=z.sent(),this.renderReplacedElement(i,r,Q),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+i.src),[3,8];case 8:if(i instanceof Ip&&this.renderReplacedElement(i,r,i.canvas),!(i instanceof Pp))return[3,12];z.label=9;case 9:return z.trys.push([9,11,,12]),[4,this.context.cache.match(i.svg)];case 10:return Q=z.sent(),this.renderReplacedElement(i,r,Q),[3,12];case 11:return z.sent(),this.context.logger.error("Error loading svg "+i.svg.substring(0,255)),[3,12];case 12:return i instanceof Np&&i.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:i.backgroundColor,x:0,y:0,width:i.width,height:i.height}),[4,c.render(i.tree)]):[3,14];case 13:h=z.sent(),i.width&&i.height&&this.ctx.drawImage(h,0,0,i.width,i.height,i.bounds.left,i.bounds.top,i.bounds.width,i.bounds.height),z.label=14;case 14:if(i instanceof qa&&(m=Math.min(i.bounds.width,i.bounds.height),i.type===Fs?i.checked&&(this.ctx.save(),this.path([new Pe(i.bounds.left+m*.39363,i.bounds.top+m*.79),new Pe(i.bounds.left+m*.16,i.bounds.top+m*.5549),new Pe(i.bounds.left+m*.27347,i.bounds.top+m*.44071),new Pe(i.bounds.left+m*.39694,i.bounds.top+m*.5649),new Pe(i.bounds.left+m*.72983,i.bounds.top+m*.23),new Pe(i.bounds.left+m*.84,i.bounds.top+m*.34085),new Pe(i.bounds.left+m*.39363,i.bounds.top+m*.79)]),this.ctx.fillStyle=Gt(_p),this.ctx.fill(),this.ctx.restore()):i.type===Us&&i.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(i.bounds.left+m/2,i.bounds.top+m/2,m/4,0,Math.PI*2,!0),this.ctx.fillStyle=Gt(_p),this.ctx.fill(),this.ctx.restore())),LT(i)&&i.value.length){switch(v=this.createFontStyle(n),J=v[0],x=v[1],F=this.fontMetrics.getMetrics(J,x).baseline,this.ctx.font=J,this.ctx.fillStyle=Gt(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=HT(i.styles.textAlign),H=ks(i),T=0,i.styles.textAlign){case 1:T+=H.width/2;break;case 2:T+=H.width;break}S=H.add(T,0,0,-H.height/2+1),this.ctx.save(),this.path([new Pe(H.left,H.top),new Pe(H.left+H.width,H.top),new Pe(H.left+H.width,H.top+H.height),new Pe(H.left,H.top+H.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Gr(i.value,S),n.letterSpacing,F),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Kt(i.styles.display,2048))return[3,20];if(i.styles.listStyleImage===null)return[3,19];if(I=i.styles.listStyleImage,I.type!==0)return[3,18];Q=void 0,N=I.url,z.label=15;case 15:return z.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return Q=z.sent(),this.ctx.drawImage(Q,i.bounds.left-(Q.width+10),i.bounds.top),[3,18];case 17:return z.sent(),this.context.logger.error("Error loading list-style-image "+N),[3,18];case 18:return[3,20];case 19:t.listValue&&i.styles.listStyleType!==-1&&(J=this.createFontStyle(n)[0],this.ctx.font=J,this.ctx.fillStyle=Gt(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",H=new ti(i.bounds.left,i.bounds.top+xt(i.styles.paddingTop,i.bounds.width),i.bounds.width,dp(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Gr(t.listValue,H),n.letterSpacing,dp(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),z.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return sA(this,void 0,void 0,function(){var i,r,I,n,s,I,o,l,I,c,h,I,m,v,I,x,F,I,T,S,I;return tA(this,function(Q){switch(Q.label){case 0:if(Kt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:Q.sent(),i=0,r=t.negativeZIndex,Q.label=2;case 2:return i<r.length?(I=r[i],[4,this.renderStack(I)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return i++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:Q.sent(),n=0,s=t.nonInlineLevel,Q.label=7;case 7:return n<s.length?(I=s[n],[4,this.renderNode(I)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,Q.label=11;case 11:return o<l.length?(I=l[o],[4,this.renderStack(I)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return o++,[3,11];case 14:c=0,h=t.nonPositionedInlineLevel,Q.label=15;case 15:return c<h.length?(I=h[c],[4,this.renderStack(I)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return c++,[3,15];case 18:m=0,v=t.inlineLevel,Q.label=19;case 19:return m<v.length?(I=v[m],[4,this.renderNode(I)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return m++,[3,19];case 22:x=0,F=t.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return x<F.length?(I=F[x],[4,this.renderStack(I)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return x++,[3,23];case 26:T=0,S=t.positiveZIndex,Q.label=27;case 27:return T<S.length?(I=S[T],[4,this.renderStack(I)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return T++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var i=this;t.forEach(function(r,n){var s=UA(r)?r.start:r;n===0?i.ctx.moveTo(s.x,s.y):i.ctx.lineTo(s.x,s.y),UA(r)&&i.ctx.bezierCurveTo(r.startControl.x,r.startControl.y,r.endControl.x,r.endControl.y,r.end.x,r.end.y)})},e.prototype.renderRepeat=function(t,i,r,n){this.path(t),this.ctx.fillStyle=i,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)},e.prototype.resizeImage=function(t,i,r){var n;if(t.width===i&&t.height===r)return t;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,i),o.height=Math.max(1,r);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,i,r),o},e.prototype.renderBackgroundImage=function(t){return sA(this,void 0,void 0,function(){var i,r,n,s,o,l;return tA(this,function(c){switch(c.label){case 0:i=t.styles.backgroundImage.length-1,r=function(h){var m,v,x,G,ge,ae,ee,we,q,F,G,ge,ae,ee,we,T,S,I,Q,N,J,H,z,re,q,ie,G,ne,le,ee,we,j,ge,ae,pe,ue,oe,fe,Qe,me,xe,Se;return tA(this,function(Me){switch(Me.label){case 0:if(h.type!==0)return[3,5];m=void 0,v=h.url,Me.label=1;case 1:return Me.trys.push([1,3,,4]),[4,n.context.cache.match(v)];case 2:return m=Me.sent(),[3,4];case 3:return Me.sent(),n.context.logger.error("Error loading background-image "+v),[3,4];case 4:return m&&(x=ll(t,i,[m.width,m.height,m.width/m.height]),G=x[0],ge=x[1],ae=x[2],ee=x[3],we=x[4],q=n.ctx.createPattern(n.resizeImage(m,ee,we),"repeat"),n.renderRepeat(G,q,ge,ae)),[3,6];case 5:gy(h)?(F=ll(t,i,[null,null,null]),G=F[0],ge=F[1],ae=F[2],ee=F[3],we=F[4],T=hy(h.angle,ee,we),S=T[0],I=T[1],Q=T[2],N=T[3],J=T[4],H=document.createElement("canvas"),H.width=ee,H.height=we,z=H.getContext("2d"),re=z.createLinearGradient(I,N,Q,J),ip(h.stops,S).forEach(function($e){return re.addColorStop($e.stop,Gt($e.color))}),z.fillStyle=re,z.fillRect(0,0,ee,we),ee>0&&we>0&&(q=n.ctx.createPattern(H,"repeat"),n.renderRepeat(G,q,ge,ae))):my(h)&&(ie=ll(t,i,[null,null,null]),G=ie[0],ne=ie[1],le=ie[2],ee=ie[3],we=ie[4],j=h.position.length===0?[Pa]:h.position,ge=xt(j[0],ee),ae=xt(j[j.length-1],we),pe=uy(h,ge,ae,ee,we),ue=pe[0],oe=pe[1],ue>0&&oe>0&&(fe=n.ctx.createRadialGradient(ne+ge,le+ae,0,ne+ge,le+ae,ue),ip(h.stops,ue*2).forEach(function($e){return fe.addColorStop($e.stop,Gt($e.color))}),n.path(G),n.ctx.fillStyle=fe,ue!==oe?(Qe=t.bounds.left+.5*t.bounds.width,me=t.bounds.top+.5*t.bounds.height,xe=oe/ue,Se=1/xe,n.ctx.save(),n.ctx.translate(Qe,me),n.ctx.transform(1,0,0,xe,0,0),n.ctx.translate(-Qe,-me),n.ctx.fillRect(ne,Se*(le-me)+me,ee,we*Se),n.ctx.restore()):n.ctx.fill())),Me.label=6;case 6:return i--,[2]}})},n=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(l=o[s],[5,r(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,i,r){return sA(this,void 0,void 0,function(){return tA(this,function(n){return this.path(ud(r,i)),this.ctx.fillStyle=Gt(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,i,r,n){return sA(this,void 0,void 0,function(){var s,o;return tA(this,function(l){switch(l.label){case 0:return i<3?[4,this.renderSolidBorder(t,r,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=yT(n,r),this.path(s),this.ctx.fillStyle=Gt(t),this.ctx.fill(),o=CT(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return sA(this,void 0,void 0,function(){var i,r,n,s,o,l,c,h,m=this;return tA(this,function(v){switch(v.label){case 0:return this.applyEffects(t.getEffects(2)),i=t.container.styles,r=!wi(i.backgroundColor)||i.backgroundImage.length,n=[{style:i.borderTopStyle,color:i.borderTopColor,width:i.borderTopWidth},{style:i.borderRightStyle,color:i.borderRightColor,width:i.borderRightWidth},{style:i.borderBottomStyle,color:i.borderBottomColor,width:i.borderBottomWidth},{style:i.borderLeftStyle,color:i.borderLeftColor,width:i.borderLeftWidth}],s=MT(rr(i.backgroundClip,0),t.curves),r||i.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),wi(i.backgroundColor)||(this.ctx.fillStyle=Gt(i.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),i.boxShadow.slice(0).reverse().forEach(function(x){m.ctx.save();var F=Is(t.curves),T=x.inset?0:ST,S=wT(F,-T+(x.inset?1:-1)*x.spread.number,(x.inset?1:-1)*x.spread.number,x.spread.number*(x.inset?-2:2),x.spread.number*(x.inset?-2:2));x.inset?(m.path(F),m.ctx.clip(),m.mask(S)):(m.mask(F),m.ctx.clip(),m.path(S)),m.ctx.shadowOffsetX=x.offsetX.number+T,m.ctx.shadowOffsetY=x.offsetY.number,m.ctx.shadowColor=Gt(x.color),m.ctx.shadowBlur=x.blur.number,m.ctx.fillStyle=x.inset?Gt(x.color):"rgba(0,0,0,1)",m.ctx.fill(),m.ctx.restore()}),v.label=2;case 2:o=0,l=0,c=n,v.label=3;case 3:return l<c.length?(h=c[l],h.style!==0&&!wi(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,3)];case 6:return v.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,t.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,t.curves)];case 10:v.sent(),v.label=11;case 11:o++,v.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,i,r,n,s){return sA(this,void 0,void 0,function(){var o,l,c,h,m,v,x,F,T,S,I,Q,N,J,H,z,H,z;return tA(this,function(re){return this.ctx.save(),o=vT(n,r),l=ud(n,r),s===2&&(this.path(l),this.ctx.clip()),UA(l[0])?(c=l[0].start.x,h=l[0].start.y):(c=l[0].x,h=l[0].y),UA(l[1])?(m=l[1].end.x,v=l[1].end.y):(m=l[1].x,v=l[1].y),r===0||r===2?x=Math.abs(c-m):x=Math.abs(h-v),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),F=i<3?i*3:i*2,T=i<3?i*2:i,s===3&&(F=i,T=i),S=!0,x<=F*2?S=!1:x<=F*2+T?(I=x/(2*F+T),F*=I,T*=I):(Q=Math.floor((x+T)/(F+T)),N=(x-Q*F)/(Q-1),J=(x-(Q+1)*F)/Q,T=J<=0||Math.abs(T-N)<Math.abs(T-J)?N:J),S&&(s===3?this.ctx.setLineDash([0,F+T]):this.ctx.setLineDash([F,T])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=i):this.ctx.lineWidth=i*2+1.1,this.ctx.strokeStyle=Gt(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(UA(l[0])&&(H=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new Pe(H.end.x,H.end.y),new Pe(z.start.x,z.start.y)]),this.ctx.stroke()),UA(l[1])&&(H=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new Pe(H.end.x,H.end.y),new Pe(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return sA(this,void 0,void 0,function(){var i;return tA(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Gt(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),i=BT(t),[4,this.renderStack(i)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(fd),LT=function(A){return A instanceof Op||A instanceof kp?!0:A instanceof qa&&A.type!==Us&&A.type!==Fs},MT=function(A,e){switch(A){case 0:return Is(e);case 2:return pT(e);default:return Ps(e)}},HT=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},IT=["-apple-system","system-ui"],PT=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return IT.indexOf(e)===-1}):A},DT=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.canvas=i.canvas?i.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=i,r.canvas.width=Math.floor(i.width*i.scale),r.canvas.height=Math.floor(i.height*i.scale),r.canvas.style.width=i.width+"px",r.canvas.style.height=i.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-i.x,-i.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+i.width+"x"+i.height+" at "+i.x+","+i.y+") with scale "+i.scale),r}return e.prototype.render=function(t){return sA(this,void 0,void 0,function(){var i,r;return tA(this,function(n){switch(n.label){case 0:return i=Ja(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,_T(i)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Gt(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(fd),_T=function(A){return new Promise(function(e,t){var i=new Image;i.onload=function(){e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},kT=(function(){function A(e){var t=e.id,i=e.enabled;this.id=t,this.enabled=i,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,$n([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),OT=(function(){function A(e,t){var i;this.windowBounds=t,this.instanceName="#"+A.instanceCount++,this.logger=new kT({id:this.instanceName,enabled:e.logging}),this.cache=(i=e.cache)!==null&&i!==void 0?i:new nT(this,e)}return A.instanceCount=1,A})(),NT=function(A,e){return e===void 0&&(e={}),KT(A,e)};typeof window<"u"&&sd.setContext(window);var KT=function(A,e){return sA(void 0,void 0,void 0,function(){var t,i,r,n,s,o,l,c,h,m,v,x,F,T,S,I,Q,N,J,H,re,z,re,q,ie,G,ne,le,ee,we,j,ge,ae,pe,ue,oe,fe,Qe,me,xe;return tA(this,function(Se){switch(Se.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(i=t.defaultView,!i)throw new Error("Document is not attached to a Window");return r={allowTaint:(q=e.allowTaint)!==null&&q!==void 0?q:!1,imageTimeout:(ie=e.imageTimeout)!==null&&ie!==void 0?ie:15e3,proxy:e.proxy,useCORS:(G=e.useCORS)!==null&&G!==void 0?G:!1},n=da({logging:(ne=e.logging)!==null&&ne!==void 0?ne:!0,cache:e.cache},r),s={windowWidth:(le=e.windowWidth)!==null&&le!==void 0?le:i.innerWidth,windowHeight:(ee=e.windowHeight)!==null&&ee!==void 0?ee:i.innerHeight,scrollX:(we=e.scrollX)!==null&&we!==void 0?we:i.pageXOffset,scrollY:(j=e.scrollY)!==null&&j!==void 0?j:i.pageYOffset},o=new ti(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new OT(n,o),c=(ge=e.foreignObjectRendering)!==null&&ge!==void 0?ge:!1,h={allowTaint:(ae=e.allowTaint)!==null&&ae!==void 0?ae:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),m=new rd(l,A,h),v=m.clonedReferenceElement,v?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return x=Se.sent(),F=el(v)||zv(v)?wB(v.ownerDocument):Xn(l,v),T=F.width,S=F.height,I=F.left,Q=F.top,N=zT(l,v,e.backgroundColor),J={canvas:e.canvas,backgroundColor:N,scale:(ue=(pe=e.scale)!==null&&pe!==void 0?pe:i.devicePixelRatio)!==null&&ue!==void 0?ue:1,x:((oe=e.x)!==null&&oe!==void 0?oe:0)+I,y:((fe=e.y)!==null&&fe!==void 0?fe:0)+Q,width:(Qe=e.width)!==null&&Qe!==void 0?Qe:Math.ceil(T),height:(me=e.height)!==null&&me!==void 0?me:Math.ceil(S)},c?(l.logger.debug("Document cloned, using foreign object rendering"),re=new DT(l,J),[4,re.render(v)]):[3,3];case 2:return H=Se.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+I+","+Q+" with size "+T+"x"+S+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=zp(l,v),N===z.styles.backgroundColor&&(z.styles.backgroundColor=ii.TRANSPARENT),l.logger.debug("Starting renderer for element at "+J.x+","+J.y+" with size "+J.width+"x"+J.height),re=new ET(l,J),[4,re.render(z)];case 4:H=Se.sent(),Se.label=5;case 5:return(!((xe=e.removeContainer)!==null&&xe!==void 0)||xe)&&(rd.destroy(x)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,H]}})})},zT=function(A,e,t){var i=e.ownerDocument,r=i.documentElement?zr(A,getComputedStyle(i.documentElement).backgroundColor):ii.TRANSPARENT,n=i.body?zr(A,getComputedStyle(i.body).backgroundColor):ii.TRANSPARENT,s=typeof t=="string"?zr(A,t):t===null?ii.TRANSPARENT:4294967295;return e===i.documentElement?wi(r)?wi(n)?s:n:r:s};const VT=new Set(["primitive","series","priceLine","decoration","textPrimitive","firstLine","secondLine","baseLine","parallelLine"]);function WT(A){const e={};for(const[t,i]of Object.entries(A))VT.has(t)||(e[t]=i);return e}function GT(A,e,t){if(!e)return;const i=`chart_drawings_${e}_${t||"default"}`;try{const r=A.map(WT);localStorage.setItem(i,JSON.stringify(r))}catch{}}function RT(A,e){if(!A)return[];const t=`chart_drawings_${A}_${e||"default"}`;try{const i=localStorage.getItem(t);if(!i)return[];const r=JSON.parse(i);return Array.isArray(r)?r:[]}catch{return[]}}function $T(A,e){if(!A)return;const t=`chart_drawings_${A}_${e||"default"}`;try{localStorage.removeItem(t)}catch{}}class gd{constructor(e,t,i="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=i,this.lineWidth=r,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=o.context,c=n._chart,h=n._series;if(!c||!h)return;const m=h.priceToCoordinate(n.price);if(m==null)return;const v=Math.round(m*o.verticalPixelRatio),x=c.timeScale().timeToCoordinate(n.originTime),F=x==null?0:Math.max(0,Math.round(x*o.horizontalPixelRatio)),T=o.bitmapSize.width;if(F>=T)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(F,v),l.lineTo(T,v),l.stroke(),l.beginPath(),l.fillStyle=n.color;const S=3*o.verticalPixelRatio;l.arc(F,v,S,0,Math.PI*2),l.fill(),l.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class md{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!i.visible||!i.text||!i._series)return;const c=i._series.priceToCoordinate(i.price);if(c==null)return;const h=Math.round(i.fontSize*l);n.font=`${h}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const m=Math.round(8*o),v=Math.round(14*l),x=s.width;let F;if(i.hAlign==="left")if(i.originTime!=null&&i._chart){const I=i._chart.timeScale().timeToCoordinate(i.originTime);F=I!=null?Math.round(I*o):m,n.textAlign="right"}else F=m,n.textAlign="left";else i.hAlign==="right"?(F=x-m,n.textAlign="right"):(F=x/2,n.textAlign="center");const T=Math.round(c*l);let S;i.vAlign==="top"?S=T-v:i.vAlign==="bottom"?S=T+v:S=T,n.fillStyle=i.textColor,n.fillText(i.text,F,S)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class wd{constructor(e,t,i,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=i,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,h=s._series;if(!c||!h)return;const m=l.horizontalPixelRatio,v=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),F=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),T=h.priceToCoordinate(s.p1.price),S=h.priceToCoordinate(s.p2.price);if(x==null||F==null||T==null||S==null)return;const I=Math.round(x*m),Q=Math.round(T*v),N=Math.round(F*m),J=Math.round(S*v),H=l.context;if(H.save(),H.beginPath(),H.strokeStyle=s.color,H.lineWidth=s.lineWidth*v,H.setLineDash([]),H.moveTo(I,Q),H.lineTo(N,J),H.stroke(),H.beginPath(),H.fillStyle=s.color,H.arc(I,Q,3*v,0,Math.PI*2),H.fill(),H.beginPath(),H.arc(N,J,3*v,0,Math.PI*2),H.fill(),!s.statsShowAlways&&!s.isActive){H.restore();return}const{priceDiff:z,pricePct:re,bars:q,days:ie,angle:G}=s.info,ne=z>=0?"+":"",le=[];if(s.statsPriceRange!==!1&&le.push(`${ne}${z.toFixed(5)} (${ne}${re.toFixed(2)}%)`),s.statsBarsRange!==!1&&le.push(`${q} bars`),s.statsDateRange!==!1&&le.push(`${ie} days`),s.statsAngle!==!1&&le.push(`∠ ${G.toFixed(1)}°`),s.statsDistance&&le.push(`Δ ${Math.abs(z).toFixed(5)}`),le.length===0){H.restore();return}const ee=Math.round(11*v);H.font=`${ee}px sans-serif`;const we=ee*1.6,j=8*v,ge=Math.max(...le.map(Ye=>H.measureText(Ye).width))+j*2,ae=le.length*we+j*2,pe=s.statsPosition??"right";let ue,oe;pe==="left"?(ue=I,oe=Q):pe==="center"?(ue=Math.round((I+N)/2),oe=Math.round((Q+J)/2)):(ue=N,oe=J);let fe,Qe;pe==="left"?(fe=ue-ge-10*m,Qe=oe-ae-4*v):pe==="center"?(fe=ue-ge/2,Qe=oe-ae-8*v):(fe=ue+10*m,Qe=oe-ae-4*v);const me=l.bitmapSize.width,xe=l.bitmapSize.height,Se=Math.min(Math.max(0,fe),me-ge-4*m),Me=Math.min(Math.max(4*v,Qe),xe-ae-4*v),$e=4*v;H.beginPath(),H.moveTo(Se+$e,Me),H.lineTo(Se+ge-$e,Me),H.quadraticCurveTo(Se+ge,Me,Se+ge,Me+$e),H.lineTo(Se+ge,Me+ae-$e),H.quadraticCurveTo(Se+ge,Me+ae,Se+ge-$e,Me+ae),H.lineTo(Se+$e,Me+ae),H.quadraticCurveTo(Se,Me+ae,Se,Me+ae-$e),H.lineTo(Se,Me+$e),H.quadraticCurveTo(Se,Me,Se+$e,Me),H.closePath(),H.fillStyle="rgba(30, 41, 59, 0.92)",H.fill(),H.strokeStyle=s.statsColor||s.color,H.lineWidth=1*v,H.stroke(),H.fillStyle="#e2e8f0",H.textAlign="left",le.forEach((Ye,Ie)=>{H.fillText(Ye,Se+j,Me+j+ee+Ie*we)}),H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cl{constructor(e,t,i,r={}){this.p1=e,this.p2=t,this.info=i,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,h=s._series;if(!c||!h)return;const m=l.horizontalPixelRatio,v=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),F=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),T=h.priceToCoordinate(s.p1.price),S=h.priceToCoordinate(s.p2.price);if(x==null||F==null||T==null||S==null)return;const I=Math.round(x*m),Q=Math.round(T*v),N=Math.round(F*m),J=Math.round(S*v),H=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(I,N),Math.min(Q,J),Math.abs(N-I),Math.abs(J-Q)),z.strokeStyle=H,z.lineWidth=1*v,z.setLineDash([]),z.strokeRect(Math.min(I,N),Math.min(Q,J),Math.abs(N-I),Math.abs(J-Q))),z.beginPath(),z.strokeStyle=H,z.lineWidth=2*v,z.moveTo(I,Q),z.lineTo(N,J),z.stroke(),z.fillStyle=H,z.beginPath(),z.arc(I,Q,3*v,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(N,J,3*v,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:re,pricePct:q,bars:ie,days:G}=s.info,ne=re>=0?"+":"",le=[];if(s.statsPriceRange&&le.push(ne+re.toFixed(5)+" ("+ne+q.toFixed(2)+"%)"),s.statsBarsRange&&le.push(ie+" bars"),s.statsDateRange&&le.push(G+" days"),le.length===0){z.restore();return}const ee=Math.round(11*v);z.font=ee+"px sans-serif";const we=ee*1.6,j=8*v,ge=Math.max(...le.map(Se=>z.measureText(Se).width))+j*2,ae=le.length*we+j*2,pe=l.bitmapSize.width,ue=l.bitmapSize.height;let oe,fe;if(s.statsPosition==="left")oe=I-ge-10*m,fe=Q-ae-4*v;else if(s.statsPosition==="center"){const Se=(I+N)/2,Me=(Q+J)/2;oe=Se-ge/2,fe=Me-ae-4*v}else oe=N+10*m,fe=J-ae-4*v;const Qe=Math.min(Math.max(0,oe),pe-ge-4*m),me=Math.min(Math.max(4*v,fe),ue-ae-4*v),xe=4*v;z.beginPath(),z.moveTo(Qe+xe,me),z.lineTo(Qe+ge-xe,me),z.quadraticCurveTo(Qe+ge,me,Qe+ge,me+xe),z.lineTo(Qe+ge,me+ae-xe),z.quadraticCurveTo(Qe+ge,me+ae,Qe+ge-xe,me+ae),z.lineTo(Qe+xe,me+ae),z.quadraticCurveTo(Qe,me+ae,Qe,me+ae-xe),z.lineTo(Qe,me+xe),z.quadraticCurveTo(Qe,me,Qe+xe,me),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||H,z.lineWidth=1*v,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",le.forEach((Se,Me)=>{z.fillText(Se,Qe+j,me+j+ee+Me*we)}),z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Bd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.fillColor=i.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.min(m,v)*c,S=Math.max(m,v)*c,I=Math.min(x,F)*h,Q=Math.max(x,F)*h,N=S-T,J=Q-I;if(N<.5||J<.5)return;const H=s.context;H.save(),H.fillStyle=r.fillColor,H.fillRect(T,I,N,J),H.strokeStyle=r.strokeColor,H.lineWidth=r.lineWidth*h,H.setLineDash([]),H.strokeRect(T,I,N,J),H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class yd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=v*h,I=x*c,Q=F*h,N=Math.hypot(I-T,Q-S);if(N<.5)return;const J=s.context;J.save(),J.strokeStyle=r.strokeColor,J.lineWidth=r.lineWidth*h,J.setLineDash([]),J.beginPath(),J.arc(T,S,N,0,Math.PI*2),J.stroke(),J.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Cd{constructor(e,t,i,r={}){this.p1=e,this.p2=t,this.p3=i,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,c=n._series;if(!l||!c)return;const h=o.horizontalPixelRatio,m=o.verticalPixelRatio,v=l.timeScale().timeToCoordinate(n.p1.rawTime),x=c.priceToCoordinate(n.p1.price),F=l.timeScale().timeToCoordinate(n.p2.rawTime),T=c.priceToCoordinate(n.p2.price),S=l.timeScale().timeToCoordinate(n.p3.rawTime),I=c.priceToCoordinate(n.p3.price);if(v==null||x==null||F==null||T==null||S==null||I==null)return;const Q=v*h,N=x*m,J=F*h,H=T*m,z=S*h,re=I*m,q=o.context;q.save(),q.beginPath(),q.moveTo(Q,N),q.lineTo(J,H),q.lineTo(z,re),q.closePath(),q.fillStyle=n.fillColor,q.fill(),q.strokeStyle=n.strokeColor,q.lineWidth=n.lineWidth*m,q.setLineDash([]),q.stroke(),q.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class vd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.minorRatio=i.minorRatio??.45,this.previewAsLine=i.previewAsLine??!1,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=v*h,I=x*c,Q=F*h,N=I-T,J=Q-S,H=Math.hypot(N,J);if(H<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*h,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(T,S),z.lineTo(I,Q),z.stroke();else{const re=(T+I)/2,q=(S+Q)/2,ie=Math.atan2(J,N),G=H/2,ne=Math.max(1,G*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(re,q,G,ne,ie,0,Math.PI*2),z.stroke()}z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hl{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#f59e0b",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight!==!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight??!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Td{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight!==!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class bd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft!==!1,this.rayRight=i.rayRight!==!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class xd{constructor(e,t,i="#22c55e",r=2){this.p1=e,this.p2=t,this.color=i,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const h=n._chart,m=n._series;if(!h||!m)return;const v=o.horizontalPixelRatio,x=o.verticalPixelRatio,F=h.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),T=h.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),S=m.priceToCoordinate(n.p1.price),I=m.priceToCoordinate(n.p2.price);if(F==null||T==null||S==null||I==null)return;const Q=F*v,N=S*x,J=T*v,H=I*x,[z,re,q,ie]=Q<=J?[Q,N,J,H]:[J,H,Q,N];let G=q-z,ne=ie-re;Math.abs(G)<1e-4&&(G=1e-4);const le=ne/G,ee=o.context;if(ee.save(),ee.strokeStyle=n.color,ee.fillStyle=n.color,ee.lineWidth=n.lineWidth*x,ee.setLineDash([]),n.rayLeft){const pe=re+le*(0-z);ee.beginPath(),ee.moveTo(0,pe),ee.lineTo(z,re),ee.stroke()}if(n.rayRight){const ae=o.bitmapSize.width,pe=ie+le*(ae-q);ee.beginPath(),ee.moveTo(q,ie),ee.lineTo(ae,pe),ee.stroke()}const we=Math.atan2(ne,G),j=(n.lineWidth*4+4)*x,ge=Math.PI/7;if(n.arrowRight){const ae=q-j*Math.cos(we-ge),pe=ie-j*Math.sin(we-ge),ue=q-j*Math.cos(we+ge),oe=ie-j*Math.sin(we+ge);ee.beginPath(),ee.moveTo(q,ie),ee.lineTo(ae,pe),ee.lineTo(ue,oe),ee.closePath(),ee.fill()}if(n.arrowLeft){const ae=we+Math.PI,pe=z-j*Math.cos(ae-ge),ue=re-j*Math.sin(ae-ge),oe=z-j*Math.cos(ae+ge),fe=re-j*Math.sin(ae+ge);ee.beginPath(),ee.moveTo(z,re),ee.lineTo(pe,ue),ee.lineTo(oe,fe),ee.closePath(),ee.fill()}if(c){const ae=n.p1.rawTime??n.p1.time,pe=n.p2.rawTime??n.p2.time,ue=n.p1.price,oe=n.p2.price,fe=[];if(n.statsPriceRange){const me=Math.abs(oe-ue),xe=ue!==0?Math.abs((oe-ue)/ue*100):0,Se=me<1e-4?6:me<.01?5:me<1?4:2;fe.push("↕ "+me.toFixed(Se)+" ("+xe.toFixed(2)+"%)")}const Qe=[];if(n.statsBarsRange)try{const me=h.timeScale().timeToCoordinate(ae),xe=h.timeScale().timeToCoordinate(pe);if(me!=null&&xe!=null){const Se=h.timeScale().coordinateToLogical(me),Me=h.timeScale().coordinateToLogical(xe);Se!=null&&Me!=null&&Qe.push("↔ "+Math.abs(Math.round(Me-Se))+" bars")}}catch{}if(n.statsDateRange){const me=Math.abs(pe-ae),xe=Math.floor(me/86400),Se=Math.floor(me%86400/3600),Me=Math.floor(me%3600/60);let $e=xe>0?xe+" day"+(xe!==1?"s":""):"";Se>0&&($e+=($e?" ":"")+Se+" hour"+(Se!==1?"s":"")),!xe&&!Se&&($e=Me+" min"+(Me!==1?"s":"")),n.statsBarsRange&&Qe.length>0?Qe[Qe.length-1]+=" ("+$e+")":Qe.push($e)}if(n.statsDistance){const me=(J-Q)/v,xe=(H-N)/x;Qe.push("distance: "+Math.sqrt(me*me+xe*xe).toFixed(2))}if(Qe.length>0&&fe.push(Qe.join(", ")),n.statsAngle){const me=G/v,xe=ne/x,Se=Math.atan2(xe,me)*180/Math.PI;fe.push("∠ "+Se.toFixed(0)+"°")}if(fe.length>0){const me=Math.min(v,x),xe=11*me,Se=xe*1.5,Me=5*me;ee.font=xe+"px sans-serif";const Ye=fe.reduce((dt,He)=>Math.max(dt,ee.measureText(He).width),0)+Me*2,Ie=fe.length*Se+Me*2;let We,De;n.statsPosition==="left"?(We=z,De=re):n.statsPosition==="center"?(We=(z+q)/2,De=(re+ie)/2):(We=q,De=ie);const Ze=We-Ye/2,nt=De-Ie-12*me;ee.fillStyle="rgba(20, 20, 30, 0.72)",ee.fillRect(Ze,nt,Ye,Ie),ee.strokeStyle=n.statsColor,ee.lineWidth=1*me,ee.strokeRect(Ze,nt,Ye,Ie),ee.fillStyle=n.statsColor,ee.textBaseline="top",ee.textAlign="left",fe.forEach((dt,He)=>{ee.fillText(dt,Ze+Me,nt+Me+He*Se)})}}ee.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Qd{constructor(e,t={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=s.timeScale().timeToCoordinate(i.center.rawTime),m=o.priceToCoordinate(i.center.price);if(h==null||m==null)return;const v=Math.round(h*l),x=Math.round(m*c),F=n.bitmapSize.width,T=n.bitmapSize.height,S=n.context;if(S.save(),S.strokeStyle=i.color,S.lineWidth=i.lineWidth*c,S.setLineDash([]),S.beginPath(),S.moveTo(0,x),S.lineTo(F,x),S.stroke(),S.beginPath(),S.moveTo(v,0),S.lineTo(v,T),S.stroke(),i.showPrice){const I=i.center.price.toFixed(5),Q=Math.round(11*c);S.font=Q+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="left";const N=S.measureText(I).width,J=Math.round(6*l),H=Math.round(3*c),z=Q+2*H,re=N+2*J,q=F-re-Math.round(2*l),ie=x-z/2;S.fillStyle=i.color,S.fillRect(q,ie,re,z),S.fillStyle="#ffffff",S.fillText(I,q+J,x)}if(i.showTime){const I=i.center.rawTime,Q=new Date(I*1e3),N=ee=>String(ee).padStart(2,"0"),J=N(Q.getUTCDate())+"."+N(Q.getUTCMonth()+1)+"."+Q.getUTCFullYear()+" "+N(Q.getUTCHours())+":"+N(Q.getUTCMinutes())+":"+N(Q.getUTCSeconds()),H=Math.round(11*c);S.font=H+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="center";const z=S.measureText(J).width,re=Math.round(6*l),q=Math.round(3*c),ie=H+2*q,G=z+2*re,ne=v-G/2,le=T-ie-Math.round(4*c);S.fillStyle=i.color,S.fillRect(ne,le,G,ie),S.fillStyle="#ffffff",S.fillText(J,v,le+ie/2)}S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Fd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight??!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsDistance=i.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=x*h,I=v*c,Q=F*h,N=T-I,J=S-Q,H=I-T,z=Q-S;if(Math.hypot(N,J)<1e-4)return;const q=Math.atan2(J,N),ie=Math.round(Math.abs(q*180/Math.PI)),G=s.context;G.save(),G.strokeStyle=r.color,G.fillStyle=r.color,G.lineWidth=r.lineWidth*h,G.setLineDash([]);const ne=Math.abs(H)<1e-4?0:z/H;if(r.rayLeft){const oe=S+ne*(0-T);G.beginPath(),G.moveTo(0,oe),G.lineTo(T,S),G.stroke()}if(r.rayRight){const ue=s.bitmapSize.width,oe=Q+ne*(ue-I);G.beginPath(),G.moveTo(I,Q),G.lineTo(ue,oe),G.stroke()}G.beginPath(),G.moveTo(T,S),G.lineTo(I,Q),G.stroke();const le=Math.atan2(z,H),ee=(r.lineWidth*4+4)*h,we=Math.PI/7;if(r.arrowRight){const ue=I-ee*Math.cos(le-we),oe=Q-ee*Math.sin(le-we),fe=I-ee*Math.cos(le+we),Qe=Q-ee*Math.sin(le+we);G.beginPath(),G.moveTo(I,Q),G.lineTo(ue,oe),G.lineTo(fe,Qe),G.closePath(),G.fill()}if(r.arrowLeft){const ue=le+Math.PI,oe=T-ee*Math.cos(ue-we),fe=S-ee*Math.sin(ue-we),Qe=T-ee*Math.cos(ue+we),me=S-ee*Math.sin(ue+we);G.beginPath(),G.moveTo(T,S),G.lineTo(oe,fe),G.lineTo(Qe,me),G.closePath(),G.fill()}const j=28*h;G.strokeStyle="rgba(122,166,174,0.55)",G.fillStyle=r.color,G.lineWidth=1*h,G.beginPath(),G.moveTo(I,Q),G.lineTo(I+j,Q),G.stroke(),G.beginPath(),G.strokeStyle="rgba(122,166,174,0.45)",G.arc(I,Q,j,0,q,q<0),G.stroke(),G.fillStyle="#4b7c86",G.font=`${Math.round(10*h)}px sans-serif`,G.textAlign="left",G.textBaseline="middle";const ge=I+(j+10*h)*Math.cos(q/2),ae=Q+(j+10*h)*Math.sin(q/2);if(G.fillText(`${ie}°`,ge,ae),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const ue=r.p1.price,oe=r.p2.price,fe=[];if(r.statsPriceRange){const me=Math.abs(oe-ue),xe=ue!==0?Math.abs((oe-ue)/ue*100):0,Se=me<1e-4?6:me<.01?5:me<1?4:2;fe.push("↕ "+me.toFixed(Se)+" ("+xe.toFixed(2)+"%)")}const Qe=[];if(r.statsDistance){const me=H/c,xe=z/h;Qe.push("distance: "+Math.sqrt(me*me+xe*xe).toFixed(2))}if(Qe.length>0&&fe.push(Qe.join(", ")),fe.length>0){const me=Math.min(c,h),xe=11*me,Se=xe*1.5,Me=5*me;G.font=xe+"px sans-serif";const Ye=fe.reduce((Te,ve)=>Math.max(Te,G.measureText(ve).width),0)+Me*2,Ie=fe.length*Se+Me*2,[We,De,Ze,nt]=T<=I?[T,S,I,Q]:[I,Q,T,S];let dt,He;r.statsPosition==="left"?(dt=We,He=De):r.statsPosition==="center"?(dt=(We+Ze)/2,He=(De+nt)/2):(dt=Ze,He=nt);const zt=dt-Ye/2,ye=He-Ie-12*me;G.fillStyle="rgba(20, 20, 30, 0.72)",G.fillRect(zt,ye,Ye,Ie),G.strokeStyle=r.statsColor,G.lineWidth=1*me,G.strokeRect(zt,ye,Ye,Ie),G.fillStyle=r.statsColor,G.textBaseline="top",G.textAlign="left",fe.forEach((Te,ve)=>{G.fillText(Te,zt+Me,ye+Me+ve*Se)})}}G.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ud{constructor(e,t,i){this.p1=e,this.p2=t,this.p3=i,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=s.context,v=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),F=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price),S=o.timeScale().timeToCoordinate(r.p3.rawTime),I=l.priceToCoordinate(r.p3.price);if(v==null||x==null||F==null||T==null||S==null||I==null)return;const Q=v*c,N=x*h,J=F*c,H=T*h,z=S*c,re=I*h,q=(J+z)/2,ie=(H+re)/2;let G=q-Q,ne=ie-N;Math.abs(G)<1e-4&&(G=1e-4);const le=ne/G,ee=s.bitmapSize.width,we=(J-z)/2,j=(H-re)/2,ge=me=>({x:q+we*me,y:ie+j*me}),ae=(me,xe)=>({x:ee,y:xe+le*(ee-me)}),pe=ge(1),ue=ge(-1),oe=ae(pe.x,pe.y),fe=ae(ue.x,ue.y);m.save(),m.beginPath(),m.moveTo(pe.x,pe.y),m.lineTo(oe.x,oe.y),m.lineTo(fe.x,fe.y),m.lineTo(ue.x,ue.y),m.closePath(),m.fillStyle="rgba(148, 163, 184, 0.2)",m.fill(),m.beginPath(),m.strokeStyle="rgba(148, 163, 184, 0.9)",m.lineWidth=1*h,m.moveTo(J,H),m.lineTo(z,re),m.stroke(),r._levels.forEach(me=>{const xe=ge(me.k),Se=ae(xe.x,xe.y);m.beginPath(),m.strokeStyle=me.color,m.lineWidth=me.width*h,m.moveTo(xe.x,xe.y),m.lineTo(Se.x,Se.y),m.stroke()});const Qe=ae(Q,N);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*h,m.moveTo(Q,N),m.lineTo(Qe.x,Qe.y),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Sd{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,m=s.timeScale().timeToCoordinate(i.p1.rawTime),v=o.priceToCoordinate(i.p1.price),x=s.timeScale().timeToCoordinate(i.p2.rawTime),F=o.priceToCoordinate(i.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*l,S=v*c,I=x*l,Q=F*c,N=n.bitmapSize.width,J=Math.abs(I-T)<1e-4?1:I-T,H=(Q-S)/J,z=I>=T?1:-1,re=z>0?N:0,q=T+z*Math.min(220*l,Math.max(80*l,N*.35)),ie=i._rays.map(ne=>{const le=H*ne.ratio;return{...ne,yEnd:S+le*(re-T),yLabel:S+le*(q-T)}});h.save();const G=(ne,le,ee)=>{!ne||!le||(h.beginPath(),h.moveTo(T,S),h.lineTo(re,ne.yEnd),h.lineTo(re,le.yEnd),h.closePath(),h.fillStyle=ee,h.fill())};G(ie[0],ie[3],"rgba(161, 98, 7, 0.10)"),G(ie[3],ie[4],"rgba(5, 150, 105, 0.10)"),G(ie[4],ie[5],"rgba(107, 114, 128, 0.12)"),ie.forEach(ne=>{h.beginPath(),h.strokeStyle=ne.color,h.lineWidth=1*c,h.moveTo(T,S),h.lineTo(re,ne.yEnd),h.stroke()}),h.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,h.textAlign=z>0?"left":"right",h.textBaseline="middle",ie.forEach(ne=>{h.fillStyle=ne.color;const le=q+(z>0?4*l:-4*l),ee=ne.yLabel;ee<-20||ee>n.bitmapSize.height+20||h.fillText(ne.label,le,ee)}),h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ed{constructor(e,t,i=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,i),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=s.context,v=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),F=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(v==null||x==null||F==null||T==null)return;const S=v*c,I=x*h,Q=F*c,N=T*h,J=Q-S,H=N-I,z=Math.hypot(J,H);if(z<1e-4)return;const re=J/z,q=H/z,ie=-q,G=re,ne=Q+ie*z,le=N+G*z,ee=S+ie*z,we=I+G*z,j=(ae,pe)=>({x:S+re*z*ae+ie*z*pe,y:I+q*z*ae+G*z*pe});m.save();const ge=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let ae=0;ae<r.divisions;ae++){const pe=ae/r.divisions,ue=(ae+1)/r.divisions,oe=j(0,pe),fe=j(1,pe),Qe=j(1,ue),me=j(0,ue);m.beginPath(),m.moveTo(oe.x,oe.y),m.lineTo(fe.x,fe.y),m.lineTo(Qe.x,Qe.y),m.lineTo(me.x,me.y),m.closePath(),m.fillStyle=ge[ae%ge.length],m.fill()}m.lineWidth=1*h,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let ae=0;ae<=r.divisions;ae++){const pe=ae/r.divisions,ue=j(0,pe),oe=j(1,pe),fe=j(pe,0),Qe=j(pe,1);m.beginPath(),m.moveTo(ue.x,ue.y),m.lineTo(oe.x,oe.y),m.stroke(),m.beginPath(),m.moveTo(fe.x,fe.y),m.lineTo(Qe.x,Qe.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*h,m.beginPath(),m.moveTo(S,I),m.lineTo(ne,le),m.stroke(),m.beginPath(),m.moveTo(Q,N),m.lineTo(ee,we),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*h,m.beginPath(),m.moveTo(S,I),m.lineTo(Q,N),m.lineTo(ne,le),m.lineTo(ee,we),m.closePath(),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ns{constructor(e,t,i,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:h=!0,showPrices:m=!0,pricesColor:v="#129f5c",rayLeft:x=!1,rayRight:F=!1,arrowLeft:T=!1,arrowRight:S=!1}=n;this.p1=e,this.p2=t,this.p3=i,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=h,this.showPrices=m,this.pricesColor=v,this.rayLeft=x,this.rayRight=F,this.arrowLeft=T,this.arrowRight=S,this.visible=!0,this._chart=null,this._series=null;const I=this;this._paneView={renderer(){return{draw(Q){Q.useBitmapCoordinateSpace(N=>{if(!I.visible)return;const J=I._chart,H=I._series;if(!J||!H)return;const z=N.horizontalPixelRatio,re=N.verticalPixelRatio,q=[I.p1,I.p3,I.p4,I.p2].map(Ie=>{const We=J.timeScale().timeToCoordinate(Ie.rawTime),De=H.priceToCoordinate(Ie.price);return We==null||De==null?null:{x:We*z,y:De*re}}).filter(Boolean);if(q.length!==4)return;const[ie,G,ne,le]=q,ee=N.context;ee.save();const we=G.x-ie.x,j=G.y-ie.y,ge=Math.sqrt(we*we+j*j)||1,ae=we/ge,pe=j/ge,ue=ne.x-le.x,oe=ne.y-le.y,fe=Math.sqrt(ue*ue+oe*oe)||1,Qe=ue/fe,me=oe/fe,xe=1e5,Se=I.rayLeft?{x:ie.x-ae*xe,y:ie.y-pe*xe}:ie,Me=I.rayRight?{x:G.x+ae*xe,y:G.y+pe*xe}:G,$e=I.rayLeft?{x:le.x-Qe*xe,y:le.y-me*xe}:le,Ye=I.rayRight?{x:ne.x+Qe*xe,y:ne.y+me*xe}:ne;if(I.showBackground){const Ie=I.fillColor||"#6aa84f",We=parseInt(Ie.slice(1,3),16),De=parseInt(Ie.slice(3,5),16),Ze=parseInt(Ie.slice(5,7),16);ee.beginPath(),ee.moveTo(ie.x,ie.y),ee.lineTo(G.x,G.y),ee.lineTo(ne.x,ne.y),ee.lineTo(le.x,le.y),ee.closePath(),ee.fillStyle=`rgba(${We},${De},${Ze},${I.fillOpacity??.1})`,ee.fill()}if(ee.strokeStyle=I.lineColor,ee.lineWidth=I.lineWidth*re,ee.setLineDash([]),ee.beginPath(),ee.moveTo(Se.x,Se.y),ee.lineTo(Me.x,Me.y),ee.moveTo($e.x,$e.y),ee.lineTo(Ye.x,Ye.y),ee.moveTo(ie.x,ie.y),ee.lineTo(le.x,le.y),ee.moveTo(G.x,G.y),ee.lineTo(ne.x,ne.y),ee.stroke(),I.arrowLeft||I.arrowRight){const Ie=8*re,We=(De,Ze,nt)=>{ee.save(),ee.translate(De,Ze),ee.rotate(nt),ee.beginPath(),ee.moveTo(0,0),ee.lineTo(-Ie,-Ie/2),ee.lineTo(-Ie,Ie/2),ee.closePath(),ee.fillStyle=I.lineColor,ee.fill(),ee.restore()};I.arrowLeft&&(We(Se.x,Se.y,Math.atan2(-pe,-ae)),We($e.x,$e.y,Math.atan2(-me,-Qe))),I.arrowRight&&(We(Me.x,Me.y,Math.atan2(pe,ae)),We(Ye.x,Ye.y,Math.atan2(me,Qe)))}if(ee.fillStyle="#ffffff",ee.strokeStyle="#3b82f6",ee.lineWidth=2*re,[ie,G,ne,le].forEach(Ie=>{ee.beginPath(),ee.arc(Ie.x,Ie.y,6*re,0,Math.PI*2),ee.fill(),ee.stroke()}),I.showPrices){const Ie=[I.p1,I.p3,I.p2,I.p4],We=[ie,G,le,ne];ee.fillStyle=I.pricesColor||I.lineColor,ee.font=`${Math.round(10*re)}px sans-serif`,ee.textAlign="left",ee.textBaseline="middle",We.forEach((De,Ze)=>{const nt=Ie[Ze]?.price;typeof nt=="number"&&ee.fillText(nt.toFixed(5),De.x+8*z,De.y)})}ee.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ul extends Ns{constructor(e,t,i,r,n={}){super(e,t,i,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class pl{constructor(e,t,i,r,n,s={}){this.p1=e,this.p2=t,this.b1=i,this.b2=r,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const h=o._chart,m=o._series;if(!h||!m)return;const v=c.horizontalPixelRatio,x=c.verticalPixelRatio,F=c.context,T=J=>{const H=h.timeScale().timeToCoordinate(J.rawTime),z=m.priceToCoordinate(J.price);return H==null||z==null?null:{x:H*v,y:z*x}},S=T(o.p1),I=T(o.p2),Q=T(o.b2),N=T(o.b1);!S||!I||!Q||!N||(F.save(),F.beginPath(),F.moveTo(S.x,S.y),F.lineTo(I.x,I.y),F.lineTo(Q.x,Q.y),F.lineTo(N.x,N.y),F.closePath(),F.fillStyle=o.fillColor,F.fill(),F.strokeStyle=o.strokeColor,F.lineWidth=o.lineWidth*x,F.setLineDash([]),F.beginPath(),F.moveTo(S.x,S.y),F.lineTo(I.x,I.y),F.stroke(),F.beginPath(),F.moveTo(N.x,N.y),F.lineTo(Q.x,Q.y),F.stroke(),F.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ks{constructor(e,t,i,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=i,this.top2=r,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(h=>{if(!l.visible)return;const m=l._chart,v=l._series;if(!m||!v)return;const x=h.horizontalPixelRatio,F=h.verticalPixelRatio,T=h.context,S=q=>{const ie=m.timeScale().timeToCoordinate(q.rawTime),G=v.priceToCoordinate(q.price);return ie==null||G==null?null:{x:ie*x,y:G*F}},I=S(l.mid1),Q=S(l.mid2),N=S(l.top1),J=S(l.top2),H=S(l.bot1),z=S(l.bot2);if(!I||!Q||!N||!J||!H||!z)return;T.save(),T.beginPath(),T.moveTo(I.x,I.y),T.lineTo(Q.x,Q.y),T.lineTo(J.x,J.y),T.lineTo(N.x,N.y),T.closePath(),T.fillStyle=l.upperFillColor,T.fill(),T.beginPath(),T.moveTo(H.x,H.y),T.lineTo(z.x,z.y),T.lineTo(Q.x,Q.y),T.lineTo(I.x,I.y),T.closePath(),T.fillStyle=l.lowerFillColor,T.fill();const re=(q,ie,G)=>{T.beginPath(),T.strokeStyle=G,T.lineWidth=l.lineWidth*F,T.setLineDash([]),T.moveTo(q.x,q.y),T.lineTo(ie.x,ie.y),T.stroke()};if(re(N,J,l.upperStrokeColor),re(I,Q,l.centerStrokeColor),re(H,z,l.lowerStrokeColor),l.showDeviationLabel){const q=Math.abs(l.top1.price-l.mid1.price),ie=Number.isFinite(q)?q.toFixed(5):null;if(ie){const G=Math.max(10,Math.round(10*F));T.fillStyle=l.labelColor,T.font=`${G}px sans-serif`,T.textAlign="left",T.textBaseline="top",T.fillText(ie,H.x+2*x,H.y+10*F)}}T.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class dl extends Ks{}class fl{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._levels=[{ratio:0,label:"0.000"},{ratio:.236,label:"0.236"},{ratio:.382,label:"0.382"},{ratio:.5,label:"0.500"},{ratio:.618,label:"0.618"},{ratio:.786,label:"0.786"},{ratio:1,label:"1.000"},{ratio:1.618,label:"1.618"},{ratio:2.618,label:"2.618"},{ratio:3.618,label:"3.618"},{ratio:4.236,label:"4.236"}],this._levelColors={0:"#ff0000",.236:"#ff0000",.382:"#00c853",.5:"#00c853",.618:"#00bcd4",.786:"#00bcd4",1:"#2962ff",1.618:"#2962ff",2.618:"#ff0000",3.618:"#ff0000",4.236:"#e040fb"},this._zoneFills=[{from:0,to:.236,color:"rgba(255, 0, 0, 0.06)"},{from:.236,to:.382,color:"rgba(0, 200, 83, 0.06)"},{from:.382,to:.5,color:"rgba(0, 200, 83, 0.06)"},{from:.5,to:.618,color:"rgba(0, 200, 83, 0.06)"},{from:.618,to:.786,color:"rgba(0, 188, 212, 0.06)"},{from:.786,to:1,color:"rgba(41, 98, 255, 0.08)"},{from:1,to:1.618,color:"rgba(255, 138, 128, 0.10)"},{from:1.618,to:2.618,color:"rgba(255, 138, 128, 0.10)"},{from:2.618,to:3.618,color:"rgba(224, 64, 251, 0.08)"},{from:3.618,to:4.236,color:"rgba(224, 64, 251, 0.08)"}];const i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,m=n.bitmapSize.width;n.bitmapSize.height;const v=i.p1.price,x=i.p2.price,F=v-x,T=q=>x+F*q,S=s.timeScale().timeToCoordinate(i.p1.rawTime),I=s.timeScale().timeToCoordinate(i.p2.rawTime),Q=o.priceToCoordinate(v),N=o.priceToCoordinate(x),J=S!=null&&I!=null?Math.round(Math.min(S,I)*l):0,H=S!=null&&I!=null?Math.round(Math.max(S,I)*l):m,z=H-J;h.save(),i._zoneFills.forEach(({from:q,to:ie,color:G})=>{const ne=T(q),le=T(ie),ee=o.priceToCoordinate(ne),we=o.priceToCoordinate(le);if(ee==null||we==null)return;const j=Math.round(ee*c),ge=Math.round(we*c);h.fillStyle=G,h.fillRect(J,Math.min(j,ge),z,Math.abs(ge-j))}),i._levels.forEach(({ratio:q,label:ie})=>{const G=T(q),ne=o.priceToCoordinate(G);if(ne==null)return;const le=Math.round(ne*c),ee=i._levelColors[q]||"#888888";h.beginPath(),h.strokeStyle=ee,h.lineWidth=q===0||q===1?1.5*c:1*c,q!==0&&q!==1&&q<1?h.setLineDash([4*l,4*l]):h.setLineDash([]),h.moveTo(J,le),h.lineTo(H,le),h.stroke(),h.setLineDash([])});const re=Math.round(11*c);if(h.font=`${re}px sans-serif`,h.textAlign="left",i._levels.forEach(({ratio:q,label:ie})=>{const G=T(q),ne=o.priceToCoordinate(G);if(ne==null)return;const le=Math.round(ne*c),ee=i._levelColors[q]||"#888888",we=`${ie} (${G.toFixed(5)})`;h.fillStyle=ee,h.textAlign="right",h.fillText(we,J-4*l,le-4*c)}),S!=null&&I!=null&&Q!=null&&N!=null){const q=Math.round(S*l),ie=Math.round(Q*c),G=Math.round(I*l),ne=Math.round(N*c);h.beginPath(),h.strokeStyle="rgba(128, 128, 128, 0.6)",h.lineWidth=1*c,h.setLineDash([]),h.moveTo(q,ie),h.lineTo(G,ne),h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(q,ie,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(G,ne,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke()}h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ld{constructor(e,t="#3b82f6",i=2,r=!0){this.time=e,this.color=t,this.lineWidth=i,this.showDate=r,this.showDot=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const h=Math.round(c*o.horizontalPixelRatio),m=o.bitmapSize.height,v=o.context;v.save(),v.beginPath(),v.strokeStyle=n.color,v.lineWidth=n.lineWidth*o.horizontalPixelRatio,v.setLineDash([]),v.moveTo(h,0),v.lineTo(h,m),v.stroke();const x=Math.round(m/2);if(n.midYCss=x/o.verticalPixelRatio,n.showDot){v.beginPath(),v.strokeStyle=n.color,v.lineWidth=1.5*o.horizontalPixelRatio;const F=5*o.horizontalPixelRatio;v.arc(h,x,F,0,Math.PI*2),v.stroke()}if(n.showDate!==!1){const F=n.time,T=new Date(typeof F=="number"?F*1e3:F),S=G=>String(G).padStart(2,"0"),I=`${S(T.getUTCDate())}.${S(T.getUTCMonth()+1)}.${T.getUTCFullYear()} ${S(T.getUTCHours())}:${S(T.getUTCMinutes())}:${S(T.getUTCSeconds())}`,Q=Math.round(11*o.verticalPixelRatio);v.font=`${Q}px ui-sans-serif, system-ui, sans-serif`,v.textBaseline="middle",v.textAlign="center";const N=v.measureText(I).width,J=Math.round(6*o.horizontalPixelRatio),H=Math.round(3*o.verticalPixelRatio),z=Q+2*H,re=N+2*J,q=h-re/2,ie=m-z-Math.round(4*o.verticalPixelRatio);v.fillStyle=n.color,v.fillRect(q,ie,re,z),v.fillStyle="#ffffff",v.fillText(I,h,ie+z/2)}v.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Md(A,e){const t=typeof A=="string"?A.trim():"",i=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(i))return`rgba(95, 143, 150, ${e})`;const r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),s=parseInt(i.slice(4,6),16);return`rgba(${r}, ${n}, ${s}, ${e})`}function XT(A,e,t){const i=`${A??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let h=c;for(;h.length>s;){let m=h.lastIndexOf(" ",s);m<=0&&(m=s),o.push(h.slice(0,m)),h=h.slice(m).trimStart()}o.push(h)};return i.split(`
11
11
  `).forEach(l),o.length===0&&o.push(""),o}function Hd(A,e,t){const i=A?.primitive??{},r=Number(i.fontSize)||12,n=!!i.textWrap,s=XT(i.text??A?.text??"Text",r,n),o=s.reduce((F,T)=>Math.max(F,T.length),1),c=Math.max(20,o*r*.58)+16,h=r*1.2,m=s.length*h+10,v=e-c/2,x=t-m;return{left:v,right:v+c,top:x,bottom:x+m+12}}class Id{constructor(e,t,i={}){this.rawTime=e,this.price=t,this.text=i.text??"Text",this.color=i.color??"#5f8f96",this.fontSize=i.fontSize??12,this.fontWeight=i.fontWeight??"normal",this.fontStyle=i.fontStyle??"normal",this.textAlign=i.textAlign??"center",this.textWrap=i.textWrap??!1,this.borderEnabled=i.borderEnabled??!1,this.borderColor=i.borderColor??"#5f8f96",this.borderOpacity=i.borderOpacity??.1,this.borderWidth=i.borderWidth??1,this.bgEnabled=i.bgEnabled??!1,this.bgColor=i.bgColor??"#5f8f96",this.bgOpacity=i.bgOpacity??.1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=o.timeScale().timeToCoordinate(r.rawTime),h=l.priceToCoordinate(r.price);if(c==null||h==null)return;const m=s.horizontalPixelRatio,v=s.verticalPixelRatio,x=Math.round(c*m),F=Math.round(h*v),T=s.context;T.save();const S=Math.round(r.fontSize*v);T.font=`${r.fontStyle} ${r.fontWeight} ${S}px sans-serif`;const I=`${r.text??""}`,Q=220*m,N=[],J=pe=>{if(!r.textWrap||pe.length===0){N.push(pe);return}const ue=pe.split(/\s+/);let oe="";for(const fe of ue){const Qe=oe?`${oe} ${fe}`:fe;T.measureText(Qe).width<=Q||!oe?oe=Qe:(N.push(oe),oe=fe)}N.push(oe)};I.split(`
12
- `).forEach(J),N.length===0&&N.push("");const H=N.map(pe=>T.measureText(pe).width),z=Math.max(...H,20*m),re=8*m,q=5*v,ie=z+re*2,G=S*1.2,ne=G*N.length+q*2,le=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",ee=x-ie/2,we=F-ne;r.bgEnabled&&(T.fillStyle=Md(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),T.beginPath(),T.rect(ee,we,ie,ne),T.fill()),r.borderEnabled&&(T.strokeStyle=Md(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),T.lineWidth=Math.max(.5,(r.borderWidth??1)*v),T.beginPath(),T.rect(ee,we,ie,ne),T.stroke()),T.fillStyle=r.color,T.textAlign=le,T.textBaseline="middle";const j=le==="left"?ee+re:le==="right"?ee+ie-re:ee+ie/2;for(let pe=0;pe<N.length;pe++)T.fillText(N[pe],j,we+q+G*(pe+.5));const ge=5*v,ae=F+10*v;T.beginPath(),T.strokeStyle="#3b82f6",T.lineWidth=1.5*v,T.arc(x,ae,ge,0,Math.PI*2),T.stroke(),T.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const JT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Pd(A){return A?JT[A]??7:7}function ZT(A,e){const t=String(A||"").toUpperCase(),i=e||Pd(A),r={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[t]||96,n=Math.ceil(i*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const DA=A=>{if(!Array.isArray(A)||A.length===0)return[];const e=A.map(i=>({...i,time:te(i.time)})).filter(i=>i.time!=null);e.sort((i,r)=>i.time-r.time);const t=new Map;for(const i of e)t.set(i.time,i);return Array.from(t.values()).sort((i,r)=>i.time-r.time)},YT=300,Dd=24,qT=150,_d=150;function gl(A,e,t=YT){if(!Array.isArray(A)||A.length===0)return[];const i=BA(e),r=Number.isFinite(i)&&i>0?i:60;let n=null;for(const o of A){const l=te(o?.time);l!=null&&(n==null||l>n)&&(n=l)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+r*o});return s}function jT(A){if(!Array.isArray(A)||A.length===0)return null;let e=null;for(const t of A){const i=te(t?.time);i!=null&&(e==null||i>e)&&(e=i)}return e}function eb(A,e){let t=0,i=A.length;for(;t<i;){const r=t+i>>1;A[r]<e?t=r+1:i=r}return t}function zs(A,e,t,i){const r=te(e),n=te(t),s=BA(i)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(A)||A.length===0)return l;if(r==null||n==null)return 1;const c=v=>{const x=eb(A,v);if(x<=0)return 0;if(x>=A.length)return A.length-1;const F=A[x-1],T=A[x];return Math.abs(v-F)<=Math.abs(T-v)?x-1:x},h=c(r),m=c(n);return Math.max(1,Math.abs(m-h)+1)}function kd(A,e,t){if(!A)return!1;const i=A.timeScale();if(!i)return!1;const r=jT(e);if(r==null)return!1;const n=i.timeToCoordinate(r);if(Number.isFinite(n)){const c=i.coordinateToLogical(n);if(Number.isFinite(c)){const h=i.getVisibleLogicalRange(),m=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,v=Number.isFinite(m)&&m>20?m:120,x=Math.min(_d,v/2),F=Math.max(20,v-x),T={from:c-F,to:c+x};try{return i.setVisibleLogicalRange(T),!0}catch{}}}const s=BA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-qT*o,to:r+_d*o};try{return i.setVisibleRange(l),!0}catch{return!1}}function ut(A,e,t,i,r,n){const s=r-t,o=n-i,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(A-t,e-i);let c=((A-t)*s+(e-i)*o)/(l*l);c=Math.max(0,Math.min(1,c));const h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function tb(A,e,t,i,r,n){const s=r-t,o=n-i,l=s*s+o*o;if(l===0)return Math.hypot(A-t,e-i);let c=((A-t)*s+(e-i)*o)/l;c<0&&(c=0);const h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function Ab(A,e,t,i,r,n){const s=r-t,o=n-i,l=s*s+o*o;if(l===0)return Math.hypot(A-t,e-i);const c=((A-t)*s+(e-i)*o)/l,h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function vi(A,e,t){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const s=t[r].x,o=t[r].y,l=t[n].x,c=t[n].y;o>e!=c>e&&A<(l-s)*(e-o)/(c-o)+s&&(i=!i)}return i}function Od(A,e,t){if(!A||!e||!t)return null;const i=(A.normalizedTime+e.normalizedTime)/2,r=(A.price+e.price)/2,n=t.price-r,s={rawTime:A.rawTime,normalizedTime:A.normalizedTime,price:A.price+n},o={rawTime:e.rawTime,normalizedTime:e.normalizedTime,price:e.price+n},l={rawTime:t.rawTime??te(i),normalizedTime:te(i),price:r+n};return{b1:s,b2:o,bottomMid:l}}function Jr(A,e,t,i=1){if(!A||!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=A.filter(re=>{const q=te(re.time);return q!=null&&q>=s&&q<=o});if(l.length<2)return null;const c=l.length;let h=0,m=0,v=0,x=0;l.forEach((re,q)=>{h+=q,m+=re.close,v+=q*re.close,x+=q*q});const F=(c*v-h*m)/(c*x-h*h),T=(m-F*h)/c;let S=0;l.forEach((re,q)=>{const ie=T+F*q;S+=(re.close-ie)**2});const I=Math.sqrt(S/c),Q=I*i,N=T,J=T+F*(c-1),H=l[0].time,z=l[c-1].time;return{p1:{rawTime:H,normalizedTime:te(H),price:N},p2:{rawTime:z,normalizedTime:te(z),price:J},top1:{rawTime:H,normalizedTime:te(H),price:N+Q},top2:{rawTime:z,normalizedTime:te(z),price:J+Q},bot1:{rawTime:H,normalizedTime:te(H),price:N-Q},bot2:{rawTime:z,normalizedTime:te(z),price:J-Q},slope:F,intercept:T,stdDev:I,offset:Q,barCount:c}}function Zr(A,e,t,i=1){if(!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=(A||[]).filter(S=>{const I=te(S.time);return I!=null&&I>=s&&I<=o});if(l.length<2)return null;const c=e.rawTime,h=t.rawTime,m=l.length,v=(t.price-e.price)/(m-1||1);let x=0;l.forEach((S,I)=>{const Q=e.price+v*I;x+=(S.close-Q)**2});const F=Math.sqrt(x/m),T=F*i;return{p1:{rawTime:c,normalizedTime:r,price:e.price},p2:{rawTime:h,normalizedTime:n,price:t.price},top1:{rawTime:c,normalizedTime:r,price:e.price+T},top2:{rawTime:h,normalizedTime:n,price:t.price+T},bot1:{rawTime:c,normalizedTime:r,price:e.price-T},bot2:{rawTime:h,normalizedTime:n,price:t.price-T},slope:v,stdDev:F,offset:T,barCount:m}}const ib={trendline:{requiredKeys:["point1","point2"],handleCount:2},gannline:{requiredKeys:["point1","point2"],handleCount:3},rectangle:{requiredKeys:["p1","p2"],handleCount:8},circle:{requiredKeys:["p1","p2"],handleCount:2},triangle:{requiredKeys:["p1","p2","p3"],handleCount:3},ellipse:{requiredKeys:["p1","p2"],handleCount:4},infoline:{requiredKeys:["p1","p2"],handleCount:2},arrowedline:{requiredKeys:["p1","p2"],handleCount:2},rayline:{requiredKeys:["p1","p2"],handleCount:2},extendedline:{requiredKeys:["p1","p2"],handleCount:2},crossline:{requiredKeys:["p"],handleCount:1},trendbyangle:{requiredKeys:["p1","p2"],handleCount:2},equidistantchannel:{requiredKeys:["p1","p2","p3"],handleCount:3},regressionchannel:{requiredKeys:["p1","p2"],handleCount:2},stddevchannel:{requiredKeys:["p1","p2"],handleCount:2},gannfan:{requiredKeys:["p1","p2"],handleCount:2},ganngrid:{requiredKeys:["p1","p2"],handleCount:2},andrewspitchfork:{requiredKeys:["p1","p2","p3"],handleCount:3},disjointchannel:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},flattopbottom:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},rulerline:{requiredKeys:["p1","p2"],handleCount:3},horizontalray:{requiredKeys:["primitive"],handleCount:1},verticalline:{requiredKeys:["primitive"],handleCount:1},pricelevel:{requiredKeys:["priceLine"],handleCount:1}},rb={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",infoline:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6",pricelevel:"#3b82f6"};function nb(A,e){if(!A||!A.type)return!1;const t=ib[A.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(i=>!!A[i])}function sb(A){return A?rb[A]??"#22c55e":"#22c55e"}function ml(A,e){if(A.length<e)return[];const t=2/(e+1);let i=A.slice(0,e).reduce((n,s)=>n+s.close,0)/e;const r=[{time:A[e-1].time,value:i}];for(let n=e;n<A.length;n++)i=A[n].close*t+i*(1-t),r.push({time:A[n].time,value:i});return r}function Vs(A,e){if(A.length<e)return null;const t=A[A.length-1],i=A.slice(-e).reduce((r,n)=>r+n.close,0)/e;return{time:t.time,value:i}}function Nd(A,e){const t=ml(A,e);return t.length?t[t.length-1]:null}function Kd(A,e){if(A.length<e+1)return null;let t=0,i=0;for(let s=1;s<=e;s++){const o=A[s].close-A[s-1].close;o>0?t+=o:i-=o}t/=e,i/=e;for(let s=e+1;s<A.length;s++){const o=A[s].close-A[s-1].close;t=(t*(e-1)+Math.max(o,0))/e,i=(i*(e-1)+Math.max(-o,0))/e}const r=A[A.length-1],n=i===0?100:100-100/(1+t/i);return{time:r.time,value:n}}function zd(A,e=12,t=26,i=9){if(A.length<t+i)return null;const r=ml(A,e),n=ml(A,t);if(!r.length||!n.length)return null;const s=n.map((h,m)=>{const v=r[r.length-n.length+m];return{time:h.time,value:v.value-h.value}});if(s.length<i)return null;const o=2/(i+1);let l=s.slice(0,i).reduce((h,m)=>h+m.value,0)/i;for(let h=i;h<s.length;h++)l=s[h].value*o+l*(1-o);const c=s[s.length-1];return{time:c.time,value:c.value,signal:l,histogram:c.value-l}}const ob={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ab=Y.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:i=!0,onBuyClick:r,onSellClick:n},s){const o=Y.useRef(null),l=Y.useRef(null),c=Y.useRef(null),h=Y.useRef(null),m=Y.useRef(null),v=Y.useRef(null),x=Y.useRef([]),F=Y.useRef(null),T=Y.useRef(!1),S=Y.useRef(null),I=Y.useRef(null),Q=Y.useRef(null),N=Y.useRef(null),J=Y.useRef([]),[H,z]=Y.useState(null),[re,q]=Y.useState(null),[ie,G]=Y.useState([]),[ne,le]=Y.useState(null);Y.useRef(null);const[ee,we]=Y.useState([]),j=Y.useRef(null),ge=Y.useRef({tp:null,sl:null,entry:null}),ae=Y.useRef(null),pe=Y.useRef(0),ue=Y.useRef(0),oe=Y.useRef(null),fe=Y.useRef(null),Qe=Y.useRef(!1),me=Y.useRef(!1);Y.useEffect(()=>{fe.current=H;let d=!1;x.current.forEach(u=>{if(u.type==="trendline"&&u.decoration){const O=u===H;u.decoration.isSelected!==O&&(u.decoration.isSelected=O,d=!0)}}),d&&c.current?.applyOptions({})},[H]);const xe=Y.useRef(new Map),Se=Y.useRef(null),Me=Y.useRef(null),$e=(d,u)=>`${d}_${u}`,Ye=()=>{const d=$e(ye,Te);return xe.current.get(d)||null},Ie=d=>{if(!d)return;const u=$e(ye,Te);xe.current.set(u,d)},{activeTool:We,setActiveTool:De,showGrid:Ze,snapToGrid:nt,chartObjects:dt,setChartObjects:He,orders:zt,selectedSymbol:ye,selectedTimeframe:Te,drawingsVisible:ve,chartType:be,chartLocked:Le,theme:Ee,candleColors:Ke,showTradeOrders:wt,showTradePosition:Dt,showTradeHistory:ni,showSLTP:ZA,showAskPrice:aA,showChartControls:si,showCrosshair:_A,showOHLC:YA,currentSymbolData:Zt,baseUrl:Yt,endpoints:Qt,endpointParams:Lt,indicators:Ct,indicatorSettings:Ut,selectedTradeForModify:Vt,setSelectedTradeForModify:je}=$t(),_e=Y.useRef({}),[Je,et]=Y.useState({}),bt=Y.useRef(0),ze=Y.useRef(Ct),Ve=Y.useRef(Ut);ze.current=Ct,Ve.current=Ut;const At=Y.useRef([]),[st,Ge]=Y.useState(!1),[ft,at]=Y.useState(null),[Ne,Wt]=Y.useState([]),[lA,Gs]=Y.useState(!0),[yl,Jd]=Y.useState(null),[Lb,dx]=Y.useState(0),Rs=Y.useMemo(()=>{const d=Ne.map(u=>te(u?.time)).filter(u=>Number.isFinite(u));return d.sort((u,O)=>u-O),d},[Ne]),$s=Y.useRef(null),oi=Y.useRef(new Map);Y.useRef(null);const Zd=Y.useRef(0),kA=Y.useRef(null),nr=Y.useRef(!1),tn=Y.useRef(!1);Y.useEffect(()=>{const d=m.current;d&&d.setData(gl(Ne,Te))},[Ne,Te]),Y.useImperativeHandle(s,()=>({zoomIn:()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*.8;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},zoomOut:()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*1.25;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const d=o.current;if(!d){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const u=Ee==="light"?"#ffffff":"#12161d",O=`chart-${ye}-${Te}-${Date.now()}.png`;NT(d,{useCORS:!0,allowTaint:!0,backgroundColor:u,scale:2,logging:!1}).then(ce=>{const y=document.createElement("a");y.download=O,y.href=ce.toDataURL("image/png"),y.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(ce=>{console.error("Chart screenshot failed",ce),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,Te,Ee]);const Cl=Y.useMemo(()=>Ne.length===0?[]:be==="line"||be==="area"?Ne.map(d=>({time:d.time,value:d.close})):Ne,[Ne,be]),Mb=d=>{r?r(d):(at("BUY"),Ge(!0))},Hb=d=>{n?n(d):(at("SELL"),Ge(!0))},Ib=()=>{Ge(!1),at(null)},Pb=d=>{const u=re;if(!u||!d)return;const O=(R,V)=>{if(typeof R!="string")return V;const X=R.trim(),se=X.startsWith("#")?X:`#${X}`;return/^#[0-9A-Fa-f]{6}$/.test(se)?se.toLowerCase():V},ce=(R,V)=>{const X=Number(R);return Number.isFinite(X)?Math.max(0,Math.min(1,X)):V};let y={...u,visibleTimeframes:Array.isArray(d.visibleTimeframes)?[...d.visibleTimeframes]:u.visibleTimeframes};if(u.type==="text"){const R=Number.isFinite(Number(d.price))?Number(d.price):u.price,V=u.primitive;V&&(V.text=typeof d.text=="string"?d.text:V.text,V.color=O(d.color,V.color??"#5f8f96"),V.fontSize=Number.isFinite(Number(d.fontSize))?Number(d.fontSize):V.fontSize,V.fontWeight=d.fontWeight==="bold"?"bold":"normal",V.fontStyle=d.fontStyle==="italic"?"italic":"normal",V.textAlign=["left","center","right"].includes(d.textAlign)?d.textAlign:V.textAlign,V.textWrap=!!d.textWrap,V.borderEnabled=!!d.borderEnabled,V.borderColor=O(d.borderColor,V.borderColor??"#5f8f96"),V.borderOpacity=ce(d.borderOpacity,V.borderOpacity??.1),V.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(d.borderWidth))?Number(d.borderWidth):1)),V.bgEnabled=!!d.bgEnabled,V.bgColor=O(d.bgColor,V.bgColor??"#5f8f96"),V.bgOpacity=ce(d.bgOpacity,V.bgOpacity??.1),V.price=R),y={...y,price:R,text:typeof d.text=="string"?d.text:u.text}}if(u.type==="trendline"){const R=O(d.lineColor,"#22c55e"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2));if(u.series)try{u.series.applyOptions({color:R,lineWidth:V})}catch{}const X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.point1?.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.point2?.price;if(u.series&&u.point1&&u.point2){const $=u.point1.time??u.point1.rawTime,C=u.point2.time??u.point2.rawTime;try{const B=DA([{time:$,value:X},{time:C,value:se}]);B.length>0&&u.series.setData(B)}catch{}}const E={...u.point1,price:X},D={...u.point2,price:se};u.decoration&&(u.decoration.color=R,u.decoration.lineWidth=V,u.decoration.arrowLeft=!!d.arrowLeft,u.decoration.arrowRight=!!d.arrowRight,u.decoration.rayLeft=!!d.rayLeft,u.decoration.rayRight=!!d.rayRight,u.decoration.statsColor=O(d.statsColor,"#5f8f96"),u.decoration.statsPosition=d.statsPosition??"right",u.decoration.statsShowAlways=!!d.statsShowAlways,u.decoration.statsPriceRange=!!d.statsPriceRange,u.decoration.statsBarsRange=!!d.statsBarsRange,u.decoration.statsDateRange=!!d.statsDateRange,u.decoration.statsAngle=!!d.statsAngle,u.decoration.statsDistance=!!d.statsDistance,u.decoration.p1=E,u.decoration.p2=D),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsShowAlways:!!d.statsShowAlways,statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,point1:E,point2:D,decoration:u.decoration}}if(u.type==="pricelevel"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showPrice!==!1,se=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",D=O(d.textColor,"#ffffff"),$=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",B=Number.isFinite(Number(d.price))?Number(d.price):u.price;if(u.priceLine)try{u.priceLine.applyOptions({price:B,color:R,lineWidth:V,axisLabelVisible:X,title:X&&typeof B=="number"?B.toFixed(5):""})}catch{}const f=h.current;if(se&&E&&f)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=D,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B;else{const L=new md(B,{text:E,textColor:D,hAlign:$,vAlign:C});try{f.attachPrimitive(L)}catch{}u.textPrimitive=L}else if(u.textPrimitive&&f){try{f.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:R,lineWidth:V,showPrice:X,showText:se,textContent:E,textColor:D,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="horizontalray"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showPrice!==!1,se=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",D=O(d.textColor,"#ffffff"),$=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",B=Number.isFinite(Number(d.price))?Number(d.price):u.price,f=u.primitive;if(f&&(f.price=B,f.color=R,f.lineWidth=V),u.priceLine)try{u.priceLine.applyOptions({price:B,color:R,axisLabelVisible:X,title:X&&typeof B=="number"?B.toFixed(5):""})}catch{}const L=h.current;if(se&&E&&L)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=D,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B,u.textPrimitive.originTime=u.rawOriginTime;else{const w=new md(B,{text:E,textColor:D,hAlign:$,vAlign:C,originTime:u.rawOriginTime});try{L.attachPrimitive(w)}catch{}u.textPrimitive=w}else if(u.textPrimitive&&L){try{L.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:R,lineWidth:V,showPrice:X,showText:se,textContent:E,textColor:D,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="verticalline"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showDate!==!1,se=u.primitive;se&&(se.color=R,se.lineWidth=V,se.showDate=X),y={...y,lineColor:R,lineWidth:V,showDate:X}}if(u.type==="infoline"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.statsShowAlways!==!1,se=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",D=!!d.statsPriceRange,$=!!d.statsBarsRange,C=!!d.statsDateRange,B=!!d.statsAngle,f=!!d.statsDistance,L=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,w=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,p=u.p1.rawTime,_=u.p2.rawTime,P=w-L,U=L!==0?P/Math.abs(L)*100:0,b=u.p1.normalizedTime??0,g=u.p2.normalizedTime??0,M=BA(Te)||3600,k=Math.abs(g-b),K=Math.max(1,Math.round(k/M)),W=Math.max(1,Math.round(k/86400)),Z=c.current,Ae=h.current,he=Z?Z.timeScale().timeToCoordinate(p):null,Be=Ae?Ae.priceToCoordinate(L):null,Ce=Z?Z.timeScale().timeToCoordinate(_):null,Ue=Ae?Ae.priceToCoordinate(w):null,qe=he!=null&&Be!=null&&Ce!=null&&Ue!=null?Math.atan2(-(Ue-Be),Ce-he)*(180/Math.PI):u.primitive?.info?.angle??0,rt={priceDiff:P,pricePct:U,bars:K,days:W,angle:qe},Xe=u.primitive;Xe&&(Xe.color=R,Xe.lineWidth=V,Xe.statsShowAlways=X,Xe.statsColor=se,Xe.statsPosition=E,Xe.statsPriceRange=D,Xe.statsBarsRange=$,Xe.statsDateRange=C,Xe.statsAngle=B,Xe.statsDistance=f,Xe.p1={...u.p1,price:L},Xe.p2={...u.p2,price:w},Xe.info=rt),y={...y,lineColor:R,lineWidth:V,statsShowAlways:X,statsColor:se,statsPosition:E,statsPriceRange:D,statsBarsRange:$,statsDateRange:C,statsAngle:B,statsDistance:f,p1:{...u.p1,price:L},p2:{...u.p2,price:w}}}if(u.type==="rulerline"){const R=O(d.lineColor,"#3b82f6"),V=d.showArea!==!1,X=!!d.statsShowAlways,se=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",D=!!d.statsPriceRange,$=!!d.statsBarsRange,C=!!d.statsDateRange,B=u.primitive;B&&(B.lineColor=R,B.showArea=V,B.statsShowAlways=X,B.statsColor=se,B.statsPosition=E,B.statsPriceRange=D,B.statsBarsRange=$,B.statsDateRange=C),y={...y,lineColor:R,showArea:V,statsShowAlways:X,statsColor:se,statsPosition:E,statsPriceRange:D,statsBarsRange:$,statsDateRange:C}}if(u.type==="arrowedline"){const R=O(d.lineColor,"#f59e0b"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="rayline"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="extendedline"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="crossline"){const R=O(d.lineColor,"#06a0e3"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.price))?Number(d.price):u.p.price,se=u.primitive;se&&(se.color=R,se.lineWidth=V,se.showTime=!!d.showTime,se.showPrice=!!d.showPrice,se.center={...u.p,price:X}),y={...y,lineColor:R,lineWidth:V,showTime:!!d.showTime,showPrice:!!d.showPrice,p:{...u.p,price:X}}}if(u.type==="trendbyangle"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="disjointchannel"){const R=O(d.lineColor,"#129f5c"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=O(d.fillColor,"#6aa84f"),se=ce(d.fillOpacity,.1),E=O(d.pricesColor,"#129f5c"),D=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,$=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=R,B.lineWidth=V,B.fillColor=X,B.fillOpacity=se,B.showBackground=!!d.showBackground,B.showPrices=!!d.showPrices,B.pricesColor=E,B.rayLeft=!!d.rayLeft,B.rayRight=!!d.rayRight,B.arrowLeft=!!d.arrowLeft,B.arrowRight=!!d.arrowRight,B.p1={...u.p1,price:D},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:R,lineWidth:V,fillColor:X,fillOpacity:se,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...u.p1,price:D},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}if(u.type==="flattopbottom"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=O(d.fillColor,"#3b82f6"),se=ce(d.fillOpacity,.12),E=O(d.pricesColor,"#3b82f6"),D=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,$=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=R,B.lineWidth=V,B.fillColor=X,B.fillOpacity=se,B.showBackground=!!d.showBackground,B.showPrices=!!d.showPrices,B.pricesColor=E,B.rayLeft=!!d.rayLeft,B.rayRight=!!d.rayRight,B.arrowLeft=!!d.arrowLeft,B.arrowRight=!!d.arrowRight,B.p1={...u.p1,price:D},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:R,lineWidth:V,fillColor:X,fillOpacity:se,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...u.p1,price:D},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}He(R=>{const V=R.map(X=>X===u?y:X);return x.current=V,V}),fe.current===u&&(fe.current=y),z(R=>R===u?y:R),le(R=>R===u?y:R),q(y);try{c.current?.applyOptions({})}catch{}};Y.useEffect(()=>{const d=o.current;if(!d)return;const u=d.getBoundingClientRect(),O=w=>{const p=Math.abs(Number(w));return Number.isFinite(p)?p>=1e3?p.toFixed(2):p.toFixed(5):"0"},ce=Ee==="light",y=R0(d,{width:u.width||d.clientWidth,height:u.height||d.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:ce?"#FFFFFF":"#0d1117",type:"solid"},textColor:ce?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ze,color:Ze?ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0},horzLines:{visible:Ze,color:Ze?ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0}},rightPriceScale:{borderColor:ce?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:ce?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:ce?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:0,vertLine:{width:1,color:ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ce?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ce?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:We===1,horzLineVisible:We===1},handleScroll:{mouseWheel:!0,pressedMouseMove:We===null||We===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),R=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),V=R.includes("JPY"),X=rn(R),se=An(R);let E,D;V?(E=.001,D=w=>Math.abs(Number(w)).toFixed(3)):X?R.startsWith("BTC")||R.startsWith("ETH")?(E=.01,D=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,D=w=>Math.abs(Number(w)).toFixed(4)):se&&(R.startsWith("XAU")||R.startsWith("XAG"))?(E=.01,D=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,D=w=>Math.abs(Number(w)).toFixed(5));const $=y.addCandlestickSeries({upColor:ce?"#089981":"#26a69a",downColor:ce?"#f23645":"#ef5350",wickUpColor:ce?"#089981":"#26a69a",wickDownColor:ce?"#f23645":"#ef5350",borderUpColor:ce?"#089981":"#26a69a",borderDownColor:ce?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:E,formatter:D}}),C=y.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=y,h.current=$,m.current=C,C.setData(gl(Ne,Te)),requestAnimationFrame(()=>{if(d&&y){const w=d.getBoundingClientRect();w.width>0&&w.height>0&&y.resize(w.width,w.height)}});const B=y.timeScale(),f=()=>{if(me.current&&oi.current.size>0){const w=B.getVisibleRange();w&&Ie(w)}};B.subscribeVisibleTimeRangeChange(f);const L=new ResizeObserver(w=>{for(const p of w){const{width:_,height:P}=p.contentRect;if(_>0&&P>0&&y){const U=B.getVisibleRange();y.resize(_,P),U&&setTimeout(()=>{try{B.setVisibleRange(U)}catch{}},0)}}});return L.observe(d),()=>{B.unsubscribeVisibleTimeRangeChange(f),L.disconnect(),y.remove(),c.current=null,h.current=null,m.current=null,v.current=null,x.current=[],kA.current&&clearTimeout(kA.current)}},[]),Y.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Ze,color:Ze?"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0},horzLines:{visible:Ze,color:Ze?"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0}}})},[Ze]),Y.useEffect(()=>{const d=c.current;if(!d)return;const u=Ee==="light";d.applyOptions({layout:{background:{color:u?"#FFFFFF":"#12161d"},textColor:u?"#020617":"#fff"},grid:{vertLines:{color:Ze?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ze?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:u?"#e5e7eb":"#1e293b"},timeScale:{borderColor:u?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1},horzLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1}}})},[Ee,Ze]),Y.useEffect(()=>{const d=h.current;!d||!Ke||d.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor})},[Ke]),Y.useEffect(()=>{if(!c.current)return;const u=!Le&&!(We!==null&&We!==1&&We!==0),O=!Le;c.current.applyOptions({crosshair:{mode:0,vertLine:{visible:We===1||_A,width:1,color:Ee==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ee==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:We===1||_A,width:1,color:Ee==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ee==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:u,horzTouchDrag:u,vertTouchDrag:u},handleScale:{axisPressedMouseMove:{time:u,price:u},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:u,price:u},mouseWheel:O,pinch:O}})},[We,Le,_A,Ee]);const Db=(d=!1)=>{const u=h.current,O=c.current;x.current.forEach(ce=>{if(ce.primitive)try{u&&u.detachPrimitive(ce.primitive)}catch{}if(ce.series&&ce.series!==u&&O)try{O.removeSeries(ce.series)}catch{}if(ce.priceLine&&u)try{u.removePriceLine(ce.priceLine)}catch{}if(ce.textPrimitive&&u)try{u.detachPrimitive(ce.textPrimitive)}catch{}}),x.current=[],He([]),De(null),d&&$T(ye,Te)},Yd=(d,u=!1)=>{d&&x.current.forEach(O=>{if(O.primitive){try{d.detachPrimitive(O.primitive)}catch{}try{d.attachPrimitive(O.primitive)}catch{}}if(u&&O.type==="pricelevel"&&O.priceLine)try{const ce=O.showPrice!==!1,y=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:ce,title:ce&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}if(u&&O.type==="horizontalray"&&O.priceLine)try{const ce=O.showPrice!==!1,y=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:ce,title:ce&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}})},Xs=Y.useCallback(()=>{GT(x.current,ye,Te)},[ye,Te]),_b=Y.useCallback(()=>{const d=c.current,u=h.current;if(!d||!u)return;const O=RT(ye,Te);if(!O.length)return;const ce=[];for(const y of O)try{let R=null;switch(y.type){case"pricelevel":{const V=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});R={...y,priceLine:V};break}case"horizontalray":{const V=new gd(y.price,y.rawOriginTime);u.attachPrimitive(V);const X=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});R={...y,primitive:V,priceLine:X};break}case"verticalline":{const V=new Ld(y.rawTime);u.attachPrimitive(V),R={...y,primitive:V};break}case"text":{const V=new Id(y.rawTime,y.price);y.text&&(V.text=y.text),u.attachPrimitive(V),R={...y,primitive:V};break}case"crossline":{const V=new Qd({rawTime:y.p.rawTime,price:y.p.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"infoline":{const V=y.info||{},X=new wd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},V);u.attachPrimitive(X),R={...y,primitive:X};break}case"rulerline":{const V=y.info||{},X=new cl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},V);u.attachPrimitive(X),R={...y,primitive:X};break}case"arrowedline":{const V=new hl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"rayline":{const V=new Td({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"extendedline":{const V=new bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"trendbyangle":{const V=new Fd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"trendline":case"gannline":{const V=y.type==="gannline"?"#7aa6ae":"#22c55e",X=d.addLineSeries({color:V,lineWidth:y.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),se=DA([{time:y.point1.time,value:y.point1.price},{time:y.point2.time,value:y.point2.price}]);se.length>0&&X.setData(se);const E=new xd(y.point1,y.point2,V,2);try{X.attachPrimitive(E)}catch{}R={...y,series:X,decoration:E};break}case"rectangle":{const V=new Bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"circle":{const V=new yd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"triangle":{const V=new Cd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"ellipse":{const V=new vd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1,minorRatio:y.minorRatio??.45,previewAsLine:!1});u.attachPrimitive(V),R={...y,primitive:V};break}case"fibonacci":{const V=new fl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"equidistantchannel":{const V=new pl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.b1.rawTime,price:y.b1.price},{rawTime:y.b2.rawTime,price:y.b2.price},{rawTime:y.bottomMid.rawTime,price:y.bottomMid.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"disjointchannel":{const V=new Ns({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"flattopbottom":{const V=new ul({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"regressionchannel":{const V=new Ks({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"stddevchannel":{const V=new dl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"andrewspitchfork":{const V=new Ud({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"gannfan":{const V=new Sd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"ganngrid":{const V=new Ed({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}default:continue}R&&ce.push(R)}catch{}ce.length&&(x.current.push(...ce),He(y=>[...y,...ce]))},[ye,Te,He]);Y.useEffect(()=>{const d=`${ye}_${Te}`;F.current===d&&Xs()},[dt,Xs,ye,Te]),Y.useEffect(()=>{(async()=>{if(!ye||!Te){Wt([]),me.current=!1;return}try{if(kA.current&&(clearTimeout(kA.current),kA.current=null),nr.current=!0,Gs(!0),Jd(null),Wt([]),me.current=!1,tn.current=!1,Me.current!==null&&Me.current!==ye&&(F.current=null,Db()),Me.current=ye,h.current)try{h.current.setData([])}catch{}const u=Pd(Te),O=ZT(Te,u),ce=Yt||ob?.VITE_BASE_URL||"http://localhost:5002",y=Qt?.candles||"/api/chart/candles",R=Lt?.candles||{},V={symbol:R.symbol||"symbol",timeframe:R.timeframe||"timeframe",limit:R.limit||"limit",daysBack:R.daysBack||"daysBack"},X={};X[V.symbol]=ye,X[V.timeframe]=Te,X[V.limit]=O,R.daysBack!==!1&&(X[V.daysBack]=u);const se=localStorage.getItem("token")??localStorage.getItem("authToken"),E=await Bt.get(`${ce}${y}`,{params:X,timeout:1e4,headers:se?{Authorization:`Bearer ${se}`}:{}});let D=[];if(Array.isArray(E.data)?D=E.data:E.data&&E.data.data&&Array.isArray(E.data.data)?D=E.data.data:E.data&&Array.isArray(E.data)&&(D=E.data),D&&D.length>0){const{candles:$,stats:C}=El(D,ye,Te);$.length>0?(Wt($),oi.current=new Map,$.forEach(B=>{oi.current.set(B.time,B)}),tn.current=!0,nr.current=!1,$s.current?.connected&&ye&&Te&&$s.current.emit("subscribeCandles",{symbol:ye,timeframe:Te})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),nr.current=!1,Wt([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),nr.current=!1,Wt([])}catch(u){console.error(`❌ Error fetching ${ye}:`,u.message);const O=u.code==="ECONNABORTED"||u.message&&u.message.includes("timeout");Jd(O?"Request timed out. No data available for this symbol.":u.message||"Failed to load candles."),nr.current=!1,Wt([]),Gs(!1)}})()},[ye,Te,Lb]),Y.useEffect(()=>{$s.current=zn.getSocket();const d=$s.current,u=()=>{if(tn.current&&ye&&Te&&d.connected){const X={symbol:ye,timeframe:Te};d.emit("subscribeCandles",X)}},O=()=>{setTimeout(()=>{ye&&Te&&u()},200)},ce=X=>{},y=X=>{};d.on("connect",O),d.on("disconnect",ce),d.on("connect_error",y),d.on("subscription:confirmed",X=>{X.type});const R=X=>{if(!tn.current||!X||!X.candle||!X.symbol)return;const se=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(se(X.symbol)!==se(ye)||X.timeframe&&X.timeframe!==Te)return;const{candle:E}=X,D=Ll(E,ye,Te);if(!D)return;const $=Date.now();if($-Zd.current<200)return;Zd.current=$;const C=c.current?.timeScale(),B=C?.getVisibleRange(),f=h.current,L=c.current;if(!(!f||!L||!me.current&&!tn.current||f?.seriesType?.()!==(be==="line"?"Line":be==="area"?"Area":be==="bars"?"Bar":"Candlestick")))try{const _=oi.current.get(D.time),P=!_,U=_?{time:D.time,open:_.open,high:Math.max(_.high,D.high),low:Math.min(_.low,D.low),close:D.close}:D;oi.current.set(D.time,U),P&&m.current&&m.current.setData(gl(Array.from(oi.current.values()),Te));try{be==="line"||be==="area"?f.update({time:U.time,value:U.close}):f.update(U),C&&B&&Ie(B)}catch(k){throw k}const b=ze.current||{},g=Ve.current||{},M=_e.current;if(Object.keys(M).length>0){const k=Array.from(oi.current.values()).sort((K,W)=>K.time-W.time);if(b.sma20&&M.sma20){const K=Vs(k,g.smaPeriod||20);if(K)try{M.sma20.update(K)}catch{}}if(b.sma50&&M.sma50){const K=Vs(k,50);if(K)try{M.sma50.update(K)}catch{}}if(b.ema12&&M.ema12){const K=Nd(k,g.emaPeriod||12);if(K)try{M.ema12.update(K)}catch{}}if(b.rsi&&M.rsi){const K=Kd(k,g.rsiPeriod||14);if(K){try{M.rsi.update(K)}catch{}if(M.rsi70)try{M.rsi70.update({time:K.time,value:70})}catch{}if(M.rsi30)try{M.rsi30.update({time:K.time,value:30})}catch{}}}if(b.macd&&M.macdLine){const K=zd(k,12,26,9);if(K){try{M.macdLine.update({time:K.time,value:K.value})}catch{}try{M.macdSignal.update({time:K.time,value:K.signal})}catch{}try{M.macdHist.update({time:K.time,value:K.histogram,color:K.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(b.bollinger&&M.bbMiddle){const K=qs(k,g.bbPeriod||20,g.bbStdDev||2);if(K){try{M.bbUpper.update({time:K.time,value:K.upper})}catch{}try{M.bbMiddle.update({time:K.time,value:K.middle})}catch{}try{M.bbLower.update({time:K.time,value:K.lower})}catch{}}}}}catch{}};d.on("candleUpdate",R);const V=()=>{d.connected&&ye&&Te&&u()};if(d.connected)V();else{const X=()=>{setTimeout(V,200)};d.once("connect",X),setTimeout(()=>{d.connected&&V()},500)}return()=>{d.off("candleUpdate",R),d.off("connect",O),d.off("disconnect",ce),d.off("connect_error",y),d.off("subscription:confirmed"),ye&&Te&&d.connected&&d.emit("unsubscribeCandles",{symbol:ye,timeframe:Te})}},[ye,Te,Yt]),Y.useEffect(()=>{const d=h.current,u=c.current;if(!(!d||!u)&&!(nr.current&&Ne.length>0)&&!(Ne.length===0&&me.current)){if(Ne.length===0&&!me.current){if(lA)return;const O=u.timeScale();d.setData([]),O.fitContent(),kA.current&&clearTimeout(kA.current),kA.current=setTimeout(()=>requestAnimationFrame(()=>Gs(!1)),400);return}if(!me.current){const O=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),ce=O.includes("JPY"),y=An(O),R=rn(O);let V,X;ce?(V=.001,X=f=>Math.abs(Number(f)).toFixed(3)):R?O.startsWith("BTC")||O.startsWith("ETH")?(V=.01,X=f=>Math.abs(Number(f)).toFixed(2)):(V=1e-4,X=f=>Math.abs(Number(f)).toFixed(4)):y&&(O.startsWith("XAU")||O.startsWith("XAG"))?(V=.01,X=f=>Math.abs(Number(f)).toFixed(2)):(V=1e-4,X=f=>Math.abs(Number(f)).toFixed(5));try{d.applyOptions({priceFormat:{type:"custom",minMove:V,formatter:X}})}catch{}const se=u.timeScale(),E=$e(ye,Te);Se.current,Se.current=E;const D=[...Ne].sort((f,L)=>f.time-L.time);if(be==="line"||be==="area"){const f=D?.map(L=>({time:L.time,value:L.close})).filter(L=>L.time!=null);f.length>0&&d.setData(f)}else D?.length>0&&d.setData(D);Ke&&d.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor}),Yd(d);const $=`${ye}_${Te}`;F.current!==$&&(F.current=$,_b());const C=BA(Te)||60;if(x.current.forEach(f=>{if(f.type==="horizontalray"&&f.primitive){const U=f.rawOriginTime??f.primitive.originTime,b=Re(U,C);f.primitive.originTime=b,f.originTime=b;return}if(f.type==="verticalline"&&f.primitive){const U=f.rawTime??f.primitive.time,b=Re(U,C);f.primitive.time=b,f.time=te(b);return}if(f.type==="infoline"&&f.primitive&&f.p1&&f.p2){const U=f.rawP1Time??f.p1.rawTime,b=f.rawP2Time??f.p2.rawTime,g=D.length>0?D[0].time:null,M=D.length>0?D[D.length-1].time:null,k=Z=>{const Ae=Re(Z,C);return g==null||M==null?Ae:Math.min(Math.max(Ae,g),M)},K=k(U),W=k(b);f.p1.rawTime=K,f.p1.normalizedTime=te(K),f.p2.rawTime=W,f.p2.normalizedTime=te(W),f.primitive.p1={rawTime:K,price:f.p1.price},f.primitive.p2={rawTime:W,price:f.p2.price};return}if(f.type==="rulerline"&&f.primitive&&f.p1&&f.p2){const U=f.rawP1Time??f.p1.rawTime,b=f.rawP2Time??f.p2.rawTime,g=D.length>0?D[0].time:null,M=D.length>0?D[D.length-1].time:null,k=Be=>{const Ce=Re(Be,C);return g==null||M==null?Ce:Math.min(Math.max(Ce,g),M)},K=k(U),W=k(b);f.p1.rawTime=K,f.p2.rawTime=W,f.primitive.p1={rawTime:K,price:f.p1.price},f.primitive.p2={rawTime:W,price:f.p2.price};const Z=te(K),Ae=te(W),he=Math.abs((Ae??0)-(Z??0));f.primitive.info={priceDiff:f.p2.price-f.p1.price,pricePct:(f.p2.price-f.p1.price)/Math.abs(f.p1.price||1)*100,bars:zs(Rs,K,W,Te),days:Math.max(1,Math.round(he/86400))};return}if(f.type==="arrowedline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="rayline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="extendedline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="trendbyangle"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="disjointchannel"&&f.primitive&&f.p1&&f.p2&&f.p3&&f.p4){const U=b=>{const g=Re(b.rawTime,C);b.rawTime=g,b.normalizedTime=te(g)};U(f.p1),U(f.p2),U(f.p3),U(f.p4),f.primitive.p1={rawTime:f.p1.rawTime,price:f.p1.price},f.primitive.p2={rawTime:f.p2.rawTime,price:f.p2.price},f.primitive.p3={rawTime:f.p3.rawTime,price:f.p3.price},f.primitive.p4={rawTime:f.p4.rawTime,price:f.p4.price};return}if(f.type==="flattopbottom"&&f.primitive&&f.p1&&f.p2&&f.p3&&f.p4){const U=b=>{const g=Re(b.rawTime,C);b.rawTime=g,b.normalizedTime=te(g)};U(f.p1),U(f.p2),U(f.p3),U(f.p4),f.primitive.p1={rawTime:f.p1.rawTime,price:f.p1.price},f.primitive.p2={rawTime:f.p2.rawTime,price:f.p2.price},f.primitive.p3={rawTime:f.p3.rawTime,price:f.p3.price},f.primitive.p4={rawTime:f.p4.rawTime,price:f.p4.price};return}if(f.type==="regressionchannel"&&f.primitive&&f.p1&&f.p2){const U=Jr(D,f.p1,f.p2,f.stdMultiplier??1);if(!U)return;const b=f.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},f.p1=U.p1,f.p2=U.p2,f.top1=U.top1,f.top2=U.top2,f.bot1=U.bot1,f.bot2=U.bot2,f.slope=U.slope,f.intercept=U.intercept,f.stdDev=U.stdDev,f.offset=U.offset,f.barCount=U.barCount;return}if(f.type==="stddevchannel"&&f.primitive&&f.p1&&f.p2){const U=Zr(D,f.p1,f.p2,f.stdMultiplier??1);if(!U)return;const b=f.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},f.p1=U.p1,f.p2=U.p2,f.top1=U.top1,f.top2=U.top2,f.bot1=U.bot1,f.bot2=U.bot2,f.slope=U.slope,f.stdDev=U.stdDev,f.offset=U.offset,f.barCount=U.barCount;return}if(f.type==="andrewspitchfork"&&f.primitive&&f.p1&&f.p2&&f.p3){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C),g=Re(f.p3.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.p3.rawTime=g,f.p3.normalizedTime=te(g),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price},f.primitive.p3={rawTime:g,price:f.p3.price};return}if((f.type==="gannfan"||f.type==="ganngrid")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if((f.type==="circle"||f.type==="ellipse")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if(f.type==="triangle"&&f.primitive&&f.p1&&f.p2&&f.p3){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C),g=Re(f.p3.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.p3.rawTime=g,f.p3.normalizedTime=te(g),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price},f.primitive.p3={rawTime:g,price:f.p3.price};return}if((f.type==="fibonacci"||f.type==="rectangle")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if(f.type!=="trendline"&&f.type!=="gannline"||!f.series||!f.point1||!f.point2)return;const L=f.point1.rawTime??f.point1.time,w=f.point2.rawTime??f.point2.time,p=Re(L,C),_=Re(w,C);f.point1.time=p,f.point2.time=_;const P=DA([{time:p,value:f.point1.price},{time:_,value:f.point2.price}]);try{P.length>0&&f.series.setData(P)}catch{}}),D?.length>0){const f=D[D?.length-1].time,L=BA(Te)||60,p=f-(Te==="M1"?150:Te==="M5"?120:100)*L;try{se.setVisibleRange({from:p,to:f+L*Dd})}catch{se.fitContent()}}else se.fitContent();try{u.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0;const B=se.getVisibleRange();Ie(B),kA.current&&clearTimeout(kA.current),kA.current=setTimeout(()=>requestAnimationFrame(()=>Gs(!1)),400)}}},[Ne.length,be,ye,Te]),Y.useEffect(()=>{const d=c.current;if(!d||!me.current||Ne.length===0)return;const u=d.timeScale(),O=u.getVisibleRange()||Ye();if(h.current)try{d.removeSeries(h.current)}catch{}if(v.current)try{d.removeSeries(v.current),v.current=null}catch{}let ce;const y=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),R=y.includes("JPY"),V=An(y),X=rn(y);let se,E;R?(se=.001,E=C=>Math.abs(Number(C)).toFixed(3)):X?y.startsWith("BTC")||y.startsWith("ETH")?(se=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(se=1e-4,E=C=>Math.abs(Number(C)).toFixed(4)):V&&(y.startsWith("XAU")||y.startsWith("XAG"))?(se=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(se=1e-4,E=C=>Math.abs(Number(C)).toFixed(5));const D={type:"custom",minMove:se,formatter:E};if(be==="bars"){const C=Ee==="light";ce=d.addBarSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const B=[...Ne].sort((f,L)=>f.time-L.time);B?.length>0&&ce.setData(B)}else if(be==="line"){ce=d.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const C=DA(Cl);C.length>0&&ce.setData(C)}else if(be==="area"){ce=d.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const C=DA(Cl);C.length>0&&ce.setData(C)}else if(be==="volume ticks"||be==="volume"){const C=Ee==="light";ce=d.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:D,priceScaleId:"right"});const B=[...Ne].sort((w,p)=>w.time-p.time);B?.length>0&&ce.setData(B);const f=d.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),d.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const L=B?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));L.length>0&&f.setData(L),v.current=f}else{const C=Ee==="light";ce=d.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const B=[...Ne].sort((f,L)=>f.time-L.time);B?.length>0&&ce.setData(B)}if(h.current=ce,Ke&&ce)try{ce.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor})}catch{}Yd(ce,!0);const $=BA(Te)||60;if(x.current.forEach(C=>{if(C.type==="horizontalray"&&C.primitive){const U=C.rawOriginTime??C.primitive.originTime,b=Re(U,$);C.primitive.originTime=b,C.originTime=b;return}if(C.type==="verticalline"&&C.primitive){const U=C.rawTime??C.primitive.time,b=Re(U,$);C.primitive.time=b,C.time=te(b);return}if(C.type==="infoline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,g=[...Ne].sort((Ae,he)=>Ae.time-he.time),M=g.length>0?g[0].time:null,k=g.length>0?g[g.length-1].time:null,K=Ae=>{const he=Re(Ae,$);return M==null||k==null?he:Math.min(Math.max(he,M),k)},W=K(U),Z=K(b);C.p1.rawTime=W,C.p1.normalizedTime=te(W),C.p2.rawTime=Z,C.p2.normalizedTime=te(Z),C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:Z,price:C.p2.price};return}if(C.type==="rulerline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,g=[...Ne].sort((Ce,Ue)=>Ce.time-Ue.time),M=g.length>0?g[0].time:null,k=g.length>0?g[g.length-1].time:null,K=Ce=>{const Ue=Re(Ce,$);return M==null||k==null?Ue:Math.min(Math.max(Ue,M),k)},W=K(U),Z=K(b);C.p1.rawTime=W,C.p2.rawTime=Z,C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:Z,price:C.p2.price};const Ae=te(W),he=te(Z),Be=Math.abs((he??0)-(Ae??0));C.primitive.info={priceDiff:C.p2.price-C.p1.price,pricePct:(C.p2.price-C.p1.price)/Math.abs(C.p1.price||1)*100,bars:zs(Rs,W,Z,Te),days:Math.max(1,Math.round(Be/86400))};return}if(C.type==="arrowedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="rayline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="extendedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="trendbyangle"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="disjointchannel"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const g=Re(b.rawTime,$);b.rawTime=g,b.normalizedTime=te(g)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="flattopbottom"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const g=Re(b.rawTime,$);b.rawTime=g,b.normalizedTime=te(g)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="regressionchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Ne].sort((M,k)=>M.time-k.time),b=Jr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const g=C.primitive;g.mid1={rawTime:b.p1.rawTime,price:b.p1.price},g.mid2={rawTime:b.p2.rawTime,price:b.p2.price},g.top1={rawTime:b.top1.rawTime,price:b.top1.price},g.top2={rawTime:b.top2.rawTime,price:b.top2.price},g.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},g.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.intercept=b.intercept,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="stddevchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Ne].sort((M,k)=>M.time-k.time),b=Zr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const g=C.primitive;g.mid1={rawTime:b.p1.rawTime,price:b.p1.price},g.mid2={rawTime:b.p2.rawTime,price:b.p2.price},g.top1={rawTime:b.top1.rawTime,price:b.top1.price},g.top2={rawTime:b.top2.rawTime,price:b.top2.price},g.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},g.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="andrewspitchfork"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$),g=Re(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=g,C.p3.normalizedTime=te(g),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:g,price:C.p3.price};return}if((C.type==="gannfan"||C.type==="ganngrid")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if((C.type==="circle"||C.type==="ellipse")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type==="triangle"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$),g=Re(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=g,C.p3.normalizedTime=te(g),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:g,price:C.p3.price};return}if((C.type==="fibonacci"||C.type==="rectangle")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type!=="trendline"&&C.type!=="gannline"||!C.series||!C.point1||!C.point2)return;const B=C.type==="gannline"?"#7aa6ae":"#22c55e";try{d.removeSeries(C.series)}catch{}const f=d.addLineSeries({color:C.lineColor??B,lineWidth:C.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),L=C.point1.rawTime??C.point1.time,w=C.point2.rawTime??C.point2.time,p=Re(L,$),_=Re(w,$);C.point1.time=p,C.point2.time=_;const P=DA([{time:p,value:C.point1.price},{time:_,value:C.point2.price}]);try{P.length>0&&f.setData(P)}catch{}if(C.decoration)try{f.attachPrimitive(C.decoration)}catch{}C.series=f}),O&&me.current)setTimeout(()=>{try{u.setVisibleRange(O),Ie(O)}catch{if(Ne.length>0)try{const B=Ne[Ne.length-1].time,f=BA(Te)||60,L=B-100*f;u.setVisibleRange({from:L,to:B+f*Dd}),Ie(u.getVisibleRange())}catch{u.fitContent(),Ie(u.getVisibleRange())}}try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!me.current){u.fitContent();try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0,Ie(u.getVisibleRange())}},[be,Ne.length,Cl.length,ye,Ke]),Y.useEffect(()=>{const d=c.current,u=v.current;if(!d||!u||!me.current||Ne.length===0||be!=="volume"&&be!=="volume ticks")return;const ce=[...Ne].sort((y,R)=>y.time-R.time)?.map(y=>({time:y.time,value:y.volume||0,color:y.close>=y.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));ce.length>0&&u.setData(ce)},[Ne,be]),Y.useEffect(()=>{if(!ye||!Te||!Ct)return;const u=Object.entries(Ct).filter(([X,se])=>se).map(([X])=>X).filter(X=>X.startsWith("sma")||X.startsWith("ema")||X==="rsi"||X==="macd");if(u.length===0){et({});return}const O=u.map(X=>X==="sma20"?`sma:${Ut?.smaPeriod||20}`:X==="sma50"?"sma:50":X==="ema12"?`ema:${Ut?.emaPeriod||12}`:X==="rsi"?`rsi:${Ut?.rsiPeriod||14}`:X==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!O)return;const ce=++bt.current,y=Yt||"http://localhost:5002",R=Qt?.indicators||"/api/market-data/indicators",V=localStorage.getItem("token")??localStorage.getItem("authToken");Bt.get(`${y}${R}`,{params:{symbol:ye,timeframe:Te,indicators:O},headers:V?{Authorization:`Bearer ${V}`}:{}}).then(X=>{ce===bt.current&&et(X.data?.data||{})}).catch(X=>{console.error("[ChartArea] Indicator fetch error:",X?.message),ce===bt.current&&et({})})},[ye,Te,Ct,Ut,Yt,Qt]),Y.useEffect(()=>{const d=c.current;if(!d||!me.current)return;const u=_e.current,O=(D,$)=>(u[D]||(u[D]=d.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...$})),u[D]),ce=D=>{if(u[D]){try{d.removeSeries(u[D])}catch{}delete u[D]}},y=()=>{["macdLine","macdSignal","macdHist"].forEach(ce)},R=Ct||{};if(R.sma20&&Je.sma20?.data?.length?O("sma20",{color:"#2196F3",lineWidth:1.5}).setData(Je.sma20.data.map($=>({time:$.time,value:$.value}))):ce("sma20"),R.sma50&&Je.sma50?.data?.length?O("sma50",{color:"#FF9800",lineWidth:1.5}).setData(Je.sma50.data.map($=>({time:$.time,value:$.value}))):ce("sma50"),R.ema12&&Je.ema12?.data?.length?O("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(Je.ema12.data.map($=>({time:$.time,value:$.value}))):ce("ema12"),R.rsi&&Je.rsi?.data?.length){const D=O("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:f=>f.toFixed(1)}});d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),D.setData(Je.rsi.data.map(f=>({time:f.time,value:f.value}))),u.rsi70||(u.rsi70=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),u.rsi30||(u.rsi30=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const $=Je.rsi.data,C=$[0]?.time,B=$[$.length-1]?.time;C&&B&&(u.rsi70.setData([{time:C,value:70},{time:B,value:70}]),u.rsi30.setData([{time:C,value:30},{time:B,value:30}]))}else ce("rsi"),ce("rsi70"),ce("rsi30");if(R.macd&&Je.macd?.data?.length){const D=O("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:f=>f.toFixed(4)}}),$=O("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});u.macdHist||(u.macdHist=d.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:f=>f.toFixed(4)}}));const C=R.rsi?.65:.8;d.priceScale("macd").applyOptions({scaleMargins:{top:C,bottom:0},borderVisible:!1,autoScale:!0}),R.rsi&&d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const B=Je.macd.data;D.setData(B.map(f=>({time:f.time,value:f.value}))),$.setData(B.map(f=>({time:f.time,value:f.signal}))),u.macdHist.setData(B.map(f=>({time:f.time,value:f.histogram,color:f.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else y();const V=()=>{["bbUpper","bbMiddle","bbLower"].forEach(ce)};if(R.bollinger){const D=Array.from(oi.current.values()).sort((f,L)=>f.time-L.time),$=Ve.current?.bbPeriod||20,C=Ve.current?.bbStdDev||2,B=Ml(D,$,C);if(B){const f=O("bbUpper",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2}),L=O("bbMiddle",{color:"rgba(33,150,243,0.8)",lineWidth:1.5}),w=O("bbLower",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2});f.setData(B.upper),L.setData(B.middle),w.setData(B.lower)}}else V();const X=Array.from(oi.current.values()).sort((D,$)=>D.time-$.time);if(X.length>0){const D=Ve.current||{};if(R.sma20&&u.sma20){const $=Vs(X,D.smaPeriod||20);if($)try{u.sma20.update($)}catch{}}if(R.sma50&&u.sma50){const $=Vs(X,50);if($)try{u.sma50.update($)}catch{}}if(R.ema12&&u.ema12){const $=Nd(X,D.emaPeriod||12);if($)try{u.ema12.update($)}catch{}}if(R.rsi&&u.rsi){const $=Kd(X,D.rsiPeriod||14);if($){try{u.rsi.update($)}catch{}if(u.rsi70)try{u.rsi70.update({time:$.time,value:70})}catch{}if(u.rsi30)try{u.rsi30.update({time:$.time,value:30})}catch{}}}if(R.macd&&u.macdLine){const $=zd(X,12,26,9);if($){try{u.macdLine.update({time:$.time,value:$.value})}catch{}try{u.macdSignal.update({time:$.time,value:$.signal})}catch{}try{u.macdHist.update({time:$.time,value:$.histogram,color:$.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(R.bollinger&&u.bbMiddle){const $=qs(X,D.bbPeriod||20,D.bbStdDev||2);if($){try{u.bbUpper.update({time:$.time,value:$.upper})}catch{}try{u.bbMiddle.update({time:$.time,value:$.middle})}catch{}try{u.bbLower.update({time:$.time,value:$.lower})}catch{}}}}const se=R.rsi&&Je.rsi?.data?.length||R.macd&&Je.macd?.data?.length,E=R.rsi&&Je.rsi?.data?.length&&R.macd&&Je.macd?.data?.length;try{d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:E?.4:se?.25:.05}})}catch{}},[Je,Ct,Ne.length]),Y.useEffect(()=>()=>{const d=c.current;if(!d)return;const u=_e.current;Object.keys(u).forEach(O=>{try{d.removeSeries(u[O])}catch{}}),_e.current={}},[ye,Te]),Y.useEffect(()=>{const d=c.current,u=h.current,O=o.current;if(!d||!u||!O)return;const y=We!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][We]:null,R=(E,D)=>{const $=Math.min(E.time,D.time),C=Math.max(E.time,D.time),B=E.time<=D.time?E.rawTime:D.rawTime,f=E.time<=D.time?D.rawTime:E.rawTime,L=Math.max(E.price,D.price),w=Math.min(E.price,D.price),p=te(Math.round(($+C)/2));return p==null?null:{p1:{rawTime:p,normalizedTime:p,price:L},p2:{rawTime:B,normalizedTime:$,price:w},p3:{rawTime:f,normalizedTime:C,price:w}}};if(!y){if(T.current=!1,S.current=null,I.current=null,N.current=null,Q.current?.series)try{d.removeSeries(Q.current.series)}catch{}if(Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null;return}if(y==="pricelevel"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const p={type:"pricelevel",priceLine:u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:L.toFixed(5)}),price:L,showPrice:!0,showText:!1};He(_=>[..._,p]),x.current.push(p),De(null)};return O.addEventListener("click",E),()=>{O.removeEventListener("click",E)}}if(y==="horizontalray"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=new gd(L,f);u.attachPrimitive(w);const p=u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof L=="number"?L.toFixed(5):""}),_=te(f),P={type:"horizontalray",primitive:w,priceLine:p,price:L,originTime:_,rawOriginTime:f,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};He(U=>[...U,P]),x.current.push(P),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="verticalline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=d.timeScale().coordinateToTime(C);if(B==null)return;const f=new Ld(B);u.attachPrimitive(f);const L=te(B),w={type:"verticalline",primitive:f,time:L,rawTime:B,lineColor:"#3b82f6",lineWidth:2,showDate:!0};He(p=>[...p,w]),x.current.push(w),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="text"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=new Id(f,L);u.attachPrimitive(w);const p={type:"text",primitive:w,rawTime:f,price:L,text:"Text"};He(_=>[..._,p]),x.current.push(p),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="infoline"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;D||(D=d.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const P=E.normalizedTime,U=te(p);if(P==null||U==null||P===U)return;const b=P<=U?[{time:P,value:E.price},{time:U,value:_}]:[{time:U,value:_},{time:P,value:E.price}];try{D.setData(b)}catch{}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p),x:L,y:w};return}if(D){try{d.removeSeries(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null)return;const b=_-E.price,g=b/Math.abs(E.price)*100,M=BA(Te)||3600,k=Math.abs(U-P),K=Math.max(1,Math.round(k/M)),W=Math.max(1,Math.round(k/86400)),Z=E.x,Ae=E.y,he=L,Ce=Math.atan2(-(w-Ae),he-Z)*(180/Math.PI),Ue={priceDiff:b,pricePct:g,bars:K,days:W,angle:Ce},qe=new wd({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_},Ue);u.attachPrimitive(qe);const rt={type:"infoline",primitive:qe,rawP1Time:E.rawTime,rawP2Time:p,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};He(Xe=>[...Xe,rt]),x.current.push(rt),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{d.removeSeries(D)}catch{}}}if(y==="rulerline"){let E=null,D=null;const $=(f,L,w,p)=>{const _=te(f),P=te(w),U=p-L,b=U/Math.abs(L)*100,g=zs(Rs,f,w,Te),M=Math.abs((P??0)-(_??0)),k=Math.max(1,Math.round(M/86400));return{priceDiff:U,pricePct:b,bars:g,days:k}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null||U===E.normalizedTime)return;const b=$(E.rawTime,E.price,_,P);if(!D)D=new cl({rawTime:E.rawTime,price:E.price},{rawTime:_,price:P},b),u.attachPrimitive(D);else{D.p2={rawTime:_,price:P},D.info=b;const g=P>=E.price;D.color=g?"#3b82f6":"#ef5350",D.fillColor=g?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;if(!E){E={rawTime:_,price:P,normalizedTime:te(_)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const U=E.normalizedTime,b=te(_);if(U==null||b==null)return;const g=$(E.rawTime,E.price,_,P),M=new cl({rawTime:E.rawTime,price:E.price},{rawTime:_,price:P},g);u.attachPrimitive(M);const k={type:"rulerline",primitive:M,rawP1Time:E.rawTime,rawP2Time:_,p1:{rawTime:E.rawTime,normalizedTime:U,price:E.price},p2:{rawTime:_,normalizedTime:b,price:P},lineColor:P>=E.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="arrowedline"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;const P=te(p);if(!(P==null||P===E.normalizedTime))if(!D)D=new hl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_}),u.attachPrimitive(D);else{D.p2={rawTime:p,price:_};try{c.current?.applyOptions({})}catch{}}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null||P===U)return;const b=new hl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_});u.attachPrimitive(b);const g={type:"arrowedline",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(M=>[...M,g]),x.current.push(g),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{u.detachPrimitive(D)}catch{}}}if(y==="rayline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new Td({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"rayline",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="extendedline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new bd({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"extendedline",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="crossline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p=new Qd({rawTime:f,price:L});u.attachPrimitive(p);const _={type:"crossline",primitive:p,p:{rawTime:f,normalizedTime:w,price:L},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};He(P=>[...P,_]),x.current.push(_),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendbyangle"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new Fd({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"trendbyangle",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="disjointchannel"){let E=null,D=null,$=null,C=null,B=0,f=null;const L=(_,P,U,b)=>{if(!f)f=new Ns(_,P,U,b),u.attachPrimitive(f);else{f.p1=_,f.p2=P,f.p3=U,f.p4=b;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(B===0||!E)return;const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top;if(B===1){const g=u.coordinateToPrice(b);if(g==null)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:g},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===2&&D){const g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k==null)return;const K=(E.price+D.price)/2;M>=K?($={rawTime:g,normalizedTime:k,price:M},C={rawTime:g,normalizedTime:k,price:2*K-M}):(C={rawTime:g,normalizedTime:k,price:M},$={rawTime:g,normalizedTime:k,price:2*K-M}),L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=_=>{const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top,g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k!=null){if(B===0){E={rawTime:g,normalizedTime:k,price:M},D={rawTime:g,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&f){try{u.detachPrimitive(f)}catch{}const K=new Ns(f.p1,f.p2,f.p3,f.p4);u.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:E,p2:D,p3:{rawTime:f.p3.rawTime,normalizedTime:te(f.p3.rawTime),price:f.p3.price},p4:{rawTime:f.p4.rawTime,normalizedTime:te(f.p4.rawTime),price:f.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};He(Z=>[...Z,W]),x.current.push(W),De(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),f)try{u.detachPrimitive(f)}catch{}}}if(y==="flattopbottom"){let E=null,D=null,$=null,C=null,B=0,f=null;const L=(_,P,U,b)=>{if(!f)f=new ul(_,P,U,b),u.attachPrimitive(f);else{f.p1=_,f.p2=P,f.p3=U,f.p4=b;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(B===0||!E)return;const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top;if(B===1){const g=u.coordinateToPrice(b);if(g==null)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:g},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===2&&D){const g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k==null)return;$={rawTime:g,normalizedTime:k,price:M},C={rawTime:g,normalizedTime:k,price:D.price},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=_=>{const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top,g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k!=null){if(B===0){E={rawTime:g,normalizedTime:k,price:M},D={rawTime:g,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&f){try{u.detachPrimitive(f)}catch{}const K=new ul(f.p1,f.p2,f.p3,f.p4);u.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:E,p2:D,p3:{rawTime:f.p3.rawTime,normalizedTime:te(f.p3.rawTime),price:f.p3.price},p4:{rawTime:f.p4.rawTime,normalizedTime:te(f.p4.rawTime),price:f.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};He(Z=>[...Z,W]),x.current.push(W),De(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),f)try{u.detachPrimitive(f)}catch{}}}if(y==="regressionchannel"){let E=null,D=null;const $=(f,L)=>{f.mid1={rawTime:L.p1.rawTime,price:L.p1.price},f.mid2={rawTime:L.p2.rawTime,price:L.p2.price},f.top1={rawTime:L.top1.rawTime,price:L.top1.price},f.top2={rawTime:L.top2.rawTime,price:L.top2.price},f.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},f.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;const g=Jr(Ne,E,{rawTime:_,normalizedTime:U},1);if(g)if(!D)D=new Ks({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),u.attachPrimitive(D);else{$(D,g);try{d.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;if(!E){E={rawTime:_,normalizedTime:U,price:P};return}const g=Jr(Ne,E,{rawTime:_,normalizedTime:U},1);if(!g)return;if(D){try{u.detachPrimitive(D)}catch{}D=null}const M=new Ks({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});u.attachPrimitive(M);const k={type:"regressionchannel",primitive:M,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,intercept:g.intercept,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="stddevchannel"){let E=null,D=null;const $=(f,L)=>{f.mid1={rawTime:L.p1.rawTime,price:L.p1.price},f.mid2={rawTime:L.p2.rawTime,price:L.p2.price},f.top1={rawTime:L.top1.rawTime,price:L.top1.price},f.top2={rawTime:L.top2.rawTime,price:L.top2.price},f.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},f.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;const g=Zr(Ne,E,{rawTime:_,normalizedTime:U,price:P},1);if(g)if(!D)D=new dl({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),u.attachPrimitive(D);else{$(D,g);try{d.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;if(!E){E={rawTime:_,normalizedTime:U,price:P};return}const g=Zr(Ne,E,{rawTime:_,normalizedTime:U,price:P},1);if(!g)return;if(D){try{u.detachPrimitive(D)}catch{}D=null}const M=new dl({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});u.attachPrimitive(M);const k={type:"stddevchannel",primitive:M,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="andrewspitchfork"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p=C+140,_=d.timeScale().coordinateToTime(p);if(_==null)return;const P=te(_);if(P==null)return;const U={rawTime:f,normalizedTime:w,price:L},b={rawTime:_,normalizedTime:P,price:L},g={rawTime:f,normalizedTime:w,price:L},M=new Ud({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:g.rawTime,price:g.price});u.attachPrimitive(M);const k={type:"andrewspitchfork",primitive:M,p1:U,p2:b,p3:g};He(K=>[...K,k]),x.current.push(k),z(k),fe.current=k,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="gannfan"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p={rawTime:f,normalizedTime:w,price:L},_={rawTime:f,normalizedTime:w,price:L},P=new Sd({rawTime:p.rawTime,price:p.price},{rawTime:_.rawTime,price:_.price});u.attachPrimitive(P);const U={type:"gannfan",primitive:P,p1:p,p2:_};He(b=>[...b,U]),x.current.push(U),z(U),fe.current=U,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="ganngrid"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p={rawTime:f,normalizedTime:w,price:L},_={rawTime:f,normalizedTime:w,price:L},P=new Ed({rawTime:p.rawTime,price:p.price},{rawTime:_.rawTime,price:_.price});u.attachPrimitive(P);const U={type:"ganngrid",primitive:P,p1:p,p2:_};He(b=>[...b,U]),x.current.push(U),z(U),fe.current=U,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendline"||y==="gannline"){const E=y,D=E==="gannline"?"#7aa6ae":"#22c55e",$=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,_=L.clientY-w.top;let P=d.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(_);if(!(P==null||U==null)&&(P=te(P),P!=null))if(N.current===null){N.current={time:P,price:U};const b=d.addLineSeries({color:D,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:E,series:b},b.setData([{time:P,value:U}])}else{const b=N.current,g={time:P,price:U},M=1,k=1e-5,K=Math.abs(g.time-b.time),W=Math.abs(g.price-b.price);if(K<M&&W<k){try{d.removeSeries(Q.current.series)}catch{}N.current=null,Q.current=null;return}const Z={time:b.time,rawTime:b.time,price:b.price},Ae={time:g.time,rawTime:g.time,price:g.price},he=DA([{time:Z.time,value:Z.price},{time:Ae.time,value:Ae.price}]);if(he.length>0){Q.current.series.setData(he);const Be=new xd(Z,Ae,D,2);try{Q.current.series.attachPrimitive(Be)}catch{}const Ce={type:E,series:Q.current.series,point1:Z,point2:Ae,decoration:Be};He(Ue=>[...Ue,Ce]),x.current.push(Ce)}De(null),N.current=null,Q.current=null}},C=L=>{if(N.current===null||Q.current?.type!=="trendline"&&Q.current?.type!=="gannline")return;L.preventDefault(),L.stopPropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,_=L.clientY-w.top;let P=d.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(_);if(P==null||U==null||(P=te(P),P==null))return;const b=N.current,g=DA([{time:b.time,value:b.price},{time:P,value:U}]);g.length>0&&Q.current.series.setData(g)},B=L=>{L.stopPropagation()},f={capture:!0,passive:!1};return O.addEventListener("click",$,f),O.addEventListener("mousemove",C,f),O.addEventListener("mousemove",B,f),()=>{if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{d.removeSeries(Q.current.series)}catch{}Q.current=null}O.removeEventListener("click",$,f),O.removeEventListener("mousemove",C,f),O.removeEventListener("mousemove",B,f)}}if(y==="parallellines"){let E=null,D=null,$=null,C=0,B=null;const f=(U,b,g,M)=>{U.p1={rawTime:b.rawTime,price:b.price},U.p2={rawTime:g.rawTime,price:g.price},U.b1={rawTime:M.b1.rawTime,price:M.b1.price},U.b2={rawTime:M.b2.rawTime,price:M.b2.price},U.p3={rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}},L=(U,b,g)=>{const M=Od(U,b,g);if(!M)return null;if(!B)B=new pl({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:M.b1.rawTime,price:M.b1.price},{rawTime:M.b2.rawTime,price:M.b2.price},{rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}),u.attachPrimitive(B);else{f(B,U,b,M);try{d.applyOptions({})}catch{}}return M},w=U=>{U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation();const b=O.getBoundingClientRect(),g=U.clientX-b.left,M=U.clientY-b.top,k=d.timeScale().coordinateToTime(g),K=u.coordinateToPrice(M);if(k==null||K==null)return;const W=te(k);if(W!=null){if(C===0){E={rawTime:k,normalizedTime:W,price:K},C=1;return}if(C===1){if(D={rawTime:k,normalizedTime:W,price:K},Math.abs(D.normalizedTime-E.normalizedTime)<1)return;const Z=te((E.normalizedTime+D.normalizedTime)/2);if(Z==null)return;const Ae=(E.price+D.price)/2;$={rawTime:Z,normalizedTime:Z,price:Ae},L(E,D,$),C=2;return}if(C===2&&E&&D){$={rawTime:k,normalizedTime:W,price:K};const Z=L(E,D,$);if(!Z||!B)return;try{u.detachPrimitive(B)}catch{}const Ae=new pl({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:Z.b1.rawTime,price:Z.b1.price},{rawTime:Z.b2.rawTime,price:Z.b2.price},{rawTime:Z.bottomMid.rawTime,price:Z.bottomMid.price});u.attachPrimitive(Ae);const he={type:"equidistantchannel",primitive:Ae,p1:E,p2:D,p3:Z.bottomMid,b1:Z.b1,b2:Z.b2,bottomMid:Z.bottomMid};He(Be=>[...Be,he]),x.current.push(he),De(null),C=0,E=null,D=null,$=null,B=null}}},p=U=>{if(C===0||!E)return;const b=O.getBoundingClientRect(),g=U.clientX-b.left,M=U.clientY-b.top,k=d.timeScale().coordinateToTime(g),K=u.coordinateToPrice(M);if(k==null||K==null)return;const W=te(k);if(W!=null){if(C===1){const Z={rawTime:k,normalizedTime:W,price:K},Ae=te((E.normalizedTime+Z.normalizedTime)/2);if(Ae==null)return;const he=(E.price+Z.price)/2;L(E,Z,{rawTime:Ae,price:he});return}C===2&&D&&L(E,D,{rawTime:k,price:K})}},_=U=>{U.stopPropagation()},P={capture:!0,passive:!1};return O.addEventListener("click",w,P),O.addEventListener("mousemove",p,P),O.addEventListener("mousemove",_,P),()=>{if(C=0,E=null,D=null,$=null,J.current=[],B)try{u.detachPrimitive(B)}catch{}B=null,O.removeEventListener("click",w,P),O.removeEventListener("mousemove",p,P),O.removeEventListener("mousemove",_,P)}}if(y==="fibonacci"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(!(p==null||_==null))if(!D)D=new fl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_}),u.attachPrimitive(D);else{D.p2={rawTime:p,price:_};try{d.applyOptions({})}catch{}}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null)return;if(Math.abs(_-E.price)<1e-5){E=null;return}const b=new fl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_});u.attachPrimitive(b);const g={type:"fibonacci",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_}};He(M=>[...M,g]),x.current.push(g),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{u.detachPrimitive(D)}catch{}}}if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{d.removeSeries(Q.current.series)}catch{}Q.current=null}const V=E=>{if(E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),y==="trendline"||y==="gannline"||y==="parallellines"||y==="fibonacci"||y!=="rectangle"&&y!=="circle"&&y!=="triangle"&&y!=="ellipse")return;const D=O.getBoundingClientRect(),$=E.clientX-D.left,C=E.clientY-D.top;let B=d.timeScale().coordinateToTime($);const f=u.coordinateToPrice(C);if(B==null||f==null)return;const L=B;if(B=te(B),B!=null){if(T.current=!0,S.current={time:B,normalizedTime:B,rawTime:L,price:f},I.current=null,y==="rectangle"){const w=new Bd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"rectangle",primitive:w}}if(y==="circle"){const w=new yd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",lineWidth:1});u.attachPrimitive(w),Q.current={type:"circle",primitive:w}}if(y==="triangle"){const w=new Cd({rawTime:L,price:f},{rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"triangle",primitive:w}}if(y==="ellipse"){const w=new vd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});u.attachPrimitive(w),Q.current={type:"ellipse",primitive:w}}if(y==="parallellines"){const w=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},X=E=>{if(!T.current||!S.current||!Q.current)return;E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const D=O.getBoundingClientRect(),$=E.clientX-D.left,C=E.clientY-D.top;let B=d.timeScale().coordinateToTime($);const f=u.coordinateToPrice(C);if(B==null||f==null)return;const L=B;if(B=te(B),B==null)return;I.current={time:B,normalizedTime:B,rawTime:L,price:f};const w=S.current;if(Q.current.type==="rectangle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="circle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="triangle"){const p=Q.current.primitive,_=R(w,{time:B,rawTime:L,price:f});if(!_)return;p.p1={rawTime:_.p1.rawTime,price:_.p1.price},p.p2={rawTime:_.p2.rawTime,price:_.p2.price},p.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="ellipse"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="parallellines")if(Q.current.firstLine){const p=Q.current.firstLine;p.endTime-p.startTime;const _=p.endPrice-p.startPrice,P=f,U=P+_;if(Q.current.secondLine)Q.current.secondLine.setData([{time:w.time,value:P},{time:B,value:U}]);else{const b=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});b.setData([{time:w.time,value:P},{time:B,value:U}]),Q.current.secondLine=b}}else Q.current.series.setData([{time:w.time,value:w.price},{time:B,value:f}])},se=E=>{if(E&&(E.preventDefault(),E.stopPropagation()),!T.current||!Q.current||!S.current)return;const D=S.current,$=I.current||D;if(Q.current.type==="parallellines")if(Q.current.firstLine){const C={type:"parallellines",firstLine:Q.current.series,secondLine:Q.current.secondLine,firstLineData:Q.current.firstLine};He(B=>[...B,C]),x.current.push(C),De(null),Q.current=null,T.current=!1,S.current=null,I.current=null;return}else{Q.current.firstLine={startTime:D.time,startPrice:D.price,endTime:$.time,endPrice:$.price},T.current=!1,S.current=null,I.current=null;return}if(Q.current.type==="rectangle"){const C=S.current,B=I.current||C,f=Math.max(C.price,B.price),L=Math.min(C.price,B.price),w=te(Math.min(C.time,B.time)),p=te(Math.max(C.time,B.time));if(w!=null&&p!=null&&Math.abs(p-w)>=1&&Math.abs(f-L)>=1e-5){const _=Q.current.primitive,P=C.time<=B.time?C.rawTime:B.rawTime,U=C.time<=B.time?B.rawTime:C.rawTime,b={rawTime:P,normalizedTime:w,price:f},g={rawTime:U,normalizedTime:p,price:L};_.p1={rawTime:b.rawTime,price:b.price},_.p2={rawTime:g.rawTime,price:g.price};const M={type:"rectangle",primitive:_,p1:b,p2:g};He(k=>[...k,M]),x.current.push(M),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="circle"){const C=Q.current.primitive,B={rawTime:D.rawTime,normalizedTime:D.time,price:D.price},f={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=d.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=d.timeScale().timeToCoordinate(f.rawTime),_=u.priceToCoordinate(f.price);if((L!=null&&w!=null&&p!=null&&_!=null?Math.hypot(p-L,_-w):0)>=3){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:f.rawTime,price:f.price};const U={type:"circle",primitive:C,p1:B,p2:f};He(b=>[...b,U]),x.current.push(U),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="triangle"){const C=Q.current.primitive,B=R(D,$);if(B){const f=Math.abs(B.p3.normalizedTime-B.p2.normalizedTime),L=Math.abs(B.p1.price-B.p2.price);if(f>=1&&L>=1e-5){C.p1={rawTime:B.p1.rawTime,price:B.p1.price},C.p2={rawTime:B.p2.rawTime,price:B.p2.price},C.p3={rawTime:B.p3.rawTime,price:B.p3.price};const w={type:"triangle",primitive:C,p1:B.p1,p2:B.p2,p3:B.p3};He(p=>[...p,w]),x.current.push(w),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="ellipse"){const C=Q.current.primitive,B={rawTime:D.rawTime,normalizedTime:D.time,price:D.price},f={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=d.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=d.timeScale().timeToCoordinate(f.rawTime),_=u.priceToCoordinate(f.price);if((L!=null&&w!=null&&p!=null&&_!=null?Math.hypot(p-L,_-w):0)>=4){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:f.rawTime,price:f.price},C.previewAsLine=!1,C.minorRatio=.45;const U={type:"ellipse",primitive:C,p1:B,p2:f,minorRatio:.45};He(b=>[...b,U]),x.current.push(U),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}T.current=!1,S.current=null,I.current=null,Q.current=null};if(y==="rectangle"||y==="circle"||y==="triangle"||y==="ellipse"){const E={capture:!0,passive:!1},D=$=>{T.current||$.stopPropagation()};return O.addEventListener("mousedown",V,E),O.addEventListener("mousemove",X,E),O.addEventListener("mousemove",D,E),O.addEventListener("mouseup",se,E),()=>{if((Q.current?.type==="rectangle"||Q.current?.type==="circle"||Q.current?.type==="triangle"||Q.current?.type==="ellipse")&&Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null,T.current=!1,S.current=null,I.current=null,O.removeEventListener("mousedown",V,E),O.removeEventListener("mousemove",X,E),O.removeEventListener("mousemove",D,E),O.removeEventListener("mouseup",se,E)}}},[We,Ne,He,De]),Y.useEffect(()=>{const d=c.current,u=h.current,O=o.current,ce=We===null||We===1;if(!ce||!d||!u||!O){ce||(z(null),G([]),le(null),we([]));return}const y=10,R=8;function V(B){if(!B)return[];if(B.type==="trendline"&&B.point1&&B.point2){const f=d.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=d.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="gannline"&&B.point1&&B.point2){const f=d.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=d.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:(f+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="rectangle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(f==null||L==null||w==null||p==null)return[];const _=Math.min(f,w),P=Math.max(f,w),U=Math.min(L,p),b=Math.max(L,p),g=(_+P)/2,M=(U+b)/2;return[{x:_,y:U},{x:g,y:U},{x:P,y:U},{x:_,y:M},{x:P,y:M},{x:_,y:b},{x:g,y:b},{x:P,y:b}]}if(B.type==="circle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="triangle"&&B.p1&&B.p2&&B.p3){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price);return f==null||L==null||w==null||p==null||_==null||P==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P}]}if(B.type==="ellipse"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(f==null||L==null||w==null||p==null)return[];const _=(f+w)/2,P=(L+p)/2,U=w-f,b=p-L,g=Math.hypot(U,b);if(g<.001)return[];const M=U/g,k=b/g,K=-k,W=M,Z=g/2,Ae=Z*Math.max(.05,B.minorRatio??.45);return[{x:_-M*Z,y:P-k*Z},{x:_+K*Ae,y:P+W*Ae},{x:_+M*Z,y:P+k*Z},{x:_-K*Ae,y:P-W*Ae}]}if(B.type==="gannfan"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="ganngrid"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="arrowedline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="rayline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="extendedline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="crossline"&&B.p){const f=d.timeScale().timeToCoordinate(B.p.rawTime),L=u.priceToCoordinate(B.p.price);return f==null||L==null?[]:[{x:f,y:L}]}if(B.type==="pricelevel"&&B.price!=null){const f=u.priceToCoordinate(B.price);return f==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:f}]}if(B.type==="text"&&B.rawTime!=null&&B.price!=null){const f=d.timeScale().timeToCoordinate(B.rawTime),L=u.priceToCoordinate(B.price);return f==null||L==null?[]:[{x:f,y:L}]}if(B.type==="trendbyangle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="andrewspitchfork"&&B.p1&&B.p2&&B.p3){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price);return f==null||L==null||w==null||p==null||_==null||P==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P}]}if(B.type==="equidistantchannel"&&B.p1&&B.p2&&B.b1&&B.b2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.b1.rawTime),P=u.priceToCoordinate(B.b1.price),U=d.timeScale().timeToCoordinate(B.b2.rawTime),b=u.priceToCoordinate(B.b2.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:(_+U)/2,y:(P+b)/2}]}if(B.type==="regressionchannel"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="stddevchannel"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="disjointchannel"&&B.p1&&B.p2&&B.p3&&B.p4){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price),U=d.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P},{x:U,y:b}]}if(B.type==="flattopbottom"&&B.p1&&B.p2&&B.p3&&B.p4){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price),U=d.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P},{x:U,y:b}]}if(B.type==="infoline"&&B.p1&&B.p2){const f=B.p1.rawTime??B.p1.time,L=B.p2.rawTime??B.p2.time,w=d.timeScale().timeToCoordinate(f),p=u.priceToCoordinate(B.p1.price),_=d.timeScale().timeToCoordinate(L),P=u.priceToCoordinate(B.p2.price);return w==null||p==null||_==null||P==null?[]:[{x:w,y:p},{x:_,y:P}]}if(B.type==="rulerline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:(f+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="fibonacci"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="horizontalray"&&B.primitive){const f=B.primitive,L=d.timeScale().timeToCoordinate(f.originTime),w=u.priceToCoordinate(f.price);return L==null||w==null?[]:[{x:L,y:w}]}if(B.type==="verticalline"&&B.primitive){const f=B.primitive,L=d.timeScale().timeToCoordinate(f.time);if(L==null)return[];const w=f.midYCss??200;return[{x:L,y:w}]}return[]}function X(B,f){for(let L=dt.length-1;L>=0;L--){const w=dt[L];if(w.type==="trendline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),_=u.priceToCoordinate(w.point1.price),P=d.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),_=u.priceToCoordinate(w.point1.price),P=d.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.min(p,P),g=Math.max(p,P),M=Math.min(_,U),k=Math.max(_,U),K=(b+g)/2,W=(M+k)/2,Z=[{x:b,y:M,mode:"handle1"},{x:K,y:M,mode:"handle2"},{x:g,y:M,mode:"handle3"},{x:b,y:W,mode:"handle4"},{x:g,y:W,mode:"handle5"},{x:b,y:k,mode:"handle6"},{x:K,y:k,mode:"handle7"},{x:g,y:k,mode:"handle8"}];for(const Ue of Z)if(Math.hypot(B-Ue.x,f-Ue.y)<y)return{object:w,mode:Ue.mode};const Ae=ut(B,f,b,M,g,M),he=ut(B,f,b,k,g,k),Be=ut(B,f,b,M,b,k),Ce=ut(B,f,g,M,g,k);if(Ae<R||he<R||Be<R||Ce<R||vi(B,f,[{x:b,y:M},{x:g,y:M},{x:g,y:k},{x:b,y:k}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(P-p,U-_);if(b<2)continue;const g=Math.hypot(B-p,f-_),M=Math.hypot(B-P,f-U);if(g<y)return{object:w,mode:"handle1"};if(M<y)return{object:w,mode:"handle2"};if(Math.abs(g-b)<R||g<b)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price);if(p==null||_==null||P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const W=ut(B,f,p,_,P,U),Z=ut(B,f,P,U,b,g),Ae=ut(B,f,b,g,p,_);if(W<R||Z<R||Ae<R||vi(B,f,[{x:p,y:_},{x:P,y:U},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=P-p,k=U-_,K=Math.hypot(M,k);if(K<2)continue;const W=M/K,Z=k/K,Ae=-Z,he=W,Be=K/2,Ce=Be*Math.max(.05,w.minorRatio??.45);if(Be<2||Ce<2)continue;const Ue=b-W*Be,qe=g-Z*Be,rt=b+Ae*Ce,Xe=g+he*Ce,vt=b+W*Be,pt=g+Z*Be,Tt=b-Ae*Ce,_t=g-he*Ce,iA=Math.hypot(B-Ue,f-qe),cA=Math.hypot(B-rt,f-Xe),wA=Math.hypot(B-vt,f-pt),qA=Math.hypot(B-Tt,f-_t);if(iA<y)return{object:w,mode:"handle1"};if(cA<y)return{object:w,mode:"handle2"};if(wA<y)return{object:w,mode:"handle3"};if(qA<y)return{object:w,mode:"handle4"};const _i=(B-b)*W+(f-g)*Z,Zs=(B-b)*Ae+(f-g)*he,of=_i/Be,af=Zs/Ce,lf=of*of+af*af;if(Math.abs(lf-1)<.2||lf<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-P,f-U),g=Math.hypot(B-p,f-_);if(b<y)return{object:w,mode:"handle2"};if(g<y)return{object:w,mode:"handle1"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-P,f-U),g=Math.hypot(B-p,f-_);if(b<y)return{object:w,mode:"handle2"};if(g<y)return{object:w,mode:"handle1"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(tb(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(Ab(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const p=d.timeScale().timeToCoordinate(w.p.rawTime),_=u.priceToCoordinate(w.p.price);if(p==null||_==null)continue;if(Math.hypot(B-p,f-_)<y)return{object:w,mode:"handle1"};const U=Math.abs(f-_),b=Math.abs(B-p);if(U<R||b<R)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const p=d.timeScale().timeToCoordinate(w.rawTime),_=u.priceToCoordinate(w.price);if(p==null||_==null)continue;const P=Hd(w,p,_);if(B>=P.left&&B<=P.right&&f>=P.top&&f<=P.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.b1.rawTime),g=u.priceToCoordinate(w.b1.price),M=d.timeScale().timeToCoordinate(w.b2.rawTime),k=u.priceToCoordinate(w.b2.price),K=b!=null&&M!=null?(b+M)/2:null,W=g!=null&&k!=null?(g+k)/2:null;if(p==null||_==null||P==null||U==null||K==null||W==null||b==null||g==null||M==null||k==null)continue;const Z=Math.hypot(B-p,f-_),Ae=Math.hypot(B-P,f-U),he=Math.hypot(B-K,f-W),Be=Math.hypot(p-K,_-W)<y*1.5;if(Be&&Math.min(Z,he)<y*1.5)return{object:w,mode:"handle3"};if(he<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle2"};if(Be)continue;if(Z<y)return{object:w,mode:"handle1"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:P,y:U},{x:M,y:k},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),g=u.priceToCoordinate(w.top1.price),M=d.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=u.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=u.priceToCoordinate(w.bot2.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null||K==null||W==null||Z==null||Ae==null)continue;const he=Math.hypot(B-p,f-_),Be=Math.hypot(B-P,f-U);if(he<y)return{object:w,mode:"handle1"};if(Be<y)return{object:w,mode:"handle2"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k),qe=ut(B,f,K,W,Z,Ae);if(Ce<R||Ue<R||qe<R||vi(B,f,[{x:b,y:g},{x:M,y:k},{x:Z,y:Ae},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),g=u.priceToCoordinate(w.top1.price),M=d.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=u.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=u.priceToCoordinate(w.bot2.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null||K==null||W==null||Z==null||Ae==null)continue;const he=Math.hypot(B-p,f-_),Be=Math.hypot(B-P,f-U);if(he<y)return{object:w,mode:"handle1"};if(Be<y)return{object:w,mode:"handle2"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k),qe=ut(B,f,K,W,Z,Ae);if(Ce<R||Ue<R||qe<R||vi(B,f,[{x:b,y:g},{x:M,y:k},{x:Z,y:Ae},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price);if(p==null||_==null||P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const W=(P+b)/2,Z=(U+g)/2;let Ae=W-p,he=Z-_;Math.abs(Ae)<1e-4&&(Ae=1e-4);const Be=he/Ae,Ce=O.clientWidth,Ue=U+Be*(Ce-P),qe=g+Be*(Ce-b),rt=ut(B,f,P,U,Ce,Ue),Xe=ut(B,f,b,g,Ce,qe);if(rt<R||Xe<R||vi(B,f,[{x:P,y:U},{x:Ce,y:Ue},{x:Ce,y:qe},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price),M=d.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null)continue;const K=Math.hypot(B-p,f-_),W=Math.hypot(B-P,f-U),Z=Math.hypot(B-b,f-g),Ae=Math.hypot(B-M,f-k);if(K<y)return{object:w,mode:"handle1"};if(W<y)return{object:w,mode:"handle2"};if(Z<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle4"};const he=ut(B,f,p,_,b,g),Be=ut(B,f,P,U,M,k),Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(he<R||Be<R||Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:b,y:g},{x:M,y:k},{x:P,y:U}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price),M=d.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null)continue;const K=Math.hypot(B-p,f-_),W=Math.hypot(B-P,f-U),Z=Math.hypot(B-b,f-g),Ae=Math.hypot(B-M,f-k);if(K<y)return{object:w,mode:"handle1"};if(W<y)return{object:w,mode:"handle2"};if(Z<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle4"};const he=ut(B,f,p,_,b,g),Be=ut(B,f,P,U,M,k),Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(he<R||Be<R||Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:b,y:g},{x:M,y:k},{x:P,y:U}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const p=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,P=d.timeScale().timeToCoordinate(p),U=u.priceToCoordinate(w.p1.price),b=d.timeScale().timeToCoordinate(_),g=u.priceToCoordinate(w.p2.price);if(P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-P,f-U),k=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(ut(B,f,P,U,b,g)<R)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const p=w.primitive,_=d.timeScale().timeToCoordinate(p.originTime),P=u.priceToCoordinate(p.price);if(P==null)continue;if(_!=null&&Math.hypot(B-_,f-P)<y)return{object:w,mode:"handle1"};const U=_==null?0:Math.max(0,_);if(B>=U&&Math.abs(f-P)<R)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const p=w.primitive,_=d.timeScale().timeToCoordinate(p.time);if(_==null)continue;const P=p.midYCss??200;if(Math.hypot(B-_,f-P)<y)return{object:w,mode:"handle1"};if(Math.abs(B-_)<R)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const p=u.priceToCoordinate(w.price);if(p==null)continue;const P=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(B-P,f-p)<y)return{object:w,mode:"line"};if(Math.abs(f-p)<R)return{object:w,mode:"line"}}}return null}const se=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=X(L,w);if(p){if(B.preventDefault(),B.stopPropagation(),B.detail>=2){Qe.current=!0,q(p.object),j.current=null,oe.current=null;return}z(p.object),le(null),we([]),j.current=p.mode,p.object.type==="rayline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="extendedline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="crossline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,p:{...p.object.p}}),p.object.type==="text"&&p.mode==="line"&&(oe.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}),p.object.type==="trendbyangle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="equidistantchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="andrewspitchfork"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="regressionchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="stddevchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="disjointchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="flattopbottom"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="fibonacci"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="gannfan"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="ganngrid"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="rectangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4"||p.mode==="handle5"||p.mode==="handle6"||p.mode==="handle7"||p.mode==="handle8")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="circle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="triangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="ellipse"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}),p.object.type==="horizontalray"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}),p.object.type==="verticalline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,time:p.object.primitive.time}),p.mode==="line"&&(p.object.type==="rulerline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="infoline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="arrowedline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rayline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="extendedline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="crossline"?oe.current={x:L,y:w,p:{...p.object.p}}:p.object.type==="text"?oe.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}:p.object.type==="trendbyangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="equidistantchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="andrewspitchfork"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="regressionchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="stddevchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="disjointchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="flattopbottom"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="fibonacci"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="gannfan"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rectangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="circle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="triangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="ellipse"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}:p.object.type==="ganngrid"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="horizontalray"?oe.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}:p.object.type==="verticalline"?oe.current={x:L,y:w,time:p.object.primitive.time}:p.object.type==="pricelevel"?oe.current={y:w,price:p.object.price}:oe.current={x:L,y:w,point1:{...p.object.point1},point2:{...p.object.point2}})}else z(null),j.current=null,G([]),le(null),we([])},E=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top;if(!j.current){const b=X(L,w);if(b?.object&&!fe.current){const g=V(b.object);le(M=>M===b.object?M:b.object),we(M=>M.length===g.length&&M.every((k,K)=>k.x===g[K].x&&k.y===g[K].y)?M:g)}else le(g=>g==null?g:null),we(g=>g.length===0?g:[]);return}const p=fe.current;if(!p)return;const _=d.timeScale().coordinateToTime(L),P=u.coordinateToPrice(w);if(_==null||P==null)return;let U=te(_);if(U!=null){if(p.type==="infoline"&&p.p1&&p.p2){const b=K=>{const W=K.rawTime??K.time,Z=K.normalizedTime??te(W);return{rawTime:W,normalizedTime:Z,price:K.price}},g=(K,W)=>{const Z=K.normalizedTime??te(K.rawTime),Ae=W.normalizedTime??te(W.rawTime);if(Z==null||Ae==null)return;const he=W.price-K.price,Be=he/Math.abs(K.price)*100,Ce=BA(Te)||3600,Ue=Math.abs(Ae-Z),qe=Math.max(1,Math.round(Ue/Ce)),rt=Math.max(1,Math.round(Ue/86400)),Xe=d.timeScale().timeToCoordinate(K.rawTime),vt=u.priceToCoordinate(K.price),pt=d.timeScale().timeToCoordinate(W.rawTime),Tt=u.priceToCoordinate(W.price),_t=Xe!=null&&vt!=null&&pt!=null&&Tt!=null?Math.atan2(-(Tt-vt),pt-Xe)*(180/Math.PI):p.primitive?.info?.angle??0,iA={priceDiff:he,pricePct:Be,bars:qe,days:rt,angle:_t},cA=p.primitive;if(cA){cA.p1={rawTime:K.rawTime,price:K.price},cA.p2={rawTime:W.rawTime,price:W.price},cA.info=iA;try{c.current?.applyOptions({})}catch{}}const wA={...p,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:Z,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:Ae,price:W.price}};He(qA=>{const _i=qA.map(Zs=>Zs===p?wA:Zs);return x.current=_i,_i}),z(wA),fe.current=wA,Xe!=null&&vt!=null&&pt!=null&&Tt!=null&&G([{x:Xe,y:vt},{x:pt,y:Tt}])},M=b(p.p1),k=b(p.p2);if(M.rawTime==null||M.normalizedTime==null||k.rawTime==null||k.normalizedTime==null)return;if(j.current==="handle1"){const K=d.timeScale().coordinateToTime(L)??_;g({rawTime:K,normalizedTime:U,price:P},k)}else if(j.current==="handle2"){const K=d.timeScale().coordinateToTime(L)??_;g(M,{rawTime:K,normalizedTime:U,price:P})}else if(j.current==="line"){const K=oe.current;if(!K)return;const W=b(K.p1),Z=b(K.p2);if(W.rawTime==null||W.normalizedTime==null||Z.rawTime==null||Z.normalizedTime==null)return;const Ae=d.timeScale().coordinateToTime(K.x)??W.rawTime,he=u.coordinateToPrice(K.y);if(Ae==null||he==null)return;const Be=te(Ae)??W.normalizedTime;if(Be==null)return;const Ce=U-Be,Ue=P-he,qe=te(W.normalizedTime+Ce),rt=te(Z.normalizedTime+Ce);if(qe==null||rt==null)return;const Xe=_-Ae;g({rawTime:W.rawTime+Xe,normalizedTime:qe,price:W.price+Ue},{rawTime:Z.rawTime+Xe,normalizedTime:rt,price:Z.price+Ue})}return}if(p.type==="rulerline"&&p.p1&&p.p2){const b=(g,M)=>{const k=g.normalizedTime??g.rawTime,K=M.normalizedTime??M.rawTime,W=M.price-g.price,Z=W/Math.abs(g.price)*100,Ae=zs(Rs,g.rawTime,M.rawTime,Te),he=Math.abs(K-k),Be=Math.max(1,Math.round(he/86400)),Ce={priceDiff:W,pricePct:Z,bars:Ae,days:Be},Ue=p.primitive;if(Ue){Ue.p1={rawTime:g.rawTime,price:g.price},Ue.p2={rawTime:M.rawTime,price:M.price},Ue.info=Ce;const Tt=M.price>=g.price;Ue.color=Tt?"#3b82f6":"#ef5350",Ue.fillColor=Tt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const qe={...p,rawP1Time:g.rawTime,rawP2Time:M.rawTime,p1:g,p2:M};He(Tt=>{const _t=Tt.map(iA=>iA===p?qe:iA);return x.current=_t,_t}),z(qe),fe.current=qe;const rt=d.timeScale().timeToCoordinate(g.rawTime),Xe=u.priceToCoordinate(g.price),vt=d.timeScale().timeToCoordinate(M.rawTime),pt=u.priceToCoordinate(M.price);rt!=null&&Xe!=null&&vt!=null&&pt!=null&&G([{x:rt,y:Xe},{x:(rt+vt)/2,y:(Xe+pt)/2},{x:vt,y:pt}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="arrowedline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="rayline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;b(p.p1,{rawTime:g,normalizedTime:M,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="extendedline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="crossline"&&p.p){const b=M=>{const k=p.primitive;if(k){k.center={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p:M};He(Ae=>{const he=Ae.map(Be=>Be===p?K:Be);return x.current=he,he}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(M.rawTime),Z=u.priceToCoordinate(M.price);W!=null&&Z!=null&&G([{x:W,y:Z}])},g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P});return}if(p.type==="pricelevel"&&p.price!=null){const b=u.coordinateToPrice(w);if(b==null)return;try{p.priceLine.applyOptions({price:b,title:b.toFixed(5)})}catch{}p.textPrimitive&&(p.textPrimitive.price=b);const g=c.current?c.current.paneSize().width:400,M=u.priceToCoordinate(b);M!=null&&G([{x:g/2,y:M}]);const k={...p,price:b};He(K=>{const W=K.map(Z=>Z===p?k:Z);return x.current=W,W}),z(k),fe.current=k;return}if(p.type==="text"){const b=d.timeScale().coordinateToTime(L);if(b==null)return;const g=p.primitive;if(g){g.rawTime=b,g.price=P;try{c.current?.applyOptions({})}catch{}}const M={...p,rawTime:b,price:P};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M;return}if(p.type==="trendbyangle"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"||j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="equidistantchannel"&&p.p1&&p.p2&&p.p3){const b=(g,M,k)=>{const K=Od(g,M,k);if(!K)return;const W=p.primitive;if(W){W.p1={rawTime:g.rawTime,price:g.price},W.p2={rawTime:M.rawTime,price:M.price},W.b1={rawTime:K.b1.rawTime,price:K.b1.price},W.b2={rawTime:K.b2.rawTime,price:K.b2.price},W.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const Z={...p,p1:g,p2:M,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};He(Ae=>{const he=Ae.map(Be=>Be===p?Z:Be);return x.current=he,he}),z(Z),fe.current=Z};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2,p.p3);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??te(p.p3.rawTime),price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K),he=te(g.p3.normalizedTime+K);if(Z==null||Ae==null||he==null)return;const Be=_-M;b({rawTime:g.p1.rawTime+Be,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+Be,normalizedTime:Ae,price:g.p2.price+W},{rawTime:g.p3.rawTime+Be,price:g.p3.price+W});return}}if(p.type==="regressionchannel"&&p.p1&&p.p2){const b=(g,M)=>{const k=Jr(Ne,g,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,intercept:k.intercept,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U},p.p2);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W});return}}if(p.type==="stddevchannel"&&p.p1&&p.p2){const b=(g,M)=>{const k=Zr(Ne,g,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W});return}}if(p.type==="andrewspitchfork"&&p.p1&&p.p2&&p.p3){const b=(g,M,k)=>{const K=p.primitive;if(K){K.p1={rawTime:g.rawTime,price:g.price},K.p2={rawTime:M.rawTime,price:M.price},K.p3={rawTime:k.rawTime,price:k.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:g,p2:M,p3:k};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2,p.p3);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P},p.p3);return}if(j.current==="handle3"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,p.p2,{rawTime:g,normalizedTime:U,price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K),he=te(g.p3.normalizedTime+K);if(Z==null||Ae==null||he==null)return;const Be=_-M;b({rawTime:g.p1.rawTime+Be,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+Be,normalizedTime:Ae,price:g.p2.price+W},{rawTime:g.p3.rawTime+Be,normalizedTime:he,price:g.p3.price+W});return}}if(p.type==="disjointchannel"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,Z,Ae,he)=>{const Be=p.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:Ae.rawTime,price:Ae.price},Be.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const Ce={...p,p1:W,p2:Z,p3:Ae,p4:he};He(Ue=>{const qe=Ue.map(rt=>rt===p?Ce:rt);return x.current=qe,qe}),z(Ce),fe.current=Ce},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(W,Z,Ae,he)=>{const Be=W.normalizedTime??te(W.rawTime);if(Be==null)return null;const Ce=te(Be+Ae);return Ce==null?null:{rawTime:W.rawTime+Z,normalizedTime:Ce,price:W.price+he}};if(j.current==="line"){const W=d.timeScale().coordinateToTime(g.x),Z=u.coordinateToPrice(g.y);if(W==null||Z==null)return;const Ae=te(W);if(Ae==null)return;const he=M-W,Be=k-Ae,Ce=P-Z,Ue=K(g.p1,he,Be,Ce),qe=K(g.p2,he,Be,Ce),rt=K(g.p3,he,Be,Ce),Xe=K(g.p4,he,Be,Ce);if(!Ue||!qe||!rt||!Xe)return;b(Ue,qe,rt,Xe);return}if(j.current==="handle1"){const W=(g.p1.price+g.p2.price)/2,Z={rawTime:M,normalizedTime:k,price:P},Ae={rawTime:M,normalizedTime:k,price:2*W-P};b(Z,Ae,g.p3,g.p4);return}if(j.current==="handle3"){const W=(g.p3.price+g.p4.price)/2,Z={rawTime:M,normalizedTime:k,price:P},Ae={rawTime:M,normalizedTime:k,price:2*W-P};b(g.p1,g.p2,Z,Ae);return}if(j.current==="handle2"){const W=(g.p1.price+g.p2.price)/2,Z={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:P};if(Z.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:2*W-P};if(Ae.normalizedTime==null)return;b(Ae,Z,g.p3,g.p4);return}if(j.current==="handle4"){const W=P-g.p4.price,Z={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+W};if(Z.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+W};if(Ae.normalizedTime==null)return;b(g.p1,Ae,g.p3,Z);return}}if(p.type==="flattopbottom"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,Z,Ae,he)=>{const Be=p.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:Ae.rawTime,price:Ae.price},Be.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const Ce={...p,p1:W,p2:Z,p3:Ae,p4:he};He(Ue=>{const qe=Ue.map(rt=>rt===p?Ce:rt);return x.current=qe,qe}),z(Ce),fe.current=Ce},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(W,Z,Ae,he)=>{const Be=W.normalizedTime??te(W.rawTime);if(Be==null)return null;const Ce=te(Be+Ae);return Ce==null?null:{rawTime:W.rawTime+Z,normalizedTime:Ce,price:W.price+he}};if(j.current==="line"){const W=d.timeScale().coordinateToTime(g.x),Z=u.coordinateToPrice(g.y);if(W==null||Z==null)return;const Ae=te(W);if(Ae==null)return;const he=M-W,Be=k-Ae,Ce=P-Z,Ue=K(g.p1,he,Be,Ce),qe=K(g.p2,he,Be,Ce),rt=K(g.p3,he,Be,Ce),Xe=K(g.p4,he,Be,Ce);if(!Ue||!qe||!rt||!Xe)return;b(Ue,qe,rt,Xe);return}if(j.current==="handle1"){const W={rawTime:M,normalizedTime:k,price:P},Z={rawTime:M,normalizedTime:k,price:g.p2.price};b(W,Z,g.p3,g.p4);return}if(j.current==="handle3"){const W={rawTime:M,normalizedTime:k,price:P},Z={rawTime:M,normalizedTime:k,price:g.p4.price};b(g.p1,g.p2,W,Z);return}if(j.current==="handle2"||j.current==="handle4"){const W=j.current==="handle2"?g.p2:g.p4,Z=P-W.price,Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+Z},he={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+Z};if(Ae.normalizedTime==null||he.normalizedTime==null)return;b(g.p1,Ae,g.p3,he);return}}if(p.type==="fibonacci"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="rectangle"&&p.p1&&p.p2){const b=(pt,Tt)=>{const _t=p.primitive;if(_t){_t.p1={rawTime:pt.rawTime,price:pt.price},_t.p2={rawTime:Tt.rawTime,price:Tt.price};try{c.current?.applyOptions({})}catch{}}const iA={...p,p1:pt,p2:Tt};He(cA=>{const wA=cA.map(qA=>qA===p?iA:qA);return x.current=wA,wA}),z(iA),fe.current=iA},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const pt=d.timeScale().coordinateToTime(g.x),Tt=u.coordinateToPrice(g.y);if(pt==null||Tt==null)return;const _t=te(pt);if(_t==null)return;const iA=k-_t,cA=P-Tt,wA=te(g.p1.normalizedTime+iA),qA=te(g.p2.normalizedTime+iA);if(wA==null||qA==null)return;const _i=_-pt;b({rawTime:g.p1.rawTime+_i,normalizedTime:wA,price:g.p1.price+cA},{rawTime:g.p2.rawTime+_i,normalizedTime:qA,price:g.p2.price+cA});return}const K=Math.min(g.p1.normalizedTime,g.p2.normalizedTime),W=Math.max(g.p1.normalizedTime,g.p2.normalizedTime),Z=Math.max(g.p1.price,g.p2.price),Ae=Math.min(g.p1.price,g.p2.price),he=g.p1.normalizedTime<=g.p2.normalizedTime?g.p1.rawTime:g.p2.rawTime,Be=g.p1.normalizedTime<=g.p2.normalizedTime?g.p2.rawTime:g.p1.rawTime;let Ce=K,Ue=W,qe=Z,rt=Ae,Xe=he,vt=Be;if((j.current==="handle1"||j.current==="handle4"||j.current==="handle6")&&(Ce=k,Xe=M),(j.current==="handle3"||j.current==="handle5"||j.current==="handle8")&&(Ue=k,vt=M),(j.current==="handle1"||j.current==="handle2"||j.current==="handle3")&&(qe=P),(j.current==="handle6"||j.current==="handle7"||j.current==="handle8")&&(rt=P),Ce>Ue){const pt=Ce,Tt=Xe;Ce=Ue,Xe=vt,Ue=pt,vt=Tt}if(qe<rt){const pt=qe;qe=rt,rt=pt}b({rawTime:Xe,normalizedTime:Ce,price:qe},{rawTime:vt,normalizedTime:Ue,price:rt});return}if(p.type==="circle"&&p.p1&&p.p2){const b=(qe,rt)=>{const Xe=p.primitive;if(Xe){Xe.p1={rawTime:qe.rawTime,price:qe.price},Xe.p2={rawTime:rt.rawTime,price:rt.price};try{c.current?.applyOptions({})}catch{}}const vt={...p,p1:qe,p2:rt};He(pt=>{const Tt=pt.map(_t=>_t===p?vt:_t);return x.current=Tt,Tt}),z(vt),fe.current=vt},g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;if(j.current==="handle2"){b(p.p1,{rawTime:g,normalizedTime:M,price:P});return}const k=oe.current;if(!k)return;const K=d.timeScale().coordinateToTime(k.x),W=u.coordinateToPrice(k.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=M-Z,he=P-W,Be=te(k.p1.normalizedTime+Ae),Ce=te(k.p2.normalizedTime+Ae);if(Be==null||Ce==null)return;const Ue=_-K;b({rawTime:k.p1.rawTime+Ue,normalizedTime:Be,price:k.p1.price+he},{rawTime:k.p2.rawTime+Ue,normalizedTime:Ce,price:k.p2.price+he});return}if(p.type==="triangle"&&p.p1&&p.p2&&p.p3){const b=(Xe,vt,pt)=>{const Tt=p.primitive;if(Tt){Tt.p1={rawTime:Xe.rawTime,price:Xe.price},Tt.p2={rawTime:vt.rawTime,price:vt.price},Tt.p3={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const _t={...p,p1:Xe,p2:vt,p3:pt};He(iA=>{const cA=iA.map(wA=>wA===p?_t:wA);return x.current=cA,cA}),z(_t),fe.current=_t},g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;if(j.current==="handle1"){b({rawTime:g,normalizedTime:M,price:P},p.p2,p.p3);return}if(j.current==="handle2"){b(p.p1,{rawTime:g,normalizedTime:M,price:P},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:g,normalizedTime:M,price:P});return}const k=oe.current;if(!k)return;const K=d.timeScale().coordinateToTime(k.x),W=u.coordinateToPrice(k.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=M-Z,he=P-W,Be=_-K,Ce=Xe=>{const vt=Xe.normalizedTime??te(Xe.rawTime);if(vt==null)return null;const pt=te(vt+Ae);return pt==null?null:{rawTime:Xe.rawTime+Be,normalizedTime:pt,price:Xe.price+he}},Ue=Ce(k.p1),qe=Ce(k.p2),rt=Ce(k.p3);if(!Ue||!qe||!rt)return;b(Ue,qe,rt);return}if(p.type==="ellipse"&&p.p1&&p.p2){const b=(K,W,Z=p.minorRatio??.45)=>{const Ae=p.primitive;if(Ae){Ae.p1={rawTime:K.rawTime,price:K.price},Ae.p2={rawTime:W.rawTime,price:W.price},Ae.minorRatio=Math.max(.05,Z);try{c.current?.applyOptions({})}catch{}}const he={...p,p1:K,p2:W,minorRatio:Math.max(.05,Z)};He(Be=>{const Ce=Be.map(Ue=>Ue===p?he:Ue);return x.current=Ce,Ce}),z(he),fe.current=he},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const K=d.timeScale().coordinateToTime(g.x),W=u.coordinateToPrice(g.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=k-Z,he=P-W,Be=te(g.p1.normalizedTime+Ae),Ce=te(g.p2.normalizedTime+Ae);if(Be==null||Ce==null)return;const Ue=_-K;b({rawTime:g.p1.rawTime+Ue,normalizedTime:Be,price:g.p1.price+he},{rawTime:g.p2.rawTime+Ue,normalizedTime:Ce,price:g.p2.price+he},g.minorRatio??p.minorRatio??.45);return}if(j.current==="handle1"){b({rawTime:M,normalizedTime:k,price:P},p.p2,p.minorRatio??.45);return}if(j.current==="handle3"){b(p.p1,{rawTime:M,normalizedTime:k,price:P},p.minorRatio??.45);return}if(j.current==="handle2"||j.current==="handle4"){const K=d.timeScale().timeToCoordinate(p.p1.rawTime),W=u.priceToCoordinate(p.p1.price),Z=d.timeScale().timeToCoordinate(p.p2.rawTime),Ae=u.priceToCoordinate(p.p2.price);if(K==null||W==null||Z==null||Ae==null)return;const he=(K+Z)/2,Be=(W+Ae)/2,Ce=Z-K,Ue=Ae-W,qe=Math.hypot(Ce,Ue);if(qe<.001)return;const rt=-Ue/qe,Xe=Ce/qe,vt=Math.abs((L-he)*rt+(w-Be)*Xe),pt=Math.max(.05,vt*2/qe);b(p.p1,p.p2,pt);return}return}if(p.type==="gannfan"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="ganngrid"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="verticalline"&&p.primitive){const b=p.primitive;b.time=_;const g={...p,time:te(_),rawTime:_};He(k=>{const K=k.map(W=>W===p?g:W);return x.current=K,K}),z(g),fe.current=g;const M=d.timeScale().timeToCoordinate(_);M!=null&&G([{x:M,y:b.midYCss??200}]),c.current?.applyOptions({});return}if(p.type==="horizontalray"&&p.primitive){const b=p.primitive,g=oe.current;if(!g)return;if(j.current==="handle1"){if(b.price=P,b.originTime=_,p.priceLine)try{p.priceLine.applyOptions({price:P,title:p.showPrice!==!1?P.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=P,p.textPrimitive.originTime=_);const M={...p,price:b.price,originTime:b.originTime,rawOriginTime:_};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M,c.current?.applyOptions({})}else if(j.current==="line"){const M=u.coordinateToPrice(g.y);if(M==null)return;const k=P-M;if(b.price=g.price+k,p.priceLine)try{p.priceLine.applyOptions({price:b.price,title:p.showPrice!==!1?b.price.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=b.price);const K={...p,price:b.price};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K,c.current?.applyOptions({})}return}if(!(p.type!=="trendline"&&p.type!=="gannline")&&!(!p.point1||!p.point2)){if(j.current==="handle1"){const b={time:U,price:P},g=DA([{time:b.time,value:b.price},{time:p.point2.time,value:p.point2.price}]);g.length>0&&p.series.setData(g),p.decoration&&(p.decoration.p1=b);const M={...p,point1:b};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M}else if(j.current==="handle2"){const b={time:U,price:P},g=DA([{time:p.point1.time,value:p.point1.price},{time:b.time,value:b.price}]);g.length>0&&p.series.setData(g),p.decoration&&(p.decoration.p2=b);const M={...p,point2:b};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M}else if(j.current==="line"){const b=oe.current;if(!b)return;const g=d.timeScale().coordinateToTime(b.x),M=u.coordinateToPrice(b.y);if(g==null||M==null)return;const k=U-g,K=P-M,W={time:te(b.point1.time+k),price:b.point1.price+K},Z={time:te(b.point2.time+k),price:b.point2.price+K},Ae=DA([{time:W.time,value:W.price},{time:Z.time,value:Z.price}]);Ae.length>0&&p.series.setData(Ae),p.decoration&&(p.decoration.p1=W,p.decoration.p2=Z);const he={...p,point1:W,point2:Z};He(Be=>{const Ce=Be.map(Ue=>Ue===p?he:Ue);return x.current=Ce,Ce}),z(he),fe.current=he}}}},D=()=>{j.current=null,oe.current=null},$=()=>{j.current||fe.current||(le(null),we([]))},C={capture:!0,passive:!1};return O.addEventListener("mousedown",se,C),O.addEventListener("mousemove",E,C),O.addEventListener("mouseup",D,C),O.addEventListener("mouseleave",$,C),()=>{O.removeEventListener("mousedown",se,C),O.removeEventListener("mousemove",E,C),O.removeEventListener("mouseup",D,C),O.removeEventListener("mouseleave",$,C)}},[We,Ne,dt,He]),Y.useEffect(()=>{const d=c.current,u=h.current;if(!d||!u)return;const O=()=>{const y=H;if(!y){G([]);return}const R=d.timeScale();if(y.type==="infoline"&&y.p1&&y.p2){const V=y.p1.rawTime??y.p1.time,X=y.p2.rawTime??y.p2.time,se=R.timeToCoordinate(V),E=u.priceToCoordinate(y.p1.price),D=R.timeToCoordinate(X),$=u.priceToCoordinate(y.p2.price);se!=null&&E!=null&&D!=null&&$!=null?G([{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="rulerline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:(V+se)/2,y:(X+E)/2},{x:se,y:E}]):G([]);return}if(y.type==="arrowedline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="rayline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="extendedline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="crossline"&&y.p){const V=R.timeToCoordinate(y.p.rawTime),X=u.priceToCoordinate(y.p.price);V!=null&&X!=null?G([{x:V,y:X}]):G([]);return}if(y.type==="text"&&y.rawTime!=null&&y.price!=null){const V=R.timeToCoordinate(y.rawTime),X=u.priceToCoordinate(y.price);V!=null&&X!=null?G([{x:V,y:X}]):G([]);return}if(y.type==="trendbyangle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="equidistantchannel"&&y.p1&&y.p2&&y.b1&&y.b2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.b1.rawTime),$=u.priceToCoordinate(y.b1.price),C=R.timeToCoordinate(y.b2.rawTime),B=u.priceToCoordinate(y.b2.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:(D+C)/2,y:($+B)/2}]):G([]);return}if(y.type==="regressionchannel"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="stddevchannel"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="andrewspitchfork"&&y.p1&&y.p2&&y.p3){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="disjointchannel"&&y.p1&&y.p2&&y.p3&&y.p4){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=R.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$},{x:C,y:B}]):G([]);return}if(y.type==="flattopbottom"&&y.p1&&y.p2&&y.p3&&y.p4){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=R.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$},{x:C,y:B}]):G([]);return}if(y.type==="fibonacci"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="trendline"&&y.point1&&y.point2){const V=R.timeToCoordinate(y.point1.time),X=u.priceToCoordinate(y.point1.price),se=R.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="gannline"&&y.point1&&y.point2){const V=R.timeToCoordinate(y.point1.time),X=u.priceToCoordinate(y.point1.price),se=R.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:(V+se)/2,y:(X+E)/2},{x:se,y:E}]):G([]);return}if(y.type==="rectangle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(V!=null&&X!=null&&se!=null&&E!=null){const D=Math.min(V,se),$=Math.max(V,se),C=Math.min(X,E),B=Math.max(X,E),f=(D+$)/2,L=(C+B)/2;G([{x:D,y:C},{x:f,y:C},{x:$,y:C},{x:D,y:L},{x:$,y:L},{x:D,y:B},{x:f,y:B},{x:$,y:B}])}else G([]);return}if(y.type==="circle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="triangle"&&y.p1&&y.p2&&y.p3){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="ellipse"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(V!=null&&X!=null&&se!=null&&E!=null){const D=(V+se)/2,$=(X+E)/2,C=se-V,B=E-X,f=Math.hypot(C,B);if(f<.001){G([]);return}const L=C/f,w=B/f,p=-w,_=L,P=f/2,U=P*Math.max(.05,y.minorRatio??.45);G([{x:D-L*P,y:$-w*P},{x:D+p*U,y:$+_*U},{x:D+L*P,y:$+w*P},{x:D-p*U,y:$-_*U}])}else G([]);return}if(y.type==="gannfan"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="ganngrid"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="horizontalray"&&y.primitive){const V=y.primitive,X=R.timeToCoordinate(V.originTime),se=u.priceToCoordinate(V.price);X!=null&&se!=null?G([{x:X,y:se}]):G([]);return}if(y.type==="verticalline"&&y.primitive){const V=y.primitive,X=R.timeToCoordinate(V.time);if(X!=null){const se=V.midYCss??200;G([{x:X,y:se}])}else G([]);return}if(y.type==="pricelevel"&&y.priceLine){const V=h.current?.priceToCoordinate(y.price);if(V!=null){const X=c.current?c.current.paneSize().width:400;G([{x:X/2,y:V}])}else G([]);return}G([])};O();const ce=d.timeScale();return ce.subscribeVisibleTimeRangeChange(O),()=>{ce.unsubscribeVisibleTimeRangeChange(O)}},[H]),Y.useEffect(()=>{let d=!1;x.current.forEach(u=>{if(u.type==="verticalline"&&u.primitive){const O=u===H||u===ne;u.primitive.showDot!==O&&(u.primitive.showDot=O,d=!0)}}),d&&c.current?.applyOptions({})},[H,ne]),Y.useEffect(()=>{let d=!1;x.current.forEach(u=>{if((u.type==="infoline"||u.type==="rulerline"||u.type==="arrowedline"||u.type==="rayline"||u.type==="extendedline"||u.type==="trendbyangle")&&u.primitive){const O=u===H||u===ne;u.primitive.isActive!==O&&(u.primitive.isActive=O,d=!0)}}),d&&c.current?.applyOptions({})},[H,ne]),Y.useEffect(()=>{!c.current||!h.current||x.current.forEach(d=>{if(d.series&&d.series.applyOptions({visible:ve}),d.priceLine){const u=ve&&d.showPrice!==!1;d.priceLine.applyOptions(ve?{color:d.lineColor??"#3b82f6",axisLabelVisible:u,title:u&&typeof d.price=="number"?d.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(d.type==="fibonacci"&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}if(d.type==="rectangle"&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}if(d.type==="parallellines"&&(d.baseLine&&d.baseLine.applyOptions({visible:ve}),d.parallelLine&&d.parallelLine.applyOptions({visible:ve}),d.firstLine&&d.firstLine.applyOptions({visible:ve}),d.secondLine&&d.secondLine.applyOptions({visible:ve})),(d.type==="horizontalray"||d.type==="verticalline"||d.type==="infoline"||d.type==="rulerline"||d.type==="arrowedline"||d.type==="rayline"||d.type==="extendedline"||d.type==="crossline"||d.type==="trendbyangle"||d.type==="equidistantchannel"||d.type==="regressionchannel"||d.type==="stddevchannel"||d.type==="gannfan"||d.type==="ganngrid"||d.type==="andrewspitchfork"||d.type==="disjointchannel"||d.type==="flattopbottom"||d.type==="circle"||d.type==="triangle"||d.type==="ellipse"||d.type==="text")&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}})},[ve,dt]),Y.useEffect(()=>{!ve&&H&&(z(null),G([]))},[ve,H]),Y.useEffect(()=>{if(x.current.length>dt.length){const d=x.current.filter((u,O)=>!dt.includes(u));H&&d.some(u=>u===H)&&(z(null),G([])),d.forEach(u=>{if(u.series&&c.current?.removeSeries(u.series),u.priceLine&&h.current?.removePriceLine(u.priceLine),u.textPrimitive)try{h.current?.detachPrimitive(u.textPrimitive)}catch{}if(u.type==="horizontalray"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="verticalline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="infoline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rulerline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="arrowedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rayline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="extendedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="crossline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="trendbyangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="equidistantchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="regressionchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="stddevchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="gannfan"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ganngrid"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="andrewspitchfork"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="disjointchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="flattopbottom"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="fibonacci"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rectangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="circle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="triangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ellipse"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="text"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="parallellines")try{u.baseLine&&c.current?.removeSeries(u.baseLine),u.parallelLine&&c.current?.removeSeries(u.parallelLine),u.firstLine&&c.current?.removeSeries(u.firstLine),u.secondLine&&c.current?.removeSeries(u.secondLine)}catch{}}),x.current=dt,Xs()}},[dt,H,Xs]),Y.useEffect(()=>{const d=h.current;return d?(At.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),At.current=[],zt.filter(O=>O.symbol===ye).forEach(O=>{const ce=parseFloat(O.openPrice??O.price),R=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(wt&&!isNaN(ce)&&At.current.push(d.createPriceLine({price:ce,color:R,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume}`})),ZA){const V=parseFloat(O.stopLoss),X=parseFloat(O.takeProfit);!isNaN(V)&&V>0&&At.current.push(d.createPriceLine({price:V,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(X)&&X>0&&At.current.push(d.createPriceLine({price:X,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{At.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),At.current=[]}):void 0},[zt,ye,wt,ZA]),Y.useEffect(()=>{const d=h.current;if(!d||!aA)return;const u=parseFloat(Zt?.ask);if(isNaN(u)||u<=0)return;let O;try{O=d.createPriceLine({price:u,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(O)try{d.removePriceLine(O)}catch{}}},[aA,Zt]),Y.useEffect(()=>{const d=o.current;if(!d)return;const u=O=>{if(Qe.current){Qe.current=!1;return}if(T.current||!c.current)return;const ce=c.current,y=h.current;if(ce&&y&&x.current.length>0){const R=d.getBoundingClientRect(),V=O.clientX-R.left,X=O.clientY-R.top,se=15;for(let E=x.current.length-1;E>=0;E--){const D=x.current[E];let $=!1;if(D.type==="text"&&D.rawTime!=null&&D.price!=null){const C=ce.timeScale().timeToCoordinate(D.rawTime),B=y.priceToCoordinate(D.price);if(C!=null&&B!=null){const f=Hd(D,C,B);V>=f.left&&V<=f.right&&X>=f.top&&X<=f.bottom&&($=!0)}}else if(D.point1&&D.point2){const C=ce.timeScale().timeToCoordinate(D.point1.time??D.point1.rawTime),B=y.priceToCoordinate(D.point1.price),f=ce.timeScale().timeToCoordinate(D.point2.time??D.point2.rawTime),L=y.priceToCoordinate(D.point2.price);if(C!=null&&B!=null&&f!=null&&L!=null){const w=Math.hypot(V-C,X-B),p=Math.hypot(V-f,X-L),_=(C+f)/2,P=(B+L)/2,U=Math.hypot(V-_,X-P);(w<se||p<se||U<se)&&($=!0)}}else if(D.p1&&D.p2){const C=ce.timeScale().timeToCoordinate(D.p1.rawTime),B=y.priceToCoordinate(D.p1.price),f=ce.timeScale().timeToCoordinate(D.p2.rawTime),L=y.priceToCoordinate(D.p2.price);if(C!=null&&B!=null&&f!=null&&L!=null){const w=Math.min(C,f),p=Math.max(C,f),_=Math.min(B,L),P=Math.max(B,L);V>=w-5&&V<=p+5&&X>=_-5&&X<=P+5&&($=!0)}}else if(D.p){const C=ce.timeScale().timeToCoordinate(D.p.rawTime),B=y.priceToCoordinate(D.p.price);C!=null&&B!=null&&Math.hypot(V-C,X-B)<se&&($=!0)}else if(D.type==="pricelevel"&&D.price!=null){const C=y.priceToCoordinate(D.price);C!=null&&Math.abs(X-C)<se&&($=!0)}if($){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),q(D);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;kd(c.current,Ne,Te)||c.current.timeScale().fitContent();const V=c.current.timeScale().getVisibleRange();Ie(V)},80)};return d.addEventListener("dblclick",u,!0),()=>{d.removeEventListener("dblclick",u,!0)}},[Ne,Te]);const qd=H??ne,jd=H?ie:ee,kb=ve&&nb(qd,jd),Ob=sb(qd?.type);Y.useEffect(()=>{const d=o.current,u=l.current;if(!d||!u)return;const O=80,ce=R=>{const V=d.getBoundingClientRect();u.style.opacity=V.bottom-R.clientY<=O?"1":"0"},y=()=>{u.style.opacity="0"};return d.addEventListener("mousemove",ce),d.addEventListener("mouseleave",y),()=>{d.removeEventListener("mousemove",ce),d.removeEventListener("mouseleave",y)}},[]);const Nb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*.8;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},[Ie]),Kb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*1.25;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},[Ie]),zb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{d.setVisibleLogicalRange({from:u.from-O,to:u.to-O})}catch{}},[]),Vb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{d.setVisibleLogicalRange({from:u.from+O,to:u.to+O})}catch{}},[]),Wb=Y.useCallback(()=>{if(!c.current)return;kd(c.current,Ne,Te)||c.current.timeScale().fitContent();const u=c.current.timeScale().getVisibleRange();Ie(u)},[Ne,Te,Ie]),ef=Vt?.id??null,tf=Vt?.takeProfit??null,Af=Vt?.stopLoss??null,vl=Vt?.type??null,rf=Vt?.volume??null,Tl=Vt?.symbol??null,nf=Vt?.price||Vt?.openPrice||null;Y.useEffect(()=>{const d=h.current;if(!d)return;const u=ge.current;if(["tp","sl","entry"].forEach(se=>{if(u[se]){try{d.removePriceLine(u[se])}catch{}u[se]=null}}),!ef)return;const O=typeof ye=="object"?ye?.symbol:ye;if(Tl!==O)return;const ce=parseFloat(nf),y=parseFloat(tf),R=parseFloat(Af),V=vl==="BUY";Number.isFinite(ce)&&ce>0&&(u.entry=d.createPriceLine({price:ce,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`${vl} ${rf} @ ${ce}`}));const X=Tl?.includes("JPY")?.01:1e-4;if(Number.isFinite(y)&&y>0&&Number.isFinite(ce)&&ce>0){const se=V?((y-ce)*(1/X)*10).toFixed(0):((ce-y)*(1/X)*10).toFixed(0);u.tp=d.createPriceLine({price:y,color:"#26A69A",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`TP, ${se} pts`})}if(Number.isFinite(R)&&R>0&&Number.isFinite(ce)&&ce>0){const se=V?((ce-R)*(1/X)*10).toFixed(0):((R-ce)*(1/X)*10).toFixed(0);u.sl=d.createPriceLine({price:R,color:"#EF5350",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`SL, ${se} pts`})}return()=>{["tp","sl","entry"].forEach(se=>{if(u[se]){try{d.removePriceLine(u[se])}catch{}u[se]=null}})}},[ef,tf,Af,vl,rf,Tl,nf,ye]);const Js=Y.useRef(Vt);Js.current=Vt;const sf=Y.useRef(je);return sf.current=je,Y.useEffect(()=>{const u=V=>{const X=h.current;if(!X)return null;const se=ge.current[V];if(!se)return null;const E=se.options();return!E||!Number.isFinite(E.price)?null:X.priceToCoordinate(E.price)},O=V=>{const X=o.current,se=c.current;if(!X||!se||!Js.current)return;const E=X.getBoundingClientRect(),D=V.clientY-E.top,$=u("tp"),C=u("sl");$!==null&&Math.abs(D-$)<20?(ae.current="tp",pe.current=D,ue.current=ge.current.tp.options().price,V.preventDefault(),V.stopImmediatePropagation(),X.style.cursor="ns-resize",se.applyOptions({handleScroll:!1,handleScale:!1})):C!==null&&Math.abs(D-C)<20&&(ae.current="sl",pe.current=D,ue.current=ge.current.sl.options().price,V.preventDefault(),V.stopImmediatePropagation(),X.style.cursor="ns-resize",se.applyOptions({handleScroll:!1,handleScale:!1}))},ce=V=>{const X=o.current,se=h.current;if(!X)return;const E=ae.current;if(!E){if(!Js.current)return;const _=X.getBoundingClientRect(),P=V.clientY-_.top,U=u("tp"),b=u("sl"),g=U!==null&&Math.abs(P-U)<20,M=b!==null&&Math.abs(P-b)<20;X.style.cursor=g||M?"ns-resize":"";return}if(!se)return;const D=X.getBoundingClientRect(),$=V.clientY-D.top,C=se.coordinateToPrice($);if(!Number.isFinite(C)||C<=0)return;const B=ge.current[E];if(!B)return;const f=Js.current;if(!f)return;const L=parseFloat(f.price||f.openPrice),w=f.type==="BUY",p=E==="tp"?w?((C-L)*1e5).toFixed(0):((L-C)*1e5).toFixed(0):w?((L-C)*1e5).toFixed(0):((C-L)*1e5).toFixed(0);B.applyOptions({price:C,title:`${E.toUpperCase()} ${p} pts`})},y=()=>{const V=o.current,X=c.current,se=ae.current;if(!se)return;const E=ge.current[se],D=E?E.options().price:null;if(ae.current=null,V&&(V.style.cursor=""),X&&X.applyOptions({handleScroll:!0,handleScale:!0}),!Number.isFinite(D)||D<=0)return;const $=sf.current;$&&$(C=>C&&(se==="tp"?{...C,takeProfit:D}:se==="sl"?{...C,stopLoss:D}:C))},R=o.current;if(R)return R.addEventListener("mousedown",O,!0),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",y),()=>{R.removeEventListener("mousedown",O,!0),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",y)}},[lA]),a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${Ee==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:We===1||We!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[lA&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),a.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:"#94a3b8"},children:["Loading ",typeof ye=="object"?ye?.symbol:ye,"..."]})]})}),!lA&&yl&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:Ee==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[a.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),a.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:Ee==="light"?"#64748b":"#94a3b8"},children:yl})]})}),!lA&&!yl&&Ne.length===0&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"flex flex-col items-center gap-2",children:a.jsxs("span",{className:"text-sm font-medium",style:{color:Ee==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),YA&&Ne.length>0&&(()=>{const d=Ne[Ne.length-1],u=O=>{const ce=Number(O);return Number.isFinite(ce)?ce>=100?ce.toFixed(2):ce.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:Ee==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:Ee==="light"?"#1e293b":"#e2e8f0"},children:u(d?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:u(d?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:u(d?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:Ee==="light"?"#1e293b":"#e2e8f0"},children:u(d?.close)})]})]})})(),(i||si)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(ou,{bidPrice:e,askPrice:t,onBuyClick:Mb,onSellClick:Hb})}),a.jsx(au,{isOpen:st,onClose:Ib,orderType:ft,bidPrice:e,askPrice:t}),a.jsx(pu,{isOpen:re!==null,onClose:()=>q(null),chartObject:re,onUpdate:Pb}),lA&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:"#475569"}})}),kb&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:jd.map((d,u)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:d.x-5,top:d.y-5,backgroundColor:Ob}},u))}),a.jsx("div",{ref:l,style:{position:"absolute",bottom:"50px",left:"50%",transform:"translateX(-50%)",zIndex:30,display:"flex",alignItems:"center",gap:"4px",opacity:0,pointerEvents:"all",transition:"opacity 200ms"},children:[{title:"Zoom out",onClick:Kb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})})},{title:"Zoom in",onClick:Nb,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[a.jsx("line",{x1:"7",y1:"3",x2:"7",y2:"11"}),a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})]})},{title:"Scroll left",onClick:zb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"8,3 4,7 8,11"})})},{title:"Scroll right",onClick:Vb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:Wb,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:d,onClick:u,icon:O})=>a.jsx("button",{title:d,onClick:u,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:Ee==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:Ee==="light"?"#374151":"#94a3b8",border:"1px solid "+(Ee==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:ce=>{ce.currentTarget.style.backgroundColor=Ee==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",ce.currentTarget.style.color=Ee==="light"?"#111827":"#e2e8f0"},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=Ee==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",ce.currentTarget.style.color=Ee==="light"?"#374151":"#94a3b8"},children:O},d))})]})})}),Et={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function Vd({style:A,className:e}){const{selectedSymbol:t,setSelectedSymbol:i,symbols:r,symbolsLoading:n}=$t(),[s,o]=Y.useState(!1),[l,c]=Y.useState(""),[h,m]=Y.useState(-1),v=Y.useRef(null),x=Y.useRef(null);Y.useEffect(()=>{const Q=N=>{v.current&&!v.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[]),Y.useEffect(()=>{s&&x.current&&x.current.focus()},[s]);const F=r.filter(Q=>Q.symbol.toLowerCase().includes(l.toLowerCase())),T=F.filter(Q=>!Q.symbol.endsWith("USDT")),S=F.filter(Q=>Q.symbol.endsWith("USDT")),I=Q=>{i(Q),o(!1),c("")};return r.find(Q=>Q.symbol===t),a.jsxs("div",{ref:v,style:{...Et.container,...A},className:e,children:[a.jsxs("button",{style:Et.button,onClick:()=>o(!s),onMouseEnter:Q=>Object.assign(Q.currentTarget.style,Et.buttonHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Et.arrow,...s?Et.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Et.dropdown,children:[a.jsx("div",{style:Et.searchContainer,children:a.jsx("input",{ref:x,style:Et.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:Q=>c(Q.target.value)})}),a.jsx("div",{style:Et.list,children:F.length===0?a.jsx("div",{style:Et.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[T.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Et.categoryLabel,children:"Forex & Metals"}),T.map(Q=>a.jsxs("div",{style:{...Et.item,...Q.symbol===t?Et.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Et.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Et.symbolPrice,...parseFloat(Q.change)>=0?Et.priceUp:Et.priceDown},children:parseFloat(Q.bid).toFixed(5)})]},Q.symbol))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Et.categoryLabel,children:"Crypto"}),S.map(Q=>a.jsxs("div",{style:{...Et.item,...Q.symbol===t?Et.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Et.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Et.symbolPrice,...parseFloat(Q.change)>=0?Et.priceUp:Et.priceDown},children:parseFloat(Q.bid).toFixed(2)})]},Q.symbol))]})]})})]})]})}const XA={container:{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"14px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",padding:0,lineHeight:1,userSelect:"none"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},input:{width:"70px",padding:"4px 6px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"center",outline:"none",boxSizing:"border-box"},presets:{display:"inline-flex",gap:"2px",marginLeft:"4px"},preset:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},presetActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}},lb=[.01,.05,.1,.5,1];function Wd({value:A,onChange:e,min:t=.01,max:i=100,step:r=.01,presets:n=lb,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:h}){const[m,v]=Y.useState(.1),x=A!==void 0?A:m,F=Y.useCallback(Q=>{const N=Math.max(t,Math.min(i,parseFloat(Q)||t)),J=Math.round(N/r)*r,H=parseFloat(J.toFixed(8));A!==void 0||v(H),e?.(H)},[t,i,r,A,e]),T=()=>F(x+r),S=()=>F(x-r),I=(x>=1,x.toFixed(2));return a.jsxs("div",{style:{...XA.container,...c},className:h,children:[o&&a.jsx("span",{style:XA.label,children:l}),a.jsx("button",{style:XA.btn,onClick:S,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,XA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:XA.input,type:"text",value:I,onChange:Q=>{const N=Q.target.value;if(N===""||N==="."||N==="0.")return;const J=parseFloat(N);isNaN(J)||F(J)},onBlur:()=>F(x)}),a.jsx("button",{style:XA.btn,onClick:T,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,XA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:XA.presets,children:n.map(Q=>a.jsx("button",{style:{...XA.preset,...Math.abs(x-Q)<1e-4?XA.presetActive:{}},onClick:()=>F(Q),onMouseEnter:N=>{Math.abs(x-Q)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(x-Q)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:Q},Q))})]})}const gA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#EF5350",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#EF5350"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#3b1515",borderColor:"#EF5350",color:"#EF5350"}};function Gd({value:A,onChange:e,enabled:t,onEnabledChange:i,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:h,className:m}){const{currentSymbolData:v}=$t(),[x,F]=Y.useState(""),[T,S]=Y.useState(!1),[I,Q]=Y.useState("price"),N=A!==void 0?A:x,J=t!==void 0?t:T,H=r!==void 0?r:I,z=Y.useCallback(ne=>{t!==void 0||S(ne),i?.(ne)},[t,i]),re=Y.useCallback(ne=>{r!==void 0||Q(ne),n?.(ne)},[r,n]),q=Y.useCallback(ne=>{A!==void 0||F(ne),e?.(ne)},[A,e]),ie=ne=>{const le=ne.target.value;if(le===""||le==="."||le==="0."){q(le);return}const ee=parseFloat(le);isNaN(ee)||q(le)},G=H==="price"?v?.bid?parseFloat(v.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...gA.container,...h},className:m,children:[l&&a.jsx("span",{style:gA.label,children:c}),s&&a.jsx("button",{style:{...gA.toggle,...J?gA.toggleOn:gA.toggleOff},onClick:()=>z(!J),children:a.jsx("div",{style:{...gA.toggleKnob,...J?gA.knobOn:gA.knobOff}})}),(J||!s)&&a.jsxs("div",{style:gA.inputGroup,children:[a.jsx("input",{style:gA.input,type:"text",value:N,onChange:ie,placeholder:G,onFocus:ne=>ne.currentTarget.style.borderColor="#EF5350",onBlur:ne=>ne.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...gA.modeBtn,...H==="price"?gA.modeBtnActive:{}},onClick:()=>re("price"),children:"Price"}),a.jsx("button",{style:{...gA.modeBtn,...H==="pips"?gA.modeBtnActive:{}},onClick:()=>re("pips"),children:"Pips"})]})]})]})}const mA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function Rd({value:A,onChange:e,enabled:t,onEnabledChange:i,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:h,className:m}){const{currentSymbolData:v}=$t(),[x,F]=Y.useState(""),[T,S]=Y.useState(!1),[I,Q]=Y.useState("price"),N=A!==void 0?A:x,J=t!==void 0?t:T,H=r!==void 0?r:I,z=Y.useCallback(ne=>{t!==void 0||S(ne),i?.(ne)},[t,i]),re=Y.useCallback(ne=>{r!==void 0||Q(ne),n?.(ne)},[r,n]),q=Y.useCallback(ne=>{A!==void 0||F(ne),e?.(ne)},[A,e]),ie=ne=>{const le=ne.target.value;if(le===""||le==="."||le==="0."){q(le);return}const ee=parseFloat(le);isNaN(ee)||q(le)},G=H==="price"?v?.ask?parseFloat(v.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...mA.container,...h},className:m,children:[l&&a.jsx("span",{style:mA.label,children:c}),s&&a.jsx("button",{style:{...mA.toggle,...J?mA.toggleOn:mA.toggleOff},onClick:()=>z(!J),children:a.jsx("div",{style:{...mA.toggleKnob,...J?mA.knobOn:mA.knobOff}})}),(J||!s)&&a.jsxs("div",{style:mA.inputGroup,children:[a.jsx("input",{style:mA.input,type:"text",value:N,onChange:ie,placeholder:G,onFocus:ne=>ne.currentTarget.style.borderColor="#26A69A",onBlur:ne=>ne.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...mA.modeBtn,...H==="price"?mA.modeBtnActive:{}},onClick:()=>re("price"),children:"Price"}),a.jsx("button",{style:{...mA.modeBtn,...H==="pips"?mA.modeBtnActive:{}},onClick:()=>re("pips"),children:"Pips"})]})]})]})}const cb=[{id:1,name:"Crosshair",icon:"+"},{id:2,name:"Trend Line",icon:"╱"},{id:3,name:"Parallel Channel",icon:"═"},{id:4,name:"Fibonacci",icon:"≡"},{id:5,name:"Rectangle",icon:"▭"},{id:6,name:"Price Level",icon:"─"}],JA={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"14px",cursor:"pointer",transition:"all 0.15s ease",padding:0,position:"relative"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},tooltip:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"11px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},divider:{width:"1px",height:"20px",backgroundColor:"#334155",margin:"0 4px"},deleteBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0},deleteBtnHover:{borderColor:"#EF5350",backgroundColor:"#3b1515",color:"#EF5350"},visibilityBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0}};function $d({showLabel:A=!0,showDelete:e=!0,showVisibility:t=!0,tools:i,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:h,chartObjects:m,setChartObjects:v}=$t(),[x,F]=Y.useState(null),T=i||cb,S=N=>{l(o===N?null:N)},I=()=>{v([]),l(null)},Q=()=>{h(!c)};return a.jsxs("div",{style:{...JA.container,...n},className:s,children:[A&&a.jsx("span",{style:JA.label,children:r}),T.map(N=>a.jsxs("button",{style:{...JA.btn,...o===N.id?JA.btnActive:{}},onClick:()=>S(N.id),onMouseEnter:J=>{F(N.id),o!==N.id&&Object.assign(J.currentTarget.style,JA.btnHover)},onMouseLeave:J=>{F(null),o!==N.id&&(J.currentTarget.style.borderColor="#334155",J.currentTarget.style.backgroundColor="#1e293b",J.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,x===N.id&&a.jsx("div",{style:JA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:JA.divider}),t&&a.jsx("button",{style:{...JA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:Q,onMouseEnter:N=>{N.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:JA.deleteBtn,onClick:I,onMouseEnter:N=>Object.assign(N.currentTarget.style,JA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Xd={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function hb({showCoinSelector:A=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:i=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:h,onStopLossEnabledChange:m,takeProfit:v,onTakeProfitChange:x,takeProfitEnabled:F,onTakeProfitEnabledChange:T,coinSelectorProps:S={},volumeControlProps:I={},stopLossProps:Q={},takeProfitProps:N={},drawingToolsProps:J={},style:H,className:z}){const re=[];A&&re.push(a.jsx(Vd,{...S},"coin")),e&&re.push(a.jsx(Wd,{value:s,onChange:o,...I},"volume")),t&&re.push(a.jsx(Gd,{value:l,onChange:c,enabled:h,onEnabledChange:m,...Q},"sl")),i&&re.push(a.jsx(Rd,{value:v,onChange:x,enabled:F,onEnabledChange:T,...N},"tp")),r&&re.push(a.jsx($d,{...J},"draw"));const q=[];return re.forEach((ie,G)=>{q.push(ie),n&&G<re.length-1&&q.push(a.jsx("div",{style:Xd.divider},`div-${G}`))}),a.jsx("div",{style:{...Xd.toolbar,...H},className:z,children:q})}const ub=[{label:"M1",value:"M1"},{label:"M5",value:"M5"},{label:"M15",value:"M15"},{label:"M30",value:"M30"},{label:"H1",value:"H1"},{label:"H4",value:"H4"},{label:"D1",value:"D1"},{label:"W1",value:"W1"}],wl={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function pb({style:A,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:i}=$t();return a.jsx("div",{style:{...wl.container,...A},className:e,children:ub.map(r=>a.jsx("button",{style:{...wl.btn,...t===r.value?wl.btnActive:{}},onClick:()=>i(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},children:r.label},r.value))})}const db=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Bl={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function fb({style:A,className:e}){const{chartType:t,setChartType:i}=$t();return a.jsx("div",{style:{...Bl.container,...A},className:e,children:db.map(r=>a.jsxs("button",{style:{...Bl.btn,...t===r.value?Bl.btnActive:{}},onClick:()=>i(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const oA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function gb({volume:A=.1,stopLoss:e,takeProfit:t,onTradeExecuted:i,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=$t(),[h,m]=Y.useState(null),v=parseFloat(o?.bid||0),x=parseFloat(o?.ask||0),F=x>0&&v>0?Math.abs(x-v):0,T=Q=>!Q||Q===0?"-.-----":Q>=1e3?Q.toFixed(2):Q>=1?Q.toFixed(4):Q.toFixed(5),S=Q=>Q===0?"-":Q>=1?Q.toFixed(1):Q>=.01?Q.toFixed(3):(Q*1e4).toFixed(1)+"p",I=Y.useCallback(Q=>{if(!s)return;const N=Q==="BUY"?x:v;if(!N||N<=0){m({type:"error",message:"No price available"});return}const J={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:Q,volume:A,price:N,stopLoss:e?parseFloat(e):null,takeProfit:t?parseFloat(t):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(z=>[...z,J]);const H=A*N*.01;c(z=>z-H),m({type:"success",message:`${Q} executed`}),i?.(J),setTimeout(()=>m(null),3e3)},[s,x,v,A,e,t,l,c,i]);return a.jsxs("div",{style:{...oA.container,...r},className:n,children:[a.jsx("button",{style:oA.sellBtn,onClick:()=>I("SELL"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,oA.sellBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d",Q.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:oA.priceBox,children:[a.jsx("span",{style:oA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...oA.priceValue,color:"#EF5350"},children:T(v)})]}),a.jsxs("div",{style:oA.spread,children:[a.jsx("span",{style:oA.spreadLabel,children:"Spread"}),a.jsx("span",{style:oA.spreadValue,children:S(F)})]}),a.jsxs("div",{style:oA.priceBox,children:[a.jsx("span",{style:oA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...oA.priceValue,color:"#26A69A"},children:T(x)})]}),a.jsx("button",{style:oA.buyBtn,onClick:()=>I("BUY"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,oA.buyBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#14532d",Q.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&a.jsx("span",{style:{...oA.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.message})]})}const ot={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function mb({style:A,className:e,maxHeight:t=200}){const{orders:i,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=$t(),[l,c]=Y.useState(null),h=i.filter(T=>T.status==="OPEN"||!T.closeAt),m=Y.useCallback((T,S)=>{const I=n.find(Q=>Q.symbol===T);return I?S?.toUpperCase()==="BUY"?parseFloat(I.bid||0):parseFloat(I.ask||0):0},[n]),v=Y.useCallback(T=>{if(l)return;c(T.id);const S=m(T.symbol,T.type),Q=(T.type?.toUpperCase()==="BUY"?S-T.price:T.price-S)*T.volume,N=T.volume*T.price*.01;r(J=>J.filter(H=>H.id!==T.id)),o(J=>J+N+Q),c(null)},[l,m,r,o]),x=T=>{const S=parseFloat(T);return!S||isNaN(S)?"-":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5)},F=T=>{const S=parseFloat(T);return isNaN(S)?"-":(S>=0?"+":"")+S.toFixed(2)};return a.jsxs("div",{style:{...ot.container,...A},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",h.length,")"]}),a.jsxs("div",{style:ot.summary,children:[a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...ot.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...ot.scrollArea,maxHeight:t},children:a.jsxs("table",{style:ot.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ot.th,children:"Symbol"}),a.jsx("th",{style:ot.th,children:"Type"}),a.jsx("th",{style:ot.th,children:"Volume"}),a.jsx("th",{style:ot.th,children:"Open Price"}),a.jsx("th",{style:ot.th,children:"Current"}),a.jsx("th",{style:ot.th,children:"SL"}),a.jsx("th",{style:ot.th,children:"TP"}),a.jsx("th",{style:ot.th,children:"Profit"}),a.jsx("th",{style:ot.th,children:"Action"})]})}),a.jsx("tbody",{children:h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.emptyRow,children:"No open positions"})}):h.map(T=>{const S=m(T.symbol,T.type),I=T.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:T.symbol}),a.jsx("td",{style:{...ot.td,...T.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:T.type}),a.jsx("td",{style:ot.td,children:T.volume}),a.jsx("td",{style:ot.td,children:x(T.price)}),a.jsx("td",{style:ot.td,children:x(S)}),a.jsx("td",{style:ot.td,children:T.stopLoss?x(T.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:T.takeProfit?x(T.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:I>=0?"#26A69A":"#EF5350",fontWeight:700},children:F(I)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.closeBtn,...l===T.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>v(T),disabled:l===T.id,onMouseEnter:Q=>{l!==T.id&&(Q.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d"},children:l===T.id?"...":"Close"})})]},T.id)})})]})})]})}function wb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(A)}function Bb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(A)}function yb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(A)}function Cb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(A)}const vb=({selectedSymbol:A,selectedTimeframe:e,onTimeframeChange:t,chartType:i="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:m=!0,onToggleMarketWatch:v,buySellPanelOpen:x,onMove:F})=>{const{theme:T}=$t(),S=T==="light",I=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],Q={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M20.999 15.002H19v3a1 1 0 0 1-2.001 0V8H15a1 1 0 1 1 0-2h1.999v-3A1 1 0 1 1 19 3v10h1.999a1 1 0 0 1 0 2Zm-10.999-4H6.999v10a1 1 0 1 1-1.999 0v-3H3a1 1 0 0 1 0-2h2v-11a1 1 0 1 1 1.999 0V9H10a1 1 0 0 1 0 2Z",clipRule:"evenodd",fill:"currentColor"})]}),candles:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"m2.166 16.571 7.013-7.194c.38-.583 1.116-.273 1.707.256l4.14 2.31 5.136-6.692c.277-.425 1.853-.182 1.853-.182v13.952H2.047a7.772 7.772 0 0 1 .119-2.45Z",opacity:".2",fill:"currentColor"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),line:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),volume:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.024 17.844H19a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1Zm-3 0H16a1 1 0 0 1-1-1v-5.845A1 1 0 0 1 16 10h.024a1 1 0 0 1 1 .999v5.845a1 1 0 0 1-1 1Zm-3 0H13a1 1 0 0 1-1-1V6.999A1 1 0 0 1 13 6h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H10a1 1 0 0 1-1-1V12a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H7a1 1 0 0 1-1-1V9.999A.999.999 0 0 1 7 9h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H4a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1Z",clipRule:"evenodd",fill:"currentColor"})]}),"volume ticks":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{fillRule:"evenodd",d:"M20.009 6.993h-.985v3.985a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1V6.993h-.946c-.565 0-1.023-.441-1.023-.985v-.024c0-.543.458-.984 1.023-.984h3.955c.565 0 1.023.441 1.023.984v.024c0 .544-.458.985-1.023.985Zm-3.985 6.14v5.845a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-5.845a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999Zm-4 6.845H12a1 1 0 0 1-1-1V9.133a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H9a1 1 0 0 1-1-1v-4.844a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H6a1 1 0 0 1-1-1v-6.845a.998.998 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H3a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1ZM18 14.134h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-3.844a1 1 0 0 1 1-1Z",clipRule:"evenodd",fill:"currentColor"})]})};return a.jsx("div",{className:`overflow-x-auto border-b ${S?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,style:{scrollbarWidth:"thin",scrollbarColor:S?"#cbd5e1 transparent":"#334155 transparent"},children:a.jsxs("div",{className:"flex items-center justify-between px-4 py-1 min-w-max",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${S?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
12
+ `).forEach(J),N.length===0&&N.push("");const H=N.map(pe=>T.measureText(pe).width),z=Math.max(...H,20*m),re=8*m,q=5*v,ie=z+re*2,G=S*1.2,ne=G*N.length+q*2,le=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",ee=x-ie/2,we=F-ne;r.bgEnabled&&(T.fillStyle=Md(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),T.beginPath(),T.rect(ee,we,ie,ne),T.fill()),r.borderEnabled&&(T.strokeStyle=Md(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),T.lineWidth=Math.max(.5,(r.borderWidth??1)*v),T.beginPath(),T.rect(ee,we,ie,ne),T.stroke()),T.fillStyle=r.color,T.textAlign=le,T.textBaseline="middle";const j=le==="left"?ee+re:le==="right"?ee+ie-re:ee+ie/2;for(let pe=0;pe<N.length;pe++)T.fillText(N[pe],j,we+q+G*(pe+.5));const ge=5*v,ae=F+10*v;T.beginPath(),T.strokeStyle="#3b82f6",T.lineWidth=1.5*v,T.arc(x,ae,ge,0,Math.PI*2),T.stroke(),T.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const JT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Pd(A){return A?JT[A]??7:7}function ZT(A,e){const t=String(A||"").toUpperCase(),i=e||Pd(A),r={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[t]||96,n=Math.ceil(i*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const DA=A=>{if(!Array.isArray(A)||A.length===0)return[];const e=A.map(i=>({...i,time:te(i.time)})).filter(i=>i.time!=null);e.sort((i,r)=>i.time-r.time);const t=new Map;for(const i of e)t.set(i.time,i);return Array.from(t.values()).sort((i,r)=>i.time-r.time)},YT=300,Dd=24,qT=150,_d=150;function gl(A,e,t=YT){if(!Array.isArray(A)||A.length===0)return[];const i=BA(e),r=Number.isFinite(i)&&i>0?i:60;let n=null;for(const o of A){const l=te(o?.time);l!=null&&(n==null||l>n)&&(n=l)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+r*o});return s}function jT(A){if(!Array.isArray(A)||A.length===0)return null;let e=null;for(const t of A){const i=te(t?.time);i!=null&&(e==null||i>e)&&(e=i)}return e}function eb(A,e){let t=0,i=A.length;for(;t<i;){const r=t+i>>1;A[r]<e?t=r+1:i=r}return t}function zs(A,e,t,i){const r=te(e),n=te(t),s=BA(i)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(A)||A.length===0)return l;if(r==null||n==null)return 1;const c=v=>{const x=eb(A,v);if(x<=0)return 0;if(x>=A.length)return A.length-1;const F=A[x-1],T=A[x];return Math.abs(v-F)<=Math.abs(T-v)?x-1:x},h=c(r),m=c(n);return Math.max(1,Math.abs(m-h)+1)}function kd(A,e,t){if(!A)return!1;const i=A.timeScale();if(!i)return!1;const r=jT(e);if(r==null)return!1;const n=i.timeToCoordinate(r);if(Number.isFinite(n)){const c=i.coordinateToLogical(n);if(Number.isFinite(c)){const h=i.getVisibleLogicalRange(),m=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,v=Number.isFinite(m)&&m>20?m:120,x=Math.min(_d,v/2),F=Math.max(20,v-x),T={from:c-F,to:c+x};try{return i.setVisibleLogicalRange(T),!0}catch{}}}const s=BA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-qT*o,to:r+_d*o};try{return i.setVisibleRange(l),!0}catch{return!1}}function ut(A,e,t,i,r,n){const s=r-t,o=n-i,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(A-t,e-i);let c=((A-t)*s+(e-i)*o)/(l*l);c=Math.max(0,Math.min(1,c));const h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function tb(A,e,t,i,r,n){const s=r-t,o=n-i,l=s*s+o*o;if(l===0)return Math.hypot(A-t,e-i);let c=((A-t)*s+(e-i)*o)/l;c<0&&(c=0);const h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function Ab(A,e,t,i,r,n){const s=r-t,o=n-i,l=s*s+o*o;if(l===0)return Math.hypot(A-t,e-i);const c=((A-t)*s+(e-i)*o)/l,h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function vi(A,e,t){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const s=t[r].x,o=t[r].y,l=t[n].x,c=t[n].y;o>e!=c>e&&A<(l-s)*(e-o)/(c-o)+s&&(i=!i)}return i}function Od(A,e,t){if(!A||!e||!t)return null;const i=(A.normalizedTime+e.normalizedTime)/2,r=(A.price+e.price)/2,n=t.price-r,s={rawTime:A.rawTime,normalizedTime:A.normalizedTime,price:A.price+n},o={rawTime:e.rawTime,normalizedTime:e.normalizedTime,price:e.price+n},l={rawTime:t.rawTime??te(i),normalizedTime:te(i),price:r+n};return{b1:s,b2:o,bottomMid:l}}function Jr(A,e,t,i=1){if(!A||!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=A.filter(re=>{const q=te(re.time);return q!=null&&q>=s&&q<=o});if(l.length<2)return null;const c=l.length;let h=0,m=0,v=0,x=0;l.forEach((re,q)=>{h+=q,m+=re.close,v+=q*re.close,x+=q*q});const F=(c*v-h*m)/(c*x-h*h),T=(m-F*h)/c;let S=0;l.forEach((re,q)=>{const ie=T+F*q;S+=(re.close-ie)**2});const I=Math.sqrt(S/c),Q=I*i,N=T,J=T+F*(c-1),H=l[0].time,z=l[c-1].time;return{p1:{rawTime:H,normalizedTime:te(H),price:N},p2:{rawTime:z,normalizedTime:te(z),price:J},top1:{rawTime:H,normalizedTime:te(H),price:N+Q},top2:{rawTime:z,normalizedTime:te(z),price:J+Q},bot1:{rawTime:H,normalizedTime:te(H),price:N-Q},bot2:{rawTime:z,normalizedTime:te(z),price:J-Q},slope:F,intercept:T,stdDev:I,offset:Q,barCount:c}}function Zr(A,e,t,i=1){if(!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=(A||[]).filter(S=>{const I=te(S.time);return I!=null&&I>=s&&I<=o});if(l.length<2)return null;const c=e.rawTime,h=t.rawTime,m=l.length,v=(t.price-e.price)/(m-1||1);let x=0;l.forEach((S,I)=>{const Q=e.price+v*I;x+=(S.close-Q)**2});const F=Math.sqrt(x/m),T=F*i;return{p1:{rawTime:c,normalizedTime:r,price:e.price},p2:{rawTime:h,normalizedTime:n,price:t.price},top1:{rawTime:c,normalizedTime:r,price:e.price+T},top2:{rawTime:h,normalizedTime:n,price:t.price+T},bot1:{rawTime:c,normalizedTime:r,price:e.price-T},bot2:{rawTime:h,normalizedTime:n,price:t.price-T},slope:v,stdDev:F,offset:T,barCount:m}}const ib={trendline:{requiredKeys:["point1","point2"],handleCount:2},gannline:{requiredKeys:["point1","point2"],handleCount:3},rectangle:{requiredKeys:["p1","p2"],handleCount:8},circle:{requiredKeys:["p1","p2"],handleCount:2},triangle:{requiredKeys:["p1","p2","p3"],handleCount:3},ellipse:{requiredKeys:["p1","p2"],handleCount:4},infoline:{requiredKeys:["p1","p2"],handleCount:2},arrowedline:{requiredKeys:["p1","p2"],handleCount:2},rayline:{requiredKeys:["p1","p2"],handleCount:2},extendedline:{requiredKeys:["p1","p2"],handleCount:2},crossline:{requiredKeys:["p"],handleCount:1},trendbyangle:{requiredKeys:["p1","p2"],handleCount:2},equidistantchannel:{requiredKeys:["p1","p2","p3"],handleCount:3},regressionchannel:{requiredKeys:["p1","p2"],handleCount:2},stddevchannel:{requiredKeys:["p1","p2"],handleCount:2},gannfan:{requiredKeys:["p1","p2"],handleCount:2},ganngrid:{requiredKeys:["p1","p2"],handleCount:2},andrewspitchfork:{requiredKeys:["p1","p2","p3"],handleCount:3},disjointchannel:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},flattopbottom:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},rulerline:{requiredKeys:["p1","p2"],handleCount:3},horizontalray:{requiredKeys:["primitive"],handleCount:1},verticalline:{requiredKeys:["primitive"],handleCount:1},pricelevel:{requiredKeys:["priceLine"],handleCount:1}},rb={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",infoline:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6",pricelevel:"#3b82f6"};function nb(A,e){if(!A||!A.type)return!1;const t=ib[A.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(i=>!!A[i])}function sb(A){return A?rb[A]??"#22c55e":"#22c55e"}function ml(A,e){if(A.length<e)return[];const t=2/(e+1);let i=A.slice(0,e).reduce((n,s)=>n+s.close,0)/e;const r=[{time:A[e-1].time,value:i}];for(let n=e;n<A.length;n++)i=A[n].close*t+i*(1-t),r.push({time:A[n].time,value:i});return r}function Vs(A,e){if(A.length<e)return null;const t=A[A.length-1],i=A.slice(-e).reduce((r,n)=>r+n.close,0)/e;return{time:t.time,value:i}}function Nd(A,e){const t=ml(A,e);return t.length?t[t.length-1]:null}function Kd(A,e){if(A.length<e+1)return null;let t=0,i=0;for(let s=1;s<=e;s++){const o=A[s].close-A[s-1].close;o>0?t+=o:i-=o}t/=e,i/=e;for(let s=e+1;s<A.length;s++){const o=A[s].close-A[s-1].close;t=(t*(e-1)+Math.max(o,0))/e,i=(i*(e-1)+Math.max(-o,0))/e}const r=A[A.length-1],n=i===0?100:100-100/(1+t/i);return{time:r.time,value:n}}function zd(A,e=12,t=26,i=9){if(A.length<t+i)return null;const r=ml(A,e),n=ml(A,t);if(!r.length||!n.length)return null;const s=n.map((h,m)=>{const v=r[r.length-n.length+m];return{time:h.time,value:v.value-h.value}});if(s.length<i)return null;const o=2/(i+1);let l=s.slice(0,i).reduce((h,m)=>h+m.value,0)/i;for(let h=i;h<s.length;h++)l=s[h].value*o+l*(1-o);const c=s[s.length-1];return{time:c.time,value:c.value,signal:l,histogram:c.value-l}}const ob={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ab=Y.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:i=!0,onBuyClick:r,onSellClick:n},s){const o=Y.useRef(null),l=Y.useRef(null),c=Y.useRef(null),h=Y.useRef(null),m=Y.useRef(null),v=Y.useRef(null),x=Y.useRef([]),F=Y.useRef(null),T=Y.useRef(!1),S=Y.useRef(null),I=Y.useRef(null),Q=Y.useRef(null),N=Y.useRef(null),J=Y.useRef([]),[H,z]=Y.useState(null),[re,q]=Y.useState(null),[ie,G]=Y.useState([]),[ne,le]=Y.useState(null);Y.useRef(null);const[ee,we]=Y.useState([]),j=Y.useRef(null),ge=Y.useRef({tp:null,sl:null,entry:null}),ae=Y.useRef(null),pe=Y.useRef(0),ue=Y.useRef(0),oe=Y.useRef(null),fe=Y.useRef(null),Qe=Y.useRef(!1),me=Y.useRef(!1);Y.useEffect(()=>{fe.current=H;let d=!1;x.current.forEach(u=>{if(u.type==="trendline"&&u.decoration){const O=u===H;u.decoration.isSelected!==O&&(u.decoration.isSelected=O,d=!0)}}),d&&c.current?.applyOptions({})},[H]);const xe=Y.useRef(new Map),Se=Y.useRef(null),Me=Y.useRef(null),$e=(d,u)=>`${d}_${u}`,Ye=()=>{const d=$e(ye,Te);return xe.current.get(d)||null},Ie=d=>{if(!d)return;const u=$e(ye,Te);xe.current.set(u,d)},{activeTool:We,setActiveTool:De,showGrid:Ze,snapToGrid:nt,chartObjects:dt,setChartObjects:He,orders:zt,selectedSymbol:ye,selectedTimeframe:Te,drawingsVisible:ve,chartType:be,chartLocked:Le,theme:Ee,candleColors:Ke,showTradeOrders:wt,showTradePosition:Dt,showTradeHistory:ni,showSLTP:ZA,showAskPrice:aA,showChartControls:si,showCrosshair:_A,showOHLC:YA,currentSymbolData:Zt,baseUrl:Yt,endpoints:Qt,endpointParams:Lt,indicators:Ct,indicatorSettings:Ut,selectedTradeForModify:Vt,setSelectedTradeForModify:je}=$t(),_e=Y.useRef({}),[Je,et]=Y.useState({}),bt=Y.useRef(0),ze=Y.useRef(Ct),Ve=Y.useRef(Ut);ze.current=Ct,Ve.current=Ut;const At=Y.useRef([]),[st,Ge]=Y.useState(!1),[ft,at]=Y.useState(null),[Ne,Wt]=Y.useState([]),[lA,Gs]=Y.useState(!0),[yl,Jd]=Y.useState(null),[Lb,dx]=Y.useState(0),Rs=Y.useMemo(()=>{const d=Ne.map(u=>te(u?.time)).filter(u=>Number.isFinite(u));return d.sort((u,O)=>u-O),d},[Ne]),$s=Y.useRef(null),oi=Y.useRef(new Map);Y.useRef(null);const Zd=Y.useRef(0),kA=Y.useRef(null),nr=Y.useRef(!1),tn=Y.useRef(!1);Y.useEffect(()=>{const d=m.current;d&&d.setData(gl(Ne,Te))},[Ne,Te]),Y.useImperativeHandle(s,()=>({zoomIn:()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*.8;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},zoomOut:()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*1.25;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const d=o.current;if(!d){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const u=Ee==="light"?"#ffffff":"#12161d",O=`chart-${ye}-${Te}-${Date.now()}.png`;NT(d,{useCORS:!0,allowTaint:!0,backgroundColor:u,scale:2,logging:!1}).then(ce=>{const y=document.createElement("a");y.download=O,y.href=ce.toDataURL("image/png"),y.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(ce=>{console.error("Chart screenshot failed",ce),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,Te,Ee]);const Cl=Y.useMemo(()=>Ne.length===0?[]:be==="line"||be==="area"?Ne.map(d=>({time:d.time,value:d.close})):Ne,[Ne,be]),Mb=d=>{r?r(d):(at("BUY"),Ge(!0))},Hb=d=>{n?n(d):(at("SELL"),Ge(!0))},Ib=()=>{Ge(!1),at(null)},Pb=d=>{const u=re;if(!u||!d)return;const O=(R,V)=>{if(typeof R!="string")return V;const X=R.trim(),se=X.startsWith("#")?X:`#${X}`;return/^#[0-9A-Fa-f]{6}$/.test(se)?se.toLowerCase():V},ce=(R,V)=>{const X=Number(R);return Number.isFinite(X)?Math.max(0,Math.min(1,X)):V};let y={...u,visibleTimeframes:Array.isArray(d.visibleTimeframes)?[...d.visibleTimeframes]:u.visibleTimeframes};if(u.type==="text"){const R=Number.isFinite(Number(d.price))?Number(d.price):u.price,V=u.primitive;V&&(V.text=typeof d.text=="string"?d.text:V.text,V.color=O(d.color,V.color??"#5f8f96"),V.fontSize=Number.isFinite(Number(d.fontSize))?Number(d.fontSize):V.fontSize,V.fontWeight=d.fontWeight==="bold"?"bold":"normal",V.fontStyle=d.fontStyle==="italic"?"italic":"normal",V.textAlign=["left","center","right"].includes(d.textAlign)?d.textAlign:V.textAlign,V.textWrap=!!d.textWrap,V.borderEnabled=!!d.borderEnabled,V.borderColor=O(d.borderColor,V.borderColor??"#5f8f96"),V.borderOpacity=ce(d.borderOpacity,V.borderOpacity??.1),V.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(d.borderWidth))?Number(d.borderWidth):1)),V.bgEnabled=!!d.bgEnabled,V.bgColor=O(d.bgColor,V.bgColor??"#5f8f96"),V.bgOpacity=ce(d.bgOpacity,V.bgOpacity??.1),V.price=R),y={...y,price:R,text:typeof d.text=="string"?d.text:u.text}}if(u.type==="trendline"){const R=O(d.lineColor,"#22c55e"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2));if(u.series)try{u.series.applyOptions({color:R,lineWidth:V})}catch{}const X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.point1?.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.point2?.price;if(u.series&&u.point1&&u.point2){const $=u.point1.time??u.point1.rawTime,C=u.point2.time??u.point2.rawTime;try{const B=DA([{time:$,value:X},{time:C,value:se}]);B.length>0&&u.series.setData(B)}catch{}}const E={...u.point1,price:X},D={...u.point2,price:se};u.decoration&&(u.decoration.color=R,u.decoration.lineWidth=V,u.decoration.arrowLeft=!!d.arrowLeft,u.decoration.arrowRight=!!d.arrowRight,u.decoration.rayLeft=!!d.rayLeft,u.decoration.rayRight=!!d.rayRight,u.decoration.statsColor=O(d.statsColor,"#5f8f96"),u.decoration.statsPosition=d.statsPosition??"right",u.decoration.statsShowAlways=!!d.statsShowAlways,u.decoration.statsPriceRange=!!d.statsPriceRange,u.decoration.statsBarsRange=!!d.statsBarsRange,u.decoration.statsDateRange=!!d.statsDateRange,u.decoration.statsAngle=!!d.statsAngle,u.decoration.statsDistance=!!d.statsDistance,u.decoration.p1=E,u.decoration.p2=D),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsShowAlways:!!d.statsShowAlways,statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,point1:E,point2:D,decoration:u.decoration}}if(u.type==="pricelevel"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showPrice!==!1,se=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",D=O(d.textColor,"#ffffff"),$=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",B=Number.isFinite(Number(d.price))?Number(d.price):u.price;if(u.priceLine)try{u.priceLine.applyOptions({price:B,color:R,lineWidth:V,axisLabelVisible:X,title:X&&typeof B=="number"?B.toFixed(5):""})}catch{}const f=h.current;if(se&&E&&f)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=D,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B;else{const L=new md(B,{text:E,textColor:D,hAlign:$,vAlign:C});try{f.attachPrimitive(L)}catch{}u.textPrimitive=L}else if(u.textPrimitive&&f){try{f.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:R,lineWidth:V,showPrice:X,showText:se,textContent:E,textColor:D,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="horizontalray"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showPrice!==!1,se=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",D=O(d.textColor,"#ffffff"),$=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",B=Number.isFinite(Number(d.price))?Number(d.price):u.price,f=u.primitive;if(f&&(f.price=B,f.color=R,f.lineWidth=V),u.priceLine)try{u.priceLine.applyOptions({price:B,color:R,axisLabelVisible:X,title:X&&typeof B=="number"?B.toFixed(5):""})}catch{}const L=h.current;if(se&&E&&L)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=D,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B,u.textPrimitive.originTime=u.rawOriginTime;else{const w=new md(B,{text:E,textColor:D,hAlign:$,vAlign:C,originTime:u.rawOriginTime});try{L.attachPrimitive(w)}catch{}u.textPrimitive=w}else if(u.textPrimitive&&L){try{L.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:R,lineWidth:V,showPrice:X,showText:se,textContent:E,textColor:D,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="verticalline"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showDate!==!1,se=u.primitive;se&&(se.color=R,se.lineWidth=V,se.showDate=X),y={...y,lineColor:R,lineWidth:V,showDate:X}}if(u.type==="infoline"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.statsShowAlways!==!1,se=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",D=!!d.statsPriceRange,$=!!d.statsBarsRange,C=!!d.statsDateRange,B=!!d.statsAngle,f=!!d.statsDistance,L=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,w=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,p=u.p1.rawTime,_=u.p2.rawTime,P=w-L,U=L!==0?P/Math.abs(L)*100:0,b=u.p1.normalizedTime??0,g=u.p2.normalizedTime??0,M=BA(Te)||3600,k=Math.abs(g-b),K=Math.max(1,Math.round(k/M)),W=Math.max(1,Math.round(k/86400)),Z=c.current,Ae=h.current,he=Z?Z.timeScale().timeToCoordinate(p):null,Be=Ae?Ae.priceToCoordinate(L):null,Ce=Z?Z.timeScale().timeToCoordinate(_):null,Ue=Ae?Ae.priceToCoordinate(w):null,qe=he!=null&&Be!=null&&Ce!=null&&Ue!=null?Math.atan2(-(Ue-Be),Ce-he)*(180/Math.PI):u.primitive?.info?.angle??0,rt={priceDiff:P,pricePct:U,bars:K,days:W,angle:qe},Xe=u.primitive;Xe&&(Xe.color=R,Xe.lineWidth=V,Xe.statsShowAlways=X,Xe.statsColor=se,Xe.statsPosition=E,Xe.statsPriceRange=D,Xe.statsBarsRange=$,Xe.statsDateRange=C,Xe.statsAngle=B,Xe.statsDistance=f,Xe.p1={...u.p1,price:L},Xe.p2={...u.p2,price:w},Xe.info=rt),y={...y,lineColor:R,lineWidth:V,statsShowAlways:X,statsColor:se,statsPosition:E,statsPriceRange:D,statsBarsRange:$,statsDateRange:C,statsAngle:B,statsDistance:f,p1:{...u.p1,price:L},p2:{...u.p2,price:w}}}if(u.type==="rulerline"){const R=O(d.lineColor,"#3b82f6"),V=d.showArea!==!1,X=!!d.statsShowAlways,se=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",D=!!d.statsPriceRange,$=!!d.statsBarsRange,C=!!d.statsDateRange,B=u.primitive;B&&(B.lineColor=R,B.showArea=V,B.statsShowAlways=X,B.statsColor=se,B.statsPosition=E,B.statsPriceRange=D,B.statsBarsRange=$,B.statsDateRange=C),y={...y,lineColor:R,showArea:V,statsShowAlways:X,statsColor:se,statsPosition:E,statsPriceRange:D,statsBarsRange:$,statsDateRange:C}}if(u.type==="arrowedline"){const R=O(d.lineColor,"#f59e0b"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="rayline"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="extendedline"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="crossline"){const R=O(d.lineColor,"#06a0e3"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.price))?Number(d.price):u.p.price,se=u.primitive;se&&(se.color=R,se.lineWidth=V,se.showTime=!!d.showTime,se.showPrice=!!d.showPrice,se.center={...u.p,price:X}),y={...y,lineColor:R,lineWidth:V,showTime:!!d.showTime,showPrice:!!d.showPrice,p:{...u.p,price:X}}}if(u.type==="trendbyangle"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="disjointchannel"){const R=O(d.lineColor,"#129f5c"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=O(d.fillColor,"#6aa84f"),se=ce(d.fillOpacity,.1),E=O(d.pricesColor,"#129f5c"),D=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,$=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=R,B.lineWidth=V,B.fillColor=X,B.fillOpacity=se,B.showBackground=!!d.showBackground,B.showPrices=!!d.showPrices,B.pricesColor=E,B.rayLeft=!!d.rayLeft,B.rayRight=!!d.rayRight,B.arrowLeft=!!d.arrowLeft,B.arrowRight=!!d.arrowRight,B.p1={...u.p1,price:D},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:R,lineWidth:V,fillColor:X,fillOpacity:se,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...u.p1,price:D},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}if(u.type==="flattopbottom"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=O(d.fillColor,"#3b82f6"),se=ce(d.fillOpacity,.12),E=O(d.pricesColor,"#3b82f6"),D=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,$=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=R,B.lineWidth=V,B.fillColor=X,B.fillOpacity=se,B.showBackground=!!d.showBackground,B.showPrices=!!d.showPrices,B.pricesColor=E,B.rayLeft=!!d.rayLeft,B.rayRight=!!d.rayRight,B.arrowLeft=!!d.arrowLeft,B.arrowRight=!!d.arrowRight,B.p1={...u.p1,price:D},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:R,lineWidth:V,fillColor:X,fillOpacity:se,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...u.p1,price:D},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}He(R=>{const V=R.map(X=>X===u?y:X);return x.current=V,V}),fe.current===u&&(fe.current=y),z(R=>R===u?y:R),le(R=>R===u?y:R),q(y);try{c.current?.applyOptions({})}catch{}};Y.useEffect(()=>{const d=o.current;if(!d)return;const u=d.getBoundingClientRect(),O=w=>{const p=Math.abs(Number(w));return Number.isFinite(p)?p>=1e3?p.toFixed(2):p.toFixed(5):"0"},ce=Ee==="light",y=R0(d,{width:u.width||d.clientWidth,height:u.height||d.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:ce?"#FFFFFF":"#0d1117",type:"solid"},textColor:ce?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ze,color:Ze?ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0},horzLines:{visible:Ze,color:Ze?ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0}},rightPriceScale:{borderColor:ce?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:ce?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:ce?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:0,vertLine:{width:1,color:ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ce?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ce?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:We===1,horzLineVisible:We===1},handleScroll:{mouseWheel:!0,pressedMouseMove:We===null||We===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),R=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),V=R.includes("JPY"),X=rn(R),se=An(R);let E,D;V?(E=.001,D=w=>Math.abs(Number(w)).toFixed(3)):X?R.startsWith("BTC")||R.startsWith("ETH")?(E=.01,D=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,D=w=>Math.abs(Number(w)).toFixed(4)):se&&(R.startsWith("XAU")||R.startsWith("XAG"))?(E=.01,D=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,D=w=>Math.abs(Number(w)).toFixed(5));const $=y.addCandlestickSeries({upColor:ce?"#089981":"#26a69a",downColor:ce?"#f23645":"#ef5350",wickUpColor:ce?"#089981":"#26a69a",wickDownColor:ce?"#f23645":"#ef5350",borderUpColor:ce?"#089981":"#26a69a",borderDownColor:ce?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:E,formatter:D}}),C=y.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=y,h.current=$,m.current=C,C.setData(gl(Ne,Te)),requestAnimationFrame(()=>{if(d&&y){const w=d.getBoundingClientRect();w.width>0&&w.height>0&&y.resize(w.width,w.height)}});const B=y.timeScale(),f=()=>{if(me.current&&oi.current.size>0){const w=B.getVisibleRange();w&&Ie(w)}};B.subscribeVisibleTimeRangeChange(f);const L=new ResizeObserver(w=>{for(const p of w){const{width:_,height:P}=p.contentRect;if(_>0&&P>0&&y){const U=B.getVisibleRange();y.resize(_,P),U&&setTimeout(()=>{try{B.setVisibleRange(U)}catch{}},0)}}});return L.observe(d),()=>{B.unsubscribeVisibleTimeRangeChange(f),L.disconnect(),y.remove(),c.current=null,h.current=null,m.current=null,v.current=null,x.current=[],kA.current&&clearTimeout(kA.current)}},[]),Y.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Ze,color:Ze?"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0},horzLines:{visible:Ze,color:Ze?"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0}}})},[Ze]),Y.useEffect(()=>{const d=c.current;if(!d)return;const u=Ee==="light";d.applyOptions({layout:{background:{color:u?"#FFFFFF":"#12161d"},textColor:u?"#020617":"#fff"},grid:{vertLines:{color:Ze?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ze?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:u?"#e5e7eb":"#1e293b"},timeScale:{borderColor:u?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1},horzLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1}}})},[Ee,Ze]),Y.useEffect(()=>{const d=h.current;!d||!Ke||d.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor})},[Ke]),Y.useEffect(()=>{if(!c.current)return;const u=!Le&&!(We!==null&&We!==1&&We!==0),O=!Le;c.current.applyOptions({crosshair:{mode:0,vertLine:{visible:We===1||_A,width:1,color:Ee==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ee==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:We===1||_A,width:1,color:Ee==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ee==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:u,horzTouchDrag:u,vertTouchDrag:u},handleScale:{axisPressedMouseMove:{time:u,price:u},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:u,price:u},mouseWheel:O,pinch:O}})},[We,Le,_A,Ee]);const Db=(d=!1)=>{const u=h.current,O=c.current;x.current.forEach(ce=>{if(ce.primitive)try{u&&u.detachPrimitive(ce.primitive)}catch{}if(ce.series&&ce.series!==u&&O)try{O.removeSeries(ce.series)}catch{}if(ce.priceLine&&u)try{u.removePriceLine(ce.priceLine)}catch{}if(ce.textPrimitive&&u)try{u.detachPrimitive(ce.textPrimitive)}catch{}}),x.current=[],He([]),De(null),d&&$T(ye,Te)},Yd=(d,u=!1)=>{d&&x.current.forEach(O=>{if(O.primitive){try{d.detachPrimitive(O.primitive)}catch{}try{d.attachPrimitive(O.primitive)}catch{}}if(u&&O.type==="pricelevel"&&O.priceLine)try{const ce=O.showPrice!==!1,y=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:ce,title:ce&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}if(u&&O.type==="horizontalray"&&O.priceLine)try{const ce=O.showPrice!==!1,y=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:ce,title:ce&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}})},Xs=Y.useCallback(()=>{GT(x.current,ye,Te)},[ye,Te]),_b=Y.useCallback(()=>{const d=c.current,u=h.current;if(!d||!u)return;const O=RT(ye,Te);if(!O.length)return;const ce=[];for(const y of O)try{let R=null;switch(y.type){case"pricelevel":{const V=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});R={...y,priceLine:V};break}case"horizontalray":{const V=new gd(y.price,y.rawOriginTime);u.attachPrimitive(V);const X=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});R={...y,primitive:V,priceLine:X};break}case"verticalline":{const V=new Ld(y.rawTime);u.attachPrimitive(V),R={...y,primitive:V};break}case"text":{const V=new Id(y.rawTime,y.price);y.text&&(V.text=y.text),u.attachPrimitive(V),R={...y,primitive:V};break}case"crossline":{const V=new Qd({rawTime:y.p.rawTime,price:y.p.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"infoline":{const V=y.info||{},X=new wd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},V);u.attachPrimitive(X),R={...y,primitive:X};break}case"rulerline":{const V=y.info||{},X=new cl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},V);u.attachPrimitive(X),R={...y,primitive:X};break}case"arrowedline":{const V=new hl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"rayline":{const V=new Td({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"extendedline":{const V=new bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"trendbyangle":{const V=new Fd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"trendline":case"gannline":{const V=y.type==="gannline"?"#7aa6ae":"#22c55e",X=d.addLineSeries({color:V,lineWidth:y.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),se=DA([{time:y.point1.time,value:y.point1.price},{time:y.point2.time,value:y.point2.price}]);se.length>0&&X.setData(se);const E=new xd(y.point1,y.point2,V,2);try{X.attachPrimitive(E)}catch{}R={...y,series:X,decoration:E};break}case"rectangle":{const V=new Bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"circle":{const V=new yd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"triangle":{const V=new Cd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"ellipse":{const V=new vd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1,minorRatio:y.minorRatio??.45,previewAsLine:!1});u.attachPrimitive(V),R={...y,primitive:V};break}case"fibonacci":{const V=new fl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"equidistantchannel":{const V=new pl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.b1.rawTime,price:y.b1.price},{rawTime:y.b2.rawTime,price:y.b2.price},{rawTime:y.bottomMid.rawTime,price:y.bottomMid.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"disjointchannel":{const V=new Ns({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"flattopbottom":{const V=new ul({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"regressionchannel":{const V=new Ks({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"stddevchannel":{const V=new dl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"andrewspitchfork":{const V=new Ud({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"gannfan":{const V=new Sd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"ganngrid":{const V=new Ed({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}default:continue}R&&ce.push(R)}catch{}ce.length&&(x.current.push(...ce),He(y=>[...y,...ce]))},[ye,Te,He]);Y.useEffect(()=>{const d=`${ye}_${Te}`;F.current===d&&Xs()},[dt,Xs,ye,Te]),Y.useEffect(()=>{(async()=>{if(!ye||!Te){Wt([]),me.current=!1;return}try{if(kA.current&&(clearTimeout(kA.current),kA.current=null),nr.current=!0,Gs(!0),Jd(null),Wt([]),me.current=!1,tn.current=!1,Me.current!==null&&Me.current!==ye&&(F.current=null,Db()),Me.current=ye,h.current)try{h.current.setData([])}catch{}const u=Pd(Te),O=ZT(Te,u),ce=Yt||ob?.VITE_BASE_URL||"http://localhost:5002",y=Qt?.candles||"/api/chart/candles",R=Lt?.candles||{},V={symbol:R.symbol||"symbol",timeframe:R.timeframe||"timeframe",limit:R.limit||"limit",daysBack:R.daysBack||"daysBack"},X={};X[V.symbol]=ye,X[V.timeframe]=Te,X[V.limit]=O,R.daysBack!==!1&&(X[V.daysBack]=u);const se=sessionStorage.getItem("token")??sessionStorage.getItem("authToken"),E=await Bt.get(`${ce}${y}`,{params:X,timeout:1e4,headers:se?{Authorization:`Bearer ${se}`}:{}});let D=[];if(Array.isArray(E.data)?D=E.data:E.data&&E.data.data&&Array.isArray(E.data.data)?D=E.data.data:E.data&&Array.isArray(E.data)&&(D=E.data),D&&D.length>0){const{candles:$,stats:C}=El(D,ye,Te);$.length>0?(Wt($),oi.current=new Map,$.forEach(B=>{oi.current.set(B.time,B)}),tn.current=!0,nr.current=!1,$s.current?.connected&&ye&&Te&&$s.current.emit("subscribeCandles",{symbol:ye,timeframe:Te})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),nr.current=!1,Wt([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),nr.current=!1,Wt([])}catch(u){console.error(`❌ Error fetching ${ye}:`,u.message);const O=u.code==="ECONNABORTED"||u.message&&u.message.includes("timeout");Jd(O?"Request timed out. No data available for this symbol.":u.message||"Failed to load candles."),nr.current=!1,Wt([]),Gs(!1)}})()},[ye,Te,Lb]),Y.useEffect(()=>{$s.current=zn.getSocket();const d=$s.current,u=()=>{if(tn.current&&ye&&Te&&d.connected){const X={symbol:ye,timeframe:Te};d.emit("subscribeCandles",X)}},O=()=>{setTimeout(()=>{ye&&Te&&u()},200)},ce=X=>{},y=X=>{};d.on("connect",O),d.on("disconnect",ce),d.on("connect_error",y),d.on("subscription:confirmed",X=>{X.type});const R=X=>{if(!tn.current||!X||!X.candle||!X.symbol)return;const se=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(se(X.symbol)!==se(ye)||X.timeframe&&X.timeframe!==Te)return;const{candle:E}=X,D=Ll(E,ye,Te);if(!D)return;const $=Date.now();if($-Zd.current<200)return;Zd.current=$;const C=c.current?.timeScale(),B=C?.getVisibleRange(),f=h.current,L=c.current;if(!(!f||!L||!me.current&&!tn.current||f?.seriesType?.()!==(be==="line"?"Line":be==="area"?"Area":be==="bars"?"Bar":"Candlestick")))try{const _=oi.current.get(D.time),P=!_,U=_?{time:D.time,open:_.open,high:Math.max(_.high,D.high),low:Math.min(_.low,D.low),close:D.close}:D;oi.current.set(D.time,U),P&&m.current&&m.current.setData(gl(Array.from(oi.current.values()),Te));try{be==="line"||be==="area"?f.update({time:U.time,value:U.close}):f.update(U),C&&B&&Ie(B)}catch(k){throw k}const b=ze.current||{},g=Ve.current||{},M=_e.current;if(Object.keys(M).length>0){const k=Array.from(oi.current.values()).sort((K,W)=>K.time-W.time);if(b.sma20&&M.sma20){const K=Vs(k,g.smaPeriod||20);if(K)try{M.sma20.update(K)}catch{}}if(b.sma50&&M.sma50){const K=Vs(k,50);if(K)try{M.sma50.update(K)}catch{}}if(b.ema12&&M.ema12){const K=Nd(k,g.emaPeriod||12);if(K)try{M.ema12.update(K)}catch{}}if(b.rsi&&M.rsi){const K=Kd(k,g.rsiPeriod||14);if(K){try{M.rsi.update(K)}catch{}if(M.rsi70)try{M.rsi70.update({time:K.time,value:70})}catch{}if(M.rsi30)try{M.rsi30.update({time:K.time,value:30})}catch{}}}if(b.macd&&M.macdLine){const K=zd(k,12,26,9);if(K){try{M.macdLine.update({time:K.time,value:K.value})}catch{}try{M.macdSignal.update({time:K.time,value:K.signal})}catch{}try{M.macdHist.update({time:K.time,value:K.histogram,color:K.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(b.bollinger&&M.bbMiddle){const K=qs(k,g.bbPeriod||20,g.bbStdDev||2);if(K){try{M.bbUpper.update({time:K.time,value:K.upper})}catch{}try{M.bbMiddle.update({time:K.time,value:K.middle})}catch{}try{M.bbLower.update({time:K.time,value:K.lower})}catch{}}}}}catch{}};d.on("candleUpdate",R);const V=()=>{d.connected&&ye&&Te&&u()};if(d.connected)V();else{const X=()=>{setTimeout(V,200)};d.once("connect",X),setTimeout(()=>{d.connected&&V()},500)}return()=>{d.off("candleUpdate",R),d.off("connect",O),d.off("disconnect",ce),d.off("connect_error",y),d.off("subscription:confirmed"),ye&&Te&&d.connected&&d.emit("unsubscribeCandles",{symbol:ye,timeframe:Te})}},[ye,Te,Yt]),Y.useEffect(()=>{const d=h.current,u=c.current;if(!(!d||!u)&&!(nr.current&&Ne.length>0)&&!(Ne.length===0&&me.current)){if(Ne.length===0&&!me.current){if(lA)return;const O=u.timeScale();d.setData([]),O.fitContent(),kA.current&&clearTimeout(kA.current),kA.current=setTimeout(()=>requestAnimationFrame(()=>Gs(!1)),400);return}if(!me.current){const O=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),ce=O.includes("JPY"),y=An(O),R=rn(O);let V,X;ce?(V=.001,X=f=>Math.abs(Number(f)).toFixed(3)):R?O.startsWith("BTC")||O.startsWith("ETH")?(V=.01,X=f=>Math.abs(Number(f)).toFixed(2)):(V=1e-4,X=f=>Math.abs(Number(f)).toFixed(4)):y&&(O.startsWith("XAU")||O.startsWith("XAG"))?(V=.01,X=f=>Math.abs(Number(f)).toFixed(2)):(V=1e-4,X=f=>Math.abs(Number(f)).toFixed(5));try{d.applyOptions({priceFormat:{type:"custom",minMove:V,formatter:X}})}catch{}const se=u.timeScale(),E=$e(ye,Te);Se.current,Se.current=E;const D=[...Ne].sort((f,L)=>f.time-L.time);if(be==="line"||be==="area"){const f=D?.map(L=>({time:L.time,value:L.close})).filter(L=>L.time!=null);f.length>0&&d.setData(f)}else D?.length>0&&d.setData(D);Ke&&d.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor}),Yd(d);const $=`${ye}_${Te}`;F.current!==$&&(F.current=$,_b());const C=BA(Te)||60;if(x.current.forEach(f=>{if(f.type==="horizontalray"&&f.primitive){const U=f.rawOriginTime??f.primitive.originTime,b=Re(U,C);f.primitive.originTime=b,f.originTime=b;return}if(f.type==="verticalline"&&f.primitive){const U=f.rawTime??f.primitive.time,b=Re(U,C);f.primitive.time=b,f.time=te(b);return}if(f.type==="infoline"&&f.primitive&&f.p1&&f.p2){const U=f.rawP1Time??f.p1.rawTime,b=f.rawP2Time??f.p2.rawTime,g=D.length>0?D[0].time:null,M=D.length>0?D[D.length-1].time:null,k=Z=>{const Ae=Re(Z,C);return g==null||M==null?Ae:Math.min(Math.max(Ae,g),M)},K=k(U),W=k(b);f.p1.rawTime=K,f.p1.normalizedTime=te(K),f.p2.rawTime=W,f.p2.normalizedTime=te(W),f.primitive.p1={rawTime:K,price:f.p1.price},f.primitive.p2={rawTime:W,price:f.p2.price};return}if(f.type==="rulerline"&&f.primitive&&f.p1&&f.p2){const U=f.rawP1Time??f.p1.rawTime,b=f.rawP2Time??f.p2.rawTime,g=D.length>0?D[0].time:null,M=D.length>0?D[D.length-1].time:null,k=Be=>{const Ce=Re(Be,C);return g==null||M==null?Ce:Math.min(Math.max(Ce,g),M)},K=k(U),W=k(b);f.p1.rawTime=K,f.p2.rawTime=W,f.primitive.p1={rawTime:K,price:f.p1.price},f.primitive.p2={rawTime:W,price:f.p2.price};const Z=te(K),Ae=te(W),he=Math.abs((Ae??0)-(Z??0));f.primitive.info={priceDiff:f.p2.price-f.p1.price,pricePct:(f.p2.price-f.p1.price)/Math.abs(f.p1.price||1)*100,bars:zs(Rs,K,W,Te),days:Math.max(1,Math.round(he/86400))};return}if(f.type==="arrowedline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="rayline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="extendedline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="trendbyangle"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="disjointchannel"&&f.primitive&&f.p1&&f.p2&&f.p3&&f.p4){const U=b=>{const g=Re(b.rawTime,C);b.rawTime=g,b.normalizedTime=te(g)};U(f.p1),U(f.p2),U(f.p3),U(f.p4),f.primitive.p1={rawTime:f.p1.rawTime,price:f.p1.price},f.primitive.p2={rawTime:f.p2.rawTime,price:f.p2.price},f.primitive.p3={rawTime:f.p3.rawTime,price:f.p3.price},f.primitive.p4={rawTime:f.p4.rawTime,price:f.p4.price};return}if(f.type==="flattopbottom"&&f.primitive&&f.p1&&f.p2&&f.p3&&f.p4){const U=b=>{const g=Re(b.rawTime,C);b.rawTime=g,b.normalizedTime=te(g)};U(f.p1),U(f.p2),U(f.p3),U(f.p4),f.primitive.p1={rawTime:f.p1.rawTime,price:f.p1.price},f.primitive.p2={rawTime:f.p2.rawTime,price:f.p2.price},f.primitive.p3={rawTime:f.p3.rawTime,price:f.p3.price},f.primitive.p4={rawTime:f.p4.rawTime,price:f.p4.price};return}if(f.type==="regressionchannel"&&f.primitive&&f.p1&&f.p2){const U=Jr(D,f.p1,f.p2,f.stdMultiplier??1);if(!U)return;const b=f.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},f.p1=U.p1,f.p2=U.p2,f.top1=U.top1,f.top2=U.top2,f.bot1=U.bot1,f.bot2=U.bot2,f.slope=U.slope,f.intercept=U.intercept,f.stdDev=U.stdDev,f.offset=U.offset,f.barCount=U.barCount;return}if(f.type==="stddevchannel"&&f.primitive&&f.p1&&f.p2){const U=Zr(D,f.p1,f.p2,f.stdMultiplier??1);if(!U)return;const b=f.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},f.p1=U.p1,f.p2=U.p2,f.top1=U.top1,f.top2=U.top2,f.bot1=U.bot1,f.bot2=U.bot2,f.slope=U.slope,f.stdDev=U.stdDev,f.offset=U.offset,f.barCount=U.barCount;return}if(f.type==="andrewspitchfork"&&f.primitive&&f.p1&&f.p2&&f.p3){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C),g=Re(f.p3.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.p3.rawTime=g,f.p3.normalizedTime=te(g),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price},f.primitive.p3={rawTime:g,price:f.p3.price};return}if((f.type==="gannfan"||f.type==="ganngrid")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if((f.type==="circle"||f.type==="ellipse")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if(f.type==="triangle"&&f.primitive&&f.p1&&f.p2&&f.p3){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C),g=Re(f.p3.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.p3.rawTime=g,f.p3.normalizedTime=te(g),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price},f.primitive.p3={rawTime:g,price:f.p3.price};return}if((f.type==="fibonacci"||f.type==="rectangle")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if(f.type!=="trendline"&&f.type!=="gannline"||!f.series||!f.point1||!f.point2)return;const L=f.point1.rawTime??f.point1.time,w=f.point2.rawTime??f.point2.time,p=Re(L,C),_=Re(w,C);f.point1.time=p,f.point2.time=_;const P=DA([{time:p,value:f.point1.price},{time:_,value:f.point2.price}]);try{P.length>0&&f.series.setData(P)}catch{}}),D?.length>0){const f=D[D?.length-1].time,L=BA(Te)||60,p=f-(Te==="M1"?150:Te==="M5"?120:100)*L;try{se.setVisibleRange({from:p,to:f+L*Dd})}catch{se.fitContent()}}else se.fitContent();try{u.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0;const B=se.getVisibleRange();Ie(B),kA.current&&clearTimeout(kA.current),kA.current=setTimeout(()=>requestAnimationFrame(()=>Gs(!1)),400)}}},[Ne.length,be,ye,Te]),Y.useEffect(()=>{const d=c.current;if(!d||!me.current||Ne.length===0)return;const u=d.timeScale(),O=u.getVisibleRange()||Ye();if(h.current)try{d.removeSeries(h.current)}catch{}if(v.current)try{d.removeSeries(v.current),v.current=null}catch{}let ce;const y=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),R=y.includes("JPY"),V=An(y),X=rn(y);let se,E;R?(se=.001,E=C=>Math.abs(Number(C)).toFixed(3)):X?y.startsWith("BTC")||y.startsWith("ETH")?(se=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(se=1e-4,E=C=>Math.abs(Number(C)).toFixed(4)):V&&(y.startsWith("XAU")||y.startsWith("XAG"))?(se=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(se=1e-4,E=C=>Math.abs(Number(C)).toFixed(5));const D={type:"custom",minMove:se,formatter:E};if(be==="bars"){const C=Ee==="light";ce=d.addBarSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const B=[...Ne].sort((f,L)=>f.time-L.time);B?.length>0&&ce.setData(B)}else if(be==="line"){ce=d.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const C=DA(Cl);C.length>0&&ce.setData(C)}else if(be==="area"){ce=d.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const C=DA(Cl);C.length>0&&ce.setData(C)}else if(be==="volume ticks"||be==="volume"){const C=Ee==="light";ce=d.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:D,priceScaleId:"right"});const B=[...Ne].sort((w,p)=>w.time-p.time);B?.length>0&&ce.setData(B);const f=d.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),d.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const L=B?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));L.length>0&&f.setData(L),v.current=f}else{const C=Ee==="light";ce=d.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const B=[...Ne].sort((f,L)=>f.time-L.time);B?.length>0&&ce.setData(B)}if(h.current=ce,Ke&&ce)try{ce.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor})}catch{}Yd(ce,!0);const $=BA(Te)||60;if(x.current.forEach(C=>{if(C.type==="horizontalray"&&C.primitive){const U=C.rawOriginTime??C.primitive.originTime,b=Re(U,$);C.primitive.originTime=b,C.originTime=b;return}if(C.type==="verticalline"&&C.primitive){const U=C.rawTime??C.primitive.time,b=Re(U,$);C.primitive.time=b,C.time=te(b);return}if(C.type==="infoline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,g=[...Ne].sort((Ae,he)=>Ae.time-he.time),M=g.length>0?g[0].time:null,k=g.length>0?g[g.length-1].time:null,K=Ae=>{const he=Re(Ae,$);return M==null||k==null?he:Math.min(Math.max(he,M),k)},W=K(U),Z=K(b);C.p1.rawTime=W,C.p1.normalizedTime=te(W),C.p2.rawTime=Z,C.p2.normalizedTime=te(Z),C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:Z,price:C.p2.price};return}if(C.type==="rulerline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,g=[...Ne].sort((Ce,Ue)=>Ce.time-Ue.time),M=g.length>0?g[0].time:null,k=g.length>0?g[g.length-1].time:null,K=Ce=>{const Ue=Re(Ce,$);return M==null||k==null?Ue:Math.min(Math.max(Ue,M),k)},W=K(U),Z=K(b);C.p1.rawTime=W,C.p2.rawTime=Z,C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:Z,price:C.p2.price};const Ae=te(W),he=te(Z),Be=Math.abs((he??0)-(Ae??0));C.primitive.info={priceDiff:C.p2.price-C.p1.price,pricePct:(C.p2.price-C.p1.price)/Math.abs(C.p1.price||1)*100,bars:zs(Rs,W,Z,Te),days:Math.max(1,Math.round(Be/86400))};return}if(C.type==="arrowedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="rayline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="extendedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="trendbyangle"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="disjointchannel"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const g=Re(b.rawTime,$);b.rawTime=g,b.normalizedTime=te(g)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="flattopbottom"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const g=Re(b.rawTime,$);b.rawTime=g,b.normalizedTime=te(g)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="regressionchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Ne].sort((M,k)=>M.time-k.time),b=Jr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const g=C.primitive;g.mid1={rawTime:b.p1.rawTime,price:b.p1.price},g.mid2={rawTime:b.p2.rawTime,price:b.p2.price},g.top1={rawTime:b.top1.rawTime,price:b.top1.price},g.top2={rawTime:b.top2.rawTime,price:b.top2.price},g.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},g.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.intercept=b.intercept,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="stddevchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Ne].sort((M,k)=>M.time-k.time),b=Zr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const g=C.primitive;g.mid1={rawTime:b.p1.rawTime,price:b.p1.price},g.mid2={rawTime:b.p2.rawTime,price:b.p2.price},g.top1={rawTime:b.top1.rawTime,price:b.top1.price},g.top2={rawTime:b.top2.rawTime,price:b.top2.price},g.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},g.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="andrewspitchfork"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$),g=Re(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=g,C.p3.normalizedTime=te(g),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:g,price:C.p3.price};return}if((C.type==="gannfan"||C.type==="ganngrid")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if((C.type==="circle"||C.type==="ellipse")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type==="triangle"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$),g=Re(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=g,C.p3.normalizedTime=te(g),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:g,price:C.p3.price};return}if((C.type==="fibonacci"||C.type==="rectangle")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type!=="trendline"&&C.type!=="gannline"||!C.series||!C.point1||!C.point2)return;const B=C.type==="gannline"?"#7aa6ae":"#22c55e";try{d.removeSeries(C.series)}catch{}const f=d.addLineSeries({color:C.lineColor??B,lineWidth:C.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),L=C.point1.rawTime??C.point1.time,w=C.point2.rawTime??C.point2.time,p=Re(L,$),_=Re(w,$);C.point1.time=p,C.point2.time=_;const P=DA([{time:p,value:C.point1.price},{time:_,value:C.point2.price}]);try{P.length>0&&f.setData(P)}catch{}if(C.decoration)try{f.attachPrimitive(C.decoration)}catch{}C.series=f}),O&&me.current)setTimeout(()=>{try{u.setVisibleRange(O),Ie(O)}catch{if(Ne.length>0)try{const B=Ne[Ne.length-1].time,f=BA(Te)||60,L=B-100*f;u.setVisibleRange({from:L,to:B+f*Dd}),Ie(u.getVisibleRange())}catch{u.fitContent(),Ie(u.getVisibleRange())}}try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!me.current){u.fitContent();try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0,Ie(u.getVisibleRange())}},[be,Ne.length,Cl.length,ye,Ke]),Y.useEffect(()=>{const d=c.current,u=v.current;if(!d||!u||!me.current||Ne.length===0||be!=="volume"&&be!=="volume ticks")return;const ce=[...Ne].sort((y,R)=>y.time-R.time)?.map(y=>({time:y.time,value:y.volume||0,color:y.close>=y.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));ce.length>0&&u.setData(ce)},[Ne,be]),Y.useEffect(()=>{if(!ye||!Te||!Ct)return;const u=Object.entries(Ct).filter(([X,se])=>se).map(([X])=>X).filter(X=>X.startsWith("sma")||X.startsWith("ema")||X==="rsi"||X==="macd");if(u.length===0){et({});return}const O=u.map(X=>X==="sma20"?`sma:${Ut?.smaPeriod||20}`:X==="sma50"?"sma:50":X==="ema12"?`ema:${Ut?.emaPeriod||12}`:X==="rsi"?`rsi:${Ut?.rsiPeriod||14}`:X==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!O)return;const ce=++bt.current,y=Yt||"http://localhost:5002",R=Qt?.indicators||"/api/market-data/indicators",V=sessionStorage.getItem("token")??sessionStorage.getItem("authToken");Bt.get(`${y}${R}`,{params:{symbol:ye,timeframe:Te,indicators:O},headers:V?{Authorization:`Bearer ${V}`}:{}}).then(X=>{ce===bt.current&&et(X.data?.data||{})}).catch(X=>{console.error("[ChartArea] Indicator fetch error:",X?.message),ce===bt.current&&et({})})},[ye,Te,Ct,Ut,Yt,Qt]),Y.useEffect(()=>{const d=c.current;if(!d||!me.current)return;const u=_e.current,O=(D,$)=>(u[D]||(u[D]=d.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...$})),u[D]),ce=D=>{if(u[D]){try{d.removeSeries(u[D])}catch{}delete u[D]}},y=()=>{["macdLine","macdSignal","macdHist"].forEach(ce)},R=Ct||{};if(R.sma20&&Je.sma20?.data?.length?O("sma20",{color:"#2196F3",lineWidth:1.5}).setData(Je.sma20.data.map($=>({time:$.time,value:$.value}))):ce("sma20"),R.sma50&&Je.sma50?.data?.length?O("sma50",{color:"#FF9800",lineWidth:1.5}).setData(Je.sma50.data.map($=>({time:$.time,value:$.value}))):ce("sma50"),R.ema12&&Je.ema12?.data?.length?O("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(Je.ema12.data.map($=>({time:$.time,value:$.value}))):ce("ema12"),R.rsi&&Je.rsi?.data?.length){const D=O("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:f=>f.toFixed(1)}});d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),D.setData(Je.rsi.data.map(f=>({time:f.time,value:f.value}))),u.rsi70||(u.rsi70=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),u.rsi30||(u.rsi30=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const $=Je.rsi.data,C=$[0]?.time,B=$[$.length-1]?.time;C&&B&&(u.rsi70.setData([{time:C,value:70},{time:B,value:70}]),u.rsi30.setData([{time:C,value:30},{time:B,value:30}]))}else ce("rsi"),ce("rsi70"),ce("rsi30");if(R.macd&&Je.macd?.data?.length){const D=O("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:f=>f.toFixed(4)}}),$=O("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});u.macdHist||(u.macdHist=d.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:f=>f.toFixed(4)}}));const C=R.rsi?.65:.8;d.priceScale("macd").applyOptions({scaleMargins:{top:C,bottom:0},borderVisible:!1,autoScale:!0}),R.rsi&&d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const B=Je.macd.data;D.setData(B.map(f=>({time:f.time,value:f.value}))),$.setData(B.map(f=>({time:f.time,value:f.signal}))),u.macdHist.setData(B.map(f=>({time:f.time,value:f.histogram,color:f.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else y();const V=()=>{["bbUpper","bbMiddle","bbLower"].forEach(ce)};if(R.bollinger){const D=Array.from(oi.current.values()).sort((f,L)=>f.time-L.time),$=Ve.current?.bbPeriod||20,C=Ve.current?.bbStdDev||2,B=Ml(D,$,C);if(B){const f=O("bbUpper",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2}),L=O("bbMiddle",{color:"rgba(33,150,243,0.8)",lineWidth:1.5}),w=O("bbLower",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2});f.setData(B.upper),L.setData(B.middle),w.setData(B.lower)}}else V();const X=Array.from(oi.current.values()).sort((D,$)=>D.time-$.time);if(X.length>0){const D=Ve.current||{};if(R.sma20&&u.sma20){const $=Vs(X,D.smaPeriod||20);if($)try{u.sma20.update($)}catch{}}if(R.sma50&&u.sma50){const $=Vs(X,50);if($)try{u.sma50.update($)}catch{}}if(R.ema12&&u.ema12){const $=Nd(X,D.emaPeriod||12);if($)try{u.ema12.update($)}catch{}}if(R.rsi&&u.rsi){const $=Kd(X,D.rsiPeriod||14);if($){try{u.rsi.update($)}catch{}if(u.rsi70)try{u.rsi70.update({time:$.time,value:70})}catch{}if(u.rsi30)try{u.rsi30.update({time:$.time,value:30})}catch{}}}if(R.macd&&u.macdLine){const $=zd(X,12,26,9);if($){try{u.macdLine.update({time:$.time,value:$.value})}catch{}try{u.macdSignal.update({time:$.time,value:$.signal})}catch{}try{u.macdHist.update({time:$.time,value:$.histogram,color:$.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(R.bollinger&&u.bbMiddle){const $=qs(X,D.bbPeriod||20,D.bbStdDev||2);if($){try{u.bbUpper.update({time:$.time,value:$.upper})}catch{}try{u.bbMiddle.update({time:$.time,value:$.middle})}catch{}try{u.bbLower.update({time:$.time,value:$.lower})}catch{}}}}const se=R.rsi&&Je.rsi?.data?.length||R.macd&&Je.macd?.data?.length,E=R.rsi&&Je.rsi?.data?.length&&R.macd&&Je.macd?.data?.length;try{d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:E?.4:se?.25:.05}})}catch{}},[Je,Ct,Ne.length]),Y.useEffect(()=>()=>{const d=c.current;if(!d)return;const u=_e.current;Object.keys(u).forEach(O=>{try{d.removeSeries(u[O])}catch{}}),_e.current={}},[ye,Te]),Y.useEffect(()=>{const d=c.current,u=h.current,O=o.current;if(!d||!u||!O)return;const y=We!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][We]:null,R=(E,D)=>{const $=Math.min(E.time,D.time),C=Math.max(E.time,D.time),B=E.time<=D.time?E.rawTime:D.rawTime,f=E.time<=D.time?D.rawTime:E.rawTime,L=Math.max(E.price,D.price),w=Math.min(E.price,D.price),p=te(Math.round(($+C)/2));return p==null?null:{p1:{rawTime:p,normalizedTime:p,price:L},p2:{rawTime:B,normalizedTime:$,price:w},p3:{rawTime:f,normalizedTime:C,price:w}}};if(!y){if(T.current=!1,S.current=null,I.current=null,N.current=null,Q.current?.series)try{d.removeSeries(Q.current.series)}catch{}if(Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null;return}if(y==="pricelevel"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const p={type:"pricelevel",priceLine:u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:L.toFixed(5)}),price:L,showPrice:!0,showText:!1};He(_=>[..._,p]),x.current.push(p),De(null)};return O.addEventListener("click",E),()=>{O.removeEventListener("click",E)}}if(y==="horizontalray"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=new gd(L,f);u.attachPrimitive(w);const p=u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof L=="number"?L.toFixed(5):""}),_=te(f),P={type:"horizontalray",primitive:w,priceLine:p,price:L,originTime:_,rawOriginTime:f,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};He(U=>[...U,P]),x.current.push(P),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="verticalline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=d.timeScale().coordinateToTime(C);if(B==null)return;const f=new Ld(B);u.attachPrimitive(f);const L=te(B),w={type:"verticalline",primitive:f,time:L,rawTime:B,lineColor:"#3b82f6",lineWidth:2,showDate:!0};He(p=>[...p,w]),x.current.push(w),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="text"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=new Id(f,L);u.attachPrimitive(w);const p={type:"text",primitive:w,rawTime:f,price:L,text:"Text"};He(_=>[..._,p]),x.current.push(p),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="infoline"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;D||(D=d.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const P=E.normalizedTime,U=te(p);if(P==null||U==null||P===U)return;const b=P<=U?[{time:P,value:E.price},{time:U,value:_}]:[{time:U,value:_},{time:P,value:E.price}];try{D.setData(b)}catch{}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p),x:L,y:w};return}if(D){try{d.removeSeries(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null)return;const b=_-E.price,g=b/Math.abs(E.price)*100,M=BA(Te)||3600,k=Math.abs(U-P),K=Math.max(1,Math.round(k/M)),W=Math.max(1,Math.round(k/86400)),Z=E.x,Ae=E.y,he=L,Ce=Math.atan2(-(w-Ae),he-Z)*(180/Math.PI),Ue={priceDiff:b,pricePct:g,bars:K,days:W,angle:Ce},qe=new wd({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_},Ue);u.attachPrimitive(qe);const rt={type:"infoline",primitive:qe,rawP1Time:E.rawTime,rawP2Time:p,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};He(Xe=>[...Xe,rt]),x.current.push(rt),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{d.removeSeries(D)}catch{}}}if(y==="rulerline"){let E=null,D=null;const $=(f,L,w,p)=>{const _=te(f),P=te(w),U=p-L,b=U/Math.abs(L)*100,g=zs(Rs,f,w,Te),M=Math.abs((P??0)-(_??0)),k=Math.max(1,Math.round(M/86400));return{priceDiff:U,pricePct:b,bars:g,days:k}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null||U===E.normalizedTime)return;const b=$(E.rawTime,E.price,_,P);if(!D)D=new cl({rawTime:E.rawTime,price:E.price},{rawTime:_,price:P},b),u.attachPrimitive(D);else{D.p2={rawTime:_,price:P},D.info=b;const g=P>=E.price;D.color=g?"#3b82f6":"#ef5350",D.fillColor=g?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;if(!E){E={rawTime:_,price:P,normalizedTime:te(_)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const U=E.normalizedTime,b=te(_);if(U==null||b==null)return;const g=$(E.rawTime,E.price,_,P),M=new cl({rawTime:E.rawTime,price:E.price},{rawTime:_,price:P},g);u.attachPrimitive(M);const k={type:"rulerline",primitive:M,rawP1Time:E.rawTime,rawP2Time:_,p1:{rawTime:E.rawTime,normalizedTime:U,price:E.price},p2:{rawTime:_,normalizedTime:b,price:P},lineColor:P>=E.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="arrowedline"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;const P=te(p);if(!(P==null||P===E.normalizedTime))if(!D)D=new hl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_}),u.attachPrimitive(D);else{D.p2={rawTime:p,price:_};try{c.current?.applyOptions({})}catch{}}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null||P===U)return;const b=new hl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_});u.attachPrimitive(b);const g={type:"arrowedline",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(M=>[...M,g]),x.current.push(g),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{u.detachPrimitive(D)}catch{}}}if(y==="rayline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new Td({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"rayline",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="extendedline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new bd({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"extendedline",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="crossline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p=new Qd({rawTime:f,price:L});u.attachPrimitive(p);const _={type:"crossline",primitive:p,p:{rawTime:f,normalizedTime:w,price:L},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};He(P=>[...P,_]),x.current.push(_),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendbyangle"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new Fd({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"trendbyangle",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="disjointchannel"){let E=null,D=null,$=null,C=null,B=0,f=null;const L=(_,P,U,b)=>{if(!f)f=new Ns(_,P,U,b),u.attachPrimitive(f);else{f.p1=_,f.p2=P,f.p3=U,f.p4=b;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(B===0||!E)return;const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top;if(B===1){const g=u.coordinateToPrice(b);if(g==null)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:g},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===2&&D){const g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k==null)return;const K=(E.price+D.price)/2;M>=K?($={rawTime:g,normalizedTime:k,price:M},C={rawTime:g,normalizedTime:k,price:2*K-M}):(C={rawTime:g,normalizedTime:k,price:M},$={rawTime:g,normalizedTime:k,price:2*K-M}),L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=_=>{const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top,g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k!=null){if(B===0){E={rawTime:g,normalizedTime:k,price:M},D={rawTime:g,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&f){try{u.detachPrimitive(f)}catch{}const K=new Ns(f.p1,f.p2,f.p3,f.p4);u.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:E,p2:D,p3:{rawTime:f.p3.rawTime,normalizedTime:te(f.p3.rawTime),price:f.p3.price},p4:{rawTime:f.p4.rawTime,normalizedTime:te(f.p4.rawTime),price:f.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};He(Z=>[...Z,W]),x.current.push(W),De(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),f)try{u.detachPrimitive(f)}catch{}}}if(y==="flattopbottom"){let E=null,D=null,$=null,C=null,B=0,f=null;const L=(_,P,U,b)=>{if(!f)f=new ul(_,P,U,b),u.attachPrimitive(f);else{f.p1=_,f.p2=P,f.p3=U,f.p4=b;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(B===0||!E)return;const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top;if(B===1){const g=u.coordinateToPrice(b);if(g==null)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:g},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===2&&D){const g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k==null)return;$={rawTime:g,normalizedTime:k,price:M},C={rawTime:g,normalizedTime:k,price:D.price},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=_=>{const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top,g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k!=null){if(B===0){E={rawTime:g,normalizedTime:k,price:M},D={rawTime:g,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&f){try{u.detachPrimitive(f)}catch{}const K=new ul(f.p1,f.p2,f.p3,f.p4);u.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:E,p2:D,p3:{rawTime:f.p3.rawTime,normalizedTime:te(f.p3.rawTime),price:f.p3.price},p4:{rawTime:f.p4.rawTime,normalizedTime:te(f.p4.rawTime),price:f.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};He(Z=>[...Z,W]),x.current.push(W),De(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),f)try{u.detachPrimitive(f)}catch{}}}if(y==="regressionchannel"){let E=null,D=null;const $=(f,L)=>{f.mid1={rawTime:L.p1.rawTime,price:L.p1.price},f.mid2={rawTime:L.p2.rawTime,price:L.p2.price},f.top1={rawTime:L.top1.rawTime,price:L.top1.price},f.top2={rawTime:L.top2.rawTime,price:L.top2.price},f.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},f.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;const g=Jr(Ne,E,{rawTime:_,normalizedTime:U},1);if(g)if(!D)D=new Ks({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),u.attachPrimitive(D);else{$(D,g);try{d.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;if(!E){E={rawTime:_,normalizedTime:U,price:P};return}const g=Jr(Ne,E,{rawTime:_,normalizedTime:U},1);if(!g)return;if(D){try{u.detachPrimitive(D)}catch{}D=null}const M=new Ks({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});u.attachPrimitive(M);const k={type:"regressionchannel",primitive:M,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,intercept:g.intercept,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="stddevchannel"){let E=null,D=null;const $=(f,L)=>{f.mid1={rawTime:L.p1.rawTime,price:L.p1.price},f.mid2={rawTime:L.p2.rawTime,price:L.p2.price},f.top1={rawTime:L.top1.rawTime,price:L.top1.price},f.top2={rawTime:L.top2.rawTime,price:L.top2.price},f.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},f.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;const g=Zr(Ne,E,{rawTime:_,normalizedTime:U,price:P},1);if(g)if(!D)D=new dl({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),u.attachPrimitive(D);else{$(D,g);try{d.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;if(!E){E={rawTime:_,normalizedTime:U,price:P};return}const g=Zr(Ne,E,{rawTime:_,normalizedTime:U,price:P},1);if(!g)return;if(D){try{u.detachPrimitive(D)}catch{}D=null}const M=new dl({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});u.attachPrimitive(M);const k={type:"stddevchannel",primitive:M,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="andrewspitchfork"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p=C+140,_=d.timeScale().coordinateToTime(p);if(_==null)return;const P=te(_);if(P==null)return;const U={rawTime:f,normalizedTime:w,price:L},b={rawTime:_,normalizedTime:P,price:L},g={rawTime:f,normalizedTime:w,price:L},M=new Ud({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:g.rawTime,price:g.price});u.attachPrimitive(M);const k={type:"andrewspitchfork",primitive:M,p1:U,p2:b,p3:g};He(K=>[...K,k]),x.current.push(k),z(k),fe.current=k,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="gannfan"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p={rawTime:f,normalizedTime:w,price:L},_={rawTime:f,normalizedTime:w,price:L},P=new Sd({rawTime:p.rawTime,price:p.price},{rawTime:_.rawTime,price:_.price});u.attachPrimitive(P);const U={type:"gannfan",primitive:P,p1:p,p2:_};He(b=>[...b,U]),x.current.push(U),z(U),fe.current=U,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="ganngrid"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p={rawTime:f,normalizedTime:w,price:L},_={rawTime:f,normalizedTime:w,price:L},P=new Ed({rawTime:p.rawTime,price:p.price},{rawTime:_.rawTime,price:_.price});u.attachPrimitive(P);const U={type:"ganngrid",primitive:P,p1:p,p2:_};He(b=>[...b,U]),x.current.push(U),z(U),fe.current=U,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendline"||y==="gannline"){const E=y,D=E==="gannline"?"#7aa6ae":"#22c55e",$=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,_=L.clientY-w.top;let P=d.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(_);if(!(P==null||U==null)&&(P=te(P),P!=null))if(N.current===null){N.current={time:P,price:U};const b=d.addLineSeries({color:D,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:E,series:b},b.setData([{time:P,value:U}])}else{const b=N.current,g={time:P,price:U},M=1,k=1e-5,K=Math.abs(g.time-b.time),W=Math.abs(g.price-b.price);if(K<M&&W<k){try{d.removeSeries(Q.current.series)}catch{}N.current=null,Q.current=null;return}const Z={time:b.time,rawTime:b.time,price:b.price},Ae={time:g.time,rawTime:g.time,price:g.price},he=DA([{time:Z.time,value:Z.price},{time:Ae.time,value:Ae.price}]);if(he.length>0){Q.current.series.setData(he);const Be=new xd(Z,Ae,D,2);try{Q.current.series.attachPrimitive(Be)}catch{}const Ce={type:E,series:Q.current.series,point1:Z,point2:Ae,decoration:Be};He(Ue=>[...Ue,Ce]),x.current.push(Ce)}De(null),N.current=null,Q.current=null}},C=L=>{if(N.current===null||Q.current?.type!=="trendline"&&Q.current?.type!=="gannline")return;L.preventDefault(),L.stopPropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,_=L.clientY-w.top;let P=d.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(_);if(P==null||U==null||(P=te(P),P==null))return;const b=N.current,g=DA([{time:b.time,value:b.price},{time:P,value:U}]);g.length>0&&Q.current.series.setData(g)},B=L=>{L.stopPropagation()},f={capture:!0,passive:!1};return O.addEventListener("click",$,f),O.addEventListener("mousemove",C,f),O.addEventListener("mousemove",B,f),()=>{if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{d.removeSeries(Q.current.series)}catch{}Q.current=null}O.removeEventListener("click",$,f),O.removeEventListener("mousemove",C,f),O.removeEventListener("mousemove",B,f)}}if(y==="parallellines"){let E=null,D=null,$=null,C=0,B=null;const f=(U,b,g,M)=>{U.p1={rawTime:b.rawTime,price:b.price},U.p2={rawTime:g.rawTime,price:g.price},U.b1={rawTime:M.b1.rawTime,price:M.b1.price},U.b2={rawTime:M.b2.rawTime,price:M.b2.price},U.p3={rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}},L=(U,b,g)=>{const M=Od(U,b,g);if(!M)return null;if(!B)B=new pl({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:M.b1.rawTime,price:M.b1.price},{rawTime:M.b2.rawTime,price:M.b2.price},{rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}),u.attachPrimitive(B);else{f(B,U,b,M);try{d.applyOptions({})}catch{}}return M},w=U=>{U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation();const b=O.getBoundingClientRect(),g=U.clientX-b.left,M=U.clientY-b.top,k=d.timeScale().coordinateToTime(g),K=u.coordinateToPrice(M);if(k==null||K==null)return;const W=te(k);if(W!=null){if(C===0){E={rawTime:k,normalizedTime:W,price:K},C=1;return}if(C===1){if(D={rawTime:k,normalizedTime:W,price:K},Math.abs(D.normalizedTime-E.normalizedTime)<1)return;const Z=te((E.normalizedTime+D.normalizedTime)/2);if(Z==null)return;const Ae=(E.price+D.price)/2;$={rawTime:Z,normalizedTime:Z,price:Ae},L(E,D,$),C=2;return}if(C===2&&E&&D){$={rawTime:k,normalizedTime:W,price:K};const Z=L(E,D,$);if(!Z||!B)return;try{u.detachPrimitive(B)}catch{}const Ae=new pl({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:Z.b1.rawTime,price:Z.b1.price},{rawTime:Z.b2.rawTime,price:Z.b2.price},{rawTime:Z.bottomMid.rawTime,price:Z.bottomMid.price});u.attachPrimitive(Ae);const he={type:"equidistantchannel",primitive:Ae,p1:E,p2:D,p3:Z.bottomMid,b1:Z.b1,b2:Z.b2,bottomMid:Z.bottomMid};He(Be=>[...Be,he]),x.current.push(he),De(null),C=0,E=null,D=null,$=null,B=null}}},p=U=>{if(C===0||!E)return;const b=O.getBoundingClientRect(),g=U.clientX-b.left,M=U.clientY-b.top,k=d.timeScale().coordinateToTime(g),K=u.coordinateToPrice(M);if(k==null||K==null)return;const W=te(k);if(W!=null){if(C===1){const Z={rawTime:k,normalizedTime:W,price:K},Ae=te((E.normalizedTime+Z.normalizedTime)/2);if(Ae==null)return;const he=(E.price+Z.price)/2;L(E,Z,{rawTime:Ae,price:he});return}C===2&&D&&L(E,D,{rawTime:k,price:K})}},_=U=>{U.stopPropagation()},P={capture:!0,passive:!1};return O.addEventListener("click",w,P),O.addEventListener("mousemove",p,P),O.addEventListener("mousemove",_,P),()=>{if(C=0,E=null,D=null,$=null,J.current=[],B)try{u.detachPrimitive(B)}catch{}B=null,O.removeEventListener("click",w,P),O.removeEventListener("mousemove",p,P),O.removeEventListener("mousemove",_,P)}}if(y==="fibonacci"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(!(p==null||_==null))if(!D)D=new fl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_}),u.attachPrimitive(D);else{D.p2={rawTime:p,price:_};try{d.applyOptions({})}catch{}}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null)return;if(Math.abs(_-E.price)<1e-5){E=null;return}const b=new fl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_});u.attachPrimitive(b);const g={type:"fibonacci",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_}};He(M=>[...M,g]),x.current.push(g),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{u.detachPrimitive(D)}catch{}}}if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{d.removeSeries(Q.current.series)}catch{}Q.current=null}const V=E=>{if(E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),y==="trendline"||y==="gannline"||y==="parallellines"||y==="fibonacci"||y!=="rectangle"&&y!=="circle"&&y!=="triangle"&&y!=="ellipse")return;const D=O.getBoundingClientRect(),$=E.clientX-D.left,C=E.clientY-D.top;let B=d.timeScale().coordinateToTime($);const f=u.coordinateToPrice(C);if(B==null||f==null)return;const L=B;if(B=te(B),B!=null){if(T.current=!0,S.current={time:B,normalizedTime:B,rawTime:L,price:f},I.current=null,y==="rectangle"){const w=new Bd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"rectangle",primitive:w}}if(y==="circle"){const w=new yd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",lineWidth:1});u.attachPrimitive(w),Q.current={type:"circle",primitive:w}}if(y==="triangle"){const w=new Cd({rawTime:L,price:f},{rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"triangle",primitive:w}}if(y==="ellipse"){const w=new vd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});u.attachPrimitive(w),Q.current={type:"ellipse",primitive:w}}if(y==="parallellines"){const w=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},X=E=>{if(!T.current||!S.current||!Q.current)return;E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const D=O.getBoundingClientRect(),$=E.clientX-D.left,C=E.clientY-D.top;let B=d.timeScale().coordinateToTime($);const f=u.coordinateToPrice(C);if(B==null||f==null)return;const L=B;if(B=te(B),B==null)return;I.current={time:B,normalizedTime:B,rawTime:L,price:f};const w=S.current;if(Q.current.type==="rectangle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="circle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="triangle"){const p=Q.current.primitive,_=R(w,{time:B,rawTime:L,price:f});if(!_)return;p.p1={rawTime:_.p1.rawTime,price:_.p1.price},p.p2={rawTime:_.p2.rawTime,price:_.p2.price},p.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="ellipse"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="parallellines")if(Q.current.firstLine){const p=Q.current.firstLine;p.endTime-p.startTime;const _=p.endPrice-p.startPrice,P=f,U=P+_;if(Q.current.secondLine)Q.current.secondLine.setData([{time:w.time,value:P},{time:B,value:U}]);else{const b=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});b.setData([{time:w.time,value:P},{time:B,value:U}]),Q.current.secondLine=b}}else Q.current.series.setData([{time:w.time,value:w.price},{time:B,value:f}])},se=E=>{if(E&&(E.preventDefault(),E.stopPropagation()),!T.current||!Q.current||!S.current)return;const D=S.current,$=I.current||D;if(Q.current.type==="parallellines")if(Q.current.firstLine){const C={type:"parallellines",firstLine:Q.current.series,secondLine:Q.current.secondLine,firstLineData:Q.current.firstLine};He(B=>[...B,C]),x.current.push(C),De(null),Q.current=null,T.current=!1,S.current=null,I.current=null;return}else{Q.current.firstLine={startTime:D.time,startPrice:D.price,endTime:$.time,endPrice:$.price},T.current=!1,S.current=null,I.current=null;return}if(Q.current.type==="rectangle"){const C=S.current,B=I.current||C,f=Math.max(C.price,B.price),L=Math.min(C.price,B.price),w=te(Math.min(C.time,B.time)),p=te(Math.max(C.time,B.time));if(w!=null&&p!=null&&Math.abs(p-w)>=1&&Math.abs(f-L)>=1e-5){const _=Q.current.primitive,P=C.time<=B.time?C.rawTime:B.rawTime,U=C.time<=B.time?B.rawTime:C.rawTime,b={rawTime:P,normalizedTime:w,price:f},g={rawTime:U,normalizedTime:p,price:L};_.p1={rawTime:b.rawTime,price:b.price},_.p2={rawTime:g.rawTime,price:g.price};const M={type:"rectangle",primitive:_,p1:b,p2:g};He(k=>[...k,M]),x.current.push(M),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="circle"){const C=Q.current.primitive,B={rawTime:D.rawTime,normalizedTime:D.time,price:D.price},f={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=d.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=d.timeScale().timeToCoordinate(f.rawTime),_=u.priceToCoordinate(f.price);if((L!=null&&w!=null&&p!=null&&_!=null?Math.hypot(p-L,_-w):0)>=3){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:f.rawTime,price:f.price};const U={type:"circle",primitive:C,p1:B,p2:f};He(b=>[...b,U]),x.current.push(U),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="triangle"){const C=Q.current.primitive,B=R(D,$);if(B){const f=Math.abs(B.p3.normalizedTime-B.p2.normalizedTime),L=Math.abs(B.p1.price-B.p2.price);if(f>=1&&L>=1e-5){C.p1={rawTime:B.p1.rawTime,price:B.p1.price},C.p2={rawTime:B.p2.rawTime,price:B.p2.price},C.p3={rawTime:B.p3.rawTime,price:B.p3.price};const w={type:"triangle",primitive:C,p1:B.p1,p2:B.p2,p3:B.p3};He(p=>[...p,w]),x.current.push(w),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="ellipse"){const C=Q.current.primitive,B={rawTime:D.rawTime,normalizedTime:D.time,price:D.price},f={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=d.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=d.timeScale().timeToCoordinate(f.rawTime),_=u.priceToCoordinate(f.price);if((L!=null&&w!=null&&p!=null&&_!=null?Math.hypot(p-L,_-w):0)>=4){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:f.rawTime,price:f.price},C.previewAsLine=!1,C.minorRatio=.45;const U={type:"ellipse",primitive:C,p1:B,p2:f,minorRatio:.45};He(b=>[...b,U]),x.current.push(U),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}T.current=!1,S.current=null,I.current=null,Q.current=null};if(y==="rectangle"||y==="circle"||y==="triangle"||y==="ellipse"){const E={capture:!0,passive:!1},D=$=>{T.current||$.stopPropagation()};return O.addEventListener("mousedown",V,E),O.addEventListener("mousemove",X,E),O.addEventListener("mousemove",D,E),O.addEventListener("mouseup",se,E),()=>{if((Q.current?.type==="rectangle"||Q.current?.type==="circle"||Q.current?.type==="triangle"||Q.current?.type==="ellipse")&&Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null,T.current=!1,S.current=null,I.current=null,O.removeEventListener("mousedown",V,E),O.removeEventListener("mousemove",X,E),O.removeEventListener("mousemove",D,E),O.removeEventListener("mouseup",se,E)}}},[We,Ne,He,De]),Y.useEffect(()=>{const d=c.current,u=h.current,O=o.current,ce=We===null||We===1;if(!ce||!d||!u||!O){ce||(z(null),G([]),le(null),we([]));return}const y=10,R=8;function V(B){if(!B)return[];if(B.type==="trendline"&&B.point1&&B.point2){const f=d.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=d.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="gannline"&&B.point1&&B.point2){const f=d.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=d.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:(f+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="rectangle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(f==null||L==null||w==null||p==null)return[];const _=Math.min(f,w),P=Math.max(f,w),U=Math.min(L,p),b=Math.max(L,p),g=(_+P)/2,M=(U+b)/2;return[{x:_,y:U},{x:g,y:U},{x:P,y:U},{x:_,y:M},{x:P,y:M},{x:_,y:b},{x:g,y:b},{x:P,y:b}]}if(B.type==="circle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="triangle"&&B.p1&&B.p2&&B.p3){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price);return f==null||L==null||w==null||p==null||_==null||P==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P}]}if(B.type==="ellipse"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(f==null||L==null||w==null||p==null)return[];const _=(f+w)/2,P=(L+p)/2,U=w-f,b=p-L,g=Math.hypot(U,b);if(g<.001)return[];const M=U/g,k=b/g,K=-k,W=M,Z=g/2,Ae=Z*Math.max(.05,B.minorRatio??.45);return[{x:_-M*Z,y:P-k*Z},{x:_+K*Ae,y:P+W*Ae},{x:_+M*Z,y:P+k*Z},{x:_-K*Ae,y:P-W*Ae}]}if(B.type==="gannfan"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="ganngrid"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="arrowedline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="rayline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="extendedline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="crossline"&&B.p){const f=d.timeScale().timeToCoordinate(B.p.rawTime),L=u.priceToCoordinate(B.p.price);return f==null||L==null?[]:[{x:f,y:L}]}if(B.type==="pricelevel"&&B.price!=null){const f=u.priceToCoordinate(B.price);return f==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:f}]}if(B.type==="text"&&B.rawTime!=null&&B.price!=null){const f=d.timeScale().timeToCoordinate(B.rawTime),L=u.priceToCoordinate(B.price);return f==null||L==null?[]:[{x:f,y:L}]}if(B.type==="trendbyangle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="andrewspitchfork"&&B.p1&&B.p2&&B.p3){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price);return f==null||L==null||w==null||p==null||_==null||P==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P}]}if(B.type==="equidistantchannel"&&B.p1&&B.p2&&B.b1&&B.b2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.b1.rawTime),P=u.priceToCoordinate(B.b1.price),U=d.timeScale().timeToCoordinate(B.b2.rawTime),b=u.priceToCoordinate(B.b2.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:(_+U)/2,y:(P+b)/2}]}if(B.type==="regressionchannel"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="stddevchannel"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="disjointchannel"&&B.p1&&B.p2&&B.p3&&B.p4){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price),U=d.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P},{x:U,y:b}]}if(B.type==="flattopbottom"&&B.p1&&B.p2&&B.p3&&B.p4){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price),U=d.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P},{x:U,y:b}]}if(B.type==="infoline"&&B.p1&&B.p2){const f=B.p1.rawTime??B.p1.time,L=B.p2.rawTime??B.p2.time,w=d.timeScale().timeToCoordinate(f),p=u.priceToCoordinate(B.p1.price),_=d.timeScale().timeToCoordinate(L),P=u.priceToCoordinate(B.p2.price);return w==null||p==null||_==null||P==null?[]:[{x:w,y:p},{x:_,y:P}]}if(B.type==="rulerline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:(f+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="fibonacci"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="horizontalray"&&B.primitive){const f=B.primitive,L=d.timeScale().timeToCoordinate(f.originTime),w=u.priceToCoordinate(f.price);return L==null||w==null?[]:[{x:L,y:w}]}if(B.type==="verticalline"&&B.primitive){const f=B.primitive,L=d.timeScale().timeToCoordinate(f.time);if(L==null)return[];const w=f.midYCss??200;return[{x:L,y:w}]}return[]}function X(B,f){for(let L=dt.length-1;L>=0;L--){const w=dt[L];if(w.type==="trendline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),_=u.priceToCoordinate(w.point1.price),P=d.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),_=u.priceToCoordinate(w.point1.price),P=d.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.min(p,P),g=Math.max(p,P),M=Math.min(_,U),k=Math.max(_,U),K=(b+g)/2,W=(M+k)/2,Z=[{x:b,y:M,mode:"handle1"},{x:K,y:M,mode:"handle2"},{x:g,y:M,mode:"handle3"},{x:b,y:W,mode:"handle4"},{x:g,y:W,mode:"handle5"},{x:b,y:k,mode:"handle6"},{x:K,y:k,mode:"handle7"},{x:g,y:k,mode:"handle8"}];for(const Ue of Z)if(Math.hypot(B-Ue.x,f-Ue.y)<y)return{object:w,mode:Ue.mode};const Ae=ut(B,f,b,M,g,M),he=ut(B,f,b,k,g,k),Be=ut(B,f,b,M,b,k),Ce=ut(B,f,g,M,g,k);if(Ae<R||he<R||Be<R||Ce<R||vi(B,f,[{x:b,y:M},{x:g,y:M},{x:g,y:k},{x:b,y:k}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(P-p,U-_);if(b<2)continue;const g=Math.hypot(B-p,f-_),M=Math.hypot(B-P,f-U);if(g<y)return{object:w,mode:"handle1"};if(M<y)return{object:w,mode:"handle2"};if(Math.abs(g-b)<R||g<b)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price);if(p==null||_==null||P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const W=ut(B,f,p,_,P,U),Z=ut(B,f,P,U,b,g),Ae=ut(B,f,b,g,p,_);if(W<R||Z<R||Ae<R||vi(B,f,[{x:p,y:_},{x:P,y:U},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=P-p,k=U-_,K=Math.hypot(M,k);if(K<2)continue;const W=M/K,Z=k/K,Ae=-Z,he=W,Be=K/2,Ce=Be*Math.max(.05,w.minorRatio??.45);if(Be<2||Ce<2)continue;const Ue=b-W*Be,qe=g-Z*Be,rt=b+Ae*Ce,Xe=g+he*Ce,vt=b+W*Be,pt=g+Z*Be,Tt=b-Ae*Ce,_t=g-he*Ce,iA=Math.hypot(B-Ue,f-qe),cA=Math.hypot(B-rt,f-Xe),wA=Math.hypot(B-vt,f-pt),qA=Math.hypot(B-Tt,f-_t);if(iA<y)return{object:w,mode:"handle1"};if(cA<y)return{object:w,mode:"handle2"};if(wA<y)return{object:w,mode:"handle3"};if(qA<y)return{object:w,mode:"handle4"};const _i=(B-b)*W+(f-g)*Z,Zs=(B-b)*Ae+(f-g)*he,of=_i/Be,af=Zs/Ce,lf=of*of+af*af;if(Math.abs(lf-1)<.2||lf<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-P,f-U),g=Math.hypot(B-p,f-_);if(b<y)return{object:w,mode:"handle2"};if(g<y)return{object:w,mode:"handle1"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-P,f-U),g=Math.hypot(B-p,f-_);if(b<y)return{object:w,mode:"handle2"};if(g<y)return{object:w,mode:"handle1"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(tb(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(Ab(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const p=d.timeScale().timeToCoordinate(w.p.rawTime),_=u.priceToCoordinate(w.p.price);if(p==null||_==null)continue;if(Math.hypot(B-p,f-_)<y)return{object:w,mode:"handle1"};const U=Math.abs(f-_),b=Math.abs(B-p);if(U<R||b<R)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const p=d.timeScale().timeToCoordinate(w.rawTime),_=u.priceToCoordinate(w.price);if(p==null||_==null)continue;const P=Hd(w,p,_);if(B>=P.left&&B<=P.right&&f>=P.top&&f<=P.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.b1.rawTime),g=u.priceToCoordinate(w.b1.price),M=d.timeScale().timeToCoordinate(w.b2.rawTime),k=u.priceToCoordinate(w.b2.price),K=b!=null&&M!=null?(b+M)/2:null,W=g!=null&&k!=null?(g+k)/2:null;if(p==null||_==null||P==null||U==null||K==null||W==null||b==null||g==null||M==null||k==null)continue;const Z=Math.hypot(B-p,f-_),Ae=Math.hypot(B-P,f-U),he=Math.hypot(B-K,f-W),Be=Math.hypot(p-K,_-W)<y*1.5;if(Be&&Math.min(Z,he)<y*1.5)return{object:w,mode:"handle3"};if(he<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle2"};if(Be)continue;if(Z<y)return{object:w,mode:"handle1"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:P,y:U},{x:M,y:k},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),g=u.priceToCoordinate(w.top1.price),M=d.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=u.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=u.priceToCoordinate(w.bot2.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null||K==null||W==null||Z==null||Ae==null)continue;const he=Math.hypot(B-p,f-_),Be=Math.hypot(B-P,f-U);if(he<y)return{object:w,mode:"handle1"};if(Be<y)return{object:w,mode:"handle2"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k),qe=ut(B,f,K,W,Z,Ae);if(Ce<R||Ue<R||qe<R||vi(B,f,[{x:b,y:g},{x:M,y:k},{x:Z,y:Ae},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),g=u.priceToCoordinate(w.top1.price),M=d.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=u.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=u.priceToCoordinate(w.bot2.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null||K==null||W==null||Z==null||Ae==null)continue;const he=Math.hypot(B-p,f-_),Be=Math.hypot(B-P,f-U);if(he<y)return{object:w,mode:"handle1"};if(Be<y)return{object:w,mode:"handle2"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k),qe=ut(B,f,K,W,Z,Ae);if(Ce<R||Ue<R||qe<R||vi(B,f,[{x:b,y:g},{x:M,y:k},{x:Z,y:Ae},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price);if(p==null||_==null||P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const W=(P+b)/2,Z=(U+g)/2;let Ae=W-p,he=Z-_;Math.abs(Ae)<1e-4&&(Ae=1e-4);const Be=he/Ae,Ce=O.clientWidth,Ue=U+Be*(Ce-P),qe=g+Be*(Ce-b),rt=ut(B,f,P,U,Ce,Ue),Xe=ut(B,f,b,g,Ce,qe);if(rt<R||Xe<R||vi(B,f,[{x:P,y:U},{x:Ce,y:Ue},{x:Ce,y:qe},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price),M=d.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null)continue;const K=Math.hypot(B-p,f-_),W=Math.hypot(B-P,f-U),Z=Math.hypot(B-b,f-g),Ae=Math.hypot(B-M,f-k);if(K<y)return{object:w,mode:"handle1"};if(W<y)return{object:w,mode:"handle2"};if(Z<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle4"};const he=ut(B,f,p,_,b,g),Be=ut(B,f,P,U,M,k),Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(he<R||Be<R||Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:b,y:g},{x:M,y:k},{x:P,y:U}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price),M=d.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null)continue;const K=Math.hypot(B-p,f-_),W=Math.hypot(B-P,f-U),Z=Math.hypot(B-b,f-g),Ae=Math.hypot(B-M,f-k);if(K<y)return{object:w,mode:"handle1"};if(W<y)return{object:w,mode:"handle2"};if(Z<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle4"};const he=ut(B,f,p,_,b,g),Be=ut(B,f,P,U,M,k),Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(he<R||Be<R||Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:b,y:g},{x:M,y:k},{x:P,y:U}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const p=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,P=d.timeScale().timeToCoordinate(p),U=u.priceToCoordinate(w.p1.price),b=d.timeScale().timeToCoordinate(_),g=u.priceToCoordinate(w.p2.price);if(P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-P,f-U),k=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(ut(B,f,P,U,b,g)<R)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const p=w.primitive,_=d.timeScale().timeToCoordinate(p.originTime),P=u.priceToCoordinate(p.price);if(P==null)continue;if(_!=null&&Math.hypot(B-_,f-P)<y)return{object:w,mode:"handle1"};const U=_==null?0:Math.max(0,_);if(B>=U&&Math.abs(f-P)<R)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const p=w.primitive,_=d.timeScale().timeToCoordinate(p.time);if(_==null)continue;const P=p.midYCss??200;if(Math.hypot(B-_,f-P)<y)return{object:w,mode:"handle1"};if(Math.abs(B-_)<R)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const p=u.priceToCoordinate(w.price);if(p==null)continue;const P=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(B-P,f-p)<y)return{object:w,mode:"line"};if(Math.abs(f-p)<R)return{object:w,mode:"line"}}}return null}const se=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=X(L,w);if(p){if(B.preventDefault(),B.stopPropagation(),B.detail>=2){Qe.current=!0,q(p.object),j.current=null,oe.current=null;return}z(p.object),le(null),we([]),j.current=p.mode,p.object.type==="rayline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="extendedline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="crossline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,p:{...p.object.p}}),p.object.type==="text"&&p.mode==="line"&&(oe.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}),p.object.type==="trendbyangle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="equidistantchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="andrewspitchfork"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="regressionchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="stddevchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="disjointchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="flattopbottom"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="fibonacci"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="gannfan"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="ganngrid"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="rectangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4"||p.mode==="handle5"||p.mode==="handle6"||p.mode==="handle7"||p.mode==="handle8")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="circle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="triangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="ellipse"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}),p.object.type==="horizontalray"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}),p.object.type==="verticalline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,time:p.object.primitive.time}),p.mode==="line"&&(p.object.type==="rulerline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="infoline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="arrowedline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rayline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="extendedline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="crossline"?oe.current={x:L,y:w,p:{...p.object.p}}:p.object.type==="text"?oe.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}:p.object.type==="trendbyangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="equidistantchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="andrewspitchfork"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="regressionchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="stddevchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="disjointchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="flattopbottom"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="fibonacci"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="gannfan"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rectangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="circle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="triangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="ellipse"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}:p.object.type==="ganngrid"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="horizontalray"?oe.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}:p.object.type==="verticalline"?oe.current={x:L,y:w,time:p.object.primitive.time}:p.object.type==="pricelevel"?oe.current={y:w,price:p.object.price}:oe.current={x:L,y:w,point1:{...p.object.point1},point2:{...p.object.point2}})}else z(null),j.current=null,G([]),le(null),we([])},E=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top;if(!j.current){const b=X(L,w);if(b?.object&&!fe.current){const g=V(b.object);le(M=>M===b.object?M:b.object),we(M=>M.length===g.length&&M.every((k,K)=>k.x===g[K].x&&k.y===g[K].y)?M:g)}else le(g=>g==null?g:null),we(g=>g.length===0?g:[]);return}const p=fe.current;if(!p)return;const _=d.timeScale().coordinateToTime(L),P=u.coordinateToPrice(w);if(_==null||P==null)return;let U=te(_);if(U!=null){if(p.type==="infoline"&&p.p1&&p.p2){const b=K=>{const W=K.rawTime??K.time,Z=K.normalizedTime??te(W);return{rawTime:W,normalizedTime:Z,price:K.price}},g=(K,W)=>{const Z=K.normalizedTime??te(K.rawTime),Ae=W.normalizedTime??te(W.rawTime);if(Z==null||Ae==null)return;const he=W.price-K.price,Be=he/Math.abs(K.price)*100,Ce=BA(Te)||3600,Ue=Math.abs(Ae-Z),qe=Math.max(1,Math.round(Ue/Ce)),rt=Math.max(1,Math.round(Ue/86400)),Xe=d.timeScale().timeToCoordinate(K.rawTime),vt=u.priceToCoordinate(K.price),pt=d.timeScale().timeToCoordinate(W.rawTime),Tt=u.priceToCoordinate(W.price),_t=Xe!=null&&vt!=null&&pt!=null&&Tt!=null?Math.atan2(-(Tt-vt),pt-Xe)*(180/Math.PI):p.primitive?.info?.angle??0,iA={priceDiff:he,pricePct:Be,bars:qe,days:rt,angle:_t},cA=p.primitive;if(cA){cA.p1={rawTime:K.rawTime,price:K.price},cA.p2={rawTime:W.rawTime,price:W.price},cA.info=iA;try{c.current?.applyOptions({})}catch{}}const wA={...p,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:Z,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:Ae,price:W.price}};He(qA=>{const _i=qA.map(Zs=>Zs===p?wA:Zs);return x.current=_i,_i}),z(wA),fe.current=wA,Xe!=null&&vt!=null&&pt!=null&&Tt!=null&&G([{x:Xe,y:vt},{x:pt,y:Tt}])},M=b(p.p1),k=b(p.p2);if(M.rawTime==null||M.normalizedTime==null||k.rawTime==null||k.normalizedTime==null)return;if(j.current==="handle1"){const K=d.timeScale().coordinateToTime(L)??_;g({rawTime:K,normalizedTime:U,price:P},k)}else if(j.current==="handle2"){const K=d.timeScale().coordinateToTime(L)??_;g(M,{rawTime:K,normalizedTime:U,price:P})}else if(j.current==="line"){const K=oe.current;if(!K)return;const W=b(K.p1),Z=b(K.p2);if(W.rawTime==null||W.normalizedTime==null||Z.rawTime==null||Z.normalizedTime==null)return;const Ae=d.timeScale().coordinateToTime(K.x)??W.rawTime,he=u.coordinateToPrice(K.y);if(Ae==null||he==null)return;const Be=te(Ae)??W.normalizedTime;if(Be==null)return;const Ce=U-Be,Ue=P-he,qe=te(W.normalizedTime+Ce),rt=te(Z.normalizedTime+Ce);if(qe==null||rt==null)return;const Xe=_-Ae;g({rawTime:W.rawTime+Xe,normalizedTime:qe,price:W.price+Ue},{rawTime:Z.rawTime+Xe,normalizedTime:rt,price:Z.price+Ue})}return}if(p.type==="rulerline"&&p.p1&&p.p2){const b=(g,M)=>{const k=g.normalizedTime??g.rawTime,K=M.normalizedTime??M.rawTime,W=M.price-g.price,Z=W/Math.abs(g.price)*100,Ae=zs(Rs,g.rawTime,M.rawTime,Te),he=Math.abs(K-k),Be=Math.max(1,Math.round(he/86400)),Ce={priceDiff:W,pricePct:Z,bars:Ae,days:Be},Ue=p.primitive;if(Ue){Ue.p1={rawTime:g.rawTime,price:g.price},Ue.p2={rawTime:M.rawTime,price:M.price},Ue.info=Ce;const Tt=M.price>=g.price;Ue.color=Tt?"#3b82f6":"#ef5350",Ue.fillColor=Tt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const qe={...p,rawP1Time:g.rawTime,rawP2Time:M.rawTime,p1:g,p2:M};He(Tt=>{const _t=Tt.map(iA=>iA===p?qe:iA);return x.current=_t,_t}),z(qe),fe.current=qe;const rt=d.timeScale().timeToCoordinate(g.rawTime),Xe=u.priceToCoordinate(g.price),vt=d.timeScale().timeToCoordinate(M.rawTime),pt=u.priceToCoordinate(M.price);rt!=null&&Xe!=null&&vt!=null&&pt!=null&&G([{x:rt,y:Xe},{x:(rt+vt)/2,y:(Xe+pt)/2},{x:vt,y:pt}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="arrowedline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="rayline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;b(p.p1,{rawTime:g,normalizedTime:M,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="extendedline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="crossline"&&p.p){const b=M=>{const k=p.primitive;if(k){k.center={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p:M};He(Ae=>{const he=Ae.map(Be=>Be===p?K:Be);return x.current=he,he}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(M.rawTime),Z=u.priceToCoordinate(M.price);W!=null&&Z!=null&&G([{x:W,y:Z}])},g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P});return}if(p.type==="pricelevel"&&p.price!=null){const b=u.coordinateToPrice(w);if(b==null)return;try{p.priceLine.applyOptions({price:b,title:b.toFixed(5)})}catch{}p.textPrimitive&&(p.textPrimitive.price=b);const g=c.current?c.current.paneSize().width:400,M=u.priceToCoordinate(b);M!=null&&G([{x:g/2,y:M}]);const k={...p,price:b};He(K=>{const W=K.map(Z=>Z===p?k:Z);return x.current=W,W}),z(k),fe.current=k;return}if(p.type==="text"){const b=d.timeScale().coordinateToTime(L);if(b==null)return;const g=p.primitive;if(g){g.rawTime=b,g.price=P;try{c.current?.applyOptions({})}catch{}}const M={...p,rawTime:b,price:P};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M;return}if(p.type==="trendbyangle"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"||j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="equidistantchannel"&&p.p1&&p.p2&&p.p3){const b=(g,M,k)=>{const K=Od(g,M,k);if(!K)return;const W=p.primitive;if(W){W.p1={rawTime:g.rawTime,price:g.price},W.p2={rawTime:M.rawTime,price:M.price},W.b1={rawTime:K.b1.rawTime,price:K.b1.price},W.b2={rawTime:K.b2.rawTime,price:K.b2.price},W.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const Z={...p,p1:g,p2:M,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};He(Ae=>{const he=Ae.map(Be=>Be===p?Z:Be);return x.current=he,he}),z(Z),fe.current=Z};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2,p.p3);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??te(p.p3.rawTime),price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K),he=te(g.p3.normalizedTime+K);if(Z==null||Ae==null||he==null)return;const Be=_-M;b({rawTime:g.p1.rawTime+Be,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+Be,normalizedTime:Ae,price:g.p2.price+W},{rawTime:g.p3.rawTime+Be,price:g.p3.price+W});return}}if(p.type==="regressionchannel"&&p.p1&&p.p2){const b=(g,M)=>{const k=Jr(Ne,g,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,intercept:k.intercept,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U},p.p2);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W});return}}if(p.type==="stddevchannel"&&p.p1&&p.p2){const b=(g,M)=>{const k=Zr(Ne,g,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W});return}}if(p.type==="andrewspitchfork"&&p.p1&&p.p2&&p.p3){const b=(g,M,k)=>{const K=p.primitive;if(K){K.p1={rawTime:g.rawTime,price:g.price},K.p2={rawTime:M.rawTime,price:M.price},K.p3={rawTime:k.rawTime,price:k.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:g,p2:M,p3:k};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2,p.p3);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P},p.p3);return}if(j.current==="handle3"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,p.p2,{rawTime:g,normalizedTime:U,price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K),he=te(g.p3.normalizedTime+K);if(Z==null||Ae==null||he==null)return;const Be=_-M;b({rawTime:g.p1.rawTime+Be,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+Be,normalizedTime:Ae,price:g.p2.price+W},{rawTime:g.p3.rawTime+Be,normalizedTime:he,price:g.p3.price+W});return}}if(p.type==="disjointchannel"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,Z,Ae,he)=>{const Be=p.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:Ae.rawTime,price:Ae.price},Be.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const Ce={...p,p1:W,p2:Z,p3:Ae,p4:he};He(Ue=>{const qe=Ue.map(rt=>rt===p?Ce:rt);return x.current=qe,qe}),z(Ce),fe.current=Ce},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(W,Z,Ae,he)=>{const Be=W.normalizedTime??te(W.rawTime);if(Be==null)return null;const Ce=te(Be+Ae);return Ce==null?null:{rawTime:W.rawTime+Z,normalizedTime:Ce,price:W.price+he}};if(j.current==="line"){const W=d.timeScale().coordinateToTime(g.x),Z=u.coordinateToPrice(g.y);if(W==null||Z==null)return;const Ae=te(W);if(Ae==null)return;const he=M-W,Be=k-Ae,Ce=P-Z,Ue=K(g.p1,he,Be,Ce),qe=K(g.p2,he,Be,Ce),rt=K(g.p3,he,Be,Ce),Xe=K(g.p4,he,Be,Ce);if(!Ue||!qe||!rt||!Xe)return;b(Ue,qe,rt,Xe);return}if(j.current==="handle1"){const W=(g.p1.price+g.p2.price)/2,Z={rawTime:M,normalizedTime:k,price:P},Ae={rawTime:M,normalizedTime:k,price:2*W-P};b(Z,Ae,g.p3,g.p4);return}if(j.current==="handle3"){const W=(g.p3.price+g.p4.price)/2,Z={rawTime:M,normalizedTime:k,price:P},Ae={rawTime:M,normalizedTime:k,price:2*W-P};b(g.p1,g.p2,Z,Ae);return}if(j.current==="handle2"){const W=(g.p1.price+g.p2.price)/2,Z={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:P};if(Z.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:2*W-P};if(Ae.normalizedTime==null)return;b(Ae,Z,g.p3,g.p4);return}if(j.current==="handle4"){const W=P-g.p4.price,Z={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+W};if(Z.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+W};if(Ae.normalizedTime==null)return;b(g.p1,Ae,g.p3,Z);return}}if(p.type==="flattopbottom"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,Z,Ae,he)=>{const Be=p.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:Ae.rawTime,price:Ae.price},Be.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const Ce={...p,p1:W,p2:Z,p3:Ae,p4:he};He(Ue=>{const qe=Ue.map(rt=>rt===p?Ce:rt);return x.current=qe,qe}),z(Ce),fe.current=Ce},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(W,Z,Ae,he)=>{const Be=W.normalizedTime??te(W.rawTime);if(Be==null)return null;const Ce=te(Be+Ae);return Ce==null?null:{rawTime:W.rawTime+Z,normalizedTime:Ce,price:W.price+he}};if(j.current==="line"){const W=d.timeScale().coordinateToTime(g.x),Z=u.coordinateToPrice(g.y);if(W==null||Z==null)return;const Ae=te(W);if(Ae==null)return;const he=M-W,Be=k-Ae,Ce=P-Z,Ue=K(g.p1,he,Be,Ce),qe=K(g.p2,he,Be,Ce),rt=K(g.p3,he,Be,Ce),Xe=K(g.p4,he,Be,Ce);if(!Ue||!qe||!rt||!Xe)return;b(Ue,qe,rt,Xe);return}if(j.current==="handle1"){const W={rawTime:M,normalizedTime:k,price:P},Z={rawTime:M,normalizedTime:k,price:g.p2.price};b(W,Z,g.p3,g.p4);return}if(j.current==="handle3"){const W={rawTime:M,normalizedTime:k,price:P},Z={rawTime:M,normalizedTime:k,price:g.p4.price};b(g.p1,g.p2,W,Z);return}if(j.current==="handle2"||j.current==="handle4"){const W=j.current==="handle2"?g.p2:g.p4,Z=P-W.price,Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+Z},he={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+Z};if(Ae.normalizedTime==null||he.normalizedTime==null)return;b(g.p1,Ae,g.p3,he);return}}if(p.type==="fibonacci"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="rectangle"&&p.p1&&p.p2){const b=(pt,Tt)=>{const _t=p.primitive;if(_t){_t.p1={rawTime:pt.rawTime,price:pt.price},_t.p2={rawTime:Tt.rawTime,price:Tt.price};try{c.current?.applyOptions({})}catch{}}const iA={...p,p1:pt,p2:Tt};He(cA=>{const wA=cA.map(qA=>qA===p?iA:qA);return x.current=wA,wA}),z(iA),fe.current=iA},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const pt=d.timeScale().coordinateToTime(g.x),Tt=u.coordinateToPrice(g.y);if(pt==null||Tt==null)return;const _t=te(pt);if(_t==null)return;const iA=k-_t,cA=P-Tt,wA=te(g.p1.normalizedTime+iA),qA=te(g.p2.normalizedTime+iA);if(wA==null||qA==null)return;const _i=_-pt;b({rawTime:g.p1.rawTime+_i,normalizedTime:wA,price:g.p1.price+cA},{rawTime:g.p2.rawTime+_i,normalizedTime:qA,price:g.p2.price+cA});return}const K=Math.min(g.p1.normalizedTime,g.p2.normalizedTime),W=Math.max(g.p1.normalizedTime,g.p2.normalizedTime),Z=Math.max(g.p1.price,g.p2.price),Ae=Math.min(g.p1.price,g.p2.price),he=g.p1.normalizedTime<=g.p2.normalizedTime?g.p1.rawTime:g.p2.rawTime,Be=g.p1.normalizedTime<=g.p2.normalizedTime?g.p2.rawTime:g.p1.rawTime;let Ce=K,Ue=W,qe=Z,rt=Ae,Xe=he,vt=Be;if((j.current==="handle1"||j.current==="handle4"||j.current==="handle6")&&(Ce=k,Xe=M),(j.current==="handle3"||j.current==="handle5"||j.current==="handle8")&&(Ue=k,vt=M),(j.current==="handle1"||j.current==="handle2"||j.current==="handle3")&&(qe=P),(j.current==="handle6"||j.current==="handle7"||j.current==="handle8")&&(rt=P),Ce>Ue){const pt=Ce,Tt=Xe;Ce=Ue,Xe=vt,Ue=pt,vt=Tt}if(qe<rt){const pt=qe;qe=rt,rt=pt}b({rawTime:Xe,normalizedTime:Ce,price:qe},{rawTime:vt,normalizedTime:Ue,price:rt});return}if(p.type==="circle"&&p.p1&&p.p2){const b=(qe,rt)=>{const Xe=p.primitive;if(Xe){Xe.p1={rawTime:qe.rawTime,price:qe.price},Xe.p2={rawTime:rt.rawTime,price:rt.price};try{c.current?.applyOptions({})}catch{}}const vt={...p,p1:qe,p2:rt};He(pt=>{const Tt=pt.map(_t=>_t===p?vt:_t);return x.current=Tt,Tt}),z(vt),fe.current=vt},g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;if(j.current==="handle2"){b(p.p1,{rawTime:g,normalizedTime:M,price:P});return}const k=oe.current;if(!k)return;const K=d.timeScale().coordinateToTime(k.x),W=u.coordinateToPrice(k.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=M-Z,he=P-W,Be=te(k.p1.normalizedTime+Ae),Ce=te(k.p2.normalizedTime+Ae);if(Be==null||Ce==null)return;const Ue=_-K;b({rawTime:k.p1.rawTime+Ue,normalizedTime:Be,price:k.p1.price+he},{rawTime:k.p2.rawTime+Ue,normalizedTime:Ce,price:k.p2.price+he});return}if(p.type==="triangle"&&p.p1&&p.p2&&p.p3){const b=(Xe,vt,pt)=>{const Tt=p.primitive;if(Tt){Tt.p1={rawTime:Xe.rawTime,price:Xe.price},Tt.p2={rawTime:vt.rawTime,price:vt.price},Tt.p3={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const _t={...p,p1:Xe,p2:vt,p3:pt};He(iA=>{const cA=iA.map(wA=>wA===p?_t:wA);return x.current=cA,cA}),z(_t),fe.current=_t},g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;if(j.current==="handle1"){b({rawTime:g,normalizedTime:M,price:P},p.p2,p.p3);return}if(j.current==="handle2"){b(p.p1,{rawTime:g,normalizedTime:M,price:P},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:g,normalizedTime:M,price:P});return}const k=oe.current;if(!k)return;const K=d.timeScale().coordinateToTime(k.x),W=u.coordinateToPrice(k.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=M-Z,he=P-W,Be=_-K,Ce=Xe=>{const vt=Xe.normalizedTime??te(Xe.rawTime);if(vt==null)return null;const pt=te(vt+Ae);return pt==null?null:{rawTime:Xe.rawTime+Be,normalizedTime:pt,price:Xe.price+he}},Ue=Ce(k.p1),qe=Ce(k.p2),rt=Ce(k.p3);if(!Ue||!qe||!rt)return;b(Ue,qe,rt);return}if(p.type==="ellipse"&&p.p1&&p.p2){const b=(K,W,Z=p.minorRatio??.45)=>{const Ae=p.primitive;if(Ae){Ae.p1={rawTime:K.rawTime,price:K.price},Ae.p2={rawTime:W.rawTime,price:W.price},Ae.minorRatio=Math.max(.05,Z);try{c.current?.applyOptions({})}catch{}}const he={...p,p1:K,p2:W,minorRatio:Math.max(.05,Z)};He(Be=>{const Ce=Be.map(Ue=>Ue===p?he:Ue);return x.current=Ce,Ce}),z(he),fe.current=he},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const K=d.timeScale().coordinateToTime(g.x),W=u.coordinateToPrice(g.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=k-Z,he=P-W,Be=te(g.p1.normalizedTime+Ae),Ce=te(g.p2.normalizedTime+Ae);if(Be==null||Ce==null)return;const Ue=_-K;b({rawTime:g.p1.rawTime+Ue,normalizedTime:Be,price:g.p1.price+he},{rawTime:g.p2.rawTime+Ue,normalizedTime:Ce,price:g.p2.price+he},g.minorRatio??p.minorRatio??.45);return}if(j.current==="handle1"){b({rawTime:M,normalizedTime:k,price:P},p.p2,p.minorRatio??.45);return}if(j.current==="handle3"){b(p.p1,{rawTime:M,normalizedTime:k,price:P},p.minorRatio??.45);return}if(j.current==="handle2"||j.current==="handle4"){const K=d.timeScale().timeToCoordinate(p.p1.rawTime),W=u.priceToCoordinate(p.p1.price),Z=d.timeScale().timeToCoordinate(p.p2.rawTime),Ae=u.priceToCoordinate(p.p2.price);if(K==null||W==null||Z==null||Ae==null)return;const he=(K+Z)/2,Be=(W+Ae)/2,Ce=Z-K,Ue=Ae-W,qe=Math.hypot(Ce,Ue);if(qe<.001)return;const rt=-Ue/qe,Xe=Ce/qe,vt=Math.abs((L-he)*rt+(w-Be)*Xe),pt=Math.max(.05,vt*2/qe);b(p.p1,p.p2,pt);return}return}if(p.type==="gannfan"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="ganngrid"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="verticalline"&&p.primitive){const b=p.primitive;b.time=_;const g={...p,time:te(_),rawTime:_};He(k=>{const K=k.map(W=>W===p?g:W);return x.current=K,K}),z(g),fe.current=g;const M=d.timeScale().timeToCoordinate(_);M!=null&&G([{x:M,y:b.midYCss??200}]),c.current?.applyOptions({});return}if(p.type==="horizontalray"&&p.primitive){const b=p.primitive,g=oe.current;if(!g)return;if(j.current==="handle1"){if(b.price=P,b.originTime=_,p.priceLine)try{p.priceLine.applyOptions({price:P,title:p.showPrice!==!1?P.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=P,p.textPrimitive.originTime=_);const M={...p,price:b.price,originTime:b.originTime,rawOriginTime:_};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M,c.current?.applyOptions({})}else if(j.current==="line"){const M=u.coordinateToPrice(g.y);if(M==null)return;const k=P-M;if(b.price=g.price+k,p.priceLine)try{p.priceLine.applyOptions({price:b.price,title:p.showPrice!==!1?b.price.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=b.price);const K={...p,price:b.price};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K,c.current?.applyOptions({})}return}if(!(p.type!=="trendline"&&p.type!=="gannline")&&!(!p.point1||!p.point2)){if(j.current==="handle1"){const b={time:U,price:P},g=DA([{time:b.time,value:b.price},{time:p.point2.time,value:p.point2.price}]);g.length>0&&p.series.setData(g),p.decoration&&(p.decoration.p1=b);const M={...p,point1:b};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M}else if(j.current==="handle2"){const b={time:U,price:P},g=DA([{time:p.point1.time,value:p.point1.price},{time:b.time,value:b.price}]);g.length>0&&p.series.setData(g),p.decoration&&(p.decoration.p2=b);const M={...p,point2:b};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M}else if(j.current==="line"){const b=oe.current;if(!b)return;const g=d.timeScale().coordinateToTime(b.x),M=u.coordinateToPrice(b.y);if(g==null||M==null)return;const k=U-g,K=P-M,W={time:te(b.point1.time+k),price:b.point1.price+K},Z={time:te(b.point2.time+k),price:b.point2.price+K},Ae=DA([{time:W.time,value:W.price},{time:Z.time,value:Z.price}]);Ae.length>0&&p.series.setData(Ae),p.decoration&&(p.decoration.p1=W,p.decoration.p2=Z);const he={...p,point1:W,point2:Z};He(Be=>{const Ce=Be.map(Ue=>Ue===p?he:Ue);return x.current=Ce,Ce}),z(he),fe.current=he}}}},D=()=>{j.current=null,oe.current=null},$=()=>{j.current||fe.current||(le(null),we([]))},C={capture:!0,passive:!1};return O.addEventListener("mousedown",se,C),O.addEventListener("mousemove",E,C),O.addEventListener("mouseup",D,C),O.addEventListener("mouseleave",$,C),()=>{O.removeEventListener("mousedown",se,C),O.removeEventListener("mousemove",E,C),O.removeEventListener("mouseup",D,C),O.removeEventListener("mouseleave",$,C)}},[We,Ne,dt,He]),Y.useEffect(()=>{const d=c.current,u=h.current;if(!d||!u)return;const O=()=>{const y=H;if(!y){G([]);return}const R=d.timeScale();if(y.type==="infoline"&&y.p1&&y.p2){const V=y.p1.rawTime??y.p1.time,X=y.p2.rawTime??y.p2.time,se=R.timeToCoordinate(V),E=u.priceToCoordinate(y.p1.price),D=R.timeToCoordinate(X),$=u.priceToCoordinate(y.p2.price);se!=null&&E!=null&&D!=null&&$!=null?G([{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="rulerline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:(V+se)/2,y:(X+E)/2},{x:se,y:E}]):G([]);return}if(y.type==="arrowedline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="rayline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="extendedline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="crossline"&&y.p){const V=R.timeToCoordinate(y.p.rawTime),X=u.priceToCoordinate(y.p.price);V!=null&&X!=null?G([{x:V,y:X}]):G([]);return}if(y.type==="text"&&y.rawTime!=null&&y.price!=null){const V=R.timeToCoordinate(y.rawTime),X=u.priceToCoordinate(y.price);V!=null&&X!=null?G([{x:V,y:X}]):G([]);return}if(y.type==="trendbyangle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="equidistantchannel"&&y.p1&&y.p2&&y.b1&&y.b2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.b1.rawTime),$=u.priceToCoordinate(y.b1.price),C=R.timeToCoordinate(y.b2.rawTime),B=u.priceToCoordinate(y.b2.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:(D+C)/2,y:($+B)/2}]):G([]);return}if(y.type==="regressionchannel"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="stddevchannel"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="andrewspitchfork"&&y.p1&&y.p2&&y.p3){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="disjointchannel"&&y.p1&&y.p2&&y.p3&&y.p4){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=R.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$},{x:C,y:B}]):G([]);return}if(y.type==="flattopbottom"&&y.p1&&y.p2&&y.p3&&y.p4){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=R.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$},{x:C,y:B}]):G([]);return}if(y.type==="fibonacci"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="trendline"&&y.point1&&y.point2){const V=R.timeToCoordinate(y.point1.time),X=u.priceToCoordinate(y.point1.price),se=R.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="gannline"&&y.point1&&y.point2){const V=R.timeToCoordinate(y.point1.time),X=u.priceToCoordinate(y.point1.price),se=R.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:(V+se)/2,y:(X+E)/2},{x:se,y:E}]):G([]);return}if(y.type==="rectangle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(V!=null&&X!=null&&se!=null&&E!=null){const D=Math.min(V,se),$=Math.max(V,se),C=Math.min(X,E),B=Math.max(X,E),f=(D+$)/2,L=(C+B)/2;G([{x:D,y:C},{x:f,y:C},{x:$,y:C},{x:D,y:L},{x:$,y:L},{x:D,y:B},{x:f,y:B},{x:$,y:B}])}else G([]);return}if(y.type==="circle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="triangle"&&y.p1&&y.p2&&y.p3){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="ellipse"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(V!=null&&X!=null&&se!=null&&E!=null){const D=(V+se)/2,$=(X+E)/2,C=se-V,B=E-X,f=Math.hypot(C,B);if(f<.001){G([]);return}const L=C/f,w=B/f,p=-w,_=L,P=f/2,U=P*Math.max(.05,y.minorRatio??.45);G([{x:D-L*P,y:$-w*P},{x:D+p*U,y:$+_*U},{x:D+L*P,y:$+w*P},{x:D-p*U,y:$-_*U}])}else G([]);return}if(y.type==="gannfan"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="ganngrid"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="horizontalray"&&y.primitive){const V=y.primitive,X=R.timeToCoordinate(V.originTime),se=u.priceToCoordinate(V.price);X!=null&&se!=null?G([{x:X,y:se}]):G([]);return}if(y.type==="verticalline"&&y.primitive){const V=y.primitive,X=R.timeToCoordinate(V.time);if(X!=null){const se=V.midYCss??200;G([{x:X,y:se}])}else G([]);return}if(y.type==="pricelevel"&&y.priceLine){const V=h.current?.priceToCoordinate(y.price);if(V!=null){const X=c.current?c.current.paneSize().width:400;G([{x:X/2,y:V}])}else G([]);return}G([])};O();const ce=d.timeScale();return ce.subscribeVisibleTimeRangeChange(O),()=>{ce.unsubscribeVisibleTimeRangeChange(O)}},[H]),Y.useEffect(()=>{let d=!1;x.current.forEach(u=>{if(u.type==="verticalline"&&u.primitive){const O=u===H||u===ne;u.primitive.showDot!==O&&(u.primitive.showDot=O,d=!0)}}),d&&c.current?.applyOptions({})},[H,ne]),Y.useEffect(()=>{let d=!1;x.current.forEach(u=>{if((u.type==="infoline"||u.type==="rulerline"||u.type==="arrowedline"||u.type==="rayline"||u.type==="extendedline"||u.type==="trendbyangle")&&u.primitive){const O=u===H||u===ne;u.primitive.isActive!==O&&(u.primitive.isActive=O,d=!0)}}),d&&c.current?.applyOptions({})},[H,ne]),Y.useEffect(()=>{!c.current||!h.current||x.current.forEach(d=>{if(d.series&&d.series.applyOptions({visible:ve}),d.priceLine){const u=ve&&d.showPrice!==!1;d.priceLine.applyOptions(ve?{color:d.lineColor??"#3b82f6",axisLabelVisible:u,title:u&&typeof d.price=="number"?d.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(d.type==="fibonacci"&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}if(d.type==="rectangle"&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}if(d.type==="parallellines"&&(d.baseLine&&d.baseLine.applyOptions({visible:ve}),d.parallelLine&&d.parallelLine.applyOptions({visible:ve}),d.firstLine&&d.firstLine.applyOptions({visible:ve}),d.secondLine&&d.secondLine.applyOptions({visible:ve})),(d.type==="horizontalray"||d.type==="verticalline"||d.type==="infoline"||d.type==="rulerline"||d.type==="arrowedline"||d.type==="rayline"||d.type==="extendedline"||d.type==="crossline"||d.type==="trendbyangle"||d.type==="equidistantchannel"||d.type==="regressionchannel"||d.type==="stddevchannel"||d.type==="gannfan"||d.type==="ganngrid"||d.type==="andrewspitchfork"||d.type==="disjointchannel"||d.type==="flattopbottom"||d.type==="circle"||d.type==="triangle"||d.type==="ellipse"||d.type==="text")&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}})},[ve,dt]),Y.useEffect(()=>{!ve&&H&&(z(null),G([]))},[ve,H]),Y.useEffect(()=>{if(x.current.length>dt.length){const d=x.current.filter((u,O)=>!dt.includes(u));H&&d.some(u=>u===H)&&(z(null),G([])),d.forEach(u=>{if(u.series&&c.current?.removeSeries(u.series),u.priceLine&&h.current?.removePriceLine(u.priceLine),u.textPrimitive)try{h.current?.detachPrimitive(u.textPrimitive)}catch{}if(u.type==="horizontalray"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="verticalline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="infoline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rulerline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="arrowedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rayline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="extendedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="crossline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="trendbyangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="equidistantchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="regressionchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="stddevchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="gannfan"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ganngrid"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="andrewspitchfork"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="disjointchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="flattopbottom"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="fibonacci"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rectangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="circle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="triangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ellipse"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="text"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="parallellines")try{u.baseLine&&c.current?.removeSeries(u.baseLine),u.parallelLine&&c.current?.removeSeries(u.parallelLine),u.firstLine&&c.current?.removeSeries(u.firstLine),u.secondLine&&c.current?.removeSeries(u.secondLine)}catch{}}),x.current=dt,Xs()}},[dt,H,Xs]),Y.useEffect(()=>{const d=h.current;return d?(At.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),At.current=[],zt.filter(O=>O.symbol===ye).forEach(O=>{const ce=parseFloat(O.openPrice??O.price),R=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(wt&&!isNaN(ce)&&At.current.push(d.createPriceLine({price:ce,color:R,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume}`})),ZA){const V=parseFloat(O.stopLoss),X=parseFloat(O.takeProfit);!isNaN(V)&&V>0&&At.current.push(d.createPriceLine({price:V,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(X)&&X>0&&At.current.push(d.createPriceLine({price:X,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{At.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),At.current=[]}):void 0},[zt,ye,wt,ZA]),Y.useEffect(()=>{const d=h.current;if(!d||!aA)return;const u=parseFloat(Zt?.ask);if(isNaN(u)||u<=0)return;let O;try{O=d.createPriceLine({price:u,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(O)try{d.removePriceLine(O)}catch{}}},[aA,Zt]),Y.useEffect(()=>{const d=o.current;if(!d)return;const u=O=>{if(Qe.current){Qe.current=!1;return}if(T.current||!c.current)return;const ce=c.current,y=h.current;if(ce&&y&&x.current.length>0){const R=d.getBoundingClientRect(),V=O.clientX-R.left,X=O.clientY-R.top,se=15;for(let E=x.current.length-1;E>=0;E--){const D=x.current[E];let $=!1;if(D.type==="text"&&D.rawTime!=null&&D.price!=null){const C=ce.timeScale().timeToCoordinate(D.rawTime),B=y.priceToCoordinate(D.price);if(C!=null&&B!=null){const f=Hd(D,C,B);V>=f.left&&V<=f.right&&X>=f.top&&X<=f.bottom&&($=!0)}}else if(D.point1&&D.point2){const C=ce.timeScale().timeToCoordinate(D.point1.time??D.point1.rawTime),B=y.priceToCoordinate(D.point1.price),f=ce.timeScale().timeToCoordinate(D.point2.time??D.point2.rawTime),L=y.priceToCoordinate(D.point2.price);if(C!=null&&B!=null&&f!=null&&L!=null){const w=Math.hypot(V-C,X-B),p=Math.hypot(V-f,X-L),_=(C+f)/2,P=(B+L)/2,U=Math.hypot(V-_,X-P);(w<se||p<se||U<se)&&($=!0)}}else if(D.p1&&D.p2){const C=ce.timeScale().timeToCoordinate(D.p1.rawTime),B=y.priceToCoordinate(D.p1.price),f=ce.timeScale().timeToCoordinate(D.p2.rawTime),L=y.priceToCoordinate(D.p2.price);if(C!=null&&B!=null&&f!=null&&L!=null){const w=Math.min(C,f),p=Math.max(C,f),_=Math.min(B,L),P=Math.max(B,L);V>=w-5&&V<=p+5&&X>=_-5&&X<=P+5&&($=!0)}}else if(D.p){const C=ce.timeScale().timeToCoordinate(D.p.rawTime),B=y.priceToCoordinate(D.p.price);C!=null&&B!=null&&Math.hypot(V-C,X-B)<se&&($=!0)}else if(D.type==="pricelevel"&&D.price!=null){const C=y.priceToCoordinate(D.price);C!=null&&Math.abs(X-C)<se&&($=!0)}if($){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),q(D);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;kd(c.current,Ne,Te)||c.current.timeScale().fitContent();const V=c.current.timeScale().getVisibleRange();Ie(V)},80)};return d.addEventListener("dblclick",u,!0),()=>{d.removeEventListener("dblclick",u,!0)}},[Ne,Te]);const qd=H??ne,jd=H?ie:ee,kb=ve&&nb(qd,jd),Ob=sb(qd?.type);Y.useEffect(()=>{const d=o.current,u=l.current;if(!d||!u)return;const O=80,ce=R=>{const V=d.getBoundingClientRect();u.style.opacity=V.bottom-R.clientY<=O?"1":"0"},y=()=>{u.style.opacity="0"};return d.addEventListener("mousemove",ce),d.addEventListener("mouseleave",y),()=>{d.removeEventListener("mousemove",ce),d.removeEventListener("mouseleave",y)}},[]);const Nb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*.8;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},[Ie]),Kb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*1.25;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},[Ie]),zb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{d.setVisibleLogicalRange({from:u.from-O,to:u.to-O})}catch{}},[]),Vb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{d.setVisibleLogicalRange({from:u.from+O,to:u.to+O})}catch{}},[]),Wb=Y.useCallback(()=>{if(!c.current)return;kd(c.current,Ne,Te)||c.current.timeScale().fitContent();const u=c.current.timeScale().getVisibleRange();Ie(u)},[Ne,Te,Ie]),ef=Vt?.id??null,tf=Vt?.takeProfit??null,Af=Vt?.stopLoss??null,vl=Vt?.type??null,rf=Vt?.volume??null,Tl=Vt?.symbol??null,nf=Vt?.price||Vt?.openPrice||null;Y.useEffect(()=>{const d=h.current;if(!d)return;const u=ge.current;if(["tp","sl","entry"].forEach(se=>{if(u[se]){try{d.removePriceLine(u[se])}catch{}u[se]=null}}),!ef)return;const O=typeof ye=="object"?ye?.symbol:ye;if(Tl!==O)return;const ce=parseFloat(nf),y=parseFloat(tf),R=parseFloat(Af),V=vl==="BUY";Number.isFinite(ce)&&ce>0&&(u.entry=d.createPriceLine({price:ce,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`${vl} ${rf} @ ${ce}`}));const X=Tl?.includes("JPY")?.01:1e-4;if(Number.isFinite(y)&&y>0&&Number.isFinite(ce)&&ce>0){const se=V?((y-ce)*(1/X)*10).toFixed(0):((ce-y)*(1/X)*10).toFixed(0);u.tp=d.createPriceLine({price:y,color:"#26A69A",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`TP, ${se} pts`})}if(Number.isFinite(R)&&R>0&&Number.isFinite(ce)&&ce>0){const se=V?((ce-R)*(1/X)*10).toFixed(0):((R-ce)*(1/X)*10).toFixed(0);u.sl=d.createPriceLine({price:R,color:"#EF5350",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`SL, ${se} pts`})}return()=>{["tp","sl","entry"].forEach(se=>{if(u[se]){try{d.removePriceLine(u[se])}catch{}u[se]=null}})}},[ef,tf,Af,vl,rf,Tl,nf,ye]);const Js=Y.useRef(Vt);Js.current=Vt;const sf=Y.useRef(je);return sf.current=je,Y.useEffect(()=>{const u=V=>{const X=h.current;if(!X)return null;const se=ge.current[V];if(!se)return null;const E=se.options();return!E||!Number.isFinite(E.price)?null:X.priceToCoordinate(E.price)},O=V=>{const X=o.current,se=c.current;if(!X||!se||!Js.current)return;const E=X.getBoundingClientRect(),D=V.clientY-E.top,$=u("tp"),C=u("sl");$!==null&&Math.abs(D-$)<20?(ae.current="tp",pe.current=D,ue.current=ge.current.tp.options().price,V.preventDefault(),V.stopImmediatePropagation(),X.style.cursor="ns-resize",se.applyOptions({handleScroll:!1,handleScale:!1})):C!==null&&Math.abs(D-C)<20&&(ae.current="sl",pe.current=D,ue.current=ge.current.sl.options().price,V.preventDefault(),V.stopImmediatePropagation(),X.style.cursor="ns-resize",se.applyOptions({handleScroll:!1,handleScale:!1}))},ce=V=>{const X=o.current,se=h.current;if(!X)return;const E=ae.current;if(!E){if(!Js.current)return;const _=X.getBoundingClientRect(),P=V.clientY-_.top,U=u("tp"),b=u("sl"),g=U!==null&&Math.abs(P-U)<20,M=b!==null&&Math.abs(P-b)<20;X.style.cursor=g||M?"ns-resize":"";return}if(!se)return;const D=X.getBoundingClientRect(),$=V.clientY-D.top,C=se.coordinateToPrice($);if(!Number.isFinite(C)||C<=0)return;const B=ge.current[E];if(!B)return;const f=Js.current;if(!f)return;const L=parseFloat(f.price||f.openPrice),w=f.type==="BUY",p=E==="tp"?w?((C-L)*1e5).toFixed(0):((L-C)*1e5).toFixed(0):w?((L-C)*1e5).toFixed(0):((C-L)*1e5).toFixed(0);B.applyOptions({price:C,title:`${E.toUpperCase()} ${p} pts`})},y=()=>{const V=o.current,X=c.current,se=ae.current;if(!se)return;const E=ge.current[se],D=E?E.options().price:null;if(ae.current=null,V&&(V.style.cursor=""),X&&X.applyOptions({handleScroll:!0,handleScale:!0}),!Number.isFinite(D)||D<=0)return;const $=sf.current;$&&$(C=>C&&(se==="tp"?{...C,takeProfit:D}:se==="sl"?{...C,stopLoss:D}:C))},R=o.current;if(R)return R.addEventListener("mousedown",O,!0),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",y),()=>{R.removeEventListener("mousedown",O,!0),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",y)}},[lA]),a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${Ee==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:We===1||We!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[lA&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),a.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:"#94a3b8"},children:["Loading ",typeof ye=="object"?ye?.symbol:ye,"..."]})]})}),!lA&&yl&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:Ee==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[a.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),a.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:Ee==="light"?"#64748b":"#94a3b8"},children:yl})]})}),!lA&&!yl&&Ne.length===0&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"flex flex-col items-center gap-2",children:a.jsxs("span",{className:"text-sm font-medium",style:{color:Ee==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),YA&&Ne.length>0&&(()=>{const d=Ne[Ne.length-1],u=O=>{const ce=Number(O);return Number.isFinite(ce)?ce>=100?ce.toFixed(2):ce.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:Ee==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:Ee==="light"?"#1e293b":"#e2e8f0"},children:u(d?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:u(d?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:u(d?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:Ee==="light"?"#1e293b":"#e2e8f0"},children:u(d?.close)})]})]})})(),(i||si)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(ou,{bidPrice:e,askPrice:t,onBuyClick:Mb,onSellClick:Hb})}),a.jsx(au,{isOpen:st,onClose:Ib,orderType:ft,bidPrice:e,askPrice:t}),a.jsx(pu,{isOpen:re!==null,onClose:()=>q(null),chartObject:re,onUpdate:Pb}),lA&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:"#475569"}})}),kb&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:jd.map((d,u)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:d.x-5,top:d.y-5,backgroundColor:Ob}},u))}),a.jsx("div",{ref:l,style:{position:"absolute",bottom:"50px",left:"50%",transform:"translateX(-50%)",zIndex:30,display:"flex",alignItems:"center",gap:"4px",opacity:0,pointerEvents:"all",transition:"opacity 200ms"},children:[{title:"Zoom out",onClick:Kb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})})},{title:"Zoom in",onClick:Nb,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[a.jsx("line",{x1:"7",y1:"3",x2:"7",y2:"11"}),a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})]})},{title:"Scroll left",onClick:zb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"8,3 4,7 8,11"})})},{title:"Scroll right",onClick:Vb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:Wb,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:d,onClick:u,icon:O})=>a.jsx("button",{title:d,onClick:u,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:Ee==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:Ee==="light"?"#374151":"#94a3b8",border:"1px solid "+(Ee==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:ce=>{ce.currentTarget.style.backgroundColor=Ee==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",ce.currentTarget.style.color=Ee==="light"?"#111827":"#e2e8f0"},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=Ee==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",ce.currentTarget.style.color=Ee==="light"?"#374151":"#94a3b8"},children:O},d))})]})})}),Et={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function Vd({style:A,className:e}){const{selectedSymbol:t,setSelectedSymbol:i,symbols:r,symbolsLoading:n}=$t(),[s,o]=Y.useState(!1),[l,c]=Y.useState(""),[h,m]=Y.useState(-1),v=Y.useRef(null),x=Y.useRef(null);Y.useEffect(()=>{const Q=N=>{v.current&&!v.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[]),Y.useEffect(()=>{s&&x.current&&x.current.focus()},[s]);const F=r.filter(Q=>Q.symbol.toLowerCase().includes(l.toLowerCase())),T=F.filter(Q=>!Q.symbol.endsWith("USDT")),S=F.filter(Q=>Q.symbol.endsWith("USDT")),I=Q=>{i(Q),o(!1),c("")};return r.find(Q=>Q.symbol===t),a.jsxs("div",{ref:v,style:{...Et.container,...A},className:e,children:[a.jsxs("button",{style:Et.button,onClick:()=>o(!s),onMouseEnter:Q=>Object.assign(Q.currentTarget.style,Et.buttonHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Et.arrow,...s?Et.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Et.dropdown,children:[a.jsx("div",{style:Et.searchContainer,children:a.jsx("input",{ref:x,style:Et.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:Q=>c(Q.target.value)})}),a.jsx("div",{style:Et.list,children:F.length===0?a.jsx("div",{style:Et.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[T.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Et.categoryLabel,children:"Forex & Metals"}),T.map(Q=>a.jsxs("div",{style:{...Et.item,...Q.symbol===t?Et.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Et.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Et.symbolPrice,...parseFloat(Q.change)>=0?Et.priceUp:Et.priceDown},children:parseFloat(Q.bid).toFixed(5)})]},Q.symbol))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Et.categoryLabel,children:"Crypto"}),S.map(Q=>a.jsxs("div",{style:{...Et.item,...Q.symbol===t?Et.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Et.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Et.symbolPrice,...parseFloat(Q.change)>=0?Et.priceUp:Et.priceDown},children:parseFloat(Q.bid).toFixed(2)})]},Q.symbol))]})]})})]})]})}const XA={container:{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"14px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",padding:0,lineHeight:1,userSelect:"none"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},input:{width:"70px",padding:"4px 6px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"center",outline:"none",boxSizing:"border-box"},presets:{display:"inline-flex",gap:"2px",marginLeft:"4px"},preset:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},presetActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}},lb=[.01,.05,.1,.5,1];function Wd({value:A,onChange:e,min:t=.01,max:i=100,step:r=.01,presets:n=lb,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:h}){const[m,v]=Y.useState(.1),x=A!==void 0?A:m,F=Y.useCallback(Q=>{const N=Math.max(t,Math.min(i,parseFloat(Q)||t)),J=Math.round(N/r)*r,H=parseFloat(J.toFixed(8));A!==void 0||v(H),e?.(H)},[t,i,r,A,e]),T=()=>F(x+r),S=()=>F(x-r),I=(x>=1,x.toFixed(2));return a.jsxs("div",{style:{...XA.container,...c},className:h,children:[o&&a.jsx("span",{style:XA.label,children:l}),a.jsx("button",{style:XA.btn,onClick:S,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,XA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:XA.input,type:"text",value:I,onChange:Q=>{const N=Q.target.value;if(N===""||N==="."||N==="0.")return;const J=parseFloat(N);isNaN(J)||F(J)},onBlur:()=>F(x)}),a.jsx("button",{style:XA.btn,onClick:T,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,XA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:XA.presets,children:n.map(Q=>a.jsx("button",{style:{...XA.preset,...Math.abs(x-Q)<1e-4?XA.presetActive:{}},onClick:()=>F(Q),onMouseEnter:N=>{Math.abs(x-Q)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(x-Q)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:Q},Q))})]})}const gA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#EF5350",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#EF5350"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#3b1515",borderColor:"#EF5350",color:"#EF5350"}};function Gd({value:A,onChange:e,enabled:t,onEnabledChange:i,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:h,className:m}){const{currentSymbolData:v}=$t(),[x,F]=Y.useState(""),[T,S]=Y.useState(!1),[I,Q]=Y.useState("price"),N=A!==void 0?A:x,J=t!==void 0?t:T,H=r!==void 0?r:I,z=Y.useCallback(ne=>{t!==void 0||S(ne),i?.(ne)},[t,i]),re=Y.useCallback(ne=>{r!==void 0||Q(ne),n?.(ne)},[r,n]),q=Y.useCallback(ne=>{A!==void 0||F(ne),e?.(ne)},[A,e]),ie=ne=>{const le=ne.target.value;if(le===""||le==="."||le==="0."){q(le);return}const ee=parseFloat(le);isNaN(ee)||q(le)},G=H==="price"?v?.bid?parseFloat(v.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...gA.container,...h},className:m,children:[l&&a.jsx("span",{style:gA.label,children:c}),s&&a.jsx("button",{style:{...gA.toggle,...J?gA.toggleOn:gA.toggleOff},onClick:()=>z(!J),children:a.jsx("div",{style:{...gA.toggleKnob,...J?gA.knobOn:gA.knobOff}})}),(J||!s)&&a.jsxs("div",{style:gA.inputGroup,children:[a.jsx("input",{style:gA.input,type:"text",value:N,onChange:ie,placeholder:G,onFocus:ne=>ne.currentTarget.style.borderColor="#EF5350",onBlur:ne=>ne.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...gA.modeBtn,...H==="price"?gA.modeBtnActive:{}},onClick:()=>re("price"),children:"Price"}),a.jsx("button",{style:{...gA.modeBtn,...H==="pips"?gA.modeBtnActive:{}},onClick:()=>re("pips"),children:"Pips"})]})]})]})}const mA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function Rd({value:A,onChange:e,enabled:t,onEnabledChange:i,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:h,className:m}){const{currentSymbolData:v}=$t(),[x,F]=Y.useState(""),[T,S]=Y.useState(!1),[I,Q]=Y.useState("price"),N=A!==void 0?A:x,J=t!==void 0?t:T,H=r!==void 0?r:I,z=Y.useCallback(ne=>{t!==void 0||S(ne),i?.(ne)},[t,i]),re=Y.useCallback(ne=>{r!==void 0||Q(ne),n?.(ne)},[r,n]),q=Y.useCallback(ne=>{A!==void 0||F(ne),e?.(ne)},[A,e]),ie=ne=>{const le=ne.target.value;if(le===""||le==="."||le==="0."){q(le);return}const ee=parseFloat(le);isNaN(ee)||q(le)},G=H==="price"?v?.ask?parseFloat(v.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...mA.container,...h},className:m,children:[l&&a.jsx("span",{style:mA.label,children:c}),s&&a.jsx("button",{style:{...mA.toggle,...J?mA.toggleOn:mA.toggleOff},onClick:()=>z(!J),children:a.jsx("div",{style:{...mA.toggleKnob,...J?mA.knobOn:mA.knobOff}})}),(J||!s)&&a.jsxs("div",{style:mA.inputGroup,children:[a.jsx("input",{style:mA.input,type:"text",value:N,onChange:ie,placeholder:G,onFocus:ne=>ne.currentTarget.style.borderColor="#26A69A",onBlur:ne=>ne.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...mA.modeBtn,...H==="price"?mA.modeBtnActive:{}},onClick:()=>re("price"),children:"Price"}),a.jsx("button",{style:{...mA.modeBtn,...H==="pips"?mA.modeBtnActive:{}},onClick:()=>re("pips"),children:"Pips"})]})]})]})}const cb=[{id:1,name:"Crosshair",icon:"+"},{id:2,name:"Trend Line",icon:"╱"},{id:3,name:"Parallel Channel",icon:"═"},{id:4,name:"Fibonacci",icon:"≡"},{id:5,name:"Rectangle",icon:"▭"},{id:6,name:"Price Level",icon:"─"}],JA={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"14px",cursor:"pointer",transition:"all 0.15s ease",padding:0,position:"relative"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},tooltip:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"11px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},divider:{width:"1px",height:"20px",backgroundColor:"#334155",margin:"0 4px"},deleteBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0},deleteBtnHover:{borderColor:"#EF5350",backgroundColor:"#3b1515",color:"#EF5350"},visibilityBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0}};function $d({showLabel:A=!0,showDelete:e=!0,showVisibility:t=!0,tools:i,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:h,chartObjects:m,setChartObjects:v}=$t(),[x,F]=Y.useState(null),T=i||cb,S=N=>{l(o===N?null:N)},I=()=>{v([]),l(null)},Q=()=>{h(!c)};return a.jsxs("div",{style:{...JA.container,...n},className:s,children:[A&&a.jsx("span",{style:JA.label,children:r}),T.map(N=>a.jsxs("button",{style:{...JA.btn,...o===N.id?JA.btnActive:{}},onClick:()=>S(N.id),onMouseEnter:J=>{F(N.id),o!==N.id&&Object.assign(J.currentTarget.style,JA.btnHover)},onMouseLeave:J=>{F(null),o!==N.id&&(J.currentTarget.style.borderColor="#334155",J.currentTarget.style.backgroundColor="#1e293b",J.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,x===N.id&&a.jsx("div",{style:JA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:JA.divider}),t&&a.jsx("button",{style:{...JA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:Q,onMouseEnter:N=>{N.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:JA.deleteBtn,onClick:I,onMouseEnter:N=>Object.assign(N.currentTarget.style,JA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Xd={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function hb({showCoinSelector:A=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:i=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:h,onStopLossEnabledChange:m,takeProfit:v,onTakeProfitChange:x,takeProfitEnabled:F,onTakeProfitEnabledChange:T,coinSelectorProps:S={},volumeControlProps:I={},stopLossProps:Q={},takeProfitProps:N={},drawingToolsProps:J={},style:H,className:z}){const re=[];A&&re.push(a.jsx(Vd,{...S},"coin")),e&&re.push(a.jsx(Wd,{value:s,onChange:o,...I},"volume")),t&&re.push(a.jsx(Gd,{value:l,onChange:c,enabled:h,onEnabledChange:m,...Q},"sl")),i&&re.push(a.jsx(Rd,{value:v,onChange:x,enabled:F,onEnabledChange:T,...N},"tp")),r&&re.push(a.jsx($d,{...J},"draw"));const q=[];return re.forEach((ie,G)=>{q.push(ie),n&&G<re.length-1&&q.push(a.jsx("div",{style:Xd.divider},`div-${G}`))}),a.jsx("div",{style:{...Xd.toolbar,...H},className:z,children:q})}const ub=[{label:"M1",value:"M1"},{label:"M5",value:"M5"},{label:"M15",value:"M15"},{label:"M30",value:"M30"},{label:"H1",value:"H1"},{label:"H4",value:"H4"},{label:"D1",value:"D1"},{label:"W1",value:"W1"}],wl={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function pb({style:A,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:i}=$t();return a.jsx("div",{style:{...wl.container,...A},className:e,children:ub.map(r=>a.jsx("button",{style:{...wl.btn,...t===r.value?wl.btnActive:{}},onClick:()=>i(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},children:r.label},r.value))})}const db=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Bl={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function fb({style:A,className:e}){const{chartType:t,setChartType:i}=$t();return a.jsx("div",{style:{...Bl.container,...A},className:e,children:db.map(r=>a.jsxs("button",{style:{...Bl.btn,...t===r.value?Bl.btnActive:{}},onClick:()=>i(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const oA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function gb({volume:A=.1,stopLoss:e,takeProfit:t,onTradeExecuted:i,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=$t(),[h,m]=Y.useState(null),v=parseFloat(o?.bid||0),x=parseFloat(o?.ask||0),F=x>0&&v>0?Math.abs(x-v):0,T=Q=>!Q||Q===0?"-.-----":Q>=1e3?Q.toFixed(2):Q>=1?Q.toFixed(4):Q.toFixed(5),S=Q=>Q===0?"-":Q>=1?Q.toFixed(1):Q>=.01?Q.toFixed(3):(Q*1e4).toFixed(1)+"p",I=Y.useCallback(Q=>{if(!s)return;const N=Q==="BUY"?x:v;if(!N||N<=0){m({type:"error",message:"No price available"});return}const J={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:Q,volume:A,price:N,stopLoss:e?parseFloat(e):null,takeProfit:t?parseFloat(t):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(z=>[...z,J]);const H=A*N*.01;c(z=>z-H),m({type:"success",message:`${Q} executed`}),i?.(J),setTimeout(()=>m(null),3e3)},[s,x,v,A,e,t,l,c,i]);return a.jsxs("div",{style:{...oA.container,...r},className:n,children:[a.jsx("button",{style:oA.sellBtn,onClick:()=>I("SELL"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,oA.sellBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d",Q.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:oA.priceBox,children:[a.jsx("span",{style:oA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...oA.priceValue,color:"#EF5350"},children:T(v)})]}),a.jsxs("div",{style:oA.spread,children:[a.jsx("span",{style:oA.spreadLabel,children:"Spread"}),a.jsx("span",{style:oA.spreadValue,children:S(F)})]}),a.jsxs("div",{style:oA.priceBox,children:[a.jsx("span",{style:oA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...oA.priceValue,color:"#26A69A"},children:T(x)})]}),a.jsx("button",{style:oA.buyBtn,onClick:()=>I("BUY"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,oA.buyBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#14532d",Q.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&a.jsx("span",{style:{...oA.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.message})]})}const ot={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function mb({style:A,className:e,maxHeight:t=200}){const{orders:i,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=$t(),[l,c]=Y.useState(null),h=i.filter(T=>T.status==="OPEN"||!T.closeAt),m=Y.useCallback((T,S)=>{const I=n.find(Q=>Q.symbol===T);return I?S?.toUpperCase()==="BUY"?parseFloat(I.bid||0):parseFloat(I.ask||0):0},[n]),v=Y.useCallback(T=>{if(l)return;c(T.id);const S=m(T.symbol,T.type),Q=(T.type?.toUpperCase()==="BUY"?S-T.price:T.price-S)*T.volume,N=T.volume*T.price*.01;r(J=>J.filter(H=>H.id!==T.id)),o(J=>J+N+Q),c(null)},[l,m,r,o]),x=T=>{const S=parseFloat(T);return!S||isNaN(S)?"-":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5)},F=T=>{const S=parseFloat(T);return isNaN(S)?"-":(S>=0?"+":"")+S.toFixed(2)};return a.jsxs("div",{style:{...ot.container,...A},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",h.length,")"]}),a.jsxs("div",{style:ot.summary,children:[a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...ot.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...ot.scrollArea,maxHeight:t},children:a.jsxs("table",{style:ot.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ot.th,children:"Symbol"}),a.jsx("th",{style:ot.th,children:"Type"}),a.jsx("th",{style:ot.th,children:"Volume"}),a.jsx("th",{style:ot.th,children:"Open Price"}),a.jsx("th",{style:ot.th,children:"Current"}),a.jsx("th",{style:ot.th,children:"SL"}),a.jsx("th",{style:ot.th,children:"TP"}),a.jsx("th",{style:ot.th,children:"Profit"}),a.jsx("th",{style:ot.th,children:"Action"})]})}),a.jsx("tbody",{children:h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.emptyRow,children:"No open positions"})}):h.map(T=>{const S=m(T.symbol,T.type),I=T.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:T.symbol}),a.jsx("td",{style:{...ot.td,...T.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:T.type}),a.jsx("td",{style:ot.td,children:T.volume}),a.jsx("td",{style:ot.td,children:x(T.price)}),a.jsx("td",{style:ot.td,children:x(S)}),a.jsx("td",{style:ot.td,children:T.stopLoss?x(T.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:T.takeProfit?x(T.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:I>=0?"#26A69A":"#EF5350",fontWeight:700},children:F(I)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.closeBtn,...l===T.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>v(T),disabled:l===T.id,onMouseEnter:Q=>{l!==T.id&&(Q.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d"},children:l===T.id?"...":"Close"})})]},T.id)})})]})})]})}function wb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(A)}function Bb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(A)}function yb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(A)}function Cb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(A)}const vb=({selectedSymbol:A,selectedTimeframe:e,onTimeframeChange:t,chartType:i="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:m=!0,onToggleMarketWatch:v,buySellPanelOpen:x,onMove:F})=>{const{theme:T}=$t(),S=T==="light",I=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],Q={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M20.999 15.002H19v3a1 1 0 0 1-2.001 0V8H15a1 1 0 1 1 0-2h1.999v-3A1 1 0 1 1 19 3v10h1.999a1 1 0 0 1 0 2Zm-10.999-4H6.999v10a1 1 0 1 1-1.999 0v-3H3a1 1 0 0 1 0-2h2v-11a1 1 0 1 1 1.999 0V9H10a1 1 0 0 1 0 2Z",clipRule:"evenodd",fill:"currentColor"})]}),candles:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"m2.166 16.571 7.013-7.194c.38-.583 1.116-.273 1.707.256l4.14 2.31 5.136-6.692c.277-.425 1.853-.182 1.853-.182v13.952H2.047a7.772 7.772 0 0 1 .119-2.45Z",opacity:".2",fill:"currentColor"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),line:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),volume:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.024 17.844H19a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1Zm-3 0H16a1 1 0 0 1-1-1v-5.845A1 1 0 0 1 16 10h.024a1 1 0 0 1 1 .999v5.845a1 1 0 0 1-1 1Zm-3 0H13a1 1 0 0 1-1-1V6.999A1 1 0 0 1 13 6h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H10a1 1 0 0 1-1-1V12a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H7a1 1 0 0 1-1-1V9.999A.999.999 0 0 1 7 9h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H4a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1Z",clipRule:"evenodd",fill:"currentColor"})]}),"volume ticks":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{fillRule:"evenodd",d:"M20.009 6.993h-.985v3.985a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1V6.993h-.946c-.565 0-1.023-.441-1.023-.985v-.024c0-.543.458-.984 1.023-.984h3.955c.565 0 1.023.441 1.023.984v.024c0 .544-.458.985-1.023.985Zm-3.985 6.14v5.845a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-5.845a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999Zm-4 6.845H12a1 1 0 0 1-1-1V9.133a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H9a1 1 0 0 1-1-1v-4.844a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H6a1 1 0 0 1-1-1v-6.845a.998.998 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H3a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1ZM18 14.134h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-3.844a1 1 0 0 1 1-1Z",clipRule:"evenodd",fill:"currentColor"})]})};return a.jsx("div",{className:`overflow-x-auto border-b ${S?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,style:{scrollbarWidth:"thin",scrollbarColor:S?"#cbd5e1 transparent":"#334155 transparent"},children:a.jsxs("div",{className:"flex items-center justify-between px-4 py-1 min-w-max",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${S?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
13
13
  ${i===N?S?"text-sky-600":"text-sky-400":S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
14
  `,title:N,children:Q[N]},N))}),a.jsx("div",{className:`flex items-center gap-1 border-r ${S?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
15
15
  ${i===N?S?"text-sky-600":"text-sky-400":S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}