// 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
define("dojo/_base/lang jimu/utils dojo/date dojo/_base/array dojo/dom-construct dijit/form/DateTextBox dijit/form/NumberSpinner dijit/form/NumberTextBox dijit/form/FilteringSelect dijit/form/TextBox dijit/form/ValidationTextBox dijit/form/TimeTextBox dijit/Editor dijit/form/SimpleTextarea dojo/store/Memory dojo/query dijit/_editor/plugins/LinkDialog dijit/_editor/plugins/TextColor jimu/dijit/EditorTextColor jimu/dijit/EditorBackgroundColor".split(" "),function(p,k,f,l,g,t,u,q,v,w,m,x,y,z,A,n){return{integerFields:["esriFieldTypeSmallInteger",
"esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble"],getFieldInfoByFieldName:function(a,d){var c={};l.some(a,function(b){if(b.name===d)return p.mixin(c,b),!0});return c},getDateFromRelativeInfo:function(a,d){var c=new Date;"fixed"===a.dateType?c=a.dateTime?new Date(a.dateTime):"":"future"===a.dateType?(c=f.add(c,"year",a.year),c=f.add(c,"month",a.month),c=f.add(c,"day",a.day),c=f.add(c,"hour",a.hour),c=f.add(c,"minute",a.minute),c=f.add(c,"second",a.second)):"past"===a.dateType&&(a.year&&
(c=f.add(c,"year",-1*a.year)),a.month&&(c=f.add(c,"month",-1*a.month)),a.day&&(c=f.add(c,"day",-1*a.day)),a.hour&&(c=f.add(c,"hour",-1*a.hour)),a.minute&&(c=f.add(c,"minute",-1*a.minute)),a.second&&(c=f.add(c,"second",-1*a.second)));return d&&""!==c?k.localizeDate(c):c},getDateFieldValue:function(a,d){if("esriFieldTypeDate"===a.type){if(d instanceof Array){var c,b;0<d.length&&d[0]&&(c=d[0].getValue());1<d.length&&d[1]&&(b=d[1].getValue());var e=c&&b?new Date(c.getFullYear(),c.getMonth(),c.getDate(),
b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds()):c||b||null}else e=d.getValue(),a.domain&&(e=Number(e));e=e&&e.getTime?e.getTime():e&&e.toGregorian?e.toGregorian().getTime():e}return e},isGuid:function(a){"{"===a[0]&&(a=a.substring(1,a.length-1));return/^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/gi.test(a)},validateGUID:function(a,d){return this.isGuid(a)},isValidPresetValue:function(a){var d=!0;l.some(a,function(c){if(c.isValid&&
!c.isValid())return d=!1,!0});return d},createPresetFieldContentNode:function(a){var d=[];if(a.domain){if("codedValue"===a.domain.type){var c=[];l.forEach(a.domain.codedValues,function(r){c.push({name:r.name,id:r.code})});var b=new v({"class":"ee-inputField",name:a.fieldName,store:new A({data:c}),searchAttr:"name",required:!0},g.create("div"))}else{b=null;switch(a.type){case "esriFieldTypeSmallInteger":case "esriFieldTypeInteger":b={min:a.domain.minValue,max:a.domain.maxValue,places:0};break;case "esriFieldTypeSingle":case "esriFieldTypeDouble":b=
{min:a.domain.minValue,max:a.domain.maxValue}}b=new u({"class":"ee-inputField",name:a.fieldName,smallDelta:1,constraints:b,required:!0},g.create("div"))}d.push(b)}else switch(a.type){case "esriFieldTypeGUID":b=new m({"class":"ee-inputField",name:a.fieldName,required:!0,trim:!0},g.create("div"));b.validator=p.hitch(this,this.validateGUID);d.push(b);break;case "esriFieldTypeDate":b=new t({"class":"ee-inputField",name:a.fieldName,required:!0,fieldType:"date"},g.create("div"));d.push(b);a.format&&a.format.time&&
!0===a.format.time&&(a=new x({"class":"ee-inputField",style:"margin-top:2px;",required:!0},g.create("div")),d.push(a));break;case "esriFieldTypeString":b=null;a.length&&Number(a.length)&&0<Number(a.length)&&(b=a.length);if(a.hasOwnProperty("stringFieldOption"))if("richtext"===a.stringFieldOption){var e=document.getElementsByTagName("head")[0];var h=window.apiUrl+"dojox/editor/plugins/resources/css/TextColor.css";n('link[href\x3d"'+h+'"]',e)[0]||k.loadStyleLink("editor_plugins_resources_TextColor",
h);h=window.apiUrl+"dojox/editor/plugins/resources/editorPlugins.css";n('link[href\x3d"'+h+'"]',e)[0]||k.loadStyleLink("editor_plugins_resources_editorPlugins",h);h=window.apiUrl+"dojox/editor/plugins/resources/css/PasteFromWord.css";n('link[href\x3d"'+h+'"]',e)[0]||k.loadStyleLink("editor_plugins_resources_PasteFromWord",h);b={"class":"ee-inputField ee-inputFieldRichText",trim:!0,maxLength:b,fieldType:"richtext",required:!0};b["class"]+=" atiRichTextField";b.height="100%";b.width="100%";b.name=a.fieldName;
b.plugins=["bold","italic","underline",k.getEditorTextColor("smartEditor"),k.getEditorBackgroundColor("smartEditor"),"|","justifyLeft","justifyCenter","justifyRight","justifyFull","|","insertOrderedList","insertUnorderedList","indent","outdent","|","createLink"];b=new y(b,g.create("div"))}else b="textarea"===a.stringFieldOption?new z({"class":"ee-inputField ee-inputFieldTextArea",name:a.fieldName,maxlength:b,fieldType:"textarea",required:!0},g.create("div")):new m({"class":"ee-inputField",name:a.fieldName,
maxlength:b,required:!0,trim:!0},g.create("div"));else b=new m({"class":"ee-inputField",name:a.fieldName,maxlength:b,required:!0,trim:!0},g.create("div"));d.push(b);break;case "esriFieldTypeSmallInteger":case "esriFieldTypeInteger":b=new q({"class":"ee-inputField",name:a.fieldName,required:!0,constraints:{places:0}},g.create("div"));d.push(b);break;case "esriFieldTypeSingle":case "esriFieldTypeDouble":b=new q({"class":"ee-inputField",name:a.fieldName,required:!0},g.create("div"));d.push(b);break;
default:b=new w({"class":"ee-unsupportField",name:a.fieldName,value:"N/A",readOnly:!0},g.create("div")),d.push(b)}return d},changeFieldToMostRestrictive:function(a,d){if(!a.hasOwnProperty("type")&&d.hasOwnProperty("type"))return d;d.length&&Number(d.length)&&0<Number(d.length)&&(a.length&&Number(a.length)?d.length<a.length&&(a.length=d.length):a.length=d.length);if(a.type===d.type)switch(d.type){case "esriFieldTypeString":a.hasOwnProperty("stringFieldOption")&&d.hasOwnProperty("stringFieldOption")&&
("richtext"===a.stringFieldOption&&"richtext"!==d.stringFieldOption?a.stringFieldOption=d.stringFieldOption:"textarea"===a.stringFieldOption&&"textbox"===d.stringFieldOption&&(a.stringFieldOption=d.stringFieldOption))}return a}}});