mergeInto(LibraryManager.library, {
	_QA: function(jsonString_) {
		try {
			const jsonString = UTF8ToString(jsonString_);
			const json = JSON.parse(jsonString);

			// correct scale and invert Y axis direction
			const S = 1 / window.devicePixelRatio;
			const unityCanvasEl = document.querySelector('canvas');
			const rect = unityCanvasEl.getBoundingClientRect();
			
			json.BoundingBox = {
				x: rect.left,
				y: rect.top,
				width: rect.width,
				height: rect.height
			};

			for (const el of json.Elements) {
				const bb = el.BoundingBox;
				delete bb.serializedVersion;
				bb.x *= S;
				bb.y = rect.height - bb.y * S;
				bb.width *= S;
				bb.height *= S;
			}

			window._QA_ = json;
		} catch (err) {}
	}
});
