ronantakizawa/codereview-bench huggingface dataset:
Repository: nodejs/node
File: lib/internal/util/inspect.js (JavaScript)

Code before:
      (code >= 0xffe0 && code <= 0xffe6) ||
      // Kana Supplement
      (code >= 0x1b000 && code <= 0x1b001) ||
      // Enclosed Ideographic Supplement
      (code >= 0x1f200 && code <= 0x1f251) ||
      // Miscellaneous Symbols and Pictographs 0x1f300 - 0x1f5ff
      // Emoticons 0x1f600 - 0x1f64f
      (code >= 0x1f300 && code <= 0x1f64f) ||
      // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
      (code >= 0x20000 && code <= 0x3fffd)
    );
  };

}

/**
 * Remove all VT control characters. Use to estimate displayed string width.
 * @param {string} str
 * @returns {string}
 */
function stripVTControlCharacters(str) {
  validateString(str, 'str');

  if (!StringPrototypeIncludes(str, '\u001B') &&
      !StringPrototypeIncludes(str, '\u009B'))
    return str;

  return RegExpPrototypeSymbolReplace(ansi, str, '');
}

module.exports = {
  identicalSequenceRange,
  inspect,
  inspectDefaultOptions,
  format,
  formatWithOptions,
  getStringWidth,
  stripVTControlCharacters,
  isZeroWidthCodePoint,
};


Review comment (performance):
You are doing two passes here, why not use a simple regex here that only checks these 2 characters in one pass?


```suggestion
  if (!RegExpPrototypeTest(/[\u001B\u009B]/, str))
    return str;
```

Did you test the performance of this? I think this would be even faster

Code after:
      (code >= 0xffe0 && code <= 0xffe6) ||
      // Kana Supplement
      (code >= 0x1b000 && code <= 0x1b001) ||
      // Enclosed Ideographic Supplement
      (code >= 0x1f200 && code <= 0x1f251) ||
      // Miscellaneous Symbols and Pictographs 0x1f300 - 0x1f5ff
      // Emoticons 0x1f600 - 0x1f64f
      (code >= 0x1f300 && code <= 0x1f64f) ||
      // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
      (code >= 0x20000 && code <= 0x3fffd)
    );
  };

}

/**
 * Remove all VT control characters. Use to estimate displayed string width.
 * @param {string} str
 * @returns {string}
 */
function stripVTControlCharacters(str) {
  validateString(str, 'str');

  // Short-circuit: all ANSI escape sequences start with either
  // ESC (\u001B, 7-bit) or CSI (\u009B, 8-bit) introducer.
  // If neither is present, the string has no VT control characters.
  if (StringPrototypeIndexOf(str, '\u001B') === -1 &&
      StringPrototypeIndexOf(str, '\u009B') === -1)
    return str;

  return RegExpPrototypeSymbolReplace(ansi, str, '');
}

module.exports = {
  identicalSequenceRange,
  inspect,
  inspectDefaultOptions,
  format,
  formatWithOptions,
  getStringWidth,
  stripVTControlCharacters,
  isZeroWidthCodePoint,
};
Repository: nodejs/node
File: lib/internal/webstreams/adapters.js (JavaScript)

