autoglm-gui 0.3.1__py3-none-any.whl → 0.4.1__py3-none-any.whl

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.
Files changed (34) hide show
  1. AutoGLM_GUI/__main__.py +6 -2
  2. AutoGLM_GUI/adb_plus/__init__.py +8 -1
  3. AutoGLM_GUI/adb_plus/screenshot.py +1 -4
  4. AutoGLM_GUI/adb_plus/touch.py +92 -0
  5. AutoGLM_GUI/api/__init__.py +66 -0
  6. AutoGLM_GUI/api/agents.py +231 -0
  7. AutoGLM_GUI/api/control.py +111 -0
  8. AutoGLM_GUI/api/devices.py +29 -0
  9. AutoGLM_GUI/api/media.py +163 -0
  10. AutoGLM_GUI/schemas.py +127 -0
  11. AutoGLM_GUI/scrcpy_stream.py +65 -28
  12. AutoGLM_GUI/server.py +2 -491
  13. AutoGLM_GUI/state.py +33 -0
  14. AutoGLM_GUI/static/assets/{about-C71SI8ZQ.js → about-gHEqXVMQ.js} +1 -1
  15. AutoGLM_GUI/static/assets/chat-6a-qTECg.js +25 -0
  16. AutoGLM_GUI/static/assets/index-C8KPPfxe.js +10 -0
  17. AutoGLM_GUI/static/assets/index-D2-3f619.css +1 -0
  18. AutoGLM_GUI/static/assets/{index-DUCan6m6.js → index-DgzeSwgt.js} +1 -1
  19. AutoGLM_GUI/static/index.html +2 -2
  20. AutoGLM_GUI/version.py +8 -0
  21. {autoglm_gui-0.3.1.dist-info → autoglm_gui-0.4.1.dist-info}/METADATA +64 -9
  22. autoglm_gui-0.4.1.dist-info/RECORD +44 -0
  23. phone_agent/adb/connection.py +0 -1
  24. phone_agent/adb/device.py +0 -2
  25. phone_agent/adb/input.py +0 -1
  26. phone_agent/adb/screenshot.py +0 -1
  27. phone_agent/agent.py +1 -1
  28. AutoGLM_GUI/static/assets/chat-C6WtEfKW.js +0 -14
  29. AutoGLM_GUI/static/assets/index-Dd1xMRCa.css +0 -1
  30. AutoGLM_GUI/static/assets/index-RqglIZxV.js +0 -10
  31. autoglm_gui-0.3.1.dist-info/RECORD +0 -35
  32. {autoglm_gui-0.3.1.dist-info → autoglm_gui-0.4.1.dist-info}/WHEEL +0 -0
  33. {autoglm_gui-0.3.1.dist-info → autoglm_gui-0.4.1.dist-info}/entry_points.txt +0 -0
  34. {autoglm_gui-0.3.1.dist-info → autoglm_gui-0.4.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1 @@
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-400:oklch(79.2% .209 151.711);--color-green-600:oklch(62.7% .194 149.214);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-gray-950:oklch(13% .028 261.692);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-2xl:42rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-gray-200,currentcolor)}::file-selector-button{border-color:var(--color-gray-200,currentcolor)}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.top-2{top:calc(var(--spacing)*2)}.top-12{top:calc(var(--spacing)*12)}.top-14{top:calc(var(--spacing)*14)}.right-2{right:calc(var(--spacing)*2)}.bottom-2{bottom:calc(var(--spacing)*2)}.left-2{left:calc(var(--spacing)*2)}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-auto{margin-top:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.block{display:block}.flex{display:flex}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-8{height:calc(var(--spacing)*8)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-\[750px\]{height:750px}.h-full{height:100%}.h-screen{height:100vh}.max-h-full{max-height:100%}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-8{width:calc(var(--spacing)*8)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[70\%\]{max-width:70%}.max-w-\[80\%\]{max-width:80%}.max-w-full{max-width:100%}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-b-2xl{border-bottom-right-radius:var(--radius-2xl);border-bottom-left-radius:var(--radius-2xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-white{border-color:var(--color-white)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-t-blue-500{border-top-color:var(--color-blue-500)}.border-t-transparent{border-top-color:#0000}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-400{background-color:var(--color-green-400)}.bg-red-100{background-color:var(--color-red-100)}.bg-white{background-color:var(--color-white)}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500{background-color:var(--color-yellow-500)}.object-contain{object-fit:contain}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-8{padding-block:calc(var(--spacing)*8)}.text-center{text-align:center}.text-left{text-align:left}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-pre-wrap{white-space:pre-wrap}.text-blue-100{color:var(--color-blue-100)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-green-600{color:var(--color-green-600)}.text-green-800{color:var(--color-green-800)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-white{color:var(--color-white)}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow-\[0_0_4px_rgba\(74\,222\,128\,0\.6\)\]{--tw-shadow:0 0 4px var(--tw-shadow-color,#4ade8099);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media(hover:hover){.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-600:hover{background-color:var(--color-gray-600)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}}@media(prefers-color-scheme:dark){.dark\:border-gray-600{border-color:var(--color-gray-600)}.dark\:border-gray-700{border-color:var(--color-gray-700)}.dark\:bg-gray-700{background-color:var(--color-gray-700)}.dark\:bg-gray-800{background-color:var(--color-gray-800)}.dark\:bg-gray-900{background-color:var(--color-gray-900)}.dark\:bg-green-900{background-color:var(--color-green-900)}.dark\:bg-red-900{background-color:var(--color-red-900)}.dark\:text-blue-400{color:var(--color-blue-400)}.dark\:text-gray-100{color:var(--color-gray-100)}.dark\:text-gray-300{color:var(--color-gray-300)}.dark\:text-gray-400{color:var(--color-gray-400)}.dark\:text-gray-600{color:var(--color-gray-600)}.dark\:text-green-200{color:var(--color-green-200)}.dark\:text-green-400{color:var(--color-green-400)}.dark\:text-red-200{color:var(--color-red-200)}.dark\:text-red-400{color:var(--color-red-400)}@media(hover:hover){.dark\:hover\:bg-gray-600:hover{background-color:var(--color-gray-600)}.dark\:hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.dark\:hover\:text-blue-400:hover{color:var(--color-blue-400)}.dark\:hover\:text-gray-200:hover{color:var(--color-gray-200)}}}}html{color-scheme:light dark}*{border-color:var(--color-gray-200)}@media(prefers-color-scheme:dark){*{border-color:var(--color-gray-800)}}body{background-color:var(--color-gray-50);color:var(--color-gray-950)}@media(prefers-color-scheme:dark){body{background-color:var(--color-gray-900);color:var(--color-gray-200)}}@keyframes ripple{0%{opacity:1;width:0;height:0}to{opacity:0;width:60px;height:60px}}.ripple-circle{pointer-events:none;background:radial-gradient(circle,#3b82f680,#3b82f600 70%);border:2px solid #3b82f6cc;border-radius:50%;width:60px;height:60px;animation:.5s ease-out ripple;position:absolute;transform:translate(-50%,-50%)}@keyframes scrollTrail{0%{opacity:0;background-position:0 0}5%{opacity:1}95%{opacity:1}to{opacity:0;background-position:0 100%}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
@@ -1 +1 @@
1
- import{u as o,r as s,j as t}from"./index-RqglIZxV.js";function n(){const e=o();return s.useEffect(()=>{e({to:"/chat"})},[e]),t.jsx("div",{className:"p-2",children:t.jsx("h3",{children:"Welcome Home!"})})}export{n as component};
1
+ import{u as o,r as s,j as t}from"./index-C8KPPfxe.js";function n(){const e=o();return s.useEffect(()=>{e({to:"/chat"})},[e]),t.jsx("div",{className:"p-2",children:t.jsx("h3",{children:"Welcome Home!"})})}export{n as component};
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>AutoGLM GUI</title>
7
- <script type="module" crossorigin src="/assets/index-RqglIZxV.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-Dd1xMRCa.css">
7
+ <script type="module" crossorigin src="/assets/index-C8KPPfxe.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-D2-3f619.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="app"></div>
AutoGLM_GUI/version.py ADDED
@@ -0,0 +1,8 @@
1
+ """Package version helper."""
2
+
3
+ from importlib.metadata import version as get_version
4
+
5
+ try:
6
+ APP_VERSION = get_version("autoglm-gui")
7
+ except Exception:
8
+ APP_VERSION = "dev"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autoglm-gui
3
- Version: 0.3.1
3
+ Version: 0.4.1
4
4
  Summary: Web GUI for AutoGLM Phone Agent - AI-powered Android automation
5
5
  Project-URL: Homepage, https://github.com/suyiiyii/AutoGLM-GUI
6
6
  Project-URL: Repository, https://github.com/suyiiyii/AutoGLM-GUI
@@ -35,11 +35,13 @@ AutoGLM 手机助手的现代化 Web 图形界面 - 让 AI 自动化操作 Andro
35
35
 
36
36
  ## ✨ 特性
37
37
 
38
+ - **多设备并发控制** - 同时管理和控制多个 Android 设备,设备间状态完全隔离
38
39
  - **对话式任务管理** - 通过聊天界面控制 Android 设备
39
40
  - **实时屏幕预览** - 基于 scrcpy 的低延迟视频流,随时查看设备正在执行的操作
40
- - **直接操控手机** - 在实时画面上直接点击操作,支持精准坐标转换和视觉反馈
41
+ - **直接操控手机** - 在实时画面上直接点击、滑动操作,支持精准坐标转换和视觉反馈
41
42
  - **零配置部署** - 支持任何 OpenAI 兼容的 LLM API
42
43
  - **ADB 深度集成** - 通过 Android Debug Bridge 直接控制设备
44
+ - **模块化界面** - 清晰的侧边栏 + 设备面板设计,功能分离明确
43
45
 
44
46
  ## 📸 界面预览
45
47
 
@@ -124,36 +126,89 @@ uv run autoglm-gui --base-url http://localhost:8080/v1
124
126
 
125
127
  ## 📖 使用说明
126
128
 
129
+ ### 多设备管理
130
+
131
+ AutoGLM-GUI 支持同时控制多个 Android 设备:
132
+
133
+ 1. **设备列表** - 左侧边栏自动显示所有已连接的 ADB 设备
134
+ 2. **设备选择** - 点击设备卡片切换到对应的控制面板
135
+ 3. **状态指示** - 清晰显示每个设备的在线状态和初始化状态
136
+ 4. **状态隔离** - 每个设备有独立的对话历史、配置和视频流
137
+
138
+ **设备状态说明**:
139
+ - 🟢 绿点:设备在线
140
+ - ⚪ 灰点:设备离线
141
+ - ✓ 标记:设备已初始化
142
+
127
143
  ### AI 自动化模式
128
144
 
129
- 1. **连接设备** - 启用 USB 调试并通过 ADB 连接设备
130
- 2. **对话** - 描述你想要做什么(例如:"去美团点一杯霸王茶姬的伯牙绝弦")
131
- 3. **观察** - Agent 会逐步执行操作
145
+ 1. **连接设备** - 启用 USB 调试并通过 ADB 连接设备(支持 USB 和 WiFi)
146
+ 2. **选择设备** - 在左侧边栏选择要控制的设备
147
+ 3. **初始化** - 点击"初始化设备"按钮配置 Agent
148
+ 4. **对话** - 描述你想要做什么(例如:"去美团点一杯霸王茶姬的伯牙绝弦")
149
+ 5. **观察** - Agent 会逐步执行操作,每一步的思考过程和动作都会实时显示
132
150
 
133
151
  ### 手动控制模式
134
152
 
135
153
  除了 AI 自动化,你也可以直接在实时画面上操控手机:
136
154
 
137
- 1. **实时画面** - 界面右侧显示手机屏幕的实时视频流(基于 scrcpy)
155
+ 1. **实时画面** - 设备面板右侧显示手机屏幕的实时视频流(基于 scrcpy)
138
156
  2. **点击操作** - 直接点击画面中的任意位置,操作会立即发送到手机
139
- 3. **视觉反馈** - 每次点击都会显示涟漪动画和成功提示
140
- 4. **精准转换** - 自动处理屏幕缩放和坐标转换,确保点击位置准确
157
+ 3. **滑动手势** - 按住鼠标拖动实现滑动操作(支持滚轮滚动)
158
+ 4. **视觉反馈** - 每次操作都会显示涟漪动画和成功/失败提示
159
+ 5. **精准转换** - 自动处理屏幕缩放和坐标转换,确保操作位置准确
160
+ 6. **显示模式** - 支持自动、视频流、截图三种显示模式切换
141
161
 
142
162
  **技术细节**:
143
163
  - 使用 scrcpy 提供低延迟(~30-50ms)的 H.264 视频流
144
164
  - 前端自动获取设备实际分辨率(如 1080x2400)
145
165
  - 智能处理视频流缩放(如 576x1280)与设备分辨率的映射
146
166
  - 支持 letterbox 黑边的精确坐标计算
167
+ - 颗粒化触摸事件支持(DOWN、MOVE、UP)实现流畅的手势操作
168
+
169
+ ## 🏗️ 架构设计
170
+
171
+ ### 多设备并发架构
172
+
173
+ AutoGLM-GUI 采用简化的多设备并发架构,支持同时管理多个 Android 设备:
174
+
175
+ **后端设计**:
176
+ - 使用字典管理多个 `PhoneAgent` 实例:`agents: dict[str, PhoneAgent]`
177
+ - 每个设备有独立的 `scrcpy` 视频流实例
178
+ - 设备级别的锁机制,避免不同设备间的阻塞
179
+ - 所有 API 接口支持 `device_id` 参数进行设备路由
180
+
181
+ **前端设计**:
182
+ - 使用 `Map<string, DeviceState>` 管理每个设备的独立状态
183
+ - 组件化设计,功能职责清晰分离:
184
+ - `DeviceCard` - 单个设备信息卡片
185
+ - `DeviceSidebar` - 设备列表侧边栏
186
+ - `DevicePanel` - 设备操作面板(ChatBox + Screen Monitor)
187
+ - 设备状态完全隔离,互不影响
188
+
189
+ **核心特点**:
190
+ - ✅ 无任务队列,简化设计
191
+ - ✅ 无复杂调度,每个设备独立运行
192
+ - ✅ 实时 WebSocket 通信,支持流式响应
193
+ - ✅ 自动设备发现和状态同步(每 3 秒刷新)
147
194
 
148
195
  ## 🛠️ 开发指南
149
196
 
197
+ ### 快速开发
198
+
150
199
  ```bash
151
200
  # 后端开发(自动重载)
152
201
  uv run autoglm-gui --base-url http://localhost:8080/v1 --reload
153
202
 
154
- # 前端开发服务器
203
+ # 前端开发服务器(热重载)
155
204
  cd frontend && pnpm dev
156
205
 
206
+ ### 构建和打包
207
+
208
+ ```bash
209
+ # 仅构建前端
210
+ uv run python scripts/build.py
211
+
157
212
  # 构建完整包
158
213
  uv run python scripts/build.py --pack
159
214
  ```
@@ -0,0 +1,44 @@
1
+ AutoGLM_GUI/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ AutoGLM_GUI/__main__.py,sha256=Ad7wiAZ3JcYmSlqm-HuOME8etEPBJdupPcv3mPxXkVg,4947
3
+ AutoGLM_GUI/schemas.py,sha256=KfDDnEM1GDXVj2sCA3UCa6qGc5sDjg-Pieaj4V29-V8,2412
4
+ AutoGLM_GUI/scrcpy_stream.py,sha256=JCgIIVolMo5SuI2S2WnuuXkZIsvV9Zcv5mAf0sgAeSc,20609
5
+ AutoGLM_GUI/server.py,sha256=SdaEGNCoGmVKEK-bMzH06BRGGOKAlAgqZfR0lXYrjYo,90
6
+ AutoGLM_GUI/state.py,sha256=4nnvuzuta_43u6R_uC7ATjUhAuJf_vM_MpMgsfCeiK4,1066
7
+ AutoGLM_GUI/version.py,sha256=z0MPXu-k9UO7RXxVGcAwim2M3yklrRqLwgOq66zSdzo,178
8
+ AutoGLM_GUI/adb_plus/__init__.py,sha256=joSXcQ66UBcIh8gJPWi2eJgk87bWNpaa6PVJvxLsvQY,295
9
+ AutoGLM_GUI/adb_plus/screenshot.py,sha256=pr7BpmUcGZO9rthpDeMRn4D1oAGX9aEEVL3ZnTQzrIo,3211
10
+ AutoGLM_GUI/adb_plus/touch.py,sha256=7cyMon9nOd6zQvZdHK7BHWoRLLWkdK-qWfTuSFfFzJA,2301
11
+ AutoGLM_GUI/api/__init__.py,sha256=O29PdxXHxf3it8VSlBCTQqDU-1J21tK943VR5vK3BfI,1914
12
+ AutoGLM_GUI/api/agents.py,sha256=KdrtKz8x-70ChTIZQ7Yf8q6sUNZk27G1HT7jogSCpQc,6944
13
+ AutoGLM_GUI/api/control.py,sha256=G-7hfdqTl5fq-UXOwE2CI_HMbfmRH1Vd589t2FTNZyY,3155
14
+ AutoGLM_GUI/api/devices.py,sha256=yjUMbiQa1twIjerSa18vGXFu9_j4496dx5h8yub0vBg,766
15
+ AutoGLM_GUI/api/media.py,sha256=PqdZIf_2L-oIiMAFLR5PfbjjjK_POkXEf5_8m__5EvA,6322
16
+ AutoGLM_GUI/static/index.html,sha256=WZWDdQuNnVcSTR7gj2zdsxYsTuamyMRRLI2Ai8TgK4w,395
17
+ AutoGLM_GUI/static/assets/about-gHEqXVMQ.js,sha256=DHvsyNZyuXbjO2Eu2dV3sgcVDRz21-GprgTFGC1Eg_Q,155
18
+ AutoGLM_GUI/static/assets/chat-6a-qTECg.js,sha256=gtebFcbEucoaop8FxcwvaSfF6RFw5gXtQBDEmdvrvoo,76406
19
+ AutoGLM_GUI/static/assets/index-C8KPPfxe.js,sha256=S7lYoTBJ-dICZb1MMjPOVxQnLqh2ygPY22PIus075nk,278235
20
+ AutoGLM_GUI/static/assets/index-D2-3f619.css,sha256=waqTh_0LLDnRv84v1ZEn_uaWb6MEdsert_9BncKw_Kc,21725
21
+ AutoGLM_GUI/static/assets/index-DgzeSwgt.js,sha256=R_Ym51nfDnRQb_5N_BHCUMZh29jkLLbNpk9z50drw9A,228
22
+ phone_agent/__init__.py,sha256=6_AwafPDiJsEVstiMcfj-HbvpuxWTC2di6MVbQzHK6s,287
23
+ phone_agent/agent.py,sha256=23LFtkAo8Kr1mrgTnQYULOeTDmwMBB4FGgrUs03VKPg,8120
24
+ phone_agent/actions/__init__.py,sha256=YiAMeBMVhRfmDOf0hQ_1FEBSV5ApcnHPQ05gHjA_weQ,160
25
+ phone_agent/actions/handler.py,sha256=kIz6SxRwxzoGoFgxMzASM-a-qDZsFE6TcieIMtE-yC4,10744
26
+ phone_agent/adb/__init__.py,sha256=w3CBSGRv-cQPME-Q-Bx2tbL_WJkpb9RqmT2olNK9TZw,950
27
+ phone_agent/adb/connection.py,sha256=IXVB2seVmMGjEMSO0QWXzR_CxsSk0s4A10n9Lt-AIeg,10055
28
+ phone_agent/adb/device.py,sha256=SEChFmJXmykyXSBQ2lc4bR-JoedtZOQFES06jJb1Bcg,5604
29
+ phone_agent/adb/input.py,sha256=Yr-5oXcYITkPl8humom7k5eakS3OMVPilj-N0veeCQQ,2857
30
+ phone_agent/adb/screenshot.py,sha256=FgPH6WgFBxU7JPgWpaCgQbltcm4LvhIoTmR5X5rm0yM,3161
31
+ phone_agent/config/__init__.py,sha256=3rrDQhBQUpgAlJe9bJfpuGA3ugzZsLerq06eMVtJIV0,861
32
+ phone_agent/config/apps.py,sha256=3QCp29T73_jFkAubAY6CRW_vlAT_EY7qJ66FFKqCVQo,8773
33
+ phone_agent/config/i18n.py,sha256=2xs1x05ouGRVILGQSgL3UMzi6wu6iqYy3scagAObRXA,2096
34
+ phone_agent/config/prompts.py,sha256=547DMu849nKQKL_PO0TWMgvSaW7Qo_-DV8Hsx2fUWQ4,8091
35
+ phone_agent/config/prompts_en.py,sha256=t8C9YLailtg8kVlFtYvq3t9EdtMGE8HastTfDh5BAUM,2630
36
+ phone_agent/config/prompts_zh.py,sha256=vSWo5_qlWwNHVYUxrePBiL2FmJFnQG0Jpb1NsVsVJos,8256
37
+ phone_agent/model/__init__.py,sha256=w6yFkla9VoUvX5vZkTWa7Z5Bg5_lfA9AajrLjZsdL24,149
38
+ phone_agent/model/client.py,sha256=6EM7BIdj9UvqPG9YmgwSGWVxensH5HDfCSAgHDeBgeo,5842
39
+ scrcpy-server-v3.3.3,sha256=fnAyO6fyWWSd1KzOl6xP77roECssbZHi575hP9U1S-A,90164
40
+ autoglm_gui-0.4.1.dist-info/METADATA,sha256=1p6NvHbkk9m9c1XhfDhZEA047psCyhQJPwAQKfG85k8,7753
41
+ autoglm_gui-0.4.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
42
+ autoglm_gui-0.4.1.dist-info/entry_points.txt,sha256=sz4rBO_kgrYmOiT0QnhCCv0b9QqBdWyCjugJgY8AEOI,58
43
+ autoglm_gui-0.4.1.dist-info/licenses/LICENSE,sha256=0IkSHDewdtmXnmYzTNq4U47EJYjTuhjQNpT0bZKuqWc,11342
44
+ autoglm_gui-0.4.1.dist-info/RECORD,,
@@ -4,7 +4,6 @@ import subprocess
4
4
  import time
5
5
  from dataclasses import dataclass
6
6
  from enum import Enum
7
- from typing import Optional
8
7
 
9
8
 
10
9
  class ConnectionType(Enum):
phone_agent/adb/device.py CHANGED
@@ -1,9 +1,7 @@
1
1
  """Device control utilities for Android automation."""
2
2
 
3
- import os
4
3
  import subprocess
5
4
  import time
6
- from typing import List, Optional, Tuple
7
5
 
8
6
  from phone_agent.config.apps import APP_PACKAGES
9
7
 
phone_agent/adb/input.py CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  import base64
4
4
  import subprocess
5
- from typing import Optional
6
5
 
7
6
 
8
7
  def type_text(text: str, device_id: str | None = None) -> None:
@@ -7,7 +7,6 @@ import tempfile
7
7
  import uuid
8
8
  from dataclasses import dataclass
9
9
  from io import BytesIO
10
- from typing import Tuple
11
10
 
12
11
  from PIL import Image
13
12
 
phone_agent/agent.py CHANGED
@@ -6,7 +6,7 @@ from dataclasses import dataclass
6
6
  from typing import Any, Callable
7
7
 
8
8
  from phone_agent.actions import ActionHandler
9
- from phone_agent.actions.handler import do, finish, parse_action
9
+ from phone_agent.actions.handler import finish, parse_action
10
10
  from phone_agent.adb import get_current_app, get_screenshot
11
11
  from phone_agent.config import get_messages, get_system_prompt
12
12
  from phone_agent.model import ModelClient, ModelConfig
@@ -1,14 +0,0 @@
1
- import{g as Le,a as Ie,r as g,j as u,b as Ue,s as Oe,c as Me,i as Ae,d as He,e as Ge}from"./index-RqglIZxV.js";var be={exports:{}};const ze={},Ve=Object.freeze(Object.defineProperty({__proto__:null,default:ze},Symbol.toStringTag,{value:"Module"})),$e=Le(Ve);var We=be.exports,Pe;function Ke(){return Pe||(Pe=1,(function(ae,q){(function(J,Y){ae.exports=Y($e)})(We,(function(J){function Y(n,s){(s==null||s>n.length)&&(s=n.length);for(var e=0,t=Array(s);e<s;e++)t[e]=n[e];return t}function oe(n){if(Array.isArray(n))return n}function Q(n){if(Array.isArray(n))return Y(n)}function _(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function b(n,s){if(!(n instanceof s))throw new TypeError("Cannot call a class as a function")}function G(n,s){for(var e=0;e<s.length;e++){var t=s[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,te(t.key),t)}}function S(n,s,e){return s&&G(n.prototype,s),e&&G(n,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function k(n,s){var e=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!e){if(Array.isArray(n)||(e=D(n))||s){e&&(n=e);var t=0,r=function(){};return{s:r,n:function(){return t>=n.length?{done:!0}:{done:!1,value:n[t++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,o=!1;return{s:function(){e=e.call(n)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,i=l},f:function(){try{a||e.return==null||e.return()}finally{if(o)throw i}}}}function X(n){var s=re();return function(){var e,t=O(n);if(s){var r=O(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return ee(this,e)}}function F(n,s,e){return(s=te(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function O(n){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},O(n)}function E(n,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(s&&s.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),s&&ne(n,s)}function re(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!n})()}function xe(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function Z(n,s){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var t,r,i,a,o=[],l=!0,c=!1;try{if(i=(e=e.call(n)).next,s!==0)for(;!(l=(t=i.call(e)).done)&&(o.push(t.value),o.length!==s);l=!0);}catch(f){c=!0,r=f}finally{try{if(!l&&e.return!=null&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function le(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ee(n,s){if(s&&(typeof s=="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _(n)}function ne(n,s){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ne(n,s)}function z(n,s){return oe(n)||Z(n,s)||D(n,s)||ye()}function $(n){return Q(n)||xe(n)||D(n)||le()}function ce(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function te(n){var s=ce(n,"string");return typeof s=="symbol"?s:s+""}function ie(n){"@babel/helpers - typeof";return ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},ie(n)}function D(n,s){if(n){if(typeof n=="string")return Y(n,s);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Y(n,s):void 0}}var P,M;function C(n,s){P=n,M=s}function y(n){if(P){for(var s=arguments.length,e=new Array(s>1?s-1:0),t=1;t<s;t++)e[t-1]=arguments[t];P.apply(void 0,[n].concat(e))}}function m(n){if(M){for(var s=arguments.length,e=new Array(s>1?s-1:0),t=1;t<s;t++)e[t-1]=arguments[t];M.apply(void 0,[n].concat(e))}}var j=(function(){function n(s){b(this,n),this.listener={},this.type=s|""}return S(n,[{key:"on",value:function(e,t){return this.listener[e]||(this.listener[e]=[]),this.listener[e].push(t),!0}},{key:"off",value:function(e,t){if(this.listener[e]){var r=this.listener[e].indexOf(t);return r>-1&&this.listener[e].splice(r,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return this.listener[e]?(this.listener[e].map(function(a){a.apply(null,r)}),!0):!1}}]),n})(),H=(function(){function n(){b(this,n)}return S(n,null,[{key:"init",value:function(){n.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hev1:[],hvcC:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var e;for(e in n.types)n.types.hasOwnProperty(e)&&(n.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);n.HDLR_TYPES={video:t,audio:r};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);n.STTS=n.STSC=n.STCO=a,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);n.FTYP=n.box(n.types.ftyp,o,c,o,l),n.DINF=n.box(n.types.dinf,n.box(n.types.dref,i))}},{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var a=8,o=r.length,l=o,c;o--;)a+=r[o].byteLength;for(c=new Uint8Array(a),c[0]=a>>24&255,c[1]=a>>16&255,c[2]=a>>8&255,c[3]=a&255,c.set(e,4),o=0,a=8;o<l;++o)c.set(r[o],a),a+=r[o].byteLength;return c}},{key:"hdlr",value:function(e){return n.box(n.types.hdlr,n.HDLR_TYPES[e])}},{key:"mdat",value:function(e){return n.box(n.types.mdat,e)}},{key:"mdhd",value:function(e,t){return n.box(n.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,85,196,0,0]))}},{key:"mdia",value:function(e){return n.box(n.types.mdia,n.mdhd(e.timescale,e.duration),n.hdlr(e.type),n.minf(e))}},{key:"mfhd",value:function(e){return n.box(n.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}},{key:"minf",value:function(e){return e.type==="audio"?n.box(n.types.minf,n.box(n.types.smhd,n.SMHD),n.DINF,n.stbl(e)):n.box(n.types.minf,n.box(n.types.vmhd,n.VMHD),n.DINF,n.stbl(e))}},{key:"moof",value:function(e,t,r){return n.box(n.types.moof,n.mfhd(e),n.traf(r,t))}},{key:"moov",value:function(e,t,r){for(var i=e.length,a=[];i--;)a[i]=n.trak(e[i]);return n.box.apply(null,[n.types.moov,n.mvhd(r,t)].concat(a).concat(n.mvex(e)))}},{key:"mvex",value:function(e){for(var t=e.length,r=[];t--;)r[t]=n.trex(e[t]);return n.box.apply(null,[n.types.mvex].concat(r))}},{key:"mvhd",value:function(e,t){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,e>>24&255,e>>16&255,e>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n.box(n.types.mvhd,r)}},{key:"sdtp",value:function(e){var t=e.samples||[],r=new Uint8Array(4+t.length),i,a;for(a=0;a<t.length;a++)i=t[a].flags,r[a+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return n.box(n.types.sdtp,r)}},{key:"stbl",value:function(e){return n.box(n.types.stbl,n.stsd(e),n.box(n.types.stts,n.STTS),n.box(n.types.stsc,n.STSC),n.box(n.types.stsz,n.STSZ),n.box(n.types.stco,n.STCO))}},{key:"avc1",value:function(e){var t=[],r=[],i,a,o;for(i=0;i<e.sps.length;i++)a=e.sps[i],o=a.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(a));for(i=0;i<e.pps.length;i++)a=e.pps[i],o=a.byteLength,r.push(o>>>8&255),r.push(o&255),r=r.concat(Array.prototype.slice.call(a));var l=n.box(n.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(r))),c=e.width,f=e.height;return n.box(n.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,f>>8&255,f&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"hev1",value:function(e){for(var t=[],r=[],i=[],a,o,l=0;l<(((c=e.vps)===null||c===void 0?void 0:c.length)||0);l++){var c;a=e.vps[l],o=a.byteLength,t.push(o>>>8&255,o&255),t=t.concat(Array.prototype.slice.call(a))}for(var f=0;f<(((h=e.sps)===null||h===void 0?void 0:h.length)||0);f++){var h;a=e.sps[f],o=a.byteLength,r.push(o>>>8&255,o&255),r=r.concat(Array.prototype.slice.call(a))}for(var d=0;d<(((p=e.pps)===null||p===void 0?void 0:p.length)||0);d++){var p;a=e.pps[d],o=a.byteLength,i.push(o>>>8&255,o&255),i=i.concat(Array.prototype.slice.call(a))}var A=e.hvcC,W=A.profile_space,K=A.tier_flag,L=A.profile_idc,I=A.profile_compatibility_flags,B=A.constraint_indicator_flags,he=A.level_idc,fe=A.chroma_format_idc,pe=n.box(n.types.hvcC,new Uint8Array([1,W<<6|K<<5|L,I>>24&255,I>>16&255,I>>8&255,I&255].concat($(B),[he,240,0,252,252|fe,248,248,0,0,3,3,32,0,1],$(t),[33,0,1],$(r),[34,0,1],$(i)))),de=e.width,w=e.height;return n.box(n.types.hev1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,de>>8&255,de&255,w>>8&255,w&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),pe,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.byteLength,r=new Uint8Array(26+t+3);return r.set([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5,t]),r.set(e.config,26),r.set([6,1,2],26+t),r}},{key:"mp4a",value:function(e){var t=e.audiosamplerate;return n.box(n.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0]),n.box(n.types.esds,n.esds(e)))}},{key:"stsd",value:function(e){return e.type==="audio"?n.box(n.types.stsd,n.STSD,n.mp4a(e)):e.codec.startsWith("hvc1")?n.box(n.types.stsd,n.STSD,n.hev1(e)):n.box(n.types.stsd,n.STSD,n.avc1(e))}},{key:"tkhd",value:function(e){var t=e.id,r=e.duration,i=e.width,a=e.height,o=e.volume;return n.box(n.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,r&255,0,0,0,0,0,0,0,0,0,0,0,0,o>>0&255,o%1*10>>0&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,a>>8&255,a&255,0,0]))}},{key:"traf",value:function(e,t){var r=n.sdtp(e),i=e.id;return n.box(n.types.traf,n.box(n.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),n.box(n.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255])),n.trun(e,r.length+16+16+8+16+8+8),r)}},{key:"trak",value:function(e){return e.duration=e.duration||4294967295,n.box(n.types.trak,n.tkhd(e),n.mdia(e))}},{key:"trex",value:function(e){var t=e.id;return n.box(n.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(e,t){var r=e.samples||[],i=r.length,a=12+16*i,o=new Uint8Array(a),l,c,f,h,d,p;for(t+=8+a,o.set([0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),l=0;l<i;l++)c=r[l],f=c.duration,h=c.size,d=c.flags,p=c.cts,o.set([f>>>24&255,f>>>16&255,f>>>8&255,f&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,p>>>24&255,p>>>16&255,p>>>8&255,p&255],12+16*l);return n.box(n.types.trun,o)}},{key:"initSegment",value:function(e,t,r){n.types||n.init();var i=n.moov(e,t,r),a;return a=new Uint8Array(n.FTYP.byteLength+i.byteLength),a.set(n.FTYP),a.set(i,n.FTYP.byteLength),a}}]),n})(),x=(function(){function n(){b(this,n)}return S(n,null,[{key:"samplingRateMap",get:function(){return[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]}},{key:"getHeaderLength",value:function(e){return e[1]&1?7:9}},{key:"getFrameLength",value:function(e){return(e[3]&3)<<11|e[4]<<3|(e[5]&224)>>>5}},{key:"isAACPattern",value:function(e){return e[0]===255&&(e[1]&240)===240&&(e[1]&6)===0}},{key:"extractAAC",value:function(e){var t=0,r=e.byteLength,i=[],a,o;if(!n.isAACPattern(e))return m("Invalid ADTS audio format"),{valid:!1};a=n.getHeaderLength(e);for(var l=e.subarray(0,a);t<r;)o=n.getFrameLength(e),i.push(e.subarray(a,o)),e=e.slice(o),t+=o;return{valid:!0,header:l,slices:i}}}]),n})(),T=1,U=(function(n){E(e,n);var s=X(e);function e(){return b(this,e),s.apply(this,arguments)}return S(e,[{key:"flush",value:function(){this.mp4track.len=0,this.mp4track.samples=[]}},{key:"isReady",value:function(){return!this.readyToDecode||!this.samples.length?null:!0}}],[{key:"getTrackID",value:function(){return T++}}]),e})(j),R=(function(n){E(e,n);var s=X(e);function e(t,r,i){var a;return b(this,e),a=s.call(this,"AACRemuxer"),a.frameDuration=i,a.readyToDecode=!1,a.header=null,a.nextDts=0,a.dts=0,a.mp4track={id:U.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:t,duration:r,samples:[],config:"",codec:""},a.samples=[],a}return S(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.header=null,this.mp4track.codec="",this.mp4track.channelCount="",this.mp4track.config="",this.mp4track.timescale=this.timescale,this.nextDts=0,this.dts=0}},{key:"feed",value:function(r,i){var a=x.extractAAC(r),o=a.valid,l=a.header,c=a.slices;return this.header||(this.header=l),o&&c.length>0?(this.remux(this.getAudioFrames(c,i)),!0):(m("Failed to extract audio data from:",r),this.dispatch("outOfData"),!1)}},{key:"getAudioFrames",value:function(r,i){var a=[],o=0,l=0,c=k(r),f;try{for(c.s();!(f=c.n()).done;){var h=f.value;a.push({units:h})}}catch(d){c.e(d)}finally{c.f()}return o=i?i/a.length|0:this.frameDuration,l=i?i-o*a.length:0,a.map(function(d){d.duration=o,l>0&&(d.duration++,l--)}),a}},{key:"remux",value:function(r){if(r.length>0)for(var i=0;i<r.length;i++){var a=r[i],o=a.units,l=o.byteLength;this.samples.push({units:o,size:l,duration:a.duration}),this.mp4track.len+=l,this.readyToDecode||this.setAACConfig()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var r=new Uint8Array(this.mp4track.len),i=0,a=this.mp4track.samples,o,l;for(this.dts=this.nextDts;this.samples.length;){var c=this.samples.shift();if(c.units,l=c.duration,l<=0){y("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(l)),this.mp4track.len-=c.size;continue}this.nextDts+=l,o={size:c.size,duration:l,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},r.set(c.units,i),i+=c.size,a.push(o)}return a.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}},{key:"setAACConfig",value:function(){var r,i,a,o=new Uint8Array(2);this.header&&(r=((this.header[2]&192)>>>6)+1,i=(this.header[2]&60)>>>2,a=(this.header[2]&1)<<2,a|=(this.header[3]&192)>>>6,o[0]=r<<3,o[0]|=(i&14)>>1,o[1]|=(i&1)<<7,o[1]|=a<<3,this.mp4track.codec="mp4a.40."+r,this.mp4track.channelCount=a,this.mp4track.config=o,this.readyToDecode=!0)}}]),e})(U),v=(function(){function n(s){b(this,n),this.data=s,this.index=0,this.bitLength=s.byteLength*8}return S(n,[{key:"setData",value:function(e){this.data=e,this.index=0,this.bitLength=e.byteLength*8}},{key:"bitsAvailable",get:function(){return this.bitLength-this.index}},{key:"skipBits",value:function(e){if(this.bitsAvailable<e)return!1;this.index+=e}},{key:"readBits",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this.getBits(e,this.index,t);return r}},{key:"getBits",value:function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(this.bitsAvailable<e)return 0;var i=t%8,a=this.data[t/8|0]&255>>>i,o=8-i;if(o>=e)return r&&(this.index+=e),a>>o-e;r&&(this.index+=o);var l=e-o;return a<<l|this.getBits(l,t+o,r)}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitLength-this.index;++e)if(this.getBits(1,this.index+e,!1)!==0)return this.index+=e,e;return e}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return this.readBits(1)===1}},{key:"readUByte",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this.readBits(e*8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}]),n})(),V=(function(){function n(){b(this,n)}return S(n,null,[{key:"extractNALu",value:function(e){for(var t=0,r=e.byteLength,i=[],a=0,o=0;t<r;){var l=e[t++];if(l===0)o++;else if(l===1&&o>=2){var c=o+1;a!==t-c&&i.push(e.subarray(a,t-c)),a=t,o=0}else o=0}var f=null;return a<r&&(f=e.subarray(a,r)),[i,f]}},{key:"skipScalingList",value:function(e,t){for(var r=8,i=8,a,o=0;o<t;o++)i!==0&&(a=e.readEG(),i=(r+a+256)%256),r=i===0?r:i}},{key:"readSPS",value:function(e){var t=new v(e),r=0,i=0,a=0,o=0,l=1,c,f,h,d,p,A,W=0;t.readUByte();for(var K=[],L=1,I=e.byteLength,B=L;B<I;B++)B+2<I&&t.readBits(24,!1)===3?(K.push(t.readBits(8)),K.push(t.readBits(8)),B+=2,t.readBits(8)):K.push(t.readBits(8));if(t.setData(new Uint8Array(K)),c=t.readUByte(),t.readBits(5),t.skipBits(3),t.readUByte(),t.skipUEG(),c===100||c===110||c===122||c===244||c===44||c===83||c===86||c===118||c===128){var he=t.readUEG();if(he===3&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBoolean()){A=he!==3?8:12;for(var fe=0;fe<A;++fe)t.readBoolean()&&(fe<6?n.skipScalingList(t,16):n.skipScalingList(t,64))}}t.skipUEG();var pe=t.readUEG();if(pe===0)t.readUEG();else if(pe===1){t.skipBits(1),t.skipEG(),t.skipEG(),f=t.readUEG();for(var de=0;de<f;++de)t.skipEG()}if(t.skipUEG(),t.skipBits(1),h=t.readUEG(),d=t.readUEG(),p=t.readBits(1),p===0&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(r=t.readUEG(),i=t.readUEG(),a=t.readUEG(),o=t.readUEG()),t.readBoolean()){if(t.readBoolean()){var w,Se=t.readUByte();switch(Se){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:{w=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()];break}}w&&w[0]>0&&w[1]>0&&(l=w[0]/w[1])}if(t.readBoolean()&&t.skipBits(1),t.readBoolean()&&(t.skipBits(4),t.readBoolean()&&t.skipBits(24)),t.readBoolean()&&(t.skipUEG(),t.skipUEG()),t.readBoolean()){var we=t.readUInt(),Fe=t.readUInt(),ve=t.readBoolean(),Ce=Fe/(2*we);ve&&(W=Ce)}}return{fps:W>0?W:void 0,width:Math.ceil(((h+1)*16-r*2-i*2)*l),height:(2-p)*(d+1)*16-(p?2:4)*(a+o)}}}]),n})(),N=(function(){function n(s){b(this,n),this.payload=s,this.nri=(this.payload[0]&96)>>5,this.nalUnitType=this.payload[0]&31,this._sliceType=null,this._isFirstSlice=!1}return S(n,[{key:"toString",value:function(){return"".concat(n.TYPES[this.type()]||"UNKNOWN",": NRI: ").concat(this.getNri())}},{key:"getNri",value:function(){return this.nri}},{key:"type",value:function(){return this.nalUnitType}},{key:"isKeyframe",get:function(){return this.nalUnitType===n.IDR}},{key:"isVCL",get:function(){return this.nalUnitType==n.IDR||this.nalUnitType==n.NDR}},{key:"parseHeader",value:function(){var e=new v(this.getPayload());e.readUByte(),this._isFirstSlice=e.readUEG()===0,this._sliceType=e.readUEG()}},{key:"isFirstSlice",get:function(){return this._isFirstSlice||this.parseHeader(),this._isFirstSlice}},{key:"sliceType",get:function(){return this._sliceType||this.parseHeader(),this._sliceType}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize()),t=new DataView(e.buffer);return t.setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"NDR",get:function(){return 1}},{key:"IDR",get:function(){return 5}},{key:"SEI",get:function(){return 6}},{key:"SPS",get:function(){return 7}},{key:"PPS",get:function(){return 8}},{key:"AUD",get:function(){return 9}},{key:"TYPES",get:function(){var e;return e={},F(e,n.IDR,"IDR"),F(e,n.SEI,"SEI"),F(e,n.SPS,"SPS"),F(e,n.PPS,"PPS"),F(e,n.NDR,"NDR"),F(e,n.AUD,"AUD"),e}}]),n})();function se(n,s){var e=new Uint8Array((n.byteLength|0)+(s.byteLength|0));return e.set(n,0),e.set(s,n.byteLength|0),e}function ge(n){var s,e,t,r="";return s=Math.floor(n),e=parseInt(s/3600,10)%24,t=parseInt(s/60,10)%60,s=s<0?0:s%60,e>0&&(r+=(e<10?"0"+e:e)+":"),r+=(t<10?"0"+t:t)+":"+(s<10?"0"+s:s),r}var me=(function(n){E(e,n);var s=X(e);function e(t,r,i){var a;return b(this,e),a=s.call(this,"H264Remuxer"),a.frameDuration=i,a.readyToDecode=!1,a.nextDts=0,a.dts=0,a.mp4track={id:U.getTrackID(),type:"video",len:0,fragmented:!0,sps:"",pps:"",fps:30,width:0,height:0,timescale:t,duration:r,samples:[]},a.samples=[],a.remainingData=new Uint8Array,a.kfCounter=0,a.pendingUnits={},a}return S(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.sps="",this.mp4track.pps="",this.nextDts=0,this.dts=0,this.remainingData=new Uint8Array,this.kfCounter=0,this.pendingUnits={}}},{key:"feed",value:function(r,i,a){var o=[],l;r=se(this.remainingData,r);var c=V.extractNALu(r),f=z(c,2);return o=f[0],l=f[1],this.remainingData=l||new Uint8Array,o.length>0?(this.remux(this.getVideoFrames(o,i,a)),!0):(m("Failed to extract any NAL units from video data:",l),this.dispatch("outOfData"),!1)}},{key:"getVideoFrames",value:function(r,i,a){var o=this,l=[],c=[],f=0,h=0,d=!1,p=!1;this.pendingUnits.units&&(l=this.pendingUnits.units,p=this.pendingUnits.vcl,d=this.pendingUnits.keyFrame,this.pendingUnits={});var A=k(r),W;try{for(A.s();!(W=A.n()).done;){var K=W.value,L=new N(K);l.length&&p&&(L.isFirstSlice||!L.isVCL)&&(c.push({units:l,keyFrame:d}),l=[],d=!1,p=!1),l.push(L),d=d||L.isKeyframe,p=p||L.isVCL}}catch(B){A.e(B)}finally{A.f()}if(l.length)if(!i)this.pendingUnits={units:l,keyFrame:d,vcl:p};else if(p)c.push({units:l,keyFrame:d});else{var I=c.length-1;I>=0&&(c[I].units=c[I].units.concat(l))}return f=i?i/c.length|0:this.frameDuration,h=i?i-f*c.length:0,c.map(function(B){B.duration=f,B.compositionTimeOffset=a,h>0&&(B.duration++,h--),o.kfCounter++,B.keyFrame&&o.dispatch("keyframePosition",o.kfCounter*f/1e3)}),y("jmuxer: No. of H264 frames of the last chunk: ".concat(c.length)),c}},{key:"remux",value:function(r){var i=k(r),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,l=[],c=0,f=k(o.units),h;try{for(f.s();!(h=f.n()).done;){var d=h.value;this.parseNAL(d)&&(l.push(d),c+=d.getSize())}}catch(p){f.e(p)}finally{f.f()}l.length>0&&this.readyToDecode&&(this.mp4track.len+=c,this.samples.push({units:l,size:c,keyFrame:o.keyFrame,duration:o.duration,compositionTimeOffset:o.compositionTimeOffset}))}}catch(p){i.e(p)}finally{i.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var r=new Uint8Array(this.mp4track.len),i=0,a=this.mp4track.samples,o,l;for(this.dts=this.nextDts;this.samples.length;){var c=this.samples.shift(),f=c.units;if(l=c.duration,l<=0){y("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(l)),this.mp4track.len-=c.size;continue}this.nextDts+=l,o={size:c.size,duration:l,cts:c.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:c.keyFrame?0:1,dependsOn:c.keyFrame?2:1}};var h=k(f),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;r.set(p.getData(),i),i+=p.getSize()}}catch(A){h.e(A)}finally{h.f()}a.push(o)}return a.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}},{key:"parseSPS",value:function(r){var i=V.readSPS(new Uint8Array(r));this.mp4track.fps=i.fps||this.mp4track.fps,this.mp4track.width=i.width,this.mp4track.height=i.height,this.mp4track.sps=[new Uint8Array(r)],this.mp4track.codec="avc1.";for(var a=new DataView(r.buffer,r.byteOffset+1,4),o=0;o<3;++o){var l=a.getUint8(o).toString(16);l.length<2&&(l="0"+l),this.mp4track.codec+=l}}},{key:"parsePPS",value:function(r){this.mp4track.pps=[new Uint8Array(r)]}},{key:"parseNAL",value:function(r){if(!r)return!1;if(r.isVCL)return!0;var i=!1;switch(r.type()){case N.PPS:this.mp4track.pps||this.parsePPS(r.getPayload()),i=!0;break;case N.SPS:this.mp4track.sps||this.parseSPS(r.getPayload()),i=!0;break;case N.AUD:y("AUD - ignoing");break;case N.SEI:y("SEI - ignoing");break}return!this.readyToDecode&&this.mp4track.pps&&this.mp4track.sps&&(this.readyToDecode=!0),i}}]),e})(U),ke=(function(){function n(){b(this,n)}return S(n,null,[{key:"extractNALu",value:function(e){for(var t=0,r=e.byteLength,i=[],a=0,o=0;t<r;){var l=e[t++];if(l===0)o++;else if(l===1&&o>=2){var c=o+1;a!==t-c&&i.push(e.subarray(a,t-c)),a=t,o=0}else o=0}var f=null;return a<r&&(f=e.subarray(a,r)),[i,f]}},{key:"removeEmulationPreventionBytes",value:function(e){for(var t=[],r=0,i=0;i<e.length;i++){var a=e[i];if(r===2&&a===3){r=0;continue}t.push(a),a===0?r++:r=0}return new Uint8Array(t)}},{key:"readSPS",value:function(e){var t=new v(e);t.readUByte(),t.readUByte(),t.readBits(4),t.readBits(3),t.readBits(1);for(var r=t.readBits(2),i=t.readBits(1),a=t.readBits(5),o=t.readUInt(),l=new Uint8Array(6),c=0;c<6;c++)l[c]=t.readUByte();var f=t.readUByte();t.readUEG();var h=t.readUEG();h===3&&t.readBits(1);var d=t.readUEG(),p=t.readUEG(),A=t.readBoolean(),W=0,K=0,L=0,I=0;A&&(W=t.readUEG(),K=t.readUEG(),L=t.readUEG(),I=t.readUEG());var B=null,he=t.readBoolean();if(he){var fe=t.readBoolean();if(fe){var pe=t.readUByte();pe===255&&(t.readUShort(),t.readUShort())}var de=t.readBoolean();de&&t.readBoolean();var w=t.readBoolean();if(w){t.readBits(3),t.readBoolean();var Se=t.readBoolean();Se&&(t.readUByte(),t.readUByte(),t.readUByte())}var we=t.readBoolean();we&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean();var Fe=t.readBoolean();if(Fe){var ve=t.readUInt(),Ce=t.readUInt();t.readBoolean(),ve&&(B=Ce/(2*ve))}}var Te=h===1||h===2?2:1,je=h===1?2:1,Ne=d-Te*(K+W),Re=p-je*(L+I);return{width:Ne,height:Re,profile_space:r,tier_flag:i,profile_idc:a,profile_compatibility_flags:o,constraint_indicator_flags:l,level_idc:f,chroma_format_idc:h,fps:B}}}]),n})(),ue=(function(){function n(s){b(this,n),this.payload=s,this.nalUnitType=(s[0]&126)>>1,this.nuhLayerId=(s[0]&1)<<5|(s[1]&248)>>3,this.nuhTemporalIdPlus1=s[1]&7,this._isFirstSlice=null,this._sliceType=null}return S(n,[{key:"toString",value:function(){return"".concat(n.TYPES[this.type()]||"UNKNOWN ("+this.type()+")",": Layer: ").concat(this.nuhLayerId,", Temporal Id: ").concat(this.nuhTemporalIdPlus1)}},{key:"type",value:function(){return this.nalUnitType}},{key:"isKeyframe",get:function(){return[n.IDR_W_RADL,n.IDR_N_LP,n.CRA].includes(this.nalUnitType)}},{key:"isVCL",get:function(){return this.nalUnitType<=31}},{key:"parseHeader",value:function(){var e=new v(this.getPayload());e.readUByte(),e.readUByte(),this._isFirstSlice=e.readBoolean(),this.isKeyframe&&e.readBits(1),e.readUEG(),this._sliceType=e.readUEG()}},{key:"isFirstSlice",get:function(){return this._isFirstSlice||this.parseHeader(),this._isFirstSlice}},{key:"sliceType",get:function(){return this._sliceType||this.parseHeader(),this._sliceType}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize()),t=new DataView(e.buffer);return t.setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"TRAIL_N",get:function(){return 0}},{key:"TRAIL_R",get:function(){return 1}},{key:"IDR_W_RADL",get:function(){return 19}},{key:"IDR_N_LP",get:function(){return 20}},{key:"CRA",get:function(){return 21}},{key:"VPS",get:function(){return 32}},{key:"SPS",get:function(){return 33}},{key:"PPS",get:function(){return 34}},{key:"AUD",get:function(){return 35}},{key:"SEI",get:function(){return 39}},{key:"SEI2",get:function(){return 40}},{key:"TYPES",get:function(){var e;return e={},F(e,n.TRAIL_N,"TRAIL_N"),F(e,n.TRAIL_R,"TRAIL_R"),F(e,n.IDR_W_RADL,"IDR"),F(e,n.IDR_N_LP,"IDR2"),F(e,n.CRA,"CRA"),F(e,n.VPS,"VPS"),F(e,n.SPS,"SPS"),F(e,n.PPS,"PPS"),F(e,n.AUD,"AUD"),F(e,n.SEI,"SEI"),F(e,n.SEI2,"SEI2"),e}}]),n})(),De=(function(n){E(e,n);var s=X(e);function e(t,r,i){var a;return b(this,e),a=s.call(this,"H264Remuxer"),a.frameDuration=i,a.readyToDecode=!1,a.nextDts=0,a.dts=0,a.mp4track={id:U.getTrackID(),type:"video",len:0,fragmented:!0,vps:"",sps:"",pps:"",hvcC:{},fps:30,width:0,height:0,timescale:t,duration:r,samples:[]},a.samples=[],a.remainingData=new Uint8Array,a.kfCounter=0,a.pendingUnits={},a}return S(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.vps="",this.mp4track.sps="",this.mp4track.pps="",this.mp4track.hvcC={},this.nextDts=0,this.dts=0,this.remainingData=new Uint8Array,this.kfCounter=0,this.pendingUnits={}}},{key:"feed",value:function(r,i,a){var o=[],l;r=se(this.remainingData,r);var c=ke.extractNALu(r),f=z(c,2);return o=f[0],l=f[1],this.remainingData=l||new Uint8Array,o.length>0?(this.remux(this.getVideoFrames(o,i,a)),!0):(m("Failed to extract any NAL units from video data:",l),this.dispatch("outOfData"),!1)}},{key:"getVideoFrames",value:function(r,i,a){var o=this,l=[],c=[],f=0,h=0,d=!1,p=!1;this.pendingUnits.units&&(l=this.pendingUnits.units,p=this.pendingUnits.vcl,d=this.pendingUnits.keyFrame,this.pendingUnits={});var A=k(r),W;try{for(A.s();!(W=A.n()).done;){var K=W.value,L=new ue(K);l.length&&p&&(L.isFirstSlice||!L.isVCL)&&(c.push({units:l,keyFrame:d}),l=[],d=!1,p=!1),l.push(L),d=d||L.isKeyframe,p=p||L.isVCL}}catch(B){A.e(B)}finally{A.f()}if(l.length)if(!i)this.pendingUnits={units:l,keyFrame:d,vcl:p};else if(p)c.push({units:l,keyFrame:d});else{var I=c.length-1;I>=0&&(c[I].units=c[I].units.concat(l))}return f=i?i/c.length|0:this.frameDuration,h=i?i-f*c.length:0,c.map(function(B){B.duration=f,B.compositionTimeOffset=a,h>0&&(B.duration++,h--),o.kfCounter++,B.keyFrame&&o.dispatch("keyframePosition",o.kfCounter*f/1e3)}),y("jmuxer: No. of H265 frames of the last chunk: ".concat(c.length)),c}},{key:"remux",value:function(r){var i=k(r),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,l=[],c=0,f=k(o.units),h;try{for(f.s();!(h=f.n()).done;){var d=h.value;this.parseNAL(d)&&(l.push(d),c+=d.getSize())}}catch(p){f.e(p)}finally{f.f()}l.length>0&&this.readyToDecode&&(this.mp4track.len+=c,this.samples.push({units:l,size:c,keyFrame:o.keyFrame,duration:o.duration,compositionTimeOffset:o.compositionTimeOffset}))}}catch(p){i.e(p)}finally{i.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var r=new Uint8Array(this.mp4track.len),i=0,a=this.mp4track.samples,o,l;for(this.dts=this.nextDts;this.samples.length;){var c=this.samples.shift(),f=c.units;if(l=c.duration,l<=0){y("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(l)),this.mp4track.len-=c.size;continue}this.nextDts+=l,o={size:c.size,duration:l,cts:c.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:c.keyFrame?0:1,dependsOn:c.keyFrame?2:1}};var h=k(f),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;r.set(p.getData(),i),i+=p.getSize()}}catch(A){h.e(A)}finally{h.f()}a.push(o)}return a.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}},{key:"parseSPS",value:function(r){this.mp4track.sps=[new Uint8Array(r)],r=ke.removeEmulationPreventionBytes(r);var i=ke.readSPS(new Uint8Array(r));this.mp4track.fps=i.fps||this.mp4track.fps,this.mp4track.width=i.width,this.mp4track.height=i.height,this.mp4track.codec="hvc1.".concat(i.profile_idc,".").concat(i.profile_compatibility_flags.toString(16))+".L".concat(i.level_idc).concat(i.tier_flag?"H":"L")+".".concat(i.constraint_indicator_flags.map(function(a){return a.toString(16)}).join(".").toUpperCase()),this.mp4track.hvcC={profile_space:i.profile_space,tier_flag:i.tier_flag,profile_idc:i.profile_idc,profile_compatibility_flags:i.profile_compatibility_flags,constraint_indicator_flags:i.constraint_indicator_flags,level_idc:i.level_idc,chroma_format_idc:i.chroma_format_idc}}},{key:"parsePPS",value:function(r){this.mp4track.pps=[r]}},{key:"parseVPS",value:function(r){this.mp4track.vps=[r]}},{key:"parseNAL",value:function(r){if(!r)return!1;if(r.isVCL)return!0;var i=!1;switch(r.type()){case ue.VPS:this.mp4track.vps||this.parseVPS(r.getPayload()),i=!0;break;case ue.SPS:this.mp4track.sps||this.parseSPS(r.getPayload()),i=!0;break;case ue.PPS:this.mp4track.pps||this.parsePPS(r.getPayload()),i=!0;break;case ue.AUD:y("AUD - ignoing");break;case ue.SEI:case ue.SEI2:y("SEI - ignoing");break}return!this.readyToDecode&&this.mp4track.vps&&this.mp4track.sps&&this.mp4track.pps&&(this.readyToDecode=!0),i}}]),e})(U),_e=(function(n){E(e,n);var s=X(e);function e(t,r,i,a){var o;return b(this,e),o=s.call(this,"remuxer"),o.videoCodec=i,o.frameDuration=a,o.initialized=!1,o.tracks={},o.seq=1,o.env=t,o.timescale=1e3,o.mediaDuration=r?4294967295:0,o}return S(e,[{key:"addTrack",value:function(r){var i=this;if((r==="video"||r==="both")&&(this.videoCodec=="H265"?this.tracks.video=new De(this.timescale,this.mediaDuration,this.frameDuration):this.tracks.video=new me(this.timescale,this.mediaDuration,this.frameDuration),this.tracks.video.on("outOfData",function(){i.dispatch("missingVideoFrames")}),this.tracks.video.on("keyframePosition",function(o){i.dispatch("keyframePosition",o)})),r==="audio"||r==="both"){var a=new R(this.timescale,this.mediaDuration,this.frameDuration);this.tracks.audio=a,this.tracks.video.on("outOfData",function(){i.dispatch("missingAudioFrames")})}}},{key:"reset",value:function(){for(var r in this.tracks)this.tracks[r].resetTrack();this.initialized=!1}},{key:"destroy",value:function(){this.tracks={},this.offAll()}},{key:"flush",value:function(){if(!this.initialized){if(!this.isReady())return;this.dispatch("ready"),this.initSegment(),this.initialized=!0}for(var r in this.tracks){var i=this.tracks[r],a=i.getPayload();if(a&&a.byteLength){var o=H.moof(this.seq,i.dts,i.mp4track),l=H.mdat(a),c=se(o,l),f={type:r,payload:c,dts:i.dts};r==="video"&&(f.fps=i.mp4track.fps),this.dispatch("buffer",f);var h=ge(i.dts/this.timescale);y("put segment (".concat(r,"): dts: ").concat(i.dts," frames: ").concat(i.mp4track.samples.length," second: ").concat(h)),i.flush(),this.seq++}}}},{key:"initSegment",value:function(){var r=[];for(var i in this.tracks){var a=this.tracks[i];if(this.env=="browser"){var o={type:i,payload:H.initSegment([a.mp4track],this.mediaDuration,this.timescale)};this.dispatch("buffer",o)}else r.push(a.mp4track)}if(this.env=="node"){var l={type:"all",payload:H.initSegment(r,this.mediaDuration,this.timescale)};this.dispatch("buffer",l)}y("Initial segment generated.")}},{key:"isReady",value:function(){for(var r in this.tracks)if(!this.tracks[r].readyToDecode||!this.tracks[r].samples.length)return!1;return!0}},{key:"feed",value:function(r){var i=!1;if(r.video&&this.tracks.video&&(i|=this.tracks.video.feed(r.video,r.duration,r.compositionTimeOffset)),r.audio&&this.tracks.audio&&(i|=this.tracks.audio.feed(r.audio,r.duration)),!i){m("Input object must have video and/or audio property. Make sure it is a valid typed array");return}this.flush()}}]),e})(j),Be=(function(n){E(e,n);var s=X(e);function e(t,r){var i;return b(this,e),i=s.call(this,"buffer"),i.type=r,i.queue=new Uint8Array,i.cleaning=!1,i.pendingCleaning=0,i.cleanOffset=30,i.cleanRanges=[],i.sourceBuffer=t,i.sourceBuffer.addEventListener("updateend",function(){if(i.pendingCleaning>0&&(i.initCleanup(i.pendingCleaning),i.pendingCleaning=0),i.cleaning=!1,i.cleanRanges.length){i.doCleanup();return}}),i.sourceBuffer.addEventListener("error",function(){i.dispatch("error",{type:i.type,name:"buffer",error:"buffer error"})}),i}return S(e,[{key:"destroy",value:function(){this.queue=null,this.sourceBuffer=null,this.offAll()}},{key:"doCleanup",value:function(){if(!this.cleanRanges.length){this.cleaning=!1;return}var r=this.cleanRanges.shift();y("".concat(this.type," remove range [").concat(r[0]," - ").concat(r[1],")")),this.cleaning=!0,this.sourceBuffer.remove(r[0],r[1])}},{key:"initCleanup",value:function(r){try{if(this.sourceBuffer.updating){this.pendingCleaning=r;return}if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var i=0;i<this.sourceBuffer.buffered.length;++i){var a=this.sourceBuffer.buffered.start(i),o=this.sourceBuffer.buffered.end(i);r-a>this.cleanOffset&&(o=r-this.cleanOffset,a<o&&this.cleanRanges.push([a,o]))}this.doCleanup()}}catch(l){m("Error occured while cleaning ".concat(this.type," buffer - ").concat(l.name,": ").concat(l.message))}}},{key:"doAppend",value:function(){if(this.queue.length&&!(!this.sourceBuffer||this.sourceBuffer.updating))try{this.sourceBuffer.appendBuffer(this.queue),this.queue=new Uint8Array}catch(i){var r="unexpectedError";i.name==="QuotaExceededError"?(y("".concat(this.type," buffer quota full")),r="QuotaExceeded"):(m("Error occured while appending ".concat(this.type," buffer - ").concat(i.name,": ").concat(i.message)),r="InvalidStateError"),this.dispatch("error",{type:this.type,name:r,error:"buffer error"})}}},{key:"feed",value:function(r){this.queue=se(this.queue,r)}}]),e})(j),Ee=(function(n){E(e,n);var s=X(e);function e(t){var r;b(this,e),r=s.call(this,"jmuxer"),r.isReset=!1;var i={node:"",mode:"both",videoCodec:"H264",flushingTime:500,maxDelay:500,clearBuffer:!0,fps:30,readFpsFromTrack:!1,debug:!1,onReady:function(){},onData:function(){},onError:function(){},onUnsupportedCodec:function(){},onMissingVideoFrames:function(){},onMissingAudioFrames:function(){},onKeyframePosition:function(){},onLoggerLog:console.log,onLoggerErr:console.error};return r.options=Object.assign({},i,t),r.env=(typeof process>"u"?"undefined":ie(process))==="object"&&typeof window>"u"?"node":"browser",r.options.debug&&C(r.options.onLoggerLog,r.options.onLoggerErr),r.options.fps||(r.options.fps=30),r.frameDuration=1e3/r.options.fps|0,r.remuxController=new _e(r.env,t.live,r.options.videoCodec,r.frameDuration),r.remuxController.addTrack(r.options.mode),r.initData(),r.remuxController.on("buffer",r.onBuffer.bind(_(r))),r.env=="browser"&&(r.remuxController.on("ready",r.createBuffer.bind(_(r))),r.initBrowser()),r.remuxController.on("missingVideoFrames",function(){typeof r.options.onMissingVideoFrames=="function"&&r.options.onMissingVideoFrames.call(null)}),r.remuxController.on("missingAudioFrames",function(){typeof r.options.onMissingAudioFrames=="function"&&r.options.onMissingAudioFrames.call(null)}),r.clearBuffer&&r.remuxController.on("keyframePosition",function(a){r.kfPosition.push(a)}),typeof r.options.onKeyframePosition=="function"&&r.remuxController.on("keyframePosition",function(a){r.options.onKeyframePosition.call(null,a)}),r}return S(e,[{key:"initData",value:function(){this.lastCleaningTime=Date.now(),this.kfPosition=[],this.pendingUnits={},this.remainingData=new Uint8Array,this.startInterval()}},{key:"initBrowser",value:function(){typeof this.options.node=="string"&&this.options.node==""&&m("no video element were found to render, provide a valid video element"),this.node=typeof this.options.node=="string"?document.getElementById(this.options.node):this.options.node,this.mseReady=!1,this.setupMSE()}},{key:"createStream",value:function(){var r=this.feed.bind(this),i=this.destroy.bind(this);return this.stream=new J.Duplex({writableObjectMode:!0,read:function(o){},write:function(o,l,c){r(o),c()},final:function(o){i(),o()}}),this.stream}},{key:"setupMSE",value:function(){if(window.MediaSource=window.MediaSource||window.WebKitMediaSource||window.ManagedMediaSource,!window.MediaSource)throw"Oops! Browser does not support Media Source Extension or Managed Media Source (IOS 17+).";if(this.isMSESupported=!!window.MediaSource,this.mediaSource=new window.MediaSource,this.url=URL.createObjectURL(this.mediaSource),window.MediaSource===window.ManagedMediaSource)try{this.node.removeAttribute("src"),this.node.disableRemotePlayback=!0;var r=document.createElement("source");r.type="video/mp4",r.src=this.url,this.node.appendChild(r),this.node.load()}catch{this.node.src=this.url}else this.node.src=this.url;this.mseEnded=!1,this.mediaSource.addEventListener("sourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("sourceclose",this.onMSEClose.bind(this)),this.mediaSource.addEventListener("webkitsourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("webkitsourceclose",this.onMSEClose.bind(this))}},{key:"endMSE",value:function(){if(!this.mseEnded)try{this.mseEnded=!0,this.mediaSource.endOfStream()}catch{m("mediasource is not available to end")}}},{key:"feed",value:function(r){!r||!this.remuxController||(r.duration=r.duration?parseInt(r.duration):0,this.remuxController.feed(r))}},{key:"destroy",value:function(){if(this.stopInterval(),this.stream&&(this.remuxController.flush(),this.stream.push(null),this.stream=null),this.remuxController&&(this.remuxController.destroy(),this.remuxController=null),this.bufferControllers){for(var r in this.bufferControllers)this.bufferControllers[r].destroy();this.bufferControllers=null,this.endMSE()}this.node=!1,this.mseReady=!1,this.videoStarted=!1,this.mediaSource=null}},{key:"reset",value:function(){if(this.stopInterval(),this.isReset=!0,this.node.pause(),this.remuxController&&this.remuxController.reset(),this.bufferControllers){for(var r in this.bufferControllers)this.bufferControllers[r].destroy();this.bufferControllers=null,this.endMSE()}this.initData(),this.env=="browser"&&this.initBrowser(),y("JMuxer was reset")}},{key:"createBuffer",value:function(){if(!(!this.mseReady||!this.remuxController||!this.remuxController.isReady()||this.bufferControllers)){this.bufferControllers={};for(var r in this.remuxController.tracks){var i=this.remuxController.tracks[r];if(!e.isSupported("".concat(r,'/mp4; codecs="').concat(i.mp4track.codec,'"')))return m("Browser does not support codec: ".concat(r,'/mp4; codecs="').concat(i.mp4track.codec,'"')),typeof this.options.onUnsupportedCodec=="function"&&this.options.onUnsupportedCodec.call(null,i.mp4track.codec),!1;var a=this.mediaSource.addSourceBuffer("".concat(r,'/mp4; codecs="').concat(i.mp4track.codec,'"'));this.bufferControllers[r]=new Be(a,r),this.bufferControllers[r].on("error",this.onBufferError.bind(this))}}}},{key:"startInterval",value:function(){var r=this;this.interval=setInterval(function(){r.options.flushingTime?r.applyAndClearBuffer():r.bufferControllers&&r.cancelDelay()},this.options.flushingTime||1e3)}},{key:"stopInterval",value:function(){this.interval&&clearInterval(this.interval)}},{key:"cancelDelay",value:function(){if(this.node.buffered&&this.node.buffered.length>0&&!this.node.seeking){var r=this.node.buffered.end(0);r-this.node.currentTime>this.options.maxDelay/1e3&&(y("delay"),this.node.paused&&this.node.play().catch(m),this.node.currentTime=r-.001)}}},{key:"releaseBuffer",value:function(){for(var r in this.bufferControllers)this.bufferControllers[r].doAppend()}},{key:"applyAndClearBuffer",value:function(){this.bufferControllers&&(this.releaseBuffer(),this.clearBuffer())}},{key:"getSafeClearOffsetOfBuffer",value:function(r){for(var i=this.options.mode==="audio"&&r||0,a,o=0;o<this.kfPosition.length&&!(this.kfPosition[o]>=r);o++)a=this.kfPosition[o];return a&&(this.kfPosition=this.kfPosition.filter(function(l){return l<a&&(i=l),l>=a})),i}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var r in this.bufferControllers){var i=this.getSafeClearOffsetOfBuffer(this.node.currentTime);this.bufferControllers[r].initCleanup(i)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(r){this.options.readFpsFromTrack&&typeof r.fps<"u"&&this.options.fps!=r.fps&&(this.options.fps=r.fps,this.frameDuration=Math.ceil(1e3/r.fps),y("JMuxer changed FPS to ".concat(r.fps," from track data"))),this.env=="browser"?this.bufferControllers&&this.bufferControllers[r.type]&&this.bufferControllers[r.type].feed(r.payload):this.stream&&this.stream.push(r.payload),this.options.onData&&this.options.onData(r.payload),this.options.flushingTime===0&&this.applyAndClearBuffer()}},{key:"onMSEOpen",value:function(){this.mseReady=!0,URL.revokeObjectURL(this.url),typeof this.options.onReady=="function"&&this.options.onReady.call(null,this.isReset)}},{key:"onMSEClose",value:function(){this.mseReady=!1,this.videoStarted=!1}},{key:"onBufferError",value:function(r){if(r.name=="QuotaExceeded"){y("JMuxer cleaning ".concat(r.type," buffer due to QuotaExceeded error")),this.bufferControllers[r.type].initCleanup(this.node.currentTime);return}else r.name=="InvalidStateError"?(y("JMuxer is reseting due to InvalidStateError"),this.reset()):this.endMSE();typeof this.options.onError=="function"&&this.options.onError.call(null,r)}}],[{key:"isSupported",value:function(r){return window.MediaSource&&window.MediaSource.isTypeSupported(r)}}]),e})(j);return Ee}))})(be)),be.exports}var Ye=Ke();const Xe=Ie(Ye);function qe({className:ae,onFallback:q,fallbackTimeout:J=5e3,enableControl:Y=!1,onTapSuccess:oe,onTapError:Q}){const _=g.useRef(null),b=g.useRef(null),G=g.useRef(null),[S,k]=g.useState("connecting"),[X,F]=g.useState(null),O=g.useRef(null),E=g.useRef(!1),[re,xe]=g.useState([]),[Z,ye]=g.useState(null),le=g.useRef(0),ee=g.useRef(Date.now()),ne=g.useRef(0),z=g.useRef(0),$=g.useRef(q),ce=g.useRef(J),te=(D,P,M)=>{const C=M.getBoundingClientRect(),y=C.width,m=C.height,j=M.videoWidth,H=M.videoHeight;if(j===0||H===0)return console.warn("[ScrcpyPlayer] Video dimensions not available yet"),null;const x=j/H,T=y/m;let U,R,v,V;T>x?(R=m,U=x*m,v=(y-U)/2,V=0):(U=y,R=y/x,v=0,V=(m-R)/2);const N=D-v,se=P-V;if(N<0||N>U||se<0||se>R)return console.warn("[ScrcpyPlayer] Click outside video area (in letterbox)"),null;const ge=Math.round(N/U*j),me=Math.round(se/R*H);return console.log(`[ScrcpyPlayer] Coordinate transform:
5
- Click: (${D}, ${P})
6
- Display: ${y}x${m}
7
- Video: ${j}x${H}
8
- Rendered: ${U}x${R} at offset (${v}, ${V})
9
- Device: (${ge}, ${me})`),{x:ge,y:me}},ie=async D=>{if(!Y)return;if(!_.current||S!=="connected"){console.warn("[ScrcpyPlayer] Video not ready for control");return}if(_.current.videoWidth===0||_.current.videoHeight===0){console.warn("[ScrcpyPlayer] Video dimensions not available");return}if(!Z){console.warn("[ScrcpyPlayer] Device resolution not available yet");return}const P=_.current.getBoundingClientRect(),M=D.clientX-P.left,C=D.clientY-P.top,y=te(M,C,_.current);if(!y)return;const m=_.current.videoWidth,j=_.current.videoHeight,H=Z.width/m,x=Z.height/j,T=Math.round(y.x*H),U=Math.round(y.y*x);console.log(`[ScrcpyPlayer] Coordinate scaling:
10
- Video stream: ${m}x${j}
11
- Device actual: ${Z.width}x${Z.height}
12
- Scale: ${H.toFixed(3)}x${x.toFixed(3)}
13
- Video coords: (${y.x}, ${y.y})
14
- Device coords: (${T}, ${U})`);const R=Date.now();xe(v=>[...v,{id:R,x:D.clientX,y:D.clientY}]),setTimeout(()=>{xe(v=>v.filter(V=>V.id!==R))},500);try{const v=await Oe(T,U);v.success?(console.log("[ScrcpyPlayer] Tap successful"),oe?.()):(console.error("[ScrcpyPlayer] Tap failed:",v.error),Q?.(v.error||"Unknown error"))}catch(v){console.error("[ScrcpyPlayer] Tap request failed:",v),Q?.(String(v))}};return g.useEffect(()=>{$.current=q,ce.current=J},[q,J]),g.useEffect(()=>{(async()=>{try{const P=await Ue();P.success&&(ye({width:P.width,height:P.height}),console.log(`[ScrcpyPlayer] Device actual resolution: ${P.width}x${P.height}`))}catch(P){console.error("[ScrcpyPlayer] Failed to fetch device resolution:",P)}})()},[]),g.useEffect(()=>{let D=null,P=null;const M=async()=>{if(_.current){if(console.log("[ScrcpyPlayer] connect() called"),z.current=Date.now(),k("connecting"),F(null),G.current){console.log("[ScrcpyPlayer] Closing existing WebSocket");try{G.current.onclose=null,G.current.onerror=null,G.current.onmessage=null,G.current.close()}catch(C){console.error("[ScrcpyPlayer] Error closing old WebSocket:",C)}G.current=null}if(b.current){console.log("[ScrcpyPlayer] Destroying old jMuxer instance");try{b.current.destroy()}catch(C){console.error("[ScrcpyPlayer] Error destroying old jMuxer:",C)}b.current=null}_.current&&(_.current.src="",_.current.load()),await new Promise(C=>setTimeout(C,300));try{console.log("[ScrcpyPlayer] Creating new jMuxer instance (after cleanup delay)"),b.current=new Xe({node:_.current,mode:"video",flushingTime:0,fps:30,debug:!1,clearBuffer:!0,onError:y=>{if(console.error("[jMuxer] Decoder error:",y),y.name==="InvalidStateError"&&y.error==="buffer error"){const m=Date.now(),j=m-ne.current;(m-z.current<1e3?j>500:j>2e3)?(ne.current=m,console.warn("[jMuxer] ⚠️ Buffer error detected, reconnecting..."),P&&setTimeout(()=>{P()},100)):console.warn(`[jMuxer] Reconnect skipped (debounced: ${j}ms since last error)`)}}});const C=new WebSocket("ws://localhost:8000/api/video/stream");G.current=C,C.binaryType="arraybuffer",C.onopen=()=>{console.log("[ScrcpyPlayer] WebSocket connected"),k("connected"),O.current=setTimeout(()=>{E.current||(console.log("[ScrcpyPlayer] No data received within timeout, triggering fallback"),k("error"),F("Video stream timeout"),C.close(),$.current&&$.current())},ce.current)},C.onmessage=y=>{if(typeof y.data=="string"){try{const m=JSON.parse(y.data);console.error("[ScrcpyPlayer] Server error:",m),F(m.error||"Unknown error"),k("error"),$.current&&!E.current&&$.current()}catch{console.error("[ScrcpyPlayer] Received non-JSON string:",y.data)}return}E.current||(E.current=!0,console.log("[ScrcpyPlayer] First video data received, canceling fallback timer"),O.current&&(clearTimeout(O.current),O.current=null));try{if(b.current&&y.data.byteLength>0){b.current.feed({video:new Uint8Array(y.data)}),le.current++;const m=Date.now(),j=m-ee.current;if(j>5e3){const H=le.current/j*1e3,x=_.current,T=x&&x.buffered.length>0?x.buffered.end(0)-x.currentTime:0;console.log(`[ScrcpyPlayer] Stats: ${H.toFixed(1)} fps, buffer: ${T.toFixed(2)}s`),T>2&&console.warn(`[ScrcpyPlayer] ⚠ High latency detected: ${T.toFixed(2)}s buffer`),le.current=0,ee.current=m}}}catch(m){console.error("[ScrcpyPlayer] Feed error:",m)}},C.onerror=y=>{console.error("[ScrcpyPlayer] WebSocket error:",y),F("Connection error"),k("error")},C.onclose=()=>{console.log("[ScrcpyPlayer] WebSocket closed"),k("disconnected"),D=setTimeout(()=>{console.log("[ScrcpyPlayer] Attempting to reconnect..."),M()},3e3)}}catch(C){console.error("[ScrcpyPlayer] Initialization error:",C),F("Initialization failed"),k("error")}}};return P=M,M(),()=>{if(D&&clearTimeout(D),O.current&&(clearTimeout(O.current),O.current=null),G.current&&(G.current.close(),G.current=null),b.current){try{b.current.destroy()}catch(C){console.error("[ScrcpyPlayer] Cleanup error:",C)}b.current=null}}},[]),u.jsxs("div",{className:`relative w-full h-full flex items-center justify-center ${ae||""}`,children:[u.jsx("video",{ref:_,autoPlay:!0,muted:!0,playsInline:!0,onClick:ie,className:`max-w-full max-h-full object-contain ${Y?"cursor-pointer":""}`,style:{backgroundColor:"#000"}}),Y&&re.map(D=>u.jsx("div",{className:"fixed pointer-events-none z-50",style:{left:D.x,top:D.y},children:u.jsx("div",{className:"ripple-circle"})},D.id)),S!=="connected"&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:u.jsxs("div",{className:"text-center text-white",children:[S==="connecting"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-8 h-8 border-4 border-white border-t-transparent rounded-full animate-spin mx-auto mb-2"}),u.jsx("p",{children:"正在连接..."})]}),S==="disconnected"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-8 h-8 border-4 border-yellow-500 border-t-transparent rounded-full animate-spin mx-auto mb-2"}),u.jsx("p",{children:"连接断开,正在重连..."})]}),S==="error"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-red-500 text-xl mb-2",children:"✗"}),u.jsx("p",{className:"text-red-400",children:"连接失败"}),X&&u.jsx("p",{className:"text-sm text-gray-400 mt-1",children:X})]})]})})]})}function Ze(){const[ae,q]=g.useState([]),[J,Y]=g.useState(""),[oe,Q]=g.useState(!1),[_,b]=g.useState(!1),[G,S]=g.useState(null),[k,X]=g.useState(null),[F,O]=g.useState(null),[E,re]=g.useState({baseUrl:"",apiKey:"",modelName:""}),[xe,Z]=g.useState(!1),[ye,le]=g.useState(!0),[ee,ne]=g.useState(!1),[z,$]=g.useState("auto"),[ce,te]=g.useState(null),ie=g.useRef(null),D=g.useRef(!1),P=g.useRef([]),M=g.useRef([]),C=()=>{ie.current?.scrollIntoView({behavior:"smooth"})};g.useEffect(()=>{C()},[ae]),g.useEffect(()=>{(async()=>{try{if((await Me()).initialized)b(!0);else try{await Ae(),b(!0)}catch{b(!1)}}catch{b(!1),S("无法连接到后端服务")}})()},[]),g.useEffect(()=>{if(!(z==="screenshot"||z==="auto"&&ee))return;const T=async()=>{if(!D.current){D.current=!0;try{const R=await Ue();R.success&&X(R)}catch(R){console.error("Failed to fetch screenshot:",R)}finally{D.current=!1}}};T();const U=setInterval(T,500);return()=>clearInterval(U)},[ee,z]);const y=async()=>{S(null);try{await Ae({model_config:{base_url:E.baseUrl||void 0,api_key:E.apiKey||void 0,model_name:E.modelName||void 0}}),b(!0),Z(!1)}catch{S("初始化失败,请检查配置或确保后端服务正在运行")}},m=async()=>{if(!J.trim()||oe)return;const x={id:Date.now().toString(),role:"user",content:J.trim(),timestamp:new Date};q(v=>[...v,x]),Y(""),Q(!0),S(null),P.current=[],M.current=[];const T=(Date.now()+1).toString(),U={id:T,role:"agent",content:"",timestamp:new Date,thinking:[],actions:[],isStreaming:!0};q(v=>[...v,U]);const R=Ge(x.content,v=>{console.log("[Chat] Processing step event:",v),P.current.push(v.thinking),M.current.push(v.action),q(V=>V.map(N=>N.id===T?{...N,thinking:[...P.current],actions:[...M.current],steps:v.step}:N))},v=>{q(V=>V.map(N=>N.id===T?{...N,content:v.message,success:v.success,isStreaming:!1}:N)),Q(!1),O(null)},v=>{q(V=>V.map(N=>N.id===T?{...N,content:`错误: ${v.message}`,success:!1,isStreaming:!1}:N)),Q(!1),O(null)});O(R)},j=async()=>{F&&(F.close(),O(null)),Q(!1),q([]),S(null),await He()},H=x=>{x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),m())};return u.jsxs("div",{className:"h-full flex items-center justify-center p-4 gap-4 relative",children:[xe&&u.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 rounded-2xl",children:u.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-2xl w-96 shadow-xl border border-gray-200 dark:border-gray-700",children:[u.jsx("h2",{className:"text-xl font-bold mb-4 text-gray-900 dark:text-gray-100",children:"Agent 配置"}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Base URL"}),u.jsx("input",{type:"text",value:E.baseUrl,onChange:x=>re({...E,baseUrl:x.target.value}),placeholder:"留空使用默认值",className:"w-full px-3 py-2 border rounded-lg bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 outline-none"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"API Key"}),u.jsx("input",{type:"password",value:E.apiKey,onChange:x=>re({...E,apiKey:x.target.value}),placeholder:"留空使用默认值",className:"w-full px-3 py-2 border rounded-lg bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 outline-none"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Model Name"}),u.jsx("input",{type:"text",value:E.modelName,onChange:x=>re({...E,modelName:x.target.value}),placeholder:"留空使用默认值",className:"w-full px-3 py-2 border rounded-lg bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 outline-none"})]}),u.jsxs("div",{className:"flex justify-end gap-2 mt-6",children:[u.jsx("button",{onClick:()=>Z(!1),className:"px-4 py-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200",children:"取消"}),u.jsx("button",{onClick:y,className:"px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors",children:"确认初始化"})]})]})]})}),u.jsxs("div",{className:"flex flex-col w-full max-w-2xl h-[750px] border border-gray-200 dark:border-gray-700 rounded-2xl shadow-lg bg-white dark:bg-gray-800",children:[u.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 rounded-t-2xl",children:[u.jsx("h1",{className:"text-xl font-semibold",children:"AutoGLM Chat"}),u.jsxs("div",{className:"flex gap-2",children:[_?u.jsx("span",{className:"px-3 py-1 bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 rounded-full text-sm flex items-center justify-center",children:"已初始化"}):u.jsx("button",{onClick:()=>Z(!0),className:"px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors flex items-center justify-center",children:"配置 Agent"}),u.jsx("button",{onClick:j,className:"px-4 py-2 bg-gray-200 dark:bg-gray-700 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors flex items-center justify-center",children:"重置"})]})]}),G&&u.jsx("div",{className:"mx-4 mt-4 p-3 bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-200 rounded-lg",children:G}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[ae.length===0&&u.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:[u.jsx("p",{className:"text-lg",children:"欢迎使用 AutoGLM Chat"}),u.jsx("p",{className:"text-sm mt-2",children:"输入任务描述,让 AI 帮你操作手机"})]}),ae.map(x=>u.jsx("div",{className:`flex ${x.role==="user"?"justify-end":"justify-start"}`,children:x.role==="agent"?u.jsxs("div",{className:"max-w-[80%] space-y-2",children:[x.thinking?.map((T,U)=>u.jsxs("div",{className:"bg-gray-100 dark:bg-gray-700 rounded-2xl px-4 py-3 border-l-4 border-blue-500",children:[u.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:["💭 步骤 ",U+1," - 思考过程"]}),u.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T}),x.actions?.[U]&&u.jsxs("details",{className:"mt-2 text-xs",children:[u.jsx("summary",{className:"cursor-pointer text-blue-500 hover:text-blue-600",children:"查看动作"}),u.jsx("pre",{className:"mt-1 p-2 bg-gray-800 text-gray-200 rounded overflow-x-auto text-xs",children:JSON.stringify(x.actions[U],null,2)})]})]},U)),x.content&&u.jsxs("div",{className:`rounded-2xl px-4 py-3 ${x.success===!1?"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200":"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200"}`,children:[u.jsx("p",{className:"whitespace-pre-wrap",children:x.content}),x.steps!==void 0&&u.jsxs("p",{className:"text-xs mt-2 opacity-70",children:["总步数: ",x.steps]})]}),x.isStreaming&&u.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 animate-pulse",children:"正在执行..."})]}):u.jsx("div",{className:"max-w-[70%] rounded-2xl px-4 py-3 bg-blue-500 text-white",children:u.jsx("p",{className:"whitespace-pre-wrap",children:x.content})})},x.id)),u.jsx("div",{ref:ie})]}),u.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 rounded-b-2xl",children:u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{type:"text",value:J,onChange:x=>Y(x.target.value),onKeyDown:H,placeholder:_?"输入任务描述...":"请先初始化 Agent",disabled:!_||oe,className:"flex-1 px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-xl bg-white dark:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"}),u.jsx("button",{onClick:m,disabled:!_||oe||!J.trim(),className:"px-6 py-3 bg-blue-500 text-white rounded-xl hover:bg-blue-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",children:"发送"})]})})]}),u.jsxs("div",{className:"w-full max-w-xs h-[750px] border border-gray-200 dark:border-gray-700 rounded-2xl shadow-lg bg-gray-900 overflow-hidden relative",children:[u.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1 bg-black/70 rounded-lg p-1",children:[u.jsx("button",{onClick:()=>$("auto"),className:`px-3 py-1 text-xs rounded transition-colors ${z==="auto"?"bg-blue-500 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,title:"自动选择最佳显示模式",children:"自动"}),u.jsx("button",{onClick:()=>$("video"),className:`px-3 py-1 text-xs rounded transition-colors ${z==="video"?"bg-blue-500 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,title:"强制使用视频流",children:"视频流"}),u.jsx("button",{onClick:()=>$("screenshot"),className:`px-3 py-1 text-xs rounded transition-colors ${z==="screenshot"?"bg-blue-500 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,title:"使用截图模式 (0.5s刷新)",children:"截图"})]}),z==="video"||z==="auto"&&ye&&!ee?u.jsxs(u.Fragment,{children:[ce&&u.jsx("div",{className:"absolute top-14 right-2 z-20 px-3 py-2 bg-blue-500 text-white text-sm rounded-lg shadow-lg animate-fade-in",children:ce}),u.jsx(qe,{className:"w-full h-full",enableControl:!0,onFallback:()=>{ne(!0),le(!1)},onTapSuccess:()=>{te("Tap executed"),setTimeout(()=>te(null),2e3)},onTapError:x=>{te(`Tap failed: ${x}`),setTimeout(()=>te(null),3e3)},fallbackTimeout:1e5})]}):u.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gray-900",children:k&&k.success?u.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[u.jsx("img",{src:`data:image/png;base64,${k.image}`,alt:"Device Screenshot",className:"max-w-full max-h-full object-contain",style:{width:k.width>k.height?"100%":"auto",height:k.width>k.height?"auto":"100%"}}),k.is_sensitive&&u.jsx("div",{className:"absolute top-12 right-2 px-2 py-1 bg-yellow-500 text-white text-xs rounded",children:"敏感内容"}),u.jsxs("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-blue-500 text-white text-xs rounded",children:["截图模式 (0.5s 刷新)",z==="auto"&&ee&&" - 视频流不可用"]})]}):k?.error?u.jsxs("div",{className:"text-center text-red-500 dark:text-red-400",children:[u.jsx("p",{className:"mb-2",children:"截图失败"}),u.jsx("p",{className:"text-xs",children:k.error})]}):u.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[u.jsx("div",{className:"w-8 h-8 border-4 border-gray-300 border-t-blue-500 rounded-full animate-spin mx-auto mb-2"}),u.jsx("p",{children:"加载中..."})]})})]})]})}export{Ze as component};
@@ -1 +0,0 @@
1
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-gray-950:oklch(13% .028 261.692);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-2xl:42rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-gray-200,currentcolor)}::file-selector-button{border-color:var(--color-gray-200,currentcolor)}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.top-2{top:calc(var(--spacing)*2)}.top-12{top:calc(var(--spacing)*12)}.top-14{top:calc(var(--spacing)*14)}.right-2{right:calc(var(--spacing)*2)}.bottom-2{bottom:calc(var(--spacing)*2)}.left-2{left:calc(var(--spacing)*2)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-auto{margin-top:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.block{display:block}.flex{display:flex}.h-4{height:calc(var(--spacing)*4)}.h-8{height:calc(var(--spacing)*8)}.h-\[750px\]{height:750px}.h-full{height:100%}.h-screen{height:100vh}.max-h-full{max-height:100%}.w-4{width:calc(var(--spacing)*4)}.w-8{width:calc(var(--spacing)*8)}.w-96{width:calc(var(--spacing)*96)}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[70\%\]{max-width:70%}.max-w-\[80\%\]{max-width:80%}.max-w-full{max-width:100%}.max-w-xs{max-width:var(--container-xs)}.flex-1{flex:1}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-b-2xl{border-bottom-right-radius:var(--radius-2xl);border-bottom-left-radius:var(--radius-2xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-white{border-color:var(--color-white)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-t-blue-500{border-top-color:var(--color-blue-500)}.border-t-transparent{border-top-color:#0000}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-100{background-color:var(--color-green-100)}.bg-red-100{background-color:var(--color-red-100)}.bg-white{background-color:var(--color-white)}.bg-yellow-500{background-color:var(--color-yellow-500)}.object-contain{object-fit:contain}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.text-center{text-align:center}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-pre-wrap{white-space:pre-wrap}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-green-800{color:var(--color-green-800)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-white{color:var(--color-white)}.opacity-70{opacity:.7}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media(hover:hover){.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-600:hover{background-color:var(--color-gray-600)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}}@media(prefers-color-scheme:dark){.dark\:border-gray-600{border-color:var(--color-gray-600)}.dark\:border-gray-700{border-color:var(--color-gray-700)}.dark\:bg-gray-700{background-color:var(--color-gray-700)}.dark\:bg-gray-800{background-color:var(--color-gray-800)}.dark\:bg-green-900{background-color:var(--color-green-900)}.dark\:bg-red-900{background-color:var(--color-red-900)}.dark\:text-blue-400{color:var(--color-blue-400)}.dark\:text-gray-100{color:var(--color-gray-100)}.dark\:text-gray-300{color:var(--color-gray-300)}.dark\:text-gray-400{color:var(--color-gray-400)}.dark\:text-gray-600{color:var(--color-gray-600)}.dark\:text-green-200{color:var(--color-green-200)}.dark\:text-red-200{color:var(--color-red-200)}.dark\:text-red-400{color:var(--color-red-400)}@media(hover:hover){.dark\:hover\:bg-gray-600:hover{background-color:var(--color-gray-600)}.dark\:hover\:text-blue-400:hover{color:var(--color-blue-400)}.dark\:hover\:text-gray-200:hover{color:var(--color-gray-200)}}}}html{color-scheme:light dark}*{border-color:var(--color-gray-200)}@media(prefers-color-scheme:dark){*{border-color:var(--color-gray-800)}}body{background-color:var(--color-gray-50);color:var(--color-gray-950)}@media(prefers-color-scheme:dark){body{background-color:var(--color-gray-900);color:var(--color-gray-200)}}@keyframes ripple{0%{opacity:1;width:0;height:0}to{opacity:0;width:60px;height:60px}}.ripple-circle{pointer-events:none;background:radial-gradient(circle,#3b82f680,#3b82f600 70%);border:2px solid #3b82f6cc;border-radius:50%;width:60px;height:60px;animation:.5s ease-out ripple;position:absolute;transform:translate(-50%,-50%)}@keyframes fade-in{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in{animation:.2s ease-out fade-in}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}