@devframes/plugin-terminals--assets 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-Ba4L0anG.js";var t=Symbol.for(`devframe:browser-agent-registry`),{tools:n,listeners:r}=globalThis[t]??={tools:new Map,listeners:new Set};function i(){return[...n.values()]}function a(e){return r.add(e),()=>r.delete(e)}var o=`devframe:client-id`,s;function c(t=globalThis.window){try{let n=t?.sessionStorage;if(n){let t=n.getItem(o);return t||(t=e(),n.setItem(o,t)),t}}catch{}return s??=e(),s}function l(){let e=typeof document>`u`?void 0:document;return{url:e?.location?.href??``,title:e?.title??``,visible:!e||e.visibilityState===`visible`,focused:e?.hasFocus()??!0}}function u(e){e.client.register({name:`devframe:agent:invoke-client-tool`,type:`action`,jsonSerializable:!0,handler:async(e,t)=>{let n=i().find(t=>t.id===e);if(!n)throw Error(`[devframe/agent] browser tool "${e}" not found`);return await n.invoke(t)}});let t=!1,n=!1,r=0,o=()=>{t||n||(t=!0,queueMicrotask(async()=>{if(t=!1,n)return;let a=i().map(({invoke:e,...t})=>t);(a.length!==0||r!==0)&&(r=a.length,await e.callOptional(`devframe:agent:sync-client-tools`,c(),a,l()).catch(()=>{}))}))},s=a(o),u=e.events.on(`connection:status`,e=>{e===`connected`&&o()}),d=typeof window>`u`?void 0:window;return d?.addEventListener(`focus`,o),d?.addEventListener(`blur`,o),d?.document.addEventListener(`visibilitychange`,o),o(),()=>{n=!0,s(),u(),d?.removeEventListener(`focus`,o),d?.removeEventListener(`blur`,o),d?.document.removeEventListener(`visibilitychange`,o)}}export{u as setupBrowserAgentRpcBridge};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={bus:{agentManifestChanged:`agent:manifest:changed`,agentToolRegistered:`agent:tool:registered`,agentToolUnregistered:`agent:tool:unregistered`,agentResourceRegistered:`agent:resource:registered`,agentResourceUnregistered:`agent:resource:unregistered`},client:{isTrustedUpdated:`rpc:is-trusted:updated`,error:`rpc:error`,connectionStatus:`connection:status`,connectionError:`connection:error`},broadcast:{authRevoked:`devframe:auth:revoked`,cacheInvalidate:`devframe:rpc:cache:invalidate`,clientStateUpdated:`devframe:rpc:client-state:updated`,clientStatePatch:`devframe:rpc:client-state:patch`,streamingChunk:`devframe:streaming:chunk`,streamingEnd:`devframe:streaming:end`,streamingUploadCancel:`devframe:streaming:upload-cancel`},inPageChannel:{panelStateUpdated:`devframe:in-page:panel-state:updated`,panelStatePatch:`devframe:in-page:panel-state:patch`},postMessage:{remoteAssetsError:`devframe:remote-assets-error`,inPageChannel:`devframe:in-page-channel`}},t=`__connection.json`,n=`__DEVFRAME_CONNECTION__`,r=`x-birpc-session`,i=`__rpc-dump/index.json`,a=`devframe:services`,o=`devframe_otp`,s=`devframe_auth_token`;e.postMessage.remoteAssetsError;function c(e){return typeof e==`string`?`'${e}'`:new f().serialize(e)}var l=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,u=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[l.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function d(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&u[n]?u[n]:n+128,s=a<128&&u[a]?u[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var f=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?d(e,t):n===`number`&&r===`number`?e-t:d(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(d),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`,`)}]`};for(let t of[`BigInt64Array`,`BigUint64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`n,`)}${e.length>0?`n`:``}]`};return e})(),p=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],m=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],h=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,g=[],_=class{_data=new v;_hash=new v([...p]);_nDataBytes=0;_minBufferSize=0;finalize(e){e&&this._append(e);let t=this._nDataBytes*8,n=this._data.sigBytes*8;return this._data.words[n>>>5]|=128<<24-n%32,this._data.words[(n+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(n+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7];for(let n=0;n<64;n++){if(n<16)g[n]=e[t+n]|0;else{let e=g[n-15],t=(e<<25|e>>>7)^(e<<14|e>>>18)^e>>>3,r=g[n-2],i=(r<<15|r>>>17)^(r<<13|r>>>19)^r>>>10;g[n]=t+g[n-7]+i+g[n-16]}let d=s&c^~s&l,f=r&i^r&a^i&a,p=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),h=(s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25),_=u+h+d+m[n]+g[n],v=p+f;u=l,l=c,c=s,s=o+_|0,o=a,a=i,i=r,r=_+v|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+u|0}_append(e){typeof e==`string`&&(e=v.fromUtf8(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(e){let t,n=this._data.sigBytes/64;n=e?Math.ceil(n):Math.max((n|0)-this._minBufferSize,0);let r=n*16,i=Math.min(r*4,this._data.sigBytes);if(r){for(let e=0;e<r;e+=16)this._doProcessBlock(this._data.words,e);t=this._data.words.splice(0,r),this._data.sigBytes-=i}return new v(t,i)}},v=class e{words;sigBytes;constructor(e,t){e=this.words=e||[],this.sigBytes=t===void 0?e.length*4:t}static fromUtf8(t){let n=unescape(encodeURIComponent(t)),r=n.length,i=[];for(let e=0;e<r;e++)i[e>>>2]|=(n.charCodeAt(e)&255)<<24-e%4*8;return new e(i,r)}toBase64(){let e=[];for(let t=0;t<this.sigBytes;t+=3){let n=this.words[t>>>2]>>>24-t%4*8&255,r=this.words[t+1>>>2]>>>24-(t+1)%4*8&255,i=this.words[t+2>>>2]>>>24-(t+2)%4*8&255,a=n<<16|r<<8|i;for(let n=0;n<4&&t*8+n*6<this.sigBytes*8;n++)e.push(h.charAt(a>>>6*(3-n)&63))}return e.join(``)}concat(e){if(this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4),this.sigBytes%4)for(let t=0;t<e.sigBytes;t++){let n=e.words[t>>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=n<<24-(this.sigBytes+t)%4*8}else for(let t=0;t<e.sigBytes;t+=4)this.words[this.sigBytes+t>>>2]=e.words[t>>>2];this.sigBytes+=e.sigBytes}};function y(e){return new _().finalize(e).toBase64()}function b(e){return y(c(e))}function ee(e){return b(e)}var x=class{cacheMap=new Map;options;keySerializer;constructor(e){this.options=e,this.keySerializer=e.keySerializer||(e=>ee(e))}updateOptions(e){this.options={...this.options,...e}}cached(e,t){let n=this.cacheMap.get(e);if(n)return n.get(this.keySerializer(t))}has(e,t){return this.cacheMap.get(e)?.has(this.keySerializer(t))??!1}apply(e,t){let n=this.cacheMap.get(e.m)||new Map;n.set(this.keySerializer(e.a),t),this.cacheMap.set(e.m,n)}validate(e){return this.options.functions.includes(e)}clear(e){e?this.cacheMap.delete(e):this.cacheMap.clear()}};function S(e,t){let n=`\x1B[${e}m`,r=`\x1B[${t}m`;return((e,...t)=>{if(Array.isArray(e)&&`raw`in e){let i=e,a=``;for(let e=0;e<i.length;e++)a+=i[e],e<t.length&&(a+=String(t[e]));return`${n}${a}${r}`}return`${n}${String(e)}${r}`})}var te={blue:S(34,39),cyan:S(36,39),gray:S(90,39),green:S(32,39),red:S(31,39),yellow:S(33,39),bold:S(1,22),dim:S(2,22),reset:S(0,0),underline:S(4,24)};function C(e,...t){return typeof e==`function`?e(...t):e}var ne=Error.captureStackTrace,w=class e extends Error{name;code;docs;fix;sources;data;get why(){return this.message}constructor(t,n=e){super(t.why,{cause:t.cause}),this.code=this.name=t.code,this.fix=t.fix,this.docs=t.docs,this.sources=t.sources,this.data=t.data,ne?.(this,n)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,data:this.data,stack:this.stack}}};function re(e,t){return typeof e==`string`?`${e}/${t.toLowerCase()}`:e?.(t)}function T(e){let t=e.reporters??[],n={},{docsBase:r}=e;for(let i of Object.keys(e.codes)){let a=e.codes[i],o=a.docs===!1?void 0:a.docs||re(r,i),s=(e={},n={})=>{let r=new w({code:i,why:C(a.why,e),fix:C(a.fix,e),docs:o,cause:e.cause,sources:e.sources,data:C(a.data,e)},s);for(let e of t)e(r,n);return r};n[i]=s}return n}function ie(e){return t=>{let n=`${e.bold(e.red(`[${t.name}]`))} ${t.message}`,r=[];return t.fix&&r.push(`${e.dim(`fix:`)} ${t.fix}`),t.sources?.length&&r.push(`${e.dim(`sources:`)} ${t.sources.join(`, `)}`),t.docs&&r.push(`${e.dim(`see:`)} ${e.cyan(t.docs)}`),r.length===0?n:[n,...r.map((t,n)=>`${e.dim(n<r.length-1?`├▶`:`╰▶`)} ${t}`)].join(`
|
|
2
2
|
`)}}var ae=ie(te);function oe(e,{method:t=`warn`}={}){console[t](ae(e))}function E(e){return T({...e,reporters:[oe,...e.reporters??[]]})}var se=E({docsBase:`https://devfra.me/errors`,codes:{DF0019:{why:e=>`RPC function "${e.name}" has \`agent\` set but \`jsonSerializable\` is \`false\`; MCP requires JSON-serializable data.`,fix:"Remove `jsonSerializable: false`, or remove `agent` to keep it RPC-only."},DF0020:{why:e=>`RPC function "${e.name}" declares \`jsonSerializable: true\` but the value at "${e.path}" is a ${e.type}.`,fix:"Either drop `jsonSerializable: true` (falls back to structured-clone) or change the value to a JSON-safe shape."},DF0021:{why:e=>`RPC function "${e.name}" is already registered`,fix:"Use the `force` parameter to overwrite an existing registration."},DF0022:{why:e=>`RPC function "${e.name}" is not registered. Use register() to add new functions.`},DF0023:{why:e=>`RPC function "${e.name}" is not registered`},DF0024:{why:e=>`Either handler or setup function must be provided for RPC function "${e.name}"`},DF0025:{why:e=>`Function "${e.name}" not found in dump store`},DF0026:{why:e=>`No dump match for "${e.name}" with args: ${e.args}`},DF0027:{why:e=>`Function "${e.name}" with type "${e.type}" cannot have dump configuration. Only "static" and "query" types support dumps.`},DF0028:{why:e=>`Function "${e.name}" with type "${e.type}" cannot use \`snapshot: true\`. Only "query" functions support this sugar; "static" functions have equivalent default behavior already.`,fix:"Remove `snapshot: true`, or change the function type to `query`."},DF0043:{why:e=>`RPC function "${e.name}" received an invalid argument at position ${e.index}: ${e.issues}`,fix:"Pass a value that satisfies the `args` schema declared for this function."},DF0044:{why:e=>`RPC function "${e.name}" returned a value that failed its \`returns\` schema: ${e.issues}`,fix:"Make the handler return a value that satisfies the `returns` schema, or relax the schema."}}});function ce(e){if(e.agent&&e.jsonSerializable===!1)throw se.DF0019({name:e.name});e.agent&&!e.jsonSerializable&&(e.jsonSerializable=!0)}async function le(e,t){let n=e[`~standard`].validate(t);return n instanceof Promise?await n:n}function ue(e){return e.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `)}async function de(e,t,n){let r=n.slice();if(!t||t.length===0)return r;for(let r=0;r<t.length;r++){let i=t[r];if(!i)continue;let a=await le(i,n[r]);if(a.issues)throw se.DF0043({name:e,index:r,issues:ue(a.issues)})}return r}async function fe(e,t,n){if(!t)return n;let r=await le(t,n);if(r.issues)throw se.DF0044({name:e,issues:ue(r.issues)});return n}async function pe(e,t){if(!e.setup)return{};if(typeof t==`object`&&t){e.__cache??=new WeakMap;let n=e.__cache,r=n.get(t);return r||(r=Promise.resolve(e.setup(t)),r.catch(()=>{n.get(t)===r&&n.delete(t)}),n.set(t,r)),await r}if(!e.__promise){let n=Promise.resolve(e.setup(t));n.catch(()=>{e.__promise===n&&(e.__promise=void 0)}),e.__promise=n}return await e.__promise}async function me(e,t){let n=e.handler;if(!n){let r=await pe(e,t);if(!r.handler)throw se.DF0024({name:e.name});n=r.handler}let r=e.args,i=e.returns;if(!r&&!i)return n;let a=n;return async(...t)=>{let n=await de(e.name,r,t),o=await a(...n);return await fe(e.name,i,o)}}var he=class{context;definitions=new Map;functions;_onChanged=[];constructor(e){this.context=e;let t=this.definitions,n=this;this.functions=new Proxy({},{get(e,r){let i=t.get(r);if(i)return me(i,n.context)},has(e,n){return t.has(n)},getOwnPropertyDescriptor(e,n){return{value:t.get(n)?.handler,configurable:!0,enumerable:!0}},ownKeys(){return Array.from(t.keys())}})}register(e,t=!1){if(this.definitions.has(e.name)&&!t)throw se.DF0021({name:e.name});ce(e),this.definitions.set(e.name,e),this._onChanged.forEach(t=>t(e.name))}update(e,t=!1){if(!this.definitions.has(e.name)&&!t)throw se.DF0022({name:e.name});ce(e),this.definitions.set(e.name,e),this._onChanged.forEach(t=>t(e.name))}onChanged(e){return this._onChanged.push(e),()=>{let t=this._onChanged.indexOf(e);t!==-1&&this._onChanged.splice(t,1)}}async getHandler(e){return await me(this.definitions.get(e),this.context)}getSchema(e){let t=this.definitions.get(e);if(!t)throw se.DF0023({name:String(e)});return{args:t.args,returns:t.returns}}has(e){return this.definitions.has(e)}get(e){return this.definitions.get(e)}list(){return Array.from(this.definitions.keys())}};function ge(e,t=``){return JSON.stringify(e,function(e,n){let r=this,i=r==null?n:r[e];if(i===void 0){if(Array.isArray(r))throw ve(t,`undefined`,r,e);return n}return i!==null&&_e(i,r,e,t),n})}function _e(e,t,n,r){if(typeof e==`bigint`)throw ve(r,`BigInt`,t,n);if(typeof e!=`object`)return;if(e instanceof Map)throw ve(r,`Map`,t,n);if(e instanceof Set)throw ve(r,`Set`,t,n);if(e instanceof Date)throw ve(r,`Date`,t,n);if(Array.isArray(e))return;let i=Object.getPrototypeOf(e);if(i!==null&&i!==Object.prototype)throw ve(r,e.constructor?.name??`class instance`,t,n)}function ve(e,t,n,r){let i=ye(n,r);return se.DF0020({name:e||`<anonymous>`,type:t,path:i})}function ye(e,t){return Array.isArray(e)?`[${t}]`:t===``?`<root>`:t}function be(){let e={};function t(t,...n){let r=e[t]||[];for(let e=0,t=r.length;e<t;e++){let t=r[e];t&&t(...n)}}function n(n,...r){t(n,...r),delete e[n]}function r(t,n){return(e[t]||=[]).push(n),()=>{e[t]=e[t]?.filter(e=>n!==e)}}function i(e,t){let n=r(e,((...e)=>(n(),t(...e))));return n}return{_listeners:e,emit:t,emitOnce:n,on:r,once:i}}var xe=/^[\w+.-]{2,}:\/\//;function Se(e){return e.endsWith(`/`)?e:`${e}/`}function Ce(e){return(e.endsWith(`/`)?e.slice(0,-1):e)||`/`}function we(e,...t){let n=e;for(let e of t)e&&e!==`/`&&(n=n?Se(n)+e.replace(/^\.?\//,``):e);return n}function Te(e,t){if(!t||t===`/`||xe.test(e))return e;let n=Ce(t);return e.startsWith(n)?e:we(n,e)}function Ee(e,t){let n=e.match(xe);return t+(n?e.slice(n[0].length):e)}var De=`__DEVFRAME_CONNECTION_META__`,Oe=`__DEVFRAME_CONNECTION_AUTH_TOKEN__`;function ke(e){let t=[()=>window?.[e],()=>globalThis?.[e],()=>parent.window?.[e]];for(let e of t)try{let t=e();if(t)return t}catch{}}function Ae(){return ke(n)}function je(){return ke(De)}function Me(e){if(e)return e;try{let e=localStorage.getItem(Oe);if(e)return e}catch{}return ke(Oe)}function Ne(e){globalThis[n]=e,globalThis[De]={...e.connectionMeta,baseUrl:e.metaBaseUrl},e.authToken&&Pe(e.authToken)}function Pe(e){try{localStorage.setItem(Oe,e)}catch{}globalThis[Oe]=e;let t=Ae();t&&(globalThis[n]={...t,authToken:e})}function Fe(e){let n=Te(t,e);try{return new URL(n,globalThis.location?.href).href}catch{return n}}function Ie(e,t){return t&&t!==e.authToken?{...e,authToken:t}:e}function Le(){let e=Ae();if(e)return Ie(e,Me()??e.authToken??e.connectionMeta.authToken);let t=je();if(t)return{connectionMeta:t,metaBaseUrl:t.baseUrl??Fe(`./`),authToken:Me(t.authToken)}}async function Re(e={}){if(e.connection){let t=Ie(e.connection,Me(e.authToken??e.connection.authToken??e.connection.connectionMeta.authToken));return Ne(t),t}let n=Array.isArray(e.baseURL)?e.baseURL:[e.baseURL??`./`];if(e.connectionMeta){let t={connectionMeta:e.connectionMeta,metaBaseUrl:Fe(n[0]??`./`),authToken:Me(e.authToken??e.connectionMeta.authToken)};return Ne(t),t}let r=Le();if(r){let t=Ie(r,Me(e.authToken??r.authToken??r.connectionMeta.authToken));return Ne(t),t}let i=[];for(let r of n){let n=Te(t,r),a=Fe(r);try{let t=await fetch(n);if(!t.ok)throw Error(`Failed to fetch connection meta from ${a}: ${t.status}`);let r=await t.json(),i=t.url||a,o={connectionMeta:r,metaBaseUrl:r.baseUrl?new URL(r.baseUrl,i).href:i,authToken:Me(e.authToken??r.authToken)};return Ne(o),o}catch(e){i.push(e)}}throw Error(`Failed to get connection meta from ${n.join(`, `)}`,{cause:i})}var ze=class extends Error{name=`DevframeConnectionError`;kind;constructor(e,t,n){super(t,n),this.kind=e}};function Be(e=o){try{let t=globalThis.location?.hash?.replace(/^#/,``)??``;return new URLSearchParams(t).get(e)||void 0}catch{return}}function Ve(e){try{let t=new URL(globalThis.location.href),n=new URLSearchParams(t.hash.replace(/^#/,``));if(!n.has(e))return;n.delete(e),t.hash=n.toString(),globalThis.history?.replaceState(globalThis.history.state,``,t.href)}catch{}}function He(e=o){let t=Be(e);return t&&Ve(e),t}async function Ue(e,t={}){let n=He(t.param??`devframe_otp`);return n?e.isTrusted?!0:e.requestTrustWithCode(n):!1}function We(e){let t={},n=new WeakMap,r,i=()=>(r??=e.sharedState.get(a,{initialValue:{}}).then(e=>(t=e.value(),e.on(`updated`,e=>{t=e}),e)),r);return i(),{state:i,has:e=>e in t,keys:()=>Object.keys(t),get:r=>{let i=t[r];if(!i)return;let a=n.get(i);return a||(a={...i,rpc:e.scope(i.scope).rpc},n.set(i,a)),a}}}var Ge=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function Ke(e=21){let t=``,n=e;for(;n--;)t+=Ge[Math.random()*64|0];return t}var qe=Symbol.for(`immer-nothing`),Je=Symbol.for(`immer-draftable`),Ye=Symbol.for(`immer-state`);function Xe(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ze=Object,Qe=Ze.getPrototypeOf,$e=`constructor`,et=`prototype`,tt=`configurable`,nt=`enumerable`,rt=`writable`,it=`value`,at=e=>!!e&&!!e[Ye];function ot(e){return e?lt(e)||gt(e)||!!e[Je]||!!e[$e]?.[Je]||_t(e)||vt(e):!1}var st=Ze[et][$e].toString(),ct=new WeakMap;function lt(e){if(!e||!yt(e))return!1;let t=Qe(e);if(t===null||t===Ze[et])return!0;let n=Ze.hasOwnProperty.call(t,$e)&&t[$e];if(n===Object)return!0;if(!bt(n))return!1;let r=ct.get(n);return r===void 0&&(r=Function.toString.call(n),ct.set(n,r)),r===st}function ut(e,t,n=!0){dt(e)===0?(n?Reflect.ownKeys(e):Ze.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function dt(e){let t=e[Ye];return t?t.type_:gt(e)?1:_t(e)?2:vt(e)?3:0}var ft=(e,t,n=dt(e))=>n===2?e.has(t):Ze[et].hasOwnProperty.call(e,t),pt=(e,t,n=dt(e))=>n===2?e.get(t):e[t],mt=(e,t,n,r=dt(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function ht(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var gt=Array.isArray,_t=e=>e instanceof Map,vt=e=>e instanceof Set,yt=e=>typeof e==`object`,bt=e=>typeof e==`function`,xt=e=>typeof e==`boolean`;function St(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Ct=e=>yt(e)?e?.[Ye]:null,wt=e=>e.copy_||e.base_,Tt=e=>e.modified_?e.copy_:e.base_;function Et(e,t){if(_t(e))return new Map(e);if(vt(e))return new Set(e);if(gt(e))return Array[et].slice.call(e);let n=lt(e);if(t===!0||t===`class_only`&&!n){let t=Ze.getOwnPropertyDescriptors(e);delete t[Ye];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[rt]===!1&&(a[rt]=!0,a[tt]=!0),(a.get||a.set)&&(t[i]={[tt]:!0,[rt]:!0,[nt]:a[nt],[it]:e[i]})}return Ze.create(Qe(e),t)}{let t=Qe(e);if(t!==null&&n)return{...e};let r=Ze.create(t);return Ze.assign(r,e)}}function Dt(e,t=!1){return At(e)||at(e)||!ot(e)||(dt(e)>1&&Ze.defineProperties(e,{set:kt,add:kt,clear:kt,delete:kt}),Ze.freeze(e),t&&ut(e,(e,t)=>{Dt(t,!0)},!1)),e}function Ot(){Xe(2)}var kt={[it]:Ot};function At(e){return e===null||!yt(e)||Ze.isFrozen(e)}var jt=`MapSet`,Mt=`Patches`,Nt=`ArrayMethods`,Pt={};function Ft(e){let t=Pt[e];return t||Xe(0,e),t}var It=e=>!!Pt[e];function Lt(e,t){Pt[e]||(Pt[e]=t)}var Rt,zt=()=>Rt,Bt=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:It(jt)?Ft(jt):void 0,arrayMethodsPlugin_:It(Nt)?Ft(Nt):void 0});function Vt(e,t){t&&(e.patchPlugin_=Ft(Mt),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ht(e){Ut(e),e.drafts_.forEach(Gt),e.drafts_=null}function Ut(e){e===Rt&&(Rt=e.parent_)}var Wt=e=>Rt=Bt(Rt,e);function Gt(e){let t=e[Ye];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Kt(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[Ye].modified_&&(Ht(t),Xe(4)),ot(e)&&(e=qt(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Ye].base_,e,t)}else e=qt(t,n);return Jt(t,e,!0),Ht(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===qe?void 0:e}function qt(e,t){if(At(t))return t;let n=t[Ye];if(!n)return nn(t,e.handledSet_,e);if(!Xt(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);en(n,e)}return n.copy_}function Jt(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Dt(t,n)}function Yt(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Xt=(e,t)=>e.scope_===t,Zt=[];function Qt(e,t,n,r){let i=wt(e),a=e.type_;if(r!==void 0&&pt(i,r,a)===t){mt(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;ut(i,(e,n)=>{if(at(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Zt;for(let e of o)mt(i,e,n,a)}function $t(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!Xt(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Tt(i);Qt(e,i.draft_??i,a,n),en(i,r)})}function en(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Yt(e)}}function tn(e,t,n){let{scope_:r}=e;if(at(n)){let i=n[Ye];Xt(i,r)&&i.callbacks_.push(function(){fn(e),Qt(e,n,Tt(i),t)})}else ot(n)&&e.callbacks_.push(function(){let i=wt(e);e.type_===3?i.has(n)&&nn(n,r.handledSet_,r):pt(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&nn(pt(e.copy_,t,e.type_),r.handledSet_,r)})}function nn(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||at(e)||t.has(e)||!ot(e)||At(e)||(t.add(e),ut(e,(r,i)=>{if(at(i)){let t=i[Ye];Xt(t,n)&&(mt(e,r,Tt(t),e.type_),Yt(t))}else ot(i)&&nn(i,t,n)})),e}function rn(e,t){let n=gt(e),r={type_:+!!n,scope_:t?t.scope_:zt(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=an;n&&(i=[r],a=on);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var an={get(e,t){if(t===Ye)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=wt(e);if(!ft(i,t,e.type_))return ln(e,i,t);let a=i[t];if(e.finalized_||!ot(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&St(t))return a;if(a===sn(e.base_,t)||cn(e,t,a)){fn(e);let n=e.type_===1?+t:t,r=mn(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in wt(e)},ownKeys(e){return Reflect.ownKeys(wt(e))},set(e,t,n){let r=un(wt(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=sn(wt(e),t),i=r?.[Ye];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(ht(n,r)&&(n!==void 0||ft(e.base_,t,e.type_)))return!0;fn(e),dn(e)}return e.copy_[t]===n&&(n!==void 0||ft(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),tn(e,t,n)),!0},deleteProperty(e,t){return fn(e),sn(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),dn(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=wt(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[rt]:!0,[tt]:e.type_!==1||t!==`length`,[nt]:r[nt],[it]:n[t]}},defineProperty(){Xe(11)},getPrototypeOf(e){return Qe(e.base_)},setPrototypeOf(){Xe(12)}},on={};for(let e in an){let t=an[e];on[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}on.deleteProperty=function(e,t){return on.set.call(this,e,t,void 0)},on.set=function(e,t,n){return an.set.call(this,e[0],t,n,e[0])};function sn(e,t){let n=e[Ye];return(n?wt(n):e)[t]}function cn(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!ot(n)||n[Ye]?!1:e.baseRefs_.has(n)}function ln(e,t,n){let r=un(t,n);return r?it in r?r[it]:r.get?.call(e.draft_):void 0}function un(e,t){if(!(t in e))return;let n=Qe(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Qe(n)}}function dn(e){e.modified_||(e.modified_=!0,e.parent_&&dn(e.parent_))}function fn(e){e.copy_||=(e.assigned_=new Map,Et(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pn=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(bt(e)&&!bt(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}bt(t)||Xe(6),n!==void 0&&!bt(n)&&Xe(7);let r;if(ot(e)){let i=Wt(this),a=mn(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Ht(i):Ut(i)}return Vt(i,n),Kt(r,i)}if(!e||!yt(e)){if(r=t(e),r===void 0&&(r=e),r===qe&&(r=void 0),this.autoFreeze_&&Dt(r,!0),n){let t=[],i=[];Ft(Mt).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Xe(1,e)},this.produceWithPatches=(e,t)=>{if(bt(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},xt(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),xt(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),xt(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ot(e)||Xe(8),at(e)&&(e=hn(e));let t=Wt(this),n=mn(t,e,void 0);return n[Ye].isManual_=!0,Ut(t),n}finishDraft(e,t){let n=e&&e[Ye];n&&n.isManual_||Xe(9);let{scope_:r}=n;return Vt(r,t),Kt(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Ft(Mt).applyPatches_;return at(e)?r(e,t):this.produce(e,e=>r(e,t))}};function mn(e,t,n,r){let[i,a]=_t(t)?Ft(jt).proxyMap_(t,n):vt(t)?Ft(jt).proxySet_(t,n):rn(t,n);return(n?.scope_??zt()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?$t(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function hn(e){return at(e)||Xe(10,e),gn(e)}function gn(e){if(!ot(e)||At(e))return e;let t=e[Ye],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Et(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Et(e,!0);let i=n;return vt(n)&&(n=new Set),ut(i,(e,t)=>{mt(n,e,gn(t))},r),t&&(t.finalized_=!1),n}function _n(){function e(n,r=[]){if(n.key_!==void 0){let e=n.parent_.copy_??n.parent_.base_,t=Ct(pt(e,n.key_)),i=pt(e,n.key_);if(i===void 0||i!==n.draft_&&i!==n.copy_||t!=null&&t.base_!==n.base_)return null;let a=n.parent_.type_===3,o;if(a){let e=n.parent_;o=Array.from(e.drafts_.keys()).indexOf(n.key_)}else o=n.key_;if(!(a&&e.size>o||ft(e,o))||n.parent_.type_===1&&n.parent_.allIndicesReassigned_)return null;r.push(o)}if(n.parent_)return e(n.parent_,r);r.reverse();try{t(n.copy_,r)}catch{return null}return r}function t(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(n=pt(n,r),!yt(n)||n===null)throw Error(`Cannot resolve path at '${t.join(`/`)}'`)}return n}let n=`replace`,r=`remove`;function i(e,t,n){if(e.scope_.processedForPatches_.has(e))return;e.scope_.processedForPatches_.add(e);let{patches_:r,inversePatches_:i}=n;switch(e.type_){case 0:case 2:return o(e,t,r,i);case 1:return a(e,t,r,i);case 3:return s(e,t,r,i)}}function a(e,t,i,a){let{base_:o,assigned_:s}=e,c=e.copy_;c.length<o.length&&([o,c]=[c,o],[i,a]=[a,i]);let l=e.allIndicesReassigned_===!0;for(let e=0;e<o.length;e++){let r=c[e],u=o[e];if((l||s?.get(e.toString()))&&r!==u){let o=r?.[Ye];if(o&&o.modified_)continue;let s=t.concat([e]);i.push({op:n,path:s,value:d(r)}),a.push({op:n,path:s,value:d(u)})}}for(let e=o.length;e<c.length;e++){let n=t.concat([e]);i.push({op:`add`,path:n,value:d(c[e])})}for(let e=c.length-1;o.length<=e;--e){let n=t.concat([e]);a.push({op:r,path:n})}}function o(e,t,i,a){let{base_:o,copy_:s,type_:c}=e;ut(e.assigned_,(e,l)=>{let u=pt(o,e,c),f=pt(s,e,c),p=l?ft(o,e)?n:`add`:r;if(u===f&&p===n)return;let m=t.concat(e);i.push(p===r?{op:p,path:m}:{op:p,path:m,value:d(f)}),a.push(p===`add`?{op:r,path:m}:p===r?{op:`add`,path:m,value:d(u)}:{op:n,path:m,value:d(u)})})}function s(e,t,n,i){let{base_:a,copy_:o}=e,s=0;a.forEach(e=>{if(!o.has(e)){let a=t.concat([s]);n.push({op:r,path:a,value:e}),i.unshift({op:`add`,path:a,value:e})}s++}),s=0,o.forEach(e=>{if(!a.has(e)){let a=t.concat([s]);n.push({op:`add`,path:a,value:e}),i.unshift({op:r,path:a,value:e})}s++})}function c(e,t,r){let{patches_:i,inversePatches_:a}=r;i.push({op:n,path:[],value:t===qe?void 0:t}),a.push({op:n,path:[],value:e})}function l(e,t){return t.forEach(t=>{let{path:i,op:a}=t,o=e;for(let e=0;e<i.length-1;e++){let t=dt(o),n=i[e];typeof n!=`string`&&typeof n!=`number`&&(n=``+n),t!==0&&t!==1||n!==`__proto__`&&n!==$e||Xe(19),bt(o)&&n===et&&Xe(19),o=pt(o,n),o!==null&&yt(o)||Xe(18,i.join(`/`))}let s=dt(o),c=u(t.value),l=i[i.length-1];switch(a){case n:switch(s){case 2:return o.set(l,c);case 3:Xe(16);default:return o[l]=c}case`add`:switch(s){case 1:return l===`-`?o.push(c):o.splice(l,0,c);case 2:return o.set(l,c);case 3:return o.add(c);default:return o[l]=c}case r:switch(s){case 1:return o.splice(l,1);case 2:return o.delete(l);case 3:return o.delete(t.value);default:return delete o[l]}default:Xe(17,a)}}),e}function u(e){if(!ot(e))return e;if(gt(e))return e.map(u);if(_t(e))return new Map(Array.from(e.entries()).map(([e,t])=>[e,u(t)]));if(vt(e))return new Set(Array.from(e).map(u));let t=Object.create(Qe(e));for(let n in e)t[n]=u(e[n]);return ft(e,Je)&&(t[Je]=e[Je]),t}function d(e){return at(e)?u(e):e}Lt(Mt,{applyPatches_:l,generatePatches_:i,generateReplacementPatches_:c,getPath:e})}globalThis.Iterator?.from;var vn=new pn,yn=vn.produce,bn=vn.produceWithPatches.bind(vn),xn=vn.applyPatches.bind(vn),Sn=1e3;function Cn(e,t){if(e.add(t),e.size>Sn){let t=e.values().next().value;t!==void 0&&e.delete(t)}}function wn(e){let{enablePatches:t=!1}=e;t&&_n();let n=be(),r=e.initialValue,i=new Set;return{on:n.on,value:()=>r,patch:(e,t=Ke())=>{i.has(t)||(_n(),r=xn(r,e),Cn(i,t),n.emit(`updated`,r,void 0,t))},mutate:(e,a=Ke())=>{if(!i.has(a)){if(Cn(i,a),t){let[t,i]=bn(r,e);if(t===r)return;r=t,n.emit(`updated`,r,i,a)}else{let t=yn(r,e);if(t===r)return;r=t,n.emit(`updated`,r,void 0,a)}}},syncIds:i}}function Tn(t){let n=new Map,r=new Map,i=new Map,a=new Set,o=t.connectionMeta.backend===`static`;function s(e,t){let n=i.get(e);return n&&typeof n==`object`&&!Array.isArray(n)&&typeof t==`object`&&!Array.isArray(t)?{...n,...t}:t}t.client.register({name:e.broadcast.clientStateUpdated,type:`event`,handler:(e,t,r)=>{let i=n.get(e);i&&!i.syncIds.has(r)&&i.mutate(()=>s(e,t),r)}}),t.client.register({name:e.broadcast.clientStatePatch,type:`event`,handler:(e,t,r)=>{let i=n.get(e);i&&!i.syncIds.has(r)&&i.patch(t,r)}});function c(e,n,r){let i=[];return i.push(n.on(`updated`,(n,i,a)=>{o||a===r||(i?t.callEvent(`devframe:rpc:server-state:patch`,e,i,a):t.callEvent(`devframe:rpc:server-state:set`,e,n,a))})),()=>{for(let e of i)e()}}return{keys:()=>Array.from(n.keys()),onKeyAdded(e){return a.add(e),()=>{a.delete(e)}},delete(e){let t=r.get(e);r.delete(e);let a=n.delete(e);return i.delete(e),t?.(),a},get:async(l,u)=>{if(u?.initialValue!==void 0&&i.set(l,u.initialValue),n.has(l))return n.get(l);let d=wn({initialValue:u?.initialValue,enablePatches:!1});async function f(){if(o||t.callEvent(`devframe:rpc:server-state:subscribe`,l),u?.initialValue!==void 0){n.set(l,d);for(let e of a)e(l);let e=!1,i=d.on(`updated`,()=>{e=!0}),o=Ke();return t.call(`devframe:rpc:server-state:get`,l).then(t=>{t!==void 0&&n.get(l)===d&&!e&&d.mutate(()=>s(l,t),o)}).catch(e=>{console.error(`Error getting server state`,e)}).finally(i),r.set(l,c(l,d,o)),d}{let e=await t.call(`devframe:rpc:server-state:get`,l);d.mutate(()=>s(l,e)),n.set(l,d);for(let e of a)e(l);return r.set(l,c(l,d)),d}}return new Promise((n,r)=>{if(t.isTrusted)f().then(n,r);else{n(d);let r=!1;t.events.on(e.client.isTrustedUpdated,e=>{e&&!r&&(r=!0,f())})}})}}}var En=typeof self==`object`?self:globalThis,Dn=new Set([`Error`,`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`,`AggregateError`]),On=new Set([`Boolean`,`Number`,`String`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float16Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`]);function kn(e,t){let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o,r=Dn.has(e)?En[e]:void 0;return n(new(r??En.Error)(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}if(typeof a==`string`&&On.has(a))return n(new En[a](o),i);throw TypeError(`unable to deserialize unsafe or unknown type: ${String(a)}`)};return r}function An(e){return kn(new Map,e)(0)}var jn=``,{toString:Mn}={},{keys:Nn}=Object;function Pn(e){let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Mn.call(e).slice(8,-1);switch(n){case`Array`:return[1,jn];case`Object`:return[2,jn];case`Date`:return[3,jn];case`RegExp`:return[4,jn];case`Map`:return[5,jn];case`Set`:return[6,jn];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]}function Fn([e,t]){return e===0&&(t===`function`||t===`symbol`)}function In(e,t,n,r){let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Pn(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize ${s}`);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Nn(r))(e||!Fn(Pn(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Fn(Pn(n))||Fn(Pn(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Fn(Pn(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a}function Ln(e,t={}){let n=[];return In(!(t.json||t.lossy),!!t.json,new Map,n)(e),n}var{parse:Rn,stringify:zn}=JSON,Bn={json:!0,lossy:!0};function Vn(e){return An(Rn(e))}function Hn(e){return zn(Ln(e,Bn))}function Un(e){return An(e)}function Wn(e){return Hn(e)}function Gn(e){return Vn(e)}var Kn=new Map;function qn(e=Kn){let t=new Map;return{serialize:n=>{let r;return n.t===`q`?r=n.m:(r=t.get(n.i),t.delete(n.i)),!(n.t===`s`&&`e`in n)&&r&&e.get(r)?.jsonSerializable===!0?ge(n,r??``):`s:${Wn(n)}`},deserialize:e=>{let n=e.startsWith(`s:`)?Gn(e.slice(2)):JSON.parse(e);return n.t===`q`&&n.i&&n.m&&t.set(n.i,n.m),n}}}function Jn(){}function Yn(e){let t=e.search(/\n\n|\r\n\r\n/);if(!(t<0))return{frame:e.slice(0,t),rest:e.slice(t+(e[t]===`\r`?4:2))}}function Xn(e){let t=`message`,n=[];for(let r of e.split(/\r?\n/))r.startsWith(`:`)||(r.startsWith(`event:`)?t=r.slice(6).trimStart():r.startsWith(`data:`)&&n.push(r.slice(5).replace(/^ /,``)));return{event:t,data:n}}function Zn(e){let{onConnected:t=Jn,onError:n=Jn,onDisconnected:i=Jn,definitions:a,fetch:o=globalThis.fetch.bind(globalThis)}=e,c=e.url;e.authToken&&(c=`${c}${c.includes(`?`)?`&`:`?`}${s}=${encodeURIComponent(e.authToken)}`);let l=qn(a),u=new AbortController,d=!1,f,p,m,h,g=new Promise((e,t)=>{m=e,h=t});g.catch(()=>{});function _(e){d||(d=!0,h(e),n(e),i())}function v(){d||(d=!0,h(Error(`Devframe SSE stream closed`)),i())}function y(e,n){e===`session`?(m(n),t()):f?.(n)}async function b(e){let t=e.getReader();p=t;let n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;for(r+=n.decode(i,{stream:!0});;){let e=Yn(r);if(!e)break;r=e.rest;let{event:t,data:n}=Xn(e.frame);n.length>0&&y(t,n.join(`
|
|
3
|
-
`))}}v()}return(async()=>{try{let e=await o(c,{headers:{accept:`text/event-stream`},signal:u.signal});if(!e.ok||!e.body)throw Error(`Devframe SSE stream request failed: ${e.status}`);await b(e.body)}catch(e){if(u.signal.aborted){v();return}_(e instanceof Error?e:Error(String(e)))}})(),{close:()=>{d=!0,u.abort(),p?.cancel().catch(()=>{})},on:e=>{f=e},post:async e=>{let t;try{t=await g}catch{return}if(d)n(Error(`Devframe SSE channel is closed; message dropped`));else try{let n=await o(c,{method:`POST`,headers:{"content-type":`text/plain; charset=utf-8`,[r]:t},body:e});if(n.status===200){let e=await n.text();e&&f?.(e);return}if(!n.ok)throw Error(`Devframe SSE POST failed: ${n.status}`)}catch(e){n(e instanceof Error?e:Error(String(e)))}},serialize:l.serialize,deserialize:l.deserialize}}function Qn(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var $n=Math.random.bind(Math),er=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function tr(e=21){let t=``,n=e;for(;n--;)t+=er[$n()*64|0];return t}var nr=6e4,rr=e=>e,ir=rr,{clearTimeout:ar,setTimeout:or}=globalThis;function sr(e,t){let{post:n,on:r,off:i=()=>{},eventNames:a=[],serialize:o=rr,deserialize:s=ir,resolver:c,bind:l=`rpc`,timeout:u=nr,proxify:d=!0}=t,f=!1,p=new Map,m,h;async function g(e,r,i,a){if(f)throw Error(`[birpc] rpc is closed, cannot call "${e}"`);let s={m:e,a:r,t:`q`};a&&(s.o=!0);let c=async e=>n(o(e));if(i){await c(s);return}if(m)try{await m}finally{m=void 0}let{promise:l,resolve:d,reject:g}=Qn(),_=tr();s.i=_;let v;async function y(n=s){return u>=0&&(v=or(()=>{try{if(t.onTimeoutError?.call(h,e,r)!==!0)throw Error(`[birpc] timeout on calling "${e}"`)}catch(e){g(e)}p.delete(_)},u),typeof v==`object`&&(v=v.unref?.())),p.set(_,{resolve:d,reject:g,timeoutId:v,method:e}),await c(n),l}try{t.onRequest?await t.onRequest.call(h,s,y,d):await y()}catch(e){if(t.onGeneralError?.call(h,e)!==!0)throw e;return}finally{ar(v),p.delete(_)}return l}let _={$call:(e,...t)=>g(e,t,!1),$callOptional:(e,...t)=>g(e,t,!1,!0),$callEvent:(e,...t)=>g(e,t,!0),$callRaw:e=>g(e.method,e.args,e.event,e.optional),$rejectPendingCalls:y,get $closed(){return f},get $meta(){return t.meta},$close:v,$functions:e};h=d?new Proxy({},{get(t,n){if(Object.hasOwn(_,n))return _[n];if(n===`then`&&!a.includes(`then`)&&!(`then`in e))return;let r=(...e)=>g(n,e,!0);if(a.includes(n))return r.asEvent=r,r;let i=(...e)=>g(n,e,!1);return i.asEvent=r,i}}):_;function v(e){f=!0,p.forEach(({reject:t,method:n})=>{let r=Error(`[birpc] rpc is closed, cannot call "${n}"`);if(e)return e.cause??=r,t(e);t(r)}),p.clear(),i(b)}function y(e){let t=Array.from(p.values()).map(({method:t,reject:n})=>e?e({method:t,reject:n}):n(Error(`[birpc]: rejected pending call "${t}".`)));return p.clear(),t}async function b(r,...i){let a;try{a=s(r)}catch(e){if(t.onGeneralError?.call(h,e)!==!0)throw e;return}if(a.t===`q`){let{m:r,a:s,o:u}=a,d,f,p=await(c?c.call(h,r,e[r]):e[r]);if(u&&(p||=()=>void 0),!p)f=Error(`[birpc] function "${r}" not found`);else try{d=await p.apply(l===`rpc`?h:e,s)}catch(e){f=e}if(a.i){if(f&&t.onFunctionError&&t.onFunctionError.call(h,f,r,s)===!0)return;if(!f)try{await n(o({t:`s`,i:a.i,r:d}),...i);return}catch(e){if(f=e,t.onGeneralError?.call(h,e,r,s)!==!0)throw e}try{await n(o({t:`s`,i:a.i,e:f}),...i)}catch(e){if(t.onGeneralError?.call(h,e,r,s)!==!0)throw e}}}else{let{i:e,r:t,e:n}=a,r=p.get(e);r&&(ar(r.timeoutId),n?r.reject(n):r.resolve(t)),p.delete(e)}}return m=r(b),h}function cr(e,t){let{channel:n,rpcOptions:r={}}=t;return sr(e,{...n,timeout:-1,...r,proxify:!1})}function lr(t){let{transport:n,authToken:r,connectionMeta:i,events:a,clientRpc:o,rpcOptions:s={},callTimeout:c=0}=t,l=!1,u=`connecting`,d=null,f=Promise.withResolvers();function p(t,n=null){if(n?d=n:t===`connected`&&(d=null),t===u)return;let r=u;u=t,a.emit(e.client.connectionStatus,t,r)}let m=new Set;function h(e){for(let t of[...m])t.reject(e)}function g(){return u===`disconnected`||u===`error`?new ze(`connection`,`[devframe] Not connected to the devframe server`,{cause:d??void 0}):u===`unauthorized`?new ze(`auth`,`[devframe] Not authorized by the devframe server`,{cause:d??void 0}):null}function _(t,n){return new Promise((r,i)=>{let o=!1,s,l={reject(t){o||(u(),a.emit(e.client.error,t,n),i(t))}};function u(){o=!0,m.delete(l),s&&clearTimeout(s)}m.add(l),c>0&&(s=setTimeout(()=>{l.reject(new ze(`timeout`,`[devframe] RPC call "${n}" timed out after ${c}ms`))},c)),t.then(e=>{o||(u(),r(e))},t=>{if(o)return;u();let r=t instanceof Error?t:Error(String(t));a.emit(e.client.error,r,n),i(r)})})}let v=new Map;for(let e of i.jsonSerializableMethods??[])v.set(e,{jsonSerializable:!0});let y=t.createChannel({definitions:v,onError(t){p(`error`,t),a.emit(e.client.connectionError,t),h(new ze(`connection`,`[devframe] Connection to the devframe server failed`,{cause:t}))},onDisconnected(){u!==`error`&&p(`disconnected`),h(new ze(`connection`,`[devframe] Disconnected from the devframe server`,{cause:d??void 0}))}}),b=cr(o.functions,{channel:y,rpcOptions:s});o.register({name:e.broadcast.authRevoked,type:`event`,handler:()=>{l=!1;let t=new ze(`auth`,`[devframe] The devframe server revoked this client's trust`);p(`unauthorized`,t),a.emit(e.client.connectionError,t),h(t),a.emit(e.client.isTrustedUpdated,!1)}});let ee=r;async function x(t){ee=t;let n=await b.$call(`anonymous:devframe:auth`,{authToken:t,ua:navigator.userAgent,origin:location.origin});if(l=n.isTrusted,l)f.resolve(!0),p(`connected`);else{let t=new ze(`auth`,`[devframe] The devframe server refused this client's credentials`);p(`unauthorized`,t),a.emit(e.client.connectionError,t)}return a.emit(e.client.isTrustedUpdated,l),n.isTrusted}async function S(t){let n=(await b.$call(`anonymous:devframe:auth:exchange`,{code:t,ua:navigator.userAgent,origin:location.origin}))?.authToken??null;return n&&(ee=n,l=!0,f.resolve(!0),p(`connected`),a.emit(e.client.isTrustedUpdated,!0)),n}async function te(e={}){await b.$call(`anonymous:devframe:auth:request-code`,{ua:navigator.userAgent,origin:location.origin,...e.reissue?{reissue:!0}:{}})}async function C(){return l?!0:x(ee??``)}async function ne(e=6e4){if(l&&f.resolve(!0),e<=0)return f.promise;let t;try{return await Promise.race([f.promise,new Promise((n,r)=>{t=setTimeout(()=>{r(Error(`[devframe] Timeout waiting for rpc to be trusted`))},e)})]),l}finally{clearTimeout(t)}}return{transport:n,get isTrusted(){return l},get status(){return u},get connectionError(){return d},requestTrust:C,requestTrustWithToken:x,requestTrustWithCode:S,requestAuthCode:te,ensureTrusted:ne,call:(...t)=>{let n=String(t[0]),r=g();return r?(a.emit(e.client.error,r,n),Promise.reject(r)):_(b.$call(...t),n)},callEvent:(...t)=>{let n=g();if(n)a.emit(e.client.error,n,String(t[0]));else return b.$callEvent(...t)},callOptional:(...t)=>{let n=String(t[0]),r=g();return r?(a.emit(e.client.error,r,n),Promise.reject(r)):_(b.$callOptional(...t),n)},close:()=>{y.close()}}}function ur(e,t,n){let r=(()=>{try{return new URL(t,n.href)}catch{return new URL(n.href)}})();if(e&&typeof e==`object`){if(e.host!=null||e.port!=null){let t=e.host??`${r.hostname}:${e.port}`;return new URL(e.path??`/`,`${r.protocol}//${t}`).href}return new URL(e.path??``,r).href}let i=e??``;return/^https?:\/\//i.test(i)?i:new URL(i,r).href}function dr(e){let{authToken:t,connectionMeta:n,metaBaseUrl:r,events:i,clientRpc:a,rpcOptions:o={},sseOptions:s={},callTimeout:c=0}=e,l=ur(n.sse,r??`./`,location);return lr({transport:`sse`,authToken:t,connectionMeta:n,events:i,clientRpc:a,rpcOptions:o,callTimeout:c,createChannel:e=>Zn({url:l,authToken:t,definitions:e.definitions,...s,onConnected(){s.onConnected?.()},onError(t){e.onError(t),s.onError?.(t)},onDisconnected(){e.onDisconnected(),s.onDisconnected?.()}})})}function fr(e){let{name:t,message:n,cause:r,...i}=e,a=r instanceof Error?r:pr(r)?fr(r):r,o=a===void 0?Error(n):Error(n,{cause:a});return o.name=t,Object.assign(o,i),o}function pr(e){return typeof e==`object`&&!!e&&typeof e.message==`string`&&typeof e.name==`string`}function mr(e){return typeof e==`object`&&!!e&&e.type===`static`&&typeof e.path==`string`}function hr(e){return typeof e==`object`&&!!e&&e.type===`query`&&typeof e.records==`object`&&e.records!==null}function gr(e){return typeof e==`object`&&!!e&&(`output`in e||`error`in e)}function _r(e){if(e.error)throw fr(e.error);return e.output}function vr(e){return e.some(e=>e!=null)}function yr(e){return typeof e==`object`&&e&&`serialization`in e&&`data`in e?e.data:e}function br(e,t){let n=new Map,r=new Map;function i(e,t){return t===`structured-clone`&&Array.isArray(e)?Un(e):e}function a(e,t){return i(yr(e),t)}async function o(e){n.has(e.path)||n.set(e.path,t(e.path).then(t=>a(t,e.serialization)));let r=await n.get(e.path);return gr(r)?_r(r):r}async function s(e,n){return r.has(e)||r.set(e,t(e).then(e=>a(e,n))),await r.get(e)}async function c(t,n){if(!(t in e))throw Error(`[devframe-rpc] Function "${t}" not found in dump store`);let r=e[t];if(mr(r)){if(vr(n))throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);return await o(r)}if(hr(r)){let e=ee(n),i=r.records[e];if(i)return _r(await s(i,r.serialization));if(r.fallback)return _r(await s(r.fallback,r.serialization));throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}if(!vr(n))return r;throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}return{call:async(e,t)=>await c(e,t),callOptional:async(t,n)=>{if(t in e)return await c(t,n)},callEvent:async(e,t)=>{}}}async function xr(e){let t=br(await e.fetchJsonFromBases(i),e.fetchJsonFromBases);return{transport:`static`,isTrusted:!0,status:`connected`,connectionError:null,requestTrust:async()=>!0,requestTrustWithToken:async()=>!0,requestTrustWithCode:async()=>null,requestAuthCode:async()=>{},ensureTrusted:async()=>!0,call:(...e)=>t.call(e[0],e.slice(1)),callEvent:(...e)=>t.callEvent(e[0],e.slice(1)),callOptional:(...e)=>t.callOptional(e[0],e.slice(1)),close:()=>{}}}var Sr=256,Cr=class extends Error{name=`StreamClosedError`};function wr(e={}){let t=e.id??Ke(),n=Math.max(0,e.replayWindow??0),r=be(),i=new AbortController,a=[],o=!1,s=0;function c(e){if(o)throw new Cr(`Cannot write to a closed stream "${t}"`);s+=1,n>0&&(a.push({seq:s,chunk:e}),a.length>n&&(a.length-n===1?a.shift():a.splice(0,a.length-n))),r.emit(`chunk`,s,e)}function l(e){if(o)return;o=!0;let t=Er(e);i.abort(e),r.emit(`end`,t)}function u(){o||(o=!0,i.signal.aborted||i.abort(`stream closed`),r.emit(`end`,void 0))}function d(e){o||i.signal.aborted||i.abort(e??`aborted`)}let f=new WritableStream({write(e){c(e)},close(){u()},abort(e){l(e)}});return{id:t,signal:i.signal,get closed(){return o},get lastSeq(){return s},write:c,error:l,close:u,abort:d,writable:f,events:r,buffer:a}}function Tr(e={}){let t=e.id??Ke(),n=Math.max(1,e.highWaterMark??Sr),r=[],i=0,a=!1,o=!1,s,c,l,u;function d(){if(c){if(r.length>0){let e=r.shift(),t=c;c=void 0,t.resolve({value:e,done:!1})}else if(a){let e=c;if(c=void 0,s){let t=Error(s.message);t.name=s.name,e.reject(t)}else e.resolve({value:void 0,done:!0})}}}function f(){if(l){for(;r.length>0;){let e=r.shift();try{l.enqueue(e)}catch{break}}if(a&&l){try{if(s){let e=Error(s.message);e.name=s.name,l.error(e)}else l.close()}catch{}l=void 0}}}function p(t,s){if(!(a||o)&&!(t<=i)){if(i=t,r.push(s),r.length>n){let t=r.length-n;r.splice(0,t),e.onOverflow?.(t)}d(),u&&f()}}function m(e){a||(a=!0,s=e,d(),u&&f())}function h(){o||a||(o=!0,e.onCancel?.(),m(void 0))}function g(){return u||(u=new ReadableStream({start(e){l=e,f()},cancel(){h()}}),u)}return{id:t,get cancelled(){return o},get done(){return a},get lastSeenSeq(){return i},get readable(){return g()},cancel:h,_push:p,_end:m,[Symbol.asyncIterator](){return{next(){if(r.length>0)return Promise.resolve({value:r.shift(),done:!1});if(a){if(s){let e=Error(s.message);return e.name=s.name,Promise.reject(e)}return Promise.resolve({value:void 0,done:!0})}return new Promise((e,t)=>{c={resolve:e,reject:t}})},return(){return h(),Promise.resolve({value:void 0,done:!0})}}}}}function Er(e){if(e instanceof Error)return{name:e.name||`Error`,message:e.message};if(typeof e==`string`)return{name:`Error`,message:e};try{return{name:`Error`,message:JSON.stringify(e)}}catch{return{name:`Error`,message:String(e)}}}var Dr=``;function Or(e,t){return`${e}${Dr}${t}`}function kr(t){let n=new Map,r=new Map;t.client.register({name:e.broadcast.streamingChunk,type:`event`,handler(e,t,r,i){n.get(Or(e,t))?._push(r,i)}}),t.client.register({name:e.broadcast.streamingEnd,type:`event`,handler(e,t,r){let i=Or(e,t),a=n.get(i);a&&(a._end(r),n.delete(i))}}),t.client.register({name:e.broadcast.streamingUploadCancel,type:`event`,handler(e,t){let n=Or(e,t),i=r.get(n);i&&(i.abort(`server cancelled upload`),r.delete(n))}}),t.events.on(e.client.isTrustedUpdated,e=>{if(e)for(let[e,r]of n){if(r.cancelled||r.done)continue;let n=e.indexOf(Dr);if(n<0)continue;let i=e.slice(0,n),a=e.slice(n+1);t.callEvent(`devframe:streaming:subscribe`,i,a,{afterSeq:r.lastSeenSeq})}});function i(r,i,a={}){let o=Or(r,i),s=n.get(o);if(s)return s;let c=Tr({id:i,highWaterMark:a.highWaterMark,onOverflow(e){console.warn(`[devframe] DF0029: Stream "${r}#${i}" dropped ${e} chunk(s) after exceeding the client high-water mark.`)},onCancel(){t.callEvent(`devframe:streaming:cancel`,r,i),n.delete(o)}});if(n.set(o,c),t.isTrusted)t.callEvent(`devframe:streaming:subscribe`,r,i,{afterSeq:0});else{let a=t.events.on(e.client.isTrustedUpdated,e=>{e&&(a(),n.has(o)&&!c.cancelled&&!c.done&&t.callEvent(`devframe:streaming:subscribe`,r,i,{afterSeq:c.lastSeenSeq}))})}return c}function a(e,n){let i=Or(e,n),a=r.get(i);if(a)return a;let o=wr({id:n});return o.events.on(`chunk`,(r,i)=>{t.callEvent(`devframe:streaming:upload-chunk`,e,n,r,i)}),o.events.on(`end`,a=>{t.callEvent(`devframe:streaming:upload-end`,e,n,a),r.delete(i)}),r.set(i,o),o}return{subscribe:i,upload:a}}function Ar(){}var jr=new Map;function Mr(e){let t=e.url;e.authToken&&(t=`${t}?${s}=${encodeURIComponent(e.authToken)}`);let n=new WebSocket(t),{onConnected:r=Ar,onError:i=Ar,onDisconnected:a=Ar,definitions:o=jr}=e;n.addEventListener(`open`,e=>{r(e)}),n.addEventListener(`error`,e=>{let t=e instanceof Error?e:Error(e.type);i(t)}),n.addEventListener(`close`,e=>{a(e)});let c=qn(o);return{close:()=>{n.close()},on:e=>{n.addEventListener(`message`,t=>{e(t.data)})},post:e=>{if(n.readyState===WebSocket.OPEN)n.send(e);else if(n.readyState===WebSocket.CONNECTING){let t=()=>{i(),n.readyState===WebSocket.OPEN&&n.send(e)},r=()=>i();function i(){n.removeEventListener(`open`,t),n.removeEventListener(`close`,r)}n.addEventListener(`open`,t),n.addEventListener(`close`,r)}else i(Error(`Devframe WebSocket is not open; message dropped`))},serialize:c.serialize,deserialize:c.deserialize}}function Nr(e,t,n){let r=(()=>{try{return new URL(t,n.href)}catch{return new URL(n.href)}})(),i=r.protocol===`https:`?`wss:`:`ws:`;if(e&&typeof e==`object`){if(e.host!=null||e.port!=null){let t=e.host??`${r.hostname}:${e.port}`,n=new URL(e.path??`/`,`${i}//${t}`);return n.protocol=i,n.href}let t=new URL(e.path??``,r);return t.protocol=i,t.href}if(typeof e==`number`)return`${i}//${r.hostname}:${e}`;let a=e??``;if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a))return Ee(a,/^https/i.test(a)?`wss://`:`ws://`);let o=new URL(a,r);return o.protocol=i,o.href}function Pr(e){let{authToken:t,connectionMeta:n,metaBaseUrl:r,events:i,clientRpc:a,rpcOptions:o={},wsOptions:s={},callTimeout:c=0}=e,l=Nr(n.websocket,r??`./`,location);return lr({transport:`websocket`,authToken:t,connectionMeta:n,events:i,clientRpc:a,rpcOptions:o,callTimeout:c,createChannel:e=>Mr({url:l,authToken:t,definitions:e.definitions,...s,onConnected(e){s.onConnected?.(e)},onError(t){e.onError(t),s.onError?.(t)},onDisconnected(t){e.onDisconnected(),s.onDisconnected?.(t)}})})}function Fr(e){return e.includes(`:`)}function Ir(e,t){return Fr(t)?t:`${e}:${t}`}function Lr(e){return{async get(t){return(await e()).value()?.[t]},async set(t,n){(await e()).mutate(e=>{if(e===void 0)return{[t]:n};e[t]=n})},async delete(t){(await e()).mutate(e=>{e!==void 0&&delete e[t]})},async all(){return(await e()).value()??{}},async onChange(t){return(await e()).on(`updated`,e=>t(e??{}))}}}function Rr(e,t,n){let r=`devframe:settings:${n}:${t}`,i;function a(){return i||=(async()=>(await e.ensureTrusted(),e.sharedState.get(r)))().catch(e=>{throw i=void 0,e}),i}return Lr(a)}function zr(e,t){return{global:Rr(e,t,`global`),project:Rr(e,t,`project`)}}function Br(e,t){return{namespace:t,base:e,rpc:{namespace:t,register(n){if(Fr(n.name))throw Error(`[devframe] Scoped client RPC registration for namespace "${t}" received an already-namespaced function name "${n.name}". Pass a bare name without a ":" separator.`);e.client.register({...n,name:`${t}:${n.name}`})},call:((n,...r)=>e.call(Ir(t,n),...r)),callEvent:((n,...r)=>e.callEvent(Ir(t,n),...r)),callOptional:((n,...r)=>e.callOptional(Ir(t,n),...r)),sharedState:((n,r)=>e.sharedState.get(Ir(t,n),r)),streaming:{subscribe:(n,r,i)=>e.streaming.subscribe(Ir(t,n),r,i),upload:(n,r)=>e.streaming.upload(Ir(t,n),r)}},settings:zr(e,t),scope:e.scope}}var Vr=128;function Hr(e){return e.replace(/[^\w-]+/g,`_`).slice(0,Vr)}function Ur(e,t){return t.safety?t.safety:e===`static`||e===`query`||e==null?`read`:`action`}var Wr=Object.freeze({type:`object`,additionalProperties:!0});function Gr(e){let t=e[`~standard`];if(t.jsonSchema)try{return t.jsonSchema.input({target:`draft-2020-12`})}catch{return Wr}return Wr}function Kr(e){if(!e||e.length===0)return{type:`object`,properties:{}};let t={},n=[];for(let r=0;r<e.length;r++){let i=`arg${r}`;t[i]=Gr(e[r]),n.push(i)}return{type:`object`,properties:t,required:n,additionalProperties:!1}}function qr(e,t){if(Array.isArray(e))return e;if(e==null)return[];if(typeof e!=`object`)return;let n=e;if(t!=null)return Array.from({length:t},(e,t)=>n[`arg${t}`]);if(`arg0`in n){let e=[];for(;`arg${e.length}`in n;)e.push(n[`arg${e.length}`]);return e}return Object.keys(n).length===0?[]:void 0}function Jr(e,t){return qr(e,t)??[e]}function Yr(){if(typeof document<`u`){let e=document.modelContext;if(e)return e}if(typeof navigator<`u`){let e=navigator.modelContext;if(e)return e}}function Xr(e,t={}){let n=t.modelContext??Yr();if(!n)return()=>{};let r=n,i=new Map,a=new Map;function o(t,n){let o=Hr(t.name),s=a.get(o);if(s&&s!==t.name){console.warn(`[devframe] WebMCP tool name "${o}" (from "${t.name}") collides with "${s}"; keeping the first registration.`);return}let c=new AbortController,l=Ur(t.type,n),u=r.registerTool({name:o,description:n.description,inputSchema:Kr(t.args),annotations:{title:n.title??t.name,readOnlyHint:l===`read`,destructiveHint:l===`destructive`},execute:n=>Zr(t,e.context,n)},{signal:c.signal});u&&`then`in u&&u.then(()=>{},()=>{}),a.set(o,t.name),i.set(t.name,()=>{c.abort(),u&&`unregister`in u&&typeof u.unregister==`function`&&u.unregister(),a.delete(o)})}function s(t){let n=t?[t]:[...e.definitions.keys()];for(let t of n){i.get(t)?.(),i.delete(t);let n=e.definitions.get(t),r=n?.agent;n&&r&&o(n,r)}}s();let c=e.onChanged(e=>s(e));return()=>{c();for(let e of i.values())e();i.clear()}}async function Zr(e,t,n){try{let r=Jr(n,e.args?.length);return{content:[{type:`text`,text:Qr(await(await me(e,t))(...r))}]}}catch(e){return{isError:!0,content:[{type:`text`,text:$r(e)}]}}}function Qr(e){return e===void 0?`undefined`:typeof e==`string`?e:JSON.stringify(e,null,2)}function $r(e){if(!(e instanceof Error))return String(e);let t=e.cause instanceof Error?` (cause: ${e.cause.message})`:``;return`${e.name}: ${e.message}${t}`}var ei=`modulepreload`,ti=function(e,t){return new URL(e,t).href},ni={},ri=function(e){return e.pathname.endsWith(`.css`)},ii=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},ai=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=ti(t,n);let r=s(t),i=ri(r);return ii(ni,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:ei,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function oi(e,t){if(t.backend===`static`)return`static`;let n=t.websocket!==void 0,r=t.sse!==void 0;if(e===`websocket`){if(!n)throw Error(`[devframe] transport: 'websocket' was requested, but this server does not advertise a WebSocket endpoint`);return`websocket`}if(e===`sse`){if(!r)throw Error(`[devframe] transport: 'sse' was requested, but this server does not advertise an SSE endpoint`);return`sse`}if(t.backend===`sse`&&r)return`sse`;if(n)return`websocket`;if(r)return`sse`;throw Error(`[devframe] This server advertises no RPC transport (backend "none"), so there is nothing to connect to. Enable the WebSocket or SSE endpoint on the server, or use its static/MCP surfaces instead.`)}async function si(t={}){let{baseURL:n=`./`,rpcOptions:r={},cacheOptions:i=!1}=t,a=be(),o=Array.isArray(n)?n:[n],s=await Re(t),{connectionMeta:c,metaBaseUrl:l,authToken:u}=s,d=o[0]??`./`;try{d=new URL(`.`,l).href}catch{}let f=new x({functions:[],...typeof t.cacheOptions==`object`?t.cacheOptions:{}}),p={rpc:void 0},m=new he(p),h=t.webmcp===!1?void 0:Xr(m),g,_=!1,v=0,y;function b(){v++,y=void 0,f.clear(),i===!0&&f.updateOptions({functions:[]})}i&&(m.register({name:e.broadcast.cacheInvalidate,type:`event`,handler:b}),a.on(e.client.connectionStatus,b),a.on(e.client.isTrustedUpdated,b));async function ee(e){let t=[d,...o.filter(e=>e!==d)].filter(e=>e!=null),n=[];for(let r of t)try{return await fetch(Te(e,r)).then(t=>{if(!t.ok)throw Error(`Failed to fetch ${e} from ${r}: ${t.status}`);return t.json()})}catch(e){n.push(e)}throw Error(`Failed to load ${e} from ${t.join(`, `)}`,{cause:n})}let S=t.callTimeout??0,te=S>0?S:1/0,C,ne={authToken:u,connectionMeta:c,metaBaseUrl:l,events:a,clientRpc:m,callTimeout:t.callTimeout,rpcOptions:{...r,async onRequest(e,t,n){let a=performance.now()+te;if(await r.onRequest?.call(this,e,t,n),i===!0&&e.i&&C.isTrusted&&!e.m.startsWith(`anonymous:`)&&e.m!==`devframe:rpc:cacheable-functions`){function t(){if(performance.now()>=a)throw new ze(`timeout`,`[devframe] RPC call "${e.m}" timed out after ${S}ms`)}for(;!y&&(t(),!(_||C.status!==`connected`));){let e=v;y=C.callOptional(`devframe:rpc:cacheable-functions`).then(t=>{e===v&&f.updateOptions({functions:t??[]})}).catch(t=>{throw e===v&&(y=void 0),t}),await y}await y,t()}let o=v;if(i&&e.i&&!_&&C.isTrusted&&f.validate(e.m)){if(f.has(e.m,e.a))return n(f.cached(e.m,e.a));let r=await t(e);o===v&&!_&&f.apply(e,r)}else await t(e)}}},w=oi(t.transport??`auto`,c);C=w===`static`?await xr({fetchJsonFromBases:ee}):w===`sse`?dr({...ne,sseOptions:t.sseOptions}):Pr({...ne,wsOptions:t.wsOptions});let re;try{re=new BroadcastChannel(`devframe-auth`)}catch{}let T,ie=!1;function ae(e){return((...t)=>ie||!T?e(...t):T.then(()=>e(...t)))}function oe(){_=!0,b();try{g?.(),h?.()}finally{try{re?.close()}finally{C.close?.()}}}let E={events:a,get isTrusted(){return C.isTrusted},get status(){return C.status},get connectionError(){return C.connectionError},get transport(){return C.transport??w},get connection(){return s},connectionMeta:c,ensureTrusted:C.ensureTrusted,requestTrust:C.requestTrust,requestTrustWithToken:async e=>(Pe(e),s={...s,authToken:e},C.requestTrustWithToken(e)),requestTrustWithCode:async e=>{let t=await C.requestTrustWithCode(e);if(!t)return!1;Pe(t),s={...s,authToken:t};try{re?.postMessage({type:`auth-update`,authToken:t})}catch{}return!0},requestAuthCode:e=>C.requestAuthCode(e),call:ae(C.call),callEvent:ae(C.callEvent),callOptional:ae(C.callOptional),client:m,sharedState:void 0,services:void 0,streaming:void 0,cacheManager:f,scope:void 0,close:oe};E.sharedState=Tn(E),E.streaming=kr(E),E.services=We(E);let se=new Map;E.scope=(e=>{if(!e)return E;let t=se.get(e);return t||(t=Br(E,e),se.set(e,t)),t}),p.rpc=E;function ce(){try{return typeof window<`u`&&window.self===window.top}catch{return!1}}async function le(){if(t.simpleAuth!==!1&&ce()&&typeof globalThis.prompt==`function`)for(await E.requestAuthCode().catch(()=>{});!E.isTrusted;){let e=globalThis.prompt(`devframe: enter the authentication code shown in your terminal`);if(e==null)return;let t=e.trim();if(t&&await E.requestTrustWithCode(t))return}}async function ue(){let e=await C.requestTrust(),n=t.otpParam??`devframe_otp`,r=n?await Ue(E,{param:n}):!1;e||r||E.isTrusted||await le()}return T=ue().then(()=>{ie=!0},()=>{ie=!0}),c.mcp&&ai(async()=>{let{setupBrowserAgentRpcBridge:e}=await import(`./browser-agent-rpc-BajrnP_A.js`);return{setupBrowserAgentRpcBridge:e}},[],import.meta.url).then(({setupBrowserAgentRpcBridge:e})=>{_||(g=e(E))}).catch(()=>{}),re&&(re.onmessage=e=>{e.data?.type===`auth-update`&&e.data.authToken&&E.requestTrustWithToken(e.data.authToken)}),E}var ci=si;function li(){if(window.parent===window)return()=>{};let e=document.documentElement,t=e.style.getPropertyValue(`--devframe-primary`),n=e.style.getPropertyPriority(`--devframe-primary`),r=!1,i=!1;return Re().then(({connectionMeta:t})=>{let n=t.configs?.ui?.branding?.primaryColor;!r&&n&&CSS.supports(`color`,n)&&(e.style.setProperty(`--devframe-primary`,n),i=!0)}).catch(()=>{}),()=>{r=!0,i&&(t?e.style.setProperty(`--devframe-primary`,t,n):e.style.removeProperty(`--devframe-primary`))}}var ui=Array.isArray,di=Array.prototype.indexOf,fi=Array.prototype.includes,pi=Array.from,mi=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,gi=Object.getOwnPropertyDescriptors,_i=Object.prototype,vi=Array.prototype,yi=Object.getPrototypeOf,bi=Object.isExtensible,xi=()=>{};function Si(e){for(var t=0;t<e.length;t++)e[t]()}function Ci(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function wi(e,t,n=!1){return e===void 0?n?t():t:e}var Ti=1024,Ei=2048,Di=4096,Oi=8192,ki=16384,Ai=32768,ji=1<<25,Mi=65536,Ni=1<<19,Pi=1<<20,Fi=1<<25,Ii=1<<21,Li=1<<22,Ri=1<<23,zi=Symbol(`$state`),Bi=Symbol(`component`),Vi=Symbol(``),Hi=Symbol(`attributes`),Ui=Symbol(`class`),Wi=Symbol(`style`),Gi=Symbol(`text`),Ki=Symbol(`form reset`),qi=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Ji=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),Yi={},Xi=Symbol(`uninitialized`),Zi=`http://www.w3.org/1999/xhtml`;function Qi(){console.warn(`https://svelte.dev/e/derived_inert`)}function $i(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ea(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var D=!1;function ta(e){D=e}var O;function na(e){if(e===null)throw $i(),Yi;return O=e}function ra(){return na(Fo(O))}function k(e){if(D){if(Fo(O)!==null)throw $i(),Yi;O=e}}function ia(e=1){if(D){for(var t=e,n=O;t--;)n=Fo(n);O=n}}function aa(e=!0){for(var t=0,n=O;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=Fo(n);e&&n.remove(),n=i}}function oa(e){if(!e||e.nodeType!==8)throw $i(),Yi;return e.data}function sa(e){return e===this.v}function ca(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function la(e){return!ca(e,this.v)}function ua(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function da(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function fa(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function pa(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function ma(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function ha(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function ga(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function _a(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function va(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function ya(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function ba(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var xa=null;function Sa(e){xa=e}function Ca(e,t=!1,n){xa={p:xa,i:!1,c:null,e:null,s:e,x:null,r:F,l:null}}function wa(e){var t=xa,n=t.e;if(n!==null){t.e=null;for(var r of n)Xo(r)}return e!==void 0&&(t.x=e),t.i=!0,xa=t.p,Ta(e)}function Ta(e={}){return mi(e,Bi,{value:!0}),e}function Ea(){return!0}var Da=[];function Oa(){var e=Da;Da=[],Si(e)}function ka(e){if(Da.length===0&&!to){var t=Da;queueMicrotask(()=>{t===Da&&Oa()})}Da.push(e)}var Aa=~(Ei|Di|Ti);function ja(e,t){e.f=e.f&Aa|t}function Ma(e){e.f&512||e.deps===null?ja(e,Ti):ja(e,Di)}function Na(e,t){e.f&2048?t.set(e,Ei):e.f&4096&&t.get(e)!==2048&&t.set(e,Di),ja(e,Ti)}var Pa=!1;function Fa(){Pa||(Pa=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[Ki]?.()})},{capture:!0}))}function Ia(e){var t=P,n=F;ys(null),bs(null);try{return e()}finally{ys(t),bs(n)}}function La(e,t,n,r){let i=Ea()?Va:Ga;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=F,c=Ra(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){Uo(e,s)}za()}}var d=Ba();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>Ua(e))).then(u).catch(e=>Uo(e,s)).finally(d)}l?l.then(()=>{s.f&16384?d():(c(),f(),za())}):f()}function Ra(){var e=F,t=P,n=xa,r=A;return function(i=!0){bs(e),ys(t),Sa(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function za(e=!0){bs(null),ys(null),Sa(null),e&&A?.deactivate()}function Ba(){var e=F,t=e.b,n=A,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function Va(e){var t=2|Ei;return F!==null&&(F.f|=Ni),{ctx:xa,deps:null,effects:null,equals:sa,f:t,fn:e,reactions:null,rv:0,v:Xi,wv:0,parent:F,ac:null}}var Ha=Symbol(`obsolete`);function Ua(e,t,n){let r=F;r===null&&da();var i=void 0,a=vo(Xi),o=!P,s=new Set;return $o(()=>{var t=F,n=Ci();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==qi&&n.reject(e)}).finally(za)}catch(e){n.reject(e),za()}var c=A;if(o){if(t.f&32768)var l=Ba();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(Ha);else for(let e of s.values())e.reject(Ha);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==Ha&&(c.activate(),t?(a.f|=Ri,Co(a,t)):(a.f&8388608&&(a.f^=Ri),Co(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),Jo(()=>{for(let e of s)e.reject(Ha)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function Wa(e){let t=Va(e);return Ss(t),t}function Ga(e){let t=Va(e);return t.equals=la,t}function Ka(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)ss(t[n])}}function qa(e){var t,n=F,r=e.parent;if(!gs&&r!==null&&e.v!==Xi&&r.f&24576)return Qi(),e.v;bs(r);try{Ka(e),t=Ps(e)}finally{bs(n)}return t}function Ja(e){var t=qa(e);!e.equals(t)&&(e.wv=js(),(!A?.is_fork||e.deps===null)&&(A===null?e.v=t:(A.capture(e,t,!0),Qa?.capture(e,t,!0)),e.deps===null))?ja(e,Ti):gs||($a===null?Ma(e):(qo()||A?.is_fork)&&$a.set(e,t))}function Ya(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&Ia(()=>{t.ac.abort(qi),t.ac=null}),t.fn!==null&&(t.teardown=xi),Ls(t,0),as(t))}function Xa(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Rs(t)}var Za=null,A=null,Qa=null,$a=null,eo=null,to=!1,no=!1,ro=null,io=null,ao=0,oo=1,so=class e{id=oo++;started=!1;linked=!0;prev=null;next=null;async_deriveds=new Map;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=0;#r=new Map;#i=null;#a=[];#o=[];#s=new Map;#c=new Map;#l=new Set;is_fork=!1;#u=!1;constructor(){Za===null?Za=this:(Za.next=this,this.prev=Za),Za=this}#d(){if(this.is_fork)return!0;for(let e of this.#r.keys())if(!this.#f(e))return!0;return!1}#f(e){for(var t=e;t!==null;t=t.parent)if(this.#c.has(t))return!0;return!1}skip_effect(e){this.#c.has(e)||this.#c.set(e,{d:[],m:[]}),this.#l.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#c.get(e);if(n){this.#c.delete(e);for(var r of n.d)ja(r,Ei),t(r);for(r of n.m)ja(r,Di),t(r)}this.#l.add(e)}#p(){var e=[];for(let i of this.#a)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=Ti}}n||e.push(t)}return this.#a=[],e}#m(){this.started=!0;for(let[e,t]of this.#s)ja(e,t),this.schedule(e);this.apply();for(var t=ro=[],n=[],r=io=[];this.#a.length>0;){ao++>1e3&&(this.#b(),co());for(let e of this.#p())try{this.#h(e,t,n)}catch(t){throw mo(e),this.#d()||this.discard(),t}}if(A=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(ro=null,io=null,this.#d()){this.#y(n),this.#y(t);for(let[e,t]of this.#c)po(e,t);r.length>0&&A.#m();return}let a=this.#g();if(a)this.#y(n),this.#y(t),a.#v(this);else{this.#s.clear();for(let e of this.#e)e(this);this.#e.clear(),Qa=this,uo(n),uo(t),Qa=null,this.#i?.resolve();var o=A;this.#n===0&&(this.#a.length===0||o!==null)&&this.#b(),o!==null&&(go.clear(),o.#m())}}#h(e,t,n){e.f^=Ti;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#c.has(r))&&r.fn!==null){a?r.f^=Ti:i&4?t.push(r):Ms(r)&&(i&16&&this.add_dirty_reaction(r,Di),Rs(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#g(){for(var e=this.prev;e!==null;e=e.prev)if(!e.is_fork&&this.#_(e))return e;return null}#_(e){for(let[t,[,n]]of this.current)if(!n&&e.current.has(t))return!0;return!1}#v(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_reactions(e.#s);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#s.delete(i),ja(i,Ei),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#b(),A=this,this.#m()}#y(e){for(var t=0;t<e.length;t+=1)Na(e[t],this.#s)}capture(e,t,n=!1){e.v!==Xi&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),$a?.set(e,t)),this.is_fork||(e.v=t)}activate(){A=this}deactivate(){A=null,$a=null}flush(){try{no=!0,A=this,this.#m()}finally{ao=0,eo=null,ro=null,io=null,no=!1,A=null,$a=null,go.clear()}}discard(){for(let e of this.#t)e(this);this.#t.clear();for(let e of this.async_deriveds.values())e.reject(Ha);this.#b(),this.#i?.resolve()}register_created_effect(e){this.#o.push(e)}increment(e,t){if(this.#n+=1,e){let e=this.#r.get(t)??0;this.#r.set(t,e+1)}}decrement(e,t){if(--this.#n,e){let e=this.#r.get(t)??0;e===1?this.#r.delete(t):this.#r.set(t,e-1)}this.#u||(this.#u=!0,ka(()=>{this.#u=!1,this.linked&&this.flush()}))}transfer_reactions(e){for(let[t,n]of e)this.add_dirty_reaction(t,n);e.clear()}add_dirty_reaction(e,t){(t===2048||this.#s.get(e)!==2048)&&this.#s.set(e,t)}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#i??=Ci()).promise}static ensure(){if(A===null){let t=A=new e;!no&&ka(()=>{t.started||t.flush()})}return A}apply(){$a=null}schedule(e){eo=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#a.push(e)}#b(){if(this.linked){var e=this.prev,t=this.next;e===null||(e.next=t),t===null?Za=e:t.prev=e,this.linked=!1}}};function co(){try{ga()}catch(e){Uo(e,eo)}}var lo=null;function uo(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Ms(r)&&(lo=new Set,Rs(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&ls(r),lo?.size>0)){go.clear();for(let e of lo){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)lo.has(n)&&(lo.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Rs(n)}}lo.clear()}}lo=null}}function fo(e){A.schedule(e)}function po(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),ja(e,Ti);for(var n=e.first;n!==null;)po(n,t),n=n.next}}function mo(e){ja(e,Ti);for(var t=e.first;t!==null;)mo(t),t=t.next}var ho=new Set,go=new Map,_o=!1;function vo(e,t){return{f:0,v:e,reactions:null,equals:sa,rv:0,wv:0}}function yo(e,t){let n=vo(e,t);return Ss(n),n}function bo(e,t=!1,n=!0){let r=vo(e);return t||(r.equals=la),r}function j(e,t,n=!1){return P!==null&&(!vs||P.f&131072)&&Ea()&&P.f&4325394&&(xs===null||!xs.has(e))&&ya(),Co(e,n?Do(t):t,io)}var xo=null,So=0;function Co(e,t,n=null){if(!e.equals(t)){gs?go.set(e,t):go.has(e)||go.set(e,e.v);var r=so.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&qa(t),$a===null&&Ma(t)}e.wv=js(),xo=null,So=0,Eo(e,Ei,n),xo=null,Ea()&&F!==null&&F.f&1024&&!(F.f&96)&&(Ts===null?Es([e]):Ts.push(e)),!r.is_fork&&ho.size>0&&!_o&&wo()}return t}function wo(){_o=!1;for(let e of ho){e.f&1024&&ja(e,Di);let t;try{t=Ms(e)}catch{t=!0}t&&Rs(e)}ho.clear()}function To(e){j(e,e.v+1)}function Eo(e,t,n){var r=e.reactions;if(r!==null){var i=Ea(),a=r.length;if(So+=a,So>1e5&&xo===null&&(xo=new Set),xo!==null){if(xo.has(e))return;xo.add(e)}for(var o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==F){var l=(c&Ei)===0;if(l&&ja(s,t),c&131072)ho.add(s);else if(c&2){var u=s;$a?.delete(u),Eo(u,Di,n)}else if(l){var d=s;c&16&&lo!==null&&lo.add(d),n===null?fo(d):n.push(d)}}}}}function Do(e){if(typeof e!=`object`||!e||zi in e||Bi in e)return e;let t=yi(e);if(t!==_i&&t!==vi)return e;var n=new Map,r=ui(e),i=yo(0),a=null,o=ks,s=e=>{if(ks===o)return e();var t=P,n=ks;ys(null),As(o);var r=e();return ys(t),As(n),r};return r&&n.set(`length`,yo(e.length,a)),new Proxy(e,{defineProperty(e,t,r){`value`in r&&r.configurable!==!1&&r.enumerable!==!1&&r.writable!==!1||_a();var i=n.get(t);return i===void 0?s(()=>{var e=yo(r.value,a);return n.set(t,e),e}):j(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=s(()=>yo(Xi,a));n.set(t,e),To(i)}}else j(r,Xi),To(i);return!0},get(t,r,i){if(r===zi)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||hi(t,r)?.writable)&&(o=s(()=>yo(Do(c?t[r]:Xi),a)),n.set(r,o)),o!==void 0){var l=I(o);return l===Xi?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var r=Reflect.getOwnPropertyDescriptor(e,t),i=n.get(t);if(i!==void 0){var a=I(i);if(a===Xi)return;if(r&&`value`in r)r.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return r},has(e,t){if(t===zi)return!0;var r=n.get(t),i=r!==void 0&&r.v!==Xi||Reflect.has(e,t);return(r!==void 0||(F!==null||P!==null)&&(!i||hi(e,t)?.writable))&&(r===void 0&&(r=s(()=>yo(i?Do(e[t]):Xi,a)),n.set(t,r)),I(r)===Xi)?!1:i},set(e,t,o,c){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;d<l.v;d+=1){var f=n.get(d+``);f===void 0?d in e&&(f=s(()=>yo(Xi,a)),n.set(d+``,f)):j(f,Xi)}if(l===void 0)(!u||hi(e,t)?.writable)&&(l=s(()=>yo(void 0,a)),j(l,Do(o)),n.set(t,l));else{u=l.v!==Xi;var p=s(()=>Do(o));j(l,p)}var m=Reflect.getOwnPropertyDescriptor(e,t);if(m?.set&&m.set.call(c,o),!u){if(r&&typeof t==`string`){var h=n.get(`length`),g=Number(t);Number.isInteger(g)&&g>=h.v&&j(h,g+1)}To(i)}return!0},ownKeys(e){I(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==Xi});for(var[r,a]of n)a.v!==Xi&&!(r in e)&&t.push(r);return t},setPrototypeOf(){va()}})}var Oo,ko,Ao,jo;function Mo(){if(Oo===void 0){Oo=window,ko=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Ao=hi(t,`firstChild`).get,jo=hi(t,`nextSibling`).get,bi(e)&&(e[Ui]=void 0,e[Hi]=null,e[Wi]=void 0,e.__e=void 0),bi(n)&&(n[Gi]=void 0)}}function No(e=``){return document.createTextNode(e)}function Po(e){return Ao.call(e)}function Fo(e){return jo.call(e)}function M(e,t){if(!D)return Po(e);var n=Po(O);if(n===null)n=O.appendChild(No());else if(t&&n.nodeType!==3){var r=No();return n?.before(r),na(r),r}return t&&Vo(n),na(n),n}function Io(e,t=!1){if(!D){var n=Po(e);return n instanceof Comment&&n.data===``?Fo(n):n}if(t){if(O?.nodeType!==3){var r=No();return O?.before(r),na(r),r}Vo(O)}return O}function Lo(e,t=!1){if(!D)return Po(e);var n=M(e,t);return k(e),n}function N(e,t=1,n=!1){let r=D?O:e;for(var i;t--;)i=r,r=Fo(r);if(!D)return r;if(n){if(r?.nodeType!==3){var a=No();return r===null?i?.after(a):r.before(a),na(a),a}Vo(r)}return na(r),r}function Ro(e){e.textContent=``}function zo(){return!1}function Bo(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function Vo(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Ho(e){var t=F;if(t===null)return P.f|=Ri,e;if(!(t.f&32768)&&!(t.f&4))throw e;Uo(e,t)}function Uo(e,t){if(e===Yi)throw e;if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function Wo(e){F===null&&(P===null&&ha(e),ma()),gs&&pa(e)}function Go(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Ko(e,t){var n=F;n!==null&&n.f&8192&&(e|=Oi);var r={ctx:xa,deps:null,nodes:null,f:e|Ei|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};A?.register_created_effect(r);var i=r;if(e&4)ro===null?so.ensure().schedule(r):ro.push(r);else if(t!==null){try{Rs(r)}catch(e){throw ss(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=Mi))}if(i!==null&&(i.parent=n,n!==null&&Go(i,n),P!==null&&P.f&2&&!(e&64))){var a=P;(a.effects??=[]).push(i)}return r}function qo(){return P!==null&&!vs}function Jo(e){let t=Ko(8,null);return ja(t,Ti),t.teardown=e,t}function Yo(e){Wo(`$effect`);var t=F.f;if(!P&&t&32&&xa!==null&&!xa.i){var n=xa;(n.e??=[]).push(e)}else return Xo(e)}function Xo(e){return Ko(4|Pi,e)}function Zo(e){so.ensure();let t=Ko(64|Ni,e);return(e={})=>new Promise(n=>{e.outro?us(t,()=>{ss(t),n(void 0)}):(ss(t),n(void 0))})}function Qo(e){return Ko(4,e)}function $o(e){return Ko(Li|Ni,e)}function es(e,t=0){return Ko(8|t,e)}function ts(e,t=[],n=[],r=[]){La(r,t,n,t=>{Ko(8,()=>{e(...t.map(I))})})}function ns(e,t=0){return Ko(16|t,e)}function rs(e){return Ko(32|Ni,e)}function is(e){var t=e.teardown;if(t!==null){let n=gs,r=P;_s(!0),ys(null);try{t.call(null)}catch(t){Uo(t,e.parent)}finally{_s(n),ys(r)}}}function as(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Ia(()=>{e.abort(qi)});var r=n.next;n.f&64?n.parent=null:ss(n,t),n=r}}function os(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||ss(t),t=n}}function ss(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(cs(e.nodes.start,e.nodes.end),n=!0),e.f|=ji,as(e,t&&!n),Ls(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();is(e),e.f^=ji,e.f|=ki;var i=e.parent;i!==null&&i.first!==null&&ls(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function cs(e,t){for(;e!==null;){var n=e===t?null:Fo(e);e.remove(),e=n}}function ls(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function us(e,t,n=!0){var r=[];e.f|=256,ds(e,r,!0);var i=()=>{n&&ss(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function ds(e,t,n){if(!(e.f&8192)){e.f^=Oi;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);ds(i,t,o?n:!1)}i=a}}}function fs(e){e.f&=-257,ps(e,!0)}function ps(e,t){if(!(e.f&256)&&e.f&8192){e.f^=Oi,e.f&1024||(ja(e,Ei),so.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);ps(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function ms(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Fo(n);t.append(n),n=i}}var hs=null,gs=!1;function _s(e){gs=e}var P=null,vs=!1;function ys(e){P=e}var F=null;function bs(e){F=e}var xs=null;function Ss(e){P!==null&&(P.f&2097152||P.f&2)&&(xs??=new Set).add(e)}var Cs=null,ws=0,Ts=null;function Es(e){Ts=e}var Ds=1,Os=0,ks=Os;function As(e){ks=e}function js(){return++Ds}function Ms(e){var t=e.f;if(t&2048)return!0;if(t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Ms(a)&&Ja(a),a.wv>e.wv)return!0}t&512&&$a===null&&ja(e,Ti)}return!1}function Ns(e,t,n=!0){var r=e.reactions;if(r!==null&&!(xs!==null&&xs.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Ns(a,t,!1):t===a&&(n?ja(a,Ei):a.f&1024&&ja(a,Di),fo(a))}}function Ps(e){var t=Cs,n=ws,r=Ts,i=P,a=xs,o=xa,s=vs,c=ks,l=e.f;Cs=null,ws=0,Ts=null,P=l&96?null:e,xs=null,Sa(e.ctx),vs=!1,ks=++Os,e.ac!==null&&(Ia(()=>{e.ac.abort(qi)}),e.ac=null);try{e.f|=Ii;var u=e.fn,d=u();e.f|=Ai;var f=Fs(e);if(Ea()&&Ts!==null&&!vs&&f!==null&&!(e.f&6146))for(var p=0;p<Ts.length;p++)Ns(Ts[p],e);if(i!==null&&i!==e){if(Os++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Os;if(t!==null)for(let e of t)e.rv=Os;Ts!==null&&(r===null?r=Ts:r.push(...Ts))}return e.f&8388608&&(e.f^=Ri),d}catch(t){return Fs(e),Ho(t)}finally{e.f^=Ii,Cs=t,ws=n,Ts=r,P=i,xs=a,Sa(o),vs=s,ks=c}}function Fs(e){var t=e.deps,n=A?.is_fork;if(Cs!==null){var r;if(n||Ls(e,ws),t!==null&&ws>0)for(t.length=ws+Cs.length,r=0;r<Cs.length;r++)t[ws+r]=Cs[r];else e.deps=t=Cs;if(qo()&&e.f&512)for(r=ws;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&ws<t.length&&(Ls(e,ws),t.length=ws);return t}function Is(e,t){let n=t.reactions;if(n!==null){var r=di.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&t.f&2&&(Cs===null||!fi.call(Cs,t))){var a=t;a.f&512&&(a.f^=512),a.v!==Xi&&Ma(a),a.ac!==null&&Ia(()=>{a.ac.abort(qi),a.ac=null,ja(a,Ei)}),Ya(a),Ls(a,0)}}function Ls(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Is(e,n[r])}function Rs(e){var t=e.f;if(!(t&16384)){ja(e,Ti);var n=F;F=e;try{t&16777232?os(e):as(e),is(e);var r=Ps(e);e.teardown=typeof r==`function`?r:null,e.wv=Ds}finally{F=n}}}function I(e){var t=!!(e.f&2);if(hs?.add(e),P!==null&&!vs&&!(F!==null&&F.f&16384)&&(xs===null||!xs.has(e))){var n=P.deps;if(P.f&2097152)e.rv<Os&&(e.rv=Os,Cs===null&&n!==null&&n[ws]===e?ws++:Cs===null?Cs=[e]:Cs.push(e));else{P.deps??=[],fi.call(P.deps,e)||P.deps.push(e);var r=e.reactions;r===null?e.reactions=[P]:fi.call(r,P)||r.push(P)}}if(gs&&go.has(e))return go.get(e);if(t){var i=e;if(gs){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Bs(i))&&(a=qa(i)),go.set(i,a),a}var o=!(i.f&512)&&!vs&&P!==null&&!!(P.f&512),s=(i.f&Ai)===0;Ms(i)&&(o&&(i.f|=512),Ja(i)),o&&!s&&(Xa(i),zs(i))}if($a?.has(e))return $a.get(e);if(e.f&8388608)throw e.v;return e.v}function zs(e){if(e.f|=512,e.deps!==null)for(let n of e.deps){var t=n.reactions;t===null?n.reactions=[e]:fi.call(t,e)||t.push(e),n.f&2&&!(n.f&512)&&(Xa(n),zs(n))}}function Bs(e){if(e.v===Xi)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(go.has(t)||t.f&2&&Bs(t))return!0;return!1}function Vs(e){var t=vs;try{return vs=!0,e()}finally{vs=t}}function Hs(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(zi in e)Us(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&zi in n&&Us(n)}}}function Us(e,t=new Set){if(typeof e==`object`&&e&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Us(e[n],t)}catch{}let n=yi(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){let t=gi(n);for(let n in t){let r=t[n].get;if(r)try{r.call(e)}catch{}}}}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var Ws=[`touchstart`,`touchmove`];function Gs(e){return Ws.includes(e)}var Ks=Symbol(`events`),qs=new Set,Js=new Set;function Ys(e,t,n,r={}){function i(e){if(r.capture||ec.call(t,e),!e.cancelBubble)return Ia(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?(i.__removed=!1,ka(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Xs(e,t,n,r,i){var a={capture:r,passive:i},o=Ys(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Jo(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function L(e,t,n){(t[Ks]??={})[e]=n}function Zs(e){for(var t=0;t<e.length;t++)qs.add(e[t]);for(var n of Js)n(e)}var Qs=null,$s=!1;function ec(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;Qs=e,$s||($s=!0,setTimeout(()=>{$s=!1,Qs=null}));var o=0,s=Qs===e&&e[Ks];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[Ks]=t;return}var l=i.indexOf(t);if(l===-1)return;c<=l&&(o=c)}if(a=i[o]||e.target,a!==t){mi(e,`currentTarget`,{configurable:!0,get(){return a||n}});var u=P,d=F;ys(null),bs(null);try{for(var f,p=[];a!==null&&a!==t;){try{var m=a[Ks]?.[r];m==null||a.disabled&&e.target!==a||m.call(a,e)}catch(e){f?p.push(e):f=e}if(e.cancelBubble)break;o++,a=o<i.length?i[o]:null}if(f){for(let e of p)queueMicrotask(()=>{throw e});throw f}}finally{e[Ks]=t,delete e.currentTarget,ys(u),bs(d)}}}var tc=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function nc(e){return tc?.createHTML(e)??e}function rc(e){var t=Bo(`template`);return t.innerHTML=nc(e.replaceAll(`<!>`,`<!---->`)),t.content}function ic(e,t){var n=F;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function ac(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(D)return ic(O,null),O;i===void 0&&(i=rc(a?e:`<!>`+e),n||(i=Po(i)));var t=r||ko?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Po(t),s=t.lastChild;ic(o,s)}else ic(t,t);return t}}function oc(e=``){if(!D){var t=No(e+``);return ic(t,t),t}var n=O;return n.nodeType===3?Vo(n):(n.before(n=No()),na(n)),ic(n,n),n}function sc(){if(D)return ic(O,null),O;var e=document.createDocumentFragment(),t=document.createComment(``),n=No();return e.append(t,n),ic(t,n),e}function R(e,t){if(D){var n=F;n.f&32768&&n.nodes.end!==null||(n.nodes.end=O),ra()}else e!==null&&e.before(t)}function cc(e){let t=0,n=vo(0),r;return()=>{qo()&&(I(n),es(()=>(t===0&&(r=Vs(()=>e(()=>To(n)))),t+=1,()=>{ka(()=>{--t,t===0&&(r?.(),r=void 0,To(n))})})))}}var lc=Mi|Ni;function uc(e,t,n,r){new dc(e,t,n,r)}var dc=class{parent;is_pending=!1;transform_error;#e;#t=D?O:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Map;#p=null;#m=cc(()=>(this.#p=vo(this.#l),()=>{this.#p=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=F;t.b=this,t.f|=128,n(e)},this.parent=F.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=ns(()=>{if(D){let e=oa(this.#t);ra();let t=e===`[!`;if(e.startsWith(`[?`)){let t=JSON.parse(e.slice(2));this.#g(t)}else t?this.#y():this.#h()}else this.#b()},lc),D&&(this.#e=O)}#h(){try{this.#a=rs(()=>this.#r(this.#e))}catch(e){this.error(e)}}#g(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#_(e);ka(r),t&&(this.#s=rs(()=>{t(this.#e,()=>e,()=>n)}))}#_(e){var t=!1,n=!1;let r=()=>{this.#v()||(t?ea():(t=!0,n&&ba(),this.#s!==null&&us(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})))};return{reset:r,invoke_onerror:()=>{if(!this.#v())try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){Uo(e,this.#i&&this.#i.parent)}}}}#v(){return(this.#i.f&(ki|ji))!==0}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=rs(()=>e(this.#e)),ka(()=>{if(!this.#v()){var e=this.#c=document.createDocumentFragment(),t=No(),n=!1;e.append(t),this.#a=this.#S(()=>{try{return rs(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){Uo(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#x(A)):this.#u===0&&(this.#e.before(e),this.#c=null,us(this.#o,()=>{this.#o=null}),this.#x(A))}}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=rs(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();ms(this.#a,e);let t=this.#n.pending;this.#o=rs(()=>t(this.#e))}else this.#x(A)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_reactions(this.#f)}defer_effect(e){Na(e,this.#f)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=F,n=P,r=xa;bs(this.#i),ys(this.#i),Sa(this.#i.ctx);try{return so.ensure(),e()}finally{bs(t),ys(n),Sa(r)}}#C(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&us(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#C(e,t)}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!this.#p||this.#d||(this.#d=!0,ka(()=>{this.#d=!1,this.#p&&Co(this.#p,this.#l)}))}get_effect_pending(){return this.#m(),I(this.#p)}error(e){if(e===Yi||!this.#n.onerror&&!this.#n.failed)throw e;A?.is_fork?(this.#a&&A.skip_effect(this.#a),this.#o&&A.skip_effect(this.#o),this.#s&&A.skip_effect(this.#s),A.oncommit(()=>{this.#v()||this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(ss(this.#a),null),this.#o&&=(ss(this.#o),null),this.#s&&=(ss(this.#s),null),D&&(na(this.#t),ia(),na(aa()));let t=this.#n.failed,n=e=>{if(this.#v())return;let{reset:n,invoke_onerror:r}=this.#_(e);r(),t&&!this.#v()&&(this.#s=this.#S(()=>{try{return rs(()=>{var r=F;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return Uo(e,this.#i.parent),null}}))};ka(()=>{if(!this.#v()){var t;try{t=this.transform_error(e)}catch(e){Uo(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>Uo(e,this.#i&&this.#i.parent)):n(t)}})}};function fc(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[Gi]??=e.nodeValue)&&(e[Gi]=n,e.nodeValue=`${n}`)}function pc(e,t){return hc(e,t)}var mc=new Map;function hc(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){Mo();var c=void 0,l=Zo(()=>{var o=n??t.appendChild(No());uc(o,{pending:()=>{}},t=>{Ca({});var n=xa;if(a&&(n.c=a),i&&(r.$$events=i),D&&ic(t,null),c=e(t,r)||Ta(),D&&(F.nodes.end=O,O===null||O.nodeType!==8||O.data!==`]`))throw $i(),Yi;wa()},s);var l=new Set,u=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!l.has(r)){l.add(r);var i=Gs(r);for(let e of[t,document]){var a=mc.get(e);a===void 0&&(a=new Map,mc.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,ec,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return u(pi(qs)),Js.add(u),()=>{for(var e of l)for(let n of[t,document]){var r=mc.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,ec),r.delete(e),r.size===0&&mc.delete(n)):r.set(e,i)}Js.delete(u),o!==n&&o.parentNode?.removeChild(o)}});return gc.set(c,l),c}var gc=new WeakMap;function _c(e,t){let n=gc.get(e);return n?(gc.delete(e),n(t)):Promise.resolve()}var vc=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)fs(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(fs(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(ss(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();ms(r,t),t.append(No()),this.#n.set(e,{effect:r,fragment:t})}else ss(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),us(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(ss(n.effect),this.#n.delete(e))};ensure(e,t){var n=A,r=zo();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=No();i.append(a),this.#n.set(e,{effect:rs(()=>t(a)),fragment:i})}else this.#t.set(e,rs(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else D&&(this.anchor=O),this.#a(n)}};function yc(e,t,n=!1){var r;D&&(r=O,ra());var i=new vc(e),a=n?Mi:0;function o(e,t){if(D){var n=oa(r);if(e!==parseInt(n.substring(1))){var a=aa();na(a),i.anchor=a,ta(!1),i.ensure(e,t),ta(!0);return}}i.ensure(e,t)}ns(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function bc(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let n=t[s];us(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;xc(e,pi(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else--o},!1)}if(o===0){var c=r.length===0&&n!==null&&e.pending.size===0;if(c){var l=n,u=l.parentNode;Ro(u),u.append(l),e.items.clear()}xc(e,t,!c)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function xc(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=Fi,ms(a,document.createDocumentFragment())):ss(t[i],n)}}var Sc;function Cc(e,t,n,r,i,a=null){var o=e,s=new Map;if(t&4){var c=e;o=D?na(Po(c)):c.appendChild(No())}D&&ra();var l=null,u=Ga(()=>{var e=n();return ui(e)?e:e==null?[]:pi(e)}),d=new Map,f=!0;function p(e){if(!(h.effect.f&16384)){h.pending.delete(e);var n=I(u);h.fallback=l,Tc(h,n,o,t,r),l!==null&&(n.length===0?l.f&33554432?(l.f^=Fi,Dc(l,null,o)):fs(l):us(l,()=>{l=null}))}}function m(e){h.pending.delete(e)}var h={effect:ns(()=>{var e=I(u),c=e.length;let h=!1;D&&oa(o)===`[!`!=(c===0)&&(o=aa(),na(o),ta(!1),h=!0);for(var g=new Set,_=A,v=zo(),y=0;y<c;y+=1){D&&O.nodeType===8&&O.data===`]`&&(o=O,h=!0,ta(!1));var b=e[y],ee=r(b,y),x=f?null:s.get(ee);x?(x.v&&Co(x.v,b),x.i&&Co(x.i,y),v&&_.unskip_effect(x.e)):(x=Ec(s,f?o:Sc??=No(),b,ee,y,i,t,n),f||(x.e.f|=Fi),s.set(ee,x)),g.add(ee)}if(c===0&&a&&!l&&(f?l=rs(()=>a(o)):(l=rs(()=>a(Sc??=No())),l.f|=Fi)),c>g.size&&fa(``,``,``),D&&c>0&&na(aa()),!f){if(d.set(_,g),v){for(let[e,t]of s)g.has(e)||_.skip_effect(t.e);_.oncommit(p),_.ondiscard(m)}else p(_)}h&&ta(!0),I(u)}),flags:t,items:s,pending:d,outrogroups:null,fallback:l};f=!1,D&&(o=O)}function wc(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Tc(e,t,n,r,i){var a=!!(r&8),o=t.length,s=e.items,c=wc(e.effect.first),l,u=null,d,f=[],p=[],m,h,g,_;if(a)for(_=0;_<o;_+=1)m=t[_],h=i(m,_),g=s.get(h).e,g.f&33554432||(g.nodes?.a?.measure(),(d??=new Set).add(g));for(_=0;_<o;_+=1){if(m=t[_],h=i(m,_),g=s.get(h).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(g),t.done.delete(g);if(g.f&8192&&(fs(g),a&&(g.nodes?.a?.unfix(),(d??=new Set).delete(g))),g.f&33554432){if(g.f^=Fi,g===c)Dc(g,null,n);else{var v=u?u.next:c;g===e.effect.last&&(e.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),Oc(e,u,g),Oc(e,g,v),Dc(g,v,n),u=g,f=[],p=[],c=wc(u.next);continue}}if(g!==c){if(l!==void 0&&l.has(g)){if(f.length<p.length){var y=p[0],b;u=y.prev;var ee=f[0],x=f[f.length-1];for(b=0;b<f.length;b+=1)Dc(f[b],y,n);for(b=0;b<p.length;b+=1)l.delete(p[b]);Oc(e,ee.prev,x.next),Oc(e,u,ee),Oc(e,x,y),c=y,u=x,--_,f=[],p=[]}else l.delete(g),Dc(g,c,n),Oc(e,g.prev,g.next),Oc(e,g,u===null?e.effect.first:u.next),Oc(e,u,g),u=g;continue}for(f=[],p=[];c!==null&&c!==g;)(l??=new Set).add(c),p.push(c),c=wc(c.next);if(c===null)continue}g.f&33554432||f.push(g),u=g,c=wc(g.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(xc(e,pi(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(c!==null||l!==void 0){var S=[];if(l!==void 0)for(g of l)g.f&8192||S.push(g);for(;c!==null;)!(c.f&8192)&&c!==e.fallback&&S.push(c),c=wc(c.next);var te=S.length;if(te>0){var C=r&4&&o===0?n:null;if(a){for(_=0;_<te;_+=1)S[_].nodes?.a?.measure();for(_=0;_<te;_+=1)S[_].nodes?.a?.fix()}bc(e,S,C)}}a&&ka(()=>{if(d!==void 0)for(g of d)g.nodes?.a?.apply()})}function Ec(e,t,n,r,i,a,o,s){var c=o&1?o&16?vo(n):bo(n,!1,!1):null,l=o&2?vo(i):null;return{v:c,i:l,e:rs(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Dc(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=Fo(r);if(a.before(r),r===i)return;r=o}}function Oc(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function kc(e,t,n){Qo(()=>{var r=Vs(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};es(()=>{var e=n();Hs(e),i&&ca(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function Ac(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ac(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function jc(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ac(e))&&(r&&(r+=` `),r+=t);return r}function z(e){return typeof e==`object`?jc(e):e??``}var Mc=[...`
|
|
3
|
+
`))}}v()}return(async()=>{try{let e=await o(c,{headers:{accept:`text/event-stream`},signal:u.signal});if(!e.ok||!e.body)throw Error(`Devframe SSE stream request failed: ${e.status}`);await b(e.body)}catch(e){if(u.signal.aborted){v();return}_(e instanceof Error?e:Error(String(e)))}})(),{close:()=>{d=!0,u.abort(),p?.cancel().catch(()=>{})},on:e=>{f=e},post:async e=>{let t;try{t=await g}catch{return}if(d)n(Error(`Devframe SSE channel is closed; message dropped`));else try{let n=await o(c,{method:`POST`,headers:{"content-type":`text/plain; charset=utf-8`,[r]:t},body:e});if(n.status===200){let e=await n.text();e&&f?.(e);return}if(!n.ok)throw Error(`Devframe SSE POST failed: ${n.status}`)}catch(e){n(e instanceof Error?e:Error(String(e)))}},serialize:l.serialize,deserialize:l.deserialize}}function Qn(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var $n=Math.random.bind(Math),er=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function tr(e=21){let t=``,n=e;for(;n--;)t+=er[$n()*64|0];return t}var nr=6e4,rr=e=>e,ir=rr,{clearTimeout:ar,setTimeout:or}=globalThis;function sr(e,t){let{post:n,on:r,off:i=()=>{},eventNames:a=[],serialize:o=rr,deserialize:s=ir,resolver:c,bind:l=`rpc`,timeout:u=nr,proxify:d=!0}=t,f=!1,p=new Map,m,h;async function g(e,r,i,a){if(f)throw Error(`[birpc] rpc is closed, cannot call "${e}"`);let s={m:e,a:r,t:`q`};a&&(s.o=!0);let c=async e=>n(o(e));if(i){await c(s);return}if(m)try{await m}finally{m=void 0}let{promise:l,resolve:d,reject:g}=Qn(),_=tr();s.i=_;let v;async function y(n=s){return u>=0&&(v=or(()=>{try{if(t.onTimeoutError?.call(h,e,r)!==!0)throw Error(`[birpc] timeout on calling "${e}"`)}catch(e){g(e)}p.delete(_)},u),typeof v==`object`&&(v=v.unref?.())),p.set(_,{resolve:d,reject:g,timeoutId:v,method:e}),await c(n),l}try{t.onRequest?await t.onRequest.call(h,s,y,d):await y()}catch(e){if(t.onGeneralError?.call(h,e)!==!0)throw e;return}finally{ar(v),p.delete(_)}return l}let _={$call:(e,...t)=>g(e,t,!1),$callOptional:(e,...t)=>g(e,t,!1,!0),$callEvent:(e,...t)=>g(e,t,!0),$callRaw:e=>g(e.method,e.args,e.event,e.optional),$rejectPendingCalls:y,get $closed(){return f},get $meta(){return t.meta},$close:v,$functions:e};h=d?new Proxy({},{get(t,n){if(Object.hasOwn(_,n))return _[n];if(n===`then`&&!a.includes(`then`)&&!(`then`in e))return;let r=(...e)=>g(n,e,!0);if(a.includes(n))return r.asEvent=r,r;let i=(...e)=>g(n,e,!1);return i.asEvent=r,i}}):_;function v(e){f=!0,p.forEach(({reject:t,method:n})=>{let r=Error(`[birpc] rpc is closed, cannot call "${n}"`);if(e)return e.cause??=r,t(e);t(r)}),p.clear(),i(b)}function y(e){let t=Array.from(p.values()).map(({method:t,reject:n})=>e?e({method:t,reject:n}):n(Error(`[birpc]: rejected pending call "${t}".`)));return p.clear(),t}async function b(r,...i){let a;try{a=s(r)}catch(e){if(t.onGeneralError?.call(h,e)!==!0)throw e;return}if(a.t===`q`){let{m:r,a:s,o:u}=a,d,f,p=await(c?c.call(h,r,e[r]):e[r]);if(u&&(p||=()=>void 0),!p)f=Error(`[birpc] function "${r}" not found`);else try{d=await p.apply(l===`rpc`?h:e,s)}catch(e){f=e}if(a.i){if(f&&t.onFunctionError&&t.onFunctionError.call(h,f,r,s)===!0)return;if(!f)try{await n(o({t:`s`,i:a.i,r:d}),...i);return}catch(e){if(f=e,t.onGeneralError?.call(h,e,r,s)!==!0)throw e}try{await n(o({t:`s`,i:a.i,e:f}),...i)}catch(e){if(t.onGeneralError?.call(h,e,r,s)!==!0)throw e}}}else{let{i:e,r:t,e:n}=a,r=p.get(e);r&&(ar(r.timeoutId),n?r.reject(n):r.resolve(t)),p.delete(e)}}return m=r(b),h}function cr(e,t){let{channel:n,rpcOptions:r={}}=t;return sr(e,{...n,timeout:-1,...r,proxify:!1})}function lr(t){let{transport:n,authToken:r,connectionMeta:i,events:a,clientRpc:o,rpcOptions:s={},callTimeout:c=0}=t,l=!1,u=`connecting`,d=null,f=Promise.withResolvers();function p(t,n=null){if(n?d=n:t===`connected`&&(d=null),t===u)return;let r=u;u=t,a.emit(e.client.connectionStatus,t,r)}let m=new Set;function h(e){for(let t of[...m])t.reject(e)}function g(){return u===`disconnected`||u===`error`?new ze(`connection`,`[devframe] Not connected to the devframe server`,{cause:d??void 0}):u===`unauthorized`?new ze(`auth`,`[devframe] Not authorized by the devframe server`,{cause:d??void 0}):null}function _(t,n){return new Promise((r,i)=>{let o=!1,s,l={reject(t){o||(u(),a.emit(e.client.error,t,n),i(t))}};function u(){o=!0,m.delete(l),s&&clearTimeout(s)}m.add(l),c>0&&(s=setTimeout(()=>{l.reject(new ze(`timeout`,`[devframe] RPC call "${n}" timed out after ${c}ms`))},c)),t.then(e=>{o||(u(),r(e))},t=>{if(o)return;u();let r=t instanceof Error?t:Error(String(t));a.emit(e.client.error,r,n),i(r)})})}let v=new Map;for(let e of i.jsonSerializableMethods??[])v.set(e,{jsonSerializable:!0});let y=t.createChannel({definitions:v,onError(t){p(`error`,t),a.emit(e.client.connectionError,t),h(new ze(`connection`,`[devframe] Connection to the devframe server failed`,{cause:t}))},onDisconnected(){u!==`error`&&p(`disconnected`),h(new ze(`connection`,`[devframe] Disconnected from the devframe server`,{cause:d??void 0}))}}),b=cr(o.functions,{channel:y,rpcOptions:s});o.register({name:e.broadcast.authRevoked,type:`event`,handler:()=>{l=!1;let t=new ze(`auth`,`[devframe] The devframe server revoked this client's trust`);p(`unauthorized`,t),a.emit(e.client.connectionError,t),h(t),a.emit(e.client.isTrustedUpdated,!1)}});let ee=r;async function x(t){ee=t;let n=await b.$call(`anonymous:devframe:auth`,{authToken:t,ua:navigator.userAgent,origin:location.origin});if(l=n.isTrusted,l)f.resolve(!0),p(`connected`);else{let t=new ze(`auth`,`[devframe] The devframe server refused this client's credentials`);p(`unauthorized`,t),a.emit(e.client.connectionError,t)}return a.emit(e.client.isTrustedUpdated,l),n.isTrusted}async function S(t){let n=(await b.$call(`anonymous:devframe:auth:exchange`,{code:t,ua:navigator.userAgent,origin:location.origin}))?.authToken??null;return n&&(ee=n,l=!0,f.resolve(!0),p(`connected`),a.emit(e.client.isTrustedUpdated,!0)),n}async function te(e={}){await b.$call(`anonymous:devframe:auth:request-code`,{ua:navigator.userAgent,origin:location.origin,...e.reissue?{reissue:!0}:{}})}async function C(){return l?!0:x(ee??``)}async function ne(e=6e4){if(l&&f.resolve(!0),e<=0)return f.promise;let t;try{return await Promise.race([f.promise,new Promise((n,r)=>{t=setTimeout(()=>{r(Error(`[devframe] Timeout waiting for rpc to be trusted`))},e)})]),l}finally{clearTimeout(t)}}return{transport:n,get isTrusted(){return l},get status(){return u},get connectionError(){return d},requestTrust:C,requestTrustWithToken:x,requestTrustWithCode:S,requestAuthCode:te,ensureTrusted:ne,call:(...t)=>{let n=String(t[0]),r=g();return r?(a.emit(e.client.error,r,n),Promise.reject(r)):_(b.$call(...t),n)},callEvent:(...t)=>{let n=g();if(n)a.emit(e.client.error,n,String(t[0]));else return b.$callEvent(...t)},callOptional:(...t)=>{let n=String(t[0]),r=g();return r?(a.emit(e.client.error,r,n),Promise.reject(r)):_(b.$callOptional(...t),n)},close:()=>{y.close()}}}function ur(e,t,n){let r=(()=>{try{return new URL(t,n.href)}catch{return new URL(n.href)}})();if(e&&typeof e==`object`){if(e.host!=null||e.port!=null){let t=e.host??`${r.hostname}:${e.port}`;return new URL(e.path??`/`,`${r.protocol}//${t}`).href}return new URL(e.path??``,r).href}let i=e??``;return/^https?:\/\//i.test(i)?i:new URL(i,r).href}function dr(e){let{authToken:t,connectionMeta:n,metaBaseUrl:r,events:i,clientRpc:a,rpcOptions:o={},sseOptions:s={},callTimeout:c=0}=e,l=ur(n.sse,r??`./`,location);return lr({transport:`sse`,authToken:t,connectionMeta:n,events:i,clientRpc:a,rpcOptions:o,callTimeout:c,createChannel:e=>Zn({url:l,authToken:t,definitions:e.definitions,...s,onConnected(){s.onConnected?.()},onError(t){e.onError(t),s.onError?.(t)},onDisconnected(){e.onDisconnected(),s.onDisconnected?.()}})})}function fr(e){let{name:t,message:n,cause:r,...i}=e,a=r instanceof Error?r:pr(r)?fr(r):r,o=a===void 0?Error(n):Error(n,{cause:a});return o.name=t,Object.assign(o,i),o}function pr(e){return typeof e==`object`&&!!e&&typeof e.message==`string`&&typeof e.name==`string`}function mr(e){return typeof e==`object`&&!!e&&e.type===`static`&&typeof e.path==`string`}function hr(e){return typeof e==`object`&&!!e&&e.type===`query`&&typeof e.records==`object`&&e.records!==null}function gr(e){return typeof e==`object`&&!!e&&(`output`in e||`error`in e)}function _r(e){if(e.error)throw fr(e.error);return e.output}function vr(e){return e.some(e=>e!=null)}function yr(e){return typeof e==`object`&&e&&`serialization`in e&&`data`in e?e.data:e}function br(e,t){let n=new Map,r=new Map;function i(e,t){return t===`structured-clone`&&Array.isArray(e)?Un(e):e}function a(e,t){return i(yr(e),t)}async function o(e){n.has(e.path)||n.set(e.path,t(e.path).then(t=>a(t,e.serialization)));let r=await n.get(e.path);return gr(r)?_r(r):r}async function s(e,n){return r.has(e)||r.set(e,t(e).then(e=>a(e,n))),await r.get(e)}async function c(t,n){if(!(t in e))throw Error(`[devframe-rpc] Function "${t}" not found in dump store`);let r=e[t];if(mr(r)){if(vr(n))throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);return await o(r)}if(hr(r)){let e=ee(n),i=r.records[e];if(i)return _r(await s(i,r.serialization));if(r.fallback)return _r(await s(r.fallback,r.serialization));throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}if(!vr(n))return r;throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}return{call:async(e,t)=>await c(e,t),callOptional:async(t,n)=>{if(t in e)return await c(t,n)},callEvent:async(e,t)=>{}}}async function xr(e){let t=br(await e.fetchJsonFromBases(i),e.fetchJsonFromBases);return{transport:`static`,isTrusted:!0,status:`connected`,connectionError:null,requestTrust:async()=>!0,requestTrustWithToken:async()=>!0,requestTrustWithCode:async()=>null,requestAuthCode:async()=>{},ensureTrusted:async()=>!0,call:(...e)=>t.call(e[0],e.slice(1)),callEvent:(...e)=>t.callEvent(e[0],e.slice(1)),callOptional:(...e)=>t.callOptional(e[0],e.slice(1)),close:()=>{}}}var Sr=256,Cr=class extends Error{name=`StreamClosedError`};function wr(e={}){let t=e.id??Ke(),n=Math.max(0,e.replayWindow??0),r=be(),i=new AbortController,a=[],o=!1,s=0;function c(e){if(o)throw new Cr(`Cannot write to a closed stream "${t}"`);s+=1,n>0&&(a.push({seq:s,chunk:e}),a.length>n&&(a.length-n===1?a.shift():a.splice(0,a.length-n))),r.emit(`chunk`,s,e)}function l(e){if(o)return;o=!0;let t=Er(e);i.abort(e),r.emit(`end`,t)}function u(){o||(o=!0,i.signal.aborted||i.abort(`stream closed`),r.emit(`end`,void 0))}function d(e){o||i.signal.aborted||i.abort(e??`aborted`)}let f=new WritableStream({write(e){c(e)},close(){u()},abort(e){l(e)}});return{id:t,signal:i.signal,get closed(){return o},get lastSeq(){return s},write:c,error:l,close:u,abort:d,writable:f,events:r,buffer:a}}function Tr(e={}){let t=e.id??Ke(),n=Math.max(1,e.highWaterMark??Sr),r=[],i=0,a=!1,o=!1,s,c,l,u;function d(){if(c){if(r.length>0){let e=r.shift(),t=c;c=void 0,t.resolve({value:e,done:!1})}else if(a){let e=c;if(c=void 0,s){let t=Error(s.message);t.name=s.name,e.reject(t)}else e.resolve({value:void 0,done:!0})}}}function f(){if(l){for(;r.length>0;){let e=r.shift();try{l.enqueue(e)}catch{break}}if(a&&l){try{if(s){let e=Error(s.message);e.name=s.name,l.error(e)}else l.close()}catch{}l=void 0}}}function p(t,s){if(!(a||o)&&!(t<=i)){if(i=t,r.push(s),r.length>n){let t=r.length-n;r.splice(0,t),e.onOverflow?.(t)}d(),u&&f()}}function m(e){a||(a=!0,s=e,d(),u&&f())}function h(){o||a||(o=!0,e.onCancel?.(),m(void 0))}function g(){return u||(u=new ReadableStream({start(e){l=e,f()},cancel(){h()}}),u)}return{id:t,get cancelled(){return o},get done(){return a},get lastSeenSeq(){return i},get readable(){return g()},cancel:h,_push:p,_end:m,[Symbol.asyncIterator](){return{next(){if(r.length>0)return Promise.resolve({value:r.shift(),done:!1});if(a){if(s){let e=Error(s.message);return e.name=s.name,Promise.reject(e)}return Promise.resolve({value:void 0,done:!0})}return new Promise((e,t)=>{c={resolve:e,reject:t}})},return(){return h(),Promise.resolve({value:void 0,done:!0})}}}}}function Er(e){if(e instanceof Error)return{name:e.name||`Error`,message:e.message};if(typeof e==`string`)return{name:`Error`,message:e};try{return{name:`Error`,message:JSON.stringify(e)}}catch{return{name:`Error`,message:String(e)}}}var Dr=``;function Or(e,t){return`${e}${Dr}${t}`}function kr(t){let n=new Map,r=new Map;t.client.register({name:e.broadcast.streamingChunk,type:`event`,handler(e,t,r,i){n.get(Or(e,t))?._push(r,i)}}),t.client.register({name:e.broadcast.streamingEnd,type:`event`,handler(e,t,r){let i=Or(e,t),a=n.get(i);a&&(a._end(r),n.delete(i))}}),t.client.register({name:e.broadcast.streamingUploadCancel,type:`event`,handler(e,t){let n=Or(e,t),i=r.get(n);i&&(i.abort(`server cancelled upload`),r.delete(n))}}),t.events.on(e.client.isTrustedUpdated,e=>{if(e)for(let[e,r]of n){if(r.cancelled||r.done)continue;let n=e.indexOf(Dr);if(n<0)continue;let i=e.slice(0,n),a=e.slice(n+1);t.callEvent(`devframe:streaming:subscribe`,i,a,{afterSeq:r.lastSeenSeq})}});function i(r,i,a={}){let o=Or(r,i),s=n.get(o);if(s)return s;let c=Tr({id:i,highWaterMark:a.highWaterMark,onOverflow(e){console.warn(`[devframe] DF0029: Stream "${r}#${i}" dropped ${e} chunk(s) after exceeding the client high-water mark.`)},onCancel(){t.callEvent(`devframe:streaming:cancel`,r,i),n.delete(o)}});if(n.set(o,c),t.isTrusted)t.callEvent(`devframe:streaming:subscribe`,r,i,{afterSeq:0});else{let a=t.events.on(e.client.isTrustedUpdated,e=>{e&&(a(),n.has(o)&&!c.cancelled&&!c.done&&t.callEvent(`devframe:streaming:subscribe`,r,i,{afterSeq:c.lastSeenSeq}))})}return c}function a(e,n){let i=Or(e,n),a=r.get(i);if(a)return a;let o=wr({id:n});return o.events.on(`chunk`,(r,i)=>{t.callEvent(`devframe:streaming:upload-chunk`,e,n,r,i)}),o.events.on(`end`,a=>{t.callEvent(`devframe:streaming:upload-end`,e,n,a),r.delete(i)}),r.set(i,o),o}return{subscribe:i,upload:a}}function Ar(){}var jr=new Map;function Mr(e){let t=e.url;e.authToken&&(t=`${t}?${s}=${encodeURIComponent(e.authToken)}`);let n=new WebSocket(t),{onConnected:r=Ar,onError:i=Ar,onDisconnected:a=Ar,definitions:o=jr}=e;n.addEventListener(`open`,e=>{r(e)}),n.addEventListener(`error`,e=>{let t=e instanceof Error?e:Error(e.type);i(t)}),n.addEventListener(`close`,e=>{a(e)});let c=qn(o);return{close:()=>{n.close()},on:e=>{n.addEventListener(`message`,t=>{e(t.data)})},post:e=>{if(n.readyState===WebSocket.OPEN)n.send(e);else if(n.readyState===WebSocket.CONNECTING){let t=()=>{i(),n.readyState===WebSocket.OPEN&&n.send(e)},r=()=>i();function i(){n.removeEventListener(`open`,t),n.removeEventListener(`close`,r)}n.addEventListener(`open`,t),n.addEventListener(`close`,r)}else i(Error(`Devframe WebSocket is not open; message dropped`))},serialize:c.serialize,deserialize:c.deserialize}}function Nr(e,t,n){let r=(()=>{try{return new URL(t,n.href)}catch{return new URL(n.href)}})(),i=r.protocol===`https:`?`wss:`:`ws:`;if(e&&typeof e==`object`){if(e.host!=null||e.port!=null){let t=e.host??`${r.hostname}:${e.port}`,n=new URL(e.path??`/`,`${i}//${t}`);return n.protocol=i,n.href}let t=new URL(e.path??``,r);return t.protocol=i,t.href}if(typeof e==`number`)return`${i}//${r.hostname}:${e}`;let a=e??``;if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a))return Ee(a,/^https/i.test(a)?`wss://`:`ws://`);let o=new URL(a,r);return o.protocol=i,o.href}function Pr(e){let{authToken:t,connectionMeta:n,metaBaseUrl:r,events:i,clientRpc:a,rpcOptions:o={},wsOptions:s={},callTimeout:c=0}=e,l=Nr(n.websocket,r??`./`,location);return lr({transport:`websocket`,authToken:t,connectionMeta:n,events:i,clientRpc:a,rpcOptions:o,callTimeout:c,createChannel:e=>Mr({url:l,authToken:t,definitions:e.definitions,...s,onConnected(e){s.onConnected?.(e)},onError(t){e.onError(t),s.onError?.(t)},onDisconnected(t){e.onDisconnected(),s.onDisconnected?.(t)}})})}function Fr(e){return e.includes(`:`)}function Ir(e,t){return Fr(t)?t:`${e}:${t}`}function Lr(e){return{async get(t){return(await e()).value()?.[t]},async set(t,n){(await e()).mutate(e=>{if(e===void 0)return{[t]:n};e[t]=n})},async delete(t){(await e()).mutate(e=>{e!==void 0&&delete e[t]})},async all(){return(await e()).value()??{}},async onChange(t){return(await e()).on(`updated`,e=>t(e??{}))}}}function Rr(e,t,n){let r=`devframe:settings:${n}:${t}`,i;function a(){return i||=(async()=>(await e.ensureTrusted(),e.sharedState.get(r)))().catch(e=>{throw i=void 0,e}),i}return Lr(a)}function zr(e,t){return{global:Rr(e,t,`global`),project:Rr(e,t,`project`)}}function Br(e,t){return{namespace:t,base:e,rpc:{namespace:t,register(n){if(Fr(n.name))throw Error(`[devframe] Scoped client RPC registration for namespace "${t}" received an already-namespaced function name "${n.name}". Pass a bare name without a ":" separator.`);e.client.register({...n,name:`${t}:${n.name}`})},call:((n,...r)=>e.call(Ir(t,n),...r)),callEvent:((n,...r)=>e.callEvent(Ir(t,n),...r)),callOptional:((n,...r)=>e.callOptional(Ir(t,n),...r)),sharedState:((n,r)=>e.sharedState.get(Ir(t,n),r)),streaming:{subscribe:(n,r,i)=>e.streaming.subscribe(Ir(t,n),r,i),upload:(n,r)=>e.streaming.upload(Ir(t,n),r)}},settings:zr(e,t),scope:e.scope}}var Vr=128;function Hr(e){return e.replace(/[^\w-]+/g,`_`).slice(0,Vr)}function Ur(e,t){return t.safety?t.safety:e===`static`||e===`query`||e==null?`read`:`action`}var Wr=Object.freeze({type:`object`,additionalProperties:!0});function Gr(e){let t=e[`~standard`];if(t.jsonSchema)try{return t.jsonSchema.input({target:`draft-2020-12`})}catch{return Wr}return Wr}function Kr(e){if(!e||e.length===0)return{type:`object`,properties:{}};let t={},n=[];for(let r=0;r<e.length;r++){let i=`arg${r}`;t[i]=Gr(e[r]),n.push(i)}return{type:`object`,properties:t,required:n,additionalProperties:!1}}function qr(e,t){if(Array.isArray(e))return e;if(e==null)return[];if(typeof e!=`object`)return;let n=e;if(t!=null)return Array.from({length:t},(e,t)=>n[`arg${t}`]);if(`arg0`in n){let e=[];for(;`arg${e.length}`in n;)e.push(n[`arg${e.length}`]);return e}return Object.keys(n).length===0?[]:void 0}function Jr(e,t){return qr(e,t)??[e]}function Yr(){if(typeof document<`u`){let e=document.modelContext;if(e)return e}if(typeof navigator<`u`){let e=navigator.modelContext;if(e)return e}}function Xr(e,t={}){let n=t.modelContext??Yr();if(!n)return()=>{};let r=n,i=new Map,a=new Map;function o(t,n){let o=Hr(t.name),s=a.get(o);if(s&&s!==t.name){console.warn(`[devframe] WebMCP tool name "${o}" (from "${t.name}") collides with "${s}"; keeping the first registration.`);return}let c=new AbortController,l=Ur(t.type,n),u=r.registerTool({name:o,description:n.description,inputSchema:Kr(t.args),annotations:{title:n.title??t.name,readOnlyHint:l===`read`,destructiveHint:l===`destructive`},execute:n=>Zr(t,e.context,n)},{signal:c.signal});u&&`then`in u&&u.then(()=>{},()=>{}),a.set(o,t.name),i.set(t.name,()=>{c.abort(),u&&`unregister`in u&&typeof u.unregister==`function`&&u.unregister(),a.delete(o)})}function s(t){let n=t?[t]:[...e.definitions.keys()];for(let t of n){i.get(t)?.(),i.delete(t);let n=e.definitions.get(t),r=n?.agent;n&&r&&o(n,r)}}s();let c=e.onChanged(e=>s(e));return()=>{c();for(let e of i.values())e();i.clear()}}async function Zr(e,t,n){try{let r=Jr(n,e.args?.length);return{content:[{type:`text`,text:Qr(await(await me(e,t))(...r))}]}}catch(e){return{isError:!0,content:[{type:`text`,text:$r(e)}]}}}function Qr(e){return e===void 0?`undefined`:typeof e==`string`?e:JSON.stringify(e,null,2)}function $r(e){if(!(e instanceof Error))return String(e);let t=e.cause instanceof Error?` (cause: ${e.cause.message})`:``;return`${e.name}: ${e.message}${t}`}var ei=`modulepreload`,ti=function(e,t){return new URL(e,t).href},ni={},ri=function(e){return e.pathname.endsWith(`.css`)},ii=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},ai=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=ti(t,n);let r=s(t),i=ri(r);return ii(ni,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:ei,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function oi(e,t){if(t.backend===`static`)return`static`;let n=t.websocket!==void 0,r=t.sse!==void 0;if(e===`websocket`){if(!n)throw Error(`[devframe] transport: 'websocket' was requested, but this server does not advertise a WebSocket endpoint`);return`websocket`}if(e===`sse`){if(!r)throw Error(`[devframe] transport: 'sse' was requested, but this server does not advertise an SSE endpoint`);return`sse`}if(t.backend===`sse`&&r)return`sse`;if(n)return`websocket`;if(r)return`sse`;throw Error(`[devframe] This server advertises no RPC transport (backend "none"), so there is nothing to connect to. Enable the WebSocket or SSE endpoint on the server, or use its static/MCP surfaces instead.`)}async function si(t={}){let{baseURL:n=`./`,rpcOptions:r={},cacheOptions:i=!1}=t,a=be(),o=Array.isArray(n)?n:[n],s=await Re(t),{connectionMeta:c,metaBaseUrl:l,authToken:u}=s,d=o[0]??`./`;try{d=new URL(`.`,l).href}catch{}let f=new x({functions:[],...typeof t.cacheOptions==`object`?t.cacheOptions:{}}),p={rpc:void 0},m=new he(p),h=t.webmcp===!1?void 0:Xr(m),g,_=!1,v=0,y;function b(){v++,y=void 0,f.clear(),i===!0&&f.updateOptions({functions:[]})}i&&(m.register({name:e.broadcast.cacheInvalidate,type:`event`,handler:b}),a.on(e.client.connectionStatus,b),a.on(e.client.isTrustedUpdated,b));async function ee(e){let t=[d,...o.filter(e=>e!==d)].filter(e=>e!=null),n=[];for(let r of t)try{return await fetch(Te(e,r)).then(t=>{if(!t.ok)throw Error(`Failed to fetch ${e} from ${r}: ${t.status}`);return t.json()})}catch(e){n.push(e)}throw Error(`Failed to load ${e} from ${t.join(`, `)}`,{cause:n})}let S=t.callTimeout??0,te=S>0?S:1/0,C,ne={authToken:u,connectionMeta:c,metaBaseUrl:l,events:a,clientRpc:m,callTimeout:t.callTimeout,rpcOptions:{...r,async onRequest(e,t,n){let a=performance.now()+te;if(await r.onRequest?.call(this,e,t,n),i===!0&&e.i&&C.isTrusted&&!e.m.startsWith(`anonymous:`)&&e.m!==`devframe:rpc:cacheable-functions`){function t(){if(performance.now()>=a)throw new ze(`timeout`,`[devframe] RPC call "${e.m}" timed out after ${S}ms`)}for(;!y&&(t(),!(_||C.status!==`connected`));){let e=v;y=C.callOptional(`devframe:rpc:cacheable-functions`).then(t=>{e===v&&f.updateOptions({functions:t??[]})}).catch(t=>{throw e===v&&(y=void 0),t}),await y}await y,t()}let o=v;if(i&&e.i&&!_&&C.isTrusted&&f.validate(e.m)){if(f.has(e.m,e.a))return n(f.cached(e.m,e.a));let r=await t(e);o===v&&!_&&f.apply(e,r)}else await t(e)}}},w=oi(t.transport??`auto`,c);C=w===`static`?await xr({fetchJsonFromBases:ee}):w===`sse`?dr({...ne,sseOptions:t.sseOptions}):Pr({...ne,wsOptions:t.wsOptions});let re;try{re=new BroadcastChannel(`devframe-auth`)}catch{}let T,ie=!1;function ae(e){return((...t)=>ie||!T?e(...t):T.then(()=>e(...t)))}function oe(){_=!0,b();try{g?.(),h?.()}finally{try{re?.close()}finally{C.close?.()}}}let E={events:a,get isTrusted(){return C.isTrusted},get status(){return C.status},get connectionError(){return C.connectionError},get transport(){return C.transport??w},get connection(){return s},connectionMeta:c,ensureTrusted:C.ensureTrusted,requestTrust:C.requestTrust,requestTrustWithToken:async e=>(Pe(e),s={...s,authToken:e},C.requestTrustWithToken(e)),requestTrustWithCode:async e=>{let t=await C.requestTrustWithCode(e);if(!t)return!1;Pe(t),s={...s,authToken:t};try{re?.postMessage({type:`auth-update`,authToken:t})}catch{}return!0},requestAuthCode:e=>C.requestAuthCode(e),call:ae(C.call),callEvent:ae(C.callEvent),callOptional:ae(C.callOptional),client:m,sharedState:void 0,services:void 0,streaming:void 0,cacheManager:f,scope:void 0,close:oe};E.sharedState=Tn(E),E.streaming=kr(E),E.services=We(E);let se=new Map;E.scope=(e=>{if(!e)return E;let t=se.get(e);return t||(t=Br(E,e),se.set(e,t)),t}),p.rpc=E;function ce(){try{return typeof window<`u`&&window.self===window.top}catch{return!1}}async function le(){if(t.simpleAuth!==!1&&ce()&&typeof globalThis.prompt==`function`)for(await E.requestAuthCode().catch(()=>{});!E.isTrusted;){let e=globalThis.prompt(`devframe: enter the authentication code shown in your terminal`);if(e==null)return;let t=e.trim();if(t&&await E.requestTrustWithCode(t))return}}async function ue(){let e=await C.requestTrust(),n=t.otpParam??`devframe_otp`,r=n?await Ue(E,{param:n}):!1;e||r||E.isTrusted||await le()}return T=ue().then(()=>{ie=!0},()=>{ie=!0}),c.mcp&&ai(async()=>{let{setupBrowserAgentRpcBridge:e}=await import(`./browser-agent-rpc-BxdJZuMS.js`);return{setupBrowserAgentRpcBridge:e}},[],import.meta.url).then(({setupBrowserAgentRpcBridge:e})=>{_||(g=e(E))}).catch(()=>{}),re&&(re.onmessage=e=>{e.data?.type===`auth-update`&&e.data.authToken&&E.requestTrustWithToken(e.data.authToken)}),E}var ci=si;function li(){if(window.parent===window)return()=>{};let e=document.documentElement,t=e.style.getPropertyValue(`--devframe-primary`),n=e.style.getPropertyPriority(`--devframe-primary`),r=!1,i=!1;return Re().then(({connectionMeta:t})=>{let n=t.configs?.ui?.branding?.primaryColor;!r&&n&&CSS.supports(`color`,n)&&(e.style.setProperty(`--devframe-primary`,n),i=!0)}).catch(()=>{}),()=>{r=!0,i&&(t?e.style.setProperty(`--devframe-primary`,t,n):e.style.removeProperty(`--devframe-primary`))}}var ui=Array.isArray,di=Array.prototype.indexOf,fi=Array.prototype.includes,pi=Array.from,mi=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,gi=Object.getOwnPropertyDescriptors,_i=Object.prototype,vi=Array.prototype,yi=Object.getPrototypeOf,bi=Object.isExtensible,xi=()=>{};function Si(e){for(var t=0;t<e.length;t++)e[t]()}function Ci(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function wi(e,t,n=!1){return e===void 0?n?t():t:e}var Ti=1024,Ei=2048,Di=4096,Oi=8192,ki=16384,Ai=32768,ji=1<<25,Mi=65536,Ni=1<<19,Pi=1<<20,Fi=1<<25,Ii=1<<21,Li=1<<22,Ri=1<<23,zi=Symbol(`$state`),Bi=Symbol(`component`),Vi=Symbol(``),Hi=Symbol(`attributes`),Ui=Symbol(`class`),Wi=Symbol(`style`),Gi=Symbol(`text`),Ki=Symbol(`form reset`),qi=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Ji=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),Yi={},Xi=Symbol(`uninitialized`),Zi=`http://www.w3.org/1999/xhtml`;function Qi(){console.warn(`https://svelte.dev/e/derived_inert`)}function $i(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ea(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var D=!1;function ta(e){D=e}var O;function na(e){if(e===null)throw $i(),Yi;return O=e}function ra(){return na(Fo(O))}function k(e){if(D){if(Fo(O)!==null)throw $i(),Yi;O=e}}function ia(e=1){if(D){for(var t=e,n=O;t--;)n=Fo(n);O=n}}function aa(e=!0){for(var t=0,n=O;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=Fo(n);e&&n.remove(),n=i}}function oa(e){if(!e||e.nodeType!==8)throw $i(),Yi;return e.data}function sa(e){return e===this.v}function ca(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function la(e){return!ca(e,this.v)}function ua(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function da(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function fa(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function pa(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function ma(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function ha(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function ga(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function _a(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function va(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function ya(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function ba(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var xa=null;function Sa(e){xa=e}function Ca(e,t=!1,n){xa={p:xa,i:!1,c:null,e:null,s:e,x:null,r:F,l:null}}function wa(e){var t=xa,n=t.e;if(n!==null){t.e=null;for(var r of n)Xo(r)}return e!==void 0&&(t.x=e),t.i=!0,xa=t.p,Ta(e)}function Ta(e={}){return mi(e,Bi,{value:!0}),e}function Ea(){return!0}var Da=[];function Oa(){var e=Da;Da=[],Si(e)}function ka(e){if(Da.length===0&&!to){var t=Da;queueMicrotask(()=>{t===Da&&Oa()})}Da.push(e)}var Aa=~(Ei|Di|Ti);function ja(e,t){e.f=e.f&Aa|t}function Ma(e){e.f&512||e.deps===null?ja(e,Ti):ja(e,Di)}function Na(e,t){e.f&2048?t.set(e,Ei):e.f&4096&&t.get(e)!==2048&&t.set(e,Di),ja(e,Ti)}var Pa=!1;function Fa(){Pa||(Pa=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[Ki]?.()})},{capture:!0}))}function Ia(e){var t=P,n=F;ys(null),bs(null);try{return e()}finally{ys(t),bs(n)}}function La(e,t,n,r){let i=Ea()?Va:Ga;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=F,c=Ra(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){Uo(e,s)}za()}}var d=Ba();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>Ua(e))).then(u).catch(e=>Uo(e,s)).finally(d)}l?l.then(()=>{s.f&16384?d():(c(),f(),za())}):f()}function Ra(){var e=F,t=P,n=xa,r=A;return function(i=!0){bs(e),ys(t),Sa(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function za(e=!0){bs(null),ys(null),Sa(null),e&&A?.deactivate()}function Ba(){var e=F,t=e.b,n=A,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function Va(e){var t=2|Ei;return F!==null&&(F.f|=Ni),{ctx:xa,deps:null,effects:null,equals:sa,f:t,fn:e,reactions:null,rv:0,v:Xi,wv:0,parent:F,ac:null}}var Ha=Symbol(`obsolete`);function Ua(e,t,n){let r=F;r===null&&da();var i=void 0,a=vo(Xi),o=!P,s=new Set;return $o(()=>{var t=F,n=Ci();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==qi&&n.reject(e)}).finally(za)}catch(e){n.reject(e),za()}var c=A;if(o){if(t.f&32768)var l=Ba();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(Ha);else for(let e of s.values())e.reject(Ha);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==Ha&&(c.activate(),t?(a.f|=Ri,Co(a,t)):(a.f&8388608&&(a.f^=Ri),Co(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),Jo(()=>{for(let e of s)e.reject(Ha)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function Wa(e){let t=Va(e);return Ss(t),t}function Ga(e){let t=Va(e);return t.equals=la,t}function Ka(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)ss(t[n])}}function qa(e){var t,n=F,r=e.parent;if(!gs&&r!==null&&e.v!==Xi&&r.f&24576)return Qi(),e.v;bs(r);try{Ka(e),t=Ps(e)}finally{bs(n)}return t}function Ja(e){var t=qa(e);!e.equals(t)&&(e.wv=js(),(!A?.is_fork||e.deps===null)&&(A===null?e.v=t:(A.capture(e,t,!0),Qa?.capture(e,t,!0)),e.deps===null))?ja(e,Ti):gs||($a===null?Ma(e):(qo()||A?.is_fork)&&$a.set(e,t))}function Ya(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&Ia(()=>{t.ac.abort(qi),t.ac=null}),t.fn!==null&&(t.teardown=xi),Ls(t,0),as(t))}function Xa(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Rs(t)}var Za=null,A=null,Qa=null,$a=null,eo=null,to=!1,no=!1,ro=null,io=null,ao=0,oo=1,so=class e{id=oo++;started=!1;linked=!0;prev=null;next=null;async_deriveds=new Map;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=0;#r=new Map;#i=null;#a=[];#o=[];#s=new Map;#c=new Map;#l=new Set;is_fork=!1;#u=!1;constructor(){Za===null?Za=this:(Za.next=this,this.prev=Za),Za=this}#d(){if(this.is_fork)return!0;for(let e of this.#r.keys())if(!this.#f(e))return!0;return!1}#f(e){for(var t=e;t!==null;t=t.parent)if(this.#c.has(t))return!0;return!1}skip_effect(e){this.#c.has(e)||this.#c.set(e,{d:[],m:[]}),this.#l.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#c.get(e);if(n){this.#c.delete(e);for(var r of n.d)ja(r,Ei),t(r);for(r of n.m)ja(r,Di),t(r)}this.#l.add(e)}#p(){var e=[];for(let i of this.#a)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=Ti}}n||e.push(t)}return this.#a=[],e}#m(){this.started=!0;for(let[e,t]of this.#s)ja(e,t),this.schedule(e);this.apply();for(var t=ro=[],n=[],r=io=[];this.#a.length>0;){ao++>1e3&&(this.#b(),co());for(let e of this.#p())try{this.#h(e,t,n)}catch(t){throw mo(e),this.#d()||this.discard(),t}}if(A=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(ro=null,io=null,this.#d()){this.#y(n),this.#y(t);for(let[e,t]of this.#c)po(e,t);r.length>0&&A.#m();return}let a=this.#g();if(a)this.#y(n),this.#y(t),a.#v(this);else{this.#s.clear();for(let e of this.#e)e(this);this.#e.clear(),Qa=this,uo(n),uo(t),Qa=null,this.#i?.resolve();var o=A;this.#n===0&&(this.#a.length===0||o!==null)&&this.#b(),o!==null&&(go.clear(),o.#m())}}#h(e,t,n){e.f^=Ti;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#c.has(r))&&r.fn!==null){a?r.f^=Ti:i&4?t.push(r):Ms(r)&&(i&16&&this.add_dirty_reaction(r,Di),Rs(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#g(){for(var e=this.prev;e!==null;e=e.prev)if(!e.is_fork&&this.#_(e))return e;return null}#_(e){for(let[t,[,n]]of this.current)if(!n&&e.current.has(t))return!0;return!1}#v(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_reactions(e.#s);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#s.delete(i),ja(i,Ei),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#b(),A=this,this.#m()}#y(e){for(var t=0;t<e.length;t+=1)Na(e[t],this.#s)}capture(e,t,n=!1){e.v!==Xi&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),$a?.set(e,t)),this.is_fork||(e.v=t)}activate(){A=this}deactivate(){A=null,$a=null}flush(){try{no=!0,A=this,this.#m()}finally{ao=0,eo=null,ro=null,io=null,no=!1,A=null,$a=null,go.clear()}}discard(){for(let e of this.#t)e(this);this.#t.clear();for(let e of this.async_deriveds.values())e.reject(Ha);this.#b(),this.#i?.resolve()}register_created_effect(e){this.#o.push(e)}increment(e,t){if(this.#n+=1,e){let e=this.#r.get(t)??0;this.#r.set(t,e+1)}}decrement(e,t){if(--this.#n,e){let e=this.#r.get(t)??0;e===1?this.#r.delete(t):this.#r.set(t,e-1)}this.#u||(this.#u=!0,ka(()=>{this.#u=!1,this.linked&&this.flush()}))}transfer_reactions(e){for(let[t,n]of e)this.add_dirty_reaction(t,n);e.clear()}add_dirty_reaction(e,t){(t===2048||this.#s.get(e)!==2048)&&this.#s.set(e,t)}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#i??=Ci()).promise}static ensure(){if(A===null){let t=A=new e;!no&&ka(()=>{t.started||t.flush()})}return A}apply(){$a=null}schedule(e){eo=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#a.push(e)}#b(){if(this.linked){var e=this.prev,t=this.next;e===null||(e.next=t),t===null?Za=e:t.prev=e,this.linked=!1}}};function co(){try{ga()}catch(e){Uo(e,eo)}}var lo=null;function uo(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Ms(r)&&(lo=new Set,Rs(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&ls(r),lo?.size>0)){go.clear();for(let e of lo){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)lo.has(n)&&(lo.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Rs(n)}}lo.clear()}}lo=null}}function fo(e){A.schedule(e)}function po(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),ja(e,Ti);for(var n=e.first;n!==null;)po(n,t),n=n.next}}function mo(e){ja(e,Ti);for(var t=e.first;t!==null;)mo(t),t=t.next}var ho=new Set,go=new Map,_o=!1;function vo(e,t){return{f:0,v:e,reactions:null,equals:sa,rv:0,wv:0}}function yo(e,t){let n=vo(e,t);return Ss(n),n}function bo(e,t=!1,n=!0){let r=vo(e);return t||(r.equals=la),r}function j(e,t,n=!1){return P!==null&&(!vs||P.f&131072)&&Ea()&&P.f&4325394&&(xs===null||!xs.has(e))&&ya(),Co(e,n?Do(t):t,io)}var xo=null,So=0;function Co(e,t,n=null){if(!e.equals(t)){gs?go.set(e,t):go.has(e)||go.set(e,e.v);var r=so.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&qa(t),$a===null&&Ma(t)}e.wv=js(),xo=null,So=0,Eo(e,Ei,n),xo=null,Ea()&&F!==null&&F.f&1024&&!(F.f&96)&&(Ts===null?Es([e]):Ts.push(e)),!r.is_fork&&ho.size>0&&!_o&&wo()}return t}function wo(){_o=!1;for(let e of ho){e.f&1024&&ja(e,Di);let t;try{t=Ms(e)}catch{t=!0}t&&Rs(e)}ho.clear()}function To(e){j(e,e.v+1)}function Eo(e,t,n){var r=e.reactions;if(r!==null){var i=Ea(),a=r.length;if(So+=a,So>1e5&&xo===null&&(xo=new Set),xo!==null){if(xo.has(e))return;xo.add(e)}for(var o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==F){var l=(c&Ei)===0;if(l&&ja(s,t),c&131072)ho.add(s);else if(c&2){var u=s;$a?.delete(u),Eo(u,Di,n)}else if(l){var d=s;c&16&&lo!==null&&lo.add(d),n===null?fo(d):n.push(d)}}}}}function Do(e){if(typeof e!=`object`||!e||zi in e||Bi in e)return e;let t=yi(e);if(t!==_i&&t!==vi)return e;var n=new Map,r=ui(e),i=yo(0),a=null,o=ks,s=e=>{if(ks===o)return e();var t=P,n=ks;ys(null),As(o);var r=e();return ys(t),As(n),r};return r&&n.set(`length`,yo(e.length,a)),new Proxy(e,{defineProperty(e,t,r){`value`in r&&r.configurable!==!1&&r.enumerable!==!1&&r.writable!==!1||_a();var i=n.get(t);return i===void 0?s(()=>{var e=yo(r.value,a);return n.set(t,e),e}):j(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=s(()=>yo(Xi,a));n.set(t,e),To(i)}}else j(r,Xi),To(i);return!0},get(t,r,i){if(r===zi)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||hi(t,r)?.writable)&&(o=s(()=>yo(Do(c?t[r]:Xi),a)),n.set(r,o)),o!==void 0){var l=I(o);return l===Xi?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var r=Reflect.getOwnPropertyDescriptor(e,t),i=n.get(t);if(i!==void 0){var a=I(i);if(a===Xi)return;if(r&&`value`in r)r.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return r},has(e,t){if(t===zi)return!0;var r=n.get(t),i=r!==void 0&&r.v!==Xi||Reflect.has(e,t);return(r!==void 0||(F!==null||P!==null)&&(!i||hi(e,t)?.writable))&&(r===void 0&&(r=s(()=>yo(i?Do(e[t]):Xi,a)),n.set(t,r)),I(r)===Xi)?!1:i},set(e,t,o,c){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;d<l.v;d+=1){var f=n.get(d+``);f===void 0?d in e&&(f=s(()=>yo(Xi,a)),n.set(d+``,f)):j(f,Xi)}if(l===void 0)(!u||hi(e,t)?.writable)&&(l=s(()=>yo(void 0,a)),j(l,Do(o)),n.set(t,l));else{u=l.v!==Xi;var p=s(()=>Do(o));j(l,p)}var m=Reflect.getOwnPropertyDescriptor(e,t);if(m?.set&&m.set.call(c,o),!u){if(r&&typeof t==`string`){var h=n.get(`length`),g=Number(t);Number.isInteger(g)&&g>=h.v&&j(h,g+1)}To(i)}return!0},ownKeys(e){I(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==Xi});for(var[r,a]of n)a.v!==Xi&&!(r in e)&&t.push(r);return t},setPrototypeOf(){va()}})}var Oo,ko,Ao,jo;function Mo(){if(Oo===void 0){Oo=window,ko=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Ao=hi(t,`firstChild`).get,jo=hi(t,`nextSibling`).get,bi(e)&&(e[Ui]=void 0,e[Hi]=null,e[Wi]=void 0,e.__e=void 0),bi(n)&&(n[Gi]=void 0)}}function No(e=``){return document.createTextNode(e)}function Po(e){return Ao.call(e)}function Fo(e){return jo.call(e)}function M(e,t){if(!D)return Po(e);var n=Po(O);if(n===null)n=O.appendChild(No());else if(t&&n.nodeType!==3){var r=No();return n?.before(r),na(r),r}return t&&Vo(n),na(n),n}function Io(e,t=!1){if(!D){var n=Po(e);return n instanceof Comment&&n.data===``?Fo(n):n}if(t){if(O?.nodeType!==3){var r=No();return O?.before(r),na(r),r}Vo(O)}return O}function Lo(e,t=!1){if(!D)return Po(e);var n=M(e,t);return k(e),n}function N(e,t=1,n=!1){let r=D?O:e;for(var i;t--;)i=r,r=Fo(r);if(!D)return r;if(n){if(r?.nodeType!==3){var a=No();return r===null?i?.after(a):r.before(a),na(a),a}Vo(r)}return na(r),r}function Ro(e){e.textContent=``}function zo(){return!1}function Bo(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function Vo(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Ho(e){var t=F;if(t===null)return P.f|=Ri,e;if(!(t.f&32768)&&!(t.f&4))throw e;Uo(e,t)}function Uo(e,t){if(e===Yi)throw e;if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function Wo(e){F===null&&(P===null&&ha(e),ma()),gs&&pa(e)}function Go(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Ko(e,t){var n=F;n!==null&&n.f&8192&&(e|=Oi);var r={ctx:xa,deps:null,nodes:null,f:e|Ei|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};A?.register_created_effect(r);var i=r;if(e&4)ro===null?so.ensure().schedule(r):ro.push(r);else if(t!==null){try{Rs(r)}catch(e){throw ss(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=Mi))}if(i!==null&&(i.parent=n,n!==null&&Go(i,n),P!==null&&P.f&2&&!(e&64))){var a=P;(a.effects??=[]).push(i)}return r}function qo(){return P!==null&&!vs}function Jo(e){let t=Ko(8,null);return ja(t,Ti),t.teardown=e,t}function Yo(e){Wo(`$effect`);var t=F.f;if(!P&&t&32&&xa!==null&&!xa.i){var n=xa;(n.e??=[]).push(e)}else return Xo(e)}function Xo(e){return Ko(4|Pi,e)}function Zo(e){so.ensure();let t=Ko(64|Ni,e);return(e={})=>new Promise(n=>{e.outro?us(t,()=>{ss(t),n(void 0)}):(ss(t),n(void 0))})}function Qo(e){return Ko(4,e)}function $o(e){return Ko(Li|Ni,e)}function es(e,t=0){return Ko(8|t,e)}function ts(e,t=[],n=[],r=[]){La(r,t,n,t=>{Ko(8,()=>{e(...t.map(I))})})}function ns(e,t=0){return Ko(16|t,e)}function rs(e){return Ko(32|Ni,e)}function is(e){var t=e.teardown;if(t!==null){let n=gs,r=P;_s(!0),ys(null);try{t.call(null)}catch(t){Uo(t,e.parent)}finally{_s(n),ys(r)}}}function as(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Ia(()=>{e.abort(qi)});var r=n.next;n.f&64?n.parent=null:ss(n,t),n=r}}function os(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||ss(t),t=n}}function ss(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(cs(e.nodes.start,e.nodes.end),n=!0),e.f|=ji,as(e,t&&!n),Ls(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();is(e),e.f^=ji,e.f|=ki;var i=e.parent;i!==null&&i.first!==null&&ls(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function cs(e,t){for(;e!==null;){var n=e===t?null:Fo(e);e.remove(),e=n}}function ls(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function us(e,t,n=!0){var r=[];e.f|=256,ds(e,r,!0);var i=()=>{n&&ss(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function ds(e,t,n){if(!(e.f&8192)){e.f^=Oi;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);ds(i,t,o?n:!1)}i=a}}}function fs(e){e.f&=-257,ps(e,!0)}function ps(e,t){if(!(e.f&256)&&e.f&8192){e.f^=Oi,e.f&1024||(ja(e,Ei),so.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);ps(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function ms(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Fo(n);t.append(n),n=i}}var hs=null,gs=!1;function _s(e){gs=e}var P=null,vs=!1;function ys(e){P=e}var F=null;function bs(e){F=e}var xs=null;function Ss(e){P!==null&&(P.f&2097152||P.f&2)&&(xs??=new Set).add(e)}var Cs=null,ws=0,Ts=null;function Es(e){Ts=e}var Ds=1,Os=0,ks=Os;function As(e){ks=e}function js(){return++Ds}function Ms(e){var t=e.f;if(t&2048)return!0;if(t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Ms(a)&&Ja(a),a.wv>e.wv)return!0}t&512&&$a===null&&ja(e,Ti)}return!1}function Ns(e,t,n=!0){var r=e.reactions;if(r!==null&&!(xs!==null&&xs.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Ns(a,t,!1):t===a&&(n?ja(a,Ei):a.f&1024&&ja(a,Di),fo(a))}}function Ps(e){var t=Cs,n=ws,r=Ts,i=P,a=xs,o=xa,s=vs,c=ks,l=e.f;Cs=null,ws=0,Ts=null,P=l&96?null:e,xs=null,Sa(e.ctx),vs=!1,ks=++Os,e.ac!==null&&(Ia(()=>{e.ac.abort(qi)}),e.ac=null);try{e.f|=Ii;var u=e.fn,d=u();e.f|=Ai;var f=Fs(e);if(Ea()&&Ts!==null&&!vs&&f!==null&&!(e.f&6146))for(var p=0;p<Ts.length;p++)Ns(Ts[p],e);if(i!==null&&i!==e){if(Os++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Os;if(t!==null)for(let e of t)e.rv=Os;Ts!==null&&(r===null?r=Ts:r.push(...Ts))}return e.f&8388608&&(e.f^=Ri),d}catch(t){return Fs(e),Ho(t)}finally{e.f^=Ii,Cs=t,ws=n,Ts=r,P=i,xs=a,Sa(o),vs=s,ks=c}}function Fs(e){var t=e.deps,n=A?.is_fork;if(Cs!==null){var r;if(n||Ls(e,ws),t!==null&&ws>0)for(t.length=ws+Cs.length,r=0;r<Cs.length;r++)t[ws+r]=Cs[r];else e.deps=t=Cs;if(qo()&&e.f&512)for(r=ws;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&ws<t.length&&(Ls(e,ws),t.length=ws);return t}function Is(e,t){let n=t.reactions;if(n!==null){var r=di.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&t.f&2&&(Cs===null||!fi.call(Cs,t))){var a=t;a.f&512&&(a.f^=512),a.v!==Xi&&Ma(a),a.ac!==null&&Ia(()=>{a.ac.abort(qi),a.ac=null,ja(a,Ei)}),Ya(a),Ls(a,0)}}function Ls(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Is(e,n[r])}function Rs(e){var t=e.f;if(!(t&16384)){ja(e,Ti);var n=F;F=e;try{t&16777232?os(e):as(e),is(e);var r=Ps(e);e.teardown=typeof r==`function`?r:null,e.wv=Ds}finally{F=n}}}function I(e){var t=!!(e.f&2);if(hs?.add(e),P!==null&&!vs&&!(F!==null&&F.f&16384)&&(xs===null||!xs.has(e))){var n=P.deps;if(P.f&2097152)e.rv<Os&&(e.rv=Os,Cs===null&&n!==null&&n[ws]===e?ws++:Cs===null?Cs=[e]:Cs.push(e));else{P.deps??=[],fi.call(P.deps,e)||P.deps.push(e);var r=e.reactions;r===null?e.reactions=[P]:fi.call(r,P)||r.push(P)}}if(gs&&go.has(e))return go.get(e);if(t){var i=e;if(gs){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Bs(i))&&(a=qa(i)),go.set(i,a),a}var o=!(i.f&512)&&!vs&&P!==null&&!!(P.f&512),s=(i.f&Ai)===0;Ms(i)&&(o&&(i.f|=512),Ja(i)),o&&!s&&(Xa(i),zs(i))}if($a?.has(e))return $a.get(e);if(e.f&8388608)throw e.v;return e.v}function zs(e){if(e.f|=512,e.deps!==null)for(let n of e.deps){var t=n.reactions;t===null?n.reactions=[e]:fi.call(t,e)||t.push(e),n.f&2&&!(n.f&512)&&(Xa(n),zs(n))}}function Bs(e){if(e.v===Xi)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(go.has(t)||t.f&2&&Bs(t))return!0;return!1}function Vs(e){var t=vs;try{return vs=!0,e()}finally{vs=t}}function Hs(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(zi in e)Us(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&zi in n&&Us(n)}}}function Us(e,t=new Set){if(typeof e==`object`&&e&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Us(e[n],t)}catch{}let n=yi(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){let t=gi(n);for(let n in t){let r=t[n].get;if(r)try{r.call(e)}catch{}}}}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var Ws=[`touchstart`,`touchmove`];function Gs(e){return Ws.includes(e)}var Ks=Symbol(`events`),qs=new Set,Js=new Set;function Ys(e,t,n,r={}){function i(e){if(r.capture||ec.call(t,e),!e.cancelBubble)return Ia(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?(i.__removed=!1,ka(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Xs(e,t,n,r,i){var a={capture:r,passive:i},o=Ys(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Jo(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function L(e,t,n){(t[Ks]??={})[e]=n}function Zs(e){for(var t=0;t<e.length;t++)qs.add(e[t]);for(var n of Js)n(e)}var Qs=null,$s=!1;function ec(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;Qs=e,$s||($s=!0,setTimeout(()=>{$s=!1,Qs=null}));var o=0,s=Qs===e&&e[Ks];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[Ks]=t;return}var l=i.indexOf(t);if(l===-1)return;c<=l&&(o=c)}if(a=i[o]||e.target,a!==t){mi(e,`currentTarget`,{configurable:!0,get(){return a||n}});var u=P,d=F;ys(null),bs(null);try{for(var f,p=[];a!==null&&a!==t;){try{var m=a[Ks]?.[r];m==null||a.disabled&&e.target!==a||m.call(a,e)}catch(e){f?p.push(e):f=e}if(e.cancelBubble)break;o++,a=o<i.length?i[o]:null}if(f){for(let e of p)queueMicrotask(()=>{throw e});throw f}}finally{e[Ks]=t,delete e.currentTarget,ys(u),bs(d)}}}var tc=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function nc(e){return tc?.createHTML(e)??e}function rc(e){var t=Bo(`template`);return t.innerHTML=nc(e.replaceAll(`<!>`,`<!---->`)),t.content}function ic(e,t){var n=F;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function ac(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(D)return ic(O,null),O;i===void 0&&(i=rc(a?e:`<!>`+e),n||(i=Po(i)));var t=r||ko?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Po(t),s=t.lastChild;ic(o,s)}else ic(t,t);return t}}function oc(e=``){if(!D){var t=No(e+``);return ic(t,t),t}var n=O;return n.nodeType===3?Vo(n):(n.before(n=No()),na(n)),ic(n,n),n}function sc(){if(D)return ic(O,null),O;var e=document.createDocumentFragment(),t=document.createComment(``),n=No();return e.append(t,n),ic(t,n),e}function R(e,t){if(D){var n=F;n.f&32768&&n.nodes.end!==null||(n.nodes.end=O),ra()}else e!==null&&e.before(t)}function cc(e){let t=0,n=vo(0),r;return()=>{qo()&&(I(n),es(()=>(t===0&&(r=Vs(()=>e(()=>To(n)))),t+=1,()=>{ka(()=>{--t,t===0&&(r?.(),r=void 0,To(n))})})))}}var lc=Mi|Ni;function uc(e,t,n,r){new dc(e,t,n,r)}var dc=class{parent;is_pending=!1;transform_error;#e;#t=D?O:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Map;#p=null;#m=cc(()=>(this.#p=vo(this.#l),()=>{this.#p=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=F;t.b=this,t.f|=128,n(e)},this.parent=F.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=ns(()=>{if(D){let e=oa(this.#t);ra();let t=e===`[!`;if(e.startsWith(`[?`)){let t=JSON.parse(e.slice(2));this.#g(t)}else t?this.#y():this.#h()}else this.#b()},lc),D&&(this.#e=O)}#h(){try{this.#a=rs(()=>this.#r(this.#e))}catch(e){this.error(e)}}#g(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#_(e);ka(r),t&&(this.#s=rs(()=>{t(this.#e,()=>e,()=>n)}))}#_(e){var t=!1,n=!1;let r=()=>{this.#v()||(t?ea():(t=!0,n&&ba(),this.#s!==null&&us(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})))};return{reset:r,invoke_onerror:()=>{if(!this.#v())try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){Uo(e,this.#i&&this.#i.parent)}}}}#v(){return(this.#i.f&(ki|ji))!==0}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=rs(()=>e(this.#e)),ka(()=>{if(!this.#v()){var e=this.#c=document.createDocumentFragment(),t=No(),n=!1;e.append(t),this.#a=this.#S(()=>{try{return rs(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){Uo(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#x(A)):this.#u===0&&(this.#e.before(e),this.#c=null,us(this.#o,()=>{this.#o=null}),this.#x(A))}}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=rs(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();ms(this.#a,e);let t=this.#n.pending;this.#o=rs(()=>t(this.#e))}else this.#x(A)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_reactions(this.#f)}defer_effect(e){Na(e,this.#f)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=F,n=P,r=xa;bs(this.#i),ys(this.#i),Sa(this.#i.ctx);try{return so.ensure(),e()}finally{bs(t),ys(n),Sa(r)}}#C(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&us(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#C(e,t)}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!this.#p||this.#d||(this.#d=!0,ka(()=>{this.#d=!1,this.#p&&Co(this.#p,this.#l)}))}get_effect_pending(){return this.#m(),I(this.#p)}error(e){if(e===Yi||!this.#n.onerror&&!this.#n.failed)throw e;A?.is_fork?(this.#a&&A.skip_effect(this.#a),this.#o&&A.skip_effect(this.#o),this.#s&&A.skip_effect(this.#s),A.oncommit(()=>{this.#v()||this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(ss(this.#a),null),this.#o&&=(ss(this.#o),null),this.#s&&=(ss(this.#s),null),D&&(na(this.#t),ia(),na(aa()));let t=this.#n.failed,n=e=>{if(this.#v())return;let{reset:n,invoke_onerror:r}=this.#_(e);r(),t&&!this.#v()&&(this.#s=this.#S(()=>{try{return rs(()=>{var r=F;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return Uo(e,this.#i.parent),null}}))};ka(()=>{if(!this.#v()){var t;try{t=this.transform_error(e)}catch(e){Uo(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>Uo(e,this.#i&&this.#i.parent)):n(t)}})}};function fc(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[Gi]??=e.nodeValue)&&(e[Gi]=n,e.nodeValue=`${n}`)}function pc(e,t){return hc(e,t)}var mc=new Map;function hc(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){Mo();var c=void 0,l=Zo(()=>{var o=n??t.appendChild(No());uc(o,{pending:()=>{}},t=>{Ca({});var n=xa;if(a&&(n.c=a),i&&(r.$$events=i),D&&ic(t,null),c=e(t,r)||Ta(),D&&(F.nodes.end=O,O===null||O.nodeType!==8||O.data!==`]`))throw $i(),Yi;wa()},s);var l=new Set,u=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!l.has(r)){l.add(r);var i=Gs(r);for(let e of[t,document]){var a=mc.get(e);a===void 0&&(a=new Map,mc.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,ec,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return u(pi(qs)),Js.add(u),()=>{for(var e of l)for(let n of[t,document]){var r=mc.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,ec),r.delete(e),r.size===0&&mc.delete(n)):r.set(e,i)}Js.delete(u),o!==n&&o.parentNode?.removeChild(o)}});return gc.set(c,l),c}var gc=new WeakMap;function _c(e,t){let n=gc.get(e);return n?(gc.delete(e),n(t)):Promise.resolve()}var vc=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)fs(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(fs(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(ss(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();ms(r,t),t.append(No()),this.#n.set(e,{effect:r,fragment:t})}else ss(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),us(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(ss(n.effect),this.#n.delete(e))};ensure(e,t){var n=A,r=zo();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=No();i.append(a),this.#n.set(e,{effect:rs(()=>t(a)),fragment:i})}else this.#t.set(e,rs(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else D&&(this.anchor=O),this.#a(n)}};function yc(e,t,n=!1){var r;D&&(r=O,ra());var i=new vc(e),a=n?Mi:0;function o(e,t){if(D){var n=oa(r);if(e!==parseInt(n.substring(1))){var a=aa();na(a),i.anchor=a,ta(!1),i.ensure(e,t),ta(!0);return}}i.ensure(e,t)}ns(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function bc(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let n=t[s];us(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;xc(e,pi(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else--o},!1)}if(o===0){var c=r.length===0&&n!==null&&e.pending.size===0;if(c){var l=n,u=l.parentNode;Ro(u),u.append(l),e.items.clear()}xc(e,t,!c)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function xc(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=Fi,ms(a,document.createDocumentFragment())):ss(t[i],n)}}var Sc;function Cc(e,t,n,r,i,a=null){var o=e,s=new Map;if(t&4){var c=e;o=D?na(Po(c)):c.appendChild(No())}D&&ra();var l=null,u=Ga(()=>{var e=n();return ui(e)?e:e==null?[]:pi(e)}),d=new Map,f=!0;function p(e){if(!(h.effect.f&16384)){h.pending.delete(e);var n=I(u);h.fallback=l,Tc(h,n,o,t,r),l!==null&&(n.length===0?l.f&33554432?(l.f^=Fi,Dc(l,null,o)):fs(l):us(l,()=>{l=null}))}}function m(e){h.pending.delete(e)}var h={effect:ns(()=>{var e=I(u),c=e.length;let h=!1;D&&oa(o)===`[!`!=(c===0)&&(o=aa(),na(o),ta(!1),h=!0);for(var g=new Set,_=A,v=zo(),y=0;y<c;y+=1){D&&O.nodeType===8&&O.data===`]`&&(o=O,h=!0,ta(!1));var b=e[y],ee=r(b,y),x=f?null:s.get(ee);x?(x.v&&Co(x.v,b),x.i&&Co(x.i,y),v&&_.unskip_effect(x.e)):(x=Ec(s,f?o:Sc??=No(),b,ee,y,i,t,n),f||(x.e.f|=Fi),s.set(ee,x)),g.add(ee)}if(c===0&&a&&!l&&(f?l=rs(()=>a(o)):(l=rs(()=>a(Sc??=No())),l.f|=Fi)),c>g.size&&fa(``,``,``),D&&c>0&&na(aa()),!f){if(d.set(_,g),v){for(let[e,t]of s)g.has(e)||_.skip_effect(t.e);_.oncommit(p),_.ondiscard(m)}else p(_)}h&&ta(!0),I(u)}),flags:t,items:s,pending:d,outrogroups:null,fallback:l};f=!1,D&&(o=O)}function wc(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Tc(e,t,n,r,i){var a=!!(r&8),o=t.length,s=e.items,c=wc(e.effect.first),l,u=null,d,f=[],p=[],m,h,g,_;if(a)for(_=0;_<o;_+=1)m=t[_],h=i(m,_),g=s.get(h).e,g.f&33554432||(g.nodes?.a?.measure(),(d??=new Set).add(g));for(_=0;_<o;_+=1){if(m=t[_],h=i(m,_),g=s.get(h).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(g),t.done.delete(g);if(g.f&8192&&(fs(g),a&&(g.nodes?.a?.unfix(),(d??=new Set).delete(g))),g.f&33554432){if(g.f^=Fi,g===c)Dc(g,null,n);else{var v=u?u.next:c;g===e.effect.last&&(e.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),Oc(e,u,g),Oc(e,g,v),Dc(g,v,n),u=g,f=[],p=[],c=wc(u.next);continue}}if(g!==c){if(l!==void 0&&l.has(g)){if(f.length<p.length){var y=p[0],b;u=y.prev;var ee=f[0],x=f[f.length-1];for(b=0;b<f.length;b+=1)Dc(f[b],y,n);for(b=0;b<p.length;b+=1)l.delete(p[b]);Oc(e,ee.prev,x.next),Oc(e,u,ee),Oc(e,x,y),c=y,u=x,--_,f=[],p=[]}else l.delete(g),Dc(g,c,n),Oc(e,g.prev,g.next),Oc(e,g,u===null?e.effect.first:u.next),Oc(e,u,g),u=g;continue}for(f=[],p=[];c!==null&&c!==g;)(l??=new Set).add(c),p.push(c),c=wc(c.next);if(c===null)continue}g.f&33554432||f.push(g),u=g,c=wc(g.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(xc(e,pi(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(c!==null||l!==void 0){var S=[];if(l!==void 0)for(g of l)g.f&8192||S.push(g);for(;c!==null;)!(c.f&8192)&&c!==e.fallback&&S.push(c),c=wc(c.next);var te=S.length;if(te>0){var C=r&4&&o===0?n:null;if(a){for(_=0;_<te;_+=1)S[_].nodes?.a?.measure();for(_=0;_<te;_+=1)S[_].nodes?.a?.fix()}bc(e,S,C)}}a&&ka(()=>{if(d!==void 0)for(g of d)g.nodes?.a?.apply()})}function Ec(e,t,n,r,i,a,o,s){var c=o&1?o&16?vo(n):bo(n,!1,!1):null,l=o&2?vo(i):null;return{v:c,i:l,e:rs(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Dc(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=Fo(r);if(a.before(r),r===i)return;r=o}}function Oc(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function kc(e,t,n){Qo(()=>{var r=Vs(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};es(()=>{var e=n();Hs(e),i&&ca(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function Ac(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ac(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function jc(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ac(e))&&(r&&(r+=` `),r+=t);return r}function z(e){return typeof e==`object`?jc(e):e??``}var Mc=[...`
|
|
4
4
|
\r\f\xA0\v`];function Nc(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||Mc.includes(r[o-1]))&&(s===r.length||Mc.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Pc(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Fc(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Ic(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Fc)),i&&c.push(...Object.keys(i).map(Fc));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=Fc(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=Pc(r)),i&&(n+=Pc(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function B(e,t,n,r,i,a){var o=e[Ui];if(D||o!==n||o===void 0){var s=Nc(n,r,a);D&&s===e.getAttribute(`class`)||(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[Ui]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Lc(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function Rc(e,t,n,r){var i=e[Wi];if(D||i!==t){var a=Ic(t,r);D&&a===e.getAttribute(`style`)||(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[Wi]=t}else r&&(Array.isArray(r)?(Lc(e,n?.[0],r[0]),Lc(e,n?.[1],r[1],`important`)):Lc(e,n,r));return r}var zc=Symbol(`is custom element`),Bc=Symbol(`is html`),Vc=Ji?`link`:`LINK`,Hc=Ji?`progress`:`PROGRESS`;function Uc(e){if(D){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Gc(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Gc(e,`checked`,null),e.checked=r}}};e[Ki]=n,ka(n),Fa()}}function Wc(e,t){var n=Kc(e);n.value!==(n.value=t??void 0)&&(e.value!==t||t===0&&e.nodeName===Hc)&&(e.value=t??``)}function Gc(e,t,n,r){var i=Kc(e);if(!(D&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===Vc))){var a=i[t];a!==(i[t]=n)&&(t===`loading`&&(e[Vi]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Jc(e).has(t)?e[t]=n:(!D||typeof n!=`number`&&typeof n!=`boolean`||a!==String(n))&&e.setAttribute(t,n))}}function Kc(e){return e[Hi]??={[zc]:e.nodeName.includes(`-`),[Bc]:e.namespaceURI===Zi}}var qc=new Map;function Jc(e){var t=e.getAttribute(`is`)||e.nodeName,n=qc.get(t);if(n)return n;qc.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=gi(i),r)r[o].set&&o!==`innerHTML`&&o!==`textContent`&&o!==`innerText`&&n.add(o);i=yi(i)}return n}function Yc(e,t){return e===t||e?.[zi]===t}function Xc(e=Ta(),t,n,r){var i=xa.r,a=F;return Qo(()=>{var o,s;return es(()=>{o=s,s=r?.()||[],Vs(()=>{Yc(n(...s),e)||(t(e,...s),o&&Yc(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Yc(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Zc(e){xa===null&&ua(`onMount`),Yo(()=>{let t=Vs(e);if(typeof t==`function`)return t})}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Qc(...e){return e.filter(Boolean).join(` `)}function $c({variant:e=`primary`,size:t=`md`,class:n}={}){let r={primary:`btn-primary`,secondary:`btn-action`,outline:`btn-action`,ghost:`inline-flex items-center justify-center gap-1.5 rounded px2 py1 op75 hover:op100 hover:bg-active transition disabled:pointer-events-none disabled:op30!`,destructive:`btn-action text-error border-error/30!`,link:`inline-flex items-center gap-1.5 color-active hover:underline underline-offset-2`},i=t===`sm`?e===`primary`?`text-sm px-2.5! py-1!`:`text-sm`:t===`lg`?`text-base px-4! py-2!`:``;return Qc(r[e],i,n)}function el({variant:e=`outline`,size:t=`md`,class:n}={}){return Qc(e===`ghost`?`btn-icon`:`btn-icon-square`,t===`sm`?`w-7! h-7! text-sm`:``,n)}function tl(e,t){return Qc(`badge`,`badge-color-${e}`,t)}function nl({active:e=!1,class:t}={}){return Qc(`relative inline-flex items-center gap-1.5 max-w-52 px-2 py-1 rounded-md border border-transparent text-sm op-fade select-none cursor-pointer transition hover:op100 hover:bg-active`,e&&`op100! bg-active border-base! color-base`,t)}function rl(e){return Qc(`flex items-center gap-2 shrink-0 h-nav px-3 border-b border-base bg-base z-nav`,e)}function il(e){return Qc(`flex items-center gap-1.5 shrink-0 font-semibold text-sm select-none`,e)}var al={connecting:{icon:`i-ph-plugs-connected-duotone`,title:`Connecting…`,body:`Establishing a connection to the devframe server.`,reloadable:!1,spin:!0},disconnected:{icon:`i-ph-plugs-duotone`,title:`Disconnected`,body:`Lost the connection to the devframe server. Reload once it is back up.`,reloadable:!0,spin:!1},unauthorized:{icon:`i-ph-lock-key-duotone`,title:`Not authorized`,body:`This client isn’t authorized. Reopen the link printed by your dev server, then reload.`,reloadable:!0,spin:!1},error:{icon:`i-ph-warning-octagon-duotone`,title:`Connection failed`,body:`Could not reach the devframe server.`,reloadable:!0,spin:!1}};function ol(e){return e===`connected`?null:al[e]}function sl(e){return Qc(`flex flex-col items-center justify-center gap-4 bg-base p-8 text-center`,e)}function cl(e=!1,t){return Qc(`text-4xl color-active`,e&&`animate-pulse`,t)}function ll(e){return Qc(`text-lg font-medium color-base`,e)}function ul(e){return Qc(`max-w-sm text-sm color-muted`,e)}function dl(e){return Qc(`flex items-center gap-2 shrink-0 h-8 px-2.5 border-b border-base bg-secondary text-sm`,e)}function fl(e){return Qc(`fixed inset-0 z-modal-backdrop grid place-items-center p-4 bg-black/40 backdrop-blur-sm`,e)}function pl(e){return Qc(`z-modal-content w-full max-w-sm flex flex-col gap-3 p-4 rounded-xl border border-base bg-base shadow-lg`,e)}function ml(e,t){return Qc(`inline-block size-1.5 rounded-full shrink-0`,{running:`bg-success`,idle:`bg-neutral-400`,error:`bg-error`}[e],t)}var hl=`devframes:plugin:terminals:sessions`,gl=`devframes:plugin:terminals:presets`,_l=`devframe:docks:active`,vl=Object.defineProperty,yl=Object.getOwnPropertyDescriptor,bl=(e,t)=>{for(var n in t)vl(e,n,{get:t[n],enumerable:!0})},V=(e,t,n,r)=>{for(var i=r>1?void 0:r?yl(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&vl(t,n,i),i},H=(e,t)=>(n,r)=>t(n,r,e),xl=`Terminal input`,Sl={get:()=>xl,set:e=>xl=e},Cl=`Too much output to announce, navigate to rows manually to read`,wl={get:()=>Cl,set:e=>Cl=e};function Tl(e){return e.replace(/\r?\n/g,`\r`)}function El(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Dl(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function Ol(e,t,n,r){e.stopPropagation(),e.clipboardData&&kl(e.clipboardData.getData(`text/plain`),t,n,r)}function kl(e,t,n,r){e=Tl(e),e=El(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function Al(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function jl(e,t,n,r,i){Al(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Ml(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Nl(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Pl=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},Fl=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128||(c=(i&31)<<6|a&63,c<128)){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Il=``,Ll=` `,Rl=class e{constructor(){this.fg=0,this.bg=0,this.extended=new zl}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},zl=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Bl=class e extends Rl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new zl,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ml(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Vl=`di$target`,Hl=`di$dependencies`,Ul=new Map;function Wl(e){return e[Hl]||[]}function Gl(e){if(Ul.has(e))return Ul.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Kl(t,e,r)};return t._id=e,Ul.set(e,t),t}function Kl(e,t,n){t[Vl]===t?t[Hl].push({id:e,index:n}):(t[Hl]=[{id:e,index:n}],t[Vl]=t)}var ql=Gl(`BufferService`),Jl=Gl(`CoreMouseService`),Yl=Gl(`CoreService`),Xl=Gl(`CharsetService`),Zl=Gl(`InstantiationService`),Ql=Gl(`LogService`),$l=Gl(`OptionsService`),eu=Gl(`OscLinkService`),tu=Gl(`UnicodeService`),nu=Gl(`DecorationService`),ru=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Bl,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):iu(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};ru=V([H(0,ql),H(1,$l),H(2,eu)],ru);function iu(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
5
5
|
|
|
6
6
|
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var au=Gl(`CharSizeService`),ou=Gl(`CoreBrowserService`),su=Gl(`MouseService`),cu=Gl(`RenderService`),lu=Gl(`SelectionService`),uu=Gl(`CharacterJoinerService`),du=Gl(`ThemeService`),fu=Gl(`LinkProviderService`),pu=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?yu.isErrorNoTelemetry(e)?new yu(e.message+`
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Terminals</title>
|
|
7
7
|
<style>html,body,#app{height:100%;margin:0}#app{position:relative}body{background:#0d1117}@media (prefers-color-scheme:light){body{background:#f6f8fa}}</style>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-Ba4L0anG.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-Dmd4AYqz.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/plugin-terminals--assets",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"description": "Prebuilt browser assets (SPA) for @devframes/plugin-terminals, served on demand through devframe's remote-assets back-proxy.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|