{"version":3,"file":"bridge-mode/common.mjs","sources":["../../../src/bridge-mode/common.ts"],"sourcesContent":["export const DefaultBridgeServerHost = '127.0.0.1';\nexport const DefaultBridgeServerPort = 3766;\nexport const DefaultLocalEndpoint = `http://${DefaultBridgeServerHost}:${DefaultBridgeServerPort}`;\nexport const BridgeCallTimeout = 30000;\n\n/**\n * Get the server host based on configuration options.\n * Priority: explicit host > allowRemoteAccess > default (127.0.0.1)\n */\nexport function getBridgeServerHost(options?: {\n  host?: string;\n  allowRemoteAccess?: boolean;\n}): string {\n  if (options?.host) {\n    return options.host;\n  }\n  if (options?.allowRemoteAccess) {\n    return '0.0.0.0';\n  }\n  return DefaultBridgeServerHost;\n}\n\nexport enum BridgeEvent {\n  Call = 'bridge-call',\n  CallResponse = 'bridge-call-response',\n  UpdateAgentStatus = 'bridge-update-agent-status',\n  Message = 'bridge-message',\n  Connected = 'bridge-connected',\n  Refused = 'bridge-refused',\n  ConnectNewTabWithUrl = 'connectNewTabWithUrl',\n  ConnectCurrentTab = 'connectCurrentTab',\n  GetBrowserTabList = 'getBrowserTabList',\n  SetDestroyOptions = 'setDestroyOptions',\n  SetActiveTabId = 'setActiveTabId',\n  RegisterFileChooserAccept = 'registerFileChooserAccept',\n  ClearFileChooserAccept = 'clearFileChooserAccept',\n  GetFileChooserError = 'getFileChooserError',\n}\n\nexport const BridgeSignalKill = 'MIDSCENE_BRIDGE_SIGNAL_KILL';\n\nexport interface BridgeConnectTabOptions {\n  /**\n   * If true, the page will always track the active tab.\n   * @default true\n   */\n  forceSameTabNavigation?: boolean;\n  /**\n   * Whether the newly created tab should become Chrome's active tab.\n   * @default true\n   */\n  activateTab?: boolean;\n  /**\n   * Custom timeout for connecting to the tab in milliseconds.\n   * @default 30000 (30 seconds)\n   */\n  timeout?: number;\n  /**\n   * Whether the blue water-flow animation border and mouse pointer\n   * overlay should be shown while controlling the page.\n   * @default true\n   */\n  enableWaterFlowAnimation?: boolean;\n}\n\nexport enum MouseEvent {\n  PREFIX = 'mouse.',\n  Click = 'mouse.click',\n  Wheel = 'mouse.wheel',\n  Move = 'mouse.move',\n  Drag = 'mouse.drag',\n}\n\nexport enum KeyboardEvent {\n  PREFIX = 'keyboard.',\n  Type = 'keyboard.type',\n  InsertText = 'keyboard.insertText',\n  Press = 'keyboard.press',\n}\n\nexport const BridgePageType = 'page-over-chrome-extension-bridge';\n\nexport const BridgeErrorCodeNoClientConnected = 'no-client-connected';\n\nexport interface BridgeCall {\n  method: string;\n  args: any[];\n  response: any;\n  callTime: number;\n  responseTime: number;\n  callback: (error: Error | undefined, response: any) => void;\n  error?: Error;\n}\n\nexport interface BridgeCallRequest {\n  id: string;\n  method: string;\n  args: any[];\n}\n\nexport interface BridgeCallResponse {\n  id: string;\n  response: any;\n  error?: any;\n}\n\nexport interface BridgeConnectedEventPayload {\n  version: string;\n}\n"],"names":["DefaultBridgeServerHost","DefaultBridgeServerPort","DefaultLocalEndpoint","BridgeCallTimeout","getBridgeServerHost","options","BridgeEvent","BridgeSignalKill","MouseEvent","KeyboardEvent","BridgePageType","BridgeErrorCodeNoClientConnected"],"mappings":"AAAO,MAAMA,0BAA0B;AAChC,MAAMC,0BAA0B;AAChC,MAAMC,uBAAuB,CAAC,OAAO,EAAEF,wBAAwB,CAAC,EAAEC,yBAAyB;AAC3F,MAAME,oBAAoB;AAM1B,SAASC,oBAAoBC,OAGnC;IACC,IAAIA,SAAS,MACX,OAAOA,QAAQ,IAAI;IAErB,IAAIA,SAAS,mBACX,OAAO;IAET,OAAOL;AACT;AAEO,IAAKM,qBAAWA,WAAAA,GAAAA,SAAXA,WAAW;;;;;;;;;;;;;;;WAAXA;;AAiBL,MAAMC,mBAAmB;AA0BzB,IAAKC,oBAAUA,WAAAA,GAAAA,SAAVA,UAAU;;;;;;WAAVA;;AAQL,IAAKC,uBAAaA,WAAAA,GAAAA,SAAbA,aAAa;;;;;WAAbA;;AAOL,MAAMC,iBAAiB;AAEvB,MAAMC,mCAAmC"}