// Class: lime.text._UTF8String.UTF8String_Impl_

var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this

$global.Object.defineProperty(exports, "__esModule", {value: true});

var __map_reserved = {};

// Imports

var $hxClasses = require("./../../../hxClasses_stub").default;
var $import = require("./../../../import_stub").default;
function lime_text_unifill_Unifill() {return require("./../../../lime/text/unifill/Unifill");}
function lime_text_unifill_Unicode() {return require("./../../../lime/text/unifill/Unicode");}
function js__$Boot_HaxeError() {return require("./../../../js/_Boot/HaxeError");}
function lime_text_unifill_InvalidCodePoint() {return require("./../../../lime/text/unifill/InvalidCodePoint");}
function lime_text_unifill_InternalEncoding() {return require("./../../../lime/text/unifill/InternalEncoding");}
function haxe_Utf8() {return require("./../../../haxe/Utf8");}
function StringBuf() {return require("./../../../StringBuf");}
function Std() {return require("./../../../Std");}

// Constructor

var UTF8String_Impl_ = function(){}

// Meta

UTF8String_Impl_.__name__ = ["lime","text","_UTF8String","UTF8String_Impl_"];
UTF8String_Impl_.prototype = {
	
};
UTF8String_Impl_.prototype.__class__ = $hxClasses["lime.text._UTF8String.UTF8String_Impl_"] = UTF8String_Impl_;

// Init



// Statics

UTF8String_Impl_._new = function(str) {
	var this1 = new String(str);
	return this1;
}
UTF8String_Impl_.charAt = function(this1,index) {
	return (lime_text_unifill_Unifill().default).uCharAt(this1,index);
}
UTF8String_Impl_.charCodeAt = function(this1,index) {
	if(index < 0 || index >= (lime_text_unifill_Unifill().default).uLength(this1)) {
		return null;
	}
	return (lime_text_unifill_Unifill().default).uCharCodeAt(this1,index);
}
UTF8String_Impl_.fromCharCode = function(code) {
	if(!(lime_text_unifill_Unicode().default).isScalar(code)) {
		throw new (js__$Boot_HaxeError().default)(new (lime_text_unifill_InvalidCodePoint().default)(code));
	}
	var this1 = code;
	return (lime_text_unifill_InternalEncoding().default).fromCodePoint(this1);
}
UTF8String_Impl_.fromCharCodes = function(codes) {
	var s = "";
	var _g = 0;
	while(_g < codes.length) {
		var code = codes[_g];
		++_g;
		if(!(lime_text_unifill_Unicode().default).isScalar(code)) {
			throw new (js__$Boot_HaxeError().default)(new (lime_text_unifill_InvalidCodePoint().default)(code));
		}
		var this1 = code;
		s += (lime_text_unifill_InternalEncoding().default).fromCodePoint(this1);
	}
	return s;
}
UTF8String_Impl_.indexOf = function(this1,str,startIndex) {
	if(startIndex == null) {
		startIndex = 0;
	}
	return (lime_text_unifill_Unifill().default).uIndexOf(this1,str,startIndex);
}
UTF8String_Impl_.lastIndexOf = function(this1,str,startIndex) {
	return (lime_text_unifill_Unifill().default).uLastIndexOf(this1,str,startIndex);
}
UTF8String_Impl_.split = function(this1,delimiter) {
	return (lime_text_unifill_Unifill().default).uSplit(this1,delimiter);
}
UTF8String_Impl_.substr = function(this1,pos,len) {
	return (haxe_Utf8().default).sub(this1,pos,len);
}
UTF8String_Impl_.substring = function(this1,startIndex,endIndex) {
	return (lime_text_unifill_Unifill().default).uSubstring(this1,startIndex,endIndex);
}
UTF8String_Impl_.toLowerCase = function(this1) {
	return this1.toLowerCase();
}
UTF8String_Impl_.toString = function(this1) {
	return this1;
}
UTF8String_Impl_.toUpperCase = function(this1) {
	return this1.toUpperCase();
}
UTF8String_Impl_.equals = function(a,b) {
	if(a == null || b == null) {
		return a == b;
	}
	return (lime_text_unifill_Unifill().default).uCompare(a,b) == 0;
}
UTF8String_Impl_.lt = function(a,b) {
	if(b == null) {
		return false;
	}
	if(a == null) {
		return true;
	}
	return (lime_text_unifill_Unifill().default).uCompare(a,b) == -1;
}
UTF8String_Impl_.gt = function(a,b) {
	if(a == null) {
		return false;
	}
	if(b == null) {
		return true;
	}
	return (lime_text_unifill_Unifill().default).uCompare(a,b) == 1;
}
UTF8String_Impl_.lteq = function(a,b) {
	if(b == null) {
		return a == null;
	}
	if(a == null) {
		return true;
	}
	return (lime_text_unifill_Unifill().default).uCompare(a,b) != 1;
}
UTF8String_Impl_.gteq = function(a,b) {
	if(a == null) {
		return b == null;
	}
	if(b == null) {
		return true;
	}
	return (lime_text_unifill_Unifill().default).uCompare(a,b) != -1;
}
UTF8String_Impl_.plus = function(a,b) {
	if(a == null && b == null) {
		return null;
	}
	if(a == null) {
		return b;
	}
	if(b == null) {
		return a;
	}
	var sb = new (StringBuf().default)();
	sb.add(UTF8String_Impl_.toString(a));
	sb.add(UTF8String_Impl_.toString(b));
	return sb.toString();
}
UTF8String_Impl_.fromDynamic = function(value) {
	return (Std().default).string(value);
}
UTF8String_Impl_.get_length = function(this1) {
	if(this1 == null) {
		return 0;
	} else {
		return this1.length;
	}
}


// Export

exports.default = UTF8String_Impl_;