Code before:
      // We need to reject it here.
      if (closed !== undefined) {
        closed.reject(error);
        closed = undefined;
      }
      controller.error(error);
      controller = undefined;
      return;
    }

    if (closed !== undefined) {
      closed.resolve();
      closed = undefined;
      return;
    }
    controller.error(new AbortError());
    controller = undefined;
  });

  streamWritable.on('drain', onDrain);

  return new WritableStream({
    start(c) { controller = c; },

    write(chunk) {
      if (isArrayBuffer(chunk)) {
        chunk = new Uint8Array(chunk);
      }
      if (streamWritable.writableNeedDrain || !streamWritable.write(chunk)) {
        backpressurePromise = PromiseWithResolvers();
        return SafePromisePrototypeFinally(
          backpressurePromise.promise, () => {
            backpressurePromise = undefined;
          });
      }
    },

    abort(reason) {
      destroy(streamWritable, reason);
    },

    close() {
      if (closed === undefined && !isWritableEnded(streamWritable)) {
        closed = PromiseWithResolvers();
        streamWritable.end();
        return closed.promise;
      }

      controller = undefined;
      return PromiseResolve();
    },

Review comment (suggestion):
We must not do this when the stream is in object mode.

```suggestion
      if (!streamWritable.writableObjectMode && isArrayBuffer(chunk)) {
```



Code after:
      // We need to reject it here.
      if (closed !== undefined) {
        closed.reject(error);
        closed = undefined;
      }
      controller.error(error);
      controller = undefined;
      return;
    }

    if (closed !== undefined) {
      closed.resolve();
      closed = undefined;
      return;
    }
    controller.error(new AbortError());
    controller = undefined;
  });

  streamWritable.on('drain', onDrain);

  return new WritableStream({
    start(c) { controller = c; },

    write(chunk) {
      if (!streamWritable.writableObjectMode && isArrayBuffer(chunk)) {
        chunk = new Uint8Array(chunk);
      }
      if (streamWritable.writableNeedDrain || !streamWritable.write(chunk)) {
        backpressurePromise = PromiseWithResolvers();
        return SafePromisePrototypeFinally(
          backpressurePromise.promise, () => {
            backpressurePromise = undefined;
          });
      }
    },

    abort(reason) {
      destroy(streamWritable, reason);
    },

    close() {
      if (closed === undefined && !isWritableEnded(streamWritable)) {
        closed = PromiseWithResolvers();
        streamWritable.end();
        return closed.promise;
      }

      controller = undefined;
      return PromiseResolve();
    },
Repository: nodejs/node
File: test/parallel/test-webstreams-compression-buffer-source.js (JavaScript)

Code before:
}

async function testCompressionRoundTripWithArrayBuffer() {
  const cs = new CompressionStream('gzip');
  const ds = new DecompressionStream('gzip');

  const csWriter = cs.writable.getWriter();
  const csReader = cs.readable.getReader();
  const dsWriter = ds.writable.getWriter();
  const dsReader = ds.readable.getReader();

  const input = new TextEncoder().encode('hello').buffer;

  await csWriter.write(input);
  csWriter.close();

  const compressed = [];
  let done = false;
  while (!done) {
    const { value, done: d } = await csReader.read();
    if (value) compressed.push(value);
    done = d;
  }

  for (const chunk of compressed) await dsWriter.write(chunk);
  dsWriter.close();

  const out = [];
  done = false;
  while (!done) {
    const { value, done: d } = await dsReader.read();
    if (value) out.push(value);
    done = d;
  }
  const result = Buffer.concat(out.map((c) => Buffer.from(c)));
  assert.strictEqual(result.toString(), 'hello');
}

Promise.all([
  testDecompressionAcceptsArrayBuffer(),
  testCompressionRoundTripWithArrayBuffer(),
]).then(common.mustCall());


Review comment (suggestion):
This is just:
```suggestion
  await cs.readable.pipeTo(ds.writable);
```


Code after:
'use strict';
require('../common');
const assert = require('assert');
const test = require('node:test');
const { DecompressionStream, CompressionStream } = require('stream/web');

// Minimal gzip-compressed bytes for "hello"
const compressedGzip = new Uint8Array([
  31, 139, 8, 0, 0, 0, 0, 0, 0, 3,
  203, 72, 205, 201, 201, 7, 0, 134, 166, 16, 54, 5, 0, 0, 0,
]);

test('DecompressionStream accepts ArrayBuffer chunks', async () => {
  const ds = new DecompressionStream('gzip');
  const writer = ds.writable.getWriter();

  const writePromise = writer.write(compressedGzip.buffer);
  writer.close();

  const chunks = await Array.fromAsync(ds.readable);
  await writePromise;
  const out = Buffer.concat(chunks.map((c) => Buffer.from(c)));
  assert.strictEqual(out.toString(), 'hello');
});

test('CompressionStream round-trip with ArrayBuffer input', async () => {
  const cs = new CompressionStream('gzip');
  const ds = new DecompressionStream('gzip');

  const csWriter = cs.writable.getWriter();

  const input = new TextEncoder().encode('hello').buffer;

  await csWriter.write(input);
  csWriter.close();

  await cs.readable.pipeTo(ds.writable);

  const out = await Array.fromAsync(ds.readable);
  const result = Buffer.concat(out.map((c) => Buffer.from(c)));
  assert.strictEqual(result.toString(), 'hello');
});
Repository: nodejs/node
File: test/parallel/test-webstreams-compression-buffer-source.js (JavaScript)

Code before:
  const compressed = [];
  let done = false;
  while (!done) {
    const { value, done: d } = await csReader.read();
    if (value) compressed.push(value);
    done = d;
  }

  for (const chunk of compressed) await dsWriter.write(chunk);
  dsWriter.close();

  const out = [];
  done = false;
  while (!done) {
    const { value, done: d } = await dsReader.read();
    if (value) out.push(value);
    done = d;
  }
  const result = Buffer.concat(out.map((c) => Buffer.from(c)));
  assert.strictEqual(result.toString(), 'hello');
}

