Files
ai/charting_library/bundles/lollipop-tooltip-renderer.0ceff3b7ae8ca6b64473.js
2023-02-02 13:31:14 +00:00

4 lines
11 KiB
JavaScript

(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9039],{59142:function(e,t){var o,n,r;n=[t],void 0===(r="function"==typeof(o=function(e){"use strict";function t(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}Object.defineProperty(e,"__esModule",{value:!0});var o=!1;if("undefined"!=typeof window){var n={get passive(){o=!0}};window.addEventListener("testPassive",null,n),window.removeEventListener("testPassive",null,n)}var r="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),l=[],a=!1,i=-1,s=void 0,c=void 0,u=function(e){return l.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},d=function(e){var t=e||window.event;return!!u(t.target)||1<t.touches.length||(t.preventDefault&&t.preventDefault(),!1)},m=function(){setTimeout((function(){void 0!==c&&(document.body.style.paddingRight=c,c=void 0),void 0!==s&&(document.body.style.overflow=s,s=void 0)}))};e.disableBodyScroll=function(e,n){if(r){if(!e)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(e&&!l.some((function(t){return t.targetElement===e}))){var m={targetElement:e,options:n||{}};l=[].concat(t(l),[m]),e.ontouchstart=function(e){1===e.targetTouches.length&&(i=e.targetTouches[0].clientY)},e.ontouchmove=function(t){var o,n,r,l;1===t.targetTouches.length&&(n=e,l=(o=t).targetTouches[0].clientY-i,!u(o.target)&&(n&&0===n.scrollTop&&0<l||(r=n)&&r.scrollHeight-r.scrollTop<=r.clientHeight&&l<0?d(o):o.stopPropagation()))},a||(document.addEventListener("touchmove",d,o?{passive:!1}:void 0),a=!0)}}else{f=n,setTimeout((function(){if(void 0===c){var e=!!f&&!0===f.reserveScrollBarGap,t=window.innerWidth-document.documentElement.clientWidth;e&&0<t&&(c=document.body.style.paddingRight,document.body.style.paddingRight=t+"px")}void 0===s&&(s=document.body.style.overflow,document.body.style.overflow="hidden")}));var p={targetElement:e,options:n||{}};l=[].concat(t(l),[p])}var f},e.clearAllBodyScrollLocks=function(){r?(l.forEach((function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null})),a&&(document.removeEventListener("touchmove",d,o?{passive:!1}:void 0),a=!1),l=[],i=-1):(m(),l=[])},e.enableBodyScroll=function(e){if(r){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");e.ontouchstart=null,e.ontouchmove=null,l=l.filter((function(t){return t.targetElement!==e})),a&&0===l.length&&(document.removeEventListener("touchmove",d,o?{passive:!1}:void 0),a=!1)}else 1===l.length&&l[0].targetElement===e?(m(),l=[]):l=l.filter((function(t){return t.targetElement!==e}))}})?o.apply(t,n):o)||(e.exports=r)},9245:e=>{e.exports={drawer:"drawer-BF9dzroi",drawerItem:"drawerItem-BF9dzroi",menuWrap:"menuWrap-BF9dzroi",menuBox:"menuBox-BF9dzroi",card:"card-BF9dzroi",mini:"mini-BF9dzroi",fadeTop:"fadeTop-BF9dzroi",
fadeBottom:"fadeBottom-BF9dzroi"}},85174:e=>{e.exports={content:"content-A343HTYW",titleWrapper:"titleWrapper-A343HTYW",title:"title-A343HTYW",subtitle:"subtitle-A343HTYW",text:"text-A343HTYW",icon:"icon-A343HTYW",group:"group-A343HTYW",groupIcon:"groupIcon-A343HTYW",beforeMarketOpen:"beforeMarketOpen-A343HTYW",afterMarketClose:"afterMarketClose-A343HTYW",groupTitle:"groupTitle-A343HTYW",groupRow:"groupRow-A343HTYW",groupCell:"groupCell-A343HTYW",link:"link-A343HTYW",mob:"mob-A343HTYW",mini:"mini-A343HTYW"}},66998:e=>{e.exports={wrap:"wrap-3HaHQVJm",positionBottom:"positionBottom-3HaHQVJm",backdrop:"backdrop-3HaHQVJm",drawer:"drawer-3HaHQVJm",positionLeft:"positionLeft-3HaHQVJm"}},22838:(e,t,o)=>{"use strict";o.r(t),o.d(t,{LollipopCardType:()=>S,showLollipopTooltip:()=>H});var n=o(59496),r=o(87995),l=o(88537),a=o(97754),i=o.n(a);function s(e,t,o){(0,n.useEffect)(()=>{const n=new IntersectionObserver(e=>{e[e.length-1].intersectionRatio<.25?o():t()},{threshold:[0,.25,.5,.75,1],root:null,rootMargin:"0px"});return e.current&&n.observe(e.current),()=>n.disconnect()},[])}var c=o(90692),u=o(41590),d=o(37558),m=o(50628),p=o(68335),f=o(59064),v=o(80643);const h=(0,n.forwardRef)((e,t)=>{const{onClose:o,onForceClose:r,onClickOutside:l,className:a,customCloseSubscriptions:i=[],...s}=e,c=(0,n.useRef)(null),u=(0,n.useCallback)(e=>{27===(0,p.hashFromEvent)(e)&&r()},[r]),d=(0,n.useCallback)(()=>{(0,f.globalCloseMenu)(),r()},[r]),h=(0,n.useCallback)(()=>{c.current&&c.current.focus({preventScroll:!0})},[]);return(0,n.useEffect)(()=>{const e=(t=d,window.addEventListener("scroll",t),()=>window.removeEventListener("scroll",t));var t;const o=i&&function(e,t){for(const o of e)o.subscribe(null,t);return()=>{for(const o of e)o.unsubscribe(null,t)}}(i,d);return()=>{e(),(0,v.isFunction)(o)&&o()}},[i,d]),n.createElement(m.PopupMenu,{className:a,isOpened:!0,tabIndex:-1,reference:e=>{"function"==typeof t?t(e):(0,v.isObject)(t)&&(t.current=e),c.current=e},onClose:o,onClickOutside:l,onKeyDown:u,onOpen:h,...s},e.children)});var g,w=o(40173),E=o(27317),b=o(9745),C=o(85174);function y(e){const{name:t,value:o,style:r,valueRightIcon:l}=e;return n.createElement("div",{className:C.groupRow,style:r},t&&n.createElement("div",{className:C.groupCell},n.createElement("span",{className:C.text},t)),n.createElement("div",{className:C.groupCell},n.createElement("span",{className:C.text},o),l&&n.createElement(b.Icon,{icon:l.iconContent,className:i()(C.groupIcon,l.iconClass,"apply-common-tooltip"),title:l.tooltipText})))}function T(e){const{text:t,href:o,onClick:r}=e;return n.createElement("a",{href:o,onClick:r&&(e=>{e.preventDefault(),r()}),className:C.link},t)}function k(e){var t;const{content:o=[],subTitle:r,cardType:l,anchor:a}=e,s=o.map((e,t)=>{const{title:o,content:r}=e;return n.createElement("div",{key:"group"+t,className:C.group},o&&n.createElement("span",{className:C.groupTitle},o),r.map((e,t)=>n.createElement(y,{key:"contentRow"+t,...e})))}),c=l?i()(C.content,C[l]):C.content,u="string"==typeof r?r:r.map((e,t)=>n.createElement(y,{key:"subTitle"+t,...e}))
;return n.createElement(n.Fragment,null,n.createElement("div",{className:c},e.title&&n.createElement("div",{className:C.titleWrapper},e.tooltipIcon&&n.createElement(b.Icon,{icon:e.tooltipIcon,className:C.icon,style:{color:null===(t=e.style)||void 0===t?void 0:t.color}}),n.createElement("span",{className:C.title},e.title)),n.createElement("span",{className:C.subtitle},u),s.length>0&&n.createElement("div",null,s),a&&n.createElement("div",{className:C.group},n.createElement(T,{...a}))))}!function(e){e[e.BeforeMarketOpen=C.beforeMarketOpen]="BeforeMarketOpen",e[e.AfterMarketClose=C.afterMarketClose]="AfterMarketClose"}(g||(g={}));var B=o(9245);const N=(0,w.mergeThemes)(E.DEFAULT_MENU_THEME,{menuWrap:B.menuWrap,menuBox:B.menuBox});function x(e){const{tooltips:t,onClose:o,onForceClose:r,onClickOutside:l,position:a,customCloseSubscriptions:m,showScrollFades:p,cardType:f}=e,v=(0,n.useRef)(null),g=(0,n.useRef)(null),w=(0,n.useRef)(null),E=(0,n.useRef)(null),[b,C]=(0,n.useState)("100%"),y=e=>{null!==e&&C(e.clientWidth+"px")},[T,x]=(0,n.useState)(!1);s(w,()=>x(!1),()=>x(!0));const M={display:T?"block":"none",width:b},[H,D]=(0,n.useState)(!1);s(E,()=>D(!1),()=>D(!0));const W={display:H?"block":"none",width:b},A=f?i()(B.card,B[f]):B.card;return n.createElement(d.DrawerManager,null,n.createElement(c.MatchMedia,{rule:"screen and (max-width: 419px)"},e=>e?n.createElement(u.Drawer,{className:B.drawer,onClose:r||o,position:"Bottom"},t.map((e,t)=>n.createElement("div",{key:""+t,className:B.drawerItem},n.createElement(k,{cardType:S.Mobile,...e})))):n.createElement(h,{position:a,theme:N,onClose:o,onForceClose:r||o,onClickOutside:l,customCloseSubscriptions:m},p&&n.createElement(n.Fragment,null,n.createElement("div",{ref:v,className:B.fadeTop,style:M}),n.createElement("div",{ref:w})),n.createElement("div",{ref:y},t.map((e,t)=>{var o;return n.createElement("div",{key:""+t,className:A,style:{borderColor:null===(o=e.style)||void 0===o?void 0:o.color}},n.createElement(k,{cardType:f,...e}))})),p&&n.createElement(n.Fragment,null,n.createElement("div",{ref:E}),n.createElement("div",{ref:g,className:B.fadeBottom,style:W})))))}var S;!function(e){e.Mobile="mob",e.Minimal="mini"}(S||(S={}));let M=null;function H(e){if(!e.items.length)return;const t={tooltips:e.items,onClose:D,onForceClose:()=>{D(),"function"==typeof e.onCustomClose&&e.onCustomClose()},onClickOutside:e.onClickOutside,position:W.bind(null,e.position),customCloseSubscriptions:e.customCloseSubscriptions,showScrollFades:e.showScrollFades,cardType:e.cardType};null===M&&(M=document.createElement("div"),document.body.appendChild(M)),r.render(n.createElement(x,{...t}),M)}function D(){null!==M&&(r.unmountComponentAtNode(M),M.remove(),M=null)}function W(e,t,o){const n=e.target,r=n.getBoundingClientRect(),a=r.width-e.targetSize.w,i=r.height-e.targetSize.h,s=(0,l.ensureNotNull)(n.closest(".chart-container")),c=s.getBoundingClientRect(),u=(0,l.ensureNotNull)(s.parentElement).getBoundingClientRect(),d=r.left+e.point.x+a,m=Math.round(d-t/2),p=Math.min(m+t,c.right,u.right)
;let f,v,h=Math.max(p-t,c.left,u.left);h+t>=u.right&&(h=u.right-t);const g=c.bottom-(r.top+e.point.y+i),w=c.height-g-e.marginTop;return w<o?(v=e.marginTop+c.top,f=Math.max(w,0)):v=c.height+c.top-g-o,{x:h,y:v,overrideHeight:f}}},37558:(e,t,o)=>{"use strict";o.d(t,{DrawerManager:()=>r,DrawerContext:()=>l});var n=o(59496);class r extends n.PureComponent{constructor(e){super(e),this._addDrawer=()=>{const e=this.state.currentDrawer+1;return this.setState({currentDrawer:e}),e},this._removeDrawer=()=>{const e=this.state.currentDrawer-1;return this.setState({currentDrawer:e}),e},this.state={currentDrawer:0}}render(){return n.createElement(l.Provider,{value:{addDrawer:this._addDrawer,removeDrawer:this._removeDrawer,currentDrawer:this.state.currentDrawer}},this.props.children)}}const l=n.createContext(null)},41590:(e,t,o)=>{"use strict";o.d(t,{Drawer:()=>p});var n=o(59496),r=o(88537),l=o(97754),a=o(59142),i=o(43989),s=o(65718),c=o(37558),u=o(49483),d=o(29197),m=o(66998);function p(e){const{position:t="Bottom",onClose:o,children:p,className:f,theme:v=m}=e,h=(0,r.ensureNotNull)((0,n.useContext)(c.DrawerContext)),[g,w]=(0,n.useState)(0),E=(0,n.useRef)(null),b=(0,n.useContext)(d.CloseDelegateContext);return(0,n.useEffect)(()=>{const e=(0,r.ensureNotNull)(E.current);return e.focus({preventScroll:!0}),b.subscribe(h,o),0===h.currentDrawer&&(0,i.setFixedBodyState)(!0),u.CheckMobile.iOS()&&(0,a.disableBodyScroll)(e),w(h.addDrawer()),()=>{b.unsubscribe(h,o);const t=h.removeDrawer();u.CheckMobile.iOS()&&(0,a.enableBodyScroll)(e),0===t&&(0,i.setFixedBodyState)(!1)}},[]),n.createElement(s.Portal,null,n.createElement("div",{className:l(m.wrap,m["position"+t])},g===h.currentDrawer&&n.createElement("div",{className:m.backdrop,onClick:o}),n.createElement("div",{className:l(m.drawer,v.drawer,m["position"+t],f),ref:E,tabIndex:-1,"data-name":e["data-name"]},p)))}}}]);