UNPKG

45.4 kBJavaScriptView Raw
1!function(t,e){var n=function(){var j={};if(typeof require==="undefined")j.__sr=function(){};else j.__sr=require;return j.__r=function(t){var e=j[t];return null===e.sts&&e.load.call(),e.mod.exports},j.https={sts:1,mod:{exports:j.__sr("https")}},j.http={sts:1,mod:{exports:j.__sr("http")}},j.util={sts:1,mod:{exports:j.__sr("util")}},j.fs={sts:1,mod:{exports:j.__sr("fs")}},j.crypto={sts:1,mod:{exports:j.__sr("crypto")}},j.a={sts:null,mod:{exports:{}},load:function(){var t=j.a.mod;t.exports;j.__sr.resolve,j.a.sts=0,t.exports.decode=function(t,e,n,s){e=e||"&",n=n||"=";var i={};if("string"!=typeof t||0===t.length)return i;var r=/\+/g;t=t.split(e);var o=1e3;s&&"number"==typeof s.maxKeys&&(o=s.maxKeys);var a,p,h=t.length;0<o&&o<h&&(h=o);for(var c=0;c<h;++c){var u,l,m,_,f=t[c].replace(r,"%20"),d=f.indexOf(n);l=0<=d?(u=f.substr(0,d),f.substr(d+1)):(u=f,""),m=decodeURIComponent(u),_=decodeURIComponent(l),a=i,p=m,Object.prototype.hasOwnProperty.call(a,p)?Array.isArray(i[m])?i[m].push(_):i[m]=[i[m],_]:i[m]=_}return i};function r(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}}t.exports.encode=function(n,s,i,t){return s=s||"&",i=i||"=",null===n&&(n=void 0),"object"==typeof n?Object.keys(n).map(function(t){var e=encodeURIComponent(r(t))+i;return Array.isArray(n[t])?n[t].map(function(t){return e+encodeURIComponent(r(t))}).join(s):e+encodeURIComponent(r(n[t]))}).join(s):t?encodeURIComponent(r(t))+i+encodeURIComponent(r(n)):""},j.a.sts=1}.bind(this)},j.b={sts:null,mod:{exports:{}},load:function(){function t(t){var e={"./querystring":"a"}[t];return e?j.__r(e):j.__sr(t)}var e=j.b.mod,n=e.exports;t.resolve=j.__sr.resolve,j.b.sts=0,(n=e.exports).parse=_,n.resolve=function(t,e){return f(s(t,e))},n.resolveObject=s,n.format=f;var d=/^([a-z0-9]+:)/,E=/:[0-9]+$/,y=["/","?",";","#"],g={file:!0,"file:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=t("./querystring");function _(t,e,n){if(t&&"object"==typeof t&&t.href)return t;var s={href:t},i=t,r=d.exec(i);if(r&&(r=r[0],s.protocol=r,i=i.substr(r.length)),n||r||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var o="//"===i.substr(0,2);!o||r&&g[r]||(i=i.substr(2),s.slashes=!0)}if(!g[r]&&(o||r&&!x[r])){for(var a=-1,p=0,h=y.length;p<h;p++){var c=i.indexOf(y[p]);-1!==c&&(a<0||c<a)&&(a=c)}i=-1!==a?(s.host=i.substr(0,a),i.substr(a)):(s.host=i,"");var u=function(t){var e={},n=t.indexOf("@");-1!==n&&(e.auth=t.substr(0,n),t=t.substr(n+1));var s=E.exec(t);s&&(s=s[0],e.port=s.substr(1),t=t.substr(0,t.length-s.length));t&&(e.hostname=t);return e}(s.host),l=Object.keys(u);for(p=0,h=l.length;p<h;p++){var m=l[p];s[m]=u[m]}s.hostname=s.hostname||""}var _=i.indexOf("#");-1!==_&&(s.hash=i.substr(_),i=i.slice(0,_));var f=i.indexOf("?");return-1!==f?(s.search=i.substr(f),s.query=i.substr(f+1),e&&(s.query=v.parse(s.query)),i=i.slice(0,f)):e&&(s.query={}),i&&(s.pathname=i),s.path=s.pathname+(s.search||""),s}function f(t){"string"==typeof t&&(t=_(t));var e=t.protocol||"",n=void 0!==t.host?t.host:void 0!==t.hostname&&(t.auth?t.auth+"@":"")+t.hostname+(t.port?":"+t.port:""),s=t.pathname||"",i=t.search||t.query&&"?"+("object"==typeof t.query?v.stringify(t.query):String(t.query))||"",r=t.hash||"";return e&&":"!==e.substr(-1)&&(e+=":"),t.slashes||(!e||x[e])&&!1!==n?(n="//"+(n||""),s&&"/"!==s.charAt(0)&&(s="/"+s)):n=n||"",r&&"#"!==r.charAt(0)&&(r="#"+r),i&&"?"!==i.charAt(0)&&(i="?"+i),e+n+s+i+r}function s(t,e){if(!t)return e;if(t=_(f(t),!1,!0),e=_(f(e),!1,!0),t.hash=e.hash,""===e.href)return t;if(e.slashes&&!e.protocol)return e.protocol=t.protocol,e;if(e.protocol&&e.protocol!==t.protocol){if(!x[e.protocol])return e;if(t.protocol=e.protocol,!e.host&&!g[e.protocol]){for(var n=(e.pathname||"").split("/");n.length&&!(e.host=n.shift()););e.host||(e.host=""),""!==n[0]&&n.unshift(""),n.length<2&&n.unshift(""),e.pathname=n.join("/")}return t.pathname=e.pathname,t.search=e.search,t.query=e.query,t.host=e.host||"",delete t.auth,delete t.hostname,t.port=e.port,t}var s=t.pathname&&"/"===t.pathname.charAt(0),i=void 0!==e.host||e.pathname&&"/"===e.pathname.charAt(0),r=i||s||t.host&&e.pathname,o=r,a=t.pathname&&t.pathname.split("/")||[],p=(n=e.pathname&&e.pathname.split("/")||[],t.protocol&&!x[t.protocol]&&void 0!==t.host);if(p&&(delete t.hostname,delete t.auth,delete t.port,t.host&&(""===a[0]?a[0]=t.host:a.unshift(t.host)),delete t.host,e.protocol&&(delete e.hostname,delete e.auth,delete e.port,e.host&&(""===n[0]?n[0]=e.host:n.unshift(e.host)),delete e.host),r=r&&(""===n[0]||""===a[0])),i)t.host=e.host||""===e.host?e.host:t.host,t.search=e.search,t.query=e.query,a=n;else if(n.length)(a=a||[]).pop(),a=a.concat(n),t.search=e.search,t.query=e.query;else if("search"in e)return p&&(t.host=a.shift()),t.search=e.search,t.query=e.query,t;if(!a.length)return delete t.pathname,t;for(var h=a.slice(-1)[0],c=(t.host||e.host)&&("."===h||".."===h)||""===h,u=0,l=a.length;0<=l;l--)"."==(h=a[l])?a.splice(l,1):".."===h?(a.splice(l,1),u++):u&&(a.splice(l,1),u--);if(!r&&!o)for(;u--;)a.unshift("..");!r||""===a[0]||a[0]&&"/"===a[0].charAt(0)||a.unshift(""),c&&"/"!==a.join("/").substr(-1)&&a.push("");var m=""===a[0]||a[0]&&"/"===a[0].charAt(0);return p&&(t.host=m?"":a.shift()),(r=r||t.host&&a.length)&&!m&&a.unshift(""),t.pathname=a.join("/"),t}j.b.sts=1}.bind(this)},j.c={sts:null,mod:{exports:{}},load:function(){function _(t){var e={"./url":"b",https:"https",http:"http"}[t];return e?j.__r(e):j.__sr(t)}var t=j.c.mod.exports;_.resolve=j.__sr.resolve,j.c.sts=0;var f=_("./url");t.request=function(t,e,s,n,i){if("undefined"!=typeof window){for(var r in c={"User-Agent":"node-soap/0.2.0",Accept:"text/html,application/xhtml+xml,application/xml","Accept-Encoding":"none","Accept-Charset":"utf-8","Content-Type":"application/x-www-form-urlencoded",Connection:"close",Host:p},n=n||{})c[r]=n[r];$.ajax(t,{headers:c,type:e?"POST":"GET",data:e,dataType:"text",success:function(t,e,n){resp={statusCode:200},s(null,resp,t)},error:function(t,e,n){resp={statusCode:t.status},s(n,resp,t.responseText)}})}else{var o=f.parse(t),a="https:"==o.protocol,p=o.hostname,h=(parseInt(o.port||(a?443:80)),[o.pathname||"/",o.search||"",o.hash||""].join(""),e?"POST":"GET"),c={"User-Agent":"node-soap/0.2.0",Accept:"text/html,application/xhtml+xml,application/xml","Accept-Encoding":"none","Accept-Charset":"utf-8",Connection:"close",Host:p};for(var r in"string"==typeof e&&(c["Content-Length"]=Buffer.byteLength(e,"utf8"),c["Content-Type"]="application/x-www-form-urlencoded"),n=n||{})c[r]=n[r];var u,l=o;for(var r in l.method=h,l.headers=c,i=i||{})l[r]=i[r];u=_(a?"https":"http"),e&&(l.body=e);var m=u.request(l,function(t,e){e="";t.on("data",function(t){e+=t}),t.on("end",function(){s(null,t,e)})});m.on("error",s),m.end(e)}},j.c.sts=1}.bind(this)},j.d={sts:null,mod:{exports:{}},load:function(){var t=j.d.mod;t.exports;j.__sr.resolve,j.d.sts=0,t.exports=function(t,e){if(1!=!!t)throw console.log(e),new Error(e)},j.d.sts=1}.bind(this)},j.e={sts:null,mod:{exports:{}},load:function(){function t(t){var e={"./http":"c","./assert":"d","./url":"b"}[t];return e?j.__r(e):j.__sr(t)}var e=j.e.mod.exports;t.resolve=j.__sr.resolve,j.e.sts=0;function n(t,e){this.wsdl=t,this._initializeServices(e)}var d=t("./http"),E=t("./assert");t("./url");n.prototype.setEndpoint=function(t){this.endpoint=t,this._initializeServices(t)},n.prototype.describe=function(){this.wsdl.definitions.types;return this.wsdl.describeServices()},n.prototype.setSecurity=function(t){this.security=t},n.prototype.setSOAPAction=function(t){this.SOAPAction=t},n.prototype._initializeServices=function(t){var e=this.wsdl.definitions.services;for(var n in e)this[n]=this._defineService(e[n],t)},n.prototype._defineService=function(t,e){var n=t.ports,s={};for(var i in n)s[i]=this._definePort(n[i],e||n[i].location);return s},n.prototype._definePort=function(t,e){var n=e,s=t.binding.methods,i={};for(var r in s)i[r]=this._defineMethod(s[r],n),this[r]||(this[r]=i[r]);return i},n.prototype._defineMethod=function(e,n){var i=this;return function(t,s){"function"==typeof t&&(s=t,t={}),i._invoke(e,t,n,function(t,e,n){s(t,e,n)})}},n.prototype._invoke=function(t,arguments,e,r){var n,o=this,a=t.$name,s=t.input,p=t.output,i=t.style,h=this.wsdl.definitions,c=h.$targetNamespace,u="",l="",m={SOAPAction:this.SOAPAction?this.SOAPAction(c,a):(c.lastIndexOf("/")!=c.length-1?c+"/":c)+a,"Content-Type":"text/xml; charset=utf-8"},_={},f=function(t,e){for(var n in t)if(t[n]===e)return n}(h.xmlns,c);o.security&&o.security.addHeaders&&o.security.addHeaders(m),o.security&&o.security.addOptions&&o.security.addOptions(_),s.parts?(E(!i||"rpc"==i,"invalid message definition for document style binding"),l=o.wsdl.objectToRpcXML(a,arguments,f,c),"encoded"===t.inputSoap&&(u='soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ')):l="string"==typeof arguments?arguments:(E(!i||"document"==i,"invalid message definition for rpc style binding"),o.wsdl.objectToDocumentXML(s.$name,arguments,s.targetNSAlias,s.targetNamespace)),n='<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" '+u+this.wsdl.xmlnsInEnvelope+"><soap:Header>"+(o.security?o.security.toXML():"")+"</soap:Header><soap:Body>"+l+"</soap:Body></soap:Envelope>",d.request(e,n,function(t,e,n){if(t)r(t,n?o.wsdl.xmlToObject(n):null,n);else{try{var s=o.wsdl.xmlToObject(n)}catch(t){return r(t,e,n)}var i=s.Body[p.$name];i=i||s.Body[a+"Response"],r(null,i,n)}},m,_)},e.Client=n,j.e.sts=1}.bind(this)},j.f={sts:null,mod:{exports:{}},load:function(){function p(t){var e={util:"util",fs:"fs",util:"util"}[t];return e?j.__r(e):j.__sr(t)}var t=j.f.mod.exports;p.resolve=j.__sr.resolve,j.f.sts=0,function(){var c=function(t){t=u.replace(t,null,null,"\r\n","\n"),t=u.replace(t,null,null,"\r","\n"),this.m_xml=t,this.m_iP=0,this.m_iState=c._STATE_PROLOG,this.m_stack=new e,this._clearAttributes(),this.m_pause=!1,this.m_preInterruptIState=c._STATE_PROLOG,this.m_namespaceList=new Array,this.m_chunkTransitionContinuation=null};c._NONE=0,c._ELM_B=1,c._ELM_E=2,c._ELM_EMP=3,c._ATT=4,c._TEXT=5,c._ENTITY=6,c._PI=7,c._CDATA=8,c._COMMENT=9,c._DTD=10,c._ERROR=11,c._INTERRUPT=12,c._CONT_XML=0,c._CONT_ALT=1,c._ATT_NAME=0,c._ATT_VAL=1,c._STATE_PROLOG=1,c._STATE_DOCUMENT=2,c._STATE_MISC=3,c._errs=new Array,c._errs[c.ERR_CLOSE_PI=0]="PI: missing closing sequence",c._errs[c.ERR_CLOSE_DTD=1]="DTD: missing closing sequence",c._errs[c.ERR_CLOSE_COMMENT=2]="Comment: missing closing sequence",c._errs[c.ERR_CLOSE_CDATA=3]="CDATA: missing closing sequence",c._errs[c.ERR_CLOSE_ELM=4]="Element: missing closing sequence",c._errs[c.ERR_CLOSE_ENTITY=5]="Entity: missing closing sequence",c._errs[c.ERR_PI_TARGET=6]="PI: target is required",c._errs[c.ERR_ELM_EMPTY=7]="Element: cannot be both empty and closing",c._errs[c.ERR_ELM_NAME=8]='Element: name must immediatly follow "<"',c._errs[c.ERR_ELM_LT_NAME=9]='Element: "<" not allowed in element names',c._errs[c.ERR_ATT_VALUES=10]="Attribute: values are required and must be in quotes",c._errs[c.ERR_ATT_LT_NAME=11]='Element: "<" not allowed in attribute names',c._errs[c.ERR_ATT_LT_VALUE=12]='Attribute: "<" not allowed in attribute values',c._errs[c.ERR_ATT_DUP=13]="Attribute: duplicate attributes not allowed",c._errs[c.ERR_ENTITY_UNKNOWN=14]="Entity: unknown entity",c._errs[c.ERR_INFINITELOOP=15]="Infininte loop",c._errs[c.ERR_DOC_STRUCTURE=16]="Document: only comments, processing instructions, or whitespace allowed outside of document element",c._errs[c.ERR_ELM_NESTING=17]="Element: must be nested correctly",c.prototype.continueParsing=function(t){this.m_chunkTransitionContinuation&&(t=this.m_chunkTransitionContinuation+t),t=u.replace(t,null,null,"\r\n","\n"),t=u.replace(t,null,null,"\r","\n"),this.m_xml=t,this.m_iP=0,this.m_iState=c._STATE_DOCUMENT,this.m_pause=!1,this.m_preInterruptIState=c._STATE_PROLOG,this.m_chunkTransitionContinuation=null},c.prototype._addAttribute=function(t,e){this.m_atts[this.m_atts.length]=new Array(t,e)},c.prototype._checkStructure=function(t){if(c._STATE_PROLOG==this.m_iState){if((c._TEXT==t||c._ENTITY==t)&&-1!=u.indexOfNonWhitespace(this.getContent(),this.getContentBegin(),this.getContentEnd()))return this._setErr(c.ERR_DOC_STRUCTURE);c._ELM_B!=t&&c._ELM_EMP!=t||(this.m_iState=c._STATE_DOCUMENT)}if(c._STATE_DOCUMENT==this.m_iState){if(c._ELM_B!=t&&c._ELM_EMP!=t||this.m_stack.push(this.getName()),c._ELM_E==t||c._ELM_EMP==t){var e=this.m_stack.pop();if(null==e||e!=this.getName())return this._setErr(c.ERR_ELM_NESTING)}if(0==this.m_stack.count())return this.m_iState=c._STATE_MISC,t}if(c._STATE_MISC==this.m_iState){if(c._ELM_B==t||c._ELM_E==t||c._ELM_EMP==t||c.EVT_DTD==t)return this._setErr(c.ERR_DOC_STRUCTURE);if((c._TEXT==t||c._ENTITY==t)&&-1!=u.indexOfNonWhitespace(this.getContent(),this.getContentBegin(),this.getContentEnd()))return this._setErr(c.ERR_DOC_STRUCTURE)}return t},c.prototype._clearAttributes=function(){this.m_atts=new Array},c.prototype._findAttributeIndex=function(t){for(var e=0;e<this.m_atts.length;e++)if(this.m_atts[e][c._ATT_NAME]==t)return e;return-1},c.prototype.getAttributeCount=function(){return this.m_atts?this.m_atts.length:0},c.prototype.getAttributeName=function(t){return t<0||t>=this.m_atts.length?null:this.m_atts[t][c._ATT_NAME]},c.prototype.getAttributeValue=function(t){return t<0||t>=this.m_atts.length?null:function(t){return t=(t=(t=(t=(t=t.replace(/&amp;/g,"&")).replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&quot;/g,'"')).replace(/&apos;/g,"'")}(this.m_atts[t][c._ATT_VAL])},c.prototype.getAttributeValueByName=function(t){return this.getAttributeValue(this._findAttributeIndex(t))},c.prototype.getColumnNumber=function(){return u.getColumnNumber(this.m_xml,this.m_iP)},c.prototype.getContent=function(){return this.m_cSrc==c._CONT_XML?this.m_xml:this.m_cAlt},c.prototype.getContentBegin=function(){return this.m_cB},c.prototype.getContentEnd=function(){return this.m_cE},c.prototype.getLineNumber=function(){return u.getLineNumber(this.m_xml,this.m_iP)},c.prototype.getName=function(){return this.m_name},c.prototype.pause=function(){this.m_pause=!0},c.prototype.resume=function(){this.m_pause=!1,this.m_iState=this.m_preInterruptIState},c.prototype.next=function(){return this.m_pause?(this.m_preInterruptIState=this.m_iState,c._INTERRUPT):this._checkStructure(this._parse())},c.prototype._parse=function(){if(this.m_iP==this.m_xml.length)return c._NONE;function t(t,e,n){for(var s=0;s<t.length;s++)if(t.charAt(s)!=e.charAt(n+s))return-1;return n}var e=this.m_xml.charAt(this.m_iP);return"<"!==e&&"&"!==e?this._parseText(this.m_iP):this.m_iP==t("<?",this.m_xml,this.m_iP)?this._parsePI(this.m_iP+2):this.m_iP==t("<!DOCTYPE",this.m_xml,this.m_iP)?this._parseDTD(this.m_iP+9):this.m_iP==t("\x3c!--",this.m_xml,this.m_iP)?this._parseComment(this.m_iP+4):this.m_iP==t("<![CDATA[",this.m_xml,this.m_iP)?this._parseCDATA(this.m_iP+9):this.m_iP==t("<",this.m_xml,this.m_iP)?this._parseElement(this.m_iP+1):this.m_iP==t("&",this.m_xml,this.m_iP)?this._parseEntity(this.m_iP+1):this._parseText(this.m_iP)},c.prototype._parsePrefixAndElementName=function(t){return splits=t.split(":",2),{prefix:1===splits.length?"":splits[0],name:1===splits.length?t:splits[1]}},c.prototype._parseNamespacesAndAtts=function(t){that=this;var e=[],n=[];return t.map(function(t){return"xmlns"===t[0].slice(0,5)?e.push({prefix:t[0].slice(6),uri:t[1],scopetag:that.m_name}):n.push(t),"not used"}),this.m_namespaceList=this.m_namespaceList.concat(e),[n,e.map(function(t){return[t.prefix,t.uri]})]},c.prototype._getContextualNamespace=function(t){if(""!==t)for(n in this.m_namespaceList)if((n=this.m_namespaceList[n]).prefix===t)return n.uri;for(var e=this.m_namespaceList.length-1;0<=e;e--){var n=this.m_namespaceList[e];if(""===n.prefix)return n.uri}return""},c.prototype._removeExpiredNamesapces=function(e){var n=[];this.m_namespaceList.map(function(t){t.scopetag!==e&&n.push(t)}),this.m_namespaceList=n},c.prototype._parseAttribute=function(t,e){var n,s,i,r,o,a,p,h;return this.m_cAlt="",-1==(n=u.indexOfNonWhitespace(this.m_xml,t,e))||e<=n?n:-1==(i=this.m_xml.indexOf("=",n))||e<i?this._setErr(c.ERR_ATT_VALUES):(s=u.lastIndexOfNonWhitespace(this.m_xml,n,i),-1==(r=u.indexOfNonWhitespace(this.m_xml,i+1,e))||e<r?this._setErr(c.ERR_ATT_VALUES):(a=this.m_xml.charAt(r),-1==u.QUOTES.indexOf(a)?this._setErr(c.ERR_ATT_VALUES):-1==(o=this.m_xml.indexOf(a,r+1))||e<o?this._setErr(c.ERR_ATT_VALUES):(p=this.m_xml.substring(n,s+1),h=this.m_xml.substring(r+1,o),-1!=p.indexOf("<")?this._setErr(c.ERR_ATT_LT_NAME):-1!=h.indexOf("<")?this._setErr(c.ERR_ATT_LT_VALUE):(h=u.replace(h,null,null,"\n"," "),h=u.replace(h,null,null,"\t"," "),iRet=this._replaceEntities(h),iRet==c._ERROR?iRet:(h=this.m_cAlt,-1!=this._findAttributeIndex(p)?this._setErr(c.ERR_ATT_DUP):(this._addAttribute(p,h),this.m_iP=o+2,c._ATT))))))},c.prototype._parseCDATA=function(t){var e=this.m_xml.indexOf("]]>",t);return-1==e?(this.m_chunkTransitionContinuation=this.m_xml.slice(t-9),c._INTERRUPT):(this._setContent(c._CONT_XML,t,e),this.m_iP=e+3,c._CDATA)},c.prototype._parseComment=function(t){var e=this.m_xml.indexOf("--\x3e",t);return-1==e?(this.m_chunkTransitionContinuation=this.m_xml.slice(t-4),c._INTERRUPT):(this._setContent(c._CONT_XML,t,e),this.m_iP=e+3,c._COMMENT)},c.prototype._parseDTD=function(t){var e,n,s,i;if(-1==(e=this.m_xml.indexOf(">",t)))return this.m_chunkTransitionContinuation=this.m_xml.slice(t-9),c._INTERRUPT;for(n=-1!=(s=this.m_xml.indexOf("[",t))&&s<e?"]>":">";;){if(e==i)return this._setErr(c.ERR_INFINITELOOP);if(i=e,-1==(e=this.m_xml.indexOf(n,t)))return this._setErr(c.ERR_CLOSE_DTD);if("]]>"!=this.m_xml.substring(e-1,e+2))break}return this.m_iP=e+n.length,c._DTD},c.prototype._parseElement=function(t){var e,n,s,i,r,o,a;if(util=p("util"),n=e=this.m_xml.indexOf(">",t),-1==e)return this.m_chunkTransitionContinuation=this.m_xml.slice(t-1),c._INTERRUPT;if("/"==this.m_xml.charAt(t)?(r=c._ELM_E,t++):r=c._ELM_B,"/"==this.m_xml.charAt(e-1)){if(r==c._ELM_E)return this._setErr(c.ERR_ELM_EMPTY);r=c._ELM_EMP,n--}if(n=u.lastIndexOfNonWhitespace(this.m_xml,t,n),e-t!=1&&u.indexOfNonWhitespace(this.m_xml,t,n)!=t)return this._setErr(c.ERR_ELM_NAME);if(this._clearAttributes(),-1==(s=u.indexOfWhitespace(this.m_xml,t,n)))s=n+1;else for(this.m_iP=s;this.m_iP<n;){if(this.m_iP==a)return this._setErr(c.ERR_INFINITELOOP);if(a=this.m_iP,(i=this._parseAttribute(this.m_iP,n))==c._ERROR)return i}return-1!=(o=this.m_xml.substring(t,s)).indexOf("<")?this._setErr(c.ERR_ELM_LT_NAME):(this.m_name=o,this.m_iP=e+1,r)},c.prototype._parseEntity=function(t){var e=this.m_xml.indexOf(";",t);return-1==e?(this.m_chunkTransitionContinuation=this.m_xml.slice(t-1),c._INTERRUPT):(this.m_iP=e+1,this._replaceEntity(this.m_xml,t,e))},c.prototype._parsePI=function(t){var e,n,s,i,r;return-1==(e=this.m_xml.indexOf("?>",t))?(this.m_chunkTransitionContinuation=this.m_xml.slice(t-2),c._INTERRUPT):-1==(n=u.indexOfNonWhitespace(this.m_xml,t,e))?this._setErr(c.ERR_PI_TARGET):(-1==(s=u.indexOfWhitespace(this.m_xml,n,e))&&(s=e),-1==(i=u.indexOfNonWhitespace(this.m_xml,s,e))&&(i=e),-1==(r=u.lastIndexOfNonWhitespace(this.m_xml,i,e))&&(r=e-1),this.m_name=this.m_xml.substring(n,s),this._setContent(c._CONT_XML,i,r+1),this.m_iP=e+2,c._PI)},c.prototype._parseText=function(t){var e,n;for(e=t;e<this.m_xml.length&&("<"!==(n=this.m_xml.charAt(e))&&"&"!==n);++e);return this._setContent(c._CONT_XML,t,e),this.m_iP=e,c._TEXT},c.prototype._replaceEntities=function(t,e,n){if(u.isEmpty(t))return"";e=e||0,n=n||t.length;var s,i,r="";for(s=t.indexOf("&",e),i=e;0<s&&s<n;){if(r+=t.substring(i,s),0==(i=t.indexOf(";",s)+1)||n<i)return this._setErr(c.ERR_CLOSE_ENTITY);if(iRet=this._replaceEntity(t,s+1,i-1),iRet==c._ERROR)return iRet;r+=this.m_cAlt,s=t.indexOf("&",i)}return i!=n&&(r+=t.substring(i,n)),this._setContent(c._CONT_ALT,r),c._ENTITY},c.prototype._replaceEntity=function(t,e,n){if(u.isEmpty(t))return-1;switch(e=e||0,n=n||t.length,t.substring(e,n)){case"amp":strEnt="&";break;case"lt":strEnt="<";break;case"gt":strEnt=">";break;case"apos":strEnt="'";break;case"quot":strEnt='"';break;case"nbsp":strEnt="";break;case"lt":strEnt="<";break;case"gt":strEnt=">";break;case"amp":strEnt="&";break;case"cent":strEnt="¢";break;case"pound":strEnt="£";break;case"yen":strEnt="¥";break;case"euro":strEnt="€";break;case"sect":strEnt="§";break;case"copy":strEnt="©";break;case"reg":strEnt="®";break;default:"#"==t.charAt(e)?strEnt=String.fromCharCode(parseInt(t.substring(e+1,n))):strEnt=" "}return this._setContent(c._CONT_ALT,strEnt),c._ENTITY},c.prototype._setContent=function(t){var e=arguments;c._CONT_XML==t?(this.m_cAlt=null,this.m_cB=e[1],this.m_cE=e[2]):(this.m_cAlt=e[1],this.m_cB=0,this.m_cE=e[1].length),this.m_cSrc=t},c.prototype._setErr=function(t){var e=c._errs[t];return this.m_cAlt=e,this.m_cB=0,this.m_cE=e.length,this.m_cSrc=c._CONT_ALT,c._ERROR};function r(t){function e(){}var n=new function(){};e.prototype.onStartDocument=function(t){n.onStartDocument=t},e.prototype.onEndDocument=function(t){n.onEndDocument=t},e.prototype.onStartElementNS=function(t){n.onStartElementNS=t},e.prototype.onEndElementNS=function(t){n.onEndElementNS=t},e.prototype.onCharacters=function(t){n.onCharacters=t},e.prototype.onCdata=function(t){n.onCdata=t},e.prototype.onComment=function(t){n.onComment=t},e.prototype.onWarning=function(t){n.onWarning=t},e.prototype.onError=function(t){n.onError=t},t(new e),this.m_hndDoc=n,this.m_hndErr=n,this.m_hndLex=n,this.m_interrupted=!1}r.DOC_B=1,r.DOC_E=2,r.ELM_B=3,r.ELM_E=4,r.CHARS=5,r.PI=6,r.CD_B=7,r.CD_E=8,r.CMNT=9,r.DTD_B=10,r.DTD_E=11,r.prototype.parseFile=function(t){var e=p("fs"),n=this;e.readFile(t,function(t,e){n.parseString(e)})},r.prototype.parseString=function(t){util=p("util");var e=this,n=!0;n=e.m_parser?(e.m_parser.continueParsing(t),!0):(e.m_parser=new c(t),!1),e.m_bErr=!1,e.m_bErr||n||e._fireEvent(r.DOC_B),e._parseLoop(),e.m_bErr||e.m_interrupted||e._fireEvent(r.DOC_E),e.m_xml=null,e.m_iP=0,e.m_interrupted=!1},r.prototype.pause=function(){this.m_parser.pause()},r.prototype.resume=function(){this.m_parser.resume(),this.m_interrupted=!1;var t=this;setTimeout(function(){t._parseLoop(),t.m_bErr||t.m_interrupted||t._fireEvent(r.DOC_E)},0)},r.prototype.setDocumentHandler=function(t){this.m_hndDoc=t},r.prototype.setErrorHandler=function(t){this.m_hndErr=t},r.prototype.setLexicalHandler=function(t){this.m_hndLex=t},r.prototype.getColumnNumber=function(){return this.m_parser.getColumnNumber()},r.prototype.getLineNumber=function(){return this.m_parser.getLineNumber()},r.prototype.getMessage=function(){return this.m_strErrMsg},r.prototype.getPublicId=function(){return null},r.prototype.getSystemId=function(){return null},r.prototype.getLength=function(){return this.m_parser.getAttributeCount()},r.prototype.getName=function(t){return this.m_parser.getAttributeName(t)},r.prototype.getValue=function(t){return this.m_parser.getAttributeValue(t)},r.prototype.getValueByName=function(t){return this.m_parser.getAttributeValueByName(t)},r.prototype._fireError=function(t){this.m_strErrMsg=t,this.m_bErr=!0,this.m_hndErr&&this.m_hndErr.onError&&this.m_hndErr.onError(this.m_strErrMsg)},r.prototype._fireEvent=function(t){var e,n,s=arguments,i=s.length-1;this.m_bErr||(r.DOC_B==t?(n="onStartDocument",e=this.m_hndDoc):r.DOC_E==t?(n="onEndDocument",e=this.m_hndDoc):r.ELM_B==t?(n="onStartElementNS",e=this.m_hndDoc):r.ELM_E==t?(n="onEndElementNS",e=this.m_hndDoc):r.CHARS==t?(n="onCharacters",e=this.m_hndDoc):r.PI==t?(n="processingInstruction",e=this.m_hndDoc):r.CD_B==t?(n="onCdata",e=this.m_hndLex):r.CD_E==t?(n="onEndCDATA",e=this.m_hndLex):r.CMNT==t&&(n="onComment",e=this.m_hndLex),e&&e[n]&&(0==i?e[n]():1==i?e[n](s[1]):2==i?e[n](s[1],s[2]):3==i?e[n](s[1],s[2],s[3]):4==i?e[n](s[1],s[2],s[3],s[4]):5==i?e[n](s[1],s[2],s[3],s[4],s[5]):6==i&&e[n](s[1],s[2],s[3],s[4],s[5],s[6])))},r.prototype._parseLoop=function(t){var e;for(t=this.m_parser;!this.m_bErr;)if((e=t.next())==c._ELM_B){theatts=this.m_parser.m_atts,nameobject=t._parsePrefixAndElementName(t.getName()),theattsandnamespace=t._parseNamespacesAndAtts(theatts);var n=t._getContextualNamespace(nameobject.prefix);this._fireEvent(r.ELM_B,nameobject.name,theattsandnamespace[0],""===nameobject.prefix?null:nameobject.prefix,""===n?null:n,theattsandnamespace[1])}else if(e==c._ELM_E){nameobject=t._parsePrefixAndElementName(t.getName());n=t._getContextualNamespace(nameobject.prefix);t._removeExpiredNamesapces(t.getName()),this._fireEvent(r.ELM_E,nameobject.name,""===nameobject.prefix?null:nameobject.prefix,""===n?null:n)}else if(e==c._ELM_EMP){theatts=this.m_parser.m_atts,nameobject=t._parsePrefixAndElementName(t.getName()),theattsandnamespace=t._parseNamespacesAndAtts(theatts);n=t._getContextualNamespace(nameobject.prefix);this._fireEvent(r.ELM_B,nameobject.name,theattsandnamespace[0],""===nameobject.prefix?null:nameobject.prefix,""===n?null:n,theattsandnamespace[1],!0),t._removeExpiredNamesapces(t.getName()),this._fireEvent(r.ELM_E,nameobject.name,""===nameobject.prefix?null:nameobject.prefix,""===n?null:n,!0)}else if(e==c._TEXT)this._fireEvent(r.CHARS,t.getContent().slice(t.getContentBegin(),t.getContentEnd()));else if(e==c._ENTITY)this._fireEvent(r.CHARS,t.getContent(),t.getContentBegin(),t.getContentEnd()-t.getContentBegin());else if(e==c._PI)this._fireEvent(r.PI,t.getName(),t.getContent().substring(t.getContentBegin(),t.getContentEnd()));else if(e==c._CDATA)this._fireEvent(r.CD_B,t.getContent().slice(t.getContentBegin(),t.getContentEnd()));else if(e==c._COMMENT)this._fireEvent(r.CMNT,t.getContent().slice(t.getContentBegin(),t.getContentEnd()));else if(e==c._DTD);else if(e==c._ERROR)this._fireError(t.getContent());else{if(e==c._INTERRUPT)return void(this.m_interrupted=!0);if(e==c._NONE)return}};var u=function(){};u.WHITESPACE=" \t\n\r",u.QUOTES="\"'",u.getColumnNumber=function(t,e){if(u.isEmpty(t))return-1;e=e||t.length;var n=t.substring(0,e).split("\n");n[n.length-1];return n.length--,e-n.join("\n").length},u.getLineNumber=function(t,e){return u.isEmpty(t)?-1:(e=e||t.length,t.substring(0,e).split("\n").length)},u.indexOfNonWhitespace=function(t,e,n){if(u.isEmpty(t))return-1;e=e||0,n=n||t.length;for(var s=e;s<n;s++)if(-1==u.WHITESPACE.indexOf(t.charAt(s)))return s;return-1},u.indexOfWhitespace=function(t,e,n){if(u.isEmpty(t))return-1;e=e||0,n=n||t.length;for(var s=e;s<n;s++)if(-1!=u.WHITESPACE.indexOf(t.charAt(s)))return s;return-1},u.isEmpty=function(t){return null==t||0==t.length},u.lastIndexOfNonWhitespace=function(t,e,n){if(u.isEmpty(t))return-1;e=e||0;for(var s=(n=n||t.length)-1;e<=s;s--)if(-1==u.WHITESPACE.indexOf(t.charAt(s)))return s;return-1},u.replace=function(t,e,n,s,i){return u.isEmpty(t)?"":(e=e||0,n=n||t.length,t.toString().substring(e,n).split(s).join(i))};var e=function(){this.m_arr=new Array};e.prototype.clear=function(){this.m_arr=new Array},e.prototype.count=function(){return this.m_arr.length},e.prototype.destroy=function(){this.m_arr=null},e.prototype.peek=function(){return 0==this.m_arr.length?null:this.m_arr[this.m_arr.length-1]},e.prototype.pop=function(){if(0==this.m_arr.length)return null;var t=this.m_arr[this.m_arr.length-1];return this.m_arr.length--,t},e.prototype.push=function(t){this.m_arr[this.m_arr.length]=t},t.SaxParser=r}(),j.f.sts=1}.bind(this)},j.g={sts:null,mod:{exports:{}},load:function(){function t(t){var e={"node-xml":"f","./http":"c","./url":"b","./assert":"d"}[t];return e?j.__r(e):j.__sr(t)}var e=j.g.mod.exports;t.resolve=j.__sr.resolve,j.g.sts=0;var c=t("node-xml"),n=t("./http"),o=t("./url"),u=t("./assert"),l={string:1,boolean:1,decimal:1,float:1,double:1,anyType:1,byte:1,int:1,long:1,short:1,unsignedByte:1,unsignedInt:1,unsignedLong:1,unsignedShort:1,duration:0,dateTime:0,time:0,date:0,gYearMonth:0,gYear:0,gMonthDay:0,gDay:0,gMonth:0,hexBinary:0,base64Binary:0,anyURI:0,QName:0,NOTATION:0};function y(t){var e=null!=t?t.indexOf(":"):-1;return e<0?{namespace:null,name:t}:{namespace:t.substring(0,e),name:t.substring(e+1)}}function m(t){return"string"==typeof t?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"):t}var a=/^[\s\xA0]+/,p=/[\s\xA0]+$/;var _=function(t,e){var n=y(t);for(var s in this.nsName=t,this.namespace=n.namespace,this.name=n.name,this.children=[],this.xmlns={},e){var i=/^xmlns:?(.*)$/.exec(s);i?this.xmlns[i[1]]=e[s]:this["$"+s]=e[s]}};_.prototype.deleteFixedAttrs=function(){this.children&&0===this.children.length&&delete this.children,this.xmlns&&0===Object.keys(this.xmlns).length&&delete this.xmlns,delete this.nsName,delete this.namespace,delete this.name},_.prototype.allowedChildren=[],_.prototype.startElement=function(t,e,n){if(this.allowedChildren){var s=this.allowedChildren[y(e).name];s?t.push(new s(e,n)):this.unexpected(e)}},_.prototype.endElement=function(t,e){if(this.nsName===e){if(t.length<2)return;var n=t[t.length-2];this!==t[0]&&(function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}(t[0].xmlns,this.xmlns),n.children.push(this),n.addChild(this)),t.pop()}},_.prototype.addChild=function(t){},_.prototype.unexpected=function(t){throw new Error("Found unexpected element ("+t+") inside "+this.nsName)},_.prototype.description=function(t){return this.$name||this.name},_.prototype.init=function(){},_.createSubClass=function(){function t(){e.apply(this,arguments),this.init()}var e=this;return t.prototype.__proto__=e.prototype,t};var s=_.createSubClass(),i=_.createSubClass(),r=_.createSubClass(),h=_.createSubClass(),f=_.createSubClass(),d=_.createSubClass(),E=_.createSubClass(),g=_.createSubClass(),x=_.createSubClass(),v=_.createSubClass(),T=_.createSubClass(),b=_.createSubClass(),C=_.createSubClass(),A=_.createSubClass(),S=_.createSubClass(),R=_.createSubClass(),N=_.createSubClass(),w=_.createSubClass(),O={types:[b,"schema"],schema:[T,"element complexType simpleType include import"],element:[s,"annotation complexType"],simpleType:[h,"restriction"],restriction:[f,"enumeration"],enumeration:[d,""],complexType:[E,"annotation sequence all"],sequence:[g,"element"],all:[x,"element"],service:[N,"port documentation"],port:[R,"address"],binding:[S,"_binding SecuritySpec operation"],portType:[A,"operation"],message:[v,"part documentation"],operation:[C,"documentation input output fault _operation"],input:[i,"body SecuritySpecRef documentation header"],output:[r,"body SecuritySpecRef documentation header"],fault:[_,"_fault"],definitions:[w,"types message portType binding service"]};function L(t){t=t.split(" ");var e={};return t.forEach(function(t){e[t.replace(/^_/,"")]=(O[t]||[_])[0]}),e}for(var P in O){var M=O[P];M[0].prototype.allowedChildren=L(M[1])}v.prototype.init=function(){this.element=null,this.parts=null},T.prototype.init=function(){this.complexTypes={},this.types={},this.elements={},this.includes=[]},b.prototype.init=function(){this.schemas={}},C.prototype.init=function(){this.input=null,this.output=null,this.inputSoap=null,this.outputSoap=null,this.style="",this.soapAction=""},A.prototype.init=function(){this.methods={}},S.prototype.init=function(){this.transport="",this.style="",this.methods={}},R.prototype.init=function(){this.location=null},N.prototype.init=function(){this.ports={}},w.prototype.init=function(){"definitions"!==this.name&&this.unexpected(nsName),this.messages={},this.portTypes={},this.bindings={},this.services={},this.schemas={}},T.prototype.addChild=function(t){if(!(t.$name in l)){if("include"===t.name||"import"===t.name){var e=t.$schemaLocation||t.$location;e&&this.includes.push({namespace:t.$namespace||t.$targetNamespace||this.$targetNamespace,location:e})}else"complexType"===t.name?this.complexTypes[t.$name]=t:"element"===t.name?this.elements[t.$name]=t:t.$name&&(this.types[t.$name]=t);this.children.pop()}},b.prototype.addChild=function(t){u(t instanceof T),t.$targetNamespace?this.schemas[t.$targetNamespace]=t:this.schemas[t.includes[0].namespace]=t},i.prototype.addChild=function(t){"body"===t.name&&(this.use=t.$use,"encoded"===this.use&&(this.encodingStyle=t.$encodingStyle),this.children.pop())},r.prototype.addChild=function(t){"body"===t.name&&(this.use=t.$use,"encoded"===this.use&&(this.encodingStyle=t.$encodingStyle),this.children.pop())},C.prototype.addChild=function(t){"operation"===t.name&&(this.soapAction=t.$soapAction||"",this.style=t.$style||"",this.children.pop())},S.prototype.addChild=function(t){"binding"===t.name&&(this.transport=t.$transport,this.style=t.$style,this.children.pop())},R.prototype.addChild=function(t){"address"===t.name&&void 0!==t.$location&&(this.location=t.$location)},w.prototype.addChild=function(t){var e=this;t instanceof b?e.schemas=t.schemas:t instanceof v?e.messages[t.$name]=t:t instanceof A?e.portTypes[t.$name]=t:t instanceof S?"http://schemas.xmlsoap.org/soap/http"!==t.transport&&"http://www.w3.org/2003/05/soap/bindings/HTTP/"!==t.transport||(e.bindings[t.$name]=t):t instanceof N?e.services[t.$name]=t:u(!1,"Invalid child type"),this.children.pop()},v.prototype.postProcess=function(t){var e,n=null,s=this.children||[];for(var i in s)if("part"===(e=s[i]).name){n=e;break}if(n){if(n.$element){delete this.parts;var r=(o=y(n.$element)).namespace;this.element=t.schemas[t.xmlns[r]].elements[o.name],this.element.targetNSAlias=r,this.element.targetNamespace=t.xmlns[r],this.children.splice(0,1)}else{this.parts={},delete this.element;for(i=0;n=this.children[i];i++){u("part"===n.name,"Expected part element");var o=y(n.$type),a=(r=t.xmlns[o.namespace],o.name),p=t.schemas[r];this.parts[n.$name]=void 0!==p?t.schemas[r].types[a]||t.schemas[r].complexTypes[a]:n.$type,this.parts[n.$name].namespace=o.namespace,this.parts[n.$name].xmlns=r,this.children.splice(i--,1)}}this.deleteFixedAttrs()}},C.prototype.postProcess=function(t,e){for(var n,s=this.children,i=0;n=s[i];i++)if("input"===n.name||"output"===n.name)if("binding"!==e){var r=y(n.$message).name,o=t.messages[r];o.postProcess(t),o.element?(t.messages[o.element.$name]=o,this[n.name]=o.element):this[n.name]=o,s.splice(i--,1)}else this[n.name]=n,s.splice(i--,1);this.deleteFixedAttrs()},A.prototype.postProcess=function(t){var e=this.children;if(void 0!==e){for(var n,s=0;n=e[s];s++)"operation"==n.name&&(n.postProcess(t,"portType"),this.methods[n.$name]=n,e.splice(s--,1));delete this.$name,this.deleteFixedAttrs()}},S.prototype.postProcess=function(t){var e=y(this.$type).name,n=t.portTypes[e],s=this.style,i=this.children;n.postProcess(t),this.methods=n.methods;for(var r,o=0;r=i[o];o++)if("operation"==r.name){r.postProcess(t,"binding"),i.splice(o--,1),r.style||(r.style=s);var a=this.methods[r.$name];a.style=r.style,a.soapAction=r.soapAction,a.inputSoap=r.input||null,a.outputSoap=r.output||null,a.inputSoap&&a.inputSoap.deleteFixedAttrs(),a.outputSoap&&a.outputSoap.deleteFixedAttrs()}delete this.$name,delete this.$type,this.deleteFixedAttrs()},N.prototype.postProcess=function(t){for(var e,n=this.children,s=t.bindings,i=0;e=n[i];i++)if("port"==e.name){var r=s[y(e.$binding).name];r&&(r.postProcess(t),this.ports[e.$name]={location:e.location,binding:r},n.splice(i--,1))}delete this.$name,this.deleteFixedAttrs()},h.prototype.description=function(t){for(var e,n=this.children,s=0;e=n[s];s++)if(e instanceof f)return this.$name+"|"+e.description();return{}},f.prototype.description=function(){return(this.$base?this.$base+"|":"")+this.children.map(function(t){return t.description()}).join(",")},d.prototype.description=function(){return this.$value},E.prototype.description=function(t){for(var e,n=this.children,s=0;e=n[s];s++)if(e instanceof g||e instanceof x)return e.description(t);return{}},s.prototype.description=function(t){var e={},n=this.$name;if(this.$minOccurs!==this.$maxOccurs&&(n+="[]"),this.$type){var s,i=y(this.$type).name,r=t.xmlns[y(this.$type).namespace],o=(s=t.schemas[r])&&(s.complexTypes[i]||s.types[i]);e[n]=!o||i in l?this.$type:o.description(t)}else{var a=this.children;e[n]={};for(var p,h=0;p=a[h];h++)p instanceof E&&(e[n]=p.description(t))}return e},x.prototype.description=g.prototype.description=function(t){for(var e,n=this.children,s={},i=0;e=n[i];i++){var r=e.description(t);for(var o in r)s[o]=r[o]}return s},v.prototype.description=function(t){if(this.element)return this.element&&this.element.description(t);var e={};return e[this.$name]=this.parts,e},A.prototype.description=function(t){var e={};for(var n in this.methods){var s=this.methods[n];e[n]=s.description(t)}return e},C.prototype.description=function(t){var e=this.input.description(t),n=this.output.description(t);return{input:e&&e[Object.keys(e)[0]],output:n&&n[Object.keys(n)[0]]}},S.prototype.description=function(t){var e={};for(var n in this.methods){var s=this.methods[n];e[n]=s.description(t)}return e},N.prototype.description=function(t){var e={};for(var n in this.ports){var s=this.ports[n];e[n]=s.binding.description(t)}return e};function I(t,e,n){var s,l=this;if(this.uri=e,this.callback=function(){},this.options=n||{},"string"==typeof t)s=this._fromXML;else{if("object"!=typeof t)throw new Error("WSDL constructor takes either an XML string or service definition");s=this._fromServices}setTimeout(function(){s.call(l,t),l.processIncludes(function(t){l.definitions.deleteFixedAttrs();var e=l.services=l.definitions.services;if(e)for(var n in e)e[n].postProcess(l.definitions);var s=l.definitions.complexTypes;if(s)for(var n in s)s[n].deleteFixedAttrs();var i=l.definitions.bindings;for(var r in i){var o=i[r];if("document"===o.style){var a=o.methods,p=o.topElements={};for(var h in a){var c=a[h].input.$name,u=a[h].output.$name;p[c]={methodName:h,outputName:u}}}}l.xmlnsInEnvelope=l._xmlnsMap(),l.callback(t,l)})},0)}function D(s,i,r){var o;return"function"==typeof i&&(r=i,i={}),n.request(s,null,function(t,e,n){t?r(t):e&&200==e.statusCode?(o=new I(n,s,i)).onReady(r):r(new Error("Invalid WSDL URL: "+s))}),o}I.prototype.onReady=function(t){t&&(this.callback=t)},I.prototype._processNextInclude=function(n,s){var i=this,r=n.shift();if(!r)return s();D(o.resolve(i.uri,r.location),function(t,e){i.definitions.schemas[r.namespace||e.definitions.$targetNamespace]=e.definitions,i._processNextInclude(n,function(t){s(t)})})},I.prototype.processIncludes=function(t){var e=this.definitions.schemas,n=[];for(var s in e){var i=e[s];n=n.concat(i.includes||[])}this._processNextInclude(n,t)},I.prototype.describeServices=function(){var t={};for(var e in this.services){var n=this.services[e];t[e]=n.description(this.definitions)}return t},I.prototype.toXML=function(){return this.xml||""},I.prototype.xmlToObject=function(t){var e,m,_=this,n=new c.SaxParser(function(t){e=t}),f=null,s={},d=[{name:null,object:s,schema:{Envelope:{Header:{Security:{UsernameToken:{Username:"string",Password:"string"}}},Body:{Fault:{faultcode:"string",faultstring:"string",detail:"string"}}}}}],E={};for(var i in e.onStartElementNS(function(t,s,e,n,i){t=e?e+":"+t:t;s=s.reduce(function(t,e,n){return t[e[0]]=e[1],t},{}),i.forEach(function(t){var e=t[0],n=t[1];s["xmlns"+(e?":":"")+e]=n});var r=y(t).name,o=d[d.length-1],a=o.schema,p=r;if(!f&&"Body"===o.name&&"Fault"!==r){var h=_.definitions.messages[r];if(!h){var c=!1;/Response$/.test(r)?(!0,r=r.replace(/Response$/,"")):/Request$/.test(r)?(c=!0,r=r.replace(/Request$/,"")):/Solicit$/.test(r)&&(c=!0,r=r.replace(/Solicit$/,""));var u=_.definitions.portTypes,l=u[Object.keys(u)[0]];r=c?l.methods[r].input.$name:l.methods[r].output.$name,h=_.definitions.messages[r],_.definitions.messages[p]=_.definitions.messages[r]}a=h.description(_.definitions),f=p}s.href&&(m=s.href.substr(1),E[m]||(E[m]={hrefs:[],obj:null}),E[m].hrefs.push({par:o.object,key:r})),(m=s.id)&&(E[m]||(E[m]={hrefs:[],obj:null})),a&&a[r+"[]"]&&(r+="[]"),d.push({name:p,object:{},schema:a&&a[r],id:s.id})}),e.onEndElementNS(function(t,e,n){t=e?e+":"+t:t;var s=d.pop(),i=s.object,r=d[d.length-1],o=r.object,a=r.schema,p=y(t).name;a&&a[p+"[]"]?(o[p]||(o[p]=[]),o[p].push(i)):p in o?(Array.isArray(o[p])||(o[p]=[o[p]]),o[p].push(i)):o[p]=i,s.id&&(E[s.id].obj=i)}),e.onCharacters(function(t){if((t=function(t){return t.replace(a,"").replace(p,"")}(t)).length){var e,n=d[d.length-1],s=y(n.schema).name;e="int"===s?parseInt(t,10):"dateTime"===s?new Date(t):"string"!=typeof n.object?t:n.object+t,n.object=e}}),n.parseString(t),E){var r=E[i],o=r.obj;r.hrefs.forEach(function(t){t.par[t.key]=o})}return s.Envelope.Body.Fault,s.Envelope},I.prototype.objectToDocumentXML=function(t,e,n,s){var i={};return i[t]=e,this.objectToXML(i,null,n,s)},I.prototype.objectToRpcXML=function(t,e,n,s){var i=[],r=this.definitions;n=n||function(t,e){for(var n in t)if(t[n]===e)return n}(r.xmlns,s),s=s||r.xmlns[n];for(var o in i.push(["<",n,":",t,">"].join("")),e)if("_xmlns"!=o){var a=e[o];i.push(["<",o,">"].join("")),i.push("object"==typeof a?this.objectToXML(a):m(a)),i.push(["</",o,">"].join(""))}return i.push(["</",n,":",t,">"].join("")),i.join("")},I.prototype.objectToXML=function(t,e,n,s){var i=[],r="",o=n?n+":":"";if(Array.isArray(t))for(var a,p=0;a=t[p];p++)0<p&&(i.push(["</",o,e,">"].join("")),i.push(["<",o,e,r,">"].join(""))),i.push(this.objectToXML(a,e));else if("object"==typeof t)for(var e in t){var h=t[e];i.push(["<",o,e,r,">"].join("")),i.push(this.objectToXML(h,e)),i.push(["</",o,e,">"].join(""))}else t&&i.push(m(t));return i.join("")},I.prototype._parse=function(t){var e,a=this,n=new c.SaxParser(function(t){e=t}),p=[],h=null;return e.onStartElementNS(function(e,s,t,n,i){e=t?t+":"+e:e;s=s.reduce(function(t,e,n){return t[e[0]]=e[1],t},{}),i.forEach(function(t){var e=t[0],n=t[1];s["xmlns"+(e?":":"")+e]=n});var r=p[p.length-1];if(r)try{r.startElement(p,e,s)}catch(t){if(a.options.strict)throw t;p.push(new _(e,s))}else{var o=y(e).name;if("definitions"===o)h=new w(e,s);else{if("schema"!==o)throw new Error("Unexpected root element of WSDL or include");h=new T(e,s)}p.push(h)}}),e.onEndElementNS(function(t,e,n){t=e?e+":"+t:t;var s=p[p.length-1];u(s,"Unmatched close tag: "+t),s.endElement(p,t)}),e.onWarning(function(t){console.log("<WARNING>"+t+"</WARNING>")}),e.onError(function(t){console.log("<ERROR>"+JSON.stringify(t)+"</ERROR>")}),n.parseString(t),h},I.prototype._fromXML=function(t){this.definitions=this._parse(t),this.xml=t},I.prototype._fromServices=function(t){},I.prototype._xmlnsMap=function(){var t=this.definitions.xmlns,e="";for(var n in t)if(""!==n){var s=t[n];switch(s){case"http://xml.apache.org/xml-soap":case"http://schemas.xmlsoap.org/wsdl/":case"http://schemas.xmlsoap.org/wsdl/soap/":case"http://schemas.xmlsoap.org/soap/encoding/":case"http://www.w3.org/2001/XMLSchema":continue}~s.indexOf("http://schemas.xmlsoap.org/")||~s.indexOf("http://www.w3.org/")||~s.indexOf("http://xml.apache.org/")||(e+=" xmlns:"+n+'="'+s+'"')}return e},e.open_wsdl=D,e.WSDL=I,j.g.sts=1}.bind(this)},j.h={sts:null,mod:{exports:{}},load:function(){function t(t){var e={"./client":"e","./wsdl":"g",crypto:"crypto","./wsdl":"g"}[t];return e?j.__r(e):j.__sr(t)}var e=j.h.mod.exports;t.resolve=j.__sr.resolve,j.h.sts=0;var i=t("./client").Client,r=t("./wsdl").open_wsdl,o=t("crypto"),n=t("./wsdl").WSDL,a={};function s(t,e){this._username=t,this._password=e}function p(t,e,n){this._username=t,this._password=e,this._passwordType=n||"PasswordText"}s.prototype.addHeaders=function(t){t.Authorization="Basic "+new Buffer(this._username+":"+this._password||"").toString("base64")},s.prototype.toXML=function(){return""};function h(t,e,n){var s=o.createHash("sha1"),i=new Buffer(t||"","base64").toString("binary");return s.update(i+e+n),s.digest("base64")}p.prototype.toXML=function(){function t(t){function e(t){return t<10?"0"+t:t}return t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"Z"}var e=new Date,n=t(e),s=t(new Date(e.getTime()+6e5)),i=o.createHash("sha1");i.update(n+Math.random());var r=i.digest("base64");return'<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsu:Timestamp wsu:Id="Timestamp-'+n+'"><wsu:Created>'+n+"</wsu:Created><wsu:Expires>"+s+'</wsu:Expires></wsu:Timestamp><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-'+n+'"><wsse:Username>'+this._username+"</wsse:Username>"+("PasswordText"===this._passwordType?"<wsse:Password>"+this._password+"</wsse:Password>":'<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">'+h(r,n,this._password)+"</wsse:Password>")+'<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">'+r+"</wsse:Nonce><wsu:Created>"+n+"</wsu:Created></wsse:UsernameToken></wsse:Security>"},e.BasicAuthSecurity=s,e.WSSecurity=p,e.createClient=function(t,e,n,s){"function"==typeof e&&(s=n,n=e,e={}),s=e.endpoint||s,function(n,t,s){"function"==typeof t&&(s=t,t={});var e=a[n];e?s(null,e):r(n,t,function(t,e){if(t)return s(t);a[n]=e,s(null,e)})}(t,e,function(t,e){n(t,e&&new i(e,s))})},e.passwordDigest=h,e.WSDL=n,j.h.sts=1}.bind(this)},j.i={sts:null,mod:{exports:{}},load:function(){function t(t){var e={"./lib/soap":"h"}[t];return e?j.__r(e):j.__sr(t)}var e=j.i.mod;e.exports;t.resolve=j.__sr.resolve,j.i.sts=0,e.exports=t("./lib/soap"),j.i.sts=1}.bind(this)},j.__r("i")}.bind(e)();e.tinysoap=n,"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=n)}(0,this);