(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pgHtml5Bridge = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){

/**
 * prive 
 */

function GetXmlHttpObject() {
    var mxmlHttp = null;
    if(mxmlHttp == null || mxmlHttp === 'undefined'){
        try {
            // Firefox, Opera 8.0+, Safari  
            mxmlHttp = new XMLHttpRequest();
        } catch (e) {
            // Internet Explorer  
            try {
                // eslint-disable-next-line no-undef
                mxmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                // eslint-disable-next-line no-undef
                mxmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
    }
    return mxmlHttp;
}

function httpRequestGet(sUrl, sParam) {
    if(typeof sUrl != "string"){
        console.error("httpRequestGet sUrl error :" + sUrl);
        return "";
    }
    if(typeof sParam != "string"){
        console.error("httpRequestGet sParam error :" + sUrl);
        return "";
    }
    var xmlhttp = GetXmlHttpObject();
    if(xmlhttp == null || xmlhttp == 'undefined'){
        console.error("xmlhttp object error !");
        return "";
    }

    xmlhttp.open("GET", sUrl, false);
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
    try {
        xmlhttp.send(sParam);
    } catch (error) {
        console.error("xmlhttp.send = " + error);
    }

    var ret = xmlhttp.responseText;
    xmlhttp = null;
    return ret;
}


function httpRequestPost(sUrl, sParam) {
    if(typeof sUrl != "string"){
        console.error("httpRequestGet sUrl error :" + sUrl);
        return "";
    }
    if(typeof sParam != "string"){
        console.error("httpRequestGet sParam error :" + sUrl);
        return "";
    }
    var xmlhttp = GetXmlHttpObject();
    if(xmlhttp == null || xmlhttp == 'undefined'){
        console.error("xmlhttp object error !");
        return "";
    }
    xmlhttp.open("POST", sUrl, false);
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
    
    try {
        xmlhttp.send(sParam);
    } catch (error) {
        console.error("xmlhttp.send = " + error);
    }

    var ret = xmlhttp.responseText;
    ////console.log("GetText RET = " + ret)
    xmlhttp = null;
    return ret;
}
global.httpRequestGet = httpRequestGet;
global.httpRequestPost = httpRequestPost;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],2:[function(require,module,exports){
function NodeList() {
    this.m_NodeList = [];
}
NodeList.prototype.Add = function(Node) {
    this.m_NodeList.push(Node);
};

NodeList.prototype.Del = function(Node) {
    if (Node == null || typeof Node == 'undefined') {
        return;
    }
    var r = this.SearchNode(Node.sSession);
    if (r.Ind > -1) {
        this.m_NodeList.splice(r.Ind, 1);
    }
};

NodeList.prototype.SearchNode = function(sSession) {
    var iRet = -1;
    if (sSession) {
        var m_NodeList = this.m_NodeList;

        for (var i = 0; i < m_NodeList.length; i++) {
            if (m_NodeList[i].sSession == sSession) {
                return {
                    Obj: m_NodeList[i],
                    Ind: i
                };
            }
        }
    }
    return {
        Obj: null,
        Ind: iRet
    };
};

NodeList.prototype.FindNode = function(sSession) {
    var r = this.SearchNode(sSession);
    return r.Obj;
};


NodeList.prototype.Traversal = function(param, callback) {
    var m_NodeList = this.m_NodeList;
    for (var i = 0; i < m_NodeList.length; i++) {
        if(typeof callback == 'function'){
            callback(m_NodeList[i], param);
        }else{
            console.log("Traversal callback undefined");
        }
    }
};

module.exports = NodeList;
},{}],3:[function(require,module,exports){

function ViewList() {
    this.videoIDListUsed = [];

    this.allocViewID = function() {
        var ret = 1;
        var videoIDListUsed = this.videoIDListUsed;

        for (var i = 0; i < videoIDListUsed.length; i++) {
            if (ret == videoIDListUsed[i]) {
                ret++;
                i = 0;
                i--; // next will run i++
            }
        }
        videoIDListUsed.push(ret);
        return ret;
    };

    this.freeViewID = function(ViewID) {
        var videoIDListUsed = this.videoIDListUsed;
        for (var i = 0; i < videoIDListUsed.length; i++) {
            if (ViewID == videoIDListUsed[i]) {
                videoIDListUsed.splice(i, 1);
                i--;
            }
        }
    };
}

//第一个参数是当前对象this，第二个是宽，第三个是高
//private
function datuIMG(datu, kuan, chang) {
    if(datu == null || typeof datu.width == "undefined" || typeof datu.height == "undefined" || typeof datu.style.padding == "undefined")
    {
        return;
    }
    datu.width = kuan;
    datu.height = chang;
    datu.style.padding = "0px";

    /*
    datu.width = kuan * 100;
    datu.height = chang * 100;
    //图片等比例缩小
    if (datu.width * chang > datu.height * kuan) {
        datu.width = kuan;
        datu.height = (kuan * chang) / kuan;
    } else {
        datu.width = (chang * kuan) / chang;
        datu.height = chang;
    }
    //图片居中显示
    //图片宽小于设定的边框宽
    if (datu.width <= kuan) {
        var kk = parseInt((kuan - datu.width) / 2);
        datu.style.paddingRight = kk + "px";
        datu.style.paddingLeft = kk + "px";
    }
    //图片高小于设定的边框高
    if (datu.height <= chang) {
        var gg = parseInt((chang - datu.height) / 2);
        datu.style.paddingTop = gg + "px";
        datu.style.paddingBottom = gg + "px";
    }
    */
}

//private
// eslint-disable-next-line no-unused-vars
function AutoResizeImage(maxWidth, maxHeight, objImg) {
    var img = new Image();
    img.src = objImg.src;
    var hRatio;
    var wRatio;
    var Ratio = 1;
    var w = img.width;
    var h = img.height;
    wRatio = maxWidth / w;
    hRatio = maxHeight / h;
    if (maxWidth == 0 && maxHeight == 0) {
        Ratio = 1;
    } else if (maxWidth == 0) { //
        if (hRatio < 1) Ratio = hRatio;
    } else if (maxHeight == 0) {
        if (wRatio < 1) Ratio = wRatio;
    } else if (wRatio < 1 || hRatio < 1) {
        Ratio = (wRatio <= hRatio ? wRatio : hRatio);
    }
    if (Ratio < 1) {
        w = w * Ratio;
        h = h * Ratio;
    }
    objImg.height = h;
    objImg.width = w;
}

function imgload(divid) {
    var oDiv = document.getElementById(divid);

    if (oDiv) {
        var oImg = document.getElementById(divid + "_img");
        var url = oDiv.getAttribute("url");
        var iViewID = oDiv.getAttribute("ViewID");
        var sSession = oDiv.getAttribute("NodeSess");
        var iCount = oDiv.getAttribute("Count");
        if (oImg) {
            oImg.src = url + "/Session" + sSession + "/ViewID" + iViewID + "/Count" + iCount;
        }
    }
}


function imgonload(divid) {
    var oDiv = document.getElementById(divid);
    if (oDiv) {
        var oImg = document.getElementById(divid + "_img");
        datuIMG(oImg, oDiv.offsetWidth, oDiv.offsetHeight);

        oDiv.setAttribute("Count", (parseInt(oDiv.getAttribute("Count")) + 1));
        window.setTimeout(function(imgload, divid) {
            imgload(divid);
        }, 0, imgload, divid);
    }
}

function imgonerror(divid) {
    var oDiv = document.getElementById(divid);

    if (oDiv) {
        var oImg = document.getElementById(divid + "_img");
        datuIMG(oImg, oDiv.offsetWidth, oDiv.offsetHeight);

        oDiv.setAttribute("Count", (parseInt(oDiv.getAttribute("Count")) + 1));
        window.setTimeout(function(imgload,divid) {
            imgload(divid);
        }, 1,imgload,divid);
    }
    return false;
}


ViewList.prototype.WndCreate = function(divId, url, sSession) {

    var oDiv = document.getElementById(divId);
    if (oDiv != null) {
        console.log("divID = " + divId);
        var GViewID = -1;
        var oImg = document.getElementById(divId + "_img");
        if (oImg == null) {
            oImg = document.createElement("img");
            oDiv.appendChild(oImg);

            GViewID = this.allocViewID();

            oDiv.setAttribute("url", url);
            oDiv.setAttribute("ViewID", GViewID);
            oDiv.setAttribute("NodeSess", sSession);
            oDiv.setAttribute("Count", 0);

            oImg.id = divId + "_img";
            oImg.style = "width:100%;height:100%;margin:0px;display:block;overflow:hidden;";
            oImg.onload = function() {
                imgonload(divId);
            };
            oImg.onerror = function() {
                imgonerror(divId);
            };
            oImg.onabort = function() {
                imgonerror(divId);
            };
            // oImg.setAttribute("onload", function(){
            //     imgonload(divId);
            // });
            // oImg.setAttribute("onerror", function(){
            //     imgonerror(divId);
            // });
            window.setTimeout(function(imgload,divId) {
                imgload(divId);
            }, 10,imgload,divId);
        } else {
            GViewID = oDiv.getAttribute("ViewID");
        }

        var RViewID = (sSession >> 16) | (GViewID << 16);

        var sWnd = "(PosX){0}(PosY){0}(SizeX){" + 320 + "}(SizeY){" + 240 + "}(Handle){" + RViewID + "}";
        console.log("sWnd = " + sWnd);
        return sWnd;
    }
    return "";
};


/*
 * @return {null}
 */
ViewList.prototype.WndDestroy = function(divId) {
    var oDiv = document.getElementById(divId);
    if (oDiv != null) {
        var oImg = document.getElementById(divId + "_img");
        if (oImg != null) {
            var iViewID = oDiv.getAttribute("ViewID");
            this.freeViewID(iViewID);
            oImg.id = "";
            oDiv.removeChild(oImg);
        }
    }
};

module.exports = ViewList;
},{}],4:[function(require,module,exports){
var TIMEOUT_HEARTBEAT = 5000; // 心跳间隔5秒
var TIMEOUT_HEARTBEAT_RES = 8000; // 等待服务器响应8秒

function WebSocketClient() {

    this.url = "";
    this.param = "";
    this.opencallback = null;
    this.msgcallbak = null;

    this.ws = null; //websocket实例

    this.timeoutObj = null;
    this.serverTimeoutObj = null;

    this.heartBeatReset = function() {
        var self = this;
        clearTimeout(self.timeoutObj);
        clearTimeout(self.serverTimeoutObj);
        self.heartBeatStart();
    };

    this.heartBeatStart = function() {
        var self = this;
        self.timeoutObj = setTimeout(function(self){
            self.heartBeatSend();
        }, TIMEOUT_HEARTBEAT,self);
       
    };


    this.heartBeatSend = function() {
        var self = this;
        self.ws.send("HeartBeat");
        self.serverTimeoutObj = setTimeout(function(self){
            self.heartBeatTimeout();
        }, TIMEOUT_HEARTBEAT_RES,self);
    };

    this.heartBeatTimeout = function() {
        // 如果onclose会执行reconnect，我们执行ws.close()就行了.
        // 如果直接执行reconnect 会触发onclose导致重连两次
        var self = this;
        self.ws.close();
    };

    this.initEventHandle = function() {
        var self = this;

        var ws = this.ws;
        // var url = this.url;
        // var param = this.param;
        // var opencallback = this.opencallback;
        // var msgcallbak = this.msgcallbak;

        ws.onclose = function() {
            self.reconnect();
            console.log("ws.onclose");
        };

        ws.onerror = function() {
            self.reconnect();
            
            console.log("ws.onerror");
        };

        ws.onopen = function() {
            //心跳检测重置
            self.heartBeatReset();
            console.log("onopen");
            if(typeof self.opencallback == "function"){
                self.opencallback();
            } 

        };

        ws.onmessage = function(msg) {
            // 如果获取到消息，心跳检测重置
            // 拿到任何消息都说明当前连接是正常的
            // console.log("msg = " + msg.data);
            self.heartBeatReset();

            if (msg.data != "HeartBeat") {
                //console.log("msg = " + msg.data);

                var sDataRaw = msg.data.replace(/\+/g, '%20');
                //console.log("msg1 = " + sDataRaw);

                var strjs = decodeURIComponent(sDataRaw);
                //console.log("msg2 = " + strjs);
 
                var js = JSON.parse(strjs);
                if (typeof self.opencallback == "function") {
                    self.msgcallbak(js);
                }

            } 
            // else {
            //     console.log("heartbeat reply");
            // }
        };
    };

    this.lockReconnect = false;

    //避免重复连接
    this.reconnect = function() {

        var self = this;

        if (this.lockReconnect) {
            return;
        }

        this.lockReconnect = true;

        // 没连接上会一直重连，设置延迟避免请求过多
        setTimeout(function(self) {
            self.newWebSocket();
            self.lockReconnect = false;
        }, 2000,self);
    };
}
WebSocketClient.prototype.newWebSocket = function(){
    var self = this;
    var url = this.url;
    var param = this.param;
    try {
        self.ws = new WebSocket(url, param);
        
        self.initEventHandle();
    } catch (e) {
        console.log("WebSocketClient.newWebSocket e = " + e);
        self.reconnect();
    }
};

WebSocketClient.prototype.createWebSocket = function(url, param, opencallback, msgcallbak) {
    var self = this;

    this.url = url;
    this.param = param;
    this.opencallback = opencallback;
    this.msgcallbak = msgcallbak;

    if(self.ws == null){
        self.newWebSocket();
    }
        
};

WebSocketClient.prototype.CheckSendSession = function(Node) {
    var sSessionData = "sSession:" + Node.sSession;
    var ws = this.ws;
    var self = this;
    try {
        ws.send(sSessionData);
    } catch (error) {
        console.log("WebSocketClient.CheckSendSession error = " + error);
        Node.checktimeoutObj = setTimeout(function(self,Node) {
            self.CheckSendSession(Node);
        }, 2000,self,Node);
    }
};

module.exports = WebSocketClient;
},{}],5:[function(require,module,exports){
(function (global){
/****************************************************
  copyright   : Copyright (C) 2003-2007, chenbichao,
                All rights reserved.
  filename    : oml.js
  discription : 
  modify      : create, chenbichao, 2007/5/2
****************************************************/

// Static data.
var aMark = new Array('(', ')', '[', ']', '{', '}');

// return: (<0)failed, (>=0)index of mark.
function omlMarkPos(strEle, uPos)
{
	var iPosTemp = 0;
	var uPosBegin = uPos;
	var uPosMark = strEle.length;
	for (var iMark = 0; iMark < aMark.length; iMark++) {
		iPosTemp = strEle.indexOf(aMark[iMark], uPosBegin);
		if (iPosTemp >= 0) {
			if (iPosTemp < uPosMark) {
				uPosMark = iPosTemp;
			}
		}
	}
	if (uPosMark >= strEle.length) {
		return -1;
	}
	return uPosMark;
}

// return: (=0)failed, (>0)next index of element.
function omlElePos(strEle, uPos)
{
  	var uStack = 0;
	var cMarkOld = 0;
	var cMarkCur = 0;
	var uPosLast = uPos;

	while (1)
	{
		// Search mark char.
		uPosCur = omlMarkPos(strEle, uPosLast);
		if (uPosCur < 0) {
			break;
		}
		uPosLast = uPosCur + 1;	
		cMarkCur = strEle.charAt(uPosCur);

		if (cMarkCur == ')') {
			if (cMarkOld != '(') {
				return 0;
			}
		}
		else if (cMarkCur == ']') {
			if (cMarkOld != '[') {
				return 0;
			}
		}
		else if (cMarkCur == '}') {
			if (cMarkOld == 0 || cMarkOld == '(' || cMarkOld == '[') {
				return 0;
			}
			if (cMarkOld == '{') {
				if (uStack <= 0) {
					return uPosLast;
				}
			}
			else { // cMarkOld = ')', ']'
				if (uStack <= 0) {
					return uPosCur;
				}
				uStack--;
				if (uStack == 0) {
					return uPosLast;
				}
			}			
		}
		else if (cMarkCur == '(') {
			if (cMarkOld == '(' || cMarkOld == '[') {
				return 0;
			}
			if (cMarkOld == ')' || cMarkOld == ']' || cMarkOld == '}') {
				if (uStack <= 0) {
					return uPosCur;
				}
			}
			if (cMarkOld == '{') {
				uStack++;
			}
		}
		else if (cMarkCur == '[') {
			if (cMarkOld == '[') {
				return 0;
			}
			if (cMarkOld == ']' || cMarkOld == '}') {
				if (uStack <= 0) {
					return uPosCur;
				}
			}
			if (cMarkOld == '{') {
				uStack++;
			}
		}
		else if (cMarkCur == '{') {
			if (cMarkOld == '}') {
				if (uStack <= 0) {
					return uPosCur;
				}
			}
			if (cMarkOld == '{') {
				uStack++;
			}
		}
		else {
			// Do nothing ...
		}
		cMarkOld = cMarkCur;	
	}
	// Failed.
	return 0;
}

// return: (=0)failed, (>0)begin index of element.
function omlEleSub(strEle, uPos)
{
	var uPosTemp = omlElePos(strEle, uPos);
	if (uPosTemp == 0) {
		return 0;
	}
	var iIndSub = strEle.indexOf('{', uPos);
	if (iIndSub < 0) {
		// No have content or sub element.
		return 0;
	}
	if (iIndSub >= uPosTemp) {
		// Found '{' in the next ele.
		return 0;
	}
	iIndSub++;
	var iIndSub1 = omlMarkPos(strEle, iIndSub);
	if ((iIndSub1 < 0) || (iIndSub1 >= (uPosTemp - 1))) {
		// {xxx}, No have sub element.
		return 0;
	}
	return iIndSub;
}

// return: (<0)failed, (>=0)begin index of element.
function omlElePath(strEle, uPos, strPath, cSplit)
{	
	var uPosEle = 0;
	var iPosSect = 0;
	var strSect = "";

//	alert(strEle + "\r\n" + strPath);
	
	while (1)
	{
		// Split path.
		var iIndSect = strPath.indexOf(cSplit, iPosSect);
		if (iIndSect < 0) {
			strSect = strPath.substr(iPosSect);
		}
		else {
			strSect = strPath.substr(iPosSect, (iIndSect - iPosSect));
			iPosSect = iIndSect + 1;
		}
		// Empty section, go to sub element.
		if (strSect == "") {
			if (iIndSect < 0) {
				break; // end of ele string.
			}
			uPosEle = omlEleSub(strEle, uPosEle);
			if (uPosEle == 0) {
				return -1;
			}
			continue;
		}
		while (1) {
			// Get ele postion.
			var uPosNext = omlElePos(strEle, uPosEle);
			if (uPosNext == 0) {
				return -1; // Walk all the ele, but not match.
			}

			//eleTemp = strEle.substr(uPosEle, (uPosNext - uPosEle));
			//alert(eleTemp + ": " + uPosNext);

			// Compare ele name.
			var iIndName = omlMarkPos(strEle, uPosEle);
			if (iIndName < 0 || strEle.charAt(iIndName) != '(') {
				uPosEle = uPosNext;
				continue;
			}
			iIndName++;
			var iIndName1 = omlMarkPos(strEle, iIndName);
			var strName = strEle.substr(iIndName, (iIndName1 - iIndName));
			if (strName == strSect) {
				break;
			}
			uPosEle = uPosNext;
		}
		if (iIndSect < 0) {
			break;
		}
		uPosEle = omlEleSub(strEle, uPosEle);
		if (uPosEle == 0) {
			return -1;
		}
	}
	return uPosEle;
}

function omlEncode(str)
{
	var strNew = new String(str);
	reg = /[\&]/g;
	strNew = strNew.replace(reg, "&G");
	reg = /[\(]/g;
	strNew = strNew.replace(reg, "&A");
	reg = /[\)]/g;
	strNew = strNew.replace(reg, "&B");
	reg = /[\[]/g;
	strNew = strNew.replace(reg, "&C");
	reg = /[\]]/g;
	strNew = strNew.replace(reg, "&D");
	reg = /[\{]/g;
	strNew = strNew.replace(reg, "&E");
	reg = /[\}]/g;
	strNew = strNew.replace(reg, "&F");
	return strNew;
}

function omlDecode(str)
{
	var strNew = new String(str);
	reg = /&A/g;
	strNew = strNew.replace(reg, '(');
	reg = /&B/g;
	strNew = strNew.replace(reg, ')');
	reg = /&C/g;
	strNew = strNew.replace(reg, '[');
	reg = /&D/g;
	strNew = strNew.replace(reg, ']');
	reg = /&E/g;
	strNew = strNew.replace(reg, '{');
	reg = /&F/g;
	strNew = strNew.replace(reg, '}');
	reg = /&G/g;
	strNew = strNew.replace(reg, '&');
	return strNew;
}

function omlSetName(strEle, strPath, vName)
{
	if (typeof(strEle) != "string"
		|| typeof(strPath) != "string"
		|| typeof(vName) == "undefined")
	{
		alert("omlSetName: bad parameter");
		return "";
	}
	
	var cSplit = '.';
	var strPathTemp = strPath;
	if (strPath.charAt(0) == '\n') {
		cSplit = strPath.charAt(1);
		strPathTemp = strPath.substring(2);
	}

	var iPos = omlElePath(strEle, 0, strPathTemp, cSplit);
	if (iPos < 0) {
		return "";
	}
	var iPos1 = omlElePos(strEle, iPos);
	if (iPos1 == 0) {
		return "";
	}

	var str1 = strEle.substr(0, iPos);
	var str2 = strEle.substr(iPos, (iPos1 - iPos));
	var str3 = strEle.substr(iPos1);

	var strClass = omlGetAttr(str2, '[', ']');
	var strContent = omlGetAttr(str2, '{', '}');

	var strName = omlEncode(vName);
	return (str1 + omlNewEle(strName, strClass, strContent) + str3);
}

function omlSetClass(strEle, strPath, vClass)
{
	if (typeof(strEle) != "string"
		|| typeof(strPath) != "string"
		|| typeof(vClass) == "undefined")
	{
		alert("omlSetClass: bad parameter");
		return "";
	}

	var cSplit = '.';
	var strPathTemp = strPath;
	if (strPath.charAt(0) == '\n') {
		cSplit = strPath.charAt(1);
		strPathTemp = strPath.substring(2);
	}

	var iPos = omlElePath(strEle, 0, strPathTemp, cSplit);
	if (iPos < 0) {
		return "";
	}
	var iPos1 = omlElePos(strEle, iPos);
	if (iPos1 == 0) {
		return "";
	}

	var str1 = strEle.substr(0, iPos);
	var str2 = strEle.substr(iPos, (iPos1 - iPos));
	var str3 = strEle.substr(iPos1);
	var strName = omlGetAttr(str2, '(', ')');
	var strContent = omlGetAttr(str2, '{', '}');
	var strClass = omlEncode(vClass);
	return (str1 + omlNewEle(strName, strClass, strContent) + str3);
}

function omlSetContent(strEle, strPath, vContent)
{
	if (typeof(strEle) != "string"
		|| typeof(strPath) != "string"
		|| typeof(vContent) == "undefined")
	{
		alert("omlSetContent: bad parameter");
		return "";
	}

	var cSplit = '.';
	var strPathTemp = strPath;
	if (strPath.charAt(0) == '\n') {
		cSplit = strPath.charAt(1);
		strPathTemp = strPath.substring(2);
	}

	var iPos = omlElePath(strEle, 0, strPathTemp, cSplit);
	if (iPos < 0) {
		return "";
	}
	var iPos1 = omlElePos(strEle, iPos);
	if (iPos1 == 0) {
		return "";
	}

	var str1 = strEle.substr(0, iPos);
	var str2 = strEle.substr(iPos, (iPos1 - iPos));
	var str3 = strEle.substr(iPos1);
	var strName = omlGetAttr(str2, '(', ')');
	var strClass = omlGetAttr(str2, '[', ']');
	var strContent = omlEncode(vContent);
	return (str1 + omlNewEle(strName, strClass, strContent) + str3);
}

function omlNewEle(vName, vClass, vContent)
{
	if (typeof(vName)== "undefined"
		|| typeof(vClass) == "undefined"
		|| typeof(vContent) == "undefined")
	{
		alert("omlNewEle: bad parameter");
		return "";
	}

	return ("(" + vName + ")[" + vClass + "]{" + vContent + "}");
}

function omlDeleteEle(strEle, strPath, uSize, uPos)
{
	if (typeof(strEle) != "string"
		|| typeof(strPath) != "string"
		|| typeof(uSize) == "undefined"
		|| typeof(uPos) == "undefined")
	{
		alert("omlDeleteEle: bad parameter");
		return "";
	}

	var cSplit = '.';
	var strPathTemp = strPath;
	if (strPath.charAt(0) == '\n') {
		cSplit = strPath.charAt(1);
		strPathTemp = strPath.substring(2);
	}

	var iPos = omlElePath(strEle, 0, strPathTemp, cSplit);
	if (iPos < 0) {
		return strEle;
	}

	var uInd = 0;
	var iPosList = iPos;
	while (uInd < uPos) {
		iPos1 = omlElePos(strEle, iPosList);
		if (iPos1 == 0) {
			return strEle;
		}
		iPosList = iPos1;
		uInd++;
	}

	uInd = 0;
	var iPosBegin = iPosList;
	while (uInd < uSize) {
		iPos1 = omlElePos(strEle, iPosList);
		if (iPos1 == 0) {
			break;
		}
		iPosList = iPos1;
		uInd++;
	}
	if (uSize > 0) {
		return (strEle.substr(0, iPosBegin) + strEle.substr(iPosList));		
	}

	return strEle;
}

function omlGetEle(strEle, strPath, uSize, uPos)
{
	if (typeof(strEle) != "string"
		|| typeof(strPath) != "string"
		|| typeof(uSize) == "undefined"
		|| typeof(uPos) == "undefined")
	{
		alert("omlGetEle: bad parameter");
		return "";
	}

	var cSplit = '.';
	var strPathTemp = strPath;
	if (strPath.charAt(0) == '\n') {
		cSplit = strPath.charAt(1);
		strPathTemp = strPath.substring(2);
	}

	var iPos = omlElePath(strEle, 0, strPathTemp, cSplit);
	if (iPos < 0) {
		return "";
	}

	var uInd = 0;
	var iPosList = iPos;
	while (uInd < uPos) {
		iPos1 = omlElePos(strEle, iPosList);
		if (iPos1 == 0) {
			return strEle;
		}
		iPosList = iPos1;
		uInd++;
	}

	uInd = 0;
	var iPosBegin = iPosList;
	while (uInd < uSize) {
		iPos1 = omlElePos(strEle, iPosList);
		if (iPos1 == 0) {
			break;
		}
		iPosList = iPos1;
		uInd++;
	}

	return strEle.substr(iPosBegin, (iPosList - iPosBegin));		
}

function omlGetAttr(eleSingle, cMarkB, cMarkE)
{
	var iMark = eleSingle.indexOf(cMarkB);
	if (iMark < 0) {
		return "";
	}

	var iInd = eleSingle.indexOf('{');
	if (iInd >= 0 && iInd < iMark) {
		return "";
	}

	iMark++;
	var iMark1 = omlMarkPos(eleSingle, iMark);
	if (iMark1 < 0) {
		return "";
	}
	if (eleSingle.charAt(iMark1) != cMarkE) {
		return "";
	}

	return eleSingle.substr(iMark, (iMark1 - iMark));
}

function omlGetName(strEle, strPath)
{
	if (typeof(strEle) != "string" || typeof(strPath) != "string") {
		alert("omlGetName: bad parameter");
		return "";
	}

	var cSplit = '.';
	var strPathTemp = strPath;
	if (strPath.charAt(0) == '\n') {
		cSplit = strPath.charAt(1);
		strPathTemp = strPath.substring(2);
	}

	var iPos = omlElePath(strEle, 0, strPathTemp, cSplit);
	if (iPos < 0) {
		return "";
	}
	var iPos1 = omlElePos(strEle, iPos);
	if (iPos1 == 0) {
		return "";
	}

	var eleSingle = strEle.substr(iPos, (iPos1 - iPos));
	return omlDecode(omlGetAttr(eleSingle, '(', ')'));
}

function omlGetClass(strEle, strPath)
{
	if (typeof(strEle) != "string" || typeof(strPath) != "string") {
		alert("omlGetClass: bad parameter");
		return "";
	}

	var cSplit = '.';
	var strPathTemp = strPath;
	if (strPath.charAt(0) == '\n') {
		cSplit = strPath.charAt(1);
		strPathTemp = strPath.substring(2);
	}

	var iPos = omlElePath(strEle, 0, strPathTemp, cSplit);
	if (iPos < 0) {
		return "";
	}
	var iPos1 = omlElePos(strEle, iPos);
	if (iPos1 == 0) {
		return "";
	}

	var eleSingle = strEle.substr(iPos, (iPos1 - iPos));
	return omlDecode(omlGetAttr(eleSingle, '[', ']'));
}

function omlGetContent(strEle, strPath)
{
	if (typeof(strEle) != "string" || typeof(strPath) != "string") {
		alert("omlGetContent: bad parameter");
		return "";
	}

	var cSplit = '.';
	var strPathTemp = strPath;
	if (strPath.charAt(0) == '\n') {
		cSplit = strPath.charAt(1);
		strPathTemp = strPath.substring(2);
	}

	var iPos = omlElePath(strEle, 0, strPathTemp, cSplit);
	if (iPos < 0) {
		return "";
	}
	var iPos1 = omlElePos(strEle, iPos);
	if (iPos1 == 0) {
		return "";
	}

	var eleSingle = strEle.substr(iPos, (iPos1 - iPos));
	return omlDecode(omlGetAttr(eleSingle, '{', '}'));
}


global.omlEncode = omlEncode;
global.omlDecode = omlDecode;

global.omlSetName = omlSetName;
global.omlSetClass = omlSetClass;
global.omlSetContent = omlSetContent;

global.omlGetEle = omlGetEle;
global.omlDeleteEle = omlDeleteEle;
global.omlNewEle = omlNewEle;

global.omlGetName = omlGetName;
global.omlGetClass = omlGetClass;
global.omlGetContent = omlGetContent;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],6:[function(require,module,exports){
(function (global){
////////////////////////////////////////////////////
require('./pgLibError');
var WebSocketClient = require('./WebSocketClient');
var NodeList = require('./NodeList');
var ViewList = require('./ViewList');
require('./HttpClient');
require('./omlParser');

var __IP_PORT__ = "127.0.0.1:17885";
var __WS__URL__ = "ws://" + __IP_PORT__;
var __WS_PARAM__ = "peergine-node";

var __VERSION_URL__ = "http://" + __IP_PORT__ + "/version";
var __PING_URL__ = "http://" + __IP_PORT__ + "/ping";
var __ACTION_URL__ = "http://" + __IP_PORT__ + "/peergine.do";
var __VIDEO_URL__ = "http://" + __IP_PORT__ + "/video.do";

var isOmlParserUseJs = true;
// private
var nodeList = new NodeList();
var viewList = new ViewList();
var wsc = new WebSocketClient();

function onOpenCallback() {
    //设置所有Node对Ws的关联
    // eslint-disable-next-line no-unused-vars
    nodeList.Traversal("", function (item, param) {
        sendNewJSNode(item.sSession);
        wsc.CheckSendSession(item);
    });

}

function onMsgCallback(js) {
    var node = nodeList.FindNode(js.sSession);
    if (node != null) {
        var sObj = "";
        var sData = "";
        if (js.OnFun == "OnExtRequest") {
            if (node.OnExtRequest != null) {

                sObj = js.sObj;
                var uMeth = js.uMeth;
                sData = js.sData;
                var uHandle = js.uHandle;
                var sPeer = js.sPeer;
                // if(uMeth == 35 && )
                // console.log("sObj: " + sObj + " uMeth: " + uMeth + " sData: " + sData + " uHandle: " + uHandle + " sPeer: " + sPeer);
                node.OnExtRequest(sObj, uMeth, sData, uHandle, sPeer);
            }
        } else if (js.OnFun == ("OnReply")) {
            if (node.OnReply != null) {

                sObj = js.sObj;
                var uErr = js.uErr;
                sData = js.sData;
                var sParam = js.sParam;

                // console.log("sObj: " + sObj + " uErr: " + uErr + " sData: " + sData + " sParam: " + sParam);
                node.OnReply(sObj, uErr, sData, sParam);
            }
        } else {
            console.log("string js = " + js);
        }
    } else {
        console.log("node sSession no exist");
    }
}

wsc.createWebSocket(__WS__URL__, __WS_PARAM__, onOpenCallback, onMsgCallback);

function pgLibJSNode(sSession) {

    //public
    this.Control = "";
    this.Node = "";
    this.Class = "";
    this.Local = "";
    this.Server = "";
    this.Relay = "";
    this.OnExtRequest = null;
    this.OnReply = null;

    this.sSession = sSession;

    this.checktimeoutObj = null;
    nodeList.Add(this);

    /*
     * @return {int}
     */
    this.ObjectAdd = function (sObject, sClass, sGroup, uFlag) {
        var sParamJson = {
            "sObject": sObject,
            "sClass": sClass,
            "sGroup": sGroup,
            "uFlag": uFlag
        };
        var sParam1 = "method=ObjectAdd" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {void}
     */
    this.ObjectDelete = function (sObject) {
        var sParamJson = {
            "sObject": sObject,
        };
        var sParam1 = "method=ObjectDelete" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.ObjectGetClass = function (sObject) {
        var sParamJson = {
            "sObject": sObject,
        };
        var sParam1 = "method=ObjectGetClass" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {int}
     */
    this.ObjectSetGroup = function (sObject, sGroup) {
        var sParamJson = {
            "sObject": sObject,
            "sGroup": sGroup
        };
        var sParam1 = "method=ObjectSetGroup" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.ObjectGetGroup = function (sObject) {
        var sParamJson = {
            "sObject": sObject,
        };
        var sParam1 = "method=ObjectGetGroup" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {int}
     */
    this.ObjectSync = function (sObject, sPeer, uAction) {

        var sParamJson = {
            "sObject": sObject,
            "sPeer": sPeer,
            "uAction": uAction
        };
        var sParam1 = "method=ObjectSync" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {int}
     */
    this.ObjectRequest = function (sObject, uMeth, sIn, sParam) {
        var sParamJson = {
            "sObject": sObject,
            "uMeth": uMeth,
            "sIn": sIn,
            "sParam": sParam
        };
        var sParam1 = "method=ObjectRequest" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));



        return httpRequestPost(__ACTION_URL__, sParam1);
    };



    /*
     * @return {int}
     */
    this.ObjectExtReply = function (sObject, uErr, sOut, uHandle) {
        var sParamJson = {
            "sObject": sObject,
            "uErr": uErr,
            "sOut": sOut,
            "uHandle": uHandle
        };
        var sParam1 = "method=ObjectExtReply" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.ObjectEnum = function (sObject, sClass) {

        var sParamJson = {
            "sObject": sObject,
            "sClass": sClass
        };
        var sParam1 = "method=ObjectEnum" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };

    /*
     * @return {String}
     */
    this.PostMessage = function (sMsg) {

        var sParamJson = {
            "sMsg": sMsg
        };
        var sParam1 = "method=ObjectEnum" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {int}
     */
    this.Start = function (uOption) {
        var self = this;
        self.checktimeoutObj = window.setTimeout(function () {
            wsc.CheckSendSession(self);
        }, 100);

        var sParamJson = {
            "uOption": uOption,
            "Control": this.Control,
            "Node": this.Node,
            "Class": this.Class,
            "Local": this.Local,
            "Server": this.Server,
            "Relay": this.Relay,
        };
        var sParam1 = "method=Start" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);


    };



    /*
     * @return {void}
     */
    this.Stop = function () {

        var sParamJson = {

        };
        var sParam1 = "method=Stop" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlEncode = function (sEle) {
        if (isOmlParserUseJs) {
            return omlEncode(sEle);
        }

        var sParamJson = {
            "sEle": sEle,
        };
        var sParam1 = "method=omlEncode" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlDecode = function (sEle) {
        if (isOmlParserUseJs) {
            return omlDecode(sEle);
        }
        var sParamJson = {
            "sEle": sEle,
        };
        var sParam1 = "method=omlDecode" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlSetName = function (sEle, sPath, sName) {
        if (isOmlParserUseJs) {
            return omlSetName(sEle, sPath, sName);
        }

        var sParamJson = {
            "sEle": sEle,
            "sPath": sPath,
            "sName": sName,
        };
        var sParam1 = "method=omlSetName" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));


        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlSetClass = function (sEle, sPath, sClass) {
        if (isOmlParserUseJs) {
            return omlSetClass(sEle, sPath, sClass);
        }
        var sParamJson = {
            "sEle": sEle,
            "sPath": sPath,
            "sClass": sClass,
        };
        var sParam1 = "method=omlSetClass" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlSetContent = function (sEle, sPath, sContent) {
        if (isOmlParserUseJs) {
            return omlSetContent(sEle, sPath, sContent);
        }
        var sParamJson = {
            "sEle": sEle,
            "sPath": sPath,
            "sContent": sContent,
        };
        var sParam1 = "method=omlSetContent" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlNewEle = function (sName, sClass, sContent) {
        if (isOmlParserUseJs) {
            return omlNewEle(sName, sClass, sContent);
        }
        var sParamJson = {
            "sName": sName,
            "sClass": sClass,
            "sContent": sContent,
        };
        var sParam1 = "method=omlNewEle" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlGetEle = function (sEle, sPath, uSize, uPos) {
        if (isOmlParserUseJs) {
            return omlGetEle(sEle, sPath, uSize, uPos);
        }
        var sParamJson = {
            "sEle": sEle,
            "sPath": sPath,
            "uSize": uSize,
            "uPos": uPos,
        };
        var sParam1 = "method=omlGetEle" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlDeleteEle = function (sEle, sPath, uSize, uPos) {
        if (isOmlParserUseJs) {
            return omlDeleteEle(sEle, sPath, uSize, uPos);
        }
        var sParamJson = {
            "sEle": sEle,
            "sPath": sPath,
            "uSize": uSize,
            "uPos": uPos,
        };
        var sParam1 = "method=omlDeleteEle" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));
        return httpRequestPost(__ACTION_URL__, sParam1);
    };

    /*
     * @return {String}
     */
    this.omlGetName = function (sEle, sPath) {
        if (isOmlParserUseJs) {
            return omlGetName(sEle, sPath);
        }
        var sParamJson = {
            "sEle": sEle,
            "sPath": sPath,
        };
        var sParam1 = "method=omlGetName" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };


    /*
     * @return {String}
     */
    this.omlGetClass = function (sEle, sPath) {
        if (isOmlParserUseJs) {
            return omlGetClass(sEle, sPath);
        }
        var sParamJson = {
            "sEle": sEle,
            "sPath": sPath,
        };
        var sParam1 = "method=omlGetClass" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };

    /*
     * @return {String}
     */
    this.omlGetContent = function (sEle, sPath) {
        if (isOmlParserUseJs) {
            return omlGetContent(sEle, sPath);
        }
        var sParamJson = {
            "sEle": sEle,
            "sPath": sPath,
        };
        var sParam1 = "method=omlGetContent" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };

    /*
     * @return {String}
     */
    this.WndCreate = function (divId) {
        return viewList.WndCreate(divId, __VIDEO_URL__, this.sSession);
    };


    /*
     * @return {null}
     */
    this.WndDestroy = function (divId) {
        return viewList.WndDestroy(divId);
    };


    /*
     * @return {String}
     */
    this.utilCmd = function (sCmd, sParam) {
        var sParamJson = {
            "sCmd": sCmd,
            "sParam": sParam,
        };
        var sParam1 = "method=utilCmd" +
            "&sSession=" + this.sSession +
            "&sParam=" + encodeURIComponent(JSON.stringify(sParamJson)); //encode64(JSON.stringify(sParamJson));

        return httpRequestPost(__ACTION_URL__, sParam1);
    };
}

function pgJSNodeVersion() {
    return httpRequestGet(__VERSION_URL__, "");
}

function pgJSNodePing() {
    return httpRequestGet(__PING_URL__, "");
}

function sendNewJSNode(sSession) {
    var sParam = "method=pgNewJSNode&sSession=" + sSession;
    return httpRequestPost(__ACTION_URL__, sParam);
}

function sendDeleteJSNode(sSession) {
    var sParam = "method=pgDeleteJSNode&sSession=" + sSession;
    return httpRequestPost(__ACTION_URL__, sParam);
}
/*
 *@return {Object}
 */
function pgNewJSNode(sSession) {
    var random = parseInt(0xffff * Math.random());
    var tmp = (sSession << 16) | random;

    var sSession1 = sendNewJSNode(tmp);

    var node = new pgLibJSNode();
    node.sSession = sSession1;
    return node;
}

/*
 *@return {Object}
 */
function pgDeleteJSNode(Node) {
    if (Node != null && typeof (Node.sSession) != "undefined") {

        var sRet = sendDeleteJSNode(Node.sSession);

        nodeList.Del(Node);
        if (Node.checktimeoutObj) {
            clearTimeout(Node.checktimeoutObj);
        }
        return sRet;
    }
    return "";
}

module.exports = pgLibJSNode;
global.pgJSNodeVersion = pgJSNodeVersion;
global.pgNewJSNode = pgNewJSNode;
global.pgDeleteJSNode = pgDeleteJSNode;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./HttpClient":1,"./NodeList":2,"./ViewList":3,"./WebSocketClient":4,"./omlParser":5,"./pgLibError":7}],7:[function(require,module,exports){
(function (global){

var PG_ERR_Normal = 0;
var PG_ERR_System = 1;
var PG_ERR_BadParam = 2;
var PG_ERR_BadClass = 3;
var PG_ERR_BadMethod = 4;
var PG_ERR_BadObject = 5;
var PG_ERR_BadStatus = 6;
var PG_ERR_BadFile = 7;
var PG_ERR_BadUser = 8;
var PG_ERR_BadPass = 9;
var PG_ERR_NoLogin = 10;
var PG_ERR_Network = 11;
var PG_ERR_Timeout = 12;
var PG_ERR_Reject = 13;
var PG_ERR_Busy = 14;
var PG_ERR_Opened = 15;
var PG_ERR_Closed = 16;
var PG_ERR_Exist = 17;
var PG_ERR_NoExist = 18;
var PG_ERR_NoSpace = 19;
var PG_ERR_BadType = 20;
var PG_ERR_CheckErr = 21;
var PG_ERR_BadServer = 22;
var PG_ERR_BadDomain = 23;
var PG_ERR_NoData = 24;
var PG_ERR_Unknown = 0xff;

var pgLibError = {};

global.PG_ERR_Normal = pgLibError.PG_ERR_Normal = PG_ERR_Normal;
global.PG_ERR_System = pgLibError.PG_ERR_System = PG_ERR_System;
global.PG_ERR_BadParam = pgLibError.PG_ERR_BadParam = PG_ERR_BadParam;
global.PG_ERR_BadClass = pgLibError.PG_ERR_BadClass = PG_ERR_BadClass;
global.PG_ERR_BadMethod = pgLibError.PG_ERR_BadMethod = PG_ERR_BadMethod;
global.PG_ERR_BadObject = pgLibError.PG_ERR_BadObject = PG_ERR_BadObject;
global.PG_ERR_BadStatus = pgLibError.PG_ERR_BadStatus = PG_ERR_BadStatus;
global.PG_ERR_BadFile = pgLibError.PG_ERR_BadFile = PG_ERR_BadFile;
global.PG_ERR_BadUser = pgLibError.PG_ERR_BadUser = PG_ERR_BadUser;
global.PG_ERR_BadPass = pgLibError.PG_ERR_BadPass = PG_ERR_BadPass;
global.PG_ERR_NoLogin = pgLibError.PG_ERR_NoLogin = PG_ERR_NoLogin;
global.PG_ERR_Network = pgLibError.PG_ERR_Network = PG_ERR_Network;
global.PG_ERR_Timeout = pgLibError.PG_ERR_Timeout = PG_ERR_Timeout;
global.PG_ERR_Reject = pgLibError.PG_ERR_Reject = PG_ERR_Reject;
global.PG_ERR_Busy = pgLibError.PG_ERR_Busy = PG_ERR_Busy;
global.PG_ERR_Opened = pgLibError.PG_ERR_Opened = PG_ERR_Opened;
global.PG_ERR_Closed = pgLibError.PG_ERR_Closed = PG_ERR_Closed;
global.PG_ERR_Exist = pgLibError.PG_ERR_Exist = PG_ERR_Exist;
global.PG_ERR_NoExist = pgLibError.PG_ERR_NoExist = PG_ERR_NoExist;
global.PG_ERR_NoSpace = pgLibError.PG_ERR_NoSpace = PG_ERR_NoSpace;
global.PG_ERR_BadType = pgLibError.PG_ERR_BadType = PG_ERR_BadType;
global.PG_ERR_CheckErr = pgLibError.PG_ERR_CheckErr = PG_ERR_CheckErr;
global.PG_ERR_BadServer = pgLibError.PG_ERR_BadServer = PG_ERR_BadServer;
global.PG_ERR_BadDomain = pgLibError.PG_ERR_BadDomain = PG_ERR_BadDomain;
global.PG_ERR_NoData = pgLibError.PG_ERR_NoData = PG_ERR_NoData;
global.PG_ERR_Unknown = pgLibError.PG_ERR_Unknown = PG_ERR_Unknown;

global.pgLibError=pgLibError;

var strErrors = [
    "PG_ERR_Normal",
    "PG_ERR_System",
    "PG_ERR_BadParam",
    "PG_ERR_BadClass",
    "PG_ERR_BadMethod",
    "PG_ERR_BadObject",
    "PG_ERR_BadStatus",
    "PG_ERR_BadFile",
    "PG_ERR_BadUser",
    "PG_ERR_BadPass",
    "PG_ERR_NoLogin",
    "PG_ERR_Network",
    "PG_ERR_Timeout",
    "PG_ERR_Reject",
    "PG_ERR_Busy",
    "PG_ERR_Opened",
    "PG_ERR_Closed",
    "PG_ERR_Exist",
    "PG_ERR_NoExist",
    "PG_ERR_NoSpace",
    "PG_ERR_BadType",
    "PG_ERR_CheckErr",
    "PG_ERR_BadServer",
    "PG_ERR_BadDomain",
    "PG_ERR_NoData"
];

function pgLibErr2Str(iErr){
    if(iErr<0 || iErr >= strErrors.length){
        return "PG_ERR_Unknown";
    }
    return strErrors[iErr];
}



global.pgLibError=pgLibError;
global.pgLibErr2Str=pgLibErr2Str;

/**
 * 判断字符串是否为空
 * @param s 字符串
 * @return true 为空 ，false 不为空
 */
function _isEmpty(s){
    return s == null || ""==(s) || typeof s != "string";
}
global._isEmpty = _isEmpty;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[6])(6)
});
