autoglm-gui 0.4.1__py3-none-any.whl → 0.4.2__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.
- AutoGLM_GUI/scrcpy_stream.py +5 -2
- AutoGLM_GUI/static/assets/{about-gHEqXVMQ.js → about-C9954kpk.js} +1 -1
- AutoGLM_GUI/static/assets/chat-CSgek5Xo.js +25 -0
- AutoGLM_GUI/static/assets/index-7WS8sURE.css +1 -0
- AutoGLM_GUI/static/assets/{index-DgzeSwgt.js → index-CCRJFa_5.js} +1 -1
- AutoGLM_GUI/static/assets/{index-C8KPPfxe.js → index-DZmNavz6.js} +1 -1
- AutoGLM_GUI/static/index.html +2 -2
- {autoglm_gui-0.4.1.dist-info → autoglm_gui-0.4.2.dist-info}/METADATA +1 -1
- {autoglm_gui-0.4.1.dist-info → autoglm_gui-0.4.2.dist-info}/RECORD +12 -12
- AutoGLM_GUI/static/assets/chat-6a-qTECg.js +0 -25
- AutoGLM_GUI/static/assets/index-D2-3f619.css +0 -1
- {autoglm_gui-0.4.1.dist-info → autoglm_gui-0.4.2.dist-info}/WHEEL +0 -0
- {autoglm_gui-0.4.1.dist-info → autoglm_gui-0.4.2.dist-info}/entry_points.txt +0 -0
- {autoglm_gui-0.4.1.dist-info → autoglm_gui-0.4.2.dist-info}/licenses/LICENSE +0 -0
AutoGLM_GUI/static/index.html
CHANGED
|
@@ -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-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DZmNavz6.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-7WS8sURE.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="app"></div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: autoglm-gui
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
AutoGLM_GUI/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
AutoGLM_GUI/__main__.py,sha256=Ad7wiAZ3JcYmSlqm-HuOME8etEPBJdupPcv3mPxXkVg,4947
|
|
3
3
|
AutoGLM_GUI/schemas.py,sha256=KfDDnEM1GDXVj2sCA3UCa6qGc5sDjg-Pieaj4V29-V8,2412
|
|
4
|
-
AutoGLM_GUI/scrcpy_stream.py,sha256=
|
|
4
|
+
AutoGLM_GUI/scrcpy_stream.py,sha256=CiZP96LRivufCH_qLZOR-Jim2kmjx3tzzjXdACfLo6k,20801
|
|
5
5
|
AutoGLM_GUI/server.py,sha256=SdaEGNCoGmVKEK-bMzH06BRGGOKAlAgqZfR0lXYrjYo,90
|
|
6
6
|
AutoGLM_GUI/state.py,sha256=4nnvuzuta_43u6R_uC7ATjUhAuJf_vM_MpMgsfCeiK4,1066
|
|
7
7
|
AutoGLM_GUI/version.py,sha256=z0MPXu-k9UO7RXxVGcAwim2M3yklrRqLwgOq66zSdzo,178
|
|
@@ -13,12 +13,12 @@ AutoGLM_GUI/api/agents.py,sha256=KdrtKz8x-70ChTIZQ7Yf8q6sUNZk27G1HT7jogSCpQc,694
|
|
|
13
13
|
AutoGLM_GUI/api/control.py,sha256=G-7hfdqTl5fq-UXOwE2CI_HMbfmRH1Vd589t2FTNZyY,3155
|
|
14
14
|
AutoGLM_GUI/api/devices.py,sha256=yjUMbiQa1twIjerSa18vGXFu9_j4496dx5h8yub0vBg,766
|
|
15
15
|
AutoGLM_GUI/api/media.py,sha256=PqdZIf_2L-oIiMAFLR5PfbjjjK_POkXEf5_8m__5EvA,6322
|
|
16
|
-
AutoGLM_GUI/static/index.html,sha256=
|
|
17
|
-
AutoGLM_GUI/static/assets/about-
|
|
18
|
-
AutoGLM_GUI/static/assets/chat-
|
|
19
|
-
AutoGLM_GUI/static/assets/index-
|
|
20
|
-
AutoGLM_GUI/static/assets/index-
|
|
21
|
-
AutoGLM_GUI/static/assets/index-
|
|
16
|
+
AutoGLM_GUI/static/index.html,sha256=TXidBBzfo9wDthbX3BNXvdwgFsffbetG7Wz2FYRwd9s,395
|
|
17
|
+
AutoGLM_GUI/static/assets/about-C9954kpk.js,sha256=oGL5HFEJTumIIhGe41aWbBu9gZBQZm_Iy3-dj58bNfs,155
|
|
18
|
+
AutoGLM_GUI/static/assets/chat-CSgek5Xo.js,sha256=V-3WMJp6Yd-LUuyYcCFV6On_mH2zMFSM5ZAUcewbI5k,75600
|
|
19
|
+
AutoGLM_GUI/static/assets/index-7WS8sURE.css,sha256=FIpcoeyvXhxxKh4LayGvAx_OfFNf3AU64znNYgTUAZs,21746
|
|
20
|
+
AutoGLM_GUI/static/assets/index-CCRJFa_5.js,sha256=LkgsM9H2BK8fK-ttJPyNCriVjxpNWGna4EhcuOdy3D8,228
|
|
21
|
+
AutoGLM_GUI/static/assets/index-DZmNavz6.js,sha256=dPTATfgO7hcQ5xlDpsyXwojAz8bWXm4helxXwrCX2KE,278235
|
|
22
22
|
phone_agent/__init__.py,sha256=6_AwafPDiJsEVstiMcfj-HbvpuxWTC2di6MVbQzHK6s,287
|
|
23
23
|
phone_agent/agent.py,sha256=23LFtkAo8Kr1mrgTnQYULOeTDmwMBB4FGgrUs03VKPg,8120
|
|
24
24
|
phone_agent/actions/__init__.py,sha256=YiAMeBMVhRfmDOf0hQ_1FEBSV5ApcnHPQ05gHjA_weQ,160
|
|
@@ -37,8 +37,8 @@ phone_agent/config/prompts_zh.py,sha256=vSWo5_qlWwNHVYUxrePBiL2FmJFnQG0Jpb1NsVsV
|
|
|
37
37
|
phone_agent/model/__init__.py,sha256=w6yFkla9VoUvX5vZkTWa7Z5Bg5_lfA9AajrLjZsdL24,149
|
|
38
38
|
phone_agent/model/client.py,sha256=6EM7BIdj9UvqPG9YmgwSGWVxensH5HDfCSAgHDeBgeo,5842
|
|
39
39
|
scrcpy-server-v3.3.3,sha256=fnAyO6fyWWSd1KzOl6xP77roECssbZHi575hP9U1S-A,90164
|
|
40
|
-
autoglm_gui-0.4.
|
|
41
|
-
autoglm_gui-0.4.
|
|
42
|
-
autoglm_gui-0.4.
|
|
43
|
-
autoglm_gui-0.4.
|
|
44
|
-
autoglm_gui-0.4.
|
|
40
|
+
autoglm_gui-0.4.2.dist-info/METADATA,sha256=GEHUFXfu226Q-UEamUDvYX3HQKpjKHbguncX1ClNss0,7753
|
|
41
|
+
autoglm_gui-0.4.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
42
|
+
autoglm_gui-0.4.2.dist-info/entry_points.txt,sha256=sz4rBO_kgrYmOiT0QnhCCv0b9QqBdWyCjugJgY8AEOI,58
|
|
43
|
+
autoglm_gui-0.4.2.dist-info/licenses/LICENSE,sha256=0IkSHDewdtmXnmYzTNq4U47EJYjTuhjQNpT0bZKuqWc,11342
|
|
44
|
+
autoglm_gui-0.4.2.dist-info/RECORD,,
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{j as c,g as Oe,a as Ie,r as b,s as Pe,b as Ne,c as He,d as Te,e as Ye,f as ze,l as $e,i as Ve,h as Ge,k as Xe}from"./index-C8KPPfxe.js";function We({id:g,model:oe,status:d,isInitialized:$,isActive:T,onClick:re}){const L=d==="device";return c.jsx("button",{onClick:re,className:`w-full text-left px-4 py-3 rounded-lg transition-all ${T?"bg-blue-500 text-white shadow-md":"bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[c.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${L?"bg-green-400 shadow-[0_0_4px_rgba(74,222,128,0.6)]":"bg-gray-400"}`,title:L?"在线":"离线"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:`font-medium text-sm truncate ${T?"text-white":"text-gray-900 dark:text-gray-100"}`,children:oe||"未知设备"}),c.jsx("div",{className:`text-xs truncate ${T?"text-blue-100":"text-gray-500 dark:text-gray-400"}`,children:g})]})]}),$&&c.jsx("div",{className:`flex-shrink-0 w-5 h-5 rounded-full flex items-center justify-center ${T?"bg-white/20":"bg-green-100 dark:bg-green-900"}`,children:c.jsx("svg",{className:`w-3 h-3 ${T?"text-white":"text-green-600 dark:text-green-400"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})})]})})}function Ke({devices:g,currentDeviceId:oe,onSelectDevice:d,onOpenConfig:$}){return c.jsxs("div",{className:"w-64 h-full bg-gray-50 dark:bg-gray-900 border-r border-gray-200 dark:border-gray-700 flex flex-col",children:[c.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:[c.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[c.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"})}),"设备列表"]}),c.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:["共 ",g.length," 个设备"]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:g.length===0?c.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[c.jsx("svg",{className:"w-12 h-12 mx-auto mb-2 opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"})}),c.jsx("p",{className:"text-sm",children:"未检测到设备"}),c.jsx("p",{className:"text-xs mt-1",children:"请连接 ADB 设备"})]}):g.map(T=>c.jsx(We,{id:T.id,model:T.model,status:T.status,isInitialized:T.is_initialized,isActive:T.id===oe,onClick:()=>d(T.id)},T.id))}),c.jsx("div",{className:"p-3 border-t border-gray-200 dark:border-gray-700 space-y-2",children:c.jsxs("button",{onClick:$,className:"w-full px-4 py-2 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg transition-colors text-sm font-medium text-gray-700 dark:text-gray-300 flex items-center justify-center gap-2",children:[c.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),"全局配置"]})})]})}var Se={exports:{}};const qe={},Je=Object.freeze(Object.defineProperty({__proto__:null,default:qe},Symbol.toStringTag,{value:"Module"})),Ze=Oe(Je);var Qe=Se.exports,_e;function et(){return _e||(_e=1,(function(g,oe){(function(d,$){g.exports=$(Ze)})(Qe,(function(d){function $(r,i){(i==null||i>r.length)&&(i=r.length);for(var e=0,t=Array(i);e<i;e++)t[e]=r[e];return t}function T(r){if(Array.isArray(r))return r}function re(r){if(Array.isArray(r))return $(r)}function L(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function M(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")}function N(r,i){for(var e=0;e<i.length;e++){var t=i[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,X(t.key),t)}}function _(r,i,e){return i&&N(r.prototype,i),e&&N(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function x(r,i){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=j(r))||i){e&&(r=e);var t=0,n=function(){};return{s:n,n:function(){return t>=r.length?{done:!0}:{done:!1,value:r[t++]}},e:function(l){throw l},f:n}}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 s,a=!0,o=!1;return{s:function(){e=e.call(r)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{a||e.return==null||e.return()}finally{if(o)throw s}}}}function O(r){var i=v();return function(){var e,t=K(r);if(i){var n=K(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ge(this,e)}}function S(r,i,e){return(i=X(i))in r?Object.defineProperty(r,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[i]=e,r}function K(r){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(i){return i.__proto__||Object.getPrototypeOf(i)},K(r)}function V(r,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(i&&i.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),i&&A(r,i)}function v(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(v=function(){return!!r})()}function G(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function W(r,i){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var t,n,s,a,o=[],l=!0,u=!1;try{if(s=(e=e.call(r)).next,i!==0)for(;!(l=(t=s.call(e)).done)&&(o.push(t.value),o.length!==i);l=!0);}catch(f){u=!0,n=f}finally{try{if(!l&&e.return!=null&&(a=e.return(),Object(a)!==a))return}finally{if(u)throw n}}return o}}function Z(){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 ue(){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 ge(r,i){if(i&&(typeof i=="object"||typeof i=="function"))return i;if(i!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return L(r)}function A(r,i){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(r,i)}function H(r,i){return T(r)||W(r,i)||j(r,i)||Z()}function D(r){return re(r)||G(r)||j(r)||ue()}function q(r,i){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var t=e.call(r,i);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function X(r){var i=q(r,"string");return typeof i=="symbol"?i:i+""}function Q(r){"@babel/helpers - typeof";return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},Q(r)}function j(r,i){if(r){if(typeof r=="string")return $(r,i);var e={}.toString.call(r).slice(8,-1);return e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set"?Array.from(r):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?$(r,i):void 0}}var Y,te;function R(r,i){Y=r,te=i}function k(r){if(Y){for(var i=arguments.length,e=new Array(i>1?i-1:0),t=1;t<i;t++)e[t-1]=arguments[t];Y.apply(void 0,[r].concat(e))}}function ne(r){if(te){for(var i=arguments.length,e=new Array(i>1?i-1:0),t=1;t<i;t++)e[t-1]=arguments[t];te.apply(void 0,[r].concat(e))}}var de=(function(){function r(i){M(this,r),this.listener={},this.type=i|""}return _(r,[{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 n=this.listener[e].indexOf(t);return n>-1&&this.listener[e].splice(n,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return this.listener[e]?(this.listener[e].map(function(a){a.apply(null,n)}),!0):!1}}]),r})(),he=(function(){function r(){M(this,r)}return _(r,null,[{key:"init",value:function(){r.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 r.types)r.types.hasOwnProperty(e)&&(r.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]),n=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]);r.HDLR_TYPES={video:t,audio:n};var s=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]);r.STTS=r.STSC=r.STCO=a,r.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),r.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),r.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),r.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]),u=new Uint8Array([0,0,0,1]);r.FTYP=r.box(r.types.ftyp,o,u,o,l),r.DINF=r.box(r.types.dinf,r.box(r.types.dref,s))}},{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];for(var a=8,o=n.length,l=o,u;o--;)a+=n[o].byteLength;for(u=new Uint8Array(a),u[0]=a>>24&255,u[1]=a>>16&255,u[2]=a>>8&255,u[3]=a&255,u.set(e,4),o=0,a=8;o<l;++o)u.set(n[o],a),a+=n[o].byteLength;return u}},{key:"hdlr",value:function(e){return r.box(r.types.hdlr,r.HDLR_TYPES[e])}},{key:"mdat",value:function(e){return r.box(r.types.mdat,e)}},{key:"mdhd",value:function(e,t){return r.box(r.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 r.box(r.types.mdia,r.mdhd(e.timescale,e.duration),r.hdlr(e.type),r.minf(e))}},{key:"mfhd",value:function(e){return r.box(r.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"?r.box(r.types.minf,r.box(r.types.smhd,r.SMHD),r.DINF,r.stbl(e)):r.box(r.types.minf,r.box(r.types.vmhd,r.VMHD),r.DINF,r.stbl(e))}},{key:"moof",value:function(e,t,n){return r.box(r.types.moof,r.mfhd(e),r.traf(n,t))}},{key:"moov",value:function(e,t,n){for(var s=e.length,a=[];s--;)a[s]=r.trak(e[s]);return r.box.apply(null,[r.types.moov,r.mvhd(n,t)].concat(a).concat(r.mvex(e)))}},{key:"mvex",value:function(e){for(var t=e.length,n=[];t--;)n[t]=r.trex(e[t]);return r.box.apply(null,[r.types.mvex].concat(n))}},{key:"mvhd",value:function(e,t){var n=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 r.box(r.types.mvhd,n)}},{key:"sdtp",value:function(e){var t=e.samples||[],n=new Uint8Array(4+t.length),s,a;for(a=0;a<t.length;a++)s=t[a].flags,n[a+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return r.box(r.types.sdtp,n)}},{key:"stbl",value:function(e){return r.box(r.types.stbl,r.stsd(e),r.box(r.types.stts,r.STTS),r.box(r.types.stsc,r.STSC),r.box(r.types.stsz,r.STSZ),r.box(r.types.stco,r.STCO))}},{key:"avc1",value:function(e){var t=[],n=[],s,a,o;for(s=0;s<e.sps.length;s++)a=e.sps[s],o=a.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(a));for(s=0;s<e.pps.length;s++)a=e.pps[s],o=a.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(a));var l=r.box(r.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),u=e.width,f=e.height;return r.box(r.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,u>>8&255,u&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,r.box(r.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"hev1",value:function(e){for(var t=[],n=[],s=[],a,o,l=0;l<(((u=e.vps)===null||u===void 0?void 0:u.length)||0);l++){var u;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<(((p=e.sps)===null||p===void 0?void 0:p.length)||0);f++){var p;a=e.sps[f],o=a.byteLength,n.push(o>>>8&255,o&255),n=n.concat(Array.prototype.slice.call(a))}for(var h=0;h<(((y=e.pps)===null||y===void 0?void 0:y.length)||0);h++){var y;a=e.pps[h],o=a.byteLength,s.push(o>>>8&255,o&255),s=s.concat(Array.prototype.slice.call(a))}var U=e.hvcC,J=U.profile_space,ee=U.tier_flag,E=U.profile_idc,z=U.profile_compatibility_flags,B=U.constraint_indicator_flags,se=U.level_idc,ae=U.chroma_format_idc,fe=r.box(r.types.hvcC,new Uint8Array([1,J<<6|ee<<5|E,z>>24&255,z>>16&255,z>>8&255,z&255].concat(D(B),[se,240,0,252,252|ae,248,248,0,0,3,3,32,0,1],D(t),[33,0,1],D(n),[34,0,1],D(s)))),pe=e.width,P=e.height;return r.box(r.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,pe>>8&255,pe&255,P>>8&255,P&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]),fe,r.box(r.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,n=new Uint8Array(26+t+3);return n.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]),n.set(e.config,26),n.set([6,1,2],26+t),n}},{key:"mp4a",value:function(e){var t=e.audiosamplerate;return r.box(r.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]),r.box(r.types.esds,r.esds(e)))}},{key:"stsd",value:function(e){return e.type==="audio"?r.box(r.types.stsd,r.STSD,r.mp4a(e)):e.codec.startsWith("hvc1")?r.box(r.types.stsd,r.STSD,r.hev1(e)):r.box(r.types.stsd,r.STSD,r.avc1(e))}},{key:"tkhd",value:function(e){var t=e.id,n=e.duration,s=e.width,a=e.height,o=e.volume;return r.box(r.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,n>>>24&255,n>>>16&255,n>>>8&255,n&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,s>>8&255,s&255,0,0,a>>8&255,a&255,0,0]))}},{key:"traf",value:function(e,t){var n=r.sdtp(e),s=e.id;return r.box(r.types.traf,r.box(r.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),r.box(r.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255])),r.trun(e,n.length+16+16+8+16+8+8),n)}},{key:"trak",value:function(e){return e.duration=e.duration||4294967295,r.box(r.types.trak,r.tkhd(e),r.mdia(e))}},{key:"trex",value:function(e){var t=e.id;return r.box(r.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 n=e.samples||[],s=n.length,a=12+16*s,o=new Uint8Array(a),l,u,f,p,h,y;for(t+=8+a,o.set([0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),l=0;l<s;l++)u=n[l],f=u.duration,p=u.size,h=u.flags,y=u.cts,o.set([f>>>24&255,f>>>16&255,f>>>8&255,f&255,p>>>24&255,p>>>16&255,p>>>8&255,p&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&61440,h.degradPrio&15,y>>>24&255,y>>>16&255,y>>>8&255,y&255],12+16*l);return r.box(r.types.trun,o)}},{key:"initSegment",value:function(e,t,n){r.types||r.init();var s=r.moov(e,t,n),a;return a=new Uint8Array(r.FTYP.byteLength+s.byteLength),a.set(r.FTYP),a.set(s,r.FTYP.byteLength),a}}]),r})(),ve=(function(){function r(){M(this,r)}return _(r,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,n=e.byteLength,s=[],a,o;if(!r.isAACPattern(e))return ne("Invalid ADTS audio format"),{valid:!1};a=r.getHeaderLength(e);for(var l=e.subarray(0,a);t<n;)o=r.getFrameLength(e),s.push(e.subarray(a,o)),e=e.slice(o),t+=o;return{valid:!0,header:l,slices:s}}}]),r})(),be=1,ie=(function(r){V(e,r);var i=O(e);function e(){return M(this,e),i.apply(this,arguments)}return _(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 be++}}]),e})(de),ke=(function(r){V(e,r);var i=O(e);function e(t,n,s){var a;return M(this,e),a=i.call(this,"AACRemuxer"),a.frameDuration=s,a.readyToDecode=!1,a.header=null,a.nextDts=0,a.dts=0,a.mp4track={id:ie.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:t,duration:n,samples:[],config:"",codec:""},a.samples=[],a}return _(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(n,s){var a=ve.extractAAC(n),o=a.valid,l=a.header,u=a.slices;return this.header||(this.header=l),o&&u.length>0?(this.remux(this.getAudioFrames(u,s)),!0):(ne("Failed to extract audio data from:",n),this.dispatch("outOfData"),!1)}},{key:"getAudioFrames",value:function(n,s){var a=[],o=0,l=0,u=x(n),f;try{for(u.s();!(f=u.n()).done;){var p=f.value;a.push({units:p})}}catch(h){u.e(h)}finally{u.f()}return o=s?s/a.length|0:this.frameDuration,l=s?s-o*a.length:0,a.map(function(h){h.duration=o,l>0&&(h.duration++,l--)}),a}},{key:"remux",value:function(n){if(n.length>0)for(var s=0;s<n.length;s++){var a=n[s],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 n=new Uint8Array(this.mp4track.len),s=0,a=this.mp4track.samples,o,l;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift();if(u.units,l=u.duration,l<=0){k("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(l)),this.mp4track.len-=u.size;continue}this.nextDts+=l,o={size:u.size,duration:l,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},n.set(u.units,s),s+=u.size,a.push(o)}return a.length?new Uint8Array(n.buffer,0,this.mp4track.len):null}},{key:"setAACConfig",value:function(){var n,s,a,o=new Uint8Array(2);this.header&&(n=((this.header[2]&192)>>>6)+1,s=(this.header[2]&60)>>>2,a=(this.header[2]&1)<<2,a|=(this.header[3]&192)>>>6,o[0]=n<<3,o[0]|=(s&14)>>1,o[1]|=(s&1)<<7,o[1]|=a<<3,this.mp4track.codec="mp4a.40."+n,this.mp4track.channelCount=a,this.mp4track.config=o,this.readyToDecode=!0)}}]),e})(ie),le=(function(){function r(i){M(this,r),this.data=i,this.index=0,this.bitLength=i.byteLength*8}return _(r,[{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,n=this.getBits(e,this.index,t);return n}},{key:"getBits",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(this.bitsAvailable<e)return 0;var s=t%8,a=this.data[t/8|0]&255>>>s,o=8-s;if(o>=e)return n&&(this.index+=e),a>>o-e;n&&(this.index+=o);var l=e-o;return a<<l|this.getBits(l,t+o,n)}},{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)}}]),r})(),ce=(function(){function r(){M(this,r)}return _(r,null,[{key:"extractNALu",value:function(e){for(var t=0,n=e.byteLength,s=[],a=0,o=0;t<n;){var l=e[t++];if(l===0)o++;else if(l===1&&o>=2){var u=o+1;a!==t-u&&s.push(e.subarray(a,t-u)),a=t,o=0}else o=0}var f=null;return a<n&&(f=e.subarray(a,n)),[s,f]}},{key:"skipScalingList",value:function(e,t){for(var n=8,s=8,a,o=0;o<t;o++)s!==0&&(a=e.readEG(),s=(n+a+256)%256),n=s===0?n:s}},{key:"readSPS",value:function(e){var t=new le(e),n=0,s=0,a=0,o=0,l=1,u,f,p,h,y,U,J=0;t.readUByte();for(var ee=[],E=1,z=e.byteLength,B=E;B<z;B++)B+2<z&&t.readBits(24,!1)===3?(ee.push(t.readBits(8)),ee.push(t.readBits(8)),B+=2,t.readBits(8)):ee.push(t.readBits(8));if(t.setData(new Uint8Array(ee)),u=t.readUByte(),t.readBits(5),t.skipBits(3),t.readUByte(),t.skipUEG(),u===100||u===110||u===122||u===244||u===44||u===83||u===86||u===118||u===128){var se=t.readUEG();if(se===3&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBoolean()){U=se!==3?8:12;for(var ae=0;ae<U;++ae)t.readBoolean()&&(ae<6?r.skipScalingList(t,16):r.skipScalingList(t,64))}}t.skipUEG();var fe=t.readUEG();if(fe===0)t.readUEG();else if(fe===1){t.skipBits(1),t.skipEG(),t.skipEG(),f=t.readUEG();for(var pe=0;pe<f;++pe)t.skipEG()}if(t.skipUEG(),t.skipBits(1),p=t.readUEG(),h=t.readUEG(),y=t.readBits(1),y===0&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(n=t.readUEG(),s=t.readUEG(),a=t.readUEG(),o=t.readUEG()),t.readBoolean()){if(t.readBoolean()){var P,De=t.readUByte();switch(De){case 1:P=[1,1];break;case 2:P=[12,11];break;case 3:P=[10,11];break;case 4:P=[16,11];break;case 5:P=[40,33];break;case 6:P=[24,11];break;case 7:P=[20,11];break;case 8:P=[32,11];break;case 9:P=[80,33];break;case 10:P=[18,11];break;case 11:P=[15,11];break;case 12:P=[64,33];break;case 13:P=[160,99];break;case 14:P=[4,3];break;case 15:P=[3,2];break;case 16:P=[2,1];break;case 255:{P=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()];break}}P&&P[0]>0&&P[1]>0&&(l=P[0]/P[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 Ae=t.readUInt(),Ue=t.readUInt(),we=t.readBoolean(),je=Ue/(2*Ae);we&&(J=je)}}return{fps:J>0?J:void 0,width:Math.ceil(((p+1)*16-n*2-s*2)*l),height:(2-y)*(h+1)*16-(y?2:4)*(a+o)}}}]),r})(),xe=(function(){function r(i){M(this,r),this.payload=i,this.nri=(this.payload[0]&96)>>5,this.nalUnitType=this.payload[0]&31,this._sliceType=null,this._isFirstSlice=!1}return _(r,[{key:"toString",value:function(){return"".concat(r.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===r.IDR}},{key:"isVCL",get:function(){return this.nalUnitType==r.IDR||this.nalUnitType==r.NDR}},{key:"parseHeader",value:function(){var e=new le(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={},S(e,r.IDR,"IDR"),S(e,r.SEI,"SEI"),S(e,r.SPS,"SPS"),S(e,r.PPS,"PPS"),S(e,r.NDR,"NDR"),S(e,r.AUD,"AUD"),e}}]),r})();function ye(r,i){var e=new Uint8Array((r.byteLength|0)+(i.byteLength|0));return e.set(r,0),e.set(i,r.byteLength|0),e}function Fe(r){var i,e,t,n="";return i=Math.floor(r),e=parseInt(i/3600,10)%24,t=parseInt(i/60,10)%60,i=i<0?0:i%60,e>0&&(n+=(e<10?"0"+e:e)+":"),n+=(t<10?"0"+t:t)+":"+(i<10?"0"+i:i),n}var Ce=(function(r){V(e,r);var i=O(e);function e(t,n,s){var a;return M(this,e),a=i.call(this,"H264Remuxer"),a.frameDuration=s,a.readyToDecode=!1,a.nextDts=0,a.dts=0,a.mp4track={id:ie.getTrackID(),type:"video",len:0,fragmented:!0,sps:"",pps:"",fps:30,width:0,height:0,timescale:t,duration:n,samples:[]},a.samples=[],a.remainingData=new Uint8Array,a.kfCounter=0,a.pendingUnits={},a}return _(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(n,s,a){var o=[],l;n=ye(this.remainingData,n);var u=ce.extractNALu(n),f=H(u,2);return o=f[0],l=f[1],this.remainingData=l||new Uint8Array,o.length>0?(this.remux(this.getVideoFrames(o,s,a)),!0):(ne("Failed to extract any NAL units from video data:",l),this.dispatch("outOfData"),!1)}},{key:"getVideoFrames",value:function(n,s,a){var o=this,l=[],u=[],f=0,p=0,h=!1,y=!1;this.pendingUnits.units&&(l=this.pendingUnits.units,y=this.pendingUnits.vcl,h=this.pendingUnits.keyFrame,this.pendingUnits={});var U=x(n),J;try{for(U.s();!(J=U.n()).done;){var ee=J.value,E=new xe(ee);l.length&&y&&(E.isFirstSlice||!E.isVCL)&&(u.push({units:l,keyFrame:h}),l=[],h=!1,y=!1),l.push(E),h=h||E.isKeyframe,y=y||E.isVCL}}catch(B){U.e(B)}finally{U.f()}if(l.length)if(!s)this.pendingUnits={units:l,keyFrame:h,vcl:y};else if(y)u.push({units:l,keyFrame:h});else{var z=u.length-1;z>=0&&(u[z].units=u[z].units.concat(l))}return f=s?s/u.length|0:this.frameDuration,p=s?s-f*u.length:0,u.map(function(B){B.duration=f,B.compositionTimeOffset=a,p>0&&(B.duration++,p--),o.kfCounter++,B.keyFrame&&o.dispatch("keyframePosition",o.kfCounter*f/1e3)}),k("jmuxer: No. of H264 frames of the last chunk: ".concat(u.length)),u}},{key:"remux",value:function(n){var s=x(n),a;try{for(s.s();!(a=s.n()).done;){var o=a.value,l=[],u=0,f=x(o.units),p;try{for(f.s();!(p=f.n()).done;){var h=p.value;this.parseNAL(h)&&(l.push(h),u+=h.getSize())}}catch(y){f.e(y)}finally{f.f()}l.length>0&&this.readyToDecode&&(this.mp4track.len+=u,this.samples.push({units:l,size:u,keyFrame:o.keyFrame,duration:o.duration,compositionTimeOffset:o.compositionTimeOffset}))}}catch(y){s.e(y)}finally{s.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var n=new Uint8Array(this.mp4track.len),s=0,a=this.mp4track.samples,o,l;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift(),f=u.units;if(l=u.duration,l<=0){k("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(l)),this.mp4track.len-=u.size;continue}this.nextDts+=l,o={size:u.size,duration:l,cts:u.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:u.keyFrame?0:1,dependsOn:u.keyFrame?2:1}};var p=x(f),h;try{for(p.s();!(h=p.n()).done;){var y=h.value;n.set(y.getData(),s),s+=y.getSize()}}catch(U){p.e(U)}finally{p.f()}a.push(o)}return a.length?new Uint8Array(n.buffer,0,this.mp4track.len):null}},{key:"parseSPS",value:function(n){var s=ce.readSPS(new Uint8Array(n));this.mp4track.fps=s.fps||this.mp4track.fps,this.mp4track.width=s.width,this.mp4track.height=s.height,this.mp4track.sps=[new Uint8Array(n)],this.mp4track.codec="avc1.";for(var a=new DataView(n.buffer,n.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(n){this.mp4track.pps=[new Uint8Array(n)]}},{key:"parseNAL",value:function(n){if(!n)return!1;if(n.isVCL)return!0;var s=!1;switch(n.type()){case xe.PPS:this.mp4track.pps||this.parsePPS(n.getPayload()),s=!0;break;case xe.SPS:this.mp4track.sps||this.parseSPS(n.getPayload()),s=!0;break;case xe.AUD:k("AUD - ignoing");break;case xe.SEI:k("SEI - ignoing");break}return!this.readyToDecode&&this.mp4track.pps&&this.mp4track.sps&&(this.readyToDecode=!0),s}}]),e})(ie),me=(function(){function r(){M(this,r)}return _(r,null,[{key:"extractNALu",value:function(e){for(var t=0,n=e.byteLength,s=[],a=0,o=0;t<n;){var l=e[t++];if(l===0)o++;else if(l===1&&o>=2){var u=o+1;a!==t-u&&s.push(e.subarray(a,t-u)),a=t,o=0}else o=0}var f=null;return a<n&&(f=e.subarray(a,n)),[s,f]}},{key:"removeEmulationPreventionBytes",value:function(e){for(var t=[],n=0,s=0;s<e.length;s++){var a=e[s];if(n===2&&a===3){n=0;continue}t.push(a),a===0?n++:n=0}return new Uint8Array(t)}},{key:"readSPS",value:function(e){var t=new le(e);t.readUByte(),t.readUByte(),t.readBits(4),t.readBits(3),t.readBits(1);for(var n=t.readBits(2),s=t.readBits(1),a=t.readBits(5),o=t.readUInt(),l=new Uint8Array(6),u=0;u<6;u++)l[u]=t.readUByte();var f=t.readUByte();t.readUEG();var p=t.readUEG();p===3&&t.readBits(1);var h=t.readUEG(),y=t.readUEG(),U=t.readBoolean(),J=0,ee=0,E=0,z=0;U&&(J=t.readUEG(),ee=t.readUEG(),E=t.readUEG(),z=t.readUEG());var B=null,se=t.readBoolean();if(se){var ae=t.readBoolean();if(ae){var fe=t.readUByte();fe===255&&(t.readUShort(),t.readUShort())}var pe=t.readBoolean();pe&&t.readBoolean();var P=t.readBoolean();if(P){t.readBits(3),t.readBoolean();var De=t.readBoolean();De&&(t.readUByte(),t.readUByte(),t.readUByte())}var Ae=t.readBoolean();Ae&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean();var Ue=t.readBoolean();if(Ue){var we=t.readUInt(),je=t.readUInt();t.readBoolean(),we&&(B=je/(2*we))}}var Ee=p===1||p===2?2:1,Me=p===1?2:1,Re=h-Ee*(ee+J),Le=y-Me*(E+z);return{width:Re,height:Le,profile_space:n,tier_flag:s,profile_idc:a,profile_compatibility_flags:o,constraint_indicator_flags:l,level_idc:f,chroma_format_idc:p,fps:B}}}]),r})(),m=(function(){function r(i){M(this,r),this.payload=i,this.nalUnitType=(i[0]&126)>>1,this.nuhLayerId=(i[0]&1)<<5|(i[1]&248)>>3,this.nuhTemporalIdPlus1=i[1]&7,this._isFirstSlice=null,this._sliceType=null}return _(r,[{key:"toString",value:function(){return"".concat(r.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[r.IDR_W_RADL,r.IDR_N_LP,r.CRA].includes(this.nalUnitType)}},{key:"isVCL",get:function(){return this.nalUnitType<=31}},{key:"parseHeader",value:function(){var e=new le(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={},S(e,r.TRAIL_N,"TRAIL_N"),S(e,r.TRAIL_R,"TRAIL_R"),S(e,r.IDR_W_RADL,"IDR"),S(e,r.IDR_N_LP,"IDR2"),S(e,r.CRA,"CRA"),S(e,r.VPS,"VPS"),S(e,r.SPS,"SPS"),S(e,r.PPS,"PPS"),S(e,r.AUD,"AUD"),S(e,r.SEI,"SEI"),S(e,r.SEI2,"SEI2"),e}}]),r})(),w=(function(r){V(e,r);var i=O(e);function e(t,n,s){var a;return M(this,e),a=i.call(this,"H264Remuxer"),a.frameDuration=s,a.readyToDecode=!1,a.nextDts=0,a.dts=0,a.mp4track={id:ie.getTrackID(),type:"video",len:0,fragmented:!0,vps:"",sps:"",pps:"",hvcC:{},fps:30,width:0,height:0,timescale:t,duration:n,samples:[]},a.samples=[],a.remainingData=new Uint8Array,a.kfCounter=0,a.pendingUnits={},a}return _(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(n,s,a){var o=[],l;n=ye(this.remainingData,n);var u=me.extractNALu(n),f=H(u,2);return o=f[0],l=f[1],this.remainingData=l||new Uint8Array,o.length>0?(this.remux(this.getVideoFrames(o,s,a)),!0):(ne("Failed to extract any NAL units from video data:",l),this.dispatch("outOfData"),!1)}},{key:"getVideoFrames",value:function(n,s,a){var o=this,l=[],u=[],f=0,p=0,h=!1,y=!1;this.pendingUnits.units&&(l=this.pendingUnits.units,y=this.pendingUnits.vcl,h=this.pendingUnits.keyFrame,this.pendingUnits={});var U=x(n),J;try{for(U.s();!(J=U.n()).done;){var ee=J.value,E=new m(ee);l.length&&y&&(E.isFirstSlice||!E.isVCL)&&(u.push({units:l,keyFrame:h}),l=[],h=!1,y=!1),l.push(E),h=h||E.isKeyframe,y=y||E.isVCL}}catch(B){U.e(B)}finally{U.f()}if(l.length)if(!s)this.pendingUnits={units:l,keyFrame:h,vcl:y};else if(y)u.push({units:l,keyFrame:h});else{var z=u.length-1;z>=0&&(u[z].units=u[z].units.concat(l))}return f=s?s/u.length|0:this.frameDuration,p=s?s-f*u.length:0,u.map(function(B){B.duration=f,B.compositionTimeOffset=a,p>0&&(B.duration++,p--),o.kfCounter++,B.keyFrame&&o.dispatch("keyframePosition",o.kfCounter*f/1e3)}),k("jmuxer: No. of H265 frames of the last chunk: ".concat(u.length)),u}},{key:"remux",value:function(n){var s=x(n),a;try{for(s.s();!(a=s.n()).done;){var o=a.value,l=[],u=0,f=x(o.units),p;try{for(f.s();!(p=f.n()).done;){var h=p.value;this.parseNAL(h)&&(l.push(h),u+=h.getSize())}}catch(y){f.e(y)}finally{f.f()}l.length>0&&this.readyToDecode&&(this.mp4track.len+=u,this.samples.push({units:l,size:u,keyFrame:o.keyFrame,duration:o.duration,compositionTimeOffset:o.compositionTimeOffset}))}}catch(y){s.e(y)}finally{s.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var n=new Uint8Array(this.mp4track.len),s=0,a=this.mp4track.samples,o,l;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift(),f=u.units;if(l=u.duration,l<=0){k("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(l)),this.mp4track.len-=u.size;continue}this.nextDts+=l,o={size:u.size,duration:l,cts:u.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:u.keyFrame?0:1,dependsOn:u.keyFrame?2:1}};var p=x(f),h;try{for(p.s();!(h=p.n()).done;){var y=h.value;n.set(y.getData(),s),s+=y.getSize()}}catch(U){p.e(U)}finally{p.f()}a.push(o)}return a.length?new Uint8Array(n.buffer,0,this.mp4track.len):null}},{key:"parseSPS",value:function(n){this.mp4track.sps=[new Uint8Array(n)],n=me.removeEmulationPreventionBytes(n);var s=me.readSPS(new Uint8Array(n));this.mp4track.fps=s.fps||this.mp4track.fps,this.mp4track.width=s.width,this.mp4track.height=s.height,this.mp4track.codec="hvc1.".concat(s.profile_idc,".").concat(s.profile_compatibility_flags.toString(16))+".L".concat(s.level_idc).concat(s.tier_flag?"H":"L")+".".concat(s.constraint_indicator_flags.map(function(a){return a.toString(16)}).join(".").toUpperCase()),this.mp4track.hvcC={profile_space:s.profile_space,tier_flag:s.tier_flag,profile_idc:s.profile_idc,profile_compatibility_flags:s.profile_compatibility_flags,constraint_indicator_flags:s.constraint_indicator_flags,level_idc:s.level_idc,chroma_format_idc:s.chroma_format_idc}}},{key:"parsePPS",value:function(n){this.mp4track.pps=[n]}},{key:"parseVPS",value:function(n){this.mp4track.vps=[n]}},{key:"parseNAL",value:function(n){if(!n)return!1;if(n.isVCL)return!0;var s=!1;switch(n.type()){case m.VPS:this.mp4track.vps||this.parseVPS(n.getPayload()),s=!0;break;case m.SPS:this.mp4track.sps||this.parseSPS(n.getPayload()),s=!0;break;case m.PPS:this.mp4track.pps||this.parsePPS(n.getPayload()),s=!0;break;case m.AUD:k("AUD - ignoing");break;case m.SEI:case m.SEI2:k("SEI - ignoing");break}return!this.readyToDecode&&this.mp4track.vps&&this.mp4track.sps&&this.mp4track.pps&&(this.readyToDecode=!0),s}}]),e})(ie),I=(function(r){V(e,r);var i=O(e);function e(t,n,s,a){var o;return M(this,e),o=i.call(this,"remuxer"),o.videoCodec=s,o.frameDuration=a,o.initialized=!1,o.tracks={},o.seq=1,o.env=t,o.timescale=1e3,o.mediaDuration=n?4294967295:0,o}return _(e,[{key:"addTrack",value:function(n){var s=this;if((n==="video"||n==="both")&&(this.videoCodec=="H265"?this.tracks.video=new w(this.timescale,this.mediaDuration,this.frameDuration):this.tracks.video=new Ce(this.timescale,this.mediaDuration,this.frameDuration),this.tracks.video.on("outOfData",function(){s.dispatch("missingVideoFrames")}),this.tracks.video.on("keyframePosition",function(o){s.dispatch("keyframePosition",o)})),n==="audio"||n==="both"){var a=new ke(this.timescale,this.mediaDuration,this.frameDuration);this.tracks.audio=a,this.tracks.video.on("outOfData",function(){s.dispatch("missingAudioFrames")})}}},{key:"reset",value:function(){for(var n in this.tracks)this.tracks[n].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 n in this.tracks){var s=this.tracks[n],a=s.getPayload();if(a&&a.byteLength){var o=he.moof(this.seq,s.dts,s.mp4track),l=he.mdat(a),u=ye(o,l),f={type:n,payload:u,dts:s.dts};n==="video"&&(f.fps=s.mp4track.fps),this.dispatch("buffer",f);var p=Fe(s.dts/this.timescale);k("put segment (".concat(n,"): dts: ").concat(s.dts," frames: ").concat(s.mp4track.samples.length," second: ").concat(p)),s.flush(),this.seq++}}}},{key:"initSegment",value:function(){var n=[];for(var s in this.tracks){var a=this.tracks[s];if(this.env=="browser"){var o={type:s,payload:he.initSegment([a.mp4track],this.mediaDuration,this.timescale)};this.dispatch("buffer",o)}else n.push(a.mp4track)}if(this.env=="node"){var l={type:"all",payload:he.initSegment(n,this.mediaDuration,this.timescale)};this.dispatch("buffer",l)}k("Initial segment generated.")}},{key:"isReady",value:function(){for(var n in this.tracks)if(!this.tracks[n].readyToDecode||!this.tracks[n].samples.length)return!1;return!0}},{key:"feed",value:function(n){var s=!1;if(n.video&&this.tracks.video&&(s|=this.tracks.video.feed(n.video,n.duration,n.compositionTimeOffset)),n.audio&&this.tracks.audio&&(s|=this.tracks.audio.feed(n.audio,n.duration)),!s){ne("Input object must have video and/or audio property. Make sure it is a valid typed array");return}this.flush()}}]),e})(de),F=(function(r){V(e,r);var i=O(e);function e(t,n){var s;return M(this,e),s=i.call(this,"buffer"),s.type=n,s.queue=new Uint8Array,s.cleaning=!1,s.pendingCleaning=0,s.cleanOffset=30,s.cleanRanges=[],s.sourceBuffer=t,s.sourceBuffer.addEventListener("updateend",function(){if(s.pendingCleaning>0&&(s.initCleanup(s.pendingCleaning),s.pendingCleaning=0),s.cleaning=!1,s.cleanRanges.length){s.doCleanup();return}}),s.sourceBuffer.addEventListener("error",function(){s.dispatch("error",{type:s.type,name:"buffer",error:"buffer error"})}),s}return _(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 n=this.cleanRanges.shift();k("".concat(this.type," remove range [").concat(n[0]," - ").concat(n[1],")")),this.cleaning=!0,this.sourceBuffer.remove(n[0],n[1])}},{key:"initCleanup",value:function(n){try{if(this.sourceBuffer.updating){this.pendingCleaning=n;return}if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var s=0;s<this.sourceBuffer.buffered.length;++s){var a=this.sourceBuffer.buffered.start(s),o=this.sourceBuffer.buffered.end(s);n-a>this.cleanOffset&&(o=n-this.cleanOffset,a<o&&this.cleanRanges.push([a,o]))}this.doCleanup()}}catch(l){ne("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(s){var n="unexpectedError";s.name==="QuotaExceededError"?(k("".concat(this.type," buffer quota full")),n="QuotaExceeded"):(ne("Error occured while appending ".concat(this.type," buffer - ").concat(s.name,": ").concat(s.message)),n="InvalidStateError"),this.dispatch("error",{type:this.type,name:n,error:"buffer error"})}}},{key:"feed",value:function(n){this.queue=ye(this.queue,n)}}]),e})(de),C=(function(r){V(e,r);var i=O(e);function e(t){var n;M(this,e),n=i.call(this,"jmuxer"),n.isReset=!1;var s={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 n.options=Object.assign({},s,t),n.env=(typeof process>"u"?"undefined":Q(process))==="object"&&typeof window>"u"?"node":"browser",n.options.debug&&R(n.options.onLoggerLog,n.options.onLoggerErr),n.options.fps||(n.options.fps=30),n.frameDuration=1e3/n.options.fps|0,n.remuxController=new I(n.env,t.live,n.options.videoCodec,n.frameDuration),n.remuxController.addTrack(n.options.mode),n.initData(),n.remuxController.on("buffer",n.onBuffer.bind(L(n))),n.env=="browser"&&(n.remuxController.on("ready",n.createBuffer.bind(L(n))),n.initBrowser()),n.remuxController.on("missingVideoFrames",function(){typeof n.options.onMissingVideoFrames=="function"&&n.options.onMissingVideoFrames.call(null)}),n.remuxController.on("missingAudioFrames",function(){typeof n.options.onMissingAudioFrames=="function"&&n.options.onMissingAudioFrames.call(null)}),n.clearBuffer&&n.remuxController.on("keyframePosition",function(a){n.kfPosition.push(a)}),typeof n.options.onKeyframePosition=="function"&&n.remuxController.on("keyframePosition",function(a){n.options.onKeyframePosition.call(null,a)}),n}return _(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==""&&ne("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 n=this.feed.bind(this),s=this.destroy.bind(this);return this.stream=new d.Duplex({writableObjectMode:!0,read:function(o){},write:function(o,l,u){n(o),u()},final:function(o){s(),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 n=document.createElement("source");n.type="video/mp4",n.src=this.url,this.node.appendChild(n),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{ne("mediasource is not available to end")}}},{key:"feed",value:function(n){!n||!this.remuxController||(n.duration=n.duration?parseInt(n.duration):0,this.remuxController.feed(n))}},{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 n in this.bufferControllers)this.bufferControllers[n].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 n in this.bufferControllers)this.bufferControllers[n].destroy();this.bufferControllers=null,this.endMSE()}this.initData(),this.env=="browser"&&this.initBrowser(),k("JMuxer was reset")}},{key:"createBuffer",value:function(){if(!(!this.mseReady||!this.remuxController||!this.remuxController.isReady()||this.bufferControllers)){this.bufferControllers={};for(var n in this.remuxController.tracks){var s=this.remuxController.tracks[n];if(!e.isSupported("".concat(n,'/mp4; codecs="').concat(s.mp4track.codec,'"')))return ne("Browser does not support codec: ".concat(n,'/mp4; codecs="').concat(s.mp4track.codec,'"')),typeof this.options.onUnsupportedCodec=="function"&&this.options.onUnsupportedCodec.call(null,s.mp4track.codec),!1;var a=this.mediaSource.addSourceBuffer("".concat(n,'/mp4; codecs="').concat(s.mp4track.codec,'"'));this.bufferControllers[n]=new F(a,n),this.bufferControllers[n].on("error",this.onBufferError.bind(this))}}}},{key:"startInterval",value:function(){var n=this;this.interval=setInterval(function(){n.options.flushingTime?n.applyAndClearBuffer():n.bufferControllers&&n.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 n=this.node.buffered.end(0);n-this.node.currentTime>this.options.maxDelay/1e3&&(k("delay"),this.node.paused&&this.node.play().catch(ne),this.node.currentTime=n-.001)}}},{key:"releaseBuffer",value:function(){for(var n in this.bufferControllers)this.bufferControllers[n].doAppend()}},{key:"applyAndClearBuffer",value:function(){this.bufferControllers&&(this.releaseBuffer(),this.clearBuffer())}},{key:"getSafeClearOffsetOfBuffer",value:function(n){for(var s=this.options.mode==="audio"&&n||0,a,o=0;o<this.kfPosition.length&&!(this.kfPosition[o]>=n);o++)a=this.kfPosition[o];return a&&(this.kfPosition=this.kfPosition.filter(function(l){return l<a&&(s=l),l>=a})),s}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var n in this.bufferControllers){var s=this.getSafeClearOffsetOfBuffer(this.node.currentTime);this.bufferControllers[n].initCleanup(s)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(n){this.options.readFpsFromTrack&&typeof n.fps<"u"&&this.options.fps!=n.fps&&(this.options.fps=n.fps,this.frameDuration=Math.ceil(1e3/n.fps),k("JMuxer changed FPS to ".concat(n.fps," from track data"))),this.env=="browser"?this.bufferControllers&&this.bufferControllers[n.type]&&this.bufferControllers[n.type].feed(n.payload):this.stream&&this.stream.push(n.payload),this.options.onData&&this.options.onData(n.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(n){if(n.name=="QuotaExceeded"){k("JMuxer cleaning ".concat(n.type," buffer due to QuotaExceeded error")),this.bufferControllers[n.type].initCleanup(this.node.currentTime);return}else n.name=="InvalidStateError"?(k("JMuxer is reseting due to InvalidStateError"),this.reset()):this.endMSE();typeof this.options.onError=="function"&&this.options.onError.call(null,n)}}],[{key:"isSupported",value:function(n){return window.MediaSource&&window.MediaSource.isTypeSupported(n)}}]),e})(de);return C}))})(Se)),Se.exports}var tt=et();const rt=Ie(tt),nt=400,Be=50;function st({deviceId:g,className:oe,onFallback:d,fallbackTimeout:$=5e3,enableControl:T=!1,onTapSuccess:re,onTapError:L,onSwipeSuccess:M,onSwipeError:N,onStreamReady:_}){const x=b.useRef(null),O=b.useRef(null),S=b.useRef(null),K=b.useRef(g),[V,v]=b.useState("connecting"),[G,W]=b.useState(null),Z=b.useRef(null),ue=b.useRef(!1),[ge,A]=b.useState([]),H=b.useRef(!1),D=b.useRef(null),[q,X]=b.useState(null),Q=b.useRef(null),j=b.useRef(null),Y=b.useRef(0),te=b.useRef(null),R=b.useRef(null),[k,ne]=b.useState(null),de=b.useRef(0),he=b.useRef(0),ve=b.useRef(0),be=b.useRef(0),ie=b.useRef(d),ke=b.useRef($),le=b.useRef(_),ce=(m,w,I)=>{const F=I.getBoundingClientRect(),C=F.width,r=F.height,i=I.videoWidth,e=I.videoHeight;if(i===0||e===0)return console.warn("[ScrcpyPlayer] Video dimensions not available yet"),null;const t=i/e,n=C/r;let s,a,o,l;n>t?(a=r,s=t*r,o=(C-s)/2,l=0):(s=C,a=C/t,o=0,l=(r-a)/2);const u=m-o,f=w-l;if(u<0||u>s||f<0||f>a)return console.warn("[ScrcpyPlayer] Click outside video area (in letterbox)"),null;const p=Math.round(u/s*i),h=Math.round(f/a*e);return console.log(`[ScrcpyPlayer] Coordinate transform:
|
|
5
|
-
Click: (${m}, ${w})
|
|
6
|
-
Display: ${C}x${r}
|
|
7
|
-
Video: ${i}x${e}
|
|
8
|
-
Rendered: ${s}x${a} at offset (${o}, ${l})
|
|
9
|
-
Device: (${p}, ${h})`),{x:p,y:h}},xe=async m=>{if(!T||!x.current||V!=="connected")return;H.current=!0,D.current={x:m.clientX,y:m.clientY,time:Date.now()};const w=x.current.getBoundingClientRect(),I=m.clientX-w.left,F=m.clientY-w.top,C=ce(I,F,x.current);if(!C||!k)return;const r=x.current.videoWidth,i=x.current.videoHeight,e=k.width/r,t=k.height/i,n=Math.round(C.x*e),s=Math.round(C.y*t);try{await Ye(n,s,g),console.log(`[Touch] DOWN: (${n}, ${s}) for device ${g}`)}catch(a){console.error("[Touch] DOWN failed:",a)}},ye=m=>{if(!H.current||!D.current)return;X({id:Date.now(),startX:D.current.x,startY:D.current.y,endX:m.clientX,endY:m.clientY});const w=x.current?.getBoundingClientRect();if(!w||!x.current||!k)return;const I=m.clientX-w.left,F=m.clientY-w.top,C=ce(I,F,x.current);if(!C)return;const r=x.current.videoWidth,i=x.current.videoHeight,e=k.width/r,t=k.height/i,n=Math.round(C.x*e),s=Math.round(C.y*t),a=Date.now();a-Y.current>=Be?(Y.current=a,Te(n,s,g).catch(o=>{console.error("[Touch] MOVE failed:",o)})):(te.current={x:n,y:s},R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{if(te.current){const{x:o,y:l}=te.current;Y.current=Date.now(),Te(o,l,g).catch(u=>{console.error("[Touch] MOVE (throttled) failed:",u)}),te.current=null}},Be-(a-Y.current)))},Fe=async m=>{if(!H.current||!D.current)return;const w=m.clientX-D.current.x,I=m.clientY-D.current.y,F=Date.now()-D.current.time;if(X(null),H.current=!1,R.current&&(clearTimeout(R.current),R.current=null),te.current=null,Math.sqrt(w*w+I*I)<10&&F<200){me(m),D.current=null;return}const r=x.current?.getBoundingClientRect();if(!r||!x.current||!k){D.current=null;return}const i=m.clientX-r.left,e=m.clientY-r.top,t=ce(i,e,x.current);if(!t){D.current=null;return}const n=x.current.videoWidth,s=x.current.videoHeight,a=k.width/n,o=k.height/s,l=Math.round(t.x*a),u=Math.round(t.y*o);try{await Pe(l,u,g),console.log(`[Touch] UP: (${l}, ${u}) for device ${g}`),re?.()}catch(f){console.error("[Touch] UP failed:",f),L?.(String(f))}D.current=null},Ce=async m=>{if(!T||!x.current||V!=="connected")return;const w=Date.now(),I=m.deltaY;j.current||(j.current={deltaY:0,lastTime:w,mouseX:m.clientX,mouseY:m.clientY}),j.current.deltaY+=I,j.current.lastTime=w;const F=.3;j.current.mouseX=Math.round(j.current.mouseX*(1-F)+m.clientX*F),j.current.mouseY=Math.round(j.current.mouseY*(1-F)+m.clientY*F),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(async()=>{if(!j.current||!x.current)return;const C=j.current;if(j.current=null,C.mouseX===void 0||C.mouseY===void 0)return;const r=x.current.getBoundingClientRect(),i=C.mouseX,e=C.mouseY,t=Math.abs(C.deltaY),n=Math.min(Math.max(300,t),800),s=ce(i-r.left,e-r.top,x.current);if(!s||!k){console.warn("[ScrcpyPlayer] Cannot execute scroll: coordinate transformation failed");return}const a=x.current.videoWidth,o=x.current.videoHeight,l=k.width/a,u=k.height/o,f=Math.round(s.x*l),p=Math.round(s.y*u);let h,y;C.deltaY>0?(h=p,y=p-t):(h=p,y=p+t);const U=Math.abs(y-h),J=Math.max(U/k.height*r.height,20),ee=Math.min(Math.max(n*.8,200),800),E=document.createElement("div");E.style.cssText=`
|
|
10
|
-
position: fixed;
|
|
11
|
-
left: ${i}px;
|
|
12
|
-
top: ${e}px;
|
|
13
|
-
width: 20px;
|
|
14
|
-
height: 20px;
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
z-index: 50;
|
|
17
|
-
transform: translateX(-50%) translateY(-50%);
|
|
18
|
-
background: radial-gradient(circle,
|
|
19
|
-
rgba(59, 130, 246, 0.8) 0%,
|
|
20
|
-
rgba(59, 130, 246, 0.4) 30%,
|
|
21
|
-
rgba(59, 130, 246, 0.2) 60%,
|
|
22
|
-
rgba(59, 130, 246, 0) 100%);
|
|
23
|
-
border-radius: 50%;
|
|
24
|
-
box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
|
|
25
|
-
`;const z=Date.now(),B=setInterval(()=>{const se=Date.now()-z,ae=Math.min(se/ee,1),fe=C.deltaY>0?e-J*ae:e+J*ae;E.style.top=fe+"px",ae>=1&&clearInterval(B)},16);document.body.appendChild(E),setTimeout(()=>{E.parentNode&&E.parentNode.removeChild(E),clearInterval(B)},ee);try{const se=await He(f,h,f,y,n,g);se.success?M?.():N?.(se.error||"Scroll failed")}catch(se){N?.(String(se))}},nt)},me=async m=>{if(!T||!x.current||V!=="connected"||x.current.videoWidth===0||x.current.videoHeight===0||!k)return;const w=x.current.getBoundingClientRect(),I=m.clientX-w.left,F=m.clientY-w.top,C=ce(I,F,x.current);if(!C)return;const r=x.current.videoWidth,i=x.current.videoHeight,e=k.width/r,t=k.height/i,n=Math.round(C.x*e),s=Math.round(C.y*t),a=Date.now();A(o=>[...o,{id:a,x:m.clientX,y:m.clientY}]),setTimeout(()=>{A(o=>o.filter(l=>l.id!==a))},500);try{const o=await ze(n,s,g);o.success?re?.():L?.(o.error||"Unknown error")}catch(o){L?.(String(o))}};return b.useEffect(()=>{ie.current=d,ke.current=$,le.current=_},[d,$,_]),b.useEffect(()=>{(async()=>{try{const w=await Ne(g);w.success&&(ne({width:w.width,height:w.height}),console.log(`[ScrcpyPlayer] Device actual resolution: ${w.width}x${w.height} for device ${g}`))}catch(w){console.error("[ScrcpyPlayer] Failed to fetch device resolution:",w)}})()},[g]),b.useEffect(()=>{K.current=g;let m=null,w=null;const I=async()=>{if(x.current){if(console.log("[ScrcpyPlayer] connect() called"),be.current=Date.now(),v("connecting"),W(null),S.current){console.log("[ScrcpyPlayer] Closing existing WebSocket");try{S.current.onclose=null,S.current.onerror=null,S.current.onmessage=null,S.current.close()}catch(F){console.error("[ScrcpyPlayer] Error closing old WebSocket:",F)}S.current=null}if(O.current){console.log("[ScrcpyPlayer] Destroying old jMuxer instance");try{O.current.destroy()}catch(F){console.error("[ScrcpyPlayer] Error destroying old jMuxer:",F)}O.current=null}x.current&&(x.current.src="",x.current.load()),await new Promise(F=>setTimeout(F,300));try{console.log("[ScrcpyPlayer] Creating new jMuxer instance (after cleanup delay)"),O.current=new rt({node:x.current,mode:"video",flushingTime:0,fps:30,debug:!1,clearBuffer:!0,onError:i=>{if(console.error("[jMuxer] Decoder error:",i),i.name==="InvalidStateError"&&i.error==="buffer error"){const e=Date.now(),t=e-ve.current;if(e-be.current<1e3?t>500:t>2e3){ve.current=e,console.warn("[jMuxer] ⚠️ Buffer error detected, reconnecting...");const a=F;w&&setTimeout(()=>{K.current===a?w&&w():console.log(`[jMuxer] Device changed (${a} -> ${K.current}), skip reconnect`)},100)}else console.warn(`[jMuxer] Reconnect skipped (debounced: ${t}ms since last error)`)}}});const F=K.current,C=`ws://localhost:8000/api/video/stream?device_id=${encodeURIComponent(F)}`,r=new WebSocket(C);S.current=r,r.binaryType="arraybuffer",r.onopen=()=>{console.log(`[ScrcpyPlayer] WebSocket connected for device ${F}`),v("connected"),le.current&&le.current({close:()=>{r.close()}}),Z.current=setTimeout(()=>{ue.current||(console.log("[ScrcpyPlayer] No data received within timeout, triggering fallback"),v("error"),W("Video stream timeout"),r.close(),ie.current&&ie.current())},ke.current)},r.onmessage=i=>{if(typeof i.data=="string"){try{const e=JSON.parse(i.data);console.error("[ScrcpyPlayer] Server error:",e),W(e.error||"Unknown error"),v("error"),ie.current&&!ue.current&&ie.current()}catch{console.error("[ScrcpyPlayer] Received non-JSON string:",i.data)}return}ue.current||(ue.current=!0,console.log("[ScrcpyPlayer] First video data received, canceling fallback timer"),Z.current&&(clearTimeout(Z.current),Z.current=null));try{if(O.current&&i.data.byteLength>0){O.current.feed({video:new Uint8Array(i.data)}),de.current++;const e=Date.now(),t=e-he.current;if(t>5e3){const n=de.current/t*1e3,s=x.current,a=s&&s.buffered.length>0?s.buffered.end(0)-s.currentTime:0;console.log(`[ScrcpyPlayer] Stats: ${n.toFixed(1)} fps, buffer: ${a.toFixed(2)}s`),a>2&&console.warn(`[ScrcpyPlayer] ⚠ High latency detected: ${a.toFixed(2)}s buffer`),de.current=0,he.current=e}}}catch(e){console.error("[ScrcpyPlayer] Feed error:",e)}},r.onerror=i=>{console.error("[ScrcpyPlayer] WebSocket error:",i),W("Connection error"),v("error")},r.onclose=()=>{console.log("[ScrcpyPlayer] WebSocket closed"),v("disconnected"),le.current&&le.current(null);const i=F;m=setTimeout(()=>{K.current===i?(console.log("[ScrcpyPlayer] Attempting to reconnect..."),I()):console.log(`[ScrcpyPlayer] Device changed (${i} -> ${K.current}), skip reconnect`)},3e3)}}catch(F){console.error("[ScrcpyPlayer] Initialization error:",F),W("Initialization failed"),v("error")}}};return w=I,I(),()=>{if(m&&clearTimeout(m),Z.current&&(clearTimeout(Z.current),Z.current=null),S.current&&(S.current.close(),S.current=null),R.current&&(clearTimeout(R.current),R.current=null),O.current){try{O.current.destroy()}catch(F){console.error("[ScrcpyPlayer] Cleanup error:",F)}O.current=null}}},[g]),c.jsxs("div",{className:`relative w-full h-full flex items-center justify-center ${oe||""}`,children:[c.jsx("video",{ref:x,autoPlay:!0,muted:!0,playsInline:!0,onMouseDown:xe,onMouseMove:ye,onMouseUp:Fe,onMouseLeave:async()=>{if(H.current&&x.current&&k){if(D.current){const m=x.current.getBoundingClientRect(),w=ce(D.current.x-m.left,D.current.y-m.top,x.current);if(w){const I=k.width/x.current.videoWidth,F=k.height/x.current.videoHeight,C=Math.round(w.x*I),r=Math.round(w.y*F);try{await Pe(C,r,g),console.log(`[Touch] UP (mouse leave) for device ${g}`)}catch(i){console.error("[Touch] UP (mouse leave) failed:",i)}}}H.current=!1,X(null),D.current=null}},onWheel:Ce,className:`max-w-full max-h-full object-contain ${T?"cursor-pointer":""}`,style:{backgroundColor:"#000"}}),T&&q&&c.jsxs("svg",{className:"fixed inset-0 pointer-events-none z-40",children:[c.jsx("line",{x1:q.startX,y1:q.startY,x2:q.endX,y2:q.endY,stroke:"rgba(59, 130, 246, 0.8)",strokeWidth:"3",strokeLinecap:"round"}),c.jsx("circle",{cx:q.startX,cy:q.startY,r:"6",fill:"rgba(59, 130, 246, 0.8)"}),c.jsx("circle",{cx:q.endX,cy:q.endY,r:"6",fill:"rgba(239, 68, 68, 0.8)"})]}),T&&ge.map(m=>c.jsx("div",{className:"fixed pointer-events-none z-50",style:{left:m.x,top:m.y},children:c.jsx("div",{className:"ripple-circle"})},m.id)),V!=="connected"&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:c.jsxs("div",{className:"text-center text-white",children:[V==="connecting"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"w-8 h-8 border-4 border-white border-t-transparent rounded-full animate-spin mx-auto mb-2"}),c.jsx("p",{children:"正在连接..."})]}),V==="disconnected"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"w-8 h-8 border-4 border-yellow-500 border-t-transparent rounded-full animate-spin mx-auto mb-2"}),c.jsx("p",{children:"连接断开,正在重连..."})]}),V==="error"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-red-500 text-xl mb-2",children:"✗"}),c.jsx("p",{className:"text-red-400",children:"连接失败"}),G&&c.jsx("p",{className:"text-sm text-gray-400 mt-1",children:G})]})]})})]})}function it({deviceId:g,deviceName:oe,deviceState:d,input:$,onInputChange:T,onSendMessage:re,onReset:L,onInitialize:M,updateDeviceState:N}){const _=b.useRef(null),x=b.useRef(!1),O=()=>{_.current?.scrollIntoView({behavior:"smooth"})};b.useEffect(()=>{O()},[d.messages]),b.useEffect(()=>{if(!g||!(d.displayMode==="screenshot"||d.displayMode==="auto"&&d.videoStreamFailed))return;const G=async()=>{if(!x.current){x.current=!0;try{const Z=await Ne(g);Z.success&&N(g,{screenshot:Z})}catch(Z){console.error("Failed to fetch screenshot:",Z)}finally{x.current=!1}}};G();const W=setInterval(G,500);return()=>clearInterval(W)},[g,d.videoStreamFailed,d.displayMode,N]);const S=v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),re())},K=b.useCallback(v=>{N(g,{videoStream:v})},[g,N]),V=b.useCallback(()=>{N(g,{videoStreamFailed:!0,useVideoStream:!1})},[g,N]);return c.jsxs("div",{className:"flex-1 flex gap-4 p-4 items-center justify-center",children:[c.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:[c.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 rounded-t-2xl",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold",children:oe}),c.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g})]}),c.jsxs("div",{className:"flex gap-2",children:[d.initialized?c.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",children:"已初始化"}):c.jsx("button",{onClick:M,className:"px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors text-sm",children:"初始化设备"}),c.jsx("button",{onClick:L,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 text-sm",children:"重置"})]})]}),d.error&&c.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 text-sm",children:d.error}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[d.messages.length===0?c.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:[c.jsx("p",{className:"text-lg",children:"设备已选择"}),c.jsx("p",{className:"text-sm mt-2",children:"输入任务描述,让 AI 帮你操作手机"})]}):null,d.messages.map(v=>c.jsx("div",{className:`flex ${v.role==="user"?"justify-end":"justify-start"}`,children:v.role==="agent"?c.jsxs("div",{className:"max-w-[80%] space-y-2",children:[v.thinking?.map((G,W)=>c.jsxs("div",{className:"bg-gray-100 dark:bg-gray-700 rounded-2xl px-4 py-3 border-l-4 border-blue-500",children:[c.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:["💭 步骤 ",W+1," - 思考过程"]}),c.jsx("p",{className:"text-sm whitespace-pre-wrap",children:G}),v.actions?.[W]&&c.jsxs("details",{className:"mt-2 text-xs",children:[c.jsx("summary",{className:"cursor-pointer text-blue-500 hover:text-blue-600",children:"查看动作"}),c.jsx("pre",{className:"mt-1 p-2 bg-gray-800 text-gray-200 rounded overflow-x-auto text-xs",children:JSON.stringify(v.actions[W],null,2)})]})]},W)),v.content&&c.jsxs("div",{className:`rounded-2xl px-4 py-3 ${v.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:[c.jsx("p",{className:"whitespace-pre-wrap",children:v.content}),v.steps!==void 0&&c.jsxs("p",{className:"text-xs mt-2 opacity-70",children:["总步数: ",v.steps]})]}),v.isStreaming&&c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 animate-pulse",children:"正在执行..."})]}):c.jsx("div",{className:"max-w-[70%] rounded-2xl px-4 py-3 bg-blue-500 text-white",children:c.jsx("p",{className:"whitespace-pre-wrap",children:v.content})})},v.id)),c.jsx("div",{ref:_})]}),c.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 rounded-b-2xl",children:c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",value:$,onChange:v=>T(v.target.value),onKeyDown:S,placeholder:d.initialized?"输入任务描述...":"请先初始化设备",disabled:d.loading,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"}),c.jsx("button",{onClick:re,disabled:d.loading||!$.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",children:"发送"})]})})]}),c.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:[c.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1 bg-black/70 rounded-lg p-1",children:[c.jsx("button",{onClick:()=>N(g,{displayMode:"auto"}),className:`px-3 py-1 text-xs rounded transition-colors ${d.displayMode==="auto"?"bg-blue-500 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,children:"自动"}),c.jsx("button",{onClick:()=>N(g,{displayMode:"video"}),className:`px-3 py-1 text-xs rounded transition-colors ${d.displayMode==="video"?"bg-blue-500 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,children:"视频流"}),c.jsx("button",{onClick:()=>N(g,{displayMode:"screenshot"}),className:`px-3 py-1 text-xs rounded transition-colors ${d.displayMode==="screenshot"?"bg-blue-500 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,children:"截图"})]}),d.displayMode==="video"||d.displayMode==="auto"&&d.useVideoStream&&!d.videoStreamFailed?c.jsxs(c.Fragment,{children:[d.tapFeedback&&c.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",children:d.tapFeedback}),c.jsx(st,{deviceId:g,className:"w-full h-full",enableControl:!0,onFallback:V,onTapSuccess:()=>{N(g,{tapFeedback:"Tap executed"}),setTimeout(()=>N(g,{tapFeedback:null}),2e3)},onTapError:v=>{N(g,{tapFeedback:`Tap failed: ${v}`}),setTimeout(()=>N(g,{tapFeedback:null}),3e3)},onSwipeSuccess:()=>{N(g,{tapFeedback:"Swipe executed"}),setTimeout(()=>N(g,{tapFeedback:null}),2e3)},onSwipeError:v=>{N(g,{tapFeedback:`Swipe failed: ${v}`}),setTimeout(()=>N(g,{tapFeedback:null}),3e3)},onStreamReady:K,fallbackTimeout:1e5})]}):c.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gray-900",children:d.screenshot&&d.screenshot.success?c.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[c.jsx("img",{src:`data:image/png;base64,${d.screenshot.image}`,alt:"Device Screenshot",className:"max-w-full max-h-full object-contain",style:{width:d.screenshot.width>d.screenshot.height?"100%":"auto",height:d.screenshot.width>d.screenshot.height?"auto":"100%"}}),d.screenshot.is_sensitive&&c.jsx("div",{className:"absolute top-12 right-2 px-2 py-1 bg-yellow-500 text-white text-xs rounded",children:"敏感内容"}),c.jsxs("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-blue-500 text-white text-xs rounded",children:["截图模式 (0.5s 刷新)",d.displayMode==="auto"&&d.videoStreamFailed&&" - 视频流不可用"]})]}):d.screenshot?.error?c.jsxs("div",{className:"text-center text-red-500 dark:text-red-400",children:[c.jsx("p",{className:"mb-2",children:"截图失败"}),c.jsx("p",{className:"text-xs",children:d.screenshot.error})]}):c.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[c.jsx("div",{className:"w-8 h-8 border-4 border-gray-300 border-t-blue-500 rounded-full animate-spin mx-auto mb-2"}),c.jsx("p",{children:"加载中..."})]})})]})]})}function ot(){const[g,oe]=b.useState([]),[d,$]=b.useState(""),[T,re]=b.useState(new Map),[L,M]=b.useState({baseUrl:"",apiKey:"",modelName:""}),[N,_]=b.useState(!1),[x,O]=b.useState(""),S=b.useRef([]),K=b.useRef([]),V=()=>T.get(d)||{messages:[],loading:!1,error:null,initialized:!1,chatStream:null,videoStream:null,screenshot:null,useVideoStream:!0,videoStreamFailed:!1,displayMode:"auto",tapFeedback:null},v=b.useCallback((A,H)=>{re(D=>{const q=new Map(D),X=q.get(A)||{messages:[],loading:!1,error:null,initialized:!1,chatStream:null,videoStream:null,screenshot:null,useVideoStream:!0,videoStreamFailed:!1,displayMode:"auto",tapFeedback:null};return q.set(A,{...X,...H}),q})},[]),G=V();b.useEffect(()=>{const A=async()=>{try{const D=await $e();oe(D.devices),D.devices.length>0&&!d&&$(D.devices[0].id)}catch(D){console.error("Failed to load devices:",D)}};A();const H=setInterval(A,3e3);return()=>clearInterval(H)},[d]);const W=async A=>{try{await Ve({model_config:{base_url:L.baseUrl||void 0,api_key:L.apiKey||void 0,model_name:L.modelName||void 0},agent_config:{device_id:A}}),v(A,{initialized:!0,error:null}),_(!1)}catch(H){v(A,{error:H instanceof Error?H.message:"初始化失败,请检查配置或确保后端服务正在运行"})}},Z=async()=>{if(!x.trim()||G.loading)return;if(!d){window.alert("请先选择一个设备");return}G.initialized||await W(d);const A={id:Date.now().toString(),role:"user",content:x.trim(),timestamp:new Date};v(d,{messages:[...G.messages,A],loading:!0,error:null}),O(""),S.current=[],K.current=[];const H=(Date.now()+1).toString(),D={id:H,role:"agent",content:"",timestamp:new Date,thinking:[],actions:[],isStreaming:!0};v(d,{messages:[...G.messages,A,D]});const q=Xe(A.content,d,X=>{console.log("[Chat] Processing step event:",X),S.current.push(X.thinking),K.current.push(X.action),re(Q=>{const j=new Map(Q),Y=j.get(d);if(!Y)return Q;const te=Y.messages.map(R=>R.id===H?{...R,thinking:[...S.current],actions:[...K.current],steps:X.step}:R);return j.set(d,{...Y,messages:te}),j})},X=>{re(Q=>{const j=new Map(Q),Y=j.get(d);if(!Y)return Q;const te=Y.messages.map(R=>R.id===H?{...R,content:X.message,success:X.success,isStreaming:!1}:R);return j.set(d,{...Y,messages:te,loading:!1,chatStream:null}),j})},X=>{re(Q=>{const j=new Map(Q),Y=j.get(d);if(!Y)return Q;const te=Y.messages.map(R=>R.id===H?{...R,content:`错误: ${X.message}`,success:!1,isStreaming:!1}:R);return j.set(d,{...Y,messages:te,loading:!1,chatStream:null,error:X.message}),j})});v(d,{chatStream:q})},ue=async()=>{d&&(G.chatStream&&G.chatStream.close(),v(d,{messages:[],loading:!1,error:null,chatStream:null}),await Ge(d))},ge=A=>{G.videoStream&&(G.videoStream.close(),v(d,{videoStream:null})),$(A)};return c.jsxs("div",{className:"h-full flex relative",children:[N&&c.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:c.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:[c.jsx("h2",{className:"text-xl font-bold mb-4 text-gray-900 dark:text-gray-100",children:"Agent 配置"}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Base URL"}),c.jsx("input",{type:"text",value:L.baseUrl,onChange:A=>M({...L,baseUrl:A.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"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"API Key"}),c.jsx("input",{type:"password",value:L.apiKey,onChange:A=>M({...L,apiKey:A.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"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Model Name"}),c.jsx("input",{type:"text",value:L.modelName,onChange:A=>M({...L,modelName:A.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"})]}),c.jsxs("div",{className:"flex justify-end gap-2 mt-6",children:[c.jsx("button",{onClick:()=>_(!1),className:"px-4 py-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200",children:"取消"}),c.jsx("button",{onClick:()=>{d?W(d):window.alert("请先选择一个设备")},className:"px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors",children:"确认配置"})]})]})]})}),c.jsx(Ke,{devices:g,currentDeviceId:d,onSelectDevice:ge,onOpenConfig:()=>_(!0)}),d?c.jsx(it,{deviceId:d,deviceName:g.find(A=>A.id===d)?.model||"未知设备",deviceState:G,input:x,onInputChange:O,onSendMessage:Z,onReset:ue,onInitialize:()=>W(d),updateDeviceState:v}):c.jsx("div",{className:"flex-1 flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:c.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[c.jsx("svg",{className:"w-16 h-16 mx-auto mb-4 opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"})}),c.jsx("h3",{className:"text-lg font-medium mb-2",children:"欢迎使用 AutoGLM Chat"}),c.jsx("p",{className:"text-sm",children:"请从左侧选择一个设备开始"})]})})]})}export{ot 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-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}}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|