initial commit with charts and assistant chat

This commit is contained in:
2026-03-02 00:08:19 -04:00
commit d907c5765e
1828 changed files with 50054 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[4934,8673],{63117:(e,t,i)=>{i.d(t,{InplaceTextLineDataSource:()=>m,InplaceTextUndoCommand:()=>T});var n=i(50279),s=i(50151),r=i(10555),o=i(58978),a=i(24377),l=i(11542),d=i(95804),u=i(48943),h=i(22613),c=i(72270),_=i(41414),p=i(40472),w=i(13896);const g={selectionColor:(0,o.getHexColorByName)("color-tv-blue-500"),cursorColor:(0,o.getHexColorByName)("color-black")},x={selectionColor:(0,o.getHexColorByName)("color-white"),cursorColor:(0,o.getHexColorByName)("color-white")};var P;!function(e){e[e.TextEditingJustFinishedTime=100]="TextEditingJustFinishedTime"}(P||(P={}));class T extends c.UndoCommand{constructor(e,t,n,s){super(new d.TranslatedString("change {title} text",l.t(null,void 0,i(57122))).format({title:new d.TranslatedString(t.name(),t.translatedType())}),!0,!w.lineToolsDoNotAffectChartInvalidation),this._sourceId=t.id(),this._model=e,this._oldValue=n,this._newValue=s}redo(){const e=this._source();this._textProperty(e).setValue(this._newValue)}undo(){const e=this._source();this._textProperty(e).setValue(this._oldValue)}_textProperty(e){return e.editableTextProperties().text}_source(){return(0,s.ensureNotNull)(this._model.dataSourceForId(this._sourceId))}}class m extends _.LineDataSource{constructor(e,t,n,s){super(e,t,n,s),this._container=null,this._activeEditingOwnerSource=null,this._editableText=new h.WatchedValue(""),this._activateTextEditingEl=null,this._paneView=null,this._selectionData={},this._cursorPaneView=null,this._cursorPosition=null,this._editingOnCreation=!1,this._editingActivationTime=null,this._editingDeactivationTime=0,this._editableText.subscribe((()=>{this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id()))})),this._isDarkBackground=(0,u.combine)(((e,t)=>{if(null===t)return this._model.dark().value();const i=(0,a.blendRgba)((0,a.parseRgba)(e),(0,a.parseRgba)(t));return"black"===(0,a.rgbToBlackWhiteString)([i[0],i[1],i[2]],150)}),this._model.backgroundColor().spawnOwnership(),this._createDataSourceBackgroundColorWV()),Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,87866)).then((t=>{this._cursorPaneView=new t.InplaceTextCursorPaneView(this,e),this._additionalCursorDataGetters&&(this._cursorPaneView.setAdditionalCursorData(...this._additionalCursorDataGetters),null!==this._cursorPosition&&(this._cursorPaneView.setCursorPosition(this._cursorPosition),e.updateSource(this)))}))}destroy(){this._isDarkBackground.destroy(),this._editableText.unsubscribe(),this._closeTextEditor(),super.destroy()}editableTextStyle(){return{...this._isDarkBackground.value()?x:g}}removeIfEditableTextIsEmpty(){return!1}activateEditingOnCreation(){return!1}topPaneViews(e){return this._activeEditingOwnerSource&&e.hasDataSource(this._activeEditingOwnerSource)&&!window.TradingView.printing&&this._cursorPaneView?(this._cursorPaneView.update((0,p.sourceChangeEvent)(this.id())),[this._cursorPaneView]):null}dataAndViewsReady(){return super.dataAndViewsReady()&&null!==this._cursorPaneView}editableText(){
return this._editableText}textEditingEl(){return this._activateTextEditingEl}activateTextEditingOn(e,t){this._activateTextEditingEl=e,this._editingOnCreation=!!t,this._editingActivationTime=performance.now(),this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id()))}deactivateTextEditing(){this._closeTextEditor()}textEditingActivationTime(){return this._editingActivationTime}textEditingJustFinished(){return performance.now()-this._editingDeactivationTime<100}setAdditionalCursorData(e,t){this._cursorPaneView?this._cursorPaneView.setAdditionalCursorData(e,t):this._additionalCursorDataGetters=[e,t]}_updateAllPaneViews(e){super._updateAllPaneViews(e),this._cursorPaneView?.update(e)}async _openTextEditor(e,t,n,o,a){if(null!==this._container)return;null===this._editingActivationTime&&(this._editingActivationTime=performance.now()),this._activateTextEditingEl=null,this._cursorPosition=null,this._container=document.createElement("div"),this._container.style.position="absolute",this._container.style.top="0",this._container.style.bottom="0",this._container.style.left="0",this._container.style.right="0",this._container.style.overflow="hidden",this._container.style.pointerEvents="none",t.appendChild(this._container);const{updateChartEditorText:l,closeChartEditorText:d}=await Promise.all([i.e(3637),i.e(2227),i.e(5592)]).then(i.bind(i,44847));if(null===this._container||this._isDestroyed)return;this._activeEditingOwnerSource=e,this._closeChartEditorText=d;const{text:u,textColor:h,wordWrap:c}=this.editableTextProperties(),{forbidLineBreaks:_,maxLength:w}=this.editableTextStyle();this._editableText.setValue(u.value());const g=this.isFixed()?(0,s.ensureDefined)(this.fixedPoint(e)):(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0],e)),x={position:(0,r.point)(g.x,g.y),textInfo:n,placeholder:o,text:this._editableText,textColor:h,wordWrap:c,forbidLineBreaks:_,maxLength:w,onClose:a,onSelectionChange:this._onSelectionChange.bind(this),onContextMenu:this.onContextMenu?this.onContextMenu.bind(this):void 0};l(this._container,x),this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id()))}_closeTextEditor(e){null===this._container||this._isDestroyed||(this._editingActivationTime=null,this._editingDeactivationTime=performance.now(),this._saveEditedText(),this._editingOnCreation=!1,this._onSelectionChange(),this._closeChartEditorText?.(this._container),this._closeChartEditorText=void 0,this._container.remove(),this._container=null,this._activeEditingOwnerSource=null,this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id())))}_saveEditedText(){const e=this.editableTextProperties().text.value(),t=this._editableText.value();e!==t&&(this._editingOnCreation&&this.editableTextProperties().text.setValue(t),this._model.undoModel().undoHistory().pushUndoCommand(this._changeEditableTextUndoCommand(e,t)))}_changeEditableTextUndoCommand(e,t){return new T(this._model,this,e,t)}_createDataSourceBackgroundColorWV(){return new h.WatchedValue(null).readonly().ownership()}_onSelectionChange(e){if(null===this._container)return;const t={}
;if(void 0!==e){const{start:i,end:n}=e;i===n?t.cursorPosition=i:t.selectionRange=[Math.min(i,n),Math.max(i,n)]}(0,n.default)(t,this._selectionData)||(this._selectionData=t,this._paneViews.forEach((e=>{e.forEach((e=>{"setSelectionRange"in e&&e.setSelectionRange(t.selectionRange)}))})),this._cursorPaneView?this._cursorPaneView.setCursorPosition(t.cursorPosition):this._cursorPosition=t.cursorPosition??null,this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id())))}}},94984:(e,t,i)=>{i.r(t),i.d(t,{LineToolRay:()=>s});var n=i(42150);class s extends n.LineToolTrendLine{constructor(e,t,i,n){super(e,t??s.createProperties(e.backgroundTheme().spawnOwnership()),i,n)}name(){return"Ray"}static createProperties(e,t){const i=n.LineToolTrendLine._createPropertiesImpl("linetoolray",e,t);return s._configureProperties(i),i}}},42150:(e,t,i)=>{i.r(t),i.d(t,{Consts:()=>n,LineToolTrendLine:()=>h});var n,s=i(50151),r=i(43229),o=i(78176),a=i(43337),l=i(65045),d=i(63117),u=i(47432);!function(e){e[e.PointsCount=2]="PointsCount",e.Name="Trend Line"}(n||(n={}));class h extends d.InplaceTextLineDataSource{constructor(e,t,n,s){super(e,t??h.createProperties(e.backgroundTheme().spawnOwnership()),n,s),this._delayedStudyViewsInitialization=!1,this._viewsModule=new r.AsyncResourceWrapper(Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,81233))),this._viewsModule.callFunction((()=>{this._model.updateSource(this)}))}destroy(){this._viewsModule.destroy(),super.destroy()}pointsCount(){return 2}name(){return"Trend Line"}canHasAlert(){return!0}showPriceLabels(){return this._properties.childs().showPriceLabels.value()}createPriceAxisView(e){return new u.LineToolPriceAxisView(this,{pointIndex:e,backgroundPropertyGetter:()=>this.showPriceLabels()?this._properties.childs().linecolor.value():null})}isForcedDrawPriceAxisLabel(){return this.showPriceLabels()}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textcolor}}supportsTargetSignature(){return!1}isMultiPaneAvailable(){return this.supportsTargetSignature()}isMultiPaneEnabled(){return null!==this.targetSignature().value()}snapTo45DegreesAvailable(){return!0}static createProperties(e,t,i){return h._createPropertiesImpl("linetooltrendline",e,t,i)}_getPaneViews(e){if(null===this.targetSignature().value()&&!this._paneViews.has(e)&&(!e||e.hasDataSource(this))){const t=this._viewsModule.get();t&&this._paneViews.set(e,[new t.TrendLinePaneView(this,this._model,e??null,this._openTextEditor.bind(this),this._closeTextEditor.bind(this))])}return super._getPaneViews(e)}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,71192))).TrendLineDefinitionsViewModel}_applyTemplateImpl(e){
super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}_createSignatureSourcePaneViews(e){const t=this._viewsModule.get();if(null===t)return this._delayedStudyViewsInitialization||(this._delayedStudyViewsInitialization=!0,this._viewsModule.callFunction((()=>{this._signaturesPaneViews.clear(),this._updateSignaturesPaneViews()}))),[];return[new t.TrendLinePaneView(this,this._model,null,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),e)]}static _createPropertiesImpl(e,t,i,n){i&&void 0===i.showPercentPriceRange&&(i.showPercentPriceRange=i.showPriceRange,i.showPipsPriceRange=i.showPriceRange);const s=new o.DefaultProperty({theme:t,defaultName:e,state:i,useUserPreferences:n});return this._configureProperties(s),s}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new a.Property("")),e.addExcludedKey("text",1),e.addChild("textsColors",new l.LineToolColorsProperty([(0,s.ensureDefined)(e.child("textcolor"))]))}}}}]);