@huynle/hub 0.10.1 → 0.11.0
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/CHANGELOG.md +54 -0
- package/README.md +17 -3
- package/package.json +1 -1
- package/packages/claude-code/package.json +1 -1
- package/packages/cli/dist/hub-cli.js +622 -394
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/grants-mcp.ts +65 -0
- package/packages/cli/src/mcp-operations.ts +49 -0
- package/packages/cli/src/mcp.ts +6 -0
- package/packages/cli/src/subscriptions-mcp.ts +76 -0
- package/packages/cli/src/teams-mcp.ts +5 -3
- package/packages/codex/package.json +1 -1
- package/packages/node/package.json +1 -1
- package/packages/preset/package.json +1 -1
- package/packages/protocol/package.json +1 -1
- package/packages/protocol/src/teams.ts +4 -0
- package/packages/protocol/src/voice-recording.ts +39 -2
- package/packages/runtime-openshell/image/entry.sh +3 -1
- package/packages/runtime-openshell/image/start.sh +3 -1
- package/packages/runtime-openshell/package.json +1 -1
- package/packages/runtime-sdk/package.json +1 -1
- package/packages/sdk/package.json +1 -1
- package/packages/sdk/src/client.ts +13 -0
- package/packages/sdk/src/teams.ts +2 -0
- package/packages/spoke-sdk/package.json +1 -1
- package/src/central/agent/decisions.ts +7 -1
- package/src/central/agent/delivery.ts +39 -9
- package/src/central/agent/grant-routes.ts +14 -1
- package/src/central/agent/grants.ts +23 -0
- package/src/central/agent/launch-engine.ts +3 -3
- package/src/central/agent/message-limits.ts +3 -0
- package/src/central/agent/routes.ts +11 -0
- package/src/central/agent/subscriptions.ts +3 -1
- package/src/central/config.ts +9 -2
- package/src/central/http.ts +102 -20
- package/src/central/recording/export.ts +57 -3
- package/src/central/recording/index.ts +234 -16
- package/src/central/recording/ingest.ts +11 -2
- package/src/central/recording/routes.ts +61 -7
- package/src/central/recording/schema.ts +66 -2
- package/src/central/recording/settings.ts +19 -5
- package/src/central/recording/store.ts +19 -0
- package/src/central/recording/taps.ts +45 -1
- package/src/central/speech/openai.ts +4 -4
- package/src/central/speech/openrouter.ts +4 -4
- package/src/central/speech/provider.ts +32 -1
- package/src/central/speech/service.ts +6 -5
- package/src/central/teams/hop-stalls.ts +72 -0
- package/src/central/teams/policy.ts +10 -0
- package/src/central/teams/routes.ts +2 -0
- package/src/central/teams/seats.ts +3 -3
- package/src/central/teams/staffing.ts +5 -0
- package/src/central/teams/store.ts +5 -2
- package/src/central/teams/validation.ts +8 -5
- package/web/dist/assets/{ArtifactPage-CsPjam8D.js → ArtifactPage-C5MMqXLN.js} +1 -1
- package/web/dist/assets/{ArtifactPane-B9weO8L6.js → ArtifactPane-CXSCmhyJ.js} +1 -1
- package/web/dist/assets/{ArtifactWorkbench-DzKhMs3l.js → ArtifactWorkbench-S0RxNGWy.js} +1 -1
- package/web/dist/assets/{Diagram-CuRIffka.js → Diagram-BGmyRb-R.js} +1 -1
- package/web/dist/assets/{Library-rv5DGtrm.js → Library-CFmMbXEa.js} +2 -2
- package/web/dist/assets/{ProfilesDestination-DUuQ9jmd.js → ProfilesDestination-7jpOc2HM.js} +1 -1
- package/web/dist/assets/{TeamsPage-D_17MkvN.js → TeamsPage-C1NGrUR-.js} +1 -1
- package/web/dist/assets/{Watchtower-DlrNOJ7X.js → Watchtower-DnvlJaU0.js} +2 -2
- package/web/dist/assets/{artifacts-But87Jfo.js → artifacts-DlQEYmDl.js} +1 -1
- package/web/dist/assets/index-Da8SKXMw.js +33 -0
- package/web/dist/assets/{index-rW6LKQj1.css → index-Dyq-jBeE.css} +1 -1
- package/web/dist/assets/live-BmqLASSo.js +5 -0
- package/web/dist/assets/{pane-layout-BW0RdX5a.js → pane-layout-BAuu_pA3.js} +1 -1
- package/web/dist/assets/{renderer2d-DyANQ1WS.js → renderer2d-B2Nh39UN.js} +1 -1
- package/web/dist/assets/{renderer3d-vYYKFAJq.js → renderer3d-CTYbljHH.js} +1 -1
- package/web/dist/assets/{safe-area-B2Bk__FK.js → safe-area-CkhEclGo.js} +1 -1
- package/web/dist/assets/{silero-worker-e802lB5T.js → silero-worker-CC2etKS3.js} +1 -1
- package/web/dist/assets/{source-C-De8L3s.js → source-GYayxUxS.js} +1 -1
- package/web/dist/assets/{toast-CXTwTvDw.js → toast-q818mjUF.js} +1 -1
- package/web/dist/index.html +5 -5
- package/web/dist/assets/index-bX8B6NLo.js +0 -33
- package/web/dist/assets/live-BGLA-peO.js +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e}from"./live-
|
|
1
|
+
import{E as e}from"./live-BmqLASSo.js";var t=`watchtower.layout`,n=1e3,r=[`--accent`,`--blue`,`--violet`,`--orange`,`--ok`,`--warn`];function i(e,t=0){let n=110+26*Math.sqrt(Math.max(1,e))+7*Math.sqrt(Math.max(0,t)),r=Math.PI*(3-Math.sqrt(5));return Array.from({length:e},(t,i)=>{let a=e===1?0:1-i/(e-1)*2,o=Math.sqrt(1-a*a),s=i*r;return[l(Math.cos(s)*o*n),l(a*n*.55),l(Math.sin(s)*o*n)]})}function a(t){let n=new Set(t.nodes.map(e=>e.id)),a=i(t.groups.length,t.groups.reduce((e,t)=>e+t.sections.reduce((e,t)=>e+t.members.length,0),0));return t.groups.map((t,i)=>{let o=[];n.has(t.id)&&o.push(t.id);for(let e of t.sections)e.id!==void 0&&n.has(e.id)&&o.push(e.id),o.push(...e.members);let s=t.machine===void 0?r[i%r.length]:e[t.machine%e.length];return{id:t.id,label:t.label,color:s,center:a[i],members:o}})}function o(e){let t=new Map;for(let n of e.links)n.kind!==`structure`&&n.kind!==`policy`&&(t.set(n.source,(t.get(n.source)??0)+n.count),t.set(n.target,(t.get(n.target)??0)+n.count));return t}function s(e,t){let n=new Set,r=new Set(e.groups.map(e=>e.id));for(let t of e.nodes)(t.kind===`hub`||t.kind===`user`||t.kind===`app`||t.kind===`role`||r.has(t.id)||t.match)&&n.add(t.id);let i=o(e),a=e.nodes.filter(e=>!n.has(e.id)&&e.kind!==`role`);a.sort((e,t)=>(i.get(t.id)??0)-(i.get(e.id)??0)||(e.id<t.id?-1:+(e.id>t.id)));for(let e of a.slice(0,Math.max(0,t.max)))n.add(e.id);for(let e of t.extra??[])n.add(e);return n}var c=e=>e.kind===`role`&&e.vacant?`${e.label} · vacant`:e.label,l=e=>Math.round(e*10)/10,u=e=>typeof e==`number`&&Number.isFinite(e);function d(e){let t=new Map;if(!e)return t;let n;try{n=JSON.parse(e)}catch{return t}if(typeof n!=`object`||!n||Array.isArray(n))return t;let{v:r,p:i}=n;if(r!==1||typeof i!=`object`||!i||Array.isArray(i))return t;for(let[e,n]of Object.entries(i)){if(t.size>=1e3)break;if(!Array.isArray(n)||n.length!==3)continue;let[r,i,a]=n;u(r)&&u(i)&&u(a)&&t.set(e,[r,i,a])}return t}function f(e,t,r=n){let i={},a=0;for(let n of[e,t])for(let[e,t]of n){if(a>=r)break;e in i||!t.every(u)||(i[e]=[l(t[0]),l(t[1]),l(t[2])],a++)}return JSON.stringify({v:1,p:i})}function p(e,t){let n=2166136261;for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),16777619);let r=(n>>>0)%1e3/1e3,i=(Math.imul(n,2654435761)>>>0)%1e3/1e3,a=r*Math.PI*2,o=i*2-1,s=Math.sqrt(1-o*o),c=t*(.6+.4*r);return[Math.cos(a)*s*c,o*c,Math.sin(a)*s*c]}function m(e,t){let n=new Map,r=new Set,i=new Map;for(let t of a(e))for(let e of t.members)i.set(e,t);let o=new Map,s=new Map;for(let t of e.links)t.kind===`structure`&&(o.get(t.target)??o.set(t.target,[]).get(t.target)).push(t.source),(s.get(t.target)??s.set(t.target,[]).get(t.target)).push(t.source),(s.get(t.source)??s.set(t.source,[]).get(t.source)).push(t.target);n.set(`hub`,[0,0,0]);for(let r of e.nodes){if(r.id===`hub`)continue;let e=t.get(r.id);e&&n.set(r.id,e)}let c=new Set(e.groups.map(e=>e.id)),u=[...e.nodes.filter(e=>c.has(e.id)),...e.nodes.filter(e=>!c.has(e.id))];for(let e of u){if(n.has(e.id))continue;r.add(e.id);let t=[...o.get(e.id)??[],...s.get(e.id)??[]].find(e=>e!==`hub`&&n.has(e)),a=i.get(e.id),c=t===void 0?a?.center:n.get(t),u=p(e.id,t===void 0?a?24:40:14),d=c??[0,0,0];n.set(e.id,[l(d[0]+u[0]),l(d[1]+u[1]),l(d[2]+u[2])])}return{positions:n,fresh:r}}function h(e,t){let n=new Map,r=[],i=e=>r.some(t=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h),a=[...e.filter(e=>e.pinned),...e.filter(e=>!e.pinned)];for(let e of a)for(let a of e.texts){let o=t(a,e),s={x:e.x-o/2,y:e.y,w:o,h:e.h};if(e.pinned||!i(s)){r.push(s),n.set(e.id,{text:a,box:s});break}}return n}var g=8,_=900;function v(e){let t={top:0,right:0,bottom:0,left:0},n=e.closest(`.wt-stage`);if(!n)return t;let r=e.getBoundingClientRect();if(!r.height)return t;let i=n.querySelector(`.wt-dock`)?.getBoundingClientRect(),a=n.querySelector(`.wt-chips`)?.getBoundingClientRect(),o=r.width>=_?n.querySelector(`.wt-pop-legend`)?.getBoundingClientRect():void 0,s=o&&o.width?Math.max(0,o.right-r.left+g):0,c=i&&i.height?Math.max(0,r.bottom-i.top+g):0,l=a&&a.height?Math.max(0,a.bottom-r.top+g):0;return{top:Math.min(l,r.height/3),right:0,bottom:Math.min(c,r.height/3),left:Math.min(s,r.width/3)}}export{c as a,a as c,s as i,m as l,t as n,d as o,o as r,h as s,v as t,f as u};
|
|
@@ -8,4 +8,4 @@ if(typeof n<`u`)return n.apply(this,arguments);throw Error(`Dynamic require of "
|
|
|
8
8
|
`);return e[0]==`Error`&&e.shift(),Et(e),q.Wa=Tt(),q.$a=e,q.Wa}function Dt(e,t,n){if(e>>>=0,t>>>=0,q.Wa==e)var r=q.$a;else(r=Error().stack.toString().split(`
|
|
9
9
|
`))[0]==`Error`&&r.shift(),Et(r);for(var i=3;r[i]&&Tt()!=e;)++i;for(e=0;e<n&&r[e+i];++e)E()[t+4*e>>>2>>>0]=Tt();return e}var Ot,kt={},At=()=>{if(!Ot){var e,t={USER:`web_user`,LOGNAME:`web_user`,PATH:`/`,PWD:`/`,HOME:`/home/web_user`,LANG:(typeof navigator==`object`&&navigator.languages&&navigator.languages[0]||`C`).replace(`-`,`_`)+`.UTF-8`,_:`./this.program`};for(e in kt)kt[e]===void 0?delete t[e]:t[e]=kt[e];var n=[];for(e in t)n.push(`${e}=${t[e]}`);Ot=n}return Ot};function jt(e,t){if(s)return I(19,1,e,t);e>>>=0,t>>>=0;var n,r=0,i=0;for(n of At()){var a=t+r;D()[e+i>>>2>>>0]=a,r+=G(n,a,1/0)+1,i+=4}return 0}var Mt=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);127>=r?t++:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,++n):t+=3}return t};function Nt(e,t){if(s)return I(20,1,e,t);e>>>=0,t>>>=0;var n=At();for(var r of(D()[e>>>2>>>0]=n.length,e=0,n))e+=Mt(r)+1;return D()[t>>>2>>>0]=e,0}function Pt(e){return s?I(21,1,e):52}function Ft(e,t,n,r){return s?I(22,1,e,t,n,r):52}function It(e,t,n,r){return s?I(23,1,e,t,n,r):70}var Y=[null,[],[]];function X(e,t,n,r){if(s)return I(24,1,e,t,n,r);t>>>=0,n>>>=0,r>>>=0;for(var i=0,a=0;a<n;a++){var o=D()[t>>>2>>>0],c=D()[t+4>>>2>>>0];t+=8;for(var l=0;l<c;l++){var u=e,d=T()[o+l>>>0],f=Y[u];d===0||d===10?((u===1?ae:w)(Fe(f)),f.length=0):f.push(d)}i+=c}return D()[r>>>2>>>0]=i,0}s||function(){for(var e=r.numThreads-1;e--;)z();N.push(()=>{pe++,function(e){s?e():Promise.all(L.map(Te)).then(e)}(()=>me())})}(),s||(h=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),A()),r.wasmBinary&&(m=r.wasmBinary),r.stackSave=()=>Yt(),r.stackRestore=e=>qt(e),r.stackAlloc=e=>Jt(e),r.setValue=function(e,t,n=`i8`){switch(n.endsWith(`*`)&&(n=`*`),n){case`i1`:case`i8`:ce()[e>>>0]=t;break;case`i16`:le()[e>>>1>>>0]=t;break;case`i32`:E()[e>>>2>>>0]=t;break;case`i64`:S[e>>>3]=BigInt(t);break;case`float`:O()[e>>>2>>>0]=t;break;case`double`:k()[e>>>3>>>0]=t;break;case`*`:D()[e>>>2>>>0]=t;break;default:M(`invalid type for setValue: ${n}`)}},r.getValue=function(e,t=`i8`){switch(t.endsWith(`*`)&&(t=`*`),t){case`i1`:case`i8`:return ce()[e>>>0];case`i16`:return le()[e>>>1>>>0];case`i32`:return E()[e>>>2>>>0];case`i64`:return S[e>>>3];case`float`:return O()[e>>>2>>>0];case`double`:return k()[e>>>3>>>0];case`*`:return D()[e>>>2>>>0];default:M(`invalid type for getValue: ${t}`)}},r.UTF8ToString=Ie,r.stringToUTF8=G,r.lengthBytesUTF8=Mt;var Lt=[ve,ye,Me,Le,Re,ze,B,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,ct,lt,ft,jt,Nt,Pt,Ft,It,X],Rt={853836:(e,t,n,i,a)=>{if(r===void 0||!r.Sa)return 1;if((e=Ie(Number(e>>>0))).startsWith(`./`)&&(e=e.substring(2)),!(e=r.Sa.get(e)))return 2;if(t=Number(t>>>0),n=Number(n>>>0),i=Number(i>>>0),t+n>e.byteLength)return 3;try{let o=e.subarray(t,t+n);switch(a){case 0:T().set(o,i>>>0);break;case 1:r.hb?r.hb(i,o):r.jb(i,o);break;default:return 4}return 0}catch{return 4}},854660:()=>typeof wasmOffsetConverter<`u`};function zt(){return typeof wasmOffsetConverter<`u`}var Z=await async function(){function e(e,t){return Z=e.exports,Z=function(){var e=Z,t=e=>()=>e()>>>0,n=e=>t=>e(t)>>>0;return(e=Object.assign({},e)).Aa=t(e.Aa),e.Ca=n(e.Ca),e.Oa=n(e.Oa),e.Pa=t(e.Pa),e.__cxa_get_exception_ptr=n(e.__cxa_get_exception_ptr),e}(),Se.push(Z.Da),Ee=Z.Ea,g=t,me(),Z}pe++;var t=he();if(r.instantiateWasm)return new Promise(n=>{r.instantiateWasm(t,(t,r)=>{n(e(t,r))})});if(s)return new Promise(t=>{ne=n=>{t(e(new WebAssembly.Instance(n,he()),n))}});fe??=r.locateFile?r.locateFile?r.locateFile(`ort-wasm-simd-threaded.wasm`,p):p+`ort-wasm-simd-threaded.wasm`:new URL(`/assets/ort-wasm-simd-threaded-CxTQ5xH-.wasm`,``+import.meta.url).href;try{var i=await async function(e){var t=fe;if(!m&&typeof WebAssembly.instantiateStreaming==`function`&&!se(t))try{var n=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(n,e)}catch(e){w(`wasm streaming compile failed: ${e}`),w(`falling back to ArrayBuffer instantiation`)}return async function(e,t){try{var n=await async function(e){if(!m)try{var t=await c(e);return new Uint8Array(t)}catch{}if(e==fe&&m)e=new Uint8Array(m);else{if(!l)throw`both async and sync fetching of the wasm failed`;e=l(e)}return e}(e);return await WebAssembly.instantiate(n,t)}catch(e){w(`failed to asynchronously prepare wasm: ${e}`),M(e)}}(t,e)}(t);return e(i.instance,i.module)}catch(e){return n(e),Promise.reject(e)}}();r._OrtInit=(e,t)=>(r._OrtInit=Z.aa)(e,t),r._OrtGetLastError=(e,t)=>(r._OrtGetLastError=Z.ba)(e,t),r._OrtCreateSessionOptions=(e,t,n,i,a,o,s,c,l,u)=>(r._OrtCreateSessionOptions=Z.ca)(e,t,n,i,a,o,s,c,l,u),r._OrtAppendExecutionProvider=(e,t,n,i,a)=>(r._OrtAppendExecutionProvider=Z.da)(e,t,n,i,a),r._OrtAddFreeDimensionOverride=(e,t,n)=>(r._OrtAddFreeDimensionOverride=Z.ea)(e,t,n),r._OrtAddSessionConfigEntry=(e,t,n)=>(r._OrtAddSessionConfigEntry=Z.fa)(e,t,n),r._OrtReleaseSessionOptions=e=>(r._OrtReleaseSessionOptions=Z.ga)(e),r._OrtCreateSession=(e,t,n)=>(r._OrtCreateSession=Z.ha)(e,t,n),r._OrtReleaseSession=e=>(r._OrtReleaseSession=Z.ia)(e),r._OrtGetInputOutputCount=(e,t,n)=>(r._OrtGetInputOutputCount=Z.ja)(e,t,n),r._OrtGetInputOutputMetadata=(e,t,n,i)=>(r._OrtGetInputOutputMetadata=Z.ka)(e,t,n,i),r._OrtFree=e=>(r._OrtFree=Z.la)(e),r._OrtCreateTensor=(e,t,n,i,a,o)=>(r._OrtCreateTensor=Z.ma)(e,t,n,i,a,o),r._OrtGetTensorData=(e,t,n,i,a)=>(r._OrtGetTensorData=Z.na)(e,t,n,i,a),r._OrtReleaseTensor=e=>(r._OrtReleaseTensor=Z.oa)(e),r._OrtCreateRunOptions=(e,t,n,i)=>(r._OrtCreateRunOptions=Z.pa)(e,t,n,i),r._OrtAddRunConfigEntry=(e,t,n)=>(r._OrtAddRunConfigEntry=Z.qa)(e,t,n),r._OrtReleaseRunOptions=e=>(r._OrtReleaseRunOptions=Z.ra)(e),r._OrtCreateBinding=e=>(r._OrtCreateBinding=Z.sa)(e),r._OrtBindInput=(e,t,n)=>(r._OrtBindInput=Z.ta)(e,t,n),r._OrtBindOutput=(e,t,n,i)=>(r._OrtBindOutput=Z.ua)(e,t,n,i),r._OrtClearBoundOutputs=e=>(r._OrtClearBoundOutputs=Z.va)(e),r._OrtReleaseBinding=e=>(r._OrtReleaseBinding=Z.wa)(e),r._OrtRunWithBinding=(e,t,n,i,a)=>(r._OrtRunWithBinding=Z.xa)(e,t,n,i,a),r._OrtRun=(e,t,n,i,a,o,s,c)=>(r._OrtRun=Z.ya)(e,t,n,i,a,o,s,c),r._OrtEndProfiling=e=>(r._OrtEndProfiling=Z.za)(e);var Bt=()=>(Bt=Z.Aa)();r._free=e=>(r._free=Z.Ba)(e),r._malloc=e=>(r._malloc=Z.Ca)(e);var Vt=(e,t,n,r,i,a)=>(Vt=Z.Fa)(e,t,n,r,i,a),Q=()=>(Q=Z.Ga)(),$=(e,t,n,r,i)=>($=Z.Ha)(e,t,n,r,i),Ht=e=>(Ht=Z.Ia)(e),Ut=e=>(Ut=Z.Ja)(e),Wt=(e,t)=>(Wt=Z.Ka)(e,t),Gt=()=>(Gt=Z.La)(),Kt=(e,t)=>(Kt=Z.Ma)(e,t),qt=e=>(qt=Z.Na)(e),Jt=e=>(Jt=Z.Oa)(e),Yt=()=>(Yt=Z.Pa)();return function e(){if(0<pe)j=e;else if(s)t(r),de();else{for(;0<N.length;)N.shift()(r);0<pe?j=e:(r.calledRun=!0,oe||(de(),t(r)))}}(),r.PTR_SIZE=4,i},Pe=Ne,Fe=globalThis.self?.name?.startsWith(`em-pthread`),Fe&&Ne()}),Le,Re,ze,B,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe=l(()=>{Ee(),Le=typeof location>`u`?void 0:location.origin,Re=import.meta.url>`file:`&&import.meta.url<`file;`,ze=()=>Re?new URL(new URL(`ort.wasm.bundle.min.mjs`,import.meta.url).href,Le).href:import.meta.url,B=ze(),Be=()=>{if(B&&!B.startsWith(`blob:`))return B.substring(0,B.lastIndexOf(`/`)+1)},Ve=(e,t)=>{try{let n=t??B;return(n?new URL(e,n):new URL(e)).origin===Le}catch{return!1}},He=(e,t)=>{let n=t??B;try{return(n?new URL(e,n):new URL(e)).href}catch{return}},Ue=(e,t)=>`${t??`./`}${e}`,We=async e=>{let t=await(await fetch(e,{credentials:`same-origin`})).blob();return URL.createObjectURL(t)},Ge=async e=>(await import(
|
|
10
10
|
/*webpackIgnore:true*/
|
|
11
|
-
e)).default,Ke=(je(),f(De)).default,qe=async()=>{if(!B)throw Error(`Failed to load proxy worker: cannot determine the script source URL.`);if(Ve(B))return[void 0,Ke()];let e=await We(B);return[e,Ke(e)]},Je=(Ie(),f(Me)).default,Ye=async(e,t,n,r)=>{let i=Je&&!(e||t);if(i){if(B)i=Ve(B);else if(r&&!n)i=!0;else throw Error(`cannot determine the script source URL.`)}if(i)return[void 0,Je];{let r=`ort-wasm-simd-threaded.mjs`,i=e??He(r,t),a=n&&i&&!Ve(i,t),o=a?await We(i):i??Ue(r,t);return[a?o:void 0,await Ge(o)]}}}),Ze,Qe,V,$e,et,tt,nt,rt,H,it=l(()=>{Xe(),Qe=!1,V=!1,$e=!1,et=()=>{if(typeof SharedArrayBuffer>`u`)return!1;try{return typeof MessageChannel<`u`&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},tt=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},nt=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},rt=async e=>{if(Qe)return Promise.resolve();if(V)throw Error(`multiple calls to 'initializeWebAssembly()' detected.`);if($e)throw Error(`previous call to 'initializeWebAssembly()' failed.`);V=!0;let t=e.initTimeout,n=e.numThreads;if(e.simd!==!1){if(e.simd===`relaxed`){if(!nt())throw Error(`Relaxed WebAssembly SIMD is not supported in the current environment.`)}else if(!tt())throw Error(`WebAssembly SIMD is not supported in the current environment.`)}let r=et();n>1&&!r&&(typeof self<`u`&&!self.crossOriginIsolated&&console.warn(`env.wasm.numThreads is set to `+n+`, but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info.`),console.warn(`WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading.`),e.numThreads=n=1);let i=e.wasmPaths,a=typeof i==`string`?i:void 0,o=i?.mjs,s=o?.href??o,c=i?.wasm,l=c?.href??c,u=e.wasmBinary,[d,f]=await Ye(s,a,n>1,!!u||!!l),p=!1,m=[];if(t>0&&m.push(new Promise(e=>{setTimeout(()=>{p=!0,e()},t)})),m.push(new Promise((e,t)=>{let r={numThreads:n};if(u)r.wasmBinary=u;else if(l||a)r.locateFile=e=>l??a+e;else if(s&&s.indexOf(`blob:`)!==0)r.locateFile=e=>new URL(e,s).href;else if(d){let e=Be();e&&(r.locateFile=t=>e+t)}f(r).then(t=>{V=!1,Qe=!0,Ze=t,e(),d&&URL.revokeObjectURL(d)},e=>{V=!1,$e=!0,t(e)})})),await Promise.race(m),p)throw Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},H=()=>{if(Qe&&Ze)return Ze;throw Error(`WebAssembly is not initialized yet.`)}}),U,at,W,ot=l(()=>{it(),U=(e,t)=>{let n=H(),r=n.lengthBytesUTF8(e)+1,i=n._malloc(r);return n.stringToUTF8(e,i,r),t.push(i),i},at=(e,t,n,r)=>{if(typeof e==`object`&&e){if(n.has(e))throw Error(`Circular reference in options`);n.add(e)}Object.entries(e).forEach(([e,i])=>{let a=t?t+e:e;if(typeof i==`object`)at(i,a+`.`,n,r);else if(typeof i==`string`||typeof i==`number`)r(a,i.toString());else if(typeof i==`boolean`)r(a,i?`1`:`0`);else throw Error(`Can't handle extra config type: ${typeof i}`)})},W=e=>{let t=H(),n=t.stackSave();try{let n=t.PTR_SIZE,r=t.stackAlloc(2*n);t._OrtGetLastError(r,r+n);let i=Number(t.getValue(r,n===4?`i32`:`i64`)),a=t.getValue(r+n,`*`),o=a?t.UTF8ToString(a):``;throw Error(`${e} ERROR_CODE: ${i}, ERROR_MESSAGE: ${o}`)}finally{t.stackRestore(n)}}}),st,ct=l(()=>{it(),ot(),st=e=>{let t=H(),n=0,r=[],i=e||{};try{if(e?.logSeverityLevel===void 0)i.logSeverityLevel=2;else if(typeof e.logSeverityLevel!=`number`||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw Error(`log severity level is not valid: ${e.logSeverityLevel}`);if(e?.logVerbosityLevel===void 0)i.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!=`number`||!Number.isInteger(e.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);e?.terminate===void 0&&(i.terminate=!1);let a=0;return e?.tag!==void 0&&(a=U(e.tag,r)),n=t._OrtCreateRunOptions(i.logSeverityLevel,i.logVerbosityLevel,!!i.terminate,a),n===0&&W(`Can't create run options.`),e?.extra!==void 0&&at(e.extra,``,/* @__PURE__ */ new WeakSet,(e,i)=>{let a=U(e,r),o=U(i,r);t._OrtAddRunConfigEntry(n,a,o)!==0&&W(`Can't set a run config entry: ${e} - ${i}.`)}),[n,r]}catch(e){throw n!==0&&t._OrtReleaseRunOptions(n),r.forEach(e=>t._free(e)),e}}}),lt,ut,dt,ft,G,pt,mt=l(()=>{it(),ot(),lt=e=>{switch(e){case`disabled`:return 0;case`basic`:return 1;case`extended`:return 2;case`layout`:return 3;case`all`:return 99;default:throw Error(`unsupported graph optimization level: ${e}`)}},ut=e=>{switch(e){case`sequential`:return 0;case`parallel`:return 1;default:throw Error(`unsupported execution mode: ${e}`)}},dt=e=>{e.extra||={},e.extra.session||(e.extra.session={});let t=e.extra.session;t.use_ort_model_bytes_directly||=`1`,e.executionProviders&&e.executionProviders.some(e=>(typeof e==`string`?e:e.name)===`webgpu`)&&(e.enableMemPattern=!1)},ft=(e,t,n,r)=>{let i=U(t,r),a=U(n,r);H()._OrtAddSessionConfigEntry(e,i,a)!==0&&W(`Can't set a session config entry: ${t} - ${n}.`)},G=async(e,t,n)=>{for(let r of t){let t=typeof r==`string`?r:r.name,i=[];switch(t){case`webnn`:if(t=`WEBNN`,typeof r!=`string`){let t=r?.deviceType;t&&ft(e,`deviceType`,t,n)}break;case`webgpu`:if(t=`JS`,typeof r!=`string`){let t=r;if(t?.preferredLayout){if(t.preferredLayout!==`NCHW`&&t.preferredLayout!==`NHWC`)throw Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${t.preferredLayout}`);ft(e,`preferredLayout`,t.preferredLayout,n)}}break;case`wasm`:case`cpu`:continue;default:throw Error(`not supported execution provider: ${t}`)}let a=U(t,n),o=i.length,s=0,c=0;if(o>0){s=H()._malloc(o*H().PTR_SIZE),n.push(s),c=H()._malloc(o*H().PTR_SIZE),n.push(c);for(let e=0;e<o;e++)H().setValue(s+e*H().PTR_SIZE,i[e][0],`*`),H().setValue(c+e*H().PTR_SIZE,i[e][1],`*`)}await H()._OrtAppendExecutionProvider(e,a,s,c,o)!==0&&W(`Can't append execution provider: ${t}.`)}},pt=async e=>{let t=H(),n=0,r=[],i=e||{};dt(i);try{let e=lt(i.graphOptimizationLevel??`all`),a=ut(i.executionMode??`sequential`),o=typeof i.logId==`string`?U(i.logId,r):0,s=i.logSeverityLevel??2;if(!Number.isInteger(s)||s<0||s>4)throw Error(`log severity level is not valid: ${s}`);let c=i.logVerbosityLevel??0;if(!Number.isInteger(c)||c<0||c>4)throw Error(`log verbosity level is not valid: ${c}`);let l=typeof i.optimizedModelFilePath==`string`?U(i.optimizedModelFilePath,r):0;if(n=t._OrtCreateSessionOptions(e,!!i.enableCpuMemArena,!!i.enableMemPattern,a,!!i.enableProfiling,0,o,s,c,l),n===0&&W(`Can't create session options.`),i.executionProviders&&await G(n,i.executionProviders,r),i.enableGraphCapture!==void 0){if(typeof i.enableGraphCapture!=`boolean`)throw Error(`enableGraphCapture must be a boolean value: ${i.enableGraphCapture}`);ft(n,`enableGraphCapture`,i.enableGraphCapture.toString(),r)}if(i.freeDimensionOverrides)for(let[e,a]of Object.entries(i.freeDimensionOverrides)){if(typeof e!=`string`)throw Error(`free dimension override name must be a string: ${e}`);if(typeof a!=`number`||!Number.isInteger(a)||a<0)throw Error(`free dimension override value must be a non-negative integer: ${a}`);let i=U(e,r);t._OrtAddFreeDimensionOverride(n,i,a)!==0&&W(`Can't set a free dimension override: ${e} - ${a}.`)}return i.extra!==void 0&&at(i.extra,``,/* @__PURE__ */ new WeakSet,(e,t)=>{ft(n,e,t,r)}),[n,r]}catch(e){throw n!==0&&t._OrtReleaseSessionOptions(n)!==0&&W(`Can't release session options.`),r.forEach(e=>t._free(e)),e}}}),ht,gt,K,_t,vt,yt,bt,xt,St=l(()=>{ht=e=>{switch(e){case`int8`:return 3;case`uint8`:return 2;case`bool`:return 9;case`int16`:return 5;case`uint16`:return 4;case`int32`:return 6;case`uint32`:return 12;case`float16`:return 10;case`float32`:return 1;case`float64`:return 11;case`string`:return 8;case`int64`:return 7;case`uint64`:return 13;case`int4`:return 22;case`uint4`:return 21;default:throw Error(`unsupported data type: ${e}`)}},gt=e=>{switch(e){case 3:return`int8`;case 2:return`uint8`;case 9:return`bool`;case 5:return`int16`;case 4:return`uint16`;case 6:return`int32`;case 12:return`uint32`;case 10:return`float16`;case 1:return`float32`;case 11:return`float64`;case 8:return`string`;case 7:return`int64`;case 13:return`uint64`;case 22:return`int4`;case 21:return`uint4`;default:throw Error(`unsupported data type: ${e}`)}},K=(e,t)=>{let n=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],r=typeof t==`number`?t:t.reduce((e,t)=>e*t,1);return n>0?Math.ceil(r*n):void 0},_t=e=>{switch(e){case`float16`:return typeof Float16Array<`u`&&Float16Array.from?Float16Array:Uint16Array;case`float32`:return Float32Array;case`uint8`:return Uint8Array;case`int8`:return Int8Array;case`uint16`:return Uint16Array;case`int16`:return Int16Array;case`int32`:return Int32Array;case`bool`:return Uint8Array;case`float64`:return Float64Array;case`uint32`:return Uint32Array;case`int64`:return BigInt64Array;case`uint64`:return BigUint64Array;default:throw Error(`unsupported type: ${e}`)}},vt=e=>{switch(e){case`verbose`:return 0;case`info`:return 1;case`warning`:return 2;case`error`:return 3;case`fatal`:return 4;default:throw Error(`unsupported logging level: ${e}`)}},yt=e=>e===`float32`||e===`float16`||e===`int32`||e===`int64`||e===`uint32`||e===`uint8`||e===`bool`||e===`uint4`||e===`int4`,bt=e=>e===`float32`||e===`float16`||e===`int32`||e===`int64`||e===`uint32`||e===`uint64`||e===`int8`||e===`uint8`||e===`bool`||e===`uint4`||e===`int4`,xt=e=>{switch(e){case`none`:return 0;case`cpu`:return 1;case`cpu-pinned`:return 2;case`texture`:return 3;case`gpu-buffer`:return 4;case`ml-tensor`:return 5;default:throw Error(`unsupported data location: ${e}`)}}}),Ct,wt=l(()=>{Ee(),Ct=async e=>{if(typeof e==`string`){let t=await fetch(e);if(!t.ok)throw Error(`failed to load external data file: ${e}`);let n=t.headers.get(`Content-Length`),r=n?parseInt(n,10):0;if(r<1073741824)return new Uint8Array(await t.arrayBuffer());{if(!t.body)throw Error(`failed to load external data file: ${e}, no response body.`);let n=t.body.getReader(),i;try{i=new ArrayBuffer(r)}catch(e){if(e instanceof RangeError){let e=Math.ceil(r/65536);i=new WebAssembly.Memory({initial:e,maximum:e}).buffer}else throw e}let a=0;for(;;){let{done:e,value:t}=await n.read();if(e)break;let r=t.byteLength;new Uint8Array(i,a,r).set(t),a+=r}return new Uint8Array(i,0,r)}}return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),Tt,q,Et,J,Dt,Ot,kt,At,jt,Mt,Nt,Pt,Ft,It=l(()=>{z(),ct(),mt(),St(),it(),ot(),wt(),Tt=(e,t)=>{H()._OrtInit(e,t)!==0&&W(`Can't initialize onnxruntime.`)},q=async e=>{Tt(e.wasm.numThreads,vt(e.logLevel))},Et=async(e,t)=>{H().asyncInit?.();let n=e.webgpu.adapter;if(t===`webgpu`){if(typeof navigator>`u`||!navigator.gpu)throw Error(`WebGPU is not supported in current environment`);if(n){if(typeof n.limits!=`object`||typeof n.features!=`object`||typeof n.requestDevice!=`function`)throw Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let t=e.webgpu.powerPreference;if(t!==void 0&&t!==`low-power`&&t!==`high-performance`)throw Error(`Invalid powerPreference setting: "${t}"`);let r=e.webgpu.forceFallbackAdapter;if(r!==void 0&&typeof r!=`boolean`)throw Error(`Invalid forceFallbackAdapter setting: "${r}"`);if(n=await navigator.gpu.requestAdapter({powerPreference:t,forceFallbackAdapter:r}),!n)throw Error(`Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.`)}}if(t===`webnn`&&(typeof navigator>`u`||!navigator.ml))throw Error(`WebNN is not supported in current environment`)},J=/* @__PURE__ */ new Map,Dt=e=>{let t=H(),n=t.stackSave();try{let n=t.PTR_SIZE,r=t.stackAlloc(2*n);t._OrtGetInputOutputCount(e,r,r+n)!==0&&W(`Can't get session input/output count.`);let i=n===4?`i32`:`i64`;return[Number(t.getValue(r,i)),Number(t.getValue(r+n,i))]}finally{t.stackRestore(n)}},Ot=(e,t)=>{let n=H(),r=n.stackSave(),i=0;try{let r=n.PTR_SIZE,a=n.stackAlloc(2*r);n._OrtGetInputOutputMetadata(e,t,a,a+r)!==0&&W(`Can't get session input/output metadata.`);let o=Number(n.getValue(a,`*`));i=Number(n.getValue(a+r,`*`));let s=n.HEAP32[i/4];if(s===0)return[o,0];let c=n.HEAPU32[i/4+1],l=[];for(let e=0;e<c;e++){let t=Number(n.getValue(i+8+e*r,`*`));l.push(t===0?Number(n.getValue(i+8+(e+c)*r,`*`)):n.UTF8ToString(t))}return[o,s,l]}finally{n.stackRestore(r),i!==0&&n._OrtFree(i)}},kt=e=>{let t=H(),n=t._malloc(e.byteLength);if(n===0)throw Error(`Can't create a session. failed to allocate a buffer of size ${e.byteLength}.`);return t.HEAPU8.set(e,n),[n,e.byteLength]},At=async(e,t)=>{let n,r,i=H();Array.isArray(e)?[n,r]=e:e.buffer===i.HEAPU8.buffer?[n,r]=[e.byteOffset,e.byteLength]:[n,r]=kt(e);let a=0,o=0,s=[],c=[],l=[];try{if([o,s]=await pt(t),t?.externalData&&i.mountExternalData){let e=[];for(let n of t.externalData){let t=typeof n==`string`?n:n.path;e.push(Ct(typeof n==`string`?n:n.data).then(e=>{i.mountExternalData(t,e)}))}await Promise.all(e)}for(let e of t?.executionProviders??[])if((typeof e==`string`?e:e.name)===`webnn`){if(i.shouldTransferToMLTensor=!1,typeof e!=`string`){let t=e,n=t?.context,r=t?.gpuDevice,a=t?.deviceType,o=t?.powerPreference;i.currentContext=n||(r?await i.webnnCreateMLContext(r):await i.webnnCreateMLContext({deviceType:a,powerPreference:o}))}else i.currentContext=await i.webnnCreateMLContext();break}a=await i._OrtCreateSession(n,r,o),i.webgpuOnCreateSession?.(a),a===0&&W(`Can't create a session.`),i.jsepOnCreateSession?.(),i.currentContext&&(i.webnnRegisterMLContext(a,i.currentContext),i.currentContext=void 0,i.shouldTransferToMLTensor=!0);let[e,u]=Dt(a),d=!!t?.enableGraphCapture,f=[],p=[],m=[],h=[];for(let t=0;t<e;t++){let[e,n,r]=Ot(a,t);e===0&&W(`Can't get an input name.`),c.push(e);let o=i.UTF8ToString(e);f.push(o),m.push(n===0?{name:o,isTensor:!1}:{name:o,isTensor:!0,type:gt(n),shape:r})}for(let t=0;t<u;t++){let[n,r,o]=Ot(a,t+e);n===0&&W(`Can't get an output name.`),l.push(n);let s=i.UTF8ToString(n);p.push(s),h.push(r===0?{name:s,isTensor:!1}:{name:s,isTensor:!0,type:gt(r),shape:o})}return J.set(a,[a,c,l,null,d,!1]),[a,f,p,m,h]}catch(e){throw c.forEach(e=>i._OrtFree(e)),l.forEach(e=>i._OrtFree(e)),a!==0&&i._OrtReleaseSession(a)!==0&&W(`Can't release session.`),e}finally{i._free(n),o!==0&&i._OrtReleaseSessionOptions(o)!==0&&W(`Can't release session options.`),s.forEach(e=>i._free(e)),i.unmountExternalData?.()}},jt=e=>{let t=H(),n=J.get(e);if(!n)throw Error(`cannot release session. invalid session id: ${e}`);let[r,i,a,o,s]=n;o&&(s&&t._OrtClearBoundOutputs(o.handle)!==0&&W(`Can't clear bound outputs.`),t._OrtReleaseBinding(o.handle)!==0&&W(`Can't release IO binding.`)),t.jsepOnReleaseSession?.(e),t.webnnOnReleaseSession?.(e),t.webgpuOnReleaseSession?.(e),i.forEach(e=>t._OrtFree(e)),a.forEach(e=>t._OrtFree(e)),t._OrtReleaseSession(r)!==0&&W(`Can't release session.`),J.delete(e)},Mt=async(e,t,n,r,i,a,o=!1)=>{if(!e){t.push(0);return}let s=H(),c=s.PTR_SIZE,l=e[0],u=e[1],d=e[3],f=d,p,m;if(l===`string`&&(d===`gpu-buffer`||d===`ml-tensor`))throw Error(`String tensor is not supported on GPU.`);if(o&&d!==`gpu-buffer`)throw Error(`External buffer must be provided for input/output index ${a} when enableGraphCapture is true.`);if(d===`gpu-buffer`){let t=e[2].gpuBuffer;m=K(ht(l),u);{let e=s.jsepRegisterBuffer;if(!e)throw Error(`Tensor location "gpu-buffer" is not supported without using WebGPU.`);p=e(r,a,t,m)}}else if(d===`ml-tensor`){let t=e[2].mlTensor;m=K(ht(l),u);let n=s.webnnRegisterMLTensor;if(!n)throw Error(`Tensor location "ml-tensor" is not supported without using WebNN.`);p=n(r,t,ht(l),u)}else{let t=e[2];if(Array.isArray(t)){m=c*t.length,p=s._malloc(m),n.push(p);for(let e=0;e<t.length;e++){if(typeof t[e]!=`string`)throw TypeError(`tensor data at index ${e} is not a string`);s.setValue(p+e*c,U(t[e],n),`*`)}}else{let e=s.webnnIsGraphInput,a=s.webnnIsGraphOutput;if(l!==`string`&&e&&a){let o=s.UTF8ToString(i);if(e(r,o)||a(r,o)){let e=ht(l);m=K(e,u),f=`ml-tensor`;let n=s.webnnCreateTemporaryTensor,i=s.webnnUploadTensor;if(!n||!i)throw Error(`Tensor location "ml-tensor" is not supported without using WebNN.`);let a=await n(r,e,u);i(a,new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),p=a}else m=t.byteLength,p=s._malloc(m),n.push(p),s.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,m),p)}else m=t.byteLength,p=s._malloc(m),n.push(p),s.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,m),p)}}let h=s.stackSave(),g=s.stackAlloc(4*u.length);try{u.forEach((e,t)=>s.setValue(g+t*c,e,c===4?`i32`:`i64`));let e=s._OrtCreateTensor(ht(l),p,m,g,u.length,xt(f));e===0&&W(`Can't create tensor for input/output. session=${r}, index=${a}.`),t.push(e)}finally{s.stackRestore(h)}},Nt=async(e,t,n,r,i,a)=>{let o=H(),s=o.PTR_SIZE,c=J.get(e);if(!c)throw Error(`cannot run inference. invalid session id: ${e}`);let l=c[0],u=c[1],d=c[2],f=c[3],p=c[4];c[5];let m=t.length,h=r.length,g=0,_=[],v=[],y=[],ee=[],b=o.stackSave(),te=o.stackAlloc(m*s),x=o.stackAlloc(m*s),S=o.stackAlloc(h*s),C=o.stackAlloc(h*s);try{[g,_]=st(a),F(`wasm prepareInputOutputTensor`);for(let r=0;r<m;r++)await Mt(n[r],v,ee,e,u[t[r]],t[r],p);for(let t=0;t<h;t++)await Mt(i[t],y,ee,e,d[r[t]],m+r[t],p);I(`wasm prepareInputOutputTensor`);for(let e=0;e<m;e++)o.setValue(te+e*s,v[e],`*`),o.setValue(x+e*s,u[t[e]],`*`);for(let e=0;e<h;e++)o.setValue(S+e*s,y[e],`*`),o.setValue(C+e*s,d[r[e]],`*`);o.jsepOnRunStart?.(l),o.webnnOnRunStart?.(l);let c;c=await o._OrtRun(l,x,te,m,C,h,S,g),c!==0&&W(`failed to call OrtRun().`);let b=[],ne=[];F(`wasm ProcessOutputTensor`);for(let t=0;t<h;t++){let n=Number(o.getValue(S+t*s,`*`));if(n===y[t]){b.push(i[t]);continue}let a=o.stackSave(),c=o.stackAlloc(4*s),l=!1,u,d=0;try{o._OrtGetTensorData(n,c,c+s,c+2*s,c+3*s)!==0&&W(`Can't access output tensor data on index ${t}.`);let i=s===4?`i32`:`i64`,a=Number(o.getValue(c,i));d=o.getValue(c+s,`*`);let p=o.getValue(c+s*2,`*`),m=Number(o.getValue(c+s*3,i)),h=[];for(let e=0;e<m;e++)h.push(Number(o.getValue(p+e*s,i)));o._OrtFree(p)!==0&&W(`Can't free memory for tensor dims.`);let g=h.reduce((e,t)=>e*t,1);u=gt(a);let _=f?.outputPreferredLocations[r[t]];if(u===`string`){if(_===`gpu-buffer`||_===`ml-tensor`)throw Error(`String tensor is not supported on GPU.`);let e=[];for(let t=0;t<g;t++){let n=o.getValue(d+t*s,`*`),r=o.getValue(d+(t+1)*s,`*`),i=t===g-1?void 0:r-n;e.push(o.UTF8ToString(n,i))}b.push([u,h,e,`cpu`])}else if(_===`gpu-buffer`&&g>0){let e=o.jsepGetBuffer;if(!e)throw Error(`preferredLocation "gpu-buffer" is not supported without using WebGPU.`);let t=e(d),r=K(a,g);if(r===void 0||!yt(u))throw Error(`Unsupported data type: ${u}`);l=!0,b.push([u,h,{gpuBuffer:t,download:o.jsepCreateDownloader(t,r,u),dispose:()=>{o._OrtReleaseTensor(n)!==0&&W(`Can't release tensor.`)}},`gpu-buffer`])}else if(_===`ml-tensor`&&g>0){let t=o.webnnEnsureTensor,r=o.webnnIsGraphInputOutputTypeSupported;if(!t||!r)throw Error(`preferredLocation "ml-tensor" is not supported without using WebNN.`);if(K(a,g)===void 0||!bt(u))throw Error(`Unsupported data type: ${u}`);if(!r(e,u,!1))throw Error(`preferredLocation "ml-tensor" for ${u} output is not supported by current WebNN Context.`);let i=await t(e,d,a,h,!1);l=!0,b.push([u,h,{mlTensor:i,download:o.webnnCreateMLTensorDownloader(d,u),dispose:()=>{o.webnnReleaseTensorId(d),o._OrtReleaseTensor(n)}},`ml-tensor`])}else if(_===`ml-tensor-cpu-output`&&g>0){let e=o.webnnCreateMLTensorDownloader(d,u)(),t=b.length;l=!0,ne.push((async()=>{let r=[t,await e];return o.webnnReleaseTensorId(d),o._OrtReleaseTensor(n),r})()),b.push([u,h,[],`cpu`])}else{let e=new(_t(u))(g);new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(o.HEAPU8.subarray(d,d+e.byteLength)),b.push([u,h,e,`cpu`])}}finally{o.stackRestore(a),u===`string`&&d&&o._free(d),l||o._OrtReleaseTensor(n)}}f&&!p&&(o._OrtClearBoundOutputs(f.handle)!==0&&W(`Can't clear bound outputs.`),J.set(e,[l,u,d,f,p,!1]));for(let[e,t]of await Promise.all(ne))b[e][2]=t;return I(`wasm ProcessOutputTensor`),b}finally{o.webnnOnRunEnd?.(l),o.stackRestore(b),v.forEach(e=>o._OrtReleaseTensor(e)),y.forEach(e=>o._OrtReleaseTensor(e)),ee.forEach(e=>o._free(e)),g!==0&&o._OrtReleaseRunOptions(g),_.forEach(e=>o._free(e))}},Pt=e=>{let t=H(),n=J.get(e);if(!n)throw Error(`invalid session id`);let r=n[0],i=t._OrtEndProfiling(r);i===0&&W(`Can't get an profile file name.`),t._OrtFree(i)},Ft=e=>{let t=[];for(let n of e){let e=n[2];!Array.isArray(e)&&`buffer`in e&&t.push(e.buffer)}return t}}),Y,X,Lt,Rt,zt,Z,Bt,Vt,Q,$,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt=l(()=>{z(),It(),it(),Xe(),Y=()=>!!C.wasm.proxy&&typeof document<`u`,Lt=!1,Rt=!1,zt=!1,Vt=/* @__PURE__ */ new Map,Q=(e,t)=>{let n=Vt.get(e);n?n.push(t):Vt.set(e,[t])},$=()=>{if(Lt||!Rt||zt||!X)throw Error(`worker not ready`)},Ht=e=>{switch(e.data.type){case`init-wasm`:Lt=!1,e.data.err?(zt=!0,Bt[1](e.data.err)):(Rt=!0,Bt[0]()),Z&&=(URL.revokeObjectURL(Z),void 0);break;case`init-ep`:case`copy-from`:case`create`:case`release`:case`run`:case`end-profiling`:{let t=Vt.get(e.data.type);e.data.err?t.shift()[1](e.data.err):t.shift()[0](e.data.out);break}}},Ut=async()=>{if(!Rt){if(Lt)throw Error(`multiple calls to 'initWasm()' detected.`);if(zt)throw Error(`previous call to 'initWasm()' failed.`);if(Lt=!0,Y())return new Promise((e,t)=>{X?.terminate(),qe().then(([n,r])=>{try{X=r,X.onerror=e=>t(e),X.onmessage=Ht,Bt=[e,t];let i={type:`init-wasm`,in:C};!i.in.wasm.wasmPaths&&(n||Re)&&(i.in.wasm.wasmPaths={wasm:new URL(`/assets/ort-wasm-simd-threaded-CxTQ5xH-.wasm`,``+import.meta.url).href}),X.postMessage(i),Z=n}catch(e){t(e)}},t)});try{await rt(C.wasm),await q(C),Rt=!0}catch(e){throw zt=!0,e}finally{Lt=!1}}},Wt=async e=>{if(Y())return $(),new Promise((t,n)=>{Q(`init-ep`,[t,n]);let r={type:`init-ep`,in:{epName:e,env:C}};X.postMessage(r)});await Et(C,e)},Gt=async e=>Y()?($(),new Promise((t,n)=>{Q(`copy-from`,[t,n]);let r={type:`copy-from`,in:{buffer:e}};X.postMessage(r,[e.buffer])})):kt(e),Kt=async(e,t)=>{if(Y()){if(t?.preferredOutputLocation)throw Error(`session option "preferredOutputLocation" is not supported for proxy.`);return $(),new Promise((n,r)=>{Q(`create`,[n,r]);let i={type:`create`,in:{model:e,options:{...t}}},a=[];e instanceof Uint8Array&&a.push(e.buffer),X.postMessage(i,a)})}return At(e,t)},qt=async e=>{if(Y())return $(),new Promise((t,n)=>{Q(`release`,[t,n]);let r={type:`release`,in:e};X.postMessage(r)});jt(e)},Jt=async(e,t,n,r,i,a)=>{if(Y()){if(n.some(e=>e[3]!==`cpu`))throw Error(`input tensor on GPU is not supported for proxy.`);if(i.some(e=>e))throw Error(`pre-allocated output tensor is not supported for proxy.`);return $(),new Promise((i,o)=>{Q(`run`,[i,o]);let s=n,c={type:`run`,in:{sessionId:e,inputIndices:t,inputs:s,outputIndices:r,options:a}};X.postMessage(c,Ft(s))})}return Nt(e,t,n,r,i,a)},Yt=async e=>{if(Y())return $(),new Promise((t,n)=>{Q(`end-profiling`,[t,n]);let r={type:`end-profiling`,in:e};X.postMessage(r)});Pt(e)}}),Zt,Qt,$t,en=l(()=>{z(),Xt(),St(),Ee(),wt(),Zt=(e,t)=>{switch(e.location){case`cpu`:return[e.type,e.dims,e.data,`cpu`];case`gpu-buffer`:return[e.type,e.dims,{gpuBuffer:e.gpuBuffer},`gpu-buffer`];case`ml-tensor`:return[e.type,e.dims,{mlTensor:e.mlTensor},`ml-tensor`];default:throw Error(`invalid data location: ${e.location} for ${t()}`)}},Qt=e=>{switch(e[3]){case`cpu`:return new M(e[0],e[2],e[1]);case`gpu-buffer`:{let t=e[0];if(!yt(t))throw Error(`not supported data type: ${t} for deserializing GPU tensor`);let{gpuBuffer:n,download:r,dispose:i}=e[2];return M.fromGpuBuffer(n,{dataType:t,dims:e[1],download:r,dispose:i})}case`ml-tensor`:{let t=e[0];if(!bt(t))throw Error(`not supported data type: ${t} for deserializing MLTensor tensor`);let{mlTensor:n,download:r,dispose:i}=e[2];return M.fromMLTensor(n,{dataType:t,dims:e[1],download:r,dispose:i})}default:throw Error(`invalid data location: ${e[3]}`)}},$t=class{async fetchModelAndCopyToWasmMemory(e){return Gt(await Ct(e))}async loadModel(e,t){N();let n;n=typeof e==`string`?await this.fetchModelAndCopyToWasmMemory(e):e,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await Kt(n,t),P()}async dispose(){return qt(this.sessionId)}async run(e,t,n){N();let r=[],i=[];Object.entries(e).forEach(e=>{let t=e[0],n=e[1],a=this.inputNames.indexOf(t);if(a===-1)throw Error(`invalid input '${t}'`);r.push(n),i.push(a)});let a=[],o=[];Object.entries(t).forEach(e=>{let t=e[0],n=e[1],r=this.outputNames.indexOf(t);if(r===-1)throw Error(`invalid output '${t}'`);a.push(n),o.push(r)});let s=r.map((e,t)=>Zt(e,()=>`input "${this.inputNames[i[t]]}"`)),c=a.map((e,t)=>e?Zt(e,()=>`output "${this.outputNames[o[t]]}"`):null),l=await Jt(this.sessionId,i,s,o,c,n),u={};for(let e=0;e<l.length;e++)u[this.outputNames[o[e]]]=a[e]??Qt(l[e]);return P(),u}startProfiling(){}endProfiling(){Yt(this.sessionId)}}}),tn={};u(tn,{OnnxruntimeWebAssemblyBackend:()=>rn,initializeFlags:()=>nn,wasmBackend:()=>an});var nn,rn,an,on=l(()=>{z(),Xt(),en(),nn=()=>{(typeof C.wasm.initTimeout!=`number`||C.wasm.initTimeout<0)&&(C.wasm.initTimeout=0);let e=C.wasm.simd;if(typeof e!=`boolean`&&e!==void 0&&e!==`fixed`&&e!==`relaxed`&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${e}". Reset it to \`false\` and ignore SIMD feature checking.`),C.wasm.simd=!1),typeof C.wasm.proxy!=`boolean`&&(C.wasm.proxy=!1),typeof C.wasm.trace!=`boolean`&&(C.wasm.trace=!1),typeof C.wasm.numThreads!=`number`||!Number.isInteger(C.wasm.numThreads)||C.wasm.numThreads<=0){if(typeof self<`u`&&!self.crossOriginIsolated)C.wasm.numThreads=1;else{let e=typeof navigator>`u`?c(`node:os`).cpus().length:navigator.hardwareConcurrency;C.wasm.numThreads=Math.min(4,Math.ceil((e||1)/2))}}},rn=class{async init(e){nn(),await Ut(),await Wt(e)}async createInferenceSessionHandler(e,t){let n=new $t;return await n.loadModel(e,t),n}},an=new rn});z(),z(),z();var sn=`1.23.2`,cn=Te;{let e=(on(),f(tn)).wasmBackend;h(`cpu`,e,10),h(`wasm`,e,10)}Object.defineProperty(C.versions,"web",{value:sn,enumerable:!0});var ln=`/assets/silero_vad-Dt9-bTDn.onnx`;27/Math.log(6.4);const un=/* @__PURE__ */ new Float64Array(400),dn=/* @__PURE__ */ new Float64Array(400);for(let e=0;e<400;e++)un[e]=Math.cos(2*Math.PI*e/400),dn[e]=-Math.sin(2*Math.PI*e/400);Object.freeze([`timers`,`smart`]),Object.freeze({threshold:.5,graceMs:150,recheckMs:400,fallbackMs:3e3,slowMs:1500}),Object.freeze([{key:`voiceTurn.threshold`,field:`threshold`,min:.01,max:.99},{key:`voiceTurn.grace`,field:`graceMs`,min:0,max:2e3},{key:`voiceTurn.recheck`,field:`recheckMs`,min:100,max:5e3},{key:`voiceTurn.fallback`,field:`fallbackMs`,min:500,max:1e4},{key:`voiceTurn.slow`,field:`slowMs`,min:500,max:5e3}]),[.../* @__PURE__ */ new Set([`um`,`umm`,`uh`,`uhh`,`uhm`,`erm`,`er`,`eh`,`ah`,`hmm`,`hm`,`mm`,`mmm`,`mhm`,`mm-hmm`,`uh-huh`])];const fn=Object.freeze({minSpeechMs:300,endSilenceMs:350,trailingKeepMs:200,preRollMs:300,holdMs:1600,finishedHoldMs:1e3});fn.trailingKeepMs;const pn=Object.freeze({startProb:.6,endProb:.35,speakingStartProb:.85,minSpeechMs:250,endSilenceMs:fn.endSilenceMs,maxSegmentMs:6e4,gateDb:3,energyMarginDb:10,energyMinSpeechMs:fn.minSpeechMs});Object.freeze([`low`,`normal`,`high`]),Object.freeze({low:Object.freeze({...pn,startProb:.75,endProb:.45,speakingStartProb:.92,minSpeechMs:350,gateDb:6,energyMarginDb:13,energyMinSpeechMs:400}),normal:pn,high:Object.freeze({...pn,startProb:.45,endProb:.25,speakingStartProb:.75,minSpeechMs:180,gateDb:0,energyMarginDb:7,energyMinSpeechMs:250})});var mn=class e{ort;session;state=/* @__PURE__ */ new Float32Array(256);context=/* @__PURE__ */ new Float32Array(64);sr;constructor(e,t){this.ort=e,this.session=t,this.sr=new e.Tensor(`int64`,BigInt64Array.from([BigInt(16e3)]),[])}static async load(t,n){let r=await t.InferenceSession.create(n,{executionProviders:[`wasm`],graphOptimizationLevel:`all`});return new e(t,r)}reset(){this.state=/* @__PURE__ */ new Float32Array(256),this.context=/* @__PURE__ */ new Float32Array(64)}async probability(e){if(e.length!==512)throw Error(`Silero VAD needs 512-sample chunks, got ${e.length}`);let t=/* @__PURE__ */ new Float32Array(576);t.set(this.context),t.set(e,64),this.context=e.slice(448);let n=await this.session.run({input:new this.ort.Tensor(`float32`,t,[1,t.length]),state:new this.ort.Tensor(`float32`,this.state,[2,1,128]),sr:this.sr});return this.state=Float32Array.from(n.stateN.data),n.output.data[0]}};C.wasm.numThreads=1,C.wasm.proxy=!1,C.logLevel=`error`;const hn=self,gn=performance.now(),_n=(async()=>{let e=await fetch(ln);if(!e.ok)throw Error(`model download failed (${e.status})`);return mn.load(r,new Uint8Array(await e.arrayBuffer()))})();_n.then(()=>hn.postMessage({type:`ready`,ms:Math.round(performance.now()-gn)}),e=>hn.postMessage({type:`error`,message:e instanceof Error?e.message:String(e)}));let vn=Promise.resolve();hn.onmessage=e=>{let t=e.data;vn=vn.then(async()=>{let e;try{e=await _n}catch(e){t.type===`chunk`&&hn.postMessage({type:`fail`,id:t.id,message:String(e?.message??e)});return}if(t.type===`reset`)return e.reset();if(t.type===`chunk`)try{hn.postMessage({type:`prob`,id:t.id,p:await e.probability(t.samples)})}catch(e){hn.postMessage({type:`fail`,id:t.id,message:String(e?.message??e)})}})};
|
|
11
|
+
e)).default,Ke=(je(),f(De)).default,qe=async()=>{if(!B)throw Error(`Failed to load proxy worker: cannot determine the script source URL.`);if(Ve(B))return[void 0,Ke()];let e=await We(B);return[e,Ke(e)]},Je=(Ie(),f(Me)).default,Ye=async(e,t,n,r)=>{let i=Je&&!(e||t);if(i){if(B)i=Ve(B);else if(r&&!n)i=!0;else throw Error(`cannot determine the script source URL.`)}if(i)return[void 0,Je];{let r=`ort-wasm-simd-threaded.mjs`,i=e??He(r,t),a=n&&i&&!Ve(i,t),o=a?await We(i):i??Ue(r,t);return[a?o:void 0,await Ge(o)]}}}),Ze,Qe,V,$e,et,tt,nt,rt,H,it=l(()=>{Xe(),Qe=!1,V=!1,$e=!1,et=()=>{if(typeof SharedArrayBuffer>`u`)return!1;try{return typeof MessageChannel<`u`&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},tt=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},nt=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},rt=async e=>{if(Qe)return Promise.resolve();if(V)throw Error(`multiple calls to 'initializeWebAssembly()' detected.`);if($e)throw Error(`previous call to 'initializeWebAssembly()' failed.`);V=!0;let t=e.initTimeout,n=e.numThreads;if(e.simd!==!1){if(e.simd===`relaxed`){if(!nt())throw Error(`Relaxed WebAssembly SIMD is not supported in the current environment.`)}else if(!tt())throw Error(`WebAssembly SIMD is not supported in the current environment.`)}let r=et();n>1&&!r&&(typeof self<`u`&&!self.crossOriginIsolated&&console.warn(`env.wasm.numThreads is set to `+n+`, but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info.`),console.warn(`WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading.`),e.numThreads=n=1);let i=e.wasmPaths,a=typeof i==`string`?i:void 0,o=i?.mjs,s=o?.href??o,c=i?.wasm,l=c?.href??c,u=e.wasmBinary,[d,f]=await Ye(s,a,n>1,!!u||!!l),p=!1,m=[];if(t>0&&m.push(new Promise(e=>{setTimeout(()=>{p=!0,e()},t)})),m.push(new Promise((e,t)=>{let r={numThreads:n};if(u)r.wasmBinary=u;else if(l||a)r.locateFile=e=>l??a+e;else if(s&&s.indexOf(`blob:`)!==0)r.locateFile=e=>new URL(e,s).href;else if(d){let e=Be();e&&(r.locateFile=t=>e+t)}f(r).then(t=>{V=!1,Qe=!0,Ze=t,e(),d&&URL.revokeObjectURL(d)},e=>{V=!1,$e=!0,t(e)})})),await Promise.race(m),p)throw Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},H=()=>{if(Qe&&Ze)return Ze;throw Error(`WebAssembly is not initialized yet.`)}}),U,at,W,ot=l(()=>{it(),U=(e,t)=>{let n=H(),r=n.lengthBytesUTF8(e)+1,i=n._malloc(r);return n.stringToUTF8(e,i,r),t.push(i),i},at=(e,t,n,r)=>{if(typeof e==`object`&&e){if(n.has(e))throw Error(`Circular reference in options`);n.add(e)}Object.entries(e).forEach(([e,i])=>{let a=t?t+e:e;if(typeof i==`object`)at(i,a+`.`,n,r);else if(typeof i==`string`||typeof i==`number`)r(a,i.toString());else if(typeof i==`boolean`)r(a,i?`1`:`0`);else throw Error(`Can't handle extra config type: ${typeof i}`)})},W=e=>{let t=H(),n=t.stackSave();try{let n=t.PTR_SIZE,r=t.stackAlloc(2*n);t._OrtGetLastError(r,r+n);let i=Number(t.getValue(r,n===4?`i32`:`i64`)),a=t.getValue(r+n,`*`),o=a?t.UTF8ToString(a):``;throw Error(`${e} ERROR_CODE: ${i}, ERROR_MESSAGE: ${o}`)}finally{t.stackRestore(n)}}}),st,ct=l(()=>{it(),ot(),st=e=>{let t=H(),n=0,r=[],i=e||{};try{if(e?.logSeverityLevel===void 0)i.logSeverityLevel=2;else if(typeof e.logSeverityLevel!=`number`||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw Error(`log severity level is not valid: ${e.logSeverityLevel}`);if(e?.logVerbosityLevel===void 0)i.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!=`number`||!Number.isInteger(e.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);e?.terminate===void 0&&(i.terminate=!1);let a=0;return e?.tag!==void 0&&(a=U(e.tag,r)),n=t._OrtCreateRunOptions(i.logSeverityLevel,i.logVerbosityLevel,!!i.terminate,a),n===0&&W(`Can't create run options.`),e?.extra!==void 0&&at(e.extra,``,/* @__PURE__ */ new WeakSet,(e,i)=>{let a=U(e,r),o=U(i,r);t._OrtAddRunConfigEntry(n,a,o)!==0&&W(`Can't set a run config entry: ${e} - ${i}.`)}),[n,r]}catch(e){throw n!==0&&t._OrtReleaseRunOptions(n),r.forEach(e=>t._free(e)),e}}}),lt,ut,dt,ft,G,pt,mt=l(()=>{it(),ot(),lt=e=>{switch(e){case`disabled`:return 0;case`basic`:return 1;case`extended`:return 2;case`layout`:return 3;case`all`:return 99;default:throw Error(`unsupported graph optimization level: ${e}`)}},ut=e=>{switch(e){case`sequential`:return 0;case`parallel`:return 1;default:throw Error(`unsupported execution mode: ${e}`)}},dt=e=>{e.extra||={},e.extra.session||(e.extra.session={});let t=e.extra.session;t.use_ort_model_bytes_directly||=`1`,e.executionProviders&&e.executionProviders.some(e=>(typeof e==`string`?e:e.name)===`webgpu`)&&(e.enableMemPattern=!1)},ft=(e,t,n,r)=>{let i=U(t,r),a=U(n,r);H()._OrtAddSessionConfigEntry(e,i,a)!==0&&W(`Can't set a session config entry: ${t} - ${n}.`)},G=async(e,t,n)=>{for(let r of t){let t=typeof r==`string`?r:r.name,i=[];switch(t){case`webnn`:if(t=`WEBNN`,typeof r!=`string`){let t=r?.deviceType;t&&ft(e,`deviceType`,t,n)}break;case`webgpu`:if(t=`JS`,typeof r!=`string`){let t=r;if(t?.preferredLayout){if(t.preferredLayout!==`NCHW`&&t.preferredLayout!==`NHWC`)throw Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${t.preferredLayout}`);ft(e,`preferredLayout`,t.preferredLayout,n)}}break;case`wasm`:case`cpu`:continue;default:throw Error(`not supported execution provider: ${t}`)}let a=U(t,n),o=i.length,s=0,c=0;if(o>0){s=H()._malloc(o*H().PTR_SIZE),n.push(s),c=H()._malloc(o*H().PTR_SIZE),n.push(c);for(let e=0;e<o;e++)H().setValue(s+e*H().PTR_SIZE,i[e][0],`*`),H().setValue(c+e*H().PTR_SIZE,i[e][1],`*`)}await H()._OrtAppendExecutionProvider(e,a,s,c,o)!==0&&W(`Can't append execution provider: ${t}.`)}},pt=async e=>{let t=H(),n=0,r=[],i=e||{};dt(i);try{let e=lt(i.graphOptimizationLevel??`all`),a=ut(i.executionMode??`sequential`),o=typeof i.logId==`string`?U(i.logId,r):0,s=i.logSeverityLevel??2;if(!Number.isInteger(s)||s<0||s>4)throw Error(`log severity level is not valid: ${s}`);let c=i.logVerbosityLevel??0;if(!Number.isInteger(c)||c<0||c>4)throw Error(`log verbosity level is not valid: ${c}`);let l=typeof i.optimizedModelFilePath==`string`?U(i.optimizedModelFilePath,r):0;if(n=t._OrtCreateSessionOptions(e,!!i.enableCpuMemArena,!!i.enableMemPattern,a,!!i.enableProfiling,0,o,s,c,l),n===0&&W(`Can't create session options.`),i.executionProviders&&await G(n,i.executionProviders,r),i.enableGraphCapture!==void 0){if(typeof i.enableGraphCapture!=`boolean`)throw Error(`enableGraphCapture must be a boolean value: ${i.enableGraphCapture}`);ft(n,`enableGraphCapture`,i.enableGraphCapture.toString(),r)}if(i.freeDimensionOverrides)for(let[e,a]of Object.entries(i.freeDimensionOverrides)){if(typeof e!=`string`)throw Error(`free dimension override name must be a string: ${e}`);if(typeof a!=`number`||!Number.isInteger(a)||a<0)throw Error(`free dimension override value must be a non-negative integer: ${a}`);let i=U(e,r);t._OrtAddFreeDimensionOverride(n,i,a)!==0&&W(`Can't set a free dimension override: ${e} - ${a}.`)}return i.extra!==void 0&&at(i.extra,``,/* @__PURE__ */ new WeakSet,(e,t)=>{ft(n,e,t,r)}),[n,r]}catch(e){throw n!==0&&t._OrtReleaseSessionOptions(n)!==0&&W(`Can't release session options.`),r.forEach(e=>t._free(e)),e}}}),ht,gt,K,_t,vt,yt,bt,xt,St=l(()=>{ht=e=>{switch(e){case`int8`:return 3;case`uint8`:return 2;case`bool`:return 9;case`int16`:return 5;case`uint16`:return 4;case`int32`:return 6;case`uint32`:return 12;case`float16`:return 10;case`float32`:return 1;case`float64`:return 11;case`string`:return 8;case`int64`:return 7;case`uint64`:return 13;case`int4`:return 22;case`uint4`:return 21;default:throw Error(`unsupported data type: ${e}`)}},gt=e=>{switch(e){case 3:return`int8`;case 2:return`uint8`;case 9:return`bool`;case 5:return`int16`;case 4:return`uint16`;case 6:return`int32`;case 12:return`uint32`;case 10:return`float16`;case 1:return`float32`;case 11:return`float64`;case 8:return`string`;case 7:return`int64`;case 13:return`uint64`;case 22:return`int4`;case 21:return`uint4`;default:throw Error(`unsupported data type: ${e}`)}},K=(e,t)=>{let n=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],r=typeof t==`number`?t:t.reduce((e,t)=>e*t,1);return n>0?Math.ceil(r*n):void 0},_t=e=>{switch(e){case`float16`:return typeof Float16Array<`u`&&Float16Array.from?Float16Array:Uint16Array;case`float32`:return Float32Array;case`uint8`:return Uint8Array;case`int8`:return Int8Array;case`uint16`:return Uint16Array;case`int16`:return Int16Array;case`int32`:return Int32Array;case`bool`:return Uint8Array;case`float64`:return Float64Array;case`uint32`:return Uint32Array;case`int64`:return BigInt64Array;case`uint64`:return BigUint64Array;default:throw Error(`unsupported type: ${e}`)}},vt=e=>{switch(e){case`verbose`:return 0;case`info`:return 1;case`warning`:return 2;case`error`:return 3;case`fatal`:return 4;default:throw Error(`unsupported logging level: ${e}`)}},yt=e=>e===`float32`||e===`float16`||e===`int32`||e===`int64`||e===`uint32`||e===`uint8`||e===`bool`||e===`uint4`||e===`int4`,bt=e=>e===`float32`||e===`float16`||e===`int32`||e===`int64`||e===`uint32`||e===`uint64`||e===`int8`||e===`uint8`||e===`bool`||e===`uint4`||e===`int4`,xt=e=>{switch(e){case`none`:return 0;case`cpu`:return 1;case`cpu-pinned`:return 2;case`texture`:return 3;case`gpu-buffer`:return 4;case`ml-tensor`:return 5;default:throw Error(`unsupported data location: ${e}`)}}}),Ct,wt=l(()=>{Ee(),Ct=async e=>{if(typeof e==`string`){let t=await fetch(e);if(!t.ok)throw Error(`failed to load external data file: ${e}`);let n=t.headers.get(`Content-Length`),r=n?parseInt(n,10):0;if(r<1073741824)return new Uint8Array(await t.arrayBuffer());{if(!t.body)throw Error(`failed to load external data file: ${e}, no response body.`);let n=t.body.getReader(),i;try{i=new ArrayBuffer(r)}catch(e){if(e instanceof RangeError){let e=Math.ceil(r/65536);i=new WebAssembly.Memory({initial:e,maximum:e}).buffer}else throw e}let a=0;for(;;){let{done:e,value:t}=await n.read();if(e)break;let r=t.byteLength;new Uint8Array(i,a,r).set(t),a+=r}return new Uint8Array(i,0,r)}}return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),Tt,q,Et,J,Dt,Ot,kt,At,jt,Mt,Nt,Pt,Ft,It=l(()=>{z(),ct(),mt(),St(),it(),ot(),wt(),Tt=(e,t)=>{H()._OrtInit(e,t)!==0&&W(`Can't initialize onnxruntime.`)},q=async e=>{Tt(e.wasm.numThreads,vt(e.logLevel))},Et=async(e,t)=>{H().asyncInit?.();let n=e.webgpu.adapter;if(t===`webgpu`){if(typeof navigator>`u`||!navigator.gpu)throw Error(`WebGPU is not supported in current environment`);if(n){if(typeof n.limits!=`object`||typeof n.features!=`object`||typeof n.requestDevice!=`function`)throw Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let t=e.webgpu.powerPreference;if(t!==void 0&&t!==`low-power`&&t!==`high-performance`)throw Error(`Invalid powerPreference setting: "${t}"`);let r=e.webgpu.forceFallbackAdapter;if(r!==void 0&&typeof r!=`boolean`)throw Error(`Invalid forceFallbackAdapter setting: "${r}"`);if(n=await navigator.gpu.requestAdapter({powerPreference:t,forceFallbackAdapter:r}),!n)throw Error(`Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.`)}}if(t===`webnn`&&(typeof navigator>`u`||!navigator.ml))throw Error(`WebNN is not supported in current environment`)},J=/* @__PURE__ */ new Map,Dt=e=>{let t=H(),n=t.stackSave();try{let n=t.PTR_SIZE,r=t.stackAlloc(2*n);t._OrtGetInputOutputCount(e,r,r+n)!==0&&W(`Can't get session input/output count.`);let i=n===4?`i32`:`i64`;return[Number(t.getValue(r,i)),Number(t.getValue(r+n,i))]}finally{t.stackRestore(n)}},Ot=(e,t)=>{let n=H(),r=n.stackSave(),i=0;try{let r=n.PTR_SIZE,a=n.stackAlloc(2*r);n._OrtGetInputOutputMetadata(e,t,a,a+r)!==0&&W(`Can't get session input/output metadata.`);let o=Number(n.getValue(a,`*`));i=Number(n.getValue(a+r,`*`));let s=n.HEAP32[i/4];if(s===0)return[o,0];let c=n.HEAPU32[i/4+1],l=[];for(let e=0;e<c;e++){let t=Number(n.getValue(i+8+e*r,`*`));l.push(t===0?Number(n.getValue(i+8+(e+c)*r,`*`)):n.UTF8ToString(t))}return[o,s,l]}finally{n.stackRestore(r),i!==0&&n._OrtFree(i)}},kt=e=>{let t=H(),n=t._malloc(e.byteLength);if(n===0)throw Error(`Can't create a session. failed to allocate a buffer of size ${e.byteLength}.`);return t.HEAPU8.set(e,n),[n,e.byteLength]},At=async(e,t)=>{let n,r,i=H();Array.isArray(e)?[n,r]=e:e.buffer===i.HEAPU8.buffer?[n,r]=[e.byteOffset,e.byteLength]:[n,r]=kt(e);let a=0,o=0,s=[],c=[],l=[];try{if([o,s]=await pt(t),t?.externalData&&i.mountExternalData){let e=[];for(let n of t.externalData){let t=typeof n==`string`?n:n.path;e.push(Ct(typeof n==`string`?n:n.data).then(e=>{i.mountExternalData(t,e)}))}await Promise.all(e)}for(let e of t?.executionProviders??[])if((typeof e==`string`?e:e.name)===`webnn`){if(i.shouldTransferToMLTensor=!1,typeof e!=`string`){let t=e,n=t?.context,r=t?.gpuDevice,a=t?.deviceType,o=t?.powerPreference;i.currentContext=n||(r?await i.webnnCreateMLContext(r):await i.webnnCreateMLContext({deviceType:a,powerPreference:o}))}else i.currentContext=await i.webnnCreateMLContext();break}a=await i._OrtCreateSession(n,r,o),i.webgpuOnCreateSession?.(a),a===0&&W(`Can't create a session.`),i.jsepOnCreateSession?.(),i.currentContext&&(i.webnnRegisterMLContext(a,i.currentContext),i.currentContext=void 0,i.shouldTransferToMLTensor=!0);let[e,u]=Dt(a),d=!!t?.enableGraphCapture,f=[],p=[],m=[],h=[];for(let t=0;t<e;t++){let[e,n,r]=Ot(a,t);e===0&&W(`Can't get an input name.`),c.push(e);let o=i.UTF8ToString(e);f.push(o),m.push(n===0?{name:o,isTensor:!1}:{name:o,isTensor:!0,type:gt(n),shape:r})}for(let t=0;t<u;t++){let[n,r,o]=Ot(a,t+e);n===0&&W(`Can't get an output name.`),l.push(n);let s=i.UTF8ToString(n);p.push(s),h.push(r===0?{name:s,isTensor:!1}:{name:s,isTensor:!0,type:gt(r),shape:o})}return J.set(a,[a,c,l,null,d,!1]),[a,f,p,m,h]}catch(e){throw c.forEach(e=>i._OrtFree(e)),l.forEach(e=>i._OrtFree(e)),a!==0&&i._OrtReleaseSession(a)!==0&&W(`Can't release session.`),e}finally{i._free(n),o!==0&&i._OrtReleaseSessionOptions(o)!==0&&W(`Can't release session options.`),s.forEach(e=>i._free(e)),i.unmountExternalData?.()}},jt=e=>{let t=H(),n=J.get(e);if(!n)throw Error(`cannot release session. invalid session id: ${e}`);let[r,i,a,o,s]=n;o&&(s&&t._OrtClearBoundOutputs(o.handle)!==0&&W(`Can't clear bound outputs.`),t._OrtReleaseBinding(o.handle)!==0&&W(`Can't release IO binding.`)),t.jsepOnReleaseSession?.(e),t.webnnOnReleaseSession?.(e),t.webgpuOnReleaseSession?.(e),i.forEach(e=>t._OrtFree(e)),a.forEach(e=>t._OrtFree(e)),t._OrtReleaseSession(r)!==0&&W(`Can't release session.`),J.delete(e)},Mt=async(e,t,n,r,i,a,o=!1)=>{if(!e){t.push(0);return}let s=H(),c=s.PTR_SIZE,l=e[0],u=e[1],d=e[3],f=d,p,m;if(l===`string`&&(d===`gpu-buffer`||d===`ml-tensor`))throw Error(`String tensor is not supported on GPU.`);if(o&&d!==`gpu-buffer`)throw Error(`External buffer must be provided for input/output index ${a} when enableGraphCapture is true.`);if(d===`gpu-buffer`){let t=e[2].gpuBuffer;m=K(ht(l),u);{let e=s.jsepRegisterBuffer;if(!e)throw Error(`Tensor location "gpu-buffer" is not supported without using WebGPU.`);p=e(r,a,t,m)}}else if(d===`ml-tensor`){let t=e[2].mlTensor;m=K(ht(l),u);let n=s.webnnRegisterMLTensor;if(!n)throw Error(`Tensor location "ml-tensor" is not supported without using WebNN.`);p=n(r,t,ht(l),u)}else{let t=e[2];if(Array.isArray(t)){m=c*t.length,p=s._malloc(m),n.push(p);for(let e=0;e<t.length;e++){if(typeof t[e]!=`string`)throw TypeError(`tensor data at index ${e} is not a string`);s.setValue(p+e*c,U(t[e],n),`*`)}}else{let e=s.webnnIsGraphInput,a=s.webnnIsGraphOutput;if(l!==`string`&&e&&a){let o=s.UTF8ToString(i);if(e(r,o)||a(r,o)){let e=ht(l);m=K(e,u),f=`ml-tensor`;let n=s.webnnCreateTemporaryTensor,i=s.webnnUploadTensor;if(!n||!i)throw Error(`Tensor location "ml-tensor" is not supported without using WebNN.`);let a=await n(r,e,u);i(a,new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),p=a}else m=t.byteLength,p=s._malloc(m),n.push(p),s.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,m),p)}else m=t.byteLength,p=s._malloc(m),n.push(p),s.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,m),p)}}let h=s.stackSave(),g=s.stackAlloc(4*u.length);try{u.forEach((e,t)=>s.setValue(g+t*c,e,c===4?`i32`:`i64`));let e=s._OrtCreateTensor(ht(l),p,m,g,u.length,xt(f));e===0&&W(`Can't create tensor for input/output. session=${r}, index=${a}.`),t.push(e)}finally{s.stackRestore(h)}},Nt=async(e,t,n,r,i,a)=>{let o=H(),s=o.PTR_SIZE,c=J.get(e);if(!c)throw Error(`cannot run inference. invalid session id: ${e}`);let l=c[0],u=c[1],d=c[2],f=c[3],p=c[4];c[5];let m=t.length,h=r.length,g=0,_=[],v=[],y=[],ee=[],b=o.stackSave(),te=o.stackAlloc(m*s),x=o.stackAlloc(m*s),S=o.stackAlloc(h*s),C=o.stackAlloc(h*s);try{[g,_]=st(a),F(`wasm prepareInputOutputTensor`);for(let r=0;r<m;r++)await Mt(n[r],v,ee,e,u[t[r]],t[r],p);for(let t=0;t<h;t++)await Mt(i[t],y,ee,e,d[r[t]],m+r[t],p);I(`wasm prepareInputOutputTensor`);for(let e=0;e<m;e++)o.setValue(te+e*s,v[e],`*`),o.setValue(x+e*s,u[t[e]],`*`);for(let e=0;e<h;e++)o.setValue(S+e*s,y[e],`*`),o.setValue(C+e*s,d[r[e]],`*`);o.jsepOnRunStart?.(l),o.webnnOnRunStart?.(l);let c;c=await o._OrtRun(l,x,te,m,C,h,S,g),c!==0&&W(`failed to call OrtRun().`);let b=[],ne=[];F(`wasm ProcessOutputTensor`);for(let t=0;t<h;t++){let n=Number(o.getValue(S+t*s,`*`));if(n===y[t]){b.push(i[t]);continue}let a=o.stackSave(),c=o.stackAlloc(4*s),l=!1,u,d=0;try{o._OrtGetTensorData(n,c,c+s,c+2*s,c+3*s)!==0&&W(`Can't access output tensor data on index ${t}.`);let i=s===4?`i32`:`i64`,a=Number(o.getValue(c,i));d=o.getValue(c+s,`*`);let p=o.getValue(c+s*2,`*`),m=Number(o.getValue(c+s*3,i)),h=[];for(let e=0;e<m;e++)h.push(Number(o.getValue(p+e*s,i)));o._OrtFree(p)!==0&&W(`Can't free memory for tensor dims.`);let g=h.reduce((e,t)=>e*t,1);u=gt(a);let _=f?.outputPreferredLocations[r[t]];if(u===`string`){if(_===`gpu-buffer`||_===`ml-tensor`)throw Error(`String tensor is not supported on GPU.`);let e=[];for(let t=0;t<g;t++){let n=o.getValue(d+t*s,`*`),r=o.getValue(d+(t+1)*s,`*`),i=t===g-1?void 0:r-n;e.push(o.UTF8ToString(n,i))}b.push([u,h,e,`cpu`])}else if(_===`gpu-buffer`&&g>0){let e=o.jsepGetBuffer;if(!e)throw Error(`preferredLocation "gpu-buffer" is not supported without using WebGPU.`);let t=e(d),r=K(a,g);if(r===void 0||!yt(u))throw Error(`Unsupported data type: ${u}`);l=!0,b.push([u,h,{gpuBuffer:t,download:o.jsepCreateDownloader(t,r,u),dispose:()=>{o._OrtReleaseTensor(n)!==0&&W(`Can't release tensor.`)}},`gpu-buffer`])}else if(_===`ml-tensor`&&g>0){let t=o.webnnEnsureTensor,r=o.webnnIsGraphInputOutputTypeSupported;if(!t||!r)throw Error(`preferredLocation "ml-tensor" is not supported without using WebNN.`);if(K(a,g)===void 0||!bt(u))throw Error(`Unsupported data type: ${u}`);if(!r(e,u,!1))throw Error(`preferredLocation "ml-tensor" for ${u} output is not supported by current WebNN Context.`);let i=await t(e,d,a,h,!1);l=!0,b.push([u,h,{mlTensor:i,download:o.webnnCreateMLTensorDownloader(d,u),dispose:()=>{o.webnnReleaseTensorId(d),o._OrtReleaseTensor(n)}},`ml-tensor`])}else if(_===`ml-tensor-cpu-output`&&g>0){let e=o.webnnCreateMLTensorDownloader(d,u)(),t=b.length;l=!0,ne.push((async()=>{let r=[t,await e];return o.webnnReleaseTensorId(d),o._OrtReleaseTensor(n),r})()),b.push([u,h,[],`cpu`])}else{let e=new(_t(u))(g);new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(o.HEAPU8.subarray(d,d+e.byteLength)),b.push([u,h,e,`cpu`])}}finally{o.stackRestore(a),u===`string`&&d&&o._free(d),l||o._OrtReleaseTensor(n)}}f&&!p&&(o._OrtClearBoundOutputs(f.handle)!==0&&W(`Can't clear bound outputs.`),J.set(e,[l,u,d,f,p,!1]));for(let[e,t]of await Promise.all(ne))b[e][2]=t;return I(`wasm ProcessOutputTensor`),b}finally{o.webnnOnRunEnd?.(l),o.stackRestore(b),v.forEach(e=>o._OrtReleaseTensor(e)),y.forEach(e=>o._OrtReleaseTensor(e)),ee.forEach(e=>o._free(e)),g!==0&&o._OrtReleaseRunOptions(g),_.forEach(e=>o._free(e))}},Pt=e=>{let t=H(),n=J.get(e);if(!n)throw Error(`invalid session id`);let r=n[0],i=t._OrtEndProfiling(r);i===0&&W(`Can't get an profile file name.`),t._OrtFree(i)},Ft=e=>{let t=[];for(let n of e){let e=n[2];!Array.isArray(e)&&`buffer`in e&&t.push(e.buffer)}return t}}),Y,X,Lt,Rt,zt,Z,Bt,Vt,Q,$,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt=l(()=>{z(),It(),it(),Xe(),Y=()=>!!C.wasm.proxy&&typeof document<`u`,Lt=!1,Rt=!1,zt=!1,Vt=/* @__PURE__ */ new Map,Q=(e,t)=>{let n=Vt.get(e);n?n.push(t):Vt.set(e,[t])},$=()=>{if(Lt||!Rt||zt||!X)throw Error(`worker not ready`)},Ht=e=>{switch(e.data.type){case`init-wasm`:Lt=!1,e.data.err?(zt=!0,Bt[1](e.data.err)):(Rt=!0,Bt[0]()),Z&&=(URL.revokeObjectURL(Z),void 0);break;case`init-ep`:case`copy-from`:case`create`:case`release`:case`run`:case`end-profiling`:{let t=Vt.get(e.data.type);e.data.err?t.shift()[1](e.data.err):t.shift()[0](e.data.out);break}}},Ut=async()=>{if(!Rt){if(Lt)throw Error(`multiple calls to 'initWasm()' detected.`);if(zt)throw Error(`previous call to 'initWasm()' failed.`);if(Lt=!0,Y())return new Promise((e,t)=>{X?.terminate(),qe().then(([n,r])=>{try{X=r,X.onerror=e=>t(e),X.onmessage=Ht,Bt=[e,t];let i={type:`init-wasm`,in:C};!i.in.wasm.wasmPaths&&(n||Re)&&(i.in.wasm.wasmPaths={wasm:new URL(`/assets/ort-wasm-simd-threaded-CxTQ5xH-.wasm`,``+import.meta.url).href}),X.postMessage(i),Z=n}catch(e){t(e)}},t)});try{await rt(C.wasm),await q(C),Rt=!0}catch(e){throw zt=!0,e}finally{Lt=!1}}},Wt=async e=>{if(Y())return $(),new Promise((t,n)=>{Q(`init-ep`,[t,n]);let r={type:`init-ep`,in:{epName:e,env:C}};X.postMessage(r)});await Et(C,e)},Gt=async e=>Y()?($(),new Promise((t,n)=>{Q(`copy-from`,[t,n]);let r={type:`copy-from`,in:{buffer:e}};X.postMessage(r,[e.buffer])})):kt(e),Kt=async(e,t)=>{if(Y()){if(t?.preferredOutputLocation)throw Error(`session option "preferredOutputLocation" is not supported for proxy.`);return $(),new Promise((n,r)=>{Q(`create`,[n,r]);let i={type:`create`,in:{model:e,options:{...t}}},a=[];e instanceof Uint8Array&&a.push(e.buffer),X.postMessage(i,a)})}return At(e,t)},qt=async e=>{if(Y())return $(),new Promise((t,n)=>{Q(`release`,[t,n]);let r={type:`release`,in:e};X.postMessage(r)});jt(e)},Jt=async(e,t,n,r,i,a)=>{if(Y()){if(n.some(e=>e[3]!==`cpu`))throw Error(`input tensor on GPU is not supported for proxy.`);if(i.some(e=>e))throw Error(`pre-allocated output tensor is not supported for proxy.`);return $(),new Promise((i,o)=>{Q(`run`,[i,o]);let s=n,c={type:`run`,in:{sessionId:e,inputIndices:t,inputs:s,outputIndices:r,options:a}};X.postMessage(c,Ft(s))})}return Nt(e,t,n,r,i,a)},Yt=async e=>{if(Y())return $(),new Promise((t,n)=>{Q(`end-profiling`,[t,n]);let r={type:`end-profiling`,in:e};X.postMessage(r)});Pt(e)}}),Zt,Qt,$t,en=l(()=>{z(),Xt(),St(),Ee(),wt(),Zt=(e,t)=>{switch(e.location){case`cpu`:return[e.type,e.dims,e.data,`cpu`];case`gpu-buffer`:return[e.type,e.dims,{gpuBuffer:e.gpuBuffer},`gpu-buffer`];case`ml-tensor`:return[e.type,e.dims,{mlTensor:e.mlTensor},`ml-tensor`];default:throw Error(`invalid data location: ${e.location} for ${t()}`)}},Qt=e=>{switch(e[3]){case`cpu`:return new M(e[0],e[2],e[1]);case`gpu-buffer`:{let t=e[0];if(!yt(t))throw Error(`not supported data type: ${t} for deserializing GPU tensor`);let{gpuBuffer:n,download:r,dispose:i}=e[2];return M.fromGpuBuffer(n,{dataType:t,dims:e[1],download:r,dispose:i})}case`ml-tensor`:{let t=e[0];if(!bt(t))throw Error(`not supported data type: ${t} for deserializing MLTensor tensor`);let{mlTensor:n,download:r,dispose:i}=e[2];return M.fromMLTensor(n,{dataType:t,dims:e[1],download:r,dispose:i})}default:throw Error(`invalid data location: ${e[3]}`)}},$t=class{async fetchModelAndCopyToWasmMemory(e){return Gt(await Ct(e))}async loadModel(e,t){N();let n;n=typeof e==`string`?await this.fetchModelAndCopyToWasmMemory(e):e,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await Kt(n,t),P()}async dispose(){return qt(this.sessionId)}async run(e,t,n){N();let r=[],i=[];Object.entries(e).forEach(e=>{let t=e[0],n=e[1],a=this.inputNames.indexOf(t);if(a===-1)throw Error(`invalid input '${t}'`);r.push(n),i.push(a)});let a=[],o=[];Object.entries(t).forEach(e=>{let t=e[0],n=e[1],r=this.outputNames.indexOf(t);if(r===-1)throw Error(`invalid output '${t}'`);a.push(n),o.push(r)});let s=r.map((e,t)=>Zt(e,()=>`input "${this.inputNames[i[t]]}"`)),c=a.map((e,t)=>e?Zt(e,()=>`output "${this.outputNames[o[t]]}"`):null),l=await Jt(this.sessionId,i,s,o,c,n),u={};for(let e=0;e<l.length;e++)u[this.outputNames[o[e]]]=a[e]??Qt(l[e]);return P(),u}startProfiling(){}endProfiling(){Yt(this.sessionId)}}}),tn={};u(tn,{OnnxruntimeWebAssemblyBackend:()=>rn,initializeFlags:()=>nn,wasmBackend:()=>an});var nn,rn,an,on=l(()=>{z(),Xt(),en(),nn=()=>{(typeof C.wasm.initTimeout!=`number`||C.wasm.initTimeout<0)&&(C.wasm.initTimeout=0);let e=C.wasm.simd;if(typeof e!=`boolean`&&e!==void 0&&e!==`fixed`&&e!==`relaxed`&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${e}". Reset it to \`false\` and ignore SIMD feature checking.`),C.wasm.simd=!1),typeof C.wasm.proxy!=`boolean`&&(C.wasm.proxy=!1),typeof C.wasm.trace!=`boolean`&&(C.wasm.trace=!1),typeof C.wasm.numThreads!=`number`||!Number.isInteger(C.wasm.numThreads)||C.wasm.numThreads<=0){if(typeof self<`u`&&!self.crossOriginIsolated)C.wasm.numThreads=1;else{let e=typeof navigator>`u`?c(`node:os`).cpus().length:navigator.hardwareConcurrency;C.wasm.numThreads=Math.min(4,Math.ceil((e||1)/2))}}},rn=class{async init(e){nn(),await Ut(),await Wt(e)}async createInferenceSessionHandler(e,t){let n=new $t;return await n.loadModel(e,t),n}},an=new rn});z(),z(),z();var sn=`1.23.2`,cn=Te;{let e=(on(),f(tn)).wasmBackend;h(`cpu`,e,10),h(`wasm`,e,10)}Object.defineProperty(C.versions,"web",{value:sn,enumerable:!0});var ln=`/assets/silero_vad-Dt9-bTDn.onnx`;27/Math.log(6.4);const un=/* @__PURE__ */ new Float64Array(400),dn=/* @__PURE__ */ new Float64Array(400);for(let e=0;e<400;e++)un[e]=Math.cos(2*Math.PI*e/400),dn[e]=-Math.sin(2*Math.PI*e/400);Object.freeze([`timers`,`smart`]),Object.freeze({threshold:.5,graceMs:150,recheckMs:400,fallbackMs:3e3,slowMs:1500}),Object.freeze([{key:`voiceTurn.threshold`,field:`threshold`,min:.01,max:.99},{key:`voiceTurn.grace`,field:`graceMs`,min:0,max:2e3},{key:`voiceTurn.recheck`,field:`recheckMs`,min:100,max:5e3},{key:`voiceTurn.fallback`,field:`fallbackMs`,min:500,max:1e4},{key:`voiceTurn.slow`,field:`slowMs`,min:500,max:5e3}]),[.../* @__PURE__ */ new Set([`um`,`umm`,`uh`,`uhh`,`uhm`,`erm`,`er`,`eh`,`ah`,`hmm`,`hm`,`mm`,`mmm`,`mhm`,`mm-hmm`,`uh-huh`])];const fn=Object.freeze({minSpeechMs:300,endSilenceMs:350,trailingKeepMs:200,preRollMs:300,holdMs:1600,finishedHoldMs:1e3});fn.trailingKeepMs,Object.freeze({nearMinMs:150,probMargin:.2,dbMargin:3,runGapMs:100,minOnsetVoicedMs:60,nearGapMs:500,nearPerMinute:20,summaryMs:1e4}),Object.freeze({preFrames:48,postFrames:16,perMinute:30,gapMs:1e3});const pn=Object.freeze({startProb:.6,endProb:.35,speakingStartProb:.85,minSpeechMs:250,endSilenceMs:fn.endSilenceMs,maxSegmentMs:6e4,gateDb:3,energyMarginDb:10,energyMinSpeechMs:fn.minSpeechMs});Object.freeze([`low`,`normal`,`high`]),Object.freeze({low:Object.freeze({...pn,startProb:.75,endProb:.45,speakingStartProb:.92,minSpeechMs:350,gateDb:6,energyMarginDb:13,energyMinSpeechMs:400}),normal:pn,high:Object.freeze({...pn,startProb:.45,endProb:.25,speakingStartProb:.75,minSpeechMs:180,gateDb:0,energyMarginDb:7,energyMinSpeechMs:250})});var mn=class e{ort;session;state=/* @__PURE__ */ new Float32Array(256);context=/* @__PURE__ */ new Float32Array(64);sr;constructor(e,t){this.ort=e,this.session=t,this.sr=new e.Tensor(`int64`,BigInt64Array.from([BigInt(16e3)]),[])}static async load(t,n){let r=await t.InferenceSession.create(n,{executionProviders:[`wasm`],graphOptimizationLevel:`all`});return new e(t,r)}reset(){this.state=/* @__PURE__ */ new Float32Array(256),this.context=/* @__PURE__ */ new Float32Array(64)}async probability(e){if(e.length!==512)throw Error(`Silero VAD needs 512-sample chunks, got ${e.length}`);let t=/* @__PURE__ */ new Float32Array(576);t.set(this.context),t.set(e,64),this.context=e.slice(448);let n=await this.session.run({input:new this.ort.Tensor(`float32`,t,[1,t.length]),state:new this.ort.Tensor(`float32`,this.state,[2,1,128]),sr:this.sr});return this.state=Float32Array.from(n.stateN.data),n.output.data[0]}};C.wasm.numThreads=1,C.wasm.proxy=!1,C.logLevel=`error`;const hn=self,gn=performance.now(),_n=(async()=>{let e=await fetch(ln);if(!e.ok)throw Error(`model download failed (${e.status})`);return mn.load(r,new Uint8Array(await e.arrayBuffer()))})();_n.then(()=>hn.postMessage({type:`ready`,ms:Math.round(performance.now()-gn)}),e=>hn.postMessage({type:`error`,message:e instanceof Error?e.message:String(e)}));let vn=Promise.resolve();hn.onmessage=e=>{let t=e.data;vn=vn.then(async()=>{let e;try{e=await _n}catch(e){t.type===`chunk`&&hn.postMessage({type:`fail`,id:t.id,message:String(e?.message??e)});return}if(t.type===`reset`)return e.reset();if(t.type===`chunk`)try{hn.postMessage({type:`prob`,id:t.id,p:await e.probability(t.samples)})}catch(e){hn.postMessage({type:`fail`,id:t.id,message:String(e?.message??e)})}})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,U as t,V as n,W as r}from"./toast-
|
|
1
|
+
import{A as e,U as t,V as n,W as r}from"./toast-q818mjUF.js";import{t as i}from"./artifacts-DlQEYmDl.js";var a=`/api/agent/artifacts`,o={workspace:``,type:``},s=e=>typeof e==`string`&&i.includes(e);function c(t){let n=typeof t==`string`?new URLSearchParams(t):t,r=n.get(`workspace`)??``,i=n.get(`type`)??``;return{workspace:r===`none`||e(`workspace`,r)?r:``,type:s(i)?i:``,...n.get(`origin`)===`preview`?{origin:`preview`}:{}}}function l(e){let t=new URLSearchParams;e.workspace&&t.set(`workspace`,e.workspace),e.type&&t.set(`type`,e.type),e.origin&&t.set(`origin`,e.origin);let n=t.toString();return n?`?${n}`:``}var u=e=>e.workspace&&e.workspace!==`none`?e.workspace:``,d=e=>`${u(e)}|${e.origin??``}`;function f(e,t){let n=new URLSearchParams({state:`active`,limit:`50`}),r=u(e);return r&&n.set(`workspace`,r),e.origin&&n.set(`origin`,e.origin),t&&n.set(`cursor`,t),`${a}?${n}`}var p=e=>typeof e==`string`&&e.length>0;function m(e){if(!e||typeof e!=`object`)return;let t=e;if(p(t.id)&&typeof t.title==`string`&&s(t.kind)&&typeof t.updatedAt==`number`)return{id:t.id,title:t.title,kind:t.kind,visibility:t.visibility===`workspace`?`workspace`:`private`,...p(t.workspaceID)?{workspaceID:t.workspaceID}:{},...p(t.description)?{description:t.description}:{},updatedAt:t.updatedAt,...t.origin===`preview`?{origin:`preview`,...typeof t.revision==`number`?{revision:t.revision}:{}}:{}}}function h(e){let t=e&&typeof e==`object`?e:{};return{items:Array.isArray(t.items)?t.items.flatMap(e=>m(e)??[]):[],...p(t.cursor)?{cursor:t.cursor}:{}}}function g(e,t){return e.filter(e=>e.origin===`preview`==(t.origin===`preview`)&&(t.type===``||e.kind===t.type)&&(t.workspace===``||(t.workspace===`none`?!e.workspaceID:e.workspaceID===t.workspace)))}function _(e){return e.status===422||e.code===`unsupported`?{kind:`unsupported`,text:`Artifacts aren't supported on this hub yet.`}:e.status===404?{kind:`unavailable`,text:`This hub doesn't have artifacts.`}:e.status===403||e.status===401?{kind:`forbidden`,text:`This device isn't allowed to read artifacts.`}:{kind:`error`,text:e.message?`Could not load artifacts: ${e.message}`:`Could not load artifacts (HTTP ${e.status}).`}}function v(e){let t=e&&typeof e==`object`?e:{};return{status:typeof t.status==`number`?t.status:0,...typeof t.code==`string`?{code:t.code}:{},message:typeof t.message==`string`?t.message:String(e)}}function y(e,t){return t?`None of the artifacts loaded so far match. Load more to keep looking.`:e.origin===`preview`?`No previews. HTML previews you open from a session stay here for a day after you last view them.`:e.workspace===``&&e.type===``?`No artifacts yet. Artifacts that your sessions create show up here.`:`No artifacts match these filters.`}var b=(e,t)=>t.get(e)??`Workspace ${e.slice(0,12)}…`,x=e=>`/artifacts/${encodeURIComponent(e)}`;function S(e,t){let n=o,r,i=0,a=[],s,c={status:`loading`},l=()=>c.status===`ready`?{status:`ready`,items:g(a,n),total:a.length,more:s!==void 0,loadingMore:c.loadingMore,...c.moreError?{moreError:c.moreError}:{}}:c,u=e=>{c=e,t(l())};function f(o){n=o;let f=d(o);if(f===r&&c.status===`ready`){t(l());return}r=f;let p=++i;a=[],s=void 0,u({status:`loading`}),e.list(o).then(e=>{p===i&&(a=[...e.items],s=e.cursor,u({status:`ready`,loadingMore:!1}))},e=>p===i&&u({status:`error`,error:_(v(e))}))}function p(){if(c.status!==`ready`||c.loadingMore||s===void 0)return;let t=i;u({status:`ready`,loadingMore:!0}),e.list(n,s).then(e=>{if(t!==i)return;let n=new Set(a.map(e=>e.id));a=[...a,...e.items.filter(e=>!n.has(e.id))],s=e.cursor,u({status:`ready`,loadingMore:!1})},e=>t===i&&u({status:`ready`,loadingMore:!1,moreError:_(v(e)).text}))}function m(){r=void 0,f(n)}async function h(n){if(!e.keep)return`Keep is not available here.`;try{await e.keep(n)}catch(e){return`Could not keep it: ${v(e).message}`}a=a.filter(e=>e.id!==n.id),c.status===`ready`&&t(l())}return{load:f,more:p,reload:m,view:l,keep:h}}var C={list:async(e,n)=>h(await t(f(e,n))),keep:async e=>void await r(`/api/agent/artifacts/${n(e.id)}/keep`,{expectedRevision:e.revision??0})};async function w(){try{return((await t(`/api/agent/workspaces?state=active&limit=200`)).items??[]).flatMap(e=>typeof e.id==`string`&&typeof e.title==`string`?[{id:e.id,title:e.title}]:[])}catch{return[]}}export{y as a,b as c,S as i,w as n,l as o,x as r,c as s,C as t};
|
|
@@ -6,4 +6,4 @@ import{J as e}from"./ui-CFB4wQfF.js";var t=e=>String(e??``).normalize(`NFD`).rep
|
|
|
6
6
|
`):``,never:e?e.permissions.never.join(`
|
|
7
7
|
`):``,expires:`8h`,maxActionsPerHour:String(e?.maxActionsPerHour??60),allowAlways:e?.allowAlways??!1}}var j=e=>e.split(`
|
|
8
8
|
`).map(e=>e.trim()).filter(Boolean),Xe=/^\d+(s|m|h|d)?$/,Ze=e=>/^([A-Za-z]:)?[\\/]/.test(e);function Qe(e){let t={},n=e.holder.trim();n||(t.holder=`Who holds it: @@orchestrator, @name, ses_… or app:<token id>`);let r=j(e.projects),i=r.find(e=>!Ze(e));r.length?i!==void 0&&(t.projects=`${i} is not an absolute directory`):t.projects=`At least one project directory`;let a=Pe.filter(t=>e.allow.includes(t));a.length||(t.allow=`Pick at least one action`);let o=e.expires.trim();Xe.test(o)||(t.expires=`A duration: seconds, or 30m, 8h, 2d`);let s=e.maxActionsPerHour.trim(),c=/^\d+$/.test(s)?Number(s):NaN;return c>=1&&c<=1e3||(t.maxActionsPerHour=`A whole number from 1 to 1000`),Object.keys(t).length?{ok:!1,errors:t}:{ok:!0,body:{holder:n,scope:{projects:r},allow:a,permissions:{allow:j(e.permit),never:j(e.never)},expires:o,maxActionsPerHour:c,allowAlways:e.allowAlways}}}function $e(e){if(/^permissions\.never/.test(e))return`never`;if(/^permissions/.test(e))return`permit`;if(/^scope/.test(e))return`projects`;if(/^allow\b/.test(e))return`allow`;if(/^expires/.test(e))return`expires`;if(/^maxActionsPerHour/.test(e))return`maxActionsPerHour`;if(/^allowAlways/.test(e))return`allowAlways`;if(/holder|^No app token|^No session|^No such session/i.test(e))return`holder`}function M(e){if(!D(e))return;let{seq:t,at:n,actor:r,verb:i,target:a,decision:o,outcome:s}=e;if(typeof t==`number`&&typeof n==`number`&&D(r)&&typeof r.kind==`string`&&typeof i==`string`&&D(a)&&typeof o==`string`&&typeof s==`string`)return e}function et(e){if(!D(e))return{entries:[]};let t=(Array.isArray(e.entries)?e.entries:[]).map(M).filter(e=>!!e);return typeof e.next==`number`?{entries:t,next:e.next}:{entries:t}}var tt={allow:`allowed`,needs_user:`needs you`,forbidden:`refused`,paused:`paused`,rate_limited:`rate limited`,busy:`hub busy`},nt={ok:`done`,failed:`failed`,gone:`already answered`,offline:`offline`,unsupported:`unsupported`,escalated:`sent to you`,refused:`refused`},rt=new Set([`forbidden`,`paused`,`rate_limited`,`busy`]),it=new Set([`failed`,`refused`,`offline`,`unsupported`]),N={"acting.pause":`turned agent actions off`,"acting.resume":`turned agent actions on`},at={approve:[`approved`,`approved $`],deny:[`denied`,`denied $`],answer:[`answered`,`answered $`],prompt:[`prompted a session`,`prompted $`],stop:[`stopped a session`,`stopped $`],propose:[`proposed an action`,`proposed an action for $`],msg:[`sent a message`,`messaged $`],roles:[`claimed a role`,`claimed a role for $`],"roles.release":[`released a role`,`released a role of $`],launch:[`launched a session`,`launched $`],"launch.stop":[`stopped a launch`,`stopped the launch of $`],"team.staff":[`staffed a team role`,`staffed a team role with $`],"team.unstaff":[`unstaffed a team role`,`unstaffed $ from a team role`],"team.denied":[`sent a message the team's rules refused`,`sent $ a message the team's rules refused`],"grant.request":[`asked for a grant`,`asked for a grant for $`],"grant.approve":[`approved a grant request`,`approved a grant request from $`],"grant.deny":[`denied a grant request`,`denied a grant request from $`],"decision.answer":[`answered a Decision`,`answered a Decision of $`]},ot={deny:[`proposed denying`,`proposed denying a request in`],answer:[`proposed answering`,`proposed answering a form in`],prompt:[`proposed prompting`,`proposed a prompt to`],stop:[`proposed stopping`,`proposed stopping`]},st=/^Decision dec_[A-Za-z0-9]{1,64}: (\w+)$/;function ct(e,t,n){let r=ot[st.exec(e??``)?.[1]??``],i=n?` in ${n}`:``;return t?`${r?r[0]:`proposed an action on`} ${t}${i}`:n?`${r?r[1]:`proposed an action for`} ${n}`:`proposed an action`}function lt(e,t,n,r){if(e===`propose`)return ct(r,t,n);let i=at[e];return i?t?`${i[0]} ${t}${n?` in ${n}`:``}`:n?i[1].replace(`$`,n):i[0]:[e.replace(/[._]+/g,` `).trim()||e,t,t&&n?`in ${n}`:n].filter(Boolean).join(` `)}var P=(e,t)=>e.as===`concierge`?`@@concierge`:e.actor.kind===`user`?`you`:t?Ae(e.actor,e=>t(e)??T(e)):f(e.actor);function ut(e,t){if(e.outcome!==`escalated`)return;let n=/\bDecision (dec_[A-Za-z0-9]{1,64})\b/.exec(e.reason??``)?.[1];for(let r of t)if(n?r.id===n:e.target.requestID&&r.action?.requestID===e.target.requestID)return r}function dt(e){if(e.state!==`answered`)return e.state;let t=e.answer?.option,n=e.options.find(e=>e.id===t)?.label??t,r=_(e);return`${n?`answered “${n}”`:`answered`}${r?` by ${r}`:``}`}var ft=`Shell, outside folders and tools always need the user's tap`,pt=`The Concierge never answers “always”: the user decides`,mt={approve:`Approved`,deny:`Denied`,answer:`Answered`,prompt:`Prompted`,stop:`Stopped`},F=e=>e.replace(/\binGrant\s*=\s*yes\b/gi,`inside your grant`).replace(/\binGrant\s*=\s*no\b/gi,`outside your grant`).replace(/\bauto\s*=\s*yes\b/gi,`approvable without you`).replace(/\bauto\s*=\s*no\b/gi,`needs your tap`).replace(/\bdec_[A-Za-z0-9]{1,64}\b/g,`a Decision`),ht=/[\u061c\u200b-\u200f\u2028-\u202e\u2060-\u206f\ufeff\u{E0000}-\u{E007F}]/gu,gt=300;function _t(e){let t=F(e).replace(ht,``).replace(/«/g,`‹`).replace(/»/g,`›`).replace(/[\u0000-\u001f\u007f-\u009f]/g,` `).replace(/\s+/g,` `).trim(),n=Array.from(t);return`«${n.length>gt?`${n.slice(0,299).join(``)}…`:t}»`}function vt(e){let t=e.reason??``;if(e.decision===`busy`)return`Refused: the hub was busy (its state did not answer in time); try again`;if(e.reason===`concierge inbound rule`)return`Refused: only you can message the Concierge`;if(e.actor.kind===`user`&&/^Decision dec_[A-Za-z0-9]{1,64} proposed by @@concierge$/.test(t))return`You said yes to the Concierge's proposal`;if(e.as!==`concierge`)return t;if(t===`concierge outbound rule`)return`Refused: the Concierge may message only you`;if(e.verb===`propose`)return`The Concierge proposed this for your answer`;if(t===ft)return`Needed your tap: shell commands, outside folders and tools always do`;if(t===pt)return`Needed your tap: the Concierge never answers “always”`;if(e.decision===`needs_user`)return t?`Needed you: ${F(t).replace(/ outside the grant\b/,` outside the Concierge's grant`)}`:`Needed you`;let n=mt[e.verb];return n&&e.decision===`allow`&&e.outcome===`ok`?`${n} by the Concierge inside your grant${t?`. Its note: ${_t(t)}`:``}`:F(t)}function yt(e,t,n){let r=e.target.requestID??e.target.formID,i=e.target.requestID?`a permission request`:e.target.formID?`a form`:void 0,a=e.target.sessionID,o=a?n?.(a)??T(a):``,s=N[e.verb]??lt(e.verb,i,o,e.reason),c=N[e.verb]?void 0:[r,r&&a?`in ${a}`:a].filter(Boolean).join(` `)||void 0,l=tt[e.decision]??e.decision,u=nt[e.outcome]??e.outcome,d=e.decision===`allow`&&e.outcome===`ok`,f=t&&t.state!==`open`?`${u} · ${dt(t)}`:void 0;return{seq:e.seq,at:e.at,who:P(e,n??(()=>void 0)),what:s,...c?{whatTitle:c}:{},result:d?`done`:f??(l===u?l:`${l} · ${u}`),tone:d||t?.state===`answered`?`ok`:rt.has(e.decision)||it.has(e.outcome)?`err`:`warn`,grant:e.grant?`grant`:``,...e.grant?{grantTitle:e.grant}:{},reason:vt(e)}}var bt={approve:`Approved`,deny:`Denied`,answer:`Answered`},xt=3,I=3,St=e=>e.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e;function Ct(e,t,n){let r=n?.(e);if(t.as===`concierge`||r?.holder===`@@concierge`)return`the Concierge's grant`;let i=r?.scope.projects.map(St)??[];if(!i.length)return`your grant`;let a=i.slice(0,I).join(`, `);return`your grant for ${i.length>I?`${a} and ${i.length-I} more`:a}`}function L(e,t,n){let r=bt[e.verb];if(!r||e.decision!==`allow`||e.outcome!==`ok`)return;let i=`${r} by ${P(e,t)}`;return e.grant?{text:`${i} · ${Ct(e.grant,e,n)}`,title:e.grant}:{text:i}}function R(e,t,n){return L(e,t,n)?.text}function wt(e,t){return[t,...e.filter(e=>e.seq!==t.seq)].sort((e,t)=>t.seq-e.seq).slice(0,100)}function Tt(e,t,n,r){for(let i of e){if(i.target.requestID!==t&&i.target.formID!==t)continue;let e=L(i,n,r);if(e)return e}}function Et(e,t,n,r,i,a,o){let s=[];for(let c of[...e].sort((e,t)=>t.at-e.at||t.seq-e.seq)){if(s.length>=xt)break;if(!c.target.sessionID||!t.has(c.target.sessionID)||n-c.at>6e5||r!==void 0&&c.at<r)continue;let e=L(c,a,o),l=c.target.requestID??c.target.formID??`seq-${c.seq}`;e&&!i?.has(l)&&!s.some(e=>e.key===l)&&s.push({key:l,...e,at:c.at})}return s}function Dt(e,t,n,r=6e4,i){for(let a of[...e].sort((e,t)=>t.at-e.at||t.seq-e.seq)){if(n-a.at>r)break;if(a.verb!==`deny`||!a.target.sessionID||!t.has(a.target.sessionID))continue;let e=R(a,void 0,i);if(e)return{key:a.target.requestID??a.target.formID??`seq-${a.seq}`,text:e}}}function Ot(e,t,n,r){let{since:i,until:a}=n,o;for(let n of e){if(n.verb!==`deny`||n.target.sessionID!==t||i!==void 0&&n.at<i||a!==void 0&&n.at>=a)continue;let e=R(n,void 0,r);e&&(!o||(i===void 0?n.at>o.e.at||n.at===o.e.at&&n.seq>o.e.seq:n.at<o.e.at||n.at===o.e.at&&n.seq<o.e.seq))&&(o={e:n,text:e})}return o&&{key:o.e.target.requestID??o.e.target.formID??`seq-${o.e.seq}`,text:o.text}}function kt(e,t){return e.filter(e=>e.denial===void 0||!t.has(e.denial))}function At(e){let t=e.enabled!==!1,n=e.hubEnabled!==!1;return{on:t,hubOn:n,note:n?t?``:`Agents cannot act for you (approve, deny, answer, prompt, stop, launch). Reading and messaging still work.`:`An admin turned agent actions off for the whole hub: no agent can approve, deny, answer, prompt, stop or launch until it is on again.`}}var jt=/^(.*?) asks to approve( always(?: \(saves .*?\))?)? (.*?)\. Outside its grant: (.*)$/s,Mt=`a permission request (details unknown)`;function Nt(e){if(e.action?.kind!==`permission`)return;let t={requester:g(e),always:e.action.always===!0,...e.action.requestID?{requestID:e.action.requestID}:{}},n=jt.exec(e.question);if(!n)return{...t,action:void 0,resources:[],reason:void 0};let r=n[3],i=r.indexOf(`: `),a=r!==Mt;return{...t,always:t.always||!!n[2],action:a?i<0?r:r.slice(0,i):void 0,resources:a&&i>=0?r.slice(i+2).split(`, `).filter(Boolean):[],reason:n[4].trim()||void 0}}function Pt(e,t){return!D(e)||typeof e.by!=`string`||e.recommends!==`approve`?``:`${t?E(e.by,t):e.by} recommends Approve${typeof e.why==`string`&&e.why?`: ${e.why}`:``}`}var z={clientID:/^hcl_[0-9a-f]{16}$/,clientSecret:/^hcs_[A-Za-z0-9_-]{43}$/,flow:/^hcf_[0-9a-f]{24}$/,code:/^hco_[A-Za-z0-9_-]{43}$/,access:/^hca_([0-9a-f]{16})_[A-Za-z0-9_-]{43}$/,refresh:/^hcr_([0-9a-f]{16})_[A-Za-z0-9_-]{43}$/,connectionID:/^[0-9a-f]{16}$/},Ft=[`hub`,`user`],It=2048,Lt=new Set([`127.0.0.1`,`[::1]`,`localhost`]);function Rt(e){if(typeof e!=`string`||e===``)return`a redirect URI is a non-empty string`;if(e.length>2048)return`a redirect URI is at most ${It} characters`;if(e.trim()!==e||/\s/.test(e))return`a redirect URI has no whitespace`;if(e.includes(`*`))return`a redirect URI has no wildcard`;let t;try{t=new URL(e)}catch{return`a redirect URI is an absolute URL`}if(t.protocol!==`https:`&&t.protocol!==`http:`)return`a redirect URI uses https (http only on a loopback host)`;if(t.protocol===`http:`&&!Lt.has(t.hostname))return`http is allowed only on a loopback host (127.0.0.1, [::1], localhost)`;if(t.username||t.password)return`a redirect URI has no user info`;if(e.includes(`#`))return`a redirect URI has no fragment`}var B=e=>!!e&&typeof e==`object`&&!Array.isArray(e),V=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),zt=new Set([`sessions:act`,`sessions:launch`,`profiles:assign`,`conversation:write`,`decisions:answer`]),Bt=e=>ze[e]??e,Vt=/^\/connect\/consent\/(hcf_[0-9a-f]{24})$/;function Ht(e){return Vt.exec(e)?.[1]}function Ut(e){if(!B(e)||typeof e.id!=`string`||!z.flow.test(e.id))return;let{client:t,scopes:n,expiresAt:r,connection:i}=e;if(!B(t)||typeof t.id!=`string`||typeof t.name!=`string`||typeof t.redirectOrigin!=`string`||!V(n)||n.length===0||typeof r!=`number`)return;let a=B(i)&&typeof i.id==`string`&&V(i.scopes)?{id:i.id,scopes:[...i.scopes]}:void 0;return{id:e.id,client:{id:t.id,name:t.name,redirectOrigin:t.redirectOrigin},scopes:[...n],expiresAt:r,...a?{connection:a}:{}}}function Wt(e){return e.scopes.map(t=>({scope:t,label:Bt(t),act:zt.has(t),checked:!0,current:e.connection?.scopes.includes(t)??!1}))}function Gt(e,t){if(!t.length)return{ok:!1,error:`Tick at least one thing it may do, or deny`};let n=t.find(t=>!e.scopes.includes(t));return n===void 0?{ok:!0,body:{scopes:e.scopes.filter(e=>t.includes(e))}}:{ok:!1,error:`The app did not ask for ${n}`}}function Kt(e){if(!B(e)||typeof e.id!=`string`||!z.connectionID.test(e.id))return;let{clientID:t,clientName:n,scopes:r,created:i,lastUsed:a,refreshExpiresAt:o}=e;if(typeof t==`string`&&typeof n==`string`&&V(r)&&typeof i==`number`&&typeof o==`number`)return{id:e.id,clientID:t,clientName:n,scopes:[...r],created:i,...typeof a==`number`?{lastUsed:a}:{},refreshExpiresAt:o}}function qt(e){return(B(e)&&Array.isArray(e.connections)?e.connections:[]).map(Kt).filter(e=>!!e)}var Jt=(e,t)=>{let n=Math.max(0,Math.round((t-e)/1e3));return n<45?`just now`:n<3600?`${Math.round(n/60)}m ago`:n<86400?`${Math.round(n/3600)}h ago`:`${Math.round(n/86400)}d ago`};function Yt(e,t){let n=[`connected ${Jt(e.created,t)}`];return e.lastUsed!==void 0&&n.push(`last refreshed ${Jt(e.lastUsed,t)}`),{title:e.clientName,scopes:e.scopes.join(`, `)||`No scopes`,detail:n.join(` · `),holder:`app:${e.id}`}}function Xt(e){if(!B(e)||typeof e.id!=`string`||!z.clientID.test(e.id))return;let{name:t,redirectURIs:n,scopes:r,created:i,createdBy:a,audience:o,disabled:s}=e;if(typeof t==`string`&&V(n)&&V(r)&&typeof i==`number`&&typeof a==`string`&&Ft.includes(o))return{id:e.id,name:t,redirectURIs:[...n],scopes:[...r],created:i,createdBy:a,audience:o,...s===!0?{disabled:!0}:{}}}function Zt(e){return(B(e)&&Array.isArray(e.clients)?e.clients:[]).map(Xt).filter(e=>!!e)}function Qt(e){return{badge:e.audience===`hub`?`Hub-wide`:`Only you`,...e.disabled?{state:`Disabled`}:{},redirects:e.redirectURIs.join(`, `),scopes:e.scopes.join(`, `)}}function $t(e){let t=e.name.trim().replace(/\s+/g,` `);if(!t)return{ok:!1,field:`name`,error:`Give the app a name`};if(t.length>100)return{ok:!1,field:`name`,error:`A name is at most 100 characters`};let n=[...new Set(e.redirects.split(`
|
|
9
|
-
`).map(e=>e.trim()).filter(Boolean))];if(!n.length)return{ok:!1,field:`redirects`,error:`Add at least one redirect URI`};if(n.length>10)return{ok:!1,field:`redirects`,error:`At most 10 redirect URIs`};for(let e of n){let t=Rt(e);if(t)return{ok:!1,field:`redirects`,error:`${e}: ${t}`}}return e.scopes.length?{ok:!0,body:{name:t,redirectURIs:n,scopes:[...new Set(e.scopes)],...e.audience?{audience:e.audience}:{}}}:{ok:!1,field:`scopes`,error:`Pick at least one scope`}}var en=class extends Error{status;code;field;hint;details;constructor(e,t){super(t),this.status=e}},tn=class extends Error{cause;name=`NetworkError`;constructor(e){super(`Can't reach the hub: the connection dropped. Check your network and try again.`),this.cause=e}},nn;function rn(e){nn=e}async function H(e,{method:t=`GET`,json:n,body:r,headers:i={},signal:a,keepalive:o}={}){let s={method:t,credentials:`same-origin`,headers:{...i},signal:a,keepalive:o};n===void 0?r!==void 0&&(s.body=r):(s.headers[`content-type`]=`application/json`,s.body=JSON.stringify(n));let c;try{c=await fetch(e,s)}catch(e){throw e instanceof TypeError?new tn(e):e}if(!c.ok){let e=await c.json().catch(()=>({}));c.status===401&&nn?.();let t=e.error&&typeof e.error==`object`?e.error:e,n=typeof e.error==`string`?e.error:typeof t.message==`string`?t.message:``,r=new en(c.status,n||`HTTP ${c.status}`);throw typeof t.field==`string`&&(r.field=t.field),typeof t.code==`string`&&(r.code=t.code),typeof t.hint==`string`&&(r.hint=t.hint),e.error&&typeof e.error==`object`&&(r.details=t),r}return c}var an=async e=>(await H(e)).json(),on=async(e,t={})=>(await H(e,{method:`POST`,json:t})).json().catch(()=>({})),sn=encodeURIComponent,cn=e=>`/api/sessions/${sn(e)}`,ln=e=>e instanceof Error?e.message:String(e),un=e=>typeof e==`object`&&!!e&&!Array.isArray(e),dn=/^[A-Za-z0-9_.:@/+~-]{1,300}$/,fn=/[\p{Cc}\p{Cf}\u2028\u2029]/u,pn={workspace:`ws`,binding:`wsb`,member:`wsm`,assignment:`asg`,supervision:`sup`,checkpoint:`chk`,sideChat:`chat`,profile:`prof`,artifact:`art`,revision:`rev`,blob:`blob`,aiJob:`job`,team:`team`,staffing:`stf`,intake:`itk`},mn=/^[A-Za-z0-9]{16,32}$/;function hn(e,t){if(typeof t!=`string`)return!1;let n=`${pn[e]}_`;return t.startsWith(n)&&mn.test(t.slice(n.length))}var gn=/^[a-z0-9-]{2,40}$/,U=e=>typeof e==`string`&&gn.test(e),_n=(e,t=120)=>typeof e==`string`&&e.trim().length>0&&e.length<=t&&!fn.test(e),vn=4e3,yn=/[\u0000-\u0009\u000b-\u001f\u007f\u2028\u2029\u200b-\u200f\u202a-\u202e\u2066-\u2069]/,bn=(e,t=vn)=>typeof e==`string`&&e.length<=t&&!yn.test(e);function xn(e){if(e!==void 0){if(!Array.isArray(e)||e.length>32)return`tags must be a list of at most 32`;if(!e.every(U))return`each tag must be 2–40 lowercase letters, digits or dashes`;if(new Set(e).size!==e.length)return`tags must be unique`}}function Sn(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))return`metadata must be an object`;let t=Object.entries(e);if(t.length>32)return`metadata has more than 32 keys`;for(let[e,n]of t){if(!U(e))return`metadata key ${JSON.stringify(String(e).slice(0,50))} must be a slug`;if(!_n(n,200))return`metadata.${e} must be 1–200 characters of text`}}var W=e=>e.signedIn,G=[{id:`sessions`,label:`All sessions`,icon:`home`,route:`/`,order:10,available:e=>W(e)?!0:`hidden`},{id:`concierge`,label:`Concierge`,icon:`spark`,route:`/concierge`,order:15,available:e=>W(e)&&e.concierge!==void 0&&e.concierge!==`disabled`?!0:`hidden`},{id:`artifacts`,label:`Artifacts`,icon:`file`,route:`/artifacts`,order:20,available:e=>W(e)?!0:`hidden`},{id:`teams`,label:`Teams`,icon:`team`,route:`/teams`,order:25,available:e=>W(e)?!0:`hidden`},{id:`watchtower`,label:`Watchtower`,icon:`watchtower`,route:`/watchtower`,order:30,available:e=>W(e)?!0:`hidden`},{id:`profiles`,label:`Agent profiles`,icon:`settings`,route:`/profiles`,order:40,available:e=>W(e)?!0:`hidden`}],Cn={"/birds-eye":`/watchtower`};function wn(e,t=``,n=``){for(let[r,i]of Object.entries(Cn))if(e===r||e.startsWith(`${r}/`))return`${i}${e.slice(r.length)}${t}${n}`}function Tn(e,t){try{return e.available(t)}catch{return`hidden`}}function En(e,t=G){return[...t].sort((e,t)=>e.order-t.order).flatMap(t=>{let n=Tn(t,e);return n===`hidden`?[]:[{dest:t,enabled:n===!0}]})}var Dn=(e,t)=>Tn(e,t)===!0?`ok`:`unavailable`;function On(e,t=G){for(let n of t)if(n.route!==`/`&&(e===n.route||e.startsWith(`${n.route}/`)))try{return{dest:n,rest:e.slice(n.route.length).split(`/`).filter(Boolean).map(decodeURIComponent)}}catch{return}}function kn(e,t=G){return e===`/`?t.find(e=>e.route===`/`)?.id:On(e,t)?.dest.id}function An(e){return e.supported?e.permission===`denied`?{state:`blocked`,message:`Notifications are blocked for this site. Allow them in the browser's site settings, then reload.`,action:`none`,warn:!0}:e.permission==="default"?{state:`off`,message:`Notifications are off on this device.`,action:`enable`,warn:!0}:!e.worker||!e.endpoint||!e.hubSubscribed?{state:`repair`,message:`Allowed, but this device is not subscribed on this hub, so nothing will arrive (this happens after the hub moves to a new address). Enable again to fix it.`,action:`enable`,warn:!0}:{state:`on`,message:`On for this device.`,action:`disable`,warn:!1}:{state:`unsupported`,message:`This browser can't get notifications here. On iPhone, add the app to the Home Screen first (iOS 16.4+); everywhere else the hub must be on https.`,action:`none`,warn:!0}}var jn=e=>e.supported&&e.permission===`granted`&&(!e.endpoint||!e.hubSubscribed);function Mn(e){if(e.subscriptions===0)return{ok:!1,text:`This device is not subscribed; enable notifications first`};if(e.sent>0)return{ok:!0,text:e.sent===1?`Test notification sent to this device`:`Test notification sent (${e.sent} subscriptions)`};let t=e.failed[0];return t?{ok:!1,text:`Test failed: ${t.host} ${t.status===void 0?`did not answer`:`answered ${t.status}`}`}:{ok:!1,text:`Test failed`}}var Nn=[1,2,5,10,15,30,60],K=[{title:`Needs you`,kinds:[{key:`question`,label:`Question`,description:`A session or subagent asks you something.`},{key:`permission`,label:`Needs permission`,description:`A tool call waits for your OK (answer from the notification).`},{key:`decision`,label:`Decision`,description:`A session asks you to decide (hub ask @me), with options and a recommendation.`},{key:`message`,label:`Message`,description:`Agent messaging needs you: a message to you, an unanswered ask, or sessions looping.`},{key:`concierge`,label:`Concierge`,description:`Your Concierge needs you or has news: its questions, permissions, decisions, messages and spoken replies.`}]},{title:`Session`,kinds:[{key:`done`,label:`All done`,description:`The session and all its subagents and scripts finished; nothing waits on you. Once per run.`},{key:`failed`,label:`Failed`,description:`The session's run failed (provider or tool error), with the reason.`},{key:`providerError`,label:`Model provider error`,description:`Quota, budget, auth or model-routing errors of the session or a subagent; once per run.`},{key:`turn`,label:`Turn finished`,description:`Every reply of the main session, also the short ones between subagents. Noisy.`},{key:`stopped`,label:`Stopped`,description:`A run stopped without you asking (OpenCode shut down, inactivity).`},{key:`retry`,label:`Retrying`,description:`The provider failed and OpenCode is retrying the request.`}]},{title:`Subagents`,kinds:[{key:`subagentDone`,label:`Subagent finished`,description:`Each subagent that finishes, by name.`},{key:`subagentFailed`,label:`Subagent failed`,description:`Each subagent that fails, with the reason.`}]},{title:`Scripts and tools`,kinds:[{key:`jobDone`,label:`Script finished`,description:`A background shell or terminal exited 0.`},{key:`jobFailed`,label:`Script failed`,description:`A background shell or terminal exited non-zero, was killed or timed out.`},{key:`longTool`,label:`Long tool finished`,description:`A tool call that ran 30 seconds or more ended.`}]},{title:`Voice`,kinds:[{key:`say`,label:`Spoken reply`,description:`Voice mode replies while no device shows the session.`},{key:`handoff`,label:`Hand-off`,description:`A session sent to this device from the terminal (ignores quiet hours).`}]},{title:`Activity digest`,kinds:[{key:`activity`,label:`Activity`,description:`One quiet, self-replacing summary per session: subagents, long tools, scripts, idle.`}]}],Pn=K.flatMap(e=>e.kinds);function Fn(e){let t=Pn.filter(t=>e[t.key]).map(e=>e.label);return t.length?`You'll get: ${t.join(`, `)}.`:`You'll get no notifications on this device.`}function In(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{return`UTC`}}var q=[{id:`general`,label:`General`,description:`Account, theme, text size and the Hub app`},{id:`notifications`,label:`Notifications`,description:`This device's notifications, what to notify about, quiet hours`},{id:`voice`,label:`Voice & speech`,description:`Voice mode, mic sensitivity, speech-to-text and text-to-speech`},{id:`media`,label:`Media`,description:`Web images in replies: the sites whose images load at once`},{id:`machines`,label:`Machines & devices`,description:`Connected machines, approvals, signed-in browsers and apps`},{id:`agents`,label:`Agents & access`,description:`App tokens, acting switches, grants and agent activity`},{id:`concierge`,label:`Concierge`,description:`Your hub-managed assistant: machine, directory, model and its grant`},{id:`teams`,label:`Teams`,description:`Team isolation: what team members see`},{id:`admin`,label:`Admin`,description:`Users, all machines, approvals and the audit log`,admin:!0}],Ln=e=>q.filter(t=>e||!t.admin);function Rn(e){if(e!==`/settings`&&!e.startsWith(`/settings/`))return;let t=e.slice(10).split(`/`)[0]??``;if(!t)return{};try{return{section:decodeURIComponent(t)}}catch{return{section:t}}}function zn(e,t){return e===void 0?t.phone?`list`:`general`:Ln(t.admin).find(t=>t.id===e)?.id}var Bn={account:`general`,appearance:`general`,notifications:`notifications`,voice:`voice`,speech:`voice`,machines:`machines`,devices:`machines`,agents:`agents`,admin:`admin`,recording:`voice`,recordings:`voice`},Vn={recording:`recordings`};function Hn(e){return Vn[e]??e}function Un(e){let t=e.replace(/^#/,``);if(!t)return;let n=Bn[t];if(n)return`/settings/${n}#${Hn(t)}`;if(q.some(e=>e.id===t))return`/settings/${t}`}var Wn=[{id:`account`,section:`general`,label:`Account`,description:`Who you are signed in as; sign out of this device`,keywords:`sign out logout user email`},{id:`set-theme`,section:`general`,label:`Color theme`,description:`Light, dark or the system's theme`,keywords:`appearance light dark system mode`},{id:`set-text-size`,section:`general`,label:`Text size`,description:`How big text is on this device`,keywords:`appearance font scale zoom`},{id:`add-app`,section:`general`,label:`Add the Hub app`,description:`Link the Hub app on a phone or tablet with a QR code`,keywords:`mobile android ios install pair link`},{id:`notifications`,section:`notifications`,label:`Notifications on this device`,description:`Enable or turn off push notifications here; permission and subscription status`,keywords:`push enable subscribe permission service worker`},{id:`notify-test`,section:`notifications`,label:`Send test notification`,description:`Check that notifications reach this device`,keywords:`push try`},{id:`quiet-hours`,section:`notifications`,label:`Quiet hours`,description:`No notifications at night (hand-offs still come through)`,keywords:`do not disturb night sleep time`},{id:`set-voice-speed`,section:`voice`,label:`Voice speed`,description:`How fast replies are spoken`,keywords:`rate tts`},{id:`set-sensitivity`,section:`voice`,label:`Mic sensitivity`,description:`How sure Voice mode must be that you are speaking to it`,keywords:`microphone noise vad`},{id:`set-turn-detection`,section:`voice`,label:`Turn detection`,description:`When Voice mode decides you finished speaking: silence timers, or the Smart Turn audio model (experimental)`,keywords:`end of turn endpointing smart turn pause hold vad experimental`},{id:`set-voice-front`,section:`voice`,label:`Voice front`,description:`Voice mode's fast voice agent: it says what it understood, then relays to the session, which keeps its own agent. On by default; turn it off to talk to the session directly`,keywords:`front echo relay fast assistant agent off direct`},{id:`set-cues`,section:`voice`,label:`Progress cues`,description:`Tones and short acknowledgements while the agent works`,keywords:`sounds acknowledgement`},{id:`set-background`,section:`voice`,label:`Keep listening when the screen is off`,description:`Lock-screen controls and listening with the screen off`,keywords:`background lock screen`},{id:`set-recording`,section:`voice`,label:`Record voice conversations (developer)`,description:`Saves your voice segments, transcripts, replies, timing and Concierge actions on this hub, for 7 days; export or delete them`,keywords:`record debug developer training audio export delete`},{id:`recordings`,section:`voice`,label:`Your recordings`,description:`The voice conversations recorded on this hub: play a segment, export or delete them`,keywords:`recordings list play segment export zip delete storage usage`},{id:`speech`,section:`voice`,label:`Speech`,description:`Speech-to-text and text-to-speech provider, model, voice and API keys`,keywords:`stt tts transcription openrouter openai key`},{id:`media-allowlist`,section:`media`,label:`Web images`,description:`Sites whose images in replies load at once; images from other sites wait for a tap`,keywords:`allowlist allow remote image picture domain host site github load`},{id:`machines`,section:`machines`,label:`Machines`,description:`Computers running OpenCode connected to this hub; approve or revoke them`,keywords:`computer approve enrollment revoke opencode`},{id:`setup-machine`,section:`machines`,label:`Set up Hub on a machine`,description:`A one-line installer for macOS, Linux or Windows that connects a computer to this hub`,keywords:`setup install connect add new computer server laptop hubctl curl powershell windows linux macos enroll`},{id:`devices`,section:`machines`,label:`Devices`,description:`Browsers and the Hub app signed in to your account; revoke them`,keywords:`browser phone sessions revoke sign out`},{id:`agents`,section:`agents`,label:`Acting switch`,description:`Whether sessions and apps may act for you at all`,keywords:`pause kill switch acting`},{id:`app-tokens`,section:`agents`,label:`App tokens`,description:`Tokens for MCP gateways, CLIs and other apps, with their scopes`,keywords:`api key token scopes mcp cli`},{id:`grants`,section:`agents`,label:`Grants`,description:`What sessions and apps may approve, deny, answer, prompt or stop for you`,keywords:`permissions delegate allow`},{id:`agent-activity`,section:`agents`,label:`Agent activity`,description:`What agents did for you (the agent audit)`,keywords:`audit log history`},{id:`concierge`,section:`concierge`,label:`Concierge`,description:`Turn the Concierge on or off, pick its machine and directory, restart it`,keywords:`assistant butler watch sessions`},{id:`concierge-grant`,section:`concierge`,label:`Concierge grant`,description:`What the Concierge may do for you without asking; renew or remove it`,keywords:`permissions approve deny preset`},{id:`context-cards`,section:`concierge`,label:`Context cards`,description:`Short pick-up summaries of your sessions, written by a light model`,keywords:`summary pickup card model resume findability`},{id:`team-isolation`,section:`teams`,label:`Team isolation`,description:`Team members see only their teams' sessions, not your other sessions`,keywords:`teams privacy hide members`}],Gn=[{id:`admin`,section:`admin`,label:`Users`,description:`Everyone on this hub: roles, disable, remove`,keywords:`admin accounts people`},{id:`admin-machines`,section:`admin`,label:`All machines`,description:`Every machine connected to this hub, by owner`,keywords:`admin revoke`},{id:`admin-audit`,section:`admin`,label:`Audit log`,description:`Who changed what on this hub`,keywords:`admin history`}],Kn=(e,t)=>({id:`pref-${e.key}`,section:`notifications`,label:e.label,description:e.description,keywords:`notify ${t}`});function qn(e){return[...Wn,...K.flatMap(e=>e.kinds.map(t=>Kn(t,e.title))),...e?Gn:[]]}var Jn=e=>q.find(t=>t.id===e)?.label??e;function Yn(e,t){let n=e.trim().toLowerCase();if(!n)return[];let r=n.split(/\s+/),i=e=>{let t=e.label.toLowerCase();return t.startsWith(n)?0:t.includes(n)?1:r.every(e=>t.includes(e))?2:3};return t.filter(e=>{let t=`${e.label} ${e.description} ${e.keywords??``} ${Jn(e.section)}`.toLowerCase();return r.every(e=>t.includes(e))}).map((e,t)=>({e,i:t,r:i(e)})).sort((e,t)=>e.r-t.r||e.i-t.i).map(e=>e.e)}function Xn(e,t){let n=e.filter(e=>e.key in t);if(!n.length)return``;let r=n.filter(e=>t[e.key]);return r.length===n.length?`All on`:r.length?`${r.length} of ${n.length} on: ${r.map(e=>e.label).join(`, `)}`:`All off`}var Zn=e=>e&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.includes(`\\`)?e:`/`;function Qn(e){let t=e.pathname,n=e.searchParams;if(t===`/pair`)return{name:`pair`,next:Zn(n.get(`next`)),error:n.get(`error`)??``};if(t===`/approve`)return{name:`approve`,code:n.get(`code`)??``};let r=Ht(t);if(r)return{name:`consent`,flow:r};if(t===`/new`)return{name:`new`,machine:n.get(`machine`)??void 0,dir:n.get(`dir`)??void 0,key:n.get(`key`)??void 0};if(t===`/panes`)return{name:`panes`};if(t===`/concierge`||t.startsWith(`/concierge/`))return{name:`concierge`};let i=Rn(t);if(i)return{name:`settings`,...i};let a=On(t);if(a)return{name:`feature`,id:a.dest.id,rest:a.rest};let o=/^\/s\/([^/]+)$/.exec(t);if(o)try{return{name:`session`,id:decodeURIComponent(o[1])}}catch{return{name:`home`}}return{name:`home`}}function J(){let e=(location.pathname===`/settings`?Un(location.hash):void 0)??wn(location.pathname,location.search,location.hash);return e&&history.replaceState(history.state,``,e),new URL(location.href)}var[$n,er]=e(J()),tr=$n,nr=()=>Qn($n()),Y=0;function X(e,{replace:t=!1}={}){let n=new URL(e,location.origin);n.pathname+n.search+n.hash!==location.pathname+location.search+location.hash&&(history[t?`replaceState`:`pushState`]({},``,n.pathname+n.search+n.hash),t||Y++),er(J())}function rr(e=`/`){Y>0?history.back():X(e)}window.addEventListener(`popstate`,()=>{Y=Math.max(0,Y-1),er(J())}),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[href]`);if(!t||t.target||t.hasAttribute(`download`)||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let n=t.getAttribute(`href`)??``;!n.startsWith(`/`)||n.startsWith(`//`)||n.startsWith(`/auth/`)||n.startsWith(`/api/`)||(e.preventDefault(),X(n))});var Z=()=>new Set;function ir(e){Z=e}var ar=e=>Z().has(e),or=e=>Z().has(e)?`/concierge`:`/s/${encodeURIComponent(e)}`,[sr,Q]=e(),cr=sr,lr=0,$;function ur(e,t=``,n){let r=++lr;Q({id:r,text:e,kind:t,action:n}),clearTimeout($),$=setTimeout(()=>sr()?.id===r&&Q(void 0),n||t?8e3:4e3)}var dr=()=>Q(void 0);export{Zt as $,hn as A,je as At,H as B,_ as Bt,Fn as C,M as Ct,En as D,Ge as Dt,kn as E,We as Et,xn as F,Ce as Ft,cn as G,ie as Gt,ln as H,h as Ht,dn as I,be as It,Qt as J,r as Jt,rn as K,ne as Kt,un as L,Te as Lt,U as M,Ne as Mt,bn as N,E as Nt,Dn as O,Dt as Ot,Sn as P,ke as Pt,Xt as Q,en as R,fe as Rt,An as S,Le as St,G as T,Ve as Tt,an as U,le as Ut,sn as V,se as Vt,on as W,ue as Wt,Gt as X,ee as Xt,Yt as Y,u as Yt,Wt as Z,Nn as _,A as _t,ar as a,Et as at,Mn as b,kt as bt,nr as c,ut as ct,Xn as d,He as dt,Ut as et,zn as f,Ot as ft,Ln as g,Je as gt,qn as h,Qe as ht,rr as i,At as it,_n as j,Me as jt,vn as k,Pt as kt,or as l,yt as lt,Hn as m,Nt as mt,dr as n,k as nt,tr as o,Re as ot,Yn as p,Ye as pt,$t as q,ce as qt,ur as r,Pe as rt,X as s,wt as st,cr as t,qt as tt,ir as u,Ue as ut,K as v,$e as vt,jn as w,et as wt,In as x,Ie as xt,Pn as y,Tt as yt,tn as z,de as zt};
|
|
9
|
+
`).map(e=>e.trim()).filter(Boolean))];if(!n.length)return{ok:!1,field:`redirects`,error:`Add at least one redirect URI`};if(n.length>10)return{ok:!1,field:`redirects`,error:`At most 10 redirect URIs`};for(let e of n){let t=Rt(e);if(t)return{ok:!1,field:`redirects`,error:`${e}: ${t}`}}return e.scopes.length?{ok:!0,body:{name:t,redirectURIs:n,scopes:[...new Set(e.scopes)],...e.audience?{audience:e.audience}:{}}}:{ok:!1,field:`scopes`,error:`Pick at least one scope`}}var en=class extends Error{status;code;field;hint;details;constructor(e,t){super(t),this.status=e}},tn=class extends Error{cause;name=`NetworkError`;constructor(e){super(`Can't reach the hub: the connection dropped. Check your network and try again.`),this.cause=e}},nn;function rn(e){nn=e}async function H(e,{method:t=`GET`,json:n,body:r,headers:i={},signal:a,keepalive:o}={}){let s={method:t,credentials:`same-origin`,headers:{...i},signal:a,keepalive:o};n===void 0?r!==void 0&&(s.body=r):(s.headers[`content-type`]=`application/json`,s.body=JSON.stringify(n));let c;try{c=await fetch(e,s)}catch(e){throw e instanceof TypeError?new tn(e):e}if(!c.ok){let e=await c.json().catch(()=>({}));c.status===401&&nn?.();let t=e.error&&typeof e.error==`object`?e.error:e,n=typeof e.error==`string`?e.error:typeof t.message==`string`?t.message:``,r=new en(c.status,n||`HTTP ${c.status}`);throw typeof t.field==`string`&&(r.field=t.field),typeof t.code==`string`&&(r.code=t.code),typeof t.hint==`string`&&(r.hint=t.hint),e.error&&typeof e.error==`object`&&(r.details=t),r}return c}var an=async e=>(await H(e)).json(),on=async(e,t={})=>(await H(e,{method:`POST`,json:t})).json().catch(()=>({})),sn=encodeURIComponent,cn=e=>`/api/sessions/${sn(e)}`,ln=e=>e instanceof Error?e.message:String(e),un=e=>typeof e==`object`&&!!e&&!Array.isArray(e),dn=/^[A-Za-z0-9_.:@/+~-]{1,300}$/,fn=/[\p{Cc}\p{Cf}\u2028\u2029]/u,pn={workspace:`ws`,binding:`wsb`,member:`wsm`,assignment:`asg`,supervision:`sup`,checkpoint:`chk`,sideChat:`chat`,profile:`prof`,artifact:`art`,revision:`rev`,blob:`blob`,aiJob:`job`,team:`team`,staffing:`stf`,intake:`itk`},mn=/^[A-Za-z0-9]{16,32}$/;function hn(e,t){if(typeof t!=`string`)return!1;let n=`${pn[e]}_`;return t.startsWith(n)&&mn.test(t.slice(n.length))}var gn=/^[a-z0-9-]{2,40}$/,U=e=>typeof e==`string`&&gn.test(e),_n=(e,t=120)=>typeof e==`string`&&e.trim().length>0&&e.length<=t&&!fn.test(e),vn=4e3,yn=/[\u0000-\u0009\u000b-\u001f\u007f\u2028\u2029\u200b-\u200f\u202a-\u202e\u2066-\u2069]/,bn=(e,t=vn)=>typeof e==`string`&&e.length<=t&&!yn.test(e);function xn(e){if(e!==void 0){if(!Array.isArray(e)||e.length>32)return`tags must be a list of at most 32`;if(!e.every(U))return`each tag must be 2–40 lowercase letters, digits or dashes`;if(new Set(e).size!==e.length)return`tags must be unique`}}function Sn(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))return`metadata must be an object`;let t=Object.entries(e);if(t.length>32)return`metadata has more than 32 keys`;for(let[e,n]of t){if(!U(e))return`metadata key ${JSON.stringify(String(e).slice(0,50))} must be a slug`;if(!_n(n,200))return`metadata.${e} must be 1–200 characters of text`}}var W=e=>e.signedIn,G=[{id:`sessions`,label:`All sessions`,icon:`home`,route:`/`,order:10,available:e=>W(e)?!0:`hidden`},{id:`concierge`,label:`Concierge`,icon:`spark`,route:`/concierge`,order:15,available:e=>W(e)&&e.concierge!==void 0&&e.concierge!==`disabled`?!0:`hidden`},{id:`artifacts`,label:`Artifacts`,icon:`file`,route:`/artifacts`,order:20,available:e=>W(e)?!0:`hidden`},{id:`teams`,label:`Teams`,icon:`team`,route:`/teams`,order:25,available:e=>W(e)?!0:`hidden`},{id:`watchtower`,label:`Watchtower`,icon:`watchtower`,route:`/watchtower`,order:30,available:e=>W(e)?!0:`hidden`},{id:`profiles`,label:`Agent profiles`,icon:`settings`,route:`/profiles`,order:40,available:e=>W(e)?!0:`hidden`}],Cn={"/birds-eye":`/watchtower`};function wn(e,t=``,n=``){for(let[r,i]of Object.entries(Cn))if(e===r||e.startsWith(`${r}/`))return`${i}${e.slice(r.length)}${t}${n}`}function Tn(e,t){try{return e.available(t)}catch{return`hidden`}}function En(e,t=G){return[...t].sort((e,t)=>e.order-t.order).flatMap(t=>{let n=Tn(t,e);return n===`hidden`?[]:[{dest:t,enabled:n===!0}]})}var Dn=(e,t)=>Tn(e,t)===!0?`ok`:`unavailable`;function On(e,t=G){for(let n of t)if(n.route!==`/`&&(e===n.route||e.startsWith(`${n.route}/`)))try{return{dest:n,rest:e.slice(n.route.length).split(`/`).filter(Boolean).map(decodeURIComponent)}}catch{return}}function kn(e,t=G){return e===`/`?t.find(e=>e.route===`/`)?.id:On(e,t)?.dest.id}function An(e){return e.supported?e.permission===`denied`?{state:`blocked`,message:`Notifications are blocked for this site. Allow them in the browser's site settings, then reload.`,action:`none`,warn:!0}:e.permission==="default"?{state:`off`,message:`Notifications are off on this device.`,action:`enable`,warn:!0}:!e.worker||!e.endpoint||!e.hubSubscribed?{state:`repair`,message:`Allowed, but this device is not subscribed on this hub, so nothing will arrive (this happens after the hub moves to a new address). Enable again to fix it.`,action:`enable`,warn:!0}:{state:`on`,message:`On for this device.`,action:`disable`,warn:!1}:{state:`unsupported`,message:`This browser can't get notifications here. On iPhone, add the app to the Home Screen first (iOS 16.4+); everywhere else the hub must be on https.`,action:`none`,warn:!0}}var jn=e=>e.supported&&e.permission===`granted`&&(!e.endpoint||!e.hubSubscribed);function Mn(e){if(e.subscriptions===0)return{ok:!1,text:`This device is not subscribed; enable notifications first`};if(e.sent>0)return{ok:!0,text:e.sent===1?`Test notification sent to this device`:`Test notification sent (${e.sent} subscriptions)`};let t=e.failed[0];return t?{ok:!1,text:`Test failed: ${t.host} ${t.status===void 0?`did not answer`:`answered ${t.status}`}`}:{ok:!1,text:`Test failed`}}var Nn=[1,2,5,10,15,30,60],K=[{title:`Needs you`,kinds:[{key:`question`,label:`Question`,description:`A session or subagent asks you something.`},{key:`permission`,label:`Needs permission`,description:`A tool call waits for your OK (answer from the notification).`},{key:`decision`,label:`Decision`,description:`A session asks you to decide (hub ask @me), with options and a recommendation.`},{key:`message`,label:`Message`,description:`Agent messaging needs you: a message to you, an unanswered ask, or sessions looping.`},{key:`concierge`,label:`Concierge`,description:`Your Concierge needs you or has news: its questions, permissions, decisions, messages and spoken replies.`}]},{title:`Session`,kinds:[{key:`done`,label:`All done`,description:`The session and all its subagents and scripts finished; nothing waits on you. Once per run.`},{key:`failed`,label:`Failed`,description:`The session's run failed (provider or tool error), with the reason.`},{key:`providerError`,label:`Model provider error`,description:`Quota, budget, auth or model-routing errors of the session or a subagent; once per run.`},{key:`turn`,label:`Turn finished`,description:`Every reply of the main session, also the short ones between subagents. Noisy.`},{key:`stopped`,label:`Stopped`,description:`A run stopped without you asking (OpenCode shut down, inactivity).`},{key:`retry`,label:`Retrying`,description:`The provider failed and OpenCode is retrying the request.`}]},{title:`Subagents`,kinds:[{key:`subagentDone`,label:`Subagent finished`,description:`Each subagent that finishes, by name.`},{key:`subagentFailed`,label:`Subagent failed`,description:`Each subagent that fails, with the reason.`}]},{title:`Scripts and tools`,kinds:[{key:`jobDone`,label:`Script finished`,description:`A background shell or terminal exited 0.`},{key:`jobFailed`,label:`Script failed`,description:`A background shell or terminal exited non-zero, was killed or timed out.`},{key:`longTool`,label:`Long tool finished`,description:`A tool call that ran 30 seconds or more ended.`}]},{title:`Voice`,kinds:[{key:`say`,label:`Spoken reply`,description:`Voice mode replies while no device shows the session.`},{key:`handoff`,label:`Hand-off`,description:`A session sent to this device from the terminal (ignores quiet hours).`}]},{title:`Activity digest`,kinds:[{key:`activity`,label:`Activity`,description:`One quiet, self-replacing summary per session: subagents, long tools, scripts, idle.`}]}],Pn=K.flatMap(e=>e.kinds);function Fn(e){let t=Pn.filter(t=>e[t.key]).map(e=>e.label);return t.length?`You'll get: ${t.join(`, `)}.`:`You'll get no notifications on this device.`}function In(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{return`UTC`}}var q=[{id:`general`,label:`General`,description:`Account, theme, text size and the Hub app`},{id:`notifications`,label:`Notifications`,description:`This device's notifications, what to notify about, quiet hours`},{id:`voice`,label:`Voice & speech`,description:`Voice mode, mic sensitivity, speech-to-text and text-to-speech`},{id:`media`,label:`Media`,description:`Web images in replies: the sites whose images load at once`},{id:`machines`,label:`Machines & devices`,description:`Connected machines, approvals, signed-in browsers and apps`},{id:`agents`,label:`Agents & access`,description:`App tokens, acting switches, grants and agent activity`},{id:`concierge`,label:`Concierge`,description:`Your hub-managed assistant: machine, directory, model and its grant`},{id:`teams`,label:`Teams`,description:`Team isolation: what team members see`},{id:`admin`,label:`Admin`,description:`Users, all machines, approvals and the audit log`,admin:!0}],Ln=e=>q.filter(t=>e||!t.admin);function Rn(e){if(e!==`/settings`&&!e.startsWith(`/settings/`))return;let t=e.slice(10).split(`/`)[0]??``;if(!t)return{};try{return{section:decodeURIComponent(t)}}catch{return{section:t}}}function zn(e,t){return e===void 0?t.phone?`list`:`general`:Ln(t.admin).find(t=>t.id===e)?.id}var Bn={account:`general`,appearance:`general`,notifications:`notifications`,voice:`voice`,speech:`voice`,machines:`machines`,devices:`machines`,agents:`agents`,admin:`admin`,recording:`voice`,recordings:`voice`},Vn={recording:`recordings`};function Hn(e){return Vn[e]??e}function Un(e){let t=e.replace(/^#/,``);if(!t)return;let n=Bn[t];if(n)return`/settings/${n}#${Hn(t)}`;if(q.some(e=>e.id===t))return`/settings/${t}`}var Wn=[{id:`account`,section:`general`,label:`Account`,description:`Who you are signed in as; sign out of this device`,keywords:`sign out logout user email`},{id:`set-theme`,section:`general`,label:`Color theme`,description:`Light, dark or the system's theme`,keywords:`appearance light dark system mode`},{id:`set-text-size`,section:`general`,label:`Text size`,description:`How big text is on this device`,keywords:`appearance font scale zoom`},{id:`add-app`,section:`general`,label:`Add the Hub app`,description:`Link the Hub app on a phone or tablet with a QR code`,keywords:`mobile android ios install pair link`},{id:`notifications`,section:`notifications`,label:`Notifications on this device`,description:`Enable or turn off push notifications here; permission and subscription status`,keywords:`push enable subscribe permission service worker`},{id:`notify-test`,section:`notifications`,label:`Send test notification`,description:`Check that notifications reach this device`,keywords:`push try`},{id:`quiet-hours`,section:`notifications`,label:`Quiet hours`,description:`No notifications at night (hand-offs still come through)`,keywords:`do not disturb night sleep time`},{id:`set-voice-speed`,section:`voice`,label:`Voice speed`,description:`How fast replies are spoken`,keywords:`rate tts`},{id:`set-sensitivity`,section:`voice`,label:`Mic sensitivity`,description:`How sure Voice mode must be that you are speaking to it`,keywords:`microphone noise vad`},{id:`set-turn-detection`,section:`voice`,label:`Turn detection`,description:`When Voice mode decides you finished speaking: silence timers, or the Smart Turn audio model (experimental)`,keywords:`end of turn endpointing smart turn pause hold vad experimental`},{id:`set-voice-front`,section:`voice`,label:`Voice front`,description:`Voice mode's fast voice agent: it says what it understood, then relays to the session, which keeps its own agent. On by default; turn it off to talk to the session directly`,keywords:`front echo relay fast assistant agent off direct`},{id:`set-cues`,section:`voice`,label:`Progress cues`,description:`Tones and short acknowledgements while the agent works`,keywords:`sounds acknowledgement`},{id:`set-background`,section:`voice`,label:`Keep listening when the screen is off`,description:`Lock-screen controls and listening with the screen off`,keywords:`background lock screen`},{id:`set-recording`,section:`voice`,label:`Record voice conversations (developer)`,description:`Saves your voice segments, transcripts, replies, timing and Concierge actions on this hub, for 7 days; export or delete them`,keywords:`record debug developer training audio export delete`},{id:`set-developer`,section:`voice`,label:`Developer mode`,description:`Records much more for debugging Voice: raw microphone audio clips, reply audio, detector traces, devices and network, console errors, models and token counts`,keywords:`developer mode debug diagnostics raw audio clips reply logs errors trace model tokens`},{id:`recordings`,section:`voice`,label:`Your recordings`,description:`The voice conversations recorded on this hub: play a segment, export or delete them`,keywords:`recordings list play segment export zip delete storage usage`},{id:`speech`,section:`voice`,label:`Speech`,description:`Speech-to-text and text-to-speech provider, model, voice and API keys`,keywords:`stt tts transcription openrouter openai key`},{id:`media-allowlist`,section:`media`,label:`Web images`,description:`Sites whose images in replies load at once; images from other sites wait for a tap`,keywords:`allowlist allow remote image picture domain host site github load`},{id:`machines`,section:`machines`,label:`Machines`,description:`Computers running OpenCode connected to this hub; approve or revoke them`,keywords:`computer approve enrollment revoke opencode`},{id:`setup-machine`,section:`machines`,label:`Set up Hub on a machine`,description:`A one-line installer for macOS, Linux or Windows that connects a computer to this hub`,keywords:`setup install connect add new computer server laptop hubctl curl powershell windows linux macos enroll`},{id:`devices`,section:`machines`,label:`Devices`,description:`Browsers and the Hub app signed in to your account; revoke them`,keywords:`browser phone sessions revoke sign out`},{id:`agents`,section:`agents`,label:`Acting switch`,description:`Whether sessions and apps may act for you at all`,keywords:`pause kill switch acting`},{id:`app-tokens`,section:`agents`,label:`App tokens`,description:`Tokens for MCP gateways, CLIs and other apps, with their scopes`,keywords:`api key token scopes mcp cli`},{id:`grants`,section:`agents`,label:`Grants`,description:`What sessions and apps may approve, deny, answer, prompt or stop for you`,keywords:`permissions delegate allow`},{id:`agent-activity`,section:`agents`,label:`Agent activity`,description:`What agents did for you (the agent audit)`,keywords:`audit log history`},{id:`concierge`,section:`concierge`,label:`Concierge`,description:`Turn the Concierge on or off, pick its machine and directory, restart it`,keywords:`assistant butler watch sessions`},{id:`concierge-grant`,section:`concierge`,label:`Concierge grant`,description:`What the Concierge may do for you without asking; renew or remove it`,keywords:`permissions approve deny preset`},{id:`context-cards`,section:`concierge`,label:`Context cards`,description:`Short pick-up summaries of your sessions, written by a light model`,keywords:`summary pickup card model resume findability`},{id:`team-isolation`,section:`teams`,label:`Team isolation`,description:`Team members see only their teams' sessions, not your other sessions`,keywords:`teams privacy hide members`}],Gn=[{id:`admin`,section:`admin`,label:`Users`,description:`Everyone on this hub: roles, disable, remove`,keywords:`admin accounts people`},{id:`admin-machines`,section:`admin`,label:`All machines`,description:`Every machine connected to this hub, by owner`,keywords:`admin revoke`},{id:`admin-audit`,section:`admin`,label:`Audit log`,description:`Who changed what on this hub`,keywords:`admin history`}],Kn=(e,t)=>({id:`pref-${e.key}`,section:`notifications`,label:e.label,description:e.description,keywords:`notify ${t}`});function qn(e){return[...Wn,...K.flatMap(e=>e.kinds.map(t=>Kn(t,e.title))),...e?Gn:[]]}var Jn=e=>q.find(t=>t.id===e)?.label??e;function Yn(e,t){let n=e.trim().toLowerCase();if(!n)return[];let r=n.split(/\s+/),i=e=>{let t=e.label.toLowerCase();return t.startsWith(n)?0:t.includes(n)?1:r.every(e=>t.includes(e))?2:3};return t.filter(e=>{let t=`${e.label} ${e.description} ${e.keywords??``} ${Jn(e.section)}`.toLowerCase();return r.every(e=>t.includes(e))}).map((e,t)=>({e,i:t,r:i(e)})).sort((e,t)=>e.r-t.r||e.i-t.i).map(e=>e.e)}function Xn(e,t){let n=e.filter(e=>e.key in t);if(!n.length)return``;let r=n.filter(e=>t[e.key]);return r.length===n.length?`All on`:r.length?`${r.length} of ${n.length} on: ${r.map(e=>e.label).join(`, `)}`:`All off`}var Zn=e=>e&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.includes(`\\`)?e:`/`;function Qn(e){let t=e.pathname,n=e.searchParams;if(t===`/pair`)return{name:`pair`,next:Zn(n.get(`next`)),error:n.get(`error`)??``};if(t===`/approve`)return{name:`approve`,code:n.get(`code`)??``};let r=Ht(t);if(r)return{name:`consent`,flow:r};if(t===`/new`)return{name:`new`,machine:n.get(`machine`)??void 0,dir:n.get(`dir`)??void 0,key:n.get(`key`)??void 0};if(t===`/panes`)return{name:`panes`};if(t===`/concierge`||t.startsWith(`/concierge/`))return{name:`concierge`};let i=Rn(t);if(i)return{name:`settings`,...i};let a=On(t);if(a)return{name:`feature`,id:a.dest.id,rest:a.rest};let o=/^\/s\/([^/]+)$/.exec(t);if(o)try{return{name:`session`,id:decodeURIComponent(o[1])}}catch{return{name:`home`}}return{name:`home`}}function J(){let e=(location.pathname===`/settings`?Un(location.hash):void 0)??wn(location.pathname,location.search,location.hash);return e&&history.replaceState(history.state,``,e),new URL(location.href)}var[$n,er]=e(J()),tr=$n,nr=()=>Qn($n()),Y=0;function X(e,{replace:t=!1}={}){let n=new URL(e,location.origin);n.pathname+n.search+n.hash!==location.pathname+location.search+location.hash&&(history[t?`replaceState`:`pushState`]({},``,n.pathname+n.search+n.hash),t||Y++),er(J())}function rr(e=`/`){Y>0?history.back():X(e)}window.addEventListener(`popstate`,()=>{Y=Math.max(0,Y-1),er(J())}),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[href]`);if(!t||t.target||t.hasAttribute(`download`)||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let n=t.getAttribute(`href`)??``;!n.startsWith(`/`)||n.startsWith(`//`)||n.startsWith(`/auth/`)||n.startsWith(`/api/`)||(e.preventDefault(),X(n))});var Z=()=>new Set;function ir(e){Z=e}var ar=e=>Z().has(e),or=e=>Z().has(e)?`/concierge`:`/s/${encodeURIComponent(e)}`,[sr,Q]=e(),cr=sr,lr=0,$;function ur(e,t=``,n){let r=++lr;Q({id:r,text:e,kind:t,action:n}),clearTimeout($),$=setTimeout(()=>sr()?.id===r&&Q(void 0),n||t?8e3:4e3)}var dr=()=>Q(void 0);export{Zt as $,hn as A,je as At,H as B,_ as Bt,Fn as C,M as Ct,En as D,Ge as Dt,kn as E,We as Et,xn as F,Ce as Ft,cn as G,ie as Gt,ln as H,h as Ht,dn as I,be as It,Qt as J,r as Jt,rn as K,ne as Kt,un as L,Te as Lt,U as M,Ne as Mt,bn as N,E as Nt,Dn as O,Dt as Ot,Sn as P,ke as Pt,Xt as Q,en as R,fe as Rt,An as S,Le as St,G as T,Ve as Tt,an as U,le as Ut,sn as V,se as Vt,on as W,ue as Wt,Gt as X,ee as Xt,Yt as Y,u as Yt,Wt as Z,Nn as _,A as _t,ar as a,Et as at,Mn as b,kt as bt,nr as c,ut as ct,Xn as d,He as dt,Ut as et,zn as f,Ot as ft,Ln as g,Je as gt,qn as h,Qe as ht,rr as i,At as it,_n as j,Me as jt,vn as k,Pt as kt,or as l,yt as lt,Hn as m,Nt as mt,dr as n,k as nt,tr as o,Re as ot,Yn as p,Ye as pt,$t as q,ce as qt,ur as r,Pe as rt,X as s,wt as st,cr as t,qt as tt,ir as u,Ue as ut,K as v,$e as vt,jn as w,et as wt,In as x,Ie as xt,Pn as y,Tt as yt,tn as z,de as zt};
|
package/web/dist/index.html
CHANGED
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
<link rel="icon" href="/icon.svg" type="image/svg+xml" />
|
|
18
18
|
<link rel="icon" href="/icon-192.png" type="image/png" sizes="192x192" />
|
|
19
19
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
20
|
-
<script type="module" crossorigin src="/assets/index-
|
|
20
|
+
<script type="module" crossorigin src="/assets/index-Da8SKXMw.js"></script>
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/assets/ui-CFB4wQfF.js">
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/toast-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/pane-layout-
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/toast-q818mjUF.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/pane-layout-BAuu_pA3.js">
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/assets/plural-Bspvoqfq.js">
|
|
25
|
-
<link rel="modulepreload" crossorigin href="/assets/artifacts-
|
|
25
|
+
<link rel="modulepreload" crossorigin href="/assets/artifacts-DlQEYmDl.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-BLdHbfdN.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/MediaImage-Ch3ryIdR.js">
|
|
28
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
28
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Dyq-jBeE.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
|
31
31
|
<div id="root"></div>
|