Promise.all([
  testDecompressionAcceptsArrayBuffer(),
  testCompressionRoundTripWithArrayBuffer(),
]).then(common.mustCall());


Review comment (suggestion):
These would be better off using the `node:test` machinery, which intrinsically handles asynchronous tests.

```js
const test = require('node:test');

test('DecompressionStream accepts ArrayBuffer chunks', async () => {
  ...
});
```

Code after:
'use strict';
require('../common');
const assert = require('assert');
const test = require('node:test');
const { DecompressionStream, CompressionStream } = require('stream/web');

// Minimal gzip-compressed bytes for "hello"
const compressedGzip = new Uint8Array([
  31, 139, 8, 0, 0, 0, 0, 0, 0, 3,
  203, 72, 205, 201, 201, 7, 0, 134, 166, 16, 54, 5, 0, 0, 0,
]);

test('DecompressionStream accepts ArrayBuffer chunks', async () => {
  const ds = new DecompressionStream('gzip');
  const writer = ds.writable.getWriter();

  const writePromise = writer.write(compressedGzip.buffer);
  writer.close();

  const chunks = await Array.fromAsync(ds.readable);
  await writePromise;
  const out = Buffer.concat(chunks.map((c) => Buffer.from(c)));
  assert.strictEqual(out.toString(), 'hello');
});

test('CompressionStream round-trip with ArrayBuffer input', async () => {
  const cs = new CompressionStream('gzip');
  const ds = new DecompressionStream('gzip');

  const csWriter = cs.writable.getWriter();

  const input = new TextEncoder().encode('hello').buffer;

  await csWriter.write(input);
  csWriter.close();

  await cs.readable.pipeTo(ds.writable);

  const out = await Array.fromAsync(ds.readable);
  const result = Buffer.concat(out.map((c) => Buffer.from(c)));
  assert.strictEqual(result.toString(), 'hello');
});
Repository: nodejs/node
File: test/parallel/test-webstreams-compression-buffer-source.js (JavaScript)

Code before:
'use strict';
const common = require('../common');
const assert = require('assert');
const { DecompressionStream, CompressionStream } = require('stream/web');

// Minimal gzip-compressed bytes for "hello"
const compressedGzip = new Uint8Array([
  31, 139, 8, 0, 0, 0, 0, 0, 0, 3,
  203, 72, 205, 201, 201, 7, 0, 134, 166, 16, 54, 5, 0, 0, 0,
]);

async function testDecompressionAcceptsArrayBuffer() {
  const ds = new DecompressionStream('gzip');
  const reader = ds.readable.getReader();
  const writer = ds.writable.getWriter();

  const writePromise = writer.write(compressedGzip.buffer);
  writer.close();

  const chunks = [];
  let done = false;
  while (!done) {
    const { value, done: d } = await reader.read();
    if (value) chunks.push(value);
    done = d;
  }
  await writePromise;
  const out = Buffer.concat(chunks.map((c) => Buffer.from(c)));
  assert.strictEqual(out.toString(), 'hello');
}

