// 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/Evented dojo/_base/declare dojo/Deferred dojo/_base/html dojo/has jimu/utils".split(" "),function(m,g,n,h,c,k){return g([m],{declaredClass:"saveJSON",config:null,constructor:function(a){g.safeMixin(this,a)},_getDownloadUrl:function(a){return window.Blob&&window.URL&&window.URL.createObjectURL?(a=new Blob([a],{type:"text/json"}),URL.createObjectURL(a)):"data:attachment/json;charset\x3dutf-8,"+encodeURIComponent(a)},exportsJson:function(a,b){b=JSON.stringify(b);var e=new n;try{if(c("ie")&&
10>c("ie")){var d=window.top.open("about:blank","_blank");d.document.write("sep\x3d,\r\n"+b);d.document.close();d.document.execCommand("SaveAs",!0,a);d.close();this.savePrompt()}else if(10===c("ie")||this._isIE11()||this._isEdge()){var p=new Blob([b],{type:"text/json"});navigator.msSaveBlob(p,a);this.savePrompt()}else{var f=h.create("a",{href:this._getDownloadUrl(b),target:"_blank",download:a},document.body);if(c("safari")){var l=document.createEvent("MouseEvents");l.initEvent("click",!0,!0);f.dispatchEvent(l)}else f.click();
this.savePrompt();h.destroy(f)}e.resolve()}catch(q){e.reject(q)}return e},_isIE11:function(){return 11===k.has("ie")},_isEdge:function(){return k.has("edge")},savePrompt:function(){this.emit("complete",{})}})});