sliccy 6.150.0 → 6.150.2
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.
- package/dist/ui/.vite/manifest.json +166 -166
- package/dist/ui/assets/{account-store-FB6hD_og.js → account-store-WHtW2xQT.js} +1 -1
- package/dist/ui/assets/{account-store-CLFiIEe9.js → account-store-igNbS3Ak.js} +1 -1
- package/dist/ui/assets/{adobe-C0SuhrNz.js → adobe-DES78X4G.js} +1 -1
- package/dist/ui/assets/{adobe-aiATKwYr.js → adobe-qGeGJSVK.js} +1 -1
- package/dist/ui/assets/{agent-bridge-3cLsKfah.js → agent-bridge-Bj-PqjME.js} +1 -1
- package/dist/ui/assets/{agent-panels-riabOq_G.js → agent-panels-BWaMcEJL.js} +1 -1
- package/dist/ui/assets/{apply-layout-Bz6N8odC.js → apply-layout-Cw4kGKTd.js} +1 -1
- package/dist/ui/assets/{apps-BxA4sLPb.js → apps-GYMxMVb3.js} +1 -1
- package/dist/ui/assets/{azure-openai-DkH6LhzR.js → azure-openai-BbxUu9bl.js} +1 -1
- package/dist/ui/assets/{azure-openai-hlwpTQ2A.js → azure-openai-Df42STSp.js} +1 -1
- package/dist/ui/assets/{budget-usage-source-D6zuo6Hu.js → budget-usage-source-CkdCr5f4.js} +1 -1
- package/dist/ui/assets/{bunny-probe-Bgz20a1s.js → bunny-probe-Dk0BdUab.js} +1 -1
- package/dist/ui/assets/{bunny-run-BsOugqIU.js → bunny-run-DtVSvgJ8.js} +1 -1
- package/dist/ui/assets/{cdp-DJGttMQn.js → cdp-bzn_Xeev.js} +1 -1
- package/dist/ui/assets/{cerebras-CUNK2jZM.js → cerebras-BdSVSPms.js} +1 -1
- package/dist/ui/assets/{cerebras-DBQ1bv38.js → cerebras-CnqGnpF2.js} +1 -1
- package/dist/ui/assets/{composer-speech-BFUPGTEu.js → composer-speech-Bk2rlnG1.js} +1 -1
- package/dist/ui/assets/{connect-surface-D_kgCGp2.js → connect-surface-CHDb1bpy.js} +1 -1
- package/dist/ui/assets/{directed-approval-EWvnA53r.js → directed-approval-KW7sZoq9.js} +1 -1
- package/dist/ui/assets/{fast-path-DAj2lYgU.js → fast-path-CfBU0M0X.js} +1 -1
- package/dist/ui/assets/{fs-Cc9eDq3V.js → fs-FVRsAbgb.js} +1 -1
- package/dist/ui/assets/{fs-BExiqsiJ.js → fs-ih2eMSkQ.js} +2 -2
- package/dist/ui/assets/{github-BsO9qBMX.js → github--5oROr4B.js} +1 -1
- package/dist/ui/assets/{github-BY2Hef8-.js → github-CMoh4wrN.js} +2 -2
- package/dist/ui/assets/{github-copilot-DYeNaU6e.js → github-copilot-DkYiMCsw.js} +1 -1
- package/dist/ui/assets/{github-copilot-BL5LC-w9.js → github-copilot-qWy0Zt4S.js} +1 -1
- package/dist/ui/assets/{github-install-BTMb6Eqq.js → github-install-BNlfwzSw.js} +1 -1
- package/dist/ui/assets/{github-zip-fcV1ZI6K.js → github-zip-BlzKyxxV.js} +1 -1
- package/dist/ui/assets/{hear-ZHJ-907t.js → hear-DZ1gevW6.js} +1 -1
- package/dist/ui/assets/{help-DhWsyOhV.js → help-AarM8EZw.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-DZArxACB.js → js-realm-worker-B0sapExQ.js} +1 -1
- package/dist/ui/assets/{kernel-worker-2JqW5-by.js → kernel-worker-BsjX-8Q_.js} +33 -33
- package/dist/ui/assets/{local-llm-BB5WjVB9.js → local-llm-Bm7qcibx.js} +1 -1
- package/dist/ui/assets/{local-llm-DcnAyJLX.js → local-llm-oYJuPYM9.js} +1 -1
- package/dist/ui/assets/{main-DbmhUBke.js → main-0FLLRgpr.js} +3 -3
- package/dist/ui/assets/{main-cherry-CizWgCog.js → main-cherry-DgWyX5j1.js} +1 -1
- package/dist/ui/assets/{memory-curation-seam-DPw-uMRg.js → memory-curation-seam-DaqkHe0O.js} +1 -1
- package/dist/ui/assets/{mount-C4r5pcZ6.js → mount-BQVKp_Ky.js} +3 -3
- package/dist/ui/assets/{mount-C4Dcf141.js → mount-pNmGh8WK.js} +1 -1
- package/dist/ui/assets/{mount-recovery-BvMNCrP1.js → mount-recovery-BAhGb_bv.js} +1 -1
- package/dist/ui/assets/{new-session-B8mQOTMk.js → new-session-DTTLrwVg.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-Bssxvnj9.js → oauth-bootstrap-CyfMMMHH.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-BTy-2rjb.js → onboarding-orchestrator-yYN6eJua.js} +1 -1
- package/dist/ui/assets/{openai-codex-C1PBtm8V.js → openai-codex-DG43gisr.js} +1 -1
- package/dist/ui/assets/{openai-codex-rd_p0one.js → openai-codex-r3KGBkgC.js} +1 -1
- package/dist/ui/assets/{openrouter-DVjN51Bu.js → openrouter-Bk7xqCwB.js} +1 -1
- package/dist/ui/assets/{openrouter-BJIIR9g5.js → openrouter-DssYc44Z.js} +1 -1
- package/dist/ui/assets/{openrouter-free-1EVH-oJw.js → openrouter-free-Bhx3nBtn.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CU-iItiG.js → openrouter-free-CSLhk_A7.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CHusQ8ye.js → openrouter-oauth-ByDzZ41D.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-Da-6Oq0D.js → openrouter-oauth-C8yHZzXx.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-Ch4Behyn.js → panel-rpc-handlers-S63g21yk.js} +2 -2
- package/dist/ui/assets/{panelize-shell-C0m6TyBn.js → panelize-shell-B59FHf_a.js} +1 -1
- package/dist/ui/assets/{provider-M-0eEmke.js → provider-B_5ZkOJ1.js} +1 -1
- package/dist/ui/assets/{provider-BPE-djCs.js → provider-DTjGYfpI.js} +2 -2
- package/dist/ui/assets/provider-settings-uchEkvQy.js +1 -0
- package/dist/ui/assets/provider-store-access-Cz_2CeJI.js +1 -0
- package/dist/ui/assets/provider-store-access-kQEPDMDW.js +1 -0
- package/dist/ui/assets/{providers-Dq0px1q5.js → providers-70klvlGo.js} +2 -2
- package/dist/ui/assets/{providers-DDqVLz05.js → providers-w9myWTsL.js} +1 -1
- package/dist/ui/assets/{quick-llm-CPEd0yPp.js → quick-llm-Bji5F30H.js} +1 -1
- package/dist/ui/assets/{recovery-screen-DHlUCruV.js → recovery-screen-lqxJwXM8.js} +1 -1
- package/dist/ui/assets/{run-C03Ay2Z7.js → run-BWhPamLe.js} +1 -1
- package/dist/ui/assets/{run-FWploF5d.js → run-Ba8ggbts.js} +2 -2
- package/dist/ui/assets/{run-BKwc0PMU.js → run-BmBPc42l.js} +1 -1
- package/dist/ui/assets/{run-Ct4a1SOJ.js → run-Byf9dPJf.js} +1 -1
- package/dist/ui/assets/{run-CPHbCalj.js → run-BzyFrWme.js} +2 -2
- package/dist/ui/assets/{session-jsonl-B6NACdIo.js → session-jsonl-BCOxqyX1.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-CUAqKOVK.js → setup-feature-flags-remote-D1ban-xx.js} +1 -1
- package/dist/ui/assets/sidecar-repair-CJngowmG.js +1 -0
- package/dist/ui/assets/{silent-renew-backoff-CmODQQqt.js → silent-renew-backoff-DycrXmC_.js} +1 -1
- package/dist/ui/assets/{skills-BUpWgkUH.js → skills-CyvmUs8o.js} +1 -1
- package/dist/ui/assets/slicc-version-BhF_V6lj.js +1 -0
- package/dist/ui/assets/{snapshot-1vOpGcO0.js → snapshot-CezJTIo1.js} +1 -1
- package/dist/ui/assets/{snapshot-features-_N-rE3pl.js → snapshot-features-i5G7O7jE.js} +1 -1
- package/dist/ui/assets/{soundscape-0en207GO.js → soundscape-B9l997Lg.js} +1 -1
- package/dist/ui/assets/{speak-_rLrkLgU.js → speak-DHglNoiP.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-DcJJcpU8.js → sprinkle-manager-oNv4Dxy0.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-D3FHwzp3.js → sprinkle-renderer-CeGc4B0L.js} +1 -1
- package/dist/ui/assets/{src-CM1l0mgT.js → src-DAuBIYcJ.js} +1 -1
- package/dist/ui/assets/{state-BURn7jMK.js → state-CENLKudR.js} +1 -1
- package/dist/ui/assets/{store-BR5AolDe.js → store-BZA4REpw.js} +1 -1
- package/dist/ui/assets/{store-HMh9Lk9i.js → store-L5QyZg_g.js} +1 -1
- package/dist/ui/assets/{sudo-HC-PPt3W.js → sudo-B6DNIqye.js} +1 -1
- package/dist/ui/assets/{sync-dialog-CjOSIYTL.js → sync-dialog-CroF8oTi.js} +1 -1
- package/dist/ui/assets/{transformers-env-Cp_6LEw_.js → transformers-env-CUhuRO-A.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-C58V0O9z.js → tray-sidecar-Djlc71w_.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-D9YglioG.js → upgrade-detection-BLcTRETI.js} +1 -1
- package/dist/ui/assets/{voice-reply-BZZxlsn0.js → voice-reply-Pzf7yCCs.js} +1 -1
- package/dist/ui/assets/{wc-attach-BlsSvdoI.js → wc-attach-BBHTF92w.js} +2 -2
- package/dist/ui/assets/{wc-extension-h0B2v7jl.js → wc-extension-BVUF-GVc.js} +2 -2
- package/dist/ui/assets/{wc-follower-BrT0nSWH.js → wc-follower-9mZwPNR8.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-ldrlDvsz.js → wc-follower-oauth-B-LgkRB6.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-BuetYYQ6.js → wc-gelatiere-Cse9kSXf.js} +1 -1
- package/dist/ui/assets/{wc-live-BdztSz08.js → wc-live-Ts1bLhjx.js} +5 -5
- package/dist/ui/assets/{wc-nav-Cp_gz-jE.js → wc-nav-DO33b6Qg.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-CL2TlWps.js → wc-onboarding-DeCWfgKN.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-DMvwda2Y.js → wc-placeholder-DgM1-HSU.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-BocSAQbJ.js → wc-secret-request-BNTQEHzM.js} +1 -1
- package/dist/ui/assets/{wc-settings-c6zuyeIz.js → wc-settings-CCJ-33PW.js} +3 -3
- package/dist/ui/assets/{wc-shell-CNx2tU3J.js → wc-shell-S_KQG-ZJ.js} +3 -3
- package/dist/ui/assets/{wc-shortcut-config-CmsfFHRi.js → wc-shortcut-config-DOL-7eLe.js} +1 -1
- package/dist/ui/assets/{wc-shortcuts-p6BtQ0R3.js → wc-shortcuts-BU_YGmdb.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-CXRTNH8y.js → wc-sprinkles-l4l891y6.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-CbYm5pR2.js → wc-transcript-export-DRwVoKZj.js} +2 -2
- package/dist/ui/assets/{wc-tray-j9M1XqGl.js → wc-tray-qlcU6L0f.js} +4 -4
- package/dist/ui/assets/welcome-detection-BFFz2Urt.js +1 -0
- package/dist/ui/assets/{whisper-session-DPNk8OqX.js → whisper-session-D3sdmYD8.js} +2 -2
- package/dist/ui/assets/{xai-grok-BQrSjOw1.js → xai-grok-DStVYmfz.js} +1 -1
- package/dist/ui/assets/{xai-grok-BEIq12AG.js → xai-grok-pQ6Q0CcQ.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/provider-settings-Vnae44M1.js +0 -1
- package/dist/ui/assets/provider-store-access-DD87rc3B.js +0 -1
- package/dist/ui/assets/provider-store-access-JCVbVn4R.js +0 -1
- package/dist/ui/assets/sidecar-repair-DFADpBRH.js +0 -1
- package/dist/ui/assets/slicc-version-BSblY8aE.js +0 -1
- package/dist/ui/assets/welcome-detection-Bu8Zf41r.js +0 -1
|
@@ -334,7 +334,7 @@ let t=8191,n=e,r=4096,i=0,a=12,o=0;for(n<0&&(n=-n,i=128),n+=33,n>t&&(n=t);(n&r)!
|
|
|
334
334
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
335
335
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
336
336
|
*/
|
|
337
|
-
if(!e||typeof e!=`object`)throw TypeError(`options must be an object.`);if(e.metadataOnly!==void 0&&typeof e.metadataOnly!=`boolean`)throw TypeError(`options.metadataOnly, when defined, must be a boolean.`);if(e.verifyKeyPackets!==void 0&&typeof e.verifyKeyPackets!=`boolean`)throw TypeError(`options.verifyKeyPackets, when defined, must be a boolean.`);if(e.verifyKeyPackets&&e.metadataOnly)throw TypeError(`options.verifyKeyPackets and options.metadataOnly cannot be enabled together.`);if(e.skipLiveWait!==void 0&&typeof e.skipLiveWait!=`boolean`)throw TypeError(`options.skipLiveWait, when defined, must be a boolean.`)},rl=e=>{if(!Xe(e))throw TypeError(`timestamp must be a number.`)},il=(e,t,n)=>n.verifyKeyPackets?t.then(async t=>{if(!t||t.type===`delta`)return t;let n=await e.determinePacketType(t);return n&&(t.type=n),t}):t;var al=class{constructor(e){if(!(e instanceof bl))throw TypeError(`track must be an InputTrack.`);this._track=e}async getFirstPacket(e={}){if(nl(e),this._track.input._disposed)throw new Fl;return il(this._track,this._track._backing.getFirstPacket(e),e)}async getFirstKeyPacket(e={}){nl(e);let t=await this.getFirstPacket(e);return t?t.type===`key`?t:this.getNextKeyPacket(t,e):null}async getPacket(e,t={}){if(rl(e),nl(t),this._track.input._disposed)throw new Fl;return il(this._track,this._track._backing.getPacket(e,t),t)}async getNextPacket(e,t={}){if(!(e instanceof I))throw TypeError(`packet must be an EncodedPacket.`);if(nl(t),this._track.input._disposed)throw new Fl;return il(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(rl(e),nl(t),this._track.input._disposed)throw new Fl;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);let r=await this._track._backing.getKeyPacket(e,t);return r&&(n(r.type===`key`),await this._track.determinePacketType(r)===`delta`?this.getKeyPacket(r.timestamp-1/await this._track.getTimeResolution(),t):r)}async getNextKeyPacket(e,t={}){if(!(e instanceof I))throw TypeError(`packet must be an EncodedPacket.`);if(nl(t),this._track.input._disposed)throw new Fl;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);let r=await this._track._backing.getNextKeyPacket(e,t);return r&&(n(r.type===`key`),await this._track.determinePacketType(r)===`delta`?this.getNextKeyPacket(r,t):r)}packets(e,t,n={}){if(e!==void 0&&!(e instanceof I))throw TypeError(`startPacket must be an EncodedPacket.`);if(e!==void 0&&e.isMetadataOnly&&!n?.metadataOnly)throw TypeError(`startPacket can only be metadata-only if options.metadataOnly is enabled.`);if(t!==void 0&&!(t instanceof I))throw TypeError(`endPacket must be an EncodedPacket.`);if(nl(n),this._track.input._disposed)throw new Fl;let r=[],{promise:i,resolve:a}=E(),{promise:o,resolve:s}=E(),c=!1,l=!1,u=null,d=!1,f=[],p=()=>Math.max(2,f.length);(async()=>{let u=e??await this.getFirstPacket(n);for(;u&&!l&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=t?.sequenceNumber);){if(r.length>p()){({promise:o,resolve:s}=E()),await o;continue}r.push(u),a(),{promise:i,resolve:a}=E(),u=await this.getNextPacket(u,n)}c=!0,a()})().catch(e=>{d||(u=e,d=!0,a())});let m=this._track;return{async next(){for(;;)if(m.input._disposed)throw new Fl;else if(l)return{value:void 0,done:!0};else if(d)throw u;else if(r.length>0){let e=r.shift(),t=performance.now();for(f.push(t);f.length>0&&t-f[0]>=1e3;)f.shift();return s(),{value:e,done:!1}}else if(c)return{value:void 0,done:!0};else await i},async return(){return l=!0,s(),a(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}},ol=class{constructor(e,t){this.onSample=e,this.onError=t}},sl=class{mediaSamplesInRange(e=-1/0,t=1/0,n){rl(e),rl(t);let r=[],i=!1,a=null,{promise:o,resolve:s}=E(),{promise:c,resolve:l}=E(),u=!1,d=!1,f=!1,p=null,m=null,h=!1,g={...n,verifyKeyPackets:!0,metadataOnly:!1};(async()=>{p=await this._createDecoder(n=>{if(l(),n.timestamp>=t&&(d=!0),d){n.close();return}a&&(n.timestamp>e?(r.push(a),i=!0):a.close()),n.timestamp>=e&&(r.push(n),i=!0),a=i?null:n,r.length>0&&(s(),{promise:o,resolve:s}=E())},e=>{h||(m=e,h=!0,s())});let n=this._createPacketSink(),_=await n.getKeyPacket(e,g)??await n.getFirstKeyPacket(g),v=_,y=n.packets(_??void 0,void 0,g);for(await y.next();v&&!d&&!this._track.input._disposed;){let e=cl(r.length);if(r.length+p.getDecodeQueueSize()>e){({promise:c,resolve:l}=E()),await c;continue}p.decode(v);let t=await y.next();if(t.done)break;v=t.value}await y.return(),!f&&!this._track.input._disposed&&await p.flush(),!i&&a&&r.push(a),u=!0,s()})().catch(e=>{h||(m=e,h=!0,s())}).finally(()=>{p?.close()});let _=this._track,v=()=>{a?.close();for(let e of r)e.close()};return{async next(){for(;;)if(_.input._disposed)throw v(),new Fl;else if(f)return{value:void 0,done:!0};else if(h)throw v(),m;else if(r.length>0){let e=r.shift();return l(),{value:e,done:!1}}else if(!u)await o;else return{value:void 0,done:!0}},async return(){return f=!0,d=!0,l(),s(),v(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e,t){de(e);let r=ue(e),i=[],a=[],{promise:o,resolve:s}=E(),{promise:c,resolve:l}=E(),u=!1,d=!1,f=null,p=null,m=!1,h=e=>{a.push(e),s(),{promise:o,resolve:s}=E()},g={...t,verifyKeyPackets:!0,metadataOnly:!1};(async()=>{f=await this._createDecoder(e=>{if(l(),d){e.close();return}let t=0;for(;i.length>0&&e.timestamp-i[0]>-1e-10;)t++,i.shift();if(t>0)for(let n=0;n<t;n++)h(n<t-1?e.clone():e);else e.close()},e=>{m||(p=e,m=!0,s())});let e=this._createPacketSink(),t=null,o=null,_=-1,v=async()=>{n(o),n(f);let t=o;for(f.decode(t);t.sequenceNumber<_;){let r=cl(a.length);for(;a.length+f.getDecodeQueueSize()>r&&!d;)({promise:c,resolve:l}=E()),await c;if(d)break;let i=await e.getNextPacket(t,g);n(i),f.decode(i),t=i}_=-1},y=async()=>{n(f),await f.flush();for(let e=0;e<i.length;e++)h(null);i.length=0};for await(let n of r){if(rl(n),d||this._track.input._disposed)break;let r=await e.getPacket(n,g),a=r&&await e.getKeyPacket(n,g);if(!a){_!==-1&&(await v(),await y()),h(null),t=null;continue}t&&(a.sequenceNumber!==o.sequenceNumber||r.timestamp<t.timestamp)&&(await v(),await y()),i.push(r.timestamp),_=Math.max(r.sequenceNumber,_),t=r,o=a}!d&&!this._track.input._disposed&&(_!==-1&&await v(),await y()),u=!0,s()})().catch(e=>{m||(p=e,m=!0,s())}).finally(()=>{f?.close()});let _=this._track,v=()=>{for(let e of a)e?.close()};return{async next(){for(;;)if(_.input._disposed)throw v(),new Fl;else if(d)return{value:void 0,done:!0};else if(m)throw v(),p;else if(a.length>0){let e=a.shift();return n(e!==void 0),l(),{value:e,done:!1}}else if(!u)await o;else return{value:void 0,done:!0}},async return(){return d=!0,l(),s(),v(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}};const cl=e=>e===0?40:8;var ll=class extends ol{constructor(e,t,r,i,a,o){super(e,t),this.codec=r,this.decoderConfig=i,this.rotation=a,this.timeResolution=o,this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new Ne,this.customDecoderQueueSize=0,this.inputTimestamps=[],this.sampleQueue=[],this.currentPacketIndex=0,this.raslSkipped=!1,this.alphaDecoder=null,this.alphaHadKeyframe=!1,this.colorQueue=[],this.alphaQueue=[],this.merger=null,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue=[],this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1,this.finalSamples=[],this.mergeAlphaPromises=[];let s=Kc.find(e=>e.supports(r,i));if(s)this.customDecoder=new s,this.customDecoder.codec=r,this.customDecoder.config=i,this.customDecoder.onSample=e=>{if(!(e instanceof Rs))throw TypeError(`The argument passed to onSample must be a VideoSample.`);this.finalizeAndEmitSample(e)},this.customDecoder.onError=e=>{t(e)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init()).catch(e=>t(e));else{let e=e=>{if(this.alphaQueue.length>0){let t=this.alphaQueue.shift();n(t!==void 0),this.mergeAlpha(e,t)}else this.colorQueue.push(e)};if(ze()){if(r===`avc`&&this.decoderConfig.description){let e=Xt(l(this.decoderConfig.description));if(e&&e.sequenceParameterSets.length>0){let t=Qt(e.sequenceParameterSets[0]);t&&t.frameMbsOnlyFlag===0&&(this.decoderConfig={...this.decoderConfig,hardwareAcceleration:`prefer-software`})}}x(this.decoderConfig.colorSpace)||(this.decoderConfig={...this.decoderConfig,colorSpace:{primaries:this.decoderConfig.colorSpace?.primaries??`bt709`,matrix:this.decoderConfig.colorSpace?.matrix??`bt709`,transfer:this.decoderConfig.colorSpace?.transfer??`bt709`,fullRange:this.decoderConfig.colorSpace?.fullRange??!1}})}let t=Error(`Decoding error`).stack;this.decoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.decoder.configure(this.decoderConfig)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(n(this.decoder),Math.max(this.decoder.decodeQueueSize,this.alphaDecoder?.decodeQueueSize??0))}decode(e){if(this.codec===`hevc`&&this.currentPacketIndex>0&&!this.raslSkipped){if(this.hasHevcRaslPicture(e.data))return;this.raslSkipped=!0}if(this.customDecoder)this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).catch(e=>this.onError(e)).finally(()=>this.customDecoderQueueSize--);else{if(n(this.decoder),Fe()||oe(this.inputTimestamps,e.timestamp,e=>e),ze()&&this.currentPacketIndex===0){if(this.codec===`avc`){let t=[],n=!1;for(let r of Vt(e.data,this.decoderConfig)){let i=Ht(e.data[r.offset]);if(n||=i>=1&&i<=5,i===Rt.AUD){if(n)break;t.length=0}i>=20&&i<=31||t.push(e.data.subarray(r.offset,r.offset+r.length))}e=new I(qt(t,this.decoderConfig),e.type,e.timestamp,e.duration)}else if(this.codec===`hevc`){let t=gn(e.data,this.decoderConfig);t&&(e=new I(t,e.type,e.timestamp,e.duration))}}this.decoder.decode(e.toEncodedVideoChunk()),this.decodeAlphaData(e)}this.currentPacketIndex++}decodeAlphaData(e){if(!e.sideData.alpha){this.pushNullAlphaFrame();return}if(this.merger||=new dl,!this.alphaDecoder){let e=e=>{if(this.colorQueue.length>0){let t=this.colorQueue.shift();n(t!==void 0),this.mergeAlpha(t,e)}else this.alphaQueue.push(e);for(this.decodedAlphaChunkCount++;this.nullAlphaFrameQueue.length>0&&this.nullAlphaFrameQueue[0]===this.decodedAlphaChunkCount;)if(this.nullAlphaFrameQueue.shift(),this.colorQueue.length>0){let e=this.colorQueue.shift();n(e!==void 0),this.mergeAlpha(e,null)}else this.alphaQueue.push(null);this.alphaDecoderQueueSize--},t=Error(`Decoding error`).stack;this.alphaDecoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.alphaDecoder.configure(this.decoderConfig)}let t=On(this.codec,this.decoderConfig,e.sideData.alpha);if(this.alphaHadKeyframe||=t===`key`,this.alphaHadKeyframe){if(this.codec===`hevc`&&this.currentAlphaPacketIndex>0&&!this.alphaRaslSkipped){if(this.hasHevcRaslPicture(e.sideData.alpha)){this.pushNullAlphaFrame();return}this.alphaRaslSkipped=!0}this.currentAlphaPacketIndex++,this.alphaDecoder.decode(e.alphaToEncodedVideoChunk(t??e.type)),this.alphaDecoderQueueSize++}else this.pushNullAlphaFrame()}pushNullAlphaFrame(){this.alphaDecoderQueueSize===0?this.alphaQueue.push(null):this.nullAlphaFrameQueue.push(this.decodedAlphaChunkCount+this.alphaDecoderQueueSize)}hasHevcRaslPicture(e){for(let t of tn(e,this.decoderConfig)){let n=nn(e[t.offset]);if(n===M.RASL_N||n===M.RASL_R)return!0}return!1}sampleHandler(e){if(Fe()){if(this.sampleQueue.length>0&&e.timestamp>=i(this.sampleQueue).timestamp){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}oe(this.sampleQueue,e,e=>e.timestamp)}else{let t=this.inputTimestamps.shift();n(t!==void 0),e.setTimestamp(t),this.finalizeAndEmitSample(e)}}finalizeAndEmitSample(e){e.setTimestamp(Math.round(e.timestamp*this.timeResolution)/this.timeResolution),e.setDuration(Math.round(e.duration*this.timeResolution)/this.timeResolution),e.setRotation(this.rotation),this.onSample(e)}async mergeAlpha(e,t){let r=E();this.mergeAlphaPromises.push(r.promise);let i={sample:null};this.finalSamples.push(i);try{for(t?(n(this.merger),i.sample=new Rs(await this.merger.merge(e,t))):i.sample=new Rs(e);this.finalSamples.length>0&&this.finalSamples[0].sample!==null;){let e=this.finalSamples.shift();this.sampleHandler(e.sample)}}catch(e){se(this.finalSamples,i),this.onError(e)}finally{se(this.mergeAlphaPromises,r.promise),r.resolve()}}async flush(){if(this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(n(this.decoder),await Promise.all([this.decoder.flush(),this.alphaDecoder?.flush()]),await Promise.all(this.mergeAlphaPromises),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.alphaHadKeyframe=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue.length=0,this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1),Fe()){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}this.currentPacketIndex=0,this.raslSkipped=!1}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(n(this.decoder),this.decoder.state!==`closed`&&this.decoder.close(),this.alphaDecoder&&this.alphaDecoder.state!==`closed`&&this.alphaDecoder.close(),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.merger?.close());for(let e of this.sampleQueue)e.close();this.sampleQueue.length=0}};let ul=null;var dl=class{constructor(){this.workers=[],this.nextWorkerIndex=0,this.pendingRequests=new Map,this.nextRequestId=0}merge(e,t){if(this.workers.length===0){if(!ul){let e=new Blob([`(${fl.toString()})()`],{type:`application/javascript`});ul=URL.createObjectURL(e)}let e=O(navigator.hardwareConcurrency,1,4);for(let t=0;t<e;t++){let e=new Worker(ul);e.addEventListener(`message`,e=>{let t=e.data,n=this.pendingRequests.get(t.id);n&&(this.pendingRequests.delete(t.id),`error`in t?n.reject(Error(t.error)):n.resolve(t.frame))}),e.addEventListener(`error`,e=>{let t=Error(e.message||`Color/alpha merge worker error.`);for(let e of this.pendingRequests.values())e.reject(t);this.pendingRequests.clear()}),this.workers.push(e)}}let n=this.nextRequestId++,r=E();this.pendingRequests.set(n,r);let i=this.workers[this.nextWorkerIndex];return this.nextWorkerIndex=(this.nextWorkerIndex+1)%this.workers.length,i.postMessage({id:n,color:e,alpha:t},{transfer:[e,t]}),r.promise}close(){for(let e of this.workers)e.terminate();this.workers.length=0;let e=Error(`Color/alpha merger closed.`);for(let t of this.pendingRequests.values())t.reject(e);this.pendingRequests.clear()}};const fl=()=>{let e=null,t=null,n=Promise.resolve();self.addEventListener(`message`,e=>{let{id:t,color:i,alpha:a}=e.data;n=n.then(async()=>{try{let e=await r(i,a);self.postMessage({id:t,frame:e},{transfer:[e]})}catch(e){self.postMessage({id:t,error:e.message})}finally{i.close(),a.close()}})});let r=async(e,t)=>{let n=e.format,r=t.format;if(!n||!r)throw Error(`CPU color/alpha merging requires a known VideoFrame format.`);let s=n.includes(`P10`),c=n.includes(`P12`),l=r.includes(`P10`),u=r.includes(`P12`);if(l!==s||u!==c)throw Error(`CPU color/alpha merging requires the alpha frame to have the same bit depth as the color frame (color: '${n}', alpha: '${r}').`);if(n===`RGBX`||n===`RGBA`||n===`BGRX`||n===`BGRA`)return await i(e,t,n);if(n===`I420`||n===`I420P10`||n===`I420P12`||n===`I422`||n===`I422P10`||n===`I422P12`||n===`I444`||n===`I444P10`||n===`I444P12`)return await a(e,t,n);if(n===`NV12`)return await o(e,t);throw Error(`CPU color/alpha merging does not support format '${n}'.`)},i=async(e,t,n)=>{let r=e.visibleRect?.width??e.codedWidth,i=e.visibleRect?.height??e.codedHeight,a=r*i,o=new Uint8Array(a*4);await e.copyTo(o);let c=await s(t,r,i,1);for(let e=0,t=3;e<a;e++,t+=4)o[t]=c[e];let l={format:n===`RGBX`||n===`RGBA`?`RGBA`:`BGRA`,codedWidth:r,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[o.buffer]};return new VideoFrame(o,l)},a=async(e,t,n)=>{let r=e.visibleRect?.width??e.codedWidth,i=e.visibleRect?.height??e.codedHeight,a=n.includes(`P10`),o=n.includes(`P12`),c=a||o?2:1,l,u;n.startsWith(`I420`)?(l=Math.ceil(r/2),u=Math.ceil(i/2)):n.startsWith(`I422`)?(l=Math.ceil(r/2),u=i):(l=r,u=i);let d=r*i,f=l*u,p=d*c,m=f*c,h=d*c,g=p+2*m+h,_=new Uint8Array(g);await e.copyTo(_);let v=await s(t,r,i,c),y=p+2*m;_.set(v,y);let b={format:n.slice(0,4)+`A`+n.slice(4),codedWidth:r,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[_.buffer]};return new VideoFrame(_,b)},o=async(e,n)=>{let r=e.visibleRect?.width??e.codedWidth,i=e.visibleRect?.height??e.codedHeight,a=r*i,o=Math.ceil(r/2)*Math.ceil(i/2),c=e.allocationSize();(!t||t.byteLength!==c)&&(t=new Uint8Array(c)),await e.copyTo(t);let l=new Uint8Array(a+2*o+a);l.set(t.subarray(0,a),0);let u=a,d=a+o,f=a;for(let e=0;e<o;e++)l[u+e]=t[f+e*2],l[d+e]=t[f+e*2+1];let p=await s(n,r,i,1);l.set(p,a+2*o);let m={format:`I420A`,codedWidth:r,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[l.buffer]};return new VideoFrame(l,m)},s=async(t,n,r,i)=>{let a=t.allocationSize();(!e||e.byteLength!==a)&&(e=new Uint8Array(a)),await t.copyTo(e);let o=t.format;if(o===`RGBA`||o===`BGRA`||o===`RGBX`||o===`BGRX`){let t=o===`RGBA`||o===`RGBX`?0:2,i=n*r;for(let n=0;n<i;n++)e[n]=e[n*4+t];return e.subarray(0,i)}return e.subarray(0,n*r*i)}},pl=e=>{if(!e||typeof e!=`object`)throw TypeError(`decoderOptions must be an object.`);if(e.hardwareAcceleration!==void 0&&![`no-preference`,`prefer-hardware`,`prefer-software`].includes(e.hardwareAcceleration))throw TypeError(`decoderOptions.hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.`);if(e.optimizeForLatency!==void 0&&typeof e.optimizeForLatency!=`boolean`)throw TypeError(`decoderOptions.optimizeForLatency, when provided, must be a boolean.`)};var ml=class extends sl{constructor(e,t={}){if(!(e instanceof Sl))throw TypeError(`videoTrack must be an InputVideoTrack.`);pl(t),super(),this._track=e,this._decoderOptions=t}async _createDecoder(e,t){if(!await this._track.canDecode())throw Error(typeof VideoDecoder>`u`?Be(`VideoDecoder`):`This video track cannot be decoded in this environment. Make sure to check decodability before using a track.`);let r=await this._track.getCodec(),i=await this._track.getRotation(),a=await this._track.getDecoderConfig(),o=await this._track.getTimeResolution();return n(r&&a),a={...a,hardwareAcceleration:this._decoderOptions.hardwareAcceleration,optimizeForLatency:this._decoderOptions.optimizeForLatency},new ll(e,t,r,a,i,o)}_createPacketSink(){return new al(this._track)}async getSample(e,t={}){rl(e);for await(let n of this.mediaSamplesAtTimestamps([e],t))return n;throw Error(`Internal error: Iterator returned nothing.`)}samples(e,t,n={}){return this.mediaSamplesInRange(e,t,n)}samplesAtTimestamps(e,t={}){return this.mediaSamplesAtTimestamps(e,t)}},hl=class{constructor(e,t={}){if(this._rotation=0,this._initPromise=null,this._nextCanvasIndex=0,!(e instanceof Sl))throw TypeError(`videoTrack must be an InputVideoTrack.`);if(t&&typeof t!=`object`)throw TypeError(`options must be an object.`);if(t.alpha!==void 0&&typeof t.alpha!=`boolean`)throw TypeError(`options.alpha, when provided, must be a boolean.`);if(t.width!==void 0&&(!Number.isInteger(t.width)||t.width<=0))throw TypeError(`options.width, when defined, must be a positive integer.`);if(t.height!==void 0&&(!Number.isInteger(t.height)||t.height<=0))throw TypeError(`options.height, when defined, must be a positive integer.`);if(t.fit!==void 0&&![`fill`,`contain`,`cover`].includes(t.fit))throw TypeError(`options.fit, when provided, must be one of "fill", "contain", or "cover".`);if(t.width!==void 0&&t.height!==void 0&&t.fit===void 0)throw TypeError(`When both options.width and options.height are provided, options.fit must also be provided.`);if(t.rotation!==void 0&&![0,90,180,270].includes(t.rotation))throw TypeError(`options.rotation, when provided, must be 0, 90, 180 or 270.`);if(t.crop!==void 0&&qs(t.crop,`options.`),t.poolSize!==void 0&&(typeof t.poolSize!=`number`||!Number.isInteger(t.poolSize)||t.poolSize<0))throw TypeError(`poolSize must be a non-negative integer.`);t.decoderOptions!==void 0&&pl(t.decoderOptions),this._videoTrack=e,this._alpha=t.alpha??!1,this._options=t,this._fit=t.fit??`fill`,this._videoSampleSink=new ml(e,t.decoderOptions),this._canvasPool=Array.from({length:t.poolSize??0},()=>null)}_ensureInit(){return this._initPromise??=(async()=>{let e=this._options,t=this._videoTrack,n=e.rotation??await t.getRotation(),r=await t.getSquarePixelWidth(),i=await t.getSquarePixelHeight(),[a,o]=n%180==0?[r,i]:[i,r],s=e.crop;s&&=Ks(s,a,o);let[c,l]=s?[s.width,s.height]:[a,o],u=c/l;e.width!==void 0&&e.height===void 0?(c=e.width,l=Math.round(c/u)):e.width===void 0&&e.height!==void 0?(l=e.height,c=Math.round(l*u)):e.width!==void 0&&e.height!==void 0&&(c=e.width,l=e.height),this._width=c,this._height=l,this._rotation=n,this._crop=s})()}_videoSampleToWrappedCanvas(e){let t=this._width,r=this._height,i=this._canvasPool[this._nextCanvasIndex],a=!1;i||(typeof document<`u`?(i=document.createElement(`canvas`),i.width=t,i.height=r):i=new OffscreenCanvas(t,r),this._canvasPool.length>0&&(this._canvasPool[this._nextCanvasIndex]=i),a=!0),this._canvasPool.length>0&&(this._nextCanvasIndex=(this._nextCanvasIndex+1)%this._canvasPool.length);let o=i.getContext(`2d`,{alpha:this._alpha||Le()});n(o),e._drawWithFitAndMipmapping(i,o,{fit:this._fit,rotation:this._rotation,crop:this._crop,targetIsFresh:a,fillBlack:!this._alpha&&Le()});let s={canvas:i,timestamp:e.timestamp,duration:e.duration};return e.close(),s}async getCanvas(e,t){rl(e),await this._ensureInit();let n=await this._videoSampleSink.getSample(e,t);return n&&this._videoSampleToWrappedCanvas(n)}async*canvases(e,t,n){await this._ensureInit(),yield*_e(this._videoSampleSink.samples(e,t,n),e=>this._videoSampleToWrappedCanvas(e))}async*canvasesAtTimestamps(e,t){await this._ensureInit(),yield*_e(this._videoSampleSink.samplesAtTimestamps(e,t),e=>e&&this._videoSampleToWrappedCanvas(e))}},gl=class extends ol{constructor(e,t,n,r){super(e,t),this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new Ne,this.customDecoderQueueSize=0,this.currentTimestamp=null,this.expectedFirstTimestamp=null,this.timestampOffset=0;let i=t=>{let n=t.timestamp;this.expectedFirstTimestamp!==null&&this.currentTimestamp===null&&(this.timestampOffset=this.expectedFirstTimestamp-n),n+=this.timestampOffset,(this.currentTimestamp===null||Math.abs(n-this.currentTimestamp)>=t.duration)&&(this.currentTimestamp=n);let i=this.currentTimestamp;if(this.currentTimestamp+=t.duration,t.numberOfFrames===0){t.close();return}let a=r.sampleRate;t.setTimestamp(Math.round(i*a)/a),e(t)},a=qc.find(e=>e.supports(n,r));if(a)this.customDecoder=new a,this.customDecoder.codec=n,this.customDecoder.config=r,this.customDecoder.onSample=e=>{if(!(e instanceof rc))throw TypeError(`The argument passed to onSample must be an AudioSample.`);i(e)},this.customDecoder.onError=e=>{t(e)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init()).catch(e=>t(e));else{let e=Error(`Decoding error`).stack;this.decoder=new AudioDecoder({output:e=>{try{i(new rc(e))}catch(e){this.onError(e)}},error:t=>{t.stack=e,this.onError(t)}}),this.decoder.configure(r)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(n(this.decoder),this.decoder.decodeQueueSize)}decode(e){this.customDecoder?(this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).catch(e=>this.onError(e)).finally(()=>this.customDecoderQueueSize--)):(n(this.decoder),this.expectedFirstTimestamp??=e.timestamp,this.decoder.decode(e.toEncodedAudioChunk()))}async flush(){this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(n(this.decoder),await this.decoder.flush()),this.currentTimestamp=null,this.expectedFirstTimestamp=null,this.timestampOffset=0}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(n(this.decoder),this.decoder.state!==`closed`&&this.decoder.close())}},_l=class extends ol{constructor(e,t,r){super(e,t),this.decoderConfig=r,this.currentTimestamp=null,n(P.includes(r.codec)),this.codec=r.codec;let{dataType:i,sampleSize:a,littleEndian:o}=Sr(this.codec);switch(this.inputSampleSize=a,a){case 1:i===`unsigned`?this.readInputValue=(e,t)=>e.getUint8(t)-128:i===`signed`?this.readInputValue=(e,t)=>e.getInt8(t):i===`ulaw`?this.readInputValue=(e,t)=>$c(e.getUint8(t)):i===`alaw`?this.readInputValue=(e,t)=>tl(e.getUint8(t)):n(!1);break;case 2:i===`unsigned`?this.readInputValue=(e,t)=>e.getUint16(t,o)-2**15:i===`signed`?this.readInputValue=(e,t)=>e.getInt16(t,o):n(!1);break;case 3:i===`unsigned`?this.readInputValue=(e,t)=>fe(e,t,o)-2**23:i===`signed`?this.readInputValue=(e,t)=>pe(e,t,o):n(!1);break;case 4:i===`unsigned`?this.readInputValue=(e,t)=>e.getUint32(t,o)-2**31:i===`signed`?this.readInputValue=(e,t)=>e.getInt32(t,o):i===`float`?this.readInputValue=(e,t)=>e.getFloat32(t,o):n(!1);break;case 8:i===`float`?this.readInputValue=(e,t)=>e.getFloat64(t,o):n(!1);break;default:D(a),n(!1)}switch(a){case 1:i===`ulaw`||i===`alaw`?(this.outputSampleSize=2,this.outputFormat=`s16`,this.writeOutputValue=(e,t,n)=>e.setInt16(t,n,!0)):(this.outputSampleSize=1,this.outputFormat=`u8`,this.writeOutputValue=(e,t,n)=>e.setUint8(t,n+128));break;case 2:this.outputSampleSize=2,this.outputFormat=`s16`,this.writeOutputValue=(e,t,n)=>e.setInt16(t,n,!0);break;case 3:this.outputSampleSize=4,this.outputFormat=`s32`,this.writeOutputValue=(e,t,n)=>e.setInt32(t,n<<8,!0);break;case 4:this.outputSampleSize=4,i===`float`?(this.outputFormat=`f32`,this.writeOutputValue=(e,t,n)=>e.setFloat32(t,n,!0)):(this.outputFormat=`s32`,this.writeOutputValue=(e,t,n)=>e.setInt32(t,n,!0));break;case 8:this.outputSampleSize=4,this.outputFormat=`f32`,this.writeOutputValue=(e,t,n)=>e.setFloat32(t,n,!0);break;default:D(a),n(!1)}}getDecodeQueueSize(){return 0}decode(e){let t=u(e.data),n=e.byteLength/this.decoderConfig.numberOfChannels/this.inputSampleSize,r=n*this.decoderConfig.numberOfChannels*this.outputSampleSize,i=new ArrayBuffer(r),a=new DataView(i);for(let e=0;e<n*this.decoderConfig.numberOfChannels;e++){let n=e*this.inputSampleSize,r=e*this.outputSampleSize,i=this.readInputValue(t,n);this.writeOutputValue(a,r,i)}let o=n/this.decoderConfig.sampleRate;(this.currentTimestamp===null||Math.abs(e.timestamp-this.currentTimestamp)>=o)&&(this.currentTimestamp=e.timestamp);let s=this.currentTimestamp;this.currentTimestamp+=o;let c=new rc({format:this.outputFormat,data:i,numberOfChannels:this.decoderConfig.numberOfChannels,sampleRate:this.decoderConfig.sampleRate,numberOfFrames:n,timestamp:s});this.onSample(c)}async flush(){}close(){}},vl=class extends sl{constructor(e){if(!(e instanceof Cl))throw TypeError(`audioTrack must be an InputAudioTrack.`);super(),this._track=e}async _createDecoder(e,t){if(!await this._track.canDecode())throw Error(typeof AudioDecoder>`u`?Be(`AudioDecoder`):`This audio track cannot be decoded in this environment. Make sure to check decodability before using a track.`);let r=await this._track.getCodec(),i=await this._track.getDecoderConfig();return n(r&&i),P.includes(i.codec)?new _l(e,t,i):new gl(e,t,r,i)}_createPacketSink(){return new al(this._track)}async getSample(e,t={}){rl(e);for await(let n of this.mediaSamplesAtTimestamps([e],t))return n;throw Error(`Internal error: Iterator returned nothing.`)}samples(e,t,n={}){return this.mediaSamplesInRange(e,t,n)}samplesAtTimestamps(e,t={}){return this.mediaSamplesAtTimestamps(e,t)}},yl=class{constructor(e){if(!(e instanceof Cl))throw TypeError(`audioTrack must be an InputAudioTrack.`);this._audioSampleSink=new vl(e)}_audioSampleToWrappedArrayBuffer(e){let t={buffer:e.toAudioBuffer(),timestamp:e.timestamp,duration:e.duration};return e.close(),t}async getBuffer(e,t){rl(e);let n=await this._audioSampleSink.getSample(e,t);return n&&this._audioSampleToWrappedArrayBuffer(n)}buffers(e,t,n){return _e(this._audioSampleSink.samples(e,t,n),e=>this._audioSampleToWrappedArrayBuffer(e))}buffersAtTimestamps(e,t){return _e(this._audioSampleSink.samplesAtTimestamps(e,t),e=>e&&this._audioSampleToWrappedArrayBuffer(e))}},bl=class e{constructor(e,t){
|
|
337
|
+
if(!e||typeof e!=`object`)throw TypeError(`options must be an object.`);if(e.metadataOnly!==void 0&&typeof e.metadataOnly!=`boolean`)throw TypeError(`options.metadataOnly, when defined, must be a boolean.`);if(e.verifyKeyPackets!==void 0&&typeof e.verifyKeyPackets!=`boolean`)throw TypeError(`options.verifyKeyPackets, when defined, must be a boolean.`);if(e.verifyKeyPackets&&e.metadataOnly)throw TypeError(`options.verifyKeyPackets and options.metadataOnly cannot be enabled together.`);if(e.skipLiveWait!==void 0&&typeof e.skipLiveWait!=`boolean`)throw TypeError(`options.skipLiveWait, when defined, must be a boolean.`)},rl=e=>{if(!Xe(e))throw TypeError(`timestamp must be a number.`)},il=(e,t,n)=>n.verifyKeyPackets?t.then(async t=>{if(!t||t.type===`delta`)return t;let n=await e.determinePacketType(t);return n&&(t.type=n),t}):t;var al=class{constructor(e){if(!(e instanceof bl))throw TypeError(`track must be an InputTrack.`);this._track=e}async getFirstPacket(e={}){if(nl(e),this._track.input._disposed)throw new Fl;return il(this._track,this._track._backing.getFirstPacket(e),e)}async getFirstKeyPacket(e={}){nl(e);let t=await this.getFirstPacket(e);return t?t.type===`key`?t:this.getNextKeyPacket(t,e):null}async getPacket(e,t={}){if(rl(e),nl(t),this._track.input._disposed)throw new Fl;return il(this._track,this._track._backing.getPacket(e,t),t)}async getNextPacket(e,t={}){if(!(e instanceof I))throw TypeError(`packet must be an EncodedPacket.`);if(nl(t),this._track.input._disposed)throw new Fl;return il(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(rl(e),nl(t),this._track.input._disposed)throw new Fl;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);let r=await this._track._backing.getKeyPacket(e,t);return r&&(n(r.type===`key`),await this._track.determinePacketType(r)===`delta`?this.getKeyPacket(r.timestamp-1/await this._track.getTimeResolution(),t):r)}async getNextKeyPacket(e,t={}){if(!(e instanceof I))throw TypeError(`packet must be an EncodedPacket.`);if(nl(t),this._track.input._disposed)throw new Fl;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);let r=await this._track._backing.getNextKeyPacket(e,t);return r&&(n(r.type===`key`),await this._track.determinePacketType(r)===`delta`?this.getNextKeyPacket(r,t):r)}packets(e,t,n={}){if(e!==void 0&&!(e instanceof I))throw TypeError(`startPacket must be an EncodedPacket.`);if(e!==void 0&&e.isMetadataOnly&&!n?.metadataOnly)throw TypeError(`startPacket can only be metadata-only if options.metadataOnly is enabled.`);if(t!==void 0&&!(t instanceof I))throw TypeError(`endPacket must be an EncodedPacket.`);if(nl(n),this._track.input._disposed)throw new Fl;let r=[],{promise:i,resolve:a}=E(),{promise:o,resolve:s}=E(),c=!1,l=!1,u=null,d=!1,f=[],p=()=>Math.max(2,f.length);(async()=>{let u=e??await this.getFirstPacket(n);for(;u&&!l&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=t?.sequenceNumber);){if(r.length>p()){({promise:o,resolve:s}=E()),await o;continue}r.push(u),a(),{promise:i,resolve:a}=E(),u=await this.getNextPacket(u,n)}c=!0,a()})().catch(e=>{d||(u=e,d=!0,a())});let m=this._track;return{async next(){for(;;)if(m.input._disposed)throw new Fl;else if(l)return{value:void 0,done:!0};else if(d)throw u;else if(r.length>0){let e=r.shift(),t=performance.now();for(f.push(t);f.length>0&&t-f[0]>=1e3;)f.shift();return s(),{value:e,done:!1}}else if(c)return{value:void 0,done:!0};else await i},async return(){return l=!0,s(),a(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}},ol=class{constructor(e,t){this.onSample=e,this.onError=t}},sl=class{mediaSamplesInRange(e=-1/0,t=1/0,n){rl(e),rl(t);let r=[],i=!1,a=null,{promise:o,resolve:s}=E(),{promise:c,resolve:l}=E(),u=!1,d=!1,f=!1,p=null,m=null,h=!1,g={...n,verifyKeyPackets:!0,metadataOnly:!1};(async()=>{p=await this._createDecoder(n=>{if(l(),n.timestamp>=t&&(d=!0),d){n.close();return}a&&(n.timestamp>e?(r.push(a),i=!0):a.close()),n.timestamp>=e&&(r.push(n),i=!0),a=i?null:n,r.length>0&&(s(),{promise:o,resolve:s}=E())},e=>{h||(m=e,h=!0,s())});let n=this._createPacketSink(),_=await n.getKeyPacket(e,g)??await n.getFirstKeyPacket(g),v=_,y=n.packets(_??void 0,void 0,g);for(await y.next();v&&!d&&!this._track.input._disposed;){let e=cl(r.length);if(r.length+p.getDecodeQueueSize()>e){({promise:c,resolve:l}=E()),await c;continue}p.decode(v);let t=await y.next();if(t.done)break;v=t.value}await y.return(),!f&&!this._track.input._disposed&&await p.flush(),!i&&a&&r.push(a),u=!0,s()})().catch(e=>{h||(m=e,h=!0,s())}).finally(()=>{p?.close()});let _=this._track,v=()=>{a?.close();for(let e of r)e.close()};return{async next(){for(;;)if(_.input._disposed)throw f=!0,d=!0,v(),new Fl;else if(f)return{value:void 0,done:!0};else if(h)throw f=!0,d=!0,v(),m;else if(r.length>0){let e=r.shift();return l(),{value:e,done:!1}}else if(!u)await o;else return{value:void 0,done:!0}},async return(){return f=!0,d=!0,l(),s(),v(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e,t){de(e);let r=ue(e),i=[],a=[],{promise:o,resolve:s}=E(),{promise:c,resolve:l}=E(),u=!1,d=!1,f=null,p=null,m=!1,h=e=>{a.push(e),s(),{promise:o,resolve:s}=E()},g={...t,verifyKeyPackets:!0,metadataOnly:!1};(async()=>{f=await this._createDecoder(e=>{if(l(),d){e.close();return}let t=0;for(;i.length>0&&e.timestamp-i[0]>-1e-10;)t++,i.shift();if(t>0)for(let n=0;n<t;n++)h(n<t-1?e.clone():e);else e.close()},e=>{m||(p=e,m=!0,s())});let e=this._createPacketSink(),t=null,o=null,_=-1,v=async()=>{n(o),n(f);let t=o;for(f.decode(t);t.sequenceNumber<_;){let r=cl(a.length);for(;a.length+f.getDecodeQueueSize()>r&&!d;)({promise:c,resolve:l}=E()),await c;if(d)break;let i=await e.getNextPacket(t,g);n(i),f.decode(i),t=i}_=-1},y=async()=>{n(f),await f.flush();for(let e=0;e<i.length;e++)h(null);i.length=0};for await(let n of r){if(rl(n),d||this._track.input._disposed)break;let r=await e.getPacket(n,g),a=r&&await e.getKeyPacket(n,g);if(!a){_!==-1&&(await v(),await y()),h(null),t=null;continue}t&&(a.sequenceNumber!==o.sequenceNumber||r.timestamp<t.timestamp)&&(await v(),await y()),i.push(r.timestamp),_=Math.max(r.sequenceNumber,_),t=r,o=a}!d&&!this._track.input._disposed&&(_!==-1&&await v(),await y()),u=!0,s()})().catch(e=>{m||(p=e,m=!0,s())}).finally(()=>{f?.close()});let _=this._track,v=()=>{for(let e of a)e?.close()};return{async next(){for(;;)if(_.input._disposed)throw d=!0,v(),new Fl;else if(d)return{value:void 0,done:!0};else if(m)throw d=!0,v(),p;else if(a.length>0){let e=a.shift();return n(e!==void 0),l(),{value:e,done:!1}}else if(!u)await o;else return{value:void 0,done:!0}},async return(){return d=!0,l(),s(),v(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}};const cl=e=>e===0?40:8;var ll=class extends ol{constructor(e,t,r,i,a,o){super(e,t),this.codec=r,this.decoderConfig=i,this.rotation=a,this.timeResolution=o,this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new Ne,this.customDecoderQueueSize=0,this.inputTimestamps=[],this.sampleQueue=[],this.currentPacketIndex=0,this.raslSkipped=!1,this.alphaDecoder=null,this.alphaHadKeyframe=!1,this.colorQueue=[],this.alphaQueue=[],this.merger=null,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue=[],this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1,this.finalSamples=[],this.mergeAlphaPromises=[];let s=Kc.find(e=>e.supports(r,i));if(s)this.customDecoder=new s,this.customDecoder.codec=r,this.customDecoder.config=i,this.customDecoder.onSample=e=>{if(!(e instanceof Rs))throw TypeError(`The argument passed to onSample must be a VideoSample.`);this.finalizeAndEmitSample(e)},this.customDecoder.onError=e=>{t(e)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init()).catch(e=>t(e));else{let e=e=>{if(this.alphaQueue.length>0){let t=this.alphaQueue.shift();n(t!==void 0),this.mergeAlpha(e,t)}else this.colorQueue.push(e)};if(ze()){if(r===`avc`&&this.decoderConfig.description){let e=Xt(l(this.decoderConfig.description));if(e&&e.sequenceParameterSets.length>0){let t=Qt(e.sequenceParameterSets[0]);t&&t.frameMbsOnlyFlag===0&&(this.decoderConfig={...this.decoderConfig,hardwareAcceleration:`prefer-software`})}}x(this.decoderConfig.colorSpace)||(this.decoderConfig={...this.decoderConfig,colorSpace:{primaries:this.decoderConfig.colorSpace?.primaries??`bt709`,matrix:this.decoderConfig.colorSpace?.matrix??`bt709`,transfer:this.decoderConfig.colorSpace?.transfer??`bt709`,fullRange:this.decoderConfig.colorSpace?.fullRange??!1}})}let t=Error(`Decoding error`).stack;this.decoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.decoder.configure(this.decoderConfig)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(n(this.decoder),Math.max(this.decoder.decodeQueueSize,this.alphaDecoder?.decodeQueueSize??0))}decode(e){if(this.codec===`hevc`&&this.currentPacketIndex>0&&!this.raslSkipped){if(this.hasHevcRaslPicture(e.data))return;this.raslSkipped=!0}if(this.customDecoder)this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).catch(e=>this.onError(e)).finally(()=>this.customDecoderQueueSize--);else{if(n(this.decoder),Fe()||oe(this.inputTimestamps,e.timestamp,e=>e),ze()&&this.currentPacketIndex===0){if(this.codec===`avc`){let t=[],n=!1;for(let r of Vt(e.data,this.decoderConfig)){let i=Ht(e.data[r.offset]);if(n||=i>=1&&i<=5,i===Rt.AUD){if(n)break;t.length=0}i>=20&&i<=31||t.push(e.data.subarray(r.offset,r.offset+r.length))}e=new I(qt(t,this.decoderConfig),e.type,e.timestamp,e.duration)}else if(this.codec===`hevc`){let t=gn(e.data,this.decoderConfig);t&&(e=new I(t,e.type,e.timestamp,e.duration))}}this.decoder.decode(e.toEncodedVideoChunk()),this.decodeAlphaData(e)}this.currentPacketIndex++}decodeAlphaData(e){if(!e.sideData.alpha){this.pushNullAlphaFrame();return}if(this.merger||=new dl,!this.alphaDecoder){let e=e=>{if(this.colorQueue.length>0){let t=this.colorQueue.shift();n(t!==void 0),this.mergeAlpha(t,e)}else this.alphaQueue.push(e);for(this.decodedAlphaChunkCount++;this.nullAlphaFrameQueue.length>0&&this.nullAlphaFrameQueue[0]===this.decodedAlphaChunkCount;)if(this.nullAlphaFrameQueue.shift(),this.colorQueue.length>0){let e=this.colorQueue.shift();n(e!==void 0),this.mergeAlpha(e,null)}else this.alphaQueue.push(null);this.alphaDecoderQueueSize--},t=Error(`Decoding error`).stack;this.alphaDecoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.alphaDecoder.configure(this.decoderConfig)}let t=On(this.codec,this.decoderConfig,e.sideData.alpha);if(this.alphaHadKeyframe||=t===`key`,this.alphaHadKeyframe){if(this.codec===`hevc`&&this.currentAlphaPacketIndex>0&&!this.alphaRaslSkipped){if(this.hasHevcRaslPicture(e.sideData.alpha)){this.pushNullAlphaFrame();return}this.alphaRaslSkipped=!0}this.currentAlphaPacketIndex++,this.alphaDecoder.decode(e.alphaToEncodedVideoChunk(t??e.type)),this.alphaDecoderQueueSize++}else this.pushNullAlphaFrame()}pushNullAlphaFrame(){this.alphaDecoderQueueSize===0?this.alphaQueue.push(null):this.nullAlphaFrameQueue.push(this.decodedAlphaChunkCount+this.alphaDecoderQueueSize)}hasHevcRaslPicture(e){for(let t of tn(e,this.decoderConfig)){let n=nn(e[t.offset]);if(n===M.RASL_N||n===M.RASL_R)return!0}return!1}sampleHandler(e){if(Fe()){if(this.sampleQueue.length>0&&e.timestamp>=i(this.sampleQueue).timestamp){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}oe(this.sampleQueue,e,e=>e.timestamp)}else{let t=this.inputTimestamps.shift();n(t!==void 0),e.setTimestamp(t),this.finalizeAndEmitSample(e)}}finalizeAndEmitSample(e){e.setTimestamp(Math.round(e.timestamp*this.timeResolution)/this.timeResolution),e.setDuration(Math.round(e.duration*this.timeResolution)/this.timeResolution),e.setRotation(this.rotation),this.onSample(e)}async mergeAlpha(e,t){let r=E();this.mergeAlphaPromises.push(r.promise);let i={sample:null};this.finalSamples.push(i);try{for(t?(n(this.merger),i.sample=new Rs(await this.merger.merge(e,t))):i.sample=new Rs(e);this.finalSamples.length>0&&this.finalSamples[0].sample!==null;){let e=this.finalSamples.shift();this.sampleHandler(e.sample)}}catch(e){se(this.finalSamples,i),this.onError(e)}finally{se(this.mergeAlphaPromises,r.promise),r.resolve()}}async flush(){if(this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(n(this.decoder),await Promise.all([this.decoder.flush(),this.alphaDecoder?.flush()]),await Promise.all(this.mergeAlphaPromises),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.alphaHadKeyframe=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue.length=0,this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1),Fe()){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}this.currentPacketIndex=0,this.raslSkipped=!1}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(n(this.decoder),this.decoder.state!==`closed`&&this.decoder.close(),this.alphaDecoder&&this.alphaDecoder.state!==`closed`&&this.alphaDecoder.close(),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.merger?.close());for(let e of this.sampleQueue)e.close();this.sampleQueue.length=0}};let ul=null;var dl=class{constructor(){this.workers=[],this.nextWorkerIndex=0,this.pendingRequests=new Map,this.nextRequestId=0}merge(e,t){if(this.workers.length===0){if(!ul){let e=new Blob([`(${fl.toString()})()`],{type:`application/javascript`});ul=URL.createObjectURL(e)}let e=O(navigator.hardwareConcurrency,1,4);for(let t=0;t<e;t++){let e=new Worker(ul);e.addEventListener(`message`,e=>{let t=e.data,n=this.pendingRequests.get(t.id);n&&(this.pendingRequests.delete(t.id),`error`in t?n.reject(Error(t.error)):n.resolve(t.frame))}),e.addEventListener(`error`,e=>{let t=Error(e.message||`Color/alpha merge worker error.`);for(let e of this.pendingRequests.values())e.reject(t);this.pendingRequests.clear()}),this.workers.push(e)}}let n=this.nextRequestId++,r=E();this.pendingRequests.set(n,r);let i=this.workers[this.nextWorkerIndex];return this.nextWorkerIndex=(this.nextWorkerIndex+1)%this.workers.length,i.postMessage({id:n,color:e,alpha:t},{transfer:[e,t]}),r.promise}close(){for(let e of this.workers)e.terminate();this.workers.length=0;let e=Error(`Color/alpha merger closed.`);for(let t of this.pendingRequests.values())t.reject(e);this.pendingRequests.clear()}};const fl=()=>{let e=null,t=null,n=Promise.resolve();self.addEventListener(`message`,e=>{let{id:t,color:i,alpha:a}=e.data;n=n.then(async()=>{try{let e=await r(i,a);self.postMessage({id:t,frame:e},{transfer:[e]})}catch(e){self.postMessage({id:t,error:e.message})}finally{i.close(),a.close()}})});let r=async(e,t)=>{let n=e.format,r=t.format;if(!n||!r)throw Error(`CPU color/alpha merging requires a known VideoFrame format.`);let s=n.includes(`P10`),c=n.includes(`P12`),l=r.includes(`P10`),u=r.includes(`P12`);if(l!==s||u!==c)throw Error(`CPU color/alpha merging requires the alpha frame to have the same bit depth as the color frame (color: '${n}', alpha: '${r}').`);if(n===`RGBX`||n===`RGBA`||n===`BGRX`||n===`BGRA`)return await i(e,t,n);if(n===`I420`||n===`I420P10`||n===`I420P12`||n===`I422`||n===`I422P10`||n===`I422P12`||n===`I444`||n===`I444P10`||n===`I444P12`)return await a(e,t,n);if(n===`NV12`)return await o(e,t);throw Error(`CPU color/alpha merging does not support format '${n}'.`)},i=async(e,t,n)=>{let r=e.visibleRect?.width??e.codedWidth,i=e.visibleRect?.height??e.codedHeight,a=r*i,o=new Uint8Array(a*4);await e.copyTo(o);let c=await s(t,r,i,1);for(let e=0,t=3;e<a;e++,t+=4)o[t]=c[e];let l={format:n===`RGBX`||n===`RGBA`?`RGBA`:`BGRA`,codedWidth:r,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[o.buffer]};return new VideoFrame(o,l)},a=async(e,t,n)=>{let r=e.visibleRect?.width??e.codedWidth,i=e.visibleRect?.height??e.codedHeight,a=n.includes(`P10`),o=n.includes(`P12`),c=a||o?2:1,l,u;n.startsWith(`I420`)?(l=Math.ceil(r/2),u=Math.ceil(i/2)):n.startsWith(`I422`)?(l=Math.ceil(r/2),u=i):(l=r,u=i);let d=r*i,f=l*u,p=d*c,m=f*c,h=d*c,g=p+2*m+h,_=new Uint8Array(g);await e.copyTo(_);let v=await s(t,r,i,c),y=p+2*m;_.set(v,y);let b={format:n.slice(0,4)+`A`+n.slice(4),codedWidth:r,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[_.buffer]};return new VideoFrame(_,b)},o=async(e,n)=>{let r=e.visibleRect?.width??e.codedWidth,i=e.visibleRect?.height??e.codedHeight,a=r*i,o=Math.ceil(r/2)*Math.ceil(i/2),c=e.allocationSize();(!t||t.byteLength!==c)&&(t=new Uint8Array(c)),await e.copyTo(t);let l=new Uint8Array(a+2*o+a);l.set(t.subarray(0,a),0);let u=a,d=a+o,f=a;for(let e=0;e<o;e++)l[u+e]=t[f+e*2],l[d+e]=t[f+e*2+1];let p=await s(n,r,i,1);l.set(p,a+2*o);let m={format:`I420A`,codedWidth:r,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[l.buffer]};return new VideoFrame(l,m)},s=async(t,n,r,i)=>{let a=t.allocationSize();(!e||e.byteLength!==a)&&(e=new Uint8Array(a)),await t.copyTo(e);let o=t.format;if(o===`RGBA`||o===`BGRA`||o===`RGBX`||o===`BGRX`){let t=o===`RGBA`||o===`RGBX`?0:2,i=n*r;for(let n=0;n<i;n++)e[n]=e[n*4+t];return e.subarray(0,i)}return e.subarray(0,n*r*i)}},pl=e=>{if(!e||typeof e!=`object`)throw TypeError(`decoderOptions must be an object.`);if(e.hardwareAcceleration!==void 0&&![`no-preference`,`prefer-hardware`,`prefer-software`].includes(e.hardwareAcceleration))throw TypeError(`decoderOptions.hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.`);if(e.optimizeForLatency!==void 0&&typeof e.optimizeForLatency!=`boolean`)throw TypeError(`decoderOptions.optimizeForLatency, when provided, must be a boolean.`)};var ml=class extends sl{constructor(e,t={}){if(!(e instanceof Sl))throw TypeError(`videoTrack must be an InputVideoTrack.`);pl(t),super(),this._track=e,this._decoderOptions=t}async _createDecoder(e,t){if(!await this._track.canDecode())throw Error(typeof VideoDecoder>`u`?Be(`VideoDecoder`):`This video track cannot be decoded in this environment. Make sure to check decodability before using a track.`);let r=await this._track.getCodec(),i=await this._track.getRotation(),a=await this._track.getDecoderConfig(),o=await this._track.getTimeResolution();return n(r&&a),a={...a,hardwareAcceleration:this._decoderOptions.hardwareAcceleration,optimizeForLatency:this._decoderOptions.optimizeForLatency},new ll(e,t,r,a,i,o)}_createPacketSink(){return new al(this._track)}async getSample(e,t={}){rl(e);for await(let n of this.mediaSamplesAtTimestamps([e],t))return n;throw Error(`Internal error: Iterator returned nothing.`)}samples(e,t,n={}){return this.mediaSamplesInRange(e,t,n)}samplesAtTimestamps(e,t={}){return this.mediaSamplesAtTimestamps(e,t)}},hl=class{constructor(e,t={}){if(this._rotation=0,this._initPromise=null,this._nextCanvasIndex=0,!(e instanceof Sl))throw TypeError(`videoTrack must be an InputVideoTrack.`);if(t&&typeof t!=`object`)throw TypeError(`options must be an object.`);if(t.alpha!==void 0&&typeof t.alpha!=`boolean`)throw TypeError(`options.alpha, when provided, must be a boolean.`);if(t.width!==void 0&&(!Number.isInteger(t.width)||t.width<=0))throw TypeError(`options.width, when defined, must be a positive integer.`);if(t.height!==void 0&&(!Number.isInteger(t.height)||t.height<=0))throw TypeError(`options.height, when defined, must be a positive integer.`);if(t.fit!==void 0&&![`fill`,`contain`,`cover`].includes(t.fit))throw TypeError(`options.fit, when provided, must be one of "fill", "contain", or "cover".`);if(t.width!==void 0&&t.height!==void 0&&t.fit===void 0)throw TypeError(`When both options.width and options.height are provided, options.fit must also be provided.`);if(t.rotation!==void 0&&![0,90,180,270].includes(t.rotation))throw TypeError(`options.rotation, when provided, must be 0, 90, 180 or 270.`);if(t.crop!==void 0&&qs(t.crop,`options.`),t.poolSize!==void 0&&(typeof t.poolSize!=`number`||!Number.isInteger(t.poolSize)||t.poolSize<0))throw TypeError(`poolSize must be a non-negative integer.`);t.decoderOptions!==void 0&&pl(t.decoderOptions),this._videoTrack=e,this._alpha=t.alpha??!1,this._options=t,this._fit=t.fit??`fill`,this._videoSampleSink=new ml(e,t.decoderOptions),this._canvasPool=Array.from({length:t.poolSize??0},()=>null)}_ensureInit(){return this._initPromise??=(async()=>{let e=this._options,t=this._videoTrack,n=e.rotation??await t.getRotation(),r=await t.getSquarePixelWidth(),i=await t.getSquarePixelHeight(),[a,o]=n%180==0?[r,i]:[i,r],s=e.crop;s&&=Ks(s,a,o);let[c,l]=s?[s.width,s.height]:[a,o],u=c/l;e.width!==void 0&&e.height===void 0?(c=e.width,l=Math.round(c/u)):e.width===void 0&&e.height!==void 0?(l=e.height,c=Math.round(l*u)):e.width!==void 0&&e.height!==void 0&&(c=e.width,l=e.height),this._width=c,this._height=l,this._rotation=n,this._crop=s})()}_videoSampleToWrappedCanvas(e){let t=this._width,r=this._height,i=this._canvasPool[this._nextCanvasIndex],a=!1;i||(typeof document<`u`?(i=document.createElement(`canvas`),i.width=t,i.height=r):i=new OffscreenCanvas(t,r),this._canvasPool.length>0&&(this._canvasPool[this._nextCanvasIndex]=i),a=!0),this._canvasPool.length>0&&(this._nextCanvasIndex=(this._nextCanvasIndex+1)%this._canvasPool.length);let o=i.getContext(`2d`,{alpha:this._alpha||Le()});n(o),e._drawWithFitAndMipmapping(i,o,{fit:this._fit,rotation:this._rotation,crop:this._crop,targetIsFresh:a,fillBlack:!this._alpha&&Le()});let s={canvas:i,timestamp:e.timestamp,duration:e.duration};return e.close(),s}async getCanvas(e,t){rl(e),await this._ensureInit();let n=await this._videoSampleSink.getSample(e,t);return n&&this._videoSampleToWrappedCanvas(n)}async*canvases(e,t,n){await this._ensureInit(),yield*_e(this._videoSampleSink.samples(e,t,n),e=>this._videoSampleToWrappedCanvas(e))}async*canvasesAtTimestamps(e,t){await this._ensureInit(),yield*_e(this._videoSampleSink.samplesAtTimestamps(e,t),e=>e&&this._videoSampleToWrappedCanvas(e))}},gl=class extends ol{constructor(e,t,n,r){super(e,t),this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new Ne,this.customDecoderQueueSize=0,this.currentTimestamp=null,this.expectedFirstTimestamp=null,this.timestampOffset=0;let i=t=>{let n=t.timestamp;this.expectedFirstTimestamp!==null&&this.currentTimestamp===null&&(this.timestampOffset=this.expectedFirstTimestamp-n),n+=this.timestampOffset,(this.currentTimestamp===null||Math.abs(n-this.currentTimestamp)>=t.duration)&&(this.currentTimestamp=n);let i=this.currentTimestamp;if(this.currentTimestamp+=t.duration,t.numberOfFrames===0){t.close();return}let a=r.sampleRate;t.setTimestamp(Math.round(i*a)/a),e(t)},a=qc.find(e=>e.supports(n,r));if(a)this.customDecoder=new a,this.customDecoder.codec=n,this.customDecoder.config=r,this.customDecoder.onSample=e=>{if(!(e instanceof rc))throw TypeError(`The argument passed to onSample must be an AudioSample.`);i(e)},this.customDecoder.onError=e=>{t(e)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init()).catch(e=>t(e));else{let e=Error(`Decoding error`).stack;this.decoder=new AudioDecoder({output:e=>{try{i(new rc(e))}catch(e){this.onError(e)}},error:t=>{t.stack=e,this.onError(t)}}),this.decoder.configure(r)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(n(this.decoder),this.decoder.decodeQueueSize)}decode(e){this.customDecoder?(this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).catch(e=>this.onError(e)).finally(()=>this.customDecoderQueueSize--)):(n(this.decoder),this.expectedFirstTimestamp??=e.timestamp,this.decoder.decode(e.toEncodedAudioChunk()))}async flush(){this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(n(this.decoder),await this.decoder.flush()),this.currentTimestamp=null,this.expectedFirstTimestamp=null,this.timestampOffset=0}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(n(this.decoder),this.decoder.state!==`closed`&&this.decoder.close())}},_l=class extends ol{constructor(e,t,r){super(e,t),this.decoderConfig=r,this.currentTimestamp=null,n(P.includes(r.codec)),this.codec=r.codec;let{dataType:i,sampleSize:a,littleEndian:o}=Sr(this.codec);switch(this.inputSampleSize=a,a){case 1:i===`unsigned`?this.readInputValue=(e,t)=>e.getUint8(t)-128:i===`signed`?this.readInputValue=(e,t)=>e.getInt8(t):i===`ulaw`?this.readInputValue=(e,t)=>$c(e.getUint8(t)):i===`alaw`?this.readInputValue=(e,t)=>tl(e.getUint8(t)):n(!1);break;case 2:i===`unsigned`?this.readInputValue=(e,t)=>e.getUint16(t,o)-2**15:i===`signed`?this.readInputValue=(e,t)=>e.getInt16(t,o):n(!1);break;case 3:i===`unsigned`?this.readInputValue=(e,t)=>fe(e,t,o)-2**23:i===`signed`?this.readInputValue=(e,t)=>pe(e,t,o):n(!1);break;case 4:i===`unsigned`?this.readInputValue=(e,t)=>e.getUint32(t,o)-2**31:i===`signed`?this.readInputValue=(e,t)=>e.getInt32(t,o):i===`float`?this.readInputValue=(e,t)=>e.getFloat32(t,o):n(!1);break;case 8:i===`float`?this.readInputValue=(e,t)=>e.getFloat64(t,o):n(!1);break;default:D(a),n(!1)}switch(a){case 1:i===`ulaw`||i===`alaw`?(this.outputSampleSize=2,this.outputFormat=`s16`,this.writeOutputValue=(e,t,n)=>e.setInt16(t,n,!0)):(this.outputSampleSize=1,this.outputFormat=`u8`,this.writeOutputValue=(e,t,n)=>e.setUint8(t,n+128));break;case 2:this.outputSampleSize=2,this.outputFormat=`s16`,this.writeOutputValue=(e,t,n)=>e.setInt16(t,n,!0);break;case 3:this.outputSampleSize=4,this.outputFormat=`s32`,this.writeOutputValue=(e,t,n)=>e.setInt32(t,n<<8,!0);break;case 4:this.outputSampleSize=4,i===`float`?(this.outputFormat=`f32`,this.writeOutputValue=(e,t,n)=>e.setFloat32(t,n,!0)):(this.outputFormat=`s32`,this.writeOutputValue=(e,t,n)=>e.setInt32(t,n,!0));break;case 8:this.outputSampleSize=4,this.outputFormat=`f32`,this.writeOutputValue=(e,t,n)=>e.setFloat32(t,n,!0);break;default:D(a),n(!1)}}getDecodeQueueSize(){return 0}decode(e){let t=u(e.data),n=e.byteLength/this.decoderConfig.numberOfChannels/this.inputSampleSize,r=n*this.decoderConfig.numberOfChannels*this.outputSampleSize,i=new ArrayBuffer(r),a=new DataView(i);for(let e=0;e<n*this.decoderConfig.numberOfChannels;e++){let n=e*this.inputSampleSize,r=e*this.outputSampleSize,i=this.readInputValue(t,n);this.writeOutputValue(a,r,i)}let o=n/this.decoderConfig.sampleRate;(this.currentTimestamp===null||Math.abs(e.timestamp-this.currentTimestamp)>=o)&&(this.currentTimestamp=e.timestamp);let s=this.currentTimestamp;this.currentTimestamp+=o;let c=new rc({format:this.outputFormat,data:i,numberOfChannels:this.decoderConfig.numberOfChannels,sampleRate:this.decoderConfig.sampleRate,numberOfFrames:n,timestamp:s});this.onSample(c)}async flush(){}close(){}},vl=class extends sl{constructor(e){if(!(e instanceof Cl))throw TypeError(`audioTrack must be an InputAudioTrack.`);super(),this._track=e}async _createDecoder(e,t){if(!await this._track.canDecode())throw Error(typeof AudioDecoder>`u`?Be(`AudioDecoder`):`This audio track cannot be decoded in this environment. Make sure to check decodability before using a track.`);let r=await this._track.getCodec(),i=await this._track.getDecoderConfig();return n(r&&i),P.includes(i.codec)?new _l(e,t,i):new gl(e,t,r,i)}_createPacketSink(){return new al(this._track)}async getSample(e,t={}){rl(e);for await(let n of this.mediaSamplesAtTimestamps([e],t))return n;throw Error(`Internal error: Iterator returned nothing.`)}samples(e,t,n={}){return this.mediaSamplesInRange(e,t,n)}samplesAtTimestamps(e,t={}){return this.mediaSamplesAtTimestamps(e,t)}},yl=class{constructor(e){if(!(e instanceof Cl))throw TypeError(`audioTrack must be an InputAudioTrack.`);this._audioSampleSink=new vl(e)}_audioSampleToWrappedArrayBuffer(e){let t={buffer:e.toAudioBuffer(),timestamp:e.timestamp,duration:e.duration};return e.close(),t}async getBuffer(e,t){rl(e);let n=await this._audioSampleSink.getSample(e,t);return n&&this._audioSampleToWrappedArrayBuffer(n)}buffers(e,t,n){return _e(this._audioSampleSink.samples(e,t,n),e=>this._audioSampleToWrappedArrayBuffer(e))}buffersAtTimestamps(e,t){return _e(this._audioSampleSink.samplesAtTimestamps(e,t),e=>e&&this._audioSampleToWrappedArrayBuffer(e))}},bl=class e{constructor(e,t){
|
|
338
338
|
/*!
|
|
339
339
|
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
340
340
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{n as t}from"./panel-rpc-BPwAqRch.js";import{t as n}from"./base64-DzRgusa4.js";import{t as r}from"./types-Dgm4REV3.js";import"./fs-
|
|
1
|
+
import{t as e}from"./logger-LESFN7Hj.js";import{n as t}from"./panel-rpc-BPwAqRch.js";import{t as n}from"./base64-DzRgusa4.js";import{t as r}from"./types-Dgm4REV3.js";import"./fs-FVRsAbgb.js";import"./tray-storage-keys-DbThbnIh.js";function i(e){return e==null?[]:Array.isArray(e)?e:[e]}function a(e,t,n,r){var i,a=e[t],o=~r.string.indexOf(t)?n==null||n===!0?``:String(n):typeof n==`boolean`?n:~r.boolean.indexOf(t)?n===`false`?!1:n===`true`||(e._.push((i=+n,i*0==0?i:n)),!!n):(i=+n,i*0==0?i:n);e[t]=a==null?o:Array.isArray(a)?a.concat(o):[a,o]}function o(e,t){e||=[],t||={};var n,r,o,s,c,l={_:[]},u=0,d=0,f=0,p=e.length;let m=t.alias!==void 0,h=t.unknown!==void 0,g=t.default!==void 0;if(t.alias=t.alias||{},t.string=i(t.string),t.boolean=i(t.boolean),m)for(n in t.alias)for(r=t.alias[n]=i(t.alias[n]),u=0;u<r.length;u++)(t.alias[r[u]]=r.concat(n)).splice(u,1);for(u=t.boolean.length;u-->0;)for(r=t.alias[t.boolean[u]]||[],d=r.length;d-->0;)t.boolean.push(r[d]);for(u=t.string.length;u-->0;)for(r=t.alias[t.string[u]]||[],d=r.length;d-->0;)t.string.push(r[d]);if(g){for(n in t.default)if(s=typeof t.default[n],r=t.alias[n]=t.alias[n]||[],t[s]!==void 0)for(t[s].push(n),u=0;u<r.length;u++)t[s].push(r[u])}let _=h?Object.keys(t.alias):[];for(u=0;u<p;u++){if(o=e[u],o===`--`){l._=l._.concat(e.slice(++u));break}for(d=0;d<o.length&&o.charCodeAt(d)===45;d++);if(d===0)l._.push(o);else if(o.substring(d,d+3)===`no-`){if(s=o.substring(d+3),h&&!~_.indexOf(s))return t.unknown(o);l[s]=!1}else{for(f=d+1;f<o.length&&o.charCodeAt(f)!==61;f++);for(s=o.substring(d,f),c=o.substring(++f)||u+1===p||(``+e[u+1]).charCodeAt(0)===45||e[++u],r=d===2?[s]:s,f=0;f<r.length;f++){if(s=r[f],h&&!~_.indexOf(s))return t.unknown(`-`.repeat(d)+s);a(l,s,f+1<r.length||c,t)}}}if(g)for(n in t.default)l[n]===void 0&&(l[n]=t.default[n]);if(m)for(n in l)for(r=t.alias[n]||[];r.length>0;)l[r.shift()]=l[n];return l}function s(e,t){let n=[],r=new Map,i=new Set;for(let a=0;a<e.length;a++){let o=e[a];o.startsWith(`-`)?t.has(o)?r.set(o,e[++a]??``):i.add(o):n.push(o)}return{positionals:n,flags:r,bools:i}}function c(e){let t=new Set(e.string??[]),n=e.alias??{};for(let[e,r]of Object.entries(n)){let n=[e,...Array.isArray(r)?r:[r]];if(n.some(e=>t.has(e)))for(let e of n)t.add(e)}return t}const l=/^(--?)([^=]+)(=.*)?$/;function u(e){let t=new Set(e.string??[]);for(let n of e.boolean??[])t.add(n),t.add(`no-${n}`);for(let[n,r]of Object.entries(e.alias??{})){t.add(n);for(let e of Array.isArray(r)?r:[r])t.add(e)}return t}function d(e,t,n){let r=0;for(;r<e.length;r++){let i=e[r];if(!i.startsWith(`-`)||i===`-`)break;let a=l.exec(i);if(!a||!n.has(a[2]))break;!a[3]&&t.has(a[2])&&r+1<e.length&&r++}return r}function f(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=l.exec(i);a&&!a[3]&&t.has(a[2])&&r+1<e.length?(n.push(`${i}=${e[r+1]}`),r++):n.push(i)}return n}function p(e,t={}){let n=e,r=[];if(t[`--`]){let t=e.indexOf(`--`);t!==-1&&(n=e.slice(0,t),r=e.slice(t+1))}let i=c(t),a=n,s=[];if(t.stopEarly){let e=d(n,i,u(t));a=n.slice(0,e),s=n.slice(e)}let{_:l,...p}=o(f(a,i),{string:t.string?[...t.string]:void 0,boolean:t.boolean?[...t.boolean]:void 0,alias:t.alias,default:t.default}),m=t.stopEarly?s:l;return{_:m,positionals:m,flags:p,doubleDashRest:r}}const m=[`playwright-cli`,`playwright`,`puppeteer`],h=new WeakMap,g=e(`playwright`);function _(e,t){let n=h.get(e);n||(n=new WeakMap,h.set(e,n));let r=n.get(t);return r||(r={snapshots:new Map,appTabId:null,harRecorder:null,sessionDirsCreated:!1,teleportWatchers:new Map,consoleMessages:new Map,consoleCleanup:new Map,networkRequests:new Map,networkRequestIndex:new Map,networkCleanup:new Map,routes:new Map,routeCleanup:new Map,lastMousePosition:new Map},n.set(t,r)),r}const v=/^(f[0-9]+)?e[0-9]+$/;function y(e){return v.test(e)}function b(e){let t=e.match(/^(f[0-9]+)(e[0-9]+)$/);return t?{framePrefix:t[1],isIframe:!0}:{framePrefix:``,isIframe:!1}}const x=n,S=new Set([`click`,`dblclick`,`fill`,`type`,`press`,`goto`,`navigate`,`select`,`check`,`uncheck`,`drag`,`dialog-accept`,`dialog-dismiss`,`drop`]);function C(e){return e.toISOString().replace(/:/g,`-`)}function w(e){return e instanceof r||typeof e==`object`&&e&&`code`in e?e.code===`EEXIST`:e instanceof Error&&e.message.includes(`EEXIST`)}const T=`function(text) {
|
|
2
2
|
const el = this;
|
|
3
3
|
const tag = el.tagName;
|
|
4
4
|
const proto = tag === 'TEXTAREA' ? window.HTMLTextAreaElement.prototype : window.HTMLInputElement.prototype;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./types-Dgm4REV3.js";import{t}from"./global-db-DJXlpNui.js";const n=`/workspace/.plugins/plugins.json`;let r=null;async function i(e){if(e)return e;if(r&&r.dbName===`slicc-fs-global`)return r.instance;let{VirtualFS:n}=await import(`./fs-
|
|
1
|
+
import{t as e}from"./types-Dgm4REV3.js";import{t}from"./global-db-DJXlpNui.js";const n=`/workspace/.plugins/plugins.json`;let r=null;async function i(e){if(e)return e;if(r&&r.dbName===`slicc-fs-global`)return r.instance;let{VirtualFS:n}=await import(`./fs-FVRsAbgb.js`).then(e=>e.t),i=await n.create({dbName:t});return r={instance:i,dbName:t},i}function a(){return{version:1,plugins:{}}}function o(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function s(e){if(!o(e))return null;let t=e;return typeof t.root==`string`?t:null}function c(e){if(!o(e))return a();let t=e,n=typeof t.version==`number`?t.version:1,r={};if(o(t.plugins))for(let[e,n]of Object.entries(t.plugins)){let t=s(n);t&&(r[e]=t)}return{version:n,plugins:r}}async function l(t){try{let e=await(await i(t)).readFile(n,{encoding:`utf-8`});try{return c(JSON.parse(e))}catch{return a()}}catch(t){if(t instanceof e&&t.code===`ENOENT`)return a();throw t}}async function u(e,t){let r=await i(t);await r.mkdir(`/workspace/.plugins`,{recursive:!0});let a=c({version:e.version||1,plugins:e.plugins??{}});await r.writeFile(n,JSON.stringify(a,null,2))}async function d(e,t){return(await l(t)).plugins[e]??null}async function f(e,t,n){let r=await l(n);r.plugins[e]=t,await u(r,n)}async function p(e,t){let n=await l(t);return e in n.plugins&&(delete n.plugins[e],await u(n,t),!0)}async function m(e){return(await l(e)).plugins}export{p as deleteInstalledPlugin,d as getInstalledPlugin,m as listInstalledPlugins,f as setInstalledPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import{t as n}from"./types-Dgm4REV3.js";import{t as r}from"./global-db-DJXlpNui.js";var i=e({MCP_STORE_PATH:()=>o,deleteServer:()=>y,getServer:()=>_,listServers:()=>b,readMcpAuthEntries:()=>S,readMcpAuthEntry:()=>x,readServersFile:()=>h,setServer:()=>v,writeServersFile:()=>g});const a=t(`mcp-store`),o=`/workspace/.mcp/servers.json`;let s=null,c=null;async function l(){return s||=await import(`./fs-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import{t as n}from"./types-Dgm4REV3.js";import{t as r}from"./global-db-DJXlpNui.js";var i=e({MCP_STORE_PATH:()=>o,deleteServer:()=>y,getServer:()=>_,listServers:()=>b,readMcpAuthEntries:()=>S,readMcpAuthEntry:()=>x,readServersFile:()=>h,setServer:()=>v,writeServersFile:()=>g});const a=t(`mcp-store`),o=`/workspace/.mcp/servers.json`;let s=null,c=null;async function l(){return s||=await import(`./fs-FVRsAbgb.js`).then(e=>e.t),s}async function u(e){if(e)return e;if(c&&c.dbName===`slicc-fs-global`)return c.instance;let{VirtualFS:t}=await l(),n=await t.create({dbName:r});return c={instance:n,dbName:r},n}function d(){return{version:1,servers:{}}}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){if(!f(e))return null;let t={...e};return typeof t.url==`string`?(delete t.sessionId,t):null}function m(e){if(!f(e))return d();let t=e,n=typeof t.version==`number`?t.version:1,r={};if(f(t.servers))for(let[e,n]of Object.entries(t.servers)){let t=p(n);t&&(r[e]=t)}return{version:n,servers:r}}async function h(e){try{let t=await(await u(e)).readFile(o,{encoding:`utf-8`});try{return m(JSON.parse(t))}catch(e){return a.warn(`servers.json is not valid JSON; treating as empty`,{error:e instanceof Error?e.message:String(e)}),d()}}catch(e){if(e instanceof n&&e.code===`ENOENT`)return d();throw e}}async function g(e,t){let n=await u(t);await n.mkdir(`/workspace/.mcp`,{recursive:!0});let r=m({version:e.version||1,servers:e.servers??{}});await n.writeFile(o,JSON.stringify(r,null,2))}async function _(e,t){return(await h(t)).servers[e]??null}async function v(e,t,n){let r=await h(n),i=p({...r.servers[e],...t});if(!i)throw Error(`MCP server entry requires a URL`);return r.servers[e]=i,await g(r,n),i}async function y(e,t){let n=await h(t);return e in n.servers&&(delete n.servers[e],await g(n,t),!0)}async function b(e){return(await h(e)).servers}async function x(e){let t=await _(e);return!t?.url||!t.auth?.clientId?null:{name:e,serverUrl:t.url,auth:t.auth}}async function S(){let e=await b(),t=[];for(let[n,r]of Object.entries(e))!r?.url||!r.auth?.clientId||t.push({name:n,serverUrl:r.url,auth:r.auth});return t}export{x as n,i as r,S as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-rpc-B3MSVImO.js","assets/rolldown-runtime-Dd_uD5pT.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{t as n}from"./quick-llm-
|
|
2
|
+
import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{t as n}from"./quick-llm-Bji5F30H.js";import{t as r}from"./approval-decision-CS9Wwm5B.js";import"./capability-DQ10DnFn.js";import{t as i}from"./page-approval-service-BXlCsull.js";var a=t(`sudo:timeout`);function o(e=`user-timeout`){return{decision:`deny`,reason:e}}function s(e,t={}){let n=t.timeoutMs??3e5;if(!Number.isFinite(n)||n<=0)return e;let r=t.setTimer??((e,t)=>setTimeout(e,t)),i=t.clearTimer??(e=>clearTimeout(e));return{requestApproval(t,s){return new Promise(c=>{let l=new AbortController,u=()=>l.abort();s?.signal?.addEventListener(`abort`,u,{once:!0});let d=!1,f=e=>{d=!0,s?.signal?.removeEventListener(`abort`,u),c(e)},p=r(()=>{d||(a.warn(`sudo approval timed out — failing closed`,{kind:t.kind,detail:t.detail,timeoutMs:n}),l.abort(),f(o(`user-timeout`)))},n),m=e=>{if(d){a.warn(`sudo decision arrived after timeout — discarded`,{kind:t.kind,detail:t.detail,decision:e.decision});return}i(p),f(e)};e.requestApproval(t,{signal:l.signal}).then(m,e=>{a.warn(`sudo broker threw — denying`,{error:e instanceof Error?e.message:String(e)}),m({decision:`deny`})})})}}}var c=t(`sudo-suggest`),l=[`You generalize a single shell command into a minimal glob pattern for an`,`allow-list rule. Output ONLY the pattern on one line — no prose, no quotes,`,`no backticks. Keep the leading command/sub-command verbatim and replace only`,`the volatile tail (args, paths, refs) with a single trailing "*".`,`Examples:`,` git push origin main -> git push*`,` rm -rf build/cache -> rm -rf*`,` npm install left-pad -> npm install*`].join(`
|
|
3
3
|
`),u=[`You generalize a single filesystem path into a minimal glob pattern for an`,`allow-list rule. Output ONLY the pattern on one line — no prose, no quotes,`,`no backticks. Keep the meaningful directory prefix and replace the volatile`,`leaf (and below) with "**". Examples:`,` /workspace/.git/config -> /workspace/.git/**`,` /shared/secrets/openai.key -> /shared/secrets/**`,` /workspace/src/app/main.ts -> /workspace/src/**`].join(`
|
|
4
4
|
`);async function d(e,t){if(e.suggestedPattern&&e.suggestedPattern.trim().length>0)return e.suggestedPattern.trim();let r=e.detail.trim(),i=e.kind===`command`?l:u,a=null;try{a=await n({prompt:r,system:i,maxTokens:40,temperature:0,signal:t})}catch(e){c.debug(`suggestPattern: quickLabel threw`,{error:e instanceof Error?e.message:String(e)}),a=null}return f(a)||r}function f(e){if(!e)return null;let t=(e.split(`
|
|
5
5
|
`,1)[0]?.trim()??``).replace(/^`+/,``).replace(/`+$/,``).replace(/^["']/,``).replace(/["']$/,``).trim();return t.length===0?null:t}var p=t(`sudo:capability-gesture`);function m(e,t={}){let n=t.suggest??d;return{async requestApproval(t,i){let a=i?.signal,o;if(t.suggestedPattern)o=t.suggestedPattern;else try{o=await n(t,a)}catch{o=t.detail}if(a?.aborted)return p.warn(`sudo approval aborted before prompting — denying`,{detail:t.detail}),{decision:`deny`};if(!e)return p.warn(`no CapabilityBroker injected for the sudo gesture hop — denying (composition bug, never a guessed transport)`,{detail:t.detail}),{decision:`deny`};let s=await e.approvals.request({kind:t.kind,detail:t.detail,suggestedPattern:o,...t.requester?{requester:t.requester}:{},...t.approver?{approver:t.approver}:{},...a?{signal:a}:{}});return s.ok?r(s.value,o):(p.warn(`capability broker approvals.request failed — denying`,{message:s.message}),{decision:`deny`})}}}var h=t(`sudo:tray-first`),g=6e5;function _(t,n={}){let r=n.suggest??d,i=n.timeoutMs??g,a=n.getClient??(async()=>{let{getPanelRpcClient:t}=await e(async()=>{let{getPanelRpcClient:e}=await import(`./panel-rpc-B3MSVImO.js`).then(e=>e.i);return{getPanelRpcClient:e}},__vite__mapDeps([0,1]));return t()});return{async requestApproval(e,n){if(n?.signal?.aborted)return{decision:`deny`};let o=e.suggestedPattern;if(!o)try{o=await r(e,n?.signal)}catch{o=e.detail}let s={...e,suggestedPattern:o},c=null;try{c=await a()}catch(e){h.debug?.(`panel-RPC client lookup threw — using native broker`,{error:e instanceof Error?e.message:String(e)})}if(c)try{let e=await c.call(`sudo-request`,{request:s,mode:`tray-first`},{timeoutMs:i});if(e?.handled!==!1)return v(e?.decision,o)}catch(e){h.warn(`tray-first sudo probe failed — using native broker`,{error:e instanceof Error?e.message:String(e)})}return t.requestApproval(s,n)}}}function v(e,t){if(!e||typeof e!=`object`)return{decision:`deny`};let n=e,r=n.attestation===`biometric`||n.attestation===`passcode`||n.attestation===`none`?n.attestation:void 0;return n.decision===`allow`?{decision:`allow`,...r?{attestation:r}:{}}:n.decision===`always`?{decision:`always`,pattern:typeof n.pattern==`string`&&n.pattern.trim().length>0?n.pattern.trim():t,...r?{attestation:r}:{}}:{decision:`deny`}}var y=t(`sudo`),b=`__slicc_sudo`;function x(e){return s(S(e))}function S(e){let t=m(e);return e?.adapter===`extension-direct`||e?.adapter===`extension-delegate`?t:_(t)}function C(e){let t={requestApproval:t=>e.requestApproval(t)};return globalThis[b]=t,y.info(`sudo broker test hook published on globalThis.__slicc_sudo`),t}export{x as createSudoBroker,i as installPanelSudoResponder,C as installSudoTestHook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./bridge-protocol-06nbmp2X.js";import{A as t,D as n,E as r,O as i,T as a,k as o,w as s}from"./wc-live-
|
|
1
|
+
import{i as e}from"./bridge-protocol-06nbmp2X.js";import{A as t,D as n,E as r,O as i,T as a,k as o,w as s}from"./wc-live-Ts1bLhjx.js";import{n as c}from"./clipboard-eqmn97SP.js";import{n as l}from"./icons-Df1OSRR-.js";function u(e){let t=[{id:`browser`,label:`Browser`},{id:`iphone`,label:`iPhone`},{id:`terminal`,label:`Terminal`}];return e>0&&t.unshift({id:`status`,label:`Status`,badge:e}),t}function d(e){return e>0?`status`:`browser`}function f(e){let t;try{t=new URL(e)}catch{return e}let n=t.pathname.split(`/`),r=n.lastIndexOf(`join`)+1;return r===0||r>=n.length||!n[r]?e:(n[r]=`•`.repeat(8),`${t.origin}${n.join(`/`)}${t.search}${t.hash}`)}function p(e){return`slicc ${e} follow bash -c`}var m=e;function h(e){try{return new URL(e).origin}catch{return m}}function g(e){return`curl -fsSL ${h(e)}/install-cli | sh`}function _(e){return`irm ${h(e)}/install-cli.ps1 | iex`}function v(e){switch(e){case`browser`:return[`Open Sliccy in the other browser, click the avatar, and choose “Connect to another browser”.`,`Paste the join link there.`];case`iphone`:return[`In the Sliccy app, paste the join link into Settings → Join link.`,`Signed in to the same iCloud account? The session is already listed under iCloud Sessions — no link needed.`];case`terminal`:return[`Lend a machine to this session — run these in its terminal:`,`The agent can then run commands on that machine as you.`]}}function y(e){return e===0?`Nothing connected yet.`:`${e} ${e===1?`device is`:`devices are`} connected.`}function b(e){return e===0?`Revoke link? The old link stops working.`:`Revoke link? ${e} connected ${e===1?`device`:`devices`} will be disconnected.`}var x=`font-family: var(--s2-font-mono); font-size: 11px; color: var(--s2-content-default); word-break: break-all; padding: 8px 12px; background: var(--s2-bg-sunken); border-radius: var(--s2-radius-default); border: 1px solid var(--s2-border-subtle);`,S=`font-size: 11px; color: var(--s2-content-secondary);`,C=`font-size: 12px; color: var(--s2-content-default);`,w=`flex: 0 0 auto; width: auto; padding: 8px 14px;`;function T(e,t,n){let r=document.createElement(e);return t&&(r.style.cssText=t),n!=null&&(r.textContent=n),r}function E(e,t,n=`normal`){e.statusEl.textContent=t,e.statusEl.style.color=n===`error`?`var(--slicc-cone)`:`var(--s2-content-secondary)`}async function D(e,t,n){await c(t)?E(e,n):E(e,`Couldn’t copy. Select the text and copy it manually.`,`error`)}async function O(e){let{onReset:t}=e.options,n=e.revokeBtn;if(!(!t||!n)){if(!e.revokeArmed){e.revokeArmed=!0,n.textContent=b(e.followers.length),k(n,!0);return}n.disabled=!0,e.doneBtn.disabled=!0,E(e,`Revoking the join link…`);try{await t(),E(e,`Join link revoked. Enable sharing from the avatar menu to get a new one.`),e.urlRevealed=!1,n.textContent=`Revoked`,e.doneBtn.disabled=!1,L(e)}catch(t){E(e,`Revoke failed: ${t instanceof Error?t.message:String(t)}`,`error`),e.revokeArmed=!1,n.textContent=`Revoke link`,k(n,!1),n.disabled=!1,e.doneBtn.disabled=!1}}}function k(e,t){e.dataset.armed=t?`1`:`0`,e.style.background=t?`var(--s2-negative)`:``,e.style.borderColor=t?`transparent`:``,e.style.color=t?`#fff`:``}function A(e){let t=T(`div`),n=T(`button`,`margin-bottom: 8px;`,`Copy join link`);n.className=`dialog__btn dialog__btn--secondary`,n.dataset.action=`copy-link`,n.addEventListener(`click`,()=>{D(e,e.options.joinUrl,`Join link copied.`)}),t.appendChild(n);let r=T(`div`,`display: flex; align-items: center; gap: 8px;`),i=T(`div`,`${x} flex: 1 1 auto; min-width: 0; color: var(--s2-content-secondary);`);i.dataset.joinUrl=`1`,i.textContent=e.urlRevealed?e.options.joinUrl:f(e.options.joinUrl);let a=T(`button`,`${w}`,e.urlRevealed?`Hide`:`Show`);return a.className=`dialog__btn dialog__btn--secondary`,a.dataset.action=`toggle-url`,a.addEventListener(`click`,()=>{e.urlRevealed=!e.urlRevealed,L(e)}),r.append(i,a),t.appendChild(r),t.appendChild(T(`div`,`${S} margin-top: 8px;`,`Anyone with this link can drive this session.`)),t}function j(e,t){let n=T(`div`,`margin-bottom: 10px;`);n.appendChild(T(`div`,`${S} margin-bottom: 4px;`,t.caption));let r=T(`div`,`${x} margin-bottom: 6px;`,t.command);r.dataset.command=t.action,n.appendChild(r);let i=T(`button`,`margin-bottom: 0;`,t.copyLabel);return i.className=`dialog__btn dialog__btn--secondary`,i.dataset.action=t.action,i.addEventListener(`click`,()=>{D(e,t.copyValue??t.command,t.okMessage)}),n.appendChild(i),n}function M(e,t){let n=T(`div`),{joinUrl:r}=e.options,i=p(r),a=e.urlRevealed?i:p(f(r));n.appendChild(j(e,{caption:`1. Install the slicc CLI (skip if you already have it):`,command:g(r),action:`copy-install`,copyLabel:`Copy install command`,okMessage:`Install command copied.`})),n.appendChild(T(`div`,`${S} margin: -6px 0 12px;`,`Windows: ${_(r)}`)),n.appendChild(j(e,{caption:`2. Connect that machine to this session:`,command:a,copyValue:i,action:`copy-command`,copyLabel:`Copy command`,okMessage:`Command copied.`}));let o=T(`button`,`${w} margin-bottom: 8px;`,e.urlRevealed?`Hide link`:`Show link`);return o.className=`dialog__btn dialog__btn--secondary`,o.dataset.action=`toggle-url`,o.addEventListener(`click`,()=>{e.urlRevealed=!e.urlRevealed,L(e)}),n.appendChild(o),n.appendChild(T(`div`,`${S} margin-bottom: 0;`,`\u26a0 ${t}`)),n}function N(e,t){let n=T(`div`),[r,i]=v(t);return n.appendChild(T(`div`,`${C} line-height: 1.5; margin-bottom: 6px;`,r)),t===`terminal`?(n.appendChild(M(e,i)),n):(n.appendChild(T(`div`,`${S} margin-bottom: 10px;`,i)),n.appendChild(A(e)),n)}function P(e){let s=T(`div`,`display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: start;`);s.dataset.follower=e.runtimeId;let c=T(`span`,`display: flex; margin-top: 2px; color: var(--s2-content-secondary);`);c.appendChild(l(n(e),{size:14})),s.appendChild(c);let u=T(`div`,`display: flex; flex-direction: column; gap: 2px; min-width: 0;`);u.appendChild(T(`div`,`${C} font-weight: 500;`,t(e)));let d=r(e);d&&u.appendChild(T(`div`,`${S} overflow-wrap: anywhere;`,d));let f=a(e);if(f.length>0){let e=T(`div`,`display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px;`);for(let t of f)e.appendChild(T(`span`,`padding: 1px 6px; border-radius: 9999px; background: var(--s2-bg-layer-1); border: 1px solid var(--s2-border-subtle); font-size: 10px; font-weight: 600; color: var(--s2-content-secondary);`,t));u.appendChild(e)}s.appendChild(u);let p=o(e),m=p===`active`?`var(--s2-positive)`:p===`warn`?`var(--s2-notice)`:`var(--s2-content-tertiary)`,h=T(`div`,`display: flex; align-items: center; gap: 5px; ${S} white-space: nowrap;`);return h.appendChild(T(`span`,`width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: ${m};`)),h.appendChild(T(`span`,void 0,i(e))),s.appendChild(h),s}function F(e){let t=T(`div`,`display: flex; flex-direction: column; gap: 10px;`);for(let n of e.followers)t.appendChild(P(n));return e.followers.length===0&&t.appendChild(T(`div`,`font-size: 12px; color: var(--s2-content-secondary);`,`Nothing connected right now.`)),t}function I(e,t,n){let r=t===e.activeTab,i=T(`button`,`flex: 0 0 auto; padding: 4px 10px; border-radius: 9999px; font-size: 12px; cursor: pointer; border: 1px solid ${r?`var(--s2-border-subtle)`:`transparent`}; background: ${r?`var(--s2-bg-layer-1)`:`transparent`}; color: ${r?`var(--s2-content-default)`:`var(--s2-content-secondary)`};`,n);return i.type=`button`,i.setAttribute(`role`,`tab`),i.setAttribute(`aria-selected`,String(r)),i.dataset.tab=t,i.addEventListener(`click`,()=>{e.activeTab=t,L(e)}),i}function L(e){let t=u(e.followers.length);t.some(t=>t.id===e.activeTab)||(e.activeTab=d(0)),e.tabsRow.replaceChildren(...t.map(t=>I(e,t.id,t.badge==null?t.label:`${t.label} · ${t.badge}`))),e.body.replaceChildren(e.activeTab===`status`?F(e):N(e,e.activeTab)),e.summaryEl.textContent=y(e.followers.length),e.revokeBtn&&!e.revokeArmed&&e.revokeBtn.textContent!==`Revoked`&&(e.revokeBtn.textContent=`Revoke link`,k(e.revokeBtn,!1))}function R(e){let t=T(`div`);t.className=`dialog-overlay`,t.dataset.syncDialog=`1`;let n=T(`div`);n.className=`dialog`,n.setAttribute(`role`,`dialog`),n.setAttribute(`aria-modal`,`true`),n.setAttribute(`aria-label`,`Session sharing`),t.appendChild(n);let r=T(`div`,void 0,`Session sharing`);r.className=`dialog__title`;let i=T(`div`,`display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap;`);i.setAttribute(`role`,`tablist`);let a=T(`div`,`margin-bottom: 12px;`);a.setAttribute(`role`,`tabpanel`);let o=T(`div`,`font-size: 12px; margin-bottom: 8px; min-height: 16px;`);o.setAttribute(`role`,`status`),o.setAttribute(`aria-live`,`polite`);let s=T(`div`,`${S} margin-bottom: 8px;`),c=T(`button`,void 0,`Done`);c.className=`dialog__btn`,n.append(r,i,a,o,s,c);let l=e.followers??[];return{options:e,followers:l,activeTab:e.initialTab??d(l.length),urlRevealed:!1,revokeArmed:!1,overlay:t,tabsRow:i,body:a,statusEl:o,summaryEl:s,doneBtn:c,revokeBtn:null}}var z=null;function B(e){z?.(),document.querySelectorAll(`.dialog-overlay[data-sync-dialog]`).forEach(e=>{e.remove()});let t=R(e),n=t.overlay.firstElementChild;if(e.onReset){let e=T(`button`,`margin-top: 8px;`,`Revoke link`);e.className=`dialog__btn dialog__btn--secondary`,e.dataset.action=`revoke`,e.addEventListener(`click`,()=>{O(t)}),n.appendChild(e),t.revokeBtn=e}let r=e=>{t.followers=e.detail?.followers??[],L(t)},i=e=>{e.key===`Escape`&&a()};function a(){window.removeEventListener(s,r),document.removeEventListener(`keydown`,i),t.overlay.remove(),z===a&&(z=null)}t.doneBtn.addEventListener(`click`,()=>a()),t.overlay.addEventListener(`click`,e=>{e.target===t.overlay&&a()}),window.addEventListener(s,r),document.addEventListener(`keydown`,i),z=a,e.copied&&E(t,`Join link copied to clipboard.`),L(t),document.body.appendChild(t.overlay)}export{B as showSyncEnabledDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as e}from"./wc-shortcuts-
|
|
1
|
+
import{J as e}from"./wc-shortcuts-BU_YGmdb.js";import"./proxied-fetch-DyBveeCl.js";import{n as t}from"./runtime-env-Dlaokqg1.js";import{a as n,t as r}from"./api-endpoint-DGxXvrur.js";import{t as i}from"./shared-mBEktoxE.js";var a=1e3;function o(e=()=>Date.now()){let t=new Map,n=null,r=0,i=()=>{let e=0,n=0;for(let r of t.values())e+=r.loaded,n+=r.total;return{loaded:e,total:n}};return{update(a,o,s){t.set(a,{loaded:Math.max(0,o),total:Math.max(t.get(a)?.total??0,s,o)}),n===null&&(n=e(),r=i().loaded)},complete(e){let n=t.get(e);n&&(n.loaded=n.total)},snapshot(){let{loaded:t,total:o}=i(),s=null;if(n!==null&&o>0&&t<o){let i=e()-n,c=t-r;if(i>=a&&c>0){let e=c/i;s=(o-t)/e/1e3}}return o>0&&t>=o&&(s=0),{loaded:t,total:o,etaSeconds:s}}}}var s=`onnx-community/whisper-tiny`,c=`onnx-community/Kokoro-82M-v1.0-ONNX`,l=Symbol.for(`slicc.transformers-env.fetch-wrapped`),u=t,d=`/workspace/node_modules/onnxruntime-web/dist/`,f=`/workspace/models/`;function p(e){return typeof e==`string`?e:e instanceof URL?e.toString():e.url}function m(e){let t=p(e);return t.startsWith(`http://`)||t.startsWith(`https://`)}function h(){return globalThis.location?.origin??null}function g(e){let t=h();if(!t)return!1;try{return new URL(p(e)).origin===t}catch{return!1}}async function _(e,t){let i=p(e),a={};t?.headers&&new Headers(t.headers).forEach((e,t)=>{a[t]=e});let o=r({...a,"X-Target-URL":i}),s=(t?.method??`GET`).toUpperCase(),c={method:s,headers:o,cache:`no-store`};return t?.body&&s!==`GET`&&s!==`HEAD`&&(c.body=t.body),fetch(n(`/api/fetch-proxy`),c)}var v=3e4,y=[`ort-wasm-simd-threaded.jsep.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.26.0-dev.20260416-b7804b056c/dist/ort-wasm-simd-threaded.jsep.wasm`,`ort-wasm-simd-threaded.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.26.0-dev.20260416-b7804b056c/dist/ort.wasm`,`ort-wasm-simd-threaded.asyncify.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.26.0-dev.20260416-b7804b056c/dist/ort-wasm-simd-threaded.asyncify.wasm`],b=Symbol.for(`slicc.transformers-env.vfs-enoent`);function x(e){if(typeof BroadcastChannel>`u`)return Promise.reject(Error(`Cannot read VFS path ${e}: BroadcastChannel unavailable in this realm`));let t=new BroadcastChannel(`preview-vfs`),n=`tfx-${Date.now()}-${Math.random().toString(36).slice(2)}`;return new Promise((r,i)=>{let a=e=>{t.removeEventListener(`message`,c),t.close(),e()},o,s=()=>{clearTimeout(o),o=setTimeout(()=>{let t=Error(`ENOENT: ${e} (preview-vfs responder timed out)`);t[b]=!0,a(()=>i(t))},v)};s();let c=t=>{let c=t.data;if(!c||c.id!==n)return;if(c.type===`preview-vfs-start`){s();return}if(c.type!==`preview-vfs-response`)return;if(clearTimeout(o),typeof c.error==`string`){let e=Error(c.error);c.error.includes(`ENOENT`)&&(e[b]=!0),a(()=>i(e));return}let l=c.content;if(l instanceof Uint8Array){a(()=>r(l));return}if(typeof l==`string`){a(()=>r(new TextEncoder().encode(l)));return}a(()=>i(Error(`Unexpected empty preview-vfs response for ${e}`)))};t.addEventListener(`message`,c),t.postMessage({type:`preview-vfs-read`,id:n,path:e,asText:!1})})}function S(e){return!!e?.[b]}function C(e){let t=new ArrayBuffer(e.byteLength),n=new Uint8Array(t);return n.set(e),n}function w(e,t){return!t||!e.startsWith(t)?null:`${f}${e.slice(t.length).split(`?`)[0].split(`#`)[0]}`}async function T(e,t){let n;try{n=await x(e)}catch(t){if(S(t))return new Response(`Not found: ${e}`,{status:404,headers:{"Content-Type":`text/plain`}});throw t}let r=i(e);return(t?.headers?new Headers(t.headers).get(`range`):null)===`bytes=0-0`?new Response(null,{status:206,headers:{"Content-Type":r,"Content-Length":String(n.byteLength),"Content-Range":`bytes 0-0/${n.byteLength}`}}):new Response(C(n),{status:200,headers:{"Content-Type":r,"Content-Length":String(n.byteLength)}})}var E=null;async function D(){if(typeof URL>`u`||typeof URL.createObjectURL!=`function`)throw Error(`onnxruntime-web blob URLs require URL.createObjectURL (browser realm only)`);let e={};if(await Promise.all(y.map(async t=>{try{let n=await x(`${d}${t}`),r=new Blob([C(n)],{type:i(t)});e[t]=URL.createObjectURL(r)}catch(e){if(!S(e))throw e}})),Object.keys(e).length===0)throw Error("onnxruntime-web is not installed — run `ipk add onnxruntime-web` to stage the wasm runtime in /workspace/node_modules/.");return e}function O(){return E||=D(),E}var k=`slicc_ort_num_threads`;function A(e){if(!e.isolated)return 1;let t=e.hardwareConcurrency,n=typeof t==`number`&&Number.isFinite(t)&&t>=1,r=n?Math.min(4,Math.floor(t)):4,i=e.override==null?NaN:Number.parseInt(e.override,10);return Number.isFinite(i)&&i>=1?Math.max(1,Math.min(r,i)):n?Math.max(1,r):1}function j(){let e=null;try{e=globalThis.localStorage?.getItem(`slicc_ort_num_threads`)??null}catch{}let t={isolated:globalThis.crossOriginIsolated===!0,hardwareConcurrency:globalThis.navigator?.hardwareConcurrency,override:e},n=A(t);return e!=null&&t.isolated&&console.warn(`[speech] ort-web numThreads=${n} forced by localStorage.${k}=${JSON.stringify(e)} — this persists until removed`),n}function M(t){let n=t.backends?.onnx?.wasm;if(n&&(n.wasmPaths=e(d),n.numThreads=j()),t.allowRemoteModels=!1,t.allowLocalModels=!0,t.localModelPath=e(f),u())return;t.allowRemoteModels=!0,t.remoteHost=t.localModelPath,t.remotePathTemplate=`{model}/`,n&&O().then(e=>{n.wasmPaths=e},()=>{});let r=t.fetch;if(r?.[l])return;let i=r,a=t.localModelPath,o=async(e,t)=>{let n=w(p(e),a);return n===null?!m(e)||g(e)?i?i(e,t):fetch(e,t):_(e,t):T(n,t)};o[l]=!0,t.fetch=o}async function N(e){let t=`weights for ${e} are missing — run \`hf download ${e}\` to fetch them into /workspace/models/.`;try{await x(`${f}${e}/config.json`)}catch(e){if(S(e))throw Error(t);let n=e instanceof Error?e.message:String(e);throw Error(`${t} (probe failed: ${n})`)}}export{s as a,c as i,M as n,o,O as r,N as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./base64-DJRlyqZu.js";import{f as n,p as r}from"./wc-follower-oauth-
|
|
1
|
+
import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./base64-DJRlyqZu.js";import{f as n,p as r}from"./wc-follower-oauth-B-LgkRB6.js";import{r as i}from"./tray-leader-BmmfZ-wo.js";var a=e(`tray-sidecar`),o=`slicc-sidecar`,s=4194304,c={exec:!1},l=class{onChunk;stdout=``;stderr=``;truncated=!1;units=0;constructor(e){this.onChunk=e}push(e,t){if(!(this.truncated||t.length===0)){if(this.units+=t.length,this.units>s){this.truncated=!0;return}e===`stdout`?this.stdout+=t:this.stderr+=t,this.onChunk?.({stream:e,text:t})}}result(e,t){return{stdout:this.truncated?`${this.stdout}\n[output truncated at cap]`:this.stdout,stderr:this.stderr,exitCode:e,...t?{error:t}:{},...this.truncated?{truncated:!0}:{}}}},u=class{name;handle=null;channel=null;unsubscribe=null;listeners=new Set;dropListeners=new Set;status=null;attachedAt=Date.now();currentJoinUrl;startPromise=null;constructor(e,t){this.name=e,this.currentJoinUrl=t}statusSink={get:()=>this.status??{state:`inactive`,joinUrl:this.currentJoinUrl,trayId:null,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:0,lastAttachCode:null,connectingSince:null,lastError:null},set:e=>{this.status=e}};get info(){let e=this.statusSink.get();return{name:this.name,joinUrl:this.currentJoinUrl,trayId:e.trayId,state:e.state,attachedAt:this.attachedAt,error:e.error}}get connected(){return this.channel!==null&&this.statusSink.get().state===`connected`}get dead(){return this.statusSink.get().state===`error`}async ready(){await(this.startPromise??Promise.resolve())}async start(e){return this.startPromise=new Promise((t,r)=>{let i=!1,a=setTimeout(()=>{i||(i=!0,this.stop(),r(Error(`timed out after ${Math.round(e/1e3)}s connecting to leader`)))},e);this.handle=n({joinUrl:this.currentJoinUrl,runtime:o,statusSink:this.statusSink,onJoinUrlChanged:e=>{this.currentJoinUrl=e}},{onConnected:e=>{this.wire(e.channel),!i&&(i=!0,clearTimeout(a),t())},onReconnecting:()=>{this.notifyDropped(`connection dropped; reconnecting`)},onGaveUp:e=>{this.notifyDropped(`reconnect gave up: ${e}`),!i&&(i=!0,clearTimeout(a),this.stop(),r(Error(e)))}})}),await this.startPromise}wire(e){let t=this.channel!==null;this.unsubscribe?.();let n=new r(e);this.channel=n,this.unsubscribe=n.onMessage(e=>this.dispatch(e)),n.send({type:`hello`,protocolVersion:8,runtime:o,capabilities:c}),a.info(t?`Sidecar reconnected`:`Sidecar attached`,{name:this.name}),t&&this.notifyDropped(`reconnected mid-request; the reply was lost`)}dispatch(e){if(e.type===`ping`){this.channel?.send({type:`pong`});return}if(e.type!==`pong`){if(e.type===`exec.request`){this.channel?.send({type:`exec.response`,requestId:e.requestId,exitCode:127,error:`slicc sidecar is a client-only attachment and does not accept exec`});return}for(let t of[...this.listeners])try{t(e)}catch(e){a.error(`Sidecar listener threw`,{name:this.name,error:e instanceof Error?e.message:String(e)})}}}send(e){return this.channel?.send(e)??!1}onMessage(e){return this.listeners.add(e),()=>this.listeners.delete(e)}onDropped(e){return this.dropListeners.add(e),()=>this.dropListeners.delete(e)}notifyDropped(e){for(let t of[...this.dropListeners])try{t(e)}catch{}}stop(){this.unsubscribe?.(),this.unsubscribe=null,this.channel?.close(),this.channel=null,this.handle?.cancel(),this.handle=null,this.notifyDropped(`detached`),this.listeners.clear(),this.dropListeners.clear()}};function d(e){let t;try{t=new URL(e)}catch{throw Error(`not a URL: ${e}`)}if(t.protocol!==`https:`&&t.protocol!==`http:`)throw Error(`join URL must be http(s): ${e}`);if(!t.pathname.includes(`/join/`))throw Error(`not a tray join URL (expected .../join/<token>): ${e}`);return t}function f(e){let t=i().session?.joinUrl;if(!t)return!1;try{let n=new URL(t);return n.origin===e.origin&&n.pathname===e.pathname}catch{return!1}}function p(e,t,n,r){return new Promise(i=>{let a=!1,o=null,s=null,c=null,l=null,u=null,d=(e,r,d)=>{a||(a=!0,c&&clearTimeout(c),l&&clearTimeout(l),o?.(),s?.(),u&&t.signal?.removeEventListener(`abort`,u),i({result:n.result(r,d),outcome:e}))},f={finish:(e,t)=>d(`complete`,e,t)};if(o=e.onMessage(e=>r(e,f)),s=e.onDropped(e=>d(`dropped`,1,`connection lost: ${e}`)),t.timeoutMs!==void 0){let e=Math.round(t.timeoutMs/1e3);c=setTimeout(()=>d(`abort`,124,`timed out after ${e}s`),t.timeoutMs)}if(t.expireMs!==void 0&&(l=setTimeout(()=>d(`expire`,0),t.expireMs)),t.signal){if(t.signal.aborted){d(`abort`,130,`interrupted`);return}u=()=>d(`abort`,130,`interrupted`),t.signal.addEventListener(`abort`,u,{once:!0})}})}var m=class{attachments=new Map;counter=0;list(){return[...this.attachments.values()].map(e=>e.info)}async attach(e){let t=d(e.joinUrl);if(f(t))throw Error(`refusing to attach to this instance's own tray — that would deadlock the leader thread`);let n=this.findByJoinUrl(t);if(n?.dead)a.info(`Replacing a dead sidecar attachment`,{name:n.name}),this.detach(n.name);else if(n){if(await n.ready(),!n.dead)return n.info;this.detach(n.name)}if(this.attachments.size>=8)throw Error(`too many sidecar attachments (8); detach one first`);let r=e.name??`slicc-${++this.counter}`;if(this.attachments.has(r))throw Error(`attachment '${r}' already exists`);let i=new u(r,t.toString());this.attachments.set(r,i);try{await i.start(e.connectTimeoutMs??3e4)}catch(e){throw this.attachments.delete(r),e}return i.info}detach(e){let t=this.attachments.get(e);return t?(t.stop(),this.attachments.delete(e),!0):!1}detachAll(){for(let e of[...this.attachments.keys()])this.detach(e)}findByJoinUrl(e){let t=`${e.origin}${e.pathname}`;return[...this.attachments.values()].find(e=>{try{let n=new URL(e.info.joinUrl);return`${n.origin}${n.pathname}`===t}catch{return!1}})}require(e){let t=this.attachments.get(e);if(!t)throw Error(`no such attachment: ${e}`);if(!t.connected)throw Error(`attachment '${e}' is not connected`);return t}async prompt(e,t,n={}){let r=this.require(e),i=new l(n.onChunk),a=!1,o=p(r,n,i,(e,t)=>{if(e.type===`agent_event`){let n=e.event;n.type===`content_delta`?i.push(`stdout`,n.text):n.type===`turn_end`?t.finish(0):n.type===`error`&&(i.push(`stderr`,`${n.error}\n`),t.finish(1));return}if(e.type===`status`){e.scoopStatus===`processing`?a=!0:a&&t.finish(0);return}e.type===`error`&&(i.push(`stderr`,`${e.error}\n`),t.finish(1))});if(!r.send({type:`user_message`,text:t,messageId:crypto.randomUUID(),...n.steer?{steer:!0}:{}}))return{stdout:``,stderr:``,exitCode:1,error:`failed to send user_message`};let{result:s,outcome:c}=await o;return c===`abort`&&r.send({type:`abort`}),s}async exec(e,n,r={}){let i=this.require(e),a=crypto.randomUUID(),o=new l(r.onChunk),s=new TextDecoder,c=new TextDecoder,u=p(i,r,o,(e,n)=>{if(e.type===`exec.chunk`&&e.requestId===a){let n;try{n=t(e.data)}catch{return}let r=e.stream===`stdout`?s:c;o.push(e.stream,r.decode(n,{stream:!0}));return}e.type===`exec.response`&&e.requestId===a&&(o.push(`stdout`,s.decode()),o.push(`stderr`,c.decode()),n.finish(e.exitCode,e.error))});if(!i.send({type:`exec.request`,requestId:a,command:n,...r.cwd?{cwd:r.cwd}:{},...r.env?{env:r.env}:{},...r.stdin?{stdin:r.stdin}:{}}))return{stdout:``,stderr:``,exitCode:1,error:`failed to send exec.request`};let{result:d,outcome:f}=await u;return f===`abort`&&i.send({type:`exec.signal`,requestId:a,signal:`SIGINT`}),d}async watch(e,t){let n=this.require(e),r=new l(t.onChunk),i=!1,{result:a}=await p(n,{...t,timeoutMs:void 0,expireMs:t.durationMs},r,(e,n)=>{if(e.type===`user_message_echo`){r.push(`stdout`,`\n> ${e.text}\n`);return}if(e.type===`agent_event`){if(t.scoopJid&&e.scoopJid!==t.scoopJid)return;r.push(`stdout`,h(e.event));return}if(e.type===`status`){if(t.scoopJid&&e.scoopJid!==t.scoopJid)return;e.scoopStatus===`processing`?i=!0:i&&t.untilIdle&&n.finish(0);return}e.type===`error`&&r.push(`stderr`,`${e.error}\n`)});return a}};function h(e){switch(e.type){case`content_delta`:return e.text;case`tool_use_start`:return`\n[tool] ${e.toolName} ${g(e.toolInput)}\n`;case`tool_result`:return`[${e.isError?`tool-error`:`tool-ok`}] ${_(e.result,200)}\n`;case`turn_end`:return`
|
|
2
2
|
`;case`error`:return`[error] ${e.error}\n`;default:return``}}function g(e){if(e==null)return``;try{return _(JSON.stringify(e),120)}catch{return``}}function _(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}export{m as SidecarRegistry};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e,g as t}from"./db-DSIYsBgP.js";import{n}from"./slicc-version-
|
|
1
|
+
import{D as e,g as t}from"./db-DSIYsBgP.js";import{n}from"./slicc-version-BhF_V6lj.js";const r=`slicc:last-seen-version`;function i(){let{version:e,releasedAt:t}=n();return{version:e,releasedAt:t}}async function a(){let e=await t(r);return e&&e.length>0?e:null}async function o(t){await e(r,t)}async function s(){let e=i(),t=await a();return t===null?(await o(e.version),{bundled:e,lastSeen:null,isUpgrade:!1}):t===e.version?{bundled:e,lastSeen:t,isUpgrade:!1}:{bundled:e,lastSeen:t,isUpgrade:!0}}async function c(e){await o(e)}export{s as detectUpgrade,a as getLastSeenVersion,c as recordVersionSeen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./logger-DDBAeTLF.js";import{K as t,W as n}from"./wc-shortcuts-
|
|
1
|
+
import{t as e}from"./logger-DDBAeTLF.js";import{K as t,W as n}from"./wc-shortcuts-BU_YGmdb.js";import{hasVoiceForLang as r,speak as i,speechTextFromMarkdown as a}from"./speak-DHglNoiP.js";var o=e(`speech:voice-reply`),s=0;function c(){s++}function l(){return s<=0?!1:(s--,!0)}async function u(e,s=i,c=r){let l=n(e);if(l&&!await c(l))return;let u=a(t(e));if(u)try{await s(l?{text:u,lang:l}:{text:u})}catch(e){o.warn(`spoken reply failed`,e)}}export{l as consumeVoiceSubmission,c as markVoiceSubmission,u as speakReplyMarkdown};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shortcuts-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shortcuts-BU_YGmdb.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/account-store-igNbS3Ak.js","assets/preload-helper-Czpn1I53.js","assets/claude-model-version-CSATLzrT.js","assets/models-BSkXF4T6.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-B-zmcypy.js","assets/libesm-BypnjKEL.js","assets/logger-DDBAeTLF.js","assets/base64-DJRlyqZu.js","assets/proxied-fetch-DyBveeCl.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/float-topology-YtctpJaG.js","assets/secret-topology-DLJBhHOi.js","assets/secrets-bridge-client--VZ3E0yk.js","assets/port-bridge-client-Dn8JtUyP.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-70klvlGo.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/icons-Df1OSRR-.js","assets/wc-secret-request-BNTQEHzM.js","assets/secret-request-registry-DrOMKR1H.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{t as e}from"./preload-helper-Czpn1I53.js";import{r as t,t as n}from"./base64-DJRlyqZu.js";import{t as r}from"./permissions-surface-registry-CilCRwhh.js";var i=8,a=2e3,o=[`/workspace`,`/shared`,`/tmp`],s=8,c=new Set([`node_modules`,`.git`]),l=1e4,u=/\.(png|jpe?g|gif|webp|svg|avif)$/i,d=4194304,f=262144;function p(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function m(e){return{png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,avif:`image/avif`,md:`text/markdown`,json:`application/json`}[e.toLowerCase().split(`.`).pop()??``]??`text/plain`}function h(e,n){let r={id:p(),name:e,size:n.length};if(u.test(e))return n.length>d?{...r,mimeType:m(e),kind:`image`,error:`image too large to inline`}:{...r,mimeType:m(e),kind:`image`,data:t(n)};let i={...r,mimeType:m(e),kind:`file`};return n.length>f?{...i,error:`file too large to inline`}:i}async function g(e){let t=new Uint8Array(await e.arrayBuffer()),n=h(e.name,t);return e.type?{...n,mimeType:e.type}:n}function _(e,t){let n=t.match(/^data:(image\/[^;]+);base64,(.+)$/);return n?{id:p(),name:e,mimeType:n[1],size:Math.floor(n[2].length*3/4),kind:`image`,data:n[2]}:null}var v=`/tmp/upload`,y=1568;async function b(e,t,n){await e.mkdir(v,{recursive:!0}).catch(()=>void 0);let r=`${v}/${Date.now()}-${t.replace(/[^A-Za-z0-9._-]+/g,`_`)}`;return await e.writeFile(r,n),r}async function x(e,t=y){let n=new Image;n.src=e;try{await n.decode()}catch{return e}let r=Math.min(1,t/Math.max(n.naturalWidth,n.naturalHeight,1));if(r>=1)return e;let i=document.createElement(`canvas`);return i.width=Math.round(n.naturalWidth*r),i.height=Math.round(n.naturalHeight*r),i.getContext(`2d`)?.drawImage(n,0,0,i.width,i.height),i.toDataURL(`image/jpeg`,.85)}async function S(e,t,r){let i=_(e,t);if(!i)return null;let a;return r&&i.data&&(a=await b(r,e,n(i.data)).catch(()=>void 0)),{..._(e,await x(t).catch(()=>t))??i,name:e,path:a}}async function C(e,t,n){if(!n)return null;let r=new Uint8Array(await t.arrayBuffer()),i=await b(n,e,r).catch(()=>void 0);return i?{id:p(),name:e,mimeType:t.type||`video/webm`,size:r.length,kind:`file`,path:i}:null}async function w(e){let t=[],n=o.map(e=>({dir:e,depth:0}));for(;n.length>0&&t.length<a;){let{dir:r,depth:i}=n.shift(),o;try{o=await e.readDir(r)}catch{continue}for(let e of o){let o=`${r}/${e.name}`;if(e.type===`directory`)i<s&&!c.has(e.name)&&n.push({dir:o,depth:i+1});else if(t.push(o),t.length>=a)break}}return t}function T(e){let t=null;return async n=>{let r=await e.openReader();(!t||Date.now()-t.at>l)&&(t={at:Date.now(),paths:await w(r)});let a=e=>n===``||e.toLowerCase().includes(n),o=t.paths.filter(e=>a(e)).slice(0,i).map(e=>({id:e,label:e.split(`/`).pop()??e,sub:e.slice(0,e.lastIndexOf(`/`))})),s=[];try{s=(await r.readDir(`/workspace/skills`)).filter(e=>e.type===`directory`&&a(e.name)).slice(0,i).map(e=>({id:e.name,label:e.name}))}catch{}let c=(await e.listConversations().catch(()=>[])).filter(e=>a(e.label)).slice(0,i);return[{kind:`file`,label:`Files`,icon:`file`,entries:o},{kind:`skill`,label:`Skills`,icon:`sparkles`,entries:s},{kind:`conversation`,label:`Conversations`,icon:`message-square`,entries:c}]}}var E=`slicc-wc-attach-style`,D=`
|
|
3
3
|
.wcatt{display:flex;flex-wrap:wrap;gap:6px;padding:8px 10px 0;font-family:var(--ui);}
|
|
4
4
|
.wcatt:empty{display:none;}
|
|
@@ -10,4 +10,4 @@ import{t as e}from"./preload-helper-Czpn1I53.js";import{r as t,t as n}from"./bas
|
|
|
10
10
|
.wcatt__x{appearance:none;background:none;border:none;cursor:pointer;color:var(--txt-3);
|
|
11
11
|
font:inherit;padding:0;line-height:1;}
|
|
12
12
|
.wcatt__x:hover{color:var(--ink);}
|
|
13
|
-
`,O=class{#e;#t=[];constructor(e){if(!document.getElementById(E)){let e=document.createElement(`style`);e.id=E,e.textContent=D,document.head.appendChild(e)}this.#e=document.createElement(`div`),this.#e.className=`wcatt`,e.prepend(this.#e)}get items(){return this.#t}add(e){this.#t.push(e),this.#n()}take(){let e=this.#t;return this.#t=[],this.#n(),e}#n(){this.#e.replaceChildren(...this.#t.map(e=>this.#r(e)))}#r(t){let n=document.createElement(`span`);if(n.className=`wcatt__chip`,t.kind===`image`&&t.data){let r=document.createElement(`img`);r.className=`wcatt__thumb`,r.src=`data:${t.mimeType};base64,${t.data}`,r.alt=t.name,r.addEventListener(`click`,()=>{e(async()=>{let{SliccImagePreview:e}=await import(`./wc-shortcuts-
|
|
13
|
+
`,O=class{#e;#t=[];constructor(e){if(!document.getElementById(E)){let e=document.createElement(`style`);e.id=E,e.textContent=D,document.head.appendChild(e)}this.#e=document.createElement(`div`),this.#e.className=`wcatt`,e.prepend(this.#e)}get items(){return this.#t}add(e){this.#t.push(e),this.#n()}take(){let e=this.#t;return this.#t=[],this.#n(),e}#n(){this.#e.replaceChildren(...this.#t.map(e=>this.#r(e)))}#r(t){let n=document.createElement(`span`);if(n.className=`wcatt__chip`,t.kind===`image`&&t.data){let r=document.createElement(`img`);r.className=`wcatt__thumb`,r.src=`data:${t.mimeType};base64,${t.data}`,r.alt=t.name,r.addEventListener(`click`,()=>{e(async()=>{let{SliccImagePreview:e}=await import(`./wc-shortcuts-BU_YGmdb.js`).then(e=>e.m);return{SliccImagePreview:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])).then(({SliccImagePreview:e})=>e.show(r.src,r))}),n.append(r)}let r=document.createElement(`span`);r.className=`wcatt__name`,r.textContent=t.name;let i=document.createElement(`button`);return i.type=`button`,i.className=`wcatt__x`,i.setAttribute(`aria-label`,`Remove ${t.name}`),i.textContent=`×`,i.addEventListener(`click`,()=>{this.#t=this.#t.filter(e=>e.id!==t.id),this.#n()}),n.append(r,i),n}};async function k(e){let t=document.createElement(`video`);t.srcObject=e,t.muted=!0;try{await t.play(),await new Promise(e=>requestAnimationFrame(()=>e(null)));let e=document.createElement(`canvas`);return e.width=t.videoWidth,e.height=t.videoHeight,e.width===0||e.height===0?null:(e.getContext(`2d`)?.drawImage(t,0,0),e.toDataURL(`image/png`))}finally{for(let t of e.getTracks())t.stop();t.srcObject=null}}async function A(){let e=r();if(e){let t=await e.request(`screenshare`,{constraints:{video:!0}});if(!t)return null;let n=t.stream;return k(n)}return k(await navigator.mediaDevices.getDisplayMedia({video:!0}))}async function j(e,t){let n=r();if(!n)return null;let i=await n.prompt({kinds:e,description:t,skipIfGranted:!0});for(let e of i.grants)if(e.kind===`camera`||e.kind===`microphone`||e.kind===`screenshare`)for(let t of e.stream.getTracks())t.stop();return i.status===`granted`}var M=`slicc_camera_device`,N=`slicc_microphone_device`,P=[`position:absolute`,`left:50%`,`right:auto`,`transform:translateX(-50%)`,`bottom:56px`,`width:calc(100% - 32px)`,`max-width:680px`,`z-index:3`].join(`;`);async function F(e,t){if(await j([`camera`,`microphone`],`Slicc is requesting access to your camera and microphone to capture a photo or video for this conversation.`)===!1)return null;let n=document.createElement(`slicc-composer-capture`),r=localStorage.getItem(M);r&&n.setAttribute(`preferred-device`,r);let i=localStorage.getItem(N);i&&n.setAttribute(`preferred-audio-device`,i),n.style.cssText=P,n.hidden=!0,n.addEventListener(`slicc-capture-device-change`,e=>{let t=e.detail;if(!t?.deviceId)return;let n=t.kind===`microphone`?N:M;localStorage.setItem(n,t.deviceId)}),e.append(n);try{return await n.open(t)}finally{n.remove()}}async function I(e,t,n){if(!e.dataUrl)return;let r=`photo-${Date.now()}.png`,i=await t.openWriter?.().catch(()=>null)??null,a=await S(r,e.dataUrl,i);a&&n.add(a)}async function L(e,t,n){if(!e.blob)return;let r=/webm/i.test(e.mimeType)?`webm`:`bin`,i=`video-${Date.now()}.${r}`,a=await t.openWriter?.().catch(()=>null)??null,o=await C(i,e.blob,a);o&&n.add(o)}async function R(e,t,n){if(e.mode===`photo`){if(!t.composer){let e=await z();if(!e)return;let r=await S(`photo-${Date.now()}.png`,e,await t.openWriter?.().catch(()=>null)??null);r&&n.add(r);return}let e=await F(t.composer,`photo`);if(!e)return;e.kind===`image`?await I(e,t,n):e.kind===`video`&&await L(e,t,n);return}let r=await A();if(!r)return;let i=await S(`screenshot-${Date.now()}.png`,r,await t.openWriter?.().catch(()=>null)??null);i&&n.add(i)}async function z(){if(await j([`camera`],`Slicc is requesting access to your camera to capture a photo for this conversation.`)===!1)return null;let e=document.createElement(`slicc-camera-dialog`),t=localStorage.getItem(M);t&&e.setAttribute(`preferred-device`,t),e.addEventListener(`slicc-camera-device-change`,e=>{let t=e.detail?.deviceId;t&&localStorage.setItem(M,t)}),document.body.append(e);try{return await e.open()}finally{e.remove()}}async function B(e,t,n){let r=await n.openWriter?.().catch(()=>null)??null,i=r?await b(r,e.name,t).catch(()=>void 0):void 0;return i?{...e,error:void 0,path:i}:e.kind===`image`?e:{...e,error:`could not be saved to the virtual filesystem`}}async function V(e,t,n){let r=await(await t()).readFile(e,{encoding:`binary`});return typeof r==`string`?(n.error(`VFS image pick returned text, not bytes — skipping the inline copy`,e),null):r}async function H(e,t,n){let r=0;try{r=(await(await n()).stat(e)).size}catch{}return{id:p(),name:t,mimeType:m(t),size:r,kind:`file`,path:e}}async function U(e,t,n,r){let i=e.split(`/`).pop()??e;if(u.test(i)){let a=await V(e,t,r);if(a){let t=h(i,a);n.add({...t,error:void 0,path:e});return}}n.add(await H(e,i,t))}function W(e,t){let n=t.value??t.getAttribute(`value`)??``,r=n&&!n.endsWith(` `)?` `:``;t.setAttribute(`value`,`${n}${r}${e}`)}function G(e,t){W(`Use the "${e}" skill: `,t)}async function K(t){let{requestSecretFromUser:n}=await e(async()=>{let{requestSecretFromUser:e}=await import(`./wc-secret-request-BNTQEHzM.js`);return{requestSecretFromUser:e}},__vite__mapDeps([26,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,0,25,27])),r=await n();if(!r.stored)return;let i=r.domains.join(`, `),a=r.persisted?`saved`:`this session only`;W(r.maskedValue?`I stored the secret ${r.name} (masked value ${r.maskedValue}, scope: ${i}, ${a}). Use the masked value — SLICC swaps in the real one at the network boundary. `:`I stored the secret ${r.name} (scope: ${i}, ${a}). Run \`secret get ${r.name}\` for its masked value. `,t.inputCard)}function q(e){return e?.name===`NotAllowedError`}async function J(e,t,n){if(e.kind===`upload`&&e.file instanceof File){let r=new Uint8Array(await e.file.arrayBuffer());n.add(await B(await g(e.file),r,t))}else e.kind===`capture`?await R(e,t,n):e.kind===`file`&&typeof e.id==`string`&&t.openReader?await U(e.id,t.openReader,n,t.log):e.kind===`secret`?await K(t):e.kind===`skill`&&typeof e.label==`string`?G(e.label,t.inputCard):e.kind===`conversation`&&typeof e.id==`string`&&t.freezer.dispatchEvent(new CustomEvent(`freezer-card-select`,{bubbles:!0,composed:!0,detail:{slug:e.id}}))}function Y(e){let{inputCard:t,log:n}=e,r=new O(t),i=t.querySelector(`slicc-add-menu`);return i&&(e.openReader?i.provider=T({openReader:e.openReader,listConversations:e.listConversations??(async()=>[])}):i.results=[],i.setAttribute(`global-drop`,``),e.noCamera&&i.setAttribute(`no-camera`,``),e.secretEntry&&i.setAttribute(`secret-action`,``)),t.addEventListener(`slicc-add`,t=>{let i=t.detail;i&&J(i,e,r).catch(e=>{q(e)||n.error(`WC add-menu action failed`,e)})}),t.addEventListener(`paste`,t=>{let i=t.clipboardData?.items;if(i)for(let a of Array.from(i)){if(!a.type.startsWith(`image/`))continue;let i=a.getAsFile();if(!i)continue;t.preventDefault();let o=(i.type.split(`/`)[1]||`png`).replace(/[^a-z0-9]/gi,``)||`png`,s=i.name?i:new File([i],`pasted-image.${o}`,{type:i.type});J({kind:`upload`,name:s.name,size:s.size,file:s},e,r).catch(e=>n.error(`Paste image failed`,e))}}),r}export{Y as wireWcAttach};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-
|
|
2
|
-
import{t as e}from"./preload-helper-Czpn1I53.js";import{C as t,S as n,b as r,r as i,t as a,y as o}from"./wc-live-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-0FLLRgpr.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/modulepreload-polyfill-P2Xu9kJm.js","assets/account-store-igNbS3Ak.js","assets/preload-helper-Czpn1I53.js","assets/claude-model-version-CSATLzrT.js","assets/models-BSkXF4T6.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-B-zmcypy.js","assets/libesm-BypnjKEL.js","assets/logger-DDBAeTLF.js","assets/base64-DJRlyqZu.js","assets/proxied-fetch-DyBveeCl.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/float-topology-YtctpJaG.js","assets/secret-topology-DLJBhHOi.js","assets/secrets-bridge-client--VZ3E0yk.js","assets/port-bridge-client-Dn8JtUyP.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-70klvlGo.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/bridge-protocol-06nbmp2X.js","assets/messages-zAgr7E2T.js","assets/tray-runtime-config-B9jN9kUJ.js","assets/telemetry-DJyRzh6X.js","assets/feature-flags-CYCRk6Dq.js","assets/tray-follower-status-BAjnN7Ar.js","assets/clipboard-eqmn97SP.js","assets/tray-join-url-BIvzbiFR.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-Czpn1I53.js";import{C as t,S as n,b as r,r as i,t as a,y as o}from"./wc-live-Ts1bLhjx.js";import{wireWcDetached as s}from"./wc-detached-F7FTH1YG.js";async function c(c,l,u=!1){let d;await i(c,l,{floatKind:`extension`,connect:e=>{d=new t(o(e.wiring));let i=n(d);return{client:r(e.wiring),host:i,workbench:(e,t)=>{a(e,d,t,i,l)}}}}),s({client:d,isDetachedSelf:u});let{setupSudoExtension:f}=await e(async()=>{let{setupSudoExtension:e}=await import(`./main-0FLLRgpr.js`).then(e=>e.i);return{setupSudoExtension:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]));await f({log:l}),d.requestState(),l.info(`WC extension shell connected to offscreen engine`)}export{c as bootExtensionFloat};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shortcuts-
|
|
2
|
-
import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{n}from"./transcript-export-DP-r8eDz.js";import{a as r,c as i,n as a,t as o,v as s,y as c}from"./wc-follower-oauth-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shortcuts-BU_YGmdb.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/account-store-igNbS3Ak.js","assets/preload-helper-Czpn1I53.js","assets/claude-model-version-CSATLzrT.js","assets/models-BSkXF4T6.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-B-zmcypy.js","assets/libesm-BypnjKEL.js","assets/logger-DDBAeTLF.js","assets/base64-DJRlyqZu.js","assets/proxied-fetch-DyBveeCl.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/float-topology-YtctpJaG.js","assets/secret-topology-DLJBhHOi.js","assets/secrets-bridge-client--VZ3E0yk.js","assets/port-bridge-client-Dn8JtUyP.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-70klvlGo.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/icons-Df1OSRR-.js","assets/panelize-shell-B59FHf_a.js","assets/virtual-device-paths-D45tpPP6.js","assets/layout-apply-registry-Cw730jao.js","assets/wc-live-Ts1bLhjx.js","assets/sprinkle-renderer-CeGc4B0L.js","assets/hid-device-registry-B2R-0rNt.js","assets/serial-port-registry-CCqklAEr.js","assets/usb-operations-BsAiCAWF.js","assets/usb-device-registry-DmUBqrA-.js","assets/shared-mBEktoxE.js","assets/mime-types-D0xZwlMO.js","assets/theme-DFKCBK8N.js","assets/theme-engine-B5SkYf3E.js","assets/slugify-BYJ6QVAt.js","assets/transcript-export-DP-r8eDz.js","assets/session-jsonl-BCOxqyX1.js","assets/types-Dgm4REV3.js","assets/tray-runtime-config-B9jN9kUJ.js","assets/bridge-protocol-06nbmp2X.js","assets/messages-zAgr7E2T.js","assets/telemetry-DJyRzh6X.js","assets/feature-flags-CYCRk6Dq.js","assets/tray-follower-status-BAjnN7Ar.js","assets/main-0FLLRgpr.js","assets/modulepreload-polyfill-P2Xu9kJm.js","assets/clipboard-eqmn97SP.js","assets/tray-join-url-BIvzbiFR.js","assets/src-BWaKqLvQ.js","assets/provider-budget-LCzMPlKv.js","assets/permissions-surface-registry-CilCRwhh.js","assets/browser-DGwroBSO.js","assets/tray-leader-BmmfZ-wo.js","assets/record-CCQFJXn_.js","assets/wc-shell-S_KQG-ZJ.js","assets/wc-shell-WkeczD9x.css","assets/wc-unit-context-DhQqWVxs.js","assets/legacy-styles-B3nS5QUo.js","assets/follower-navigate-watcher-DnnHgZbM.js","assets/navigation-watcher-BpA1OwJw.js","assets/discovery-preference-Bw3Fi0jd.js","assets/wc-transcript-export-DRwVoKZj.js","assets/export-spool-CuNzzI8a.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{n}from"./transcript-export-DP-r8eDz.js";import{a as r,c as i,n as a,t as o,v as s,y as c}from"./wc-follower-oauth-B-LgkRB6.js";import{d as l,m as u,p as d,s as ee,u as te}from"./tray-runtime-config-B9jN9kUJ.js";import{m as ne,r as re,x as f}from"./wc-live-Ts1bLhjx.js";import{r as p,t as m}from"./feature-flags-CYCRk6Dq.js";import{a as ie,t as ae}from"./tray-follower-status-BAjnN7Ar.js";import{r as oe}from"./main-0FLLRgpr.js";import{n as se}from"./theme-engine-B5SkYf3E.js";import{d as ce}from"./wc-unit-context-DhQqWVxs.js";import{WcSprinkleZone as le}from"./wc-sprinkles-l4l891y6.js";import{wireWcAttach as ue}from"./wc-attach-BBHTF92w.js";import{installLeaderPermissionsSurface as de}from"./wc-permissions-Ch85s0Vv.js";var h=t(`follower-switch-out`);function fe(e,t){t.stopFollower();try{t.storage.removeItem(d),e.workerBaseUrl===null?t.storage.removeItem(u):t.storage.setItem(u,e.workerBaseUrl)}catch(e){h.error(`follower switch-out: storage write failed — state may revert on reload`,{error:e instanceof Error?e.message:String(e)})}try{let e=t.getHref(),n=l(e);n!==e&&t.replaceHref(n)}catch(e){h.error(`follower switch-out: URL normalize failed — may re-enter follower on reload`,{error:e instanceof Error?e.message:String(e)})}t.reload()}var g=6;function pe(e){let{refs:t,getSync:n,getTargets:r,hasCdpBrowser:i,log:a}=e;if(t.overlaySurfaces.has(`browser`))return{overlay:document.createElement(`slicc-tab-overlay`),refresh:()=>{}};let o=document.createElement(`slicc-tab-overlay`);o.setAttribute(`heading`,`Browser · tabs in this tray`),o.setAttribute(`no-peek`,``),document.body.append(o);let s=()=>{o.tabs=r().map(e=>({id:e.targetId,title:e.title||e.url||e.targetId,url:e.url}))};return t.overlaySurfaces.add(`browser`),t.dock.addEventListener(`slicc-dock-select`,e=>{e.detail?.id===`browser`&&(s(),o.show(),t.dock.collapse?.())}),o.addEventListener(`tab-activate`,t=>{let r=t.detail.id,s=n(),c=s?.getLeaderProtocolVersion()??0;if(!(s&&i()&&c>=g)){let t=o.tabs.find(e=>e.id===r)?.url;if(!t){a.warn(`WC follower browser: no URL for tab`,{id:r});return}e.window.open(t,`_blank`,`noopener`)||a.warn(`WC follower browser: window.open was blocked`,{id:r}),o.hide();return}s.requestTabTeleport(r).then(e=>{a.info(`WC follower browser: leader teleported a tab here`,{source:r,targetId:e}),o.hide()}).catch(e=>{a.error(`WC follower browser: tab teleport failed`,e)})}),{overlay:o,refresh:s}}var _=new Set([`oauth-attempt`,`connect-attempt`,`device-code-decision`]);function me(e){return _.has(e)}var v=`slicc-signin-redirect-style`,y=`wc-signin-redirect`,b=`${y}--welcome`,x=`
|
|
3
3
|
.${y}{display:flex;gap:10px;align-items:flex-start;margin:10px 12px;padding:12px 14px;
|
|
4
4
|
border:1px solid var(--line);border-radius:12px;background:var(--ghost);color:var(--ink);
|
|
5
5
|
font-family:var(--ui);font-size:13px;line-height:1.4;}
|
|
@@ -14,4 +14,4 @@ import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF
|
|
|
14
14
|
.${y}__x:hover{color:var(--ink);}
|
|
15
15
|
`;function S(e){if(e.getElementById(v))return;let t=e.createElement(`style`);t.id=v,t.textContent=x,e.head.appendChild(t)}function C(e,t){S(e);let n=e.createElement(`div`);n.className=y,n.setAttribute(`role`,`status`);let r=e.createElement(`div`);r.className=`${y}__body`;let i=e.createElement(`div`);i.className=`${y}__title`,i.textContent=t.title;let a=e.createElement(`div`);a.className=`${y}__sub`,a.textContent=t.sub,r.append(i,a);let o=e.createElement(`button`);if(o.type=`button`,o.className=`${y}__open`,o.textContent=t.buttonLabel,o.addEventListener(`click`,()=>t.onOpenTab()),n.append(r,o),t.dismissible){let t=e.createElement(`button`);t.type=`button`,t.className=`${y}__x`,t.setAttribute(`aria-label`,`Dismiss`),t.textContent=`×`,t.addEventListener(`click`,()=>n.remove()),n.append(t)}return n}function he(e,t){let n=e.ownerDocument;t.onOpenTab();let r=e.querySelector(`.${y}`);if(r)return r.scrollIntoView?.({block:`nearest`}),r;let i=C(n,{title:`Sign in from the SLICC tab`,sub:`The side panel can't complete a provider login — we've switched you to the main SLICC tab. Finish signing in there (Settings › Providers), then come back.`,buttonLabel:`Open SLICC tab`,onOpenTab:t.onOpenTab,dismissible:!0});return e.append(i),i.scrollIntoView?.({block:`nearest`}),i}function ge(e,t){let n=C(e,{title:`Set up SLICC in the main tab`,sub:`SLICC needs a model connected before it can help. Open the main SLICC tab to finish setup and sign in, then come back to the side panel.`,buttonLabel:`Open SLICC tab`,onOpenTab:t.onOpenTab,dismissible:!1});return n.classList.add(b),n}var w=t(`wc-follower`),_e=`/shared/sprinkles/welcome/`,ve=`/shared/sprinkles/suggestions/`;function ye(e){return e===void 0||e===`active`?{kind:`active`}:e.trim()===``?null:{kind:`frozen`,sessionId:e}}function be(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);let n=document.createElement(`div`);n.style.cssText=`padding:2rem;text-align:center;font-family:system-ui;`;let r=document.createElement(`h1`);r.style.color=`var(--s2-negative, #e34850)`,r.textContent=`Could not start follower`;let i=document.createElement(`p`);i.style.color=`var(--s2-content-tertiary, #717171)`,i.textContent=t,n.append(r,i),e.appendChild(n)}function xe(e,t,n,r,i){let a=e=>{let t=document.createElement(`div`);return t.className=`wcui-placeholder`,t.textContent=e,t};i.files?(e.style.display=`none`,e.parentElement?.append(a(`Files live on the leader. A follower mirrors the leader's chat, sprinkles, and browser tabs - not its filesystem.`))):e.closest(`slicc-surface`)?.remove(),i.terminal?t.append(a(`The shell runs on the leader. A follower has no local terminal - drive the session through chat.`)):t.closest(`slicc-surface`)?.remove(),i.memory?n.append(a(`Memory lives on the leader. A follower has no local memory store.`)):n.closest(`slicc-surface`)?.remove(),i.monitor?(r.style.display=`none`,r.parentElement?.append(a(`Monitor reads the leader's kernel state. A follower has no local kernel.`))):r.closest(`slicc-surface`)?.remove()}var T={terminal:!0,files:!0,memory:!0,browser:!0,modelPicker:!0,history:!0,nav:!0,monitor:!0,showTimestamps:!0};function Se(e){let t=[];for(let[n,r]of[[`terminal`,`term`],[`files`,`files`],[`memory`,`memory`],[`browser`,`browser`],[`monitor`,`monitor`]])e[n]||t.push(`slicc-dock-item[data-t="${r}"]`);if(e.modelPicker||t.push(`slicc-composer-meta`),e.history||t.push(`slicc-freezer`),e.nav||t.push(`slicc-nav`),!e.terminal&&!e.files&&!e.memory&&!e.browser&&!e.monitor&&t.push(`slicc-dock .div`,`slicc-dock .grow`),t.length||!e.history){let n=document.createElement(`style`),r=t.length?`${t.join(`,
|
|
16
16
|
`)}{display:none!important;}`:``;e.history||(r+=`
|
|
17
|
-
.wcui-appcol{padding-left:0!important;}`),n.textContent=r,document.head.append(n)}}function E(e,t){return e&&!t}async function D(t,n,r){let[{parseLayoutDocument:i},{panelizeShell:a}]=await Promise.all([e(()=>import(`./wc-shortcuts-p6BtQ0R3.js`).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])),e(()=>import(`./panelize-shell-C0m6TyBn.js`),__vite__mapDeps([26,11,0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28]))]),o=i(n);if(`error`in o){r.warn(`follower: host-pushed layout failed validation — keeping the default`,{error:o.error});return}a(t.refs,o),r.info(`follower: applied host-pushed layout document`,{id:o.id,locked:o.locked===!0})}async function Ce(e,t,n){if(n&&t.cherryTransport?.flags)try{let e=JSON.parse(t.cherryTransport.flags);e&&typeof e==`object`&&!Array.isArray(e)&&m(e)}catch(e){w.warn(`follower: host-pushed flags were not valid JSON — ignoring`,e)}let r=p(`panel-layouts`);if(e.refs.dockTree.tilesMovable=r,n&&t.cherryTransport?.layout)try{let n=JSON.parse(t.cherryTransport.layout);n&&typeof n==`object`&&`base`in n?r?await D(e,n,w):w.warn(`follower: ignoring host-pushed layout — the panel-layouts flag is off`):e.refs.dockTree.setTree(n)}catch(e){w.warn(`follower: host-pushed layout was not valid JSON — keeping the default`,e)}}async function O(t,l,u){let d=u===`cherry`,m=d&&new URLSearchParams(window.location.search).get(`ui-only`)===`1`,h=window.location.ancestorOrigins?.[0],g=d&&(h?.startsWith(`chrome-extension://`)??!1),_;try{_=await oe({runtimeMode:u,envBaseUrl:null,window,log:l})}catch(e){let n=e instanceof Error?e.message:String(e);w.error(`follower prelude failed`,{runtimeMode:u,error:n}),be(t,n);return}let v=d?_.cherryJoinUrl:ee(window.location.href,window.localStorage);if(!v){w.error(`follower mount with no join URL - falling back to live boot`);let{bootLeaderFloat:n}=await e(async()=>{let{bootLeaderFloat:e}=await import(`./wc-live-BdztSz08.js`).then(e=>e.n);return{bootLeaderFloat:e}},__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,0,25,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61]));return n(t,l,`standalone`)}let y=d?`cherry`:g?`extension`:`standalone`,x,S,C,D=new Set,O=null,k=null,A=()=>_.cherryTransport?.emitSliccEventToHost(`slicc.open-leader-tab`),j=()=>{g&&he(x.refs.thread,{onOpenTab:A})},we=e=>{let t=e.querySelectorAll(`img[src^="${_e}"]`);return t.length!==0&&(t.forEach((t,n)=>{n===0&&!M?t.replaceWith(ge(e.ownerDocument,{onOpenTab:A})):t.remove()}),!0)},M=!1,Te=e=>{let t=e.querySelectorAll(`img[src^="${ve}"]`);if(t.length!==0){for(let e of t)e.remove();M=!0;for(let e of x.refs.thread.querySelectorAll(`.${b}`))e.remove()}},N=(await re(t,l,{floatKind:y,connect:async t=>{x=t,d&&_.cherryTransport?.theme&&se(_.cherryTransport.theme),await Ce(x,_,d);let n=d&&_.cherryTransport?.effortLevel;n?localStorage.setItem(`slicc_locked_effort_level`,n):localStorage.removeItem(`slicc_locked_effort_level`),S=d&&_.cherryTransport?{...T,..._.cherryTransport.features}:T,xe(x.refs.fileTree,x.refs.termSurface,x.refs.memoryHost,x.refs.monitor,S),Se(S),e(async()=>{let{applyTimestampVisibility:e,initTimestampPreference:t}=await import(`./wc-shortcuts-p6BtQ0R3.js`).then(e=>e.R);return{applyTimestampVisibility:e,initTimestampPreference:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])).then(({applyTimestampVisibility:e,initTimestampPreference:t})=>{S.showTimestamps?t():e(!1)}),e(async()=>{let{loadDipStyles:e,loadSprinkleStyles:t}=await import(`./legacy-styles-B3nS5QUo.js`);return{loadDipStyles:e,loadSprinkleStyles:t}},__vite__mapDeps([62,3])).then(({loadDipStyles:e,loadSprinkleStyles:t})=>Promise.all([e(),t()])).catch(()=>void 0),C=new a({getSync:()=>J?.currentSync??null});let r=f({getSync:()=>J?.currentSync??null,onAgentEvent:e=>(D.add(e),()=>D.delete(e)),onAgentError:e=>{w.warn(`follower send failed`,{error:e}),N.controller.addAssistantMessage(`_That message was not sent to the leader — ${e}_`)}}),i={...r,sendSprinkleLick:(e,t,n)=>{r.sendSprinkleLick(e,t,n);let i=t?.action;typeof i==`string`&&me(i)&&j()},addressableUnitId:()=>V(),onMessageRendered:e=>{Te(e),g&&we(e)},onSelectionApplied:()=>{W(H,U),k?.onShownUnitChanged()},onSnapshotRendered:e=>{N.controller.setProcessing(e.some(e=>e.isStreaming))},ownsModelPill:!0,takeAttachments:()=>De.take()};return{client:C,host:i}}})).chat,P=N.controller;if(g)for(let e of[`slicc-error-open-settings`,`slicc-error-login`,`slicc-error-change-model`])x.refs.thread.addEventListener(e,()=>j());let F=`Connecting to leader…`,I=`Ask the leader, or describe a change…`,L=null,R=()=>x.getSelected()?.id??L,z=e=>e&&e.length>0?e:null,B=!1,V=()=>B?z(R()??C.selectedUnitId):null,Ee=()=>{let e=x.getSelected();return e?ce(e):!1},H=!1,U=F,W=(e,t)=>{H=e,U=t;let n=e&&V()!==null;x.refs.inputCard.setAttribute(`placeholder`,e&&!n?F:t),n&&!Ee()?x.refs.inputCard.removeAttribute(`disabled`):x.refs.inputCard.setAttribute(`disabled`,``)};W(!1,F),ie(e=>{try{window.localStorage.setItem(s,JSON.stringify(e))}catch{}});try{window.localStorage.setItem(s,JSON.stringify(ae()))}catch{}m||x.refs.composer.setAttribute(`ptt`,``);let De=ue({inputCard:x.refs.inputCard,freezer:x.refs.freezer,composer:x.refs.composer,noCamera:m,log:w}),G=new le(x.refs).callbacks(),K=e=>{if(L=e,!e)return;let t=C.currentUnits().find(t=>t.id===e);if(!t){x.watchUnit(e),W(H,U);return}if(x.getSelected()?.id!==t.id){x.selectScoop(t);return}W(H,U)},q=()=>{B=!1,C.resetSelection()};x.refs.switcher.connection=`disconnected`;let J,Y=null,Oe=()=>(Y||=de({runtimeMode:u})?.element??null,Y),X=[],ke=pe({refs:x.refs,getSync:()=>J.currentSync,getTargets:()=>X,hasCdpBrowser:()=>E(_.hasLocalCdpSurface,m),window,log:w});k=ne({composerMeta:x.refs.composerMeta,getUnits:()=>C.currentUnits(),setModel:(e,t)=>{C.setModel(e,t).catch(()=>void 0)},getSync:()=>J.currentSync,getSelectedScoopJid:()=>R(),modelPickerEnabled:S.modelPicker,getLockedEffortLevel:()=>localStorage.getItem(`slicc_locked_effort_level`)}),C.subscribeList(()=>k?.onShownUnitChanged()),J=r(C.wrapOptions({joinUrl:v,runtime:d?c:`slicc-standalone`,advertisesCdpTargets:E(_.hasLocalCdpSurface,m),onTargetsUpdated:e=>{X=e,ke.refresh()},...d||m?{}:{onOAuthPopupRequest:(e,t)=>o(e,t,{getPermissionsSurface:Oe,window})},browserAPI:_.browser,onSnapshot:(e,t)=>{B=!0,K(z(t))},onUserMessage:(e,t,n,r)=>P.addUserMessage(e,r),onBiscottoMessageState:(e,t)=>{switch(t){case`pending`:P.addAssistantMessage(`_Sent for review — waiting for the host._`);break;case`rejected`:P.addAssistantMessage(`_The host did not forward that message._`);break;case`unanswered`:P.addAssistantMessage(`_No one reviewed that message in time, so it was not forwarded._`)}},onStatus:(e,t)=>{i(t,R())&&P.setProcessing(e===`processing`)},setChatAgent:e=>{O?.(),O=e.onEvent(e=>{for(let t of D)t(e)})},onSudoApprovalRequest:async t=>{let{openSudoApprovalDialog:n}=await e(async()=>{let{openSudoApprovalDialog:e}=await import(`./wc-sudo-approval-BE35g6ia.js`);return{openSudoApprovalDialog:e}},[]),r=d?_.cherryTransport?.hostOrigin:void 0;return{decision:(await n({kind:t.kind,detail:t.detail,...t.suggestedPattern?{suggestedPattern:t.suggestedPattern}:{}},{allowAlways:!1,signal:t.signal,expiresAt:t.expiresAt,requester:t.requester??t.scoopName??(r?`via ${r}`:void 0)})).decision,attestation:`none`}},onConnectionChange:e=>{x.refs.switcher.connection=e?`connected`:`disconnected`,e||q(),W(e,e?I:F),e||k?.reset(),d&&_.cherryTransport?.emitSliccEventToHost(e?`slicc.follower.ready`:`slicc.follower.disconnected`)},getSelectedScoopJid:()=>R(),onLeaderStalled:e=>{W(!e,e?`The leader is busy — hang on…`:I)},onGaveUp:e=>{w.error(`follower gave up reaching the leader`,{error:e}),x.refs.switcher.connection=`disconnected`,q(),W(!1,`Couldn't reach the leader. Reload to retry.`),k?.reset(),d&&_.cherryTransport?.emitSliccEventToHost(`slicc.follower.disconnected`)},...d?{}:{onJoinUrlChanged:e=>{w.info(`follower joinUrl superseded, persisting replacement`,{newJoinUrl:e}),te(window.localStorage,e)}},addSprinkle:G.addSprinkle,removeSprinkle:G.removeSprinkle,onOpen:e=>{/^https?:\/\//.test(e)?window.open(e,`_blank`,`noopener`):w.warn(`follower sprinkle open() of a local path is unavailable`,{path:e})},onScoopsList:(e,t)=>{B=!0;let n=R();!n||!e.some(e=>e.jid===n)?K(z(t)):K(n),x.wiring.refreshScoops?.()},onModelsList:e=>k?.onModelsList(e),onModelState:e=>k?.onModelState(e),...d?{onCherrySliccEvent:(e,t)=>_.cherryTransport?.emitSliccEventToHost(e,t)}:{}}));for(let e of[`save`,`skip`,`erase`])x.refs.freezer.addEventListener(`new-chat-${e}`,()=>{J.currentSync?.requestNewSession(e)});p(`agentic-memory`)&&x.refs.freezer.querySelector(`slicc-freezer-new`)?.setAttribute(`no-skip`,``),x.refs.switcher.addEventListener(`slicc-scoop-select`,e=>{let t=e.detail?.key;t&&(L=t)}),d&&_.cherryTransport&&(_.cherryTransport.onHostEvent=(e,t)=>J.currentSync?.sendCherryHostEvent(e,t),_.cherryTransport.onExportRequest=(e,t,r,i)=>{let a=J.currentSync;if(!a)return Promise.reject(new n(`transfer-aborted`));let o=ye(t);return o?a.requestTranscriptExport(o,r,i):Promise.reject(new n(`session-not-found`))});let Z=null;if(!d){let{startFollowerNavigateWatcher:t}=await e(async()=>{let{startFollowerNavigateWatcher:e}=await import(`./follower-navigate-watcher-DnnHgZbM.js`);return{startFollowerNavigateWatcher:e}},__vite__mapDeps([63,11,13,1,3,12,14,15,16,64,44,65]));Z=t(_.realCdpTransport,()=>J.currentSync)}let Q=!1,$=()=>{x.refs.avatarMenu.items=[{kind:`separator`},...g?[{id:`focus-leader-tab`,label:`Bring leader to front`,icon:`external-link`}]:[],{id:`export-transcript`,label:Q?`Exporting…`:`Export transcript`,icon:`download`,disabled:Q||void 0},{id:`tray-stop`,label:`Disconnect from leader`,icon:`unplug`,danger:!0}]};$(),x.refs.avatarMenu.addEventListener(`slicc-avatar-action`,t=>{let n=t.detail?.id;if(n===`focus-leader-tab`){_.cherryTransport?.emitSliccEventToHost(`slicc.focus-leader-tab`);return}if(n===`tray-stop`){window.dispatchEvent(new CustomEvent(`slicc:tray-leave`,{detail:{workerBaseUrl:null}}));return}if(n===`export-transcript`&&!Q){Q=!0,$();let t=J.currentSync;if(!t){Q=!1,$();return}let n=new AbortController;t.requestTranscriptExport({kind:`active`},n.signal).then(async t=>{let{downloadTranscriptBlob:n}=await e(async()=>{let{downloadTranscriptBlob:e}=await import(`./wc-transcript-export-CbYm5pR2.js`);return{downloadTranscriptBlob:e}},__vite__mapDeps([66,3,40,67,53,1]));await n(t,`slicc-transcript-${new Date().toISOString().slice(0,10)}.zip`)}).catch(e=>{w.error(`follower transcript export failed`,{error:String(e)})}).finally(()=>{Q=!1,$()})}}),window.addEventListener(`slicc:tray-leave`,e=>{fe({workerBaseUrl:(e.detail??{}).workerBaseUrl??null},{storage:window.localStorage,stopFollower:()=>{Z?.(),J.stop()},getHref:()=>window.location.href,replaceHref:e=>window.history.replaceState(null,``,e),reload:()=>window.location.reload()})}),w.info(`follower mounted`,{runtimeMode:u,isCherry:d})}export{O as bootFollowerFloat};
|
|
17
|
+
.wcui-appcol{padding-left:0!important;}`),n.textContent=r,document.head.append(n)}}function E(e,t){return e&&!t}async function D(t,n,r){let[{parseLayoutDocument:i},{panelizeShell:a}]=await Promise.all([e(()=>import(`./wc-shortcuts-BU_YGmdb.js`).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])),e(()=>import(`./panelize-shell-B59FHf_a.js`),__vite__mapDeps([26,11,0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28]))]),o=i(n);if(`error`in o){r.warn(`follower: host-pushed layout failed validation — keeping the default`,{error:o.error});return}a(t.refs,o),r.info(`follower: applied host-pushed layout document`,{id:o.id,locked:o.locked===!0})}async function Ce(e,t,n){if(n&&t.cherryTransport?.flags)try{let e=JSON.parse(t.cherryTransport.flags);e&&typeof e==`object`&&!Array.isArray(e)&&m(e)}catch(e){w.warn(`follower: host-pushed flags were not valid JSON — ignoring`,e)}let r=p(`panel-layouts`);if(e.refs.dockTree.tilesMovable=r,n&&t.cherryTransport?.layout)try{let n=JSON.parse(t.cherryTransport.layout);n&&typeof n==`object`&&`base`in n?r?await D(e,n,w):w.warn(`follower: ignoring host-pushed layout — the panel-layouts flag is off`):e.refs.dockTree.setTree(n)}catch(e){w.warn(`follower: host-pushed layout was not valid JSON — keeping the default`,e)}}async function O(t,l,u){let d=u===`cherry`,m=d&&new URLSearchParams(window.location.search).get(`ui-only`)===`1`,h=window.location.ancestorOrigins?.[0],g=d&&(h?.startsWith(`chrome-extension://`)??!1),_;try{_=await oe({runtimeMode:u,envBaseUrl:null,window,log:l})}catch(e){let n=e instanceof Error?e.message:String(e);w.error(`follower prelude failed`,{runtimeMode:u,error:n}),be(t,n);return}let v=d?_.cherryJoinUrl:ee(window.location.href,window.localStorage);if(!v){w.error(`follower mount with no join URL - falling back to live boot`);let{bootLeaderFloat:n}=await e(async()=>{let{bootLeaderFloat:e}=await import(`./wc-live-Ts1bLhjx.js`).then(e=>e.n);return{bootLeaderFloat:e}},__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,0,25,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61]));return n(t,l,`standalone`)}let y=d?`cherry`:g?`extension`:`standalone`,x,S,C,D=new Set,O=null,k=null,A=()=>_.cherryTransport?.emitSliccEventToHost(`slicc.open-leader-tab`),j=()=>{g&&he(x.refs.thread,{onOpenTab:A})},we=e=>{let t=e.querySelectorAll(`img[src^="${_e}"]`);return t.length!==0&&(t.forEach((t,n)=>{n===0&&!M?t.replaceWith(ge(e.ownerDocument,{onOpenTab:A})):t.remove()}),!0)},M=!1,Te=e=>{let t=e.querySelectorAll(`img[src^="${ve}"]`);if(t.length!==0){for(let e of t)e.remove();M=!0;for(let e of x.refs.thread.querySelectorAll(`.${b}`))e.remove()}},N=(await re(t,l,{floatKind:y,connect:async t=>{x=t,d&&_.cherryTransport?.theme&&se(_.cherryTransport.theme),await Ce(x,_,d);let n=d&&_.cherryTransport?.effortLevel;n?localStorage.setItem(`slicc_locked_effort_level`,n):localStorage.removeItem(`slicc_locked_effort_level`),S=d&&_.cherryTransport?{...T,..._.cherryTransport.features}:T,xe(x.refs.fileTree,x.refs.termSurface,x.refs.memoryHost,x.refs.monitor,S),Se(S),e(async()=>{let{applyTimestampVisibility:e,initTimestampPreference:t}=await import(`./wc-shortcuts-BU_YGmdb.js`).then(e=>e.R);return{applyTimestampVisibility:e,initTimestampPreference:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])).then(({applyTimestampVisibility:e,initTimestampPreference:t})=>{S.showTimestamps?t():e(!1)}),e(async()=>{let{loadDipStyles:e,loadSprinkleStyles:t}=await import(`./legacy-styles-B3nS5QUo.js`);return{loadDipStyles:e,loadSprinkleStyles:t}},__vite__mapDeps([62,3])).then(({loadDipStyles:e,loadSprinkleStyles:t})=>Promise.all([e(),t()])).catch(()=>void 0),C=new a({getSync:()=>J?.currentSync??null});let r=f({getSync:()=>J?.currentSync??null,onAgentEvent:e=>(D.add(e),()=>D.delete(e)),onAgentError:e=>{w.warn(`follower send failed`,{error:e}),N.controller.addAssistantMessage(`_That message was not sent to the leader — ${e}_`)}}),i={...r,sendSprinkleLick:(e,t,n)=>{r.sendSprinkleLick(e,t,n);let i=t?.action;typeof i==`string`&&me(i)&&j()},addressableUnitId:()=>V(),onMessageRendered:e=>{Te(e),g&&we(e)},onSelectionApplied:()=>{W(H,U),k?.onShownUnitChanged()},onSnapshotRendered:e=>{N.controller.setProcessing(e.some(e=>e.isStreaming))},ownsModelPill:!0,takeAttachments:()=>De.take()};return{client:C,host:i}}})).chat,P=N.controller;if(g)for(let e of[`slicc-error-open-settings`,`slicc-error-login`,`slicc-error-change-model`])x.refs.thread.addEventListener(e,()=>j());let F=`Connecting to leader…`,I=`Ask the leader, or describe a change…`,L=null,R=()=>x.getSelected()?.id??L,z=e=>e&&e.length>0?e:null,B=!1,V=()=>B?z(R()??C.selectedUnitId):null,Ee=()=>{let e=x.getSelected();return e?ce(e):!1},H=!1,U=F,W=(e,t)=>{H=e,U=t;let n=e&&V()!==null;x.refs.inputCard.setAttribute(`placeholder`,e&&!n?F:t),n&&!Ee()?x.refs.inputCard.removeAttribute(`disabled`):x.refs.inputCard.setAttribute(`disabled`,``)};W(!1,F),ie(e=>{try{window.localStorage.setItem(s,JSON.stringify(e))}catch{}});try{window.localStorage.setItem(s,JSON.stringify(ae()))}catch{}m||x.refs.composer.setAttribute(`ptt`,``);let De=ue({inputCard:x.refs.inputCard,freezer:x.refs.freezer,composer:x.refs.composer,noCamera:m,log:w}),G=new le(x.refs).callbacks(),K=e=>{if(L=e,!e)return;let t=C.currentUnits().find(t=>t.id===e);if(!t){x.watchUnit(e),W(H,U);return}if(x.getSelected()?.id!==t.id){x.selectScoop(t);return}W(H,U)},q=()=>{B=!1,C.resetSelection()};x.refs.switcher.connection=`disconnected`;let J,Y=null,Oe=()=>(Y||=de({runtimeMode:u})?.element??null,Y),X=[],ke=pe({refs:x.refs,getSync:()=>J.currentSync,getTargets:()=>X,hasCdpBrowser:()=>E(_.hasLocalCdpSurface,m),window,log:w});k=ne({composerMeta:x.refs.composerMeta,getUnits:()=>C.currentUnits(),setModel:(e,t)=>{C.setModel(e,t).catch(()=>void 0)},getSync:()=>J.currentSync,getSelectedScoopJid:()=>R(),modelPickerEnabled:S.modelPicker,getLockedEffortLevel:()=>localStorage.getItem(`slicc_locked_effort_level`)}),C.subscribeList(()=>k?.onShownUnitChanged()),J=r(C.wrapOptions({joinUrl:v,runtime:d?c:`slicc-standalone`,advertisesCdpTargets:E(_.hasLocalCdpSurface,m),onTargetsUpdated:e=>{X=e,ke.refresh()},...d||m?{}:{onOAuthPopupRequest:(e,t)=>o(e,t,{getPermissionsSurface:Oe,window})},browserAPI:_.browser,onSnapshot:(e,t)=>{B=!0,K(z(t))},onUserMessage:(e,t,n,r)=>P.addUserMessage(e,r),onBiscottoMessageState:(e,t)=>{switch(t){case`pending`:P.addAssistantMessage(`_Sent for review — waiting for the host._`);break;case`rejected`:P.addAssistantMessage(`_The host did not forward that message._`);break;case`unanswered`:P.addAssistantMessage(`_No one reviewed that message in time, so it was not forwarded._`)}},onStatus:(e,t)=>{i(t,R())&&P.setProcessing(e===`processing`)},setChatAgent:e=>{O?.(),O=e.onEvent(e=>{for(let t of D)t(e)})},onSudoApprovalRequest:async t=>{let{openSudoApprovalDialog:n}=await e(async()=>{let{openSudoApprovalDialog:e}=await import(`./wc-sudo-approval-BE35g6ia.js`);return{openSudoApprovalDialog:e}},[]),r=d?_.cherryTransport?.hostOrigin:void 0;return{decision:(await n({kind:t.kind,detail:t.detail,...t.suggestedPattern?{suggestedPattern:t.suggestedPattern}:{}},{allowAlways:!1,signal:t.signal,expiresAt:t.expiresAt,requester:t.requester??t.scoopName??(r?`via ${r}`:void 0)})).decision,attestation:`none`}},onConnectionChange:e=>{x.refs.switcher.connection=e?`connected`:`disconnected`,e||q(),W(e,e?I:F),e||k?.reset(),d&&_.cherryTransport?.emitSliccEventToHost(e?`slicc.follower.ready`:`slicc.follower.disconnected`)},getSelectedScoopJid:()=>R(),onLeaderStalled:e=>{W(!e,e?`The leader is busy — hang on…`:I)},onGaveUp:e=>{w.error(`follower gave up reaching the leader`,{error:e}),x.refs.switcher.connection=`disconnected`,q(),W(!1,`Couldn't reach the leader. Reload to retry.`),k?.reset(),d&&_.cherryTransport?.emitSliccEventToHost(`slicc.follower.disconnected`)},...d?{}:{onJoinUrlChanged:e=>{w.info(`follower joinUrl superseded, persisting replacement`,{newJoinUrl:e}),te(window.localStorage,e)}},addSprinkle:G.addSprinkle,removeSprinkle:G.removeSprinkle,onOpen:e=>{/^https?:\/\//.test(e)?window.open(e,`_blank`,`noopener`):w.warn(`follower sprinkle open() of a local path is unavailable`,{path:e})},onScoopsList:(e,t)=>{B=!0;let n=R();!n||!e.some(e=>e.jid===n)?K(z(t)):K(n),x.wiring.refreshScoops?.()},onModelsList:e=>k?.onModelsList(e),onModelState:e=>k?.onModelState(e),...d?{onCherrySliccEvent:(e,t)=>_.cherryTransport?.emitSliccEventToHost(e,t)}:{}}));for(let e of[`save`,`skip`,`erase`])x.refs.freezer.addEventListener(`new-chat-${e}`,()=>{J.currentSync?.requestNewSession(e)});p(`agentic-memory`)&&x.refs.freezer.querySelector(`slicc-freezer-new`)?.setAttribute(`no-skip`,``),x.refs.switcher.addEventListener(`slicc-scoop-select`,e=>{let t=e.detail?.key;t&&(L=t)}),d&&_.cherryTransport&&(_.cherryTransport.onHostEvent=(e,t)=>J.currentSync?.sendCherryHostEvent(e,t),_.cherryTransport.onExportRequest=(e,t,r,i)=>{let a=J.currentSync;if(!a)return Promise.reject(new n(`transfer-aborted`));let o=ye(t);return o?a.requestTranscriptExport(o,r,i):Promise.reject(new n(`session-not-found`))});let Z=null;if(!d){let{startFollowerNavigateWatcher:t}=await e(async()=>{let{startFollowerNavigateWatcher:e}=await import(`./follower-navigate-watcher-DnnHgZbM.js`);return{startFollowerNavigateWatcher:e}},__vite__mapDeps([63,11,13,1,3,12,14,15,16,64,44,65]));Z=t(_.realCdpTransport,()=>J.currentSync)}let Q=!1,$=()=>{x.refs.avatarMenu.items=[{kind:`separator`},...g?[{id:`focus-leader-tab`,label:`Bring leader to front`,icon:`external-link`}]:[],{id:`export-transcript`,label:Q?`Exporting…`:`Export transcript`,icon:`download`,disabled:Q||void 0},{id:`tray-stop`,label:`Disconnect from leader`,icon:`unplug`,danger:!0}]};$(),x.refs.avatarMenu.addEventListener(`slicc-avatar-action`,t=>{let n=t.detail?.id;if(n===`focus-leader-tab`){_.cherryTransport?.emitSliccEventToHost(`slicc.focus-leader-tab`);return}if(n===`tray-stop`){window.dispatchEvent(new CustomEvent(`slicc:tray-leave`,{detail:{workerBaseUrl:null}}));return}if(n===`export-transcript`&&!Q){Q=!0,$();let t=J.currentSync;if(!t){Q=!1,$();return}let n=new AbortController;t.requestTranscriptExport({kind:`active`},n.signal).then(async t=>{let{downloadTranscriptBlob:n}=await e(async()=>{let{downloadTranscriptBlob:e}=await import(`./wc-transcript-export-DRwVoKZj.js`);return{downloadTranscriptBlob:e}},__vite__mapDeps([66,3,40,67,53,1]));await n(t,`slicc-transcript-${new Date().toISOString().slice(0,10)}.zip`)}).catch(e=>{w.error(`follower transcript export failed`,{error:String(e)})}).finally(()=>{Q=!1,$()})}}),window.addEventListener(`slicc:tray-leave`,e=>{fe({workerBaseUrl:(e.detail??{}).workerBaseUrl??null},{storage:window.localStorage,stopFollower:()=>{Z?.(),J.stop()},getHref:()=>window.location.href,replaceHref:e=>window.history.replaceState(null,``,e),reload:()=>window.location.reload()})}),w.info(`follower mounted`,{runtimeMode:u,isCherry:d})}export{O as bootFollowerFloat};
|