local y,w="\076\105\098\083\116\117\098",2 local O=_G[y]if not O or O.minor<w then O=O or{libs={};minors={}}_G[y]=O O.minor=w function O.NewLibrary(O,y,w)assert(type(y)=="\115\116\114\105\110\103","\066\097\100 \097\114\103\117\109\101\110\116 \035\050 \116\111 \096\078\101\119\076\105\098\114\097\114\121\' \040\115\116\114\105\110\103 \101\120\112\101\099\116\101\100\041")w=assert(tonumber(string.match(w,"\037\100\043")),"\077\105\110\111\114 \118\101\114\115\105\111\110 \109\117\115\116 \101\105\116\104\101\114 \098\101 \097 \110\117\109\098\101\114 \111\114 \099\111\110\116\097\105\110 \097 \110\117\109\098\101\114\046")local H=O.minors[y]if H and H>=w then return nil end O.minors[y],O.libs[y]=w,O.libs[y]or{}return O.libs[y],H end function O.GetLibrary(O,y,w)if not O.libs[y]and not w then error(("\067\097\110\110\111\116 \102\105\110\100 \097 \108\105\098\114\097\114\121 \105\110\115\116\097\110\099\101 \111\102 \037\113\046"):format(tostring(y)),2)end return O.libs[y],O.minors[y]end function O.IterateLibraries(y)return pairs(y.libs)end setmetatable(O,{__call=O.GetLibrary})end
-- LibStub is a simple versioning stub meant for use in Libraries.  http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2  -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]

if not LibStub or LibStub.minor < LIBSTUB_MINOR then
	LibStub = LibStub or {libs = {}, minors = {} }
	_G[LIBSTUB_MAJOR] = LibStub
	LibStub.minor = LIBSTUB_MINOR

	function LibStub:NewLibrary(major, minor)
		assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
		minor = assert(tonumber(string.match(minor, "%d+")), "Minor version must either be a number or contain a number.")

		local oldminor = self.minors[major]
		if oldminor and oldminor >= minor then return nil end
		self.minors[major], self.libs[major] = minor, self.libs[major] or {}
		return self.libs[major], oldminor
	end

	function LibStub:GetLibrary(major, silent)
		if not self.libs[major] and not silent then
			error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
		end
		return self.libs[major], self.minors[major]
	end

	function LibStub:IterateLibraries() return pairs(self.libs) end
	setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
