/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../core/Accessor","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../libs/maquette/projection","../../libs/maquette/h","../../libs/maquette/projector"],(function(t,e,r,o,s,i,n,a,h,p,c){"use strict";let l=function(e){function r(t){var r;return(r=e.call(this,t)||this).startX=0,r.startY=0,r.endX=0,r.endY=0,r.width=1,r.color=[0,0,0,.5],r.visible=!0,r}t._inheritsLoose(r,e);var o=r.prototype;return o.render=function(){const{height:t,left:e,top:r,width:o,x1:s,x2:i,y1:n,y2:a}=this._calculateCoordinates(d),h=`stroke: ${this.strokeStyle}; stroke-width: ${this.width}; stroke-linecap: ${this.lineCap};`;return p.h("div",{classes:{"esri-line-overlay-item":!0},styles:{left:e+"px",top:r+"px",width:o+"px",height:t+"px",visibility:this.visible?"visible":"hidden"}},[p.h("svg",{width:o,height:t},[p.h("line",{x1:s,y1:n,x2:i,y2:a,style:h})])])},o.renderCanvas=function(t){if(!this.visible)return;t.strokeStyle=this.strokeStyle,t.lineWidth=this.width,t.lineCap=this.lineCap;const e=this._calculateCoordinates(d);t.beginPath(),t.moveTo(e.left+e.x1,e.top+e.y1),t.lineTo(e.left+e.x2,e.top+e.y2),t.stroke()},o._calculateCoordinates=function(t){const e=Math.min(this.startX,this.endX),r=Math.max(this.startX,this.endX),o=Math.min(this.startY,this.endY),s=Math.max(this.startY,this.endY),i=this.width;return t.left=e-i,t.top=o-i,t.width=r-e+2*i,t.height=Math.max(20,s-o+2*i),t.x1=this.startX-e+i,t.y1=this.startY-o+i,t.x2=this.endX-e+i,t.y2=this.endY-o+i,t},t._createClass(r,[{key:"startPosition",get:function(){return[this.startX,this.startY]},set:function(t){this._set("startX",t[0]),this._set("startY",t[1])}},{key:"endPosition",get:function(){return[this.endX,this.endY]},set:function(t){this._set("endX",t[0]),this._set("endY",t[1])}},{key:"strokeStyle",get:function(){const t=this.color;return`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]})`}},{key:"lineCap",get:function(){return"round"}}]),r}(r);e.__decorate([o.property()],l.prototype,"startX",void 0),e.__decorate([o.property()],l.prototype,"startY",void 0),e.__decorate([o.property()],l.prototype,"endX",void 0),e.__decorate([o.property()],l.prototype,"endY",void 0),e.__decorate([o.property()],l.prototype,"startPosition",null),e.__decorate([o.property()],l.prototype,"endPosition",null),e.__decorate([o.property()],l.prototype,"width",void 0),e.__decorate([o.property()],l.prototype,"color",void 0),e.__decorate([o.property()],l.prototype,"visible",void 0),e.__decorate([o.property({readOnly:!0})],l.prototype,"strokeStyle",null),l=e.__decorate([a.subclass("esri.views.overlay.LineOverlayItem")],l);const d={left:0,top:0,width:0,height:0,x1:0,y1:0,x2:0,y2:0};return l}));
