ecplayer 1.0.3 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,237 +1,113 @@
1
- (function(J,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],e):(J=typeof globalThis<"u"?globalThis:J||self,e(J.EcPlayer={},J.ReactJSXRuntime,J.React))})(this,function(J,e,r){"use strict";/**
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".ecp-full-width{width:100%}.ecp-h-full{height:100%}.ecp-relative{position:relative}.ecp-absolute{position:absolute}.ecp-inset-0{top:0;right:0;bottom:0;left:0}.ecp-z-10{z-index:10}.ecp-flex{display:flex}.ecp-inline-flex{display:inline-flex}.ecp-flex-col{flex-direction:column}.ecp-flex-wrap{flex-wrap:wrap}.ecp-flex-1{flex:1 1 0%}.ecp-flex-shrink-0{flex-shrink:0}.ecp-grid{display:grid}.ecp-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.ecp-hidden{display:none}.ecp-items-center{align-items:center}.ecp-items-end{align-items:flex-end}.ecp-items-start{align-items:flex-start}.ecp-justify-center{justify-content:center}.ecp-justify-between{justify-content:space-between}.ecp-justify-end{justify-content:flex-end}.ecp-justify-start{justify-content:flex-start}.ecp-text-center{text-align:center}.ecp-text-right{text-align:right}.ecp-self-center{align-self:center}.ecp-gap-1{gap:.25rem}.ecp-gap-2{gap:.5rem}.ecp-gap-3{gap:.75rem}.ecp-gap-px{gap:1px}.ecp-gap-05{gap:2px}.ecp-mb-1{margin-bottom:.25rem}.ecp-mb-2{margin-bottom:.5rem}.ecp-mb-4{margin-bottom:1rem}.ecp-mb-6{margin-bottom:1.5rem}.ecp-mr-2{margin-right:.5rem}.ecp-mt-4{margin-top:1rem}.ecp-mt-6{margin-top:1.5rem}.ecp-ml-auto{margin-left:auto}.ecp-p-1{padding:.25rem}.ecp-p-1-5{padding:.375rem}.ecp-p-2{padding:.5rem}.ecp-p-3{padding:.75rem}.ecp-p-4{padding:1rem}.ecp-p-6{padding:1.5rem}.ecp-p-8{padding:2rem}.ecp-px-2{padding-left:.5rem;padding-right:.5rem}.ecp-px-3{padding-left:.75rem;padding-right:.75rem}.ecp-px-4{padding-left:1rem;padding-right:1rem}.ecp-px-6{padding-left:1.5rem;padding-right:1.5rem}.ecp-py-1{padding-top:.25rem;padding-bottom:.25rem}.ecp-py-2{padding-top:.5rem;padding-bottom:.5rem}.ecp-py-3{padding-top:.75rem;padding-bottom:.75rem}.ecp-py-5{padding-top:1.25rem;padding-bottom:1.25rem}.ecp-pb-2{padding-bottom:.5rem}.ecp-pt-2{padding-top:.5rem}.ecp-w-1{width:.25rem}.ecp-w-3{width:.75rem}.ecp-w-4{width:1rem}.ecp-w-10{width:2.5rem}.ecp-w-12{width:3rem}.ecp-w-20{width:5rem}.ecp-w-24{width:6rem}.ecp-w-px{width:1px}.ecp-w-full{width:100%}.ecp-max-w-xs{max-width:20rem}.ecp-max-w-lg{max-width:32rem}.ecp-max-w-4xl{max-width:56rem}.ecp-h-0-5{height:.125rem}.ecp-h-1{height:.25rem}.ecp-h-1-5{height:.375rem}.ecp-h-2{height:.5rem}.ecp-h-3{height:.75rem}.ecp-h-4{height:1rem}.ecp-h-6{height:1.5rem}.ecp-h-8{height:2rem}.ecp-h-10{height:2.5rem}.ecp-h-12{height:3rem}.ecp-h-20{height:5rem}.ecp-h-40{width:10rem;height:40px}.ecp-h-64{height:16rem}.ecp-h-screen{height:100vh}.ecp-min-h-screen{min-height:100vh}.ecp-min-h-0{min-height:0}.ecp-min-w-12{min-width:3rem}.ecp-min-w-0{min-width:0}.ecp-aspect-square{aspect-ratio:1 / 1}.ecp-text-xs{font-size:.75rem;line-height:1rem}.ecp-text-sm{font-size:.875rem;line-height:1.25rem}.ecp-text-lg{font-size:1.125rem;line-height:1.75rem}.ecp-text-2xl{font-size:1.5rem;line-height:2rem}.ecp-font-medium{font-weight:500}.ecp-font-semibold{font-weight:600}.ecp-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.ecp-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ecp-text-white{color:#fff}.ecp-text-transparent{color:transparent}.ecp-text-gray-400{color:#9ca3af}.ecp-text-gray-500{color:#6b7280}.ecp-text-gray-600{color:#4b5563}.ecp-text-gray-700{color:#374151}.ecp-text-gray-800{color:#1f2937}.ecp-text-gray-100{color:#f3f4f6}.ecp-text-gray-200{color:#e5e7eb}.ecp-text-gray-300{color:#d1d5db}.ecp-text-red-500{color:#ef4444}.ecp-dark .ecp-text-dark-100{color:#f3f4f6}.ecp-dark .ecp-text-dark-200{color:#e5e7eb}.ecp-dark .ecp-text-dark-300{color:#d1d5db}.ecp-bg-white{background-color:#fff}.ecp-bg-black-20{background-color:#0003}.ecp-bg-black-30{background-color:#0000004d}.ecp-bg-black-40{background-color:#0006}.ecp-bg-black-50{background-color:#00000080}.ecp-bg-gray-100{background-color:#f3f4f6}.ecp-bg-gray-200{background-color:#e5e7eb}.ecp-bg-gray-300{background-color:#d1d5db}.ecp-bg-gray-700{background-color:#374151}.ecp-bg-gray-800{background-color:#1f2937}.ecp-bg-red-50{background-color:#fef2f2}.ecp-bg-transparent{background-color:transparent}.ecp-border{border-width:1px}.ecp-border-2{border-width:2px}.ecp-border-r{border-right-width:1px}.ecp-border-transparent{border-color:transparent}.ecp-border-gray-300{border-color:#d1d5db}.ecp-border-red-300{border-color:#fca5a5}.ecp-border-current{border-color:currentColor}.ecp-border-none{border:none}.ecp-outline-none{outline:none}.ecp-rounded{border-radius:.25rem}.ecp-rounded-lg{border-radius:.5rem}.ecp-rounded-xl{border-radius:.75rem}.ecp-rounded-2xl{border-radius:1rem}.ecp-rounded-full{border-radius:9999px}.ecp-rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.ecp-shadow-sm{box-shadow:0 1px 2px #0000000d}.ecp-shadow-lg{box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a}.ecp-shadow-2xl{box-shadow:0 25px 50px -12px #00000040}.ecp-opacity-20{opacity:.2}.ecp-opacity-40{opacity:.4}.ecp-opacity-70{opacity:.7}.ecp-opacity-80{opacity:.8}.ecp-cursor-pointer{cursor:pointer}.ecp-cursor-not-allowed{cursor:not-allowed}.ecp-pointer-events-none{pointer-events:none}.ecp-transition{transition-property:color,background-color,border-color,opacity,box-shadow,transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ecp-transition-all{transition:all .15s cubic-bezier(.4,0,.2,1)}.ecp-duration-75{transition-duration:75ms}.ecp-duration-100{transition-duration:.1s}.ecp-duration-150{transition-duration:.15s}.ecp-duration-300{transition-duration:.3s}.ecp-scale-0{transform:scale(0)}.ecp-translate-y-10{transform:translateY(2.5rem)}.ecp--translate-y-10{transform:translateY(-2.5rem)}.ecp-rotate-180{transform:rotate(180deg)}.ecp-hover-scale-105:hover{transform:scale(1.05)}.ecp-hover-scale-110:hover{transform:scale(1.1)}@keyframes ecp-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ecp-animation-spin{animation:ecp-spin 15s infinite linear}.ecp-object-contain{-o-object-fit:contain;object-fit:contain}.ecp-backdrop-blur-xl{-webkit-backdrop-filter:blur(24px);backdrop-filter:blur(24px)}.ecp-overflow-hidden{overflow:hidden}.ecp-top-0{top:0}.ecp-left-0{left:0}.ecp-fixed{position:fixed}.ecp-z-9999{z-index:9999}.ecp-appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.ecp-page-wrapper{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:1rem}@media (min-width: 768px){.ecp-page-wrapper{padding:2rem}}.ecp-demo-container{width:100%;height:100%}@media (min-width: 768px){.ecp-demo-container{height:auto;max-width:56rem}}.ecp-container-glass{border-radius:.75rem;padding:2rem}.ecp-demo-header{margin-bottom:1.5rem;display:flex;justify-content:space-between;align-items:flex-start}.ecp-demo-title{font-size:1.5rem;font-weight:600;color:#1f2937;margin-bottom:.25rem}.ecp-demo-title--dark{color:#e5e7eb}.ecp-demo-subtitle{font-size:.875rem;color:#6b7280}.ecp-theme-btn{background:#fff;border:1px solid #d1d5db;color:#374151;padding:.5rem 1rem;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:.5rem}.ecp-theme-btn:hover{background:#f9fafb}.ecp-demo-actions{margin-top:1.5rem;display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.ecp-action-btn{background:#fff;border:1px solid #d1d5db;color:#374151;padding:.5rem 1.5rem;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:.5rem}.ecp-action-btn:hover{background:#f9fafb}.ecp-file-input-hidden{display:none}.ecp-theme-selector-panel{border-radius:.75rem;padding:1.5rem;margin-bottom:1.5rem}.ecp-theme-selector-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.ecp-theme-selector-title{font-size:1.125rem;font-weight:600;color:#1f2937}.ecp-theme-selector-close{color:#6b7280;font-size:.875rem;font-weight:500;background:none;border:none;cursor:pointer}.ecp-theme-selector-close:hover{color:#374151}.ecp-theme-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem}@media (min-width: 640px){.ecp-theme-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width: 768px){.ecp-theme-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}.ecp-theme-card{background:#fff;padding:1rem;border-radius:.5rem;cursor:pointer;border:2px solid transparent;transition:all .15s cubic-bezier(.4,0,.2,1)}.ecp-theme-card--active{border-color:currentColor;box-shadow:0 10px 15px -3px #0000001a}.ecp-theme-color-preview{height:2.5rem;border-radius:.25rem;margin-bottom:.5rem}.ecp-theme-name{font-size:.875rem;font-weight:500;color:#374151}.ecp-vp-wrapper{width:100%;border-radius:.75rem;overflow:hidden}.ecp-vp-bg{padding:1rem}.ecp-vp-vu-outer{position:relative}.ecp-vp-vu-bg{border-radius:.5rem;margin-bottom:1.5rem;padding:1rem;box-shadow:0 1px 2px #0000000d}.ecp-vp-vu-bg--light{background:#ffffffb3}.ecp-vp-vu-bg--dark{background:#0006}.ecp-vp-vu-bg--transparent{background:transparent!important;padding:0!important;box-shadow:none!important}.ecp-vp-vu-bg--dimmed{opacity:.3}.ecp-vp-vu-bg--no-margin{margin-bottom:0}.ecp-vp-vu-bars{display:flex;justify-content:center;align-items:flex-end;gap:.25rem;height:16rem}.ecp-vp-eq-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;width:100%;justify-content:center;z-index:10;border-radius:.5rem;padding:1rem;box-shadow:0 1px 2px #0000000d;transition:all .3s cubic-bezier(.4,0,.2,1)}.ecp-vp-eq-overlay--light{background:#fffc}.ecp-vp-eq-overlay--dark{background:#00000080}.ecp-vp-eq-title{font-size:.875rem;font-weight:500;margin-bottom:1rem}.ecp-vp-eq-title--light{color:#374151}.ecp-vp-eq-title--dark{color:#e5e7eb}.ecp-vp-eq-bands{display:flex;flex-direction:column;gap:1rem}.ecp-vp-eq-band-header{display:flex;justify-content:space-between;margin-bottom:.25rem}.ecp-vp-eq-band-label{font-size:.75rem}.ecp-vp-eq-band-label--light{color:#4b5563}.ecp-vp-eq-band-label--dark{color:#d1d5db}.ecp-vp-eq-band-range{display:flex;align-items:center;gap:.75rem}.ecp-vp-eq-range-bound{font-size:.75rem}.ecp-vp-eq-range-bound--light{color:#6b7280}.ecp-vp-eq-range-bound--dark{color:#9ca3af}.ecp-vp-eq-slider{flex:1;height:2rem;background:#d1d5db;border-radius:.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}.ecp-vp-eq-slider::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:0;height:0;background:transparent;border:none;box-shadow:none}.ecp-vp-eq-slider::-moz-range-thumb{width:0;height:0;background:transparent;border:none;box-shadow:none}.ecp-vp-eq-footer{display:flex;justify-content:flex-end;margin-top:1rem}.ecp-vp-eq-reset{padding:.25rem .75rem;border-radius:.25rem;font-size:.75rem;cursor:pointer;transition:all .15s;border:none}.ecp-vp-eq-reset--light{background:#e5e7eb;color:#374151}.ecp-vp-eq-reset--light:hover{background:#d1d5db}.ecp-vp-eq-reset--dark{background:#374151;color:#e5e7eb}.ecp-vp-eq-reset--dark:hover{background:#4b5563}.ecp-vp-track{margin-bottom:1.5rem;display:flex;align-items:center}.ecp-vp-thumbnail-wrap{margin-right:.5rem;width:3rem;flex-shrink:0}.ecp-vp-thumbnail{height:3rem;width:3rem;border-radius:9999px}.ecp-vp-track-info{width:100%;min-width:0}.ecp-vp-track-name{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ecp-vp-track-name--light{color:#374151}.ecp-vp-track-name--dark{color:#f3f4f6}.ecp-vp-track-author{font-size:.75rem}.ecp-vp-track-author--light{color:#6b7280}.ecp-vp-track-author--dark{color:#d1d5db}.ecp-vp-seekbar{margin-bottom:1.5rem}.ecp-vp-seekbar-row{display:flex;align-items:center;gap:.25rem}.ecp-vp-time{font-size:.75rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;width:3rem}.ecp-vp-time--right{text-align:right}.ecp-vp-time--light{color:#4b5563}.ecp-vp-time--dark{color:#f3f4f6}.ecp-vp-seek-input{flex:1;height:.5rem;background:#e5e7eb;border-radius:.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}.ecp-vp-seek-input:disabled{opacity:.4;cursor:not-allowed}.ecp-vp-seek-input::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 2px 6px #0003}.ecp-vp-seek-input::-moz-range-thumb{width:16px;height:16px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 2px 6px #0003}.ecp-vp-controls{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.ecp-vp-controls--sm{gap:.5rem}.ecp-vp-play-btn{padding:.5rem 1rem;min-width:6rem;border-radius:9999px;font-size:.875rem;font-weight:500;color:#fff;border:none;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:opacity .15s}.ecp-vp-play-btn:hover{opacity:.9}.ecp-vp-play-btn:disabled{opacity:.4;cursor:not-allowed}.ecp-vp-play-btn--compact{padding:1.25rem .75rem;min-width:unset}.ecp-vp-play-icon-wrap{position:relative;width:1rem;display:flex;align-items:center}.ecp-vp-stop-btn{padding:.75rem;border-radius:9999px;font-size:.875rem;font-weight:500;border:none;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:all .15s}.ecp-vp-stop-btn--light{background:#374151;color:#fff}.ecp-vp-stop-btn--light:hover{background:#1f2937}.ecp-vp-stop-btn--dark{background:#f3f4f6;color:#000}.ecp-vp-stop-btn--dark:hover{background:#d1d5db}.ecp-vp-stop-btn:disabled{opacity:.4;cursor:not-allowed}.ecp-vp-stop-btn--wide{padding:.5rem 1rem}.ecp-vp-eq-btn{padding:.75rem;border-radius:9999px;font-size:.875rem;font-weight:500;border:none;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:all .15s}.ecp-vp-eq-btn--off{background:#f3f4f6;color:#374151}.ecp-vp-eq-btn--off:hover{background:#d1d5db}.ecp-vp-eq-btn--on{color:#fff}.ecp-vp-eq-btn:disabled{opacity:.4;cursor:not-allowed}.ecp-vp-eq-btn--wide{padding:.5rem 1rem}.ecp-vp-loop-btn{padding:.75rem;border-radius:9999px;font-size:.875rem;font-weight:500;border:none;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:all .15s}.ecp-vp-loop-btn--off{background:#f3f4f6;color:#374151}.ecp-vp-loop-btn--off:hover{background:#d1d5db}.ecp-vp-loop-btn--on{color:#fff}.ecp-vp-loop-btn:disabled{opacity:.4;cursor:not-allowed}.ecp-vp-loop-btn--wide{padding:.5rem 1rem}.ecp-vp-loop-icon--active{transform:rotate(180deg)}.ecp-vp-speed-wrap{display:flex;align-items:center}.ecp-vp-speed-select{border-radius:9999px;font-size:.875rem;font-weight:500;border:none;outline:none;cursor:pointer;transition:all .15s;background:transparent}.ecp-vp-speed-select--light{color:#1f2937}.ecp-vp-speed-select--dark{color:#e5e7eb}.ecp-vp-speed-option--light{background:#fff;color:#1f2937}.ecp-vp-speed-option--dark{background:#1f2937;color:#f3f4f6}.ecp-vp-volume{display:flex;align-items:center;gap:.25rem;margin-left:auto}@media (min-width: 768px){.ecp-vp-volume{gap:.75rem}}.ecp-vp-mute-btn{padding:.5rem;border-radius:9999px;background:none;border:none;cursor:pointer;transition:all .15s}.ecp-vp-mute-btn:hover{background:#f3f4f680}.ecp-vp-mute-icon--light{color:#4b5563}.ecp-vp-mute-icon--dark{color:#f3f4f6}.ecp-vp-volume-slider{width:6rem;height:.5rem;border-radius:.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}.ecp-vp-volume-slider::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 2px 6px #0003}.ecp-vp-volume-slider::-moz-range-thumb{width:16px;height:16px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 2px 6px #0003}@media (max-width: 460px){.ecp-vp-volume-slider{display:none}}.ecp-vp-volume-pct{font-size:.75rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;width:2.5rem;text-align:right}.ecp-vp-volume-pct--light{color:#374151}.ecp-vp-volume-pct--dark{color:#f3f4f6}.ecp-vp-error{font-size:.875rem;color:#ef4444;background:#fef2f2;padding:.75rem;border-radius:.25rem;margin-bottom:1rem;border:1px solid #fca5a5}.ecp-wave-outer{width:100%;max-width:32rem;position:relative}.ecp-wave-audio-el{display:none}.ecp-wave-card{border-radius:1rem;box-shadow:0 25px 50px -12px #00000040}.ecp-wave-card-inner{border-radius:1rem;padding:1.5rem;-webkit-backdrop-filter:blur(24px);backdrop-filter:blur(24px)}.ecp-wave-thumbnail-wrap{width:100%;padding:1rem}.ecp-wave-thumbnail{width:100%;aspect-ratio:1 / 1;border-radius:.75rem}.ecp-wave-seek{position:relative;height:5rem;margin-bottom:1.5rem;cursor:pointer}.ecp-wave-bars{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:flex-end;justify-content:center;height:100%;width:100%;gap:1px}.ecp-wave-bar{width:.25rem;border-radius:.25rem .25rem 0 0;transition:all .15s}.ecp-wave-progress-line{position:absolute;top:0;height:100%;width:.25rem;background:#fff;border-right:1px solid black;border-radius:9999px;transition:all .15s;transform:translate(-50%)}.ecp-wave-times{display:flex;justify-content:space-between;font-size:.875rem;margin-bottom:1.5rem}.ecp-wave-controls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:center;justify-content:space-between;margin-bottom:1rem}.ecp-wave-left-controls{display:flex;align-items:center;gap:.5rem}.ecp-wave-vol-btn{padding:.5rem;border-radius:9999px;border:none;cursor:pointer;transition:all .15s}.ecp-wave-vol-slider{width:5rem;height:.375rem;border-radius:.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}.ecp-wave-vol-slider::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 1px 3px #0003}.ecp-wave-vol-slider::-moz-range-thumb{width:14px;height:14px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none}.ecp-wave-center-controls{display:flex;justify-content:center}.ecp-wave-play-btn{padding:1rem;border-radius:9999px;border:none;cursor:pointer;transition:all .15s;box-shadow:0 10px 15px -3px #0000001a}.ecp-wave-play-btn:hover{transform:scale(1.05)}.ecp-wave-right-controls{display:flex;align-items:center;gap:.75rem}.ecp-wave-speed-select{padding:.25rem .5rem;border-radius:.5rem;font-size:.875rem;border:none;cursor:pointer}.ecp-wave-speed-select--light{background:#f3f4f6;color:#374151}.ecp-wave-speed-select--dark{background:#1f2937;color:#f3f4f6}.ecp-wave-eq-btn{padding:.5rem;border-radius:9999px;border:none;cursor:pointer;transition:all .15s}.ecp-wave-eq-overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:#0003;display:flex;align-items:center;justify-content:center;z-index:10;border-radius:1rem;padding:1rem}.ecp-wave-eq-panel{max-width:20rem;width:100%;padding:.5rem 1rem 1rem;border-radius:.75rem}.ecp-wave-eq-panel--light{background:#fff}.ecp-wave-eq-panel--dark{background:#1f2937}.ecp-wave-eq-title{font-size:1.125rem;font-weight:500;margin-bottom:.5rem}.ecp-wave-eq-title--light{color:#374151}.ecp-wave-eq-title--dark{color:#e5e7eb}.ecp-wave-eq-bands{display:flex;flex-direction:column;gap:1rem}.ecp-wave-eq-band-header{display:flex;justify-content:space-between;margin-bottom:.25rem}.ecp-wave-eq-label--light{font-size:.75rem;color:#4b5563}.ecp-wave-eq-label--dark{font-size:.75rem;color:#d1d5db}.ecp-wave-eq-range-row{display:flex;align-items:center;gap:.75rem}.ecp-wave-eq-bound--light{font-size:.75rem;color:#6b7280}.ecp-wave-eq-bound--dark{font-size:.75rem;color:#9ca3af}.ecp-wave-eq-slider{flex:1;height:1rem;background:#d1d5db;border-radius:.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}.ecp-wave-eq-slider::-webkit-slider-thumb{-webkit-appearance:none;width:0;height:0;background:transparent;border:none;box-shadow:none}.ecp-wave-eq-slider::-moz-range-thumb{width:0;height:0;background:transparent;border:none}.ecp-wave-eq-footer{display:flex;justify-content:space-between;margin-top:1.5rem}.ecp-wave-eq-footer-btn{padding:.25rem .75rem;border-radius:.25rem;font-size:.75rem;cursor:pointer;border:none;transition:all .15s}.ecp-wave-eq-footer-btn--light{background:#e5e7eb;color:#374151}.ecp-wave-eq-footer-btn--light:hover{background:#d1d5db}.ecp-wave-eq-footer-btn--dark{background:#374151;color:#e5e7eb}.ecp-wave-eq-footer-btn--dark:hover{background:#4b5563}.ecp-wave-error{padding:1.5rem;border-radius:.75rem;text-align:center}.ecp-wave-error-title{font-weight:500}.ecp-wave-error-msg{font-size:.875rem}.ecp-wave-error--light{color:#dc2626}.ecp-wave-error--dark{color:#fca5a5}.ecp-nano-wrapper{position:relative;overflow:hidden;display:inline-flex;flex-direction:column;padding:.5rem .75rem;box-shadow:0 10px 15px -3px #0000001a}.ecp-nano-wrapper--pill{border-radius:9999px;width:110px;height:40px}.ecp-nano-wrapper--card{border-radius:1rem;width:120px;height:150px}.ecp-nano-progress-bg{position:absolute;top:0;left:0;height:100%;opacity:.2}.ecp-nano-content{position:absolute;display:flex;flex-direction:column}.ecp-nano-thumbnail-wrap{width:6rem;padding-bottom:.5rem}.ecp-nano-thumbnail{width:6rem;aspect-ratio:1 / 1;border-radius:.75rem}.ecp-nano-row{display:flex;align-items:center;gap:.5rem}.ecp-nano-play-btn{padding:.375rem;border-radius:9999px;border:none;cursor:pointer;flex-shrink:0;transition:transform .15s}.ecp-nano-play-btn:hover{transform:scale(1.1)}.ecp-nano-waveform{display:flex;width:100%;min-width:3rem;align-items:center;gap:2px;height:1.5rem}.ecp-nano-wave-bar{border-radius:9999px;width:100%;transition:height .2s}.ecp-video-wrapper{border-radius:.75rem;overflow:hidden;transition:all .3s cubic-bezier(.4,0,.2,1)}.ecp-video-wrapper--fullscreen{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;display:flex;flex-direction:column;height:100vh;width:100vw;background:#000}.ecp-video-inner{height:auto}.ecp-video-inner--fullscreen{display:flex;flex-direction:column;flex:1;min-height:0}.ecp-video-inner--padded{padding:1rem}.ecp-video-name{margin-bottom:1rem;font-weight:500}.ecp-video-name--light{color:#374151}.ecp-video-name--dark{color:#f3f4f6}.ecp-video-layout{position:relative;margin-bottom:1rem}.ecp-video-layout--row{display:flex;gap:.75rem}.ecp-video-layout--col{display:flex;flex-direction:column;gap:.75rem}.ecp-video-layout--fullscreen{flex:1;min-height:0}.ecp-video-vu-top,.ecp-video-vu-bottom{width:100%;height:3rem}.ecp-video-vu-side{width:3rem;background:#00000080;border-radius:.5rem;padding:.25rem}.ecp-video-el-wrap{flex:1;border-radius:.5rem;overflow:hidden;position:relative}.ecp-video-el-wrap--light{background:#ffffffb3}.ecp-video-el-wrap--dark{background:#000000b3}.ecp-video-el{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.ecp-video-eq-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;width:100%;justify-content:center;z-index:10;border-radius:.5rem;padding:1rem;box-shadow:0 1px 2px #0000000d;transition:all .3s}.ecp-video-eq-panel{max-width:600px;width:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:center;border-radius:.5rem;padding:1rem;box-shadow:0 1px 2px #0000000d;transition:all .3s}.ecp-video-eq-panel--light{background:#fffc}.ecp-video-eq-panel--dark{background:#000000b3}.ecp-video-eq-title{font-size:.875rem;font-weight:500;margin-bottom:1rem}.ecp-video-eq-title--light{color:#374151}.ecp-video-eq-title--dark{color:#e5e7eb}.ecp-video-eq-bands{display:flex;flex-direction:column;gap:1rem}.ecp-video-eq-band-header{display:flex;justify-content:space-between;margin-bottom:.25rem}.ecp-video-eq-label--light{font-size:.75rem;color:#4b5563}.ecp-video-eq-label--dark{font-size:.75rem;color:#d1d5db}.ecp-video-eq-range-row{display:flex;align-items:center;gap:.75rem}.ecp-video-eq-bound--light{font-size:.75rem;color:#6b7280}.ecp-video-eq-bound--dark{font-size:.75rem;color:#9ca3af}.ecp-video-eq-slider{flex:1;height:1.5rem;background:#d1d5db;border-radius:.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}.ecp-video-eq-slider::-webkit-slider-thumb{-webkit-appearance:none;width:0;height:0;background:transparent;border:none;box-shadow:none}.ecp-video-eq-slider::-moz-range-thumb{width:0;height:0;background:transparent;border:none}.ecp-video-eq-footer{display:flex;justify-content:space-between;margin-top:1.5rem}.ecp-video-eq-footer-btn{padding:.25rem .75rem;border-radius:.25rem;font-size:.75rem;cursor:pointer;border:none;transition:all .15s}.ecp-video-eq-footer-btn--light{background:#e5e7eb;color:#374151}.ecp-video-eq-footer-btn--light:hover{background:#d1d5db}.ecp-video-eq-footer-btn--dark{background:#374151;color:#e5e7eb}.ecp-video-eq-footer-btn--dark:hover{background:#4b5563}.ecp-video-seekbar{margin-bottom:1rem}.ecp-video-seekbar--fullscreen{margin-top:.75rem}.ecp-video-seekbar-row{display:flex;align-items:center;gap:.75rem}.ecp-video-time{font-size:.75rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;width:3rem}.ecp-video-time--right{text-align:right}.ecp-video-time--light{color:#4b5563}.ecp-video-time--dark{color:#f3f4f6}.ecp-video-seek-input{flex:1;height:.5rem;border-radius:.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}.ecp-video-seek-input:disabled{opacity:.4;cursor:not-allowed}.ecp-video-seek-input::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 2px 6px #0003}.ecp-video-seek-input::-moz-range-thumb{width:16px;height:16px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 2px 6px #0003}.ecp-video-controls{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.ecp-video-play-btn{border-radius:9999px;font-size:.875rem;font-weight:500;color:#fff;border:none;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:opacity .15s;padding:.5rem 1rem}.ecp-video-play-btn:hover{opacity:.9}.ecp-video-play-btn:disabled{opacity:.4;cursor:not-allowed}.ecp-video-play-btn--compact{padding:1.25rem .75rem}.ecp-video-play-icon-wrap{position:relative;width:1rem;display:flex;align-items:center}.ecp-video-stop-btn{padding:.75rem;border-radius:9999px;font-size:.875rem;font-weight:500;border:none;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:all .15s}.ecp-video-stop-btn--light{background:#374151;color:#fff}.ecp-video-stop-btn--light:hover{background:#1f2937}.ecp-video-stop-btn--dark{background:#f3f4f6;color:#000}.ecp-video-stop-btn--dark:hover{background:#d1d5db}.ecp-video-stop-btn:disabled{opacity:.4;cursor:not-allowed}.ecp-video-fullscreen-btn{border-radius:9999px;font-size:.875rem;font-weight:500;border:none;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:all .15s;padding:.75rem}.ecp-video-fullscreen-btn--light{background:#374151;color:#fff}.ecp-video-fullscreen-btn--light:hover{background:#1f2937}.ecp-video-fullscreen-btn--dark{background:#f3f4f6;color:#000}.ecp-video-fullscreen-btn--dark:hover{background:#d1d5db}.ecp-video-fullscreen-btn--wide{padding:.5rem 1rem}.ecp-video-eq-toggle-btn{padding:.75rem;border-radius:9999px;font-size:.875rem;font-weight:500;border:none;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:all .15s}.ecp-video-eq-toggle-btn--off{background:#f3f4f6;color:#374151}.ecp-video-eq-toggle-btn--off:hover{background:#d1d5db}.ecp-video-eq-toggle-btn--on{color:#fff}.ecp-video-eq-toggle-btn:disabled{opacity:.4;cursor:not-allowed}.ecp-video-eq-toggle-btn--wide{padding:.5rem 1rem}.ecp-video-speed-wrap{display:flex;align-items:center}.ecp-video-speed-select{border-radius:9999px;font-size:.875rem;font-weight:500;border:none;outline:none;cursor:pointer;background:transparent;transition:all .15s}.ecp-video-speed-select--light{color:#1f2937}.ecp-video-speed-select--dark{color:#e5e7eb}.ecp-video-speed-option--light{background:#f3f4f6;color:#1f2937}.ecp-video-speed-option--dark{background:#1f2937;color:#f3f4f6}.ecp-video-volume{display:flex;align-items:center;gap:.25rem;margin-left:auto}@media (min-width: 768px){.ecp-video-volume{gap:.75rem}}.ecp-video-mute-btn{padding:.5rem;border-radius:.5rem;background:none;border:none;cursor:pointer;transition:all .15s}.ecp-video-mute-btn:hover{background:#f3f4f6}.ecp-video-mute-icon--light{color:#4b5563}.ecp-video-mute-icon--dark{color:#f3f4f6}.ecp-video-vol-slider{width:6rem;height:.5rem;border-radius:.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}.ecp-video-vol-slider::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 2px 6px #0003}.ecp-video-vol-slider::-moz-range-thumb{width:16px;height:16px;border-radius:50%;cursor:pointer;background:var(--thumb-color, #ffffff);border:none;box-shadow:0 2px 6px #0003}@media (max-width: 460px){.ecp-video-vol-slider{display:none}}.ecp-video-vol-pct{font-size:.75rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;width:2.5rem;text-align:right}.ecp-video-vol-pct--light{color:#374151}.ecp-video-vol-pct--dark{color:#f3f4f6}.ecp-video-error{font-size:.875rem;color:#ef4444;background:#fef2f2;padding:.75rem;border-radius:.25rem;margin-bottom:1rem;border:1px solid #fca5a5}.ecp-vu-bar-wrap{flex:1;height:100%;position:relative;display:flex;flex-direction:column;justify-content:flex-end}.ecp-vu-bar-fill{border-radius:.25rem .25rem 0 0;transition:height 75ms}.ecp-vu-peak-line{position:absolute;width:100%;height:2px;transition:top .1s}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ (function(Z,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],e):(Z=typeof globalThis<"u"?globalThis:Z||self,e(Z.EcPlayer={},Z.ReactJSXRuntime,Z.React))})(this,function(Z,e,t){"use strict";/**
2
3
  * @license lucide-react v0.540.0 - ISC
3
4
  *
4
5
  * This source code is licensed under the ISC license.
5
6
  * See the LICENSE file in the root directory of this source tree.
6
- */const Qe=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ge=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,f,p)=>p?p.toUpperCase():f.toLowerCase()),Ie=o=>{const c=Ge(o);return c.charAt(0).toUpperCase()+c.slice(1)},He=(...o)=>o.filter((c,f,p)=>!!c&&c.trim()!==""&&p.indexOf(c)===f).join(" ").trim(),Ke=o=>{for(const c in o)if(c.startsWith("aria-")||c==="role"||c==="title")return!0};/**
7
+ */const Ke=c=>c.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xe=c=>c.replace(/^([A-Z])|[\s-_]+(\w)/g,(i,u,v)=>v?v.toUpperCase():u.toLowerCase()),Oe=c=>{const i=Xe(c);return i.charAt(0).toUpperCase()+i.slice(1)},Ue=(...c)=>c.filter((i,u,v)=>!!i&&i.trim()!==""&&v.indexOf(i)===u).join(" ").trim(),Ze=c=>{for(const i in c)if(i.startsWith("aria-")||i==="role"||i==="title")return!0};/**
7
8
  * @license lucide-react v0.540.0 - ISC
8
9
  *
9
10
  * This source code is licensed under the ISC license.
10
11
  * See the LICENSE file in the root directory of this source tree.
11
- */var Xe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
12
+ */var Je={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
12
13
  * @license lucide-react v0.540.0 - ISC
13
14
  *
14
15
  * This source code is licensed under the ISC license.
15
16
  * See the LICENSE file in the root directory of this source tree.
16
- */const Ze=r.forwardRef(({color:o="currentColor",size:c=24,strokeWidth:f=2,absoluteStrokeWidth:p,className:N="",children:g,iconNode:b,...x},q)=>r.createElement("svg",{ref:q,...Xe,width:c,height:c,stroke:o,strokeWidth:p?Number(f)*24/Number(c):f,className:He("lucide",N),...!g&&!Ke(x)&&{"aria-hidden":"true"},...x},[...b.map(([E,O])=>r.createElement(E,O)),...Array.isArray(g)?g:[g]]));/**
17
+ */const Re=t.forwardRef(({color:c="currentColor",size:i=24,strokeWidth:u=2,absoluteStrokeWidth:v,className:N="",children:f,iconNode:m,...D},q)=>t.createElement("svg",{ref:q,...Je,width:i,height:i,stroke:c,strokeWidth:v?Number(u)*24/Number(i):u,className:Ue("lucide",N),...!f&&!Ze(D)&&{"aria-hidden":"true"},...D},[...m.map(([P,j])=>t.createElement(P,j)),...Array.isArray(f)?f:[f]]));/**
17
18
  * @license lucide-react v0.540.0 - ISC
18
19
  *
19
20
  * This source code is licensed under the ISC license.
20
21
  * See the LICENSE file in the root directory of this source tree.
21
- */const ae=(o,c)=>{const f=r.forwardRef(({className:p,...N},g)=>r.createElement(Ze,{ref:g,iconNode:c,className:He(`lucide-${Qe(Ie(o))}`,`lucide-${o}`,p),...N}));return f.displayName=Ie(o),f};/**
22
+ */const ae=(c,i)=>{const u=t.forwardRef(({className:v,...N},f)=>t.createElement(Re,{ref:f,iconNode:i,className:Ue(`lucide-${Ke(Oe(c))}`,`lucide-${c}`,v),...N}));return u.displayName=Oe(c),u};/**
22
23
  * @license lucide-react v0.540.0 - ISC
23
24
  *
24
25
  * This source code is licensed under the ISC license.
25
26
  * See the LICENSE file in the root directory of this source tree.
26
- */const Je=ae("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
27
+ */const et=ae("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
27
28
  * @license lucide-react v0.540.0 - ISC
28
29
  *
29
30
  * This source code is licensed under the ISC license.
30
31
  * See the LICENSE file in the root directory of this source tree.
31
- */const Ye=ae("minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/**
32
+ */const tt=ae("minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/**
32
33
  * @license lucide-react v0.540.0 - ISC
33
34
  *
34
35
  * This source code is licensed under the ISC license.
35
36
  * See the LICENSE file in the root directory of this source tree.
36
- */const $e=ae("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);/**
37
+ */const qe=ae("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);/**
37
38
  * @license lucide-react v0.540.0 - ISC
38
39
  *
39
40
  * This source code is licensed under the ISC license.
40
41
  * See the LICENSE file in the root directory of this source tree.
41
- */const Ee=ae("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);/**
42
+ */const $e=ae("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);/**
42
43
  * @license lucide-react v0.540.0 - ISC
43
44
  *
44
45
  * This source code is licensed under the ISC license.
45
46
  * See the LICENSE file in the root directory of this source tree.
46
- */const Re=ae("repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
47
+ */const rt=ae("repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
47
48
  * @license lucide-react v0.540.0 - ISC
48
49
  *
49
50
  * This source code is licensed under the ISC license.
50
51
  * See the LICENSE file in the root directory of this source tree.
51
- */const Ce=ae("sliders-vertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
52
+ */const Ee=ae("sliders-vertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
52
53
  * @license lucide-react v0.540.0 - ISC
53
54
  *
54
55
  * This source code is licensed under the ISC license.
55
56
  * See the LICENSE file in the root directory of this source tree.
56
- */const De=ae("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
57
+ */const Ve=ae("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
57
58
  * @license lucide-react v0.540.0 - ISC
58
59
  *
59
60
  * This source code is licensed under the ISC license.
60
61
  * See the LICENSE file in the root directory of this source tree.
61
- */const et=ae("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);/**
62
+ */const nt=ae("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);/**
62
63
  * @license lucide-react v0.540.0 - ISC
63
64
  *
64
65
  * This source code is licensed under the ISC license.
65
66
  * See the LICENSE file in the root directory of this source tree.
66
- */const Ae=ae("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
67
+ */const Fe=ae("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
67
68
  * @license lucide-react v0.540.0 - ISC
68
69
  *
69
70
  * This source code is licensed under the ISC license.
70
71
  * See the LICENSE file in the root directory of this source tree.
71
- */const je=ae("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),oe={rainbow:{name:"Rainbow",bg:"linear-gradient(135deg, #ef444422 0%, #f9731622 15%, #f59e0b22 30%, #10b98122 45%, #06b6d422 60%, #3b82f622 75%, #6366f122 85%, #a855f722 92%, #ec489922 100%)",bars:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e"],peak:"#a0a0a0ff",button:"#ec4899",buttonHover:"#d946ef",slider:"#ec4899"},ocean:{name:"Ocean Blue",bg:"linear-gradient(135deg, #667eea43 0%, #764ba243 100%)",bars:["#0ea5e9","#38bdf8","#06b6d4","#22d3ee"],peak:"#0369a1",button:"#0ea5e9",buttonHover:"#0284c7",slider:"#0ea5e9"},sunset:{name:"Sunset",bg:"linear-gradient(135deg, #f093fb43 0%, #f5576c43 100%)",bars:["#f43f5e","#fb7185","#fda4af","#fecdd3"],peak:"#be123c",button:"#f43f5e",buttonHover:"#e11d48",slider:"#f43f5e"},forest:{name:"Forest Green",bg:"linear-gradient(135deg, #0ba36043 0%, #3cba9243 100%)",bars:["#10b981","#34d399","#6ee7b7","#a7f3d0"],peak:"#047857",button:"#10b981",buttonHover:"#059669",slider:"#10b981"},midnight:{name:"Midnight",bg:"linear-gradient(135deg, #2c3e5043 0%, #3498db43 100%)",bars:["#3b82f6","#60a5fa","#93c5fd","#bfdbfe"],peak:"#1e40af",button:"#3b82f6",buttonHover:"#2563eb",slider:"#3b82f6"},neon:{name:"Neon Cyan",bg:"linear-gradient(135deg, #13547a43 0%, #80d0c743 100%)",bars:["#06b6d4","#22d3ee","#67e8f9","#a5f3fc"],peak:"#0e7490",button:"#06b6d4",buttonHover:"#0891b2",slider:"#06b6d4"},purple:{name:"Royal Purple",bg:"linear-gradient(135deg, #2f1c5622 0%, #764ba243 100%)",bars:["#8b5cf6","#a78bfa","#baabf9ff","#ddd6fe"],peak:"#6d28d9",button:"#8b5cf6",buttonHover:"#7c3aed",slider:"#8b5cf6"},amber:{name:"Amber Gold",bg:"linear-gradient(135deg, #f59e0b43 0%, #d9770643 100%)",bars:["#f59e0b","#fbbf24","#fcd34d","#fde68a"],peak:"#b45309",button:"#f59e0b",buttonHover:"#d97706",slider:"#f59e0b"},rose:{name:"Rose Pink",bg:"linear-gradient(135deg, #ec489943 0%, #be185d43 100%)",bars:["#ec4899","#f472b6","#f9a8d4","#fbcfe8"],peak:"#9f1239",button:"#ec4899",buttonHover:"#db2777",slider:"#ec4899"}};function Oe({theme:o,setTheme:c,close:f}){const p=Object.keys(oe).map(N=>({key:N,name:oe[N].name,colors:oe[N].bars}));return e.jsxs("div",{className:"container-glass rounded-xl p-6 mb-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-800",children:"Choose Color Palette"}),e.jsx("button",{onClick:()=>f(),className:"text-gray-500 hover:text-gray-700 text-sm font-medium",children:"Close"})]}),e.jsx("div",{className:"theme-selector grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:p.map(N=>e.jsxs("div",{className:`theme-card bg-white p-4 rounded-lg cursor-pointer border-2 transition-all ${o===N.key?"border-current shadow-lg":"border-transparent"}`,onClick:()=>c(N.key),children:[e.jsx("div",{className:"color-preview h-10 rounded mb-2",style:{background:`linear-gradient(to right, ${N.colors.join(", ")})`}}),e.jsx("div",{className:"text-sm font-medium text-gray-700",children:N.name})]},N.key))})]})}function Ve({audio:o,name:c="No track loaded",author:f,theme:p="rainbow",volume:N=100,thumbnail:g=null,controls:b={play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,loop:!0,trackName:!0,equalizer:!0,speed:!0},mode:x="light",bands:q=null,transparent:E=!1,autoPlay:O=!1,equalizer:z={bass:0,mid:0,treble:0}}){const[S,I]=r.useState(!1),[B,A]=r.useState(0),[j,w]=r.useState(0),[$,ce]=r.useState(N||100),[re,fe]=r.useState(!1),[U,W]=r.useState(!1),[ne,se]=r.useState(!1),[H,ie]=r.useState([]),[T,L]=r.useState(!1),[M,le]=r.useState({bass:z.bass||0,mid:z.mid||0,treble:z.treble||0}),[de,Y]=r.useState(1),[Q,v]=r.useState(0),u=r.useRef(null),P=r.useRef(null),G=r.useRef(null),ge=r.useRef(null),D=r.useRef(null),R=r.useRef(null),K=r.useRef(null),k=r.useRef(null),ee=r.useRef(null),X=r.useRef(null);r.useEffect(()=>{const t=X.current;if(!t)return;const a=new ResizeObserver(s=>{for(let l of s)v(l.contentRect.width)});return a.observe(t),()=>a.disconnect()},[]),r.useEffect(()=>{const t=[];if(o&&typeof o!="string"&&t.push(["TypeError","audio must be a string (URL or path)"]),c&&typeof c!="string"&&t.push(["TypeError","name must be a string"]),p&&typeof p!="string"&&typeof p!="object")t.push(["TypeError","theme must be a string or a valid theme object"]);else if(typeof p=="object"){const a=["name","bg","bars","peak","button","buttonHover","slider"];for(const s of a)s in p||t.push(["ThemeError",`theme object missing key: ${s}`])}(typeof N!="number"||N<0||N>100)&&t.push(["TypeError","volume must be a number between 0 and 100"]),typeof b!="object"||Array.isArray(b)?t.push(["TypeError","controls must be an object"]):["play","pause","stop","seekbar","volume","loop","trackName","equalizer"].forEach(s=>{b&&s in b&&typeof b[s]!="boolean"&&t.push(["TypeError",`controls.${s} must be a boolean`])}),q&&(Array.isArray(q)?q.length===0?t.push(["ValueError","bands array cannot be empty"]):q.forEach((a,s)=>{typeof a.freq!="number"&&t.push(["TypeError",`bands[${s}].freq must be a number`])}):t.push(["TypeError","bands must be an array"])),t.length>0?(ie(t),console.group("%cVisualizePlayer: Prop validation failed","color:red"),t.forEach(a=>console.error(`${a[0]}: ${a[1]}`)),console.groupEnd()):ie([])},[o,c,p,N,b,x,q]);const n=q||[{freq:0},{freq:10},{freq:20},{freq:25},{freq:31.5},{freq:40},{freq:50},{freq:63},{freq:80},{freq:100},{freq:125},{freq:160},{freq:200},{freq:250},{freq:315},{freq:400},{freq:500},{freq:630},{freq:800},{freq:1e3},{freq:1250},{freq:1600},{freq:2e3},{freq:2500},{freq:3150},{freq:4e3},{freq:5e3},{freq:6300},{freq:8e3},{freq:1e4},{freq:12500}],d=r.useRef(n.map(()=>0)),y=r.useRef(n.map(()=>0)),F=r.useRef(n.map(()=>0)),_=r.useRef(!1),Z=r.useRef(typeof p=="string"?p:"purple");let i=typeof p=="string"?oe[p]||oe.purple:typeof p=="object"?p:oe.purple;const h=x==="dark",ue=typeof b=="object"&&Object.keys(b).length===0;r.useEffect(()=>{typeof p=="string"?Z.current=p:Z.current="purple",pe()},[p]),r.useEffect(()=>{u.current||(u.current=new Audio);const t=u.current,a=()=>{ne||A(t.currentTime)},s=()=>{w(t.duration)},l=()=>{U||(I(!1),k.current&&cancelAnimationFrame(k.current))},m=()=>I(!0),C=()=>I(!1);return t.addEventListener("timeupdate",a),t.addEventListener("loadedmetadata",s),t.addEventListener("ended",l),t.addEventListener("play",m),t.addEventListener("pause",C),()=>{t.removeEventListener("timeupdate",a),t.removeEventListener("loadedmetadata",s),t.removeEventListener("ended",l),t.removeEventListener("play",m),t.removeEventListener("pause",C)}},[ne,U]),r.useEffect(()=>()=>{u.current&&(u.current.pause(),u.current.src="",u.current.load()),P.current&&P.current.close().catch(t=>console.warn("AudioContext cleanup error:",t)),k.current&&cancelAnimationFrame(k.current)},[]),r.useEffect(()=>{if(o){const t=S,a=$,s=U;if(k.current&&(cancelAnimationFrame(k.current),k.current=null),ge.current){try{ge.current.disconnect()}catch(V){console.warn("Source disconnect error:",V)}ge.current=null}if(G.current){try{G.current.disconnect()}catch(V){console.warn("Analyser disconnect error:",V)}G.current=null}if(D.current){try{D.current.disconnect()}catch(V){console.warn("Bass filter disconnect error:",V)}D.current=null}if(R.current){try{R.current.disconnect()}catch(V){console.warn("Mid filter disconnect error:",V)}R.current=null}if(K.current){try{K.current.disconnect()}catch(V){console.warn("Treble filter disconnect error:",V)}K.current=null}P.current&&(P.current.close().catch(V=>console.warn("AudioContext close error:",V)),P.current=null),u.current&&(u.current.pause(),u.current.src="",u.current.load()),u.current=new Audio;try{u.current.crossOrigin="anonymous"}catch(V){console.debug("Could not set crossOrigin on audio element",V)}u.current.src=o,u.current.preload="auto",u.current.muted=!1,u.current.volume=re?0:a/100,u.current.loop=s,u.current.load();const l=u.current,m=()=>{ne||A(l.currentTime)},C=()=>{w(l.duration)},te=()=>{U||(I(!1),k.current&&cancelAnimationFrame(k.current))},be=()=>I(!0),Ne=()=>I(!1);l.addEventListener("timeupdate",m),l.addEventListener("loadedmetadata",C),l.addEventListener("ended",te),l.addEventListener("play",be),l.addEventListener("pause",Ne),A(0),I(!1),console.debug("Audio element created",{src:u.current.src,volume:u.current.volume,loop:u.current.loop}),d.current=n.map(()=>0),y.current=n.map(()=>0),F.current=n.map(()=>0),pe(),t&&u.current.play().catch(V=>console.error("Play failed:",V))}},[o]),r.useEffect(()=>{u.current&&(u.current.volume=re?0:$/100)},[$,re]),r.useEffect(()=>{u.current&&(u.current.loop=U)},[U]),r.useEffect(()=>{u.current&&(u.current.playbackRate=de)},[de]),r.useEffect(()=>{P.current&&(D.current&&(D.current.gain.value=M.bass),R.current&&(R.current.gain.value=M.mid),K.current&&(K.current.gain.value=M.treble))},[M]),r.useEffect(()=>{_.current=S,k.current&&(cancelAnimationFrame(k.current),k.current=null),S?(P.current||qe(),ve()):he()},[S]);const qe=()=>{if(!P.current&&u.current)try{const t=window.AudioContext||window.webkitAudioContext;if(t){const a=new t;P.current=a;const s=a.createBiquadFilter();s.type="lowshelf",s.frequency.value=320,s.gain.value=M.bass;const l=a.createBiquadFilter();l.type="peaking",l.frequency.value=1e3,l.Q.value=.5,l.gain.value=M.mid;const m=a.createBiquadFilter();m.type="highshelf",m.frequency.value=3200,m.gain.value=M.treble;const C=a.createAnalyser();C.fftSize=8192,C.smoothingTimeConstant=.7;const te=a.createMediaElementSource(u.current);te.connect(s),s.connect(l),l.connect(m),m.connect(C),C.connect(a.destination),D.current=s,R.current=l,K.current=m,G.current=C,ge.current=te}}catch(t){console.error("Failed to setup audio context:",t)}},me=t=>{const a=P.current,s=G.current;if(!a||!s)return 0;const l=a.sampleRate/2,m=Math.round(t/l*s.frequencyBinCount);return Math.min(m,s.frequencyBinCount-1)},he=()=>{if(_.current)return;d.current=d.current.map(l=>l*.7);const t=Date.now();y.current=y.current.map((l,m)=>t-F.current[m]>1500?l*.95:l),pe();const a=Math.max(...d.current),s=Math.max(...y.current);a>.01||s>.01?k.current=requestAnimationFrame(he):(_.current||(d.current=n.map(()=>0),y.current=n.map(()=>0),F.current=n.map(()=>0),pe()),k.current&&cancelAnimationFrame(k.current),k.current=null)},ve=()=>{if(!G.current||!_.current)return;const t=G.current.frequencyBinCount,a=new Uint8Array(t);G.current.getByteFrequencyData(a),n.forEach((s,l)=>{const m=me(s.freq),C=l<n.length-1?me(n[l+1].freq):a.length;let te=0,be=0;for(let _e=m;_e<C;_e++)te+=a[_e],be++;let Ne=be>0?te/be/255:0;Ne=Math.pow(Ne,.6),d.current[l]=d.current[l]*.8+Ne*.2;const V=Date.now();d.current[l]>y.current[l]?(y.current[l]=d.current[l],F.current[l]=V):V-F.current[l]>1500&&(y.current[l]*=.95)}),pe(),k.current=requestAnimationFrame(ve)},pe=()=>{if(!ee.current)return;const t=oe[Z.current]||oe.rainbow;let a="";n.forEach((s,l)=>{const m=d.current[l]*100,C=100-y.current[l]*100,te=Math.floor(l/n.length*t.bars.length),be=t.bars[Math.min(te,t.bars.length-1)];a+=`
72
- <div class="flex-1 h-full relative flex flex-col justify-end">
73
- <div class="rounded-t transition-all duration-75" style="height: ${m}%; background: ${be};">
74
- ${y.current[l]>.1?`<div class="absolute w-full h-0.5 transition-all duration-100" style="top: ${C}%; background: ${t.peak};"></div>`:""}
72
+ */const Me=ae("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),le={rainbow:{name:"Rainbow",bg:"linear-gradient(135deg, #ef444422 0%, #f9731622 15%, #f59e0b22 30%, #10b98122 45%, #06b6d422 60%, #3b82f622 75%, #6366f122 85%, #a855f722 92%, #ec489922 100%)",bars:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e"],peak:"#a0a0a0ff",button:"#ec4899",buttonHover:"#d946ef",slider:"#ec4899"},ocean:{name:"Ocean Blue",bg:"linear-gradient(135deg, #667eea43 0%, #764ba243 100%)",bars:["#0ea5e9","#38bdf8","#06b6d4","#22d3ee"],peak:"#0369a1",button:"#0ea5e9",buttonHover:"#0284c7",slider:"#0ea5e9"},sunset:{name:"Sunset",bg:"linear-gradient(135deg, #f093fb43 0%, #f5576c43 100%)",bars:["#f43f5e","#fb7185","#fda4af","#fecdd3"],peak:"#be123c",button:"#f43f5e",buttonHover:"#e11d48",slider:"#f43f5e"},forest:{name:"Forest Green",bg:"linear-gradient(135deg, #0ba36043 0%, #3cba9243 100%)",bars:["#10b981","#34d399","#6ee7b7","#a7f3d0"],peak:"#047857",button:"#10b981",buttonHover:"#059669",slider:"#10b981"},midnight:{name:"Midnight",bg:"linear-gradient(135deg, #2c3e5043 0%, #3498db43 100%)",bars:["#3b82f6","#60a5fa","#93c5fd","#bfdbfe"],peak:"#1e40af",button:"#3b82f6",buttonHover:"#2563eb",slider:"#3b82f6"},neon:{name:"Neon Cyan",bg:"linear-gradient(135deg, #13547a43 0%, #80d0c743 100%)",bars:["#06b6d4","#22d3ee","#67e8f9","#a5f3fc"],peak:"#0e7490",button:"#06b6d4",buttonHover:"#0891b2",slider:"#06b6d4"},purple:{name:"Royal Purple",bg:"linear-gradient(135deg, #2f1c5622 0%, #764ba243 100%)",bars:["#8b5cf6","#a78bfa","#baabf9ff","#ddd6fe"],peak:"#6d28d9",button:"#8b5cf6",buttonHover:"#7c3aed",slider:"#8b5cf6"},amber:{name:"Amber Gold",bg:"linear-gradient(135deg, #f59e0b43 0%, #d9770643 100%)",bars:["#f59e0b","#fbbf24","#fcd34d","#fde68a"],peak:"#b45309",button:"#f59e0b",buttonHover:"#d97706",slider:"#f59e0b"},rose:{name:"Rose Pink",bg:"linear-gradient(135deg, #ec489943 0%, #be185d43 100%)",bars:["#ec4899","#f472b6","#f9a8d4","#fbcfe8"],peak:"#9f1239",button:"#ec4899",buttonHover:"#db2777",slider:"#ec4899"}};function We({theme:c,setTheme:i,close:u}){const v=Object.keys(le).map(N=>({key:N,name:le[N].name,colors:le[N].bars}));return e.jsxs("div",{className:"ecp-theme-selector-panel",children:[e.jsxs("div",{className:"ecp-theme-selector-header",children:[e.jsx("h2",{className:"ecp-theme-selector-title",children:"Choose Color Palette"}),e.jsx("button",{onClick:()=>u(),className:"ecp-theme-selector-close",children:"Close"})]}),e.jsx("div",{className:"ecp-theme-grid",children:v.map(N=>e.jsxs("div",{className:`ecp-theme-card${c===N.key?" ecp-theme-card--active":""}`,onClick:()=>i(N.key),children:[e.jsx("div",{className:"ecp-theme-color-preview",style:{background:`linear-gradient(to right, ${N.colors.join(", ")})`}}),e.jsx("div",{className:"ecp-theme-name",children:N.name})]},N.key))})]})}function Qe({audio:c,name:i="No track loaded",author:u,theme:v="rainbow",volume:N=100,thumbnail:f=null,controls:m={play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,loop:!0,trackName:!0,equalizer:!0,speed:!0},mode:D="light",bands:q=null,transparent:P=!1,autoPlay:j=!1,equalizer:A={bass:0,mid:0,treble:0}}){const[$,_]=t.useState(!1),[F,L]=t.useState(0),[T,B]=t.useState(0),[g,M]=t.useState(N||100),[re,pe]=t.useState(!1),[U,J]=t.useState(!1),[se,ce]=t.useState(!1),[ne,ie]=t.useState([]),[x,V]=t.useState(!1),[W,oe]=t.useState({bass:A.bass||0,mid:A.mid||0,treble:A.treble||0}),[de,R]=t.useState(1),[Q,y]=t.useState(0),p=t.useRef(null),E=t.useRef(null),Y=t.useRef(null),fe=t.useRef(null),O=t.useRef(null),ee=t.useRef(null),G=t.useRef(null),k=t.useRef(null),S=t.useRef(null),K=t.useRef(null);t.useEffect(()=>{const r=K.current;if(!r)return;const s=new ResizeObserver(l=>{for(let o of l)y(o.contentRect.width)});return s.observe(r),()=>s.disconnect()},[]),t.useEffect(()=>{const r=[];if(c&&typeof c!="string"&&r.push(["TypeError","audio must be a string (URL or path)"]),i&&typeof i!="string"&&r.push(["TypeError","name must be a string"]),v&&typeof v!="string"&&typeof v!="object")r.push(["TypeError","theme must be a string or a valid theme object"]);else if(typeof v=="object"){const s=["name","bg","bars","peak","button","buttonHover","slider"];for(const l of s)l in v||r.push(["ThemeError",`theme object missing key: ${l}`])}(typeof N!="number"||N<0||N>100)&&r.push(["TypeError","volume must be a number between 0 and 100"]),typeof m!="object"||Array.isArray(m)?r.push(["TypeError","controls must be an object"]):["play","pause","stop","seekbar","volume","loop","trackName","equalizer"].forEach(l=>{m&&l in m&&typeof m[l]!="boolean"&&r.push(["TypeError",`controls.${l} must be a boolean`])}),q&&(Array.isArray(q)?q.length===0?r.push(["ValueError","bands array cannot be empty"]):q.forEach((s,l)=>{typeof s.freq!="number"&&r.push(["TypeError",`bands[${l}].freq must be a number`])}):r.push(["TypeError","bands must be an array"])),r.length>0?(ie(r),console.group("%cVisualizePlayer: Prop validation failed","color:red"),r.forEach(s=>console.error(`${s[0]}: ${s[1]}`)),console.groupEnd()):ie([])},[c,i,v,N,m,D,q]);const n=q||[{freq:0},{freq:10},{freq:20},{freq:25},{freq:31.5},{freq:40},{freq:50},{freq:63},{freq:80},{freq:100},{freq:125},{freq:160},{freq:200},{freq:250},{freq:315},{freq:400},{freq:500},{freq:630},{freq:800},{freq:1e3},{freq:1250},{freq:1600},{freq:2e3},{freq:2500},{freq:3150},{freq:4e3},{freq:5e3},{freq:6300},{freq:8e3},{freq:1e4},{freq:12500}],d=t.useRef(n.map(()=>0)),b=t.useRef(n.map(()=>0)),z=t.useRef(n.map(()=>0)),H=t.useRef(!1),X=t.useRef(typeof v=="string"?v:"purple"),h=typeof v=="string"?le[v]||le.purple:typeof v=="object"?v:le.purple,C=D==="dark",ge=typeof m=="object"&&Object.keys(m).length===0;t.useEffect(()=>{typeof v=="string"?X.current=v:X.current="purple",ve()},[v]),t.useEffect(()=>{p.current||(p.current=new Audio);const r=p.current,s=()=>{se||L(r.currentTime)},l=()=>B(r.duration),o=()=>{U||(_(!1),k.current&&cancelAnimationFrame(k.current))},w=()=>_(!0),I=()=>_(!1);return r.addEventListener("timeupdate",s),r.addEventListener("loadedmetadata",l),r.addEventListener("ended",o),r.addEventListener("play",w),r.addEventListener("pause",I),()=>{r.removeEventListener("timeupdate",s),r.removeEventListener("loadedmetadata",l),r.removeEventListener("ended",o),r.removeEventListener("play",w),r.removeEventListener("pause",I)}},[se,U]),t.useEffect(()=>()=>{p.current&&(p.current.pause(),p.current.src="",p.current.load()),E.current&&E.current.close().catch(r=>console.warn("AudioContext cleanup error:",r)),k.current&&cancelAnimationFrame(k.current)},[]),t.useEffect(()=>{if(c){const r=$,s=g,l=U;if(k.current&&(cancelAnimationFrame(k.current),k.current=null),fe.current){try{fe.current.disconnect()}catch{}fe.current=null}if(Y.current){try{Y.current.disconnect()}catch{}Y.current=null}if(O.current){try{O.current.disconnect()}catch{}O.current=null}if(ee.current){try{ee.current.disconnect()}catch{}ee.current=null}if(G.current){try{G.current.disconnect()}catch{}G.current=null}E.current&&(E.current.close().catch(te=>console.warn("AudioContext close error:",te)),E.current=null),p.current&&(p.current.pause(),p.current.src="",p.current.load()),p.current=new Audio;try{p.current.crossOrigin="anonymous"}catch{}p.current.src=c,p.current.preload="auto",p.current.muted=!1,p.current.volume=re?0:s/100,p.current.loop=l,p.current.load();const o=p.current,w=()=>{se||L(o.currentTime)},I=()=>B(o.duration),ue=()=>{U||(_(!1),k.current&&cancelAnimationFrame(k.current))},me=()=>_(!0),Ne=()=>_(!1);o.addEventListener("timeupdate",w),o.addEventListener("loadedmetadata",I),o.addEventListener("ended",ue),o.addEventListener("play",me),o.addEventListener("pause",Ne),L(0),_(!1),d.current=n.map(()=>0),b.current=n.map(()=>0),z.current=n.map(()=>0),ve(),r&&p.current.play().catch(te=>console.error("Play failed:",te))}},[c]),t.useEffect(()=>{p.current&&(p.current.volume=re?0:g/100)},[g,re]),t.useEffect(()=>{p.current&&(p.current.loop=U)},[U]),t.useEffect(()=>{p.current&&(p.current.playbackRate=de)},[de]),t.useEffect(()=>{E.current&&(O.current&&(O.current.gain.value=W.bass),ee.current&&(ee.current.gain.value=W.mid),G.current&&(G.current.gain.value=W.treble))},[W]),t.useEffect(()=>{H.current=$,k.current&&(cancelAnimationFrame(k.current),k.current=null),$?(E.current||Ce(),ke()):he()},[$]);const Ce=()=>{if(!E.current&&p.current)try{const r=window.AudioContext||window.webkitAudioContext;if(r){const s=new r;E.current=s;const l=s.createBiquadFilter();l.type="lowshelf",l.frequency.value=320,l.gain.value=W.bass;const o=s.createBiquadFilter();o.type="peaking",o.frequency.value=1e3,o.Q.value=.5,o.gain.value=W.mid;const w=s.createBiquadFilter();w.type="highshelf",w.frequency.value=3200,w.gain.value=W.treble;const I=s.createAnalyser();I.fftSize=8192,I.smoothingTimeConstant=.7;const ue=s.createMediaElementSource(p.current);ue.connect(l),l.connect(o),o.connect(w),w.connect(I),I.connect(s.destination),O.current=l,ee.current=o,G.current=w,Y.current=I,fe.current=ue}}catch(r){console.error("Failed to setup audio context:",r)}},ye=r=>{const s=E.current,l=Y.current;if(!s||!l)return 0;const o=s.sampleRate/2,w=Math.round(r/o*l.frequencyBinCount);return Math.min(w,l.frequencyBinCount-1)},he=()=>{if(H.current)return;d.current=d.current.map(o=>o*.7);const r=Date.now();b.current=b.current.map((o,w)=>r-z.current[w]>1500?o*.95:o),ve();const s=Math.max(...d.current),l=Math.max(...b.current);s>.01||l>.01?k.current=requestAnimationFrame(he):(H.current||(d.current=n.map(()=>0),b.current=n.map(()=>0),z.current=n.map(()=>0),ve()),k.current&&cancelAnimationFrame(k.current),k.current=null)},ke=()=>{if(!Y.current||!H.current)return;const r=Y.current.frequencyBinCount,s=new Uint8Array(r);Y.current.getByteFrequencyData(s),n.forEach((l,o)=>{const w=ye(l.freq),I=o<n.length-1?ye(n[o+1].freq):s.length;let ue=0,me=0;for(let De=w;De<I;De++)ue+=s[De],me++;let Ne=me>0?ue/me/255:0;Ne=Math.pow(Ne,.6),d.current[o]=d.current[o]*.8+Ne*.2;const te=Date.now();d.current[o]>b.current[o]?(b.current[o]=d.current[o],z.current[o]=te):te-z.current[o]>1500&&(b.current[o]*=.95)}),ve(),k.current=requestAnimationFrame(ke)},ve=()=>{if(!S.current)return;const r=le[X.current]||le.rainbow;let s="";n.forEach((l,o)=>{const w=d.current[o]*100,I=100-b.current[o]*100,ue=Math.floor(o/n.length*r.bars.length),me=r.bars[Math.min(ue,r.bars.length-1)];s+=`
73
+ <div class="ecp-vu-bar-wrap">
74
+ <div class="ecp-vu-bar-fill" style="height: ${w}%; background: ${me};">
75
+ ${b.current[o]>.1?`<div class="ecp-vu-peak-line" style="top: ${I}%; background: ${r.peak};"></div>`:""}
75
76
  </div>
76
77
  </div>
77
- `}),ee.current.innerHTML=a},Se=()=>{!u.current||!o||(S?u.current.pause():(P.current&&P.current.state==="suspended"&&P.current.resume(),u.current.play().catch(t=>console.error("Play failed:",t))))},Pe=()=>{u.current&&(u.current.pause(),u.current.currentTime=0,I(!1),A(0),d.current=n.map(()=>0),y.current=n.map(()=>0),F.current=n.map(()=>0),pe())},Te=t=>{const s=parseFloat(t.target.value)/100*j;A(s),u.current&&!ne&&(u.current.currentTime=s)},Le=()=>{se(!0)},Me=()=>{u.current&&(u.current.currentTime=B),se(!1)},Fe=t=>{const a=parseInt(t.target.value);ce(a),fe(a===0)},ze=()=>{fe(!re)},we=t=>{Y(parseFloat(t.target.value))},Be=()=>{W(!U)},xe=(t,a)=>{le(s=>({...s,[t]:a}))},ye=()=>{le({bass:0,mid:0,treble:0})};r.useEffect(()=>{((typeof b=="object"&&Object.keys(b).length===0||!b)&&!S||O)&&Se()},[b]);const ke=t=>{if(isNaN(t))return"0:00";const a=Math.floor(t/60),s=Math.floor(t%60);return`${a}:${s.toString().padStart(2,"0")}`};return H&&H.length>0?H.map((t,a)=>e.jsxs("div",{className:"text-red-500 text-sm bg-red-50 p-3 rounded mb-4 border border-red-300",children:[e.jsxs("strong",{children:[t[0],":"]})," ",t[1]]},a)):e.jsx("div",{ref:X,className:"w-full rounded-xl overflow-hidden",style:{backgroundColor:ue||E?void 0:h?"#6060606a":"#ffffffab"},children:e.jsxs("div",{style:{background:ue||E?void 0:i.bg},className:ue||E?"":"p-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:`${E&&T?"opacity-30":""} ${ue||E?"":h?"bg-black/40":"bg-white/70"} rounded-lg ${ue?"":"mb-6"} ${ue||E?"":"p-4"} shadow-sm`,children:e.jsx("div",{className:"flex justify-center items-end gap-1 h-64",ref:ee})}),T&&e.jsxs("div",{className:`absolute inset-0 flex flex-col w-full justify-center z-10 ${!(ue||E)&&(h?"bg-black/50":"bg-white/80")} rounded-lg p-4 shadow-sm transition-all duration-300`,children:[e.jsx("h3",{className:`text-sm font-medium mb-4 ${h?"text-gray-200":"text-gray-700"}`,children:"Equalizer"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:"Bass"}),e.jsxs("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:[M.bass," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:M.bass,onChange:t=>xe("bass",parseInt(t.target.value)),className:"flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${i.slider} ${(M.bass+20)/40*100}%, ${i.slider+"30"} ${(M.bass+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:"Mid"}),e.jsxs("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:[M.mid," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:M.mid,onChange:t=>xe("mid",parseInt(t.target.value)),className:"flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${i.slider} ${(M.mid+20)/40*100}%, ${i.slider+"30"} ${(M.mid+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:"Treble"}),e.jsxs("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:[M.treble," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:M.treble,onChange:t=>xe("treble",parseInt(t.target.value)),className:"flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${i.slider} ${(M.treble+20)/40*100}%, ${i.slider+"30"} ${(M.treble+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]})]}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx("button",{onClick:ye,className:`px-3 py-1 rounded text-xs ${h?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Reset"})})]})]}),b.trackName&&e.jsxs("div",{className:"mb-6 flex items-center",children:[g&&e.jsx("div",{className:"mr-2 w-12 flex-shrink-0",children:e.jsx("img",{src:g,alt:"",className:`${S?"animation-spin":""} h-12 w-12 rounded-full`})}),e.jsxs("div",{className:"w-full min-w-0",children:[e.jsx("div",{className:`${h?"text-gray-100":"text-gray-700"} font-medium truncate`,children:c}),f&&typeof f=="string"&&e.jsx("div",{className:`${h?"text-gray-300":"text-gray-500"} text-xs`,children:f})]})]}),b.seekbar&&e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex items-center md:gap-1",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-100":"text-gray-600"} font-mono w-12`,children:ke(B)}),e.jsx("input",{type:"range",min:"0",max:"100",value:j>0?B/j*100:0,onChange:Te,onMouseDown:Le,onMouseUp:Me,onTouchStart:Le,onTouchEnd:Me,disabled:!o,className:"flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:o&&j>0?`linear-gradient(to right, ${i.slider} ${B/j*100}%, ${i.slider+"30"} ${B/j*100}%)`:i.slider+"30"}}),e.jsx("span",{className:`text-xs ${h?"text-gray-100":"text-gray-600"} font-mono w-12 text-right`,children:ke(j)})]})}),e.jsxs("div",{className:`flex flex-wrap items-center ${Q<330?"gap-2":"gap-3"}`,children:[b.play&&e.jsxs("button",{onClick:Se,disabled:!o,className:`${Q<350?"px-3 py-5":"px-4 py-2 md:w-24"} rounded-full text-sm font-medium text-white disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all hover:opacity-90`,style:{backgroundColor:i.button},children:[e.jsxs("div",{className:"relative w-4 flex items-center",children:[e.jsx($e,{size:16,className:`${S?"":"scale-0 translate-y-10"} transition-all absolute`}),e.jsx(Ee,{size:16,className:`${S?"scale-0 -translate-y-10":""} transition-all absolute`})]}),e.jsx("span",{style:{display:Q<350?"none":"block"},children:S?"Pause":"Play"})]}),b.stop&&e.jsxs("button",{onClick:Pe,disabled:!o,className:`${h?"bg-gray-100 text-black":"bg-gray-700 text-white"} ${Q<600?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium ${h?"hover:bg-gray-300":"hover:bg-gray-800"} disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,children:[e.jsx(De,{size:16}),e.jsx("span",{style:{display:Q<600?"none":"block"},children:"Stop"})]}),b.equalizer&&e.jsxs("button",{onClick:()=>L(!T),disabled:!o,className:`${Q<600?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${T?"text-white":"bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,style:T?{backgroundColor:i.button}:{},children:[e.jsx(Ce,{size:16}),e.jsx("span",{style:{display:Q<600?"none":"block"},children:"EQ"})]}),b.loop&&e.jsxs("button",{onClick:Be,disabled:!o,className:`${Q<700?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${U?"text-white":"bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,style:U?{backgroundColor:i.button}:{},children:[e.jsx(Re,{size:16,className:`${U?"rotate-180":""} transition-all`}),e.jsx("span",{style:{display:Q<700?"none":"block"},children:"Loop"})]}),b.speed&&e.jsx("div",{className:"flex items-center",children:e.jsxs("select",{value:de,onChange:we,className:`rounded-full text-sm font-medium border-none outline-none cursor-pointer transition-all bg-transparent ${h?"text-gray-200":"text-gray-800"}`,children:[e.jsx("option",{value:"0.5",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"0.5x"}),e.jsx("option",{value:"0.75",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"0.75x"}),e.jsx("option",{value:"1",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"1x"}),e.jsx("option",{value:"1.25",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"1.25x"}),e.jsx("option",{value:"1.5",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"1.5x"}),e.jsx("option",{value:"2",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"2x"})]})}),b.volume&&e.jsxs("div",{className:"flex items-center gap-1 md:gap-3 ml-auto",children:[e.jsx("button",{onClick:ze,className:"p-2 rounded-full hover:bg-gray-100/50 transition-all",children:re||$===0?e.jsx(je,{size:20,className:h?"text-gray-100":"text-gray-600"}):e.jsx(Ae,{size:20,className:h?"text-gray-100":"text-gray-600"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:$,onChange:Fe,className:"hide-for-xs w-24 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, ${i.slider} ${$}%, ${i.slider+"30"} ${$}%)`,display:Q<460?"none":"block"}}),e.jsxs("span",{style:{display:Q<800?"none":"block"},className:`hidden sm:block text-xs ${h?"text-gray-100":"text-gray-700"} font-mono w-10 text-right`,children:[$,"%"]})]})]}),e.jsx("style",{children:`
78
- input[type="range"]::-webkit-slider-thumb {
79
- -webkit-appearance: none;
80
- appearance: none;
81
- width: 16px;
82
- height: 16px;
83
- border-radius: 50%;
84
- background: ${i.slider};
85
- cursor: pointer;
86
- border: 2px solid white;
87
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
88
- }
89
-
90
- input[type="range"]::-moz-range-thumb {
91
- width: 16px;
92
- height: 16px;
93
- border-radius: 50%;
94
- background: ${i.slider};
95
- cursor: pointer;
96
- border: 2px solid white;
97
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
98
- }
99
- input[type="range"].eq-slider::-webkit-slider-thumb {
100
- -webkit-appearance: none;
101
- appearance: none;
102
- width: 0;
103
- height: 0;
104
- background: transparent;
105
- border: none;
106
- box-shadow: none;
107
- }
108
- input[type="range"].eq-slider::-moz-range-thumb {
109
- width: 0;
110
- height: 0;
111
- background: transparent;
112
- border: none;
113
- box-shadow: none;
114
- }
115
- .hide-for-xs {
116
- display: flex;
117
- }
118
- @media (max-width: 480px) {
119
- .hide-for-xs {
120
- display: none;
121
- }
122
- }
123
- .animation-spin {
124
- animation: spin 15s infinite linear;
125
- }
126
-
127
- @keyframes spin {
128
- from {
129
- transform: rotate(0deg);
130
- }
131
- to {
132
- transform: rotate(360deg)
133
- }
134
- }
135
- `})]})})}function Ue({audio:o,gradient:c=["#cd7eff","#ff00f2"],background:f="#f4e4ffff",autoPlay:p=!1,thumbnail:N=null,width:g,equalizer:b={bass:0,mid:0,treble:0},mode:x="light"}){const[q,E]=r.useState(!1),[O,z]=r.useState(0),[S,I]=r.useState(0),[B,A]=r.useState(!1),[j,w]=r.useState(80),[$,ce]=r.useState(1),[re,fe]=r.useState([]),[U,W]=r.useState(null),[ne,se]=r.useState(!1),[H,ie]=r.useState({bass:b.bass||0,mid:b.mid||0,treble:b.treble||0}),T=r.useRef(null),L=r.useRef(null),M=r.useRef(null),le=r.useRef(null),de=r.useRef(null),Y=r.useRef(null),Q=()=>{const n=[];for(let d=0;d<100;d++){const y=20+Math.random()*60;n.push(y)}return n};r.useEffect(()=>{if(!o)return;if(!Array.isArray(c)||c.length<2){W("Gradient must be an array with at least 2 colors");return}const n=T.current;if(!n)return;const d=()=>z(n.currentTime),y=()=>{I(n.duration),fe(Q())},F=()=>E(!1),_=Z=>{var i,h;W(`Audio error: ${((h=(i=Z.target)==null?void 0:i.error)==null?void 0:h.message)||"Failed to load audio"}`)};return n.addEventListener("timeupdate",d),n.addEventListener("loadedmetadata",y),n.addEventListener("ended",F),n.addEventListener("error",_),()=>{n.removeEventListener("timeupdate",d),n.removeEventListener("loadedmetadata",y),n.removeEventListener("ended",F),n.removeEventListener("error",_)}},[o,c,x]),r.useEffect(()=>{o&&T.current&&p&&(T.current.play().catch(n=>{console.error("Play failed:",n),E(!1)}),E(!0))},[o]),r.useEffect(()=>{if(T.current&&!L.current&&T.current){const n=window.AudioContext||window.webkitAudioContext;if(n){const d=new n;L.current=d;const y=d.createMediaElementSource(T.current);M.current=y;const F=d.createBiquadFilter();F.type="lowshelf",F.frequency.value=200,le.current=F;const _=d.createBiquadFilter();_.type="peaking",_.frequency.value=1e3,_.Q.value=1,de.current=_;const Z=d.createBiquadFilter();Z.type="highshelf",Z.frequency.value=3e3,Y.current=Z,y.connect(F).connect(_).connect(Z).connect(d.destination)}}},[o]),r.useEffect(()=>{T.current&&(T.current.volume=B?0:j/100)},[j,B]),r.useEffect(()=>{T.current&&(T.current.playbackRate=$)},[$]);const v=()=>{T.current&&(q?T.current.pause():T.current.play().catch(n=>{W(`Playback failed: ${n instanceof Error?n.message:String(n)}`)}),E(!q))},u=()=>{A(!B)},P=n=>{w(parseInt(n.target.value)),B&&parseInt(n.target.value)>0&&A(!1)},G=n=>{ce(parseFloat(n.target.value))},ge=n=>{const d=n.currentTarget.getBoundingClientRect(),_=(n.clientX-d.left)/d.width*S;T.current&&(T.current.currentTime=_,z(_))},D=(n,d)=>{ie(y=>({...y,[n]:d})),n==="bass"&&le.current&&(le.current.gain.value=d),n==="mid"&&de.current&&(de.current.gain.value=d),n==="treble"&&Y.current&&(Y.current.gain.value=d)},R=()=>{D("bass",0),D("mid",0),D("treble",0)},K=n=>{if(isNaN(n))return"0:00";const d=Math.floor(n/60),y=Math.floor(n%60);return`${d}:${y.toString().padStart(2,"0")}`},k=S>0?O/S*100:0;if(U)return e.jsx("div",{className:"w-lg p-6 rounded-xl",style:{background:f},children:e.jsxs("div",{className:`text-center ${x==="dark"?"text-red-300":"text-red-600"}`,children:[e.jsx("p",{className:"font-medium",children:"Error"}),e.jsx("p",{className:"text-sm",children:U})]})});if(!o)return null;const ee=x==="dark"?"text-gray-300":"text-gray-700",X=x==="dark"?"text-gray-400":"text-gray-500";return e.jsxs("div",{className:"w-full max-w-lg relative",style:{width:g+"px"},children:[e.jsx("audio",{ref:T,src:o}),e.jsx("div",{className:"rounded-2xl shadow-2xl",children:e.jsxs("div",{className:"rounded-2xl p-6 backdrop-blur-xl",style:{background:f},children:[N&&e.jsx("div",{className:"w-full p-4",children:e.jsx("img",{src:N,alt:"",className:"w-full aspect-square rounded-xl"})}),e.jsxs("div",{className:"relative h-20 mb-6 cursor-pointer",onClick:ge,children:[e.jsx("div",{className:"absolute inset-0 flex items-end justify-center h-full w-full gap-px",children:re.map((n,d)=>{const F=d/re.length*100<=k;return e.jsx("div",{className:"w-1 rounded-t transition-all duration-150",style:{height:`${n}%`,background:F?c[0]:c[1],opacity:F?1:.4}},d)})}),e.jsx("div",{className:"absolute top-0 h-full w-1 bg-white border-r border-black rounded-full transition-all duration-150",style:{left:`${k}%`,transform:"translateX(-50%)"}})]}),e.jsxs("div",{className:`flex justify-between text-sm ${X} mb-6`,children:[e.jsx("span",{children:K(O)}),e.jsx("span",{children:K(S)})]}),e.jsxs("div",{className:"grid grid-cols-3 items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:u,className:"p-2 rounded-full transition-all",style:{background:`linear-gradient(135deg, ${c[0]}, ${c[1]})`},children:B||j===0?e.jsx(je,{className:"w-4 h-4 text-white"}):e.jsx(Ae,{className:"w-4 h-4 text-white"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:j,onChange:P,className:`${g?"":"hidden sm:block"} w-20 h-1.5 rounded-lg appearance-none cursor-pointer`,style:{background:`linear-gradient(to right, ${c[0]} ${j}%, ${x==="dark"?"#374151":"#d1d5db"} ${j}%)`,display:g&&g<400?"none":void 0}}),g&&g<400&&e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("button",{onClick:()=>se(!ne),className:"p-2 rounded-full transition-all",style:{background:`linear-gradient(135deg, ${c[0]}, ${c[1]})`},children:e.jsx(Ce,{className:"w-4 h-4 text-white"})})})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx("button",{onClick:v,className:"p-4 rounded-full transition-all hover:scale-105 shadow-lg",style:{background:`linear-gradient(135deg, ${c[0]}, ${c[1]})`},children:q?e.jsx($e,{className:"w-6 h-6 text-white fill-white"}):e.jsx(Ee,{className:"w-6 h-6 text-white fill-white"})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex items-center justify-end",children:e.jsxs("select",{value:$,style:{background:f,color:c[0]},onChange:G,className:`py-1 px-2 rounded-lg text-sm ${ee} ${x==="dark"?"bg-gray-800":"bg-gray-100"}`,children:[e.jsx("option",{value:"0.5",children:"0.5x"}),e.jsx("option",{value:"0.75",children:"0.75x"}),e.jsx("option",{value:"1",children:"1x"}),e.jsx("option",{value:"1.25",children:"1.25x"}),e.jsx("option",{value:"1.5",children:"1.5x"}),e.jsx("option",{value:"2",children:"2x"})]})}),!(g&&g<400)&&e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("button",{onClick:()=>se(!ne),className:"p-2 rounded-full transition-all",style:{background:`linear-gradient(135deg, ${c[0]}, ${c[1]})`},children:e.jsx(Ce,{className:"w-4 h-4 text-white"})})})]})]})]})}),ne&&e.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-20 flex items-center justify-center z-10 rounded-2xl p-4",children:e.jsxs("div",{className:`max-w-xs w-full p-4 pt-2 rounded-xl ${x==="dark"?"bg-gray-800":"bg-white"}`,children:[e.jsx("h3",{className:`text-lg font-medium mb-2 ${x==="dark"?"text-gray-200":"text-gray-700"}`,children:"Equalizer"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:"Bass"}),e.jsxs("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:[H.bass," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:H.bass,onChange:n=>D("bass",parseInt(n.target.value)),className:"flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${c[0]} ${(H.bass+20)/40*100}%, ${c[1]+"30"} ${(H.bass+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:"Mid"}),e.jsxs("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:[H.mid," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:H.mid,onChange:n=>D("mid",parseInt(n.target.value)),className:"flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${c[0]} ${(H.mid+20)/40*100}%, ${c[1]+"30"} ${(H.mid+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:"Treble"}),e.jsxs("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:[H.treble," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:H.treble,onChange:n=>D("treble",parseInt(n.target.value)),className:"flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${c[0]} ${(H.treble+20)/40*100}%, ${c[1]+"30"} ${(H.treble+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]})]}),e.jsxs("div",{className:"flex justify-between mt-6",children:[e.jsx("button",{onClick:R,className:`px-3 py-1 rounded text-xs ${x==="dark"?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Reset"}),e.jsx("button",{onClick:()=>se(!1),className:`px-3 py-1 rounded text-xs ${x==="dark"?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Close"})]})]})}),e.jsx("style",{children:`
136
- input[type="range"].eq-slider::-webkit-slider-thumb {
137
- -webkit-appearance: none;
138
- appearance: none;
139
- width: 0;
140
- height: 0;
141
- background: transparent;
142
- border: none;
143
- box-shadow: none;
144
- }
145
- input[type="range"].eq-slider::-moz-range-thumb {
146
- width: 0;
147
- height: 0;
148
- background: transparent;
149
- border: none;
150
- box-shadow: none;
151
- }
152
- `})]})}function We({audio:o,thumbnail:c,gradient:f=["#cd7eff","#fe59f6"],background:p="#1f273a",autoPlay:N=!1}){const[g,b]=r.useState(!1),[,x]=r.useState(0),q=r.useRef(null),[E,O]=r.useState(0),[z,S]=r.useState(0),[I,B]=r.useState(0);r.useEffect(()=>{const w=q.current;if(!w)return;const $=()=>x(w.currentTime);return w.addEventListener("timeupdate",$),()=>w.removeEventListener("timeupdate",$)},[]),r.useEffect(()=>{const w=setInterval(()=>{g&&O($=>$+.1)},100);return()=>clearInterval(w)},[g]),r.useEffect(()=>{const w=setInterval(()=>{g&&B($=>$+.1)},100);return()=>clearInterval(w)},[g]),r.useEffect(()=>{o&&q.current&&N&&(q.current.play().catch(()=>b(!1)),b(!0))},[o]),r.useEffect(()=>{const w=q.current;if(!w)return;const $=()=>{S(w.duration),console.log("Audio duration:",w.duration)};return B(0),w.addEventListener("loadedmetadata",$),()=>{w.removeEventListener("loadedmetadata",$)}},[o]);const A=()=>{q.current&&(g?q.current.pause():q.current.play().catch(w=>console.error("NanoPlayer play failed:",w)),b(!g))};if(!o)return null;const j={background:`linear-gradient(135deg, ${f[0]}, ${f[1]})`};return e.jsxs("div",{style:{backgroundColor:p},className:`
153
- relative overflow-hidden inline-flex flex-col
154
- ${c?"rounded-2xl":"rounded-full"}
155
- px-3 py-2 shadow-lg
156
- ${c?"w-[120px] h-[150px]":"w-[110px] h-[40px]"}
157
- `,children:[e.jsx("audio",{ref:q,src:o,onEnded:()=>{b(!1),B(0)}}),e.jsx("div",{style:{width:`${(z>0?I/z:0)*100}%`,backgroundImage:j.background},className:"absolute top-0 left-0 h-full opacity-20"}),e.jsxs("div",{className:"absolute flex flex-col",children:[c&&e.jsx("div",{className:"w-24 pb-2",children:e.jsx("img",{src:c,alt:"",className:"w-24 aspect-square rounded-xl"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:A,style:j,className:"p-1.5 rounded-full hover:scale-110 transition-transform flex-shrink-0",children:g?e.jsx($e,{fill:p,className:"w-3 h-3 text-transparent"}):e.jsx(Ee,{fill:p,className:"w-3 h-3 text-transparent"})}),e.jsx("div",{className:"flex w-full min-w-12 items-center gap-0.5 h-6",children:[...Array(12)].map((w,$)=>e.jsx("div",{className:"rounded-full transition-all duration-200",style:{width:"100%",background:`linear-gradient(to top, ${f[0]}, ${f[1]})`,height:g?`${8+Math.sin((E*8+$)*.6)*10}px`:"8px",opacity:g?.8:.4}},$))})]})]})]})}function tt({video:o,name:c="No video loaded",audioVisual:f=null,volume:p=100,thumbnail:N=null,controls:g={play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,fullscreen:!0,videoName:!0,equalizer:!0,speed:!0},mode:b="light",transparent:x=!1,autoPlay:q=!1,color:E="#3b82f6",equalizer:O={bass:0,mid:0,treble:0}}){const[z,S]=r.useState(!1),[I,B]=r.useState(0),[A,j]=r.useState(0),[w,$]=r.useState(p||100),[ce,re]=r.useState(!1),[fe,U]=r.useState(!1),[W,ne]=r.useState(!1),[se,H]=r.useState([]),[ie,T]=r.useState(!1),[L,M]=r.useState({bass:O.bass||0,mid:O.mid||0,treble:O.treble||0}),[le,de]=r.useState(1),[Y,Q]=r.useState(0),v=r.useRef(null),u=r.useRef(null),P=r.useRef(null),G=r.useRef(null),ge=r.useRef(null),D=r.useRef(null),R=r.useRef(null),K=r.useRef(null),k=r.useRef(null),ee=r.useRef(null),X=r.useRef(0),n=r.useRef(0),d=r.useRef(0),y=r.useRef(0),F=r.useRef(0),_=r.useRef(0),Z=r.useRef(!1),i=b==="dark"||W,h=typeof g=="object"&&Object.keys(g).length===0;r.useEffect(()=>{const t=u.current;if(!t)return;const a=new ResizeObserver(s=>{for(let l of s)Q(l.contentRect.width)});return a.observe(t),()=>a.disconnect()},[]),r.useEffect(()=>{const t=[];o&&typeof o!="string"&&t.push(["TypeError","video must be a string (URL or path)"]),c&&typeof c!="string"&&t.push(["TypeError","name must be a string"]),(typeof p!="number"||p<0||p>100)&&t.push(["TypeError","volume must be a number between 0 and 100"]),f&&typeof f!="object"?t.push(["TypeError","audioVisual must be an object"]):f&&(["left","right","top","bottom"].includes(f.side)||t.push(["ValueError","audioVisual.side must be 'left', 'right', 'top', or 'bottom'"])),t.length>0?(H(t),console.group("%cVideoPlayer: Prop validation failed","color:red"),t.forEach(a=>console.error(`${a[0]}: ${a[1]}`)),console.groupEnd()):H([])},[o,c,p,f,g,b]),r.useEffect(()=>{if(!v.current)return;const t=v.current,a=()=>{fe||B(t.currentTime)},s=()=>{j(t.duration)},l=()=>{S(!1),k.current&&cancelAnimationFrame(k.current)},m=()=>S(!0),C=()=>S(!1);return t.addEventListener("timeupdate",a),t.addEventListener("loadedmetadata",s),t.addEventListener("ended",l),t.addEventListener("play",m),t.addEventListener("pause",C),()=>{t.removeEventListener("timeupdate",a),t.removeEventListener("loadedmetadata",s),t.removeEventListener("ended",l),t.removeEventListener("play",m),t.removeEventListener("pause",C)}},[fe]),r.useEffect(()=>{if(o){const t=z,a=w;if(v.current&&v.current.pause(),v.current){v.current.pause(),v.current.src=o,v.current.volume=ce?0:a/100;const s=()=>{t&&v.current&&v.current.play().catch(l=>console.error("Play failed:",l)),v.current&&v.current.removeEventListener("canplay",s)};v.current.addEventListener("canplay",s),v.current.load()}B(0),S(!1),X.current=0,n.current=0,d.current=0,y.current=0,F.current=0,_.current=0,he()}},[o]),r.useEffect(()=>{v.current&&(v.current.volume=ce?0:w/100)},[w,ce]),r.useEffect(()=>{v.current&&(v.current.playbackRate=le)},[le]),r.useEffect(()=>{P.current&&(D.current&&(D.current.gain.value=L.bass),R.current&&(R.current.gain.value=L.mid),K.current&&(K.current.gain.value=L.treble))},[L]),r.useEffect(()=>{Z.current=z,k.current&&(cancelAnimationFrame(k.current),k.current=null),z&&f?(P.current||ue(),me()):!z&&f&&qe()},[z,f]),r.useEffect(()=>{const t=()=>{ne(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),r.useEffect(()=>()=>{k.current&&cancelAnimationFrame(k.current),P.current&&P.current.close().catch(t=>console.warn("AudioContext cleanup error:",t))},[]);const ue=()=>{if(!P.current&&v.current)try{const t=window.AudioContext||window.webkitAudioContext;if(t){const a=new t;P.current=a;const s=a.createBiquadFilter();s.type="lowshelf",s.frequency.value=320,s.gain.value=L.bass;const l=a.createBiquadFilter();l.type="peaking",l.frequency.value=1e3,l.Q.value=.5,l.gain.value=L.mid;const m=a.createBiquadFilter();m.type="highshelf",m.frequency.value=3200,m.gain.value=L.treble;const C=a.createAnalyser();C.fftSize=2048,C.smoothingTimeConstant=.8;const te=a.createMediaElementSource(v.current);te.connect(s),s.connect(l),l.connect(m),m.connect(C),m.connect(a.destination),D.current=s,R.current=l,K.current=m,G.current=C,ge.current=te}}catch(t){console.error("Failed to setup audio context:",t)}},qe=()=>{if(Z.current)return;X.current*=.7,n.current*=.7;const t=Date.now();t-F.current>1500&&(d.current*=.95),t-_.current>1500&&(y.current*=.95),he();const a=Math.max(X.current,n.current),s=Math.max(d.current,y.current);a>.01||s>.01?k.current=requestAnimationFrame(qe):(Z.current||(X.current=0,n.current=0,d.current=0,y.current=0,he()),k.current&&cancelAnimationFrame(k.current),k.current=null)},me=()=>{if(!G.current||!Z.current)return;const t=G.current.frequencyBinCount,a=new Uint8Array(t);G.current.getByteFrequencyData(a);let s=0;for(let C=0;C<t;C++)s+=a[C];let l=s/t/255;l=Math.pow(l,.5),X.current=X.current*.7+l*.3,n.current=n.current*.7+l*.3;const m=Date.now();X.current>d.current?(d.current=X.current,F.current=m):m-F.current>1500&&(d.current*=.95),n.current>y.current?(y.current=n.current,_.current=m):m-_.current>1500&&(y.current*=.95),he(),k.current=requestAnimationFrame(me)},he=()=>{if(!ee.current||!f)return;const t=f.color||"#00ff00",a=f.peak||"#ff0000",s=X.current*100,l=n.current*100,m=100-d.current*100,C=100-y.current*100;f.side==="top"||f.side==="bottom"?ee.current.innerHTML=`
158
- <div class="flex flex-col gap-1 h-full justify-center">
159
- <div class="flex items-center justify-center gap-2">
160
- <div class="text-xs ${i?"text-gray-100":"text-gray-900"} opacity-80 w-4 text-center">L</div>
161
- <div class="relative flex-1 h-3 bg-black/40 rounded-full overflow-hidden flex justify-end">
162
- <div class="h-full rounded-l-full transition-all duration-75" style="width: ${s}%; background: ${t};"></div>
163
- ${d.current>.1?`<div class="absolute top-0 w-1 h-full transition-all duration-100" style="right: ${d.current*100}%; background: ${a};"></div>`:""}
78
+ `}),S.current.innerHTML=s},xe=()=>{!p.current||!c||($?p.current.pause():(E.current&&E.current.state==="suspended"&&E.current.resume(),p.current.play().catch(r=>console.error("Play failed:",r))))},Se=()=>{p.current&&(p.current.pause(),p.current.currentTime=0,_(!1),L(0),d.current=n.map(()=>0),b.current=n.map(()=>0),z.current=n.map(()=>0),ve())},Pe=r=>{const l=parseFloat(r.target.value)/100*T;L(l),p.current&&!se&&(p.current.currentTime=l)},Le=()=>ce(!0),Te=()=>{p.current&&(p.current.currentTime=F),ce(!1)},ze=r=>{const s=parseInt(r.target.value);M(s),pe(s===0)},_e=()=>pe(!re),je=r=>R(parseFloat(r.target.value)),Be=()=>J(!U),Ae=(r,s)=>oe(l=>({...l,[r]:s})),be=()=>oe({bass:0,mid:0,treble:0});t.useEffect(()=>{((typeof m=="object"&&Object.keys(m).length===0||!m)&&!$||j)&&xe()},[m]);const we=r=>{if(isNaN(r))return"0:00";const s=Math.floor(r/60),l=Math.floor(r%60);return`${s}:${l.toString().padStart(2,"0")}`};if(ne&&ne.length>0)return e.jsx(e.Fragment,{children:ne.map((r,s)=>e.jsxs("div",{className:"ecp-vp-error",children:[e.jsxs("strong",{children:[r[0],":"]})," ",r[1]]},s))});const He=ge||P?void 0:C?"#6060606a":"#ffffffab",Ie=ge||P?void 0:h.bg,a=`ecp-vp-vu-bg ${P?" ecp-vp-vu-bg--transparent":C?" ecp-vp-vu-bg--dark":" ecp-vp-vu-bg--light"}${x&&P?" ecp-vp-vu-bg--dimmed":""}${ge?" ecp-vp-vu-bg--no-margin":""}`;return e.jsx("div",{ref:K,className:"ecp-vp-wrapper",style:{backgroundColor:He},children:e.jsxs("div",{className:"ecp-vp-bg",style:{background:Ie},children:[e.jsxs("div",{className:"ecp-vp-vu-outer",children:[e.jsx("div",{className:a,children:e.jsx("div",{className:"ecp-vp-vu-bars",ref:S})}),x&&e.jsxs("div",{className:`ecp-vp-eq-overlay${C?" ecp-vp-eq-overlay--dark":" ecp-vp-eq-overlay--light"}`,children:[e.jsx("h3",{className:`ecp-vp-eq-title${C?" ecp-vp-eq-title--dark":" ecp-vp-eq-title--light"}`,children:"Equalizer"}),e.jsx("div",{className:"ecp-vp-eq-bands",children:["bass","mid","treble"].map(r=>e.jsxs("div",{className:"ecp-vp-eq-band",children:[e.jsxs("div",{className:"ecp-vp-eq-band-header",children:[e.jsx("span",{className:`ecp-vp-eq-band-label${C?" ecp-vp-eq-band-label--dark":" ecp-vp-eq-band-label--light"}`,children:r.charAt(0).toUpperCase()+r.slice(1)}),e.jsxs("span",{className:`ecp-vp-eq-band-label${C?" ecp-vp-eq-band-label--dark":" ecp-vp-eq-band-label--light"}`,children:[W[r]," dB"]})]}),e.jsxs("div",{className:"ecp-vp-eq-band-range",children:[e.jsx("span",{className:`ecp-vp-eq-range-bound${C?" ecp-vp-eq-range-bound--dark":" ecp-vp-eq-range-bound--light"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:W[r],onChange:s=>Ae(r,parseInt(s.target.value)),className:"ecp-vp-eq-slider",style:{background:`linear-gradient(to right, ${h.slider} ${(W[r]+20)/40*100}%, ${h.slider+"30"} ${(W[r]+20)/40*100}%)`,"--thumb-color":h.slider}}),e.jsx("span",{className:`ecp-vp-eq-range-bound${C?" ecp-vp-eq-range-bound--dark":" ecp-vp-eq-range-bound--light"}`,children:"+20"})]})]},r))}),e.jsx("div",{className:"ecp-vp-eq-footer",children:e.jsx("button",{onClick:be,className:`ecp-vp-eq-reset${C?" ecp-vp-eq-reset--dark":" ecp-vp-eq-reset--light"}`,children:"Reset"})})]})]}),m.trackName&&e.jsxs("div",{className:"ecp-vp-track",children:[f&&e.jsx("div",{className:"ecp-vp-thumbnail-wrap",children:e.jsx("img",{src:f,alt:"",className:`ecp-vp-thumbnail${$?" ecp-animation-spin":""}`})}),e.jsxs("div",{className:"ecp-vp-track-info",children:[e.jsx("div",{className:`ecp-vp-track-name${C?" ecp-vp-track-name--dark":" ecp-vp-track-name--light"}`,children:i}),u&&typeof u=="string"&&e.jsx("div",{className:`ecp-vp-track-author${C?" ecp-vp-track-author--dark":" ecp-vp-track-author--light"}`,children:u})]})]}),m.seekbar&&e.jsx("div",{className:"ecp-vp-seekbar",children:e.jsxs("div",{className:"ecp-vp-seekbar-row",children:[e.jsx("span",{className:`ecp-vp-time${C?" ecp-vp-time--dark":" ecp-vp-time--light"}`,children:we(F)}),e.jsx("input",{type:"range",min:"0",max:"100",value:T>0?F/T*100:0,onChange:Pe,onMouseDown:Le,onMouseUp:Te,onTouchStart:Le,onTouchEnd:Te,disabled:!c,className:"ecp-vp-seek-input",style:{background:c&&T>0?`linear-gradient(to right, ${h.slider} ${F/T*100}%, ${h.slider+"30"} ${F/T*100}%)`:h.slider+"30","--thumb-color":h.slider}}),e.jsx("span",{className:`ecp-vp-time ecp-vp-time--right${C?" ecp-vp-time--dark":" ecp-vp-time--light"}`,children:we(T)})]})}),e.jsxs("div",{className:`ecp-vp-controls${Q<330?" ecp-vp-controls--sm":""}`,children:[m.play&&e.jsxs("button",{onClick:xe,disabled:!c,className:`ecp-vp-play-btn${Q<350?" ecp-vp-play-btn--compact":""}`,style:{backgroundColor:h.button},children:[e.jsxs("div",{className:"ecp-vp-play-icon-wrap",children:[e.jsx(qe,{size:16,style:{position:"absolute",transform:$?void 0:"scale(0) translateY(2.5rem)",transition:"all 150ms"}}),e.jsx($e,{size:16,style:{position:"absolute",transform:$?"scale(0) translateY(-2.5rem)":void 0,transition:"all 150ms"}})]}),e.jsx("span",{style:{display:Q<350?"none":"block"},children:$?"Pause":"Play"})]}),m.stop&&e.jsxs("button",{onClick:Se,disabled:!c,className:`ecp-vp-stop-btn${C?" ecp-vp-stop-btn--dark":" ecp-vp-stop-btn--light"}${Q>=600?" ecp-vp-stop-btn--wide":""}`,children:[e.jsx(Ve,{size:16}),e.jsx("span",{style:{display:Q<600?"none":"block"},children:"Stop"})]}),m.equalizer&&e.jsxs("button",{onClick:()=>V(!x),disabled:!c,className:`ecp-vp-eq-btn${x?" ecp-vp-eq-btn--on":" ecp-vp-eq-btn--off"}${Q>=600?" ecp-vp-eq-btn--wide":""}`,style:x?{backgroundColor:h.button}:{},children:[e.jsx(Ee,{size:16}),e.jsx("span",{style:{display:Q<600?"none":"block"},children:"EQ"})]}),m.loop&&e.jsxs("button",{onClick:Be,disabled:!c,className:`ecp-vp-loop-btn${U?" ecp-vp-loop-btn--on":" ecp-vp-loop-btn--off"}${Q>=700?" ecp-vp-loop-btn--wide":""}`,style:U?{backgroundColor:h.button}:{},children:[e.jsx(rt,{size:16,className:U?"ecp-vp-loop-icon--active":""}),e.jsx("span",{style:{display:Q<700?"none":"block"},children:"Loop"})]}),m.speed&&e.jsx("div",{className:"ecp-vp-speed-wrap",children:e.jsx("select",{value:de,onChange:je,className:`ecp-vp-speed-select${C?" ecp-vp-speed-select--dark":" ecp-vp-speed-select--light"}`,children:["0.5","0.75","1","1.25","1.5","2"].map(r=>e.jsxs("option",{value:r,className:C?"ecp-vp-speed-option--dark":"ecp-vp-speed-option--light",children:[r,"x"]},r))})}),m.volume&&e.jsxs("div",{className:"ecp-vp-volume",children:[e.jsx("button",{onClick:_e,className:"ecp-vp-mute-btn",children:re||g===0?e.jsx(Me,{size:20,className:C?"ecp-vp-mute-icon--dark":"ecp-vp-mute-icon--light"}):e.jsx(Fe,{size:20,className:C?"ecp-vp-mute-icon--dark":"ecp-vp-mute-icon--light"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:g,onChange:ze,className:"ecp-vp-volume-slider",style:{background:`linear-gradient(to right, ${h.slider} ${g}%, ${h.slider+"30"} ${g}%)`,"--thumb-color":h.slider,display:Q<460?"none":"block"}}),e.jsxs("span",{className:`ecp-vp-volume-pct${C?" ecp-vp-volume-pct--dark":" ecp-vp-volume-pct--light"}`,style:{display:Q<800?"none":"block"},children:[g,"%"]})]})]})]})})}function Ye({audio:c,gradient:i=["#cd7eff","#ff00f2"],background:u="#f4e4ffff",autoPlay:v=!1,thumbnail:N=null,width:f,equalizer:m={bass:0,mid:0,treble:0},mode:D="light"}){const[q,P]=t.useState(!1),[j,A]=t.useState(0),[$,_]=t.useState(0),[F,L]=t.useState(!1),[T,B]=t.useState(80),[g,M]=t.useState(1),[re,pe]=t.useState([]),[U,J]=t.useState(null),[se,ce]=t.useState(!1),[ne,ie]=t.useState({bass:m.bass||0,mid:m.mid||0,treble:m.treble||0}),x=t.useRef(null),V=t.useRef(null),W=t.useRef(null),oe=t.useRef(null),de=t.useRef(null),R=t.useRef(null),Q=()=>{const n=[];for(let d=0;d<100;d++)n.push(20+Math.random()*60);return n};t.useEffect(()=>{if(!c)return;if(!Array.isArray(i)||i.length<2){J("Gradient must be an array with at least 2 colors");return}const n=x.current;if(!n)return;const d=()=>A(n.currentTime),b=()=>{_(n.duration),pe(Q())},z=()=>P(!1),H=X=>{var h,C;return J(`Audio error: ${((C=(h=X.target)==null?void 0:h.error)==null?void 0:C.message)||"Failed to load audio"}`)};return n.addEventListener("timeupdate",d),n.addEventListener("loadedmetadata",b),n.addEventListener("ended",z),n.addEventListener("error",H),()=>{n.removeEventListener("timeupdate",d),n.removeEventListener("loadedmetadata",b),n.removeEventListener("ended",z),n.removeEventListener("error",H)}},[c,i,D]),t.useEffect(()=>{c&&x.current&&v&&(x.current.play().catch(n=>{console.error("Play failed:",n),P(!1)}),P(!0))},[c]),t.useEffect(()=>{if(x.current&&!V.current&&x.current){const n=window.AudioContext||window.webkitAudioContext;if(n){const d=new n;V.current=d;const b=d.createMediaElementSource(x.current);W.current=b;const z=d.createBiquadFilter();z.type="lowshelf",z.frequency.value=200,oe.current=z;const H=d.createBiquadFilter();H.type="peaking",H.frequency.value=1e3,H.Q.value=1,de.current=H;const X=d.createBiquadFilter();X.type="highshelf",X.frequency.value=3e3,R.current=X,b.connect(z).connect(H).connect(X).connect(d.destination)}}},[c]),t.useEffect(()=>{x.current&&(x.current.volume=F?0:T/100)},[T,F]),t.useEffect(()=>{x.current&&(x.current.playbackRate=g)},[g]);const y=()=>{x.current&&(q?x.current.pause():x.current.play().catch(n=>J(`Playback failed: ${n instanceof Error?n.message:String(n)}`)),P(!q))},p=()=>L(!F),E=n=>{B(parseInt(n.target.value)),F&&parseInt(n.target.value)>0&&L(!1)},Y=n=>M(parseFloat(n.target.value)),fe=n=>{const d=n.currentTarget.getBoundingClientRect(),z=(n.clientX-d.left)/d.width*$;x.current&&(x.current.currentTime=z,A(z))},O=(n,d)=>{ie(b=>({...b,[n]:d})),n==="bass"&&oe.current&&(oe.current.gain.value=d),n==="mid"&&de.current&&(de.current.gain.value=d),n==="treble"&&R.current&&(R.current.gain.value=d)},ee=()=>{O("bass",0),O("mid",0),O("treble",0)},G=n=>{if(isNaN(n))return"0:00";const d=Math.floor(n/60),b=Math.floor(n%60);return`${d}:${b.toString().padStart(2,"0")}`},k=$>0?j/$*100:0,S=D==="dark";if(U)return e.jsxs("div",{className:"ecp-wave-error",style:{background:u},children:[e.jsx("p",{className:`ecp-wave-error-title${S?" ecp-wave-error--dark":" ecp-wave-error--light"}`,children:"Error"}),e.jsx("p",{className:`ecp-wave-error-msg${S?" ecp-wave-error--dark":" ecp-wave-error--light"}`,children:U})]});if(!c)return null;const K=S?"#9ca3af":"#6b7280";return e.jsxs("div",{className:"ecp-wave-outer",style:{width:f?`${f}px`:void 0},children:[e.jsx("audio",{ref:x,src:c,className:"ecp-wave-audio-el"}),e.jsx("div",{className:"ecp-wave-card",children:e.jsxs("div",{className:"ecp-wave-card-inner",style:{background:u},children:[N&&e.jsx("div",{className:"ecp-wave-thumbnail-wrap",children:e.jsx("img",{src:N,alt:"",className:"ecp-wave-thumbnail"})}),e.jsxs("div",{className:"ecp-wave-seek",onClick:fe,children:[e.jsx("div",{className:"ecp-wave-bars",children:re.map((n,d)=>{const b=d/re.length*100<=k;return e.jsx("div",{className:"ecp-wave-bar",style:{height:`${n}%`,background:b?i[0]:i[1],opacity:b?1:.4}},d)})}),e.jsx("div",{className:"ecp-wave-progress-line",style:{left:`${k}%`}})]}),e.jsxs("div",{className:"ecp-wave-times",style:{color:K},children:[e.jsx("span",{children:G(j)}),e.jsx("span",{children:G($)})]}),e.jsxs("div",{className:"ecp-wave-controls",children:[e.jsxs("div",{className:"ecp-wave-left-controls",children:[e.jsx("button",{onClick:p,className:"ecp-wave-vol-btn",style:{background:`linear-gradient(135deg, ${i[0]}, ${i[1]})`},children:F||T===0?e.jsx(Me,{style:{width:"1rem",height:"1rem",color:"white"}}):e.jsx(Fe,{style:{width:"1rem",height:"1rem",color:"white"}})}),e.jsx("input",{type:"range",min:"0",max:"100",value:T,onChange:E,className:"ecp-wave-vol-slider",style:{background:`linear-gradient(to right, ${i[0]} ${T}%, ${S?"#374151":"#d1d5db"} ${T}%)`,"--thumb-color":i[0],display:f&&f<400?"none":void 0}}),f&&f<400&&e.jsx("button",{onClick:()=>ce(!se),className:"ecp-wave-eq-btn",style:{background:`linear-gradient(135deg, ${i[0]}, ${i[1]})`},children:e.jsx(Ee,{style:{width:"1rem",height:"1rem",color:"white"}})})]}),e.jsx("div",{className:"ecp-wave-center-controls",children:e.jsx("button",{onClick:y,className:"ecp-wave-play-btn",style:{background:`linear-gradient(135deg, ${i[0]}, ${i[1]})`},children:q?e.jsx(qe,{style:{width:"1.5rem",height:"1.5rem",color:"white",fill:"white"}}):e.jsx($e,{style:{width:"1.5rem",height:"1.5rem",color:"white",fill:"white"}})})}),e.jsxs("div",{className:"ecp-wave-right-controls",children:[e.jsx("select",{value:g,onChange:Y,className:`ecp-wave-speed-select${S?" ecp-wave-speed-select--dark":" ecp-wave-speed-select--light"}`,style:{background:u,color:i[0]},children:["0.5","0.75","1","1.25","1.5","2"].map(n=>e.jsxs("option",{value:n,children:[n,"x"]},n))}),!(f&&f<400)&&e.jsx("button",{onClick:()=>ce(!se),className:"ecp-wave-eq-btn",style:{background:`linear-gradient(135deg, ${i[0]}, ${i[1]})`},children:e.jsx(Ee,{style:{width:"1rem",height:"1rem",color:"white"}})})]})]})]})}),se&&e.jsx("div",{className:"ecp-wave-eq-overlay",children:e.jsxs("div",{className:`ecp-wave-eq-panel${S?" ecp-wave-eq-panel--dark":" ecp-wave-eq-panel--light"}`,children:[e.jsx("h3",{className:`ecp-wave-eq-title${S?" ecp-wave-eq-title--dark":" ecp-wave-eq-title--light"}`,children:"Equalizer"}),e.jsx("div",{className:"ecp-wave-eq-bands",children:["bass","mid","treble"].map(n=>e.jsxs("div",{children:[e.jsxs("div",{className:"ecp-wave-eq-band-header",children:[e.jsx("span",{className:S?"ecp-wave-eq-label--dark":"ecp-wave-eq-label--light",children:n.charAt(0).toUpperCase()+n.slice(1)}),e.jsxs("span",{className:S?"ecp-wave-eq-label--dark":"ecp-wave-eq-label--light",children:[ne[n]," dB"]})]}),e.jsxs("div",{className:"ecp-wave-eq-range-row",children:[e.jsx("span",{className:S?"ecp-wave-eq-bound--dark":"ecp-wave-eq-bound--light",children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:ne[n],onChange:d=>O(n,parseInt(d.target.value)),className:"ecp-wave-eq-slider",style:{background:`linear-gradient(to right, ${i[0]} ${(ne[n]+20)/40*100}%, ${i[1]+"30"} ${(ne[n]+20)/40*100}%)`,"--thumb-color":i[0]}}),e.jsx("span",{className:S?"ecp-wave-eq-bound--dark":"ecp-wave-eq-bound--light",children:"+20"})]})]},n))}),e.jsxs("div",{className:"ecp-wave-eq-footer",children:[e.jsx("button",{onClick:ee,className:`ecp-wave-eq-footer-btn${S?" ecp-wave-eq-footer-btn--dark":" ecp-wave-eq-footer-btn--light"}`,children:"Reset"}),e.jsx("button",{onClick:()=>ce(!1),className:`ecp-wave-eq-footer-btn${S?" ecp-wave-eq-footer-btn--dark":" ecp-wave-eq-footer-btn--light"}`,children:"Close"})]})]})})]})}function Ge({audio:c,thumbnail:i,gradient:u=["#cd7eff","#fe59f6"],background:v="#1f273a",autoPlay:N=!1}){const[f,m]=t.useState(!1),[,D]=t.useState(0),q=t.useRef(null),[P,j]=t.useState(0),[A,$]=t.useState(0),[_,F]=t.useState(0);t.useEffect(()=>{const g=q.current;if(!g)return;const M=()=>D(g.currentTime);return g.addEventListener("timeupdate",M),()=>g.removeEventListener("timeupdate",M)},[]),t.useEffect(()=>{const g=setInterval(()=>{f&&j(M=>M+.1)},100);return()=>clearInterval(g)},[f]),t.useEffect(()=>{const g=setInterval(()=>{f&&F(M=>M+.1)},100);return()=>clearInterval(g)},[f]),t.useEffect(()=>{c&&q.current&&N&&(q.current.play().catch(()=>m(!1)),m(!0))},[c]),t.useEffect(()=>{const g=q.current;if(!g)return;const M=()=>$(g.duration);return F(0),g.addEventListener("loadedmetadata",M),()=>g.removeEventListener("loadedmetadata",M)},[c]);const L=()=>{q.current&&(f?q.current.pause():q.current.play().catch(g=>console.error("NanoPlayer play failed:",g)),m(!f))};if(!c)return null;const T=`linear-gradient(135deg, ${u[0]}, ${u[1]})`,B=`${(A>0?_/A:0)*100}%`;return e.jsxs("div",{className:`ecp-nano-wrapper${i?" ecp-nano-wrapper--card":" ecp-nano-wrapper--pill"}`,style:{backgroundColor:v},children:[e.jsx("audio",{ref:q,src:c,onEnded:()=>{m(!1),F(0)}}),e.jsx("div",{className:"ecp-nano-progress-bg",style:{width:B,backgroundImage:T}}),e.jsxs("div",{className:"ecp-nano-content",children:[i&&e.jsx("div",{className:"ecp-nano-thumbnail-wrap",children:e.jsx("img",{src:i,alt:"",className:"ecp-nano-thumbnail"})}),e.jsxs("div",{className:"ecp-nano-row",children:[e.jsx("button",{onClick:L,className:"ecp-nano-play-btn",style:{background:T},children:f?e.jsx(qe,{fill:v,style:{width:"0.75rem",height:"0.75rem",color:"transparent"}}):e.jsx($e,{fill:v,style:{width:"0.75rem",height:"0.75rem",color:"transparent"}})}),e.jsx("div",{className:"ecp-nano-waveform",children:[...Array(12)].map((g,M)=>e.jsx("div",{className:"ecp-nano-wave-bar",style:{background:`linear-gradient(to top, ${u[0]}, ${u[1]})`,height:f?`${8+Math.sin((P*8+M)*.6)*10}px`:"8px",opacity:f?.8:.4}},M))})]})]})]})}function at({video:c,name:i="No video loaded",audioVisual:u=null,volume:v=100,thumbnail:N=null,controls:f={play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,fullscreen:!0,videoName:!0,equalizer:!0,speed:!0},mode:m="light",transparent:D=!1,autoPlay:q=!1,color:P="#3b82f6",equalizer:j={bass:0,mid:0,treble:0}}){const[A,$]=t.useState(!1),[_,F]=t.useState(0),[L,T]=t.useState(0),[B,g]=t.useState(v||100),[M,re]=t.useState(!1),[pe,U]=t.useState(!1),[J,se]=t.useState(!1),[ce,ne]=t.useState([]),[ie,x]=t.useState(!1),[V,W]=t.useState({bass:j.bass||0,mid:j.mid||0,treble:j.treble||0}),[oe,de]=t.useState(1),[R,Q]=t.useState(0),y=t.useRef(null),p=t.useRef(null),E=t.useRef(null),Y=t.useRef(null),fe=t.useRef(null),O=t.useRef(null),ee=t.useRef(null),G=t.useRef(null),k=t.useRef(null),S=t.useRef(null),K=t.useRef(0),n=t.useRef(0),d=t.useRef(0),b=t.useRef(0),z=t.useRef(0),H=t.useRef(0),X=t.useRef(!1),h=m==="dark"||J,C=typeof f=="object"&&Object.keys(f).length===0;t.useEffect(()=>{const a=p.current;if(!a)return;const r=new ResizeObserver(s=>{for(let l of s)Q(l.contentRect.width)});return r.observe(a),()=>r.disconnect()},[]),t.useEffect(()=>{const a=[];c&&typeof c!="string"&&a.push(["TypeError","video must be a string (URL or path)"]),i&&typeof i!="string"&&a.push(["TypeError","name must be a string"]),(typeof v!="number"||v<0||v>100)&&a.push(["TypeError","volume must be a number between 0 and 100"]),u&&typeof u!="object"?a.push(["TypeError","audioVisual must be an object"]):u&&!["left","right","top","bottom"].includes(u.side)&&a.push(["ValueError","audioVisual.side must be 'left', 'right', 'top', or 'bottom'"]),a.length>0?ne(a):ne([])},[c,i,v,u,f,m]),t.useEffect(()=>{if(!y.current)return;const a=y.current,r=()=>{pe||F(a.currentTime)},s=()=>T(a.duration),l=()=>{$(!1),k.current&&cancelAnimationFrame(k.current)},o=()=>$(!0),w=()=>$(!1);return a.addEventListener("timeupdate",r),a.addEventListener("loadedmetadata",s),a.addEventListener("ended",l),a.addEventListener("play",o),a.addEventListener("pause",w),()=>{a.removeEventListener("timeupdate",r),a.removeEventListener("loadedmetadata",s),a.removeEventListener("ended",l),a.removeEventListener("play",o),a.removeEventListener("pause",w)}},[pe]),t.useEffect(()=>{if(c){const a=A,r=B;if(y.current){y.current.pause(),y.current.src=c,y.current.volume=M?0:r/100;const s=()=>{a&&y.current&&y.current.play().catch(l=>console.error("Play failed:",l)),y.current&&y.current.removeEventListener("canplay",s)};y.current.addEventListener("canplay",s),y.current.load()}F(0),$(!1),K.current=0,n.current=0,d.current=0,b.current=0,z.current=0,H.current=0,he()}},[c]),t.useEffect(()=>{y.current&&(y.current.volume=M?0:B/100)},[B,M]),t.useEffect(()=>{y.current&&(y.current.playbackRate=oe)},[oe]),t.useEffect(()=>{E.current&&(O.current&&(O.current.gain.value=V.bass),ee.current&&(ee.current.gain.value=V.mid),G.current&&(G.current.gain.value=V.treble))},[V]),t.useEffect(()=>{X.current=A,k.current&&(cancelAnimationFrame(k.current),k.current=null),A&&u?(E.current||ge(),ye()):!A&&u&&Ce()},[A,u]),t.useEffect(()=>{const a=()=>se(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",a),()=>document.removeEventListener("fullscreenchange",a)},[]),t.useEffect(()=>()=>{k.current&&cancelAnimationFrame(k.current),E.current&&E.current.close().catch(a=>console.warn("AudioContext cleanup error:",a))},[]);const ge=()=>{if(!E.current&&y.current)try{const a=window.AudioContext||window.webkitAudioContext;if(a){const r=new a;E.current=r;const s=r.createBiquadFilter();s.type="lowshelf",s.frequency.value=320,s.gain.value=V.bass;const l=r.createBiquadFilter();l.type="peaking",l.frequency.value=1e3,l.Q.value=.5,l.gain.value=V.mid;const o=r.createBiquadFilter();o.type="highshelf",o.frequency.value=3200,o.gain.value=V.treble;const w=r.createAnalyser();w.fftSize=2048,w.smoothingTimeConstant=.8;const I=r.createMediaElementSource(y.current);I.connect(s),s.connect(l),l.connect(o),o.connect(w),o.connect(r.destination),O.current=s,ee.current=l,G.current=o,Y.current=w,fe.current=I}}catch(a){console.error("Failed to setup audio context:",a)}},Ce=()=>{if(X.current)return;K.current*=.7,n.current*=.7;const a=Date.now();a-z.current>1500&&(d.current*=.95),a-H.current>1500&&(b.current*=.95),he();const r=Math.max(K.current,n.current),s=Math.max(d.current,b.current);r>.01||s>.01?k.current=requestAnimationFrame(Ce):(X.current||(K.current=0,n.current=0,d.current=0,b.current=0,he()),k.current&&cancelAnimationFrame(k.current),k.current=null)},ye=()=>{if(!Y.current||!X.current)return;const a=Y.current.frequencyBinCount,r=new Uint8Array(a);Y.current.getByteFrequencyData(r);let s=0;for(let w=0;w<a;w++)s+=r[w];let l=Math.pow(s/a/255,.5);K.current=K.current*.7+l*.3,n.current=n.current*.7+l*.3;const o=Date.now();K.current>d.current?(d.current=K.current,z.current=o):o-z.current>1500&&(d.current*=.95),n.current>b.current?(b.current=n.current,H.current=o):o-H.current>1500&&(b.current*=.95),he(),k.current=requestAnimationFrame(ye)},he=()=>{if(!S.current||!u)return;const a=u.color||"#00ff00",r=u.peak||"#ff0000",s=K.current*100,l=n.current*100,o=100-d.current*100,w=100-b.current*100;u.side==="top"||u.side==="bottom"?S.current.innerHTML=`
79
+ <div style="display:flex;flex-direction:column;gap:0.25rem;height:100%;justify-content:center;">
80
+ <div style="display:flex;align-items:center;justify-content:center;gap:0.5rem;">
81
+ <div style="font-size:0.75rem;opacity:0.8;width:1rem;text-align:center;color:${h?"#f3f4f6":"#111827"}">L</div>
82
+ <div style="position:relative;flex:1;height:0.75rem;background:rgba(0,0,0,0.4);border-radius:9999px;overflow:hidden;display:flex;justify-content:flex-end;">
83
+ <div style="height:100%;border-radius:9999px 0 0 9999px;transition:width 75ms;width:${s}%;background:${a};"></div>
84
+ ${d.current>.1?`<div style="position:absolute;top:0;width:0.25rem;height:100%;transition:right 100ms;right:${d.current*100}%;background:${r};"></div>`:""}
164
85
  </div>
165
- <div class="w-px h-4 bg-white/20"></div>
166
- <div class="relative flex-1 h-3 bg-black/40 rounded-full overflow-hidden flex justify-start">
167
- <div class="h-full rounded-r-full transition-all duration-75" style="width: ${l}%; background: ${t};"></div>
168
- ${y.current>.1?`<div class="absolute top-0 w-1 h-full transition-all duration-100" style="left: ${y.current*100}%; background: ${a};"></div>`:""}
86
+ <div style="width:1px;height:1rem;background:rgba(255,255,255,0.2)"></div>
87
+ <div style="position:relative;flex:1;height:0.75rem;background:rgba(0,0,0,0.4);border-radius:9999px;overflow:hidden;display:flex;justify-content:flex-start;">
88
+ <div style="height:100%;border-radius:0 9999px 9999px 0;transition:width 75ms;width:${l}%;background:${a};"></div>
89
+ ${b.current>.1?`<div style="position:absolute;top:0;width:0.25rem;height:100%;transition:left 100ms;left:${b.current*100}%;background:${r};"></div>`:""}
169
90
  </div>
170
- <div class="text-xs ${i?"text-gray-100":"text-gray-900"} opacity-80 w-4 text-center">R</div>
91
+ <div style="font-size:0.75rem;opacity:0.8;width:1rem;text-align:center;color:${h?"#f3f4f6":"#111827"}">R</div>
171
92
  </div>
172
93
  </div>
173
- `:ee.current.innerHTML=`
174
- <div class="flex gap-2 h-full">
175
- <div class="flex-1 flex flex-col">
176
- <div class="text-xs text-white opacity-70 text-center mb-1">L</div>
177
- <div class="flex-1 relative flex flex-col justify-end bg-black/30 rounded-lg overflow-hidden">
178
- <div class="rounded-t transition-all duration-75" style="height: ${s}%; background: ${t};">
179
- ${d.current>.1?`<div class="absolute w-full h-1 transition-all duration-100" style="top: ${m}%; background: ${a};"></div>`:""}
94
+ `:S.current.innerHTML=`
95
+ <div style="display:flex;gap:0.5rem;height:100%;">
96
+ <div style="flex:1;display:flex;flex-direction:column;">
97
+ <div style="font-size:0.75rem;color:white;opacity:0.7;text-align:center;margin-bottom:0.25rem;">L</div>
98
+ <div style="flex:1;position:relative;display:flex;flex-direction:column;justify-content:flex-end;background:rgba(0,0,0,0.3);border-radius:0.5rem;overflow:hidden;">
99
+ <div style="border-radius:0.25rem 0.25rem 0 0;transition:height 75ms;height:${s}%;background:${a};">
100
+ ${d.current>.1?`<div style="position:absolute;width:100%;height:0.25rem;transition:top 100ms;top:${o}%;background:${r};"></div>`:""}
180
101
  </div>
181
102
  </div>
182
103
  </div>
183
- <div class="flex-1 flex flex-col">
184
- <div class="text-xs text-white opacity-70 text-center mb-1">R</div>
185
- <div class="flex-1 relative flex flex-col justify-end bg-black/30 rounded-lg overflow-hidden">
186
- <div class="rounded-t transition-all duration-75" style="height: ${l}%; background: ${t};">
187
- ${y.current>.1?`<div class="absolute w-full h-1 transition-all duration-100" style="top: ${C}%; background: ${a};"></div>`:""}
104
+ <div style="flex:1;display:flex;flex-direction:column;">
105
+ <div style="font-size:0.75rem;color:white;opacity:0.7;text-align:center;margin-bottom:0.25rem;">R</div>
106
+ <div style="flex:1;position:relative;display:flex;flex-direction:column;justify-content:flex-end;background:rgba(0,0,0,0.3);border-radius:0.5rem;overflow:hidden;">
107
+ <div style="border-radius:0.25rem 0.25rem 0 0;transition:height 75ms;height:${l}%;background:${a};">
108
+ ${b.current>.1?`<div style="position:absolute;width:100%;height:0.25rem;transition:top 100ms;top:${w}%;background:${r};"></div>`:""}
109
+ </div>
188
110
  </div>
189
111
  </div>
190
112
  </div>
191
- `},ve=()=>{!v.current||!o||(z?v.current.pause():(P.current&&P.current.state==="suspended"&&P.current.resume(),v.current.play().catch(t=>console.error("Play failed:",t))))},pe=()=>{v.current&&(v.current.pause(),v.current.currentTime=0,S(!1),B(0),X.current=0,n.current=0,d.current=0,y.current=0,he())},Se=t=>{const s=parseFloat(t.target.value)/100*A;B(s),v.current&&!fe&&(v.current.currentTime=s)},Pe=()=>U(!0),Te=()=>{v.current&&(v.current.currentTime=I),U(!1)},Le=t=>{const a=parseInt(t.target.value);$(a),re(a===0)},Me=t=>{de(parseFloat(t.target.value))},Fe=()=>re(!ce),ze=()=>{u.current&&(document.fullscreenElement?document.exitFullscreen():u.current.requestFullscreen().catch(t=>console.error("Fullscreen failed:",t)))},we=(t,a)=>{M(s=>({...s,[t]:a})),P.current&&(t==="bass"&&D.current&&(D.current.gain.value=a),t==="mid"&&R.current&&(R.current.gain.value=a),t==="treble"&&K.current&&(K.current.gain.value=a))},Be=()=>{M({bass:0,mid:0,treble:0})},xe=t=>{if(isNaN(t))return"0:00";const a=Math.floor(t/60),s=Math.floor(t%60);return`${a}:${s.toString().padStart(2,"0")}`};if(r.useEffect(()=>{(h&&!z||q)&&ve()},[g]),se&&se.length>0)return se.map((t,a)=>e.jsxs("div",{className:"text-red-500 text-sm bg-red-50 p-3 rounded mb-4 border border-red-300",children:[e.jsxs("strong",{children:[t[0],":"]})," ",t[1]]},a));const ye=f?f.side:null,ke=ye==="top"||ye==="bottom";return e.jsx("div",{ref:u,className:`rounded-xl overflow-hidden transition-all duration-300 ${W?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"relative"}`,style:{backgroundColor:h||x?void 0:i?"#49494937":"white"},children:e.jsxs("div",{style:{background:h||x?void 0:i?"#1a1a1ab0":"#f5f5f5",height:W?"100%":"auto"},className:`${h||x?"":"p-4"} ${W?"flex flex-col flex-1":""}`,children:[g.videoName&&!W&&e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:`${i?"text-gray-100":"text-gray-700"} font-medium`,children:c})}),e.jsxs("div",{className:`relative ${ke?"flex flex-col gap-3":"flex gap-3"} ${W?"flex-1 min-h-0":"mb-4"}`,children:[f&&ye==="top"&&e.jsx("div",{className:"w-full h-12",ref:ee}),e.jsxs("div",{className:`flex ${!ke&&"flex-1"} gap-3`,children:[f&&ye==="left"&&e.jsx("div",{className:"w-12 bg-black/50 rounded-lg p-1",ref:ee}),e.jsxs("div",{className:`flex-1 ${i?"bg-black/70":"bg-white/70"} rounded-lg overflow-hidden relative`,children:[e.jsxs("video",{ref:v,className:"w-full h-full object-contain",poster:N||void 0,children:[o&&e.jsx("source",{src:o}),"Your browser does not support the video tag."]}),ie&&e.jsx("div",{className:"absolute inset-0 flex flex-col w-full justify-center z-10 rounded-lg p-4 shadow-sm transition-all duration-300",children:e.jsxs("div",{className:`max-w-[600px] w-full mx-auto flex flex-col justify-center z-10 ${i?"bg-black/70":"bg-white/80"} rounded-lg p-4 shadow-sm transition-all duration-300`,children:[e.jsx("h3",{className:`text-sm font-medium mb-4 ${i?"text-gray-200":"text-gray-700"}`,children:"Equalizer"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:"Bass"}),e.jsxs("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:[L.bass," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.bass,onChange:t=>we("bass",parseInt(t.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${E} ${(L.bass+20)/40*100}%, #e5e7eb ${(L.bass+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:"Mid"}),e.jsxs("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:[L.mid," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.mid,onChange:t=>we("mid",parseInt(t.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${E} ${(L.mid+20)/40*100}%, #e5e7eb ${(L.mid+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:"Treble"}),e.jsxs("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:[L.treble," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.treble,onChange:t=>we("treble",parseInt(t.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${E} ${(L.treble+20)/40*100}%, #e5e7eb ${(L.treble+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]})]}),e.jsxs("div",{className:"flex justify-between mt-6",children:[e.jsx("button",{onClick:Be,className:`px-3 py-1 rounded text-xs ${i?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Reset"}),e.jsx("button",{onClick:()=>T(!1),className:`ml-2 px-3 py-1 rounded text-xs ${i?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Close"})]})]})})]}),f&&ye==="right"&&e.jsx("div",{className:"w-12 bg-black/50 rounded-lg p-1",ref:ee})]}),f&&ye==="bottom"&&e.jsx("div",{className:"w-full h-12",ref:ee})]}),g.seekbar&&e.jsx("div",{className:`mb-4 ${W?"mt-3":""}`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-100":"text-gray-600"} font-mono w-12`,children:xe(I)}),e.jsx("input",{type:"range",min:"0",max:"100",value:A>0?I/A*100:0,onChange:Se,onMouseDown:Pe,onMouseUp:Te,onTouchStart:Pe,onTouchEnd:Te,disabled:!o,className:"flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:o&&A>0?`linear-gradient(to right, ${E} ${I/A*100}%, #e5e7eb ${I/A*100}%)`:"#e5e7eb"}}),e.jsx("span",{className:`text-xs ${i?"text-gray-100":"text-gray-600"} font-mono w-12 text-right`,children:xe(A)})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[g.play&&e.jsxs("button",{onClick:ve,disabled:!o,style:{backgroundColor:E},className:`${Y>400?" px-4 py-2":"px-3 py-5"} rounded-full text-sm font-medium text-white hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,children:[e.jsxs("div",{className:"relative w-4 flex items-center",children:[e.jsx($e,{size:16,className:`${z?"":"scale-0 translate-y-10"} transition-all absolute`}),e.jsx(Ee,{size:16,className:`${z?"scale-0 -translate-y-10":""} transition-all absolute`})]}),Y>400&&(z?"Pause":"Play")]}),g.stop&&e.jsx("button",{onClick:pe,disabled:!o,className:`${i?"bg-gray-100 text-black hover:bg-gray-300":"bg-gray-700 text-white hover:bg-gray-800"} px-3 py-3 rounded-full text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,children:e.jsx(De,{size:16})}),g.fullscreen&&e.jsxs("button",{onClick:ze,className:`${Y<800?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${i?"bg-gray-100 text-black hover:bg-gray-300":"bg-gray-700 text-white hover:bg-gray-800"}`,children:[W?e.jsx(Ye,{size:16}):e.jsx(Je,{size:16}),e.jsx("span",{style:{display:Y<800?"none":"block"},children:W?"Exit":"Full"})]}),g.equalizer&&e.jsxs("button",{onClick:()=>T(!ie),disabled:!o,className:`${Y<700?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${ie?"text-white":"bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,style:ie?{backgroundColor:E}:{},children:[e.jsx(Ce,{size:16}),e.jsx("span",{style:{display:Y<700?"none":"block"},children:"EQ"})]}),g.speed&&e.jsx("div",{className:"flex items-center",children:e.jsxs("select",{value:le,onChange:Me,className:`rounded-full text-sm font-medium border-none outline-none cursor-pointer transition-all bg-transparent ${i?"text-gray-200":"text-gray-800"}`,children:[e.jsx("option",{value:"0.5",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"0.5x"}),e.jsx("option",{value:"0.75",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"0.75x"}),e.jsx("option",{value:"1",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1x"}),e.jsx("option",{value:"1.25",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1.25x"}),e.jsx("option",{value:"1.5",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1.5x"}),e.jsx("option",{value:"2",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"2x"})]})}),g.volume&&e.jsxs("div",{className:"flex items-center gap-1 md:gap-3 ml-auto",children:[e.jsx("button",{onClick:Fe,className:"p-2 rounded-lg hover:bg-gray-100 transition-all",children:ce||w===0?e.jsx(je,{size:20,className:i?"text-gray-100":"text-gray-600"}):e.jsx(Ae,{size:20,className:i?"text-gray-100":"text-gray-600"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:w,onChange:Le,className:"hide-for-xs w-24 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, ${E} ${w}%, #e5e7eb ${w}%)`,display:Y<460?"none":"block"}}),e.jsxs("span",{style:{display:Y<800?"none":"block"},className:`text-xs ${i?"text-gray-100":"text-gray-700"} font-mono w-10 text-right`,children:[w,"%"]})]})]}),e.jsx("style",{children:`
192
- input[type="range"]::-webkit-slider-thumb {
193
- -webkit-appearance: none;
194
- appearance: none;
195
- width: 16px;
196
- height: 16px;
197
- border-radius: 50%;
198
- background: ${E};
199
- cursor: pointer;
200
- border: 2px solid white;
201
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
202
- }
203
-
204
- input[type="range"]::-moz-range-thumb {
205
- width: 16px;
206
- height: 16px;
207
- border-radius: 50%;
208
- background: ${E};
209
- cursor: pointer;
210
- border: 2px solid white;
211
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
212
- }
213
- input[type="range"].eq-slider::-webkit-slider-thumb {
214
- -webkit-appearance: none;
215
- appearance: none;
216
- width: 0;
217
- height: 0;
218
- background: transparent;
219
- border: none;
220
- box-shadow: none;
221
- }
222
- input[type="range"].eq-slider::-moz-range-thumb {
223
- width: 0;
224
- height: 0;
225
- background: transparent;
226
- border: none;
227
- box-shadow: none;
228
- }
229
- .hide-for-xs {
230
- display: flex;
231
- }
232
- @media (max-width: 480px) {
233
- .hide-for-xs {
234
- display: none;
235
- }
236
- }
237
- `})]})})}function rt(){const[o,c]=r.useState(null),[f,p]=r.useState("No track loaded"),[N,g]=r.useState("purple"),[b,x]=r.useState(!1),[q,E]=r.useState(!1),[O,z]=r.useState("light"),S=r.useRef(null),I=A=>{var w;const j=(w=A.target.files)==null?void 0:w[0];if(j){const $=URL.createObjectURL(j);c($),p(j.name)}},B=()=>{var A;(A=S.current)==null||A.click()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 md:p-8",style:{backgroundColor:O==="dark"?"#222":"white"},children:e.jsxs("div",{className:"w-full h-full md:h-auto md:max-w-4xl",children:[b&&e.jsx(Oe,{theme:N,setTheme:g,close:()=>x(!1)}),e.jsxs("div",{className:"container-glass rounded-xl p-8",children:[e.jsxs("div",{className:"mb-6 flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("h1",{className:`text-2xl font-semibold ${O==="dark"?"text-gray-200":"text-gray-800"} mb-1`,children:"Audio Visualizer"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Professional frequency analyzer"})]}),e.jsxs("button",{onClick:()=>x(!b),className:"bg-white border border-gray-300 text-gray-700 px-4 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",children:[e.jsx("span",{children:"🎨"})," Themes"]})]}),e.jsx(Ve,{audio:o||void 0,name:f||void 0,author:"K.Prabhasha",theme:N,autoPlay:!1,thumbnail:"https://cdn-icons-png.flaticon.com/512/3845/3845874.png",mode:O,transparent:q,volume:70,controls:{play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,loop:!0,trackName:!0}}),e.jsx(Ue,{audio:o||"",width:400,thumbnail:"https://cdn-icons-png.flaticon.com/512/8316/8316619.png",autoPlay:!1,gradient:["#26ce3aff","#39eed9ff"],background:"#c0ffefff"}),e.jsx(We,{audio:o||"",thumbnail:"https://cdn-icons-png.flaticon.com/512/17524/17524837.png",autoPlay:!1,gradient:["#26ce3aff","#39eed9ff"],background:"#c0ffefff"}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"file",ref:S,onChange:I,accept:"audio/*",className:"hidden"}),e.jsxs("button",{onClick:B,className:"bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",children:[e.jsx(et,{size:16}),"Load Audio"]}),e.jsx("button",{onClick:()=>z(O==="dark"?"light":"dark"),className:"bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",children:O==="dark"?"Light":"Dark"}),e.jsxs("button",{onClick:()=>E(!q),className:"bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",children:["Transparent: ",String(q)]})]})]})]})})}J.DemoVisualizePlayer=rt,J.NanoAudioPlayer=We,J.ThemeSelector=Oe,J.VideoPlayer=tt,J.VisualizePlayer=Ve,J.WaveAudioPlayer=Ue,J.themes=oe,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})});
113
+ `},ke=()=>{!y.current||!c||(A?y.current.pause():(E.current&&E.current.state==="suspended"&&E.current.resume(),y.current.play().catch(a=>console.error("Play failed:",a))))},ve=()=>{y.current&&(y.current.pause(),y.current.currentTime=0,$(!1),F(0),K.current=0,n.current=0,d.current=0,b.current=0,he())},xe=a=>{const s=parseFloat(a.target.value)/100*L;F(s),y.current&&!pe&&(y.current.currentTime=s)},Se=()=>U(!0),Pe=()=>{y.current&&(y.current.currentTime=_),U(!1)},Le=a=>{const r=parseInt(a.target.value);g(r),re(r===0)},Te=a=>de(parseFloat(a.target.value)),ze=()=>re(!M),_e=()=>{p.current&&(document.fullscreenElement?document.exitFullscreen():p.current.requestFullscreen().catch(a=>console.error("Fullscreen failed:",a)))},je=(a,r)=>{W(s=>({...s,[a]:r})),E.current&&(a==="bass"&&O.current&&(O.current.gain.value=r),a==="mid"&&ee.current&&(ee.current.gain.value=r),a==="treble"&&G.current&&(G.current.gain.value=r))},Be=()=>W({bass:0,mid:0,treble:0}),Ae=a=>{if(isNaN(a))return"0:00";const r=Math.floor(a/60),s=Math.floor(a%60);return`${r}:${s.toString().padStart(2,"0")}`};if(t.useEffect(()=>{(C&&!A||q)&&ke()},[f]),ce&&ce.length>0)return e.jsx(e.Fragment,{children:ce.map((a,r)=>e.jsxs("div",{className:"ecp-video-error",children:[e.jsxs("strong",{children:[a[0],":"]})," ",a[1]]},r))});const be=u?u.side:null,we=be==="top"||be==="bottom",He=C||D?void 0:h?"#49494937":"white",Ie=C||D?void 0:h?"#1a1a1ab0":"#f5f5f5";return e.jsx("div",{ref:p,className:`ecp-video-wrapper${J?" ecp-video-wrapper--fullscreen":""}`,style:{backgroundColor:He},children:e.jsxs("div",{className:`ecp-video-inner${J?" ecp-video-inner--fullscreen":""}${D?"":" ecp-video-inner--padded"}`,style:{background:Ie},children:[f.videoName&&!J&&e.jsx("div",{className:`ecp-video-name${h?" ecp-video-name--dark":" ecp-video-name--light"}`,children:i}),e.jsxs("div",{className:`ecp-video-layout${we?" ecp-video-layout--col":" ecp-video-layout--row"}${J?" ecp-video-layout--fullscreen":""}`,children:[u&&be==="top"&&e.jsx("div",{className:"ecp-video-vu-top",ref:S}),e.jsxs("div",{style:{display:"flex",flex:we?void 0:1,gap:"0.75rem"},children:[u&&be==="left"&&e.jsx("div",{className:"ecp-video-vu-side",ref:S}),e.jsxs("div",{className:`ecp-video-el-wrap${h?" ecp-video-el-wrap--dark":" ecp-video-el-wrap--light"}`,children:[e.jsxs("video",{ref:y,className:"ecp-video-el",poster:N||void 0,children:[c&&e.jsx("source",{src:c}),"Your browser does not support the video tag."]}),ie&&e.jsx("div",{className:"ecp-video-eq-overlay",children:e.jsxs("div",{className:`ecp-video-eq-panel${h?" ecp-video-eq-panel--dark":" ecp-video-eq-panel--light"}`,children:[e.jsx("h3",{className:`ecp-video-eq-title${h?" ecp-video-eq-title--dark":" ecp-video-eq-title--light"}`,children:"Equalizer"}),e.jsx("div",{className:"ecp-video-eq-bands",children:["bass","mid","treble"].map(a=>e.jsxs("div",{children:[e.jsxs("div",{className:"ecp-video-eq-band-header",children:[e.jsx("span",{className:h?"ecp-video-eq-label--dark":"ecp-video-eq-label--light",children:a.charAt(0).toUpperCase()+a.slice(1)}),e.jsxs("span",{className:h?"ecp-video-eq-label--dark":"ecp-video-eq-label--light",children:[V[a]," dB"]})]}),e.jsxs("div",{className:"ecp-video-eq-range-row",children:[e.jsx("span",{className:h?"ecp-video-eq-bound--dark":"ecp-video-eq-bound--light",children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:V[a],onChange:r=>je(a,parseInt(r.target.value)),className:"ecp-video-eq-slider",style:{background:`linear-gradient(to right, ${P} ${(V[a]+20)/40*100}%, #e5e7eb ${(V[a]+20)/40*100}%)`,"--thumb-color":P}}),e.jsx("span",{className:h?"ecp-video-eq-bound--dark":"ecp-video-eq-bound--light",children:"+20"})]})]},a))}),e.jsxs("div",{className:"ecp-video-eq-footer",children:[e.jsx("button",{onClick:Be,className:`ecp-video-eq-footer-btn${h?" ecp-video-eq-footer-btn--dark":" ecp-video-eq-footer-btn--light"}`,children:"Reset"}),e.jsx("button",{onClick:()=>x(!1),className:`ecp-video-eq-footer-btn${h?" ecp-video-eq-footer-btn--dark":" ecp-video-eq-footer-btn--light"}`,style:{marginLeft:"0.5rem"},children:"Close"})]})]})})]}),u&&be==="right"&&e.jsx("div",{className:"ecp-video-vu-side",ref:S})]}),u&&be==="bottom"&&e.jsx("div",{className:"ecp-video-vu-bottom",ref:S})]}),f.seekbar&&e.jsx("div",{className:`ecp-video-seekbar${J?" ecp-video-seekbar--fullscreen":""}`,children:e.jsxs("div",{className:"ecp-video-seekbar-row",children:[e.jsx("span",{className:`ecp-video-time${h?" ecp-video-time--dark":" ecp-video-time--light"}`,children:Ae(_)}),e.jsx("input",{type:"range",min:"0",max:"100",value:L>0?_/L*100:0,onChange:xe,onMouseDown:Se,onMouseUp:Pe,onTouchStart:Se,onTouchEnd:Pe,disabled:!c,className:"ecp-video-seek-input",style:{background:c&&L>0?`linear-gradient(to right, ${P} ${_/L*100}%, #e5e7eb ${_/L*100}%)`:"#e5e7eb","--thumb-color":P}}),e.jsx("span",{className:`ecp-video-time ecp-video-time--right${h?" ecp-video-time--dark":" ecp-video-time--light"}`,children:Ae(L)})]})}),e.jsxs("div",{className:"ecp-video-controls",children:[f.play&&e.jsxs("button",{onClick:ke,disabled:!c,className:`ecp-video-play-btn${R<=400?" ecp-video-play-btn--compact":""}`,style:{backgroundColor:P},children:[e.jsxs("div",{className:"ecp-video-play-icon-wrap",children:[e.jsx(qe,{size:16,style:{position:"absolute",transform:A?void 0:"scale(0) translateY(2.5rem)",transition:"all 150ms"}}),e.jsx($e,{size:16,style:{position:"absolute",transform:A?"scale(0) translateY(-2.5rem)":void 0,transition:"all 150ms"}})]}),R>400&&(A?"Pause":"Play")]}),f.stop&&e.jsx("button",{onClick:ve,disabled:!c,className:`ecp-video-stop-btn${h?" ecp-video-stop-btn--dark":" ecp-video-stop-btn--light"}`,children:e.jsx(Ve,{size:16})}),f.fullscreen&&e.jsxs("button",{onClick:_e,className:`ecp-video-fullscreen-btn${h?" ecp-video-fullscreen-btn--dark":" ecp-video-fullscreen-btn--light"}${R>=800?" ecp-video-fullscreen-btn--wide":""}`,children:[J?e.jsx(tt,{size:16}):e.jsx(et,{size:16}),e.jsx("span",{style:{display:R<800?"none":"block"},children:J?"Exit":"Full"})]}),f.equalizer&&e.jsxs("button",{onClick:()=>x(!ie),disabled:!c,className:`ecp-video-eq-toggle-btn${ie?" ecp-video-eq-toggle-btn--on":" ecp-video-eq-toggle-btn--off"}${R>=700?" ecp-video-eq-toggle-btn--wide":""}`,style:ie?{backgroundColor:P}:{},children:[e.jsx(Ee,{size:16}),e.jsx("span",{style:{display:R<700?"none":"block"},children:"EQ"})]}),f.speed&&e.jsx("div",{className:"ecp-video-speed-wrap",children:e.jsx("select",{value:oe,onChange:Te,className:`ecp-video-speed-select${h?" ecp-video-speed-select--dark":" ecp-video-speed-select--light"}`,children:["0.5","0.75","1","1.25","1.5","2"].map(a=>e.jsxs("option",{value:a,className:h?"ecp-video-speed-option--dark":"ecp-video-speed-option--light",children:[a,"x"]},a))})}),f.volume&&e.jsxs("div",{className:"ecp-video-volume",children:[e.jsx("button",{onClick:ze,className:"ecp-video-mute-btn",children:M||B===0?e.jsx(Me,{size:20,className:h?"ecp-video-mute-icon--dark":"ecp-video-mute-icon--light"}):e.jsx(Fe,{size:20,className:h?"ecp-video-mute-icon--dark":"ecp-video-mute-icon--light"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:B,onChange:Le,className:"ecp-video-vol-slider",style:{background:`linear-gradient(to right, ${P} ${B}%, #e5e7eb ${B}%)`,"--thumb-color":P,display:R<460?"none":"block"}}),e.jsxs("span",{className:`ecp-video-vol-pct${h?" ecp-video-vol-pct--dark":" ecp-video-vol-pct--light"}`,style:{display:R<800?"none":"block"},children:[B,"%"]})]})]})]})})}function st(){const[c,i]=t.useState(null),[u,v]=t.useState("No track loaded"),[N,f]=t.useState("purple"),[m,D]=t.useState(!1),[q,P]=t.useState(!1),[j,A]=t.useState("light"),$=t.useRef(null),_=L=>{var B;const T=(B=L.target.files)==null?void 0:B[0];if(T){const g=URL.createObjectURL(T);i(g),v(T.name)}},F=()=>{var L;return(L=$.current)==null?void 0:L.click()};return e.jsx("div",{className:"ecp-page-wrapper",style:{backgroundColor:j==="dark"?"#222":"white"},children:e.jsxs("div",{className:"ecp-demo-container",children:[m&&e.jsx(We,{theme:N,setTheme:f,close:()=>D(!1)}),e.jsxs("div",{className:"ecp-container-glass",children:[e.jsxs("div",{className:"ecp-demo-header",children:[e.jsxs("div",{children:[e.jsx("h1",{className:`ecp-demo-title${j==="dark"?" ecp-demo-title--dark":""}`,children:"Audio Visualizer"}),e.jsx("p",{className:"ecp-demo-subtitle",children:"Professional frequency analyzer"})]}),e.jsxs("button",{onClick:()=>D(!m),className:"ecp-theme-btn",children:[e.jsx("span",{children:"🎨"})," Themes"]})]}),e.jsx(Qe,{audio:c||void 0,name:u||void 0,author:"K.Prabhasha",theme:N,autoPlay:!1,thumbnail:"https://cdn-icons-png.flaticon.com/512/3845/3845874.png",mode:j,transparent:q,volume:70,controls:{play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,loop:!0,trackName:!0}}),e.jsx(Ye,{audio:c||"",width:400,thumbnail:"https://cdn-icons-png.flaticon.com/512/8316/8316619.png",autoPlay:!1,gradient:["#26ce3aff","#39eed9ff"],background:"#c0ffefff"}),e.jsx(Ge,{audio:c||"",thumbnail:"https://cdn-icons-png.flaticon.com/512/17524/17524837.png",autoPlay:!1,gradient:["#26ce3aff","#39eed9ff"],background:"#c0ffefff"}),e.jsxs("div",{className:"ecp-demo-actions",children:[e.jsx("input",{type:"file",ref:$,onChange:_,accept:"audio/*",className:"ecp-file-input-hidden"}),e.jsxs("button",{onClick:F,className:"ecp-action-btn",children:[e.jsx(nt,{size:16}),"Load Audio"]}),e.jsx("button",{onClick:()=>A(j==="dark"?"light":"dark"),className:"ecp-action-btn",children:j==="dark"?"Light":"Dark"}),e.jsxs("button",{onClick:()=>P(!q),className:"ecp-action-btn",children:["Transparent: ",String(q)]})]})]})]})})}Z.DemoVisualizePlayer=st,Z.NanoAudioPlayer=Ge,Z.ThemeSelector=We,Z.VideoPlayer=at,Z.VisualizePlayer=Qe,Z.WaveAudioPlayer=Ye,Z.themes=le,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});