import { $w as baseAPI } from '<%= subLevelPath %>../../app/weapps-api'

export const $page = {
  __internal__: {}
};

export const $w = new Proxy(
  baseAPI,
  {
    get(target, prop) {
      if(prop === '$page'){
        return $page
      }
      // 尝试代理页面级别组件实例
      const pageWidget = $page.widgets?.[prop];
      if (pageWidget) {
        return pageWidget._userWidget;
      }
      return target[prop]
    },
  },
);

$page.__internal__.$w = $w