async function testCompressionRoundTripWithArrayBuffer() {
  const cs = new CompressionStream('gzip');
  const ds = new DecompressionStream('gzip');

  const csWriter = cs.writable.getWriter();
  const csReader = cs.readable.getReader();
  const dsWriter = ds.writable.getWriter();
  const dsReader = ds.readable.getReader();

  const input = new TextEncoder().encode('hello').buffer;

  await csWriter.write(input);
  csWriter.close();

  const compressed = [];
  let done = false;
  while (!done) {
    const { value, done: d } = await csReader.read();
    if (value) compressed.push(value);
    done = d;

Review comment (suggestion):
Nit: Similar to Mattias's comment, this iteration doesn't need to be done manually:

```suggestion
  const chunks = await Array.fromAsync(ds.readable);
```


Code after:
'use strict';
require('../common');
const assert = require('assert');
const test = require('node:test');
const { DecompressionStream, CompressionStream } = require('stream/web');

// Minimal gzip-compressed bytes for "hello"
const compressedGzip = new Uint8Array([
  31, 139, 8, 0, 0, 0, 0, 0, 0, 3,
  203, 72, 205, 201, 201, 7, 0, 134, 166, 16, 54, 5, 0, 0, 0,
]);

test('DecompressionStream accepts ArrayBuffer chunks', async () => {
  const ds = new DecompressionStream('gzip');
  const writer = ds.writable.getWriter();

  const writePromise = writer.write(compressedGzip.buffer);
  writer.close();

  const chunks = await Array.fromAsync(ds.readable);
  await writePromise;
  const out = Buffer.concat(chunks.map((c) => Buffer.from(c)));
  assert.strictEqual(out.toString(), 'hello');
});

test('CompressionStream round-trip with ArrayBuffer input', async () => {
  const cs = new CompressionStream('gzip');
  const ds = new DecompressionStream('gzip');

  const csWriter = cs.writable.getWriter();

  const input = new TextEncoder().encode('hello').buffer;

  await csWriter.write(input);
  csWriter.close();

  await cs.readable.pipeTo(ds.writable);

  const out = await Array.fromAsync(ds.readable);
  const result = Buffer.concat(out.map((c) => Buffer.from(c)));
  assert.strictEqual(result.toString(), 'hello');
});
Repository: nodejs/node
File: test/parallel/test-webstreams-compression-buffer-source.js (JavaScript)

Code before:
  await writePromise;
  const out = Buffer.concat(chunks.map((c) => Buffer.from(c)));
  assert.strictEqual(out.toString(), 'hello');
});

test('CompressionStream round-trip with ArrayBuffer input', async () => {
  const cs = new CompressionStream('gzip');
  const ds = new DecompressionStream('gzip');

  const csWriter = cs.writable.getWriter();
  const dsReader = ds.readable.getReader();

  const input = new TextEncoder().encode('hello').buffer;

  await csWriter.write(input);
  csWriter.close();

  await cs.readable.pipeTo(ds.writable);

  const out = [];
  let done = false;
  while (!done) {
    const { value, done: d } = await dsReader.read();
    if (value) out.push(value);
    done = d;
  }
  const result = Buffer.concat(out.map((c) => Buffer.from(c)));
  assert.strictEqual(result.toString(), 'hello');
});


Review comment (suggestion):
Nit-pick: you could also use `Array.fromAsync` here. 😉

Code after:
'use strict';
require('../common');
const assert = require('assert');
const test = require('node:test');
const { DecompressionStream, CompressionStream } = require('stream/web');

// Minimal gzip-compressed bytes for "hello"
const compressedGzip = new Uint8Array([
  31, 139, 8, 0, 0, 0, 0, 0, 0, 3,
  203, 72, 205, 201, 201, 7, 0, 134, 166, 16, 54, 5, 0, 0, 0,
]);

test('DecompressionStream accepts ArrayBuffer chunks', async () => {
  const ds = new DecompressionStream('gzip');
  const writer = ds.writable.getWriter();

  const writePromise = writer.write(compressedGzip.buffer);
  writer.close();

  const chunks = await Array.fromAsync(ds.readable);
  await writePromise;
  const out = Buffer.concat(chunks.map((c) => Buffer.from(c)));
  assert.strictEqual(out.toString(), 'hello');
});

test('CompressionStream round-trip with ArrayBuffer input', async () => {
  const cs = new CompressionStream('gzip');
  const ds = new DecompressionStream('gzip');

  const csWriter = cs.writable.getWriter();

  const input = new TextEncoder().encode('hello').buffer;

  await csWriter.write(input);
  csWriter.close();

  await cs.readable.pipeTo(ds.writable);

  const out = await Array.fromAsync(ds.readable);
  const result = Buffer.concat(out.map((c) => Buffer.from(c)));
  assert.strictEqual(result.toString(), 'hello');
});
Repository: novuhq/novu
File: apps/api/src/app/bridge/bridge.module.ts (TypeScript)

