// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"url:widgets/ThreatAnalysis/setting/newZone.html":'\x3cdiv\x3e\r\n\r\n  \x3cdiv class\x3d"esriCTPopupContainer"\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTLabel"\x3e${nls.descriptionLabel}\x3c/div\x3e\r\n      \x3cdiv class\x3d"esriCTDijitControl"\x3e\r\n        \x3cdiv class\x3d"esriCTDijitWrapper"\x3e\r\n          \x3cdiv class\x3d"esriCTDijitWrapper" data-dojo-attach-point\x3d"zoneDescriptionTextBox"\r\n            data-dojo-type\x3d"dijit/form/ValidationTextBox" aria-label\x3d"${nls.descriptionLabel}" trim\x3d"true" required\x3d"true"\x3e\r\n          \x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTLabel" data-dojo-attach-point\x3d"zoneDistanceLabel"\x3e\x3c/div\x3e\r\n      \x3cdiv class\x3d"esriCTDijitControl"\x3e\r\n        \x3cdiv class\x3d"esriCTDijitWrapper"\x3e\r\n          \x3cdiv class\x3d"esriCTDijitWrapper" data-dojo-attach-point\x3d"zoneDistanceTextBox"\r\n          data-dojo-type\x3d"dijit/form/NumberTextBox" data-dojo-props\x3d"constraints:{min: 0.01}" trim\x3d"true" required\x3d"true"\x3e\r\n          \x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTSymbologyLabel" title\x3d"${nls.outline}"\x3e${nls.outline}\x3c/div\x3e\r\n      \x3cdiv class\x3d"colorPicker Line" id\x3d"outlineColor" data-dojo-attach-point\x3d"outlineColorPicker"\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTSymbologyLabel" title\x3d"${nls.fill}"\x3e${nls.fill}\x3c/div\x3e\r\n      \x3cdiv class\x3d"colorPicker Fill" id\x3d"fillColor" data-dojo-attach-point\x3d"fillColorPicker"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n  \x3c/div\x3e\r\n\r\n\x3c/div\x3e'}});
define("dojo/_base/declare dojo/_base/array ./ColorPickerEditor jimu/BaseWidget dijit/_WidgetsInTemplateMixin dojo/text!./newZone.html dojo/_base/lang dojo/Evented dojo/dom-class dojo/query dijit/registry jimu/dijit/Popup jimu/utils dojo/string dojo/on dijit/form/NumberTextBox dijit/form/ValidationTextBox dijit/form/Select jimu/dijit/SymbolChooser".split(" "),function(k,e,l,m,n,p,c,q,r,h,f,t,d,u,g){return k([m,n,q],{baseClass:"jimu-widget-threatAnalysis-newZoneSettings",templateString:p,selectedSettings:{},
colorPickerNodes:[],dropdownNodes:[],prevZoneName:null,newZonePopup:null,constructor:function(a){c.mixin(this,a)},startup:function(){this._setSymbologySettings()},postCreate:function(){this.inherited(arguments);this.newZonePopup=this.prevZoneName=null;this.currentRowData&&this.currentRowData.zoneDescription&&(this.zoneDescriptionTextBox.set("value",this.currentRowData.zoneDescription),this.zoneDescriptionTextBox.set("title",this.currentRowData.zoneDescription),this.prevZoneName=this.currentRowData.zoneDescription);
this._zoneDescriptionTextBoxValidator();this.currentRowData&&this.currentRowData.distance&&(this.zoneDistanceTextBox.set("value",this.currentRowData.distance),this.zoneDistanceTextBox.set("title",this.currentRowData.distance));this.zoneDistanceLabel.innerHTML=u.substitute(this.nls.distanceLabel,{unitAbbr:this.unitAbbr});this.own(g(this.zoneDescriptionTextBox,"blur",c.hitch(this,function(){this.zoneDescriptionTextBox.set("value",d.stripHTML(d.sanitizeHTML(this.zoneDescriptionTextBox.value)));this.zoneDescriptionTextBox.set("title",
d.stripHTML(d.sanitizeHTML(this.zoneDescriptionTextBox.value)))})));this.own(g(this.zoneDescriptionTextBox,"change",c.hitch(this,function(a){this.zoneDescriptionTextBox.set("title",a)})));this.own(g(this.zoneDistanceTextBox,"change",c.hitch(this,function(){isNaN(this.zoneDistanceTextBox.value)?this.zoneDistanceTextBox.set("title",""):this.zoneDistanceTextBox.set("title",this.zoneDistanceTextBox.value)})));this._createPopUp()},_createPopUp:function(){this.newZonePopup=new t({titleLabel:this.isAddZone?
this.nls.newThreatZonePopupLabel:this.nls.editThreatZonePopupLabel,width:700,maxHeight:800,autoHeight:!0,"class":this.baseClass,content:this,buttons:[{label:this.nls.ok,onClick:c.hitch(this,function(){this.zoneDescriptionTextBox.isValid()?this.zoneDistanceTextBox.isValid()?this._validInputs()&&(this.emit("zoneInfoUpdated",{name:d.stripHTML(d.sanitizeHTML(this.zoneDescriptionTextBox.value)),distance:this.zoneDistanceTextBox.get("value"),symbol:this._getSymbologySettings()}),this.newZonePopup.close()):
this.zoneDistanceTextBox.focus():this.zoneDescriptionTextBox.focus()})},{label:this.nls.cancel,classNames:["jimu-btn-vacation"],onClick:c.hitch(this,function(){this.newZonePopup.close()})}]})},_setSymbologySettings:function(){var a={outlineColor:{color:"#d10e40",transparency:0,type:"esriSLSSolid"},fillColor:{color:"#d10e40",transparency:.88,type:"esriSFSSolid"}};this.colorPickerNodes=h(".colorPicker",this.domNode);this.dropdownNodes=h(".dropdown",this.domNode);e.forEach(this.colorPickerNodes,c.hitch(this,
function(b){b=new l({nls:this.nls,type:r.contains(b,"Line")?"line":"fill"},b);b.setValues({color:this.currentRow&&this.currentRow.symbol?this.currentRow.symbol[b.id].color:a[b.id].color,transparency:this.currentRow&&this.currentRow.symbol?this.currentRow.symbol[b.id].transparency:a[b.id].transparency});b.startup();b.dropdown.set("value",this.currentRow&&this.currentRow.symbol?this.currentRow.symbol[b.id].type:a[b.id].type)}))},_getSymbologySettings:function(){e.forEach(this.colorPickerNodes,c.hitch(this,
function(a){var b={color:f.byId(a.id).getValues().color,transparency:f.byId(a.id).getValues().transparency,type:f.byId(a.id).dropdown.getValue()};this.selectedSettings[a.id]=b}));return this.selectedSettings},_isDuplicateZoneName:function(a){var b=!1;e.some(this.existingZoneNames,c.hitch(this,function(v){if(a.toLowerCase()===v.toLowerCase())return b=!0}));return b},_zoneDescriptionTextBoxValidator:function(){this.zoneDescriptionTextBox.validator=c.hitch(this,function(a){return a?a!==this.prevZoneName&&
this._isDuplicateZoneName(a)?(this.zoneDescriptionTextBox.set("invalidMessage",this.nls.uniqueZoneDescriptionMsg),!1):!0:(this.zoneDescriptionTextBox.set("invalidMessage",this.nls.requiredMsg),!1)})},_validInputs:function(){var a=!0;e.some(this.colorPickerNodes,function(b){if(!f.byId(b.id).validateSpinner())return a=!1,!0},this);return a}})});