1"use strict";(self.webpackChunkPantera=self.webpackChunkPantera||[]).push([[715],{1707:(e,t,s)=>{s.r(t),s.d(t,{element_diagram_structure:()=>_});var i=s(6435),n=s(2114),o=s(3211),r=s(1222),a=s(7733),l=s(1545),h=s(3381),c=s(3051),d=s(8624),u=s(1598),p=s(7923),m=s(4892),g=s(7590),w=s(8469),f=s(4195),k=s(169);class v{constructor(e){this._foutsideClick=this._outsideClick.bind(this),this.component=e,this.paper=e.paper,this.graph=e.graph,this._create(),this.listeners()}_create(){let e=document.createRange().createContextualFragment('<div class="xdropdown-menu">\n\t\t\t\t<ul class="dropdown-menu" id="structure__context-menu"></ul>\n\t\t\t</div>');document.body.append(e),v.menu=e,v.list=document.querySelector("ul#structure__context-menu")}_show(e,t){const s=v.list;s.innerHTML=e,s.classList.add("show"),s.style.left=t.pageX.toString()+"px",s.style.top=t.pageY.toString()+"px",setTimeout((()=>{document.addEventListener("click",this._foutsideClick),document.addEventListener("contextmenu",this._foutsideClick)}),100)}_close(){const e=v.list;e.classList.remove("show"),e.style.left=null,e.style.top=null,document.removeEventListener("click",this._foutsideClick),document.removeEventListener("contextmenu",this._foutsideClick)}listeners(){const e=document.getElementById("link-context-menu-tpl"),t=document.getElementById("element-context-menu-tpl");v.list.addEventListener("click",(e=>{const t=e.target.closest("a[data-action]").dataset.action;if(t)switch(t){case"switch_dir":this.switchDir(this.cellView);break;case"delete":this.delete(this.cellView);break;case"copy":this.copy(this.cellView);break;case"link":this.link(this.cellView)}})),this.paper.on("link:contextmenu",((t,s)=>{this.cellView=t,this._show(e.innerHTML,s)})),this.paper.on("element:contextmenu",((e,s)=>{this.cellView=e,this._show(t.innerHTML,s)}))}_outsideClick(e){let t=e.target;v.list.contains(t)?t instanceof HTMLAnchorElement&&this._close():this._close()}switchDir(e){const t=e.model,s=Object.assign({},t.attributes.source),i=Object.assign({},t.attributes.target);t.set("source",i),t.set("target",s)}delete(e){e.model.remove()}copy(e){const t=e.model,s=t.clone();this.graph.addCell(s);const i=this.graph.getElements().find((e=>e.id===s.id));if(i){const e=i.position();i.position(e.x+25,e.y+25);const n=this.component.getTaskDetails(t.id);n&&this.component.addTask({id:s.id,data:Object.assign({},n)})}}link(e){const t=this.graph.getElements().find((t=>t.id===e.model.id)),s=t.position();this.component.createLink({source:e.model,target:{x:s.x,y:s.y+t.size().height+200}})}}class E{constructor(e){this.graph=e}valid(){const e=this.graph.getElements(),t=e[0],s=e[1];let i=!1;return this.graph.dfs(t,(e=>e!==s||(i=!0,!1)),{outbound:!0}),i}}class y{constructor(e){this.zoomLevels=[.21,.26,.33,.4,.5,.64,.8,1,1.2,1.44,1.73,2.1,2.5,3,3.6,4.3],this.structureEl=e;const t=document.getElementById("structure__zoom-slider");if(t){const e=Number(t.value);this.currentZoomIndex=e,this.slider={input:t,oldValue:e,label:t.parentNode.querySelector("label")}}else this.currentZoomIndex=7;this.mousewheelListener(),this.dragListener(),this.resetListener(),this.sliderListener()}mousewheelListener(){const e=(e,t,s,i)=>{e.preventDefault(),this.updateZoom(i,(i=>{this.slider&&(this.slider.oldValue=Number(this.slider.input.value),this.slider.input.value=this.currentZoomIndex.toString()),this.structureEl.paper.translate(-t*i+e.offsetX,-s*i+e.offsetY)}))};this.structureEl.paper.on("blank:mousewheel",((t,s,i,n)=>{e(t,s,i,n)})),this.structureEl.paper.on("cell:mousewheel element:mousewheel",((t,s,i,n,o)=>{e(s,i,n,o)}))}sliderListener(){this.slider&&(this.slider.input.addEventListener("input",(()=>{const e=Number(this.slider.input.value),t=e-this.slider.oldValue;this.updateZoom(t,(()=>{this.slider.oldValue=e}))})),this.updatePercentage())}dragListener(){let e={x:null,y:null};this.structureEl.paper.on("blank:pointerdown",((t,s,i)=>{let n=this.structureEl.paper.scale().sx;e={x:s*n,y:i*n}})),this.structureEl.paper.on("cell:pointerup blank:pointerup",(()=>{e={x:null,y:null}}));this.structureEl.graphWrap.addEventListener("mousemove",(t=>{e.x&&e.y&&this.structureEl.paper.translate(t.offsetX-e.x,t.offsetY-e.y)}).bind(this))}resetListener(){var e;null===(e=this.structureEl.container.querySelector(".structure__reset-view-btn"))||void 0===e||e.addEventListener("click",(()=>{this.structureEl.paper.scaleContentToFit()}))}updateZoom(e,t){const s=this.currentZoomIndex+e;if(s<0||s>this.zoomLevels.length-1)return;this.currentZoomIndex=s,this.updatePercentage();const i=this.zoomLevels[this.currentZoomIndex];this.structureEl.paper.scale(i,i,0,0),t&&t(i)}updatePercentage(){if(!this.slider)return;let e=100*this.currentZoomIndex/(this.zoomLevels.length-1);e=Math.round(e),this.slider.label.textContent=`${e} %`}}class _{constructor(){setTimeout((()=>{this._init()}))}
1getTaskDetails(e){const t=this.getTask(e);return t?t.data:null}addTask(e){return this.tasks.push(e),this}_init(){this.container=document.querySelector("div.element-structure"),this.graphWrap=this.container.querySelector(".element-structure__graph-wrap"),this.id=Number(this.container.dataset.id),this.router=this.container.dataset.router,this.graph=new r.k({},{cellNamespace:a}),this.graphValidator=new E(this.graph),this.paper=new l.X({el:this.graphWrap,model:this.graph,width:"100%",height:"100%",gridSize:10,cellViewNamespace:a,drawGrid:{color:"rgb(97, 97, 97)",thickness:1},perpendicularLinks:!0,defaultLink:()=>new h.Arrow}),this.tasks=[],this.listeners(),this.graphEvents(),this.zoomHandler=new y(this);const e=window.GRAPH_JSON,t=window.DETAILS_JSON;let s=[];if(t&&(s=t),e)try{let t=e;console.log({graphJSON:t}),this.graph.fromJSON(t),this.graph.getElements().forEach((e=>{if(e instanceof c.Rectangle){this.addElementTools(e),e.attr("label/fontSize",18),e.attr("label/fontWeight",800);const t=s.find((t=>t.id===e.id));this.tasks.push({id:e.id,data:null==t?void 0:t.data})}})),this.graph.getLinks().forEach((e=>{this.addLinkTools(e)}))}catch(e){console.error(e),this.setup()}else this.setup();this.paper.hideTools(),this.bindToolEvents()}addLinkTools(e){let t=new d.U({snapRadius:1}),s=new u.w,i=new p.s,n=new p.A,o=new m.V,r=new m.R,a=new g.E,l=new w.J;const h=new f.I({tools:[t,s,i,n,o,r,a,l]});e.findView(this.paper).addTools(h)}listeners(){this.container.querySelectorAll("a.structure__add-shape-btn").forEach((e=>{e.addEventListener("click",(()=>{switch(e.dataset.shape){case"rectangle":this.createRectangle();break;case"link":this.createLink()}}))}));this.container.querySelector("a.structure__serialize-btn").addEventListener("click",(()=>{this.save()})),document.addEventListener("click",(e=>{let t=e.target;if(t.matches(".structure__element-form-submit-btn")){const e=t.closest("form");if(!n.X.form.validate(e))return;this.handleElementForm(e),i.q.modal.close()}})),this.paperEvents()}graphEvents(){this.graph.on("remove",(e=>{const t=this.getTask(e.id),s=this.tasks.indexOf(t);-1!==s&&this.tasks.splice(s,1)}))}paperEvents(){this.paper.on("element:pointerclick",(e=>{const t=e.model.id,s=JSON.stringify({id:t,details:this.getTaskDetails(t)});fetch(`${o.xw.lineage}/task`,{headers:{accept:"text/html, */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST",body:s}).then((e=>e.text())).then((e=>{e&&"string"==typeof e?i.q.modal.create(e):i.q.notify.show({title:"DÄmesio",message:"Ä®vyko klaida",type:"error"})}))})),this.contextMenu=new v(this)}setup(){}createRectangle(){const e={width:190,height:140};let t=this.paper.svg.getBoundingClientRect(),s=this.paper.clientToLocalRect({x:t.left,y:t.top,width:t.width,height:t.height}).center(),i=new c.Rectangle({size:e,attrs:{label:{fontSize:18,fontWeight:800}}}),n=i.size();i.position(s.x-n.width,s.y-n.height),i.addTo(this.graph),this.tasks.push({id:i.id,data:{_width:e.width,_height:e.height}}),this.addElementTools(i)}createLink(e){e||(e={});let t=this.paper.svg.getBoundingClientRect(),s=this.paper.clientToLocalRect({x:t.left,y:t.top,width:t.width,height:t.height}).center(),i=new h.Arrow(Object.assign({source:s,target:{x:s.x+150,y:s.y},attrs:{".connection":{"stroke-dasharray":"4 2"}}},e));i.addTo(this.graph),this.addLinkTools(i)}bindToolEvents(){this.paper.on("cell:mouseover",(function(e){e.showTools()})),this.paper.on("cell:mouseout",(function(e){e.hideTools()}))}addElementTools(e){let t=new w.J({offset:{x:10,y:10}}),s=new f.I({tools:[t]});e.findView(this.paper).addTools(s)}handleElementForm(e){let t=n.X.form.serialize(e),s=t.id;delete t.id,delete t._json;let i=this.graph.getElements().find((e=>e.id===s));const o=this.getTask(s),r=t["_title[lt]"];if(o.data=t,i instanceof c.Rectangle&&(t._width&&t._height&&i.resize(Number(t._width),Number(t._height)),r)){const{width:e,height:t}=i.size(),s=k.xO(r,{width:e-2,height:t},{"font-size":18,"font-weight":800},{ellipsis:!0});i.attr("root/title",r),i.attr("label/text",s)}}getTask(e){return this.tasks.find((t=>t.id===e))}save(){let e=JSON.stringify({GraphJSON:this.graph.toJSON(),DetailsJSON:this.tasks});console.log({"object-to-save":e}),fetch(`${o.xw.lineage}/saveJSON/${this.id}`,{headers:{accept:"application/json, text/javascript, */*; q=0.01","Content-Type":"application/json"},method:"POST",body:e}).then((e=>e.json())).then((e=>{console.log({resp:e}),e.success?i.q.toast.show({message:"IÅ¡saugota"}):i.q.notify.show({title:"DÄmesio",message:"IÅ¡saugoti nepavyko",type:"error"})}))}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.