Code before:
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import {
  CreateChange,
  CreateMessageTemplate,
  CreateWorkflow,
  DeleteMessageTemplate,
  DeletePreferencesUseCase,
  DeleteWorkflowUseCase,
  GetPreferences,
  GetWorkflowByIdsUseCase,
  GetWorkflowWithPreferencesUseCase,
  ResourceValidatorService,
  TierRestrictionsValidateUsecase,
  UpdateChange,
  UpdateMessageTemplate,
  UpdateWorkflow,
  UpsertControlValuesUseCase,
  UpsertPreferences,
} from '@novu/application-generic';
import { CommunityOrganizationRepository, PreferencesRepository } from '@novu/dal';
import { SharedModule } from '../shared/shared.module';
import { BridgeController } from './bridge.controller';
import { USECASES } from './usecases';
import { BuildVariableSchemaUsecase } from '../workflows-v2/usecases';
import { ExtractVariables } from '../workflows-v2/usecases/extract-variables/extract-variables.usecase';
import { BuildStepIssuesUsecase } from '../workflows-v2/usecases/build-step-issues/build-step-issues.usecase';

const PROVIDERS = [
  CreateWorkflow,
  UpdateWorkflow,
  GetWorkflowByIdsUseCase,
  GetWorkflowWithPreferencesUseCase,
  DeleteWorkflowUseCase,
  UpsertControlValuesUseCase,
  CreateMessageTemplate,
  UpdateMessageTemplate,

Review comment (refactor):
when we use the `GetWorkflowByIdsUseCase` we don't always need to pull the preferences details so I decided to refactor it and create the `GetWorkflowWithPreferencesUseCase` class that pulls that information and use it in those specific places

Code after:
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import {
  CreateChange,
  CreateMessageTemplate,
  CreateWorkflow,
  DeleteMessageTemplate,
  DeletePreferencesUseCase,
  DeleteWorkflowUseCase,
  GetPreferences,
  GetWorkflowByIdsUseCase,
  GetWorkflowWithPreferencesUseCase,
  ResourceValidatorService,
  TierRestrictionsValidateUsecase,
  UpdateChange,
  UpdateMessageTemplate,
  UpdateWorkflow,
  UpsertControlValuesUseCase,
  UpsertPreferences,
} from '@novu/application-generic';
import { CommunityOrganizationRepository, PreferencesRepository } from '@novu/dal';
import { SharedModule } from '../shared/shared.module';
import { BridgeController } from './bridge.controller';
import { USECASES } from './usecases';
import { BuildVariableSchemaUsecase } from '../workflows-v2/usecases';
import { CreateVariablesObject } from '../workflows-v2/usecases/create-variables-object/create-variables-object.usecase';
import { BuildStepIssuesUsecase } from '../workflows-v2/usecases/build-step-issues/build-step-issues.usecase';

const PROVIDERS = [
  CreateWorkflow,
  UpdateWorkflow,
  GetWorkflowByIdsUseCase,
  GetWorkflowWithPreferencesUseCase,
  DeleteWorkflowUseCase,
  UpsertControlValuesUseCase,
  CreateMessageTemplate,
  UpdateMessageTemplate,
Repository: novuhq/novu
File: packages/shared/src/dto/workflows/workflow.dto.ts (TypeScript)

Code before:

export type UpdateWorkflowDto = WorkflowCommonsFields & {
  /**
   * We allow to update workflow id only for code first workflows
   */
  workflowId?: string;

  steps: (StepCreateDto | StepUpdateDto)[];

  preferences: PreferencesRequestDto;

  origin: WorkflowOriginEnum;
};

export type UpsertWorkflowBody = Omit<UpdateWorkflowDto, 'steps'> & {
  steps: UpsertStepBody[];
};

export type UpsertStepBody = StepCreateBody | UpdateStepBody;
export type StepCreateBody = StepCreateDto;
export type UpdateStepBody = StepUpdateDto;

export function isStepCreateBody(step: UpsertStepBody): step is StepCreateDto {
  return step && typeof step === 'object' && !(step as UpdateStepBody)._id;
}

export function isStepUpdateBody(step: UpsertStepBody): step is UpdateStepBody {
  return step && typeof step === 'object' && !!(step as UpdateStepBody)._id;
}


Review comment (refactor):
is ti possible to ask you to inline this to api class and add the relevant openapi and class validator decorators, if you won't i'll just have to do it right after you, just have it duplicated but the api should use it's own as a class decorated. the FE can use this for now until we sort out the dual build

Code after:

  preferences?: PreferencesRequestDto;
};

export type UpdateWorkflowDto = WorkflowCommonsFields & {
  /**
   * We allow to update workflow id only for code first workflows
   */
  workflowId?: string;

  steps: (StepCreateDto | StepUpdateDto)[];

  preferences: PreferencesRequestDto;

  origin: WorkflowOriginEnum;
};

export type UpsertWorkflowBody = Omit<UpdateWorkflowDto, 'steps'> & {
  steps: UpsertStepBody[];
};

export type UpsertStepBody = StepCreateBody | UpdateStepBody;
export type StepCreateBody = StepCreateDto;
export type UpdateStepBody = StepUpdateDto;

export type DuplicateWorkflowDto = Pick<CreateWorkflowDto, 'name' | 'tags' | 'description'>;

export function isStepCreateBody(step: UpsertStepBody): step is StepCreateDto {
  return step && typeof step === 'object' && !(step as UpdateStepBody)._id;
}

export function isStepUpdateBody(step: UpsertStepBody): step is UpdateStepBody {
  return step && typeof step === 'object' && !!(step as UpdateStepBody)._id;
}
Repository: novuhq/novu
File: apps/dashboard/src/components/conditions-editor/variable-select.tsx (TypeScript)

Code before:
            </InputWrapper>
          </InputRoot>
          {error && <span className="text-destructive text-xs">{error}</span>}
        </div>
      </PopoverAnchor>
      <PopoverContent
        className="min-w-[250px] max-w-[250px] p-0"
        side="bottom"
        align="start"
        onOpenAutoFocus={(e) => {
          // prevent the input from being blurred when the popover opens
          e.preventDefault();
        }}
        onFocusOutside={onClose}
      >
        {filteredOptions.length > 0 ? (
          <VariableList
            ref={variablesListRef}
            options={filteredOptions}
            onSelect={onSelect}
            selectedValue={value}
            title={title}
          />
        ) : (
          <div className="flex flex-col items-center justify-center p-4 text-center">
            <p className="text-foreground-600 text-sm">{emptyStateMessage?.primary ?? 'No variables available'}</p>
            <p className="text-foreground-400 mt-1 text-xs">
              {emptyStateMessage?.secondary ?? 'Add variables to your workflow to see them here'}
            </p>
          </div>
        )}
      </PopoverContent>
    </Popover>
  );
};


