define("editor/assert/js/addon/upload",["../../../../share/assert/js/usersvc","../../../../share/assert/js/restclient"],function(require,exports){function a(a){var b="";for(var c in a)b+=c+"="+a[c]+"&";return encodeURI(b.substr(0,b.length-1))}function b(a){f=a}function c(b,c){var f=Global.saveToPath.substr(Global.saveToPath.lastIndexOf("\\")+1);f=f.substr(0,f.lastIndexOf(".")),e.getToken(function(g){if(!g)return void c("123",401,"");var h={method:"pan.file.add",version:"1.0",format:"json",uid:e.uuid,fileName:f,folderType:"yun_wendang",access_token:g,appkey:"Hb0YhmOo"},i=a(h);d.RegisterClientInvoked(b,c),d.UploadResourceFile("123",AppRemoteSvcCfg.ResSvcUrl,Global.saveToPath,i.toString(),b,c)})}var d=window.require("./node_modules/upload/AddonUpload"),e=require("../../../../share/assert/js/usersvc").userSvc,f="";exports.uploadPackage=c,exports.setFileID=b}),define("share/assert/js/usersvc",["share/assert/js/restclient"],function(require,exports){function a(){function a(a){var b="";for(var c in a)b+=c+"="+a[c]+"&";return encodeURI(b.substr(0,b.length-1))}this.userName="",this.uuid="",this.passwd="";var _self=this;this.login=function(b,c,d){_self.userName=b,_self.passwd=c,_self.getToken(function(e){if(!e)return void d(401);var f={method:"core.user.login",version:"version",format:"json",key:"loginName",value:b,password:c,appkey:"Hb0YhmOo",access_token:e},g=a(f);$.post(AppRemoteSvcCfg.UserSvcUrl,g,function(a){a?(1==a.statusCode&&(_self.uuid=a.userInfo.id),d(new Number(a.statusCode))):d(-1)}).error(function(){d(-1)})})},this.getToken=function(a){b.reqAccessToken(_self.userName,_self.passwd,a)}}var b=require("share/assert/js/restclient").RestClient;exports.userSvc=new a}),define("share/assert/js/restclient",[],function(require,exports){function a(){function b(b,d){var f={locale:e.locale,format:e.format,appkey:e.appkey,access_token:c};for(var g in d)f[g]=d[g];var h;return $.ajax({type:b,async:!1,url:e.restUrl,data:f,dataType:f.format,success:function(a){h=a},error:function(e){log(e.responseJSON),"401"==e.status&&"106"==e.responseJSON.code&&(c="",h=a._request(b,d))}}),h}var _self=this,c="",d=!1,e={appkey:"Hb0YhmOo",appsecret:"R7odNVS0KPtgXJ1TKQbHAxFP6EHdSW5d",username:"",password:"",grantType:"client_credentials",locale:"zh_CN",format:"json",tokenUrl:AppRemoteSvcCfg.UserSvcToken,restUrl:AppRemoteSvcCfg.ResSvcUrl};this.reqAccessToken=function(a,b,d){$.ajax({type:"POST",async:!1,cache:!1,url:e.tokenUrl,data:{client_id:e.appkey,client_secret:e.appsecret,grant_type:e.grantType,username:a,password:b},dataType:"json",success:function(a){c=a.access_token,d(a.access_token)},error:function(){d("")}})},this.userLogin=function(a,b){$.ajax({type:"POST",async:!1,cache:!1,url:e.restUrl,data:{method:"core.user.login",version:"version",format:"json",key:"loginName",value:a,password:b,appkey:"Hb0YhmOo",access_token:c},dataType:"json",success:function(){},error:function(){}})},this.init=function(a){if(!d){for(var b in a)void 0!=e[b]&&(e[b]=a[b]);d=!0}},this.post=function(a){return _self._request("POST",a)},this.get=function(a){return _self._request("GET",a)},this._request=function(a,d){return""==c&&_self.reqAccessToken(),b(a,d)}}exports.RestClient=new a});