var BrowserPrint=function(){function e(e){return s+e}function n(e,n){var i=new XMLHttpRequest;i.overrideMimeType("text/html;charset=gb2312");return"withCredentials"in i?i.open(e,n,!0):"undefined"!=typeof XDomainRequest?(i=new XDomainRequest,i.open(e,n)):i=null,i}function i(e,n,i,t){return void 0!=e&&(void 0==i&&(i=e.sendFinishedCallback),void 0==t&&(t=e.sendErrorCallback)),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&200===n.status?i(n.responseText):n.readyState===XMLHttpRequest.DONE&&t(n.responseText)},n}var t={},r=2,s="http://localhost:9100/";return"https:"===location.protocol&&(s="https://localhost:9101/"),t.Device=function(t){var s=this;this.name=t.name,this.deviceType=t.deviceType,this.connection=t.connection,this.uid=t.uid,this.version=r,this.provider=t.provider,this.manufacturer=t.manufacturer,this.sendErrorCallback=function(e){},this.sendFinishedCallback=function(e){},this.send=function(t,r,o){var a=n("POST",e("write"));if(a){i(s,a,r,o);var c={device:{name:this.name,uid:this.uid,connection:this.connection,deviceType:this.deviceType,version:this.version,provider:this.provider,manufacturer:this.manufacturer},data:t};a.send(JSON.stringify(c))}},this.sendUrl=function(t,r,o){var a=n("POST",e("write"));if(a){i(s,a,r,o);var c={device:{name:this.name,uid:this.uid,connection:this.connection,deviceType:this.deviceType,version:this.version,provider:this.provider,manufacturer:this.manufacturer},url:t};a.send(JSON.stringify(c))}},this.readErrorCallback=function(e){},this.readFinishedCallback=function(e){},this.read=function(t,r){var o=n("POST",e("read"));if(o){i(s,o,t,r);var a={device:{name:this.name,uid:this.uid,connection:this.connection,deviceType:this.deviceType,version:this.version,provider:this.provider,manufacturer:this.manufacturer}};o.send(JSON.stringify(a))}},this.sendThenRead=function(e,n,i){this.send(e,function(e){return function(){e.read(n,i)}}(this),i)}},t.getLocalDevices=function(r,s,o){var a=n("GET",e("available"));a&&(finishedFunction=function(e){response=e,response=JSON.parse(response);for(var n in response)if(response.hasOwnProperty(n)&&response[n].constructor===Array){arr=response[n];for(var i=0;i