Review comment (suggestion):
```suggestion
            <p className="text-foreground-600 text-sm">{emptyStateMessage?.primary ?? 'Refine the key'}</p>
```

Code after:
            </InputWrapper>
          </InputRoot>
          {error && <span className="text-destructive text-xs">{error}</span>}
        </div>
      </PopoverAnchor>
      {filteredOptions.length > 0 && (
        <PopoverContent
          className="min-w-[250px] max-w-[250px] p-0"
          side="bottom"
          align="start"
          onOpenAutoFocus={(e) => {
            // prevent the input from being blurred when the popover opens
            e.preventDefault();
          }}
          onFocusOutside={onClose}
        >
          <VariableList
            ref={variablesListRef}
            options={filteredOptions}
            onSelect={onSelect}
            selectedValue={value}
            title={title}
          />
        </PopoverContent>
      )}

      {filteredOptions.length === 0 && !inputValue && (
        <PopoverContent
          className="min-w-[250px] max-w-[250px] p-0"
          side="bottom"
          align="start"
          onOpenAutoFocus={(e) => {
            // prevent the input from being blurred when the popover opens
            e.preventDefault();
          }}
          onFocusOutside={onClose}
        >
          <div className="flex flex-col items-center justify-center p-4 text-center">
            <p className="text-foreground-600 text-sm">{emptyStateMessage?.primary ?? 'Refine the key'}</p>
            <p className="text-foreground-400 mt-1 text-xs">
              {emptyStateMessage?.secondary ??
                'Type "payload." to specify a payload variable to refine the key further'}
            </p>
          </div>
        </PopoverContent>
      )}
    </Popover>
  );
};