'use client'
import { Button, buttonVariants } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import { useTranslation } from 'react-i18next'
import { CopyFeedback } from '@/app/components/base/copy-feedback'
import ShareQRCode from '@/app/components/base/qrcode'
import { AccessPointEndpoint } from './card'
type AccessPointUrlProps = {
enabled: boolean
label: string
unavailableLabel: string
value: string
copiedLabel?: string
copyDisabled?: boolean
copyLabel?: string
loading?: boolean
unavailable?: boolean
showOpen?: boolean
showQrCode?: boolean
showRegenerate?: boolean
openUrl?: string
onCopyError?: () => void
onRegenerate?: () => void
openDisabledReason?: string
openLabel?: string
qrCodeDownloadLabel?: string
qrCodeLabel?: string
qrCodeScanLabel?: string
regenerateLabel?: string
regenerateDisabled?: boolean
regenerating?: boolean
}
export function AccessPointUrl({
copiedLabel,
copyDisabled = false,
copyLabel,
enabled,
label,
loading = false,
onCopyError,
onRegenerate,
openDisabledReason,
openLabel,
openUrl,
qrCodeDownloadLabel,
qrCodeLabel,
qrCodeScanLabel,
regenerateDisabled = false,
regenerateLabel,
regenerating = false,
showOpen = false,
showQrCode = false,
showRegenerate = false,
unavailable = false,
unavailableLabel,
value,
}: AccessPointUrlProps) {
const { t } = useTranslation()
const detailsAvailable = !loading && !unavailable
const disabledOpenButton = (
)
const disabledOpenAction = openDisabledReason ? (