'use strict';

// src/ar/types.ts
var DEFAULT_AR_ASSETS = {
  cameraParametersUrl: "https://raw.githack.com/AR-js-org/AR.js/master/three.js/data/camera_para.dat",
  patternUrl: "https://raw.githack.com/AR-js-org/AR.js/master/three.js/data/patt.hiro"
};

// src/ar/load-arjs.ts
var loadPromise = null;
async function loadARJS(options = {}) {
  if (typeof window === "undefined") {
    throw new Error("AR.js can only be loaded in a browser environment.");
  }
  if (options.three) {
    window.THREE = options.three;
  }
  const existing = window.THREEx;
  if (existing && !options.forceReload) {
    return existing;
  }
  if (!loadPromise || options.forceReload) {
    const importPromise = options.locationOnly ? import('@ar-js-org/ar.js/three.js/build/ar-threex-location-only.js') : import('@ar-js-org/ar.js/three.js/build/ar-threex.js');
    loadPromise = importPromise.then(() => {
      const THREEx = window.THREEx;
      if (!THREEx) {
        throw new Error("AR.js loaded, but THREEx namespace was not found.");
      }
      return THREEx;
    });
  }
  return loadPromise;
}

exports.DEFAULT_AR_ASSETS = DEFAULT_AR_ASSETS;
exports.loadARJS = loadARJS;
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map