;(() => {
  // 全局注册器：供 Kitchen 菜单逻辑文件注册 check / submit 函数
  if (!global.cloudIslandKitchenMenu) {
    global.cloudIslandKitchenMenu = {}
  }

  const root = global.cloudIslandKitchenMenu
  if (!root.logicMap) root.logicMap = {}
  if (!root.submitMap) root.submitMap = {}

  root.registerLogic = function registerLogic(key, checker) {
    if (!key || typeof checker !== 'function') return
    root.logicMap[String(key)] = checker
  }

  root.getLogic = function getLogic(key) {
    return root.logicMap[String(key || '')] || null
  }

  root.registerSubmit = function registerSubmit(key, submitter) {
    if (!key || typeof submitter !== 'function') return
    root.submitMap[String(key)] = submitter
  }

  root.getSubmit = function getSubmit(key) {
    return root.submitMap[String(key || '')] || null
  }
})()
