imba
Version:
12 lines (10 loc) • 152 kB
JavaScript
var ye=Symbol.for("#__init__"),Sl=Symbol.for("#__initor__"),hu=Symbol.for("#__inited__"),$l=Symbol.for("#__hooks__"),Yp=Symbol.for("#__patch__"),au=Symbol.for("#has"),uu=Symbol.for("#meta"),bi=Symbol.for("imba"),Wp=Symbol.for("#__mixin__"),cu=Symbol.for("#matcher"),or=Symbol.for("#L"),Xp=Symbol.for("#appendChild"),Qp=Symbol.for("#afterVisit"),Jp=Symbol.for("#beforeReconcile"),Zp=Symbol.for("#afterReconcile"),tm=Symbol.for("##up"),em={SUPERCALLS:8,CONSTRUCTOR:16},Ot={IsExtension:1,IsTag:2,HasDescriptors:4,HasSuperCalls:8,HasConstructor:16,HasFields:32,HasMixins:64,HasInitor:128,HasDecorators:256,IsObjectExtension:512,IsMixin:1024},Kt=new Map,fu=globalThis[bi]||(globalThis[bi]={counter:0,classes:Kt});function Pt(i,t={}){return Kt.has(i)||Kt.set(i,{symbol:Symbol(i.name),parent:Object.getPrototypeOf(i.prototype)?.constructor,for:i,uses:null,inits:null,id:fu.counter++,...t}),Kt.get(i)}var xl=new WeakMap;function rm(i,t){return i==t||t?.[cu]?.(i)}function im(i,t){return typeof t=="string"?typeof i===t:t?.[Symbol.hasInstance]?.(i)}function sm(i,t){return t?.[au]?.(i)??t?.includes?.(i)??t?.has?.(i)??!1}function nm(i,t){return t?.indexOf?t.indexOf(i):Array.prototype.indexOf.call(i,t)}function om(i,t,...e){return t&&t[or]instanceof Function?i=t[or](i,t,...e):globalThis[or]instanceof Function&&(i=globalThis[or](i,t,...e)),i}function wl(i){return xl.get(i)||xl.set(i,{}).get(i)}function _l(i){return i?.toIterable?.()||i}function lm(i,t,e,r){let s,n=arguments.length,o=i.length,l=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;for(;o>0;)(s=i[--o])&&(l=(n<3?s(l):n>3?s(t,e,l):s(t,e))||l);return n>3&&l&&Object.defineProperty(t,e,l),l}function du(i,t){if(!i||!t)return!1;if(i.get)return t.get===i.get;if(i.set)return t.set===i.set;if(i.value)return i.value===t.value}function Tl(i,t,e,r={}){let s=i.constructor;!e&&t&&(e=Object.getOwnPropertyDescriptors(t),delete e.constructor,e[ye]&&(console.warn(`Cannot define plain fields when extending class ${s.name}`),delete e[ye]));let n=Pt(s);if(n&&n.augments){let o=new Map;for(let l of Object.keys(e)){let h=Object.getOwnPropertyDescriptor(i,l);for(let u of n.augments){let f=o.get(u);f||o.set(u,f={});let c=Object.getOwnPropertyDescriptor(u.prototype,l);c&&!du(h,c)?console.warn("wont extend",l,c,h):f[l]=e[l]}}for(let[l,h]of o)Object.keys(h).length&&Tl(l.prototype,null,h)}return Object.defineProperties(i,e),i}function lr(i,t){let e=Pt(i),r=Pt(t),s=r.parent;for(;s&&Pt(s)?.flags&Ot.IsMixin;){lr(i,s),s=null;break}if(s&&!(i.prototype instanceof s))throw new Error(`Mixin ${t.name} has superclass not present in target class`);if(!r.augments){r.augments=new Set;let o=r.ref=Symbol(t.name),l=Object[Symbol.hasInstance];t.prototype[o]=!0,Object.defineProperty(t,Symbol.hasInstance,{value:function(h){return this===t?h&&!!h[o]:l.call(this,h)}})}if(i.prototype[r.ref])return i;if(r.uses)for(let o of r.uses)lr(i,o);r.augments.add(i),e.uses||(e.uses=[]),e.uses.push(t);let n=Object.getOwnPropertyDescriptors(t.prototype);return delete n.constructor,n[ye]&&(e.inits||(e.inits=[]),e.inits.push(t.prototype[ye]),delete n[ye]),Object.defineProperties(i.prototype,n),t?.mixed instanceof Function&&t.mixed(i),i}function hm(i,t,...e){let r=t?class extends t{}:class{},s=Pt(r,{symbol:i});for(let n of e)lr(r,n);return r.prototype[i]=function(n,o,l){if(s.inits)for(let h of s.inits)h.call(this,n,!1,l)},r}var X={cache:{},self:null,target:null,proxy:new Proxy({},{apply:(i,t,e)=>Reflect.apply(X.target,t,e),get:(i,t)=>{let e=Reflect.get(X.target,t,X.self);return e instanceof Function?e.bind(X.self):e},set:(i,t,e,r)=>Reflect.set(X.target,t,e,X.self)})};function am(i,t){return X.self=i,X.target=X.cache[t],X.proxy}function a(i,t,e,r,s=null){let n=Object.getPrototypeOf(i.prototype),o=(r&(Ot.HasMixins|Ot.IsExtension))==Ot.HasMixins,l;if(o&&(Kt.set(i,Kt.get(n.constructor)),n=Object.getPrototypeOf(n)),s){let u=r&Ot.IsObjectExtension?s:s.prototype,f=Pt(i);if(f.uses){s===u&&console.warn("Cannot extend object with mixins");for(let c of f.uses)lr(s,c)}return r&Ot.HasSuperCalls&&(X.cache[t]=Object.create(Object.getPrototypeOf(u),Object.getOwnPropertyDescriptors(u))),Tl(u,i.prototype),s}let h=n?.constructor;if(l=Pt(i,{symbol:t}),Object.defineProperty(i,uu,{value:l,enumerable:!1,configurable:!0}),e&&i.name!==e&&Object.defineProperty(i,"name",{value:e,configurable:!0}),l.flags=r,r&Ot.HasConstructor&&(i.prototype[Sl]=t),l.uses)for(let u of l.uses)u.mixes?.(i);return h?.inherited instanceof Function&&h.inherited(i),i}function um(i,t){i[Sl]===t&&(i[hu]?.(),i[$l]&&i[$l].inited(i))}var be=Symbol.for("#__listeners__"),pu=/-./g,mm=new Set,mu=Symbol(),xi=class xi{static for(t){return new Proxy({},new this(t))}constructor(t){this.getter=t}get target(){return this.getter()}get(t,e){return this.target[e]}set(t,e,r){return this.target[e]=r,!0}};a(xi,mu,"LazyProxy",16);var vi=xi;function Cl(i,t={}){return new Proxy(t,new vi(i))}function ve(i){let t=typeof i;if(t=="number")return i;if(t=="string"){if(/^\d+fps$/.test(i))return 1e3/parseFloat(i);if(/^([-+]?[\d\.]+)s$/.test(i))return parseFloat(i)*1e3;if(/^([-+]?[\d\.]+)ms$/.test(i))return parseFloat(i)}return null}function gm(i){return i.indexOf("-")>=0?i.replace(pu,function(t){return t.charAt(1).toUpperCase()}):i}function $i(i,t,e){if(!i)return;let r=Object.getOwnPropertyDescriptor(i,t);return r||i==e?r||void 0:$i(Reflect.getPrototypeOf(i),t,e)}var Ll=function(i,t,e){let r,s,n;for(;(r=e)&&(e=e.next);)(s=e.listener)&&(e.path&&s[e.path]?n=t?s[e.path].apply(s,t):s[e.path]():n=t?s.apply(e,t):s.call(e)),e.times&&--e.times<=0&&(r.next=e.next,e.listener=null)};function j(i,t,e,r){let s,n,o;return s=i[be]||(i[be]={}),n=s[t]||(s[t]={}),o=n.tail||(n.tail=n.next={}),o.listener=e,o.path=r,n.tail=o.next={},o}function P(i,t,e){let r=j(i,t,e);return r.times=1,r}function It(i,t,e,r){if(!e)return;let s,n,o=i[be];if(o&&(s=o[t])){for(;(n=s)&&(s=s.next);)if(s==e||s.listener==e){n.next=s.next,s.listener=null;break}}}function G(i,t,e=null){let r;(r=i[be])&&(r[t]&&Ll(t,e,r[t]),r.all&&Ll(t,[t,e],r.all))}var gu=Symbol(),Si=class Si{emit(t,...e){return G(this,t,e)}on(t,...e){return j(this,t,...e)}once(t,...e){return P(this,t,...e)}un(t,...e){return It(this,t,...e)}};a(Si,gu,"Emitter",0);var qt=Si;function ym(i){return i}function wi(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}function yu(i){let t;return i&&((t=i.toIterable)?t.call(i):i)}var Nl=Symbol.for("#__init__"),El=Symbol.for("#schedule"),_i=Symbol.for("#frames"),hr=Symbol.for("#interval"),Yt=Symbol.for("#stage"),Wt=Symbol.for("#scheduled"),ar=Symbol.for("#version"),bu=Symbol.for("#fps"),Ml=Symbol.for("#ticker"),vu=globalThis.requestAnimationFrame||function(i){return globalThis.setTimeout(i,1e3/60)};var $m=1/60,$u=Symbol(),Ci=class Ci{constructor(t=null){this[Nl](t)}[Nl](t=null,e=!0,r=!0){var s;this.owner=t&&(s=t.owner)!==void 0?s:null,this.target=t&&(s=t.target)!==void 0?s:null,this.active=t&&(s=t.active)!==void 0?s:!1,this.value=t&&(s=t.value)!==void 0?s:void 0,this.skip=t&&(s=t.skip)!==void 0?s:0,this.last=t&&(s=t.last)!==void 0?s:0}tick(t,e){return this.last=this.owner[_i],this.target.tick(this,e),1}update(t,e){let r=this.active,s=t.value;return this.value!=s&&(this.deactivate(),this.value=s),(this.value||r||e)&&this.activate(),this}queue(){this.owner.add(this)}activate(){return this.value===!0?this.owner.on("commit",this):this.value===!1||typeof this.value=="number"&&(this.value/16.666666666666668<=2?this.owner.on("raf",this):this[hr]=globalThis.setInterval(this.queue.bind(this),this.value)),this.active=!0,this}deactivate(){return this.value===!0&&this.owner.un("commit",this),this.owner.un("raf",this),this[hr]&&(globalThis.clearInterval(this[hr]),this[hr]=null),this.active=!1,this}};a(Ci,$u,"Scheduled",16);var Ti=Ci,xu=Symbol(),Ni=class Ni{constructor(){var t=this;this.id=Symbol(),this.queue=[],this.stage=-1,this[Yt]=-1,this[_i]=0,this[Wt]=!1,this[ar]=0,this.listeners={},this.intervals={},this.commit=function(){return t.add("commit"),t},this[bu]=0,this.$promise=null,this.$resolve=null,this[Ml]=function(e){return t[Wt]=!1,t.tick(e)}}touch(){return this[ar]++}get version(){return this[ar]}add(t,e=!1){return(e||this.queue.indexOf(t)==-1)&&this.queue.push(t),this[Wt]||this[El](),this}get committingΦ(){return this.queue.indexOf("commit")>=0}get syncingΦ(){return this[Yt]==1}listen(t,e){let r=this.listeners[t],s=!r;return r||(r=this.listeners[t]=new Set),r.add(e),t=="raf"&&s&&this.add("raf"),this}unlisten(t,e){var r;let s=this.listeners[t];return s&&s.delete(e),t=="raf"&&s&&s.size==0&&(r=this.listeners.raf,delete this.listeners.raf),this}on(t,e){return this.listen(t,e)}un(t,e){return this.unlisten(t,e)}get promise(){var t=this;return this.$promise||(this.$promise=new Promise(function(e){return t.$resolve=e}))}tick(t){var e=this;let r=this.queue,s=this[_i]++;if(this.ts||(this.ts=t),this.dt=t-this.ts,this.ts=t,this.queue=[],this[Yt]=1,this[ar]++,r.length)for(let n=0,o=yu(r),l=o.length;n<l;n++){let h=o[n];typeof h=="string"&&this.listeners[h]?this.listeners[h].forEach(function(u){if(wi(u.tick,Function))return u.tick(e,h);if(wi(u,Function))return u(e,h)}):wi(h,Function)?h(this.dt,this):h.tick&&h.tick(this.dt,this)}return this[Yt]=this[Wt]?0:-1,this.$promise&&(this.$resolve(this),this.$promise=this.$resolve=null),this.listeners.raf&&this.add("raf"),this}[El](){return this[Wt]||(this[Wt]=!0,this[Yt]==-1&&(this[Yt]=0),vu(this[Ml])),this}schedule(t,e){var s,n;return e||(e=t[s=this.id]||(t[s]={value:!0})),(e[n=this.id]||(e[n]=new Ti({owner:this,target:t}))).update(e,!0)}unschedule(t,e={}){e||(e=t[this.id]);let r=e&&e[this.id];return r&&r.active&&r.deactivate(),this}};a(Ni,xu,"Scheduler",16);var Li=Ni,E=new Li;function F(){return E.add("commit").promise}function Su(i,t){return globalThis.setTimeout(function(){i(),F()},t)}function wu(i,t){return globalThis.setInterval(function(){i(),F()},t)}var _u=globalThis.clearInterval,Tu=globalThis.clearTimeout,$e=globalThis.imba||(globalThis.imba={});$e.commit=F;$e.setTimeout=Su;$e.setInterval=wu;$e.clearInterval=_u;$e.clearTimeout=Tu;var Ol={on:function(i,t){return j(this,i,t)},inited:function(i){return G(this,"inited",[i])}};function wm(){return!0}function Il(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}function Tm(i,t,e){if(e.get){let r=e.get;e.get=function(){let s=r.call(this);return Object.defineProperty(this,t,{enumerable:!1,value:s}),s}}return e}function Lm(i,t,e){var r,s;if(Il(e.value,Function)){let n=e.value;e.get=function(){if(this==i)return n;let o=n.bind(this);return Object.defineProperty(this,t,{enumerable:!1,value:o}),o},r=e.value,delete e.value,s=e.writable,delete e.writable}return e}var Pl=new WeakMap;function Cm(i,t,e){let r=this[0]||{},s=e.value,n=Symbol(),o=new WeakMap,l=Pl.get(i),h=r.timeout||20*1e3,u=""+(i.constructor?.name||"")+"."+String(typeof t=="symbol"?t.description:t);if(l||Pl.set(i,l={}),l.key)throw new Error("@thenable "+u+" not allowed - @thenable "+l.key+" already defined");if(!Il(s,Function))throw new Error("@thenable "+u+" only supports functions");if(s.length>0)throw new Error("@thenable "+u+" methods cannot be called with arguments");let f=function(g){return console.trace("@thenable "+u+" took more than "+h+"ms - make sure method does not return self.",g)},c=function(g){let d=o.get(g);return d||o.set(g,d={}),d},p=function(g,d){let m=this,b=c(m);return(b.promise||(b.promise=new Promise(function(O,me){let S=r.timeout!==!1?setTimeout(f,r.timeout||2e4,m):null,W=function(pt){return S&&clearTimeout(S),b.met=!0,b.error=pt,b.promise=null,b.wrapped=null,console.trace("@thenable "+u+" threw error",pt),me(pt)};return m[t]().then(function(){return S&&clearTimeout(S),b.met=!0,b.promise=null,b.wrapped=null,O(m)},W)}))).then(g,d)};return Object.defineProperty(i,"then",{enumerable:!1,configurable:!0,get:function(){return c(this).met?null:p}}),e.value=function(g){let d=c(this);return d.met?d.error?Promise.reject(d.error):Promise.resolve(this):(d.wrapped??(d.wrapped=Promise.resolve(s.call(this,d))),d.wrapped)},e.value.reset=function(g){let d=c(g);o.delete(g)},e.value.check=c,e}import jl from"cluster";import Q from"fs";import Qt from"path";import{EventEmitter as Eu}from"events";import kl from"path";var Lu=Symbol(),Xt,Fl=new(Xt=class{get rootDir(){return process.env.IMBA_OUTDIR||kl.dirname(process.env.pm_exec_path||process.argv[1])}get publicPath(){return kl.resolve(this.rootDir,process.env.IMBA_PUBDIR||globalThis.IMBA_PUBDIR||"public")}},a(Xt,Lu,"Env",0),Xt);import Mu from"http";function U(i){let t;return i&&((t=i.toIterable)?t.call(i):i)}function Vl(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}var Dl=Symbol.for("#setup"),Al=Symbol.for("#setup?"),Cu=Symbol.for("#dom"),Nu=Symbol.for("#server"),xe={html:{"Content-Type":"text/html; charset=utf-8"},txt:{"Content-Type":"text/plain; charset=utf-8"},js:{"Content-Type":"text/javascript; charset=utf-8"},cjs:{"Content-Type":"text/javascript; charset=utf-8"},mjs:{"Content-Type":"text/javascript; charset=utf-8"},json:{"Content-Type":"application/json; charset=utf-8"},css:{"Content-Type":"text/css; charset=utf-8"},map:{"Content-Type":"application/json; charset=utf-8"},otf:{"Content-Type":"font/otf"},ttf:{"Content-Type":"font/ttf"},woff:{"Content-Type":"font/woff"},woff2:{"Content-Type":"font/woff2"},svg:{"Content-Type":"image/svg+xml"},avif:{"Content-Type":"image/avif"},gif:{"Content-Type":"image/gif"},png:{"Content-Type":"image/png"},apng:{"Content-Type":"image/apng"},webp:{"Content-Type":"image/webp"},jpg:{"Content-Type":"image/jpeg"},jpeg:{"Content-Type":"image/jpeg"},ico:{"Content-Type":"image/x-icon"},bmp:{"Content-Type":"image/bmp"},pdf:{"Content-Type":"application/pdf"},webm:{"Content-Type":"video/webm"},weba:{"Content-Type":"audio/webm"},avi:{"Content-Type":"video/x-msvideo"},mp3:{"Content-Type":"audio/mpeg"},mp4:{"Content-Type":"video/mp4"},m4a:{"Content-Type":"audio/m4a"},mov:{"Content-Type":"video/quicktime"},wmv:{"Content-Type":"video/x-ms-wmv"},mpeg:{"Content-Type":"video/mpeg"},wav:{"Content-Type":"audio/wav"},ogg:{"Content-Type":"audio/ogg"},ogv:{"Content-Type":"video/ogg"},oga:{"Content-Type":"audio/ogg"},opus:{"Content-Type":"audio/opus"}},Rl={id:Date.now()},z=globalThis.process,Ou=Symbol(),Pi=class Pi extends Set{call(t,...e){var r;r=[];for(let s of U(this))r.push(s[t](...e));return r}close(t={}){var e;e=[];for(let r of U(this))e.push(r.close(t));return e}reload(t={}){var e;e=[];for(let r of U(this))e.push(r.reload(t));return e}broadcast(t,...e){var r;r=[];for(let s of U(this))r.push(s.broadcast(t,...e));return r}emit(t,e){var r;r=[];for(let s of U(this))r.push(s.emit(t,e));return r}sseEnd(){let t=[];for(let e of U(this))for(let r of U(e.clients))t.push(new Promise(function(s){return r.on("finish",s),r.end()}));return Promise.all(t)}};a(Pi,Ou,"Servers",0);var Ei=Pi,kt=new Ei,Pu=Symbol(),Jt,Hl=new(Jt=class extends Eu{constructor(){var t;super(...arguments),t=this,this.autoreload=!1,this.state={},globalThis.IMBA_RUN&&(jl.isWorker?z.on("message",function(e){if(t.emit("message",e),e[0]=="emit")return t.emit(...e.slice(1))}):z.on("message",function(e){if(e[0]=="emit")return t.emit(...e.slice(1))}))}[Dl](){var t=this;if(this[Al]!=!0&&(this[Al]=!0,!0))return this.on("rebuild",function(e){let r=globalThis.IMBA_MANIFEST;return globalThis.IMBA_MANIFEST=e,kt.broadcast("rebuild",e)}),this.on("reloadHard",async function(e){return kt.broadcast("reloadHard",e),await kt.sseEnd(),z.exit(0)}),this.on("reloading",function(e){var r;t.state.reloading=!0,r=[];for(let s of U(kt))r.push(s.pause());return r}),this.on("reloaded",async function(e){var r;t.state.reloaded=!0,kt.broadcast("reloaded"),await new Promise(function(n){return setTimeout(n,100)}),r=[];for(let n of U(kt))r.push(n.close());let s=r;return setTimeout(function(){return z.exit(0)},100),await Promise.all(s),z.exit(0)}),!0}send(t){if(Vl(z.send,Function))return z.send(t)}on(t,e){return super.on(...arguments)}reload(){if(!(this.isReloading!=!0&&(this.isReloading=!0,!0)))return this;if(this.state.reloading=!0,!z.env.IMBA_SERVE){console.warn("not possible to gracefully reload servers not started via imba start");return}this.send("reload")}},a(Jt,Pu,"Process",24),Jt);function Gl(i,t=[],e=0){let r=globalThis.IMBA_MANIFEST[i];if(t.indexOf(i)>=0)return t;if(r?.imports)for(let s=0,n=U(r?.imports),o=n.length;s<o;s++){let l=n[s];t.push(l),Gl(l,t,e+1)}return t}var Iu=Symbol(),Ii=class Ii{constructor(t,e,r={}){this.server=t,this.url=e,[this.pathname,this.query]=e.split("?"),this.ext=Qt.extname(this.pathname),this.headers={"Content-Type":"text/plain","Access-Control-Allow-Origin":"*","cache-control":"public, max-age=31536000"},Object.assign(this.headers,t.options.assetHeaders||{}),Object.assign(this.headers,xe[this.ext.slice(1)]||{}),this.headers["max-age"]=864e5,r.imports&&t.options.preload!==!1&&(this.headers.Link=Gl(e).map(function(s){return"<"+s+">; rel=modulepreload; as=script"}).join(", ")),this.path=t.localPathForUrl(e)}respond(t,e){var r=this;return Q.access(this.path,Q.constants.R_OK,function(s){if(s)return e.writeHead(404,{}),e.end();try{if(r.server.options.setHeaders&&r.server.options.setHeaders(e,r.path),globalThis.BUN)return Q.readFile(r.path,function(n,o){return e.writeHead(200,r.headers),e.end(o)});{let n=Q.createReadStream(r.path);return e.writeHead(200,r.headers),n.pipe(e)}}catch{return e.writeHead(503,{}),e.end()}})}createReadStream(){return Q.createReadStream(this.path)}pipe(t){return this.createReadStream().pipe(t)}};a(Ii,Iu,"AssetResponder",16);var Mi=Ii,ku=Symbol(),ki=class ki{static wrap(t,e={}){return new this(t,e)}localPathForUrl(t){var n;let e,r,s=t.replace(/\?.*$/,"");return(n=this.urlToLocalPathMap)[s]??(n[s]=(e=Qt.resolve(Fl.publicPath,"."+s),r=Q.existsSync(e)&&e,!r&&this.staticDir&&(e=Qt.resolve(this.staticDir,"."+s),r=Q.existsSync(e)&&e),r))}headersForAsset(t){let e,r=Qt.extname(t);return e=Object.assign({"Content-Type":"text/plain","Access-Control-Allow-Origin":"*","cache-control":"public"},xe[r.slice(1)]||{})}get manifest(){return globalThis.IMBA_MANIFEST||{}}constructor(t,e={}){var r=this;kt.add(this),this.id=Math.random(),this.startedAt=Date.now(),this.options=e,this.closed=!1,this.paused=!1,this.server=t,this.clients=new Set,this.stalledResponses=[],this.assetResponders={},this.urlToLocalPathMap={},this.publicExistsMap={},this.staticDir=globalThis.IMBA_STATICDIR||"",z.env.IMBA_PATH&&(this.devtoolsPath=Qt.resolve(z.env.IMBA_PATH,"hmr.js")),this.scheme=Vl(t,Mu.Server)?"http":"https";let s=this.server._events.request,n=globalThis[Cu];t.off("request",s),s[Nu]=this,t.on("listening",function(){let o=r.server.address(),l=o.address;(l=="::"||l=="0.0.0.0")&&(l="localhost");let h=""+r.scheme+"://"+l+":"+o.port+"/";if(!z.env.IMBA_CLUSTER)return console.log("listening on "+h)}),globalThis.IMBA_HMR&&(globalThis.IMBA_HMR_PATH="/__hmr__.js"),this.handler=function(o,l){var d;let h,u=o.constructor.name=="Http2ServerRequest",f=o.url;if(r.paused||r.closed)return l.statusCode=302,l.setHeader("Location",o.url),u||l.setHeader("Connection","close"),r.closed?(u&&o.stream.session.close(),l.end()):r.stalledResponses.push(l);if(f=="/__imba__.mjs"){l.writeHead(200,xe.mjs);let m=Qt.resolve(z.env.IMBA_PATH,"dist","imba.mjs");return Q.createReadStream(m).pipe(l)}if(globalThis.IMBA_HMR){if(f=="/__hmr__.json")return l.writeHead(200,xe.json),l.end(JSON.stringify(Rl));if(f=="/__hmr__.js"&&r.devtoolsPath){let m=Q.createReadStream(r.devtoolsPath);return l.writeHead(200,xe.js),m.pipe(l)}if(f=="/__hmr__"){let m={"Content-Type":"text/event-stream","Cache-Control":"no-cache"};return u||(m.Connection="keep-alive"),l.writeHead(200,m),r.clients.add(l),r.broadcast("init",globalThis.IMBA_MANIFEST,[l]),r.broadcast("state",Rl,[l]),o.on("close",function(){return r.clients.delete(l)}),!0}}let c=o.headers,p;u?p=c[":scheme"]+"://"+c[":authority"]:p=(o.connection.encrypted?"https":"http")+"://"+c.host;let g=r.manifest[f];if(g&&r.localPathForUrl(f))return((d=r.assetResponders)[f]||(d[f]=new Mi(r,f,g))).respond(o,l);if((f.match(/\.[A-Z\d]{8}\./)||f.match(/\.\w{1,4}($|\?)/))&&(h=r.localPathForUrl(f)))try{let m=r.headersForAsset(h);if(e.setHeaders&&e.setHeaders(l,h),globalThis.BUN)return Q.readFile(h,function(b,_){return b?(l.writeHead(500,{}),l.write("Error getting the file: "+b)):(l.writeHead(200,m),l.end(_))});{let b=Q.createReadStream(h);return l.writeHead(200,m),b.pipe(l)}}catch{return l.writeHead(503,{}),l.end()}if(n){let m=new n.Location(o.url,p);return n.Document.create({location:m},function(){return s(o,l)})}else return s(o,l)},t.on("request",this.handler),t.on("close",function(){return console.log("server is closing!")}),globalThis.IMBA_RUN&&(jl.isWorker||z.env.IMBA_WATCH)&&(Hl[Dl](),Hl.send("serve"))}broadcast(t,e={},r=this.clients){e=JSON.stringify(e);let s="data: "+e+`
`;for(let n of U(r))n.write("event: "+t+`
`),n.write(`id: imba
`),n.write(s);return this}pause(){return this.paused!=!0&&(this.paused=!0,!0)&&this.broadcast("paused"),this}resume(){if(this.paused!=!1&&(this.paused=!1,!0))return this.broadcast("resumed"),this.flushStalledResponses()}flushStalledResponses(){for(let t=0,e=U(this.stalledResponses),r=e.length;t<r;t++)e[t].end();return this.stalledResponses=[]}close(){var t=this;return this.pause(),new Promise(function(e){return t.closed=!0,t.server.close(e),t.flushStalledResponses()})}};a(ki,ku,"Server",16);var Oi=ki;function Vm(i,...t){return Oi.wrap(i,...t)}var Fi={};function jm(i,t,e){if(t!=null){let r=Fi[i]||(Fi[i]=new WeakMap);return r.get(t)||r.set(t,(e.memoized=i)&&e).get(t)}return e}function Fu(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}var Se=Symbol.for("#idler"),we=Symbol.for("#resolve"),Au=Symbol(),Ai=class Ai extends Set{constructor(){super(),this[Se]=Promise.resolve(this)}emit(t,...e){return G(this,t,e)}on(t,...e){return j(this,t,...e)}once(t,...e){return P(this,t,...e)}un(t,...e){return It(this,t,...e)}add(t){var e=this;if(Fu(t,Function)&&(t=t()),!this.has(t)){let r=this.size==0;super.add(t),r&&(this[Se]=this[we]=null,this.emit("busy",this)),this.emit("add",t,this);let s=function(){return e.delete(t)};t.then(s,s)}return t}delete(t){return super.delete(t)?(this.emit("delete",t,this),this.size==0&&(this[we]&&(this[we](!0),this[we]=null),this.emit("idle",this)),!0):!1}get idle(){var t=this;return this[Se]||(this[Se]=new Promise(function(e){return t.size==0?e(!0):t[we]=e}))}get idleΦ(){return this.size==0}then(t,e){return this.idle.then(t,e)}};a(Ai,Au,"Queue",24);var ur=Ai;function Ru(i,t){let e=[],r=[];for(let s=0,n=_l(i),o=n.length;s<o;s++){let l=n[s];if(s%2!=0)continue;let h=i[s+1];l==""?(r.push("%s"),e.push(""+"\x1B[40m\x1B[32m"+h+"\x1B[0m")):(r.push("%s %O"),e.push("\x1B[44m\x1B[97m"+l+"\x1B[0m"),e.push(h))}return[r.join(" "),...e]}var cr=Symbol.for("#L");function qm(){return globalThis[cr]||(globalThis[cr]=globalThis[cr]||Ru),!0}function Hu(i){let t;return i&&((t=i.toIterable)?t.call(i):i)}var J={"":[-1,{id:1,slot:1,part:1,elementTiming:"elementtiming"}],HTML:[-1,{title:1,lang:1,translate:1,dir:1,accessKey:"accesskey",draggable:1,spellcheck:1,autocapitalize:1,inputMode:"inputmode",style:1,tabIndex:"tabindex",enterKeyHint:"enterkeyhint"}],HTMLAnchor:[1,{target:1,download:1,ping:1,rel:1,relList:"rel",hreflang:1,type:1,referrerPolicy:"referrerpolicy",coords:1,charset:1,name:1,rev:1,shape:1,href:1}],HTMLArea:[1,{alt:1,coords:1,download:1,shape:1,target:1,ping:1,rel:1,relList:"rel",referrerPolicy:"referrerpolicy",href:1}],HTMLMedia:[1,{src:1,crossOrigin:"crossorigin",preload:1,controlsList:"controlslist"}],HTMLAudio:[4,{}],HTMLBase:[1,{href:1,target:1}],HTMLQuote:[1,{cite:1}],HTMLBody:[1,{text:1,link:1,vLink:"vlink",aLink:"alink",bgColor:"bgcolor",background:1}],HTMLBR:[1,{clear:1}],HTMLButton:[1,{formAction:"formaction",formEnctype:"formenctype",formMethod:"formmethod",formTarget:"formtarget",name:1,type:1,value:1}],HTMLCanvas:[1,{width:1,height:1}],HTMLTableCaption:[1,{align:1}],HTMLTableCol:[1,{span:1,align:1,ch:"char",chOff:"charoff",vAlign:"valign",width:1}],HTMLData:[1,{value:1}],HTMLDataList:[1,{}],HTMLMod:[1,{cite:1,dateTime:"datetime"}],HTMLDetails:[1,{}],HTMLDialog:[1,{}],HTMLDiv:[1,{align:1}],HTMLDList:[1,{}],HTMLEmbed:[1,{src:1,type:1,width:1,height:1,align:1,name:1}],HTMLFieldSet:[1,{name:1}],HTMLForm:[1,{acceptCharset:"accept-charset",action:1,autocomplete:1,enctype:1,encoding:"enctype",method:1,name:1,target:1}],HTMLHeading:[1,{align:1}],HTMLHead:[1,{}],HTMLHR:[1,{align:1,color:1,size:1,width:1}],HTMLHtml:[1,{version:1}],HTMLIFrame:[1,{src:1,srcdoc:1,name:1,sandbox:1,width:1,height:1,referrerPolicy:"referrerpolicy",csp:1,allow:1,align:1,scrolling:1,frameBorder:"frameborder",longDesc:"longdesc",marginHeight:"marginheight",marginWidth:"marginwidth",loading:1}],HTMLImage:[1,{alt:1,src:1,srcset:1,sizes:1,crossOrigin:"crossorigin",useMap:"usemap",width:1,height:1,referrerPolicy:"referrerpolicy",decoding:1,name:1,lowsrc:1,align:1,hspace:1,vspace:1,longDesc:"longdesc",border:1,loading:1}],HTMLInput:[1,{accept:1,alt:1,autocomplete:1,dirName:"dirname",formAction:"formaction",formEnctype:"formenctype",formMethod:"formmethod",formTarget:"formtarget",height:1,max:1,maxLength:"maxlength",min:1,minLength:"minlength",name:1,pattern:1,placeholder:1,src:1,step:1,type:1,defaultValue:"value",value:1,width:1,align:1,useMap:"usemap",required:1}],HTMLLabel:[1,{htmlFor:"for"}],HTMLLegend:[1,{align:1}],HTMLLI:[1,{value:1,type:1}],HTMLLink:[1,{href:1,crossOrigin:"crossorigin",rel:1,relList:"rel",media:1,hreflang:1,type:1,as:1,referrerPolicy:"referrerpolicy",sizes:1,imageSrcset:"imagesrcset",imageSizes:"imagesizes",charset:1,rev:1,target:1,integrity:1}],HTMLMap:[1,{name:1}],HTMLMenu:[1,{}],HTMLMeta:[1,{name:1,httpEquiv:"http-equiv",content:1,scheme:1,property:1,charset:1}],HTMLMeter:[1,{value:1,min:1,max:1,low:1,high:1,optimum:1}],HTMLObject:[1,{data:1,type:1,name:1,useMap:"usemap",width:1,height:1,align:1,archive:1,code:1,hspace:1,standby:1,vspace:1,codeBase:"codebase",codeType:"codetype",border:1}],HTMLOList:[1,{start:1,type:1}],HTMLOptGroup:[1,{label:1}],HTMLOption:[1,{label:1,value:1}],HTMLOutput:[1,{htmlFor:"for",name:1}],HTMLParagraph:[1,{align:1}],HTMLParam:[1,{name:1,value:1,type:1,valueType:"valuetype"}],HTMLPicture:[1,{}],HTMLPre:[1,{width:1}],HTMLProgress:[1,{value:1,max:1}],HTMLScript:[1,{src:1,type:1,charset:1,crossOrigin:"crossorigin",referrerPolicy:"referrerpolicy",event:1,htmlFor:"for",integrity:1,defer:1,async:1}],HTMLSelect:[1,{autocomplete:1,name:1,size:1,value:1,required:1}],HTMLSlot:[1,{name:1}],HTMLSource:[1,{src:1,type:1,srcset:1,sizes:1,media:1}],HTMLSpan:[1,{}],HTMLStyle:[1,{media:1,type:1}],HTMLTable:[1,{align:1,border:1,frame:1,rules:1,summary:1,width:1,bgColor:"bgcolor",cellPadding:"cellpadding",cellSpacing:"cellspacing"}],HTMLTableSection:[1,{align:1,ch:"char",chOff:"charoff",vAlign:"valign"}],HTMLTableCell:[1,{colSpan:"colspan",rowSpan:"rowspan",headers:1,align:1,axis:1,height:1,width:1,ch:"char",chOff:"charoff",vAlign:"valign",bgColor:"bgcolor",abbr:1,scope:1}],HTMLTemplate:[1,{}],HTMLTextArea:[1,{autocomplete:1,cols:1,dirName:"dirname",maxLength:"maxlength",minLength:"minlength",name:1,placeholder:1,rows:1,wrap:1}],HTMLTime:[1,{dateTime:"datetime"}],HTMLTitle:[1,{}],HTMLTableRow:[1,{align:1,ch:"char",chOff:"charoff",vAlign:"valign",bgColor:"bgcolor"}],HTMLTrack:[1,{kind:1,src:1,srclang:1,label:1}],HTMLUList:[1,{type:1}],HTMLVideo:[4,{width:1,height:1,poster:1}],SVG:[-1,{}],SVGGraphics:[66,{transform:1}],SVGA:[67,{}],SVGAnimation:[66,{}],SVGAnimate:[69,{}],SVGAnimateMotion:[69,{}],SVGAnimateTransform:[69,{}],SVGGeometry:[67,{}],SVGCircle:[73,{cx:1,cy:1,r:1}],SVGClipPath:[67,{clipPathUnits:1}],SVGDefs:[67,{}],SVGDesc:[66,{}],SVGDiscard:[66,{}],SVGEllipse:[73,{cx:1,cy:1,rx:1,ry:1}],SVGFEBlend:[66,{mode:1,x:1,y:1,width:1,height:1}],SVGFEColorMatrix:[66,{type:1,values:1,x:1,y:1,width:1,height:1}],SVGFEComponentTransfer:[66,{x:1,y:1,width:1,height:1}],SVGFEComposite:[66,{operator:1,x:1,y:1,width:1,height:1}],SVGFEConvolveMatrix:[66,{orderX:1,orderY:1,kernelMatrix:1,divisor:1,edgeMode:1,x:1,y:1,width:1,height:1}],SVGFEDiffuseLighting:[66,{surfaceScale:1,diffuseConstant:1,x:1,y:1,width:1,height:1}],SVGFEDisplacementMap:[66,{xChannelSelector:1,yChannelSelector:1,x:1,y:1,width:1,height:1}],SVGFEDistantLight:[66,{}],SVGFEDropShadow:[66,{dx:1,dy:1,stdDeviationX:1,stdDeviationY:1,x:1,y:1,width:1,height:1}],SVGFEFlood:[66,{x:1,y:1,width:1,height:1}],SVGComponentTransferFunction:[66,{type:1,tableValues:1,slope:1,amplitude:1,exponent:1}],SVGFEFuncA:[90,{}],SVGFEFuncB:[90,{}],SVGFEFuncG:[90,{}],SVGFEFuncR:[90,{}],SVGFEGaussianBlur:[66,{x:1,y:1,width:1,height:1}],SVGFEImage:[66,{preserveAspectRatio:1,x:1,y:1,width:1,height:1}],SVGFEMerge:[66,{x:1,y:1,width:1,height:1}],SVGFEMergeNode:[66,{}],SVGFEMorphology:[66,{operator:1,x:1,y:1,width:1,height:1}],SVGFEOffset:[66,{x:1,y:1,width:1,height:1}],SVGFEPointLight:[66,{}],SVGFESpecularLighting:[66,{surfaceScale:1,specularConstant:1,specularExponent:1,x:1,y:1,width:1,height:1}],SVGFESpotLight:[66,{specularExponent:1}],SVGFETile:[66,{x:1,y:1,width:1,height:1}],SVGFETurbulence:[66,{numOctaves:1,stitchTiles:1,type:1,x:1,y:1,width:1,height:1}],SVGFilter:[66,{filterUnits:1,primitiveUnits:1,x:1,y:1,width:1,height:1}],SVGForeignObject:[67,{x:1,y:1,width:1,height:1}],SVGG:[67,{}],SVGImage:[67,{x:1,y:1,width:1,height:1,preserveAspectRatio:1}],SVGLine:[73,{x1:1,y1:1,x2:1,y2:1}],SVGGradient:[66,{gradientUnits:1,gradientTransform:1,spreadMethod:1}],SVGLinearGradient:[111,{x1:1,y1:1,x2:1,y2:1}],SVGMarker:[66,{refX:1,refY:1,markerUnits:1,markerWidth:1,markerHeight:1,orientType:1,orientAngle:1,viewBox:1,preserveAspectRatio:1}],SVGMask:[66,{maskUnits:1,maskContentUnits:1,x:1,y:1,width:1,height:1}],SVGMetadata:[66,{}],SVGMPath:[66,{}],SVGPath:[73,{}],SVGPattern:[66,{patternUnits:1,patternContentUnits:1,patternTransform:1,x:1,y:1,width:1,height:1,viewBox:1,preserveAspectRatio:1}],SVGPolygon:[73,{}],SVGPolyline:[73,{}],SVGRadialGradient:[111,{cx:1,cy:1,r:1,fx:1,fy:1,fr:1}],SVGRect:[73,{x:1,y:1,width:1,height:1,rx:1,ry:1}],SVGScript:[66,{}],SVGSet:[69,{}],SVGStop:[66,{}],SVGStyle:[66,{}],SVGSVG:[67,{x:1,y:1,width:1,height:1,viewBox:1,preserveAspectRatio:1}],SVGSwitch:[67,{}],SVGSymbol:[66,{viewBox:1,preserveAspectRatio:1}],SVGTextContent:[67,{textLength:1,lengthAdjust:1}],SVGTextPositioning:[130,{x:1,y:1,dx:1,dy:1,rotate:1}],SVGText:[131,{}],SVGTextPath:[130,{startOffset:1,method:1,spacing:1}],SVGTitle:[66,{}],SVGTSpan:[131,{}],SVGUse:[67,{x:1,y:1,width:1,height:1}],SVGView:[66,{viewBox:1,preserveAspectRatio:1}]},C={a:2,abbr:1,address:1,area:3,article:1,aside:1,audio:5,b:1,base:6,bdi:1,bdo:1,blockquote:7,body:8,br:9,button:10,canvas:11,caption:12,cite:1,code:1,col:13,colgroup:13,data:14,datalist:15,dd:1,del:16,details:17,dfn:1,dialog:18,div:19,dl:20,dt:1,em:1,embed:21,fieldset:22,figcaption:1,figure:1,footer:1,form:23,h1:24,h2:24,h3:24,h4:24,h5:24,h6:24,head:25,header:1,hgroup:1,hr:26,html:27,i:1,iframe:28,img:29,input:30,ins:16,kbd:1,label:31,legend:32,li:33,link:34,main:1,map:35,mark:1,menu:36,meta:37,meter:38,nav:1,noscript:1,object:39,ol:40,optgroup:41,option:42,output:43,p:44,param:45,picture:46,pre:47,progress:48,q:7,rp:1,rt:1,ruby:1,s:1,samp:1,script:49,section:1,select:50,slot:51,small:1,source:52,span:53,strike:1,strong:1,style:54,sub:1,summary:1,sup:1,table:55,tbody:56,td:57,template:58,textarea:59,tfoot:56,th:57,thead:56,time:60,title:61,tr:62,track:63,u:1,ul:64,var:1,video:65,wbr:1,svg_a:68,svg_animate:70,svg_animateMotion:71,svg_animateTransform:72,svg_audio:66,svg_canvas:66,svg_circle:74,svg_clipPath:75,svg_defs:76,svg_desc:77,svg_discard:78,svg_ellipse:79,svg_feBlend:80,svg_feColorMatrix:81,svg_feComponentTransfer:82,svg_feComposite:83,svg_feConvolveMatrix:84,svg_feDiffuseLighting:85,svg_feDisplacementMap:86,svg_feDistantLight:87,svg_feDropShadow:88,svg_feFlood:89,svg_feFuncA:91,svg_feFuncB:92,svg_feFuncG:93,svg_feFuncR:94,svg_feGaussianBlur:95,svg_feImage:96,svg_feMerge:97,svg_feMergeNode:98,svg_feMorphology:99,svg_feOffset:100,svg_fePointLight:101,svg_feSpecularLighting:102,svg_feSpotLight:103,svg_feTile:104,svg_feTurbulence:105,svg_filter:106,svg_foreignObject:107,svg_g:108,svg_iframe:66,svg_image:109,svg_line:110,svg_linearGradient:112,svg_marker:113,svg_mask:114,svg_metadata:115,svg_mpath:116,svg_path:117,svg_pattern:118,svg_polygon:119,svg_polyline:120,svg_radialGradient:121,svg_rect:122,svg_script:123,svg_set:124,svg_stop:125,svg_style:126,svg_svg:127,svg_switch:128,svg_symbol:129,svg_text:132,svg_textPath:133,svg_title:134,svg_tspan:135,svg_unknown:66,svg_use:136,svg_video:66,svg_view:137},Ri=Object.keys(J);for(let i=0,t=Hu(Ri),e=t.length;i<e;i++){let r=t[i],s=J[r];s.name=r+"Element",s.up=J[Ri[s[0]]]}for(let i=0,t=Object.keys(C),e=t.length,r,s;i<e;i++)r=t[i],s=C[r],C[r]=J[Ri[s]],r.indexOf("svg_")==0&&(C[r.replace("_",":")]=C[r]);import{AsyncLocalStorage as zl}from"async_hooks";var Bl=Symbol.for("#toStringDeopt"),_e=Symbol.for("#named"),Ul=Symbol.for("#symbols"),Kl=Symbol.for("#batches"),ql=Symbol.for("#extras"),Hi=Symbol.for("#stacks"),Vu=Symbol(),Vi=class Vi{constructor(t){this.dom=t,this.string=""}contains(t){return this.dom.classList.contains(t)}has(t){return this.dom.classList.contains(t)}add(t){return this.contains(t)?this:(this.string+=(this.string?" ":"")+t,this.dom.classList.add(t),this)}set(t,e){this[_e]||(this[_e]={});let r=this[_e][t];return r!=e&&(r&&this.decr(r),e&&this.incr(e),this[_e][t]=e),this}remove(t){if(!this.contains(t))return this;let e=new RegExp("(^|\\s)"+t+"(?=\\s|$)","g");return this.string=this.string.replace(e,""),this.dom.classList.remove(t),this}toggle(t,e){return e===void 0&&(e=!this.contains(t)),e?this.add(t):this.remove(t)}incr(t,e=0){var r=this;let s=this.stacks,n=s[t]||0;return n<1&&this.add(t),e>0&&setTimeout(function(){return r.decr(t)},e),s[t]=Math.max(n,0)+1}decr(t){let e=this.stacks,r=e[t]||0;return r==1&&this.remove(t),e[t]=Math.max(r,1)-1}reconcile(t,e,r){let s=this[Ul],n=this[Kl],o=!0;if(!s)s=this[Ul]=[t],n=this[Kl]=[e||""],r&&(this.dom.className||"").indexOf(r)==-1&&(s.push(t),n.push(r)),this.toString=this.valueOf=this[Bl];else{let l=s.indexOf(t),h=e||"";l==-1?(s.push(t),n.push(h),r&&(this.dom.className||"").indexOf(r)==-1&&(s.push(t),n.push(r))):n[l]!=h?n[l]=h:o=!1}o&&(this[ql]=" "+n.join(" "),this.sync())}valueOf(){return this.string}toString(){return this.string}[Bl](){return this.string+(this[ql]||"")}sync(){return this.dom.flagSync$()}get stacks(){return this[Hi]||(this[Hi]={})}};a(Vi,Vu,"Flags",16);var Ft=Vi;var Yl=Symbol.for("#__init__"),Di=Symbol.for("#getRenderContext"),Du=Symbol.for("#getDynamicContext"),ju=Symbol.for("#removeFromCache"),L={context:null,document:null,createTextNode:function(i){return globalThis.document.createTextNode(i)}},Gu=Symbol(),Gi=class Gi{constructor(t=null){this[Yl](t)}[Yl](t=null,e=!0,r=!0){var s;this.stack=t&&(s=t.stack)!==void 0?s:[],this.moving=t&&(s=t.moving)!==void 0?s:new Set}push(t){return this.stack.push(t)}pop(t){return this.stack.pop()}};a(Gi,Gu,"Renderer",16);var ji=Gi,Z=new ji,zu=Symbol(),fr=class fr extends Map{constructor(t,e=null){super(),this._=t,this.sym=e}pop(){return L.context=null}[Di](t){let e=this.get(t);return e||this.set(t,e=new fr(this._,t)),L.context=e}[Du](t,e){return this[Di](t)[Di](e)}[ju](t){let e=this[t];return e&&(this.delete(e),this[t]=null,this.value==e&&(this.value=null)),this}run(t,e=1){if(this.value=t,L.context==this&&(L.context=null),e==0){let r=t;if(typeof r=="number"&&(r=String(r)),typeof r=="string"){let s=this.text||(this.text=L.createTextNode(r));return r!=s.textContent&&(s.textContent=r),s}}return this.get(t)}cache(t){return this.set(this.value,t),t}};a(fr,zu,"RenderContext",16);var mt=fr;function dr(i,t=Symbol(),e=i){return L.context=i[t]||(i[t]=new mt(e,t))}function eg(){let i=L.context,t=i||new mt(null);return globalThis.DEBUG_IMBA&&!i&&Z.stack.length>0&&console.trace("detected unmemoized nodes in",Z.stack.slice(0),"see https://imba.io",t),i&&(L.context=null),t}function et(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}function Me(i){let t;return i&&((t=i.toIterable)?t.call(i):i)}var ts=Symbol.for("#parent"),nh=Symbol.for("#context"),Wl=Symbol.for("#closestNode"),Bu=Symbol.for("#parentNode"),At=Symbol.for("#__init__"),Uu=Symbol.for("##inited"),zi=Symbol.for("#getRenderContext"),Ku=Symbol.for("#getDynamicContext"),Bi=Symbol.for("#replaceChild"),Pe=Symbol.for("#appendChild"),Xl=Symbol.for("#removeChild"),gt=Symbol.for("#insertInto"),Ql=Symbol.for("#insertChild"),Te=Symbol.for("#removeFrom"),Jl=Symbol.for("#removeFromDeopt"),Zt=Symbol.for("#replaceWith"),Zl=Symbol.for("#replaceWithDeopt"),Ui=Symbol.for("#placeholderNode"),qu=Symbol.for("#attachToParent"),Yu=Symbol.for("#detachFromParent"),Wu=Symbol.for("#placeChild"),Xu=Symbol.for("#beforeReconcile"),Qu=Symbol.for("#afterReconcile"),Ju=Symbol.for("#afterVisit"),Zu=Symbol.for("#visitContext"),Ki=Symbol.for("#document"),gr=Symbol.for("#htmlNodeName"),th=Symbol.for("#ImbaElement"),qi=Symbol.for("#flags"),te=Symbol.for("#scripts"),pr=Symbol.for("#location"),Yi=Symbol.for("##document"),oh=Symbol.for("##parent"),tc=Symbol.for("##up"),Wi=Symbol.for("##context"),Le=Symbol.for("#domNode"),Ce=Symbol.for("##placeholderNode"),eh=Symbol.for("#domDeopt"),ec=Symbol.for("#insertIntoDeopt"),Xi=Symbol.for("##classList"),Ne=Symbol.for("##style"),Qi=Symbol.for("##dataset"),ct=Symbol.for("#asset"),Ji=Symbol.for("#innerHTML"),Ee=Symbol.for("##visitContext"),rc=Symbol.for("#isRichElement"),Oe=Symbol.for("#src"),ic=Symbol.for("#getSlot"),sc=Symbol.for("#cssns"),nc=Symbol.for("#cssid"),oc=Symbol.for("#dom"),lc={},yr=null,hc=Symbol(),cs=class cs extends URL{};a(cs,hc,"Location",0);var Ie=cs,ac=Symbol(),fs=class fs{get document(){return this[Ki]||(this[Ki]=new this.Document(this))}get location(){return this.document.location}};a(fs,ac,"Window",0);var rh=fs;function ag(){return globalThis.imba.uses_window=!0,!0}var uc={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},tt=null,lh={},cc=Symbol(),ds=class ds{define(){return this}get(){return this}upgrade(){}whenDefined(){}};a(ds,cc,"CustomElementRegistry",0);var es=ds,ug=new es,fc={};function yt(i,t){let e=i;if(typeof i=="string"&&(i=J[i]||C[i]||J[i+"Element"]||C["svg_"+i]),et(i,I))return i;if(!i)return yt("HTML");if(i&&!i.klass){let r=Symbol(),n=class n extends yt(i.up){};a(n,r,"element",0);let s=n;i.klass=s}if(i&&!i.idl){i.idl=!0;let r=Object.getOwnPropertyDescriptors(i.klass.prototype);for(let s=i[1],n=0,o=Object.keys(s),l=o.length,h,u;n<l;n++){h=o[n],u=s[h];let f=u==1?h:u;r[f]||f=="style"||Object.defineProperty(i.klass.prototype,h,{set:function(c){this.setAttribute(f,c)},get:function(){return this.getAttribute(f)}})}}return i.klass}function cg(i,t,e){var n;let r=yt(i,t);if(!(r==e||et(r.prototype,e)||r.prototype[gr])){let o=r.prototype[th];if(!o){let l=Symbol();o=(n=class extends r{constructor(){super(...arguments),this.__slots={},this.__F=0}},a(n,l,"CustomBuiltInElement",16),n),r.prototype[th]=o;let h=Object.getOwnPropertyDescriptors(e.prototype);Object.defineProperties(o.prototype,h),o.prototype[gr]=i}return o}return r}var mr=function(i){let t=typeof i=="string"?i:String(i);return t.indexOf('"')>=0&&(t=t.replace(/\"/g,""")),t},rs=function(i,t){let e=typeof i=="string"?i:String(i);return t=="script"||t=="style"||(e.indexOf('"')>=0&&(e=e.replace(/\"/g,""")),e.indexOf("<")>=0&&(e=e.replace(/\</g,"<")),e.indexOf(">")>=0&&(e=e.replace(/\>/g,">"))),e},dc=Symbol(),wr=class wr{static create(t,e){let r=new wr;return r[nh]=t,r.location=t.location,yr||(yr=new zl),yr.run(r,e),r}constructor(){}get flags(){return this[qi]||(this[qi]=new Ft({classList:new br(this)}))}get scripts(){return this[te]||(this[te]=[])}set location(t){typeof t=="string"&&(t=new Ie(t)),this[pr]=t}get location(){return this[pr]||(this[pr]=new Ie("http://localhost/"))}createElement(t){let e=yt(t),r=new e(t);return r.nodeName=t,r}createElementNS(t,e){if(t=="http://www.w3.org/2000/svg"){let r=yt("svg_"+e),s=new r;return s.nodeName=e,s}return this.createElement(e)}createTextNode(t){return new ee(t)}createComment(t){return new vt(t)}createDocumentFragment(){return new vr}getElementById(t){return null}};a(wr,dc,"Document",16);var bt=wr,st=new bt;L.createTextNode=function(i){return st.createTextNode(i)};var ih=st;function Ge(){return yr&&yr?.getStore?.()||st}var pc=Symbol(),_r=class _r{constructor(t,e){this.classes=e||[],this.dom=t}add(t){return this.classes.indexOf(t)<0&&this.classes.push(t),this}remove(t){let e=this.classes.indexOf(t);return e>=0&&(this.classes[e]=""),this}toggle(t){return this.contains(t)?this.remove(t):this.add(t),this}contains(t){return this.classes.indexOf(t)>=0}clone(t){return new _r(t,this.classes.slice(0))}toString(){return this.classes.join(" ").trim()}};a(_r,pc,"DOMTokenList",16);var br=_r,mc=Symbol(),ps=class ps{constructor(){}removeProperty(t){var e;return e=this[t],delete this[t],e}setProperty(t,e){return this[t]=e}toString(){let t=[];for(let e=this,r=0,s=Object.keys(e),n=s.length,o,l;r<n;r++)o=s[r],l=e[o],et(l,Function)||t.push(""+o+": "+l);return t.join(";")}};a(ps,mc,"StyleDeclaration",16);var is=ps,gc=Symbol(),Tr=class Tr{static wrap(t){return new Proxy(t.attributes,new Tr)}set(t,e,r){return t["data-"+e]=r,!0}get(t,e){return t["data-"+e]}};a(Tr,gc,"DataSet",0);var ss=Tr,yc={get(i,t){let e=i,r;for(;e&&r==null;)(e=e[ts])&&(r=e[t]);return r}},bc=Symbol(),ms=class ms{toString(){return this.outerHTML}get outerHTML(){return""}text$(t){return this.textContent=t,this}get ownerDocument(){return this[Yi]||(this[Yi]=Ge())}get[ts](){return this[oh]||this.parentNode||this[tc]}get[nh](){return this[Wi]||(this[Wi]=new Proxy(this,yc))}get[Wl](){return this}get[Bu](){return this[ts]?.[Wl]}[At](){return this}[Uu](){return this}[zi](t){return dr(this,t)}[Ku](t,e){return this[zi](t)[zi](e)}[Bi](t,e){let r=this[Ql](t,e);return this[Xl](e),r}[Pe](t){return t[gt](this,null)}[Xl](t){return t[Te](this)}[gt](t,e){return e?t.insertBefore(this,e):t.appendChild(this),this}[Ql](t,e){return t[gt](this,e)}[Te](t){return t.removeChild(this)}[Jl](t){return t.removeChild(this[Le]||this)}[Zt](t,e){return e[Bi](t,this)}[Zl](t,e){return e[Bi](t,this[Le]||this)}get[Ui](){return this[Ce]||(this[Ce]=st.createComment("placeholder"))}set[Ui](t){let e=this[Ce];this[Ce]=t,e&&e!=t&&e.parentNode&&e[Zt](t)}[qu](){let t=this[Le],e=t&&t.parentNode;return t&&e&&t!=this&&(this[Le]=null,this[gt](e,t),t[Te](e)),this}[Yu](){this[eh]!=!0&&(this[eh]=!0,!0)&&(this[Zt]=this[Zl],this[Te]=this[Jl],this[gt]=this[ec]);let t=this[Ui];return this.parentNode&&t!=this&&(t[gt](this.parentNode,this),this[Te](this.parentNode)),this[Le]=t,this}[Wu](t,e,r){let s=typeof t;if(s==="undefined"||t===null){if(r&&et(r,vt))return r;let n=new vt("");return r?r[Zt](n,this):n[gt](this,null)}if(t===r)return t;if(s!=="object"){let n,o=t;return e&128&&e&256,r?et(r,ee)?(r.textContent=o,r):(n=ih.createTextNode(o),r[Zt](n,this),n):(this.appendChild(n=ih.createTextNode(o)),n)}else return r?r[Zt](t,this):t[gt](this,null)}};a(ms,bc,"Node",0);var I=ms,vc=Symbol(),gs=class gs extends I{constructor(t){super(),this.textContent=t??""}get outerHTML(){return this.textContent}};a(gs,vc,"Text",16);var ee=gs,$c=Symbol(),ys=class ys extends I{constructor(t){super(),this.value=t}get outerHTML(){return"<!-- "+rs(this.value)+" -->"}toString(){return this.tag&&this.tag.toNodeString?this.tag.toNodeString():this.outerHTML}};a(ys,$c,"Comment",16);var vt=ys,xc=Symbol(),Rt=class Rt extends I{constructor(t){super(),this.nodeName=t,this.childNodes=[],this.attributes={}}emit(t,e,r={bubbles:!0}){console.warn("Element#emit not supported on node")}get classList(){return this[Xi]||(this[Xi]=new br(this))}get style(){return this[Ne]||(this[Ne]=new is)}get dataset(){return this[Qi]||(this[Qi]=ss.wrap(this))}get richValue(){return this.value}set richValue(t){this.value=t}set asset(t){this[ct]=t}get asset(){return this[ct]}appendChild(t){return this.childNodes.push(t),t.parentNode=this,t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),this}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(this.childNodes.splice(r,1,t),t.parentNode=this),e}insertBefore(t,e){let r=this.childNodes.indexOf(e);return this.childNodes.splice(r,0,t),this}setAttribute(t,e){var r;return e==null?(r=this.attributes[t],delete this.attributes[t]):this.attributes[t]=e,this}setAttributeNS(t,e,r){return this.setAttribute(t+":"+e,r)}getAttribute(t){return this.attributes?this.attributes[t]:void 0}getAttributeNS(t,e){return this.getAttribute(t+":"+e)}removeAttribute(t){var e;return e=this.attributes[t],delete this.attributes[t],!0}addEventListener(){return this}removeEventListener(){return this}resolve(){return this}set innerHTML(t){this[Ji]=t}get innerHTML(){let t="";if(this[Ji])return this[Ji];if(this.textContent!=null)return rs(this.textContent,this.nodeName);for(let e=0,r=Me(this.childNodes),s=r.length;e<s;e++){let n=r[e];typeof n=="string"?t+=rs(n,this.nodeName):et(n,Number)?t+=""+n:n&&(t+=n.outerHTML)}return t}get outerHTML(){let t=this.nodeName,e=this[gr],r=""+t;e&&(r=""+e+" is='"+t+"'",t=e);let s,n=this.id,o=this.classList.toString();this.dehydrate&&(o=o?"_ssr_ "+o:"_ssr_",this.dehydrate()),n&&(r+=' id="'+mr(n)+'"'),o&&(r+=' class="'+mr(o)+'"');for(let l=this.attributes,h=0,u=Object.keys(l),f=u.length,c,p;h<f;h++)c=u[h],p=l[c],!(c=="id"&&n)&&(r+=" "+c+'="'+mr(p)+'"');return this[Ne]&&(r+=' style="'+mr(this[Ne].toString())+'"'),uc[t]?"<"+r+">":"<"+r+">"+this.innerHTML+"</"+t+">"}get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes[this.childNodes.length-1]}get firstElementChild(){let t=this.childNodes.length,e=0;for(;e<t;){let r=this.childNodes[e++];if(et(r,Rt))return r}return null}get lastElementChild(){let t=this.childNodes.length;for(;t>0;){let e=this.childNodes[--t];if(et(e,Rt))return e}return null}get className(){return this.classList.toString()}set className(t){this.classList.classes=(t||"").split(" "),this.classList.toString()}log(...t){return console.log(...t)}text$(t){return this.textContent=t,this}[Xu](){return this}[Qu](){return this}[Ju](){this.render&&this.render(),this[Ee]&&(this[Ee]=null)}get[Zu](){return this[Ee]||(this[Ee]={})}get flags(){return this.$flags||(this.$flags=new Ft(this),this.flag$==Rt.prototype.flag$&&(this.flags$ext=this.className),this.flagDeopt$()),this.$flags}flag$(t){let e=this.flags$ns;this.className=e?e+(this.flags$ext=t):this.flags$ext=t}flagIf$(){return this}flagDeopt$(){var t=this;this.flag$=this.flagExt$,this.flagSelf$=function(e){return t.flagSync$(t.flags$own=e)}}flagExt$(t){return this.flagSync$(this.flags$ext=t)}flagSelf$(t){return this.flagDeopt$(),this.flagSelf$(t)}flagSync$(){return this.className=(this.flags$ns||"")+(this.flags$ext||"")+" "+(this.flags$own||"")+" "+(this.$flags||"")}set$(t,e){let r=$i(this,t,Rt);!r||!r.set?this.setAttribute(t,e):this[t]=e}};a(Rt,xc,"Element",16);var y=Rt;y.prototype.setns$=y.prototype.setAttributeNS;y.prototype[rc]=!0;var Sc=Symbol(),bs=class bs extends y{constructor(){super(null)}get outerHTML(){return this.innerHTML}};a(bs,Sc,"DocumentFragment",16);var vr=bs,wc=Symbol(),vs=class vs extends vr{get outerHTML(){return this.innerHTML}};a(vs,wc,"ShadowRoot",0);var sh=vs,_c=Symbol(),$s=class $s extends y{};a($s,_c,"HTMLElement",0);var A=$s,Tc=Symbol(),xs=class xs extends A{constructor(){super(...arguments),super[At]||this[At]()}[At](t=null,e=!0,r=!0){e&&super[At]&&super[At](...arguments),this.hmr=t?t.hmr:void 0}get scripts(){return this[te]||(this[te]=[])}get outerHTML(){let t=tt;tt=this;let e=super.outerHTML,r=new Set,s=[],n=[];if(globalThis.IMBA_HMR_PATH&&this.hmr!==!1&&n.push("<script src='/__hmr__.js'></script>"),globalThis.__vite_manifest__)for(let o=0,l=Me(this.scripts),h=l.length;o<h;o++){let u=l[o];if(this.src=globalThis.__vite_manifest__[u.src]){n.push('<script type="module" src="'+this.src.file+'"></script>');for(let f=0,c=Me(this.src.css),p=c.length;f<p;f++){let g=c[f];r.add({url:g})}}}else globalThis.__vite__&&n.push(`<link rel='stylesheet' id='imba-dev-ssr' href='.dev-ssr/all.css'>
<script>addEventListener('DOMContentLoaded', (event) => {
document.getElementById("imba-dev-ssr").remove()
});</script>`);if(!this.styles){for(let o=0,l=Me(this.scripts),h=l.length;o<h;o++){let f=l[o].src,c=lc[f];c&&c.css&&r.add(c.css)}for(let o of Me(r))n.push("<link rel='stylesheet' href='"+o.url+"'>")}if(tt=t,n.length){let o=e.indexOf("</head>");o==-1&&(o=e.indexOf("<body>")),o==-1&&(o=0),e=e.slice(0,o)+`
`+n.join(`
`)+`
`+e.slice(o)}return"<!DOCTYPE html>"+e}};a(xs,Tc,"HTMLHtmlElement",24);var ns=xs,Lc=Symbol(),Ss=class Ss extends A{};a(Ss,Lc,"HTMLSelectElement",0);var ke=Ss,Cc=Symbol(),ws=class ws extends A{};a(ws,Cc,"HTMLInputElement",0);var Fe=ws,Nc=Symbol(),_s=class _s extends A{};a(_s,Nc,"HTMLTextAreaElement",0);var Ae=_s,Ec=Symbol(),Ts=class Ts extends A{};a(Ts,Ec,"HTMLButtonElement",0);var Re=Ts,Mc=Symbol(),Ls=class Ls extends A{};a(Ls,Mc,"HTMLOptionElement",0);var He=Ls,Oc=Symbol(),Cs=class Cs extends A{get outerHTML(){return tt&&((tt.scripts||(tt.scripts=[])).push(this),globalThis.__vite_manifest__&&globalThis.__vite_manifest__[this.src])?"":(this[ct]&&(this[ct].js?(this.setAttribute("src",this[ct].js.url),this.setAttribute("type","module")):console.warn("could not find browser entrypoint for "+this[ct].path)),super.outerHTML)}};a(Cs,Oc,"HTMLScriptElement",8);var os=Cs,Pc=Symbol(),Ns=class Ns extends A{get outerHTML(){if(this[ct]){let t=this.getAttribute("rel"),e;t=="stylesheet"&&((e=this[ct].css.url)||console.warn("could not find stylesheet for "+this[ct].path)),e&&this.setAttribute("href",e)}return super.outerHTML}};a(Ns,Pc,"HTMLLinkElement",8);var ls=Ns,Ic=Symbol(),Es=class Es extends A{set src(t){this[Oe]!=t&&(this[Oe]=t)}get src(){return this[Oe]}get outerHTML(){if(tt&&this.src&&(tt.styles||(tt.styles=[])).push(this),this.src){this.nodeName="link",this.setAttribute("rel","stylesheet"),this.setAttribute("href",String(this.src));let t=super.outerHTML;return this.nodeName="style",t}return super.outerHTML}};a(Es,Ic,"HTMLStyleElement",8);var hs=Es,kc=Symbol(),Ms=class Ms{};a(Ms,kc,"Event"