@fabiofiorita/porcelain 0.78.0 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/server/src/cli/main.mjs +7327 -6616
- package/web/dist/assets/_-CM-4wlBy.js +1 -0
- package/web/dist/assets/_layerId-DjtekDj2.js +1 -0
- package/web/dist/assets/{_paired-CrNFab02.js → _paired-C2SWHQl4.js} +1 -1
- package/web/dist/assets/{_paired-BQ0y29Xb.js → _paired-CBm2MtkG.js} +1 -1
- package/web/dist/assets/_paired-DYH4LSdK.js +1 -0
- package/web/dist/assets/_paired-Dl_-1y7f.js +1 -0
- package/web/dist/assets/_reviewId-CZ8KLgSQ.js +1 -0
- package/web/dist/assets/{_revision-BMXAJq_Z.js → _revision-8PDQVDma.js} +1 -1
- package/web/dist/assets/{_section-DdvA8EEA.js → _section-BM-gB9-A.js} +1 -1
- package/web/dist/assets/{_worktreeId-C8Q6GcvL.js → _worktreeId-C7Hl3HqX.js} +1 -1
- package/web/dist/assets/_worktreeId-DMvqT50n.js +1 -0
- package/web/dist/assets/_worktreeId-DYH4LSdK.js +1 -0
- package/web/dist/assets/_worktreeId-Dl_-1y7f.js +1 -0
- package/web/dist/assets/access-CdrSsWC7.js +19 -0
- package/web/dist/assets/{connected-workspace-8ch85vkt.js → connected-workspace-CfilrSRL.js} +1 -1
- package/web/dist/assets/{desktop-actions-BPv0J8RL.js → desktop-actions-OZdmeAnL.js} +1 -1
- package/web/dist/assets/{edit-file-Bcu9LCmp.js → edit-file-DZdgw3o0.js} +20 -20
- package/web/dist/assets/{file-editor-B_jE48tv.js → file-editor-rIz6iew9.js} +1 -1
- package/web/dist/assets/{index-BHlOFndd.js → index-DvQ8vt2r.js} +3 -3
- package/web/dist/assets/{lazyRouteComponent-C0NLdQ95.js → lazyRouteComponent-C9UGVZ8K.js} +1 -1
- package/web/dist/assets/{pair-CbpILDh2.js → pair-DTr7Piog.js} +1 -1
- package/web/dist/assets/pair-Dl_-1y7f.js +1 -0
- package/web/dist/assets/{review-route-CZyVDwAY.js → review-route-DmS-9i7N.js} +1 -1
- package/web/dist/assets/{reviews-DCiXZMLG.js → reviews-yGaQ3xF5.js} +8 -8
- package/web/dist/assets/{useMatch-CPSFM0JI.js → useMatch-CmCox52T.js} +1 -1
- package/web/dist/assets/useRouterState-B27q7C5L.js +1 -0
- package/web/dist/assets/{workspace-error-DIuDMViV.js → workspace-error-BH8VQBuM.js} +1 -1
- package/web/dist/assets/{workspace-pending-DgQgV-cu.js → workspace-pending-dViXllQf.js} +1 -1
- package/web/dist/index.html +7 -7
- package/web/dist/assets/_-CSJHpFdT.js +0 -1
- package/web/dist/assets/_layerId-DODyO-4v.js +0 -1
- package/web/dist/assets/_paired-Bse7nsmg.js +0 -1
- package/web/dist/assets/_paired-CmZDjtRz.js +0 -1
- package/web/dist/assets/_reviewId-CBVBAvNp.js +0 -1
- package/web/dist/assets/_worktreeId-B27bXYEK.js +0 -1
- package/web/dist/assets/_worktreeId-Bse7nsmg.js +0 -1
- package/web/dist/assets/_worktreeId-CmZDjtRz.js +0 -1
- package/web/dist/assets/access-E2mYEqnl.js +0 -19
- package/web/dist/assets/pair-Bse7nsmg.js +0 -1
- package/web/dist/assets/useRouterState-DtsAJKLm.js +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";var n=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},r={pipe(){return n(this,arguments)}},i=function(){function e(){}return e.prototype=r,e}(),a=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},o=e=>e,s=e=>()=>e,c=s(!0),l=s(!1),u=s(void 0),d=u;function f(e,...t){return n(e,t)}function p(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function m(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function h(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i!==n&&t.set(i,i),i}}var g=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},_=new WeakSet,v=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),y=0,b=()=>{y++};function x(e){return typeof e==`string`}function S(e){return typeof e==`number`}function C(e){return typeof e==`boolean`}function w(e){return typeof e==`bigint`}function T(e){return typeof e==`symbol`}function E(e){return x(e)||S(e)||T(e)}function D(e){return typeof e==`function`}function O(e){return e===void 0}function k(e){return e!==void 0}function A(e){return e!=null}function j(e){return!1}function M(e){return!0}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){return typeof e==`object`&&!!e||D(e)}var F=a(2,(e,t)=>P(e)&&t in e),I=a(2,(e,t)=>F(e,`_tag`)&&e._tag===t);function L(e){return e instanceof Error}function R(e){return F(e,Symbol.iterator)||x(e)}var ee=`~effect/Hash`,z=e=>{switch(typeof e){case`number`:return oe(e);case`bigint`:return se(e.toString(10));case`string`:return se(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?se(`Invalid Date`):se(e.toISOString());if(e instanceof RegExp)return se(e.toString());{if(_.has(e))return te(e);let t=ge.get(e);if(t!==void 0)return t;if(_e.has(e))return b(),se(`[Circular]`);_e.add(e);let n=y,r;try{r=`~effect/Hash`in e?e[ee]():typeof e==`function`?te(e):e instanceof DataView?de(v(e)):Array.isArray(e)||ArrayBuffer.isView(e)?de(e):e instanceof Map?fe(e):e instanceof Set?me(e):le(e)}finally{_e.delete(e)}return n===y&&ge.set(e,r),r}}return ie(ne(se(String(e))))},te=e=>(he.has(e)||he.set(e,ie(Math.random()*4294967296|0)),he.get(e)),ne=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),re=a(2,(e,t)=>ne(Math.imul(e,2654435761)+Math.imul(t,2246822507))),ie=e=>e&3221225471|e>>>1&1073741824,ae=new DataView(new ArrayBuffer(8)),oe=e=>{let t=e|0;return t===e?ie(t):(ae.setFloat64(0,e===e?e:NaN),ie(re(ae.getInt32(0),ae.getInt32(4))))},se=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return ie(t)},ce=(e,t)=>{let n=12289;for(let r of t)n^=re(z(r),z(e[r]));return ie(n)},le=e=>ce(e,g(e)),ue=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return ie(r)},de=e=>{let t=6151;for(let n of e)t=re(t,z(n));return ie(t)},fe=ue(se(`Map`),([e,t])=>re(z(e),z(t))),pe=se(`Set`),me=ue(pe,e=>re(pe,z(e))),he=new WeakMap,ge=new WeakMap,_e=new WeakSet,ve=`~effect/Equal`;function ye(){return arguments.length===1?e=>be(e,arguments[0]):be(arguments[0],arguments[1])}function be(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||_.has(e)||_.has(t)?!1:xe(e,t):!1}function xe(e,t){let n=Ce.length;for(let r=n;r-->0;)if(Ce[r]===e&&we[r]===t)return!0;if(n)return Se(e,t);let r=Te.get(e);r||Te.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=Se(e,t)),i}function Se(e,t){Ce.push(e),we.push(t);try{return Ee(e,t)}finally{Ce.pop(),we.pop()}}var Ce=[],we=[],Te=new WeakMap;function Ee(e,t){if(z(e)!==z(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=Ne(e);if(n!==Ne(t)||typeof e==`function`&&!n)return!1;if(n)return e[ve](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:De(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?Oe(v(e),v(t)):Oe(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:Ae(e,t,je,Me):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Ae(e,t,z,be):ke(e,t)}function De(e,t){for(let n=0;n<e.length;n++)if(!be(e[n],t[n]))return!1;return!0}function Oe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ke(e,t){let n=g(e),r=g(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!be(e[i],t[i]))return!1;return!0}function Ae(e,t,n,r){let i=new Map;for(let e of t){let t=n(e),r=i.get(t);r?r.push(e):i.set(t,[e])}outer:for(let t of e){let e=i.get(n(t));if(e){for(let n=0;n<e.length;n++)if(r(t,e[n])){e[n]=e[e.length-1],e.pop();continue outer}}return!1}return!0}var je=e=>z(e[0]),Me=(e,t)=>be(e[0],t[0])&&be(e[1],t[1]),Ne=e=>F(e,ve),Pe=e=>Fe(new Proxy(e,{})),Fe=e=>(_.add(e),e),Ie=Symbol.for(`~effect/Redactable`),Le=e=>F(e,Ie);function Re(e){return Le(e)?ze(e):e}function ze(e){return e[Ie](globalThis[`~effect/Fiber/currentFiber`]?.context??He)}var Be=`~effect/Fiber/currentFiber`,Ve=new Map,He={"~effect/Context":{},base:Ve,depth:0,mapUnsafe:Ve,pipe(){return n(this,arguments)}};function Ue(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,t=0){try{return l(e,t)}catch{return(typeof e==`object`&&e||typeof e==`function`)&&r.delete(e),`[inspection threw]`}}function l(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return We;r.add(e);let l;if(Ie in e)l=c(ze(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
|
|
2
|
+
`+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=qe(e);else if(!t?.ignoreToString&&F(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Je(e);l=e instanceof Error&&e.cause!==void 0?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Ge(t)}:${c(Ye(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Ge(t)}: ${c(Ye(e,t),n+1)}`).join(`,
|
|
3
|
+
`)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var We=`[Circular]`;function Ge(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Ke(e){return e.map(e=>`[${Ge(e)}]`).join(``)}function qe(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Je(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Ye(e,t){try{return e[t]}catch{return`[property access threw]`}}function Xe(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=F(r,Ie)?Re(r):Re(t);if(typeof i==`bigint`)return Ue(i);if(typeof i!=`object`||!i)return i;let a=i instanceof Error&&!F(i,`toJSON`)?{...i,name:i.name,message:i.message}:i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(i))return n.push(i),a!==i&&n.push(a),a},t?.space)??`null`}var Ze=Symbol.for(`nodejs.util.inspect.custom`),Qe=e=>{try{return e=Re(e),F(e,`toJSON`)&&D(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Qe):e}catch{return`[toJSON threw]`}},$e=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?Xe(e,{space:t}):Ue(e,{space:t})}catch{return String(e)}},et={toJSON(){return Qe(this)},[Ze](){return this.toJSON()},toString(){return Ue(this.toJSON())}},tt=class{[Ze](){return this.toJSON()}toString(){return Ue(this.toJSON())}},nt=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),rt=()=>Error.stackTraceLimit,it=e=>{nt&&(Error.stackTraceLimit=e)},at=class{constructor(e){this.value=e,this.done=!1}next(e){return this.done?(this.value=e,this):(this.done=!0,{value:this.value,done:!1})}},ot=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return rt()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})();function st(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function ct(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&st(e,n,t[n])}var lt=`~effect/Effect`,ut=`~effect/Exit`,dt={_A:o,_E:o,_R:o},ft=`${lt}/identifier`,pt=`${lt}/args`,mt=`${lt}/evaluate`,ht=`${lt}/successCont`,gt=`${lt}/failureCont`,_t=`${lt}/ensureCont`,vt=Symbol.for(`effect/Effect/Yield`),yt={pipe(){return n(this,arguments)},toJSON(){return{...this}},toString(){return Ue(this.toJSON(),{ignoreToString:!0,space:2})},[Ze](){return this.toJSON()}},bt={[lt]:dt,...yt,[Symbol.iterator](){return new at(this)},toJSON(){return{_id:`Effect`,op:this[ft],...pt in this?{args:this[pt]}:void 0}}},xt=e=>F(e,lt),St=e=>F(e,ut),Ct=`~effect/Cause`,wt=`~effect/Cause/Reason`,Tt=e=>F(e,Ct),Et=e=>F(e,wt),Dt=class{constructor(e){this[Ct]=Ct,this.reasons=e}pipe(){return n(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${Ue(this.reasons)})`}[Ze](){return this.toJSON()}[ve](e){return Tt(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>ye(t,e.reasons[n]))}[ee](){return de(this.reasons)}},Ot=new WeakMap,kt=class{[wt];annotations;_tag;constructor(e,t,n){if(this[wt]=wt,this._tag=e,t!==At&&typeof n==`object`&&n&&t.size>0){let e=Ot.get(n);e&&(t=new Map([...e,...t])),Ot.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return n(this,arguments)}toString(){return Ue(this)}[Ze](){return this.toString()}},At=new Map,jt=class extends kt{constructor(e,t=At){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${Ue(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[ve](e){return Rt(e)&&ye(this.error,e.error)&&ye(this.annotations,e.annotations)}[ee](){return re(se(this._tag))(re(z(this.error))(z(this.annotations)))}},Mt=e=>new Dt(e),eee=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=z(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>ye(e,i)))continue;else t.push(i);r.push(i)}return r},Nt=a(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Dt(eee(e.reasons,t.reasons));return ye(e,n)?e:n}),tee=new Dt([]),Pt=e=>new Dt([new jt(e)]),Ft=class extends kt{constructor(e,t=At){super(`Die`,t,e),this.defect=e}toString(){return`Die(${Ue(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[ve](e){return nee(e)&&ye(this.defect,e.defect)&&ye(this.annotations,e.annotations)}[ee](){return re(se(this._tag))(re(z(this.defect))(z(this.annotations)))}},It=e=>new Dt([new Ft(e)]),Lt=a(e=>Tt(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Dt(e.reasons.map(e=>e.annotate(t,n)))),Rt=e=>e._tag===`Fail`,nee=e=>e._tag===`Die`,zt=e=>e._tag===`Interrupt`;function ree(e){return Jt(`Effect.evaluate: Not implemented`)}var Bt=e=>({...bt,[ft]:e.op,[mt]:e[mt]??ree,[ht]:e[ht],[gt]:e[gt],[_t]:e[_t]}),Vt=e=>{let t=Bt(e),n=function(e){this[pt]=e};return n.prototype=t,function(e){return new n(e)}},Ht=e=>{let t={[ut]:ut,_tag:e.op,get[e.prop](){return this[pt]},...Bt(e),toString(){return`${e.op}(${Ue(this[pt])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[pt]}},[ve](e){return St(e)&&e._tag===this._tag&&ye(this[pt],e[pt])},[ee](){return re(se(e.op),z(this[pt]))}},n=function(e){this[pt]=e};return n.prototype=t,function(e){return new n(e)}},Ut=Ht({op:`Success`,prop:`value`,[mt](e){let t=e.getCont(ht);return t?t[ht](this[pt],e,this):e.yieldWith(this)}}),Wt={key:`effect/Cause/StackTrace`},Gt={key:`effect/Cause/InterruptorStackTrace`},Kt=Ht({op:`Failure`,prop:`cause`,[mt](e){let t=this[pt],n=!1;e.cache.stackFrame&&(t=Lt(t,{mapUnsafe:new Map([[Wt.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(gt),i=e._interruptedCause;if(i&&e.interruptible){let a=!1;for(;r&&e.interruptible;)a||=ft in r,r=e.getCont(gt);a&&(t=Mt(t.reasons.filter(e=>e._tag!==`Fail`))),t=Nt(t,i),n=!0}return r?r[gt](t,e,n?void 0:this):e.yieldWith(n?Kt(t):this)}}),qt=e=>Kt(Pt(e)),Jt=e=>Kt(It(e)),Yt=Vt({op:`WithFiber`,[mt](e){return this[pt](e)}}),Xt=function(){class e extends globalThis.Error{}let t=Bt({op:`YieldableError`,[mt](){return qt(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Zt=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Xt{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(ct(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Qt=e=>{class t extends Zt{_tag=e}return t.prototype.name=e,t},$t=`~effect/Cause/NoSuchElementError`,en=class extends Qt(`NoSuchElementError`){[$t]=$t;constructor(e){super({message:e})}},tn=`~effect/Cause/Done`,nn=e=>F(e,tn),rn={[tn]:tn,_tag:`Done`,value:void 0},an=e=>e===void 0?rn:{[tn]:tn,_tag:`Done`,value:e},iee=qt(rn),aee=e=>e===void 0?iee:qt(an(e)),on=e=>Bt({op:e.label,[mt]:e.evaluate}),sn=e=>(t,n)=>t===n||e(t,n),oee=(e,t)=>e===t,cn=()=>oee;function see(e){return sn((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function cee(e){return sn((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var ln=`~effect/Option`,un={[ln]:{_A:e=>e},...yt,[Symbol.iterator](){return new at(this)}},dn=Object.defineProperty(Object.assign(Object.create(un),{_tag:`Some`,_op:`Some`,[ve](e){return mn(e)&&gn(e)&&ye(this.value,e.value)},[ee](){return re(z(this._tag))(z(this.value))},toString(){return`some(${Ue(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:Qe(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),fn=z(`None`),pn=Object.assign(Object.create(un),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[ve](e){return mn(e)&&hn(e)},[ee](){return fn},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),mn=e=>F(e,ln),hn=e=>e._tag===`None`,gn=e=>e._tag===`Some`,_n=Object.create(pn),vn=function(e){this.value=e};vn.prototype=dn;var yn=e=>new vn(e),bn=`~effect/Result`,xn={[bn]:{_A:e=>e,_E:e=>e},...yt,[Symbol.iterator](){return new at(this)}},Sn=Object.assign(Object.create(xn),{_tag:`Success`,_op:`Success`,[ve](e){return wn(e)&&En(e)&&ye(this.success,e.success)},[ee](){return re(z(this._tag))(z(this.success))},toString(){return`success(${Ue(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:Qe(this.success)}}}),Cn=Object.assign(Object.create(xn),{_tag:`Failure`,_op:`Failure`,[ve](e){return wn(e)&&Tn(e)&&ye(this.failure,e.failure)},[ee](){return re(z(this._tag))(z(this.failure))},toString(){return`failure(${Ue(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:Qe(this.failure)}}}),wn=e=>F(e,bn),Tn=e=>e._tag===`Failure`,En=e=>e._tag===`Success`,Dn=function(e){this.failure=e};Dn.prototype=Cn;var lee=e=>new Dn(e),On=function(e){this.success=e};On.prototype=Sn;var uee=e=>new On(e);function kn(e){return(t,n)=>t===n?0:e(t,n)}var dee=kn((e,t)=>e<t?-1:1),An=kn((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),fee=a(2,(e,t)=>kn((n,r)=>e(t(n),t(r)))),jn=e=>a(2,(t,n)=>e(t,n)===-1),Mn=e=>a(2,(t,n)=>e(t,n)===1),Nn=e=>a(2,(t,n)=>e(t,n)!==1),Pn=e=>a(2,(t,n)=>e(t,n)!==-1),Fn=e=>a(2,(t,n)=>t===n||e(t,n)<1?t:n),In=()=>_n,Ln=yn,Rn=hn,zn=gn,Bn=a(2,(e,{onNone:t,onSome:n})=>Rn(e)?t():n(e.value)),Vn=a(2,(e,t)=>Rn(e)?t():e.value),pee=a(2,(e,t)=>Rn(e)?t():e),Hn=e=>e==null?In():Ln(e),Un=Vn(u),Wn=e=>(...t)=>{try{return Ln(e(...t))}catch{return In()}},Gn=a(2,(e,t)=>{if(zn(e))return e.value;throw t()}),Kn=Gn(()=>Error(`getOrThrow called on a None`)),qn=a(2,(e,t)=>Rn(e)?In():Ln(t(e.value))),Jn=a(2,(e,t)=>Rn(e)?In():t(e.value)),Yn=a(2,(e,t)=>Rn(e)?In():Hn(t(e.value))),Xn=Jn(o),Zn=e=>Rn(e)?[]:[e.value],Qn=a(2,(e,t)=>Rn(e)?In():t(e.value)?Ln(e.value):In()),$n=a(2,(e,t)=>!Rn(e)&&t(e.value)),er=`~effect/Context/Service`,tr=function(){function e(){}let t=e;Object.setPrototypeOf(t,mee);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[rr]=rr,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&nr.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},mee={[er]:er,...on({label:`Service`,evaluate(e){return Ut(yr(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return mr(this,e)},use(e){return Yt(t=>e(yr(t.context,this)))},useSync(e){return Yt(t=>Ut(e(yr(t.context,this))))}},nr=new Set,rr=`~effect/Context/Reference`,ir=`~effect/Context`,hee=8,gee=8,ar=(e,t,n,r)=>{let i=Object.create(vee);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},or=(e,t)=>{t&&(or(e,t.parent),e.set(t.key,t.value))},sr=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return or(t,e.overlay),e._flat=t},_ee=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),ur(n)},cr=Symbol(),lr=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?cr:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=gee&&(n.base=sr(n),n.overlay=void 0,n.depth=0),r)},ur=e=>ar(void 0,e,void 0,0),vee={get mapUnsafe(){return sr(this)},...yt,[ir]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ve](e){if(!dr(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!ye(r,n.get(e)))return!1;return!0},[ee](){return oe(this.mapUnsafe.size)}},yee=(e,t)=>e.cacheRoot===t.cacheRoot,dr=e=>F(e,ir),fr=e=>!!e[rr],pr=()=>bee,bee=ur(new Map),mr=(e,t)=>ur(new Map([[e.key,t]])),hr=a(3,(e,t,n)=>xee(e,t.key,n)),xee=(e,t,n)=>{let r=e,i=nr.has(t)?void 0:r.cacheRoot;if(r.depth>=hee){let e=new Map(r.mapUnsafe);return e.set(t,n),ar(i,e,void 0,0)}return ar(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},gr=a(2,(e,t)=>_r(e,t.key)),_r=(e,t)=>{let n=lr(e,t);return n===cr?void 0:n},vr=a(2,(e,t)=>{let n=lr(e,t.key);if(n===cr){if(fr(t))return xr(t);throw Sr(t)}return n}),yr=vr,br=`~effect/Context/defaultValue`,xr=e=>br in e?e[br]:e[br]=e.defaultValue(),Sr=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
|
|
4
|
+
`);e.splice(1,3),t.stack=e.join(`
|
|
5
|
+
`)}return t},Cr=a(2,(e,t)=>{let n=lr(e,t.key);return n===cr?fr(t)?Ln(xr(t)):In():Ln(n)}),wr=a(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:_ee(e,e=>t.mapUnsafe.forEach((t,n)=>e.set(n,t)))),Tr=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return ur(t)},Er=tr,Dr=e=>e.length>0,Or=e=>e>0?Math.floor(e):0,kr=uee,Ar=lee,jr=e=>{if(D(e))try{return kr(e())}catch(e){return Ar(e)}try{return kr(e.try())}catch(t){return Ar(e.catch(t))}},Mr=Tn,Nr=En,Pr=a(2,(e,t)=>Mr(e)?Ar(t(e.failure)):e),Fr=a(2,(e,{onFailure:t,onSuccess:n})=>Mr(e)?t(e.failure):n(e.success)),Ir=see,Lr=e=>{let t=e[Symbol.iterator]().next();if(t.done)throw Error(`headUnsafe: empty iterable`);return t.value},Rr={[Symbol.iterator](){return zr}},zr={next(){return{done:!0,value:void 0}}},Br=()=>Rr,Vr=a(2,(e,t)=>Object.hasOwn(e,t)),Hr=a(2,(e,t)=>{let n={...e};for(let r of Ur(e))st(n,r,t(e[r],r));return n}),Ur=e=>Object.keys(e),Wr=e=>a(2,(t,n)=>{for(let r of Ur(t))if(!Vr(n,r)||!e(t[r],n[r]))return!1;return!0}),Gr=e=>{let t=Wr(e);return(e,n)=>t(e,n)&&t(n,e)},Kr=globalThis.Array,qr=e=>Kr.isArray(e)?e:Kr.from(e),Jr=e=>Kr.isArray(e)?e:[e],Yr=a(2,(e,t)=>[...e,t]),Xr=a(2,(e,t)=>qr(e).concat(qr(t)));Kr.isArray;var Zr=Dr,Qr=Dr;function $r(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var See=a(2,(e,t)=>{let n=Math.floor(t);if($r(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]}),Cee=e=>e[e.length-1],ei=()=>[],ti=e=>[e],ni=a(2,(e,t)=>e.map(t)),wee=cee,ri=`~effect/Duration`,ii=BigInt(0),ai=BigInt(1),Tee=BigInt(2),Eee=BigInt(10),oi=BigInt(24),si=BigInt(60),ci=BigInt(1e3),li=BigInt(1e6),ui=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),di=e=>ui(e*1e6),fi=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=Eee**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*Tee>=a?ai:ii);return r?-s:s},Dee=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,pi=e=>{switch(typeof e){case`number`:return ki(e);case`bigint`:return Oi(e);case`string`:{if(e===`Infinity`)return Ei;if(e===`-Infinity`)return Di;let t=Dee.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return Oi(fi(r,ai));if(i===`micro`||i===`micros`)return Oi(fi(r,ci));let a=Number(r);switch(i){case`milli`:case`millis`:return ki(a);case`second`:case`seconds`:return Ai(a);case`minute`:case`minutes`:return ji(a);case`hour`:case`hours`:return Mi(a);case`day`:case`days`:return Ni(a);case`week`:case`weeks`:return Pi(a)}break}case`object`:{if(e===null)break;if(ri in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(S)?mi(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ti:e[0]===-1/0||e[1]===-1/0?Di:e[0]===1/0||e[1]===1/0?Ei:yi(ui(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?yi(n):yi(ui(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return mi(e)},mi=e=>{throw Error(`Invalid Input: ${e}`)},hi={_tag:`Millis`,millis:0},gi={_tag:`Infinity`},_i={_tag:`NegativeInfinity`},vi={[ri]:ri,[ee](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?z(ui(e)):oe(this.value.millis)}case`Nanos`:return z(this.value.nanos);default:return le(this.value)}},[ve](e){return bi(e)&&Mee(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[Ze](){return this.toJSON()},pipe(){return n(this,arguments)}},yi=e=>{let t=Object.create(vi);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?hi:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:di(e)}:e>0?gi:_i:e===ii?hi:{_tag:`Nanos`,nanos:e},t},bi=e=>F(e,ri),xi=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,Si=e=>{switch(e.value._tag){case`Millis`:return e.value.millis===0;case`Nanos`:return e.value.nanos===ii;case`Infinity`:case`NegativeInfinity`:return!1}},Ci=e=>{switch(e.value._tag){case`Millis`:return e.value.millis<0;case`Nanos`:return e.value.nanos<ii;case`NegativeInfinity`:return!0;case`Infinity`:return!1}},wi=e=>{switch(e.value._tag){case`Infinity`:case`NegativeInfinity`:return Ei;case`Millis`:return e.value.millis<0?yi(-e.value.millis):e;case`Nanos`:return e.value.nanos<ii?yi(-e.value.nanos):e}},Ti=yi(0),Ei=yi(1/0),Di=yi(-1/0),Oi=e=>yi(e),ki=e=>yi(e),Ai=e=>yi(e*1e3),ji=e=>yi(e*6e4),Mi=e=>yi(e*36e5),Ni=e=>yi(e*864e5),Pi=e=>yi(e*6048e5),Fi=e=>zi(pi(e),{onMillis:o,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ii=e=>zi(pi(e),{onMillis:e=>e/1e3,onNanos:e=>Number(e)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Li=e=>zi(pi(e),{onMillis:e=>e/6e4,onNanos:e=>Number(e)/6e10,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Oee=e=>zi(pi(e),{onMillis:e=>e/36e5,onNanos:e=>Number(e)/36e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ri=e=>{let t=pi(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return di(t.value.millis)}},zi=a(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),Bi=a(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(Ri(e),t.value.nanos):n.onNanos(e.value.nanos,Ri(t))),Vi=kn((e,t)=>Bi(e,t,{onMillis:(e,t)=>e<t?-1:+(e>t),onNanos:(e,t)=>e<t?-1:+(e>t),onInfinity:(e,t)=>e.value._tag===t.value._tag?0:e.value._tag===`Infinity`?1:e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`?-1:1})),kee=(e,t)=>Bi(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Aee=Fn(Vi),jee=Nn(Vi),Mee=a(2,(e,t)=>kee(e,t)),Nee=e=>{if(e.value._tag===`Infinity`)return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};if(e.value._tag===`NegativeInfinity`)return{days:-1/0,hours:-1/0,minutes:-1/0,seconds:-1/0,millis:-1/0,nanos:-1/0};let t=Ri(e),n=t<ii,r=n?-t:t,i=r/li,a=i/ci,o=a/si,s=o/si,c=s/oi,l=n?-1:1;return{days:l*Number(c),hours:l*Number(s%oi),minutes:l*Number(o%si),seconds:l*Number(a%si),millis:l*Number(i%ci),nanos:l*Number(r%li)}},Hi=e=>{if(e.value._tag===`Infinity`)return`Infinity`;if(e.value._tag===`NegativeInfinity`)return`-Infinity`;if(Si(e))return`0`;if(Ci(e))return`-`+Hi(wi(e));let t=Nee(e),n=[];return t.days!==0&&n.push(`${t.days}d`),t.hours!==0&&n.push(`${t.hours}h`),t.minutes!==0&&n.push(`${t.minutes}m`),t.seconds!==0&&n.push(`${t.seconds}s`),t.millis!==0&&n.push(`${t.millis}ms`),t.nanos!==0&&n.push(`${t.nanos}ns`),n.join(` `)},Pee=e=>t=>!Mr(e(t)),Fee=e=>t=>t.has(e)?kr(t):Ar(t),Ui=a(2,(e,t)=>n=>{let r=e(n);return Mr(r)?r:t(r.success)}),Wi=e=>t=>{let n=e(t);return Mr(n)?In():Ln(n.success)},Gi=Er(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new Xi}),Ki=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},qi=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Ji=e=>{try{return qi(e)}catch{return Ki(e)}},Yi=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},Xi=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?Ki:Ji)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new Zi(this.setImmediate)}},Zi=class{tasks=new Yi;running=void 0;setImmediate;constructor(e=Ji){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},Qi=Er(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),$i=Er(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),ea=class extends i{constructor(e){super(),e&&ct(this,e)}},ta=e=>class extends ea{_tag=e},na=Zt,ra=Qt,ia=`~effect/encoding/EncodingError`,aa=class extends ra(`EncodingError`){[ia]=ia},oa=e=>{switch(e){case 16:return ua();case 32:return da();default:{let t=``;for(let n=e>>>3;n>0;n--)t+=la();return t}}},sa=Uint8Array.from(`0123456789abcdef`,e=>e.charCodeAt(0)),ca=()=>Math.random()*4294967296>>>0,la=()=>{let e=ca();return String.fromCharCode(sa[e>>>28],sa[e>>>24&15],sa[e>>>20&15],sa[e>>>16&15],sa[e>>>12&15],sa[e>>>8&15],sa[e>>>4&15],sa[e&15])},ua=()=>{let e=ca(),t=ca();return String.fromCharCode(sa[e>>>28],sa[e>>>24&15],sa[e>>>20&15],sa[e>>>16&15],sa[e>>>12&15],sa[e>>>8&15],sa[e>>>4&15],sa[e&15],sa[t>>>28],sa[t>>>24&15],sa[t>>>20&15],sa[t>>>16&15],sa[t>>>12&15],sa[t>>>8&15],sa[t>>>4&15],sa[t&15])},da=()=>{let e=ca(),t=ca(),n=ca(),r=ca();return String.fromCharCode(sa[e>>>28],sa[e>>>24&15],sa[e>>>20&15],sa[e>>>16&15],sa[e>>>12&15],sa[e>>>8&15],sa[e>>>4&15],sa[e&15],sa[t>>>28],sa[t>>>24&15],sa[t>>>20&15],sa[t>>>16&15],sa[t>>>12&15],sa[t>>>8&15],sa[t>>>4&15],sa[t&15],sa[n>>>28],sa[n>>>24&15],sa[n>>>20&15],sa[n>>>16&15],sa[n>>>12&15],sa[n>>>8&15],sa[n>>>4&15],sa[n&15],sa[r>>>28],sa[r>>>24&15],sa[r>>>20&15],sa[r>>>16&15],sa[r>>>12&15],sa[r>>>8&15],sa[r>>>4&15],sa[r&15])},fa=`effect/Tracer/ParentSpan`,pa=class extends tr()(fa,{fiberCached:!0}){},ma=e=>e,ha=Er(`effect/Tracer/DisablePropagation`,{defaultValue:l}),ga=Er(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),_a=Er(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),va=`effect/Tracer`,ya=ma({span:e=>new ba(e)}),ba=class{_tag=`Span`;sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(e){this.name=e.name,this.parent=e.parent,this.annotations=e.annotations,this.links=e.links,this.startTime=e.startTime,this.kind=e.kind,this.sampled=e.sampled,this.status={_tag:`Started`,startTime:e.startTime}}get traceId(){return this._traceId??=Un(this.parent)?.traceId??oa(32)}get spanId(){return this._spanId??=oa(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(e,t){this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}},xa=`effect/Metric/FiberRuntimeMetrics`,Sa=Er(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:u}),Ca=Er(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:c}),wa=Er(`effect/References/TracerTimingEnabled`,{defaultValue:c}),Ta=Er(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),Ea=Er(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),Da=Er(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),Oa=Er(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),ka=Er(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Aa=Er(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),ja=e=>{if(e?.captureStackTrace===!1||e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=`boolean`)return e;let t=rt();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};it(3);let n=Error();return it(t),{...e,captureStackTrace:Na(()=>n.stack)}},Ma=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let i=r.split(`
|
|
6
|
+
`);if(i[e]!==void 0)return n=i[e].trim(),n}},Na=Ma(3),Pa=class extends kt{constructor(e,t=At){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[ve](e){return zt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[ee](){return re(se(`${this._tag}:${this.fiberId}`))(te(this.annotations))}},Fa=e=>new Pa(e),Ia=e=>new Dt([new Pa(e)]),Iee=e=>{let t=e.reasons.find(Rt);return t?kr(t):Ar(e)},La=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return kr(n.error)}return Ar(e)},Lee=Wi(La),Ra=e=>e.reasons.some(zt),za=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?kr(t):Ar(e)},Ree=e=>{let t=za(e);return Mr(t)?zee:t.success},zee=new Set,Bee=e=>e.reasons.length>0&&e.reasons.every(zt),Vee=a(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>Rt(e)?(n=!0,new jt(t(e.error),e.annotations)):e);return n?Mt(r):e}),Ba=e=>{let t;for(let n of e.reasons){if(n._tag===`Fail`)return n.error;n._tag===`Die`&&(t??=n)}return t===void 0?e.reasons.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`):t.defect},Hee=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=rt();i!==0&&it(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(Va(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=Kee(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(Va(i,r[0].annotations,t))}}finally{i!==0&&it(i)}return n},Va=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(Uee(e),{cause:e.cause?Va(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=Gee(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?Ha(e,t):e}n?.includeCauseInStack&&(i.stack=Ga(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else i=new globalThis.Error(e?r===`string`?e:Xe(e):`Unknown error: ${e}`);return i},Uee=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Xe(e)},Wee=/\((.*)\)/g,Gee=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
7
|
+
`),a=[r];for(let e=1;e<i.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(i[e]);e++)a.push(i[e]);return n?Ha(a.join(`
|
|
8
|
+
`),n):a.join(`
|
|
9
|
+
`)},Ha=(e,t)=>{let n=t?.get(Wt.key);return n&&(e=`${e}\n${Ua(n)}`),e},Kee=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(Gt.key);n.push(` at fiber (${t})`),r&&n.push(Ua(r))}return n.join(`
|
|
10
|
+
`)},Ua=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(Wee),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
|
|
11
|
+
`)},Wa=e=>Hee(e).map(Ga).join(`
|
|
12
|
+
`),Ga=e=>e.cause?`${e.stack} {\n${Ka(e.cause,` `)}\n}`:e.stack,Ka=(e,t)=>{let n=e.stack.split(`
|
|
13
|
+
`),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${Ka(e.cause,`${t} `)}\n${t}}`),r},qa=`~effect/Fiber`,qee={_A:o,_E:o},Jee={id:0},Ja=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),Ya=()=>Ja===void 0?void 0:new Ja(`effect/Fiber`),Xa=()=>globalThis[Be],Za=class{constructor(e,t=!0){this.setContext(e),this.id=++Jee.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[qa](){return qee}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return yr(this.context,e)}addObserver(e){return this._exit?(e(this._exit),d):(this._observers===void 0?this._observers=[e]:this._observers.push(e),()=>this.removeObserver(e))}removeObserver(e){if(this._exit||this._observers===void 0)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)}interruptUnsafe(e,t){if(this._exit)return;let n=Ia(e);this.cache.stackFrame&&(n=Lt(n,mr(Wt,this.cache.stackFrame))),t&&(n=Lt(n,t)),this._interruptedCause=this._interruptedCause?Nt(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(oo(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._asyncContext!==void 0){let t=this._asyncContext;return this._asyncContext=void 0,t.runInAsyncScope(this.evaluate,this,e)}if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===vt){this._asyncContext=Ya();return}let n=Qa.interruptChildren&&Qa.interruptChildren(this);if(n!==void 0)return this.evaluate(Wo(n,()=>t));if(this._exit=t,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&=(this._parent._children?.delete(this),void 0),this._observers!==void 0){let e=this._observers;this._observers=void 0;for(let n=0;n<e.length;n++)e[n](t)}this._stack.length=0,this._children=void 0,this.context=pr()}runLoop(e){let t=globalThis[Be];globalThis[Be]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;){this._deferredInterrupt&&(this._deferredInterrupt=!1,i=oo(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=Wo(uo,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[mt](this),i===vt){let e=this._yielded;if(ut in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return vt}}}catch(e){return F(i,mt)?this.runLoop(Jt(e)):Jt(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{this._running=n,globalThis[Be]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,Xee;for(;;){let t=this._stack.pop();if(!t)return;let n=t[_t];if(n!==void 0){let r=n.call(t,this);if(r)return r[e]=r,r}if(t[e])return t}}succeedWith(e){if(!(++this.currentOpCount&Zee-1))return Ut(e);let t=this.getCont(ht);return t?t[ht](e,this):this.yieldWith(Ut(e))}yieldWith(e){return this._yielded=e,vt}children(){return this._children??=new Set}pipe(){return n(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&yee(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=Yee(e);this.cache?.scheduler!==r.scheduler&&(this._dispatcher=void 0),this.cache=r}get currentSpanLocal(){let e=this.cache.span;return e?._tag===`Span`?e:void 0}},Yee=e=>{let t=_r(e,va);return{scheduler:yr(e,Gi),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:yr(e,Ca),span:_r(e,fa),logLevel:yr(e,Oa),minimumLogLevel:yr(e,ka),stackFrame:yr(e,Sa),runtimeMetrics:_r(e,xa),maxOpsBeforeYield:yr(e,Qi),preventYield:yr(e,$i)}},Xee={[ht](e,t){return oo(t._interruptedCause)},[gt](e,t){return oo(t._interruptedCause)}},Zee=32,Qa={interruptChildren:void 0},$a=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Gt.key,e.cache.stackFrame),ur(t)},Qee=e=>{if(e._children!==void 0&&e._children.size!==0)return io(e._children)},eo=e=>{let t=e;return t._exit?ao(t._exit):_o(n=>t._exit?n(ao(t._exit)):co(e.addObserver(e=>n(ao(e)))))},to=e=>_o(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(ao(r))}return a(),co(()=>i?.())}),no=e=>{let t=e;return t._exit?t._exit:_o(n=>t._exit?n(t._exit):co(e.addObserver(n)))},$ee=e=>_o(t=>{let n=Array.from(e);if(n.length===0)return t(ao(ei()));let r=Array(n.length),i=ei(),a=()=>{for(let e=0;e<i.length;e++)n[e].removeObserver(i[e])},o=0,s=!1;for(let e=0;e<n.length&&!s;e++){let c=i=>{if(o++,i._tag===`Failure`)return s=!0,a(),t(i);r[e]=i.value,o===n.length&&t(ao(r))};i.push(c),n[e].addObserver(c)}return co(()=>{s=!0,a()})}),ro=e=>Yt(t=>ete(e,t.id)),ete=a(e=>F(e[0],qa),(e,t,n)=>Yt(r=>{let i=$a(r);return i=i&&n?wr(i,n):i??n,e.interruptUnsafe(t,i),Vo(eo(e))})),io=e=>Yt(t=>{let n=$a(t),r=ei();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return Vo(to(r))}),ao=Ut,oo=Kt,so=qt,co=Vt({op:`Sync`,[mt](e){let t=this[pt](),n=e.getCont(ht);return n?n[ht](t,e):e.yieldWith(Ut(t))}}),lo=Vt({op:`Suspend`,[mt](e){return this[pt]()}}),tte=Fr({onFailure:so,onSuccess:ao}),uo=Vt({op:`Yield`,[mt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(is)},this[pt]??0),e.yieldWith(()=>{t=!0})}})(0),fo=ao(In()),nte=e=>lo(()=>oo(e())),po=e=>Jt(e),mo=e=>lo(()=>so(e())),ho=ao(void 0),rte=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new gl(e,`An error occurred in Effect.try`):e.catch;return lo(()=>{try{return ao(t())}catch(e){return so(n(e))}})},ite=e=>go(function(t,n){e(n).then(e=>t(ao(e)),e=>t(po(e)))},e.length!==0),ate=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new gl(e,`An error occurred in Effect.tryPromise`):e.catch;return go(function(e,r){let i=e=>lo(()=>{try{return so(ot(()=>n(e)))}catch(e){return po(e)}});try{t(r).then(t=>e(ao(t)),t=>e(i(t)))}catch(t){e(i(t))}},t.length!==0)},ote=e=>Yt(t=>e(t.id)),go=function(){let e=Bt({op:`Async`,[mt](e){let t=!1,n=!1,r=this.withSignal?new AbortController:void 0,i=this.register.call(e.cache.scheduler,r=>{t||(t=!0,n?e.evaluate(r):n=r)},r?.signal);return n===!1?(n=!0,e._yielded=()=>{t=!0},r===void 0&&i===void 0||e._stack.push(ste(()=>(t=!0,r?.abort(),i??is))),vt):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),ste=Vt({op:`AsyncFinalizer`,[_t](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Ac))},[gt](e,t){return Ra(e)?Wo(sc(Kt(e),this[pt]()),()=>oo(e)):oo(e)}}),_o=e=>go(e,e.length>=2),vo=_o(d),cte=(...e)=>{if(e.length===1){let t=e[0];return lo(()=>Eo(t()))}let[t,n]=e;return lo(()=>Eo(n.call(t.self)))},yo=(e,...t)=>{let n=t.length===0?function(){return lo(()=>Eo(e.apply(this,arguments)))}:function(){let n=lo(()=>Eo(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return bo(e.length,n)},bo=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),xo=Ma(2),So=function(){let e=typeof arguments[0]==`string`,t=e?arguments[0]:`Effect.fn`,n=e?arguments[1]:void 0,r=rt(),i;return r!==0&&(it(2),i=new globalThis.Error,it(r)),e?(r,...a)=>Co(t,r,i,a,e,n):Co(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},Co=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.shift().bind(t.self),s=`${e} (definition)`,c=n?xo(()=>n.stack):u;return bo(o.length,function(...t){let n=lo(()=>{let e=o.apply(this,arguments);return xt(e)?e:Eo(e)});for(let e=0;e<r.length;e++)n=r[e](n,...t);if(!xt(n))return n;let l=rt(),d;return l!==0&&(it(2),d=new globalThis.Error,it(l)),fs(i?tl(e,a,e=>nl(n,e)):n,Sa,t=>({name:e,stack:d?xo(()=>d.stack):u,parent:{name:s,stack:c,parent:t}}))})},wo=(e,...t)=>bo(e.length,t.length===0?function(){return To(()=>e.apply(this,arguments))}:function(){let n=To(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),To=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return ao(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return lo(()=>n?(n=!1,Wo(r.value,e=>Eo(t,e))):lo(()=>Eo(e())))}}}catch(e){return po(e)}},Eo=function(){let e=Bt({op:`Iterator`,[ht](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return ao(r.value);if(!Go(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[mt](e){return this[ht](this.initial,e)}}),t=function(e,t){this.iterator=e,this.initial=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),Do=a(2,(e,t)=>new Ao(e,jo,ao(t))),Oo=function(e){return e._stack.push(this),this[pt]},ko=Bt({op:`OnSuccess`,[mt]:Oo}),Ao=function(e,t,n){this[pt]=e,this[ht]=t,this.payload=n};Ao.prototype=ko;var jo=function(){return this.payload},Mo=function(e,t){return t.succeedWith(this.payload)},No=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),Po=function(e,t){let n=this.payload;return t.succeedWith(No?n(e):ot(()=>n(e)))},Fo=function(e){let t=this.payload;return t(e)},Io=function(e){let t=this.payload;return new Ao(t(e),Mo,e)},Lo=function(e){return new Ao(this.payload,Mo,e)},Ro=e=>Jo(e,Ln),zo=a(2,(e,t)=>new Ao(e,xt(t)?jo:Fo,t)),Bo=a(2,(e,t)=>new Ao(e,xt(t)?Lo:Io,t)),Vo=e=>new Ao(e,jo,is),Ho=(e,t)=>Yt(n=>{let r=new Set;return Ec(n,()=>r.size===0?void 0:io(r)),_o(i=>{let a=!1,o=0;for(let s of e){if(a)break;let e=o++,c=Bc(n,s,!0,!0,!1);r.add(c),c.addObserver(o=>{r.delete(c);let s=!a;a=!0,i(o),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}})}),Uo=a(e=>xt(e[1]),(e,t,n)=>Ho([e,t],n)),Wo=a(2,(e,t)=>new Ao(e,Fo,t)),Go=e=>e[ut]!==void 0,Ko=a(2,(e,t)=>Go(e)?e._tag===`Success`?t(e.value):e:Wo(e,t)),qo=e=>Wo(e,o),Jo=a(2,(e,t)=>new Ao(e,Po,t)),Yo=a(2,(e,t)=>Go(e)?as(e,t):Jo(e,t)),Xo=a(2,(e,t)=>Go(e)?os(e,t):Ms(e,t)),Zo=a(2,(e,t)=>Go(e)?ss(e,t):Ns(e,t)),Qo=a(2,(e,t)=>{if(Go(e)){if(e._tag===`Success`)return e;let n=La(e.cause);return Mr(n)?e:t(n.success)}return Es(e,t)}),$o=e=>Kt(Ia(e)),es=e=>e._tag===`Success`,ts=e=>e._tag===`Failure`,ns=e=>e._tag===`Failure`?kr(e.cause):Ar(e),rs=e=>e._tag===`Failure`&&Ra(e.cause),is=Ut(void 0),as=a(2,(e,t)=>e._tag===`Success`?Ut(t(e.value)):e),os=a(2,(e,t)=>{if(e._tag===`Success`)return e;let n=La(e.cause);return Mr(n)?e:qt(t(n.success))}),ss=a(2,(e,t)=>{if(e._tag===`Success`)return Ut(t.onSuccess(e.value));let n=La(e.cause);return Mr(n)?e:qt(t.onFailure(n.success))}),cs=a(2,(e,t)=>es(e)?t:e),ls=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?is:Kt(Mt(t))},us=e=>Yt(t=>ao(Cr(t.context,e))),ds=a(2,(e,t)=>Yt(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),Ec(n,()=>{n.setContext(r)}),e)})),fs=a(3,(e,t,n)=>ds(e,e=>{let r=vr(e,t),i=n(r);return r===i?e:hr(e,t,i)})),ps=()=>ms,ms=Yt(e=>ao(e.context)),hs=e=>Yt(t=>e(t.context)),gs=a(2,(e,t)=>Go(e)?e:ds(e,wr(t))),_s=function(){return arguments.length===1?a(2,(e,t)=>vs(e,arguments[0],t)):a(3,(e,t,n)=>vs(e,t,n)).apply(this,arguments)},vs=(e,t,n)=>ds(e,hr(t,n)),ys=a(2,(e,t)=>Wo(t,t=>t?Ro(e):fo)),bs=a(e=>xt(e[0]),(e,t)=>Pc({while:c,body:s(t?.disableYield?e:Wo(e,e=>uo)),step:d})),xs=a(2,(e,t)=>new Cs(e,t.length===1?t:e=>t(e))),Ss=Bt({op:`OnFailure`,[mt]:Oo}),Cs=function(e,t){this[pt]=e,this[gt]=t};Cs.prototype=Ss;var ws=a(3,(e,t,n)=>xs(e,e=>t(e)?n(e):oo(e))),Ts=a(3,(e,t,n)=>xs(e,e=>{let r=t(e);return Mr(r)?oo(r.failure):n(r.success,e)})),Es=a(2,(e,t)=>Ts(e,La,e=>t(e))),Ds=a(2,(e,t)=>xs(e,e=>zo(t(e),oo(e)))),Os=a(3,(e,t,n)=>xs(e,e=>{let r=t(e);return Mr(r)?oo(e):zo(n(r.success,e),oo(e))})),ks=a(2,(e,t)=>Os(e,La,e=>t(e))),As=a(e=>xt(e[0]),(e,t,n,r)=>xs(e,e=>{let i=La(e);return Mr(i)?oo(i.failure):t(i.success)?n(i.success):r?r(i.success):oo(e)})),js=a(e=>xt(e[0]),(e,t,n,r)=>As(e,Array.isArray(t)?e=>F(e,`_tag`)&&t.includes(e._tag):I(t),n,r)),Ms=a(2,(e,t)=>Es(e,e=>mo(()=>t(e)))),Ns=a(2,(e,t)=>Gs(e,{onFailure:e=>mo(()=>t.onFailure(e)),onSuccess:e=>co(()=>t.onSuccess(e))})),Ps=e=>Es(e,po),Fs=a(2,(e,t)=>Es(e,e=>co(()=>t(e)))),Is=a(e=>xt(e[0]),(e,t)=>{if(!t?.log)return Gs(e,{onFailure:e=>ho,onSuccess:e=>ho});let n=Cl(t.log===!0?void 0:t.log);return Bs(e,{onFailure(e){let r=Iee(e);return Mr(r)?oo(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>ho})}),Ls=a(e=>xt(e[0]),(e,t)=>{if(!t?.log)return Bs(e,{onFailure:e=>ho,onSuccess:e=>ho});let n=Cl(t.log===!0?void 0:t.log);return Bs(e,{onFailure:e=>t.message===void 0?n(e):n(t.message,e),onSuccess:e=>ho})}),Rs=e=>Ks(e,{onFailure:In,onSuccess:Ln}),zs=e=>qs(e,{onFailure:Ar,onSuccess:kr}),Bs=a(2,(e,t)=>new Hs(e,t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),t.onFailure.length===1?t.onFailure:e=>t.onFailure(e))),Vs=Bt({op:`OnSuccessAndFailure`,[mt]:Oo}),Hs=function(e,t,n){this[pt]=e,this[ht]=t,this[gt]=n};Hs.prototype=Vs;var Us=function(e,t){let n=this.payload;return t.succeedWith(No?n.onSuccess(e):ot(()=>n.onSuccess(e)))},Ws=((e,t)=>{let n=Bt({op:e,[mt]:Oo,[ht]:Us,[gt]:t}),r=function(e,t){this[pt]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(Rt);if(n===void 0)return oo(e);let r=this.payload;return t.succeedWith(No?r.onFailure(n.error):ot(()=>r.onFailure(n.error)))}),Gs=a(2,(e,t)=>Bs(e,{onFailure:e=>{let n=e.reasons.find(Rt);return n?t.onFailure(n.error):oo(e)},onSuccess:t.onSuccess})),Ks=a(2,(e,t)=>new Ws(e,t)),qs=a(2,(e,t)=>{if(Go(e)){if(e._tag===`Success`)return Ut(t.onSuccess(e.value));let n=La(e.cause);return Mr(n)?e:Ut(t.onFailure(n.success))}return Ks(e,t)}),Js=e=>Go(e)?Ut(e):Ys(e),Ys=Vt({op:`Exit`,[mt](e){return e._stack.push(this),this[pt]},[ht](e,t,n){return t.succeedWith(n??Ut(e))},[gt](e,t,n){return t.succeedWith(n??Kt(e))}}),Xs=a(2,(e,t)=>zo(cl(t),e)),Zs=a(2,(e,t)=>Wo(ec(e,t.duration),e=>Rn(e)?t.orElse():ao(e.value))),Qs=e=>new Kte(`Operation timed out after '${Hi(e)}'`),$s=a(2,(e,t)=>{let n=pi(t);return Zs(e,{duration:n,orElse:()=>so(Qs(n))})}),ec=a(2,(e,t)=>Uo(Ro(e),Do(cl(t),In()))),tc=`~effect/Scope`,nc=`~effect/Scope/Closeable`,rc=tr(`effect/Scope`),ic=(e,t)=>Yt(n=>{let r=ac(e,t);return r===void 0?ho:(Ste(n),r)}),ac=(e,t)=>{let n=e.state;if(n._tag===`Closed`||(e.state={_tag:`Closed`,exit:t},e.parent!==void 0&&mc(e.parent,e),n._tag===`Empty`))return;if(n.finalizer!==void 0)return oc(n.finalizer,t);let r=n.finalizers;return r.size===1?oc(r.values().next().value,t):cc(e,r,t)},oc=(e,t)=>{try{return e(t)}catch(e){return Jt(e)}},sc=(e,t)=>es(e)?t:xs(t,t=>oo(Nt(e.cause,t))),cc=yo(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=Xa();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*Js(oc(s,n))):i.push(Bc(o,oc(s,n),!0,!0,`inherit`))}return i.length>0&&(r=yield*to(i)),yield*ls(r)}),lc=(e,t)=>co(()=>uc(e,t)),uc=(e,t)=>{let n=gc(t,e);return e.state._tag===`Closed`?(n.state=e.state,n):(pc(e,n,e=>ic(n,e)),n)},dc=(e,t)=>lo(()=>e.state._tag===`Closed`?t(e.state.exit):(pc(e,{},t),ho)),fc=(e,t)=>dc(e,s(t)),pc=(e,t,n)=>{if(e.state._tag===`Empty`)e.state={_tag:`Open`,finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag===`Open`){let r=e.state;r.finalizer===void 0?r.finalizers.set(t,n):(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n))}},mc=(e,t)=>{if(e.state._tag!==`Open`)return;let n=e.state;n.finalizerKey===t?e.state=_c:n.finalizers!==void 0&&(n.finalizers.delete(t),n.finalizers.size===0&&(e.state=_c))},hc=e=>gc(e,void 0),gc=(e=`sequential`,t)=>({[nc]:nc,[tc]:tc,strategy:e,parent:t,state:_c}),_c={_tag:`Empty`},vc=e=>co(()=>hc(e)),yc=rc,bc=_s(rc),xc=e=>Yt(t=>{let n=t.context,r=hc();return t.setContext(hr(t.context,rc,r)),Ec(t,e=>(t.setContext(n),ac(r,e))),e}),Sc=e=>lo(()=>{let t=hc();return Dc(e(t),e=>lo(()=>ac(t,e)??ho))}),Cc=(e,t,n)=>hs(r=>Mc(i=>Wo(yc,a=>Bo(n?.interruptible?i(e):e,e=>dc(a,n=>gs(t(e,n),r)))))),lte=e=>Wo(yc,t=>hs(n=>dc(t,t=>gs(e(t),n)))),wc=function(){let e=Bt({op:`OnExit`,[mt](e){return e._stack.push(this),this.effect},[_t](e){e.interruptible&&this.interruptible!==!0&&(e._stack.push(Ac),e.interruptible=!1)},[ht](e,t,n){n??=Ut(e);let r;try{r=this.onExit(n)}catch(e){r=Jt(e)}return r?Wo(r,e=>n):n},[gt](e,t,n){n??=Kt(e);let r;try{r=this.onExit(n)}catch(e){r=Jt(e)}return r?Wo(sc(n,r),e=>n):n}}),t=function(e,t,n){this.effect=e,this.onExit=t,this.interruptible=n};return t.prototype=e,t}(),Tc=(e,t,n)=>new wc(e,t,n),Ec=(e,t)=>{e._stack.push(new wc(void 0,t,void 0))},Dc=a(2,Tc),ute=a(2,(e,t)=>Dc(e,e=>t)),dte=a(3,(e,t,n)=>Dc(e,e=>{let r=t(e);return Mr(r)?ho:n(r.success,e)})),fte=a(2,(e,t)=>dte(e,ns,t)),pte=a(3,(e,t,n)=>Dc(e,e=>{if(e._tag!==`Failure`)return ho;let r=t(e.cause);return Mr(r)?ho:n(r.success,e.cause)})),mte=a(2,(e,t)=>pte(za,t)(e)),hte=(e,t,n)=>Mc(r=>Wo(e,e=>Tc(lo(()=>r(t(e))),t=>n(e,t),!0))),gte=s(1/0),_te=(e,t)=>{let n=0,r,i,a=(e,t)=>(t.awaiters++,Ec(e,()=>{if(!(--t.awaiters>0||i!==t))return i=void 0,ro(t.fiber)}),no(t.fiber));return[Yt(o=>{if(i!==void 0)return a(o,i);if(r!==void 0&&(n===1/0||o.getRef(rl).currentTimeMillisUnsafe()<n))return r;r=void 0;let s=o.getRef(rl),c={fiber:void 0,awaiters:0};return i=c,c.fiber=Bc(o,Tc(e,e=>{if(i!==c||(i=void 0,rs(e)))return;let a=t(e);n=a===1/0?1/0:s.currentTimeMillisUnsafe()+a,r=e}),!0,!0),c.fiber._exit??a(o,c)}),co(()=>{r=void 0})]},vte=e=>co(()=>_te(e,gte)[0]),yte=Yt(e=>oo(Ia(e.id))),Oc=e=>Yt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Ac),e):e),kc=Vt({op:`SetInterruptible`,[_t](e){if(e.interruptible=this[pt],e._interruptedCause&&e.interruptible)return()=>oo(e._interruptedCause)}}),Ac=kc(!0),bte=kc(!1),xte=e=>{if(e.interruptible=!0,e._stack.push(bte),e._interruptedCause)return oo(e._interruptedCause)},Ste=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Ac))},jc=e=>Yt(t=>t.interruptible?e:xte(t)??e),Mc=e=>Yt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Ac),e(jc)):e(o)),Nc=(e,t)=>R(e)?t?.mode===`result`?Fc(e,zs,t):Fc(e,o,t):t?.discard?t.mode===`result`?Fc(Object.values(e),zs,t):Fc(Object.values(e),o,t):lo(()=>{let n={};return Do(Fc(Object.entries(e),([e,r])=>Jo(t?.mode===`result`?zs(r):r,t=>{st(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),Pc=Vt({op:`While`,[ht](e,t){return this[pt].step(e),this[pt].while()?(t._stack.push(this),this[pt].body()):is},[mt](e){return this[pt].while()?(e._stack.push(this),this[pt].body()):is}}),Fc=a(e=>typeof e[1]==`function`,(e,t,n)=>lo(()=>{let r=Ic(n?.concurrency);if(r===1)return Cte(e,t,n);let i=qr(e),a=i.length;if(a===0)return n?.discard?ho:ao([]);let o=n?.discard?void 0:Array(a),s=wte({f:t,out:o},i,{concurrency:r});return s?Do(s,o):ao(o)})),Cte=(e,t,n)=>lo(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return Do(Pc({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),Ic=e=>e===`unbounded`?1/0:Math.max(1,e??1),Lc=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>Wo(Js(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??ho),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!Go(c))return r(e,i,a,o,c);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return i},Rc=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=0,o=i.end??r.length,s=i.concurrency,c=!1,l,u,d,f,p,m=e=>{let t=Jt(e);return f=t,c=!0,u&&u.size>0?Wo(Oc(io(Array.from(u))),()=>f??t):t},h=()=>{let i=!1;for(;!f&&a<o;a++){let o=r[a],g=p??t(e,o,a);if(Go(g)){if(f=n(e,o,g,a),f)break}else if(l){p=void 0;let t=Bc(l,g,!0,!0,`inherit`);if(t._exit){if(f=n(e,o,t._exit,a),f)break;continue}u.add(t);let r=a;if(t.addObserver(a=>{u.delete(t);try{if(f){if(a._tag===`Failure`){let e=a.cause.reasons.filter(e=>e._tag!==`Interrupt`);if(e.length>0){let t=Mt(e);f=Kt(f._tag===`Failure`?Nt(f.cause,t):t)}}}else{let t=n(e,o,a,r);t&&(f=t,h())}if(i){let e=h();e&&d(e)}else c&&u.size===0&&d(f??ho)}catch(e){d(m(e))}}),u.size<s)continue;i=!0,a++;return}else return _o(e=>{l=Xa(),u=new Set,p=g,d=e;let t;try{t=h()}catch(t){return e(m(t))}return t?e(t):lo(()=>(f??=is,Wo(u?io(u):ho,()=>f?._tag===`Failure`?f:ho)))})}if(c=!0,f){if(u&&u.size>0){let e=$a(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||f._tag===`Failure`)return f}else if(d){if(u)u.size===0&&d(ho);else return is}};return h()}},zc=()=>e=>Rc(e),wte=Rc({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag===`Failure`)return n;e.out&&(e.out[r]=n.value)}}),Tte=a(e=>xt(e[0]),(e,t)=>Yt(n=>(Ol(),ao(Bc(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),Bc=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new Za(a.context,o);return n?s.evaluate(t):(s._asyncContext=Ya(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),!r&&!s._exit&&(a.children().add(s),s._parent=a),s},Ete=a(e=>xt(e[0]),(e,t)=>Yt(n=>ao(Bc(n,e,t?.startImmediately,!0,t?.uninterruptible)))),Vc=a(e=>xt(e[0]),(e,t,n)=>Yt(r=>{let i=Bc(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit){if(t.state._tag!==`Closed`){let e={};pc(t,e,()=>ote(e=>e===i.id?ho:ro(i))),i.addObserver(()=>mc(t,e))}else i.interruptUnsafe(r.id,$a(r))}return ao(i)})),Dte=a(e=>xt(e[0]),(e,t)=>Wo(yc,n=>Vc(e,n,t))),Hc=e=>(t,n)=>{let r=new Za(n?.scheduler?hr(e,Gi,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},Ote=a(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return pc(t,n,()=>ro(e)),e.addObserver(()=>mc(t,n)),e}),kte=Hc(pr()),Uc=e=>{let t=Hc(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},Ate=Uc(pr()),Wc=e=>{let t=Hc(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},jte=Wc(pr()),Gc=e=>{let t=Wc(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw Ba(e.cause);return e.value})},Mte=Gc(pr()),Kc=e=>{let t=Hc(e);return e=>{if(Go(e))return e;let n=new Xi(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Jt(new ml(r))}},Nte=Kc(pr()),qc=e=>{let t=Kc(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw Ba(n.cause);return n.value}},Pte=qc(pr()),Jc=ao(!0),Yc=ao(!1),Fte=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return Jc;if(this.scheduled===void 0)this.scheduled=this.waiters,e.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let e=0;e<this.waiters.length;e++)this.scheduled.push(this.waiters[e]);return this.waiters=[],Jc}flushScheduled=()=>{if(this.scheduled===void 0)return;let e=this.scheduled;this.scheduled=void 0;for(let t=0;t<e.length;t++)e[t](is)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](is)}open=Yt(e=>this._isOpen?Yc:(this._isOpen=!0,this.scheduleUnsafe(e)));release=Yt(e=>this._isOpen?Yc:this.scheduleUnsafe(e));openUnsafe(){return!this._isOpen&&(this._isOpen=!0,this.flushWaiters(),!0)}await=_o(e=>this._isOpen?e(ho):(this.waiters.push(e),co(()=>{let t=this.waiters.indexOf(e);t===-1?this.scheduled!==void 0&&(t=this.scheduled.indexOf(e),t!==-1&&this.scheduled.splice(t,1)):this.waiters.splice(t,1)})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=co(()=>this.closeUnsafe());whenOpen=e=>Wo(this.await,()=>e);isOpen(){return this._isOpen}},Xc=e=>new Fte(e??!1),Ite=e=>co(()=>Xc(e)),Zc=BigInt(0),Lte={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Zc,endTime:Zc,exit:is},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},Rte=e=>Object.assign(Object.create(Lte),e),Qc=e=>e?yr(e.annotations,ha)?e._tag===`Span`?Qc(Un(e.parent)):In():Ln(e):In(),$c=(e,t,n)=>{let r=!e.cache.tracerEnabled||n?.annotations&&yr(n.annotations,ha),i=n?.parent===void 0?n?.root?In():Qc(e.cache.span):Ln(n.parent),a;if(r)a=Rte({name:t,parent:i,annotations:hr(n?.annotations??pr(),ha,!0)});else{let r=e.cache.tracer??ya,o=e.getRef(rl),s=e.getRef(wa),c=e.getRef(Ta),l=e.getRef(Ea),u=n?.level??e.getRef(ga),d=n?.links===void 0?l.length===0?[]:l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??pr(),links:d,startTime:s?o.currentTimeNanosUnsafe():Zc,kind:n?.kind??`internal`,root:n?.root??Rn(i),sampled:n?.sampled??(zn(i)&&i.value.sampled===!1?!1:!vl(e.getRef(_a),u))});for(let e in c)a.attribute(e,c[e]);if(n?.attributes!==void 0)for(let e in n.attributes)a.attribute(e,n.attributes[e])}return a},zte=(e,t)=>Oc(Yt(n=>{let r=vr(n.context,rc),i=$c(n,e,t??{}),a=n.getRef(rl),o=n.getRef(wa);return Do(dc(r,e=>el(i,e,a,o)),i)})),Bte=(e,t)=>(t=typeof t==`function`?t:u,fs(Sa,n=>({name:e,stack:t,parent:n}))),el=(e,t,n,r)=>co(()=>{e.status._tag!==`Ended`&&e.end(r?n.currentTimeNanosUnsafe():Zc,t)}),tl=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return Yt(t=>{let i=$c(t,e,n),a=t.getRef(rl),o=t.getRef(wa);return Ec(t,e=>el(i,e,a,o)),r(i)})},nl=_s(pa),Vte=function(){let e=xt(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=o;return t._tag===`Span`&&(n=ja(n),r=Bte(t.name,n?.captureStackTrace)),e?nl(r(arguments[0]),t):e=>nl(r(e),t)},Hte=(...e)=>Yt(t=>{let n=t.currentSpanLocal;if(n){if(e.length===1)for(let[t,r]of Object.entries(e[0]))n.attribute(t,r);else n.attribute(e[0],e[1])}return ho}),rl=Er(`effect/Clock`,{defaultValue:()=>new Ute}),il=2**31-1,Ute=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=co(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Wte()}currentTimeNanos=co(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return ol()}monotonicTimeNanos=co(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(Fi(e))}sleepMillis(e){return e<=0?uo:Number.isFinite(e)?_o(t=>{let n=e>il?this.sleepMillis(e-il):ho,r=setTimeout(()=>t(n),Math.min(e,il));return co(()=>clearTimeout(r))}):vo}},al=BigInt(1e6),ol=function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==`function`)return()=>e.bigint();if(typeof performance<`u`&&typeof performance.now==`function`)return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let e=BigInt(Date.now())*al;return e>t&&(t=e),t}}(),Wte=function(){let e=BigInt(1e9),t;return()=>{let n=ol(),r=BigInt(Date.now())*al;if(t===void 0)t=r-n;else{let i=t+n;(r>i?r-i:i-r)>e&&(t=r-n)}return t+n}}(),sl=e=>Yt(t=>e(t.getRef(rl))),cl=e=>sl(t=>t.sleep(pi(e))),Gte=sl(e=>e.currentTimeMillis),ll=`~effect/Cause/TimeoutError`,Kte=class extends Qt(`TimeoutError`){[ll]=ll;constructor(e){super({message:e})}},ul=`~effect/Cause/IllegalArgumentError`,qte=class extends Qt(`IllegalArgumentError`){[ul]=ul;constructor(e){super({message:e})}},dl=`~effect/Cause/ExceededCapacityError`,fl=class extends Qt(`ExceededCapacityError`){[dl]=dl;constructor(e){super({message:e})}},pl=`~effect/Cause/AsyncFiberError`,ml=class extends Qt(`AsyncFiberError`){[pl]=pl;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},hl=`~effect/Cause/UnknownError`,gl=class extends Qt(`UnknownError`){[hl]=hl;constructor(e,t){super({message:t,cause:e})}},_l=Er(`effect/Console`,{defaultValue:()=>globalThis.console}),vl=Mn(fee(An,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),Jte=Er(`effect/Logger/CurrentLoggers`,{defaultValue:()=>new Set([El,Dl])}),Yte=Er(`effect/Logger/LogToStderr`,{defaultValue:l}),yl={"~effect/Logger":{_Message:o,_Output:o},pipe(){return n(this,arguments)}},bl=e=>{let t=Object.create(yl);return t.log=e,t},xl=e=>e.replace(/[\s="]/g,`_`),Sl=(e,t)=>`${xl(e[0])}=${t-e[1]}ms`,Cl=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];Tt(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?Mt(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=tee),Yt(r=>{let i=e??r.cache.logLevel;if(vl(r.cache.minimumLogLevel,i))return ho;let a=r.getRef(rl),o=r.getRef(Jte);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return ho})},wl={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};wl.gray,wl.blue,wl.green,wl.yellow,wl.red,wl.bgBrightRed,wl.black;var Tl=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,El=bl(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(Wa(e));let o=t.getTime(),s=n.getRef(Aa),c=``;for(let e of s)c+=` ${Sl(e,o)}`;let l=n.getRef(Da);Object.keys(l).length>0&&a.push(l);let u=n.getRef(_l);(n.getRef(Yte)?u.error:u.log)(`[${Tl(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),Dl=bl(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(rl),a=t.getRef(Da),o=t.cache.span;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))st(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=Wa(e)),o.event($e(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)});function Ol(){Qa.interruptChildren??=Qee}var kl=ao(void 0),Al=Tt,jl=Et,Ml=Rt,Nl=Mt,Pl=Pt,Fl=It,Il=Ia,Ll=e=>new jt(e),Rl=e=>new Ft(e),zl=Fa,Xte=Bee,Bl=Vee,Zte=Nt,Vl=Ba,Hl=La,Ul=Lee,Wl=Ra,Gl=Ree,Kl=za,ql=Wa,Jl=en,Yl=nn,Xl=aee,Zl=qte,Ql=fl,$l=gl,eu=Lt,tu=St,nu=Ut,ru=Kt,iu=qt,au=Jt,ou=$o,su=is,cu=es,lu=ts,uu=rs,du={"~effect/Deferred":{_A:o,_E:o},pipe(){return n(this,arguments)}},fu=function(){this.resumes=void 0,this.effect=void 0};fu.prototype=du;var pu=()=>new fu,mu=()=>co(()=>pu()),hu=e=>_o(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),co(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)}))),gu=a(2,(e,t)=>co(()=>vu(e,t))),Qte=a(2,(e,t)=>gu(e,qt(t))),$te=a(2,(e,t)=>gu(e,Kt(t))),ene=a(2,(e,t)=>$te(e,Ia(t))),_u=a(2,(e,t)=>gu(e,Ut(t))),vu=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let n=e.resumes;e.resumes=void 0;for(let e=0;e<n.length;e++)n[e](t)}return!0},tne=a(2,(e,t)=>Mc(n=>Wo(Js(n(e)),e=>gu(t,e)))),nne=Da,yu=rc,rne=vc,bu=hc,xu=bc,Su=dc,Cu=fc,wu=lc,Tu=uc,Eu=ic,ine=`~effect/Layer`,Du=`~effect/Layer/MemoMap`,ane=(e,t)=>{let n={observers:0,deferred:pu(),scope:bu(),finalizer:r=>lo(()=>--n.observers>0?ho:(e.map.delete(t),Eu(n.scope,r)))};return n},Ou=(e,t)=>t.state._tag!==`Closed`&&(e.observers++,pc(t,{},e.finalizer),!0),one={[ine]:{_ROut:o,_E:o,_RIn:o},pipe(){return n(this,arguments)}},ku=e=>{let t=Object.create(one);return t.build=e,t},Au=e=>ku((t,n)=>{let r=Tu(n);return Dc(e(t,r),e=>e._tag===`Failure`?Eu(r,e):ho)}),ju=e=>{let t=Au((n,r)=>n.getOrElseMemoize(t,r,e));return t},Mu=class{get[Du](){return Du}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);return n?(Ou(n,t),n.deferred.effect??hu(n.deferred)):this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return lo(()=>{let r;return Tc(lo(()=>{let i=this.get(e,t);if(i)return i;let a=ane(this,e);return Ou(a,t)?(r=a.deferred,this.map.set(e,a),n(this,a.scope)):n(this,t)}),e=>{r&&vu(r,e)})})}},Nu=()=>new Mu,sne=e=>new Mu(e),Pu=class e extends tr()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=gr(t,e);return n?sne(n):Nu()}},Fu=a(3,(e,t,n)=>_s(Jo(e.build(t,n),hr(Pu,t)),Pu,t)),Iu=e=>Yt(t=>Fu(e,Pu.forkOrCreate(t.context),vr(t.context,yu))),Lu=a(2,(e,t)=>Yt(n=>Fu(e,Pu.forkOrCreate(n.context),t))),Ru=function(){return arguments.length===1?e=>zu(mr(arguments[0],e)):zu(mr(arguments[0],arguments[1]))},zu=e=>ku(s(ao(e))),Bu=zu(pr()),Vu=function(){return arguments.length===1?e=>Hu(()=>mr(arguments[0],e())):Hu(()=>mr(arguments[0],arguments[1]()))},Hu=e=>ju(s(co(e))),Uu=function(){return arguments.length===1?e=>Wu(arguments[0],e):Wu(arguments[0],arguments[1])},Wu=(e,t)=>Gu(Jo(t,t=>mr(e,t))),Gu=e=>ju((t,n)=>xu(e,n)),Ku=e=>Gu(Do(e,pr())),qu=(e,t,n)=>{let r=Tu(n,`parallel`);return Fc(e,e=>e.build(t,Tu(r,`sequential`)),{concurrency:e.length}).pipe(Jo(e=>Tr(...e)))},Ju=(...e)=>Au((t,n)=>qu(e,t,n)),Yu=a(2,(e,t)=>Ju(e,...Array.isArray(t)?t:[t])),Xu=(e,t,n)=>Au((r,i)=>Wo(Array.isArray(t)?qu(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(gs(t),Jo(e=>n(e,t))))),Zu=a(2,(e,t)=>Xu(e,t,o)),Qu=a(2,(e,t)=>Xu(e,t,(e,t)=>wr(t,e))),$u=e=>ku((t,n)=>e.build(Nu(),n)),ed=rl,td=Gte,nd=`~effect/DateTime`,rd=`~effect/DateTime/TimeZone`,id={[nd]:nd,pipe(){return n(this,arguments)},[Ze](){return this.toString()},toJSON(){return Ad(this).toJSON()}},ad={...id,_tag:`Utc`,[ee](){return oe(this.epochMilliseconds)},[ve](e){return ud(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Ad(this).toJSON()})`}},od={...id,_tag:`Zoned`,[ee](){return re(oe(this.epochMilliseconds))(z(this.zone))},[ve](e){return ud(e)&&e._tag===`Zoned`&&this.epochMilliseconds===e.epochMilliseconds&&ye(this.zone,e.zone)},toString(){return`DateTime.Zoned(${Gd(this)})`}},sd={[rd]:rd,[Ze](){return this.toString()}},cd={...sd,_tag:`Named`,[ee](){return se(`Named:${this.id}`)},[ve](e){return fd(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}};({...sd});var ld=(e,t,n)=>{let r=Object.create(od);return r.epochMilliseconds=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},ud=e=>F(e,nd),dd=e=>ud(e[0]),fd=e=>F(e,rd),pd=e=>e._tag===`Utc`,md=kn((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:+(e.epochMilliseconds>t.epochMilliseconds)),hd=e=>{let t=Object.create(ad);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},gd=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Zl(`Invalid date`);return hd(t)},_d=e=>{if(ud(e))return e;if(e instanceof Date)return gd(e);if(typeof e==`object`){if(`epochMilliseconds`in e)return gd(new Date(e.epochMilliseconds));let t=new Date(0);return Id(t,e),gd(t)}return typeof e==`string`&&!vd(e)?gd(new Date(e+`Z`)):gd(new Date(e))},vd=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),yd=Wn(_d),bd=Jo(td,hd),xd=()=>hd(Date.now()),Sd=e=>hd(e.epochMilliseconds),Cd=a(dd,(e,t,n)=>n?.adjustForTimeZone===!0?Rd(e.epochMilliseconds,t,n?.disambiguation??`compatible`):ld(e.epochMilliseconds,t,e.partsUtc)),wd=new Map,Td={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},Ed=e=>{let t=e.resolvedOptions().timeZone,n=wd.get(t);if(n!==void 0)return n;let r=Object.create(cd);return r.id=t,r.format=e,wd.set(t,r),r},Dd=()=>Ed(new Intl.DateTimeFormat(`en-US`,Td)),Od=a(2,(e,t)=>ki(Fd(t)-Fd(e))),kd=Mn(md),Ad=e=>new Date(e.epochMilliseconds),jd=e=>{if(e._tag===`Utc`)return new Date(e.epochMilliseconds);if(e.zone._tag===`Offset`)return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type===`fractionalSecond`?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=n.getTime(),n},Md=e=>jd(e).getTime()-Fd(e),Nd=e=>{let t=Math.abs(e),n=Math.floor(t/36e5),r=Math.round(t%36e5/6e4);return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},Pd=e=>Nd(Md(e)),Fd=e=>e.epochMilliseconds,Id=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month===void 0?e.getUTCMonth():t.month-1,t.day??e.getUTCDate()),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)},Ld=864e5,Rd=(e,t,n)=>{if(t._tag===`Offset`)return ld(e-t.offset,t);let r=Vd(e-Ld,e,t),i=Vd(e+Ld,e,t);if(r===i)return ld(e-r,t);let a=r<i,o=r-i;if(a){if(Vd(e-i,e,t)===i)return ld(e-i,t);let a=ld(e-r,t);if(e!==jd(a).getTime())switch(n){case`reject`:{let n=new Date(e).toISOString();throw RangeError(`Gap time: ${n} does not exist in time zone ${t.id}`)}case`earlier`:return ld(e-i,t);case`compatible`:case`later`:return a}return a}if(Vd(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||Vd(e-r+o,e+o,t)===r)return ld(e-r,t);if(n===`reject`){let n=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${n} occurs twice in time zone ${t.id}`)}}return ld(e-i,t)},zd=/([+-])(\d{2}):(\d{2})$/,Bd=e=>{let t=zd.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},Vd=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=Bd(r);return i===null?Md(ld(t,n)):i},Hd=e=>Ad(e).toISOString(),Ud=e=>jd(e).toISOString().slice(0,10),Wd=e=>{let t=jd(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${Pd(e)}`},Gd=e=>e.zone._tag===`Offset`?Wd(e):`${Wd(e)}[${e.zone.id}]`;globalThis.String;var Kd=e=>e.trim(),qd=(e,t,n)=>{let r=n*(t-e)+e;if(r!==t||e>=t||!Number.isFinite(t))return r;if(t===0)return-Number.MIN_VALUE;let i=new DataView(new ArrayBuffer(8));i.setFloat64(0,t);let a=i.getBigUint64(0);return i.setBigUint64(0,t>0?a-BigInt(1):a+BigInt(1)),i.getFloat64(0)},Jd=a(2,(e,t)=>Ts(e,Qd,e=>t(e))),Yd=e=>e.reasons.some(Xd),Xd=e=>e._tag===`Fail`&&Yl(e.error),Zd=e=>{let t,n=!1;for(let r of e.reasons)Xd(r)?t??=r.error:r._tag!==`Interrupt`&&(n=!0);return t===void 0?Ar(e):n?Ar(Nl(e.reasons.filter(e=>!Xd(e)))):kr(t)},Qd=e=>{let t=Zd(e);return Mr(t)?t:kr(t.success.value)},$d=e=>{let t=Zd(e);return Mr(t)?ru(t.failure):nu(t.success.value)},ef=a(2,(e,t)=>Bs(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=Zd(e);return Mr(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),tf=`~effect/Schedule`,nf=Er(`effect/Schedule/CurrentMetadata`,{defaultValue:s({input:void 0,output:void 0,duration:Ti,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),rf={[tf]:{_Out:o,_In:o,_Env:o},pipe(){return n(this,arguments)}},af=e=>{let t=Object.create(rf);return t.step=e,t},of=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},sf=e=>af(Jo(e,e=>{let t=of();return(n,r)=>e(t(n,r))})),cf=e=>xs(e.step,e=>ao(()=>oo(e))),lf=e=>sl(t=>Jo(cf(e),e=>{let n=of();return r=>lo(()=>{let i=t.currentTimeMillisUnsafe();return Wo(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,Do(cl(t),a)})})})),uf=e=>af(Jo(Nc(e.map(cf)),e=>(t,n)=>Wo(Fc(e,e=>ef(e(t,n),{onSuccess:e=>ao(e[1]),onDone:()=>kl,onFailure:oo})),e=>{let t=df(e);return t===void 0?Xl(Ti):ao([t,t])}))),df=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t=t===void 0?r:Aee(t,r))}return t},ff=(e,t=2)=>{let n=Fi(pi(e));return sf(ao(e=>{let r=ki(n*t**(e.attempt-1));return ao([r,r])}))},pf=e=>{let t=pi(e);return sf(ao(e=>ao([e.attempt-1,t])))},mf=a(2,(e,t)=>af(Jo(cf(e),e=>{let n=of();return(r,i)=>Bo(e(r,i),([e,a])=>t({...n(r,i),output:e,duration:a}))}))),hf=a(2,(e,t)=>{let n=t.duration===void 0?void 0:pi(t.duration);return gf(e,({attempt:e,elapsed:r})=>ao((t.times===void 0||e<=t.times)&&(n===void 0||jee(ki(r),n))))}),gf=a(2,(e,t)=>af(Jo(cf(e),e=>{let n=of();return(r,i)=>Wo(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return Wo(xt(s)?s:ao(s),t=>t?ao(e):Xl(a))})}))),_f=pf(Ti),vf=()=>e=>e,yf=(e,t,n)=>Sc(r=>Wo(n?.local?Fu(t,Nu(),r):Lu(t,r),t=>gs(e,t))),bf=a(e=>xt(e[0]),(e,t,n)=>dr(t)?gs(e,t):yf(e,Array.isArray(t)?Ju(...t):t,n)),xf=a(3,(e,t,n)=>Wo(lf(t),t=>{let r=nf.defaultValue(),i,a=Es(lo(()=>_s(e,nf,r)),e=>(i=e,Wo(t(e),e=>(r=e,a))));return Jd(a,e=>ot(()=>n(i,e)))})),Sf=xt,Cf=Nc,wf=Fc,Tf=Pc,Ef=ite,Df=ate,B=ao,Of=fo,kf=lo,V=co,Af=ho,jf=kl,Mf=_o,Nf=vo,H=cte,U=so,Pf=oo,Ff=nte,If=po,Lf=rte,Rf=uo,zf=Yt,cne=tte,Bf=Wo,Vf=qo,Hf=zo,Uf=Bo,Wf=zs,lne=Rs,Gf=Js,Kf=Jo,qf=Do,Jf=Ro,Yf=Vo,Xf=Es,Zf=js,Qf=xs,une=ws,$f=Ms,ep=Ps,tp=ks,dne=Ds,fne=xf,np=Is,pne=Ls,mne=Fs,rp=$s,ip=ec,ap=Zs,hne=Xs,op=cl,sp=Uo,gne=ys,cp=Ks,lp=Bs,_ne=Gs,up=ps,dp=hs,fp=bf,pp=gs,vne=us,mp=ds,hp=_s,gp=yc,_p=xc,yne=Sc,vp=Cc,yp=hte,bp=lte,xp=ute,Sp=fte,Cp=Dc,wp=vte,Tp=yte,Ep=jc,Dp=mte,Op=Oc,kp=Mc,Ap=bs,bne=Hte,xne=zte,jp=tl,Mp=Vte,Np=Tte,Pp=Vc,Fp=Dte,Sne=Ete,Ip=kte,Lp=Hc,Rp=Uc,Cne=Ate,zp=Mte,wne=Gc,Bp=jte,Tne=Wc,Vp=Pte,Hp=qc,Up=Nte,Ene=Kc,Wp=yo,Gp=So,Kp=sl,qp=Cl(`Error`),Dne=a(e=>Sf(e[0]),(e,...t)=>fs(e,nne,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||st(n,t[0],t[1]),n})),Jp=Yo,Yp=Xo,Xp=Zo,Zp=Ko,One=Qo,kne=wo,Qp=`~effect/BigDecimal`,Ane={[Qp]:Qp,[ee](){let e=tm(this);return re(se(String(e.value)),oe(e.scale))},[ve](e){return jne(e)&&Rne(this,e)===0},toString(){return`BigDecimal(${zne(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Ze](){return this.toJSON()},pipe(){return n(this,arguments)}},jne=e=>F(e,Qp),Mne=(e,t)=>{if(!Number.isSafeInteger(t))throw RangeError(`Scale must be a safe integer, got ${t}`);let n=Object.create(Ane);return n.value=e,n.scale=t,n},$p=(e,t)=>{let n=Mne(e,t);return n.normalized=n,n},em=BigInt(0),Nne=BigInt(1),Pne=BigInt(10),Fne=$p(em,0),tm=e=>{if(e.normalized===void 0){if(e.value===em)e.normalized=Fne;else{let t=`${e.value}`,n=t.length;for(;t[n-1]===`0`;)n--;e.normalized=$p(BigInt(t.slice(0,n)),e.scale-(t.length-n))}}return e.normalized},Ine=100,Lne=[Nne],nm=(e,t)=>e===t?0:e<t?-1:1,rm=(e,t)=>{let n=`${e.value<em?-e.value:e.value}`,r=`${t.value<em?-t.value:t.value}`,i=BigInt(n.length-r.length)-BigInt(e.scale)+BigInt(t.scale);if(i!==em)return i<em?-1:1;let a=Math.max(n.length,r.length);return dee(n.padEnd(a,`0`),r.padEnd(a,`0`))},Rne=(e,t)=>{if(e.scale===t.scale)return nm(e.value,t.value);let n=im(e),r=im(t);if(n!==r)return n<r?-1:1;if(n===0)return 0;let i=e.scale-t.scale,a=Math.abs(i);if(a>Ine)return n===-1?rm(t,e):rm(e,t);let o=Lne[a]??=Pne**BigInt(a);return i>0?nm(e.value,t.value*o):nm(e.value*o,t.value)},im=e=>e.value===em?0:e.value<em?-1:1,zne=e=>{let t=tm(e);if(Math.abs(t.scale)>=16)return Bne(t);let n=t.value<em,r=`${n?-t.value:t.value}`,i=t.scale>0?r.padStart(t.scale+1,`0`):r.padEnd(r.length-t.scale,`0`),a=i.length-t.scale,o=t.scale>0?`${i.slice(0,a)}.${i.slice(a)}`:i;return n?`-${o}`:o},Bne=e=>{if(Vne(e))return`0e+0`;let t=tm(e),n=`${t.value}`,r=t.value<em?2:1,i=n.slice(0,r),a=n.slice(r),o=a.length-t.scale;return`${i}${a===``?``:`.${a}`}e${o>=0?`+`:``}${o}`},Vne=e=>e.value===em,Hne=BigInt(1),am=BigInt(1e3),om=BigInt(1024),sm=[{symbol:`B`,factor:Hne,names:[`B`,`byte`,`bytes`]},{symbol:`kB`,factor:am,names:[`kB`,`kilobyte`,`kilobytes`]},{symbol:`MB`,factor:am**BigInt(2),names:[`MB`,`megabyte`,`megabytes`]},{symbol:`GB`,factor:am**BigInt(3),names:[`GB`,`gigabyte`,`gigabytes`]},{symbol:`TB`,factor:am**BigInt(4),names:[`TB`,`terabyte`,`terabytes`]},{symbol:`PB`,factor:am**BigInt(5),names:[`PB`,`petabyte`,`petabytes`]},{symbol:`EB`,factor:am**BigInt(6),names:[`EB`,`exabyte`,`exabytes`]},{symbol:`ZB`,factor:am**BigInt(7),names:[`ZB`,`zettabyte`,`zettabytes`]},{symbol:`YB`,factor:am**BigInt(8),names:[`YB`,`yottabyte`,`yottabytes`]},{symbol:`RB`,factor:am**BigInt(9),names:[`RB`,`ronnabyte`,`ronnabytes`]},{symbol:`QB`,factor:am**BigInt(10),names:[`QB`,`quettabyte`,`quettabytes`]}],Une=[sm[0],{symbol:`KiB`,factor:om,names:[`KiB`,`kibibyte`,`kibibytes`]},{symbol:`MiB`,factor:om**BigInt(2),names:[`MiB`,`mebibyte`,`mebibytes`]},{symbol:`GiB`,factor:om**BigInt(3),names:[`GiB`,`gibibyte`,`gibibytes`]},{symbol:`TiB`,factor:om**BigInt(4),names:[`TiB`,`tebibyte`,`tebibytes`]},{symbol:`PiB`,factor:om**BigInt(5),names:[`PiB`,`pebibyte`,`pebibytes`]},{symbol:`EiB`,factor:om**BigInt(6),names:[`EiB`,`exbibyte`,`exbibytes`]},{symbol:`ZiB`,factor:om**BigInt(7),names:[`ZiB`,`zebibyte`,`zebibytes`]},{symbol:`YiB`,factor:om**BigInt(8),names:[`YiB`,`yobibyte`,`yobibytes`]}];[...sm,...Une.slice(1)];var Wne=ud,Gne=pd,cm=_d,Kne=yd,qne=bd,Jne=xd,Yne=Sd,lm=Cd,Xne=Dd,Zne=Od,Qne=kd,um=Md,dm=Hd,$ne=Ud,fm=e=>ere(typeof e==`string`?tre.encode(e):e),pm=e=>{let t=nre(e),n=t.length;if(n%4!=0)return Ar(new aa({kind:`Decode`,module:`Base64`,input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf(`=`);if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!==`=`))return Ar(new aa({kind:`Decode`,module:`Base64`,input:t,message:`Found a '=' character, but it is not at the end`}));try{let e=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=new Uint8Array(n/4*3-e);for(let e=0,i=0;e<n;e+=4,i+=3){let n=gm(t.charCodeAt(e))<<18|gm(t.charCodeAt(e+1))<<12|gm(t.charCodeAt(e+2))<<6|gm(t.charCodeAt(e+3));r[i]=n>>16,r[i+1]=n>>8&255,r[i+2]=n&255}return kr(r)}catch(e){return Ar(new aa({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},ere=e=>{let t=e.length,n=``,r=2;for(;r<t;r+=3)n+=mm[e[r-2]>>2],n+=mm[(e[r-2]&3)<<4|e[r-1]>>4],n+=mm[(e[r-1]&15)<<2|e[r]>>6],n+=mm[e[r]&63];return r===t+1&&(n+=mm[e[r-2]>>2],n+=mm[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=mm[e[r-2]>>2],n+=mm[(e[r-2]&3)<<4|e[r-1]>>4],n+=mm[(e[r-1]&15)<<2],n+=`=`),n},tre=new TextEncoder,nre=e=>e.replace(/[\n\r]/g,``),mm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,hm=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)hm[mm.charCodeAt(e)]=e;hm[61]=0;var gm=e=>{if(e>=hm.length||hm[e]===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return hm[e]},_m=`~effect/HashMap`,vm=5,ym=32,bm=ym/4,xm=ym/2,Sm=31,Cm=e=>(e-=e>>>1&1431655765,e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),wm=(e,t)=>e>>>t&Sm,Tm=(e,t)=>1<<wm(e,t),Em=(e,t)=>Cm(e&t-1);function Dm(e,t,n,r,i,a){if(t>32)throw Error(`HashMap: max depth exceeded`);let o=Tm(n,t),s=Tm(i,t);return o===s?new Fm(e,o,[Dm(e,t+vm,n,r,i,a)]):new Fm(e,o|s,o>>>0<s>>>0?[r,a]:[a,r])}var Om=se(`HashMap`),km=(e,t)=>re(z(e),z(t)),Am=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e[n];r&&(t^=r.subtreeHash())}return t},jm=class{canEdit(e){return this.edit===e}subtreeHash(){let e=this._hash;if(e===void 0){let t=y;e=this.computeHash(),t===y&&(this._hash=e)}return e}},Mm=class extends jm{_tag=`EmptyNode`;edit=0;get size(){return 0}get(e,t,n){return In()}has(e,t,n){return!1}set(e,t,n,r,i,a){return a.value=!0,new Nm(e,n,r,i)}remove(e,t,n,r,i){return this}canEdit(e){return!1}computeHash(){return 0}},Nm=class e extends jm{_tag=`LeafNode`;edit;hash;key;value;constructor(e,t,n,r){super(),this.edit=e,this.hash=t,this.key=n,this.value=r}get size(){return 1}get(e,t,n){return this.hash===t&&ye(this.key,n)?Ln(this.value):In()}has(e,t,n){return this.hash===t&&ye(this.key,n)}set(t,n,r,i,a,o){if(this.canEdit(t)&&(this._hash=void 0),this.hash===r&&ye(this.key,i))return ye(this.value,a)?this:this.canEdit(t)?(this.value=a,this):new e(t,r,i,a);if(o.value=!0,this.hash===r)return new Pm(t,r,[[this.key,this.value],[i,a]]);let s=Tm(r,n),c=Tm(this.hash,n);return s===c?new Fm(t,s,[this.set(t,n+vm,r,i,a,o)]):new Fm(t,s|c,s>>>0<c>>>0?[new e(t,r,i,a),this]:[this,new e(t,r,i,a)])}remove(e,t,n,r,i){if(this.hash===n&&ye(this.key,r)){i.value=!0;return}return this}computeHash(){return km(this.key,this.value)}},Pm=class e extends jm{_tag=`CollisionNode`;edit;hash;entries;constructor(e,t,n){super(),this.edit=e,this.hash=t,this.entries=n}get size(){return this.entries.length}get(e,t,n){if(this.hash!==t)return In();for(let[e,t]of this.entries)if(ye(e,n))return Ln(t);return In()}has(e,t,n){if(this.hash!==t)return!1;for(let[e]of this.entries)if(ye(e,n))return!0;return!1}set(t,n,r,i,a,o){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==r)return o.value=!0,Dm(t,n,this.hash,this,r,new Nm(t,r,i,a));for(let n=0;n<this.entries.length;n++)if(ye(this.entries[n][0],i)){if(ye(this.entries[n][1],a))return this;if(this.canEdit(t))return this.entries[n]=[i,a],this;let r=[...this.entries];return r[n]=[i,a],new e(t,this.hash,r)}return o.value=!0,this.canEdit(t)?(this.entries.push([i,a]),this):new e(t,this.hash,[...this.entries,[i,a]])}remove(t,n,r,i,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==r)return this;let o=this.entries.findIndex(([e])=>ye(e,i));if(o===-1)return this;if(a.value=!0,this.entries.length===1)return;if(this.entries.length===2){let e=this.entries[+(o===0)];return new Nm(t,this.hash,e[0],e[1])}if(this.canEdit(t))return this.entries.splice(o,1),this;let s=[...this.entries];return s.splice(o,1),new e(t,this.hash,s)}computeHash(){let e=0,t=this.entries;for(let n=0;n<t.length;n++)e^=km(t[n][0],t[n][1]);return e}},Fm=class e extends jm{_tag=`IndexedNode`;edit;_size;bitmap;children;constructor(e,t,n){super(),this.edit=e,this.bitmap=t,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((e,t)=>e+t.size,0)),this._size}get(e,t,n){let r=Tm(t,e);if((this.bitmap&r)===0)return In();let i=Em(this.bitmap,r);return this.children[i].get(e+vm,t,n)}has(e,t,n){let r=Tm(t,e);if((this.bitmap&r)===0)return!1;let i=Em(this.bitmap,r);return this.children[i].has(e+vm,t,n)}set(t,n,r,i,a,o){this.canEdit(t)&&(this._hash=void 0);let s=Tm(r,n),c=Em(this.bitmap,s);if((this.bitmap&s)!==0){let s=this.children[c],l=s.set(t,n+vm,r,i,a,o);if(s===l)return this;if(this.canEdit(t))return this.children[c]=l,this;let u=[...this.children];return u[c]=l,new e(t,this.bitmap,u)}{o.value=!0;let n=new Nm(t,r,i,a),l=this.bitmap|s;if(this.canEdit(t))return this.children.splice(c,0,n),this.bitmap=l,this._size=void 0,this.children.length>xm?this.expand(t,l,this.children):this;let u=[...this.children];return u.splice(c,0,n),u.length>xm?this.expand(t,l,u):new e(t,l,u)}}remove(t,n,r,i,a){this.canEdit(t)&&(this._hash=void 0);let o=Tm(r,n);if((this.bitmap&o)===0)return this;let s=Em(this.bitmap,o),c=this.children[s],l=c.remove(t,n+vm,r,i,a);if(!a.value)return this;if(l===void 0){let n=this.bitmap^o;if(n===0)return;if(this.children.length===2){let e=this.children[+(s===0)];if(e._tag===`LeafNode`)return e}if(this.canEdit(t))return this.children.splice(s,1),this.bitmap=n,this._size=void 0,this;let r=[...this.children];return r.splice(s,1),new e(t,n,r)}if(c===l)return this;if(this.canEdit(t))return this.children[s]=l,this;let u=[...this.children];return u[s]=l,new e(t,this.bitmap,u)}expand(e,t,n){let r=new globalThis.Array(ym),i=0;for(let e=0;e<ym;e++)t&1<<e&&(r[e]=n[i++]);return new Im(e,n.length,r)}computeHash(){return Am(this.children)}},Im=class e extends jm{_tag=`ArrayNode`;edit;_size;count;children;constructor(e,t,n){super(),this.edit=e,this.count=t,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((e,t)=>e+(t?.size??0),0)),this._size}get(e,t,n){let r=wm(t,e),i=this.children[r];return i?i.get(e+vm,t,n):In()}has(e,t,n){let r=wm(t,e),i=this.children[r];return i?i.has(e+vm,t,n):!1}set(t,n,r,i,a,o){this.canEdit(t)&&(this._hash=void 0);let s=wm(r,n),c=this.children[s];if(c){let l=c.set(t,n+vm,r,i,a,o);if(c===l)return this;if(this.canEdit(t))return this.children[s]=l,this;let u=[...this.children];return u[s]=l,new e(t,this.count,u)}{o.value=!0;let n=new Nm(t,r,i,a);if(this.canEdit(t))return this.children[s]=n,this.count++,this._size=void 0,this;let c=[...this.children];return c[s]=n,new e(t,this.count+1,c)}}remove(t,n,r,i,a){this.canEdit(t)&&(this._hash=void 0);let o=wm(r,n),s=this.children[o];if(!s)return this;let c=s.remove(t,n+vm,r,i,a);if(!a.value)return this;let l=this.count-+!c;if(l<bm)return this.pack(t,o,c);if(s===c)return this;if(this.canEdit(t))return this.children[o]=c,c||(this.count=l),this._size=void 0,this;let u=[...this.children];return u[o]=c,new e(t,l,u)}pack(e,t,n){let r=[],i=0,a=1;for(let e=0;e<this.children.length;e++){let o=e===t?n:this.children[e];o&&(r.push(o),i|=a),a<<=1}return new Fm(e,i,r)}computeHash(){return Am(this.children)}},Lm=class{stack;project;entries=[];index=0;constructor(e,t){this.stack=[e],this.project=t}next(){for(;;){if(this.index<this.entries.length){let e=this.entries[this.index++];return{done:!1,value:this.project(e[0],e[1])}}if(this.stack.length===0)return{done:!0,value:void 0};let e=this.stack.pop();switch(e._tag){case`LeafNode`:{let t=e;return{done:!1,value:this.project(t.key,t.value)}}case`CollisionNode`:this.entries=e.entries,this.index=0;break;case`IndexedNode`:case`ArrayNode`:{let t=e.children;for(let e=t.length-1;e>=0;e--){let n=t[e];n&&this.stack.push(n)}}}}}[Symbol.iterator](){return this}},Rm=(e,t)=>[e,t],zm=(e,t)=>t,Bm=class{[_m]=_m;_editable;_edit;_root;_size;constructor(e,t,n,r){this._editable=e,this._edit=t,this._root=n,this._size=r}get size(){return this._size}[Symbol.iterator](){return new Lm(this._root,Rm)}[ve](e){if(Hm(e)){let t=e;if(this.size!==t.size)return!1;for(let[t,n]of this){let r=f(e,Wm(t));if(Rn(r)||!ye(n,r.value))return!1}return!0}return!1}[ee](){return ie(Om^this._root.subtreeHash())}[Ze](){return Qe(this)}toString(){return`HashMap(${Ue(Array.from(this))})`}toJSON(){return{_id:`HashMap`,values:Array.from(this).map(([e,t])=>[Qe(e),Qe(t)])}}pipe(){return n(this,arguments)}},Vm=new Mm,Hm=e=>F(e,_m),Um=()=>new Bm(!1,0,Vm,0),Wm=a(2,(e,t)=>e._root.get(0,z(t),t)),Gm=(e,t,n,r)=>{let i=e,a={value:!1},o=i._editable?i._edit:NaN,s=i._root.set(o,0,n,t,r,a);return i._editable?(i._root=s,a.value&&i._size++,e):i._root===s?e:new Bm(!1,i._edit,s,i._size+ +!!a.value)},Km=a(3,(e,t,n)=>Gm(e,t,z(t),n)),qm=e=>new Lm(e._root,zm),Jm=(e,t,n)=>{let r=e,i={value:!1},a=r._editable?r._edit:NaN,o=r._root.remove(a,0,n,t,i);return i.value?r._editable?(r._root=o??Vm,r._size--,e):o===void 0?Um():new Bm(!1,r._edit,o,r._size-1):e},Ym=a(2,(e,t)=>Jm(e,t,z(t))),Xm=Um,Zm=Km,Qm=qm,$m=Ym,eh=`~effect/http/Cookies`,th=`~effect/http/Cookies/Cookie`,nh={[eh]:eh,...et,toJSON(){return{_id:`effect/Cookies`,cookies:Hr(this.cookies,e=>e.toJSON())}},pipe(){return n(this,arguments)}},rh=e=>{let t=Object.create(nh);return t.cookies=e,t},ih=e=>{let t={};for(let n of e)st(t,n.name,n);return rh(t)},ah=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=oh(e.trim());t&&n.push(t)}return ih(n)};function oh(e){let t=e.split(`;`).map(e=>e.trim()).filter(e=>e!==``);if(t.length===0)return;let n=t[0].indexOf(`=`);if(n===-1)return;let r=t[0].slice(0,n);if(!sh.test(r))return;let i=t[0].slice(n+1),a=lh(i);if(t.length===1)return Object.assign(Object.create(ch),{name:r,value:a,valueEncoded:i});let o={};for(let e=1;e<t.length;e++){let n=t[e],r=n.indexOf(`=`),i=r===-1?n:n.slice(0,r).trim(),a=r===-1?void 0:n.slice(r+1).trim();switch(i.toLowerCase()){case`domain`:{if(a===void 0)break;let e=a.trim().replace(/^\./,``);e&&(o.domain=e);break}case`expires`:{if(a===void 0)break;let e=new Date(a);isNaN(e.getTime())||(o.expires=e);break}case`max-age`:{if(a===void 0)break;let e=parseInt(a,10);isNaN(e)||(o.maxAge=Ai(e));break}case`path`:if(a===void 0)break;a[0]===`/`&&(o.path=a);break;case`priority`:if(a===void 0)break;switch(a.toLowerCase()){case`low`:o.priority=`low`;break;case`medium`:o.priority=`medium`;break;case`high`:o.priority=`high`}break;case`httponly`:o.httpOnly=!0;break;case`secure`:o.secure=!0;break;case`partitioned`:o.partitioned=!0;break;case`samesite`:if(a===void 0)break;switch(a.toLowerCase()){case`lax`:o.sameSite=`lax`;break;case`strict`:o.sameSite=`strict`;break;case`none`:o.sameSite=`none`}}}return Object.assign(Object.create(ch),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var sh=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,ch={[th]:th,...et,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},lh=e=>{try{return decodeURIComponent(e)}catch{return e}},uh=new WeakMap,dh=e=>{if(uh.has(e))return uh.get(e);throw Error(`Unable to get redacted value`+(e.label?` with label: "${e.label}"`:``))},fh=`~effect/Redacted`,ph=e=>F(e,fh),mh=(e,t)=>{let n=Object.create(hh);return t?.label&&(n.label=t.label),uh.set(n,e),n},hh={[fh]:{_A:e=>e},label:void 0,...yt,toJSON(){return this.toString()},toString(){return`<redacted${x(this.label)?`:`+this.label:``}>`},[ee](){return z(uh.get(this))},[ve](e){return ph(e)&&ye(uh.get(this),uh.get(e))}},gh=dh,_h=e=>sn((t,n)=>e(gh(t),gh(n))),vh=Symbol.for(`~effect/http/Headers`),yh=Object.defineProperties(Object.create(null),{[vh]:{value:vh},[Ie]:{value(e){return kh(this,yr(e,jh))}},toJSON:{value(){return Re(this)}},[ve]:{value(e){return xh(this,e)}},[ee]:{value(){return le(this)}},toString:{value:et.toString},[Ze]:{value:et[Ze]}}),bh=e=>Object.assign(Object.create(yh),e),xh=Gr(cn()),Sh=Object.create(yh),Ch=e=>{if(e===void 0)return Sh;if(Symbol.iterator in e){let t=Object.create(yh);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(yh);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(`, `):r!==void 0&&(t[n.toLowerCase()]=r);return t},wh=e=>Object.setPrototypeOf(e,yh),Th=a(3,(e,t,n)=>{let r=bh(e);return r[t.toLowerCase()]=n,r}),Eh=a(2,(e,t)=>bh({...e,...Ch(t)})),Dh=a(2,(e,t)=>{let n=bh(e);return Object.assign(n,t),n}),Oh=a(2,(e,t)=>{let n=bh(e);return delete n[t.toLowerCase()],n}),kh=a(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=mh(e[r]))}else for(let r in e)r.search(t)!==-1&&(n[r]=mh(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),Ah=(e,t)=>{for(let n=0;n<t.length;n++){let r=t[n];if(typeof r==`string`){if(r.toLowerCase()===e.toLowerCase())return!0}else if(e.search(r)!==-1)return!0}return!1},jh=Er(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),Mh=`~effect/http/UrlParams`,Nh=e=>F(e,Mh),Ph={...yt,[Mh]:Mh,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[ve](e){return Rh(this,e)},[ee](){return de(this.params.flat())}},Fh=e=>{let t=Object.create(Ph);return t.params=e,t},Ih=e=>{if(Nh(e))return e;let t=Lh(e),n=[];for(let e=0;e<t.length;e++)if(Array.isArray(t[e][0])){let[r,i]=t[e];n.push([`${r[0]}[${r.slice(1).join(`][`)}]`,i])}else n.push(t[e]);return Fh(n)},Lh=e=>{let t=typeof e[Symbol.iterator]==`function`?qr(e):Object.entries(e),n=[];for(let[e,r]of t)if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]!==void 0&&n.push([e,String(r[t])]);else if(typeof r==`object`&&r){let t=Lh(r);for(let[r,i]of t)n.push([[e,...typeof r==`string`?[r]:r],i])}else r!==void 0&&n.push([e,String(r)]);return n},Rh=sn((e,t)=>zh(e.params,t.params)),zh=wee(Ir([cn(),cn()])),Bh=Fh([]),Vh=a(2,(e,t)=>Fh(t(e.params))),Hh=a(2,(e,t)=>{let n=Ih(t).params.slice(),r=new Set;for(let e=0;e<n.length;e++)r.add(n[e][0]);for(let t=0;t<e.params.length;t++)r.has(e.params[t][0])||n.push(e.params[t]);return Fh(n)}),Uh=a(2,(e,t)=>Vh(e,Xr(Ih(t).params))),Wh=e=>new URLSearchParams(Ih(e).params).toString(),Gh=e=>{let t={};for(let[n,r]of e.params)if(!Object.hasOwn(t,n))st(t,n,r);else{let e=t[n];typeof e==`string`?st(t,n,[e,r]):e.push(r)}return t};function Kh(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function qh(e){return t=>Kh(t)?.[e]}var Jh=`~structural`,Yh=`~sentinels`,Xh=`~constructor`,Zh=m(e=>{let t=Kh(e)?.identifier;return typeof t==`string`?t:e.getExpected(Zh)}),Qh=Symbol(),$h=nu,eg=$h(Qh),tg=$h(Qh),ng=e=>e===Qh?In():Ln(e),rg=e=>e._tag===`None`?eg:$h(e.value),ig=`~effect/SchemaIssue/Issue`;function ag(e){return F(e,ig)&&e[ig]===ig}function og(e){return Object.hasOwn(e,`input`)}var sg=class{[ig]=ig;constructor(e,t){t?.reportInput===!0&&e!==Qh&&(this.input=e)}},cg=class extends sg{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},lg=class extends sg{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},ug=class extends sg{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},dg=class extends sg{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},fg=class extends sg{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},pg=class extends sg{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},mg=class extends sg{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},hg=class extends sg{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}};function gg(e,t,n,r,i){return new pg(e,[new ug([t],n)],r,i)}var _g=class extends sg{_tag=`Forbidden`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},vg=class extends sg{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},yg=class extends sg{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function bg(e,t,n){if(ag(e))return e;if(typeof e==`string`)return new hg({message:e},t,n);let r=typeof e.issue==`string`?new hg({message:e.issue},t,n):e.issue;return new ug(e.path,r)}function xg(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new hg(void 0,t,n):bg(e,t,n)}function Sg(e,t,n,r){return Array.isArray(t)?Qr(t)?t.length===1?bg(t[0],n,r):new pg(e,ni(t,e=>bg(e,n,r)),n,r):void 0:xg(t,n,r)}var Cg=e=>{let t=Pg(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Og(Zh(e.ast),e);case`InvalidValue`:{let t=Dg(e);if(t!==void 0)return Og(t,e);let n=Eg(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Eg(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Eg(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},wg=e=>Pg(e.issue)??Pg(e);function Tg(e){return t=>({issues:kg(t,[],e?.leafHook??Cg,e?.checkHook??wg)})}function Eg(e){return og(e)?Ue(e.input):void 0}function Dg(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function Og(e,t){let n=Eg(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function kg(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];if(e.issue._tag!==`InvalidValue`)return kg(e.issue,t,n,r);let a=Dg(e.issue);return[{path:t,message:a===void 0?Og(Ag(e.filter),e):Og(a,e.issue)}]}case`Encoding`:return kg(e.issue,t,n,r);case`Pointer`:return kg(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>kg(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:Pg(e)??Og(Zh(e.ast),e)}]:e.issues.flatMap(e=>kg(e,t,n,r));default:return[{path:t,message:n(e)}]}}function Ag(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Ag(e)).join(` & `)}}function jg(){return e=>Ng(e,``)}var Mg=jg();function Ng(e,t){let n;switch(e._tag){case`Filter`:{let r=wg(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Ng(e.issue,t);let r=Dg(e.issue);n=r===void 0?Og(Ag(e.filter),e):Og(r,e.issue)}break}case`Encoding`:return Ng(e.issue,t);case`Pointer`:return Ng(e.issue,t+Ke(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Ng(e,t)).join(`
|
|
14
|
+
`);n=Pg(e)??Og(Zh(e.ast),e);break;default:n=Cg(e)}return t?`${n}\n at ${t}`:n}function Pg(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Pg(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function Fg(e){let t;for(let n of e.reasons){if(!Ml(n)||!ag(n.error))return;t??=n.error}return t}function Ig(e,t){let n=Fg(e);if(n===void 0)throw Error(t,{cause:e});return n}var Lg=e=>Object.assign(Object.create(r),e);function Rg(e){return Kg((t,n)=>U(e(t,n)))}function zg(e){return Rg((t,n)=>{let r={message:e(t)};return zn(t)?new _g(r,t.value,n):new _g(r)})}var Bg=zg(()=>`Encoding is not supported`),Vg=Lg({_tag:`Passthrough`});function Hg(){return Vg}function Ug(e){return Lg({_tag:`Transform`,transform:e})}function Wg(e){return Lg({_tag:`TransformEffect`,transform:e})}function Gg(e){return Lg({_tag:`TransformOptional`,transform:e})}function Kg(e){return Lg({_tag:`TransformOptionalEffect`,transform:e})}function qg(){return Gg(()=>In())}function Jg(e){return Kg(t=>{let n=Qn(t,k);return zn(n)?B(n):Jp(e,Ln)})}function Yg(){return Ug(globalThis.String)}function Xg(){return Ug(globalThis.Number)}function Zg(){return Ug(globalThis.BigInt)}function Qg(){return Ug(Kd)}function $g(e){return Wg((t,n)=>Lf({try:()=>JSON.parse(t,e?.reviver),catch:()=>new hg({expected:`a valid JSON string`},t,n)}))}function e_(e){return Wg((t,n)=>Lf({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw TypeError(`Value cannot be represented as JSON`);return n},catch:()=>new hg({expected:`a JSON-serializable value`},t,n)}))}function t_(){return Ug(fm)}function n_(){return Wg((e,t)=>Yp(cne(pm(e)),()=>new hg({expected:`a valid Base64 string`},e,t)))}var r_=class extends i{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new r_(this.encode,this.decode)}},i_=`~effect/SchemaTransformation/Transformation`,a_=class extends i{[i_]=i_;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new a_(this.encode,this.decode)}};function o_(e){return F(e,i_)&&e[i_]===i_}var s_=e=>o_(e)?e:new a_(e.decode,e.encode);function c_(e){return new a_(Wg(e.decode),Wg(e.encode))}function l_(e){return new a_(Ug(e.decode),Ug(e.encode))}function u_(){return new a_(Qg(),Hg())}var d_=new a_(Hg(),Hg());function f_(){return d_}var p_=new a_(Xg(),Yg()),m_=new a_(Zg(),Yg()),h_=e=>N(e)&&typeof e.message==`string`,g_=e=>{let t=Object.hasOwn(e,`cause`)?Error(e.message,{cause:b_(e.cause)}):Error(e.message);return typeof e.name==`string`&&e.name!==`Error`&&(t.name=e.name),typeof e.stack==`string`&&(t.stack=e.stack),t},__=e=>{try{let t=Xe(e);return t===void 0?Ue(e):JSON.parse(t)}catch{return Ue(e)}},v_=(e,t,n)=>{let r={name:e.name,message:typeof e.message==`string`?e.message:``};return t?.includeStack&&typeof e.stack==`string`&&(r.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(r.cause=n(e.cause)),r},y_=e=>{let t=new WeakSet,n=r=>{if(L(r)){if(t.has(r))return`[Circular]`;t.add(r);let i=v_(r,e,n);return t.delete(r),i}return __(r)};return n},b_=e=>h_(e)?g_(e):e,x_=e=>l_({decode:b_,encode:y_(e)}),S_=c_({decode:(e,t)=>URL.canParse(e)?B(new URL(e)):U(new hg({expected:`a valid URL string`},e,t)),encode:e=>B(e.href)}),C_=new a_(n_(),t_());function w_(e){return new a_($g(e??{}),e_(e))}function T_(e){return t=>t._tag===e}var E_=T_(`Declaration`),D_=T_(`Null`),O_=T_(`Void`),k_=T_(`Never`),A_=T_(`Literal`),j_=T_(`UniqueSymbol`),M_=T_(`Arrays`),N_=T_(`Objects`),P_=T_(`Union`),F_=T_(`Suspend`),I_=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},L_={},R_=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}},z_=`~effect/Schema`,B_=class{[z_]=z_;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},V_=class extends B_{_tag=`Declaration`;typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,i,a,o,s){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o,this.encodingRun=s}getParser(){let e;return(t,n)=>t===Qh?eg:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=fy(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new V_(a,r,this.annotations,t,void 0,this.context,n,i)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},H_=new class extends B_{_tag=`Null`;getParser(){return Sy(this,null)}getExpected(){return`null`}},U_=class extends B_{_tag=`Undefined`;getParser(){return Sy(this,void 0)}toCodecJson(){return $v(this,[W_])}getExpected(){return`undefined`}},W_=new I_(H_,new a_(Ug(()=>void 0),Ug(()=>null))),G_=new U_,K_=new class extends B_{_tag=`Void`;getParser(){let e=$h(void 0);return t=>t===Qh?eg:e}toCodecJson(){return $v(this,[W_])}getExpected(){return`void`}},q_=new class extends B_{_tag=`Never`;getParser(){return Cy(this,j)}getExpected(){return`never`}},J_=new class extends B_{_tag=`Unknown`;getParser(){return Cy(this,M)}getExpected(){return`unknown`}},Y_=class extends B_{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${Ue(e)}`);this.literal=e}getParser(){return Sy(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?X_(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:X_(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function X_(e){let t=globalThis.String(e.literal);return $v(e,[new I_(new Y_(t),new a_(Ug(()=>e.literal),Ug(()=>t)))])}var Z_=new class extends B_{_tag=`String`;getParser(){return Cy(this,x)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&ky(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},Q_=class extends B_{_tag=`Number`;getParser(){return Cy(this,S)}matchKey(e,t){return this._match(pre,e,t)}matchPart(e,t){return this._match(Ey,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:ky(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&($_(this.checks,`effect/schema/isFinite`)||$_(this.checks,`effect/schema/isInt`))?this:$v(this,[Jv])}toCodecStringTree(){return this.toCodecJson()===this?$v(this,[hre]):$v(this,[gre])}getExpected(){return`number`}};function $_(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&$_(e.checks,t))}var ev=new Q_,tv=new class extends B_{_tag=`Boolean`;getParser(){return Cy(this,C)}getExpected(){return`boolean`}},nv=new class extends B_{_tag=`BigInt`;getParser(){return Cy(this,w)}matchPart(e,t){if(!Oy.test(e))return;let n=globalThis.BigInt(e);return t.disableChecks||!this.checks?n:ky(this.checks,n,void 0,this,t)?void 0:n}toCodecStringTree(){return $v(this,[vre])}getExpected(){return`bigint`}},rv=class extends B_{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(gy(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(gy(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}let c=e=>{let{input:t,len:r,options:i}=e;if(n.rest.length===0&&r>a)for(let o=a;o<r;o++){let r=new fg(n,t[o],i),a=new ug([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return U(new pg(n,[a],t,i))}return e.issues?U(new pg(n,e.issues,t,i)):$h(e.output)},l=(e,t)=>{let r=e.length,i={ast:n,getParser:s,input:e,len:r,tailThreshold:Math.max(a,r-o),output:new globalThis.Array(r),issues:void 0,options:t},u=n.rest.length===0?a:Math.max(r,a+o),d=t.concurrency===void 0?1:Ic(t.concurrency),f=d===1?ov(i,e,0,u):sv(i,e,{concurrency:d,end:u});if(!f)return c(i);if(Go(f))return Zp(f,()=>c(i));let p=!0;return kf(()=>p?(p=!1,Bf(f,()=>c(i))):l(e,t))};return(e,a)=>{if(e===Qh)return eg;try{return Array.isArray(e)?(r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)}))),l(e,a)):U(new mg(n,e,a))}catch(e){return If(e)}}}_rebuild(e,t,n){let r=fy(this.elements,e),i=fy(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new rv(this.isMutable,r,i,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}};function iv(e,t,n,r){if(n._tag===`Failure`)return cv(e,e.ast,r,n);let i=n===tg?t:n[pt];if(i!==Qh)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(gy(t.ast))return;let n=new ug([r],new dg(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return iu(new pg(e.ast,[n],e.input,e.options))}}var av={onItem(e,t,n){let r=n<e.len?t:Qh;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:iv},ov=Lc()(av),sv=zc()(av),cv=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Fg(r.cause);if(i===void 0)return ru(Bl(r.cause,r=>new pg(t,[new ug([n],r)],e.input,e.options)));let a=new ug([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return iu(new pg(t,[a],e.input,e.options))},lv=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function uv(e,t,n=L_){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(r=>Object.prototype.propertyIsEnumerable.call(e,r)&&t.matchKey(r,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(wy(yy(t)))}var dv=class{name;type;constructor(e,t){this.name=e,this.type=t}};function fv(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(fv);default:return!1}}function pv(e){let t=ty(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(pv);default:return!1}}function mv(e){return fv(e)&&pv(e)}var hv=class{parameter;type;constructor(e,t){if(!mv(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,gy(t)&&!xy(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},gv=class extends B_{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o}getParser(e,t=e){let n=this,r=n.propertySignatures.length,i=n.indexSignatures.length;if(!r&&!i)return Cy(n,A);let a,o,s=()=>(a||(a=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),o=i?n.indexSignatures.map(n=>({is:n,parserKey:e(wy(n.parameter)),parserValue:t(n.type)})):void 0),a),c=()=>{let e=new Set(n.propertySignatures.map(e=>typeof e.name==`number`?globalThis.String(e.name):e.name)),t=(t,i,a,o,s)=>{if(s._tag===`Failure`)return cv(t,n,i,s)??su;let c=s===tg?o:s[pt];if(a!==Qh&&c!==Qh){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return su;st(t.out,a,c)}return su},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!Go(t))return Bf(Gf(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return cv(e,n,r,a)??su;let o=a===tg?r:a[pt],s=e.input[r],l=i.parserValue(s,e.options);return Go(l)?t(e,r,o,s,l):Bf(Gf(l),n=>t(e,r,o,s,n))},l=(e,n,r)=>{let i=e.input[n],a=r.parserValue(i,e.options);return Go(a)?t(e,n,n,i,a):Bf(Gf(a),r=>t(e,n,n,i,r))},u=i?zc()({onItem:(e,[t,n])=>n.is.parameter===Z_?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return kne(function*(t,d){if(t===Qh)return Qh;if(typeof t!=`object`||!t||Array.isArray(t))return yield*U(new mg(n,t,d));s();let f=t,p={},m={ast:n,input:f,out:p,issues:void 0,options:d},h=d.errors===`all`,g=d.onExcessProperty===`error`,_=d.concurrency===void 0?1:Ic(d.concurrency),v=i&&g?n.indexSignatures.map(e=>uv(f,e.parameter,d)):void 0;if(g){let r=v?new Set(e):e;if(v)for(let e of v)for(let t of e)r.add(t);let i=Reflect.ownKeys(f);for(let e=0;e<i.length;e++){let a=i[e];if(!r.has(a)&&Object.prototype.propertyIsEnumerable.call(f,a)){let e=new fg(n,f[a],d),r=new ug([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*U(new pg(n,[r],t,d))}}}if(r){let e=_===1?yv(m,a):bv(m,a,{concurrency:_});e&&(yield*e)}if(i&&_===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===Z_?l:c,r=v?.[e]??(t.is.parameter===Z_?Object.keys(f):uv(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!Go(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=ei();for(let t=0;t<i;t++){let n=o[t],r=v?.[t]??(n.is.parameter===Z_?Object.keys(f):uv(f,n.is.parameter,d));for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=u(m,e,{concurrency:_});t&&(yield*t)}return m.issues?yield*U(new pg(n,m.issues,t,d)):p})};if(i)return c();let l,u=(e,t,n)=>{let r=a[t];return Bf(Gf(n),n=>{let i=_v(e,r,n);if(i)return i;let o=()=>$h(e.out),s=yv(e,a.slice(t+1));return s?Zp(s,o):o()})};return(e,t)=>{if(e===Qh)return eg;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&Ic(t.concurrency)!==1)return(l??=c())(e,t);if(typeof e!=`object`||!e||Array.isArray(e))return U(new mg(n,e,t));let r=s(),i=e,a={},o={ast:n,input:i,out:a,issues:void 0,options:t};try{for(let e=0;e<r.length;e++){let n=r[e],s=n.name,c=Mv(i,s),l=c?i[s]:Qh,d=n.parser(l,t);if(!Go(d))return u(o,e,d);if(d===tg){c&&st(a,s,l);continue}let f=_v(o,n,d);if(f)return f}}catch(e){return If(e)}return $h(a)}}_rebuild(e,t,n,r){let i=fy(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new dv(t.name,n)}),a=fy(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new hv(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new gv(i,a,this.annotations,n,void 0,this.context,r)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};function _v(e,t,n){if(n._tag===`Failure`)return cv(e,e.ast,t.name,n);if(n===tg)return;let r=n[pt];if(r!==Qh){st(e.out,t.name,r);return}if(delete e.out[t.name],!gy(t.type)){let n=new ug([t.name],new dg(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return iu(new pg(e.ast,[n],e.input,e.options))}}var vv={onItem(e,t){if(!Mv(e.input,t.name))return t.parser(Qh,e.options);let n=e.input[t.name];return st(e.out,t.name,n),t.parser(n,e.options)},step:_v},yv=Lc()(vv),bv=zc()(vv);function xv(e,t){return e?t?[...e,...t]:e:t}function Sv(e,t,n){return new gv(Reflect.ownKeys(e).map(t=>new dv(t,e[t].ast)),[],n,t)}function Cv(e){return e.ast}function wv(e,t=void 0){return new rv(!1,e.map(e=>e.ast),[],void 0,t)}function Tv(e,t,n){return new Pv(e.map(Cv),t,void 0,n)}var Ev=h(e=>{for(;;){if(F_(e))return J_;let t=e.encoding;if(!t)return e.recur?.(Ev,o)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==o))return J_;e=t[t.length-1].to}});function Dv(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(Dv)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Ov(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[Yh];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!gy(t)){if(A_(t))return[{key:e.name,literal:t.literal}];if(j_(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!gy(e)){if(A_(e))return[{key:t,literal:e.literal}];if(j_(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>Ov(Ev(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return Ov(e.thunk())}}var kv=new WeakMap,Av=Object.freeze([]),jv=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Mv=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Nv(e){let t=kv.get(e);if(t)return t;let n,r=0,i,a,o=!0,s=[];for(let t=0;t<e.length;t++){let c=e[t],l=Ev(c);if(k_(l))continue;if(A_(l)||j_(l)){a??=new Map;let e=A_(l)?l.literal:l.symbol;s[t]=e;let n=a.get(e);n||a.set(e,n=[]),n.push(t)}else o=!1;let u=Ov(l);if(u.length){n??=new Map,r++;for(let{key:e,literal:r}of u){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=Dv(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??Av);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??Av;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=new Map;for(let[e,t]of i)a.set(e,Object.freeze(Array.from(t)));let o=Object.freeze(e.map((e,t)=>t));t=(e,t)=>{if(P(e)){let n=Mv(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??Av;if(t)return o}return Av}}else if(n){let e;for(let t of n)(!e||t[1][0].size>e[1][0].size)&&t[1][1].size===r&&(e=t);t=(t,r)=>{let a=jv(t);if(!P(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=Mv(t,n),u=c?t[n]:void 0;if(c&&(!r||u!==void 0)){let e=i.get(u);if(!e)return l(a);for(let t of e)o.add(t);s=n}}if(s===void 0)for(let[e,[i,a]]of n){let n=Mv(t,e),s=n?t[e]:void 0;if(n&&(!r||s!==void 0)){let e=i.get(s);if(e)for(let t of e)o.add(t)}else if(r)for(let e of a)o.add(e)}for(let[e,[i,a]]of n){if(e===s)continue;let n=Mv(t,e),c=n?t[e]:void 0;if(n&&(!r||c!==void 0)){let e=i.get(c);for(let t of o)a.has(t)&&!e?.has(t)&&o.delete(t)}}return Array.from(o).sort((e,t)=>e-t)}}else t=e=>{let t=l(jv(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return kv.set(e,t),t}var Pv=class extends B_{_tag=`Union`;types;options;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.options=t,this.encodingChecks=o}getParser(e,t){let n=this,r=t!==void 0,i=[],a=t=>i[t]??=e(n.types[t]),o;return(e,t)=>{if(e===Qh)return eg;let i=(o??=Nv(n.types))(e,r);if(i.length===0)return U(new vg(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:Go(r)?Fv(n,r.cause,e,t):Iv(n,r,e,t)}return Lv(n,a,i,e,t)}}_rebuild(e,t,n){let r=fy(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Pv(r,this.options,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=yy(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(A_);if(t.length>0)return`${Vv(n.isMutable)}[ ${t.map(t=>e(t)+Hv(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>A_(e.type));if(t.length>0)return`{ ${t.map(t=>`${Vv(t.type.context?.isMutable)}${Ge(t.name)}${Hv(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function Fv(e,t,n,r){let i=Fg(t);return i?iu(new vg(e,[i],n,r)):ru(t)}function Iv(e,t,n,r){return Qf(t,t=>Fv(e,t,n,r))}function Lv(e,t,n,r,i){let a={ast:e,parser:t,input:r,out:void 0,successes:e.options?.mode===`oneOf`?[]:void 0,issues:void 0,options:i},o=zv(a,n);return o?Rv(o,a):a.out?a.out:U(new vg(e,a.issues??[],r,i))}function Rv(e,t){return Zp(e,e=>t.out===tg?B(t.input):t.out?t.out:U(new vg(t.ast,t.issues??[],t.input,t.options)))}var zv=Lc()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Fg(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),iu(new yg(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return su}}}),Bv=new Pv([new Y_(`Infinity`),new Y_(`-Infinity`),new Y_(`NaN`)]);function Vv(e){return e?``:`readonly `}function Hv(e){return e?`?`:``}var Uv=class extends i{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new Uv(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Uv(this.run,this.annotations,!0)}and(e,t){return new Wv([this,e],t)}},Wv=class extends i{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Wv(this.checks,{...this.annotations,...e})}and(e,t){return new Wv([this,e],t)}};function Gv(e,t,n=!1){return new Uv((t,n,r)=>Sg(n,e(t,n,r),t,r),t,n)}function Kv(e){return Gv(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitraryConstraint:{number:`finite`},...e})}var qv=iy(ev,[Kv()]),Jv=new I_(new Pv([qv,Bv]),new a_(Xg(),Ug(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Yv(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Gv(e=>(n.lastIndex=0,n.test(e)),{expected:`a string matching the RegExp ${r.source}`,representation:{id:`effect/schema/isPattern`,payload:r},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[r]},...t})}var Xv=new WeakMap;function Zv(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&Xv.set(n,Qv(e)),n}function Qv(e){let t=Xv.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return Xv.set(e,n),n}function $v(e,t){return e.encoding===t?e:Zv(e,{encoding:t})}function ey(e,t){if(e.context===t)return e;let n=Qv(e);return n.context===t&&n.encoding===e.encoding?n:Zv(e,{context:t})}function ty(e){return e.encoding?ty(e.encoding[e.encoding.length-1].to):e}function ny(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return ry(e,Yr(e.checks.slice(0,-1),n.annotate(t)))}return Zv(e,{annotations:{...e.annotations,...t}})}function ry(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Zv(e,{checks:t})}function iy(e,t){return ry(e,xv(e.checks,t))}function ay(e,t){let n=t(e.to);return n===e.to?e:new I_(n,e.transformation)}function oy(e,t){let n=e,r=n[n.length-1],i=ay(r,t);return i===r?e:Yr(e.slice(0,e.length-1),i)}function sy(e){return t=>t.encoding?$v(t,oy(t.encoding,e)):t}function cy(e,t){return sy(e=>ey(e,t))(e)}function ly(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:$v(r,oy(r.encoding,n))}return e(r)}return h(n)}function uy(e,t){return dy(e,t,vy(e))}function dy(e,t,n){let r=new I_(e,t);return $v(n,n.encoding?[...n.encoding,r]:[r])}function fy(e,t){let n;for(let r=0;r<e.length;r++){let i=e[r],a=t(i);if(n)n[r]=a;else if(a!==i){n=Array(e.length);for(let t=0;t<r;t++)n[t]=e[t];n[r]=a}}return n??e}function py(e,t){return ey(e,e.context?new R_(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new R_(!1,!1,void 0,t))}var my=h(e=>rre(ey(e,e.context?e.context.isOptional===!1?new R_(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new R_(!0,!1)))),rre=sy(my),ire=m(e=>my(new Pv([e,G_]))),hy=h(e=>are(ey(e,e.context?e.context.isMutable===!1?new R_(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new R_(!1,!0)))),are=sy(hy);function ore(e,t){return ey(e,e.context?new R_(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new R_(!1,!1,t))}function sre(e,t,n){return dy(e,n,t)}function cre(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:E(e.literal)&&!t.includes(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.includes(e.symbol)||t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function lre(e,t){let{literals:n,parameters:r}=cre(e);return new gv(n.map(e=>new dv(e,t)),r.map(e=>new hv(e,t)))}function gy(e){return e.context?.isOptional??!1}function _y(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(_y)}function ure(e){function t(e){return _y(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return Zr(n)?n:void 0}function dre(e){let t=!0;function n(e){return t=t&&!e.encoding&&!F_(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var vy=h(e=>{let t=Qv(e);if(t!==e){let n=vy(t);return n===t&&e.encoding===void 0?e:ey(n,e.context)}let n=`recur`in e?e.recur(vy):e;if(`encodingChecks`in n&&n.encodingChecks){let t=dre(e)?n.encodingChecks:M_(n)||N_(n)||E_(n)&&n.typeParameters.length>0?ure(n.encodingChecks):void 0;return Zv(n,{encodingChecks:void 0,checks:xv(n.checks,t)})}return n}),yy=h(e=>vy(by(e)));function fre(e,t){let n=t,r=n.length,i=n[r-1],a=[new I_(by($v(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new I_(by(n[e-1].to),n[e].transformation.flip()));let o=by(i.to);return o.encoding?$v(o,[...o.encoding,...a]):$v(o,a)}var by=m(e=>{if(e.encoding)return fre(e,e.encoding);let t=Qv(e);if(t!==e){let n=by(t);return n===t?e:ey(n,e.context)}return`flip`in e?e.flip(by):`recur`in e?e.recur(by):e});function xy(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(xy);default:return!1}}function Sy(e,t){let n=t===0?tg:$h(t);return(r,i)=>r===Qh?eg:r===t?n:U(new mg(e,r,i))}function Cy(e,t){return(n,r)=>n===Qh?eg:t(n)?tg:U(new mg(e,n,r))}var wy=ly(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(wy)}}),Ty=ly(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(Ty)}}),Ey=new globalThis.RegExp(`^${lv}$`),pre=new globalThis.RegExp(`^(?:${lv}|Infinity|-Infinity|NaN)$`);function mre(e){return Yv(Ey,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:Ey.source}),...e})}var Dy=iy(Z_,[mre()]),hre=new I_(Dy,p_),gre=new I_(new Pv([Dy,Bv]),p_),Oy=new globalThis.RegExp(`^-?\\d+$`);function _re(e){return Yv(Oy,{expected:`a string representing a bigint`,representation:{id:`effect/schema/isStringBigInt`,payload:null},toJsonSchema:()=>({pattern:Oy.source}),...e})}var vre=new I_(iy(Z_,[_re({expected:`a string representing a bigint`})]),m_);function ky(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=ky(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new cg(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function yre(e){if(!E_(e))return;let t=e.annotations?.[Xh];return D(t)?t(e.typeParameters):void 0}var Ay=qh;function bre(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function xre(e){return e===void 0||typeof e==`string`}function jy(e,t){let n=new WeakMap,r=[];outer:for(;;){if(typeof e!=`object`||!e){if(!t(e))return!1}else{let t=e,i=n.get(t);if(i===!1)return!1;if(i===void 0){let e=Array.isArray(t);if(!e){let e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null)return!1}n.set(t,!1),r.push({value:t,keys:e?t.length:Object.keys(t),index:0})}}for(;r.length>0;){let t=r[r.length-1],i=t.keys;if(typeof i==`number`){if(t.index<i){e=t.value[t.index++];continue outer}}else if(t.index<i.length){e=t.value[i[t.index++]];continue outer}n.set(t.value,!0),r.pop()}return!0}}function Sre(e){return jy(e,bre)}var My=new V_([],()=>(e,t,n)=>Sre(e)?tg:U(new mg(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>Py}),Cre=ny(My,{representation:{id:`effect/schema/MutableJson`,payload:null}}),Ny=new I_(My,f_()),wre=new I_(new Pv([new rv(!1,[],[My]),new gv([],[new hv(Z_,My)])]),f_());function Tre(e){return jy(e,xre)}var Py=new I_(new V_([],()=>(e,t,n)=>Tre(e)?tg:U(new mg(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),f_()),Fy=(e,t,n)=>e===tg?n(t):Zp(e,n);function Iy(e){if(e._tag===`Middleware`)return(t,n,r)=>Ly(t===tg?e.decode($h(ng(n)),r):e.decode(Jp(t,ng),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===tg?$h(t):e;case`Transform`:{let e=e=>e===Qh?eg:$h(t.transform(e));return(t,n)=>Fy(t,n,e)}case`TransformOptional`:{let e=e=>rg(t.transform(ng(e)));return(t,n)=>Fy(t,n,e)}case`TransformEffect`:return(e,n,r)=>Fy(e,n,e=>e===Qh?eg:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>Fy(e,n,e=>Ly(t.transform(ng(e),r)))}}var Ly=e=>Zp(e,rg),Ry=(e,t,n,r)=>Qf(r,r=>Ff(()=>Bl(r,r=>new lg(e,r,t,n))));function Ere(e,t){let n=Iy(e.link.transformation),r;return(i,a)=>{if(i===Qh)return eg;if(e.isConstructed(i))return tg;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function Dre(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==Qh&&r!==void 0)return t(r,i);let a=n;if(Go(a)&&a._tag===`Success`){let e=t(a[pt],i);return e===tg?a:e}return Zp(Ry(e,r,i,a),e=>{let n=t(e,i);return n===tg?$h(e):n})}}function Ore(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:Dre(e,n)}function zy(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?yre(e):void 0,o=a?Ere(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>Iy(e.transformation)),u=e.encodingChecks;if(!c&&!s&&!u)return o;let d,f=(t,n)=>{let r=o(t,n);if(u&&!n.disableChecks){if(Go(r)){if(r._tag===`Success`){let i=r===tg?t:r[pt];if(t!==Qh&&i!==Qh){let i=ky(u,t,void 0,e,n);i&&(r=U(new pg(e,i,t,n)))}}}else r=Bf(r,r=>{if(t!==Qh&&r!==Qh){let r=ky(u,t,void 0,e,n);if(r)return U(new pg(e,r,t,n))}return B(r)})}if(s&&!n.disableChecks){if(Go(r)){if(r._tag===`Success`){let i=r===tg?t:r[pt];if(i===Qh)return r;let a=ky(s,i,void 0,e,n);a&&(r=U(new pg(e,a,i,n)))}}else r=Bf(r,t=>{if(t!==Qh){let r=ky(s,t,void 0,e,n);if(r)return U(new pg(e,r,t,n))}return B(t)})}return r},p=i===void 0?f:i(f);return c?(n,r)=>{let i=d??=c.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=c.length-1;e>=0;e--)if(o=l[e](o,a,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[pt],o=t(a,r)):o=Zp(o,e=>{let n=t(e,r);return n===tg?$h(e):n})}if(o._tag===`Success`){let e=o[pt],t=p(e,r);return t===tg?o:t}return o=Ry(e,n,r,o),Zp(o,e=>{let t=p(e,r);return t===tg?$h(e):t})}:p}var kre=Symbol(),By=new WeakMap,Are=e=>Hy(e).parser,Vy=e=>Hy(e).makeEffect,jre=e=>Ore(e,Vy),Mre=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=zy(this.ast,Are)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=zy(this.ast,Vy,jre)}};function Hy(e){let t=By.get(e);if(t!==void 0)return t;let n=new Mre(e);return By.set(e,n),n}function Uy(e){let t=e.ast,n;return(e,r)=>(n??=Xy(Kre,vy(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Wy(e){let t=Uy(e);return(e,n)=>{let r=Up(t(e,n));return cu(r)?Ln(r.value):(Ig(r.cause,`Option adapter can only return none for schema issues`),In())}}function Gy(e){return Wre(vy(e.ast))}function Nre(e){return Fre(e.ast)}function Pre(e){{let t=Zy(Yy(e));return e=>{let n=t(e,L_);return cu(n)?!0:(Ig(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}}function Fre(e){let t=vy(e),n=e=>(n=Pre(t),n(e));return e=>n(e)}function Ire(e){let t=Yy(e);return(e,n)=>{let r=Up(t(e,n));if(!cu(r))return Ig(r.cause,`Issue adapter can only return schema issues`)}}function Ky(e,t){let n=Yy(e.ast);return t===void 0?n:(e,r)=>n(e,qy(t,r))}function Lre(e,t){return Vre(Ky(e,t))}function Rre(e,t){return Hre(Ky(e,t))}function zre(e,t){let n=Yy(by(e.ast));return t===void 0?n:(e,r)=>n(e,qy(t,r))}var qy=(e,t)=>t?{...e,...t}:e,Jy=e=>e===Qh?U(new hg):B(e);function Yy(e){return Xy(Gre,e)}function Bre(e,t){return e===tg?B(t):Go(e)?e[pt]===Qh?Jy(Qh):e:Zp(e,Jy)}function Xy(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??L_);return a===tg?B(r):Go(a)?a[pt]===Qh?Jy(Qh):a:Zp(a,Jy)}}function Zy(e){return(t,n)=>Up(e(t,n))}function Vre(e){let t=Zy(e);return(e,n)=>{let r=t(e,n);return cu(r)?Ln(r.value):(Ig(r.cause,`Option adapter can only return none for schema issues`),In())}}function Hre(e){let t=Zy(e);return(e,n)=>{let r=t(e,n);return cu(r)?kr(r.value):Ar(Ig(r.cause,`Result adapter can only return schema issues`))}}function Ure(e,t){let n=Up(e);if(cu(n))return n.value;let r=Ig(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}function Wre(e){let t,n;return(r,i)=>{t??=Hy(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??L_,o=t.make;if(o!==void 0&&r!==Qh){let e;try{e=o(r,a)}catch(e){throw Ig(Fl(e),`Constructor adapter can only throw schema issues`),e}if(e!==kre&&e!==Qh)return e}return Ure(Bre((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var Gre=e=>Hy(e).parser,Kre=e=>Hy(e).makeEffect,Qy=`~effect/Schema/Schema`,$y=Symbol(),qre={[Qy]:Qy,get make(){let e=Gy(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Uy(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=Wy(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return n(this,arguments)},annotate(e){return this.rebuild(ny(this.ast,e))},annotateKey(e){return this.rebuild(py(this.ast,e))},check(...e){return this.rebuild(iy(this.ast,e))},rebuild(e){return eb(e,this[$y])}};function eb(e,t){function n(){}let r=Object.setPrototypeOf(n,qre);return t&&(Object.hasOwn(t,`name`)||Object.hasOwn(t,`length`)||Object.hasOwn(t,`__proto__`))?Object.defineProperties(r,Object.getOwnPropertyDescriptors({...t})):Object.assign(r,t),r[$y]=t,r.ast=e,r}function Jre(e){return eb(tb(e.ast),{schema:e})}var tb=ly(e=>{let t=Xre(e,tb),n=e.context;return t===e||n===void 0?t:cy(t,nb(n))});function nb(e){return e.constructorDefault===void 0?e:new R_(e.isOptional,e.isMutable,void 0,e.annotations)}function rb(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function ib(e){return t=>{let n=[...t].sort((t,n)=>e(yy(t))-e(yy(n)));return n.some((e,n)=>e!==t[n])?n:t}}var Yre=ib(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function Xre(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!D(n))return $v(e,[Ny]);let r=n(e.typeParameters.map(e=>eb(yy(e))));return r===void 0?e:$v(e,[ay(r,t)])}case`Unknown`:return $v(e,[Ny]);case`ObjectKeyword`:return $v(e,[wre]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return rb(e),e.recur(t,Ty);case`Union`:{let n=Yre(e.types);return n===e.types?e.recur(t):new Pv(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}function Zre(e){return eb(ab(e.ast),{schema:e})}var Qre=ib(e=>{switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function $re(e,t,n){switch(e._tag){case`Declaration`:{let r=e.typeParameters.map(e=>eb(t(yy(e)))),i=e.annotations?.toCodecStringTree;if(D(i)){let n=i(r);return n===void 0?e:$v(e,[ay(n,t)])}let a=e.annotations?.toCodecJson,o=D(a)?a(r):void 0,s=o===void 0?e.annotations?.toCodec:void 0,c=o??(D(s)?s(r):void 0);return c===void 0?n(e):$v(e,[ay(c,t)])}case`Null`:return $v(e,[eie]);case`Boolean`:return $v(e,[tie]);case`Unknown`:case`ObjectKeyword`:return $v(e,[Py]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return rb(e),e.recur(t,Ty);case`Union`:{let n=Qre(e.types);return n===e.types?e.recur(t):new Pv(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}var eie=new I_(new Y_(`null`),new a_(Ug(()=>null),Ug(()=>`null`))),tie=new I_(new Pv([new Y_(`true`),new Y_(`false`)]),new a_(Ug(e=>e===`true`),Yg())),nie=new a_(Ug(e=>typeof e==`string`?[e]:e),Hg()),ab=ly(e=>{let t=$re(e,ab,e=>{throw new globalThis.Error(`Missing structural codec for StringTree`,{cause:e})});return t!==e&&e.context!==void 0?cy(t,nb(e.context)):t},{stopAt:e=>e.transformation===nie});function ob(e){return cu(e)?e.value:{issues:[{message:ql(e.cause)}]}}function rie(e,t){let n=Ky(e),r={errors:`all`,...t?.parseOptions},i=Tg(t),a=e=>{let t=new Xi(`sync`),a=Ip(cp(n(e,r),{onFailure:i,onSuccess:e=>({value:e})}),{scheduler:t});a.currentDispatcher?.flush();let o=a.pollUnsafe();return o?ob(o):new Promise(e=>{a.addObserver(t=>{e(ob(t))})})};if(`~standard`in e){let t=e;return`validate`in t[`~standard`]||Object.assign(t[`~standard`],{validate:a}),t}return Object.assign(e,{"~standard":{version:1,vendor:`effect`,validate:a}})}var iie=a(2,(e,t)=>cb(e,(e,n)=>oie(t,e)?void 0:[e,n])),sb=e=>e,aie=a(2,(e,t)=>cb(e,(e,n)=>[e,t(n)]));function oie(e,t){return e.some(e=>e===t||typeof e==`number`&&String(e)===t)}function cb(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let i=t(r,e[r]);if(i){let[e,t]=i;st(n,e,t)}}return n}var lb=`~effect/Schema/SchemaError`;function sie(e){return F(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}var ub=Qy;function db(){return(e,t,n)=>Tb(new V_(e.map(Cv),e=>t(e.map(e=>Tb(e))),n))}function fb(e,t){return db()([],()=>(t,n,r)=>e(t)?B(t):U(new mg(n,t,r)),t)}var pb=class extends ra(`SchemaError`){[lb]=lb;constructor(e){let t=rt();it(0);try{super({issue:e})}finally{it(t)}}get message(){return Mg(this.issue)}toString(){return`SchemaError(${this.message})`}};function mb(e){return sie(e)}function hb(e){return Go(e)?cie(e):Qf(e,e=>Ff(()=>Bl(e,e=>new pb(e))))}function cie(e){return cu(e)?e:ru(Bl(e.cause,e=>new pb(e)))}function lie(e,t){let n;for(let r of e.reasons){if(!Ml(r)||!mb(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function gb(e){let t=Up(e);if(cu(t))return t.value;throw lie(t.cause,`Sync adapter can only throw schema errors`)}function _b(e,t){return rie(e,t)}var uie=Nre;function vb(e,t){let n=Ky(e,t);return(e,t)=>hb(n(e,t))}var yb=vb,die=Lre;function bb(e,t){let n=Rre(e,t);return(e,t)=>Pr(n(e,t),e=>new pb(e))}function xb(e,t){let n=vb(e,t);return(e,t)=>gb(n(e,t))}var fie=xb;function Sb(e,t){let n=zre(e,t);return(e,t)=>hb(n(e,t))}var Cb=Sb;function pie(e,t){let n=Sb(e,t);return(e,t)=>gb(n(e,t))}var wb=pie,Tb=eb;function Eb(e){return F(e,ub)&&e[ub]===ub}var Db=sb(e=>Tb(my(e.ast),{schema:e})),W=sb(e=>{let t=Kb(e);return Tb(ire(e.ast),{schema:t})}),Ob=sb(e=>Tb(hy(e.ast),{schema:e})),kb=sb(e=>Tb(vy(e.ast),{schema:e})),Ab=sb(e=>Tb(yy(e.ast),{schema:e}));function G(e){let t=Tb(new Y_(e),{literal:e,transform(n){return t.pipe(qb(G(n),{decode:Ug(()=>n),encode:Ug(()=>e)}))}});return t}var jb=Tb(q_),Mb=Tb(J_),mie=Tb(H_),Nb=Tb(G_),K=Tb(Z_),Pb=Tb(ev),Fb=Tb(tv),hie=Tb(nv),Ib=Tb(K_);function Lb(e,t){return Tb(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Lb(Sv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function q(e){return Lb(Sv(e,void 0),e)}function Rb(e,t){return Tb(lre(e.ast,t.ast),{key:e,value:t})}function zb(e,t){return Tb(e,{elements:t,mapElements(e,t){let n=e(this.elements);return zb(wv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Bb(e){return zb(wv(e),e)}var J=sb(e=>Tb(new rv(!1,[],[e.ast]),{value:e})),Vb=sb(e=>Tb(new rv(!1,[e.ast],[e.ast]),{value:e}));function Hb(e,t){return Tb(e,{members:t,mapMembers(e,t){let n=e(this.members);return Hb(Tv(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Ub(e,t){return Hb(Tv(e,t,void 0),e)}function Wb(e){let t=e.map(G);return Tb(Tv(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return Ub(e(this.members))},pick(e){return Wb(e)},transform(e){return Ub(t.map((t,n)=>t.transform(e[n])))}})}var Gb=sb(e=>Ub([e,mie])),Kb=sb(e=>Ub([e,Nb]));function gie(e){return t=>Tb(t.ast,{schema:t,identifier:e})}function _ie(e){return t=>Tb(uy(t.ast,new r_(e,o)),{schema:t})}function vie(e){return yie(e)}function yie(e){return t=>_ie(One(e))(t)}function qb(e,t){return n=>Tb(sre(n.ast,e.ast,t?s_(t):f_()),{from:n,to:e})}function bie(){return(e,t)=>ex()(e,{decode:t,encode:Bg})}function Jb(e){return t=>qb(kb(t),e)(t)}function Yb(e){return t=>Tb(ore(t.ast,e),{schema:t})}function Xb(e){return Qf(e,e=>Ff(()=>Bl(e,e=>e.issue)))}function Zb(e,t){let n=t?.encodingStrategy===`omit`?qg():Hg();return t=>Db(Ab(t)).pipe(qb(t,{decode:Jg(Xb(e)),encode:n}))}function xie(e,t){let n=t?.encodingStrategy===`omit`?qg():Hg();return t=>W(Ab(t)).pipe(qb(t,{decode:Jg(Xb(e)),encode:n}))}function Qb(e){return G(e).pipe(Yb(B(e)))}function Sie(e,t){return q({_tag:Qb(e),...t})}function $b(e,t){return fb(t=>t instanceof e,t)}function ex(){return(e,t)=>new I_(e.ast,s_(t))}var tx=Gv;function nx(e,t){let n=e.source,r=e.flags,i=/^[dg]*uy?$/.test(r),a=r===``?`new RegExp(${Ue(n)})`:`new RegExp(${Ue(n)}, ${Ue(r)})`;return Yv(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}var Cie=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function rx(e,t){let n=Cie(e);return nx(n,{expected:e?`a UUID v${e}`:`a UUID`,representation:{id:`effect/schema/isUUID`,payload:{version:e??null}},toJsonSchema:()=>({pattern:n.source,format:`uuid`}),toCode:()=>({runtime:e===void 0?`Schema.isUUID()`:`Schema.isUUID(${e})`}),...t})}var ix=Tb(qv);function wie(e){let t=Mn(e.order),n=e.formatter??Ue;return(r,i)=>tx(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function Tie(e){let t=Pn(e.order),n=e.formatter??Ue;return(r,i)=>tx(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r},...e.annotate?.(r),...i})}function Eie(e){let t=Nn(e.order),n=e.formatter??Ue;return(r,i)=>tx(e=>t(e,r),{expected:`a value less than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,maximum:r},...e.annotate?.(r),...i})}function Die(e){let t=Pn(e.order),n=Mn(e.order),r=Nn(e.order),i=jn(e.order),a=e.formatter??Ue;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return tx(e=>c(e,o.minimum)&&l(e,o.maximum),{expected:`a value between ${a(o.minimum)}${o.exclusiveMinimum?` (excluded)`:``} and ${a(o.maximum)}${o.exclusiveMaximum?` (excluded)`:``}`,arbitraryConstraint:{order:e.order,minimum:o.minimum,maximum:o.maximum,...o.exclusiveMinimum&&{exclusiveMinimum:!0},...o.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(o),...s})}}function ax(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Ue(e)}`);return e}var ox=wie({order:An,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:ax(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Ue(e)})`})})}),sx=Tie({order:An,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:ax(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Ue(e)})`})})}),cx=Eie({order:An,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:ax(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Ue(e)})`})})}),lx=Die({order:An,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:ax(e.minimum),maximum:ax(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Ue(e.minimum)}, maximum: ${Ue(e.maximum)}, exclusiveMinimum: ${Ue(t)}, exclusiveMaximum: ${Ue(n)} })`})}}});function ux(e){return tx(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>[{type:`integer`},!0],toCode:()=>({runtime:`Schema.isInt()`}),arbitraryConstraint:{number:`integer`},...e})}var dx=Pb.check(ux());function fx(e,t){return e=hx(e),px(e,Math.ceil(e/2),t)}function px(e,t,n){return tx(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:n})=>n===`string`?e<=1?{minLength:t}:[{minLength:t},!0]:n===`array`?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Jh]:!0,arbitraryConstraint:{minLength:e},...n})}function Oie(e){return px(1,1,e)}function mx(e,t){return e=hx(e),tx(t=>t.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:`effect/schema/isMaxLength`,payload:{maxLength:e}},toJsonSchema:({type:t})=>t===`string`?e===0?{maxLength:e}:[{maxLength:e},!0]:t===`array`?{maxItems:e}:t===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Jh]:!0,arbitraryConstraint:{maxLength:e},...t})}function hx(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function kie(e,t){return e=hx(e),tx(t=>Reflect.ownKeys(t).length>=e,{expected:`a value with at least ${e===1?`1 entry`:`${e} entries`}`,representation:{id:`effect/schema/isMinProperties`,payload:{minProperties:e}},toJsonSchema:({type:t})=>t===`object`?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Jh]:!0,arbitraryConstraint:{minProperties:e},...t})}function Aie(e,t){let n=Ab(e),r=Ire(n.ast);return tx((e,t,n)=>{let i=Reflect.ownKeys(e),a=[];for(let e of i){let t=r(e,n);if(t!==void 0&&(a.push(new ug([e],t)),n.errors===`first`))break}return!Zr(a)||new pg(t,a,e,n)},{expected:`an object with property names matching the schema`,representation:{id:`effect/schema/isPropertyNames`,payload:null,schemas:[n.ast]},toJsonSchema:({schemas:e,type:t})=>t===`object`?{propertyNames:e[0]}:[{propertyNames:e[0]},!0],toCode:({schemas:e})=>({runtime:`Schema.isPropertyNames(${e[0].runtime})`}),[Jh]:!0,...t})}var gx=K.check(Oie()),jie=e=>+(e?.includeStack===!0)|(e?.excludeCause===!0?2:0),Mie=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},_x=[];function vx(e){let t=jie(e),n=_x[t];if(n!==void 0)return n;let r=Wie.pipe(qb(Mb,x_(Mie(t))));return _x[t]=r,r}globalThis.RegExp;var yx=K.annotate({expected:`a string that will be decoded as a URL`}),Nie=$b(globalThis.URL,{representation:{id:`effect/schema/URL`,payload:null},toCode:()=>({runtime:`Schema.URL`,Type:`globalThis.URL`}),expected:`URL`,toCodecJson:()=>ex()(yx,S_)}),bx=yx.pipe(qb(Nie,S_)),Pie=K.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function xx(e,t){return Pie.pipe(qb(e,w_(t)))}var Fie=xx(Mb);globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var Sx=K.annotate({expected:`a string that will be decoded as a number`}).pipe(qb(Pb,p_)),Cx=K.annotate({expected:`a string that will be decoded as a finite number`}).pipe(qb(ix,p_)),Iie=K.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),Lie=$b(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>ex()(Iie,C_)});function wx(e,t){return Tb(db()([e,t],([e,t])=>(n,r,i)=>{if(!jl(n))return U(new mg(r,n,i));switch(n._tag){case`Fail`:return Xp(Ky(e)(n.error,i),{onSuccess:Ll,onFailure:e=>gg(r,`error`,e,n,i)});case`Die`:return Xp(Ky(t)(n.defect,i),{onSuccess:Rl,onFailure:e=>gg(r,`defect`,e,n,i)});case`Interrupt`:return B(n)}},{representation:{id:`effect/schema/CauseReason`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.CauseReason(${e[0].runtime}, ${e[1].runtime})`,Type:`Cause.Failure<${e[0].Type}, ${e[1].Type}>`,importDeclarations:[`import * as Cause from "effect/Cause"`]}),expected:`Cause.Failure`,toCodec:([e,t])=>ex()(Ub([q({_tag:G(`Fail`),error:e}),q({_tag:G(`Die`),defect:t}),q({_tag:G(`Interrupt`),fiberId:Kb(ix)})]),l_({decode:e=>{switch(e._tag){case`Fail`:return Ll(e.error);case`Die`:return Rl(e.defect);case`Interrupt`:return zl(e.fiberId)}},encode:e=>{switch(e._tag){case`Fail`:return{_tag:`Fail`,error:e.error};case`Die`:return{_tag:`Die`,defect:e.defect};case`Interrupt`:return{_tag:`Interrupt`,fiberId:e.fiberId}}}}))}).ast,{error:e,defect:t})}function Tx(e,t){return Tb(db()([e,t],([e,t])=>{let n=J(wx(e,t));return(e,t,r)=>Al(e)?Xp(Ky(n)(e.reasons,r),{onSuccess:Nl,onFailure:n=>gg(t,`failures`,n,e,r)}):U(new mg(t,e,r))},{representation:{id:`effect/schema/Cause`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Cause(${e[0].runtime}, ${e[1].runtime})`,Type:`Cause.Cause<${e[0].Type}, ${e[1].Type}>`,importDeclarations:[`import * as Cause from "effect/Cause"`]}),expected:`Cause`,toCodec:([e,t])=>ex()(J(wx(e,t)),l_({decode:Nl,encode:({reasons:e})=>e}))}).ast,{error:e,defect:t})}var Ex=c_({decode:(e,t)=>Bn(Kne(e),{onNone:()=>U(new hg({expected:`a valid UTC DateTime string`},e,t)),onSome:e=>B(Yne(e))}),encode:e=>B(dm(e))}),Rie=-864e13,zie=864e13;function Bie(e,t,n){let r=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+ +(e.exclusiveMinimum===!0)),i=Math.min(n,e?.maximum===void 0?n:e.maximum.epochMilliseconds-+(e.exclusiveMaximum===!0));return r<=i?[r,i]:[t,n]}function Vie(e,t){return dx.check(lx({minimum:e,maximum:t}))}var Dx=fb(e=>Wne(e)&&Gne(e),{representation:{id:`effect/schema/DateTimeUtc`,payload:null},toCode:()=>({runtime:`Schema.DateTimeUtc`,Type:`DateTime.Utc`,importDeclarations:[`import * as DateTime from "effect/DateTime"`]}),expected:`DateTime.Utc`,toCodecArbitrary:({constraint:e})=>{let[t,n]=Bie(e,Rie,zie);return bie()(Vie(t,n),Ug(cm))},toCodecJson:()=>ex()(K,Ex),toFormatter:()=>e=>e.toString()}),Ox=K.annotate({expected:`a string that will be decoded as a DateTime.Utc`}).pipe(qb(Dx,Ex)),kx=fb(bi,{representation:{id:`effect/schema/Duration`,payload:null},toCode:()=>({runtime:`Schema.Duration`,Type:`Duration.Duration`,importDeclarations:[`import * as Duration from "effect/Duration"`]}),expected:`Duration`,toCodecJson:()=>ex()(Ub([q({_tag:G(`Infinity`)}),q({_tag:G(`NegativeInfinity`)}),q({_tag:G(`Nanos`),value:hie}),q({_tag:G(`Millis`),value:dx})]),l_({decode:e=>{switch(e._tag){case`Infinity`:return Ei;case`NegativeInfinity`:return Di;case`Nanos`:return Oi(e.value);case`Millis`:return ki(e.value)}},encode:e=>{switch(e.value._tag){case`Infinity`:return{_tag:`Infinity`};case`NegativeInfinity`:return{_tag:`NegativeInfinity`};case`Nanos`:return{_tag:`Nanos`,value:e.value.nanos};case`Millis`:return{_tag:`Millis`,value:e.value.millis}}}}))});function Ax(e,t,n){return Tb(db()([e,t,n],([e,t,n])=>{let r=Tx(t,n);return(t,n,i)=>{if(!tu(t))return U(new mg(n,t,i));switch(t._tag){case`Success`:return Xp(Ky(e)(t.value,i),{onSuccess:nu,onFailure:e=>gg(n,`value`,e,t,i)});case`Failure`:return Xp(Ky(r)(t.cause,i),{onSuccess:ru,onFailure:e=>gg(n,`cause`,e,t,i)})}}},{representation:{id:`effect/schema/Exit`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Exit(${e[0].runtime}, ${e[1].runtime}, ${e[2].runtime})`,Type:`Exit.Exit<${e[0].Type}, ${e[1].Type}, ${e[2].Type}>`,importDeclarations:[`import * as Exit from "effect/Exit"`]}),expected:`Exit`,toCodec:([e,t,n])=>ex()(Ub([q({_tag:G(`Success`),value:e}),q({_tag:G(`Failure`),cause:Tx(t,n)})]),l_({decode:e=>e._tag===`Success`?nu(e.value):ru(e.cause),encode:e=>cu(e)?{_tag:`Success`,value:e.value}:{_tag:`Failure`,cause:e.cause}}))}).ast,{value:e,error:t,defect:n})}var jx=fb(Nh,{representation:{id:`effect/http/UrlParams`,payload:null},toCode:()=>({runtime:`Schema.UrlParams`,Type:`UrlParams.UrlParams`,importDeclarations:[`import * as UrlParams from "effect/http/UrlParams"`]}),expected:`UrlParams`,toEquivalence:()=>Rh,toCodec:()=>ex()(J(Bb([K,K])),l_({decode:Fh,encode:e=>e.params}))}).pipe(qb(Rb(K,Ub([K,Vb(K)])),l_({decode:Gh,encode:Ih})));function Mx(e,t){let n=typeof t?.label==`string`?t.label:void 0,r=t?.disallowJsonEncode===!0,i=n===void 0?r?{disallowJsonEncode:!0}:void 0:r?{label:n,disallowJsonEncode:!0}:{label:n},a=n===void 0?void 0:Ky(G(n));return Tb(db()([e],([e])=>(t,n,r)=>ph(t)?Zp(a===void 0?Af:Yp(a(t.label,r),e=>new ug([`label`],e)),()=>Xp(Ky(e)(gh(t),r),{onSuccess:e=>mh(e,{label:t.label}),onFailure:()=>new pg(n,[new ug([`value`],new hg(void 0,t,r))],t,r)})):U(new mg(n,t,r)),{representation:{id:`effect/schema/Redacted`,payload:i??null},toCode:({typeParameters:e})=>({runtime:i===void 0?`Schema.Redacted(${e[0].runtime})`:`Schema.Redacted(${e[0].runtime}, ${Ue(i)})`,Type:`Redacted.Redacted<${e[0].Type}>`,importDeclarations:[`import * as Redacted from "effect/Redacted"`]}),expected:`Redacted`,toCodecJson:([e])=>ex()(e,{decode:Ug(e=>mh(e,{label:n})),encode:r?zg(e=>`Cannot serialize Redacted`+(zn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):Ug(gh)}),toEquivalence:([e])=>_h(e)}).ast,{value:e})}function Hie(e,t){return qb(Mx(kb(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Ug(e=>mh(e,{label:t?.label})),encode:t?.disallowEncode?zg(e=>`Cannot encode Redacted`+(zn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):Ug(gh)})(e)}var Uie=globalThis.Symbol.for(`immer-draftable`),Nx={};function Px(e,t,r,i,a){let o=Lx(r,t,i),s=Ix(t),c=class extends e{constructor(...[e,t]){let n=t?.[`~payload`],i=n?.token===Nx?n.value:r.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:Nx,value:i}})}static[ub]=ub;get[s](){return s}static[Uie]=!0;static identifier=t;static fields=r.fields;static get ast(){return o(this).ast}static pipe(){return n(this,arguments)}static rebuild(e){return o(this).rebuild(e)}static make(e,t){return Gy(o(this))(e??{},t)}static makeOption(e,t){return Wy(o(this))(e??{},t)}static makeEffect(e,t){return o(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(ny(this.ast,e))}static annotateKey(e){return this.rebuild(py(this.ast,e))}static check(...e){return this.rebuild(iy(this.ast,e))}static extend(e){return(t,n)=>{let i=Rx(t)?t:q(t),o={...r.fields,...i.fields},s=Sv(o,r.ast.checks,{identifier:e});return Px(this,e,Lb(iy(s,i.ast.checks),o),n,a)}}static mapFields(e,t){return r.mapFields(e,t)}};return a!==void 0&&Object.assign(c.prototype,a(t)),c}function Fx(e){return new a_(Ug(t=>new e(t,{"~payload":{token:Nx,value:t}})),Hg())}function Ix(e){return`~effect/Schema/Class/${e}`}function Lx(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=Ix(t),o=e=>e instanceof i||F(e,a),s=Fx(i);return r=qb(Tb(new V_([e.ast],()=>(e,t,n)=>o(e)?B(e):U(new mg(t,e,n)),{identifier:t,[Xh]:([e])=>({isConstructed:o,link:new I_(e,s)}),toCodec:([e])=>new I_(e.ast,s),toEquivalence:([e])=>e,toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[Yh]:Ov(e.ast),...n})),s)(e)}}function Rx(e){return Eb(e)}var zx=e=>(t,n)=>Px(ea,e,Rx(t)?t:q(t),n,e=>({toString(){return`${e}(${Ue({...this})})`}})),Bx=e=>(t,n)=>Px(Zt,e,Rx(t)?t:q(t),n,e=>({name:e})),Y=e=>(t,n,r)=>{let i=Rx(n)?n.mapFields(e=>({_tag:Qb(t),...e}),{unsafePreserveChecks:!0}):Sie(t,n);return Bx(e??t)(i,r)},Vx=Jre,Hx=Zre,Wie=Tb(ny(My,{toCode:()=>({runtime:`Schema.Json`,Type:`Schema.Json`})})),Gie=Tb(ny(Cre,{toCode:()=>({runtime:`Schema.MutableJson`,Type:`Schema.MutableJson`})})),Ux=`~effect/reactivity/AsyncResult`,Wx=e=>F(e,Ux),Gx={[Ux]:{E:o,A:o},pipe(){return n(this,arguments)},[ve](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return ye(this.value,e.value);case`Failure`:return ye(this.cause,e.cause)}},[ee](){let e=se(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:re(e)(this._tag===`Success`?z(this.value):z(this.cause))}},Kx=e=>e.waiting,qx=(e,t)=>e._tag===`Success`?$x(e.value):nS(e.cause,{previous:t}),Jx=e=>e._tag===`None`?Zx(!0):iS(e.value),Yx=e=>e._tag===`Initial`,Xx=e=>e._tag!==`Initial`,Zx=(e=!1)=>{let t=Object.create(Gx);return t._tag=`Initial`,t.waiting=e,t},Qx=e=>e._tag===`Success`,$x=(e,t)=>{let n=Object.create(Gx);return n._tag=`Success`,n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},eS=e=>e._tag===`Failure`,tS=(e,t)=>{let n=Object.create(Gx);return n._tag=`Failure`,n.cause=e,n.previousSuccess=t?.previousSuccess??In(),n.waiting=t?.waiting??!1,n},nS=(e,t)=>tS(e,{previousSuccess:Jn(t.previous,e=>Qx(e)?Ln(e):eS(e)?e.previousSuccess:In()),waiting:t.waiting}),rS=(e,t)=>nS(Pl(e),t),iS=a(e=>Wx(e[0]),(e,t)=>{if(e.waiting)return t?.touch?aS(e):e;let n=Object.assign(Object.create(Gx),e);return n.waiting=!0,t?.touch&&Qx(n)&&(n.timestamp=Date.now()),n}),aS=e=>Qx(e)?$x(e.value,{waiting:e.waiting}):e,oS=a(2,(e,t)=>e._tag===`Failure`?nS(e.cause,{previous:t,waiting:e.waiting}):e),sS=e=>e._tag===`Success`?Ln(e.value):e._tag===`Failure`?qn(e.previousSuccess,e=>e.value):In(),cS=e=>Gn(sS(e),()=>new Jl(`AsyncResult.getOrThrow: no value found`)),lS=e=>{switch(e._tag){case`Success`:return nu(e.value);case`Failure`:return ru(e.cause);default:return iu(new Jl)}},uS=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return tS(e.cause,{previousSuccess:qn(e.previousSuccess,e=>$x(t(e.value),e)),waiting:e.waiting});case`Success`:return $x(t(e.value),e)}}),dS=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return tS(e.cause,{previousSuccess:Jn(e.previousSuccess,e=>{let n=t(e.value,e);return Qx(n)?Ln(n):In()}),waiting:e.waiting});case`Success`:return t(e.value,e)}}),fS=eo,pS=no,mS=$ee,hS=ro,gS=io,_S=Xa,vS=Ote,yS=Xc,bS=Ite,xS=`~effect/MutableRef`,SS={[xS]:xS,...yt,toJSON(){return{_id:`MutableRef`,current:Qe(this.current)}}},CS=e=>{let t=Object.create(SS);return t.current=e,t},wS=a(2,(e,t)=>(e.current=t,e)),TS=Symbol.for(`effect/MutableList/Empty`),ES=()=>({head:void 0,tail:void 0,length:0}),DS=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},OS=()=>({array:[],mutable:!0,offset:0,next:void 0}),kS=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=OS(),e.tail=e.tail.next):e.head=e.tail=OS(),e.tail.array.push(t),e.length++},Kie=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||=e.head,e.length++},qie=(e,t)=>Jie(e,qr(t),!Array.isArray(t)),Jie=(e,t,n=!1)=>{if(t.length===0)return 0;let r={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=r:e.head=e.tail=r,e.length+=t.length,t.length},AS=e=>{e.head=e.tail=void 0,e.length=0},jS=(e,t)=>{if(t=Or(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return AS(e),t}let n=Array(t),r=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[r++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,r===t)return e.head=i.offset===i.array.length&&i.next?i.next:i,e.length-=t,e.length===0?AS(e):DS(e),n;i=i.next}return AS(e),n},Yie=e=>jS(e,e.length),MS=e=>{if(!e.head)return TS;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:AS(e):DS(e),t},Xie=(e,t)=>{let n=[],r=e.head,i=0;for(;r;){for(let e=r.offset;e<r.array.length;e++)t(r.array[e],i++)&&n.push(r.array[e]);r=r.next}if(n.length===0){AS(e);return}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length},Zie=(e,t)=>Xie(e,e=>e!==t),Qie=`~effect/PubSub`,$ie=`~effect/PubSub/Subscription`,eae=e=>V(()=>FS(e.atomicPubSub(),new Map,bu(),yS(!1),CS(!1),e.strategy(),CS(In()))),tae=e=>eae({atomicPubSub:()=>nae(e),strategy:()=>new IS}),nae=e=>{let t=e?.replay;return new uae(t&&t>0?new zS(Math.ceil(t)):void 0)},NS=a(2,(e,t)=>e.shutdownFlag.current||zn(e.ended.current)?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),rae=e=>Op(dp(t=>{let n=yr(t,yu),r=Tu(e.scope),i=lae(e.pubsub,e.subscribers,e.strategy,e.ended);return Cu(r,iae(i)).pipe(Hf(Su(n,e=>Eu(r,e))),qf(i))})),iae=e=>Op(zf(t=>(wS(e.shutdownFlag,!0),wf(Yie(e.pollers),e=>ene(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(Uf(()=>V(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),gne(e.shutdownHook.open),Yf)))),aae=e=>kf(function t(n){if(e.shutdownFlag.current)return Tp;let r=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?B(e.replayWindow.takeAll().concat(r)):Zr(r)?B(r):Bf(oae(e),e=>t([e]))}),oae=e=>Mf(t=>{if(e.shutdownFlag.current)return t(Tp);if(zn(e.ended.current))return t(B(e.ended.current.value));let n=pu(),r=e.subscribers.get(e.subscription);return r||(r=new Set,e.subscribers.set(e.subscription,r)),r.add(e.pollers),kS(e.pollers,n),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),n.effect?t(n.effect):(n.resumes=[t],V(()=>Zie(e.pollers,n)))}),PS=Symbol.for(`effect/PubSub/AbsentValue`),sae=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},cae=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},lae=(e,t,n,r)=>new fae(e,t,e.subscribe(),ES(),yS(!1),CS(!1),n,e.replayWindow(),r),uae=class{publisherHead={value:PS,replayIndex:void 0,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=2**53-1;replayBuffer;constructor(e){this.replayBuffer=e}replayWindow(){return this.replayBuffer?new BS(this.replayBuffer):VS}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(e){let t=this.replayBuffer?.offer(e),n=this.publisherTail.subscribers;if(n!==0){let r={value:e,replayIndex:t,subscribers:n,next:null};this.publisherTail.next=r,this.publisherTail=this.publisherTail.next,this.publisherIndex+=1}return!0}publishAll(e){if(this.publisherTail.subscribers!==0)for(let t of e)this.publish(t);else this.replayBuffer&&this.replayBuffer.offerAll(e);return[]}slide(){if(this.publisherHead!==this.publisherTail){let e=this.publisherHead.next,t=e.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=PS,this.subscribersIndex+=1,this.replayBuffer?.slide(t,e.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new dae(this,this.publisherTail,this.publisherIndex,!1)}},dae=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(e,t,n,r){this.self=e,this.subscriberHead=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){if(this.unsubscribed)return!0;let e=!0,t=!0;for(;t;)this.subscriberHead===this.self.publisherTail?t=!1:this.subscriberHead.next.value===PS?(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1):(e=!1,t=!1);return e}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return TS;let e=!0,t=TS;for(;e;)if(this.subscriberHead===this.self.publisherTail)e=!1;else{let n=this.subscriberHead.next.value;n!==PS&&(t=n,--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=PS,this.self.subscribersIndex+=1),e=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return t}pollUpTo(e){e=Or(e);let t=[],n=0;for(;n!==e;){let r=this.poll();r===TS?n=e:(t.push(r),n+=1)}return t}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,--this.self.publisherTail.subscribers;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==PS&&(--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=PS,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},fae=class{[$ie]={_A:o};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;ended;constructor(e,t,n,r,i,a,o,s,c){this.pubsub=e,this.subscribers=t,this.subscription=n,this.pollers=r,this.shutdownHook=i,this.shutdownFlag=a,this.strategy=o,this.replayWindow=s,this.ended=c}pipe(){return n(this,arguments)}},pae=class{[Qie]={_A:o};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;ended;constructor(e,t,n,r,i,a,o){this.pubsub=e,this.subscribers=t,this.scope=n,this.shutdownHook=r,this.shutdownFlag=i,this.strategy=a,this.ended=o}pipe(){return n(this,arguments)}},FS=(e,t,n,r,i,a,o)=>new pae(e,t,n,r,i,a,o),IS=class{get shutdown(){return Af}handleSurplus(e,t,n,r){return B(!1)}onPubSubEmptySpaceUnsafe(e,t){}completePollersUnsafe(e,t,n,r){return LS(this,e,t,n,r)}completeSubscribersUnsafe(e,t){return RS(this,e,t)}},LS=(e,t,n,r,i)=>{let a=!0;for(;a&&!r.isEmpty();){let o=MS(i);if(o===TS)cae(n,r,i),i.length===0?a=!1:sae(n,r,i);else{let a=r.poll();a===TS?Kie(i,o):(vu(o,nu(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},RS=(e,t,n)=>{for(let[r,i]of n)for(let a of i)e.completePollersUnsafe(t,n,r,a)},zS=class{capacity;head={value:PS,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(e){this.capacity=e}slide(e,t){this.slideValues[this.index%this.capacity]={value:e,index:t},this.index++}offer(e){let t=this.publisherIndex++;return this.tail.value=e,this.tail.index=t,this.tail.next={value:PS,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,t}offerAll(e){for(let t of e)this.offer(t)}},BS=class{buffer;values;index=0;remaining;slideIndex;newestIndex=-1;constructor(e){this.buffer=e,this.remaining=e.size,this.slideIndex=e.index,this.values=Array(this.remaining);let t=e.head;for(let e=0;e<this.remaining;e++)this.values[e]=t.value,this.newestIndex=t.index,t=t.next}close(){this.values.length=0,this.remaining=0}sync(){let e=this.buffer.index-this.slideIndex;if(e===0||this.remaining===0)return;let t=Math.min(e,this.buffer.capacity),n=this.buffer.index-t;for(let e=0;e<t;e++){let t=this.buffer.slideValues[(n+e)%this.buffer.capacity];t.index>this.newestIndex&&(this.index=(this.index+1)%this.values.length,this.values[(this.index+this.remaining-1)%this.values.length]=t.value,this.newestIndex=t.index)}this.slideIndex=this.buffer.index}take(){if(this.remaining===0)return;this.sync();let e=this.values[this.index];return this.values[this.index]=PS,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),e}takeN(e){e=Or(e);let t=Math.min(e,this.remaining),n=Array(t);for(let e=0;e<t;e++)n[e]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},VS={remaining:0,take:()=>void 0,takeN:()=>[],takeAll:()=>[],close:()=>void 0},HS=`~effect/Queue`,US=`~effect/Queue/Enqueue`,WS=`~effect/Queue/Dequeue`,GS={_A:o,_E:o},KS={[HS]:GS,[US]:GS,[WS]:GS,...yt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:lC(this)}}},qS=e=>Yt(t=>{let n=Object.create(KS);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=ES(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},ao(n)}),JS=e=>qS({capacity:e}),YS=e=>qS({capacity:e,strategy:`sliding`}),XS=a(2,(e,t)=>lo(()=>ZS(e,t)?dC:e.state._tag===`Open`&&e.strategy===`suspend`?yC(e,t):uC)),ZS=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(MS(e.messages),kS(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0&&(kS(e.messages,t),mC(e),!0):(kS(e.messages,t),hC(e),!0):!1,QS=a(2,(e,t)=>_o(n=>{let r=$S(e,t);return r.length===0||e.strategy===`dropping`?n(Ut(r)):bC(e,{_tag:`Array`,remaining:r,offset:0,resume:n})})),$S=(e,t)=>{if(e.state._tag!==`Open`)return qr(t);if(e.capacity===1/0||e.strategy===`sliding`)return qie(e.messages,t),e.strategy===`sliding`&&jS(e.messages,e.messages.length-e.capacity),hC(e),[];let n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return qr(t);let r=[],i=0;for(let a of t)i<n?kS(e.messages,a):r.push(a),i++;return hC(e),r},eC=a(2,(e,t)=>co(()=>tC(e,t))),tC=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=cs(Kt(t),fC);return e.state.offers.size===0&&e.messages.length===0?(wC(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},hC(e),!0)},nC=e=>eC(e,Pt(an())),rC=e=>co(()=>iC(e)),iC=e=>{if(e.state._tag===`Done`)return!1;AS(e.messages);let t=e.state.offers;wC(e,e.state._tag===`Open`?pC:e.state.exit);for(let e of t)xC(e);return!0},aC=e=>oC(e,1,1/0),oC=a(3,(e,t,n)=>(t=Or(t),n=Or(n),lo(()=>gC(e,t,n)??zo(vC(e,()=>_C(e,t)),oC(e,t,n))))),sC=e=>lo(()=>cC(e)??zo(vC(e,()=>_C(e,1)),sC(e))),cC=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=MS(e.messages);return CC(e),Ut(t)}if(e.capacity<=0&&e.state.offers.size>0){let t=SC(e.state.offers);return CC(e),Ut(t)}},lC=e=>e.state._tag===`Done`?0:e.messages.length,uC=Ut(!1),dC=Ut(!0),fC=qt(an()),pC=$o(),mC=e=>{if(e.state._tag!==`Done`&&e.state.takers.size!==0){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(is),e.messages.length===0))break}},hC=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,mC(e)},0))},gC=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return Ut([]);if(!_C(e,t))return;let r=e.messages.length>0?jS(e.messages,n):[SC(e.state.offers)];return CC(e),Ut(r)},_C=(e,t)=>e.messages.length>=(e.state._tag===`Closing`?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!==`Done`&&e.state.offers.size>0,vC=(e,t)=>_o(n=>{if(e.state._tag===`Done`)return n(e.state.exit);if(t())return n(is);let r={ready:t,resume:n};return e.state.takers.add(r),co(()=>{e.state._tag!==`Done`&&e.state.takers.delete(r)})}),yC=(e,t)=>_o(n=>ZS(e,t)?n(dC):bC(e,{_tag:`Single`,message:t,resume:n})),bC=(e,t)=>{if(e.state._tag!==`Open`)return xC(t);let n=e.state.offers;return n.add(t),co(()=>{e.state._tag!==`Done`&&(n.delete(t),e.state._tag===`Closing`&&n.size===0&&e.messages.length===0&&wC(e,e.state.exit))})},xC=e=>e._tag===`Single`?e.resume(uC):e.resume(Ut(e.remaining.slice(e.offset))),SC=e=>{let t=e.values().next().value;if(t._tag===`Single`)return e.delete(t),t.resume(dC),t.message;let n=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Ut([]))),n},CC=e=>{if(e.state._tag===`Done`)return Yd(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0&&(wC(e,e.state.exit),Yd(e.state.exit.cause));for(let t of e.state.offers){let n=e.capacity-e.messages.length;if(n<=0)break;if(t._tag===`Single`)kS(e.messages,t.message),e.state.offers.delete(t),t.resume(dC);else{for(;t.offset<t.remaining.length;t.offset++){if(n===0)return!1;kS(e.messages,t.remaining[t.offset]),n--}e.state.offers.delete(t),t.resume(Ut([]))}}return!1},wC=(e,t)=>{if(e.state._tag===`Done`)return;let n=e.state;e.state={_tag:`Done`,exit:t};for(let e of n.takers)e.resume(t);n.takers.clear();for(let e of n.awaiters)e(t);n.awaiters.clear()},TC=e=>new DC(e),EC=(e,t,n)=>_o(r=>{if(e.free>=t)return r(n);let i=()=>{e.free<t||(e.waiters.delete(i),r(n))};return e.waiters.add(i),co(()=>{e.waiters.delete(i)})}),DC=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=lo(()=>this.free<e?EC(this,e,t):(this.taken+=e,ao(e)));return t}takeIfAvailable(e){return lo(()=>this.free<e?ao(!1):(this.taken+=e,ao(!0)))}releaseUnsafe(e,t){return this.taken-=t,this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{for(let e of this.waiters){if(this.free<=0)break;e()}},0),this.free}resize(e){return Yt(t=>(this.permits=e,this.free<0||this.releaseUnsafe(t,0),ho))}release(e){return Yt(t=>ao(this.releaseUnsafe(t,e)))}get releaseAll(){return Yt(e=>ao(this.releaseUnsafe(e,this.taken)))}withPermits(e){return t=>Mc(n=>{let r=lo(()=>this.free<e?Wo(n(EC(this,e,ho)),()=>r):(this.taken+=e,Tc(n(t),()=>{this.releaseUnsafe(Xa(),e)},!0)));return r})}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>Mc(n=>this.free<e?fo:(this.taken+=e,Tc(n(Ro(t)),()=>{this.releaseUnsafe(Xa(),e)},!0)))}},OC=e=>co(()=>new DC(e)),kC=(e,t)=>t?e.withPermit(t):e.withPermit,AC=`~effect/Channel`,jC=e=>F(e,AC),MC={[AC]:{_Env:o,_InErr:o,_InElem:o,_OutErr:o,_OutElem:o},pipe(){return n(this,arguments)}},NC=e=>{let t=Object.create(MC);return t.transform=(t,n)=>Qf(e(t,n),e=>B(Pf(e))),t},PC=(e,t)=>NC((n,r)=>Bf(LC(e)(n,r),e=>t(e,r))),FC=e=>NC((t,n)=>e),IC=e=>NC(Wp(function*(t,n){let r=Tu(n),i=e=>Eu(r,$d(e));return Sp(yield*Sp(e(t,n,r),i),i)})),LC=e=>e.transform,RC=(e,t,n)=>qS({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Uf(t=>Cu(e,rC(t))),Uf(n=>Pp(xu(t(n),e),e))),zC=(e,t)=>NC((n,r)=>Kf(RC(r,e,t),aC)),BC=e=>NC((t,n)=>kf(()=>LC(e())(t,n))),VC=e=>FC(V(()=>{let t=e();return kf(()=>{let e=t.next();return e.done?Xl(e.value):B(e.value)})})),HC=e=>FC(V(()=>{let t=0;return kf(()=>t>=e.length?Xl():B(e[t++]))})),UC=e=>JC(B(e)),WC=FC(B(Xl())),GC=FC(B(Nf)),KC=e=>FC(B(U(e))),qC=e=>FC(Pf(e)),JC=e=>FC(V(()=>{let t=!1;return kf(()=>t?Xl():(t=!0,e))})),YC=e=>FC(B(aC(e))),XC=e=>FC(B(Dp(aae(e),()=>Xl()))),ZC=e=>Sw(Kf(rae(e),XC)),QC=e=>NC((t,n)=>$C({scope:n,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd})),$C=e=>{let t=e.readable.getReader(),n=e.exit??CS(void 0),r=kf(()=>n.current?n.current:lp(Df({try:()=>t.read(),catch:e.onError}),{onFailure:e=>n.current??Pf(e),onSuccess:({done:e,value:t})=>n.current?n.current:e?Xl():B(ti(t))}));return qf(Cu(e.scope,e.releaseLockOnEnd?V(()=>t.releaseLock()):Ef(()=>t.cancel().catch(d))),r)},ew=a(2,(e,t)=>PC(e,e=>V(()=>{let n=0;return Kf(e,e=>t(e,n++))}))),tw=e=>e===void 0||e!==`unbounded`&&e<=1,nw=a(e=>jC(e[0]),(e,t,n)=>tw(n?.concurrency)?rw(e,t):iw(e,t,n)),rw=(e,t)=>NC((n,r)=>{let i=0;return Kf(LC(e)(n,r),Bf(e=>t(e,i++)))}),iw=(e,t,n)=>IC(Wp(function*(r,i,a){let o=0,c=yield*LC(e)(r,i),l=n.concurrency===`unbounded`?2**53-1:n.concurrency,u=yield*JS(0);yield*Cu(a,rC(u));let d=Lp(yield*up()),f=vS(a);if(n.unordered){let e=TC(l),n=s(e.release(1)),r=lp({onFailure:e=>Bf(eC(u,e),n),onSuccess:e=>Bf(XS(u,e),n)});yield*e.take(1).pipe(Bf(()=>c),Bf(e=>{let n=o++;return f(d(r(kf(()=>t(e,n))))),Af}),Ap({disableYield:!0}),Qf(t=>e.withPermits(l-1)(eC(u,t))),Pp(a))}else{let e=yield*JS(l-2);yield*Cu(a,rC(e)),yield*sC(e).pipe(Vf,Bf(e=>XS(u,e)),Ap({disableYield:!0}),Qf(e=>eC(u,e)),Pp(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,tC(u,e.cause))};yield*c.pipe(Bf(i=>{if(n)return Pf(n);let a=o++,s=d(kf(()=>t(i,a)));return f(s),s.addObserver(r),XS(e,pS(s))}),Ap({disableYield:!0}),Qf(t=>XS(e,ru(t)).pipe(Hf(eC(e,t)))),Pp(a))}return sC(u)})),aw=a(e=>jC(e[0]),(e,t,n)=>tw(n?.concurrency)?ow(e,t):sw(e,t,n)),ow=(e,t)=>NC((n,r)=>Kf(LC(e)(n,r),e=>{let i,a,o=Bf(e,e=>(a??=Tu(r),Zp(LC(t(e))(n,a),e=>(i=s(e),i)))),s=Jd(e=>{if(i=void 0,a.state._tag===`Empty`)return o;let t=Eu(a,su);return a=void 0,Bf(t,()=>o)});return kf(()=>i??o)})),sw=(e,t,n)=>e.pipe(ew(t),yw(n)),cw=e=>aw(e,o),lw=e=>PC(e,e=>{let t,n=0;return B(kf(function r(){if(t===void 0)return Bf(e,e=>{switch(e.length){case 0:return r();case 1:return B(e[0]);default:return t=e,B(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),B(i)}))}),uw=e=>PC(e,e=>B(Ap(e,{disableYield:!0}))),dw=a(2,(e,t)=>lf(typeof t==`function`?t(o):t).pipe(Kf(t=>{let n=nf.defaultValue();return fw(kw(e,nf,V(()=>n)),e=>t(e).pipe(Kf(e=>{n=e}),Jd(()=>Xl(e))))}),Sw)),fw=(e,t)=>NC((n,r)=>V(()=>{let i,a=()=>{let o=Tu(r);return Bf(LC(e)(n,o),e=>(i=Jd(e,e=>Eu(o,su).pipe(Bf(()=>t(e)),Bf(a))),i))};return kf(()=>i??a())})),pw=a(2,(e,t)=>NC((n,r)=>Kf(LC(e)(n,r),e=>Bf(e,function n(r){return t(r)?B(r):Bf(e,n)})))),mw=a(2,(e,t)=>PC(e,e=>B(Bf(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return Qr(i)?B(i):Bf(e,n)})))),hw=a(2,(e,t)=>NC((n,r)=>{let i=Tu(r);return Kf(LC(e)(n,i),e=>{let a=e.pipe(Qf(e=>{if(Yd(e))return Pf(e);let o=i;return i=Tu(r),Eu(o,ru(e)).pipe(Hf(LC(t(e))(n,i)),Bf(e=>(a=e,e)))}));return kf(()=>a)})})),gw=a(3,(e,t,n)=>hw(e,e=>{let r=t(e);return Mr(r)?qC(r.failure):n(r.success,e)})),_w=a(2,(e,t)=>gw(e,Hl,e=>t(e))),vw=a(e=>jC(e[0]),(e,t,n)=>e.pipe(ew(t),yw({...n,concurrency:n?.concurrency??1,switch:!0}))),yw=a(2,(e,{bufferSize:t=16,concurrency:n,switch:r=!1})=>IC(Wp(function*(i,a,o){let s=n===`unbounded`?2**53-1:Math.max(1,n),c=r?void 0:TC(s),l=yield*bS(!0),u=new Set,d=yield*JS(t);yield*Cu(o,rC(d));let f=yield*LC(e)(i,a);return yield*H(function*(){for(;;){let e;c&&(u.size<s?yield*c.take(1):(e=yield*Np(f),yield*sp(c.take(1),Hf(pS(e),Nf))));let t=e===void 0?yield*f:yield*pS(e),n=Tu(o),r=yield*LC(t)(i,n);for(;u.size>=s;){let e=Lr(u);u.delete(e),u.size===0&&(yield*l.open),yield*hS(e)}let a=yield*r.pipe(Uf(()=>Rf),Bf(e=>XS(d,e)),Ap({disableYield:!0}),Sp(Wp(function*(e){let t=Zd(e);if(yield*Gf(Eu(n,Mr(t)?ru(t.failure):nu(t.success.value))),u.has(a)&&(u.delete(a),c&&(yield*c.release(1)),u.size===0&&(yield*l.open),!Nr(t)))return yield*eC(d,e)})),Np);l.closeUnsafe(),u.add(a)}}).pipe(Qf(e=>Nr(Zd(e))?l.whenOpen(eC(d,e)):eC(d,e)),Pp(o)),sC(d)}))),bw=a(e=>jC(e[0])&&jC(e[1]),(e,t,n)=>IC(Wp(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*JS(0);yield*Cu(a,rC(s));let c=0;function l(e,t){if(c++,!Yd(t))return eC(s,t);switch(o){case`both`:return c===2?eC(s,t):Af;case`left`:case`right`:return e===o?eC(s,t):Af;case`either`:return eC(s,t)}}let u=(e,t,n)=>LC(t)(r,n).pipe(Bf(e=>e.pipe(Bf(e=>XS(s,e)),Ap)),Sp(t=>Hf(Eu(n,$d(t)),l(e,t))),Pp(a));return yield*u(`left`,e,Tu(a)),yield*u(`right`,t,Tu(a)),sC(s)}))),xw=a(2,(e,t)=>NC((n,r)=>Bf(LC(e)(n,r),e=>LC(t)(e,r)))),Sw=e=>NC((t,n)=>{let r;return B(kf(()=>r||e.pipe(xu(n),Bf(e=>LC(e)(t,n)),Bf(e=>r=e))))}),Cw=a(2,(e,t)=>IC((n,r,i)=>Su(i,t).pipe(Hf(LC(e)(n,r))))),ww=a(2,(e,t)=>PC(e,e=>B(Jd(e,e=>Bf(t,()=>Xl(e)))))),Tw=a(2,(e,t)=>Cw(e,e=>t)),Ew=(e,t,n)=>kf(()=>{let r=bu();return Jd(Bf(LC(e)(Xl(),r),t),n||B).pipe(Cp(e=>Eu(r,e)))}),Dw=a(2,(e,t)=>NC((n,r)=>Kf(pp(LC(e)(n,r),t),pp(t)))),Ow=a(3,(e,t,n)=>NC((r,i)=>Kf(hp(LC(e)(r,i),t,n),hp(t,n)))),kw=a(3,(e,t,n)=>NC((r,i)=>Bf(n,n=>LC(Ow(e,t,n))(r,i)))),Aw=a(2,(e,t)=>Ew(e,e=>Ap(Bf(e,t),{disableYield:!0}))),jw=e=>kf(()=>{let t=In();return Ew(e,e=>e.pipe(Jf,Bf(e=>(t=e,Xl()))),()=>B(t))}),Mw=Wp(function*(e){let t=TC(1),n=yield*up(),r=yr(n,yu);return(yield*LC(e)(Xl(),r)).pipe(pp(n),t.withPermits(1))},Qf(e=>B(Pf(e)))),Nw=(e,t)=>LC(e)(Xl(),t),Pw=`~effect/MutableHashMap`,mae={[Pw]:Pw,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${Ue(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:Qe(Array.from(this))}},[Ze](){return this.toJSON()},pipe(){return n(this,arguments)}},Fw=()=>{let e=Object.create(mae);return e.backing=new Map,e.buckets=new Map,e},hae=(...e)=>gae(e),gae=e=>{let t=Fw();for(let[n,r]of e)Rw(t,n,r);return t},Iw=a(2,(e,t)=>{if(e.backing.has(t))return Ln(e.backing.get(t));if(Lw(t))return In();let n=z(t),r=e.buckets.get(n);return r===void 0?In():vae(e,r,t)}),Lw=e=>typeof e!=`object`&&typeof e!=`function`,_ae=e=>e.backing.values(),vae=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(ye(n,t[r])){let n=t[r];return Ln(e.backing.get(n))}return In()},yae=a(2,(e,t)=>zn(Iw(e,t))),Rw=a(3,(e,t,n)=>{if(e.backing.has(t)||Lw(t))return e.backing.set(t,n),e;let r=z(t),i=e.buckets.get(r);if(i===void 0)return e.buckets.set(r,[t]),e.backing.set(t,n),e;let a=bae(i,t);return a===void 0&&(i.push(t),a=t),e.backing.set(a,n),e}),bae=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(ye(t,e[n]))return e[n]},zw=a(2,(e,t)=>{if(Lw(t))return e.backing.delete(t),e;let n=z(t),r=e.buckets.get(n);if(r===void 0)return e;for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i===t||ye(t,i)){e.backing.delete(i),r.splice(n,1);break}}return r.length===0&&e.buckets.delete(n),e}),xae=e=>(e.backing.clear(),e.buckets.clear(),e),Bw=e=>e.backing.size,Vw=`~effect/PlatformError`,Sae=class extends ra(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},Cae=class extends na{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}},Hw=class extends ra(`PlatformError`){constructor(e){`cause`in e?super({reason:e,cause:e.cause}):super({reason:e})}[Vw]=Vw;get message(){return this.reason.message}},Uw=e=>new Hw(new Cae(e)),wae=e=>new Hw(new Sae(e)),Tae=`~effect/Stream`,Eae={_R:o,_E:o,_A:o},Ww=function(e){this.channel=e};Ww.prototype={[Tae]:Eae,pipe(){return n(this,arguments)}};var Dae=e=>new Ww(e),Gw=`~effect/RcMap`,Oae=e=>({[Gw]:Gw,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:`Open`,map:Fw()},pipe(){return n(this,arguments)}}),kae=e=>zf(t=>{let n=t.context,r=yr(n,yu),i=Oae({lookup:e.lookup,context:n,scope:r,idleTimeToLive:typeof e.idleTimeToLive==`function`?p(e.idleTimeToLive,pi):s(pi(e.idleTimeToLive??Ti)),capacity:Math.max(e.capacity??1/0,0)});return qf(Su(r,()=>{if(i.state._tag===`Closed`)return Af;let e=i.state.map;return i.state={_tag:`Closed`},wf(e,([,e])=>Gf(Kw(e))).pipe(Uf(()=>V(()=>{xae(e)})))}),i)}),Aae=a(2,(e,t)=>kp(n=>{if(e.state._tag===`Closed`)return Tp;let r=e.state,i=_S(),a=Iw(r.map,t),o;if(a._tag===`Some`)o=a.value,o.refCount++;else if(Number.isFinite(e.capacity)&&Bw(e.state.map)>=e.capacity)return U(new Ql(`RcMap attempted to exceed capacity of ${e.capacity}`));else{o={deferred:pu(),scope:bu(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},o.finalizer=Mae(e,t,o),Rw(r.map,t,o);let n=new Map(e.context.mapUnsafe);i.context.mapUnsafe.forEach((e,t)=>{n.set(t,e)}),n.set(yu.key,o.scope);let a=ur(n);kf(()=>e.lookup(t)).pipe(Lp(a),vS(o.scope)).addObserver(n=>{uu(n)&&jae(e,t,o,a),vu(o.deferred,n)})}return Cu(vr(i.context,yu),o.finalizer).pipe(Hf(n(hu(o.deferred))))})),jae=(e,t,n,r)=>{if(e.state._tag===`Closed`)return;let i=Iw(e.state.map,t);i._tag!==`None`&&i.value===n&&(zw(e.state.map,t),!(n.refCount>0)&&Kw(n).pipe(Lp(r),vS(e.scope)))},Kw=e=>e.fiber?hS(e.fiber).pipe(Hf(Eu(e.scope,su))):Eu(e.scope,su),Mae=(e,t,n)=>zf(r=>{if(n.refCount--,n.refCount>0)return Af;if(e.state._tag===`Closed`)return Kw(n);let i=Iw(e.state.map,t);if(i._tag===`None`||i.value!==n)return Kw(n);if(Si(n.idleTimeToLive))return zw(e.state.map,t),Kw(n);if(!xi(n.idleTimeToLive))return Af;let a=r.getRef(ed);return n.expiresAt=a.currentTimeMillisUnsafe()+Fi(n.idleTimeToLive),n.fiber||=kp(function r(i){let o=a.currentTimeMillisUnsafe(),s=n.expiresAt-o;if(s<=0){if(e.state._tag===`Closed`||n.refCount>0)return Af;let r=Iw(e.state.map,t);return r._tag===`None`||r.value!==n?Af:(zw(e.state.map,t),Eu(n.scope,su))}return Bf(i(a.sleep(ki(s))),()=>r(i))}).pipe(xp(V(()=>{n.fiber=void 0})),Lp(r.context),vS(e.scope)),Af}),Nae=`~effect/Stream`,qw=e=>F(e,Nae),Jw=Dae,Yw=e=>Jw(JC(Kf(e,ti))),Pae=e=>Jw(FC(e)),Xw=(e,t)=>Jw(NC((n,r)=>Bf(Nw(e.channel,r),e=>t(e,r)))),Zw=e=>e.channel,Qw=(e,t)=>Jw(zC(e,t)),$w=Jw(WC),eT=e=>Jw(UC(ti(e))),Fae=(...e)=>Rae(e),tT=e=>Jw(BC(()=>e().channel)),Iae=e=>Jw(KC(e)),Lae=e=>Jw(qC(e)),Rae=e=>Qr(e)?Jw(UC(e)):$w,nT=e=>Jw(YC(e)),zae=e=>Jw(ZC(e)),Bae=e=>Jw(QC(e)),Vae=(e,t)=>Pae(V(()=>{let n=e,r=!1;return kf(function e(){return r?Xl():Bf(t(n),([t,i])=>(Rn(i)?r=!0:n=i.value,Qr(t)?B(t):e()))})})),Hae=Jw(GC),rT=e=>Jw(Sw(Kf(e,Zw))),iT=a(2,(e,t)=>tT(()=>{let n=0;return Jw(ew(e.channel,ni(e=>t(e,n++))))})),aT=a(e=>qw(e[0]),(e,t,n)=>e.channel.pipe(lw,nw(t,n),ew(ti),Jw)),Uae=a(e=>qw(e[0]),(e,t,n)=>e.channel.pipe(lw,vw(e=>t(e).channel,n),Jw)),Wae=e=>Jw(uw(e.channel)),oT=a(2,(e,t)=>Jw(dw(e.channel,t))),sT=a(2,(e,t)=>{let n=Jw(cw(VC(()=>Gae(e,t))));return cT.set(n,[e,t]),n}),cT=new WeakMap;function*Gae(e,t){let n=[t,e];for(;n.length>0;){let e=n.pop(),t=cT.get(e);t===void 0?yield e.channel:n.push(t[1],t[0])}}var Kae=a(e=>qw(e[0])&&qw(e[1]),(e,t,n)=>Jw(bw(Zw(e),Zw(t),n))),qae=(...e)=>Jw(BC(()=>{let t=[],n=new Set,r=yS();return yw(HC(e.map((i,a)=>i.channel.pipe(lw,nw(i=>(t[a]=i,n.has(a)?B(ti(t.slice())):(n.add(a),n.size<e.length?r.await:qf(r.open,ti(t.slice()))))),pw(k)))),{concurrency:`unbounded`,bufferSize:0})})),Jae=a(3,(e,t,n)=>iT(qae(e,t),([e,t])=>n(e,t))),lT=a(2,(e,t)=>Jw(mw(Zw(e),t))),Yae=a(2,(e,t)=>Jw(_w(e.channel,e=>t(e).channel))),Xae=a(e=>qw(e[0]),(e,t,n)=>Xw(e,(e,r)=>V(()=>{let r=0,i=!1;return Bf(kf(()=>i?Xl():e),e=>{let a=e.findIndex(e=>t(e,r++));if(a>=0){i=!0;let t=e.slice(0,n?.excludeLast?a:a+1);return Qr(t)?B(t):Xl()}return B(e)})}))),Zae=a(2,(e,t)=>Jw(xw(e.channel,t))),Qae=a(e=>qw(e[0]),(e,t)=>tT(()=>{let n=new TextDecoder(t?.encoding);return iT(e,e=>n.decode(e,{stream:!0}))})),$ae=a(2,(e,t)=>Jw(ww(e.channel,t))),uT=a(2,(e,t)=>Jw(Tw(e.channel,t))),dT=a(2,(e,t)=>Jw(Dw(e.channel,t))),fT=e=>Kf(jw(e.channel),qn(See(0))),pT=a(2,(e,t)=>Aw(e.channel,e=>{let n=0;return Tf({while:()=>n<e.length,body:()=>t(e[n++]),step:d})})),mT=a(2,(e,t)=>Aw(e.channel,t)),eoe=e=>Mw(e.channel),toe=a(e=>qw(e[0]),(e,t,n)=>{let r,i,a=yS(!1);return new ReadableStream({start(n){i=Ip(pp(mT(e,e=>a.whenOpen(V(()=>{a.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0}))),t)),i.addObserver(e=>{e._tag===`Failure`?n.error(Vl(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return zp(Yf(hS(i)))}},n?.strategy)}),noe=a(e=>qw(e[0]),(e,t)=>Kf(up(),n=>toe(e,n,t))),hT=`~effect/reactivity/Reactivity`,gT=tr(`effect/reactivity/Reactivity`),roe=V(()=>{let e=new Map,t=t=>{xT(t,t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})},n=e=>dp(n=>{let r=gr(n,_T);return r?xT(e,e=>{r.add(e)}):t(e),Af}),r=(e,t)=>Uf(t,n(e)),i=(t,n)=>{let r=[];return xT(t,t=>{r.push(t);let i=e.get(t);i===void 0&&(i=new Set,e.set(t,i)),i.add(n)}),()=>{for(let t=0;t<r.length;t++){let i=e.get(r[t]);i!==void 0&&(i.delete(n),i.size===0&&e.delete(r[t]))}}},a=(e,t)=>H(function*(){let n=yield*up(),r=yr(n,yu),a=yield*qS(),o=p(Lp(n),vS(r)),s=!1,c=!1,l=e=>{e._tag===`Failure`?tC(a,e.cause):ZS(a,e.value),c?(c=!1,o(t).addObserver(l)):s=!1};function u(){if(s){c=!0;return}s=!0,o(t).addObserver(l)}return yield*Cu(r,V(i(e,u))),u(),a}),o=(e,t)=>a(e,t).pipe(Kf(nT),rT),s=t=>kf(()=>{let n=new Set;return t.pipe(hp(_T,n),Cp(t=>V(()=>{n.forEach(t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})})))});return gT.of({[hT]:hT,mutation:r,query:a,stream:o,invalidateUnsafe:t,invalidate:n,registerUnsafe:i,withBatch:s})}),_T=class extends tr()(`effect/reactivity/Reactivity/PendingInvalidation`){},ioe=a(2,(e,t)=>gT.use(n=>n.mutation(t,e))),vT=e=>gT.use(t=>t.invalidate(e)),yT=Uu(gT)(roe);function bT(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return z(e)}}var xT=(e,t)=>{if(Array.isArray(e)){for(let n=0;n<e.length;n++)t(bT(e[n]));return}for(let n in e){t(n);let r=e[n];for(let e=0;e<r.length;e++)t(`${n}:${bT(r[e])}`)}},ST=a(2,(e,t)=>e===void 0?void 0:t(e)),aoe=a(2,(e,{onDefined:t,onUndefined:n})=>e===void 0?n():t(e)),CT=`~effect/persistence/KeyValueStore`,wT=`~effect/persistence/KeyValueStore/KeyValueStoreError`,TT=class extends ra(`KeyValueStoreError`){[wT]=wT},ET=tr(`effect/persistence/KeyValueStore`),ooe=e=>ET.of({[CT]:CT,has:t=>Kf(e.get(t),k),isEmpty:Kf(e.size,e=>e===0),modify:(t,n)=>Bf(e.get(t),r=>{if(r===void 0)return jf;let i=n(r);return qf(e.set(t,i),i)}),modifyUint8Array:(t,n)=>Bf(e.getUint8Array(t),r=>{if(r===void 0)return jf;let i=n(r);return qf(e.set(t,i),i)}),...e}),soe=e=>{let t=new TextEncoder;return ooe({...e,getUint8Array:n=>e.get(n).pipe(Kf(ST(e=>Fr(pm(e),{onFailure:()=>t.encode(e),onSuccess:o})))),set:(t,n)=>typeof n==`string`?e.set(t,n):kf(()=>e.set(t,fm(n)))})},DT=`~effect/persistence/KeyValueStore/SchemaStore`,OT=(e,t)=>{let n=xx(Vx(t)),r=yb(n),i=Cb(n),a=t=>Bf(e.get(t),aoe({onUndefined:()=>Of,onDefined:e=>Jf(r(e))})),o=(t,n)=>Bf(i(n),n=>e.set(t,n)),s=(e,t)=>Bf(a(e),n=>{if(Rn(n))return Of;let r=t(n.value);return qf(o(e,r),Ln(r))});return{[DT]:DT,get:a,set:o,modify:s,remove:e.remove,clear:e.clear,size:e.size,has:e.has,isEmpty:e.isEmpty}},coe=e=>Vu(ET)(()=>{let t=e();return soe({get:e=>Lf({try:()=>t.getItem(e)??void 0,catch:t=>new TT({key:e,method:`get`,message:`Unable to get item with key ${e}`,cause:t})}),set:(e,n)=>Lf({try:()=>t.setItem(e,n),catch:t=>new TT({key:e,method:`set`,message:`Unable to set item with key ${e}`,cause:t})}),remove:e=>Lf({try:()=>t.removeItem(e),catch:t=>new TT({key:e,method:`remove`,message:`Unable to remove item with key ${e}`,cause:t})}),clear:Lf({try:()=>t.clear(),catch:e=>new TT({method:`clear`,message:`Unable to clear storage`,cause:e})}),size:Lf({try:()=>t.length,catch:e=>new TT({method:`size`,message:`Unable to get size`,cause:e})})})}),kT=`~effect/SubscriptionRef`,AT=e=>F(e,kT),loe={...yt,[kT]:{_A:o},toJSON(){return{_id:`SubscriptionRef`,value:this.value}}},jT=e=>Kf(tae({replay:1}),t=>{let n=Object.create(loe);return n.semaphore=TC(1),n.value=e,n.pubsub=t,NS(n.pubsub,e),n}),MT=e=>zae(e.pubsub),NT=e=>V(()=>e.value),PT=(e,t)=>{e.value=t,NS(e.pubsub,t)},FT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>{let[n,r]=t(e.value);return PT(e,r),n}))),IT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>PT(e,t)))),LT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>PT(e,t(e.value))))),RT=`~effect/reactivity/AtomRegistry`,zT=e=>F(e,RT),BT=e=>new XT(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),VT=tr(RT),HT=a(2,(e,t)=>Qw(n=>kf(()=>Cu(vr(_S().context,yu),V(e.subscribe(t,e=>ZS(n,e),{immediate:!0})))))),UT=a(e=>zT(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return Mf(n=>{let i=e.get(t);if(i._tag!==`Initial`&&!(r&&i.waiting))return n(lS(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n(lS(e)),a())});return V(a)})}),WT={immediate:!0},GT=e=>{e()},KT={};function qT(e,t){let n=KT;for(let r of e)try{t(r)}catch(e){n===KT&&(n=e)}if(n!==KT)throw n}var JT=`~effect-atom/atom/Atom/Serializable`,YT=e=>JT in e?e[JT].key:e,XT=class{[RT];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[RT]=RT,this.scheduler=new Xi(`sync`,t),this.schedulerAsync=new Xi(`async`,t),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=r,this.timeoutResolution=n===void 0&&r!==void 0?Math.round(r/2):n??1e3,e!==void 0)for(let[t,n]of e){let e=t;for(;e.initialValueTarget;)e=e.initialValueTarget;this.ensureNode(e).setInitialValue(n)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(e){return this.ensureNode(e).value()}set(e,t){e.write(this.ensureNode(e).writeContext,t)}setSerializable(e,t){this.preloadedSerializable.set(e,t)}modify(e,t){let n=this.ensureNode(e),r=t(n.value());return e.write(n.writeContext,r[1]),r[0]}update(e,t){let n=this.ensureNode(e);e.write(n.writeContext,t(n.value()))}refresh=e=>{e.refresh===void 0?this.invalidateAtom(e):e.refresh(this.refresh)};subscribe(e,t,n){let r=this.ensureNode(e);n?.immediate?t(r.value()):r.state===QT.stale&&r.value();let i=r.subscribe(function(){t(r._value)});return()=>{i(),r.canBeRemoved&&this.scheduleNodeRemoval(r)}}mount(e){return this.subscribe(e,d,WT)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=YT(e),n=this.nodes.get(t);if(n===void 0?(n=this.createNode(e),this.nodes.set(t,n),this.onNodeAdded?.(n)):this.atomHasTtl(e)&&this.removeNodeTimeout(n),typeof t==`string`&&this.preloadedSerializable.has(t)){let r=this.preloadedSerializable.get(t);this.preloadedSerializable.delete(t);let i=e[JT].decode(r),a=e;for(;a.initialValueTarget;)a=a.initialValueTarget;a===e?n.setValue(i):this.ensureNode(a).setInitialValue(i)}return n}createNode(e){if(this.disposed)throw Error(`Cannot access Atom ${e}: registry is disposed`);return e.keepAlive||this.scheduleAtomRemoval(e),new $T(this,e)}invalidateAtom=e=>{this.ensureNode(e).invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get(YT(e));t!==void 0&&t.canBeRemoved&&this.removeNode(t)},0)}scheduleNodeRemoval(e){this.dispatcher.scheduleTask(()=>{e.canBeRemoved&&this.removeNode(e)},0)}removeNode(e){this.atomHasTtl(e.atom)?this.setNodeTimeout(e):(this.nodes.delete(YT(e.atom)),e.remove(),this.onNodeRemoved?.(e))}setNodeTimeout(e){if(this.nodeTimeoutBucket.has(e))return;let t=e.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(t-=this.#e,t<=0)){this.nodes.delete(YT(e.atom)),e.remove(),this.onNodeRemoved?.(e);return}let n=Math.ceil(t/this.timeoutResolution)*this.timeoutResolution,r=Date.now()+n,i=r-r%this.timeoutResolution+this.timeoutResolution,a=this.timeoutBuckets.get(i);a===void 0&&(a=[new Set,setTimeout(()=>this.sweepBucket(i),i-Date.now())],this.timeoutBuckets.set(i,a)),a[0].add(e),this.nodeTimeoutBucket.set(e,i)}removeNodeTimeout(e){let t=this.nodeTimeoutBucket.get(e);if(t===void 0)return;this.nodeTimeoutBucket.delete(e),this.scheduleNodeRemoval(e);let[n,r]=this.timeoutBuckets.get(t);n.delete(e),n.size===0&&(clearTimeout(r),this.timeoutBuckets.delete(t))}#e=null;sweepBucket(e){let t=this.timeoutBuckets.get(e)[0];this.timeoutBuckets.delete(e),qT(t,this.removeIdleNode)}removeIdleNode=e=>{if(this.nodeTimeoutBucket.delete(e),e.canBeRemoved){this.nodes.delete(YT(e.atom)),this.onNodeRemoved?.(e),this.#e=e.atom.idleTTL??this.defaultIdleTTL;try{e.remove()}finally{this.#e=null}}};reset(){this.timeoutBuckets.forEach(([,e])=>clearTimeout(e)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear();let e=Array.from(this.nodes.values());this.nodes.clear();for(let t of e)t.state=QT.removed;qT(e,this.destroyNode)}destroyNode=e=>{e.remove(),this.onNodeRemoved?.(e)};dispose(){this.disposed=!0,this.reset()}},ZT={alive:1,initialized:2,waitingForValue:4},QT={uninitialized:ZT.alive|ZT.waitingForValue,stale:ZT.alive|ZT.initialized|ZT.waitingForValue,valid:ZT.alive|ZT.initialized,removed:0},$T=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new nE(e,this)}registry;atom;state=QT.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;invalidatedDuringBuild=!1;failed=!1;parents=new Set;children=new Set;listeners=new Set;observedChildren=0;currentState(){switch(this.state){case QT.uninitialized:return`uninitialized`;case QT.stale:return`stale`;case QT.valid:return`valid`;default:return`removed`}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}get building(){return this.lifetime!==void 0&&this.lifetime.reads!==void 0}get isObserved(){return!this.atom.lazy||this.listeners.size>0||this.observedChildren>0}childObserved(e){let t=this.isObserved;this.observedChildren+=e,t!==this.isObserved&&this.observedChanged(e)}observedChanged(e){for(let t of this.parents)t.childObserved(e)}_value=void 0;value(){for(;(this.state&ZT.waitingForValue)!==0;)this.build();return this._value}build(){this.disposeLifetime(),this.invalidatedDuringBuild=!1;let e=tE(this);this.lifetime=e;let t,n=!1;try{t=this.atom.read(e),n=!0}finally{let t=e.reads;e.reads=void 0,this.lifetime===e&&(this.dropUnread(t),n||this.fail())}if(this.lifetime===e&&(this.state&ZT.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.failed=!1,this.state=QT.valid):this.setValue(t)),e.failure!==KT)throw e.failure}fail(){this.failed=!0;try{this.invalidateChildren()}catch{}}readTracked(e,t){let n=this.registry.ensureNode(e);this.parents.has(n)||(this.parents.add(n),n.children.add(this),this.isObserved&&n.childObserved(1));try{return n.value()}catch(e){if(t.reads===void 0||n.state!==QT.valid)throw e;return t.failure===KT&&(t.failure=e),n._value}finally{t.reads!==void 0&&!t.disposed&&t.reads.add(n)}}dropUnread(e){if(e.size===this.parents.size)return;let t=this.isObserved;for(let n of this.parents)e.has(n)||(this.parents.delete(n),n.children.delete(this),t&&n.childObserved(-1),n.canBeRemoved&&this.registry.scheduleNodeRemoval(n))}valueOption(){return(this.state&ZT.initialized)===0?In():Ln(this._value)}setInitialValue(e){if((this.state&ZT.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=QT.stale,this._value=e,this.listeners.size>0&&this.announce();return}this.setValue(e)}setValue(e){let t=this.failed;this.failed=!1;let n=(this.state&ZT.initialized)!==0;if(this.state=QT.valid,n&&this.atom.equals(this._value,e)){t&&this.invalidateChildren();return}this._value=e;let r=KT;try{this.invalidateChildren()}catch(e){r=e}if(this.listeners.size>0)try{this.announce()}catch(e){r===KT&&(r=e)}if(r!==KT)throw r}announce(){iE.phase===rE.collect?iE.notify.add(this):this.notify()}invalidate(){if(this.state===QT.valid){this.state=QT.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&iE.phase!==rE.collect?this.build():this.propagate()}propagate(){iE.phase===rE.collect?(this.building&&(this.invalidatedDuringBuild=!0),iE.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let e=KT;for(let t of Array.from(this.children))if(t.affectedBy(this))try{t.invalidate()}catch(t){e===KT&&(e=t)}if(e!==KT)throw e}affectedBy(e){if(this.state===QT.valid)return!0;let t=this.lifetime?.reads;return t===void 0?this.isObserved&&e.state===QT.valid:t.has(e)}notify(){iE.phase===rE.commit&&iE.notify.delete(this),qT(this.listeners,GT)}disposeLifetime(){let e=this.lifetime;e!==void 0&&(this.lifetime=void 0,e.dispose())}remove(){let e=this.isObserved;this.state=QT.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let t=Array.from(this.parents);this.parents.clear(),qT(t,t=>{t.children.delete(this),e&&t.childObserved(-1),t.canBeRemoved&&this.registry.removeNode(t)})}}subscribe(e){let t=this.isObserved;return this.listeners.add(e),t||this.observedChanged(1),()=>{this.listeners.delete(e)&&!this.isObserved&&this.observedChanged(-1)}}},eE={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){return this.disposed?this.node.registry.get(e):this.node.readTracked(e,this)},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return Nf;switch(n._tag){case`Initial`:return Nf;case`Failure`:return ru(n.cause);case`Success`:return B(n.value)}},resultOnce(e,t){return Mf(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n(lS(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n(lS(e)))},{immediate:!1});return V(i)})},setResult(e,t){return this.disposed?Nf:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag===`None`?Nf:B(t.value)},someOnce(e){return Mf(t=>{let n=this.once(e);if(zn(n))return t(B(n.value));let r=this.node.registry.subscribe(e,e=>{Rn(e)||(r(),t(B(e.value)))},{immediate:!1});return V(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?In():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?$w:Qw(n=>V(()=>{this.subscribe(e,e=>ZS(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(lT(Xx),aT(e=>e._tag===`Success`?B(e.value):Pf(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,qT(e.reverse(),GT)}},tE=e=>{function t(n){return t.disposed||t.isFn?e.registry.get(n):e.readTracked(n,t)}return Object.setPrototypeOf(t,eE),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=KT,t},nE=class{constructor(e,t){this.registry=e,this.node=t}registry;node;get(e){return this.registry.get(e)}set(e,t){return this.registry.set(e,t)}setSelf(e){return this.node.setValue(e)}refreshSelf(){return this.node.invalidate()}},rE={disabled:0,collect:1,commit:2},iE={phase:rE.disabled,depth:0,stale:[],notify:new Set};function aE(e){let t=iE.phase;iE.phase=rE.collect,iE.depth++;let n=KT;try{e()}catch(e){n=e}if(iE.depth===1){let{notify:e,stale:t}=iE,r=0;do{for(iE.phase=rE.collect;r<t.length;r++)try{oE(t[r])}catch(e){n===KT&&(n=e)}iE.phase=rE.commit;for(let t of e)try{t.notify()}catch(e){n===KT&&(n=e)}}while(r<t.length);iE.stale=[],e.clear()}if(iE.depth--,iE.phase=t,n!==KT)throw n}function oE(e){if(e.state===QT.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=QT.stale,e.disposeLifetime()}e.value()}var sE=`~effect/reactivity/Atom`,cE=e=>F(e,sE),lE=`~effect/reactivity/Atom/Writable`,uE=a(2,(e,t)=>{let n=pi(t),r=xi(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Fi(n):void 0})}),dE=uE(0),fE={[sE]:sE,equals:Object.is,...yt,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},pE={...fE,atom(e,t){let n=xE(e,t);return _E(e=>{let t=e.self(),r=e(this);return r._tag===`Success`?n(e,r.value):oS(r,t)})},fn(e,t){return arguments.length===0?(e,t)=>mE(this,e,t):mE(this,e,t)},pull(e,t){let n=dE(wE(0));return HE(n,_E(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?EE(r,VE(r,n,e,t),Zx(!0),a.value):oS(a,i)}))},subscriptionRef(e){return NE(dE(_E(t=>{let n=t.self(),r=t(this);if(r._tag!==`Success`)return oS(r,n);let i=typeof e==`function`?e(t):e;return AT(i)?i:EE(t,i,Zx(!0),r.value)})),(e,t)=>ME(e,t,cS(e(this))))}},mE=(e,t,n)=>{let[r,i,a]=BE(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return Sf(i)?ioe(i,n.reactivityKeys):uT(i,vT(n.reactivityKeys))}:t,n);return vE(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):oS(i,n)},i)},hE={...fE,[lE]:lE},gE=e=>lE in e,_E=(e,t)=>{let n=Object.create(fE);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},vE=(e,t,n)=>{let r=Object.create(hE);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function yE(e,t){e.setSelf(t)}var bE=(e,t)=>{let n=xE(e,t);return`~effect/reactivity/Atom`in n?n:_E(n)},xE=(e,t)=>{if(typeof e==`function`&&!Sf(e)&&!qw(e)){let n=e;return function(e,r){let i=n(e);switch(typeof i){case`function`:case`object`:return i===null?i:SE in i?TE(e,i,t,r):CE in i?AE(e,i,t,r):i;default:return i}}}return Sf(e)?function(n,r){return TE(n,e,t,r)}:qw(e)?function(n,r){return AE(n,e,t,r)}:wE(e)},SE=`~effect/Effect`,CE=`~effect/Stream`,wE=e=>vE(function(t){return e},yE),TE=(e,t,n,r)=>EE(e,t,n?.initialValue===void 0?Zx():$x(n.initialValue),r,n?.uninterruptible);function EE(e,t,n,r=pr(),i=!1){let a=e.self(),o=bu();e.addFinalizer(()=>{Lp(r)(Eu(o,su))});let s,c=!1,l=DE(r.pipe(hr(yu,o),hr(VT,e.registry),hr(Gi,e.registry.scheduler)),t,function(t){s=qx(t,a),c&&e.setSelf(s)},i);return c=!0,l!==void 0&&e.addFinalizer(l),s===void 0?a._tag===`Some`?Jx(a):iS(n):s}function DE(e,t,n,r=!1){if(tu(t)){n(t);return}let i=Lp(e)(t);i.currentDispatcher?.flush();let a=i.pollUnsafe();if(a){n(a);return}let o=i.addObserver(n);function s(){o(),r||i.interruptUnsafe()}return s}function OE(e){let t=e?.memoMap??dE(bE(()=>Nu())),n=e=>cE(t)?e(t):t,r=yT;function i(e){let t=Object.create(pE);t.keepAlive=!1,t.lazy=!0,t.refresh=void 0,t.factory=i;let a=WE(_E(typeof e==`function`?t=>Qu(e(t),r):()=>Qu(e,r)));return t.layer=a,t.read=function(e){let t=e(a);return TE(e,Bf(gp,r=>Fu(t,n(e),r)),{uninterruptible:!0})},t}i.memoMap=t,i.addGlobalLayer=e=>{r=Qu(r,Zu(e,yT))};let a=dE(bE(e=>dp(t=>Fu(yT,n(e),yr(t,yu))).pipe(Kf(yr(gT)))));return i.withReactivity=e=>t=>GE(t,n=>{let r=cS(n(a));return n.addFinalizer(r.registerUnsafe(e,()=>{n.refresh(t)})),n.subscribe(t,e=>n.setSelf(e)),n.once(t)},{initialValueTarget:t}),i}var kE=OE();kE.withReactivity;var AE=(e,t,n,r)=>jE(e,t,n?.initialValue===void 0?Zx():$x(n.initialValue),r);function jE(e,t,n,r=pr()){let i=e.self();r=hr(r,VT,e.registry);let a=yne(n=>Bf(Nw(t.channel,n),t=>Tf({while:c,body:()=>t,step(t){e.setSelf($x(Cee(t),{waiting:!0}))}}))).pipe(Qf(t=>(Yd(t)?f(e.self(),Jn(sS),Bn({onNone:()=>e.setSelf(rS(new Jl,{previous:e.self()})),onSome:t=>e.setSelf($x(t))})):e.setSelf(nS(t,{previous:e.self()})),Af))),o=DE(r.pipe(hr(VT,e.registry),hr(Gi,e.registry.scheduler)),a,d,!1);return o!==void 0&&e.addFinalizer(o),i._tag===`Some`?Jx(i):iS(n)}var ME=(e,t,n=pr())=>AT(t)?(e.addFinalizer(MT(t).pipe(mT(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return Af}),Rp(n))),Hp(n)(NT(t))):t._tag===`Success`?jE(e,MT(t.value),Zx(!0),n):t,NE=(e,t)=>{function n(t,n){let r=t.get(e);AT(r)?Vp(IT(r,n)):Qx(r)&&Vp(IT(r.value,n))}return vE(n=>{let r=n(e);return AT(r)||Qx(r)?t(n,r):r},n)},PE=function(...e){return e.length===0?FE:FE(...e)},FE=(e,t)=>{let n=dE(wE([0,void 0])),r=t?.initialValue!==void 0;return vE(function(i){i.isFn=!0;let[a,o]=i.get(n);return a===0?r?t.initialValue:In():r?e(o,i):Ln(e(o,i))},function(e,t){eD(()=>{e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})})},IE=Symbol.for(`effect/reactivity/atom/Atom/Reset`),LE=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`),RE=function(...e){return e.length===0?zE:zE(...e)},zE=(e,t)=>{let[n,r]=BE(e,t);return vE(n,r)};function BE(e,t){let n=dE(wE([0,void 0])),r=t?.initialValue===void 0?Zx():$x(t.initialValue),i=t?.concurrent?dE(_E(e=>{let t=new Set;return e.addFinalizer(()=>t.forEach(e=>e.interruptUnsafe())),t})):void 0;function a(t,a){let o=i?t(i):void 0;t.isFn=!0;let[s,c]=t.get(n);if(s===0)return r;if(c===LE)return nS(Il(),{previous:t.self()});let l=e(c,t);return SE in l?(o&&(l=Bf(Sne(l,{startImmediately:!0}),e=>{o.add(e);let t=Array.from(o);return e.addObserver(()=>o.delete(e)),Kf(mS(t),e=>e[0])})),EE(t,l,r,a,!1)):jE(t,l,r,a)}function o(e,t){eD(()=>{t===IE?e.set(n,[0,void 0]):t===LE?e.set(n,[e.get(n)[0]+1,LE]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var VE=(e,t,n,r)=>Bf(eoe(typeof n==`function`?n(e):n),n=>{let i=_S().context,a=ei(),o=lp(n,{onFailure(e){return Yd(e)?Qr(a)?B({done:!0,items:a}):U(new Jl(`Atom.pull: no items`)):Pf(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=Xr(a,e),a=t),B({done:!1,items:t})}}),s=new Set;return e.addFinalizer(()=>{for(let e of s)e()}),e.once(t),e.subscribe(t,()=>{e.setSelf(Jx(e.self()));let t;t=DE(i,o,n=>{t&&s.delete(t);let r=qx(n,e.self()),i=s.size>0;e.setSelf(i?iS(r):r)}),t&&s.add(t)}),o}),HE=(e,t)=>vE(t.read,function(t,n){t.set(e,t.get(e)+1)}),X=typeof WeakRef>`u`||typeof FinalizationRegistry>`u`?e=>{let t=Fw();return function(n){let r=Iw(t,n);if(r._tag===`Some`)return r.value;let i=e(n);return Rw(t,n,i),i}}:e=>{let t=Fw(),n=new FinalizationRegistry(e=>{let n=Iw(t,e);n._tag===`Some`&&n.value.deref()===void 0&&zw(t,e)});return function(r){let i=Iw(t,r).pipe(Yn(e=>e.deref()));if(i._tag===`Some`)return i.value;let a=e(r);return Rw(t,r,new WeakRef(a)),n.register(a,r),a}},UE=a(2,(e,t)=>{function n(n){let r=n(e);return r._tag===`Initial`?iS(n(t)):r}return gE(e)?vE(n,function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):_E(n,e.refresh??function(t){t(e)})}),WE=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),GE=a(e=>cE(e[0]),(e,t,n)=>{let r=dE(gE(e)?vE(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):_E(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=KE(n.initialValueTarget)),r}),KE=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},qE=a(2,(e,t)=>GE(e,n=>t(n(e)))),JE=a(2,(e,t)=>{let n=Fi(pi(t));return GE(e,function(t){let r=setTimeout(()=>t.refresh(e),n);return t.addFinalizer(()=>clearTimeout(r)),t(e)},{initialValueTarget:e})}),YE=a(2,(e,t)=>{let n=Fi(pi(t.staleTime));return GE(e,r=>{let i=r.once(e);if(r.subscribe(e,e=>{r.setSelf(e)}),t.revalidateOnFocus&&t.focusSignal&&(r.once(t.focusSignal),r.subscribe(t.focusSignal,t.revalidateOnFocus===`always`?()=>r.refresh(e):()=>{QE(r.once(e),n)&&r.refresh(e)})),Rn(r.self())&&t.revalidateOnMount===!1)return i;if(QE(i,n)){let t=!0;r.addFinalizer(()=>{t=!1}),r.registry.schedulerAsync.makeDispatcher().scheduleTask(()=>{t&&QE(r.once(e),n)&&r.refresh(e)},0)}return i},{initialValueTarget:e})}),XE=e=>e._tag===`Success`?Ln(e.timestamp):e._tag===`Failure`?qn(e.previousSuccess,e=>e.timestamp):In(),ZE=(e,t,n)=>n-e<t,QE=(e,t)=>{if(e.waiting)return!1;let n=Un(XE(e));return n===void 0?e._tag!==`Initial`:!ZE(n,t,Date.now())},$E=e=>{let t=0,n=dE(wE([t,void 0]));return vE(t=>{let r=t.once(e),i=!1;t.subscribe(e,e=>{if(r=e,a.size>0)return;if(i=!1,!Wx(e))return t.setSelf(e);let n=Un(t.self());switch(e._tag){case`Initial`:Yx(n)&&t.setSelf(e);return;case`Success`:Qx(n)?!e.waiting&&e.timestamp>=n.timestamp&&t.setSelf(e):t.setSelf(e);return;case`Failure`:return t.setSelf(e)}});let a=new Set,o=new Set;return t.subscribe(n,([,n])=>{if(a.has(n))return;a.add(n);let s;s=t.registry.subscribe(n,c=>{if(Qx(c)&&c.waiting)return t.setSelf(c.value);a.delete(n),s&&(o.delete(s),s()),!i&&!eS(c)&&(i=!0),a.size===0&&(i?(i=!1,t.refresh(e)):t.setSelf(r))},{immediate:!0}),a.has(n)?o.add(s):s()}),t.addFinalizer(()=>{for(let e of o)e();a.clear(),o.clear()}),r},(e,r)=>e.set(n,[++t,r]),t=>t(e))},eD=aE,tD=(e=>t=>GE(t,n=>(n.once(e),n.subscribe(e,e=>n.refresh(t)),n.subscribe(t,e=>n.setSelf(e)),n.once(t)),{initialValueTarget:t}))(_E(e=>{let t=0;function n(){document.visibilityState===`visible`&&e.setSelf(++t)}return window.addEventListener(`visibilitychange`,n),e.addFinalizer(()=>{window.removeEventListener(`visibilitychange`,n)}),t})),nD=e=>{let t=e.runtime.fn(t=>ET.use(n=>OT(n,e.schema).set(e.key,t))),n=e.runtime.atom(ET.use(t=>OT(t,e.schema).get(e.key)));return vE(e.mode===`async`?r=>{r.mount(t);let i=uS(Vn(()=>{let n=e.defaultValue();return r.set(t,n),n}));return r.subscribe(n,e=>r.setSelf(i(e))),i(r.once(n))}:r=>(r.mount(t),r.subscribe(n,n=>{if(Qx(n)){if(zn(n.value))r.setSelf(n.value.value);else{let n=Vn(r.self(),e.defaultValue);r.setSelf(n),r.set(t,n)}}},{immediate:!0}),Vn(r.self(),e.defaultValue)),(n,r)=>{n.set(t,r),n.setSelf(e.mode===`async`?$x(r):r)})},rD=e=>Kf(VT,t=>t.refresh(e)),iD=`~effect-atom/atom/Atom/ServerValue`,aD=a(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[iD](e=>t.get(e)):t.get(e)),oD=(e,t)=>()=>{let n=yb(Vb(e),t);return NC((e,t)=>B(Bf(e,e=>n(e))))},sD=`~effect/encoding/Sse/SseError`,cD=class extends ra(`EventTooLarge`){get message(){return`Pending SSE event exceeded the maximum size of ${this.maxEventSize}`}},lD=class extends ra(`SseError`){[sD]=sD;get message(){return this.reason.message}},uD=10485760,dD=e=>NC((t,n)=>V(()=>{let n=[],r,i=pD(e=>{e._tag===`Retry`?r=e:n.push(e)},e),a=Bf(t,e=>{for(let t=0;t<e.length;t++){let n=i.feed(e[t]);if(n!==void 0)return U(n)}return Af});return kf(function e(){if(Zr(n)){let e=n;return n=[],B(e)}return r?U(r):Bf(a,e)})})),fD=(e,t,n)=>xw(dD(t),oD(hD.pipe(qb(e,gD)),n)());function pD(e,t){let n=t?.maxEventSize??uD,r,i,a,o,s,c,l,u;return d(),{feed:f,reset:d};function d(){r=!0,i=``,a=0,o=-1,s=!1,c=void 0,l=void 0,u=``}function f(e){i=i?i+e:e,r&&i.startsWith(mD)&&(i=i.slice(mD.length)),r=!1;let t=i.length,c=0;for(;c<t;){s&&=(i[c]===`
|
|
15
|
+
`&&++c,!1);let e=-1,n=o,r;for(let o=c+a;e<0&&o<t;++o)r=i[o],r===`:`&&n<0?n=o-c:r===`\r`?(s=!0,e=o-c):r===`
|
|
16
|
+
`&&(e=o-c);if(e<0){a=t-c,o=n;break}a=0,o=-1,p(i,c,n,e),c+=e+1}if(c===t?i=``:c>0&&(i=i.slice(c)),i.length+u.length>n){let e=new lD({reason:new cD({maxEventSize:n})});return d(),e}}function p(t,n,r,i){if(i===0){u.length>0&&(e({_tag:`Event`,id:c,event:l||`message`,data:u.slice(0,-1)}),u=``),l=void 0;return}let a=r<0,o=t.slice(n,n+(a?i:r)),s=0;s=a?i:t[n+r+1]===` `?r+2:r+1;let d=n+s,f=i-s,p=t.slice(d,d+f).toString();o===`data`?u+=p?`${p}\n`:`
|
|
17
|
+
`:o===`event`?l=p:o===`id`&&!p.includes(`\0`)?c=p:o===`retry`&&/^\d+$/.test(p)&&e(new vD({duration:ki(parseInt(p,10)),lastEventId:c}))}}var mD=``,hD=q({_tag:Qb(`Event`),id:Kb(K),event:K,data:K}),gD=l_({decode:e=>e.id===void 0?{event:e.event,data:e.data}:{id:e.id,event:e.event,data:e.data},encode:e=>({_tag:`Event`,id:e.id,event:e.event??`message`,data:e.data})}),_D=`~effect/encoding/Sse/Retry`,vD=class e extends ta(`Retry`){[_D]=_D;static is(e){return F(e,_D)}static filter(t){return e.is(t)?kr(t):Ar(t)}},yD=`~effect/http/HttpBody`,bD=e=>F(e,yD),xD=class{[yD];constructor(){this[yD]=yD}[Ze](){return this.toJSON()}toString(){return Ue(this,{ignoreToString:!0})}},SD=new class extends xD{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},CD=class extends xD{_tag=`Uint8Array`;contentType;contentLength;text;_body;constructor(e,t,n,r){super(),this._body=e,this.text=r,this.contentType=t,this.contentLength=n}get body(){return this._body??=DD(this.text)}toJSON(){return{_id:`effect/HttpBody`,_tag:`Uint8Array`,body:this.contentType.startsWith(`text/`)||this.contentType.endsWith(`json`)?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}},wD=(e,t)=>new CD(e,t??`application/octet-stream`,e.length),TD=new TextEncoder,ED=globalThis.Buffer,DD=ED===void 0?e=>TD.encode(e):e=>ED.from(e,`utf8`),OD=(e,t)=>{if(typeof e!=`string`&&(e=e===void 0?``:String(e)),ED!==void 0)return new CD(void 0,t??`text/plain`,ED.byteLength(e,`utf8`),e);let n=TD.encode(e);return new CD(n,t??`text/plain`,n.length,e)},kD=(e,t)=>OD(Wh(Ih(e)),t??`application/x-www-form-urlencoded`),AD=class extends xD{_tag=`FormData`;contentType=void 0;contentLength=void 0;formData;constructor(e){super(),this.formData=e}toJSON(){return{_id:`effect/HttpBody`,_tag:`FormData`,formData:this.formData}}},jD=e=>new AD(e),MD={"~effect/Ref":{_A:o},...yt,toJSON(){return{_id:`Ref`,ref:this.ref}}},ND=e=>{let t=Object.create(MD);return t.ref=CS(e),t},PD=e=>V(()=>ND(e)),FD=e=>V(()=>e.ref.current),ID=a(2,(e,t)=>V(()=>wS(e.ref,t))),LD=a(2,(e,t)=>V(()=>{let n=e.ref.current;return e.ref.current=t,n})),RD=a(2,(e,t)=>V(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),zD=a(2,(e,t)=>V(()=>{e.ref.current=t(e.ref.current)})),BD=`~effect/http/HttpClientError`,VD=e=>F(e,BD),HD=class extends ra(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[BD]=BD;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},UD=e=>e.endsWith(`Error`)?e.slice(0,-5):e,WD=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,GD=class extends ra(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return WD(UD(this._tag),this.description,this.methodAndUrl)}},KD=class extends ra(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return WD(UD(this._tag),this.description,this.methodAndUrl)}},qD=class extends ra(`StatusCodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return WD(UD(this._tag),this.description,e)}},JD=class extends ra(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return WD(UD(this._tag),this.description,e)}},YD=class extends ra(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return WD(UD(this._tag),this.description,e)}},XD=class e extends Bx(BD)({_tag:Qb(`HttpError`),kind:Wb([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:W(vx())}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}},ZD=e=>e!==`GET`&&e!==`HEAD`&&e!==`OPTIONS`&&e!==`TRACE`,QD=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],$D=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?Oh(Oh(e,`content-type`),`content-length`):(e=t.contentType===void 0?Oh(e,`content-type`):Th(e,`content-type`,t.contentType),t.contentLength===void 0?Oh(e,`content-length`):Th(e,`content-length`,t.contentLength.toString())),eO=class extends ra(`UrlError`){},tO=(e,t,n)=>jr({try:()=>{let r=new URL(e,nO());for(let e=0;e<t.params.length;e++){let[n,i]=t.params[e];i!==void 0&&r.searchParams.append(n,i)}return n!==void 0&&(r.hash=n),r},catch:e=>new eO({cause:e})}),nO=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},rO=`~effect/http/HttpClientRequest`,iO={[rO]:rO,...et,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:Re(this.headers),body:this.body.toJSON()}},pipe(){return n(this,arguments)}};function aO(e,t,n,r,i,a){let o=Object.create(iO);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var oO=aO(`GET`,``,Bh,In(),Sh,SD),sO=e=>(t,n)=>lO(oO,{method:e,url:t,...n??void 0}),cO=sO(`GET`),lO=a(2,(e,t)=>{let n=e;return t.method&&(n=uO(n,t.method)),t.url&&(n=hO(n,t.url)),t.headers&&(n=fO(n,t.headers)),t.urlParams&&(n=vO(n,t.urlParams)),t.hash&&(n=bO(n,t.hash)),t.body&&(n=xO(n,t.body)),t.accept&&(n=pO(n,t.accept)),t.acceptJson&&(n=mO(n)),n}),uO=a(2,(e,t)=>aO(t,e.url,e.urlParams,e.hash,e.headers,e.body)),dO=a(3,(e,t,n)=>aO(e.method,e.url,e.urlParams,e.hash,Th(e.headers,t,n),e.body)),fO=a(2,(e,t)=>aO(e.method,e.url,e.urlParams,e.hash,Eh(e.headers,t),e.body)),pO=a(2,(e,t)=>dO(e,`Accept`,t)),mO=pO(`application/json`),hO=a(2,(e,t)=>{if(typeof t==`string`)return aO(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=Ih(n.searchParams),i=Hn(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,aO(e.method,n.toString(),r,i,e.headers,e.body)}),gO=a(2,(e,t)=>t===``?e:aO(e.method,_O(t,e.url),e.urlParams,e.hash,e.headers,e.body)),_O=(e,t)=>{let n=e.endsWith(`/`),r=t.startsWith(`/`);return n&&r?e+t.slice(1):!n&&!r?e+`/`+t:e+t},vO=a(2,(e,t)=>aO(e.method,e.url,Hh(e.urlParams,t),e.hash,e.headers,e.body)),yO=a(2,(e,t)=>aO(e.method,e.url,Uh(e.urlParams,t),e.hash,e.headers,e.body)),bO=a(2,(e,t)=>aO(e.method,e.url,e.urlParams,Ln(t),e.headers,e.body)),xO=a(2,(e,t)=>aO(e.method,e.url,e.urlParams,e.hash,$D(e.headers,t),t)),SO=a(2,(e,t)=>xO(e,jD(t)));function CO(e){let t=tO(e.url,e.urlParams,Un(e.hash));return Nr(t)?Ln(t.success):In()}var wO=`~effect/http/HttpIncomingMessage`,TO=(e,t)=>{let n=e.headers[`content-type`]??``,r;if(n.includes(`application/json`))try{r=Vp(e.json)}catch{}else if(n.includes(`text/`)||n.includes(`urlencoded`))try{r=Vp(e.text)}catch{}let i={...t,headers:Re(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(i.body=r),i},EO=`~effect/http/HttpClientResponse`,DO=(e,t)=>new OO(e,t),OO=class extends tt{[wO];[EO];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[wO]=wO,this[EO]=EO}toJSON(){return TO(this,{_id:`HttpClientResponse`,request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get url(){if(this.source.url)return this.source.url.split(`#`)[0];let e=CO(this.request);return Rn(e)?``:(e.value.hash=``,e.value.href)}get headers(){return Ch(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=ah(this.source.headers.getSetCookie())}get remoteAddress(){return In()}get stream(){return this.source.body?Bae({evaluate:()=>this.source.body,onError:e=>new HD({reason:new JD({request:this.request,response:this,cause:e})})}):Iae(new HD({reason:new YD({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return Bf(this.text,e=>Lf({try:()=>e===``?null:JSON.parse(e),catch:e=>new HD({reason:new JD({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody??=Kf(this.arrayBuffer,e=>new TextDecoder().decode(e))}get urlParamsBody(){return Bf(this.text,e=>Lf({try:()=>Ih(new URLSearchParams(e)),catch:e=>new HD({reason:new JD({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=Df({try:()=>this.source.formData(),catch:e=>new HD({reason:new JD({request:this.request,response:this,cause:e})})}).pipe(wp,Vp)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=Df({try:()=>this.source.arrayBuffer(),catch:e=>new HD({reason:new JD({request:this.request,response:this,cause:e})})}).pipe(wp,Vp),this.arrayBufferBody}pipe(){return n(this,arguments)}},kO=e=>wh({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${Bn(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),AO=`~effect/http/HttpClient`,jO=tr(`effect/HttpClient`),MO=a(2,(e,t)=>NO(n=>t(e.postprocess(n)),e.preprocess)),NO=(e,t)=>{let n=Object.create(PO);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},PO={[AO]:AO,pipe(){return n(this,arguments)},...et,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(QD.map(([e,t])=>[t,function(t,n){return this.execute(sO(e)(t,n))}]))},FO=e=>NO(t=>Bf(t,t=>zf(n=>{let r=UO.get(t),i=r??new AbortController,a=tO(t.url,t.urlParams,Un(t.hash));if(Mr(a))return U(new HD({reason:new KD({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(ha)||n.getRef(LO)(t)){let a=e(t,o,i.signal,n);return r?a:kp(e=>lp(e(a),{onSuccess(e){return HO.register(e,i),B(new WO(e,i))},onFailure(e){return Wl(e)&&i.abort(),Pf(e)}}))}return jp(n.getRef(BO)(t),{kind:`client`},a=>{a.attribute(`http.request.method`,t.method),a.attribute(`server.address`,o.origin),o.port!==``&&a.attribute(`server.port`,+o.port),a.attribute(`url.full`,o.toString()),a.attribute(`url.path`,o.pathname),a.attribute(`url.scheme`,o.protocol.slice(0,-1));let s=o.search.slice(1);s!==``&&a.attribute(`url.query`,s);let c=n.getRef(jh),l=n.getRef(RO);for(let e in t.headers)l(e,`request`)&&a.attribute(`http.request.header.${e}`,Ah(e,c)?`<redacted>`:t.headers[e]);return t=n.getRef(zO)?fO(t,kO(a)):t,kp(s=>s(e(t,o,i.signal,n)).pipe(Mp(a,{captureStackTrace:!1}),lp({onSuccess:e=>{a.attribute(`http.response.status_code`,e.status);for(let t in e.headers)l(t,`response`)&&a.attribute(`http.response.header.${t}`,Ah(t,c)?`<redacted>`:e.headers[t]);return r?B(e):(HO.register(e,i),B(new WO(e,i)))},onFailure(e){return!r&&Wl(e)&&i.abort(),Pf(e)}})))})})),B),IO=a(2,(e,t)=>NO(e.postprocess,n=>Kf(e.preprocess(n),t))),LO=Er(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>l}),RO=Er(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>c}),zO=Er(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:c}),BO=Er(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),VO=e=>Uu(jO)(dp(t=>Kf(e,e=>MO(e,mp(e=>wr(t,e)))))),HO=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{e.abort()});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new Map;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),UO=new WeakMap,WO=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[EO]=EO;[wO]=wO;applyInterrupt(e){return kf(()=>(HO.unregister(this.original),Dp(e,()=>V(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return tT(()=>(HO.unregister(this.original),uT(this.original.stream,V(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Ze](){return this.original[Ze]()}pipe(){return n(this,arguments)}};({...yt});var GO=`~effect/socket/Socket`,KO=tr(`effect/socket/Socket`),qO=e=>KO.of({[GO]:GO,reader:e.reader,writer:e.writer}),JO=new TextEncoder,YO=`~effect/socket/Socket/CloseEvent`,XO=e=>F(e,YO),ZO=`~effect/socket/Socket/SocketError`,QO=e=>F(e,ZO),$O=class extends Bx(`effect/socket/Socket/SocketReadError`)({_tag:Qb(`SocketReadError`),cause:vx()}){message=`An error occurred during Read`},ek=class extends Bx(`effect/socket/Socket/SocketWriteError`)({_tag:Qb(`SocketWriteError`),cause:vx()}){message=`An error occurred during Write`},tk=class extends Bx(`effect/socket/Socket/SocketOpenError`)({_tag:Qb(`SocketOpenError`),kind:Wb([`Unknown`,`Timeout`]),cause:vx()}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},nk=class e extends Bx(`effect/socket/Socket/SocketUpgradeError`)({_tag:Qb(`SocketUpgradeError`),cause:W(vx())}){static unsupported=()=>U(new ak({reason:new e({})}));get message(){return this.cause===void 0?`Socket does not support TLS upgrade`:`An error occurred during TLS upgrade`}},rk=class extends Bx(`effect/socket/Socket/SocketCloseError`)({_tag:Qb(`SocketCloseError`),code:dx,closeReason:W(K)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},ik=Ub([$O,ek,tk,nk,rk]),ak=class extends Y(ZO)(`SocketError`,{_tag:Qb(`SocketError`),reason:ik}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[ZO]=ZO;static is(e){return QO(e)}message=this.reason.message},ok=(e,t)=>new ak({reason:new rk({code:e,closeReason:t})}),sk=class extends tr()(`@effect/platform/Socket/WebSocketConstructor`){},ck=(e,t)=>sk.use(n=>uk(vp((typeof e==`string`?B(e):e).pipe(Kf(e=>n(e,t?.protocols))),e=>V(()=>e.close(1e3))),t)),lk=e=>`pause`in e&&typeof e.pause==`function`,uk=(e,t)=>zf(n=>{let r,i=yS(!1),a=n.context,o=H(function*(){let n=yield*gp,a=yield*xu(e,n);`binaryType`in a&&(a.binaryType=`arraybuffer`);let o=lk(a),s=t?.highWaterMark??(o?dk:void 0),c=a.readyState===1,l=o&&`isPaused`in a&&a.isPaused===!0,u=[],d=0,f,p,m;function h(){o&&!l&&(a.pause(),l=!0)}function g(){o&&l&&(a.resume(),l=!1)}function _(){let e=u;return u=[],d=0,f===void 0&&g(),e}function v(){if(p===void 0||u.length===0)return;let e=p;p=void 0,e(B(_()))}function y(e){u.push(e),s!==void 0&&(d+=typeof e==`string`?JO.encode(e).byteLength:e.byteLength),p!==void 0&&v(),o&&d>=s?h():!o&&!p&&s!==void 0&&d>s&&b(new ak({reason:new $O({cause:Error(`Socket highWaterMark of ${s} bytes exceeded`)})}))}function b(e){if(f===void 0&&(f=e),m!==void 0){let{cleanup:e,resume:t}=m;m=void 0,e(),t(U(f))}if(p!==void 0){let e=p;p=void 0,e(u.length>0?B(_()):U(f))}}function x(e){let t=e.data;if(typeof Blob<`u`&&t instanceof Blob){t.arrayBuffer().then(e=>y(new Uint8Array(e)),e=>{b(new ak({reason:new $O({cause:e})}))});return}y(t instanceof ArrayBuffer?new Uint8Array(t):t)}function S(e){b(new ak({reason:c?new $O({cause:e}):new tk({kind:`Unknown`,cause:e})}))}function C(e){b(ok(typeof e.code==`number`?e.code:1006,e.reason))}return a.addEventListener(`message`,x),a.addEventListener(`error`,S,{once:!0}),a.addEventListener(`close`,C,{once:!0}),yield*Cu(n,V(()=>{if(b(ok(1006)),a.removeEventListener(`message`,x),a.removeEventListener(`error`,S),a.removeEventListener(`close`,C),o)try{g()}catch{}i.closeUnsafe(),r=void 0})),a.readyState>=2?yield*U(f??ok(1006)):(c||=(yield*Mf(e=>{let t=()=>{m?.resume===e&&(m=void 0,a.removeEventListener(`open`,t),e(Af))},n=()=>a.removeEventListener(`open`,t);return m={resume:e,cleanup:n},a.addEventListener(`open`,t,{once:!0}),V(()=>{m?.resume===e&&(m=void 0),n()})}).pipe(ap({duration:t?.openTimeout??1e4,orElse:()=>U(new ak({reason:new tk({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))})),!0),f===void 0&&d<s&&g(),r=a,i.openUnsafe(),{pull:Mf(e=>u.length>0?e(B(_())):f===void 0?(p=e,V(()=>{p===e&&(p=void 0)})):e(U(f))),upgrade:nk.unsupported})}).pipe(mp(e=>wr(a,e))),s=e=>kf(()=>{let t=r;if(t===void 0)return i.whenOpen(s(e));try{return XO(e)?t.close(e.code,e.reason):t.send(e),Af}catch(e){return U(new ak({reason:new ek({cause:e})}))}}),c=e=>kf(()=>{let t=r;if(t===void 0)return i.whenOpen(c(e));try{for(let n=0;n<e.length;n++)t.send(e[n]);return Af}catch(e){return U(new ak({reason:new ek({cause:e})}))}});return B(qO({reader:o,writer:B({write:s,writeAll:c})}))}),dk=65536,fk=new Uint8Array(256);for(let e of"!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")fk[e.charCodeAt(0)]=1;var pk=new Uint8Array(256);pk[9]=1;for(let e=32;e<=126;e++)pk[e]=1;for(let e=128;e<=255;e++)pk[e]=1;var mk=tr(`effect/http/HttpServerRequest`),hk=new WeakSet,gk=e=>zf(t=>{let n=vr(t.context,mk);return hk.add(n.source),e}),_k=tr(`effect/http/HttpRouter`),vk=e=>e.endsWith(`/`)?e.slice(0,-1):e,yk=a(2,(e,t)=>(t=vk(t),e===`*`?`${t}/*`:e===`/`?t:t+e)),bk=`~effect/http/HttpRouter/Middleware`,xk=function(){return arguments.length===0?Sk:Sk(arguments[0],arguments[1])},Sk=(e,t)=>t?.global?Ku(H(function*(){let t=yield*_k,n=Sf(e)?yield*e:e;yield*t.addGlobalMiddleware(n)})):new Tk(Sf(e)?Gu(Kf(e,e=>ur(new Map([[wk,e]])))):zu(ur(new Map([[wk,e]])))),Ck=0,wk=`effect/http/HttpRouter/MiddlewareFn`,Tk=class e{[bk]={};layerFn;dependencies;constructor(e,t){this.layerFn=e,this.dependencies=t;let n=`effect/http/HttpRouter/Middleware-${++Ck}`;this.layer=Gu(H({self:this},function*(){let e=yield*up(),t=[_r(e,wk)];if(this.dependencies){let n=yield*Pu,r=yr(e,yu),i=yield*Fu(this.dependencies,n,r);t.push(...Dk(i))}return ur(new Map([[n,t]]))})).pipe(Zu(this.layerFn))}layer;combine(t){return new e(this.layerFn,this.dependencies?Qu(this.dependencies,t.layer):t.layer)}},Ek=new WeakMap,Dk=e=>{let t=Ek.get(e);if(t)return t;let n=ei(),r=0;for(let[t,i]of e.mapUnsafe)t.startsWith(`effect/http/HttpRouter/Middleware-`)&&(n.push(i),i.length>r&&(r=i.length));if(n.length===0)t=[];else{let e=new Set;for(let t=r-1;t>=0;t--)for(let r of n)t<r.length&&e.add(r[t]);t=qr(e).reverse()}return Ek.set(e,t),t};xk(gk).layer;var Ok={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,OK:200,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511},kk=e=>Ok[e],Ak=`~effect/http-api/HttpApiSchema/Stream`;function jk(e){let t=typeof e==`string`?kk(e):e;return e=>e.annotate({httpApiStatus:t})}var Mk=(e=>Ib.pipe(jk(e)))(204);function Nk(e){return t=>Ib.pipe(qb(kb(t),l_({decode:e.decode,encode:d})))}var Pk=e=>Eb(e)&&F(e,Ak),Fk=e=>Pk(e)&&e._tag===`StreamSse`,Ik=e=>Pk(e)&&e._tag===`StreamUint8Array`,Lk=`~effect/http-api/HttpApiSchema/WithHeaders`,Rk=`~effect/http-api/HttpApiSchema/WithHeadersValue`,zk=e=>({[Rk]:Rk,body:e.body,headers:e.headers}),Bk=e=>Eb(e)&&F(e,`~effect/http-api/HttpApiSchema/WithHeaders`);function Vk(e,t,n){return Tb(e.ast,{[Lk]:Lk,schema:t,headers:n})}function Hk(e,t){return e.annotate({"~httpApiEncoding":{_tag:t._tag,contentType:t.contentType??Uk(t._tag)}})}function Uk(e){switch(e){case`Multipart`:return`multipart/form-data`;case`Json`:return`application/json`;case`FormUrlEncoded`:return`application/x-www-form-urlencoded`;case`Uint8Array`:return`application/octet-stream`;case`Text`:return`text/plain`}}function Wk(e){return t=>Hk(t,{_tag:`FormUrlEncoded`,...e})}function Gk(e){return t=>Hk(t,{_tag:`Text`,...e})}var Kk=e=>{if(O_(e)||O_(yy(e)))return!0;let t=e.encoding?.[0].to;return t!==void 0&&O_(t)},qk=Ay(`~httpApiEncoding`),Jk=Ay(`~httpApiWithHeaders`),Yk=Ay(`httpApiStatus`),Xk={_tag:`Json`,contentType:`application/json`},Zk={_tag:`FormUrlEncoded`,contentType:`application/x-www-form-urlencoded`};function Qk(e){return qk(e)??Xk}function $k(e,t){return qk(e)||(ZD(t)?Xk:Zk)}function eA(e){let t=Qk(e);if(t._tag===`Multipart`)throw Error(`Multipart is not supported in response`);return t}function tA(e){return Yk(e)??200}function nA(e){return Bk(e)?Yk(e.ast)??tA(e.schema.ast):tA(e.ast)}function rA(e){return Bk(e)&&qk(e.ast)===void 0?eA(e.schema.ast):eA(e.ast)}function iA(e){return Yk(e)??500}function aA(e){return Bk(e)?Yk(e.ast)??iA(e.schema.ast):iA(e.ast)}function oA(e){let t=e.toLowerCase().trim(),n=t.indexOf(`;`);return n===-1?t:t.slice(0,n).trim()}var sA=`~effect/http-api/HttpApiEndpoint`;function cA(e){let t=[];for(let{schemas:n}of e.payload.values())t.push(...n);return t}function lA(e){let t=Array.from(e.success);return Zr(t)?t:[Mk]}function uA(e){let t=new Set(e.error),n=e.disableCodecs?o:yA;for(let r of e.middlewares){let e=r;for(let r of e.error)t.add(n(r))}return Array.from(t)}var dA={[sA]:sA,pipe(){return n(this,arguments)},prefix(e){return pA({...fA(this),path:yk(this.path,e)})},middleware(e){return pA({...fA(this),middlewares:new Set([...this.middlewares,e])})},annotate(e,t){return pA({...fA(this),annotations:hr(this.annotations,e,t)})},annotateMerge(e){return pA({...fA(this),annotations:wr(this.annotations,e)})}},fA=e=>({identifier:e.identifier,path:e.path,method:e.method,params:e.params,query:e.query,headers:e.headers,payload:e.payload,success:e.success,error:e.error,annotations:e.annotations,middlewares:e.middlewares,disableCodecs:e.disableCodecs});function pA(e){function t(){}return Object.setPrototypeOf(t,dA),Object.assign(t,e)}var mA=e=>(t,n,r)=>{let i=r?.disableCodecs??!1,a=i?o:Hx;return pA({identifier:t,path:n,method:e,params:hA(r?.params,a),query:hA(r?.query,a),headers:hA(r?.headers,a),payload:gA(r?.payload,e,i),success:vA(r?.success,e,i),error:bA(r?.error,i),annotations:pr(),middlewares:new Set,disableCodecs:i})};function hA(e,t){if(e!==void 0)return Eb(e)?t(e):t(q(e))}function gA(e,t,n){let r=new Map;if(e===void 0)return r;let i=Array.isArray(e)?e:Eb(e)?[e]:[q(e).pipe(Wk())],a=n?o:AA;for(let e of i){let n=$k(e.ast,t),i=oA(n.contentType),o=r.get(i);if(o){if(o.encoding._tag!==n._tag)throw Error(`Multiple payload encodings for content-type: ${n.contentType}`);if(o.encoding._tag===`Multipart`)throw Error(`Multiple multipart payloads for content-type: ${n.contentType}`);o.schemas.push(a(e,t))}else r.set(i,{encoding:n,schemas:[a(e,t)]})}return r}var _A=`effect/http-api/stream/failure`;function vA(e,t,n){if(e===void 0)return new Set;let r=Jr(e);return xA(r,t),new Set(n?r:r.map(yA))}var yA=m(e=>Pk(e)?e:Bk(e)?Vk(e,Pk(e.schema)?e.schema:kA(e.schema,rA(e)),Hx(e.headers)):OA(e));function bA(e,t){if(e===void 0)return new Set;let n=Jr(e);for(let e of n)if(Pk(Bk(e)?e.schema:e))throw Error(`Streaming schemas are not supported in error responses`);return CA(n,aA),new Set(t?n:n.map(yA))}function xA(e,t){let n=!1,r=new Map;for(let i of e){let e=Bk(i)?i.schema:i,a=nA(i);if(Pk(e)){if(wA(e,t),n)throw Error(`Multiple streaming success responses are not supported`);n=!0;let i=SA(r,a);if(i.noContent)throw Error(`Cannot combine no-content and streaming success responses for status: ${a}`);if(i.bufferedContentTypes.has(oA(e.contentType)))throw Error(`Cannot combine buffered and streaming success responses for status ${a} and content-type: ${e.contentType}`);r.set(a,{...i,stream:e})}else{let t=SA(r,a),n=Kk(e.ast);if(t.stream!==void 0){if(n)throw Error(`Cannot combine no-content and streaming success responses for status: ${a}`);let e=rA(i);if(oA(e.contentType)===oA(t.stream.contentType))throw Error(`Cannot combine buffered and streaming success responses for status ${a} and content-type: ${e.contentType}`)}n||t.bufferedContentTypes.add(oA(rA(i).contentType)),t.noContent=t.noContent||n}}CA(e,nA)}function SA(e,t){let n=e.get(t);return n===void 0&&(n={bufferedContentTypes:new Set,noContent:!1},e.set(t,n)),n}function CA(e,t){let n=new Map;for(let r of e){let e=t(r),i=Jk(r.ast),a=Bk(r)?r.schema:i?.body??r,o=Kk(a.ast)?``:oA(Pk(a)?a.contentType:rA(r).contentType),s=n.get(e);s===void 0&&(s={headerContentType:void 0,plainContentTypes:new Set},n.set(e,s));let c=()=>Error(`Cannot combine a response with headers with another response for status ${e} and content-type: ${o||`<no content>`}`);if(Bk(r)||i!==void 0){if(s.headerContentType!==void 0)throw Error(`Cannot declare multiple responses with headers for status ${e}`);if(s.plainContentTypes.has(o))throw c();s.headerContentType=o}else{if(s.headerContentType===o)throw c();s.plainContentTypes.add(o)}}}function wA(e,t){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare streaming success responses`);if(Fk(e)&&TA(e.events.ast))throw Error(`SSE event name is reserved: ${_A}`)}function TA(e){return EA(yy(e),new Set)}function EA(e,t){if(t.has(e))return!1;if(t.add(e),P_(e))return e.types.some(e=>EA(e,t));if(F_(e))return EA(e.thunk(),t);if(!N_(e))return!1;let n=e.propertySignatures.find(e=>e.name===`event`);return n!==void 0&&DA(n.type,t)}function DA(e,t){if(t.has(e))return!1;t.add(e);let n=yy(e);return n===e?A_(e)?e.literal===_A:P_(e)?e.types.some(e=>DA(e,t)):F_(e)?DA(e.thunk(),t):!1:DA(n,t)}function OA(e){let t=eA(e.ast),n=Jk(e.ast);return n===void 0?kA(e,t):e.annotate({"~httpApiWithHeaders":{...n,bodyCodec:kA(n.body,t),headersCodec:Hx(n.headers)}})}function kA(e,t){switch(t._tag){case`Json`:return Vx(e);case`FormUrlEncoded`:return Hx(e);case`Text`:case`Uint8Array`:return e}}function AA(e,t){switch($k(e.ast,t)._tag){case`Json`:return Vx(e);case`FormUrlEncoded`:return Hx(e);case`Text`:case`Uint8Array`:case`Multipart`:return e}}var jA=mA(`GET`),MA=mA(`POST`),NA=mA(`PUT`),PA=mA(`PATCH`),FA=mA(`DELETE`),IA=`~effect/http-api/HttpApi`,LA={[IA]:IA,pipe(){return n(this,arguments)},add(...e){let t={...this.groups};for(let n of e)st(t,n.identifier,n);return zA({...RA(this),groups:t})},addHttpApi(e){let t={...this.groups};for(let n of Object.keys(e.groups)){let r=e.groups[n];st(t,n,r.annotateMerge(wr(e.annotations,r.annotations)))}return zA({...RA(this),groups:t})},prefix(e){return zA({...RA(this),groups:Hr(this.groups,t=>t.prefix(e))})},middleware(e){return zA({...RA(this),groups:Hr(this.groups,t=>t.middleware(e))})},annotate(e,t){return zA({...RA(this),annotations:hr(this.annotations,e,t)})},annotateMerge(e){return zA({...RA(this),annotations:wr(this.annotations,e)})}},RA=e=>({identifier:e.identifier,groups:e.groups,annotations:e.annotations}),zA=e=>{function t(){}return Object.setPrototypeOf(t,LA),Object.assign(t,e)},BA=e=>zA({identifier:e,groups:{},annotations:pr()}),VA=(e,t)=>{let n=Object.values(e.groups);for(let r of n){let n=wr(e.annotations,r.annotations);t.onGroup({group:r,mergedAnnotations:n});let i=Object.values(r.endpoints);for(let e of i)(!t.predicate||t.predicate({endpoint:e,group:r}))&&t.onEndpoint({group:r,endpoint:e,middleware:e.middlewares,mergedAnnotations:wr(n,e.annotations),successes:HA(lA(e),nA),errors:HA(uA(e),aA)})}},HA=(e,t)=>{let n=new Map;return e.forEach(r),n;function r(e){if(Pk(Bk(e)?e.schema:e))return;let r=t(e),i=n.get(r);i===void 0?n.set(r,[e]):i.push(e)}},UA=class extends tr()(`effect/http-api/HttpApi/ParseOptions`){},WA=class extends tr()(`effect/http-api/HttpApi/ParamsParseOptions`){},GA=class extends tr()(`effect/http-api/HttpApi/QueryParseOptions`){},KA=class extends tr()(`effect/http-api/HttpApi/HeadersParseOptions`){},qA=class extends tr()(`effect/http-api/HttpApi/PayloadParseOptions`){},JA=class extends tr()(`effect/http-api/HttpApi/SuccessParseOptions`){},YA=class extends tr()(`effect/http-api/HttpApi/ErrorParseOptions`){},XA=e=>{let t=gr(e,UA);return{params:gr(e,WA)??t,query:gr(e,GA)??t,headers:gr(e,KA)??t,payload:gr(e,qA)??t,success:gr(e,JA)??t,error:gr(e,YA)??t}},ZA=new Set;function QA(e){if(e===void 0)return ZA;let t=ty(e.ast);return N_(t)&&t.indexSignatures.length===0?new Set(t.propertySignatures.map(e=>String(e.name))):void 0}var $A=(e,t)=>H(function*(){let n=yield*up(),r=t.httpClient.pipe(t?.baseUrl===void 0?o:IO(gO(t.baseUrl.toString())));function i(e,t,a,o,s){if(s===-1)return r.execute(a);let c=n.mapUnsafe.get(o[s]);return c===void 0?i(e,t,a,o,s-1):c({endpoint:t,group:e,request:a,next(n){return i(e,t,n,o,s-1)}})}VA(e,{predicate:t?.predicate,onGroup(e){t.onGroup?.(e)},onEndpoint(e){let{group:n,endpoint:r,errors:a,successes:o,mergedAnnotations:s}=e,c=XA(s),l=ij(r.path,r.params),u={orElse:wj},d=new Map;for(let[e,t]of a.entries()){let n=uj(t);for(let[t,r]of n.entries())cj(d,e,t,aj(r,c.error,c.headers))}for(let[e,t]of d.entries()){let n=lj(t);u[e]=e=>Bf(Qf(n(e),t=>Pf(Zte(Pl(new HD({reason:new qD({request:e.request,response:e})})),t))),U)}let f=new Map;for(let[e,t]of o.entries()){let n=uj(t);for(let[t,r]of n.entries())cj(f,e,t,aj(r,c.success,c.headers))}for(let e of mj(r)){let t=pj(e)?e.schema:e;cj(f,nA(e),t.contentType,hj(e,c.success,c.headers))}for(let[e,t]of f.entries())u[e]=lj(t);let p=ST(r.params,e=>Sb(e,c.params)),m=cA(r),h=Zr(m)?Sb(ZD(r.method)?Ej(m,r.method):Ub(m),c.payload):void 0,g=ST(r.headers,e=>Sb(e,c.headers)),_=ST(r.query,e=>Sb(e,c.query)),v=Array.from(e.middleware,e=>`${e.key}/Client`),y=Wp(function*(e){let a=sO(r.method)(r.path);if(e!==void 0){if(p!==void 0){let t=yield*p(e.params);a=hO(a,l(t))}if(h!==void 0){if(ZD(r.method)){if(e.payload instanceof FormData)a=SO(a,e.payload);else{let t=yield*h(e.payload);a=xO(a,t)}}else{let t=yield*h(e.payload);a=yO(a,t)}}if(g!==void 0){let t=yield*g(e.headers);a=fO(a,t)}if(_!==void 0){let t=yield*_(e.query);a=yO(a,t)}}let o=yield*i(n,r,a,v,v.length-1);if(e?.responseMode===`response-only`)return o;let s=(u[o.status]??u.orElse)(o,e?.sseOptions),c=yield*t.transformResponse===void 0?s:t.transformResponse(s);return e?.responseMode===`decoded-and-response`?[c,o]:c});t.onEndpoint({...e,endpointFn:y})}})}),ej=(e,t)=>Bf(jO,n=>tj(e,{...t,httpClient:t?.transformClient?t.transformClient(n):n})),tj=(e,t)=>{let n={};return $A(e,{...t,onGroup({group:e}){e.topLevel||st(n,e.identifier,{})},onEndpoint({endpoint:e,endpointFn:t,group:r}){st(r.topLevel?n:n[r.identifier],e.identifier,t)}}).pipe(qf(n))},nj=(e,t)=>{let n={};return VA(e,{onGroup({group:e}){e.topLevel||st(n,e.identifier,{})},onEndpoint({group:e,endpoint:r,mergedAnnotations:i}){let a=XA(i),o=ij(r.path,r.params),s=r.params===void 0?void 0:wb(r.params,a.params),c=r.query===void 0?void 0:wb(r.query,a.query);st(e.topLevel?n:n[e.identifier],r.identifier,e=>{let n=e?.params,i=n===void 0?r.path:o(s===void 0?n:s(n)),a=e?.query===void 0?void 0:c===void 0?e.query:c(e.query),l=a===void 0?Bh:Ih(a);if(t?.baseUrl===void 0){let e=Wh(l);return e===``?i:`${i}?${e}`}let u=new URL(gO(cO(i),t.baseUrl.toString()).url);for(let[e,t]of l.params)t!==void 0&&u.searchParams.append(e,t);return u.toString()})}}),n},rj=/(\/?):(\w+)(\?)?/g,ij=(e,t)=>{if(t===void 0||!e.includes(`:`))return t=>e;let n=QA(t);return t=>e.replace(rj,(e,r,i,a)=>{if(n!==void 0&&!n.has(i))return e;let o=t[i];if(o===void 0){if(a!==void 0)return``;throw Error(`Missing path parameter: ${i}`)}return`${r}${encodeURIComponent(o)}`})};function aj(e,t,n){let r=e.some(e=>Bk(e)||Jk(e.ast)!==void 0),i=vb(r?Ub(e.map(e=>sj(e,t,n))):Sj(e),t);return e=>Bf(e.arrayBuffer,r?t=>i({body:t,headers:e.headers}):i)}var oj=q({body:Mb,headers:Mb});function sj(e,t,n){let r=Jk(e.ast),i=r===void 0?Bk(e)?{body:e.schema,headers:e.headers,toValue:zk}:{body:e,headers:Mb,toValue:e=>e.body}:{body:r.bodyCodec,headers:r.headersCodec,toValue:r.transformation.decode},a=vb(Cj(i.body).pipe(qb(i.body)),t),o=vb(i.headers,n);return oj.pipe(qb(Bk(e)?e:kb(e),c_({decode:e=>Cf({body:a(e.body),headers:o(e.headers)}).pipe(Kf(i.toValue),$f(e=>e.issue)),encode:(e,t)=>U(new _g({message:`Decode only schema`},e,t))})))}function cj(e,t,n,r){let i=oA(n),a=e.get(t);a===void 0?e.set(t,[{contentType:i,decode:r}]):a.push({contentType:i,decode:r})}function lj(e){let t=e[0];return e.length===1&&t!==void 0?t.decode:(t,n)=>{let r=oA(t.headers[`content-type`]??``),i=e.find(e=>e.contentType===r);return i===void 0?dj(t,r,e):i.decode(t,n)}}function uj(e){let t=new Map;for(let n of e){let e=Kk((Bk(n)?n.schema:n).ast)?``:oA(rA(n).contentType),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return t}function dj(e,t,n){let r=Array.from(new Set(n.map(e=>e.contentType))).join(`, `);return U(new HD({reason:new JD({request:e.request,response:e,description:`Unsupported response content-type for status ${e.status}: ${t||`<missing>`}. Expected one of: ${r}`})}))}var fj=`effect/http-api/stream/failure`,pj=e=>Bk(e);function mj(e){let t=[];for(let n of e.success)Pk(Bk(n)?n.schema:n)&&t.push(n);return t}function hj(e,t,n){let r=pj(e),i=r?e.schema:e,a=Ik(i)?void 0:{declaration:i,decoder:gj(i,t)},o=(e,t)=>Kf(up(),n=>dT(a===void 0?e.stream:_j(e.stream,a.declaration,a.decoder(t)),n));if(!r)return o;let s=vb(e.headers,n);return(e,t)=>Bf(s(e.headers),n=>Kf(o(e,t),e=>zk({body:e,headers:n})))}function gj(e,t){let n=Ub([q({id:W(K),event:G(fj),data:xx(Vx(Tx(e.error,vx())))}),e.events]),r=fD(n,void 0,t);return e=>e===void 0?r:fD(n,e,t)}function _j(e,t,n){let r=Xw(e.pipe(Qae,Zae(n)),e=>V(()=>{let t;return kf(()=>t===void 0?Bf(e,e=>{for(let n=0;n<e.length;n++){let r=e[n];if(r.event===fj&&Al(r.data)){if(n===0)return Pf(r.data);t=r.data,e=e.slice(0,n);break}}return B(e)}):Pf(t))}));return t.sseMode===`data`?iT(r,e=>e.data):r}var vj=$b(globalThis.ArrayBuffer,{expected:`ArrayBuffer`}),yj=vj.pipe(qb(Lie,l_({decode(e){return new Uint8Array(e)},encode(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}}))),bj=vj.pipe(qb(K,l_({decode(e){return new TextDecoder().decode(e)},encode(e){let t=new TextEncoder().encode(e);return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}}))),xj=bj.pipe(qb(Ub([G(``).pipe(qb(Nb,l_({decode:()=>void 0,encode:()=>``}))),Fie])));function Sj(e){return Ub(e.map(t));function t(e){return Cj(e).pipe(qb(e))}}function Cj(e){switch(eA(e.ast)._tag){case`Json`:return D_(yy(e.ast))?xj.pipe(qb(Mb,l_({decode:e=>e===void 0?null:e,encode:e=>e===null?void 0:e}))):xj;case`FormUrlEncoded`:return bj.pipe(qb(jx,l_({decode:e=>Ih(new URLSearchParams(e)),encode:Wh})));case`Uint8Array`:return yj;case`Text`:return bj}}var wj=e=>U(new HD({reason:new JD({request:e.request,response:e})})),Tj=fb(bD);function Ej(e,t){return Ub(e.map(e=>Oj(e,t)))}var Dj=new WeakMap;function Oj(e,t){let n=e.ast,r=Dj.get(n);if(r!==void 0)return r;let i=$k(n,t),a=Tj.pipe(qb(e,c_({decode(e,t){return U(new _g({message:`Encode only schema`},e,t))},encode(e,t){switch(i._tag){case`Multipart`:return U(new _g({message:`Payload must be a FormData`},e,t));case`Json`:try{return B(OD(JSON.stringify(e),i.contentType))}catch{return U(new hg({expected:`a JSON-serializable request body`},e,t))}case`Text`:return typeof e==`string`?B(OD(e,i.contentType)):U(new hg({message:`Expected a string`},e,t));case`FormUrlEncoded`:return N(e)?B(kD(Ih(e),i.contentType)):U(new hg({message:`Expected a record`},e,t));case`Uint8Array`:return e instanceof Uint8Array?B(wD(e,i.contentType)):U(new hg({message:`Expected a Uint8Array`},e,t))}}})));return Dj.set(n,a),a}var kj=`~effect/reactivity/AtomRef`,Aj=e=>new Nj(e),jj={count:0,generate(){return`AtomRef-${this.count++}`}},Mj=class{[kj];key=jj.generate();value;constructor(e){this[kj]=kj,this.value=e}[ve](e){return ye(this.value,e.value)}[ee](){return z(this.value)}listeners=null;notify(e){let t=this.listeners;for(;t!==null;)t.f(e),t=t.next}subscribe(e){let t={f:e,prev:null,next:this.listeners};return this.listeners&&(this.listeners.prev=t),this.listeners=t,()=>{this.listeners===t&&(this.listeners=t.next),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev)}}map(e){return new Pj(this,e)}},Nj=class extends Mj{prop(e){return new Fj(this,e)}set(e){return ye(e,this.value)?this:(this.value=e,this.notify(e),this)}update(e){return this.set(e(this.value))}},Pj=class e{[kj];key=jj.generate();parent;transform;constructor(e,t){this[kj]=kj,this.parent=e,this.transform=t}[ve](e){return ye(this.value,e.value)}[ee](){return z(this.value)}get value(){return this.transform(this.parent.value)}subscribe(e){let t=this.transform(this.parent.value);return this.parent.subscribe(n=>{let r=this.transform(n);ye(r,t)||(t=r,e(r))})}map(t){return new e(this,t)}},Fj=class e{[kj];key=jj.generate();previous;parent;_prop;constructor(e,t){this[kj]=kj,this.parent=e,this._prop=t,this.previous=e.value[t]}[ve](e){return ye(this.value,e.value)}[ee](){return z(this.value)}get value(){return this.parent.value&&this._prop in this.parent.value&&(this.previous=this.parent.value[this._prop]),this.previous}subscribe(e){let t=this.value;return this.parent.subscribe(n=>{if(!n||!(this._prop in n))return;let r=n[this._prop];ye(r,t)||(t=r,e(r))})}map(e){return new Pj(this,e)}prop(t){return new e(this,t)}set(e){if(Array.isArray(this.parent.value)){let t=this.parent.value.slice();t[this._prop]=e,this.parent.set(t)}else this.parent.set({...this.parent.value,[this._prop]:e});return this}update(e){if(Array.isArray(this.parent.value)){let t=this.parent.value.slice();t[this._prop]=e(this.parent.value[this._prop]),this.parent.set(t)}else this.parent.set({...this.parent.value,[this._prop]:e(this.parent.value[this._prop])});return this}},Ij=class extends tr()(`effect/workers/Transferable/Collector`){},Lj=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return Ij.of({addAllUnsafe:t,addAll:e=>V(()=>t(e)),readUnsafe:n,read:V(n),clearUnsafe:r,clear:V(r)})},Rj=Ub([class extends Bx(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:Qb(`WorkerSpawnError`),message:K,cause:W(vx())}){},class extends Bx(`effect/workers/WorkerError/WorkerSendError`)({_tag:Qb(`WorkerSendError`),message:K,cause:W(vx())}){},class extends Bx(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:Qb(`WorkerReceiveError`),message:K,cause:W(vx())}){},class extends Bx(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:Qb(`WorkerUnknownError`),message:K,cause:W(vx())}){}]),zj=`~effect/PrimaryKey`,Bj=`~effect/rpc/RpcSchema/StreamSchema`;function Vj(e){return F(e,Bj)}function Hj(e){return Vj(e)?Ln({success:e.success,error:e.error}):In()}var Uj=fb(qw);function Wj(e,t){return Tb(Uj.ast,{[Bj]:Bj,success:e,error:t})}var Gj=`~effect/rpc/Rpc`,Kj={[Gj]:Gj,pipe(){return n(this,arguments)},setSuccess(e){return qj({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return qj({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return qj({_tag:this._tag,payloadSchema:Eb(e)?e:q(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return qj({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return qj({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return qj({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:hr(this.annotations,e,t)})},annotateMerge(e){return qj({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:wr(this.annotations,e)})}},qj=e=>{function t(){}return Object.setPrototypeOf(t,Kj),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},Jj=(e,t)=>{let n=t?.success??Ib,r=t?.error??jb,i=t?.defect??vx(),a;return a=t?.primaryKey?class extends zx(`effect/rpc/Rpc/${e}`)(t.payload){[zj](){return t.primaryKey(this)}}:Eb(t?.payload)?t?.payload:t?.payload?q(t?.payload):Ib,qj({_tag:e,payloadSchema:a,successSchema:t?.stream?Wj(n,r):n,errorSchema:t?.stream?jb:r,defectSchema:i,annotations:pr(),middlewares:new Set})},Yj=new WeakMap,Xj=e=>{if(Yj.has(e))return Yj.get(e);let t=e,n=new Set([t.errorSchema]),r=Hj(t.successSchema);zn(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=Ax(zn(r)?Ib:t.successSchema,Ub([...n]),t.defectSchema);return Yj.set(e,i),i},Zj=`~effect/rpc/Rpc/Wrapper`,Qj=e=>Zj in e,$j=`~effect/rpc/RpcClientError`,eM=class extends Bx(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:Qb(`RpcClientDefect`),message:K,cause:vx()}){},tM=class extends Bx($j)({_tag:Qb(`RpcClientError`),reason:Ub([Rj,ik,XD,eM])}){[$j]=$j;get message(){return`${this.reason._tag}: ${this.reason.message}`}},nM=e=>e,rM={_tag:`Ping`},iM=Vx,aM,oM=e=>(aM??=new TextDecoder).decode(e),sM=class extends tr()(`effect/rpc/RpcSerialization`){},cM=sM.of({contentType:`application/json`,includesFraming:!1,codecFor:iM,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e==`string`?e:oM(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),lM=e=>kf(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>dp(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),Af});return Kf(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return H(function*(){t.add(e),r.set(e,i);let a=n.get(e);if(a){n.delete(e);for(let[e,t]of a)yield*pp(kf(()=>i(e)),t)}return yield*Cp(Nf,()=>(t.delete(e),r.delete(e),Af))})}}))}),uM=0,dM=Wp(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>uM++),s=yield*up(),c=yr(s,yu),l=new Map,u=!1;yield*Cu(c,zf(e=>(u=!0,d(ou(e.id)))));let d=Wp(function*(e){for(let[t,n]of l)l.delete(t),n._tag===`Queue`?yield*e._tag===`Success`?nC(n.queue):eC(n.queue,e.cause):n.resume(e)}),f=e=>{let r=Vj(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?Ch(s.headers):Sh,l=s?.context??pr();if(!r){let r=t=>p(e,a,t,e.payloadSchema.make(o),c,l,s?.discard??!1);return i?r(void 0):jp(`${n}.${e._tag}`,{attributes:t.spanAttributes},r)}let u=m(e,a,e.payloadSchema.make(o),c,s?.streamBufferSize??16,l);return s?.asQueue?u:rT(Kf(u,nT))}},p=(e,n,r,i,s,c,d)=>zf(f=>{if(u)return Tp;let p=a(),m=n(e=>t.onFromClient({message:e,context:c,discard:d}),{_tag:`Request`,id:p,tag:e._tag,payload:i,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:Dh(f.getRef(hM),s)});if(d)return m;let h;return Dp(Mf(t=>{let n={_tag:`Effect`,rpc:e,context:c,resume(e){t(e),h&&!h.pollUnsafe()&&f.currentDispatcher.scheduleTask(()=>{h.interruptUnsafe(f.id)},0)}};l.set(p,n),h=m.pipe(r?Mp(r,{captureStackTrace:!1}):o,Lp(f.context)),h.addObserver(e=>{if(e._tag===`Failure`)return t(e)})}),e=>(l.delete(p),Hf(hS(h),g(p,Array.from(e),c))))}),m=Wp(function*(e,r,s,c,d,f){if(u)return yield*Tp;let p=i?void 0:yield*xne(`${n}.${e._tag}`,{attributes:t.spanAttributes}),m=_S(),h=a(),_=vr(m.context,yu),v=yield*JS(d);return yield*Su(_,e=>(iC(v),l.has(h)?(l.delete(h),g(h,lu(e)?Array.from(Gl(e.cause)):[],f)):Af)),l.set(h,{_tag:`Queue`,rpc:e,queue:v,scope:_,context:f}),yield*r(e=>t.onFromClient({message:e,context:f,discard:!1}),{_tag:`Request`,id:h,tag:e._tag,payload:s,...p?{traceId:p.traceId,spanId:p.spanId,sampled:p.sampled}:{},headers:Dh(m.getRef(hM),c)}).pipe(p?Mp(p,{captureStackTrace:!1}):o,Sp(e=>eC(v,e)),Ep,Pp(_,{startImmediately:!0})),v}),h=e=>{let t=[];for(let n of e.middlewares.values()){let e=_r(s,`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},g=(e,n,r)=>Mf(i=>{let a=_S();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r,discard:!1}).pipe(rp(1e3),Lp(a.context)).addObserver(()=>{i(Af)})}),_=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=l.get(n);return!i||i._tag!==`Queue`?Af:QS(i.queue,e.values).pipe(r?Bf(()=>t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context,discard:!1})):o,Qf(e=>eC(i.queue,e)))}case`Exit`:{let t=e.requestId,n=l.get(t);return n?(l.delete(t),n._tag===`Effect`?(n.resume(e.exit),Af):e.exit._tag===`Success`?nC(n.queue):eC(n.queue,e.exit.cause)):Af}case`Defect`:return d(au(e.defect));case`ClientEnd`:return Af}},v;if(t.flatten){let t=new Map;v=function(n,r,i){let a=t.get(n);return a||(a=f(e.requests.get(n)),t.set(n,a)),a(r,i)}}else v={},e.requests.forEach(e=>{st(v,e._tag,f(e))});return{client:v,write:_}}),fM=0,pM=Wp(function*(e,t){let n=fM++,{codecFor:r,run:i,send:a,supportsAck:o,supportsTransferables:s}=yield*gM,c=mM(r),l=fie(r(vx())),u=new Map,d=e=>u.has(e)?(u.delete(e),a(n,{_tag:`Interrupt`,requestId:e})):Af,{client:f,write:p}=yield*dM(e,{...t,supportsAck:o,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),i=s?Lj():void 0,o=_S(),l={rpc:r,context:i?hr(o.context,Ij,i):o.context,schemas:c(r)};return u.set(t.id,l),l.schemas.encodePayload(t.payload).pipe(pp(l.context),ep,Bf(e=>a(n,{...t,id:t.id,payload:e,headers:Object.entries(t.headers)},i&&i.readUnsafe())))}case`Ack`:return u.get(t.requestId)?a(n,{_tag:`Ack`,requestId:t.requestId}):Af;case`Interrupt`:return d(t.requestId);case`Eof`:return Af}}});return yield*i(n,e=>{switch(e._tag){case`Chunk`:{let t=nM(e.requestId),n=u.get(t);if(!n||Rn(n.schemas.decodeChunk))return Af;let r=n.schemas.decodeChunk.value;return kp(i=>i(r(e.values).pipe(pp(n.context),ep,Bf(e=>p({_tag:`Chunk`,clientId:0,requestId:t,values:e})))).pipe(Sp(e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:ru(e)}).pipe(Hf(Wl(e)?Af:np(d(t))))),une(e=>!Wl(e),()=>Af)))}case`Exit`:{let t=nM(e.requestId),n=u.get(t);return n?(u.delete(t),n.schemas.decodeExit(e.exit).pipe(pp(n.context),ep,lp({onSuccess:e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:ru(e)})}))):Af}case`Defect`:return p({_tag:`Defect`,clientId:0,defect:l(e.defect)});case`ClientProtocolError`:{let t=iu(e.error);return wf(Array.from(u.keys()),e=>p({_tag:`Exit`,clientId:0,requestId:e,exit:t}))}default:return Af}}).pipe(Qf(qp),Ep,Fp),f}),mM=e=>{let t=new WeakMap;return n=>{let r=t.get(n);return r===void 0?(r={decodeChunk:qn(Hj(n.successSchema),t=>vb(e(Vb(t.success)))),encodePayload:Cb(e(n.payloadSchema)),decodeExit:vb(e(Xj(n)))},t.set(n,r),r):r}},hM=Er(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>Sh}),gM=class extends tr()(`effect/rpc/RpcClient/Protocol`){static make=lM},uoe=e=>gM.make(Wp(function*(t,n){let r=yield*KO,i=yield*sM,a=yield*vne(poe),s=new Map,c=yield*r.writer,l=i.makeUnsafe(),u=yield*foe(kf(()=>c.write(l.encode(rM)))),f,p=e=>wf(n,n=>t(n,e)),m=e=>(f=e,p({_tag:`ClientProtocolError`,error:e})),h=e=>{try{let n=l.decode(e);if(n.length===0)return Af;let r=0;return Tf({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return u.onPong(),Af;if(Object.hasOwn(e,`requestId`)){let n=e.requestId,r=s.get(n);if(r!==void 0)return e._tag===`Exit`&&s.delete(n),t(r,e)}return p(e)},step:d})}catch(e){return p({_tag:`ClientProtocolError`,error:new tM({reason:new eM({message:`Error decoding message`,cause:e})})})}};return yield*kf(()=>(l=i.makeUnsafe(),u.reset(),H(function*(){let{pull:e}=yield*r.reader;for(f=void 0,zn(a)&&(yield*a.value.onConnect);;){let t=yield*e;for(let e=0;e<t.length;e++)yield*h(t[e])}}).pipe(_p,sp(Bf(u.timeout,()=>U(new ak({reason:new $O({cause:Error(`ping timeout`)})}))))))).pipe(zn(a)?xp(a.value.onDisconnect):o,dne(t=>{let n=Hl(t),r=Nr(n),i=new tM({reason:r?n.success.reason:new eM({message:`Unknown socket error`,cause:Vl(t)})});return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?(e.onTransientError?.(i)??Af).pipe(pne({log:!0,message:`RpcClient onTransientError hook failed`})):m(i)}),fne(e?.retryPolicy??doe,e=>m(new tM({reason:e.reason}))),Dne({module:`RpcClient`,method:`makeProtocolSocket`}),Fp),{send(e,t){if(f)return U(f);t._tag===`Request`&&s.set(t.id,e);let n=l.encode(t);return n===void 0?Af:ep(c.write(n))},supportsAck:!0,supportsTransferables:!1,codecFor:i.codecFor}})),doe=uf([ff(500,1.5),pf(5e3)]),foe=Wp(function*(e){let t=!0,n=yS();return yield*kf(()=>t?(t=!1,e):n.open).pipe(hne(`5 seconds`),np,Ap,Ep,Fp),{timeout:n.await,reset:()=>{t=!0,n.closeUnsafe()},onPong:()=>{t=!0}}}),poe=class extends tr()(`effect/rpc/RpcClient/ConnectionHooks`){},moe=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),_M=t(((e,t)=>{t.exports=moe()})),Z=e(_M(),1),hoe=Z.use,vM=Z.useLayoutEffect;function goe(e,t,n){Z.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function _oe(e){let t=Z.useRef(null);return Z.useImperativeHandle(e,()=>t.current,[]),t}function yM(e){if(URL.canParse)return URL.canParse(e);try{return new URL(e),!0}catch{return!1}}function bM(e){return e[e.length-1]}function xM(e,t){return typeof e==`function`?e(t):e}var SM=Object.prototype.hasOwnProperty,voe=Object.prototype.propertyIsEnumerable;function yoe(e){for(let t in e)if(SM.call(e,t))return!0;return!1}var boe=()=>Object.create(null),xoe=(e,t)=>CM(e,t,boe);function CM(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=DM(e)&&DM(i);if(!a&&!(TM(e)&&TM(i)))return i;let o=a?e:wM(e);if(!o)return i;let s=a?i:wM(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:SM.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=CM(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function wM(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!voe.call(e,r))return!1;t.push(r)}return t}function TM(e){if(!EM(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!EM(n)||!n.hasOwnProperty(`isPrototypeOf`))}function EM(e){return Object.prototype.toString.call(e)===`[object Object]`}function DM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function OM(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!OM(e[r],t[r],n))return!1;return!0}if(TM(e)&&TM(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!OM(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!OM(e[o],t[o],n)))return!1;return i===a}return!1}function Soe(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var Coe=/[\x00-\x1f\x7f"<>`{}]/g;function woe(e){return e.replace(Coe,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function kM(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return woe(t)}var Toe=[`http:`,`https:`,`mailto:`,`tel:`];function AM(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Eoe(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=kM(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=kM(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Doe(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ooe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function jM(){throw Error(`Invariant failed`)}function MM(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var NM=4,PM=5;function FM(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1<a.length&&(s=a.indexOf(`}`,o))!==-1){let r=a.charCodeAt(o+1);if(r===45){if(o+2<a.length&&a.charCodeAt(o+2)===36){let e=o+3,r=s;if(e<r)return n[0]=3,n[1]=t+o,n[2]=t+e,n[3]=t+r,n[4]=t+s+1,n[5]=i,n}}else if(r===36){let r=o+1,a=o+2;return a===s?(n[0]=2,n[1]=t+o,n[2]=t+r,n[3]=t+a,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+o,n[2]=t+a,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function IM(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=FM(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=RM(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c);u||(t=t.toLowerCase(),c=c.toLowerCase());let m=f===1?i.dynamic:f===3?i.optional:i.wildcard,h=f!==2&&!d&&m?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=koe(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=RM(r);e.kind=PM,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=RM(r);e.kind=NM,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)IM(e,t,r,c,i,a,o,s)}function LM(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function RM(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function koe(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Aoe(e,t){let n=RM(`/`),r=new Uint16Array(6),i=[];for(let t of e)IM(!1,r,t,1,n,0,i);for(let e of i)e.sort(LM);t.masksTree=n,t.flatCache=MM(1e3)}function joe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=zM(e,t.masksTree);return t.flatCache.set(e,r),r}function Moe(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=RM(`/`),IM(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),zM(r,o,n)}function Noe(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=zM(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=VM(a.route)),t.matchCache.set(r,a),a}function Poe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Foe(e,t=!1,n){let r=RM(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;IM(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&jM(),o[e.id]=e,c!==0&&e.path){let t=Poe(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(LM);return{processedTree:{segmentTree:r,singleCache:MM(1e3),matchCache:MM(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function zM(e,t,n=!1){let r=e.split(`/`),i=Loe(e,r,t,n);if(!i)return null;let[a]=BM(e,r,i);return{route:i.node.route,rawParams:a}}function BM(e,t,n){let r=Ioe(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===NM)break;if(u.kind===PM){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix.length;if(e.charCodeAt(t)===123){let n=u.suffix.length,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix.length,r=u.suffix.length,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function VM(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Ioe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Loe(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!bM(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!WM(l,n))continue;if(i.parse){if(!UM(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==NM&&WM(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===NM||i.kind===2)&&WM(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(UM(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Roe(f,o))return n;WM(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+HM(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+HM(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+HM(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+HM(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function HM(e,t){return 2**(e-t-1)}function Roe(e,t){return e===2**(t-1)-1}function UM(e,t,n){let r,i;try{[r,i]=BM(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function WM(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===NM)>(e.node.kind===NM)||t.node.kind===NM==(e.node.kind===NM)&&t.node.depth>e.node.depth)))}function zoe(e){return GM(e.filter(e=>e!==void 0).join(`/`))}function GM(e){return e.replace(/\/{2,}/g,`/`)}function KM(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function qM(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Boe(e){return qM(KM(e))}function JM(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Voe(e,t,n){return JM(e,n)===JM(t,n)}function Hoe({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=GM(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=GM(e)),o=e.split(`/`);o.length>1&&bM(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(bM(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?GM(s):s)||`/`;return a&&r&&r.set(a,c),c}function Uoe(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function YM(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>XM(e,n)).join(`/`):XM(r,n):r}function Woe({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=FM(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=YM(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=YM(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=YM(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function XM(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Goe=`Error preloading route! ☝️`,Koe=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ZM=t(((e,t)=>{t.exports=Koe()})),Q=ZM();function qoe({children:e,fallback:t=null}){return(0,Q.jsx)(Z.Fragment,{children:QM()?e:t})}function QM(){return Z.useSyncExternalStore(Joe,()=>!0,()=>!1)}function Joe(){return()=>{}}var $M=Z.createContext(null);function eN(e){return Z.useContext($M)}var Yoe=t((e=>{var t=_M();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),tN=t(((e,t)=>{t.exports=Yoe()})),Xoe=t((e=>{var t=_M(),n=tN();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),nN=t(((e,t)=>{t.exports=Xoe()})),rN=nN();function Zoe(e,t){return e===t}function iN(e,t,n=Zoe){let r=(0,Z.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,Z.useCallback)(()=>e?.get(),[e]);return(0,rN.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function aN(e){let t=eN();return Z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Qoe(e){let t=eN(),n=aN(),r=Z.useRef(null);return vM(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function oN(e){let t=Z.useRef(e);return OM(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function $oe(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ese(e,t,n){if(e?.external)return AM(e.href,n)?void 0:e.href;if(!sse(t)&&yM(t))return AM(t,n)?void 0:t}function tse(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Voe(e.pathname,t.pathname,r))return!1}else{let n=JM(e.pathname,r),i=JM(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!OM(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function nse(e,t){let n=eN(),r=_oe(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:I,...L}=e,R=s,ee=QM(),z=oN(e.search),te=oN(e.params),ne=oN(o),re=Z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,z,te,e.state,e.mask,e.unsafeRelative]),ie=Z.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...re}),r=ose(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=ese(r,R,n.protocolAllowlist);return[r?.href,i,tse(e,t,ne,n.basepath,ee,i!==void 0)]},[ne,v,ee,re,n,R]),[ae,oe,se]=iN(n.stores.location,ie,$oe),ce=se?xM(i,{})??rse:sN,le=se?sN:xM(a,{})??sN,ue=[b,ce.className,le.className].filter(Boolean).join(` `),de=(y||ce.style||le.style)&&{...y,...ce.style,...le.style},fe=Z.useRef(!1),pe=e.reloadDocument||oe||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,he=Z.useCallback(()=>{n.preloadRoute(re).catch(e=>{console.warn(e),console.warn(Goe)})},[n,re]),ge=Z.useCallback(e=>{if(!e){lN(r);return}if(!(e.isIntersecting??pe===`intent`)){e.isIntersecting===!1&&lN(r);return}if(!me){he();return}cN.has(r)||cN.set(r,setTimeout(()=>{cN.delete(r),he()},me))},[he,r,pe,me]);goe(r,ge,pe!==`viewport`),Z.useEffect(()=>{fe.current||pe===`render`&&(he(),fe.current=!0)},[he,pe]);let _e=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...re,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(oe)return{...L,ref:r,href:oe,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ve=()=>{pe===`intent`&&he()},ye=()=>{pe===`intent`&&lN(r)};return{...L,...ce,...le,href:ae,ref:r,onClick:uN([x,_e]),onBlur:uN([S,ye]),onFocus:uN([C,ge]),onMouseEnter:uN([w,ge]),onMouseLeave:uN([T,ye]),onTouchStart:uN([E,ve]),disabled:!!v,target:_,...de&&{style:de},...ue&&{className:ue},...v&&ise,...se&&ase}}var sN={},rse={className:`active`},ise={role:`link`,"aria-disabled":!0},ase={"data-status":`active`,"aria-current":`page`},cN=new WeakMap,lN=e=>{clearTimeout(cN.get(e)),cN.delete(e)},uN=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ose(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function sse(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var dN=Z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=nse(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return Z.createElement(`a`,t,o)}return Z.createElement(n,a,o)}),cse=e=>e,lse=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),fN=t(((e,t)=>{t.exports=lse()})),use=t((e=>{var t=_M();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),pN=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=use()})),dse=t((e=>{var t=_M().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}})),mN=t(((e,t)=>{t.exports=dse()})),hN=e(fN(),1);function fse(e){let t=hN.unstable_scheduleCallback(4,e);return()=>hN.unstable_cancelCallback(t)}var gN=Z.createContext(BT({scheduleTask:fse,defaultIdleTTL:400})),_N=new WeakMap;function pse(e,t){let n=_N.get(e);n===void 0&&(n=new WeakMap,_N.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i={subscribe(n){return e.subscribe(t,n)},snapshot(){return e.get(t)},getServerSnapshot(){return aD(t,e)}};return n.set(t,i),i}function vN(e,t){let n=pse(e,t);return Z.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}var yN=(e,t)=>{let n=Z.useContext(gN);return t?vN(n,Z.useMemo(()=>qE(e,t),[e,t])):vN(n,e)};function bN(e,t){Z.useEffect(()=>e.mount(t),[t,e])}function xN(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?Z.useCallback(r=>{e.set(t,r);let i=Bp(UT(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(mse):i},[e,t,n.mode]):Z.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var mse=e=>{if(cu(e))return e.value;throw Vl(e.cause)},SN=e=>{bN(Z.useContext(gN),e)},CN=(e,t)=>{let n=Z.useContext(gN);return bN(n,e),xN(n,e,t)},wN=e=>{let t=Z.useContext(gN);return bN(t,e),Z.useCallback(()=>{t.refresh(e)},[t,e])},TN=(e,t)=>{let n=Z.useContext(gN);return[vN(n,e),xN(n,e,t)]},EN={suspendOnWaiting:new WeakMap,default:new WeakMap};function hse(e,t,n){let r=n?EN.suspendOnWaiting:EN.default,i=r.get(e);i===void 0&&(i=new WeakMap,r.set(e,i));let a=i.get(t);return a===void 0?(a=new Promise(r=>{let a=e.subscribe(t,e=>{e._tag===`Initial`||n&&e.waiting||(setTimeout(a,1e3),r(),i.delete(t))})}),i.set(t,a),a):a}function gse(e,t,n){let r=vN(e,t);if(r._tag===`Initial`||n&&r.waiting)throw hse(e,t,n);return r}var _se=(e,t)=>{let n=gse(Z.useContext(gN),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw Vl(n.cause);return n},DN=e=>{let[,t]=Z.useReducer(e=>e+1,0);return Z.useEffect(()=>e.subscribe(t),[e]),e.value},ON=tN();function kN(){}var AN=Object.freeze([]),jN=Object.freeze({});function MN(e){Z.useEffect(e,AN)}var NN={};function PN(e,t){let n=Z.useRef(NN);return n.current===NN&&(n.current=e(t)),n}var FN=typeof document<`u`?Z.useLayoutEffect:()=>{},IN=e(pN(),1);function vse(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var LN=vse(`https://base-ui.com/production-error`,`Base UI`),yse=19;function RN(e){return yse>=e}var zN=[],BN=void 0;function bse(){return BN}function xse(e){zN.push(e)}function VN(e){let t=(t,n)=>{let r=PN(Sse).current,i;try{BN=r;for(let e of zN)e.before(r);i=e(t,n);for(let e of zN)e.after(r);r.didInitialize=!0}finally{BN=void 0}return i};return t.displayName=e.displayName||e.name,t}function HN(e){return Z.forwardRef(VN(e))}function Sse(){return{didInitialize:!1}}var Cse=RN(19)?Tse:Ese;function UN(e,t,n,r,i){return Cse(e,t,n,r,i)}function wse(e,t,n,r,i){let a=Z.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,ON.useSyncExternalStore)(e.subscribe,a,a)}xse({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,ON.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Tse(e,t,n,r,i){let a=bse();if(!a)return wse(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Ese(e,t,n,r,i){return(0,rN.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Dse=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return UN(this,e,t,n,r)}},WN={...Z},GN=WN.useInsertionEffect,Ose=GN&&GN!==WN.useLayoutEffect?GN:e=>e();function KN(e){let t=PN(kse).current;return t.next=e,Ose(t.effect),t.trampoline}function kse(){let e={next:void 0,callback:Ase,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Ase(){}var qN=class extends Dse{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Z.useDebugValue(e);let n=this;FN(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;FN(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;FN(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){Z.useDebugValue(e);let n=this,r=t!==void 0;FN(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return Z.useDebugValue(e),UN(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Z.useDebugValue(e);let n=KN(t??kN);this.context[e]=n}useStateSetter(e){let t=Z.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function JN(){return typeof window<`u`}function YN(e){return QN(e)?(e.nodeName||``).toLowerCase():`#document`}function XN(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ZN(e){return((QN(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function QN(e){return JN()?e instanceof Node||e instanceof XN(e).Node:!1}function $N(e){return JN()?e instanceof Element||e instanceof XN(e).Element:!1}function eP(e){return JN()?e instanceof HTMLElement||e instanceof XN(e).HTMLElement:!1}function tP(e){return!JN()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof XN(e).ShadowRoot}function nP(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=lP(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function jse(e){return/^(table|td|th)$/.test(YN(e))}function rP(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Mse=/transform|translate|scale|rotate|perspective|filter/,Nse=/paint|layout|strict|content/,iP=e=>!!e&&e!==`none`,aP;function oP(e){let t=$N(e)?lP(e):e;return iP(t.transform)||iP(t.translate)||iP(t.scale)||iP(t.rotate)||iP(t.perspective)||!sP()&&(iP(t.backdropFilter)||iP(t.filter))||Mse.test(t.willChange||``)||Nse.test(t.contain||``)}function Pse(e){let t=dP(e);for(;eP(t)&&!cP(t);){if(oP(t))return t;if(rP(t))return null;t=dP(t)}return null}function sP(){return aP??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),aP}function cP(e){return/^(html|body|#document)$/.test(YN(e))}function lP(e){return XN(e).getComputedStyle(e)}function uP(e){return $N(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dP(e){if(YN(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||tP(e)&&e.host||ZN(e);return tP(t)?t.host:t}function fP(e){let t=dP(e);return cP(t)?(e.ownerDocument||e).body:eP(t)&&nP(t)?t:fP(t)}function pP(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=fP(e),i=r===e.ownerDocument?.body,a=XN(r);if(i){let e=mP(a);return t.concat(a,a.visualViewport||[],nP(r)?r:[],e&&n?pP(e):[])}return t.concat(r,pP(r,[],n))}function mP(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hP(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function gP(e){return e?.ownerDocument||document}function _P(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var vP=null;globalThis.requestAnimationFrame;var yP=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},bP=class e{static create(){return new e}static request(e){return yP.request(e)}static cancel(e){return yP.cancel(e)}currentId=vP;request(e){this.cancel(),this.currentId=yP.request(()=>{this.currentId=vP,e()})}cancel=()=>{this.currentId!==vP&&(yP.cancel(this.currentId),this.currentId=vP)};disposeEffect=()=>this.cancel};function xP(){let e=PN(bP.create).current;return MN(e.disposeEffect),e}var SP=0,CP=class e{static create(){return new e}currentId=SP;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=SP,t()},e)}isStarted(){return this.currentId!==SP}clear=()=>{this.currentId!==SP&&(clearTimeout(this.currentId),this.currentId=SP)};disposeEffect=()=>this.clear};function wP(){let e=PN(CP.create).current;return MN(e.disposeEffect),e}function Fse(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Ise,platform:Lse,maxTouchPoints:Rse}=Fse(),TP=Ise.toLowerCase(),EP=Lse.toLowerCase(),DP=/^i(os$|p)/.test(EP)||EP===`macintel`&&Rse>1,OP=`android`,kP=EP===OP||TP.includes(OP),AP=!DP&&EP.startsWith(`mac`);EP.startsWith(`win`),!kP&&/^(linux|chrome os)/.test(EP);var zse=AP||DP,jP=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!jP&&TP.includes(`firefox`),!jP&&TP.includes(`chrom`);var Bse=zse,MP=/jsdom|happydom/.test(TP);function NP(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function PP(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&tP(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function FP(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var Vse=`data-base-ui-focusable`,Hse=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,IP=`ArrowLeft`,LP=`ArrowRight`,Use=`ArrowUp`,Wse=`ArrowDown`,RP=`data-starting-style`,zP=`data-ending-style`,Gse={[RP]:``},Kse={[zP]:``},BP={transitionStatus(e){return e===`starting`?Gse:e===`ending`?Kse:null}},qse=`data-open`,Jse=`data-closed`,Yse=`data-anchor-hidden`,VP=`data-popup-open`,Xse=`data-pressed`,Zse={[VP]:``},Qse={[VP]:``,[Xse]:``},$se={[qse]:``},ece={[Jse]:``},tce={[Yse]:``},HP={open(e){return e?Zse:null}},UP={open(e){return e?Qse:null}},WP={open(e){return e?$se:ece},anchorHidden(e){return e?tce:null}},GP={...WP,...BP},KP=`data-trigger-disabled`;function qP(e,t){if(!$N(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(KP);for(let[,e]of t.entries())if(PP(e,n))return!e.hasAttribute(KP);return!1}function JP(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function nce(e){return e.matches(`html,body`)}function YP(e){return eP(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function rce(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Hse}`)!=null}function XP(e){return e?e.getAttribute(`role`)===`combobox`&&YP(e):!1}function ZP(e){if(!e||MP)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function QP(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function $P(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...$P(e,t.id,n)])}function eF(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function tF(e){e.preventDefault(),e.stopPropagation()}function ice(e){return`nativeEvent`in e}function nF(e){return e.pointerType===``&&e.isTrusted?!0:kP&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function rF(e){return MP?!1:!kP&&e.width===0&&e.height===0||kP&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function iF(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function ace(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var aF=Math.min,oF=Math.max,sF=Math.round,cF=Math.floor,lF=e=>({x:e,y:e}),oce={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function uF(e,t,n){return oF(e,aF(t,n))}function dF(e,t){return typeof e==`function`?e(t):e}function fF(e){return e.split(`-`)[0]}function pF(e){return e.split(`-`)[1]}function mF(e){return e===`x`?`y`:`x`}function hF(e){return e===`y`?`height`:`width`}function gF(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function _F(e){return mF(gF(e))}function sce(e,t,n){n===void 0&&(n=!1);let r=pF(e),i=_F(e),a=hF(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xF(o)),[o,xF(o)]}function cce(e){let t=xF(e);return[vF(e),t,vF(t)]}function vF(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var yF=[`left`,`right`],bF=[`right`,`left`],lce=[`top`,`bottom`],uce=[`bottom`,`top`];function dce(e,t,n){switch(e){case`top`:case`bottom`:return n?t?bF:yF:t?yF:bF;case`left`:case`right`:return t?lce:uce;default:return[]}}function fce(e,t,n,r){let i=pF(e),a=dce(fF(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(vF)))),a}function xF(e){let t=fF(e);return oce[t]+e.slice(t.length)}function pce(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function SF(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:pce(e)}function CF(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wF(e,t){return t<0||t>=e.length}function TF(e,t){return DF(e.current,{disabledIndices:t})}function EF(e,t){return DF(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function DF(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&OF(e,a,r));return a}function OF(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!kF(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function mce(e){return e.visibility===`hidden`||e.visibility===`collapse`}function kF(e,t=e?lP(e):null){return!e||!e.isConnected||!t||mce(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var hce=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function gce(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return tP(n)?n.host:null}function AF(e){for(let t of Array.from(e.children))if(YN(t)===`summary`)return t;return null}function _ce(e,t){let n=AF(t);return!!n&&(e===n||PP(n,e))}function jF(e){let t=e?YN(e):``;return e!=null&&e.matches(hce)&&(t!==`summary`||e.parentElement!=null&&YN(e.parentElement)===`details`&&AF(e.parentElement)===e)&&(t!==`details`||AF(e)==null)&&(t!==`input`||e.type!==`hidden`)}function MF(e){if(!jF(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=gce(t)){let n=t!==e,r=YN(t)===`slot`;if(t.hasAttribute(`inert`)||n&&YN(t)===`details`&&!t.open&&!_ce(e,t)||t.hasAttribute(`hidden`)||!r&&!vce(t,n))return!1}return!0}function vce(e,t){let n=lP(e);return t?n.display!==`none`:kF(e,n)}function NF(e){let t=e.tabIndex;if(t<0){let t=YN(e);if(t===`details`||t===`audio`||t===`video`||eP(e)&&e.isContentEditable)return 0}return t}function PF(e){if(YN(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function yce(e,t){let n=PF(e);if(!n)return!0;let r=t.find(e=>{let t=PF(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=PF(e);return t?.name===n.name&&t.form===n.form})===n}function FF(e){if(eP(e)&&YN(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return eP(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function IF(e,t){FF(e).forEach(e=>{jF(e)&&t.push(e),IF(e,t)})}function LF(e,t,n){FF(e).forEach(e=>{eP(e)&&e.matches(t)&&n.push(e),LF(e,t,n)})}function RF(e){return MF(e)&&NF(e)>=0}function zF(e){let t=[];return IF(e,t),t.filter(MF)}function BF(e){let t=zF(e);return t.filter(e=>NF(e)>=0&&yce(e,t))}function VF(e,t){let n=BF(e),r=n.length;if(r===0)return;let i=NP(gP(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function HF(e){return VF(gP(e).body,1)||e}function UF(e){return VF(gP(e).body,-1)||e}function WF(e,t){if(!e)return null;let n=BF(gP(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function bce(e){return WF(e,1)}function GF(e){return WF(e,-1)}function KF(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!PP(n,r)}function qF(e){BF(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function JF(e){let t=[];LF(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var YF={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},XF={...YF,position:`fixed`,top:0,left:0},ZF={...YF,position:`absolute`},QF=Z.forwardRef(function(e,t){let[n,r]=Z.useState();FN(()=>{Bse&&jP&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Q.jsx)(`span`,{...e,ref:t,style:XF,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function $F(e,t,n,r){let i=PN(tI).current;return nI(i,e,t,n,r)&&iI(i,[e,t,n,r]),i.callback}function eI(e){let t=PN(tI).current;return rI(t,e)&&iI(t,e),t.callback}function tI(){return{callback:null,cleanup:null,refs:[]}}function nI(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function rI(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function iI(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}function aI(e){if(!Z.isValidElement(e))return null;let t=e,n=t.props;return(RN(19)?n?.ref:t.ref)??null}function oI(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function sI(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function cI(e,t){return typeof e==`function`?e(t):e}function lI(e,t){return typeof e==`function`?e(t):e}var uI={};function dI(e,t,n,r,i){if(!n&&!r&&!i&&!e)return pI(t);let a=pI(e);return t&&(a=mI(a,t)),n&&(a=mI(a,n)),r&&(a=mI(a,r)),i&&(a=mI(a,i)),a}function fI(e){if(e.length===0)return uI;if(e.length===1)return pI(e[0]);let t=pI(e[0]);for(let n=1;n<e.length;n+=1)t=mI(t,e[n]);return t}function pI(e){return vI(e)?{...yI(e,uI)}:hI(e)}function mI(e,t){return vI(t)?yI(t,e):gI(e,t)}function hI(e){let t={...e};for(let e in t){let n=t[e];_I(e,n)&&(t[e]=xI(n))}return t}function gI(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=oI(e.style,r);break;case`className`:e[n]=CI(e.className,r);break;default:e[n]=_I(n,r)?bI(e[n],r):r}}return e}function _I(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function vI(e){return typeof e==`function`}function yI(e,t){return vI(e)?e(t):e??uI}function bI(e,t){return t?e?(...n)=>{let r=n[0];if(wI(r)){let i=r;SI(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:xI(t):e}function xI(e){return e&&((...t)=>{let n=t[0];return wI(n)&&SI(n),e(...t)})}function SI(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function CI(e,t){return t?e?t+` `+e:t:e}function wI(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function TI(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=kI(r));let i=EI(t,n,r);if(n.enabled===!1)return null;let a=n.state??jN;return AI(e,r,i,a)}function EI(e,t,n){let{className:r,style:i}=e,{state:a=jN,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?cI(r,a):void 0,d=l?lI(i,a):void 0,f=l?sI(a,c):jN,p=l&&s?DI(s):void 0,m=l?oI(f,p)??{}:jN;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?eI([m.ref,aI(n),...o]):$F(m.ref,aI(n),o):$F(null,null)),l?(u!==void 0&&(m.className=CI(m.className,u)),d!==void 0&&(m.style=oI(m.style,d)),m):jN}function DI(e){return Array.isArray(e)?fI(e):dI(void 0,e)}var OI=Symbol.for(`react.lazy`);function kI(e){if(e?.$$typeof!==OI)return e;let t=Z.Children.toArray(e)[0];return Z.isValidElement(t)?t:e}function AI(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=dI(n,t.props);return e.ref=n.ref,Z.cloneElement(t,e)}if(e&&typeof e==`string`)return jI(e,n);throw Error(LN(8))}function jI(e,t){return e===`button`?(0,Z.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,Z.createElement)(`img`,{alt:``,...t,key:t.key}):Z.createElement(e,t)}function MI(e){return RN(19)?e:e?`true`:void 0}function NI(e){return e==null?e:`current`in e?e.current:e}var PI=null;function FI(e){if(!PI){let e=[];PI=e,queueMicrotask(()=>{PI=null,IN.flushSync(()=>{for(let t of e)t()})})}PI.push(e)}function II(e,t=!1,n=!1){let r=xP();return KN((i,a=null)=>{r.cancel();let o=NI(e);if(o==null)return;let s=o,c=()=>{if(!n){IN.flushSync(i);return}FI(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(s.getAnimations().some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=RP;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function LI(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=KN(a),s=II(r,n,i);Z.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var RI={style:{transition:`none`}},zI=`data-base-ui-click-trigger`,BI=`data-base-ui-swipe-ignore`,VI=`data-swipe-ignore`,HI=`[${BI}]`,UI=`[${VI}]`,WI={fallbackAxisSide:`none`},GI={fallbackAxisSide:`end`},KI={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function qI(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var JI=0;function YI(e,t=`mui`){let[n,r]=Z.useState(e),i=e||n;return Z.useEffect(()=>{n??(JI+=1,r(`${t}-${JI}`))},[n,t]),i}var XI=WN.useId;function ZI(e,t){if(XI!==void 0){let n=XI();return e??(t?`${t}-${n}`:n)}return YI(e,t)}var QI=Z.createContext(void 0);function $I(e=!1){let t=Z.useContext(QI);if(t===void 0&&!e)throw Error(LN(16));return t}function eL(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:Z.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function tL(e,t,{detail:n=0}={}){e.dispatchEvent(new(XN(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function nL(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),s=$I(!0),c=a??s!==void 0,{props:l}=eL({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=Z.useCallback(()=>{let e=o.current;rL(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return FN(u,[u]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return dI({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(SI(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=rL(r),s=!i&&iL(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),tL(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),tL(r,e)))},onKeyUp(e){if(!t){if(SI(e),a?.(e),e.target===e.currentTarget&&i&&c&&rL(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),tL(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:KN(e=>{o.current=e,u()})}}function rL(e){return eP(e)&&e.tagName===`BUTTON`}function iL(e){return eP(e)&&e.tagName===`A`&&!!e.href}var aL=`none`,oL=`trigger-press`,sL=`trigger-hover`,cL=`trigger-focus`,lL=`outside-press`,uL=`item-press`,dL=`close-press`,fL=`focus-out`,pL=`escape-key`,mL=`list-navigation`,hL=`cancel-open`,gL=`sibling-open`,_L=`disabled`,vL=`missing`,yL=`initial`,bL=`imperative-action`,xL=`window-resize`;function SL(e,t,n,r){let i=!1,a=!1,o=r??jN;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function CL(e){return`data-base-ui-${e}`}var wL=Z.createContext(null),TL=()=>Z.useContext(wL),EL=CL(`portal`);function DL(e={}){let{ref:t,container:n,componentProps:r=jN,elementProps:i}=e,a=ZI(),o=TL()?.portalNode,[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=KN(e=>{e!==null&&u(e)}),f=Z.useRef(null);FN(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(QN(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=TI(`div`,r,{ref:[t,d],props:[{id:a,[EL]:``},i]}),m=s&&p?IN.createPortal(p,s):null;return{node:l,nodeId:Z.isValidElement(p)?p.props.id:void 0,subtree:m}}var OL=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=DL({container:o,ref:t,componentProps:e,elementProps:c}),f=Z.useRef(null),p=Z.useRef(null),m=Z.useRef(null),h=Z.useRef(null),[g,_]=Z.useState(null),v=Z.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;Z.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&KF(e)&&(e.type===`focusin`?v.current&&=(JF(l),!1):(qF(l),v.current=!0))}return hP(_P(l,`focusin`,e,!0),_P(l,`focusout`,e,!0))},[l,y]),FN(()=>{l&&b===!0&&v.current&&(JF(l),v.current=!1)},[b,l]);let S=Z.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,Q.jsxs)(Z.Fragment,{children:[d,(0,Q.jsxs)(wL.Provider,{value:S,children:[x&&l&&(0,Q.jsx)(QF,{"data-type":`outside`,ref:f,onFocus:e=>{KF(e,l)?m.current?.focus():UF(g?g.domReference:null)?.focus()}}),x&&l&&(0,Q.jsx)(`span`,{role:s,"aria-owns":u,style:KI}),l&&IN.createPortal(a,l),x&&l&&(0,Q.jsx)(QF,{"data-type":`outside`,ref:p,onFocus:e=>{KF(e,l)?h.current?.focus():(HF(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,SL(`focus-out`,e.nativeEvent)))}})]})]})}),kL=Z.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=DL({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Q.jsxs)(Z.Fragment,{children:[l,c&&IN.createPortal(n,c)]})});function AL(e){let t=PN(jL,e).current;return t.next=e,FN(t.effect),t}function jL(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ML(e,t){return t!=null&&!iF(t)?0:typeof e==`function`?e():e}function NL(e,t,n){let r=ML(e,n);return typeof r==`number`?r:r?.[t]}function PL(e){return typeof e==`function`?e():e}function FL(e,t){return t||e===`click`||e===`mousedown`}function IL(e){return e?.includes(`mouse`)&&e!==`mousedown`}var LL=Z.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new CP,currentIdRef:{current:null},currentContextRef:{current:null}});function RL(e,t){e.current=t.current}function zL(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Z.useRef(n),a=Z.useRef(n),o=Z.useRef(null),s=Z.useRef(null),c=wP();return FN(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:NL(i.current,`open`),close:NL(n,`close`)}},[n,o,i,a]),(0,Q.jsx)(LL.Provider,{value:Z.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function BL(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Z.useContext(LL),[f,p]=Z.useState(!1),m=Z.useRef(n);return FN(()=>{m.current=n},[n]),FN(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),FN(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:NL(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,SL(aL))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),FN(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,RL(o,c),d.clear()}},[l,a,o,i,c,d]),Z.useMemo(()=>({activeIdRef:a,hasProvider:u,delayRef:o,isInstantPhase:f}),[a,u,o,f])}var VL=0;function HL(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(VL);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),kN;let o=requestAnimationFrame(a);return VL=o,()=>{VL===o&&(cancelAnimationFrame(o),VL=0)}}var UL={inert:new WeakMap,"aria-hidden":new WeakMap},WL=`data-base-ui-inert`,GL={inert:new WeakSet,"aria-hidden":new WeakSet},KL=new WeakMap,qL=0;function JL(e){return GL[e]}function YL(e){return e?tP(e)?e.host:YL(e.parentNode):null}var XL=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=YL(t);return e.contains(n)?n:null}).filter(e=>e!=null),ZL=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},QL=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{YN(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function $L(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=XL(t,e),l=i?QL(t,ZL(c),new Set(c)):[],u=[],d=[];if(a){let e=UL[a],n=JL(a);s=n,o=e;let r=XL(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);QL(t,ZL(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(KL.get(e)||0)+1;KL.set(e,t),d.push(e),t===1&&e.setAttribute(WL,``)}),qL+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(KL.get(e)||0)-1;KL.set(e,t),t||e.removeAttribute(WL)}),--qL,qL||(UL.inert=new WeakMap,UL[`aria-hidden`]=new WeakMap,GL.inert=new WeakSet,GL[`aria-hidden`]=new WeakSet,KL=new WeakMap)}}function eR(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=gP(e[0]).body;return $L(e,a,n,r,{mark:i})}function tR(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var nR=class{nodesRef={current:[]};events=tR();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},rR=Z.createContext(null),iR=Z.createContext(null),aR=()=>Z.useContext(rR)?.id||null,oR=e=>{let t=Z.useContext(iR);return e??t};function sR(e){let t=ZI(),n=oR(e),r=aR();return FN(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function cR(e){let{children:t,id:n}=e,r=aR();return(0,Q.jsx)(rR.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function lR(e){let{children:t,externalTree:n}=e,r=PN(()=>n??new nR).current;return(0,Q.jsx)(iR.Provider,{value:r,children:t})}function uR(e,t){let n=XN(FP(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var dR=20,fR=[];function pR(){fR=fR.filter(e=>e.deref()?.isConnected)}function mR(e){pR(),e&&YN(e)!==`body`&&(fR.push(new WeakRef(e)),fR.length>dR&&(fR=fR.slice(-20)))}function hR(){return pR(),fR[fR.length-1]?.deref()}function gR(e){return e?RF(e)?e:BF(e)[0]||e:null}function _R(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=zF(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return RF(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function vR(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=KN(()=>b.current.floatingContext?.nodeId),S=i===!1,C=XP(_)&&S,w=AL(i),T=AL(a),E=AL(l),D=AL(g),O=oR(p),k=TL(),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef(!1),N=Z.useRef(null),P=Z.useRef(``),F=Z.useRef(``),I=Z.useRef(null),L=Z.useRef(null),R=$F(I,f,k?.beforeInsideRef),ee=$F(L,k?.afterInsideRef),z=wP(),te=wP(),ne=xP(),re=k!=null,ie=QP(v),ae=KN((e=ie)=>e?BF(e):[]),oe=KN(()=>m?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&PP(ie,NP(gP(ie)))&&ae().length===0&&!C&&tF(e)}return _P(gP(ie),`keydown`,e)},[r,ie,s,C,ae]),Z.useEffect(()=>{if(r||!g)return;let e=gP(ie);function t(){M.current=!1}function n(e){let t=FP(e),n=oe(),r=PP(v,t)||PP(_,t)||PP(k?.portalNode,t)||n.some(e=>e===t||PP(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,te.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return hP(_P(e,`pointerdown`,n,!0),_P(e,`pointerup`,t,!0),_P(e,`pointercancel`,t,!0),_P(e,`keydown`,i,!0),t)},[r,v,_,ie,g,k,te,oe]),Z.useEffect(()=>{if(r||!c)return;let e=gP(ie);function t(){j.current=!0,te.start(0,()=>{j.current=!1})}function n(e){let t=FP(e);RF(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=FP(t);s&&n==null&&i!=null&&PP(v,i)&&mR(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=oe(),f=n?.hasAttribute(CL(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,NI(d),NI(u)].includes(n),p=!(PP(_,n)||PP(v,n)||PP(n,v)||PP(k?.portalNode,n)||l.some(e=>e===n||PP(e,n))||c.hasMatchingElement(e=>PP(e,n))||f||O&&($P(O.nodesRef.current,a).find(e=>PP(e.context?.elements.floating,n)||PP(e.context?.elements.domReference,n))||eF(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,QP(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&ie&&_R(ie),o&&r!==_&&!kF(i)&&NP(e)===e.body){if(eP(ie)&&(ie.focus(),o===`popup`)){ne.request(()=>{ie.focus()});return}let e=ae(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ie;eP(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!j.current&&(C||n!==hR())&&(A.current=!0,h.setOpen(!1,SL(fL,t)))})}function a(){M.current||(b.current.insideReactTree=!0,z.start(0,()=>{b.current.insideReactTree=!1}))}let l=eP(_)?_:null;if(v||l)return hP(l&&_P(l,`focusout`,i),l&&_P(l,`pointerdown`,t),v&&_P(v,`focusin`,n),v&&_P(v,`focusout`,i),v&&k&&_P(v,`focusout`,a,!0))},[r,_,v,ie,s,O,k,h,c,o,ae,C,x,b,z,te,ne,u,d,oe]),Z.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${CL(`portal`)}]`)||[]),t=(O?eF(O.nodesRef.current,x()):[]).find(e=>XP(e.context?.elements.domReference||null))?.context?.elements.domReference,n=eR([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...oe(),t,NI(d),NI(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=eR([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,oe]),FN(()=>{if(!g||r||!eP(ie))return;P.current=``,F.current=``;let e=gP(ie),t=NP(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||PP(ie,t))return;let i=null,a=()=>(i??=ae(ie),i[0]||ie),o;o=r===!0||r===null?a():NI(r),o||=a();let s=PP(ie,NP(e));HL(o,{preventScroll:o===ie,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=NP(e);return!(t!==o&&PP(ie,t))}})})},[r,g,ie,ae,w,E,D]),FN(()=>{if(r||!ie)return;let e=gP(ie),t=NP(e),n=E.current==null;mR(t);function i(e){if(e.open||(P.current=uR(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(nF(e.nativeEvent)||rF(e.nativeEvent))A.current=!1;else{let e=!1;gP(ie).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&YN(t)!==`body`?t:null,s=n?o||a:a||o;return s||=hR()||null,typeof i==`boolean`?s:NI(i)||s||null}return()=>{y.off(`openchange`,i);let t=NP(e),n=oe(),r=PP(v,t)||n.some(e=>e===t||PP(e,t))||O&&$P(O.nodesRef.current,x(),!1).some(e=>PP(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=gR(c),i=typeof o!=`boolean`;if(o&&!A.current&&eP(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,ie,T,E,y,O,_,x,oe]),FN(()=>{if(!jP||g||!v)return;let e=NP(gP(v));eP(e)&&YP(e)&&PP(v,e)&&e.blur()},[g,v]),FN(()=>{if(!r&&k)return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),FN(()=>{if(!r&&ie)return _R(ie),()=>{queueMicrotask(pR)}},[r,ie]);let se=!r&&(!s||!C)&&(re||s);return(0,Q.jsxs)(Z.Fragment,{children:[se&&(0,Q.jsx)(QF,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=ae();HL(e[e.length-1])}else k?.portalNode&&(A.current=!1,KF(e,k.portalNode)?HF(_)?.focus():NI(d??k.beforeOutsideRef)?.focus())}}),n,se&&(0,Q.jsx)(QF,{"data-type":`inside`,ref:ee,onFocus:e=>{s?HL(ae()[0]):k?.portalNode&&(c&&(A.current=!0),KF(e,k.portalNode)?UF(_)?.focus():NI(u??k.afterOutsideRef)?.focus())}})]})}function yR(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=oL}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),f=xP(),p=wP(),m=Z.useMemo(()=>{function e(e,t,n,r){let i=SL(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=iF(e.pointerType,!0)&&rF(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||iF(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=FP(o);if(YP(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}iF(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return Z.useMemo(()=>n?{reference:m}:jN,[n,m])}function bR(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function xR(e){return e!=null&&e.clientX!=null}function SR(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Z.useRef(!1),u=Z.useRef(null),[d,f]=Z.useState(),[p,m]=Z.useState([]),h=KN(e=>{i.set(`positionReference`,e)}),g=KN((e,t,n)=>{l.current||(!c.current.openEvent||xR(c.current.openEvent))&&i.set(`positionReference`,bR(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=KN(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=iF(d)?o:a;Z.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=XN(o);function r(t){let n=FP(t);PP(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||xR(c.current.openEvent)?u.current=_P(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),Z.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Z.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Z.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=Z.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return Z.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function CR(){return!1}function wR(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function TR(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=CR,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f,events:p}=l.context,m=oR(c),h=KN(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=KN(()=>a),{escapeKey:y,outsidePress:b}=wR(s),x=Z.useRef(!1),S=Z.useRef(!1),C=Z.useRef(!1),w=Z.useRef(!1),T=Z.useRef(!1),E=Z.useRef(``),D=Z.useRef(null),O=wP(),k=wP(),A=KN(()=>{k.clear(),f.current.insideReactTree=!1}),j=KN(e=>{let t=f.current.floatingContext?.nodeId;return(m?$P(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=KN(e=>JP(e,l.select(`floatingElement`))||JP(e,l.select(`domReferenceElement`))),N=KN(e=>{o()&&l.setOpen(!1,SL(oL,e.nativeEvent))}),P=KN(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=SL(pL,ice(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),F=KN(()=>{f.current.insideReactTree=!0,k.start(0,A)}),I=KN(e=>{if(!u||!n||e.button!==0)return;let t=FP(e.nativeEvent);PP(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),L=KN(e=>{u&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});Z.useEffect(()=>{function e(e){e.open||(w.current=!1)}return p.on(`openchange`,e),()=>{p.off(`openchange`,e)}},[p]),Z.useEffect(()=>{if(!u||!n)return u||(w.current=!1),A;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let e=new CP,t=new CP,i=gP(d);function a(){e.clear(),T.current=!0}function o(){e.start(jP?5:0,()=>{T.current=!1})}function s(){C.current=!0,t.start(0,()=>{C.current=!1})}function c(){x.current=!1,S.current=!1}function p(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=p();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function k(e){let t=f.current.floatingContext?.nodeId,n=m&&$P(m.nodesRef.current,t).some(t=>JP(e,t.context?.elements.floating));return M(e)||n}function N(e){if(h(e)){e.type!==`click`&&!M(e)&&(t.clear(),C.current=!1),A();return}if(f.current.insideReactTree){A();return}let n=FP(e),r=`[${CL(`inert`)}]`,i=$N(n)?n.getRootNode():null,a=Array.from((tP(i)?i:gP(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>PP(e,n))))return;let s=$N(n)?n:null;for(;s&&!cP(s);){let e=dP(s);if(cP(e)||!$N(e))break;s=e}if(!(a.length&&$N(n)&&!nce(n)&&!PP(n,l.select(`floatingElement`))&&a.every(e=>!PP(s,e)))){if(eP(n)&&!(`touches`in e)){let t=cP(n),r=lP(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!k(e)){if(p()===`intentional`){if(e.detail!==0&&!nF(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}(typeof g!=`function`||g(e))&&(j(`__outsidePressBubbles`)||(l.setOpen(!1,SL(lL,e)),A()))}}}function F(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!M(e)&&N(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=FP(e);if(!n)return;let r=_P(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,I)}function ee(e){O.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!D.current||D.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function z(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;if(c(),p()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!k(e)){if(n){s();return}(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,A())}}}function te(e){if(p()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(N(e),O.clear(),D.current=null)}function ne(e){L(e,te)}function re(e){p()===`sloppy`&&D.current&&!M(e)&&(D.current.dismissOnTouchEnd&&N(e),O.clear(),D.current=null)}function ie(e){L(e,re)}let ae=hP(r&&hP(_P(i,`keydown`,P),_P(i,`compositionstart`,a),_P(i,`compositionend`,o)),_&&hP(_P(i,`click`,ee,!0),_P(i,`pointerdown`,ee,!0),_P(i,`pointerup`,z,!0),_P(i,`pointercancel`,z,!0),_P(i,`mousedown`,ee,!0),_P(i,`mouseup`,z,!0),_P(i,`touchstart`,R,{capture:!0,passive:!0}),_P(i,`touchmove`,ne,{capture:!0,passive:!0}),_P(i,`touchend`,ie,{capture:!0,passive:!0})));return()=>{ae(),e.clear(),t.clear(),c(),C.current=!1,A()}},[f,d,r,_,g,u,n,y,b,P,A,v,j,M,m,l,O]);let R=Z.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ee=Z.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return Z.useMemo(()=>n?{reference:R,floating:ee,trigger:R}:{},[n,R,ee])}function ER(e,t,n){let{reference:r,floating:i}=e,a=gF(t),o=_F(t),s=hF(o),c=fF(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=pF(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function DR(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=dF(t,e),p=SF(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=CF(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=CF(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var OR=50,kR=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:DR},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ER(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<OR&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ER(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},AR=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=dF(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=fF(r),_=gF(o),v=fF(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xF(o)]:cce(o)),x=p!==`none`;!d&&x&&b.push(...fce(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=sce(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===gF(t)||T.every(e=>gF(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=gF(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},jR=new Set([`left`,`top`]);async function MR(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=fF(n),s=pF(n),c=gF(n)===`y`,l=jR.has(o)?-1:1,u=a&&c?-1:1,d=dF(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var NR=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await MR(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},PR=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=dF(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=gF(i),p=mF(f),m=u[p],h=u[f],g=(e,t)=>uF(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},FR=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=dF(e,t),u={x:n,y:r},d=gF(i),f=mF(d),p=u[f],m=u[d],h=dF(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=jR.has(fF(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},IR=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=dF(e,t),c=await i.detectOverflow(t,s),l=fF(n),u=pF(n),d=gF(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=aF(p-c[m],g),y=aF(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*oF(c.left,c.right):S=p-2*oF(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function LR(e){let t=lP(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=eP(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=sF(n)!==a||sF(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function RR(e){return $N(e)?e:e.contextElement}function zR(e){let t=RR(e);if(!eP(t))return lF(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=LR(t),o=(a?sF(n.width):n.width)/r,s=(a?sF(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var BR=lF(0);function VR(e){let t=XN(e);return!sP()||!t.visualViewport?BR:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function HR(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===XN(e)}function UR(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=RR(e),o=lF(1);t&&(r?$N(r)&&(o=zR(r)):o=zR(e));let s=HR(a,n,r)?VR(a):lF(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=XN(a),t=$N(r)?XN(r):r,n=e,i=mP(n);for(;i&&t!==n;){let e=zR(i),t=i.getBoundingClientRect(),r=lP(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=XN(i),i=mP(n)}}return CF({width:u,height:d,x:c,y:l})}function WR(e,t){let n=uP(e).scrollLeft;return t?t.left+n:UR(ZN(e)).left+n}function GR(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-WR(e,n),y:n.top+t.scrollTop}}function KR(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ZN(r),s=t?rP(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=lF(1),u=lF(0),d=eP(r);if((d||!a)&&((YN(r)!==`body`||nP(o))&&(c=uP(r)),d)){let e=UR(r);l=zR(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?GR(o,c):lF(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function qR(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function JR(e){let t=uP(e),n=e.ownerDocument.body,r=oF(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=oF(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+WR(e),o=-t.scrollTop;return lP(n).direction===`rtl`&&(a+=oF(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var YR=25;function XR(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=XN(e),a=ZN(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!sP()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(WR(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=YR&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ZR(e,t){let n=UR(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=zR(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function QR(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=XR(e,n,t);else if(t===`document`)r=JR(ZN(e));else if($N(t))r=ZR(t,n);else{let n=VR(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return CF(r)}function $R(e,t){let n=t.get(e);if(n)return n;let r=pP(e,[],!1).filter(e=>$N(e)&&YN(e)!==`body`),i=null,a=lP(e).position===`fixed`,o=a?dP(e):e;for(;$N(o)&&!cP(o);){let e=lP(o),t=oP(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=dP(o)}return t.set(e,r),r}function ez(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?rP(t)?[]:$R(t,this._c):[].concat(n),r],o=QR(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=QR(t,a[e],i);s=oF(n.top,s),c=aF(n.right,c),l=aF(n.bottom,l),u=oF(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function tz(e){let{width:t,height:n}=LR(e);return{width:t,height:n}}function nz(e,t,n){let r=eP(t),i=ZN(t),a=n===`fixed`,o=UR(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=lF(0);if((r||!a)&&((YN(t)!==`body`||nP(i))&&(s=uP(t)),r)){let e=UR(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=WR(i));let l=i&&!r&&!a?GR(i,s):lF(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function rz(e){return lP(e).position===`static`}function iz(e,t){if(!eP(e)||lP(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ZN(e)===n&&(n=n.ownerDocument.body),n}function az(e,t){let n=XN(e);if(rP(e))return n;if(!eP(e)){let t=dP(e);for(;t&&!cP(t);){if($N(t)&&!rz(t))return t;t=dP(t)}return n}let r=iz(e,t);for(;r&&jse(r)&&rz(r);)r=iz(r,t);return r&&cP(r)&&rz(r)&&!oP(r)?n:r||Pse(e)||n}var oz=async function(e){let t=this.getOffsetParent||az,n=this.getDimensions,r=await n(e.floating);return{reference:nz(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sz(e){return lP(e).direction===`rtl`}var cz={convertOffsetParentRelativeRectToViewportRelativeRect:KR,getDocumentElement:ZN,getClippingRect:ez,getOffsetParent:az,getElementRects:oz,getClientRects:qR,getDimensions:tz,getScale:zR,isElement:$N,isRTL:sz};function lz(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uz(e,t,n){let r=null,i,a=ZN(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=cF(d),h=cF(a.clientWidth-(u+f)),g=cF(a.clientHeight-(d+p)),_=cF(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:oF(0,aF(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!lz(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=XN(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function dz(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=RR(e),u=i||a?[...l?pP(l):[],...t?pP(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?uz(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?UR(e):null;c&&g();function g(){let t=UR(e);h&&!lz(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var fz=NR,pz=PR,mz=AR,hz=IR,gz=FR,_z=(e,t,n)=>{let r=new Map,i=n??{},a={...cz,...i.platform,_c:r};return kR(e,t,{...i,platform:a})},vz=typeof document<`u`?Z.useLayoutEffect:function(){};function yz(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!yz(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!yz(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bz(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xz(e,t){let n=bz(e);return Math.round(t*n)/n}function Sz(e){let t=Z.useRef(e);return vz(()=>{t.current=e}),t}function Cz(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);yz(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=Sz(c),D=Sz(i),O=Sz(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),_z(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!yz(w.current,t)&&(w.current=t,IN.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);vz(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);vz(()=>(A.current=!0,()=>{A.current=!1}),[]),vz(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=xz(M.floating,u.x),r=xz(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bz(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var wz=(e,t)=>{let n=fz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tz=(e,t)=>{let n=pz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ez=(e,t)=>({fn:gz(e).fn,options:[e,t]}),Dz=(e,t)=>{let n=mz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oz=(e,t)=>{let n=hz(e);return{name:n.name,fn:n.fn,options:[e,t]}},kz={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},Az=class extends qN{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:tR(),nested:n,triggerElements:i},kz),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&ace(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function jz(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=Z.useRef(null);r===void 0&&f.current===null&&(f.current=new Az({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),FN(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};$N(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function Mz(e,t=!1,n=!1,r=!1){let[i,a]=Z.useState(e&&t?`idle`:void 0),[o,s]=Z.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),FN(()=>{if(!e&&o&&i!==`ending`&&n){let e=bP.request(()=>{a(`ending`)});return()=>{bP.cancel(e)}}},[e,o,i,n]),FN(()=>{if(!e||t)return;let n=bP.request(()=>{a(void 0)});return()=>{bP.cancel(n)}},[t,e]),FN(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=bP.request(()=>{a(`idle`)});return()=>{bP.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var Nz={tabIndex:-1,[Vse]:``};function Pz(e){return t=>t!==`touch`||e.current}function Fz(e,t=!1){let n=ZI(),r=aR()!=null,i=PN(()=>e(n,r)).current;return jz({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function Iz({handle:e,store:t}){return FN(()=>e.attachStore(t),[e,t]),null}function Lz(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function Rz(e,t){let n=Z.useRef(null);return KN(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),Lz(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Lz(t))})}function zz(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s}}function Bz(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Vz(e,t,n,r={}){let i=n.reason,a=i===sL,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Bz(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=zz(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?IN.flushSync(l):l()}function Hz(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Rz(e,n),o=KN(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=KN(e=>{a(e),e&&o(e)});return FN(()=>(s(t.current),()=>s(null)),[s,t,n,e]),FN(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Uz(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Z.useRef(null),i=e.useState(`open`);FN(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=SL(aL);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function Wz(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=Mz(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=KN(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return LI({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function Gz(e,t){e.useSyncedValues(t),FN(()=>()=>{e.update({activeTriggerProps:jN,inactiveTriggerProps:jN,popupProps:jN})},[e])}function Kz(e,t){FN(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),FN(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var qz=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function Jz(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Az({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:jN,inactiveTriggerProps:jN,popupProps:jN}}var Yz=e=>e.triggerIdProp??e.activeTriggerId,Xz=e=>e.openProp??e.open,Zz=e=>(e.popupElement?.id??e.floatingId)||void 0;function Qz(e,t){return t!==void 0&&Xz(e)&&Yz(e)===t}function $z(e,t){return Qz(e,t)?!0:t!==void 0&&Xz(e)&&Yz(e)==null&&e.triggerCount===1}var eB={open:Xz,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Yz,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Zz,isTriggerActive:(e,t)=>t!==void 0&&Yz(e)===t,isOpenedByTrigger:(e,t)=>Qz(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Yz(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>$z(e,t)?Zz(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function tB(e){let t=Z.useCallback(t=>e===void 0?kN:e.subscribeStore(t),[e]),n=Z.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,ON.useSyncExternalStore)(t,n,()=>e?.serverStore)}function nB(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=ZI(),a=aR()!=null,o=PN(()=>new Az({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new qz,floatingId:i,syncOnly:!1,nested:a})).current;return FN(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=$N(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function rB(e){return iB(e,e.rootContext)}function iB(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=oR(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=Cz({...e,elements:{..._,...l&&{reference:l}}}),y=$N(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Z.useCallback(e=>{let t=$N(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{($N(e)||e===null)&&(h.current=e,f(e)),($N(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!$N(e))&&v.refs.setReference(e)},[v.refs,f]),C=Z.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Z.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Z.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Z.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return FN(()=>{o&&(h.current=o)},[o]),FN(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var aB=AP&&jP;function oB(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Z.useRef(!1),c=Z.useRef(null),l=Z.useRef(!0),u=wP();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=XN(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&eP(e)&&e===NP(gP(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return hP(_P(t,`blur`,r),aB&&_P(t,`keydown`,a,!0),aB&&_P(t,`pointerdown`,o,!0))},[i,n]),Z.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);$N(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Z.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=FP(t.nativeEvent);if($N(a)){if(aB&&!t.relatedTarget){if(!l.current&&!YP(a))return}else if(!ZP(a))return}let o=qP(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,SL(cL,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,SL(cL,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=$N(n)&&n.hasAttribute(CL(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=NP(gP(e));(n||t!==e)&&(PP(o.current.floatingContext?.refs.floating.current,t)||PP(e,t)||a||qP(n??t,i.context.triggerElements)||i.setOpen(!1,SL(cL,r)))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var sB=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new CP,this.restTimeout=new CP,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},cB=new WeakMap;function lB(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&cB.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),cB.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function uB(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=cB.get(n);a&&a!==e&&lB(a),lB(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,cB.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function dB(e){let t=e.context.dataRef.current,n=PN(()=>t.hoverInteractionState??sB.create()).current;return t.hoverInteractionState||=n,MN(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function fB(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=oR(),d=aR(),f=dB(a),p=wP(),m=KN(()=>FL(l.current.openEvent?.type,f.interactedInside)),h=KN(()=>IL(l.current.openEvent?.type)),g=KN(()=>{lB(f)});FN(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Z.useEffect(()=>g,[g]),FN(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&$N(c)&&s){let e=c,t=s,n=gP(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return uB(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Z.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&$P(u.nodesRef.current,d).length>0)}function t(e){let t=NL(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,SL(sL,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=FP(e);if(!rce(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(qP(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&$N(o)&&$P(u.nodesRef.current,r,!1).some(e=>PP(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){u&&d&&!e()&&p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,SL(sL,t)),u.events.emit(`floating.closed`,t)})}let y=s;return hP(y&&_P(y,`mouseenter`,c),y&&_P(y,`mouseleave`,_),y&&_P(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var pB={current:null};function mB(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=pB,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=oR(l),y=dB(h),b=Z.useRef(!1),x=AL(i),S=AL(r),C=AL(o),w=AL(n),T=AL(p),E=AL(f),D=KN(()=>FL(g.current.openEvent?.type,y.interactedInside)),O=KN(()=>T.current?.()!==!1),k=KN((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!PP(e,t);if(!$N(n))return!1;let i=n;return r.hasMatchingElement(e=>PP(e,i))&&(!e||!PP(e,i))}),A=KN(()=>{y.handler&&=(gP(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=KN(()=>{lB(y)});return u&&(y.handleCloseOptions=i?.__options),Z.useEffect(()=>A,[A]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===sL,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),Z.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=NL(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,SL(sL,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,SL(sL,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!$N(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!iF(y.pointerType))return;let t=PL(C.current),n=NL(S.current,`open`,y.pointerType),r=FP(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if($N(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(PP(e,r)){s=e;break}}$N(i)&&$N(o)&&!h.context.triggerElements.hasElement(i)&&PP(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&$N(s)&&$N(o)&&PP(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,SL(sL,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,SL(sL,e,s))}):g&&O()&&h.setOpen(!0,SL(sL,e,s)))}function i(t){if(D()){j();return}A();let n=gP(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!qP(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!PP(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){PP(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?_P(t,`mouseout`,o):void 0;return s?hP(_P(t,`mousemove`,r,{once:!0}),_P(t,`mouseenter`,r),_P(t,`mouseleave`,i),l):hP(_P(t,`mouseenter`,r),_P(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),Z.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!iF(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;uB(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=PL(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,SL(sL,t,n))}y.pointerType===`touch`?IN.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var hB=`Escape`;function gB(e){return jP&&e.movementX===0&&e.movementY===0}function _B(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function vB(e,t){return _B(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function yB(e,t,n){return _B(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function bB(e,t,n){return _B(t,n?e===IP:e===LP,e===Wse)}function xB(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===hB:_B(t,n?e===LP:e===IP,e===Use)}function SB(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=QP(T),k=XP(E),A=AL(O),j=aR(),M=oR(b),N=Z.useRef(f),P=Z.useRef(o??-1),F=Z.useRef(null),I=Z.useRef(!0),L=KN(e=>{i(P.current===-1?null:P.current,e)}),R=Z.useRef(!!T),ee=Z.useRef(w),z=Z.useRef(!1),te=Z.useRef(!1),ne=Z.useRef(null),re=AL(h),ie=AL(w),ae=AL(o),oe=AL(y),se=xP(),ce=xP(),le=KN(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):ne.current=HL(e,{sync:z.current,preventScroll:!0})}let t=n.current[P.current],r=te.current;t&&e(t),(z.current?e=>e():e=>se.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),he&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});FN(()=>{D.current.orientation=g},[D,g]),FN(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(te.current=!0,L())):R.current&&(P.current=-1,L()))},[a,w,T,o,L]),FN(()=>{if(a){if(!w){z.current=!1;return}if(T){if(r==null){if(z.current=!1,ae.current!=null)return;if(R.current&&(P.current=-1,le()),(!ee.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ce.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||yB(F.current,g,u)||l?TF(n):EF(n),F.current=null,L())};t()}}else wF(n.current,r)||(P.current=r,le(),te.current=!1)}}},[a,w,T,r,ae,l,n,g,u,L,le,ce]),FN(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=NP(gP(E??t??null)),r=e.some(e=>e.context&&PP(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),FN(()=>{ee.current=w,R.current=!!T}),FN(()=>{w||(F.current=null,N.current=f)},[w,f]);let ue=r!=null,de=KN(e=>{if(!ie.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),fe=KN(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),pe=KN(()=>TF(n,re.current)),me=KN(e=>{if(I.current=!1,z.current=!0,e.which===229||!ie.current&&e.currentTarget===A.current)return;if(l&&xB(e.key,g,u,S)){vB(e.key,fe())||tF(e),C.setOpen(!1,SL(mL,e.nativeEvent)),eP(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=TF(n,h),i=EF(n,h);if(k||(e.key===`Home`&&(tF(e),P.current=r,L(e)),e.key===`End`&&(tF(e),P.current=i,L(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,L(e)),g===`both`)return}if(vB(e.key,g)){if(tF(e),w&&!d&&NP(e.currentTarget.ownerDocument)===e.currentTarget){P.current=yB(e.key,g,u)?r:i,L(e);return}yB(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(z.current=!1,P.current=r):P.current=DF(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,DF(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(z.current=!1,P.current=i):P.current=DF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,DF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),wF(n.current,P.current)&&(P.current=-1),L(e)}}),he=Z.useMemo(()=>({onFocus(e){z.current=!0,de(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){gB(e)||(z.current=!0,te.current=!1,p&&de(e))},onPointerLeave(e){if(!ie.current||!I.current||e.pointerType===`touch`)return;z.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&oe.current&&(ne.current?.(),ne.current=null,P.current=-1,L(e),!d)){let e=A.current,t=NP(gP(e));e&&PP(e,t)&&e.focus({preventScroll:!0})}}}),[de,ie,A,p,n,L,oe,d]),ge=Z.useMemo(()=>d&&w&&ue&&{"aria-activedescendant":`${v}-${r}`},[d,w,ue,v,r]),_e=Z.useMemo(()=>({...k?{}:ge,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=FP(e.nativeEvent);if(t&&!PP(A.current,t))return;tF(e),C.setOpen(!1,SL(fL,e.nativeEvent)),eP(E)&&E.focus();return}me(e)},onPointerMove(e){gB(e)||(I.current=!0)}}),[ge,me,A,k,C,w,d,E]),ve=Z.useMemo(()=>{function e(e){C.setOpen(!0,SL(mL,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&nF(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&rF(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=bB(t.key,fe(),u),a=vB(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return me(t);if(n||m||!r){if(o){let e=vB(t.key,fe());F.current=l&&e?null:t.key}if(l){i&&(tF(t),n?(P.current=pe(),L(t)):e(t));return}a&&(ae.current!=null&&(P.current=ae.current),tF(t),!n&&m?e(t):me(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[me,f,pe,l,L,C,m,g,fe,u,ae,d]),ye=Z.useMemo(()=>({...ge,...ve}),[ge,ve]);return Z.useMemo(()=>a?{reference:ye,floating:_e,item:he,trigger:ve}:{},[a,ye,_e,ve,he])}function CB(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=wP(),m=Z.useRef(``),h=Z.useRef(u??i??-1),g=Z.useRef(null),_=KN(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!kF(n)||n?.matches(`:disabled`)?!1:o==null||!OF(AN,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&c(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(tF(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(tF(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=KN(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);PP(n,t)||PP(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});FN(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Z.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Z.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var wB=.1,TB=wB*wB,EB=.5;function DB(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function OB(e,t,n,r,i,a,o,s,c,l){let u=!1;return DB(e,t,n,r,i,a)&&(u=!u),DB(e,t,i,a,o,s)&&(u=!u),DB(e,t,o,s,c,l)&&(u=!u),DB(e,t,c,l,n,r)&&(u=!u),u}function kB(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function AB(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function jB(e={}){let{blockPointerEvents:t=!1}=e,n=new CP,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*TB;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=FP(r),g=r.type===`mouseleave`,_=PP(u,h),v=PP(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&$N(r.relatedTarget)&&PP(u,r.relatedTarget))return;function y(){return!!(s&&$P(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=AB(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=AB(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=AB(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=AB(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!kB(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?EB/2:EB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+EB+1,o=C||T?S.bottom-EB:S.top,s=C?T?S.bottom-EB:S.top:S.bottom-EB;M=OB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?EB/2:EB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-EB,o=C||T?S.top+EB:S.bottom,s=C?T?S.top+EB:S.bottom:S.top+EB;M=OB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?EB/2:EB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+EB+1,o=w||E?S.right-EB:S.left,s=w?E?S.right-EB:S.left:S.right-EB;M=OB(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?EB/2:EB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-EB,o=w||E?S.left+EB:S.right,s=w?E?S.left+EB:S.right:S.left+EB;M=OB(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var MB=Z.createContext(void 0);function NB(){return Z.useContext(MB)?.direction??`ltr`}var PB=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=dF(e,t)||{};if(l==null)return{};let f=SF(u),p={x:n,y:r},m=_F(i),h=hF(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=uF(k,j,A),N=!c.arrow&&pF(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),FB=(e,t)=>{let{name:n,fn:r}=PB(e);return{name:n,fn:r,options:[e,t]}},IB={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},LB={sideX:`left`,sideY:`top`},RB=`--available-width`,zB=`--available-height`,BB=`--anchor-width`,VB=`--anchor-height`,HB=`--transform-origin`,UB=RB,WB=zB;function GB(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function KB(e,t,n){let{rects:r,placement:i}=e;return{side:GB(t,fF(i),n),align:pF(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function qB(e){return JB(e,rB)}function JB(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Z.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=KN(A),M=A?j:n,N=AL(n),P=AL(g),F=NB()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let ee=+(i===`bottom`),z=+(i===`top`),te=+(i===`right`),ne=+(i===`left`),re={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},ie=Z.useRef(null),ae=AL(a),oe=AL(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(wz(e=>{let t=KB(e,i,F),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,F,i]));let ue=E===`none`&&T!==`shift`,de=!ue&&(u||O||T===`shift`),fe=T===`none`?null:Dz({...re,padding:{top:R.top+1+ee,right:R.right+1+ne,bottom:R.bottom+1+z,left:R.left+1+te},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),pe=ue?null:Tz({...re,rootBoundary:k,mainAxis:E!==`none`,crossAxis:de,limiter:u||O?void 0:Ez(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=gF(fF(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[re,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?le.push(pe,fe):le.push(fe,pe),le.push(Oz({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(UB,`${t}px`),i.setProperty(WB,`${n}px`);let a=XN(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(BB,`${u}px`),i.setProperty(VB,`${d}px`)}}),FB(e=>({element:ie.current||gP(e.elements.floating).createElement(`div`),padding:ie.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=fF(r),u=pF(r),d=gF(l)===`y`,f=ie.current,p=typeof a==`function`?a(KB(e,i,F)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return de&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(HB,d?`${m} ${h}`:`${h} ${m}`),{}}},IB,b),FN(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let me=Z.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:Se,isPositioned:Ce,floatingStyles:we}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>dz(...e,me),nodeId:y,externalTree:S}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||LB,De=Ce?r:`fixed`,Oe=Z.useMemo(()=>{let e;return e=Ce?b?{position:De,[Te]:_e,[Ee]:ve}:{...we,position:De}:{position:De,top:0,left:0},e[UB]=`100vw`,e[WB]=`100vh`,Ce||(e.opacity=0),e},[b,De,Te,_e,Ee,ve,we,Ce]),ke=Z.useRef(null);FN(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(YB(t)?t.current:t)||null;n!==ke.current&&(he.setPositionReference(n),ke.current=n)},[g,he,M,N]),Z.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&YB(e)&&e.current!==ke.current&&(he.setPositionReference(e.current),ke.current=e.current)},[g,he,M,N]),Z.useEffect(()=>{if(m&&g&&ge.reference&&ge.floating)return dz(ge.reference,ge.floating,be,me)},[m,g,ge,be,me]);let Ae=fF(xe),je=GB(i,Ae,F),Me=pF(xe)||`center`,Ne=!!ye.hide?.referenceHidden;FN(()=>{x&&g&&Ce&&Ae!==I&&w(Ae)},[x,g,Ce,Ae,I]);let Pe=Z.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Fe=ye.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Oe,arrowStyles:Pe,arrowRef:ie,arrowUncentered:Fe,side:je,align:Me,physicalSide:Ae,anchorHidden:Ne,refs:he,context:Se,isPositioned:Ce,update:be}),[Oe,Pe,ie,Fe,je,Me,Ae,Ne,he,Se,Ce,be])}function YB(e){return e!=null&&`current`in e}function XB(e){return e===`starting`?RI:jN}function ZB(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),TI(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},XB(r),i],stateAttributesMapping:WP})}var QB=mN(),$B=48,eV=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-$B-t;return n},tV=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},nV=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-$B;n+=i>>>1^-(i&1),t[r]=n}return t},rV=384,iV=[],aV=tV(eV(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),oV=tV(eV(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),sV=`@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom`,cV=(()=>{let e=aV.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=aV[n];i<aV[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(aV[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=aV[i];a<aV[i+1];a++)n[r++]=e,e+=t[e]}return n})(),lV=eV(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),uV=tV(eV(`123333359346463635126536711576`)),dV=eV(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),fV=eV(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),pV=nV(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),mV=(()=>{let e=new Int32Array(319).fill(-1),t=nV(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=nV(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),hV=`container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top| bounce none ping pulse spin| auto square video| auto fr max min px|none | auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform`.split(`|`).map(e=>{let t=e.split(` `),n=t.shift();for(let e=0;e<t.length;e++)t[e]=n+t[e];return t}),gV=nV(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),_V=nV(`ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622`),vV=nV(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~22
:22|22222222222G000qOVI00000}2>40000B00000I¨©000¬00000000000000021M®00°000000000000000000000222HGHa1º222¿2À2222ÉÌ000°2±`),yV=new Int32Array(995),bV=new Int32Array(995),xV=new Int32Array(995),SV=``,CV=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<gV.length;r++)for(let i of hV[vV[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),CV[a*2]=SV.length,CV[a*2+1]=i.length,SV+=i),yV[n]=gV[r],bV[n]=_V[r],xV[n]=a,n++}}var wV=nV(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),TV=tV(eV(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),EV=nV(`24A;33N=C@H4A;33N=C@<27;83:;8393NQ:3NQʰ222ˉºŴŽ2R2=18cƴÅŇ=cĞÛC1ƈǝȈ:ħ25=11D3A@4=<1;1DEr25;11B3?<6;:371BCn9@7=<8192>2E121@9@EHE@9>2T25511<398454131<=V25511<398454131<=ƧNž2Đå242L222290000f22500ɛ000ǘ222`),DV=eV(`ij`),OV=eV(``),kV=eV(`1`),AV={GROUP_COUNT:rV,customValidatorNames:iV,edgeStart:aV,labelStart:oV,labelText:sV,edgeTarget:cV,nodeGroup:lV,nodeVlist:mV,vlistPat:uV,vlistOps:dV,vlistRef:fV,vlistGroup:pV,litAnchor:yV,litGroup:bV,litPool:xV,poolOffsets:CV,poolText:SV,adjGid:wV,adjStart:TV,adjTgt:EV,patGid:DV,patTgt:OV,postfixLookupGroups:kV,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},jV=`line`in Error(),MV=-1,NV=-1,PV=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},FV=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15|0},IV=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let L=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(PV(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;L[n]!==-1;)n=n+1&I-1;L[n]=e}let R=(e,t,n,r)=>{let i=(PV(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=L[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},ee=n.cacheSize??8192,z=n.prefix??e.prefix??``,te=z===``?``:z+`:`,ne=te.length,re=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ae=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,se=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ce=0,le=-1,ue=-1,de=-1,fe=-1,pe=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,me=e=>/\s/.test(String.fromCharCode(e)),he=(e,t,n)=>{if(ce=0,le=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)ce=1;else if(r===40&&i===41)ce=2;else return;de=t+1,fe=n-1;let a=t+1;if(pe(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!pe(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(le=t+1,ue=a,de=a+1)}},ge=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},_e=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ve=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ye=e=>!!e&&!Number.isNaN(Number(e)),be=(e,t,n)=>{if(n-t<11||!ge(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&ge(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&ge(e,t+10,t+18,`-normal/`)},xe=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Se=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),Ce=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],we=(e,t,n,r)=>{if(e>=10){if(e>=25)return re[e-25](t.slice(n,r));let i=e-10;if(ce!==xe[i])return!1;if(le>=0){for(let e of Se[i])if(ge(t,le,ue,e))return!0;return!1}switch(Ce[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(de,fe);return ie.test(e)&&!ae.test(e)}case 3:return ye(t.slice(de,fe));case 4:return se.test(t.slice(de,fe));default:return oe.test(t.slice(de,fe))}}switch(e){case 0:return!0;case 1:return ce===0;case 2:return ce===1;case 3:return ce===2;case 4:return _e.test(t.slice(n,r));case 5:return ye(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&ye(t.slice(n,r-1));case 8:return ve.test(t.slice(n,r));default:return be(t,n,r)}},Te=new Set(typeof E==`string`?E.split(` `):E),Ee=(e,t,n,r,i,a)=>{let o=PV(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},De=new Map,Oe=new Map,ke=2,Ae=4096,je=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Te.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=Oe.get(s);return c===void 0&&Oe.set(s,c=ke++),c},Me=new Map,Ne=r,Pe=r+4096,Fe=()=>Ne++,Ie=2097152,Le=8192,Re=new Int32Array(Le),ze=Array(Le).fill(null),Be=new Int32Array(Le),Ve=new Int32Array(Le),He=new Uint8Array(Le),Ue=0,We=(e,t,n,r,i,a,o,s)=>{let c=e;if(ze[e]!==null){if(ze[e|1]===null)c=e|1;else if(!(Ue++&3))c=e|Ue>>2&1;else return}ze[c]=t.slice(n,r),Re[c]=i,Be[c]=a,Ve[c]=o,He[c]=s},Ge=()=>ze.fill(null),Ke=256,qe=[new Int32Array(Ke),new Int32Array(Ke),new Int32Array(Ke),new Int32Array(Ke)],[Je,Ye,Xe,Ze]=qe,Qe=new Uint8Array(Ke),$e=new Uint8Array(Ke),et=()=>{Ke*=2,qe=qe.map(e=>{let t=new Int32Array(Ke);return t.set(e),t}),[Je,Ye,Xe,Ze]=qe;let e=new Uint8Array(Ke);e.set(Qe),Qe=e,$e=new Uint8Array(Ke)},tt=64,nt=new Int32Array(tt),rt=new Int32Array(tt),it=new Int32Array(r),at=2048,ot=21,st=new Float64Array(at),ct=new Int32Array(at),lt=0,ut=(e,t)=>{if(e===0&&t<r)return it[t]===lt?1:(it[t]=lt,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>ot;for(;ct[i]===lt;){if(st[i]===n)return 1;i=i+1&at-1}return st[i]=n,ct[i]=lt,0},dt=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?MV:Ee(Me,e,t+1,r,0,Fe)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=rt[t];if(r>n)continue;let i=nt[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=R(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;he(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(we(d[t],e,r,n))return p[h+t]}return MV},ft=e=>{let t=e.length,n=0,c=0,u=!1;(ke>Ae||De.size>Ae)&&(De=new Map,Oe=new Map,ke=2,Ge()),Ne>Pe&&(Me=new Map,Ne=r,Ge());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&me(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&me(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===Ke&&et();let _=n++;Je[_]=p,Ye[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(Re[y]===v&&ze[y]!==null&&ze[y].length===g?t=y:Re[y|1]===v&&ze[y|1]!==null&&ze[y|1].length===g&&(t=y|1),t>=0){let n=ze[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Xe[_]=Be[t],Ze[_]=Ve[t],Qe[_]=He[t];continue}}}let b=p;if(ne!==0){if(h-p<=ne||!e.startsWith(te,p)){Xe[_]=MV,We(y,e,p,h,v,MV,0,0);continue}b=p+ne}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,L=-1,R=0;(l[0]>=0||N[0]===1)&&(nt[0]=0,rt[0]=M,R=1);let ee=NV,z=0;for(let t=M;t<D;t++)if(t===A&&(ee=F<I?NV:P,z=R),P!==NV){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=NV;else{let e=i[P],t=i[P+1],c=NV;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],L=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(R===tt){tt*=2;let e=new Int32Array(tt);e.set(nt),nt=e;let t=new Int32Array(tt);t.set(rt),rt=t}nt[R]=r,rt[R]=t+2,R++}}A===D&&(ee=F<I?NV:P,z=R);let re=F<I?NV:P,ie,ae=!1;if(A>=0){if(ae=!0,ie=dt(e,E,A,ee,z),ie!==MV&&ie<r&&j[ie]){let t=dt(e,E,D,re,R);t!==MV&&t!==ie&&(ie=t,ae=!1)}else ie===MV&&(ie=dt(e,E,D,re,R),ae=!1)}else ie=dt(e,E,D,re,R);let oe=0,se=0;ie===MV?Xe[_]=MV:(se=+!!ae,oe=b>=C?+!!O:Ee(De,e,b,C,+!!O,e=>je(e,O)),Xe[_]=ie,Qe[_]=se,Ze[_]=oe),We(y,e,p,h,v,ie,oe,se)}if(n===0)return``;if(n===1)return Je[0]===0&&Ye[0]===t?e:e.slice(Je[0],Ye[0]);if(n*k>at){for(;n*k>at;)at<<=1,ot--;st=new Float64Array(at),ct=new Int32Array(at)}if(ke>=Ie||Ne>=Ie)throw Error(`cn: too many distinct classes in one merge`);lt=lt+1|0,lt===0&&(it.fill(0),ct.fill(0),lt=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Xe[e];if(t===MV){$e[e]=1;continue}let n=Ze[e];if(ut(n,t)===1){$e[e]=0,f=!0;continue}if($e[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)ut(n,x[e]);if(Qe[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&ut(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!$e[m]){m++;continue}let t=Je[m],r=Ye[m],i=m+1;for(;i<n&&$e[i]&&Je[i]===r+1&&e.charCodeAt(r)===32;)r=Ye[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},pt=16384,mt=new Int32Array(pt*2),ht=0,gt=1,_t=Object.create(null),vt=Object.create(null),yt=new Map,bt=new Map,xt=0,St=0,Ct=()=>{ht^=pt,gt=gt+1|0,St=0},wt=e=>{let t=_t[e];if(t!==void 0)return t;let n=FV(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=vt[e],t!==void 0)?(_t[e]=t,t):(t=ft(e),i?(_t[e]=t,++xt>ee&&(xt=0,vt=_t,_t=Object.create(null),Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Tt=e=>{let t=yt.get(e);if(t!==void 0)return t;let n=FV(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=bt.get(e),t!==void 0)?(yt.set(e,t),t):(t=ft(e),i?(yt.set(e,t),++xt>ee&&(xt=0,bt=yt,yt=new Map,Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Et=e=>{let t=FV(e,0,e.length),n=(t&16383)+ht;return mt[n]===(t^gt)||mt[n^pt]===(t^gt-1)||(mt[n]=t^gt,++St>pt&&Ct(),!1)},Dt=ee===0?ft:jV?e=>{let t=yt.get(e);return t===void 0?Tt(e):t}:wt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?Dt(arguments[0]):Dt(zV.apply(null,arguments))},mergeString:Dt,seenBefore:ee===0?()=>!1:Et,mergeUncached:ft}},LV=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:LV(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},RV=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:LV(i,t);a&&(n&&(n+=` `),n+=a)}return n},zV=function(){return RV(arguments,!1)},BV=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},l=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},u=(t,c)=>{let u=t.length,d=s===null?null:s.n;if(!c){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let f=``,p=-1,m=0,h=!1;for(let e=0;e<u;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=LV(n,!0),!n)continue;h=!0}p<0&&(f=n,p=e),m++}}if(m===0)return``;if(m===1)return e(f);if(h){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let g=i.get(f);g===void 0&&(g=a.get(f),g!==void 0&&i.set(f,g));let _=null;if(g!==void 0)outer:for(let e=0;e<g.length;e++){let n=g[e];if(n.t!==m)continue;let r=n.a,i=1;for(let e=p+1;e<u;e++){let n=t[e];if(n&&n!==r[i++])continue outer}_=n;break}if(_===null){let s=f,c=[f];for(let e=p+1;e<u;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);_={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},g===void 0&&i.set(f,g=[]),g.length>=256&&g.shift(),g.push(_),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==_&&(s.n=_),s=_,_.r},d=t=>Array.isArray(t)?u(t.slice(),!1):e(LV(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},VV=IV(AV),HV=BV(VV.mergeString,VV);VV.merge;var UV=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=nL({disabled:i,focusableWhenDisabled:a,native:o});return TI(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function WV(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=WV(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function GV(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=WV(e))&&(r&&(r+=` `),r+=t);return r}var KV=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,qV=GV,JV=(e,t)=>n=>{if(t?.variants==null)return qV(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=KV(t)||KV(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return qV(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},YV=JV(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,xs:`h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5`,sm:`h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,lg:`h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4`,icon:`size-7 [&_svg:not([class*='size-'])]:size-3.5`,"icon-xs":`size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5`,"icon-sm":`size-6 [&_svg:not([class*='size-'])]:size-3`,"icon-lg":`size-8 [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`,size:`default`}});function XV({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Q.jsx)(UV,{"data-slot":`button`,className:HV(YV({variant:t,size:n,className:e})),...r})}var ZV=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function QV(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:ZV(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var $V=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},eH=e=>{let t=$V(e);return t.charAt(0).toUpperCase()+t.slice(1)},tH=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),nH={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function rH(e){return e!=null}function iH(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??nH.width,a=e.size??e.height??nH.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?tH(...c):tH(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??nH[`stroke-width`])*Number(e.size??e.width??nH.width)/Number(t.size??t.width??nH.width):t.strokeWidth??nH[`stroke-width`];return[`svg`,{...Object.entries(nH).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&rH(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&rH(t.width)&&{[r(`width`)]:t.width},...`height`in t&&rH(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function aH(e,t={}){return iH(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var oH=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},sH=(0,Z.createContext)({}),cH=()=>(0,Z.useContext)(sH),lH=(0,Z.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=cH()??{},y=!!c||oH(d),[b,x,S=[]]=aH(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:tH(v,s),hasA11yProp:y,attributes:d});return(0,Z.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,Z.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function uH(e,t=[],n=[]){let r=typeof e==`string`?QV(e,t,n):e,i=(0,Z.forwardRef)(({className:e,...t},n)=>(0,Z.createElement)(lH,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=eH(r.name)),i}var dH={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};dH.node;var fH=uH(dH),pH={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};pH.node;var mH=uH(pH),hH={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};hH.node;var gH=uH(hH),_H={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};_H.node;var vH=uH(_H),yH={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};yH.node;var bH=uH(yH),xH={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};xH.node;var SH=uH(xH),CH={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};CH.node;var wH=uH(CH),TH={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};TH.node;var EH=uH(TH),DH={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};DH.node;var OH=uH(DH),kH={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};kH.node;var AH=uH(kH),jH={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};jH.node;var MH=uH(jH),NH={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};NH.node;var PH=uH(NH),FH={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};FH.node;var IH=uH(FH),LH={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};LH.node;var RH=uH(LH),zH={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};zH.node;var BH=uH(zH),VH={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};VH.node;var HH=uH(VH),UH={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};UH.node;var WH=uH(UH),GH={name:`panel-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]],aliases:[`sidebar`]};GH.node;var KH=uH(GH),qH={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};qH.node;var JH=uH(qH),YH={name:`server-off`,size:24,node:[[`path`,{d:`M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5`,key:`bt2siv`}],[`path`,{d:`M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z`,key:`1hjrv1`}],[`path`,{d:`M22 17v-1a2 2 0 0 0-2-2h-1`,key:`1iynyr`}],[`path`,{d:`M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z`,key:`161ggg`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};YH.node;var XH=uH(YH),ZH={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};ZH.node;var QH=uH(ZH),$H={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};$H.node;var eU=uH($H),tU={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};tU.node;var nU=uH(tU),rU={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};rU.node;var iU=uH(rU),aU={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};aU.node;var oU=uH(aU),sU={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};sU.node;var cU=uH(sU),lU=Z.createContext(void 0);function uU(e){let t=Z.useContext(lU);if(t===void 0&&!e)throw Error(LN(72));return t}var dU=class extends qN{setState(e){}update(e){}set(e,t){}notifyAll(){}},fU={...eB,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},pU=class extends qN{constructor(e,t,n){let r=new qz;super(mU(e,r,t,n),hU(r),fU)}setOpen=(e,t)=>{Vz(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,SL(oL,e))}};function mU(e,t,n,r=!1){return{...Jz(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function hU(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var gU=VN(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=Fz((e,t)=>new pU({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Uz(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Wz(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Z.useRef(null);FN(()=>{m&&t&&p.setOpen(!1,SL(_L))},[m,t,p]),FN(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),FN(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Z.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,SL(bL))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,Q.jsxs)(lU.Provider,{value:p,children:[l&&(0,Q.jsx)(Iz,{handle:l,store:p}),T&&(0,Q.jsx)(_U,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function _U({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=TR(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=SR(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Z.useMemo(()=>dI(a.reference,i.reference),[a.reference,i.reference]);return Gz(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??jN}),null}function vU(e){return ZI(e,`base-ui`)}var yU=Z.createContext(void 0);function bU(){return Z.useContext(yU)}var xU=`data-base-ui-tooltip-trigger`;function SU(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if($N(n))return n}}let t=e.target;return $N(t)?t:null}function CU(e){let t=e;for(;t;){let e=t.closest(`[${xU}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&$N(n.host)?n.host:null}return null}var wU=HN(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=uU(!0),m=tB(a)??p;if(!m)throw Error(LN(82));let h=vU(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Z.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=Hz(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=bU(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=BL(v,{open:_}),O=dB(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=AL(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Z.useRef(!1),F=wP(),I=Z.useRef(void 0);function L(){return D&&w.current!=null?0:c??C??600}function R(e){let t=y.current;if(!t||!e)return!1;let n=CU(e);return n!==null&&n!==t&&PP(t,n)}function ee(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let z=mB(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?jB():null,restMs:L,delay(){return u==null&&D?{close:NL(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),te=oB(v,{enabled:!A}).reference,ne=e=>{let t=P.current,n=SU(e),r=ee(n),i=y.current,a=i&&n&&PP(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,SL(sL,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&iF(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,SL(sL,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},re=m.useState(`triggerProps`,S);return TI(`button`,e,{state:{open:_},ref:[t,x,y],props:[z,te,S||M!==`none`?re:void 0,{onMouseOver(e){ne(e.nativeEvent)},onFocus(e){R(SU(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[KP]:A?``:void 0,[xU]:A?void 0:``},f],stateAttributesMapping:HP})}),TU=Z.createContext(void 0);function EU(){let e=Z.useContext(TU);if(e===void 0)throw Error(LN(70));return e}var DU=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return uU().useState(`mounted`)||n?(0,Q.jsx)(TU.Provider,{value:n,children:(0,Q.jsx)(kL,{ref:t,...r})}):null}),OU=Z.createContext(void 0);function kU(){let e=Z.useContext(OU);if(e===void 0)throw Error(LN(71));return e}var AU=Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=GI,style:g,..._}=e,v=uU(),y=EU(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=qB({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=ZB(e,Z.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,Q.jsx)(OU.Provider,{value:D,children:O})}),jU=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=uU(),{side:s,align:c}=kU(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);LI({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),fB(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return TI(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[Nz,f,XB(d),a],stateAttributesMapping:GP})}),MU=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=uU(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=kU();return TI(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:WP})}),NU=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Z.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Q.jsx)(yU.Provider,{value:t,children:(0,Q.jsx)(zL,{delay:i,timeoutMs:r,children:e.children})})};function PU(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function FU({delay:e=0,...t}){return(0,Q.jsx)(NU,{"data-slot":`tooltip-provider`,delay:e,...t})}function IU({...e}){return(0,Q.jsx)(gU,{"data-slot":`tooltip`,...e})}function LU({...e}){return(0,Q.jsx)(wU,{"data-slot":`tooltip-trigger`,...e})}function RU({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,Q.jsx)(DU,{children:(0,Q.jsx)(AU,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,Q.jsxs)(jU,{"data-slot":`tooltip-content`,className:HV(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,Q.jsx)(MU,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var zU=new Set;function BU(e){return zU.add(e),()=>zU.delete(e)}function VU(e){for(let t of[...zU])t(e)}function HU(e,t){let n=()=>VU({title:`Copied ${t}`,description:e,type:`success`}),r=()=>VU({title:`Could not copy ${t}`,description:e,type:`error`});if(window.isSecureContext&&navigator.clipboard!==null&&navigator.clipboard!==void 0){navigator.clipboard.writeText(e).then(n,()=>{UU(e)?n():r()});return}UU(e)?n():r()}function UU(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();try{return document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}var WU=X(e=>bE(t=>{window.addEventListener(`focus`,e),window.addEventListener(`online`,e),window.addEventListener(`visibilitychange`,e),t.addFinalizer(()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`online`,e),window.removeEventListener(`visibilitychange`,e)})}));function GU(e){let t=(0,QB.c)(2),n;t[0]===e?n=t[1]:(n=WU(e),t[0]=e,t[1]=n),SN(n)}var KU=`~effect/Cache`,qU=(e,t)=>hs(n=>{let r=Object.create(YU);return r.lookup=t=>ds(e(t),e=>wr(n,e)),r.map=hae(),r.capacity=t.capacity,r.timeToLive=t.timeToLive?(e,n)=>pi(t.timeToLive(e,n)):XU,ao(r)}),JU=e=>qU(e.lookup,{...e,timeToLive:e.timeToLive===void 0?XU:()=>e.timeToLive}),YU={...yt,[KU]:KU,toJSON(){return{_id:`Cache`,capacity:this.capacity,map:this.map}}},XU=(e,t)=>Ei,ZU=a(2,(e,t)=>Yt(n=>{let r=Iw(e.map,t);if(zn(r)&&(zw(e.map,t),!eW(r.value,n)))return Rw(e.map,t,r.value),r.value.await();let i=new QU(n,e.lookup(t));i.onInterrupt=()=>$U(e,t,i);let a=!1;i.fiber.addObserver(r=>{if(i.onInterrupt=void 0,rs(r)){$U(e,t,i);return}let o=e.timeToLive(r,t);Si(o)?(a=!0,$U(e,t,i)):xi(o)&&(i.expiresAt=n.getRef(rl).currentTimeMillisUnsafe()+Fi(o))});let o=i.fiber.pollUnsafe();return!a&&(o===void 0||!rs(o))&&Rw(e.map,t,i),Number.isFinite(e.capacity)&&tW(e),i.await()})),QU=class{expiresAt;awaiters;fiber;onInterrupt;constructor(e,t){this.fiber=Bc(e,t,!0,!0),this.awaiters=0,this.expiresAt=void 0}await(){return this.fiber.pollUnsafe()||(this.awaiters++,Dc(no(this.fiber),()=>(this.awaiters--,this.awaiters>0||this.fiber.pollUnsafe()?ho:(this.onInterrupt?.(),ro(this.fiber)))))}},$U=(e,t,n)=>{let r=Iw(e.map,t);zn(r)&&r.value===n&&zw(e.map,t)},eW=(e,t)=>e.expiresAt!==void 0&&t.getRef(rl).currentTimeMillisUnsafe()>=e.expiresAt,tW=e=>{let t=Bw(e.map)-e.capacity;if(!(t<=0)){for(let[n]of e.map)if(zw(e.map,n),t--,t===0)return}},nW=a(2,(e,t)=>co(()=>{zw(e.map,t)})),rW=2**48-1,iW=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,aW=(e,t)=>{if(t.length!==10)throw Error(`ULID randomness must be exactly 10 bytes, received ${t.length}`);let n=Math.min(Math.max(0,Math.trunc(e)),rW),r=``;for(let e=45;e>=0;e-=5)r+=iW[Math.floor(n/2**e)&31];let i=0,a=0;for(let e of t){for(i=i<<8|e,a+=8;a>=5;)a-=5,r+=iW[i>>>a&31];i&=(1<<a)-1}return r},oW=e=>e.toString(16).padStart(2,`0`),sW=e=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map(e=>Array.from(e,oW).join(``)).join(`-`),cW=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function lW(e=cW()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var uW=e=>sW(e===void 0?lW():lW(e)),dW=2**48-1;function fW(e,t=cW()){let n=Math.min(Math.max(0,Math.trunc(e)),dW);return t[0]=Math.floor(n/2**40),t[1]=Math.floor(n/2**32)&255,t[2]=Math.floor(n/2**24)&255,t[3]=Math.floor(n/2**16)&255,t[4]=Math.floor(n/256)&255,t[5]=n&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var pW=(e,t)=>sW(t===void 0?fW(e):fW(e,t)),mW=`~effect/Crypto`,hW=tr(`effect/Crypto`),gW=e=>{let t=e.randomBytes,n=e=>Kf(_W(`randomBytes`,e),t),r=e=>(e[0]&31)*2**48+e[1]*2**40+e[2]*2**32+e[3]*2**24+e[4]*2**16+e[5]*256+e[6],i=()=>r(t(7))/2**53,a=()=>{for(;;){let e=t(7),n=r(e);if(!(e[0]&32))return n+-(2**53-1);if(n<2**53-1)return n+1}};return hW.of({[mW]:mW,randomBytes:n,nextDoubleUnsafe:i,nextIntUnsafe:a,digest:e.digest,random:V(()=>i()),randomBoolean:V(()=>i()>.5),randomInt:V(()=>a()),randomBetween:(e,t)=>V(()=>qd(e,t,i())),randomIntBetween(e,t,n){let r=n?.halfOpen===!0?0:1;return V(()=>{let n=Math.ceil(e),a=Math.floor(t);return Math.floor(i()*(a-n+r))+n})},randomShuffle:e=>V(()=>{let t=Array.from(e);for(let e=t.length-1;e>=1;--e){let n=Math.min(e,Math.floor(i()*(e+1))),r=t[e];t[e]=t[n],t[n]=r}return t}),randomUUIDv4:V(()=>uW(t(16))),randomUUIDv7:Kp(e=>B(pW(e.currentTimeMillisUnsafe(),t(16)))),randomULID:Kp(e=>B(aW(e.currentTimeMillisUnsafe(),t(10))))})},_W=(e,t)=>Number.isSafeInteger(t)&&t>=0?B(t):U(wae({module:`Crypto`,method:e,description:`size must be a non-negative safe integer`})),vW=`~effect/FiberMap`,yW=e=>F(e,vW),bW={[vW]:vW,[Symbol.iterator](){return this.state._tag===`Closed`?Br():this.state.backing[Symbol.iterator]()},...yt,toJSON(){return{_id:`FiberMap`,state:this.state}}},xW=(e,t)=>{let n=Object.create(bW);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},SW=()=>vp(V(()=>xW(Fw(),pu())),e=>kf(()=>{let t=e.state;return t._tag===`Closed`?Af:(e.state={_tag:`Closed`},gS(_ae(t.backing)).pipe(tne(e.deferred)))})),CW=-1,wW=Pee(Ui(Kl,Fee(CW))),TW=a(e=>yW(e[0]),(e,t,n,r)=>{if(e.state._tag===`Closed`){n.interruptUnsafe(CW);return}let i=Iw(e.state.backing,t);if(i._tag===`Some`){if(i.value===n)return;if(r?.onlyIfMissing===!0){n.interruptUnsafe(CW);return}}Rw(e.state.backing,t,n),i._tag===`Some`&&i.value.interruptUnsafe(CW),n.addObserver(i=>{if(e.state._tag===`Closed`)return;let a=Iw(e.state.backing,t);zn(a)&&n===a.value&&zw(e.state.backing,t),lu(i)&&(r?.propagateInterruption===!0?!wW(i.cause):!Xte(i.cause))&&vu(e.deferred,i)})}),EW=a(2,(e,t)=>e.state._tag!==`Closed`&&yae(e.state.backing,t)),DW=function(){let e;return()=>(e===void 0&&(e=Ip(Tp)),e)}(),OW=e=>()=>Kf(up(),t=>{let n=Lp(t);return(t,r,i)=>{if(e.state._tag===`Closed`||i?.onlyIfMissing===!0&&EW(e,t))return DW();let a=n(r,i);return TW(e,t,a,i),a}}),kW=`~effect/ManagedRuntime`,AW=(e,t)=>{let n=t?.memoMap??Nu(),r=bu(`sequential`),i=Tu(r,`sequential`),a={onFiberStart:vS(Tu(r,`parallel`))},o=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,s,c=zf(t=>(s||=Ip(Uf(Fu(e,n,i),e=>V(()=>{l.cachedContext=e})),{...a,scheduler:t.cache.scheduler}),Vf(fS(s)))),l={[kW]:kW,memoMap:n,scope:r,contextEffect:c,cachedContext:void 0,context(){return l.cachedContext===void 0?zp(l.contextEffect):Promise.resolve(l.cachedContext)},dispose(){return zp(l.disposeEffect)},[Symbol.asyncDispose](){return l.dispose()},disposeEffect:kf(()=>(l.contextEffect=If(`ManagedRuntime disposed`),l.cachedContext=void 0,Eu(l.scope,su))),runFork(e,t){return l.cachedContext===void 0?Ip(jW(l,e),o(t)):Lp(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?Cne(jW(l,e),o(t)):Rp(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Up(jW(l,e)):Ene(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?Vp(jW(l,e)):Hp(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Bp(jW(l,e),o(t)):Tne(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?zp(jW(l,e),o(t)):wne(l.cachedContext)(e,o(t))}};return l};function jW(e,t){return Bf(e.contextEffect,e=>pp(t,e))}var MW=`~effect/SynchronizedRef`,NW={...yt,[MW]:MW,toJSON(){return{_id:`SynchronizedRef`,value:this.backing.ref.current}}},PW=e=>{let t=Object.create(NW);return t.semaphore=TC(1),t.backing=ND(e),t},FW=e=>V(()=>PW(e)),IW=e=>e.backing.ref.current,LW=a(2,(e,t)=>e.semaphore.withPermit(RD(e.backing,t))),RW=a(2,(e,t)=>e.semaphore.withPermit(kf(()=>Kf(t(IW(e)),([t,n])=>(e.backing.ref.current=n,t))))),zW=a(2,(e,t)=>e.semaphore.withPermit(ID(e.backing,t))),BW=a(2,(e,t)=>e.semaphore.withPermit(zD(e.backing,t))),VW=class extends tr()(`@porcelain/client/EnvironmentStorage`){},HW=class extends tr()(`@porcelain/client/AccessPlatform`){},UW=class extends Y()(`WriteNotSentError`,{cause:Mb}){get message(){return`An earlier change failed, so this one was not sent.`}},WW=class extends tr()(`@porcelain/client/WriteQueue`){static make=H(function*(){let e=yield*OC(1),t=yield*PD({pending:0,failure:In()});return{enqueue:n=>kp(r=>H(function*(){return yield*zD(t,e=>({...e,pending:e.pending+1})),yield*Rf,yield*e.withPermit(H(function*(){let e=yield*FD(t),i=yield*Gf(r(zn(e.failure)?U(new UW({cause:e.failure.value})):n));return yield*zD(t,e=>{let t=e.pending-1,n=lu(i)?Vl(i.cause):void 0;return{pending:t,failure:t===0?In():pee(e.failure,()=>lu(i)?Ln(n instanceof UW?n.cause:n):In())}}),yield*cu(i)?B(i.value):Pf(i.cause)}))}))}})},GW=class e extends tr()(`@porcelain/client/WriteQueues`){static layer=Uu(e,H(function*(){let e=yield*kae({lookup:e=>H(function*(){return{scope:yield*wu(yield*yu,`parallel`),queue:yield*WW.make}}),idleTimeToLive:0});return{run:(t,n)=>_p(H(function*(){let{scope:r,queue:i}=yield*Aae(e,JSON.stringify(t)),a=yield*Pp(i.enqueue(n),r,{startImmediately:!0});return yield*pS(a).pipe(xp(hS(a)))}))}}))},KW=class extends Y()(`ConnectionError`,{message:K,cause:Db(Mb)}){},qW=Gp(`persistedState`)(function*(e){let t=Aj({...e.initial,status:`loading`,error:void 0}),n=yield*WW.make;return{state:t,load:()=>n.enqueue(H(function*(){t.update(e=>({...e,status:`loading`,error:void 0})),yield*e.read().pipe(_ne({onSuccess:e=>V(()=>t.set({...e,status:`ready`,error:void 0})),onFailure:()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.readFailed})))}),Op)})),write:r=>n.enqueue(H(function*(){if(t.value.status!==`ready`)return yield*U(new KW({message:e.messages.beforeRead}));let n=yield*r(t.value);yield*e.write(n).pipe($f(({cause:t})=>new KW({message:e.messages.writeFailed,cause:t})),tp(()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.writeFailed})))),Uf(()=>V(()=>t.update(e=>({...e,...n})))),Op)}))}}),JW=1024,YW=1024*JW,XW=10*YW,ZW=16*JW,QW=2e3,$W=2e3,eG=4096,tG=2147483647,nG=1e3,rG=1e4,iG=rG,aG=1024,oG=5e4,sG=16e3,cG=4e3,lG=2e3,uG=1e3,dG=4e3,fG=2048;8*YW,32*YW;var pG=Wb([`content_changed`,`file_too_large`,`unsupported_text`,`worktree_changed`]),mG=q({statusCode:Pb.check(ux()).check(sx(400)).check(cx(599)),error:K,message:K,code:W(pG)}),hG=K.check(tx(e=>Nr(bb(bx)(e)),{expected:`an absolute URL`})),gG=K.check(nx(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z$/),tx(e=>{let t=bb(Ox)(e);return Nr(t)&&$ne(t.success)===e.split(`T`)[0]},{expected:`a valid UTC timestamp`})),_G=K.check(rx()),vG=K.check(nx(RegExp(`^[0-9a-f]{32}$`)));function yG(e){return Gb(e).pipe(qb(Kb(kb(e)),l_({decode:e=>e===null?void 0:e,encode:e=>e===void 0?null:e})))}var bG=q({worktreeId:vG}),xG=`~effect/http-api/HttpApiMiddleware`,SG=`~effect/http-api/HttpApiMiddleware/Security`,CG=()=>(e,t)=>{let n=rt(),r;n!==0&&(it(2),r=new globalThis.Error,it(n));class i extends tr()(e){}let a=i;if(Object.defineProperty(i,"stack",{get(){return r?.stack}}),a[xG]=xG,a.error=wG(t?.error),a.requiredForClient=t?.requiredForClient??!1,t?.security!==void 0){if(Object.keys(t.security).length===0)throw Error(`HttpApiMiddleware.Service: security object must not be empty`);a[SG]=SG,a.security=t.security}return a};function wG(e){return e===void 0?new Set:new Set(Array.isArray(e)?e:[e])}var TG=`~effect/http-api/HttpApiGroup`,EG={[TG]:TG,add(...e){let t={...this.endpoints};for(let n of e)st(t,n.identifier,n);return OG({...DG(this),endpoints:t})},prefix(e){return OG({...DG(this),endpoints:Hr(this.endpoints,t=>t.prefix(e))})},middleware(e){return OG({...DG(this),endpoints:Hr(this.endpoints,t=>t.middleware(e))})},annotateMerge(e){return OG({...DG(this),annotations:wr(this.annotations,e)})},annotate(e,t){return OG({...DG(this),annotations:hr(this.annotations,e,t)})},annotateEndpointsMerge(e){return OG({...DG(this),endpoints:Hr(this.endpoints,t=>t.annotateMerge(e))})},annotateEndpoints(e,t){return OG({...DG(this),endpoints:Hr(this.endpoints,n=>n.annotate(e,t))})},pipe(){return n(this,arguments)}},DG=e=>({identifier:e.identifier,topLevel:e.topLevel,endpoints:e.endpoints,annotations:e.annotations}),OG=e=>{function t(){}return Object.setPrototypeOf(t,EG),t.key=`effect/http-api/HttpApiGroup/${e.identifier}`,Object.assign(t,e)},kG=(e,t)=>OG({identifier:e,topLevel:t?.topLevel??!1,endpoints:{},annotations:pr()}),AG=Ub([q({kind:G(`owner`)}),q({kind:G(`device`),deviceId:K.check(rx())})]),jG=`/open/pair`,MG=`/pair`;function NG(e){return e.replace(/\/$/,``)===jG}function PG(e){let t=t=>[`c=${encodeURIComponent(e.code)}`,`e=${encodeURIComponent(e.environmentId)}`,...t?[`a=${encodeURIComponent(e.addresses.join(`,`))}`]:[]].join(`&`);return e.appOrigin===void 0?`${e.addresses[0]??``}${MG}#${t(e.addresses.length>1)}`:`${e.appOrigin}${jG}#${t(!0)}`}function FG(e){let t=e.indexOf(`#`);if(t===-1)return;let n=e.slice(0,t),r;try{r=new Map(e.slice(t+1).split(`&`).map(e=>{let[t=``,n=``]=e.split(`=`);return[t,decodeURIComponent(n)]}))}catch{return}let i=(r.get(`a`)??``).split(`,`).filter(e=>e!==``),a={code:r.get(`c`)??``,environmentId:r.get(`e`)??``};if(n.endsWith(`/open/pair`))return i.length===0?void 0:{...a,addresses:i,appOrigin:n.slice(0,-10)};if(n.endsWith(MG))return{...a,addresses:i.length===0?[n.slice(0,-5)]:i}}var IG=K,LG=q({addresses:J(K),code:K,environmentId:K,appOrigin:W(K)}),RG=IG.pipe(qb(LG,c_({decode:e=>{let t=FG(e);return t===void 0?U(new hg({message:`Expected a Porcelain pairing link`})):B(t)},encode:e=>B(PG(e))}))),zG=q({code:K.check(fx(1)).check(mx(200)),platform:K.check(fx(1)).check(mx(120)),label:W(K.check(fx(1)).check(mx(80)))}),BG=q({device:q({id:K,label:K,platform:K,createdAt:K}),credential:W(K)}),VG=q({id:K,label:K,addresses:J(K),createdAt:K,expiresAt:K,trusted:Fb,canManageSharing:W(Fb)}),HG=Wb([`loopback`,`lan`,`tailnet`,`tunnel`]),UG=q({id:K,label:K,platform:K,createdAt:K,lastSeenAt:K,lastSeenAddress:W(K),route:HG,routeInferred:W(Fb),trusted:Fb,canManageSharing:W(Fb),canEditWaysIn:Fb,current:W(Fb)}),WG=q({canEditIdentity:W(Fb),grants:J(VG),devices:J(UG)}),GG=q({labels:J(K.check(fx(1)).check(mx(80))).check(fx(1)).check(mx(20)),addresses:J(hG).check(fx(1)).check(mx(10)),trusted:W(Fb),canManageSharing:W(Fb)}),KG=q({grants:J(q({grant:VG,code:K,link:RG}))}),qG=q({id:K.check(fx(1))}),JG=q({revoked:Fb,kind:W(Wb([`grant`,`device`]))}),YG=q({id:K.check(fx(1)),trusted:Fb}),XG=q({id:K,trusted:Fb}),ZG=q({id:K.check(fx(1)),allowed:Fb}),QG=q({id:K,allowed:Fb}),$G=q({id:K.check(fx(1)),allowed:Fb}),eK=q({id:K,allowed:Fb}),tK=Nb;q({route:HG,local:Fb}),tr()(`@porcelain/http/RequestConnection`);var nK=class extends CG()(`@porcelain/http/ClientRequest`){};tr()(`@porcelain/http/RequestCaller`);var rK=class extends CG()(`@porcelain/http/PairedRequest`){},iK=class extends Y()(`InvalidDeviceDetailsError`,{}){get message(){return`The device name or platform is missing, too long, or contains control characters.`}},aK=class extends Y()(`InvalidPairingAddressError`,{}){get message(){return`This server does not answer at that address, so a link aimed there would not reach it.`}},oK=class extends Y()(`InvalidPairingError`,{}){get message(){return`This pairing link is not valid.`}},sK=class extends Y()(`MissingEnvironmentIdentityError`,{}){get message(){return`This server has no environment identity.`}};Y()(`TooManyPairingAttemptsError`,{});var cK=class extends Y()(`InvalidTunnelHostnameError`,{}){get message(){return`Enter the public hostname your Cloudflare tunnel serves, such as porcelain.example.com.`}},lK=class extends Y()(`MissingTunnelHostnameError`,{}){get message(){return`Cloudflare needs the public hostname your tunnel serves.`}},uK=class extends Y()(`InvalidTailnetHostnameError`,{}){get message(){return`Enter this computer's Tailscale name, such as laptop.tail1234.ts.net.`}},dK=class extends Y()(`MissingTailnetHostnameError`,{}){get message(){return`Tailscale needs this computer's Tailscale name.`}},fK=class extends Y()(`NoLocalNetworkError`,{}){get message(){return`This computer is not on a local network right now, so there is no network to share on.`}},pK=class extends Y()(`UnidentifiedLocalNetworkError`,{}){get message(){return`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known. Try again in a moment.`}},mK=class extends Y()(`ServiceNotManagedError`,{}){get message(){return`Porcelain is not running as the installed service, so it cannot update itself`}},hK=class extends Y()(`ServiceUpdateNotOfferedError`,{}){get message(){return`That version is not the newer version this server offers`}},gK=class extends Y()(`ServiceUpdateRunningError`,{}){get message(){return`An update is already running`}},_K=class extends Y()(`DeviceViewerRequiredError`,{}){get message(){return`A live ticket is issued to a paired device`}},vK=class extends Y()(`TooManyLiveTicketsError`,{}){get message(){return`Too many live tickets are waiting to be used. Try again shortly.`}},yK=class extends Y()(`DeviceNotFoundError`,{}){get message(){return`Device not found`}},bK=class extends Y()(`UntrustedDeviceError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can update Porcelain`}},xK=class extends Y()(`WaysInPermissionRequiredError`,{}){get message(){return`An owner must let this device edit ways in on the computer that runs Porcelain before it can see or change them`}},SK=class extends Y()(`WaysInChangedError`,{}){get message(){return`The ways in changed since you last looked. Check them again, then save your change.`}},CK=class extends Y()(`RemoteRouteInUseError`,{}){get message(){return`This device is connected through this way in, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}},wK=class extends Y()(`ReviewGitSettingsTrustRequiredError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can change Reviews & Git settings`}},TK=class extends Y()(`ReviewGitSettingsNotConfiguredError`,{}){get message(){return`Choose Reviews & Git settings for this computer before changing one of them`}},EK=class extends Y()(`SharingManagementRequiredError`,{}){get message(){return`This device cannot manage sharing. Allow it from a device with sharing access.`}},DK=class extends Y()(`PushRegistrationDeviceRequiredError`,{}){get message(){return`Notifications are registered by a paired device`}},OK=Er(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),kK=class extends tr()(`effect/http/FetchHttpClient/RequestInit`){},AK=VO(B(FO((e,t,n,r)=>{let i=r.getRef(OK),a=gr(r.context,kK)??{},o=a.headers?Dh(Ch(a.headers),e.headers):e.headers;o[`content-length`]&&(o=Oh(o,`content-length`));let s=r=>Kf(Df({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:typeof ReadableStream<`u`&&r instanceof ReadableStream?`half`:void 0,signal:n}),catch:t=>new HD({reason:new GD({request:e,cause:t})})}),t=>DO(e,t));switch(e.body._tag){case`Raw`:case`Uint8Array`:return s(e.body.body);case`FormData`:return s(e.body.formData);case`Stream`:return Bf(noe(e.body.stream),s)}return s(void 0)}))),jK={BadRequest:`Bad Request`,Unauthorized:`Unauthorized`,Forbidden:`Forbidden`,PayloadTooLarge:`Payload Too Large`,TooManyRequests:`Too Many Requests`,BadGateway:`Bad Gateway`,ServiceUnavailable:`Service Unavailable`,NotFound:`Not Found`,Conflict:`Conflict`,UnprocessableEntity:`Unprocessable Entity`},MK=class extends Y()(`HttpFailureMessage`,{name:K,message:K}){};function $(e,t,n={}){let r=typeof n.message==`object`?void 0:n.message??new e().message,i={statusCode:kk(t),error:jK[t],...n.code===void 0?{}:{code:n.code}};return q({statusCode:G(i.statusCode),error:G(i.error),message:r===void 0?K:G(r),code:Db(n.code===void 0?jb:G(n.code))}).pipe(qb(fb(t=>t instanceof e||t instanceof MK&&t.name===e.name),l_({decode:t=>r===void 0?new MK({name:e.name,message:t.message}):new e,encode:e=>({...i,message:r??e.message})})),jk(t))}var NK=$(sK,`ServiceUnavailable`,{message:`Operation unavailable`}),PK={onExcessProperty:`error`},FK=BA(`porcelain`).annotate(WA,PK).annotate(GA,PK).annotate(qA,PK),IK=q({pullStrategy:Wb([`merge`,`rebase`]),collapseSpecs:Fb,archiveDeleteWorktree:Fb,archiveDeleteLocalBranch:Fb,archiveDeleteRemoteBranch:Fb}),LK=Wb([`desktop`,`laptop`,`server`,`cloud`]),RK=Wb([`review-ready`,`agent-reply`]),zK=Wb([`ios`,`android`]),BK=q({name:K,custom:Fb,icon:Db(LK)}),VK=q({environmentId:K,name:K,version:yG(K),protocol:Pb.check(ux()).check(ox(0))}),HK=q({name:Gb(K.pipe(Jb(u_())).check(fx(1)).check(mx(64)).check(tx(e=>!/\p{Cc}/u.test(e))))}),UK=BK,WK=q({icon:Gb(LK)}),GK=BK,KK=q({status:G(`ok`),environmentId:K}),qK={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return JK({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[e,n]of r.requests)t.set(e,n);for(let[e,t]of r.annotations.mapUnsafe)n.set(e,t)}return JK({requests:t,annotations:ur(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return JK({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return JK({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return H(function*(){let n=yield*up(),r=Sf(e)?yield*e:e,i=new Map;return t.requests.forEach((e,t)=>{i.set(e.key,{tag:e._tag,handler:r[t],context:n})}),ur(i)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return JK({requests:t,annotations:this.annotations})},toLayer(e){return Gu(this.toHandlers(e))},of:o,toLayerHandler(e,t){let n=this;return Gu(H(function*(){let r=yield*up(),i=Sf(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),ur(a)}))},accessHandler(e){return dp(t=>{let n=this.requests.get(e),{handler:r,context:i}=_r(t,n.key);return B((e,t)=>{t.rpc=n;let a=r(e,t),o=Qj(a)?a.value:a;return Sf(o)?fp(o,i):dT(o,i)})})},annotate(e,t){return JK({requests:this.requests,annotations:hr(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(mr(e,t))},annotateMerge(e){return JK({requests:this.requests,annotations:wr(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(wr(e,r.annotations)));return JK({requests:t,annotations:this.annotations})}},JK=e=>Object.assign(function(){},qK,{requests:e.requests,annotations:e.annotations}),YK=(...e)=>JK({requests:new Map(e.map(e=>[e._tag,e])),annotations:pr()}),XK=`(?:[0-9a-f]{40}|[0-9a-f]{64})`,ZK=K.check(nx(RegExp(`^${XK}$`))),QK=K.check(nx(RegExp(`^${XK}(?:,${XK})*$`))),$K=Wb([`switch`,`fetch`,`pull`,`push`,`commit`,`amend`,`stash-create`,`stash-apply`,`stash-pop`,`discard`]),eq=q({requestId:K.check(rx()),projectId:K.check(rx()),worktreeId:vG,action:$K,state:Wb([`running`,`succeeded`,`no-change`,`rejected`,`conflicted`,`interrupted`]),reason:W(Wb([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`])),message:W(K),progress:J(K),result:W(q({headOid:W(ZK),trackingOid:W(ZK),sourceOid:W(ZK),destinationRef:W(K),stashOid:W(ZK),stashRetained:W(Fb),restoreStashOid:W(ZK),restoreIndex:W(Fb),branch:W(K)})),acceptedAt:gG,finishedAt:W(gG)}),tq=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;function nq(e,t){return e.length>0&&e.length<=t&&!e.includes(`\0`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)&&!tq.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e.toLowerCase()!==`.git`)}var rq=K.check(fx(1)).check(mx(eG)).check(tx(e=>nq(e,eG),{expected:`Expected a normalized relative path`})),iq=q({projects:J(K.check(rx())).check(mx(128)),worktrees:J(q({projectId:K.check(rx()),worktreeId:vG,paths:J(rq).check(mx(64))})).check(mx(32))}).annotate({parseOptions:{onExcessProperty:`error`}}),aq=YK(Jj(`notices`,{success:Ub([q({type:G(`ready`)}),q({type:G(`subscribed`)}),q({type:G(`heartbeat`)}),q({type:G(`inventory`)}),q({type:G(`git-action`),projectId:K.check(rx()),worktreeId:vG,receipt:eq}),q({type:G(`project`),projectId:K.check(rx()),change:Wb([`files`,`preferences`])}),q({type:G(`worktree`),projectId:K.check(rx()),worktreeId:vG,change:Wb([`files`,`git`,`reviewed`,`comments`,`review`])})]),stream:!0}),Jj(`follow`,{payload:iq})),oq=q({ticket:K,expiresAt:K}),sq=q({ticket:W(K)}),cq=Nb,lq=q({address:K,dataDirectory:K,pid:Pb.check(ux()).check(ox(0))}),uq=q({token:K.check(fx(1)).check(mx(256)),platform:zK,kinds:J(RK).check(mx(2))}),dq=q({kinds:J(RK)}),fq=Nb,pq=Ub([q({kind:G(`off`)}),q({kind:G(`starting`)}),q({kind:G(`on`),urls:J(K)}),q({kind:G(`paused`)}),q({kind:G(`failed`),reason:Wb([`address-in-use`,`address-unavailable`,`unreachable`,`other-server`])})]),mq=q({interfaceName:K,subnet:K,gateway:K,gatewayHardware:W(K)}),hq=q({enabled:Fb,status:pq}),gq=K.check(nx(/^[a-f0-9]{64}$/)).pipe(gie(`WaysInFingerprint`)),_q=Wb([`lan`,`tailnet`,`cloudflare`]),vq=q({routes:q({lan:hq,tailnet:hq,cloudflare:hq}),lanNetwork:W(mq),localNetwork:W(mq),tailnetHostname:W(K),tailnetTarget:W(K),cloudflareHostname:W(K),serviceUrl:K,editing:q({fingerprint:gq,protectedRoute:W(_q)})}),yq=q({expected:gq,change:q({lan:W(Fb),tailnet:W(Fb),tailnetHostname:W(K.check(fx(1)).check(mx(253))),cloudflare:W(Fb),cloudflareHostname:W(K.check(fx(1)).check(mx(253)))}).check(tx(e=>Object.keys(e).length>0))}),bq=vq,xq=dx.check(ox(0)).check(cx(2**53-1)),Sq=q({kind:G(`configured`),revision:xq,settings:IK}),Cq=Ub([q({kind:G(`unconfigured`)}),Sq]),wq=Ub([q({kind:G(`initialize`),settings:IK}),q({kind:G(`change`),change:IK.mapFields(aie(Db)).check(kie(1))})]),Tq=Sq,Eq=q({from:K,target:K,stage:Wb([`downloading`,`installing`,`restarting`,`updated`,`failed`]),reason:yG(K)}),Dq=q({managed:Fb,version:yG(K),latest:yG(K),available:Fb,running:Fb,last:yG(Eq),canUpdate:Fb}),Oq=q({version:K.check(fx(1)).check(mx(128))}),kq=Dq,Aq=$(iK,`BadRequest`),jq=kG(`publicAccess`).add(jA(`readHealth`,`/health`,{disableCodecs:!0,success:KK,error:NK}),jA(`readEnvironment`,`/environment`,{disableCodecs:!0,success:VK,error:NK})),Mq=kG(`browserAccess`).add(FA(`clearBrowserSession`,`/session`,{disableCodecs:!0,success:tK.pipe(Nk({decode:()=>void 0}),jk(`NoContent`))})),Nq=kG(`pairing`).add(MA(`redeemPairing`,`/pair`,{disableCodecs:!0,payload:zG,success:BG,error:[Aq,$(oK,`Unauthorized`)]})).middleware(nK),Pq=kG(`session`).add(jA(`readSession`,`/session`,{disableCodecs:!0,success:AG}),MA(`issueLiveTicket`,`/live/tickets`,{disableCodecs:!0,success:oq,error:[$(_K,`Forbidden`),$(vK,`TooManyRequests`)]})).middleware(rK).middleware(nK),Fq=$(DK,`Forbidden`),Iq=kG(`pushRegistration`).add(NA(`setPushRegistration`,`/push-registration`,{disableCodecs:!0,payload:uq,success:dq,error:Fq}),FA(`clearPushRegistration`,`/push-registration`,{disableCodecs:!0,success:fq.pipe(Nk({decode:()=>void 0}),jk(`NoContent`)),error:Fq})).middleware(rK).middleware(nK),Lq=kG(`serviceUpdates`).add(jA(`readServiceUpdate`,`/service/update`,{disableCodecs:!0,success:Dq}),MA(`startServiceUpdate`,`/service/update`,{disableCodecs:!0,payload:Oq,success:kq.pipe(jk(`Accepted`)),error:[$(bK,`Forbidden`),$(mK,`Conflict`),$(gK,`Conflict`),$(hK,`Conflict`)]})).middleware(rK).middleware(nK),Rq=kG(`reviewGitSettings`).add(jA(`readReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,success:Cq}),PA(`saveReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,payload:wq,success:Tq,error:[$(wK,`Forbidden`),$(TK,`Conflict`)]})).middleware(rK).middleware(nK),zq=$(EK,`Forbidden`),Bq=kG(`administration`).add(jA(`listAccess`,`/access`,{disableCodecs:!0,success:WG,error:zq}),MA(`issuePairing`,`/pairings`,{disableCodecs:!0,payload:GG,success:KG,error:[zq,NK,Aq,$(aK,`BadRequest`)]}),MA(`revokeAccess`,`/access/revoke`,{disableCodecs:!0,payload:qG,success:JG,error:zq}),MA(`setDeviceTrust`,`/access/trust`,{disableCodecs:!0,payload:YG,success:XG,error:[zq,$(yK,`NotFound`)]}),MA(`setManagementPermission`,`/access/management-permission`,{disableCodecs:!0,payload:$G,success:eK,error:[zq,$(yK,`NotFound`)]}),MA(`setWaysInPermission`,`/access/ways-in-permission`,{disableCodecs:!0,payload:ZG,success:QG,error:[zq,$(yK,`NotFound`)]})).middleware(rK).middleware(nK),Vq=$(xK,`Forbidden`),Hq=kG(`remoteAccess`).add(jA(`readRemoteAccess`,`/remote-access`,{disableCodecs:!0,success:vq,error:Vq}),PA(`setRemoteAccess`,`/remote-access`,{disableCodecs:!0,payload:yq,success:bq,error:[Vq,$(SK,`Conflict`),$(CK,`Conflict`),$(uK,`BadRequest`),$(cK,`BadRequest`),$(dK,`BadRequest`),$(lK,`BadRequest`),$(fK,`Conflict`),$(pK,`Conflict`)]})).middleware(rK).middleware(nK),Uq=kG(`environmentLabel`).add(NA(`renameEnvironment`,`/environment/name`,{disableCodecs:!0,payload:HK,success:UK})).add(NA(`setEnvironmentIcon`,`/environment/icon`,{disableCodecs:!0,payload:WK,success:GK})).middleware(rK),Wq=kG(`ownerStatus`).add(jA(`readOwnerStatus`,`/status`,{disableCodecs:!0,success:lq})).middleware(rK);FK.add(jq).prefix(`/api`),FK.add(Mq).prefix(`/api`);var Gq=class extends FK.add(Nq).prefix(`/api`){};FK.add(Pq).prefix(`/api`),FK.add(Iq).prefix(`/api`),FK.add(Lq).prefix(`/api`),FK.add(Hq).prefix(`/api`),FK.add(Rq).prefix(`/api`),FK.add(Bq).prefix(`/api`),FK.add(Uq).prefix(`/api`),FK.add(Bq,Hq,Wq);var Kq=class extends FK.add(jq,Mq,Nq,Pq,Iq,Lq,Hq,Rq,Bq,Uq).prefix(`/api`){},qq=class extends Y()(`InvalidLineRangeError`,{}){get message(){return`The line range ends before it starts`}},Jq=class extends Y()(`WorktreeChangedError`,{}){get message(){return`Worktree changed during inspection`}},Yq=class extends Y()(`WorktreeNotFoundError`,{}){get message(){return`Worktree not found`}},Xq=class extends Y()(`RepositoryUnavailableError`,{}){get message(){return`Repository could not be inspected`}},Zq=class extends Y()(`FilePreferenceLimitError`,{}){get message(){return`File preference limit reached`}},Qq=class extends Y()(`FolderNotFoundError`,{}){get message(){return`Path not found`}},$q=class extends Y()(`FolderNotReadableError`,{}){get message(){return`Path could not be read`}};Y()(`NoWorktreeAtPathError`,{});var eJ=class extends Y()(`ProjectNotFoundError`,{}){get message(){return`Project not found`}},tJ=class extends Y()(`UnsupportedFolderNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},nJ=class extends Y()(`WorktreeUnavailableError`,{}){get message(){return`Worktree is unavailable`}},rJ=[$(Jq,`Conflict`,{code:`worktree_changed`,message:`Refresh status and retry inspection`}),$(Yq,`NotFound`),$(eJ,`NotFound`),$(nJ,`UnprocessableEntity`,{message:`Repository could not be inspected`})];Y()(`GitActionRejectedError`,{reason:Wb([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`]),detail:W(K),cause:W(Mb)}),Y()(`RepositoryIdentityMismatchError`,{});var iJ=class extends Error{name=`GitError`},aJ=class extends iJ{name=`HistorySnapshotUnavailableError`;constructor(e){super(`History snapshot is unavailable`,e)}},oJ=class extends iJ{name=`HistoryWorktreeUnavailableError`;constructor(e){super(`Worktree is unavailable`,e)}},sJ=class extends iJ{name=`InvalidHistoryRequestError`;constructor(e){super(`Invalid history request`,e)}},cJ=class extends iJ{name=`ReadLimitExceededError`;constructor(e){super(`History read exceeds its limit`,e)}},lJ=class extends iJ{name=`UnsupportedHistoryDataError`;constructor(e){super(`History contains unsupported data`,e)}},uJ=class extends Y()(`GitTimeoutError`,{}){get message(){return`Git command exceeded its deadline`}},dJ=class extends iJ{name=`InspectionLimitError`;constructor(e){super(`Git inspection exceeds its limit`,e)}},fJ=class extends iJ{name=`InvalidGitDiffError`;constructor(){super(`Invalid Git diff output`)}},pJ=class extends iJ{name=`InvalidGitStatusError`;constructor(){super(`Invalid Git status output`)}},mJ=class extends iJ{name=`UnsupportedGitFiltersError`;constructor(){super(`Git conversion filters are unsupported for worktree inspection`)}},hJ=class extends iJ{name=`UnsupportedPathEncodingError`;constructor(e){super(`Git paths require valid UTF-8`,e)}};Y()(`GitCommandError`,{checkout:K,args:J(K),exitCode:Kb(Pb),stderr:K,cause:W(Mb)}),Y()(`GitFilesystemError`,{cause:Mb}),Y()(`UnsupportedFilesystemIdentityError`,{}),Y()(`UnsupportedRepositoryError`,{});var gJ=[$(aJ,`UnprocessableEntity`,{message:`History snapshot is unavailable; start a new listing`}),$(oJ,`UnprocessableEntity`,{message:`Worktree is unavailable`}),$(sJ,`BadRequest`),$(cJ,`UnprocessableEntity`,{message:`History read exceeds its limit`}),$(lJ,`UnprocessableEntity`,{message:`History contains unsupported data`}),$(uJ,`ServiceUnavailable`,{message:`Operation unavailable`}),$(dJ,`PayloadTooLarge`,{message:`Git inspection exceeds its limit`}),$(fJ,`BadGateway`,{message:`Git produced output that could not be read`}),$(pJ,`BadGateway`,{message:`Git produced output that could not be read`}),$(mJ,`UnprocessableEntity`,{message:`Git conversion filters are unsupported for worktree inspection`}),$(hJ,`UnprocessableEntity`,{message:`Git paths require valid UTF-8`}),$(Xq,`UnprocessableEntity`,{message:`Repository could not be inspected`})],_J=class extends Y()(`ContentChangedError`,{}){get message(){return`Content changed; retry the operation`}},vJ=class extends Y()(`CrossDeviceMoveError`,{}){get message(){return`Destination is on another filesystem; nothing was moved`}},yJ=class extends Y()(`DiskFullError`,{}){get message(){return`There is not enough space on the disk`}},bJ=class extends Y()(`DirectoryTooLargeError`,{}){get message(){return`Directory exceeds the listing limit`}},xJ=class extends Y()(`EntryExistsError`,{}){get message(){return`An entry already exists at that path`}},SJ=class extends Y()(`FileTooLargeError`,{}){get message(){return`File exceeds the read limit`}},CJ=class extends Y()(`InvalidMoveError`,{}){get message(){return`An entry cannot be moved onto or into itself`}},wJ=class extends Y()(`PathNotFoundError`,{}){get message(){return`Path not found`}},TJ=class extends Y()(`PathNotReadableError`,{}){get message(){return`Path could not be read`}},EJ=class extends Y()(`TrashUnavailableError`,{}){get message(){return`This machine has no trash; nothing was deleted`}},DJ=class extends Y()(`UnsupportedAssetTypeError`,{}){get message(){return`File type cannot be previewed`}},OJ=class extends Y()(`UnsupportedEntryNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},kJ=class extends Y()(`UnsupportedTextError`,{}){get message(){return`File is not supported UTF-8 text`}},AJ=$(CJ,`BadRequest`,{message:`Invalid request`}),jJ=$(wJ,`NotFound`),MJ=$(_J,`Conflict`,{code:`content_changed`}),NJ=$(xJ,`Conflict`),PJ=$(TJ,`UnprocessableEntity`),FJ=$(OJ,`UnprocessableEntity`),IJ=$(bJ,`UnprocessableEntity`),LJ=$(vJ,`UnprocessableEntity`),RJ=$(EJ,`UnprocessableEntity`),zJ=$(DJ,`UnprocessableEntity`),BJ=$(kJ,`UnprocessableEntity`,{code:`unsupported_text`}),VJ=$(SJ,`UnprocessableEntity`,{code:`file_too_large`}),HJ=$(yJ,`UnprocessableEntity`),UJ=[...rJ,jJ,PJ,MJ],WJ=[...UJ,BJ,VJ],GJ=class extends Y()(`BranchBaseNotFoundError`,{}){get message(){return`Base branch not found`}},KJ=class extends Y()(`CommitNotFoundError`,{}){get message(){return`Commit not found`}},qJ=class extends Y()(`IncompleteDiffReadError`,{}){get message(){return`Diff read returned fewer results than requested`}},JJ=class extends Y()(`SelectionMismatchError`,{}){get message(){return`Selections must cover exactly the expected files`}},YJ=class extends Y()(`UnnamedDiffSelectionError`,{}){get message(){return`A diff selection names neither an old nor a new path`}},XJ=class extends Y()(`UnbornBranchError`,{}){get message(){return`The branch has no commits yet`}},ZJ=class extends Y()(`UnrelatedBranchError`,{}){get message(){return`The branch shares no history with its base`}},QJ=K.check(fx(1)).check(mx(aG)).check(nx(/^refs\/(?:heads|remotes)\/\S+$/u)),$J=K.check(nx(/^[a-f0-9]{64}$/)),eY=Ub([q({kind:G(`text`),patch:K}),q({kind:G(`binary`)}),q({kind:G(`metadata-only`),patch:K}),q({kind:G(`omitted`),reason:Wb([`size-limit`,`unsupported-encoding`,`unsupported-submodule`])})]),tY=q({ref:K,oid:ZK}),nY=q({path:K,oldPath:yG(K),newPath:yG(K),status:Wb([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldOid:W(ZK),newOid:W(ZK),oldMode:K,newMode:K,fingerprint:$J}),rY=q({base:W(QJ)}),iY=q({worktreeId:vG,head:q({oid:ZK,branch:yG(K)}),base:yG(tY),mergeBaseOid:yG(ZK),commits:Pb.check(ux()).check(sx(0)),files:J(nY).check(mx(rG))}),aY=q({baseOid:ZK,headOid:ZK,paths:J(J(K).check(fx(1)).check(mx(2))).check(fx(1)).check(mx(200))}),oY=q({diffs:J(q({paths:J(K),content:eY}))}),sY=q({defaultRef:yG(K),bases:J(q({ref:K,name:K,remote:Fb})).check(mx(500))}),cY=q({additions:dx,deletions:dx,binaryFiles:dx}),lY={DD:`both-deleted`,AU:`added-by-us`,UD:`deleted-by-them`,UA:`added-by-them`,DU:`deleted-by-us`,AA:`both-added`,UU:`both-modified`},uY={"both-deleted":`DD`,"added-by-us":`AU`,"deleted-by-them":`UD`,"added-by-them":`UA`,"deleted-by-us":`DU`,"both-added":`AA`,"both-modified":`UU`},dY=Wb([`DD`,`AU`,`UD`,`UA`,`DU`,`AA`,`UU`]),fY=Wb([`both-deleted`,`added-by-us`,`deleted-by-them`,`added-by-them`,`deleted-by-us`,`both-added`,`both-modified`]),pY=dY.pipe(qb(fY,l_({decode:e=>lY[e],encode:e=>uY[e]}))),mY=q({scope:Wb([`staged`,`unstaged`]),oldPath:yG(rq),newPath:yG(rq)}),hY=Ub([q({scope:Wb([`staged`,`unstaged`]),kind:Wb([`added`,`modified`,`deleted`,`renamed`,`type-changed`]),oldPath:yG(rq),newPath:yG(rq),oldMode:K.check(nx(/^[0-7]{6}$/)),newMode:K.check(nx(/^[0-7]{6}$/)),oldOid:yG(ZK),newOid:yG(ZK),supported:Fb}),q({scope:G(`untracked`),path:rq}),q({scope:G(`unmerged`),path:rq,conflict:pY})]),gY=q({environmentId:K.check(rx()),worktreeId:vG,statusToken:$J,branch:W(q({name:yG(K),upstream:yG(K),ahead:Pb.check(ux()).check(sx(0)),behind:Pb.check(ux()).check(sx(0)),remoteName:yG(K),sourceRef:yG(K),upstreamOid:yG(ZK),stashes:J(q({oid:ZK,message:K})),discarded:J(q({oid:ZK,path:rq,kind:Wb([`hunk`,`rename`])})).check(mx(50))})),consistency:G(`best-effort`),headOid:yG(ZK),inProgress:yG(Wb([`merge`,`rebase`])),mergeHeadOid:yG(ZK),headCommit:yG(q({subject:K,body:W(K)})),changes:J(hY).check(mx(QW))}),_Y=q({environmentId:K.check(rx()),worktreeId:vG,...cY.fields,additions:cY.fields.additions.check(sx(0)),deletions:cY.fields.deletions.check(sx(0)),binaryFiles:cY.fields.binaryFiles.check(sx(0))}),vY=q({path:rq,fingerprint:yG($J),comparisons:J(hY).check(fx(1))}),yY=q({name:yG(K),upstream:yG(K),ahead:Pb.check(ux()).check(sx(0)),behind:Pb.check(ux()).check(sx(0))}),bY=q({environmentId:K.check(rx()),worktreeId:vG,statusToken:$J,headOid:yG(ZK),inProgress:yG(Wb([`merge`,`rebase`])),mergeHeadOid:yG(ZK),branch:yG(yY),interrupted:W(q({requestId:K.check(rx()),action:$K})),changes:J(vY).check(mx(QW))}),xY=q({expectedStatusToken:$J,expectedFiles:J(q({path:rq,fingerprint:yG($J)})).check(fx(1)).check(mx(200)),selections:J(mY).check(fx(1)).check(mx(200))}),SY=q({environmentId:K.check(rx()),worktreeId:vG,statusToken:$J,diffs:J(q({selection:mY,content:eY}))}),CY=q({path:rq,from:Sx.check(ux()).check(sx(1)),to:Sx.check(ux()).check(sx(1)),at:Wb([`head`,`worktree`])}),wY=q({environmentId:K.check(rx()),worktreeId:vG,at:Wb([`head`,`worktree`]),path:rq,from:Pb.check(ux()).check(sx(0)),to:Pb.check(ux()).check(sx(0)),lines:J(K)}),TY=QK,EY=J(ZK),DY=TY.pipe(qb(EY,l_({decode:e=>e.split(`,`),encode:e=>e.join(`,`)}))),OY=q({limit:W(Sx.check(ux()).check(sx(1)).check(cx(100))),after:W(DY),tip:W(ZK)}),kY=Ub([q({kind:G(`attached`),ref:K}),q({kind:G(`detached`)}),q({kind:G(`unborn`),ref:K})]),AY=Ub([q({kind:Wb([`local-branch`,`remote-branch`,`tag`]),name:K}),q({kind:G(`head`),name:G(`HEAD`)})]),jY=q({oid:ZK,parentOids:J(ZK),author:q({name:K,timestamp:K}),subject:K,subjectTruncated:Fb,body:yG(K),bodyTruncated:Fb,refs:J(AY)}),MY=q({snapshot:yG(q({tipOid:yG(ZK),head:kY})),commits:J(jY).check(mx(100)),nextAfter:yG(J(ZK).check(mx(100))),tip:yG(ZK),boundary:yG(Wb([`shallow`,`wide`])),restarted:Fb}),NY=q({tip:ZK,offset:dx.check(sx(1)).check(cx(2**53-1-100-1))}),PY=q({path:rq,after:W(xx(NY)),limit:W(Sx.check(ux()).check(sx(1)).check(cx(100)))}),FY=q({commits:J(q({commit:jY,path:K,previousPath:yG(K),status:Wb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})).check(mx(100)),nextAfter:yG(NY),tip:yG(ZK),boundary:yG(G(`shallow`)),restarted:Fb}),IY=Ub([q({kind:G(`parent`),parentNumber:Pb.check(ux()).check(ox(0)),baseOid:ZK}),q({kind:G(`empty-tree`)})]),LY=q({oldPath:yG(K),newPath:yG(K),status:Wb([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldMode:K,newMode:K}),RY=q({worktreeId:vG,oid:ZK}),zY=q({parent:W(Sx.check(ux()).check(sx(1)).check(cx(nG)))}),BY=q({commit:jY,comparison:IY,files:J(LY).check(mx(rG))}),VY=q({worktreeId:vG,oid:ZK}),HY=q({parent:W(Pb.check(ux()).check(sx(1)).check(cx(nG))),paths:J(J(K).check(fx(1)).check(mx(2))).check(fx(1)).check(mx(200))}),UY=q({commitOid:ZK,diffs:J(q({paths:J(K),content:eY}))}),WY=class extends FK.add(kG(`changes`).add(jA(`readWorktreeSummary`,`/api/worktrees/:worktreeId/summary`,{disableCodecs:!0,params:bG,success:_Y,error:[NK,...rJ,...gJ]}),jA(`listBranchBases`,`/api/worktrees/:worktreeId/branch-bases`,{disableCodecs:!0,params:bG,success:sY,error:[...rJ,...gJ]}),jA(`listCommits`,`/api/worktrees/:worktreeId/commits`,{disableCodecs:!0,params:bG,query:OY.fields,success:MY,error:[...rJ,...gJ]}),jA(`listFileCommits`,`/api/worktrees/:worktreeId/file-commits`,{disableCodecs:!0,params:bG,query:PY.fields,success:FY,error:[...rJ,...gJ]}),jA(`readBranchChanges`,`/api/worktrees/:worktreeId/branch-changes`,{disableCodecs:!0,params:bG,query:rY.fields,success:iY,error:[...rJ,...gJ,$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),MA(`readBranchDiffs`,`/api/worktrees/:worktreeId/branch-changes/diffs`,{disableCodecs:!0,params:bG,payload:aY,success:oY,error:[...rJ,...gJ,$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),MA(`readChangeDiffs`,`/api/worktrees/:worktreeId/changes/diffs`,{disableCodecs:!0,params:bG,payload:xY,success:SY,error:[NK,...rJ,...gJ,$(JJ,`BadRequest`,{message:`Invalid request`}),$(YJ,`BadRequest`,{message:`Invalid request`}),$(qJ,`UnprocessableEntity`)]}),jA(`readChangeLines`,`/api/worktrees/:worktreeId/changes/lines`,{disableCodecs:!0,params:bG,query:CY.fields,success:wY,error:[NK,...WJ,$(qq,`BadRequest`,{message:`Invalid request`})]}),jA(`readChanges`,`/api/worktrees/:worktreeId/changes`,{disableCodecs:!0,params:bG,success:bY,error:[NK,...rJ,...gJ]}),MA(`readCommitDiffs`,`/api/worktrees/:worktreeId/commits/:oid/diffs`,{disableCodecs:!0,params:VY,payload:HY,success:UY,error:[...rJ,...gJ,$(KJ,`NotFound`)]}),jA(`readCommitFiles`,`/api/worktrees/:worktreeId/commits/:oid/files`,{disableCodecs:!0,params:RY,query:zY.fields,success:BY,error:[...rJ,...gJ,$(KJ,`NotFound`)]}),jA(`readGitStatus`,`/api/worktrees/:worktreeId/git/status`,{disableCodecs:!0,params:bG,success:gY,error:[NK,...rJ,...gJ]})).middleware(rK)){};function GY(e){return new TextEncoder().encode(e).byteLength}var KY=Ub([G(``),rq]),qY=K.check(tx(e=>e.length<=1048576&&!e.includes(`\0`)&&GY(e)<=1048576,{expected:`UTF-8 text without NUL within the write limit`})),JY=q({path:KY}),YY=_b(q({worktreeId:vG,path:K,entries:J(q({name:K,kind:Wb([`file`,`directory`,`symlink`,`submodule`,`other`]),ignored:W(Fb),target:W(K)}))})),XY=_b(q({worktreeId:vG,paths:J(K).check(mx(oG))})),ZY=q({path:rq}),QY=_b(q({worktreeId:vG,path:K,encoding:G(`utf-8`),byteLength:dx.check(sx(0)),text:K,contentFingerprint:W($J)})),$Y=Ub([q({kind:G(`write`),path:rq,text:qY,expectedFingerprint:$J}),q({kind:G(`create`),path:rq,entryKind:Wb([`file`,`directory`])}),q({kind:G(`move`),path:rq,destination:rq}),q({kind:G(`trash`),path:rq}),q({kind:G(`copy`),path:rq,destination:rq})]),eX=_b(q({path:K,contentFingerprint:W($J)})),tX=q({path:rq}),nX=_b(q({path:K,mediaType:K,base64:K})),rX=q({document:rq,paths:J(K.check(mx(eG))).check(fx(1),mx(64))}),iX=_b(q({assets:J(Ub([q({kind:G(`asset`),path:K,mediaType:K,base64:K}),q({kind:G(`unavailable`),path:K})]))})),aX=class extends FK.add(kG(`files`).add(jA(`listDirectory`,`/api/worktrees/:worktreeId/directory`,{disableCodecs:!0,params:bG,query:JY.fields,success:YY,error:[...UJ,FJ,IJ]}),jA(`listWorktreePaths`,`/api/worktrees/:worktreeId/paths`,{disableCodecs:!0,params:bG,success:XY,error:[...rJ,IJ]}),jA(`readTextFile`,`/api/worktrees/:worktreeId/text`,{disableCodecs:!0,params:bG,query:ZY.fields,success:QY,error:[...UJ,BJ,VJ]}),jA(`readFileAsset`,`/api/worktrees/:worktreeId/asset`,{disableCodecs:!0,params:bG,query:tX.fields,success:nX,error:[...UJ,zJ,VJ]}),MA(`readPreviewAssets`,`/api/worktrees/:worktreeId/preview-assets`,{disableCodecs:!0,params:bG,payload:rX,success:iX,error:rJ}),MA(`editFile`,`/api/worktrees/:worktreeId/files`,{disableCodecs:!0,params:bG,payload:$Y,success:eX,error:[...UJ,BJ,NJ,LJ,RJ,VJ,HJ,AJ]})).middleware(rK)){},oX=class extends Y()(`CommitDraftSelectionError`,{}){get message(){return`Select readable changed files to generate a commit draft.`}},sX=class extends Y()(`CommitDraftTooLargeError`,{}){get message(){return`Select fewer files to generate a commit draft.`}},cX=class extends Y()(`CommitGenerationFailedError`,{}){get message(){return`Commit generation failed.`}},lX=class extends Y()(`CommitGroupsMismatchError`,{}){get message(){return`The generated draft did not cover the selected files. Generate again or write the message manually.`}},uX=class extends Y()(`CommitToolFailedError`,{}){get message(){return`Commit generation failed. Check that the selected CLI is up to date and signed in.`}},dX=class extends Y()(`CommitToolMissingError`,{}){get message(){return`The selected coding CLI is not installed.`}},fX=class extends Y()(`DiscardExpectationMismatchError`,{}){get message(){return`A discard expects exactly the discarded path`}},pX=class extends Y()(`DuplicateExpectedFileError`,{}){get message(){return`Each expected file may appear only once`}},mX=class extends Y()(`EmptyCommitSelectionError`,{}){get message(){return`Select at least one path to commit`}},hX=class extends Y()(`ExpectedFilesMismatchError`,{}){get message(){return`The expected files do not match the selected paths`}},gX=class extends Y()(`GitActionNotFoundError`,{}){get message(){return`Git action receipt not found`}},_X=class extends Y()(`GitActionReceiptMismatchError`,{}){get message(){return`Git action receipt does not match this request`}},vX=class extends Y()(`InvalidHunkRangeError`,{}){get message(){return`The hunk ends before it starts`}},yX=class extends Y()(`MergeExpectationMismatchError`,{}){get message(){return`A merge in progress and its merge head must be expected together`}},bX=class extends Y()(`MissingExpectedFilesError`,{}){get message(){return`This action needs the files the client expects`}},xX=class extends Y()(`MissingUpstreamExpectationError`,{}){get message(){return`This action needs the upstream the client expects`}},SX=class extends Y()(`UnsupportedCommitModelError`,{}){get message(){return`Unsupported commit model.`}},CX=class extends Y()(`WorktreeCleanupRefusedError`,{message:K}){},wX=J(q({id:K,label:K})),TX=q({mode:Wb([`message`,`groups`]),model:K.check(fx(1)).check(mx(160)),expectedStatusToken:$J,paths:J(rq).check(fx(1)).check(mx(QW))}),EX=q({groups:J(q({message:K.check(fx(1)).check(mx(ZW)),paths:J(rq).check(fx(1)).check(mx(QW))})).check(fx(1)).check(mx(20)),expectedFiles:J(q({path:rq,fingerprint:$J})).check(mx(QW))}),DX=K.check(fx(1)).check(mx(ZW)).check(tx(e=>e.trim().length>0&&!e.includes(`\0`)&&GY(e)<=16384)),OX=K.check(mx(aG)).check(nx(/^refs\/heads\/[\s\S]/u)).check(tx(e=>!e.includes(`\0`))),kX=K.check(nx(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/)),AX=q({path:rq,fingerprint:$J}),jX=q({worktreeId:vG,requestId:K.check(rx())}),MX=Ub([q({action:G(`switch`),targetRef:OX}),q({action:G(`fetch`),remoteName:kX,sourceRef:OX}),q({action:G(`pull`),remoteName:kX,sourceRef:OX,strategy:W(Wb([`ff-only`,`merge`,`rebase`]))}),q({action:G(`push`),remoteName:kX,destinationRef:OX,allowCreate:Fb}),q({action:G(`commit`),message:DX,paths:J(rq).check(mx(QW))}),q({action:G(`amend`),message:DX,paths:J(rq).check(mx(QW))}),q({action:G(`stash-create`),message:DX,includeUntracked:Fb}),q({action:Wb([`stash-apply`,`stash-pop`]),stashOid:ZK,restoreIndex:Fb.pipe(Zb(B(!1)))}),q({action:G(`discard`),path:rq,hunk:W(q({scope:Wb([`staged`,`unstaged`]),startLine:Pb.check(ux()).check(ox(0)),endLine:Pb.check(ux()).check(ox(0))}))})]),NX=q({headOid:yG(ZK),branch:yG(K),inProgress:yG(Wb([`merge`,`rebase`])),mergeHeadOid:yG(ZK),upstreamOid:W(Gb(ZK)),files:W(J(AX).check(mx(QW)))}),PX=q({requestId:K.check(rx()),input:MX,expected:NX}),FX=eq,IX=Ub([eq,mG]),LX=jX,RX=eq,zX=jX,BX=q({dismissed:G(!0)}),VX=$(_X,`Conflict`,{message:`Git action request does not match its receipt`}),HX=$(gX,`NotFound`),UX=[$(vX,`BadRequest`,{message:`Invalid request`}),$(pX,`BadRequest`,{message:`Invalid request`}),$(yX,`BadRequest`,{message:`Invalid request`}),$(mX,`BadRequest`,{message:`Invalid request`}),$(hX,`BadRequest`,{message:`Invalid request`}),$(fX,`BadRequest`,{message:`Invalid request`}),$(bX,`BadRequest`,{message:`Invalid request`}),$(xX,`BadRequest`,{message:`Invalid request`})],WX=[$(oX,`UnprocessableEntity`),$(sX,`UnprocessableEntity`),$(cX,`UnprocessableEntity`),$(lX,`UnprocessableEntity`),$(uX,`UnprocessableEntity`),$(dX,`UnprocessableEntity`),$(SX,`UnprocessableEntity`)],GX=class extends FK.add(kG(`gitActions`).add(FA(`dismissInterruptedGitAction`,`/api/worktrees/:worktreeId/git/interrupted/:requestId`,{disableCodecs:!0,params:zX,success:BX,error:[...rJ,HX,VX]}),MA(`generateCommitDraft`,`/api/worktrees/:worktreeId/git/commit-draft`,{disableCodecs:!0,params:bG,payload:TX,success:EX,error:[...rJ,...gJ,...WX]}),jA(`listCommitModels`,`/api/git/commit-models`,{disableCodecs:!0,success:wX}),jA(`readGitActionReceipt`,`/api/worktrees/:worktreeId/git/receipts/:requestId`,{disableCodecs:!0,params:LX,success:RX,error:[...rJ,HX]}),MA(`runGitAction`,`/api/worktrees/:worktreeId/git/actions`,{disableCodecs:!0,params:bG,payload:PX,success:[FX,FX.pipe(jk(202)),IX.pipe(jk(409)),IX.pipe(jk(503))],error:[...rJ,VX,...UX]})).middleware(rK)){};q({address:K,dataDirectory:K,pid:dx}),q({path:Ob(K),fingerprint:Ob(Ub([K,Nb]))});var KX=q({deleteWorktree:Fb,deleteLocalBranch:Fb,deleteRemoteBranch:Fb}),qX=q({worktreePath:W(K),detachWorktreePath:W(K),localBranch:W(K),remoteBranch:W(K),remoteBranchNote:W(K),mainCheckout:Fb,dirty:Fb,unpushed:Fb,fingerprint:K}),JX=q({options:KX,confirmation:W(q({plan:qX,discardChanges:Fb}))}),YX=JX,XX=q({deleted:Fb,plan:qX}),ZX=K.check(tx(e=>nq(e,eG),{expected:`a normalized relative path`})),QX=_b(q({preferences:J(q({path:ZX,pinned:Fb,hidden:Fb}))})),$X=q({path:ZX,flag:Wb([`pinned`,`hidden`]),value:Fb}),eZ=QX,tZ=Wb([`moved`,`missing`,`permission`,`git-failed`]),nZ=K.check(fx(1),mx(eG),tx(e=>e.startsWith(`/`)&&!e.includes(`\0`),{expected:`an absolute path without NUL`})),rZ={id:_G,name:K,worktrees:J(q({id:vG,path:K,main:Fb,branch:yG(K),headCommittedAt:Db(gG),available:Fb,status:yG(Wb([`pending`,`reviewed`,`replied`]))}))},iZ=Ub([q({...rZ,available:G(!0),unavailableReason:Db(jb)}),q({...rZ,available:G(!1),unavailableReason:Db(tZ)})]),aZ=q({projectId:_G}),oZ=aZ,sZ=aZ,cZ=aZ,lZ=_b(q({environmentId:_G,environment:BK,projects:J(iZ)})),uZ=q({path:nZ}),dZ=_b(iZ),fZ=q({deleted:Fb}),pZ=q({path:Db(nZ)}),mZ=_b(q({path:K,parent:yG(K),directories:J(q({name:K,path:K})),repository:Fb,truncated:Fb})),hZ=_b(q({name:K.pipe(qb(K.check(fx(1),mx(100),tx(e=>!/[\p{Cc}\p{Cf}]/u.test(e),{expected:`a name without control characters`})),l_({decode:e=>e.trim(),encode:e=>e})))}),{parseOptions:PK}),gZ=q({id:_G,name:K}),_Z=$(eJ,`NotFound`),vZ=class extends FK.add(kG(`projects`).add(MA(`deleteWorktree`,`/api/worktrees/:worktreeId/delete`,{disableCodecs:!0,params:bG,payload:YX,success:XX,error:[...rJ,$(CX,`Conflict`,{message:{fromError:!0}})]}),jA(`browseProjectFolders`,`/api/projects/folders`,{disableCodecs:!0,query:pZ.fields,success:mZ,error:[$(Qq,`NotFound`),$($q,`UnprocessableEntity`),$(tJ,`UnprocessableEntity`)]}),jA(`readInventory`,`/api/inventory`,{disableCodecs:!0,success:lZ,error:NK}),MA(`refreshInventory`,`/api/inventory/refresh`,{disableCodecs:!0,success:lZ,error:NK}),jA(`listFilePreferences`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:sZ,success:QX,error:_Z}),MA(`registerProject`,`/api/projects`,{disableCodecs:!0,payload:uZ,success:dZ,error:[_Z,$(Xq,`UnprocessableEntity`,{message:`Repository could not be inspected`})]}),FA(`removeProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:oZ,success:fZ,error:_Z}),PA(`renameProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:aZ,payload:hZ,success:gZ,error:_Z}),NA(`setFilePreference`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:cZ,payload:$X,success:eZ,error:[_Z,$(Zq,`Conflict`,{message:`File preference limit reached`})]})).middleware(rK)){},yZ=class extends Y()(`UnknownBoxLayerError`,{}){get message(){return`A diagram box names a layer the review does not have`}},bZ=class extends Y()(`CommentAuthorMismatchError`,{}){get message(){return`Only the author of a comment may change it`}},xZ=class extends Y()(`CommentIdentityConflictError`,{}){get message(){return`Comment ID belongs to a different write`}},SZ=class extends Y()(`CommentLimitExceededError`,{}){get message(){return`Comment capacity exceeded`}},CZ=class extends Y()(`CommentRevisionMismatchError`,{}){get message(){return`The comparison must identify the revision it belongs to`}},wZ=class extends Y()(`CommentTargetNotFoundError`,{}){get message(){return`Comment target not found`}},TZ=class extends Y()(`DuplicateLayerIdError`,{}){get message(){return`Layer IDs repeat within the review`}},EZ=class extends Y()(`DuplicateStepIdError`,{}){get message(){return`Step IDs repeat within a layer`}},DZ=class extends Y()(`ReviewConflictError`,{}){get message(){return`The review changed; reload before retrying`}},OZ=class extends Y()(`ReviewLayerNotFoundError`,{}){get message(){return`Review layer not found`}},kZ=class extends Y()(`ReviewSummaryNotFoundError`,{}){get message(){return`Review summary not found`}},AZ=class extends Y()(`ReviewedMarkConflictError`,{}){get message(){return`The reviewed mark is based on a version that has changed`}},jZ=class extends Y()(`StepLaneOutOfRangeError`,{}){get message(){return`A step names a lane its layer does not have`}},MZ=class extends Y()(`UnsupportedCommentComparisonError`,{}){get message(){return`A comment on the whole change compares only against a branch`}},NZ=class extends Y()(`UnknownArrowBoxError`,{}){get message(){return`A diagram arrow joins a box its diagram does not have`}},PZ=class extends Y()(`InvalidDecisionBoxError`,{}){get message(){return`A decision box must name a layer and be the only decision box for that layer`}},FZ=class extends Y()(`ProofFileNotFoundError`,{}){get message(){return`Proof file not found`}},IZ=class extends Y()(`ProofFileUnreadableError`,{}){get message(){return`A proof file is missing from the worktree or is not a readable file`}},LZ=class extends Y()(`ProofTooLargeError`,{}){get message(){return`A proof file, or the proof files together, are over their size limit`}},RZ=class extends Y()(`UnknownProofTargetError`,{}){get message(){return`A check or asset names a layer or step the review does not have; a step also needs its layer`}},zZ=class extends Y()(`UnsupportedProofFileError`,{}){get message(){return`A proof file is not the kind it names: an image must be PNG, JPEG, GIF or WebP and a video MP4 or WebM`}},BZ=class extends Y()(`UnknownProofFileError`,{}){get message(){return`A proofId names no image or video of the current review`}},VZ=class extends Y()(`InvalidReviewPointerError`,{layerId:K,stepId:K,path:K,startLine:Pb,endLine:Pb,reason:Wb([`missing`,`unreadable`,`out-of-range`]),lineCount:Db(Pb)}){get message(){let e=`Step \`${this.stepId}\` in layer \`${this.layerId}\` points to \`${this.path}:${this.startLine}-${this.endLine}\``;switch(this.reason){case`missing`:return`${e}, which does not exist in this worktree`;case`unreadable`:return`${e}, which is not a readable text file`;case`out-of-range`:return`${e}, but the file has ${this.lineCount} lines`;default:return this.reason}}},HZ=class extends Y()(`ReviewPublishRefusedError`,{message:K}){},UZ=class extends Y()(`ReviewNotFoundError`,{}){get message(){return`Review or revision not found`}},WZ=class extends Y()(`InvalidReviewComparisonError`,{}){get message(){return`The from revision must not be newer than the to revision`}},GZ=Wb([`gh-not-installed`,`no-accounts`,`no-access`,`not-github`,`rate-limited`,`offline`,`invalid-response`,`pull-request-not-found`]),KZ=q({kind:G(`unavailable`),reason:GZ}),qZ=q({account:K,source:Wb([`detected`,`overridden`])}),JZ=q({repository:W(K),accounts:J(K),choice:W(qZ),override:W(K),unavailable:W(KZ)}),YZ=Gb(q({login:K,avatarUrl:W(K)})),XZ=q({hasNextPage:Fb}),ZZ=Ub([q({__typename:G(`CheckRun`),name:K,status:K,conclusion:Gb(K),detailsUrl:Gb(K),startedAt:W(Gb(K)),completedAt:W(Gb(K))}),q({__typename:G(`StatusContext`),context:K,state:K,targetUrl:Gb(K)})]),QZ=q({number:dx,title:K,url:K,state:Wb([`OPEN`,`CLOSED`,`MERGED`]),isDraft:Fb,author:YZ,headRefName:K,updatedAt:K,commits:q({nodes:J(q({commit:q({statusCheckRollup:Gb(q({state:K}))})}))})}),$Z=q({id:K,author:YZ,createdAt:K,body:K,url:K});q({...QZ.fields,commits:q({nodes:J(q({commit:q({statusCheckRollup:Gb(q({state:K,contexts:q({nodes:J(ZZ),pageInfo:XZ})}))})}))}),body:K,bodyHTML:W(K),createdAt:W(K),baseRefName:K,headRefOid:K,mergeable:K,labels:q({nodes:J(q({name:K,color:K})),pageInfo:XZ}),comments:q({nodes:J($Z),pageInfo:XZ}),reviews:q({nodes:J(q({id:K,author:YZ,submittedAt:Gb(K),createdAt:W(K),body:K,url:K,state:K,comments:q({nodes:J(q({...$Z.fields,path:K,diffHunk:W(K),line:Gb(dx),originalLine:Gb(dx)})),pageInfo:XZ})})),pageInfo:XZ})});var eQ=q({name:K,status:K,conclusion:W(K),detailsUrl:W(K),durationMs:W(dx)}),tQ=q({number:dx,title:K,url:K,state:Wb([`open`,`closed`,`merged`]),draft:Fb,author:W(K),headBranch:K,updatedAt:K,checksSummary:W(K),checksTruncated:Fb}),nQ=q({id:K,kind:Wb([`comment`,`review`,`review-comment`]),author:W(K),time:K,body:K,url:K,reviewState:W(K),authorAvatarUrl:W(K),reviewId:W(K),diffHunk:W(K),path:W(K),line:W(dx),originalLine:W(dx)}),rQ=q({...tQ.fields,description:K,createdAt:W(K),authorAvatarUrl:W(K),baseBranch:K,headSha:K,matchesReviewHead:Fb,mergeable:K,labels:J(q({name:K,color:K})),checks:J(eQ),timeline:J(nQ),truncated:Fb});q({number:dx,commits:q({nodes:J(q({commit:q({statusCheckRollup:Gb(q({state:Wb([`SUCCESS`,`PENDING`,`EXPECTED`,`FAILURE`,`ERROR`])}))})}))})});var iQ=Wb([`passed`,`running`,`failed`,`none`]);Y()(`GitHubReadError`,{reason:GZ}),Y()(`GitHubPullRequestNotFoundError`,{});var aQ=class extends Y()(`ReviewArchiveRefusedError`,{message:K}){},oQ=class extends Y()(`ReviewPullRequestRefusedError`,{message:K}){},sQ=class extends Y()(`AgentFeedbackConflictError`,{reviewId:K,reason:Wb([`review-inactive`,`session-missing`,`session-connected`,`delivery-mismatch`,`stale-feedback`,`delivery-pending`,`recipient-unavailable`,`recipient-mismatch`])}){get message(){switch(this.reason){case`review-inactive`:return`Open the latest active review before connecting or sending feedback`;case`session-connected`:return`Disconnect the current session before associating another one`;case`session-missing`:return`Connect a T3 session before sending feedback`;case`delivery-mismatch`:return`This feedback delivery is no longer current`;case`stale-feedback`:return`Newer feedback has already been queued`;case`delivery-pending`:return`The previous send has an unknown result. Acknowledge it or disconnect before sending more feedback`;case`recipient-unavailable`:return`The associated T3 session is unavailable on this machine`;case`recipient-mismatch`:return`The associated T3 session belongs to a different worktree`}}},cQ=q({path:Ob(K),startLine:Ob(Pb),endLine:Ob(Pb),symbol:Ob(W(Ub([K,Nb])))}),lQ=q({id:Ob(K),lane:Ob(Pb),title:Ob(K),text:Ob(K),kind:Ob(Ub([G(`changed`),G(`context`)])),pointer:Ob(cQ)}),uQ=q({id:Ob(K),title:Ob(K),summary:Ob(K),lanes:Ob(J(K)),steps:Ob(J(lQ))}),dQ=q({...lQ.fields,published:Ob(J(K))});q({...iie(uQ.fields,[`steps`]),steps:Ob(J(dQ)),fingerprint:Ob(K)});var fQ=q({id:Ob(K),label:Ob(K),detail:Ob(W(Ub([K,Nb]))),change:Ob(W(Ub([G(`new`),G(`changed`),G(`removed`),Nb]))),problem:Ob(W(Ub([K,Nb]))),layerId:Ob(W(Ub([K,Nb]))),decision:Ob(W(G(!0)))}),pQ=q({from:Ob(K),to:Ob(K),label:Ob(W(Ub([K,Nb])))});q({after:Ob(q({boxes:Ob(J(fQ)),arrows:Ob(J(pQ))}))});var mQ=Wb([`merge`,`hold`]),hQ=q({what:K,why:K}),gQ=q({behavior:K,why:K,paths:J(K)});q({asked:q({text:K,links:W(J(q({title:K,url:K})))}),recommendation:mQ,reasons:J(K),notProven:J(hQ),removed:J(gQ)}),q({reviewId:K,projectId:K,commonDirectory:K,branch:K,pullRequest:W(K),state:Wb([`open`,`closed`]),archived:W(Fb),latestRevision:dx,lastSeenRevision:dx}),q({path:K,oldPath:W(K),newPath:W(K),oldOid:W(K),newOid:W(K),oldMode:K,newMode:K,status:Wb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])}),q({path:K,ranges:J(q({startLine:Pb,endLine:Pb})),deleted:W(Fb),binary:W(Fb)});var _Q=q({layerId:Ob(W(Ub([K,Nb]))),stepId:Ob(W(Ub([K,Nb])))}),vQ=q({..._Q.fields,name:Ob(K),result:Ob(Ub([G(`pass`),G(`fail`)])),output:Ob(W(Ub([K,Nb])))}),yQ=Ub([G(`image`),G(`video`)]),bQ=Ub([G(`image/png`),G(`image/jpeg`),G(`image/gif`),G(`image/webp`),G(`video/mp4`),G(`video/webm`)]),xQ=Ub([q({..._Q.fields,id:Ob(K),kind:Ob(yQ),title:Ob(K),mediaType:Ob(bQ),byteLength:Ob(Pb)}),q({...q({..._Q.fields,kind:Ob(G(`link`)),title:Ob(K),url:Ob(K)}).fields,id:Ob(K)})]);q({paths:W(J(K)),checks:Ob(J(vQ)),assets:Ob(J(xQ))});var SQ=Ub([q({kind:Ob(G(`worktree`)),scope:Ob(Ub([G(`staged`),G(`unstaged`),G(`untracked`)]))}),q({kind:Ob(G(`file`))}),q({kind:Ob(G(`commit`)),parent:Ob(Pb)}),q({kind:Ob(G(`branch`)),base:Ob(K)})]);Ub([q({comparison:Ob(W(Ub([SQ,Nb]))),revision:Ob(W(Ub([K,Nb]))),contentFingerprint:Ob(W(Ub([K,Nb]))),kind:Ob(G(`change`))}),q({comparison:Ob(W(Ub([SQ,Nb]))),revision:Ob(W(Ub([K,Nb]))),contentFingerprint:Ob(W(Ub([K,Nb]))),kind:Ob(G(`file`)),filePath:Ob(K)}),q({comparison:Ob(W(Ub([SQ,Nb]))),revision:Ob(W(Ub([K,Nb]))),contentFingerprint:Ob(W(Ub([K,Nb]))),kind:Ob(G(`codeRange`)),filePath:Ob(K),startLine:Ob(Pb),endLine:Ob(Pb),side:Ob(W(Ub([G(`additions`),G(`deletions`),Nb])))})]),Ub([G(`reviewer`),G(`agent`)]);var CQ=J(K),wQ=q({path:K,headBlobOid:K}),TQ=q({layerId:K,fingerprint:K}),EQ=q({area:Wb([`baseline`,`file-marks`,`conversation`,`proof`]),reason:K,ids:CQ}),DQ=q({files:J(Ub([q({path:K,change:Wb([`entered`,`left`])}),q({path:K,change:Wb([`changed`,`unchanged`]),headChanged:Fb,baseChanged:Fb})])),decisions:q({affected:CQ,new:CQ,gone:CQ,resetMarks:J(TQ)}),fileMarks:q({carriedCount:dx,carried:J(wQ),reset:J(wQ)}),verdict:q({recommendation:q({from:mQ,to:mQ}),removed:q({added:J(gQ),dropped:J(gQ)}),deletedFiles:q({added:CQ,dropped:CQ}),notProven:q({added:J(hQ),dropped:J(hQ)})}),conversation:q({agentMessageCount:dx,agentThreadIds:CQ,agentMessages:J(q({threadId:K,messageId:K,body:K,createdAt:K})),resolvedThreadCount:dx,resolvedThreadIds:CQ}),proof:q({publishedChecks:J(vQ),changedResults:J(q({from:vQ,to:vQ}))}),unknown:J(EQ)}),OQ=JX,kQ=q({archived:Fb,plan:qX}),AQ=q({kind:G(`t3`),threadId:K}),jQ=q({id:K,reviewId:K,reviewRevision:dx,commentRevision:dx,state:Wb([`pending`,`delivered`,`acknowledged`]),attempted:Fb,error:W(K)}),MQ=q({session:W(AQ),delivery:W(jQ)}),NQ=K.check(rx()),PQ=K.pipe(Jb(u_())).check(fx(1)).check(mx(200)),FQ={layerId:W(NQ),stepId:W(NQ)},IQ=Wb([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/webm`]),LQ=q({name:PQ,result:Wb([`pass`,`fail`]),output:W(K.check(fx(1)).check(mx(dG))),...FQ}),RQ=hG.check(tx(e=>{let t=bb(bx)(e);return Nr(t)&&/^https?:$/.test(t.success.protocol)})).check(mx(fG)),zQ=e=>q({kind:G(e),title:PQ,path:W(rq),proofId:W(NQ),...FQ}).check(tx(e=>e.path===void 0!=(e.proofId===void 0),{expected:`Name either the path of a new file or the proofId of a published one`})),BQ=Ub([zQ(`image`),zQ(`video`),q({kind:G(`link`),title:PQ,url:RQ,...FQ})]),VQ=q({checks:W(J(LQ).check(mx(100))),assets:W(J(BQ).check(mx(20)))}),HQ=Ub([q({id:NQ,kind:Wb([`image`,`video`]),title:PQ,mediaType:IQ,byteLength:Pb.check(ux()).check(ox(0)),...FQ}),q({id:NQ,kind:G(`link`),title:PQ,url:RQ,...FQ})]),UQ=q({checks:J(LQ).check(mx(100)),assets:J(HQ).check(mx(20)),current:Fb}),WQ=q({proofId:NQ}),GQ=q({id:NQ,mediaType:IQ,base64:K}),KQ=/^\/review-summaries\/(?<token>[^?]*)\?expires=(?<expires>[^&]*)&signature=(?<signature>.*)$/,qQ=Pb.check(ux()).check(ox(0)),JQ=q({url:K.check(fx(1)),byteLength:qQ}),YQ=q({token:K,expires:K,signature:K,byteLength:qQ}),XQ=JQ.pipe(qb(YQ,l_({decode:e=>{let t=KQ.exec(e.url)?.groups;return{token:decodeURIComponent(t?.token??``),expires:decodeURIComponent(t?.expires??``),signature:decodeURIComponent(t?.signature??``),byteLength:e.byteLength}},encode:e=>({url:`/review-summaries/${encodeURIComponent(e.token)}?expires=${encodeURIComponent(e.expires)}&signature=${encodeURIComponent(e.signature)}`,byteLength:e.byteLength})}))),ZQ=K.check(rx()),QQ=Pb.check(ux()).check(sx(1)).check(cx(tG)),$Q=q({path:rq,startLine:QQ,endLine:QQ,symbol:W(K.pipe(Jb(u_())).check(fx(1)).check(mx(500)))}),e$=q({...$Q.fields,textFingerprint:$J}),t$=Ub([q({state:G(`changed`)}),q({state:G(`broken`)}),q({state:G(`current`),startLine:QQ,endLine:QQ}),q({state:G(`committed`),startLine:QQ,endLine:QQ})]),n$=q({id:ZQ,lane:Pb.check(ux()).check(sx(0)).check(cx(99)),title:K.pipe(Jb(u_())).check(fx(1)).check(mx(200)),text:K.pipe(Jb(u_())).check(fx(1)).check(mx(cG)),kind:Wb([`changed`,`context`]),pointer:$Q}),r$=q({published:W(J(K)),...n$.fields,pointer:e$,location:t$}),i$=q({id:ZQ,title:K.pipe(Jb(u_())).check(fx(1)).check(mx(200)),summary:K.pipe(Jb(u_())).check(fx(1)).check(mx(lG)),lanes:J(K.pipe(Jb(u_())).check(fx(1)).check(mx(100))).check(fx(1)).check(mx(100)),steps:J(n$).check(fx(1)).check(mx(500))}),a$=q({...i$.fields,steps:J(r$).check(fx(1)).check(mx(500)),fingerprint:$J,codeMoved:W(Fb)}),o$=q({from:ZQ,to:ZQ,label:W(K.pipe(Jb(u_())).check(fx(1)).check(mx(200)))}),s$=q({after:q({boxes:J(q({id:ZQ,label:K.pipe(Jb(u_())).check(fx(1)).check(mx(200)),detail:W(K.pipe(Jb(u_())).check(fx(1)).check(mx(lG))),change:W(Wb([`new`,`changed`,`removed`])),problem:W(K.pipe(Jb(u_())).check(fx(1)).check(mx(lG))),layerId:W(ZQ),decision:W(G(!0))})).check(mx(500)),arrows:J(o$).check(mx(uG))})}),c$=K.check(fx(1)).check(mx(XW)).check(tx(e=>e.isWellFormed(),{expected:`Expected valid Unicode text`})).check(tx(e=>GY(e)<=XW,{expected:`Summary exceeds 10 MiB`})),l$=q({path:rq,ranges:J(q({startLine:QQ,endLine:QQ})),deleted:W(Fb),binary:W(Fb)}),u$=K.check(rx()),d$=dx.check(ox(0)),f$=K.check(fx(1)).check(mx(lG)),p$=q({asked:q({text:f$,links:W(J(q({title:f$,url:K.check(nx(/^https?:\/\//))})))}),recommendation:Wb([`merge`,`hold`]),reasons:J(f$).check(fx(1)).check(mx(5)),notProven:J(q({what:f$,why:f$})),removed:J(q({behavior:f$,why:f$,paths:J(rq).check(fx(1))}))}),m$=Ub([q({kind:G(`available`).pipe(Zb(B(`available`))),web:K,app:K,revision:q({web:K,app:K}),decisions:J(q({layerId:ZQ,web:K,app:K}))}),q({kind:G(`unavailable`),reason:G(`no-reachable-route`)})]),h$=Wb([`http`,`https`]),g$=q({reviewId:u$,projectId:K,revision:d$,headOid:K,base:K,baseOid:K,mergeBaseOid:K,publishedAt:gG,branch:K,worktreePath:K,worktreeName:K}),_$=q({reviewId:W(u$),headOid:W(K),baseOid:W(K),base:W(K),mergeBaseOid:W(K),verdict:W(p$),links:W(m$),environmentId:K.check(rx()),worktreeId:vG,revision:Pb.check(ux()).check(ox(0)),publishedAt:gG,active:Fb,diagnostics:Wb([`current`,`unavailable`]),summary:XQ,diagram:W(s$),layers:J(a$).check(mx(100)),notExplained:J(l$).check(mx(QW)),proof:UQ}),v$=q({expectedRevision:Pb.check(ux()).check(sx(0)).check(cx(2**53-1-1)),summaryHtml:W(c$),verdict:p$,base:W(K.check(fx(1))),pullRequest:W(K.check(nx(/^https:\/\/github\.com\/[^/]+\/[^/]+\/pull\/[1-9][0-9]*\/?$/))),reviewId:W(u$),diagram:W(s$),layers:J(i$).check(fx(1)).check(mx(100)),proof:W(VQ)}),y$=q({review:yG(_$)}),b$=q({...y$.fields,reviewId:u$,revision:d$,headOid:K,baseOid:K,links:m$}),x$=q({projectId:K}),S$=q({revision:W(d$)}),C$=q({paths:aY.fields.paths}),w$=q({reviewId:u$}),T$=q({...w$.fields,revision:Cx.check(ux()).check(ox(0))}),E$=q({reviewId:u$,projectId:K,branch:K,pullRequest:W(K),state:Wb([`open`,`closed`]),archived:W(Fb),latestRevision:d$,lastSeenRevision:dx}),D$=q({review:yG(E$),revisions:J(g$),revision:yG(q({...g$.fields,files:J(q({path:rq,oldPath:W(rq),newPath:W(rq),oldOid:W(K),newOid:W(K),oldMode:K,newMode:K,status:Wb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})),verdict:p$,content:_$}))}),O$=J(E$),k$=q({revision:d$}),A$=q({state:G(`closed`)}),j$=q({deleted:Fb}),M$=q({updated:Fb}),N$=q({path:rq}),P$=Ub([q({kind:G(`text`),text:K,blobOid:K}),q({kind:G(`missing`)}),q({kind:Wb([`too-large`,`unsupported`]),blobOid:K})]),F$=q({path:rq,fingerprint:K,reviewedAt:gG,stale:Fb}),I$=q({layerId:ZQ,fingerprint:$J,reviewedAt:gG}),L$=q({files:J(F$),decisions:J(I$)}),R$=Ub([q({kind:G(`file`),revision:d$,path:rq,headBlobOid:K}),q({kind:G(`decision`),revision:d$,layerId:ZQ,fingerprint:$J})]),z$=Ub([q({kind:G(`file`),path:rq,headBlobOid:K}),q({kind:G(`decision`),layerId:ZQ,fingerprint:$J})]);Ub([q({worktreeId:vG,reviewId:W(u$)}),q({reviewId:u$,worktreeId:W(vG)})]);var B$=q({...MQ.fields,acknowledgementAccepted:W(Fb),currentCommentRevision:dx.check(sx(0))}),V$=q({reviewRevision:dx.check(ox(0))}),H$=q({...w$.fields,session:q({...AQ.fields,threadId:K.check(fx(1),mx(2048),nx(/^\S[^\0]*$/))})}),U$=q({...w$.fields,deliveryId:K.check(rx())}),W$=Cx.check(ux()).check(ox(0)),G$=q({from:W(W$),to:W(W$)}),K$=q({reviewId:K.check(rx()),from:yG(dx),to:dx,comparison:yG(DQ),unknown:J(EQ)}),q$=q({...G$.fields,path:rq}),J$=Ub([q({kind:G(`diff`),from:dx,to:dx,path:rq,...oY.fields}),q({kind:G(`unavailable`),reason:Wb([`no-baseline`,`path-not-reviewed`,`not-changed`])})]),Y$=Ub([q({kind:G(`available`),account:K,pullRequest:rQ}),q({kind:G(`not-linked`)}),KZ]),X$=Ub([q({kind:G(`available`),account:K,pullRequests:J(q({...tQ.fields,reviewId:W(K)})),truncated:Fb,recentlyClosedSince:K}),KZ]),Z$=q({account:yG(K.check(nx(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/)))});q({override:Db(Z$)});var Q$=q({pullRequest:yG(K.check(nx(/^https:\/\/github\.com\/[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+\/pull\/[1-9][0-9]*$/)))}),$$=Ub([q({kind:G(`updated`)}),KZ]),e1=Ub([q({kind:G(`available`),number:dx,checks:iQ}),q({kind:G(`not-linked`)}),KZ]),t1={comparison:W(Ub([q({kind:G(`worktree`),scope:Wb([`staged`,`unstaged`,`untracked`])}),q({kind:G(`file`)}),q({kind:G(`commit`),parent:Pb.check(ux()).check(sx(1)).check(cx(nG))}),q({kind:G(`branch`),base:QJ})])),revision:W(K.check(fx(1)).check(mx(256))),contentFingerprint:W(K.check(fx(1)).check(mx(256)))},n1=K.check(fx(1)).check(mx(sG)).check(tx(e=>e.trim().length>0&&!e.includes(`\0`))),r1=Wb([`reviewer`,`agent`]),i1=Ub([q({kind:G(`change`),filePath:W(jb),...t1}),q({kind:G(`file`),filePath:rq,...t1}),q({kind:G(`codeRange`),filePath:rq,startLine:Pb.check(ux()).check(sx(1)).check(cx(tG)),endLine:Pb.check(ux()).check(sx(1)).check(cx(tG)),side:W(Wb([`additions`,`deletions`])),...t1})]),a1=q({id:K.check(rx()),body:n1,author:r1,createdAt:W(gG),editedAt:W(gG)}),o1=q({review:W(q({reviewId:K.check(rx()),revision:dx.check(ox(0)),headOid:K})),id:K.check(rx()),worktreeId:vG,anchor:i1,resolved:Fb,messages:J(a1).check(fx(1)),revision:Pb.check(ux()).check(sx(0))}),s1=q({threadId:K.check(rx())}),c1=q({worktreeId:vG,...s1.fields}),l1=Wb([`waiting`,`all`]);q({reviewId:W(K.check(rx())),scope:W(l1)}),q({kind:Wb([`owner`,`device`,`agent`])});var u1=J(o1),d1=q({reviewRevision:W(dx.check(ox(0))),reviewId:W(K.check(rx())),threadId:W(K.check(rx())),messageId:W(K.check(rx())),anchor:i1,body:n1}),f1=o1,p1=q({reviewId:W(K.check(rx())),messageId:W(K.check(rx())),body:n1}),m1=o1,h1=q({reviewId:W(K.check(rx())),resolved:Fb}),g1=o1,_1=q({reviewId:W(K.check(rx())),messageId:K.check(rx()),body:n1}),v1=q({reviewId:W(K.check(rx())),messageId:K.check(rx())}),y1=o1,b1=q({threadId:K.check(rx()),thread:yG(o1)}),x1=q({reviewId:W(K.check(rx())),threads:J(q({threadId:K.check(rx()),revision:Pb.check(ux()).check(sx(0))})).check(fx(1)).check(mx(100))}),S1=q({deleted:J(K.check(rx())),skipped:J(K.check(rx()))}),C1=q({throughRevision:Pb.check(ux()).check(sx(0))}),w1=q({worktreeId:vG,seenThrough:Pb.check(ux()).check(sx(0))}),T1=q({path:rq,fingerprint:$J,reviewedAt:gG}),E1=Wb([`worktree`,`branch`]),D1={scope:G(`branch`),base:QJ},O1=q({scope:W(E1),branch:W(QJ)}),k1=q({worktreeId:vG,marks:J(T1).check(mx(iG))}),A1={path:rq,reviewed:G(!0),fingerprint:$J},j1=Ub([q({...A1,scope:W(G(`worktree`))}),q({...A1,...D1})]),M1=k1,N1={files:J(q({path:rq,fingerprint:$J})).check(fx(1)).check(mx($W))},P1=Ub([q({...N1,scope:W(G(`worktree`))}),q({...N1,...D1})]),F1=q({...k1.fields,marked:J(rq).check(mx($W)),conflicts:J(q({path:rq,reason:Wb([`stale`,`missing`])})).check(mx($W))}),I1=q({path:rq,scope:W(E1),branch:W(QJ)}),L1=k1,R1=q({paths:J(rq).check(fx(1)).check(mx($W)),scope:W(E1),branch:W(QJ)}),z1=k1,B1=q({worktreeId:vG,marks:J(q({layerId:K.check(rx()),fingerprint:$J,reviewedAt:gG,stale:Fb})).check(mx(100))}),V1=q({layerId:K.check(rx()),reviewed:G(!0),fingerprint:$J}),H1=B1,U1=q({layerId:K.check(rx())}),W1=B1,G1=class extends FK.add(kG(`reviews`).add(jA(`readReviewAgentFeedback`,`/api/reviews/:reviewId/agent-feedback`,{disableCodecs:!0,params:w$,success:B$,error:[$(UZ,`NotFound`),$(sQ,`Conflict`,{message:{fromError:!0}})]}),MA(`sendReviewAgentFeedback`,`/api/reviews/:reviewId/agent-feedback`,{disableCodecs:!0,params:w$,payload:V$,success:B$,error:[$(UZ,`NotFound`),$(sQ,`Conflict`,{message:{fromError:!0}})]}),FA(`disconnectReviewAgentSession`,`/api/reviews/:reviewId/agent-session`,{disableCodecs:!0,params:w$,success:B$,error:[$(UZ,`NotFound`),$(sQ,`Conflict`,{message:{fromError:!0}})]}),MA(`archiveReview`,`/api/reviews/:reviewId/archive`,{disableCodecs:!0,params:w$,payload:OQ,success:kQ,error:[$(UZ,`NotFound`),$(eJ,`NotFound`),$(aQ,`Conflict`,{message:{fromError:!0}})]}),jA(`compareReview`,`/api/reviews/:reviewId/compare`,{disableCodecs:!0,params:w$,query:G$.fields,success:K$,error:[$(UZ,`NotFound`),$(WZ,`BadRequest`,{message:{fromError:!0}})]}),jA(`readReviewInterdiff`,`/api/reviews/:reviewId/interdiff`,{disableCodecs:!0,params:w$,query:q$.fields,success:J$,error:[...rJ,...gJ,$(UZ,`NotFound`),$(WZ,`BadRequest`,{message:{fromError:!0}}),$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),NA(`setReviewPullRequest`,`/api/reviews/:reviewId/pull-request`,{disableCodecs:!0,params:w$,payload:Q$,success:$$,error:[$(UZ,`NotFound`),$(eJ,`NotFound`),$(oQ,`Conflict`,{message:{fromError:!0}})]}),jA(`readReviewPullChecks`,`/api/reviews/:reviewId/pull-request/checks`,{disableCodecs:!0,params:w$,success:e1,error:[$(UZ,`NotFound`),$(eJ,`NotFound`)]}),jA(`readReviewPullRequest`,`/api/reviews/:reviewId/pull-request`,{disableCodecs:!0,params:w$,success:Y$,error:[$(UZ,`NotFound`),$(eJ,`NotFound`)]}),jA(`listProjectPullRequests`,`/api/projects/:projectId/pull-requests`,{disableCodecs:!0,params:x$,success:X$,error:[$(eJ,`NotFound`)]}),jA(`readProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:x$,success:JZ,error:[$(eJ,`NotFound`)]}),NA(`setProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:x$,payload:Z$,success:JZ,error:[$(eJ,`NotFound`)]})).add(FA(`deleteReviewCommentMessage`,`/api/reviews/:reviewId/comments/:threadId/messages`,{disableCodecs:!0,params:q({...w$.fields,...s1.fields}),query:v1.fields,success:b1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(bZ,`Forbidden`)]}),MA(`deleteResolvedReviewComments`,`/api/reviews/:reviewId/comments/resolved/deletion`,{disableCodecs:!0,params:w$,payload:x1,success:S1,error:[...rJ,$(UZ,`NotFound`)]}),PA(`editReviewCommentMessage`,`/api/reviews/:reviewId/comments/:threadId/messages`,{disableCodecs:!0,params:q({...w$.fields,...s1.fields}),payload:_1,success:y1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(bZ,`Forbidden`),$(SZ,`Conflict`)]}),jA(`listReviewMarks`,`/api/reviews/:reviewId/marks`,{disableCodecs:!0,params:w$,success:L$,error:[$(UZ,`NotFound`)]}),NA(`setReviewMark`,`/api/reviews/:reviewId/marks`,{disableCodecs:!0,params:w$,payload:R$,success:M$,error:[$(UZ,`NotFound`),$(AZ,`Conflict`)]}),MA(`removeReviewMark`,`/api/reviews/:reviewId/marks/removal`,{disableCodecs:!0,params:w$,payload:z$,success:M$,error:[$(UZ,`NotFound`)]}),MA(`createReviewCommentThread`,`/api/reviews/:reviewId/comments`,{disableCodecs:!0,params:w$,payload:d1,success:f1,error:[...rJ,$(UZ,`NotFound`),$(xZ,`Conflict`),$(SZ,`Conflict`),$(qq,`BadRequest`,{message:`Invalid request`}),$(CZ,`BadRequest`,{message:`Invalid request`}),$(MZ,`BadRequest`,{message:`Invalid request`})]}),jA(`listReviewCommentThreads`,`/api/reviews/:reviewId/comments`,{disableCodecs:!0,params:w$,success:u1,error:[...rJ,$(UZ,`NotFound`)]}),MA(`replyToReviewComment`,`/api/reviews/:reviewId/comments/:threadId/replies`,{disableCodecs:!0,params:q({...w$.fields,...s1.fields}),payload:p1,success:m1,error:[...rJ,$(UZ,`NotFound`),$(xZ,`Conflict`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(SZ,`Conflict`)]}),NA(`updateReviewCommentThread`,`/api/reviews/:reviewId/comments/:threadId`,{disableCodecs:!0,params:q({...w$.fields,...s1.fields}),payload:h1,success:g1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`})]}),jA(`readReview`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:w$,success:D$,error:[NK,...rJ,$(UZ,`NotFound`)]}),jA(`readReviewRevision`,`/api/reviews/:reviewId/revisions/:revision`,{disableCodecs:!0,params:T$,success:D$,error:[NK,...rJ,$(UZ,`NotFound`)]}),jA(`listProjectReviews`,`/api/projects/:projectId/reviews`,{disableCodecs:!0,params:x$,success:O$}),NA(`setReviewSeen`,`/api/reviews/:reviewId/seen`,{disableCodecs:!0,params:w$,payload:k$,success:M$,error:[$(UZ,`NotFound`)]}),PA(`setReviewState`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:w$,payload:A$,success:M$,error:[$(UZ,`NotFound`)]}),FA(`deleteProjectReview`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:w$,success:j$,error:[...rJ,$(UZ,`NotFound`)]}),jA(`readReviewProofFile`,`/api/reviews/:reviewId/revisions/:revision/proof`,{disableCodecs:!0,params:T$,query:WQ.fields,success:GQ,error:[...rJ,$(FZ,`NotFound`)]}),jA(`readReviewFile`,`/api/reviews/:reviewId/revisions/:revision/file`,{disableCodecs:!0,params:T$,query:N$.fields,success:P$,error:[$(UZ,`NotFound`)]}),MA(`readReviewDiffs`,`/api/reviews/:reviewId/revisions/:revision/diffs`,{disableCodecs:!0,params:T$,payload:C$,success:oY,error:[...rJ,...gJ,$(UZ,`NotFound`),$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),MA(`createCommentThread`,`/api/worktrees/:worktreeId/comments`,{disableCodecs:!0,params:bG,payload:d1,success:f1,error:[...rJ,$(UZ,`NotFound`),$(xZ,`Conflict`),$(SZ,`Conflict`),$(qq,`BadRequest`,{message:`Invalid request`}),$(CZ,`BadRequest`,{message:`Invalid request`}),$(MZ,`BadRequest`,{message:`Invalid request`})]}),FA(`deleteCommentMessage`,`/api/worktrees/:worktreeId/comments/:threadId/messages`,{disableCodecs:!0,params:c1,query:v1.fields,success:b1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(bZ,`Forbidden`)]}),MA(`deleteResolvedComments`,`/api/worktrees/:worktreeId/comments/resolved/deletion`,{disableCodecs:!0,params:bG,payload:x1,success:S1,error:[...rJ,$(UZ,`NotFound`)]}),PA(`editCommentMessage`,`/api/worktrees/:worktreeId/comments/:threadId/messages`,{disableCodecs:!0,params:c1,payload:_1,success:y1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(bZ,`Forbidden`),$(SZ,`Conflict`)]}),jA(`listCommentThreads`,`/api/worktrees/:worktreeId/comments`,{disableCodecs:!0,params:bG,success:u1,error:[...rJ,$(UZ,`NotFound`)]}),jA(`listReviewedFiles`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:bG,query:O1.fields,success:k1,error:[...rJ,$(UZ,`NotFound`)]}),jA(`listReviewedLayers`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:bG,success:B1,error:[...rJ,$(UZ,`NotFound`)]}),MA(`markCommentsSeen`,`/api/worktrees/:worktreeId/comments/seen`,{disableCodecs:!0,params:bG,payload:C1,success:w1,error:[...rJ,$(UZ,`NotFound`)]}),FA(`deleteReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:bG,success:j$,error:[...rJ,$(UZ,`NotFound`)]}),NA(`publishReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:bG,payload:v$,success:b$,error:[NK,...rJ,...gJ,$(TZ,`BadRequest`,{message:`Invalid request`}),$(EZ,`BadRequest`,{message:`Invalid request`}),$(qq,`BadRequest`,{message:`Invalid request`}),$(jZ,`BadRequest`,{message:`Invalid request`}),$(PZ,`BadRequest`,{message:`Invalid request`}),$(yZ,`BadRequest`,{message:`Invalid request`}),$(NZ,`BadRequest`,{message:`Invalid request`}),$(RZ,`BadRequest`),$(VZ,`BadRequest`,{message:{fromError:!0}}),$(DZ,`Conflict`),$(HZ,`Conflict`,{message:{fromError:!0}}),$(KJ,`NotFound`),$(LZ,`PayloadTooLarge`),$(BZ,`BadRequest`),$(zZ,`UnprocessableEntity`),$(IZ,`UnprocessableEntity`),$(qJ,`UnprocessableEntity`)]}),jA(`readProofFile`,`/api/worktrees/:worktreeId/review/proof`,{disableCodecs:!0,params:bG,query:WQ.fields,success:GQ,error:[...rJ,$(FZ,`NotFound`)]}),jA(`readPublishedReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:bG,success:y$,error:[NK,...rJ,...gJ,$(qJ,`UnprocessableEntity`)]}),FA(`removeReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:bG,query:I1.fields,success:L1,error:rJ}),FA(`removeReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:bG,payload:R1,success:z1,error:rJ}),FA(`removeReviewedLayer`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:bG,query:U1.fields,success:W1,error:[...rJ,$(UZ,`NotFound`)]}),MA(`replyToComment`,`/api/worktrees/:worktreeId/comments/:threadId/replies`,{disableCodecs:!0,params:c1,payload:p1,success:m1,error:[...rJ,$(UZ,`NotFound`),$(xZ,`Conflict`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(SZ,`Conflict`)]}),NA(`setReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:bG,payload:j1,success:M1,error:[...rJ,...gJ,$(AZ,`Conflict`),$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),NA(`setReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:bG,payload:P1,success:F1,error:[...rJ,...gJ,$(AZ,`Conflict`),$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),NA(`setReviewedLayer`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:bG,payload:V1,success:H1,error:[...rJ,$(OZ,`NotFound`),$(AZ,`Conflict`)]}),NA(`updateCommentThread`,`/api/worktrees/:worktreeId/comments/:threadId/resolution`,{disableCodecs:!0,params:c1,payload:h1,success:g1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`})]})).middleware(rK)){},K1=q({token:K.check(rx())}),q1=q({expires:gG,signature:K.check(nx(/^[A-Za-z0-9_-]{43}$/))}),J1=K,Y1=class extends FK.add(kG(`reviewSummary`).add(jA(`readReviewSummary`,`/review-summaries/:token`,{disableCodecs:!0,params:K1,query:q1.fields,success:J1.pipe(Gk({contentType:`text/html; charset=utf-8`})),error:kZ.pipe(Nk({decode:()=>new kZ}),jk(`NotFound`))}))){},X1=class extends FK.addHttpApi(Kq).addHttpApi(vZ).addHttpApi(aX).addHttpApi(WY).addHttpApi(G1).addHttpApi(Y1).addHttpApi(GX){},Z1=q({address:K,credential:Hie(K),deviceId:W(K)}),Q1=q({...Z1.fields,environmentId:K,name:K,alternateRoutes:W(J(Z1)),operationIdentity:W(K)});function $1({address:e,credential:t,deviceId:n}){return{address:e,credential:t,...n?{deviceId:n}:{}}}function e0(e){return[$1(e),...(e.alternateRoutes??[]).map($1)]}function t0(e){return e.operationIdentity??(e.deviceId?JSON.stringify([e.environmentId,e.address,e.deviceId]):void 0)}function n0(e,t){let[n,...r]=t;if(!n)throw Error(`A saved environment needs at least one connection.`);return{environmentId:e.environmentId,name:e.name,...$1(n),...t0(e)?{operationIdentity:t0(e)}:{},...r.length?{alternateRoutes:r.map($1)}:{}}}function r0(e){let t=URL.parse(e)?.hostname??``;return t.endsWith(`.ts.net`)?`Tailscale`:/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(t)?`LAN`:`Network`}function i0(e){return JSON.stringify(wb(J(Q1))(e))}function a0(e,t){if(t===void 0)return{kind:`checking`};if(t.kind===`reconnecting`)return{kind:`reconnecting`};if(t.kind===`foreign`)return{kind:`other-server`};if(t.kind===`unauthorized`)return{kind:`needs-pairing`};if(t.kind===`unreachable`)return{kind:`offline`};let{environment:n}=t;return n.environmentId===e.environmentId?n.protocol===3?{kind:`online`,name:n.name,version:n.version}:{kind:`incompatible`}:{kind:`other-server`}}function o0(e,t){let n=Reflect.get(e,t);return typeof n==`string`?n:void 0}function s0(e){if(!e||typeof e!=`object`)return;let t=o0(e,`address`),n=o0(e,`credential`),r=o0(e,`deviceId`);return t&&n?{address:t,credential:mh(n),...r?{deviceId:r}:{}}:void 0}function c0(e){if(!e||typeof e!=`object`)return[];let t=o0(e,`environmentId`),n=o0(e,`name`),r=s0(e),i=Reflect.get(e,`alternateRoutes`);return t&&n!==void 0&&r?[{environmentId:t,name:n,...r,...o0(e,`operationIdentity`)?{operationIdentity:o0(e,`operationIdentity`)}:{},...Array.isArray(i)?{alternateRoutes:i.flatMap(e=>{let t=s0(e);return t?[t]:[]})}:{}}]:[]}function l0(e){return Array.isArray(e)?e.flatMap(c0):[]}function u0(e,t){let n=e.find(e=>e.environmentId===t.environmentId);if(!n)return[...e,t];let r=e0(t),i=e0(n).map(e=>r.find(t=>t.address===e.address)??e);return i.push(...r.filter(e=>!i.some(t=>t.address===e.address))),[...e.filter(e=>e.environmentId!==t.environmentId),n0({...n,name:t.name},i)]}var d0=_h((e,t)=>e===t);function f0(e,t){return e.environmentId===t.environmentId&&e.address===t.address&&d0(e.credential,t.credential)&&e.deviceId===t.deviceId&&(e.alternateRoutes??[]).length===(t.alternateRoutes??[]).length&&(e.alternateRoutes??[]).every((e,n)=>{let r=t.alternateRoutes?.[n];return r!==void 0&&e.address===r.address&&e.deviceId===r.deviceId&&d0(e.credential,r.credential)})}function p0(e){switch(e.kind){case`checking`:return`Checking`;case`reconnecting`:return`Reconnecting`;case`online`:return`Online`;case`offline`:return`Offline`;case`needs-pairing`:return`Needs pairing`;case`other-server`:return`Another server`;case`incompatible`:return`Update needed`}}function m0(e){switch(e.kind){case`offline`:return`It did not answer. Check that it runs and that this device reaches its address.`;case`needs-pairing`:return`It no longer accepts this app. Run porcelain pair on it and add the new link.`;case`other-server`:return`Another Porcelain answers at this address now, so this app stays away from it.`;case`incompatible`:return`It runs a Porcelain this app cannot talk to. Update both to the same version.`;default:return}}var h0=class e extends tr()(`@porcelain/client/AccessStore`){static layer=Uu(e,H(function*(){let e=yield*VW,t=yield*qW({initial:{remotes:[],missingCredentials:[]},read:e.read,write:e.write,messages:{beforeRead:`Saved environments must be read before changing them.`,readFailed:`Saved environments could not be read. Try reading them again.`,writeFailed:`The saved environments could not be updated. Read them again before making changes.`}});return{state:t.state,load:t.load,save:Gp(`AccessStore.save`)(e=>t.write(t=>{let n=t.missingCredentials.find(t=>t.environmentId===e.environmentId),r=e0(e),i=n?.operationIdentity?{...e,operationIdentity:n.operationIdentity}:e;return B({remotes:u0(t.remotes,i),missingCredentials:t.missingCredentials.flatMap(t=>{if(t.environmentId!==e.environmentId)return[t];let n=t.routes.filter(e=>!r.some(t=>t.address===e.address));return n.length?[{...t,routes:n}]:[]})})})),route:Gp(`AccessStore.route`)(e=>t.write(({remotes:t,missingCredentials:n})=>H(function*(){let r=t.find(t=>t.environmentId===e.environmentId);if(!r)return yield*U(new KW({message:`That environment is no longer saved.`}));let i=e0(r),a=i.find(t=>t.address===e.address);if(!a)return yield*U(new KW({message:`That connection is no longer saved.`}));let o=i.filter(t=>t.address!==e.address);if(e.kind===`remove`&&!o.length)return yield*U(new KW({message:`Forget the environment to remove its last connection.`}));let s=n0(r,e.kind===`prefer`?[a,...o]:o);return{missingCredentials:n,remotes:t.map(t=>t.environmentId===e.environmentId?s:t)}}))),forget:Gp(`AccessStore.forget`)(e=>t.write(t=>B({remotes:t.remotes.filter(t=>t.environmentId!==e),missingCredentials:t.missingCredentials.filter(t=>t.environmentId!==e)})))}}))},g0=class extends tr()(`@porcelain/client/ConnectionFactory`){},_0=class extends tr()(`@porcelain/client/RemoteConnectionFactory`){},v0=class e extends tr()(`@porcelain/client/AccessSession`){static layer=Uu(e,H(function*(){let e=yield*g0,t=yield*yu,n,r=Aj({connection:null,generation:0,writerIdentity:void 0});return{state:r,beginConnection:Gp(`AccessSession.beginConnection`)((i=!1)=>V(()=>{if(i&&r.value.generation!==0)return null;let a=r.value.generation;return Gp(`AccessSession.completeConnection`)(function*(i){if(a!==r.value.generation)return!1;let o=JSON.stringify(i.principal),s=r.value.connection?.environmentId===i.inventory.environmentId&&r.value.writerIdentity===o,c=n,l=r.value.connection;if(s||(c=yield*wu(t,`sequential`),l=yield*e.local(i).pipe(hp(yu,c))),a!==r.value.generation)return!s&&c&&(yield*Eu(c,su)),!1;let u=n;return n=c,r.update(e=>({...e,connection:l,writerIdentity:o,generation:a+1})),u&&u!==n&&(yield*Eu(u,su)),!0},Op)})),clear:Gp(`AccessSession.clear`)(function*(){let e=n;n=void 0,r.update(e=>({...e,connection:null,writerIdentity:void 0,generation:e.generation+1})),e&&(yield*Eu(e,su))},Op)}}))},y0=class e extends tr()(`@porcelain/client/RemoteConnections`){static layer=Uu(e,H(function*(){let e=yield*_0,t=yield*yu,n=yield*OC(1),r=[],i=Aj([]);return{state:i,synchronize:Gp(`RemoteConnections.synchronize`)(a=>H(function*(){let n=yield*wf(a,n=>H(function*(){let i=r.find(e=>f0(e.remote,n));if(i)return{...i,remote:n};let a=yield*wu(t,`sequential`);return{remote:n,connection:yield*e.open(n).pipe(hp(yu,a)),scope:a}})),o=r.filter(e=>!n.some(t=>t.scope===e.scope));r=n,i.set(n.map(({remote:e,connection:t})=>({remote:e,connection:t}))),yield*wf(o,e=>Eu(e.scope,su),{discard:!0})}).pipe(kC(n),Op))}}))},b0=Ku(H(function*(){let e=yield*h0,t=yield*y0;yield*t.synchronize(e.state.value.remotes),yield*Qw(Gp(`RemoteConnections.subscribe`)(function*(t){yield*vp(V(()=>e.state.subscribe(({remotes:e})=>{ZS(t,e)})),e=>V(e))})).pipe(pT(t.synchronize),Fp({startImmediately:!0}))}));function x0(e,t,n){return(r,i)=>{let a=new URL(r,e),o=new Headers(i?.headers);return t&&a.pathname!==`/api/health`&&o.set(`authorization`,`Bearer ${gh(t)}`),n(a,{...i,headers:o,mode:`cors`,credentials:`omit`,redirect:`error`,cache:`no-store`})}}var S0=class extends Y()(`RequestError`,{status:Pb,message:K,code:mG.fields.code}){};function C0(e){return Uu(jO,Kf(jO,e=>e.pipe(IO(gO(`http://porcelain.invalid`)),MO(hp(zO,!1))))).pipe(Zu($u(AK).pipe(Zu(Yu(Ru(OK,(t,n)=>t instanceof URL?e(`${t.pathname}${t.search}`,n):Promise.reject(TypeError(`FetchHttpClient sends every request as a parsed URL.`))),Ru(kK,{redirect:`error`,cache:`no-store`}))))))}function w0(e){let t=e.response;return t===void 0?B(new KW({message:`Could not reach Porcelain. Try again.`,cause:e.reason._tag===`TransportError`?e.reason.cause:e})):Kf(mne(t.json,()=>void 0),e=>{let n=bb(mG)(e);return new S0({status:t.status,message:Nr(n)?n.success.message:`Request failed (${t.status})`,code:void 0})})}function T0(e){return Xf(e,e=>VD(e)?Bf(w0(e),U):U(e))}function E0(e,t){return t(T0(e))}var D0=class extends tr()(`@porcelain/client/PairingPlatform`){},O0=Mb,k0=Nb,A0=class extends FK.add(kG(`live`).add(jA(`liveUpdates`,`/api/live`,{disableCodecs:!0,query:sq.fields,success:cq.pipe(Nk({decode:()=>void 0}),jk(`SwitchingProtocols`))})).middleware(rK)){};FK.add(kG(`reviewMcp`).add(MA(`reviewMcp`,`/mcp`,{disableCodecs:!0,payload:O0,success:[O0,k0.pipe(Nk({decode:()=>void 0}),jk(`Accepted`))]})).middleware(rK));function j0(e){let t;try{t=new URL(e.trim())}catch{return}return t.protocol===`http:`||t.protocol===`https:`?t.origin:void 0}function M0(e){let t;try{t=new URL(e.trim())}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`)return;let n=N0(t.hash);if(!n)return;if(t.pathname===`/pair`)return{address:t.origin,...n};if(!NG(t.pathname))return;let[r=``]=(new URLSearchParams(t.hash.replace(/^#/,``)).get(`a`)??``).split(`,`),i=j0(r);return i===void 0?void 0:{address:i,...n}}function N0(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`c`),r=t.get(`e`);return n&&r?{code:n,environmentId:r}:null}var xce=3e3,Sce=8e3,Cce=1e4,P0=1e4,wce=1e4,Tce=1e3,Ece=1e3,Dce=1e3,Oce=3e4,F0=2500,kce=5e3,I0=6e4,Ace=18e5,jce=6e4,L0=X(e=>Aj(void 0)),Mce=X(e=>OE()),Nce=ej(X1),R0=class e extends tr()(`@porcelain/client/BootstrapClient`){static layer=X(t=>Zu(Uu(e,Nce),C0(t)))},Pce=X(e=>kE(R0.layer(e)));function Fce(e,t){return eS(t)?{kind:`offline`}:a0(e,Un(sS(t)))}function z0(e,t){return H(function*(){let e=yield*R0,n=yield*T0(e.publicAccess.readEnvironment()).pipe(Zf(`ConnectionError`,t=>T0(e.session.readSession()).pipe(Hf(U(t)))));return n.environmentId===t&&n.protocol===3&&(yield*T0(e.session.readSession())),{kind:`described`,environment:n}}).pipe(fp(R0.layer(e)),Xf(e=>B(e instanceof S0&&e.status===401?{kind:`unauthorized`}:{kind:`unreachable`})),ip(kce),Kf(e=>Vn(e,()=>({kind:`unreachable`}))))}function B0(e,t){L0(e.send).set({remote:t,revision:Symbol()})}var V0=Gp(`Environments.readVerifiedRoute`)(function*(e,t,n){let r=x0(e.address,e.credential,n);return yield*H(function*(){return(yield*T0((yield*R0).publicAccess.readHealth())).environmentId===t?yield*z0(r,t):{kind:`foreign`}}).pipe(fp(R0.layer(r)),Xf(()=>B({kind:`unreachable`})))}),Ice=Gp(`Environments.readRoutes`)(function*(e,t){let n={kind:`unreachable`};for(let r of e0(t)){let i=yield*V0(r,t.environmentId,e.send).pipe(ip(F0),Kf(e=>Vn(e,()=>({kind:`unreachable`}))));if(a0(t,i).kind===`online`)return i;i.kind!==`unreachable`&&(n=i)}return n}),Lce=X(({platform:e,remote:t})=>{let{send:n,statusActivity:r}=e;return Mce(e)(Bu).atom(()=>{let i=!1,a=!1,o=!1,s,c=Qw(e=>H(function*(){let s=t=>{t&&(o=t===`suspend`);let n=!o&&(r?.isActive()??!0),s=n&&!a;a=n,(!n||s||!i)&&ZS(e,n)};yield*vp(V(()=>{let e=r?.subscribe(s),i=L0(n).subscribe(()=>{let e=L0(n).value;e&&f0(e.remote,t)&&s()});return()=>{e?.(),i?.()}}),e=>V(e)),s()}),{bufferSize:1,strategy:`sliding`}),l=H(function*(){i=!0;let n=yield*Ice(e,t);return s=n,n}).pipe(xp(V(()=>{i=!1})));return c.pipe(Uae(e=>e?tT(()=>s?.kind===`unreachable`?sT(Fae({kind:`reconnecting`}),Yw(l)):Yw(l)).pipe(oT(pf(Oce))):Hae))}).pipe(uE(0))});function Rce(e,t){return Lce({platform:e,remote:t})}var zce=X(({platform:e,remote:t,connection:n})=>_E(r=>{let i=n?.liveUpdates.state;i&&r.addFinalizer(i.subscribe(()=>r.refreshSelf()));let a=Fce(t,r(Rce(e,t)));return i?.value===`connected`?a.kind===`online`?a:{kind:`online`,name:t.name}:i?.value===`unauthorized`?{kind:`needs-pairing`}:a.kind===`other-server`||a.kind===`incompatible`?a:i?.value===`reconnecting`?{kind:`reconnecting`}:i?.value===`connecting`?a.kind===`offline`?a:{kind:`checking`}:a}));function H0(e,t,n){return zce({platform:e,remote:t,connection:n})}function U0(e){return e instanceof S0?!0:e instanceof KW?!1:e._tag===`InvalidPairingError`||e._tag===`InvalidDeviceDetailsError`}function Bce(e,t,n){return H(function*(){let r=M0(t);if(!r)return yield*U(new KW({message:`Paste the whole link porcelain pair printed, starting with http.`}));if(n&&r.environmentId!==n)return yield*U(new KW({message:`That pairing link belongs to another computer. Add it as a separate environment.`}));let i=x0(r.address,void 0,e.send);if((yield*T0(H(function*(){return yield*(yield*R0).publicAccess.readHealth()}).pipe(fp(R0.layer(i))))).environmentId!==r.environmentId)return yield*U(new KW({message:`Another Porcelain answered at that address than the one that made the link.`}));let a=yield*T0(H(function*(){return yield*(yield*R0).pairing.redeemPairing({payload:{code:r.code,platform:e.name()}})}).pipe(fp(R0.layer(i)))).pipe($f(e=>U0(e)?new KW({message:`That link was not accepted. It works once, for a few minutes; run porcelain pair again.`}):e instanceof KW?new KW({message:`Could not reach ${r.address}. Check that Porcelain runs there and that this device reaches it.`,cause:e.cause}):e));if(!a.credential)return yield*U(new KW({message:`The remote paired but sent no credential.`}));let o=mh(a.credential),s=a0(r,yield*z0(x0(r.address,o,e.send),r.environmentId));return s.kind===`online`?{environmentId:r.environmentId,address:r.address,name:s.name,credential:o,deviceId:a.device.id}:yield*U(new KW({message:s.kind===`other-server`?`Another Porcelain answered at that address than the one that made the link.`:s.kind===`incompatible`?`That Porcelain runs a version this app cannot talk to. Update both to the same version.`:`The remote paired but did not answer afterwards. Try again.`}))})}var Vce=Gp(`Environments.pairAndSave`)(function*(e,t){let n=yield*h0,r=yield*HW;if(n.state.value.status!==`ready`)return yield*U(new KW({message:`Read saved environments before pairing.`}));let i=n.state.value.missingCredentials.find(t=>t.environmentId===M0(e)?.environmentId);if(i&&!i.routes.some(t=>t.address===M0(e)?.address))return yield*U(new KW({message:`Use a pairing link for the connection whose credential is missing.`}));let a=yield*Bce(r,e,t);return yield*n.save(a),a}),Hce=Gp(`BrowserSession.pair`)(function*(e){let t=yield*D0,n=yield*R0;if((yield*T0(n.publicAccess.readHealth()).pipe($f(e=>!(e instanceof KW)&&!(e instanceof S0)&&e._tag!==`MissingEnvironmentIdentityError`?new KW({message:`That address answered, but it is not a Porcelain server.`}):new KW({message:`Could not reach Porcelain. Check that the server is running, then open the link again.`,cause:e})))).environmentId!==e.environmentId)return yield*U(new KW({message:`This link was made for a different Porcelain installation.`}));let r=yield*T0(n.pairing.redeemPairing({payload:{code:e.code,platform:t.name()}})).pipe($f(e=>U0(e)?new KW({message:`This pairing link is not usable. Ask for a new one.`}):e));return{inventory:yield*T0(n.projects.readInventory()).pipe($f(e=>e instanceof S0?new KW({message:`Pairing succeeded but the workspace could not be loaded. Reload the page.`}):e)),principal:{kind:`device`,deviceId:r.device.id}}}),Uce=X(({transport:e,platform:t})=>kE(Yu(R0.layer(e),Ru(D0,t))).fn(e=>Hce(e))),W0=X(e=>{class t extends tr()(`@porcelain/client/HttpClient`){static runtime=e.atoms(Uu(t,Kf(ej(X1),t=>({request:(n,r)=>E0(n(t),t=>e.request(t,r))}))).pipe(Zu(C0(e.transport))))}return t}),G0=Gp(`Client.requestApi`)(function*(e,t){return yield*(yield*W0(e)).request(t)}),K0=X(e=>e.atoms(t=>Yu(t(W0(e).runtime.layer),Gu(e.runtime.contextEffect)))),q0=class e extends tr()(`@porcelain/client/AccessSnapshots`){static layer=Uu(e,H(function*(){return{sharing:yield*PD(In()),remote:yield*PD(In()),update:yield*PD(In())}}))},J0=X(e=>e.atoms(t=>Qu(q0.layer,t(K0(e).layer))));function Wce(){return new KW({message:`The connected context changed. Reopen Porcelain to continue safely.`})}function Y0(e,t=!0){return kf(()=>e.isClosed()?Tp:X0(t))}function X0(e=!0){return e?Af:U(Wce())}function Gce(e){return e instanceof Jq}var Z0=[`lan`,`tailnet`,`cloudflare`],Q0={lan:`Local network`,tailnet:`Tailscale`,cloudflare:`Cloudflare tunnel`},Kce={lan:`Devices on this network.`,tailnet:`Encrypted access through your Tailscale network.`,cloudflare:`HTTPS through your existing tunnel.`},$0={loopback:`This computer`,lan:`Local network`,tailnet:`Tailscale`,tunnel:`Cloudflare tunnel`};function qce(e){return`This device is connected through ${Q0[e]}, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}var Jce=`Anyone on the same network can read what Porcelain shows and the device credentials it sends. For an encrypted connection, use Tailscale.`,Yce=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/,Xce=/^::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}$/;function Zce(e,t){let n=new URL(e).hostname.replace(/^\[|\]$/g,``).replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n===`::1`||t.includes(n)||Yce.test(n)||Xce.test(n)}function Qce(e){return e.route!==`loopback`||e.canEditWaysIn}function $ce(e,t=[]){return Zce(e,t)?`Use the computer running Porcelain to manage ways in, or pair over the local network or an existing encrypted route.`:`Turn on Manage sharing for this device in Computers → Devices, from a computer with sharing access.`}function e2(e){return`${e.subnet} on ${e.interfaceName}`}function t2(e){let{lan:t}=e.routes,n=e.localNetwork,r=e.lanNetwork,i=`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known.`;return t.enabled?t.status.kind===`paused`?n?n.gatewayHardware?r?e2(r)===e2(n)?`Paused on this network. It looks like ${e2(r)}, but its router is another one, so this is another network; turn it on for this network to listen here.`:`Paused on this network. It was turned on for ${e2(r)}, and listens again there, or here once you turn it on for this network.`:`Paused on this network. It was turned on before Porcelain kept the network it was turned on for; turn it on for this network to listen here.`:`Paused. ${i}`:r?`Paused: this computer is not on a local network. Porcelain listens again when it is back on ${e2(r)}.`:`Paused: this computer is not on a local network.`:r?`Listening on ${e2(r)} only.`:`Listening on this network only.`:n?n.gatewayHardware?`Turning it on listens on ${e2(n)} only, and pauses on any other network.`:`${i} Try again in a moment.`:`This computer is not on a local network right now.`}function ele(e){return e?Z0.some(t=>{let n=e.routes[t];return n.enabled?n.status.kind===`starting`||n.status.kind===`off`:n.status.kind!==`off`}):!1}function tle(e){return e===void 0?[]:Z0.flatMap(t=>{let{status:n}=e.routes[t];return n.kind===`on`?n.urls.map(e=>({route:t,url:e})):[]})}function nle(e){let[t]=e.grants;return t?{id:t.grant.id,label:t.grant.label,address:t.link.addresses[0],link:PG(t.link),expiresAt:t.grant.expiresAt}:null}function rle(e){return`tailscale serve --bg --https=443 ${e}`}var ile={lan:`Starting`,tailnet:`Checking the Tailscale name`,cloudflare:`Checking the tunnel`};function ale(e,t){switch(t.status.kind){case`off`:return t.enabled?`Starting`:null;case`starting`:return ile[e];case`paused`:return`Paused on this network`;case`failed`:return`Failed`;case`on`:return t.enabled?`On`:`Stopping`}}var ole={tailnet:{label:`Tailscale name`,saveLabel:`Save name`,placeholder:`laptop.tail1234.ts.net`},cloudflare:{label:`Public hostname`,saveLabel:`Save hostname`,placeholder:`porcelain.example.com`}};function n2(e,t){return(t===`tailnet`?e.tailnetHostname:e.cloudflareHostname)??``}function sle(e,t){let{enabled:n,status:r}=e.routes[t];return n&&r.kind===`failed`}function cle(e,t,n){let r=n2(e,t)===``;return t===`tailnet`?{tailnetHostname:n,...r?{tailnet:!0}:{}}:{cloudflareHostname:n,...r?{cloudflare:!0}:{}}}function lle(e,t,n){let r=n2(e,t),i=n??r,a=i.trim();return{...ole[t],value:i,canSave:a!==``&&a!==r,save:cle(e,t,a),failed:sle(e,t),check:t===`tailnet`?{tailnet:!0}:{cloudflare:!0}}}function ule(e,t){let n=`Your devices may reach that program instead of Porcelain: run tailscale serve --https=443 off now, then turn Tailscale off and on here to pick a free port and run the new command Porcelain names.`;switch(t){case`address-in-use`:return e===`tailnet`?`Another program already listens on the port Tailscale forwards to. ${n}`:`Another program already listens on this port.`;case`address-unavailable`:return e===`tailnet`?`Porcelain could not open the local listener Tailscale forwards to. ${n}`:`This computer could not listen at its address.`;case`unreachable`:return e===`tailnet`?`Nothing answered at this Tailscale name yet. Check that you ran the command below, that Tailscale is connected on this computer and uses MagicDNS, and that MagicDNS and HTTPS Certificates are on in the Tailscale admin console. Porcelain keeps checking.`:`Nothing answered at this hostname. Check that cloudflared is running and routes it here.`;case`other-server`:return e===`tailnet`?`Another server answered at this Tailscale name. Run the command below so Tailscale forwards to this Porcelain; Porcelain keeps checking.`:`Another server answered at this hostname.`}}function r2(e){return Qx(e)?e.value:void 0}function dle(e,t,n){return H(function*(){let r=yield*Gf(n.pipe(Uf(()=>Y0(e))));if(lu(r)&&Wl(r.cause))return yield*Tp;if(cu(r))yield*ID(t,Ln(r.value));else{let e=Un(Ul(r.cause));e instanceof S0&&e.status===401&&(yield*ID(t,In()))}return qx(r,qn(yield*FD(t),$x))})}function i2(e,t,n,r){let i=e.atom(e=>{let i=Jn(e.self(),sS);return rT(Kf(r,e=>sT(eT(Jx(i)),Yw(t).pipe(oT(pf(n)),Xae(t=>!e(Un(sS(t))))))))}).pipe(qE(e=>dS(e,e=>e)));return $E(i).pipe(GE((e,t)=>{let n=e(t);return e(i).waiting?Jx(Ln(n)):n}),uE(0))}function a2(e,t,n){return Bf(q0,r=>dle(e,t(r),n))}function o2(e){return e.pipe(Xf(e=>e instanceof S0&&e.status===403||I(e,`WaysInPermissionRequiredError`)||I(e,`SharingManagementRequiredError`)?B(null):U(e)))}var s2=X(e=>i2(J0(e),a2(e,e=>e.sharing,o2(G0(e,e=>e.administration.listAccess()))),Dce,B(()=>!0))),c2=X(e=>i2(J0(e),a2(e,e=>e.remote,o2(G0(e,e=>e.remoteAccess.readRemoteAccess()))),Tce,B(ele))),l2=X(e=>i2(J0(e),a2(e,e=>e.update,G0(e,e=>e.serviceUpdates.readServiceUpdate())),Ece,H(function*(){let e=Un(yield*FD((yield*q0).update)),t=e?.running?e.last?.target:void 0;return e=>e?.managed===!0?e.running?(t=e.last?.target,!0):t!==void 0&&e.last?.stage===`updated`&&e.last.target===t&&e.version===e.last.from&&e.version!==t:!1})));function fle(e){return H(function*(){let t=yield*W0(e),n=yield*GW,r=yield*q0,i=yield*VT;function a(t,r){return n.run([t],H(function*(){yield*Y0(e);let t=yield*r;return yield*Y0(e),t}))}function o(t){return V(()=>{e.isClosed()||i.refresh(t)})}function s(e,t,n){return yp(V(()=>{let t=i.mount(e),n=bE($x(i.get(e),{waiting:!0}));return i.set(e,n),{transition:n,unmount:t}}),({transition:e})=>n.pipe(Uf(n=>H(function*(){yield*ID(t,Ln(n)),i.set(e,$x($x(n),{waiting:!0}))}))),({transition:e,unmount:t},n)=>V(()=>{i.set(e,cu(n)?$x($x(n.value)):tS(n.cause)),t()}))}return{issue:n=>a(`paired-access`,t.request(e=>e.administration.issuePairing({payload:{labels:[n.label],addresses:n.addresses,...n.trusted?{trusted:!0}:{},canManageSharing:n.canManageSharing===!0}})).pipe(Uf(()=>o(s2(e))))),revoke:n=>a(`paired-access`,t.request(e=>e.administration.revokeAccess({payload:{id:n}})).pipe(xp(o(s2(e))))),trust:n=>a(`paired-access`,t.request(e=>e.administration.setDeviceTrust({payload:n})).pipe(xp(o(s2(e))))),allowManagement:n=>a(`paired-access`,t.request(e=>e.administration.setManagementPermission({payload:n})).pipe(xp(o(s2(e))))),allowWaysIn:n=>a(`paired-access`,t.request(e=>e.administration.setWaysInPermission({payload:n})).pipe(xp(o(s2(e))))),setRemote:n=>a(`remote-access`,s(c2(e),r.remote,t.request(e=>e.remoteAccess.setRemoteAccess({payload:n})).pipe(Uf(()=>Y0(e)),tp(()=>o(c2(e)))))),startUpdate:n=>a(`service-update`,s(l2(e),r.update,t.request(e=>e.serviceUpdates.startServiceUpdate({payload:{version:n}})).pipe(Uf(()=>Y0(e)),tp(()=>o(l2(e))))))}})}var u2=class e extends tr()(`@porcelain/client/AccessCommands`){static layer(t){return Uu(e,fle(t))}},d2=X(e=>e.atoms(t=>Qu(u2.layer(e),t(J0(e).layer)))),ple=X(e=>d2(e).fn(e=>u2.use(t=>t.issue(e)).pipe(Kf(nle)),{concurrent:!0})),mle=X(({connection:e,id:t})=>d2(e).fn(()=>u2.use(e=>e.revoke(t)),{concurrent:!0})),hle=X(({connection:e,id:t})=>d2(e).fn(e=>u2.use(n=>n.trust({id:t,trusted:e})),{concurrent:!0})),gle=X(({connection:e,id:t})=>d2(e).fn(e=>u2.use(n=>n.allowWaysIn({id:t,allowed:e})),{concurrent:!0})),_le=X(e=>d2(e).fn(e=>u2.use(t=>t.setRemote(e)),{concurrent:!0})),vle=X(e=>d2(e).fn(e=>u2.use(t=>t.startUpdate(e)),{concurrent:!0})),yle=X(({connection:e,id:t})=>d2(e).fn(e=>u2.use(n=>n.allowManagement({id:t,allowed:e})),{concurrent:!0})),f2={withIdentity:(e,t)=>[...e,...t.cacheIdentity??[]],worktreeSurface:(e,t,n)=>f2.withIdentity(f2.reviewSurface(e.environmentId,t,n),e),worktreeReads:(e,t,n)=>[f2.environment(e.environmentId),f2.review(e.environmentId,t),f2.reviewSurface(e.environmentId,t,n.slice(0,1)),f2.reviewSurface(e.environmentId,t,n)],connectedInventory:e=>f2.withIdentity(f2.inventory(e.environmentId),e),projectReviews:(e,t)=>[`project-reviews`,e,...t?[t]:[]],durableReview:(e,t)=>[`project-review`,e,t],environment:e=>[`environment`,e],reviewGitSettings:e=>[`review-git-settings`,e],filePreferences:(e,t)=>[`review`,e,t,`file-preferences`],inventory:e=>[`inventory`,e],worktreeInventory:e=>[`worktree-inventory`,e],reviewProject:(e,t)=>[`review`,e,t],review:(e,t)=>[...f2.reviewProject(e,t.projectId),t.worktreeId],reviewSurface:(e,t,n)=>[...f2.review(e,t),...n]},p2=new Set([`changes`,`directory`,`text`,`paths`,`git-status`,`asset`,`html-preview`,`step-lines`]),m2=new Set([`changes`,`git-status`,`paths`,`step-lines`]);function h2(e,t,n,r=In(),i=[t,f2.environment(e.environmentId)]){return H(function*(){let a=yield*GW,o=yield*gT,s=yield*jT({epoch:0,result:Bn(r,{onNone:()=>Zx(),onSome:e=>$x(e)})}),c=(t=n,r=!1)=>H(function*(){let n=(yield*NT(s)).epoch;yield*LT(s,e=>({...e,result:iS(e.result)}));let i=yield*Gf(t.pipe(Uf(()=>Y0(e))));yield*LT(s,e=>e.epoch===n?{...e,epoch:e.epoch+ +!!r,result:qx(i,Ln(e.result))}:e)});function l(n,r){return a.run(f2.withIdentity(t,e),H(function*(){yield*Y0(e),yield*LT(s,e=>({...e,epoch:e.epoch+1}));let t=yield*n;return yield*Y0(e),yield*LT(s,e=>({epoch:e.epoch+1,result:Bn(r(sS(e.result),t),{onNone:()=>e.result,onSome:e=>$x(e)})})),t}).pipe(xp(o.invalidate([t]))))}return{confirm:l,refresh:e=>H(function*(){yield*LT(s,e=>({...e,epoch:e.epoch+1})),yield*c(e,!0)}),stream:Kae(MT(s).pipe(iT(e=>e.result)),o.stream(i,c()).pipe(Wae))}})}var g2=Er(`@porcelain/client/InventorySeed`,{defaultValue:()=>In()}),_2=class e extends tr()(`@porcelain/client/InventoryState`){static layer(t){return Uu(e,H(function*(){let e=yield*g2,n=yield*W0(t),r=e=>Y0(t,e.environmentId===t.environmentId),i=n.request(e=>e.projects.readInventory()),a=yield*h2(t,f2.inventory(t.environmentId),i.pipe(Uf(r)),e,[f2.inventory(t.environmentId),f2.environment(t.environmentId),f2.worktreeInventory(t.environmentId)]);function o(e,t){return a.confirm(e,(e,n)=>qn(e,e=>t(e,n)))}return{stream:a.stream,confirm:o,refresh:()=>a.refresh(n.request(e=>e.projects.refreshInventory()).pipe(Zf(`RequestError`,e=>e.status===404?i:U(e)),Uf(r)))}}))}},v2=X(e=>e.atoms(t=>Qu(_2.layer(e),t(K0(e).layer))));function y2(e){return X(t=>v2(t).fn(n=>H(function*(){let r=yield*W0(t);return yield*(yield*_2).confirm(r.request(t=>e(t.environmentLabel,n)),(e,t)=>({...e,environment:t}))}),{concurrent:!0}))}var ble=y2((e,t)=>e.renameEnvironment({payload:{name:t}})),xle=y2((e,t)=>e.setEnvironmentIcon({payload:{icon:t}})),Sle=Gp(`BrowserSession.restore`)(function*(){let e=yield*R0;return{principal:yield*T0(e.session.readSession()),inventory:yield*T0(e.projects.readInventory())}},Xf(e=>e instanceof S0&&e.status===401?B(null):U(e instanceof S0||mb(e)?new KW({message:`Could not reach Porcelain to restore this browser session.`,cause:e}):e))),Cle=X(e=>Pce(e).atom(Sle())),b2=`Save or discard unsaved file drafts before disconnecting.`;function x2(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`RequestError`||`_tag`in e)?e.message:`Could not connect to the environment. Try again.`}var S2=class extends tr()(`@porcelain/client/FileDraftWriter`){},wle=Er(`@porcelain/client/FileDraftTiming`,{defaultValue:()=>({autosave:ki(xce),diskNotice:ki(Sce)})}),C2=class e extends tr()(`@porcelain/client/FileDraft`){static layer(t,n){return Uu(e,H(function*(){let e=yield*S2,r=yield*wle,i=Aj({text:t.text,savedText:t.text,fingerprint:t.fingerprint,saving:!1,owner:null,error:null,diskChanged:new Set}),a=Aj(!1),o=Aj(null),s=yield*FW(void 0),c=yield*OC(1),l=yield*PD(void 0),u=yield*FW(new Map),d=Aj(new Map),f=e=>i.update(t=>({...t,...e})),p=()=>e.isBlockedError?e.isBlockedError(i.value.error):i.value.error instanceof _J,m=H(function*(){let e=yield*LD(l,void 0);e&&(yield*hS(e))}),h=e=>{i.value.owner===e&&f({owner:null})},g=e=>{let t=new Set(i.value.diskChanged);t.delete(e),f({diskChanged:t})},_=Gp(`FileDraft.forgetDiskChange`)(function*(e){let t=yield*LW(u,t=>{let n=new Map(t);return n.delete(e),[t.get(e),n]});t&&(yield*hS(t)),g(e)}),v=Gp(`FileDraft.save`)(function*(){return yield*c.withPermit(m),yield*yield*RW(s,t=>t?B([pS(t),t]):a.value||p()?B([B(!1),void 0]):i.value.text===i.value.savedText?B([B(!0),void 0]):(f({saving:!0,error:null}),Kf(Pp(H(function*(){for(;i.value.text!==i.value.savedText;){let t=i.value.text,n=yield*e.write(t,i.value.fingerprint);o.set(n),f({savedText:t,fingerprint:n})}return!0}).pipe(Qf(e=>V(()=>(f({error:Vl(e)}),!1))),xp(Rf.pipe(Hf(zW(s,void 0)),Hf(V(()=>f({saving:!1})))))),n,{startImmediately:!0}),e=>[pS(e),e])))});return yield*Cu(n,V(()=>{a.set(!0),d.set(new Map)})),{state:i,get blocked(){return p()},claim(e){return a.value||i.value.owner!==null&&i.value.owner!==e?!1:(f({owner:e}),!0)},release:h,attachEditor:e=>{a.value||d.update(t=>new Map(t).set(e,Symbol(e)))},finishEditing:Gp(`FileDraft.finishEditing`)(function*(e,t,n=()=>{}){let r=d.value.get(e);r&&(yield*Rf,!(a.value||d.value.get(e)!==r)&&(d.update(t=>{let n=new Map(t);return n.delete(e),n}),n(),h(e),(i.value.saving||!i.value.error)&&(yield*v()),i.value.text!==i.value.savedText&&t()))}),noticeDiskChange:Gp(`FileDraft.noticeDiskChange`)(function*(e,t){yield*RW(u,s=>{if(a.value||i.value.saving||i.value.owner!==null||s.has(e)||o.value===t)return B([void 0,s]);f({diskChanged:new Set([...i.value.diskChanged,e])});let c;return Kf(Pp(op(r.diskNotice).pipe(Hf(BW(u,t=>{if(t.get(e)!==c)return t;let n=new Map(t);return n.delete(e),g(e),n}))),n,{startImmediately:!0}),t=>(c=t,[void 0,new Map(s).set(e,t)]))})}),forgetDiskChange:_,change:Gp(`FileDraft.change`)(function*(e){a.value||i.value.text===e||(f({text:e}),yield*c.withPermit(H(function*(){if(yield*m,a.value)return;let e=yield*Pp(op(r.autosave).pipe(Hf(ID(l,void 0)),Hf(v()),Yf),n,{startImmediately:!0});yield*ID(l,e)})))}),reset:Gp(`FileDraft.reset`)(function*(e,t){yield*c.withPermit(H(function*(){a.value||i.value.saving||(yield*m,f({text:e,savedText:e,fingerprint:t,error:null}))}))}),refresh:Gp(`FileDraft.refresh`)(function*(e,t){yield*c.withPermit(V(()=>{let n=i.value;a.value||!t||n.saving||n.text!==n.savedText||n.fingerprint===t||f({text:e,savedText:e,fingerprint:t,error:null})}))}),save:v,dispose:()=>kf(()=>(a.set(!0),Eu(n,su)))}}))}},w2=(e,t)=>`${JSON.stringify([e.projectId,e.worktreeId])}/${t}`,T2=class e extends tr()(`@porcelain/client/FileDrafts`){static layer=Uu(e,H(function*(){let e=yield*gp,t=Aj(new Map),n=Aj(new Map),r=e=>t.value.get(e)??new Map,i=(e,n)=>t.update(t=>{let r=new Map(t);return n.size?r.set(e,n):r.delete(e),r});return{entries:e=>new Map([...r(e.environmentId)].map(([e,t])=>[e,t.draft])),retain:Gp(`FileDrafts.retain`)(function*(t){let n=w2(t.scope,t.path),a=r(t.environmentId).get(n);if(a)return yield*a.draft.refresh(t.text,t.fingerprint),a.draft;let o=yield*wu(e),s=Aj(t.path),c=yr(yield*Iu(C2.layer(t,o).pipe(Zu(Ru(S2,{...t.writer,write:(e,n)=>t.writer.write({path:s.value,text:e,expectedFingerprint:n})})))).pipe(hp(yu,o)),C2);return i(t.environmentId,new Map(r(t.environmentId)).set(n,{scope:o,draft:c,path:s})),yield*Cu(o,V(()=>i(t.environmentId,new Map([...r(t.environmentId)].filter(([,e])=>e.scope!==o))))),c}),adopt:e=>{n.update(t=>new Map(t).set(e.environmentId,e))},connection:e=>n.value.get(e.environmentId)??e,hasUnsaved:e=>e.some(e=>[...r(e).values()].some(({draft:e})=>e.state.value.saving||e.state.value.text!==e.state.value.savedText)),hasUnsavedWorktree:(e,t)=>[...r(e)].some(([e,{draft:n}])=>e.startsWith(w2(t,``))&&(n.state.value.saving||n.state.value.text!==n.state.value.savedText||n.blocked)),save:Gp(`FileDrafts.save`)(function*(e){for(let{draft:t}of r(e).values())if(!(yield*t.save()))return!1;return!0}),drop:Gp(`FileDrafts.drop`)(function*(e){let t=[...r(e).values()];i(e,new Map),n.update(t=>{let n=new Map(t);return n.delete(e),n}),yield*wf(t,e=>Eu(e.scope,su),{concurrency:`unbounded`,discard:!0})}),relocate:Gp(`FileDrafts.relocate`)(function*(e,t,n,a){let o=r(e),s=new Map(o),c=[],l=w2(a,n.path);for(let e of t){let t=o.get(e);if(t){if(s.delete(e),n.kind===`move`){let r=`${n.destination}${e.slice(l.length)}`;t.path.set(r),s.set(w2(a,r),t)}else c.push(t)}}i(e,s),yield*wf(c,e=>Eu(e.scope,su),{concurrency:`unbounded`,discard:!0})})}}))},E2=X(e=>e.atoms(T2.layer)),Tle=X(e=>E2(e).atom(T2)),Ele=X(e=>e.atoms(t=>Yu(t(W0(e).runtime.layer),T2.layer)).fn(Gp(`BrowserSession.disconnect`)(function*(){let t=yield*T2,n=yield*W0(e);if(!(yield*t.save(e.environmentId)))return yield*U(new KW({message:b2}));yield*n.request(e=>e.browserAccess.clearBrowserSession())},$f(e=>e instanceof KW?e:new KW({message:`Could not disconnect. Check the connection and try again.`,cause:e}))))),Dle=Gp(`BrowserSession.connect`)(function*(e,t,n,r){let i=yield*v0,a=yield*i.beginConnection(),o=yield*yp(V(()=>e.set(t,n)),()=>UT(e,t,{suspendOnWaiting:!0}),()=>V(()=>e.set(t,LE))).pipe(ap({duration:r,orElse:()=>Tp}),Qf(e=>U(new KW({message:x2(Vl(e)),cause:Vl(e)}))));if(a&&(yield*a(o)),i.state.value.connection?.environmentId!==o.inventory.environmentId)return yield*U(new KW({message:`Could not connect to the environment. Try again.`}))}),Ole=Gp(`BrowserSession.restoreConnection`)(function*(e,t){let n=yield*v0;if(n.state.value.connection)return!0;let r=yield*n.beginConnection(!0);if(!r)return!1;let i=e.get(t);eS(i)&&!i.waiting&&e.refresh(t);let a=yield*UT(e,t,{suspendOnWaiting:!0});return a!==null&&(yield*r(a),n.state.value.connection!==null)}),D2=class e extends tr()(`@porcelain/client/EnvironmentMutations`){static layer=Uu(e,H(function*(){let e=yield*OC(1),t=Aj(0);return{pendingSelections:t,run:(n,r)=>yp(V(()=>{n===`selection`&&t.update(e=>e+1)}),()=>e.withPermit(r),()=>V(()=>{n===`selection`&&t.update(e=>e-1)}))}}))},O2=class extends tr()(`@porcelain/client/WorkspaceSelectionCleanup`){},kle=H(function*(){let e=yield*h0,t=yield*HW,n=yield*D2,r=yield*T2,i=yield*O2;return{read:Gp(`Environments.read`)(()=>n.run(`access`,e.load())),pair:Gp(`Environments.pair`)(r=>n.run(`access`,H(function*(){return r.localEnvironmentId&&M0(r.value)?.environmentId===r.localEnvironmentId?yield*U(new KW({message:`That link is for this computer.`})):yield*Vce(r.value,r.environmentId).pipe(hp(h0,e),hp(HW,t))}))),route:Gp(`Environments.route`)(t=>n.run(`access`,H(function*(){if(!(yield*r.save(t.environmentId)))return yield*U(new KW({message:b2}));yield*e.route(t)}))),forget:Gp(`Environments.forget`)(t=>n.run(`selection`,H(function*(){if(!(yield*r.save(t)))return yield*U(new KW({message:b2}));yield*H(function*(){yield*e.forget(t),yield*i.forgetEnvironment(t),yield*r.drop(t)}).pipe(Op)})))}}),k2=class e extends tr()(`@porcelain/client/EnvironmentCommands`){static layer=Uu(e,kle)};function A2(e){return e.kind===`service`?e.state.managed&&e.state.available&&e.state.latest!==void 0:e.available&&e.latest!==void 0}function Ale(e,t){return t.running||e.some(A2)}function j2(e){if(e.kind===`mac-app`)return A2(e)?e.latest:void 0;let{state:t}=e;return A2(e)&&t.managed&&t.canUpdate&&!t.running?t.latest:void 0}function jle(e){if(e.state.managed&&!e.state.canUpdate)return{label:`Needs trust`,deviceId:e.deviceId,hint:e.deviceId?`Run porcelain trust ${e.deviceId} on that computer, or allow it in the Mac app → Computers → This computer → Devices`:`Find this device’s id with porcelain devices on that computer, then run porcelain trust <id>, or allow it in the Mac app → Computers → This computer → Devices`}}function Mle(e){let t=new Set;for(let n of e)j2(n)!==void 0&&t.add(`${n.kind}:${n.id}`);return t.size}function Nle(e){let t=e.entries.findIndex(e=>e.status===`updating`);return{total:e.entries.length,current:t<0?void 0:t+1,label:t<0?void 0:`Updating ${t+1} of ${e.entries.length}`}}var M2=bE({running:!1,entries:[]}).pipe(WE),N2=class extends Y()(`SettingsUpdateError`,{message:K}){},Ple=Gp(`updateSettingsTarget`)(function*(e,t,n){if(e.kind===`mac-app`)return yield*e.update(t);let r=vle(e.connection),i=n.mount(r);yield*bp(()=>V(i)),n.set(r,t),yield*UT(n,r,{suspendOnWaiting:!0});let a=yield*HT(n,l2(e.connection)).pipe(iT(e=>{if(eS(e)){let t=Vl(e.cause);return t instanceof S0&&(t.status===401||t.status===403)?Ln({status:`failed`,message:`Could not confirm the update: access to this computer was denied (${t.status}). Pair or trust this device again.`}):In()}if(!Qx(e))return In();let n=e.value;return n.managed?n.running?In():n.version===t?Ln({status:`updated`}):n.last?.target===t&&n.last.stage===`failed`?Ln({status:`failed`,message:n.last.reason??`The updater gave no reason.`}):In():Ln({status:`failed`,message:`This computer no longer runs the managed service.`})}),lT(zn),iT(e=>e.value),fT);if(Rn(a))return yield*new N2({message:`The update stopped before completion.`});if(a.value.status===`failed`)return yield*new N2({message:a.value.message})}),Fle=RE((e,t)=>H(function*(){let n=t.registry;if(n.get(M2).running)return;let r=[],i=new Set;for(let t of e){let e=j2(t),n=`${t.kind}:${t.id}`;e===void 0||i.has(n)||(i.add(n),r.push({target:t,version:e}))}if(r.sort((e,t)=>Number(e.target.kind===`mac-app`)-Number(t.target.kind===`mac-app`)),r.length===0)return;let a=r.map(({target:e,version:t})=>({id:e.id,name:e.name,kind:e.kind,version:t,status:`queued`})),o=e=>n.set(M2,{running:e,entries:a});o(!0),yield*H(function*(){for(let[e,{target:t,version:i}]of r.entries()){a=a.map((t,n)=>n===e?{...t,status:`updating`}:t),o(!0);let r=yield*Gf(Ple(t,i,n).pipe(_p)),s=lu(r)?Vl(r.cause):void 0;a=a.map((t,n)=>n===e?cu(r)?{...t,status:`updated`}:{...t,status:`failed`,message:s instanceof Error?s.message:`The update failed.`}:t),o(!0)}}).pipe(xp(V(()=>{a=a.map(e=>e.status===`queued`||e.status===`updating`?{...e,status:`failed`,message:`The update was interrupted.`}:e),o(!1)})))}),{concurrent:!0}).pipe(WE),P2=nj(A0).live.liveUpdates,Ile=nj(Gq).pairing.redeemPairing,F2=new Set;function Lle(e){return F2.add(e),()=>F2.delete(e)}function I2(){for(let e of[...F2])e()}function L2(e,t={}){return async(n,r)=>{let i=new Headers(r?.headers);i.delete(`authorization`),i.set(`x-porcelain-browser`,`1`);let a=await e(n,{...r,headers:i,credentials:`same-origin`});return a.status===401&&n!==Ile()&&t.reportUnauthorized!==!1&&I2(),a}}var R2=X(e=>v2(e).atom(rT(Kf(_2,e=>e.stream))).pipe(qE(e=>dS(e,e=>e)),uE(0)));X(e=>_E(t=>e.map(e=>({connection:e,result:t(R2(e))}))));var Rle=class extends tr()(`@porcelain/client/ProjectSelectionStorage`){},z2=class e extends tr()(`@porcelain/client/ProjectSelectionStore`){static layer=Uu(e,H(function*(){let e=yield*Rle,t=yield*qW({initial:{currentEnvironmentId:void 0,selections:{}},read:e.read,write:e.write,messages:{beforeRead:`Saved workspace selections must be read before changing them.`,readFailed:`Saved workspace selections could not be read. Try reading them again.`,writeFailed:`Saved workspace selections could not be updated. Read them again before making changes.`}}),n=t.write;return{state:t.state,load:t.load,selectEnvironment:Gp(`ProjectSelectionStore.selectEnvironment`)(e=>n(({selections:t})=>B({currentEnvironmentId:e,selections:t}))),selectWorkspace:Gp(`ProjectSelectionStore.selectWorkspace`)((e,t,r)=>n(({selections:n})=>B({currentEnvironmentId:e,selections:{...n,[e]:{projectId:t,worktreeId:r}}}))),forgetEnvironment:Gp(`ProjectSelectionStore.forgetEnvironment`)(e=>n(({currentEnvironmentId:t,selections:n})=>B({currentEnvironmentId:t===e?void 0:t,selections:Object.fromEntries(Object.entries(n).filter(([t])=>t!==e))})))}}))},B2={projects:void 0,environments:void 0,reviews:void 0,older:!1};function zle(e,t){return Number(t.main)-Number(e.main)||Number(t.headCommittedAt!==void 0)-Number(e.headCommittedAt!==void 0)||(t.headCommittedAt??``).localeCompare(e.headCommittedAt??``)||e.name.localeCompare(t.name)||e.key.localeCompare(t.key)}function V2(e){return e.state===`none`?`No review`:e.state===`loading`?`Reading review…`:e.state===`unavailable`?`Review unavailable`:e.archived?`Archived review`:e.closed?`Closed review`:e.retained?`Retained review`:e.progressUnavailable?`Review · progress unavailable`:e.progress?`Review · ${e.progress.reviewed}/${e.progress.total} decisions`:`Review · reading progress…`}function Ble(e){return e.state===`loading`?`Reading changes…`:e.state===`unavailable`?`Changes unavailable`:e.count===0?`Working tree clean`:`${e.count} ${e.count===1?`file`:`files`} changed`}function H2(e){return e.review.state===`none`?``:V2(e.review).replace(`Review · `,``)}function U2(e){if(e.state!==`available`)return;let t=e.summary;return t?.state===`available`&&(t.additions||t.deletions||t.binaryFiles)?t:void 0}function Vle(e){if(e.state===`loading`)return`Reading changes…`;if(e.state===`unavailable`)return`Changes unavailable`;let t=U2(e);if(t){let e=t.binaryFiles?` · ${t.binaryFiles} binary`:``;return`+${t.additions} −${t.deletions}${e}`}return e.count===0?``:`${e.count} ${e.count===1?`file`:`files`}`}function Hle(e){return e?e.state===`available`?{passed:`Checks passed`,running:`Checks running`,failed:`Checks failed`,none:`No checks`}[e.result]:e.state===`loading`?`Checks loading`:`Checks unavailable`:`Checks loading`}function Ule(e){return[e.name,e.projectName,e.environmentName,e.main?`Main worktree`:void 0,e.detached?`Detached HEAD`:void 0,e.detached?e.path:void 0,V2(e.review),e.kind===`worktree`?Ble(e.changes):void 0,e.review.state===`available`&&e.review.pullRequestNumber?`Pull request #${e.review.pullRequestNumber}`:void 0,!e.available&&e.kind===`worktree`?`Unavailable`:void 0].filter(Boolean).join(`, `)}function Wle(e,t){return!t||e.environmentId!==t.environmentId?!1:t.kind===`worktree`?e.kind===`worktree`&&e.worktreeId===t.worktreeId:e.review.state===`available`&&e.review.reviewId===t.reviewId}function Gle(e,t,n){let r=e.review;if(n.reviews!==void 0&&(n.reviews.length===0||r.state===`none`&&!n.reviews.includes(`without-review`)||r.state===`available`&&!n.reviews.includes(`with-review`)))return!1;let i=[e.name,e.branch,e.path,e.projectName,e.environmentName,r.state===`available`?r.pullRequestNumber:void 0].filter(e=>e!==void 0).join(` `).toLocaleLowerCase();return t.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean).every(e=>i.includes(e))}function Kle(e,t){return[{key:`reviews`,label:`Review`,options:[{id:`with-review`,label:`With a review`},{id:`without-review`,label:`Without a review`}]},{key:`environments`,label:`Environments`,options:[...new Map(e.map(e=>[e.environmentId,{id:e.environmentId,label:e.environmentName,icon:e.environmentIcon}])).values()]},{key:`projects`,label:`Projects`,options:e.map(e=>({id:e.key,label:`${e.name} · ${e.environmentName}`}))}].map(({key:e,label:n,options:r})=>{let i=t[e]??r.map(e=>e.id);return{key:e,label:n,items:r.map(e=>({...e,checked:i.includes(e.id),next:i.includes(e.id)?i.filter(t=>t!==e.id):[...i,e.id]}))}})}function qle(e,t){let n=new Map(e.map(e=>[e.environmentId,{...e,failures:e.failures.filter(({entry:e})=>!t.recoveredKeys.includes(e.key)&&(!t.environments.includes(e.environmentId)||t.inventoryKeys.includes(e.key)))}]));for(let e of t.issues){let t=n.get(e.environmentId),r=new Map((t?.failures??[]).map(e=>[e.entry.key,e]));for(let t of e.failures)r.set(t.entry.key,t);n.set(e.environmentId,{...e,dismissed:t?.dismissed??!1,failures:[...r.values()]})}let r=[...n.values()].filter(e=>e.failures.length>0);return JSON.stringify(r)===JSON.stringify(e)?e:r}var W2=bE({query:``,filter:B2,expanded:{}}).pipe(WE),G2=bE([]).pipe(WE);function Jle(e){return H(function*(){let t=yield*W0(e),n=yield*_2,r=yield*T2;return{register:e=>n.confirm(t.request(t=>t.projects.registerProject({payload:{path:e}})),(e,t)=>({...e,projects:e.projects.some(e=>e.id===t.id)?e.projects.map(e=>e.id===t.id?t:e):[...e.projects,t]})),rename:e=>n.confirm(t.request(t=>t.projects.renameProject({params:{projectId:e.projectId},payload:{name:e.name}})),(e,t)=>({...e,projects:e.projects.map(e=>e.id===t.id?{...e,name:t.name}:e)})),remove:i=>n.confirm(H(function*(){let n=`[${JSON.stringify(i)},`;for(let[t,i]of r.entries(e))if(t.startsWith(n)&&!(yield*i.save()))return yield*U(new KW({message:`Save or discard unsaved file drafts before removing this project.`}));return yield*t.request(e=>e.projects.removeProject({params:{projectId:i}}))}),e=>({...e,projects:e.projects.filter(e=>e.id!==i)}))}})}var K2=class extends tr()(`@porcelain/client/ProjectCommands`){},q2=X(e=>e.atoms(t=>Qu(Uu(K2,Jle(e)),Yu(t(v2(e).layer),T2.layer)))),Yle=X(e=>q2(e).fn(e=>K2.use(t=>t.register(e)),{concurrent:!0})),Xle=X(e=>q2(e).fn(e=>K2.use(t=>t.rename(e)),{concurrent:!0})),Zle=X(e=>q2(e).fn(e=>K2.use(t=>t.remove(e)),{concurrent:!0})),J2=X(e=>v2(e).fn(e=>_2.use(e=>e.refresh()),{concurrent:!0})),Qle=X(e=>vE(t=>e.map(e=>t(J2(e))),(t,n)=>{for(let n of e)t.set(J2(n),void 0)})),Y2=class e extends tr()(`@porcelain/client/FilePreferencesState`){static layer(t,n){return Uu(e,H(function*(){let e=yield*W0(t);return yield*h2(t,f2.filePreferences(t.environmentId,n),e.request(e=>e.projects.listFilePreferences({params:{projectId:n}})))}))}},X2=X(({connection:e,projectId:t})=>e.atoms(n=>Qu(Y2.layer(e,t),n(K0(e).layer)))),$le=X(({connection:e,projectId:t})=>X2({connection:e,projectId:t}).fn(n=>H(function*(){let r=yield*W0(e);return yield*(yield*Y2).confirm(r.request(e=>e.projects.setFilePreference({params:{projectId:t},payload:n})),(e,t)=>Ln(t))}),{concurrent:!0})),Z2=class e extends tr()(`@porcelain/client/ReadSubscriptions`){static layer=Uu(e,H(function*(){let e=yield*jT(Xm());return{snapshot:NT(e),changes:MT(e),reviewsFor:Gp(`ReadSubscriptions.reviewsFor`)(function*(t){let n=yield*NT(e);return[...new Set([...Qm(n)].flatMap(e=>e.reviewId&&(e.projectId===void 0||e.projectId===t.projectId&&e.worktreeId===t.worktreeId)?[e.reviewId]:[]))]}),retain:Gp(`ReadSubscriptions.retain`)(function*(t){yield*vp(H(function*(){let n=Symbol();return yield*LT(e,Zm(n,t)),n}),t=>LT(e,$m(t)))})}}))};function Q2(e,t,n,r,i,a=[]){let o=e4(e,t,n,i.atom(i=>H(function*(){yield*(yield*Z2).retain({...t,paths:a,surface:String(n[0]),settled:UT(i.registry,o,{suspendOnWaiting:!0}).pipe(np,Yf)});let s=yield*r;return yield*Y0(e),s})));return o}function $2(e){let t=bE(Zx()).pipe(WE),n=e.pipe(UE(t));return GE(n,r=>{let i=r(e);return Qx(i)&&r.once(t)!==i&&r.set(t,i),r(n)}).pipe(uE(0))}function eue(e,t,n,r,i){let a=e4(e,t,n,i.pull(e=>rT(H(function*(){return yield*(yield*Z2).retain({...t,paths:[],surface:String(n[0]),settled:UT(e.registry,a,{suspendOnWaiting:!0}).pipe(np,Yf)}),typeof r==`function`?r(e):r}))));return a}function e4(e,t,n,r){return r.pipe(e.atoms.withReactivity(f2.worktreeReads(e,t,n)),uE(0))}function t4(e,t,n,r){let i=r.atom(r=>rT(H(function*(){return yield*(yield*Z2).retain({...e,paths:[],surface:t,settled:UT(r.registry,i,{suspendOnWaiting:!0}).pipe(np,Yf)}),(yield*n).stream}))).pipe(qE(e=>dS(e,e=>e)),uE(0));return i}function n4(e,t,n,r=()=>!0,i=[]){return Q2(e.connection,e.scope,t,G0(e.connection,n).pipe(Uf(t=>Y0(e.connection,r(t)))),K0(e.connection),i)}var tue=X(e=>X2(e).atom(rT(Kf(Y2,e=>e.stream))).pipe(qE(e=>dS(e,e=>e)),uE(0),$2)),nue=X(({connection:e,path:t})=>K0(e).atom(H(function*(){return yield*(yield*W0(e)).request(e=>e.projects.browseProjectFolders({query:t===void 0?{}:{path:t}}))})));function rue(e,t){return nue({connection:e,path:t})}q({currentEnvironmentId:W(_G),selections:Rb(K,q({projectId:_G,worktreeId:vG})).check(Aie(_G))});var iue=H(function*(){let e=yield*h0,t=yield*z2,n=yield*D2;return{pending:n.pendingSelections,execute:Gp(`WorkspaceSelection.execute`)(r=>n.run(`selection`,H(function*(){if(r.kind===`read`){if(yield*t.load(),e.state.value.status!==`ready`||t.state.value.status!==`ready`)return;let n=new Set(e.state.value.remotes.map(e=>e.environmentId)),r=new Set(Object.keys(t.state.value.selections));t.state.value.currentEnvironmentId&&r.add(t.state.value.currentEnvironmentId);for(let e of r)n.has(e)||(yield*t.forgetEnvironment(e));return}if(e.state.value.status!==`ready`||!e.state.value.remotes.some(e=>e.environmentId===r.environmentId))return yield*U(new KW({message:`That environment is no longer paired. Open the workspace picker again.`}));if(r.kind===`environment`){yield*t.selectEnvironment(r.environmentId);return}yield*t.selectWorkspace(r.environmentId,r.projectId,r.worktreeId)})))}});(class e extends tr()(`@porcelain/client/ProjectSelectionCommands`){static layer=Uu(e,iue)});var aue=X(e=>RE((t,n)=>H(function*(){let r=yield*n.setResult(Yle(e),t.path.trim()),i=r.worktrees.find(e=>e.available);t.complete(),i&&(yield*t.select({remote:t.remote,projectId:r.id,worktreeId:i.id}))})));Uu(O2,Kf(z2,e=>({forgetEnvironment:e.forgetEnvironment})));var r4=Gp(`Changes.readSnapshot`)(function*({connection:e,scope:t}){let n=yield*G0(e,e=>e.changes.readChanges({params:{worktreeId:t.worktreeId}}));return yield*Y0(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),oue=X(e=>Q2(e.connection,e.scope,[`changes`],r4(e),K0(e.connection)).pipe($2)),i4=Gp(`Changes.readGitStatusSnapshot`)(function*({connection:e,scope:t}){let n=yield*G0(e,e=>e.changes.readGitStatus({params:{worktreeId:t.worktreeId}}));return yield*Y0(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),a4=X(e=>Q2(e.connection,e.scope,[`git-status`],i4(e),K0(e.connection)).pipe($2)),o4=X(e=>Q2(e.connection,e.scope,[`git-status`],H(function*(){let t=yield*G0(e.connection,t=>t.changes.readWorktreeSummary({params:{worktreeId:e.scope.worktreeId}}));return yield*Y0(e.connection,t.environmentId===e.connection.environmentId&&t.worktreeId===e.scope.worktreeId),t}),K0(e.connection)).pipe($2)),s4=class e extends tr()(`@porcelain/client/CommentThreadsState`){static layer(t,n){return Uu(e,H(function*(){let e=yield*W0(t);return yield*h2(t,f2.reviewSurface(t.environmentId,n,[`comments`]),H(function*(){let r=yield*e.request(e=>e.reviews.listCommentThreads({params:{worktreeId:n.worktreeId}}));if(yield*Y0(t,r.every(e=>e.worktreeId===n.worktreeId||e.review!==void 0)),r.some(e=>e.worktreeId!==n.worktreeId)){let{review:i}=yield*e.request(e=>e.reviews.readPublishedReview({params:{worktreeId:n.worktreeId}}));yield*Y0(t,i?.environmentId===t.environmentId&&i.worktreeId===n.worktreeId&&r.every(e=>e.worktreeId===n.worktreeId||e.review?.reviewId===i.reviewId))}return yield*Y0(t),r}),In(),f2.worktreeReads(t,n,[`comments`]))}))}},c4=X(({connection:e,scope:t})=>e.atoms(n=>Qu(s4.layer(e,t),n(K0(e).layer)))),sue=X(e=>bE({snapshot:``,filters:new Set,through:0})),cue=X(e=>t4(e.scope,`comments`,s4,c4(e)).pipe($2));function l4({connection:e,scope:t}){return cue({connection:e,scope:t})}function u4(e,t,n=()=>!0,r={}){return K0(e).atom(r=>{let i=Jn(r.self(),sS);return H(function*(){let r=yield*G0(e,e=>t(e,i));return yield*Y0(e,n(r)),r})}).pipe(e.atoms.withReactivity([f2.environment(e.environmentId),...r.inventory===!1?[]:[f2.inventory(e.environmentId)]]),uE(0))}function d4(e,t=!1){return n=>{let r=n.pipe(e.connection.atoms.withReactivity([f2.durableReview(e.connection.environmentId,e.reviewId)]));return GE(r,n=>(t&&n.mount(m4(e)),n(r)))}}function f4(e,t){return(e.revision===void 0?t.reviews.readReview({params:{reviewId:e.reviewId}}):t.reviews.readReviewRevision({params:{reviewId:e.reviewId,revision:e.revision}})).pipe(Zf(`ReviewNotFoundError`,()=>B({review:void 0,revisions:[],revision:void 0})))}function p4(e,t){return(t.review===void 0||t.review.reviewId===e.reviewId)&&(t.revision===void 0||(e.revision===void 0||t.revision.revision===e.revision)&&t.revision.content.environmentId===e.connection.environmentId)}var m4=X(e=>{let t=bE(In()).pipe(WE),n=u4(e.connection,(n,r)=>H(function*(){let i=yield*VT,a=Un(i.get(t));if(Rn(r)&&a?.review&&a.revision){let n=(yield*UT(i,h4({connection:e.connection,projectId:a.review.projectId}),{suspendOnWaiting:!0})).find(t=>t.reviewId===e.reviewId);if(n&&n.latestRevision===a.review.latestRevision){let e={...a,review:n};return i.set(t,Ln(e)),e}}let o=yield*f4(e,n);return yield*Y0(e.connection,p4(e,o)),i.set(t,Ln(o)),o}),t=>p4(e,t)).pipe(e.connection.atoms.withReactivity([f2.durableReview(e.connection.environmentId,e.reviewId)]),uE(0)),r=K0(e.connection).atom(t=>H(function*(){let r=t(n),i=Un(sS(r)),a=yield*Z2,o={reviewId:e.reviewId,surface:`review`,settled:UT(t.registry,n,{suspendOnWaiting:!0}).pipe(np,Yf)};return i||(yield*a.retain(o)),i?.review?.state===`open`&&!i.review.archived&&i.revision&&(yield*a.retain({...o,projectId:i.review.projectId,worktreeId:i.revision.content.worktreeId,paths:[]})),r})).pipe(qE(e=>dS(e,e=>e)),uE(0)),i=qE(t,e=>zn(e)?$x(e.value):Zx());return GE(n,e=>e(r)).pipe(UE(i),uE(0))}),h4=X(e=>{let t=u4(e.connection,t=>t.reviews.listProjectReviews({params:{projectId:e.projectId}}),t=>t.every(t=>t.projectId===e.projectId)).pipe(e.connection.atoms.withReactivity([f2.projectReviews(e.connection.environmentId,e.projectId)]));return GE(t,n=>{let r=n(t),i=Un(sS(r)),a=e.connection.runtime.runSync(gT);return n.addFinalizer(a.registerUnsafe(i?i.map(t=>f2.durableReview(e.connection.environmentId,t.reviewId)):[f2.projectReviews(e.connection.environmentId)],()=>n.refresh(t))),r}).pipe($2)}),g4=X(e=>u4(e.connection,t=>t.reviews.listReviewMarks({params:{reviewId:e.reviewId}})).pipe(d4(e,!0),$2)),lue=X(e=>u4(e.connection,t=>t.reviews.readReviewAgentFeedback({params:{reviewId:e.reviewId}})).pipe(d4(e,!0),$2)),uue=X(e=>u4(e.connection,t=>t.reviews.listReviewCommentThreads({params:{reviewId:e.reviewId}}),t=>t.every(t=>t.review?.reviewId===e.reviewId)).pipe(d4(e,!0))),due=X(e=>{let t=uue({connection:e.connection,reviewId:e.reviewId});if(!e.worktree)return t;let n=l4({connection:e.connection,scope:e.worktree});return _E(e=>{let r=e(t),i=e(n),a=eS(i)?Un(Ul(i.cause)):void 0,o=a&&`_tag`in a&&(a._tag===`WorktreeUnavailableError`||a._tag===`WorktreeNotFoundError`||a._tag===`ProjectNotFoundError`)?$x(Vn(sS(i),()=>[])):i;return dS(r,e=>uS(o,t=>[...e,...t.filter(e=>e.review===void 0)]))}).pipe(uE(0))}),fue=X(e=>u4(e.connection,t=>t.reviews.readReviewFile({params:{reviewId:e.reviewId,revision:e.revision},query:{path:e.path}}))),pue=X(e=>u4(e.connection,t=>t.reviews.readReviewDiffs({params:{reviewId:e.reviewId,revision:e.revision},payload:{paths:e.paths}}))),mue=X(e=>u4(e.connection,t=>t.reviews.readReviewProofFile({params:{reviewId:e.reviewId,revision:e.revision},query:{proofId:e.proofId}}),t=>t.id===e.proofId));X(e=>u4(e.connection,t=>t.reviews.compareReview({params:{reviewId:e.reviewId},query:{from:e.from,to:e.to}}),t=>t.reviewId===e.reviewId&&(e.from===void 0||t.from===e.from)&&(e.to===void 0||t.to===e.to)).pipe(d4(e))),X(e=>u4(e.connection,t=>t.reviews.readReviewInterdiff({params:{reviewId:e.reviewId},query:{from:e.from,to:e.to,path:e.path}}),t=>t.kind===`unavailable`||t.path===e.path&&(e.from===void 0||t.from===e.from)&&(e.to===void 0||t.to===e.to)).pipe(d4(e)));var hue=X(e=>u4(e.connection,t=>t.reviews.readReviewPullRequest({params:{reviewId:e.reviewId}})).pipe(d4(e,!0))),gue=X(e=>u4(e.connection,t=>t.reviews.listProjectPullRequests({params:{projectId:e.projectId}})).pipe(e.connection.atoms.withReactivity([f2.projectReviews(e.connection.environmentId),f2.projectReviews(e.connection.environmentId,e.projectId)]))),_ue=X(e=>u4(e.connection,t=>t.reviews.readProjectGitHubAccount({params:{projectId:e.projectId}})).pipe($2)),vue=X(e=>K0(e.connection).atom(H(function*(){let t={connection:e.connection,reviewId:e.reviewId},n=yield*G0(e.connection,e=>f4(t,e));return yield*Y0(e.connection,p4(t,n)),!n.review||n.review.lastSeenRevision>=e.revision?{updated:!1}:yield*G0(e.connection,t=>t.reviews.setReviewSeen({params:{reviewId:e.reviewId},payload:{revision:e.revision}}))})).pipe(e.connection.atoms.withReactivity([f2.environment(e.connection.environmentId)]),WE)),_4=X(e=>u4(e.connection,t=>t.reviews.readReviewPullChecks({params:{reviewId:e.reviewId}}),void 0,{inventory:!1}).pipe(d4(e),$2));function v4(e,t){return e?.some(e=>e.layerId===t.id&&e.fingerprint===t.fingerprint)===!0}function yue({revision:e,marks:t,status:n,pull:r}){let i=e?.content.layers??[],a=i.filter(e=>v4(t?.decisions,e)).length,o=i.length,s=t!==void 0&&o>0&&a===o,c=n===`replied`,l=bue(r),u=l||c?`Needs you`:s?`Decisions reviewed`:n===`reviewed`?`Waiting on agent`:`Needs you`,d=[];l&&d.push({label:l,variant:r?.kind===`loading`?`outline`:`destructive`}),e?.content.proof.checks.some(e=>e.result===`fail`)&&d.push({label:`Proof failed`,variant:`destructive`});let f=e?.content.notExplained.length??0;return f>0&&d.push({label:`${f} not explained`,variant:`outline`}),c&&d.push({label:`Agent replied`,variant:`default`}),e&&d.push({label:e.verdict.recommendation===`hold`?`Agent says hold`:`Recommends merge`,variant:`secondary`}),u===`Waiting on agent`&&d.push({label:`Waiting for a commit`,variant:`secondary`}),{reviewed:a,total:o,group:u,badges:d}}function bue(e){if(e?.kind===`loading`)return`Reading pull request…`;if(e?.kind===`failed`)return`PR state unavailable: request failed.`;if(e?.kind===`unavailable`)return`PR state unavailable: ${{"gh-not-installed":`GitHub CLI is not installed.`,"no-accounts":`No GitHub account is signed in.`,"no-access":`The GitHub account cannot access this repository.`,"not-github":`This repository has no GitHub remote.`,"rate-limited":`GitHub rate limit reached.`,offline:`GitHub could not be reached.`,"invalid-response":`GitHub returned an invalid response.`,"pull-request-not-found":`GitHub could not find this pull request.`}[e.reason]}`}function xue(e,t){return e.archived===!0||e.state===`closed`||t?.kind===`available`&&t.pullRequest!==void 0&&t.pullRequest.state!==`open`}function Sue(e,t){return e.archived!==!0&&t?.kind===`available`&&t.pullRequest!==void 0&&t.pullRequest.state!==`open`}function Cue(e,t,n){return n?.trim()||t?.verdict.asked.text.trim()||e.branch}function wue(e){let t=e.replace(/(?<=.)[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return{name:t.slice(n+1)||t,parent:n<0?void 0:t.slice(0,n||1)}}function Tue(e,t){return e===void 0&&t?.kind===`unavailable`&&t.reason===`not-github`}function Eue(e){let t=/^https:\/\/github\.com\/([a-zA-Z0-9_.-]+)\/([a-zA-Z0-9_.-]+)\/pull\/([1-9][0-9]*)(?:\/[^?#]*)?(?:[?#].*)?$/.exec(e.trim());return t?`https://github.com/${t[1]}/${t[2]}/pull/${t[3]}`:void 0}function y4(e,t,n=`${t}s`){return e===1?t:n}function b4(e,t,n=`${t}s`){return`${e} ${y4(e,t,n)}`}function Due(e){return e.matchesReviewHead?`Same head as the review`:`Different head from the review`}function x4(e){return e.state===`open`&&e.draft?`draft`:e.state}var Oue={open:`Open`,draft:`Draft`,merged:`Merged`,closed:`Closed`};function kue(e){return Oue[x4(e)]}var Aue=new Set([`FAILURE`,`ERROR`,`CANCELLED`,`TIMED_OUT`,`ACTION_REQUIRED`,`STARTUP_FAILURE`,`STALE`]);function S4(e){return e.status!==`COMPLETED`||e.conclusion===`EXPECTED`?`running`:Aue.has(e.conclusion??``)?`failed`:`passed`}function jue(e,t,n){let r=`${e.length}${t?`+`:``}`;if(t){let e=C4(n);return e.tone===`none`?{tone:`none`,label:`${r} checks listed · result incomplete`,short:`Checks incomplete`}:{tone:e.tone,label:e.label,short:e.label}}if(e.length===0)return{tone:`none`,label:`No checks`,short:`No checks`};let i=b4(e.length,`check`),a=e.filter(e=>S4(e)===`failed`);if(a.length>0)return{tone:`failed`,label:`${a.length} of ${i} failed`,short:`${a.length} failed`};let o=e.filter(e=>S4(e)===`running`);return o.length>0?{tone:`running`,label:`${o.length} of ${i} running`,short:`${o.length} running`}:{tone:`passed`,label:`${i} passed`,short:i}}function Mue(e){return S4(e)}function C4(e){return e===`SUCCESS`?{tone:`passed`,label:`Checks passing`}:e===`FAILURE`||e===`ERROR`?{tone:`failed`,label:`Checks failing`}:e===`PENDING`||e===`EXPECTED`?{tone:`running`,label:`Checks running`}:{tone:`none`,label:`No checks`}}function Nue(e){switch(e){case`no-access`:return{description:`The chosen or detected GitHub account cannot open this repository. Choose another account or reset the choice in Settings › Reviews & Git.`,action:{kind:`settings`,label:`Choose an account`}};case`gh-not-installed`:return{description:`The GitHub CLI (gh) is not installed on this computer.`,action:{kind:`install`,label:`How to install`,url:`https://cli.github.com`}};case`no-accounts`:return{description:`No GitHub account is signed in. Run gh auth login on this computer.`,action:{kind:`copy`,label:`Copy gh auth login`,text:`gh auth login`}};case`rate-limited`:return{description:`GitHub rate limit reached.`,action:{kind:`retry`,label:`Try again`}};case`offline`:return{description:`GitHub can’t be reached.`,action:{kind:`retry`,label:`Try again`}};case`invalid-response`:return{description:`GitHub’s answer was unreadable.`,action:{kind:`retry`,label:`Try again`}};case`pull-request-not-found`:return{description:`GitHub could not find this pull request. It may have been removed or become unavailable to this account. The review stays linked and readable.`,action:{kind:`retry`,label:`Try again`}};case`not-github`:return{description:`This repository has no GitHub remote.`,action:{kind:`retry`,label:`Try again`}}}}function Pue(e){return e===`MERGEABLE`?{label:`No conflicts`,tone:`passed`}:e===`CONFLICTING`?{label:`Conflicts`,tone:`failed`}:{label:`Not known yet`,tone:`none`}}function Fue(e){if(e===`APPROVED`)return{label:`Approved`,tone:`passed`};if(e===`CHANGES_REQUESTED`)return{label:`Changes requested`,tone:`failed`};if(e===`DISMISSED`)return{label:`Dismissed`,tone:`none`}}function w4(e){let t=/\/pull\/([1-9][0-9]*)$/.exec(e);return t?Number(t[1]):void 0}function Iue(e){return/^https:\/\/github\.com\/([^/]+\/[^/]+)\/pull\//.exec(e)?.[1]}function Lue(e,t,n){return e.filter(e=>e.headBranch===t&&e.state===`open`).map(e=>({pull:e,heldBy:e.reviewId!==void 0&&e.reviewId!==n?e.reviewId:void 0}))}function Rue(e){if(e===void 0)return;let t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function zue(e){let t=new Set(e.filter(e=>e.kind===`review`).map(e=>e.id));return e.filter(e=>e.kind!==`review-comment`||e.reviewId===void 0||!t.has(e.reviewId)).map(t=>({item:t,comments:t.kind===`review`?e.filter(e=>e.kind===`review-comment`&&e.reviewId===t.id):[]}))}function T4(e){return e??`Detached HEAD`}function Bue(e,t){for(let n of e.projects){let e=n.worktrees.find(e=>e.id===t);if(e)return{worktree:e,projectId:n.id}}}function Vue(e){let t=e.projects.flatMap(e=>e.worktrees);return t.find(e=>e.available&&!e.main)??t.find(e=>e.available)}function Hue(e){return e.projects.flatMap(e=>e.worktrees).find(e=>e.available&&(e.status===`replied`||e.status===`pending`))??Vue(e)}function Uue(e){return e.worktrees.find(e=>e.main)?.path??e.worktrees[0]?.path??``}function Wue(e){switch(e.unavailableReason){case`moved`:return`Porcelain doesn't recognise this repository as the one it registered. Remove the project and add it again.`;case`missing`:return`The repository folder is missing.`;case`permission`:return`Porcelain cannot read this repository because access is denied.`;case`git-failed`:return`Git could not read this repository.`;default:return`Porcelain can't reach this repository right now.`}}function Gue(e){return e.progressUnavailable?`unavailable`:e.progress?e.progress.reviewed<e.progress.total?`needs-you`:`reviewed`:`reading`}function Kue(e){let t=e.flatMap(e=>e.review.state===`available`&&!e.review.closed?[{key:e.key,entry:e,review:e.review,status:Gue(e.review),label:H2(e)}]:[]),n=new Map;for(let e of t){if(e.status===`needs-you`)continue;let t=`${e.entry.environmentId}/${e.entry.projectId}`,r=n.get(t);n.set(t,{key:t,name:e.entry.projectName,environmentName:e.entry.environmentName,rows:[...r?.rows??[],e]})}return{needsYou:t.filter(e=>e.status===`needs-you`),projects:[...n.values()].sort((e,t)=>e.name.localeCompare(t.name)||e.environmentName.localeCompare(t.environmentName)||e.key.localeCompare(t.key)),reading:e.some(e=>e.review.state===`loading`)}}var que=LK.literals,E4={desktop:`Desktop`,laptop:`Laptop`,server:`Server`,cloud:`Cloud`},D4=`desktop`;function O4(e){return e.icon??D4}function Jue(e){return e===D4?null:e}function k4(e){return{state:`available`,reviewId:e.reviewId,closed:e.state===`closed`||e.archived===!0,archived:e.archived===!0,pullRequestNumber:e.pullRequest?w4(e.pullRequest):void 0,progress:void 0}}function Yue(e){let{project:t,connection:n,environmentName:r}=e;return t.worktrees.map(e=>({key:`${n.environmentId}/${t.id}/${e.id}`,kind:`worktree`,environmentId:n.environmentId,environmentName:r,projectId:t.id,projectName:t.name,worktreeId:e.id,path:e.path,name:e.branch??wue(e.path).name,branch:T4(e.branch),main:e.main,...e.headCommittedAt?{headCommittedAt:e.headCommittedAt}:{},detached:!e.branch,available:t.available&&e.available,review:{state:`loading`},changes:{state:t.available&&e.available?`loading`:`unavailable`}})).sort(zle)}var A4=X(e=>_E(t=>{let n=t(R2(e.connection)),r=Un(sS(n)),i=r?.projects.find(t=>t.id===e.projectId);if(!r||!i)return{entries:[],messages:[]};let a=eS(n)?{...i,available:!1}:i,o=r.environment.name,s=Yue({...e,project:a,environmentName:o}),c=t(h4({connection:e.connection,projectId:a.id})),l=Un(sS(c)),u=[],d=(l??[]).filter(e=>e.state===`open`&&!e.archived),f=new Set(s.map(e=>e.branch)),p=d.filter(e=>f.has(e.branch)).map(n=>{let r=t(m4({connection:e.connection,reviewId:n.reviewId}));return{record:n,result:r,revision:Un(sS(r))?.revision}}).sort((e,t)=>(t.revision?.publishedAt??``).localeCompare(e.revision?.publishedAt??``)||e.record.reviewId.localeCompare(t.record.reviewId));eS(c)&&u.push(`Reviews for ${a.name} could not be read.`);let m=new Map,h=new Set,g=new Set;for(let e of p){Yx(e.result)&&h.add(e.record.branch),(eS(e.result)||!e.revision)&&g.add(e.record.branch);let t=e.revision;if(!t||t.projectId!==a.id)continue;let n=JSON.stringify([t.worktreePath,t.content.worktreeId]);m.has(n)||m.set(n,e)}let _=new Set;for(let n of s){if(eS(c)){n.review={state:`unavailable`};continue}if(!l)continue;let r=m.get(JSON.stringify([n.path,n.worktreeId]));if(!r){g.has(n.branch)&&!h.has(n.branch)&&u.push(`Review for ${n.name} on ${o} could not be read.`),n.review={state:`none`},g.has(n.branch)&&(n.review={state:`unavailable`}),h.has(n.branch)&&(n.review={state:`loading`});continue}_.add(r.record.reviewId);let i=t(g4({connection:e.connection,reviewId:r.record.reviewId})),a=Un(sS(i));eS(i)&&u.push(`Progress for ${n.name} on ${o} could not be read.`);let s=r.revision?.content.layers;n.review={...k4(r.record),...a&&s&&!eS(i)?{progress:{reviewed:s.filter(e=>v4(a.decisions,e)).length,total:s.length}}:{},progressUnavailable:eS(i)}}if(e.older)for(let t of l??[]){if(_.has(t.reviewId))continue;let n=p.find(e=>e.record.reviewId===t.reviewId)?.revision;s.push({key:`${e.connection.environmentId}/${t.reviewId}`,kind:`review`,environmentId:e.connection.environmentId,environmentName:o,projectId:a.id,projectName:a.name,worktreeId:s.find(e=>n?.worktreePath===e.path)?.worktreeId,path:n?.worktreePath,name:t.branch,branch:t.branch,main:!1,detached:t.branch===`Detached HEAD`,available:!0,review:{...k4(t),retained:!0},changes:{state:`unavailable`}})}return{entries:s,messages:u}}).pipe(uE(0))),Xue=X(e=>_E(t=>{let n=t(A4(e)),r=[];return{entries:n.entries.map(n=>{let i={...n};if(i.available&&i.worktreeId){let n=t(a4({connection:e.connection,scope:{projectId:i.projectId,worktreeId:i.worktreeId}})),a=Un(sS(n));eS(n)&&r.push({entry:i,detail:Un(Ul(n.cause))?.message}),i.changes=eS(n)?{state:`unavailable`}:a?{state:`available`,count:new Set(a.changes.map(e=>e.scope===`untracked`||e.scope===`unmerged`?e.path:e.newPath??e.oldPath)).size}:{state:`loading`}}return i}),messages:n.messages,statusFailures:r}}).pipe(uE(0)));function j4(e,t){let n=t.map(t=>{let n=e(R2(t));return{connection:t,result:n,inventory:Un(sS(n))}});return{reads:n,loading:n.some(({result:e})=>Yx(e)),messages:n.flatMap(({result:e,inventory:t})=>eS(e)?[`${t?.environment.name??`Computer`}: projects could not be read.`]:[])}}var M4=X(e=>_E(t=>{let n=t(W2),r=[],i=[],a=[],o=[],s=j4(t,e),c=[...s.messages];for(let{connection:e,result:t,inventory:i}of s.reads){Qx(t)&&a.push(e.environmentId);for(let a of i?.projects??[]){let o=eS(t)?{...a,available:!1}:a,s=`${e.environmentId}/${o.id}`;r.push({key:s,connection:e,project:o,environmentName:i.environment.name,environmentIcon:O4(i.environment),expanded:n.query.trim().length>0||n.expanded[s]!==!1,entries:[]})}}r.sort((e,t)=>e.project.name.localeCompare(t.project.name)||e.environmentName.localeCompare(t.environmentName)||e.key.localeCompare(t.key));let l=Kle(r.map(e=>({key:e.key,name:e.project.name,environmentId:e.connection.environmentId,environmentName:e.environmentName,environmentIcon:e.environmentIcon})),n.filter),u=[];for(let e of r){if(n.filter.reviews?.length===0||n.filter.projects!==void 0&&!n.filter.projects.includes(e.key)||n.filter.environments!==void 0&&!n.filter.environments.includes(e.connection.environmentId))continue;if(!e.expanded){u.push(e);continue}let r=t(Xue({connection:e.connection,projectId:e.project.id,older:n.filter.older}));if(i.push(...r.entries),c.push(...r.messages),r.statusFailures.length>0){let t=o.find(t=>t.connection.environmentId===e.connection.environmentId);t?t.failures.push(...r.statusFailures):o.push({connection:e.connection,environmentName:e.environmentName,failures:[...r.statusFailures]})}let a=r.entries.filter(e=>Gle(e,n.query,n.filter)).map(e=>({...e,review:{...e.review},changes:{...e.changes}}));for(let n of a){if(n.changes.state===`available`&&n.worktreeId){if(n.changes.count===0)n.changes.summary={state:`available`,additions:0,deletions:0,binaryFiles:0};else{let r=t(o4({connection:e.connection,scope:{projectId:n.projectId,worktreeId:n.worktreeId}})),i=Un(sS(r));n.changes.summary={state:`loading`},eS(r)?n.changes.summary={state:`unavailable`}:i&&(n.changes.summary={state:`available`,additions:i.additions,deletions:i.deletions,binaryFiles:i.binaryFiles})}}if(n.review.state===`available`&&n.review.pullRequestNumber){let r=t(_4({connection:e.connection,reviewId:n.review.reviewId})),i=Un(sS(r));n.review.checks={state:`loading`},eS(r)||i&&(i.kind!==`available`||i.number!==n.review.pullRequestNumber)?n.review.checks={state:`unavailable`}:i?.kind===`available`&&(n.review.checks={state:`available`,result:i.checks})}}(a.length!==0||!n.query.trim()&&n.filter.reviews===void 0)&&u.push({...e,entries:a})}let d=t.once(G2),f=qle(d,{issues:o.map(({connection:e,environmentName:t,failures:n})=>({environmentId:e.environmentId,environmentName:t,failures:n})),recoveredKeys:i.filter(e=>e.changes.state===`available`).map(e=>e.key),inventoryKeys:r.flatMap(e=>e.project.worktrees.map(t=>`${e.connection.environmentId}/${e.project.id}/${t.id}`)),environments:a});return f!==d&&t.set(G2,f),{projects:u,allProjects:r,statusIssues:t(G2),filters:l,loading:s.loading,messages:[...new Set(c)]}}));X(e=>_E(t=>{let n=[],r=j4(t,e),i=[...r.messages];for(let{connection:e,inventory:a}of r.reads)for(let r of a?.projects??[]){let a=t(A4({connection:e,projectId:r.id,older:!1}));n.push(...a.entries),i.push(...a.messages)}return{inbox:Kue(n),loading:r.loading,messages:[...new Set(i)]}}));var N4=class extends tr()(`@porcelain/client/OperationStore`){},P4=class extends tr()(`@porcelain/client/OperationStorage`){},F4=xx(J(q({requestId:PX.fields.requestId,projectId:K.check(fx(1)),worktreeId:bG.fields.worktreeId,request:PX}).check(tx(e=>e.requestId===e.request.requestId))));function I4(e){return e.state!==`running`}var L4=(e,t)=>JSON.stringify([e.projectId,e.worktreeId,t]),Zue=Uu(N4,H(function*(){let e=yield*P4,t=yield*OC(1),n=yield*jT(0),r=yield*e.read().pipe(Bf(e=>vb(F4)(e??`[]`)),Wf),i=Aj({operations:Nr(r)?new Map(r.success.map(e=>[L4(e,e.request.input.action),e])):new Map,closed:!1,restorationError:Mr(r)?new KW({message:`Could not restore pending Git operations. Check the previous operation before starting another.`,cause:r.failure}):void 0}),a=Gp(`OperationStore.publish`)(function*(e){i.set(e),yield*LT(n,e=>e+1)});yield*bp(()=>t.withPermit(a({...i.value,operations:new Map,closed:!0})));let o=Gp(`OperationStore.persist`)(function*(t){if(i.value.restorationError)return yield*U(i.value.restorationError);let n=[...t.values()].filter(e=>!e.receipt||!I4(e.receipt)).map(({receipt:e,...t})=>t),r=yield*Cb(F4)(n).pipe($f(e=>new KW({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e})));yield*(n.length?e.write(r):e.clear()).pipe($f(({cause:e})=>new KW({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e}))),yield*a({...i.value,operations:t})}),s=e=>t.withPermit(H(function*(){return i.value.closed?yield*Tp:yield*e().pipe(Op)}));return{state:i,set:Gp(`OperationStore.set`)((e,t)=>s(()=>H(function*(){let n=new Map(i.value.operations);t?n.set(e,t):n.delete(e),yield*o(n)}))),accept:Gp(`OperationStore.accept`)(e=>s(()=>H(function*(){let t=L4(e,e.action),n=i.value.operations.get(t);if(!n||n.requestId!==e.requestId||n.receipt&&I4(n.receipt))return!1;let r=new Map(i.value.operations);return r.set(t,{...n,receipt:e}),yield*o(r),!0}))),wait:Gp(`OperationStore.wait`)(function*(e,t){return yield*Bn(yield*MT(n).pipe(aT(()=>H(function*(){let n=i.value.operations.get(e);return yield*X0(!i.value.closed&&n?.requestId===t),n?.receipt&&I4(n.receipt)?Ln(n.receipt):In()})),lT(zn),iT(e=>e.value),fT),{onSome:B,onNone:()=>X0(!1).pipe(Hf(Nf))})})}})),Que=X(({connection:e,scope:t})=>e.operations.state.map(({operations:e})=>{let n=e.get(L4(t,`switch`));return{unresolved:!(!n||n.receipt&&I4(n.receipt))}}));function R4(e,t,n){e.set(G2,e(G2).flatMap(e=>{if(e.environmentId!==t)return[e];let r=n(e.failures);return r.length>0?[{...e,failures:r}]:[]}))}var $ue=X(e=>RE(Gp(`WorktreeNavigator.refresh`)(function*(t,n){if(t){let r=e.find(e=>e.environmentId===t.environmentId),i=n(G2).find(e=>e.environmentId===t.environmentId);if(!r||!i)return;yield*n.setResult(J2(r),void 0);let a=yield*n.result(R2(r),{suspendOnWaiting:!0}),o=i.failures.filter(({entry:e})=>a.projects.some(t=>t.id===e.projectId&&t.available&&t.worktrees.some(t=>t.id===e.worktreeId&&t.available))),s=o.map(({entry:e})=>e.key);R4(n,t.environmentId,e=>e.filter(({entry:e})=>s.includes(e.key))),yield*wf(o,e=>{let i=e.entry;if(!i.worktreeId)return Af;let a=a4({connection:r,scope:{projectId:i.projectId,worktreeId:i.worktreeId}});return n.refresh(a),n.result(a,{suspendOnWaiting:!0}).pipe(cp({onSuccess:()=>R4(n,t.environmentId,e=>e.filter(e=>e.entry.key!==i.key)),onFailure:e=>R4(n,t.environmentId,t=>t.map(t=>t.entry.key===i.key?{...t,detail:e.message}:t))}))},{concurrency:`unbounded`});return}yield*wf(e,e=>n.setResult(J2(e),void 0),{concurrency:`unbounded`});let r=n(M4(e));for(let e of r.projects){if(!e.expanded)continue;let t=h4({connection:e.connection,projectId:e.project.id}),r=Un(sS(n(t)));n.refresh(t);for(let t of r??[])t.state!==`open`||t.archived||e.project.worktrees.some(e=>(e.branch??`Detached HEAD`)===t.branch)&&n.refresh(m4({connection:e.connection,reviewId:t.reviewId}));for(let t of e.entries)if(t.worktreeId&&t.available&&(t.changes.state===`available`&&t.changes.count>0&&n.refresh(o4({connection:e.connection,scope:{projectId:t.projectId,worktreeId:t.worktreeId}})),n.refresh(a4({connection:e.connection,scope:{projectId:t.projectId,worktreeId:t.worktreeId}}))),t.review.state===`available`&&t.review.pullRequestNumber&&n.refresh(_4({connection:e.connection,reviewId:t.review.reviewId})),t.kind===`worktree`&&t.review.state===`available`&&!t.review.closed){let r={connection:e.connection,reviewId:t.review.reviewId};n.refresh(g4(r))}}}))),z4=[`review`,`reviewed-layers`],ede={files:z4,git:z4,review:z4,reviewed:[`reviewed`,`reviewed-layers`],comments:[`comments`]};function tde(e){return e.type===`worktree`?{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(ede[e.change])}:null}function nde(e){return e.action===`fetch`||e.action===`push`?null:{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(z4)}}var B4=[`branch`,`branch-bases`,`history`];function rde(e){if(e.type===`ready`||e.type===`subscribed`||e.type===`heartbeat`||e.type===`git-action`||e.type===`inventory`||e.type===`project`)return;let t=new Set(tde(e)?.surfaces);if(e.change===`files`)for(let e of p2)t.add(e);if(e.change===`git`)for(let e of[...m2,...B4])t.add(e);return{scope:e,surfaces:t}}function V4(e,t){let n=rde(t);return n?[...n.surfaces].map(t=>f2.reviewSurface(e,n.scope,[t])):[]}function ide(e){if(e.state!==`running`&&e.state!==`rejected`&&e.state!==`no-change`)return new Set([...e.action===`fetch`||e.action===`push`?[`git-status`,`changes`]:[...m2,...p2],...B4,...nde(e)?.surfaces??[]])}function H4(e,t){let n=ide(t);return n?[...n].map(n=>f2.reviewSurface(e,t,[n])):[]}var ade=class extends ea{},U4=class e extends tr()(`@porcelain/client/GitReceiptRefresh`){static layer(t){return Uu(e,H(function*(){let e=yield*gp,n=yield*gT,r=yield*Z2,i=yield*JU({capacity:1/0,timeToLive:Ei,lookup:a=>H(function*(){let o=new Set(H4(t.environmentId,a).map(e=>String(e[4]))),s=[...Qm(yield*r.snapshot)],c=yield*r.reviewsFor(a),l=s.filter(e=>e.projectId===a.projectId&&e.worktreeId===a.worktreeId).filter(e=>o.has(e.surface)),u=yield*Pp(H(function*(){n.invalidateUnsafe([f2.worktreeInventory(t.environmentId),f2.projectReviews(t.environmentId,a.projectId),...c.map(e=>f2.durableReview(t.environmentId,e)),...H4(t.environmentId,a)]),yield*wf(l,e=>e.settled,{concurrency:`unbounded`,discard:!0})}),e);return yield*Pp(fS(u).pipe(Hf(nW(i,a))),e),u})});return{refresh:Gp(`GitReceiptRefresh.refresh`)(function*(e){if(e.state===`running`||e.state===`rejected`||e.state===`no-change`)return;let t=new ade({projectId:e.projectId,worktreeId:e.worktreeId,requestId:e.requestId,action:e.action,state:e.state}),n=yield*ZU(i,t);n.pollUnsafe()&&(yield*nW(i,t)),yield*pS(n)})}}))}},W4=X(e=>e.atoms(t=>Qu(U4.layer(e),t(K0(e).layer))));function G4(e,t){return H(function*(){let n=yield*(yield*W0(e)).request(e=>e.gitActions.readGitActionReceipt({params:{worktreeId:t.worktreeId,requestId:t.requestId}}));return yield*Y0(e,n.projectId===t.projectId&&n.worktreeId===t.worktreeId&&n.requestId===t.requestId),n})}var K4=class extends Y()(`GitOperationStateError`,{reason:Wb([`pending`,`missing`,`mismatch`,`receipt-unavailable`])}){get message(){switch(this.reason){case`pending`:return`Check the existing receipt before starting another operation.`;case`missing`:return`No operation to recover`;case`mismatch`:return`Action mismatch`;case`receipt-unavailable`:return`The operation receipt is unavailable. Inspect the current Git state in your terminal before taking another action. This operation was not submitted again.`}}},ode=Gp(`GitActionController.make`)(function*({connection:e,scope:t,action:n}){let r=yield*W0(e),i=yield*N4,a=yield*hW,o=yield*U4,s=yield*OC(1),c=L4(t,n),l=Gp(`GitActionController.accept`)(function*(t){yield*Y0(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*o.refresh(t),yield*Y0(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*i.accept(t)}),u=Gp(`GitActionController.send`)(function*(a){let o=yield*r.request(e=>e.gitActions.runGitAction({params:{worktreeId:t.worktreeId},payload:a}));return`requestId`in o?(yield*Y0(e,o.projectId===t.projectId&&o.worktreeId===t.worktreeId&&o.requestId===a.requestId&&o.action===n),yield*l(o),yield*i.wait(c,a.requestId)):yield*U(new S0({status:o.statusCode,message:o.message}))});return{execute:Gp(`GitActionController.execute`)(function*(r){return yield*e.request(H(function*(){let o=yield*s.withPermit(H(function*(){yield*Y0(e);let o=i.state.value.operations.get(c);if(o&&(!o.receipt||!I4(o.receipt)))return yield*U(new K4({reason:`pending`}));if(r.input.action!==n)return yield*U(new K4({reason:`mismatch`}));let s={...r,requestId:yield*a.randomUUIDv4.pipe($f(e=>new KW({message:`Could not create a Git recovery identity.`,cause:e})))};return yield*i.set(c,{...t,requestId:s.requestId,request:s}),s}));return yield*u(o)}))}),recover:Gp(`GitActionController.recover`)(function*(){return yield*e.request(H(function*(){yield*Y0(e);let t=i.state.value.operations.get(c);if(!t)return yield*U(new K4({reason:`missing`}));let r=yield*G4(e,t).pipe(Zf(`GitActionNotFoundError`,()=>U(new K4({reason:`receipt-unavailable`}))),$f(e=>e instanceof S0&&e.status===404?new K4({reason:`receipt-unavailable`}):e));return yield*Y0(e,r.action===n),yield*l(r),yield*i.wait(c,t.requestId)}))}),startNew:Gp(`GitActionController.startNew`)(function*(){return yield*s.withPermit(H(function*(){let e=i.state.value.operations.get(c)?.receipt;return!e||!I4(e)?!1:(yield*i.set(c,null),!0)}))})}}),q4=class e extends tr()(`@porcelain/client/GitActionController`){static layer(t){return Uu(e,ode(t))}},J4=X(e=>e.connection.atoms(t=>Qu(q4.layer(e),Ju(t(W4(e.connection).layer),Gu(e.connection.runtime.contextEffect))))),Y4=X(e=>J4(e).fn(e=>q4.use(t=>t.execute(e)),{concurrent:!0})),X4=X(e=>J4(e).fn(e=>q4.use(e=>e.recover()),{concurrent:!0})),sde=X(e=>J4(e).fn(e=>q4.use(e=>e.startNew())));function cde(e,t){let n=Y4(e),r=X4(e),i=sde(e),a=()=>{t.set(n,IE),t.set(r,IE)};return{run:Gp(`GitActions.run`)(function*(e,r){return t.set(n,{input:e,expected:r}),yield*UT(t,n,{suspendOnWaiting:!0})}),recover:Gp(`GitActions.recover`)(function*(){return t.set(r,void 0),yield*UT(t,r,{suspendOnWaiting:!0})}),startNew:Gp(`GitActions.startNew`)(function*(){t.set(i,void 0),(yield*UT(t,i,{suspendOnWaiting:!0}))&&a()}),reset:a}}var Z4=X(e=>bE(H(function*(){return cde(e,yield*VT)}))),Q4=Gp(`Projects.branchSwitchCommands`)(function*(e){return yield*UT(yield*VT,Z4({...e,action:`switch`}),{suspendOnWaiting:!0})}),$4=X(e=>e.atoms(t=>Yu(t(K0(e).layer),T2.layer))),e3=Gp(`Projects.requireSavedWorktreeDrafts`)(function*(e){if((yield*T2).hasUnsavedWorktree(e.connection.environmentId,e.scope))return yield*new KW({message:`Save or discard unsaved file drafts before changing this worktree.`})}),lde=X(e=>$4(e.connection).fn(Gp(`Projects.deleteWorktree`)(function*(t){t.confirmation&&(yield*e3(e));let n=yield*G0(e.connection,n=>n.projects.deleteWorktree({params:{worktreeId:e.scope.worktreeId},payload:t}));return yield*Y0(e.connection),n.deleted&&(yield*vT([f2.inventory(e.connection.environmentId),f2.worktreeInventory(e.connection.environmentId),f2.projectReviews(e.connection.environmentId)])),n}))),ude=X(e=>$4(e.connection).fn(Gp(`Projects.switchWorktreeBranch`)(function*(t){yield*e3(e);let n=yield*Q4(e),r=yield*i4(e);return yield*n.startNew(),yield*n.run({action:`switch`,targetRef:t},{headOid:r.headOid,branch:r.branch?.name,inProgress:r.inProgress,mergeHeadOid:r.mergeHeadOid})}))),dde=X(e=>$4(e.connection).fn(Gp(`Projects.recoverWorktreeBranchSwitch`)(function*(t){return yield*e3(e),yield*(yield*Q4(e)).recover()}))),fde=1.5,pde=29360128,mde=1e4,hde=8192,gde=80,_de=64,vde=1e4,t3=15e3,yde=2166136261,bde=16777619;function xde(e,t){if(!e.running)return null;let n=e.last?.target??e.latest??`the new version`;return t||e.last?.stage===`restarting`?`Restarting Porcelain on ${n}. This page reconnects when it is back.`:e.last?.stage===`installing`?`Installing ${n}…`:`Downloading ${n}…`}function Sde(e){let{last:t}=e;return e.running||t==null?null:t.stage===`updated`&&t.target===e.version?{kind:`updated`,from:t.from,target:t.target}:t.stage===`failed`?{kind:`failed`,target:t.target,reason:t.reason??`The updater gave no reason.`}:null}function Cde(e,t){return t.endSide&&t.side&&t.endSide!==t.side?null:{...e,kind:`codeRange`,startLine:Math.min(t.start,t.end),endLine:Math.max(t.start,t.end),...e.comparison?.kind===`file`||e.comparison?.kind===`worktree`&&e.comparison.scope===`untracked`?{}:{side:t.side??`additions`}}}function wde(e,t){if(e.kind===`change`||e.filePath!==t.filePath)return!1;if(e.comparison?.kind===`branch`)return t.comparison?.kind===`branch`;if(e.revision!==t.revision)return!1;if(!e.comparison)return e.kind===`file`||t.comparison?.kind===`file`&&e.side===void 0;let n=t.comparison;return e.comparison.kind===n?.kind?e.comparison.kind===`worktree`&&n.kind===`worktree`?e.comparison.scope===n.scope:e.comparison.kind===`commit`&&n.kind===`commit`?e.comparison.parent===n.parent:!0:!1}function Tde(e,t){return e.contentFingerprint!==null&&e.contentFingerprint!==void 0&&e.contentFingerprint!==t.contentFingerprint}function Ede(e){return e.comparison?.kind===`branch`?e.comparison.base:void 0}function Dde(e){return e.kind===`change`?void 0:e.filePath}function Ode(e){return e?{kind:`change`,comparison:{kind:`branch`,base:e.base},revision:e.tip}:{kind:`change`}}function kde(e){if(e.kind===`change`)return e.comparison?.kind===`branch`?`Whole branch`:`Whole change`;if(e.kind===`file`)return`Whole file`;let t=e.side===`deletions`?`−`:`+`;return e.startLine===e.endLine?`${t}${e.startLine}`:`${t}${e.startLine} to ${t}${e.endLine}`}function n3(e){return e.messages[0]?.author??`reviewer`}function Ade(e){let t=e.filter(e=>e.resolved),n=t.filter(e=>n3(e)===`reviewer`).map(e=>({threadId:e.id,revision:e.revision}));return{confirmed:n,kept:t.length-n.length}}function r3(e){return e.resolved?`resolved`:e.messages.at(-1)?.author===`agent`?`agent-replied`:`awaiting-agent`}function i3(e){let t=e.map(r3),n=e=>t.filter(t=>t===e).length,r=n(`awaiting-agent`),i=n(`agent-replied`);return{awaitingAgent:r,awaitingYou:i,open:r+i,resolved:n(`resolved`)}}function jde(e){switch(r3(e)){case`resolved`:return`Resolved`;case`awaiting-agent`:return`Waiting for the agent`;case`agent-replied`:return n3(e)===`agent`&&e.messages.length===1?`From the agent`:`Agent replied`}}function Mde(e,t){return`${e.split(`
|
|
18
|
+
`).map(e=>`> ${e}`).join(`
|
|
19
|
+
`)}\n\n${t}`}function Nde(e){return e.trim().length>0&&!e.includes(`\0`)&&e.length<=16e3}function Pde(e,t,n){return e?.body===t?e:n()}function Fde(e,t){let n=[[`open`,e.open],[`resolved`,e.resolved]].filter(([,e])=>e>0);return e.highest===0||!n.every(([e])=>t.has(e))?null:e.highest}function Ide(e,t,n=[]){let r=new Map(e.map(e=>[e.id,e]));for(let e of t)r.set(e.id,e);for(let e of n)r.delete(e);return[...r.values()]}var a3=[`fail`,`pass`];function o3(e){let t=e?.checks??[],n=e=>t.filter(t=>t.result===e).length;return{failing:n(`fail`),passing:n(`pass`),current:e?.current??!0}}function Lde(e){return[...e].sort((e,t)=>a3.indexOf(e.result)-a3.indexOf(t.result))}function Rde(e,t){let n=e=>e.layerId===t;return{checks:(e?.checks??[]).filter(n),assets:(e?.assets??[]).filter(n),current:e?.current??!0}}function zde(e){switch(e){case`fail`:return`Failed`;case`pass`:return`Passed`}}function Bde(e){return Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0))}function Vde(e){return URL.parse(e)?.host??e}function Hde(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}var s3=q({method:Wb([`GET`,`POST`,`PATCH`,`PUT`,`DELETE`,`HEAD`,`OPTIONS`,`TRACE`,`QUERY`]),url:K,urlParams:J(Bb([K,K])),hash:W(K),headers:Rb(K,Ub([K,Mx(K)]))}).annotate({identifier:`HttpRequestDetails`}),Ude=q({status:dx,headers:Rb(K,Ub([K,Mx(K)]))}).annotate({identifier:`HttpResponseDetails`}),c3=`~effect/ai/AiError/Reason`,l3=()=>Kde.pipe(Yb(B({})),xie(B({}))),Wde=e=>{let t=Re(e),n={};for(let e in t){let r=t[e];st(n,e,ph(r)?r.toString():r)}return n},Gde=class e extends Bx(`effect/ai/AiError/NetworkError`)({_tag:Qb(`NetworkError`),reason:Wb([`TransportError`,`EncodeError`,`InvalidUrlError`]),request:s3,description:W(K)}){[c3]=c3;get isRetryable(){return this.reason===`TransportError`}static fromRequestError(t){return new e({description:t.description,reason:t._tag,request:{hash:Un(t.request.hash),headers:Wde(t.request.headers),method:t.request.method,url:t.request.url,urlParams:Array.from(t.request.urlParams)}})}get message(){let e=`${this.request.method} ${this.request.url}`,t=this.description?`${this.reason}: ${this.description}`:`${this.reason}: A network error occurred.`;t+=` (${e})`;let n=``;switch(this.reason){case`EncodeError`:n+=`Check that the request body data is properly formatted and matches the expected content type.`;break;case`InvalidUrlError`:n+=`Verify that the URL format is correct and that all required parameters have been provided.`,n+=` Check for any special characters that may need encoding.`;break;case`TransportError`:n+=`Check your network connection and verify that the requested URL is accessible.`}return t+=`\n\n${n}`,t}},Kde=Rb(K,Gb(Gie)),u3=q({promptTokens:W(dx),completionTokens:W(dx),totalTokens:W(dx)}).annotate({identifier:`UsageInfo`}),d3=q({request:s3,response:W(Ude),body:W(K)}).annotate({identifier:`HttpContext`}),qde=class extends Bx(`effect/ai/AiError/RateLimitError`)({_tag:Qb(`RateLimitError`),retryAfter:W(kx),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!0}get message(){let e=`Rate limit exceeded`;return this.retryAfter&&(e+=`. Retry after ${Hi(this.retryAfter)}`),e}},Jde=class extends Bx(`effect/ai/AiError/QuotaExhaustedError`)({_tag:Qb(`QuotaExhaustedError`),resetAt:W(Dx),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){let e=`Quota exhausted`;return this.resetAt&&(e+=`. Resets at ${this.resetAt}`),`${e}. Check your account billing and usage limits.`}},Yde=class extends Bx(`effect/ai/AiError/AuthenticationError`)({_tag:Qb(`AuthenticationError`),kind:Wb([`InvalidKey`,`ExpiredKey`,`MissingKey`,`InsufficientPermissions`,`Unknown`]),description:W(K),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){let e=`${this.kind}: ${{InvalidKey:`Verify your API key is correct`,ExpiredKey:`Your API key has expired. Generate a new one`,MissingKey:`No API key provided. Set the appropriate environment variable`,InsufficientPermissions:`Your API key lacks required permissions`,Unknown:`Authentication failed. Check your credentials`}[this.kind]}`;return this.description&&(e+=`. ${this.description}`),e}},Xde=class extends Bx(`effect/ai/AiError/ContentPolicyError`)({_tag:Qb(`ContentPolicyError`),description:K,metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){return`Content policy violation: ${this.description}`}},Zde=class extends Bx(`effect/ai/AiError/InvalidRequestError`)({_tag:Qb(`InvalidRequestError`),parameter:W(K),constraint:W(K),description:W(K),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){let e=`Invalid request`;return this.parameter&&(e+=`: parameter '${this.parameter}'`),this.constraint&&(e+=` ${this.constraint}`),this.description&&(e+=`. ${this.description}`),e}},Qde=class extends Bx(`effect/ai/AiError/InternalProviderError`)({_tag:Qb(`InternalProviderError`),description:K,metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!0}get message(){return`Internal provider error: ${this.description}`}},$de=class e extends Bx(`effect/ai/AiError/InvalidOutputError`)({_tag:Qb(`InvalidOutputError`),description:K,metadata:l3(),usage:W(u3)}){[c3]=c3;get isRetryable(){return!0}static fromSchemaError(t){return new e({description:t.message})}get message(){return`Invalid output: ${this.description}`}},efe=class e extends Bx(`effect/ai/AiError/StructuredOutputError`)({_tag:Qb(`StructuredOutputError`),description:K,responseText:K,metadata:l3(),usage:W(u3)}){[c3]=c3;get isRetryable(){return!0}static fromSchemaError(t,n){return new e({description:t.message,responseText:n})}get message(){return`Structured output validation failed: ${this.description}`}},tfe=class extends Bx(`effect/ai/AiError/UnsupportedSchemaError`)({_tag:Qb(`UnsupportedSchemaError`),description:K,metadata:l3()}){[c3]=c3;get isRetryable(){return!1}get message(){return`Unsupported schema: ${this.description}`}},nfe=class extends Bx(`effect/ai/AiError/UnknownError`)({_tag:Qb(`UnknownError`),description:W(K),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){return this.description??`Unknown error`}},f3=class extends Bx(`effect/ai/AiError/ToolNotFoundError`)({_tag:Qb(`ToolNotFoundError`),toolName:K,availableTools:J(K)}){[c3]=c3;get isRetryable(){return!0}get message(){let e=this.availableTools.length>0?this.availableTools.join(`, `):`none`;return`Tool '${this.toolName}' not found. Available tools: ${e}`}},p3=class extends Bx(`effect/ai/AiError/ToolParameterValidationError`)({_tag:Qb(`ToolParameterValidationError`),toolName:K,description:K}){[c3]=c3;get isRetryable(){return!0}get message(){return`Invalid parameters for tool '${this.toolName}': ${this.description}`}},m3=class extends Bx(`effect/ai/AiError/InvalidToolResultError`)({_tag:Qb(`InvalidToolResultError`),toolName:K,description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Tool '${this.toolName}' returned invalid result: ${this.description}`}},h3=class extends Bx(`effect/ai/AiError/ToolResultEncodingError`)({_tag:Qb(`ToolResultEncodingError`),toolName:K,toolResult:Mb,description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Failed to encode result for tool '${this.toolName}': ${this.description}`}},rfe=Ub([qde,Jde,Yde,Xde,Zde,Qde,Gde,$de,efe,tfe,nfe,f3,p3,m3,h3,class extends Bx(`effect/ai/AiError/ToolConfigurationError`)({_tag:Qb(`ToolConfigurationError`),toolName:K,description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Invalid configuration for tool '${this.toolName}': ${this.description}`}},class extends Bx(`effect/ai/AiError/ToolkitRequiredError`)({_tag:Qb(`ToolkitRequiredError`),pendingApprovals:J(K),description:W(K)}){[c3]=c3;get isRetryable(){return!1}get message(){return`Toolkit required to resolve pending tool approvals: ${this.pendingApprovals.join(`, `)}`}},class extends Bx(`effect/ai/AiError/InvalidUserInputError`)({_tag:Qb(`InvalidUserInputError`),description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Invalid user input: ${this.description}`}}]),g3=`~effect/ai/AiError`,_3=class extends Bx(`effect/ai/AiError/AiError`)({_tag:Qb(`AiError`),module:K,method:K,reason:rfe}){[g3]=g3;cause=this.reason;get isRetryable(){return this.reason.isRetryable}get retryAfter(){return`retryAfter`in this.reason?this.reason.retryAfter:void 0}get message(){return`${this.module}.${this.method}: ${this.reason.message}`}},ife=e=>F(e,c3),v3=e=>new _3(e),afe=`~effect/ai/Tool`,y3=(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),e,t),b3={[afe]:{_Requirements:o},pipe(){return n(this,arguments)},addDependency(){return y3(this)},setParameters(e){return y3(this,{parametersSchema:e,jsonSchema:void 0})},setSuccess(e){return y3(this,{successSchema:e})},setFailure(e){return y3(this,{failureSchema:e})},setNeedsApproval(e){return y3(this,{needsApproval:e})},annotate(e,t){return y3(this,{annotations:hr(this.annotations,e,t)})},annotateMerge(e){return y3(this,{annotations:wr(this.annotations,e)})}};({...b3}),{...b3};var ofe=e=>{let t=Object.assign(Object.create(b3),e);return t.id=`effect/ai/Tool/${e.name}`,t},x3=(e,t)=>{let n=t?.success??Ib,r=t?.failure??jb;return ofe({name:e,description:t?.description,parametersSchema:t?.parameters??lfe,successSchema:n,failureSchema:r,failureMode:t?.failureMode??`error`,annotations:pr(),needsApproval:t?.needsApproval})},S3=Er(`effect/ai/Tool/Readonly`,{defaultValue:l}),C3=Er(`effect/ai/Tool/Destructive`,{defaultValue:c}),w3=Er(`effect/ai/Tool/Idempotent`,{defaultValue:l}),T3=Er(`effect/ai/Tool/OpenWorld`,{defaultValue:c}),E3=Er(`effect/ai/Tool/Strict`,{defaultValue:()=>void 0}),sfe=q({type:Wb([`execution-denied`,`execution-interrupted`]),reason:K}).annotate({identifier:`ToolExecutionFailure`}),cfe=e=>Ub([_3,e.failureSchema,sfe]),lfe=Rb(K,jb),D3=`~effect/ai/Toolkit`,ufe=Er(`effect/ai/Toolkit/FailureOrigin`,{defaultValue:()=>`result`}),O3=(e,t)=>eu(Pl(e),mr(ufe,t)),dfe={...on({label:`Toolkit`,evaluate:Wp(function*(e){let t=this.tools,n=e.context,r=new WeakMap,i=e=>{let t=r.get(e);if(O(t)){let i=n.mapUnsafe.get(e.id),a=Eb(e.parametersSchema)?vb(e.parametersSchema):e=>B(e),o=Sb(e.successSchema),s=Sb(cfe(e));t={context:i.context,handler:i.handler,decodeParameters:a,encodeResult:(e,t)=>t?s(e):o(e)},r.set(e,t)}return t};return{tools:t,handle:Wp(function*(e,n,r,a){let o=Object.hasOwn(t,e)?t[e]:void 0;if(yield*bne({tool:e,parameters:n}),O(o))return yield*v3({module:`Toolkit`,method:`${e}.handle`,reason:new f3({toolName:e,availableTools:Object.keys(t)})});let s=i(o),c=(t,n)=>s.encodeResult(t,n).pipe($f(n=>v3({module:`Toolkit`,method:`${e}.handle`,reason:new h3({toolName:e,toolResult:t,description:n.message})}))),l=yield*Wf(s.decodeParameters(n,a));if(Mr(l)){let t=v3({module:`Toolkit`,method:`${e}.handle`,reason:new p3({toolName:e,description:l.failure.message})});return o.failureMode===`error`?yield*Pf(O3(t,`parameters`)):Yw(Kf(c(t,!0),e=>({result:t,isFailure:!0,failureOrigin:`parameters`,preliminary:!1,encodedResult:e})))}let u=l.success,d=yield*qS(),f={toolCallId:r,preliminary:e=>Yf(XS(d,{result:e,isFailure:!1,preliminary:!0}))},p=yield*s.handler(u,f).pipe(Bf(e=>XS(d,{result:e,isFailure:!1,preliminary:!1})),mp(e=>wr(s.context,e)),lp({onFailure:e=>eC(d,e),onSuccess:()=>nC(d)}),Np),m=t=>mb(t)?v3({module:`Toolkit`,method:`${e}.handle`,reason:new m3({toolName:e,description:`Tool handler returned invalid result: ${t.message}`})}):ife(t)?v3({module:`Toolkit`,method:`${e}.handle`,reason:t}):t;return nT(d).pipe(Yae(e=>{let t=m(e),n=mb(e)?`result`:`handler`;return o.failureMode===`error`?Lae(O3(t,n)):eT({result:t,isFailure:!0,failureOrigin:n,preliminary:!1})}),aT(Wp(function*(e){let t=yield*c(e.result,e.isFailure);return{...e,encodedResult:t}})),$ae(hS(p)))})}})}),[D3]:D3,of:o,toHandlers(e){return H({self:this},function*(){let t=yield*up(),n=Sf(e)?yield*e:e,r=new Map;for(let[e,i]of Object.entries(n)){let n=Object.hasOwn(this.tools,e)?this.tools[e]:void 0;n!==void 0&&r.set(n.id,{name:e,handler:i,context:t})}return ur(r)})},toLayer(e){return Gu(this.toHandlers(e))},toJSON(){return{_id:`effect/ai/Toolkit`,tools:Array.from(Object.values(this.tools)).map(e=>e.name)}}},ffe=e=>Object.assign(function(){},dfe,{tools:e}),pfe=(...e)=>{let t={};for(let n of e)st(t,n.name,n);return t},mfe=(...e)=>ffe(pfe(...e)),k3=q({cwd:Db(K.check(fx(1)).check(mx(eG)))}),hfe=q({...k3.fields,...v$.fields}),gfe=q({...b$.fields,warnings:J(K)}),_fe=q({...k3.fields,reviewId:W(K.check(rx())),...S$.fields}),vfe=q({reviewId:W(K.check(rx())),...k3.fields,scope:l1.pipe(Zb(B(`waiting`)))}),yfe=q({...k3.fields,...d1.fields}),bfe=q({...k3.fields,...s1.fields,...p1.fields}),xfe=q({...k3.fields,...s1.fields,...h1.fields}),Sfe=x3(`publish_review`,{parameters:hfe,success:gfe,failure:mG,failureMode:`return`,description:`Publish an immutable revision of committed branch work with a required verdict. Read the current revision and porcelain://review-guide first. Include your own CSS, matching the reviewed application where possible; missing CSS produces an advisory warning. Attach proof that the work is done: checks you ran with their result, and screenshots, short videos or links.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!0),Cfe=x3(`read_review`,{parameters:_fe,success:D$,failure:mG,failureMode:`return`,description:`Read the latest published review, resolved pointers and uncovered changed lines.`}).annotate(E3,!0).annotate(T3,!1).annotate(S3,!0).annotate(w3,!0),wfe=x3(`list_comments`,{parameters:vfe,success:q({threads:u1}),failure:mG,failureMode:`return`,description:`Read review threads waiting for the agent. Omit scope, or pass waiting, for unresolved threads whose latest message is not from the agent. Pass all to include every thread.`}).annotate(E3,!0).annotate(T3,!1).annotate(S3,!0).annotate(w3,!0),Tfe=x3(`create_comment`,{parameters:yfe,success:f1,failure:mG,failureMode:`return`,description:`Create an agent review thread on the whole change (kind change, with a branch comparison and its tip for a branch review), a file or a code range. Stable optional IDs make retries idempotent.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),Efe=x3(`reply_to_comment`,{parameters:bfe,success:m1,failure:mG,failureMode:`return`,description:`Reply to a review thread. Stable optional messageId makes retries idempotent.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),Dfe=x3(`resolve_comment`,{parameters:xfe,success:g1,failure:mG,failureMode:`return`,description:`Resolve or reopen a review thread.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1).annotate(w3,!0);mfe(x3(`connect_review_agent`,{parameters:H$,success:B$,failure:mG,failureMode:`return`,description:`Associate this published review with your existing local T3 Code thread. Supply its exact threadId, never guess from a branch or title. The server verifies that the thread belongs to the published worktree. Owner feedback can then queue a notification in this session.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),x3(`acknowledge_feedback`,{parameters:U$,success:B$,failure:mG,failureMode:`return`,description:`Acknowledge receipt of the exact Porcelain feedback delivery before handling it. Only handle the batch if acknowledgementAccepted is true; false means it was already acknowledged. This is receipt, not resolution or implementation/merge authorization. Read the named revision and comments, then reply with stable message IDs.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),Sfe,Cfe,wfe,Tfe,Efe,Dfe);function Ofe(e,t){let n=new Map(e.map(e=>[e.path,e])),r=[];for(let e of t){let t=n.get(e.path);t&&(r.push(t),n.delete(e.path))}return[...r,...n.values()]}function A3(e,t){if(e.fingerprint===null||e.fingerprint===void 0)return`unreviewed`;let n=t.find(t=>t.path===e.path);return n?n.fingerprint===e.fingerprint?`reviewed`:`stale`:`unreviewed`}function j3(e,t){return t.find(t=>t.path===e.path)}function kfe(e,t,n){let r=n==null?null:new Set(n);return e.changes.flatMap(n=>{if(r&&!r.has(n.path))return[];let i=j3(n,t.marks);return[{...n,environmentId:e.environmentId,worktreeId:e.worktreeId,statusToken:e.statusToken,reviewStatus:A3(n,t.marks),...i?{mark:i}:{}}]})}function Afe(e,t,n){let r=n==null?null:new Set(n);return e.flatMap(e=>{if(r&&!r.has(e.path))return[];let n=j3(e,t.marks);return[{...e,reviewStatus:A3(e,t.marks),...n?{mark:n}:{}}]})}function jfe(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`WriteNotSentError`||e instanceof oQ||e.name===oQ.name)?e.message:`This review surface could not be loaded. Try again.`}function M3(e){return e.fingerprint!==null&&e.fingerprint!==void 0}function Mfe(e){return e.split(`/`).at(-1)??e}function Nfe(e,t,n){let r=encodeURIComponent(e.token),i={expires:e.expires,signature:e.signature},a=new URL(t),o=n===void 0?void 0:new URL(n);return o!==void 0&&(a.protocol!==o.protocol||a.host!==o.host)?new URL(`/remote-review-summaries/${r}?${new URLSearchParams({computer:`${a.protocol}//${a.host}`,...i})}`,n).href:new URL(`/review-summaries/${r}?${new URLSearchParams(i)}`,t).href}function Pfe(e,t){return!(Date.parse(e.expires)-t>jce)}function Ffe(e){let t=e.filter(e=>e.binary!==!0&&e.deleted!==!0),n=e.filter(e=>e.binary===!0).length,r=e.filter(e=>e.deleted===!0).length,i=t.reduce((e,t)=>e+t.ranges.reduce((e,t)=>e+t.endLine-t.startLine+1,0),0),a=[...t.length>0?[`${b4(i,`line`)} in ${b4(t.length,`file`)}`]:[],...n>0?[b4(n,`binary file`)]:[],...r>0?[b4(r,`removed file`)]:[]],o=a.at(-1);return o===void 0?null:a.length===1?o:`${a.slice(0,-1).join(`, `)} and ${o}`}function Ife(e){return!e||typeof e!=`object`||!(`source`in e)||!(`openLayer`in e)?null:e.source===`porcelain-summary`&&typeof e.openLayer==`number`&&Number.isInteger(e.openLayer)?e.openLayer:null}function Lfe(e){let t=[...e.matchAll(/\shref\s*=\s*(["'])#layer-(\d+)\1/gi)].map(e=>Number(e[2]));return[...new Set(t)].filter(e=>e>0)}var Rfe={kind:`worktree`};function zfe(e){return{kind:`branch`,base:e?.base?.ref??``,branch:e?.head.branch}}function Bfe(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function N3(e){return[...new Map(e.map(e=>[e.path,e])).values()]}function P3(e){let t={marked:[],skipped:[],failed:[]},n=[];for(let r of N3(e)){if(r.reviewStatus===`reviewed`){t.skipped.push({path:r.path,reason:`already-reviewed`});continue}if(!M3(r)||r.fingerprint===null||r.fingerprint===void 0){t.skipped.push({path:r.path,reason:`not-fingerprintable`});continue}n.push({path:r.path,fingerprint:r.fingerprint})}return{report:t,files:n}}function Vfe(e,t){return{...e,marked:[...e.marked,...t.marked],failed:[...e.failed,...t.conflicts.map(e=>({path:e.path,error:Error(e.reason===`missing`?`That file is no longer in the change list.`:`The file changed since it was shown.`)}))]}}function F3(e){let t=e.failed.length,n=e.skipped.filter(e=>e.reason===`not-fingerprintable`).length,r=e.skipped.length-n;return[e.marked.length>0?`Marked ${b4(e.marked.length,`file`)}.`:`No files marked.`,n>0?`Skipped ${n}.`:``,r>0?`${r} already reviewed.`:``,t>0?`${t} failed.`:``].filter(Boolean).join(` `)}function I3(e){return`${e.join(`, `)} cannot be marked reviewed because ${y4(e.length,`its fingerprint is`,`their fingerprints are`)} unavailable (too large or unreadable).`}function L3(e){return`${I3(e)} This stop stays open until every file can be marked reviewed.`}function Hfe(e){let{files:t,report:n}=P3(e),r=n.skipped.filter(e=>e.reason===`not-fingerprintable`).map(e=>e.path);return{eligible:t.length,unavailable:r,blocked:r.length>0&&t.length===0,action:r.length===0?void 0:t.length>0?`Mark available files reviewed`:`Review unavailable`,explanation:r.length>0?L3(r):void 0}}function Ufe(e){let t=e.skipped.filter(e=>e.reason===`not-fingerprintable`).map(e=>e.path);if(t.length>0)return{title:`Some files cannot be marked reviewed`,description:`${F3(e)} ${L3(t)}`,type:e.failed.length>0?`error`:`warning`};if(e.failed.length>0)return{title:`Some files changed before they were marked`,description:F3(e),type:`error`}}function Wfe(e){let t=N3(e),n=t.filter(M3),r=n.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0&&e.reviewStatus!==`reviewed`),i=n.filter(e=>e.reviewStatus===`reviewed`),a=t.length-n.length,o=r.length===0&&i.length>0,s=a>0?`${n.length} reviewed · ${a} unavailable`:`All reviewed`,c=n.length===0?null:o?`Unmark all`:r.length===0?s:null;return{entries:t,reviewedPaths:i.map(e=>e.path),unmarking:o,blocked:n.length===0||r.length===0&&i.length===0,label:n.length===0?`No files can be marked reviewed`:c??`Mark all ${b4(r.length,`file`)} reviewed`,text:n.length===0?`No reviewable files`:c??`Mark all reviewed`}}function Gfe(e,t){return t===`reviewed`?`Unmark ${e} as unreviewed`:t===`stale`?`Mark changed ${e} as reviewed`:`Mark ${e} as reviewed`}function Kfe(e,t){return!e?.fingerprint||t?null:e.reviewed?{kind:`unmark`,path:e.path}:{kind:`mark`,input:{path:e.path,fingerprint:e.fingerprint}}}function qfe(e){return e.kind===`branch`?{kind:`branch`,branch:e.branch}:{kind:`worktree`}}function Jfe(e){return[`reviewed`,...e.kind===`branch`?[`branch`,e.branch??``]:[]]}function Yfe(e,t){let n=new Map(e.marks.map(e=>[e.path,e]));for(let e of t)for(let t of e.changes)t.fingerprint?n.set(t.path,{path:t.path,fingerprint:t.fingerprint,reviewedAt:e.reviewedAt}):n.delete(t.path);return{...e,marks:[...n.values()]}}function Xfe(e){let t=o3(e),n=t.failing+t.passing;return t.failing>0?{key:`checks`,value:`${t.failing} of ${n} failing`,label:`${t.failing} of ${b4(n,`check`)} failing`,tone:`failing`}:n===0?{key:`checks`,label:`No checks attached`,value:`None attached`,tone:`attention`}:e?.current===!1?{key:`checks`,value:`Outdated`,label:`Checks ran before the latest changes`,tone:`attention`}:{key:`checks`,label:`${b4(n,`check`)} passed`,value:`${n} passed`,tone:`ok`}}function Zfe(e){if(e===null)return{key:`unexplained`,label:`No review published`,value:`No review`,tone:`attention`};let t=Ffe(e.notExplained);return t===null?{key:`unexplained`,label:`Every change explained`,value:`All explained`,tone:`ok`}:{key:`unexplained`,label:`${t} not explained`,value:t,tone:`attention`}}function Qfe(e,t){if(e===0&&t===0)return[{key:`comments`,label:`No open comments`,value:`None open`,tone:`ok`}];let n=[];return e>0&&n.push({key:`comments`,label:`${b4(e,`comment`)} waiting on the agent`,value:`${e} awaiting agent`,tone:`attention`}),t>0&&n.push({key:`replies`,label:`${b4(t,`comment`)} waiting on you`,value:`${t} awaiting you`,tone:`attention`}),n}function $fe(e){let t=e.files.length,n=e.files.filter(e=>e.reviewStatus===`reviewed`).length,r=e.files.filter(e=>e.reviewStatus===`stale`).length,i=i3(e.threads),a=e.explains?Zfe(e.review):null;return[t===0?{key:`files`,label:`No changed files`,value:`None changed`,tone:`ok`}:{key:`files`,label:`${n} of ${b4(t,`file`)} reviewed`,value:`${n} of ${t} reviewed`,tone:n===t?`ok`:`attention`},r===0?{key:`stale`,label:`No marks went stale`,value:`None stale`,tone:`ok`}:{key:`stale`,label:`${b4(r,`mark`)} changed since reviewed`,value:`${r} changed`,tone:`attention`},...a===null?[]:[a],...Qfe(i.awaitingAgent,i.awaitingYou),Xfe(e.review?.proof)]}function R3(e,t){return e?`Unmark as reviewed`:t?`Mark as reviewed again`:`Mark as reviewed`}function epe(e){switch(e.kind){case`file`:return[{id:`review`,label:R3(e.status===`reviewed`,e.status===`stale`),disabled:!e.canReview},{id:`comment`,label:`Comment`},{id:`open`,label:`Open diff`},{id:`open-to-side`,label:e.sideLabel},{id:`open-file`,label:`Open file`},{id:`timeline`,label:`Show timeline`},{id:`copy-relative`,label:`Copy relative path`},...e.canDiscard?[{id:`discard`,label:`Discard`,destructive:!0}]:[]];case`decision`:{let t=Hfe(e.files);return[{id:`open`,label:`Open`},{id:`review`,label:e.reviewed?R3(!0,e.stale):t.action??R3(!1,e.stale),disabled:!e.settled||e.pending||t.blocked}]}case`section`:return[{id:`open`,label:`Open`}];case`group`:return[{id:`expand-all`,label:`Expand all`},{id:`collapse-all`,label:`Collapse all`}];case`thread`:return[...e.canReveal?[{id:`reveal`,label:`Show in the code`}]:[],...e.resolved?[]:[{id:`reply`,label:`Reply`,disabled:e.pending}],{id:`resolution`,label:e.resolved?`Reopen`:`Resolve`,disabled:e.pending}];default:return e}}var z3=K.check(rx()),tpe=Cx.check(ux()).check(lx({minimum:1,maximum:2**53-1})),npe=q({reviewId:z3,environmentId:gx,host:gx,protocol:W(h$),revision:W(tpe),decision:W(z3)});function rpe(e){try{let t=new URL(e,`https://porcelain.fabiofiorita.com`);if(t.origin!==`https://porcelain.fabiofiorita.com`||t.username||t.password||t.hash||!/^\/open\/reviews\/[^/]+$/.test(t.pathname))return;let n=new Set([`environment`,`host`,`protocol`,`revision`,`decision`]);for(let e of t.searchParams.keys())if(n.has(e)&&t.searchParams.getAll(e).length!==1)return;let r=t.searchParams.get(`revision`);if(r!==null&&!/^[1-9]\d*$/.test(r))return;let i=xb(npe)({reviewId:decodeURIComponent(t.pathname.slice(14)),environmentId:t.searchParams.get(`environment`),host:t.searchParams.get(`host`),...t.searchParams.has(`protocol`)?{protocol:t.searchParams.get(`protocol`)}:{},...r===null?{}:{revision:r},...t.searchParams.has(`decision`)?{decision:t.searchParams.get(`decision`)}:{}});if(!/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*|\[[a-fA-F0-9:]+\])(?::[1-9]\d{0,4})?$/.test(i.host))return;let a=i.protocol??`https`,o=new URL(`${a}://${i.host}`);return o.host!==i.host.toLowerCase()&&o.host!==i.host.toLowerCase().replace(a===`http`?/:80$/:/:443$/,``)?void 0:{...i,webUrl:ipe(i)}}catch{return}}function ipe(e){let t=new URL(`/reviews/${encodeURIComponent(e.reviewId)}`,`${e.protocol??`https`}://${e.host}`);return e.revision!==void 0&&(t.pathname+=`/${e.revision}`),e.decision!==void 0&&(e.revision===void 0?t.searchParams.set(`decision`,e.decision):t.pathname+=`/decisions/${encodeURIComponent(e.decision)}`),t.toString()}function ape(e){try{let t=new URL(e);return t.protocol!==`porcelain-desktop:`||t.host!==`open`||t.username||t.password||t.hash?void 0:rpe(`https://porcelain.fabiofiorita.com/open${t.pathname}${t.search}`)}catch{return}}function ope(e,t){return e.replace(/^claude mcp add /,`${t} mcp add `)}function B3(e){if(!e.startsWith(`Mozilla/`))return e||`Unknown platform`;let t=/Edg(?:e|A|iOS)?\//.test(e)?`Edge`:/(?:Firefox|FxiOS)\//.test(e)?`Firefox`:/(?:Chrome|CriOS)\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:`Browser`,n=/iPad/.test(e)?`iPadOS`:/iPhone|iPod/.test(e)?`iOS`:/Android/.test(e)?`Android`:/Windows/.test(e)?`Windows`:/Macintosh|Mac OS X/.test(e)?`macOS`:/CrOS/.test(e)?`ChromeOS`:/Linux/.test(e)?`Linux`:void 0;return n?`${t} on ${n}`:t}function spe(e){let t=B3(e);return t.startsWith(`iPadOS`)?`tablet`:/^(?:iOS|Android|Mobile)\b/.test(t)?`phone`:`browser`}var cpe=new Intl.ListFormat(`en-GB`,{type:`conjunction`});function lpe(e,t){let n=Z0.filter(t=>e.routes[t].status.kind===`on`).map(e=>Q0[e]);return[n.length===0?`No way in on`:cpe.format(n),b4(t,`device`)].join(` · `)}function upe(e){let[t=``,...n]=e.split(/(?<=^\S+)(?=\s)/),r=[{text:t,kind:`program`}];for(let e of n.join(``).split(/('[^']*')/))e!==``&&r.push({text:e,kind:e.startsWith(`'`)?`quoted`:`plain`});return r}function dpe(e,t,n){let r=bu(),{timeoutMs:i,...a}=e,o=AW(Ju($u(GW.layer),yT,$u(Z2.layer),n),{memoMap:t}),s=OE({memoMap:o.memoMap}),c=!1,l=Vp(wp(kf(()=>(c=!0,Eu(r,su).pipe(xp(o.disposeEffect)))).pipe(Op))),u=()=>(c=!0,zp(l));return{connection:Pe({runtime:o,atoms:s,scope:r,isClosed:()=>c||r.state._tag===`Closed`,close:u,...a,request:Gp(`Connection.request`)(function*(e,t){if(c)return yield*Tp;let n=yield*(t?yp(Pp(e,t),pS,hS):e).pipe(ap({duration:i,orElse:()=>Tp}),Pp(r));return yield*pS(n).pipe(xp(hS(n)),Bf(e=>c?Tp:B(e)))})}),close:u,closeEffect:l}}var fpe=X(e=>e.atoms(Bu).fn(t=>H(function*(){(yield*gT).invalidateUnsafe([f2.review(e.environmentId,t)])})));function ppe(e){return()=>void 0}function mpe(e){return()=>void 0}function hpe(e){}function gpe(){return()=>void 0}var V3=class e extends tr()(`@porcelain/web/DesktopHost`){static layer=Vu(e,()=>({isDesktopShell:!1,hasAppUpdateFeed:!1,canPickProject:e=>!1,pickProject:Gp(`Desktop.pickProject`)(function*(e){return yield*U(new KW({message:`The native project picker is unavailable for this computer.`}))}),mcpConfiguration:kf(()=>U(new KW({message:`The desktop bridge is unavailable.`}))),checkUpdate:H(function*(){return In()}),installUpdate:kf(()=>U(new KW({message:`The native app updater is unavailable.`}))),updateStates:eT({status:`idle`})}))};function _pe(){}var vpe=X(e=>bE(t=>{t.addFinalizer(mpe(e))})),H3={isActive:()=>document.visibilityState!==`hidden`&&!0,subscribe:e=>{let t=ppe(e),n=()=>e();return window.addEventListener(`focus`,n),window.addEventListener(`online`,n),window.addEventListener(`offline`,n),document.addEventListener(`visibilitychange`,n),()=>{t(),window.removeEventListener(`focus`,n),window.removeEventListener(`online`,n),window.removeEventListener(`offline`,n),document.removeEventListener(`visibilitychange`,n)}}};function U3(e){return e.kind===`online`?`secondary`:e.kind===`checking`?`outline`:`destructive`}var ype=VW.of({read:()=>Df({try:async()=>{{let e=localStorage.getItem(`porcelain.remotes`);return{remotes:e===null?[]:l0(JSON.parse(e)),missingCredentials:[]}}},catch:e=>new $l(e)}),write:({remotes:e})=>Df({try:async()=>{let t=i0(e);localStorage.setItem(`porcelain.remotes`,t)},catch:e=>new $l(e)})});function bpe(e,t,n){let r=new Map;for(let t of[...e.state.value.operations.values()])t.receipt&&I4(t.receipt)||r.set(JSON.stringify([t.projectId,t.worktreeId]),{projectId:t.projectId,worktreeId:t.worktreeId,paths:new Set});let i=[...n];for(let e of[...i.filter(e=>!e.reviewId),...i.filter(e=>e.reviewId)]){if(e.projectId===void 0||e.reviewId&&!t?.projects.some(t=>t.id===e.projectId&&t.available&&t.worktrees.some(t=>t.id===e.worktreeId&&t.available)))continue;let n=JSON.stringify([e.projectId,e.worktreeId]),i=r.get(n)??{projectId:e.projectId,worktreeId:e.worktreeId,paths:new Set};for(let t of e.paths)t!==``&&i.paths.add(t);r.set(n,i)}return{projects:t?.projects.map(e=>e.id).slice(0,128)??[],worktrees:[...r.values()].slice(0,32).map(e=>({projectId:e.projectId,worktreeId:e.worktreeId,paths:[...e.paths].slice(0,64)}))}}var xpe=Gp(`Live.connect`)(function*(e,t){let n=yield*VT,r=yield*Z2,i=yield*N4,a=yield*U4,o=yield*gT,s=yield*vp(wu(e.scope,`sequential`),e=>Eu(e,su)),c=yield*OW(yield*SW().pipe(hp(yu,s)))(),l=yield*up(),u=Gp(`Live.applyNotice`)(function*(t){if(t.type===`git-action`)return yield*a.refresh(t.receipt);if(t.type===`inventory`&&(yield*o.invalidate([f2.inventory(e.environmentId),f2.reviewGitSettings(e.environmentId)])),t.type===`worktree`){let n=yield*r.reviewsFor(t);yield*o.invalidate([f2.worktreeInventory(e.environmentId),f2.projectReviews(e.environmentId,t.projectId),...n.map(t=>f2.durableReview(e.environmentId,t))])}t.type===`project`&&t.change===`preferences`&&(yield*o.invalidate([f2.filePreferences(e.environmentId,t.projectId)])),yield*o.invalidate(V4(e.environmentId,t))}),d=()=>{for(let t of i.state.value.operations.values())t.receipt&&I4(t.receipt)||c(Symbol(),H(function*(){let n=yield*G4(e,{...t}).pipe(pp(l));yield*Y0(e),yield*a.refresh(n),yield*i.accept(n)}).pipe(np,Yf))},f=yield*e.liveUpdates.connect({onNotice:t=>{e.isClosed()||s.state._tag===`Closed`||(t.type===`inventory`&&e.onStatusChange?.(),t.type===`ready`&&d(),c(Symbol(),H(function*(){yield*u(t),t.type===`git-action`&&!e.isClosed()&&s.state._tag!==`Closed`&&(yield*i.accept(t.receipt))}).pipe(Qf(()=>V(()=>{!e.isClosed()&&s.state._tag!==`Closed`&&d()})),Yf)))},onReconnect:()=>{!e.isClosed()&&s.state._tag!==`Closed`&&(e.onStatusChange?.(),c(Symbol(),o.invalidate([f2.environment(e.environmentId)])))},onUnauthorized:()=>{e.isClosed()||s.state._tag===`Closed`||(e.onStatusChange?.(),t?t():c(Symbol(),o.invalidate([f2.inventory(e.environmentId)])))}}).pipe(hp(yu,s)),p=``,m=H(function*(){if(e.isClosed()||s.state._tag===`Closed`)return;let t=bpe(i,Un(sS(n.get(R2(e)))),Qm(yield*r.snapshot)),a=JSON.stringify(t);a!==p&&(p=a,f.subscribe(t))}),h=()=>{!e.isClosed()&&s.state._tag!==`Closed`&&c(`subscription`,Hf(Rf,m),{onlyIfMissing:!0})};yield*vp(V(()=>n.subscribe(R2(e),h)),e=>V(e)).pipe(hp(yu,s)),yield*vp(V(()=>i.state.subscribe(h)),e=>V(()=>e?.())).pipe(hp(yu,s)),c(Symbol(),pT(r.changes,()=>V(h))),h()}),Spe=X(e=>e.atoms(t=>Ju(t(v2(e).layer),t(W4(e).layer),Gu(e.runtime.contextEffect)))),Cpe=X(({connection:e,onUnauthorized:t})=>Spe(e).atom(xpe(e,t)).pipe(uE(0))),wpe=bE($x(void 0)),Tpe=()=>Aj(`idle`);function Epe(e){return e instanceof S0?e.status===401:e instanceof tM||QO(e)?e.reason._tag===`SocketCloseError`&&e.reason.code===4001:!1}function W3(e,t=pr(),n){let r=Tpe();return{state:r,connect:Gp(`LiveUpdates.connect`)(function*({onNotice:i,onReconnect:a,onUnauthorized:o}){let s=yield*PD({projects:[],worktrees:[]}),c=yield*ed,l=yield*YS(1),u=!1,d=sC(l);if(n?.activity){let e=n.activity,t=e.isActive(),r=!1,i=c.monotonicTimeNanosUnsafe();yield*vp(V(()=>e.subscribe(n=>{n&&(r=n===`suspend`);let a=!r&&e.isActive(),o=c.monotonicTimeNanosUnsafe();!a&&t&&(i=o),u||=n===`resume`,a&&(u||=!t&&o-i>=BigInt(3e4)*1000000n,ZS(l,void 0)),t=a})),e=>V(e))}let f=yield*YS(1),p=0,m=500,h=_p(H(function*(){r.set(p===0?`connecting`:`reconnecting`);let t=yield*e,n=yield*mu(),o=yield*mu(),c=yield*mu(),l=yield*uoe({retryPolicy:_f.pipe(vf(),mf(({input:e})=>Qte(c,e)),hf({times:0}))}).pipe(hp(KO,t),hp(sM,cM)),h=yield*pM(aq,{disableTracing:!0}).pipe(hp(gM,l)),g=(yield*OC(1)).withPermit(Bf(FD(s),e=>h.follow(e))),_=h.notices(void 0).pipe(pT(e=>H(function*(){if(e.type===`ready`){yield*_u(o,void 0);return}i(e)}))),v=H(function*(){yield*hu(o),yield*g,p>0&&a(),p+=1,m=500,r.set(`connected`),yield*_u(n,void 0),i({type:`ready`})}).pipe(rp(P0),Hf(Nf));yield*Cf([_,hu(n).pipe(Hf(Ap(sC(f).pipe(Hf(g))))),Ap(H(function*(){yield*d,yield*hu(n);let e=u;u=!1,yield*g.pipe(rp(wce)),e&&(a(),i({type:`ready`}))})),v],{concurrency:`unbounded`}).pipe(sp(hu(c)))})),g=_p(H(function*(){for(yield*bp(()=>V(()=>r.set(`idle`)).pipe(Hf(rC(f)),Hf(rC(l))));;){let e=yield*Gf(h);if(lu(e)&&Epe(Vl(e.cause))&&!(yield*n?.recoverUnauthorized?.()??B(!1)))return r.set(`unauthorized`),o(),yield*Nf;r.set(p===0?`connecting`:`reconnecting`),yield*op(m).pipe(sp(d)),m=Math.min(m*2,Cce)}}));return yield*Rf.pipe(Hf(g),pp(t),Qf(e=>Wl(e)?Af:qp(`Live updates stopped unexpectedly`)),Fp),{subscribe(e){f.state._tag!==`Done`&&(Vp(ID(s,e)),ZS(f,void 0))}}})}}function Dpe(e,t){let n=Aj(void 0),r=e0(e),i=new Set,a=()=>{i.clear(),n.set(void 0)},o=e=>{i.add(e.address),n.value?.address===e.address&&n.set(void 0)},s=TC(1),c=Gp(`RemoteRoute.select`)((o=!1)=>H(function*(){if(o&&a(),n.value)return n.value;r.every(e=>i.has(e.address))&&i.clear();let s=0;for(let a of r){if(i.has(a.address))continue;let r=yield*V0(a,e.environmentId,t).pipe(ip(F0));if(zn(r)&&a0(e,r.value).kind===`online`)return n.set(a),a;zn(r)&&r.value.kind===`unauthorized`&&s++}return i.clear(),s===r.length?yield*U(new S0({status:401,message:`This computer no longer accepts the saved connections. Pair it again.`})):yield*U(new KW({message:`None of this computer’s saved connections could be reached and authorized.`}))}).pipe(kC(s))),l=e=>x0(e.address,e.credential,t);return{active:n,reset:a,failed:o,select:c,transport:async(e,t)=>{let n={...t?.signal?{signal:t.signal}:{}},i=await zp(c(),n),a=t?.method===void 0||t.method===`GET`||t.method===`HEAD`,s=async n=>{try{let r=await l(n)(e,t);return r.status===401&&o(n),r}catch(e){throw t?.signal?.aborted||o(n),e}},u;try{u=await s(i)}catch(e){if(!a||t?.signal?.aborted||r.length===1)throw e;let o=await zp(c(),n);if(o.address===i.address)throw e;return s(o)}if(u.status!==401||!a||r.length===1)return u;let d=await zp(c().pipe(lne),n);return zn(d)&&d.value.address!==i.address?s(d.value):u},transportFor:l}}function Ope(e,t,n,r,i){return W3(H(function*(){let i=r?yield*r.select():void 0;return i&&r&&(yield*bp(e=>V(()=>{lu(e)&&!Wl(e.cause)&&r.failed(i)}))),yield*H(function*(){let{ticket:a}=yield*H(function*(){return yield*T0((yield*R0).session.issueLiveTicket())}).pipe(fp(R0.layer(i&&r?r.transportFor(i):t))),o=new URL(i?.address??e);return yield*n(`${o.protocol===`https:`?`wss:`:`ws:`}//${o.host}${P2({query:{ticket:a}})}`)}).pipe(rp(P0))}),void 0,{...i?{activity:i}:{},...r?{recoverUnauthorized:()=>r.select().pipe(cp({onSuccess:()=>!0,onFailure:e=>!(e instanceof S0&&e.status===401)}))}:{}})}function G3(e,t,n){let{connection:r}=dpe(e,n,Yu($u(Zue),T2.layer).pipe(Qu(t))),i=Pe({...r,get address(){return e.activeRoute?.value?.address??e.address},...e.activeRoute?{activeRoute:e.activeRoute}:{},liveUpdates:e.liveUpdates,...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},operations:r.runtime.runSync(N4)});return r.runtime.runSync(T2).adopt(i),i}function kpe(e,t,n){let r=Dpe({...e,name:``},e.send),i=r.transport;return G3({environmentId:e.environmentId,address:e.address,transport:i,cacheIdentity:[e.address,e.deviceId??``],activeRoute:r.active,liveUpdates:Ope(e.address,i,e.socket,r,e.activity),...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},timeoutMs:e.timeoutMs},t,n)}function K3(e){return ck(e).pipe(hp(sk,e=>new WebSocket(e)))}function Ape(e){return W3(K3(`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${P2({query:{}})}`),void 0,{activity:e})}function jpe(e){return e instanceof kJ?`This file is binary or uses an unsupported text encoding.`:e instanceof SJ?`This file is too large to display as text.`:null}var Mpe=X(({connection:e,scope:t,path:n})=>n4({connection:e,scope:t},[`text`,n],e=>e.files.readTextFile({params:{worktreeId:t.worktreeId},query:{path:n}}).pipe(Xf(e=>{let t=jpe(e);return t?B({kind:`unreadable`,reason:t}):U(e)})),e=>`reason`in e||e.worktreeId===t.worktreeId&&e.path===n,[n])),q3=X(({connection:e,scope:t,path:n})=>n4({connection:e,scope:t},[`directory`,n],e=>e.files.listDirectory({params:{worktreeId:t.worktreeId},query:{path:n}}),e=>e.worktreeId===t.worktreeId,[n]).pipe($2));function J3({connection:e,scope:t,paths:n}){return n.map(n=>q3({connection:e,scope:t,path:n}))}var Npe=X(e=>bE(t=>J3(e).map(e=>t(e)))),Ppe=X(e=>PE((t,n)=>{for(let t of J3(e))n.refresh(t)})),Fpe=X(e=>n4(e,[`paths`],t=>t.files.listWorktreePaths({params:{worktreeId:e.scope.worktreeId}}),t=>t.worktreeId===e.scope.worktreeId)),Ipe=X(({connection:e,scope:t,path:n})=>Q2(e,t,[`asset`,n],H(function*(){return yield*(yield*W0(e)).request(e=>e.files.readFileAsset({params:{worktreeId:t.worktreeId},query:{path:n}}))}),K0(e),[n]));function Lpe(e,t,n){let r=e===`file`?`untitled`:`new-folder`,i=n=>`${t}${n}${e===`directory`?`/`:``}`;if(!n(i(r)))return i(r);let a=2;for(;n(i(`${r}-${a}`));)a+=1;return i(`${r}-${a}`)}function Rpe(e,t){let n=e.lastIndexOf(`/`)+1,r=e.slice(n),i=r.lastIndexOf(`.`),a=i>0?r.slice(0,i):r,o=i>0?r.slice(i):``,s=t=>`${e.slice(0,n)}${a} copy${t}${o}`;if(!t(s(``)))return s(``);let c=2;for(;t(s(` ${c}`));)c+=1;return s(` ${c}`)}function zpe(e){return e.filter(t=>!e.some(e=>e!==t&&e.endsWith(`/`)&&t.startsWith(e)))}function Bpe(e,t){return!e.some(e=>e.endsWith(`/`)&&t.startsWith(e))}function Y3(e){return e.replace(/\/$/,``).split(`/`).at(-1)??e}function Vpe(e){return e.filter(e=>e.endsWith(`/`))}function Hpe(e){return e.split(`/`).slice(0,-1).map((e,t,n)=>`${n.slice(0,t+1).join(`/`)}/`)}function Upe(e){let t=[];return e.folder&&!e.link&&(t.push({id:`new-file`,label:`New file`}),t.push({id:`new-folder`,label:`New folder`})),e.link||t.push({id:`rename`,label:`Rename`}),e.openable&&!e.folder&&!e.link&&t.push({id:`duplicate`,label:`Duplicate`}),e.openable&&(t.push(e.changed?{id:`open-diff`,label:`Open diff`}:{id:`open`,label:`Open`}),e.openToSideLabel!==void 0&&t.push({id:`open-to-side`,label:e.openToSideLabel}),e.changed&&t.push({id:`open-file`,label:`Open file`}),!e.folder&&!e.link&&t.push({id:`timeline`,label:`Show timeline`})),e.pinned!==void 0&&t.push({id:`pin`,label:`${e.pinned?`Unpin`:`Pin`} ${e.folder?`folder`:`file`}`}),t.push({id:`hide`,label:e.hiddenEntry===null?e.folder?`Hide folder`:`Hide file`:e.ownHidden?e.folder?`Show folder`:`Show file`:`Show ${e.hiddenName}`}),t.push({id:`copy-relative`,label:`Copy relative path`}),t.push({id:`copy-full`,label:`Copy full path`}),t.push({id:`trash`,label:`Move to trash`}),t}function Wpe(e,t){return Upe({...t,folder:e?.kind===`directory`,link:e?.kind===`symlink`||e?.kind===`submodule`,openable:e?.kind===`file`})}var X3=class e extends tr()(`@porcelain/client/FileEdits`){static layer(t,n){return Uu(e,H(function*(){let e=yield*W0(t),r=yield*T2,i=yield*gT;return{execute:Gp(`Files.edit`)(function*(a){let o=`${JSON.stringify([n.projectId,n.worktreeId])}/`,s=a.kind===`move`||a.kind===`trash`?[...r.entries(t)].filter(([e])=>e===`${o}${a.path}`||e.startsWith(`${o}${a.path}/`)):[];return yield*t.request(yp(V(Symbol),i=>kp(o=>H(function*(){if(yield*o(Y0(t)),s.some(([,e])=>e.state.value.owner!==null))return yield*U(new KW({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!e.claim(i))return yield*U(new KW({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!(yield*o(e.save())))return yield*U(new KW({message:`Save or discard the unsaved draft before moving this entry.`}));let c={worktreeId:n.worktreeId},l=yield*o(e.request(e=>{switch(a.kind){case`write`:return e.files.editFile({params:c,payload:a});case`create`:return e.files.editFile({params:c,payload:a});case`move`:return e.files.editFile({params:c,payload:a});case`copy`:return e.files.editFile({params:c,payload:a});case`trash`:return e.files.editFile({params:c,payload:a})}}));return yield*Y0(t,l.path===(a.kind===`move`||a.kind===`copy`?a.destination:a.path)),(a.kind===`move`||a.kind===`trash`)&&(yield*r.relocate(t.environmentId,s.map(([e])=>e),a,n)),l})),e=>H(function*(){for(let[,t]of s)t.release(e);t.isClosed()||(yield*i.invalidate(V4(t.environmentId,{type:`worktree`,...n,change:`files`})))})))})}}))}},Z3=X(({connection:e,scope:t})=>e.atoms(n=>Qu(X3.layer(e,t),Yu(n(K0(e).layer),T2.layer)))),Gpe=X(e=>Z3(e).fn(e=>X3.use(t=>t.execute(e)),{concurrent:!0})),Kpe=X(e=>E2(e.connection).atom(H(function*(){let t=yield*T2,n=yield*VT;return yield*t.retain({...e,environmentId:e.connection.environmentId,writer:{write:({path:r,text:i,expectedFingerprint:a})=>{let o=Z3({connection:t.connection(e.connection),scope:e.scope});return yp(V(()=>n.mount(o)),()=>H(function*(){let e=yield*yr(yield*UT(n,o),X3).execute({kind:`write`,path:r,text:i,expectedFingerprint:a});return e.contentFingerprint?e.contentFingerprint:yield*U(new KW({message:`The server did not confirm the saved version.`}))}),e=>V(e))}}})}))),qpe=Gp(`Files.moveEntries`)(function*(e,t,n){for(let r of zpe(e)){let e=`${t}${Y3(r)}`;r.replace(/\/$/,``)!==e.replace(/\/$/,``)&&(yield*n(r,e))}}),Jpe=Gp(`Files.completeDraft`)(function*(e,t){(yield*e.save())&&t()}),Q3=X(e=>{class t extends tr()(`@porcelain/client/PreviewAssets`){static layer=Uu(t,H(function*(){let t=yield*W0(e);return{read:Gp(`PreviewAssets.read`)(function*(n,r,i){let a=yield*t.request(e=>e.files.readPreviewAssets({params:{worktreeId:n.worktreeId},payload:{document:r,paths:[...i]}}));return yield*Y0(e),new Map(a.assets.map(e=>[e.path,e.kind===`asset`?e:null]))})}}))}return t}),Ype=class extends Y()(`HtmlPreviewUnavailable`,{}){get message(){return`Could not prepare the HTML preview. Try again.`}},$3=class extends tr()(`@porcelain/client/HtmlPreviewPlatform`){},Xpe=X(({connection:e,platform:t})=>e.atoms(n=>Qu(Yu(Q3(e).layer,t),n(K0(e).layer)))),Zpe=X(({connection:e,scope:t,path:n,html:r,platform:i})=>Q2(e,t,[`html-preview`,n,r],H(function*(){let i=yield*$3,a=yield*Q3(e);return yield*i.render(r,n,e=>a.read(t,n,e))}),Xpe({connection:e,platform:i}),[n]));function Qpe(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}var $pe=Gp(`HtmlPreview.collectAssets`)(function*(e,t,n){let r=new Map,i=0,a=e;for(let e=0;e<8;e+=1){let e=[...new Set(a)].filter(e=>!r.has(e));if(e.length===0)return r;let o=64-r.size;if(o<=0){for(let t of e)r.set(t,null);return r}let s=e.slice(0,o);for(let t of e.slice(o))r.set(t,null);let c=yield*t(s),l=[];for(let e of s){let t=c.get(e)??null;if(t===null){r.set(e,null);continue}if(i+=t.base64.length,i>29360128){r.set(e,null);continue}r.set(e,t),t.mediaType===`text/css`&&l.push(...n(Qpe(t),e))}a=l}return r}),eme=X(e=>K0(e).atom(G0(e,e=>e.gitActions.listCommitModels())).pipe(uE(I0),YE({staleTime:I0,revalidateOnFocus:!1})));function tme(e){return eme(e)}var e6=X(({connection:e,scope:t})=>K0(e).fn(Gp(`GitActions.generateCommitDraft`)(function*({lifetime:n,...r}){let i=yield*(yield*W0(e)).request(e=>e.gitActions.generateCommitDraft({params:{worktreeId:t.worktreeId},payload:r}),n);return yield*Y0(e),i}),{concurrent:!0})),nme=X(({connection:e,scope:t})=>K0(e).fn(Gp(`GitActions.dismissInterrupted`)(function*(n){yield*(yield*W0(e)).request(e=>e.gitActions.dismissInterruptedGitAction({params:{worktreeId:t.worktreeId,requestId:n}})),yield*Y0(e),yield*vT([f2.reviewSurface(e.environmentId,t,[`changes`])])}))),rme=X(e=>bE(H(function*(){let t=yield*VT,n=e6(e);return Gp(`CommitDraft.submit`)(function*(e,r){return t.set(n,{...e,lifetime:r}),yield*UT(t,n,{suspendOnWaiting:!0})})})));function t6(e,t=[],n,r=t.length>0){let i=new Set(t);return{headOid:e.headOid??void 0,inProgress:e.inProgress??void 0,mergeHeadOid:e.mergeHeadOid??void 0,branch:e.branch?.name??void 0,...n===void 0?{}:{upstreamOid:n},...r?{files:(e.files??[]).flatMap(e=>i.has(e.path)&&e.fingerprint!==null&&e.fingerprint!==void 0?[{path:e.path,fingerprint:e.fingerprint}]:[])}:{}}}var n6=e=>![`succeeded`,`no-change`].includes(e.state),r6=e=>e.message??(e.reason?e.reason.replaceAll(`_`,` `).toLowerCase():`Git ${e.state}`),i6=e=>e.state===`rejected`&&e.reason===`CHANGED_SINCE_LOOKED`;function a6(e){return e instanceof Error?e.message:`Git could not complete this action. Check the current state and try again.`}var o6=e=>t=>V(()=>{Wl(t)||e.setError(Vl(t))}),ime=Gp(`CommitForm.generate`)(function*(e,t,n=e.paths){let{model:r,working:i,setBusy:a,setError:o,generator:s,status:c,setDrafted:l,setDone:u,setActiveGroup:d,setMessage:f,setGroups:p}=e;if(!r||!n.length||i)return;a(!0),o(null),yield*bp(()=>V(()=>a(!1)));let m=yield*s.submit({mode:t,model:r,paths:n,expectedStatusToken:c.statusToken});l(t,m.expectedFiles),u(new Set),d(null),t===`message`?(f(m.groups[0]?.message??``),p(null)):p(m.groups.map(t=>({...t,id:e.createId()})))},_p,(e,t)=>e.pipe(Qf(o6(t)))),ame=Gp(`CommitForm.commit`)(function*(e){let{working:t,uncertain:n,setBusy:r,setError:i,currentMessage:a,mode:o,commitAction:s,paths:c,status:l,groups:u,done:d,ownHead:f,onBusy:p,setActiveGroup:m,git:h,setOwnHead:g,setDone:_}=e;if(t||n||(r(!0),i(null),yield*bp(()=>V(()=>r(!1))),o===`groups`&&!u?.length))return;let v=s===`amend`?[{id:`single`,message:a,paths:c}]:o===`groups`&&u?u.filter(e=>!d.has(e.id)):[{id:`single`,message:a,paths:c}],y=f??l.headOid??null;p(!0),yield*bp(()=>V(()=>p(!1)));for(let e of v){if(!e.message.trim()||s!==`amend`&&l.inProgress!==`merge`&&!e.paths.length)return yield*U(new $l(void 0,`Give every commit a message and at least one file.`));m(e.id);let t=yield*h.run({action:s,message:e.message,paths:e.paths},t6({...l,headOid:y},l.inProgress===`merge`?l.files?.map(e=>e.path)??[]:e.paths,void 0,!0));if(n6(t))return yield*U(new $l(void 0,r6(t)));t.result?.headOid&&(y=t.result.headOid,g(y)),_(t=>new Set([...t,e.id])),m(null)}},_p,(e,t)=>e.pipe(Qf(o6(t)))),ome=Gp(`CommitForm.lookAgain`)(function*(e){let{onLookAgain:t,working:n,setBusy:r,setError:i,git:a,setOwnHead:o}=e;t&&!n&&(r(!0),i(null),yield*bp(()=>V(()=>r(!1))),yield*t,yield*a.startNew(),o(null))},_p,(e,t)=>e.pipe(Qf(o6(t)))),sme=Gp(`CommitForm.recover`)(function*(e){let{setError:t,git:n,activeGroup:r,setDone:i,setActiveGroup:a,setOwnHead:o}=e;t(null);let s=yield*n.recover();r&&[`succeeded`,`no-change`].includes(s.state)&&(s.result?.headOid&&o(s.result.headOid),i(e=>new Set([...e,r])),a(null))},(e,t)=>e.pipe(Qf(o6(t))));function s6(e){return{statusToken:e.statusToken,inProgress:e.inProgress,mergeHeadOid:e.mergeHeadOid,headOid:e.headOid,branch:e.branch,changes:e.changes.flatMap(e=>e.comparisons),files:e.changes.map(({path:e,fingerprint:t})=>({path:e,fingerprint:t}))}}function cme(e,t){return e==null?t:t==null||t.name!==e.name||t.upstream!==e.upstream?e:{...t,name:e.name,upstream:e.upstream,ahead:e.ahead,behind:e.behind}}function c6(e){return e.branch??null}function l6(e){return e.changes.some(e=>e.scope===`unmerged`)}function lme(e,t){let n=c6(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;if(t.inProgress===`merge`&&!t.mergeHeadOid)return`Finish this merge in a terminal.`;switch(e){case`switch`:return t.changes.length?`Commit or stash local changes before switching branches.`:null;case`commit`:return l6(t)&&t.inProgress!==`merge`?`Resolve the conflicts before committing.`:null;case`amend`:return l6(t)?`Resolve the conflicts before amending.`:t.headOid===null||t.headOid===void 0?`There is no commit to amend.`:null;case`push`:return n?n.name===null||n.name===void 0?`Detached HEAD: check out a branch before pushing.`:n.behind>0?`Pull the upstream changes before pushing.`:n.ahead>0||n.upstream===null||n.upstream===void 0?null:`No local commits to push.`:null;case`pull`:return n?.upstream===null||n?.upstream===void 0?`No upstream branch to pull from.`:t.changes.length?`Commit or stash local changes before pulling.`:n?.name===null?`Detached HEAD: check out a branch before pulling.`:null;case`fetch`:return n?.upstream===null||n?.upstream===void 0?`No upstream branch to fetch.`:null;case`stash-create`:return null;case`stash-apply`:case`stash-pop`:return n?.stashes&&n.stashes.length===0?`No stash is available.`:null;case`discard`:return null}}function ume(e,t){let n=c6(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;switch(e){case`switch`:return null;case`commit`:return t.changes.length?null:`Nothing to commit.`;case`amend`:return t.changes.length?`Choose which changed files to add to the last commit.`:`Change the last commit message.`;case`push`:return n==null?`Enter the configured remote and full branch ref.`:null;case`pull`:case`fetch`:return n==null?`Enter the configured remote and full branch ref.`:null;case`stash-create`:return t.changes.length===0?`Nothing changed; the server will report no change.`:null;case`stash-apply`:case`stash-pop`:return n?.stashes===null||n?.stashes===void 0?`Enter a full stash object ID.`:null;case`discard`:return null}}function dme(e,t){let n=c6(t);return e.kind!==`run`||n==null?null:e.action===`pull`?n.behind:n.ahead}function fme(e){if(e.inProgress===`rebase`||e.inProgress===`merge`&&!e.mergeHeadOid)return{kind:`hint`,label:`Git recovery`,hint:`Finish or abort this operation in a terminal.`};if(e.inProgress===`merge`||e.changes.length>0)return{kind:`commit`,label:`Commit`};let t=c6(e);return t==null?{kind:`hint`,label:`Commit`,hint:`Nothing to commit. Choose a Git action to continue.`}:t.name===null||t.name===void 0?{kind:`hint`,label:`Commit`,hint:`Detached HEAD: check out a branch before pushing.`}:t.behind>0?{kind:`run`,action:`pull`,label:`Pull`}:t.ahead>0?{kind:`run`,action:`push`,label:`Push`}:(t.stashes?.length??0)>0?{kind:`stash`,label:`Apply stash`}:{kind:`hint`,label:`Commit`,hint:`Nothing to commit, pull or push.`}}var u6=Gp(`GitActions.restoreStash`)(function*(e,t,n,r,i){let a=yield*e.run({action:`stash-apply`,...t},n).pipe(Kf(e=>n6(e)?r6(e):null),Xf(e=>B(a6(e))));r(a===null?{title:i.restored,type:`success`}:{title:i.failed,description:a,type:`error`})}),pme=Gp(`Discard.restore`)(function*({what:e,readChanges:t,notify:n,dismissNotice:r,restore:i},a,o,s){let c=yield*t().pipe(Kf(s6),Xf(t=>V(()=>(n({title:`Could not restore ${e}`,description:a6(t),type:`error`}),null))));if(!c)return;let l=c.files?.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0).map(e=>e.path)??[];r(s),yield*u6(i,{stashOid:a,restoreIndex:o},t6(c,l,void 0,!0),n,{restored:`Restored ${e}`,failed:`Could not restore ${e}`})});function mme(e,t){let{what:n,notify:r,close:i}=e;if(n6(t))return{text:r6(t),moved:i6(t)};i();let a=t.result?.restoreStashOid;if(t.state===`no-change`)return r({title:`Nothing to discard`,description:`${n} already matches the last commit.`,type:`info`}),null;let o=t.result?.restoreIndex??!1,s=r({title:`Discarded ${n}`,type:`success`,timeout:e.restoreTimeoutMs,...a?{actionProps:{children:`Restore`,onClick:()=>e.run(pme(e,a,o,s))}}:{}});return null}var hme=Gp(`Discard.finish`)(function*(e,t){return mme(t,yield*e)});function gme(e){return e===`fetch`||e===`pull`||e===`push`}function _me(e,t,n){return e?n&&(e.branch?.name!==t?.name||e.branch?.upstream!==t?.upstream)?{ready:!1,reason:`The branch target changed. Review it and try again.`}:{ready:!0,looked:e}:{ready:!1,reason:`The branch target is still loading. Try again.`}}function vme(e,t,n){if(!t?.name)throw Error(`Check out a branch before using the remote.`);if(e===`fetch`||e===`pull`){if(!t?.upstream||!t.remoteName||!t.sourceRef)throw Error(`Configure an upstream branch first.`);let r=`${t.remoteName}/`;if(!t.upstream.startsWith(r)||t.sourceRef!==`refs/heads/${t.upstream.slice(r.length)}`)throw Error(`The configured upstream changed. Review it and try again.`);return e===`fetch`?{action:e,remoteName:t.remoteName,sourceRef:t.sourceRef}:{action:e,remoteName:t.remoteName,sourceRef:t.sourceRef,strategy:n}}let r=t.sourceRef??`refs/heads/${t.name}`;return{action:e,remoteName:t.remoteName??`origin`,destinationRef:r,allowCreate:t?.upstream===null||t?.upstream===void 0}}var d6=e=>e===`fetch`?`Fetch`:e===`pull`?`Pull`:`Push`;function f6(e,t){let n=d6(e);return{title:t.state===`interrupted`?`${n} outcome not confirmed`:t.state===`conflicted`?`${n} needs conflict resolution`:t.state===`rejected`?`${n} did not run`:t.state===`running`?`${n} in progress`:n,description:r6(t),type:t.state===`succeeded`||t.state===`no-change`?`success`:t.state===`running`?`info`:`error`}}var yme=e=>e===`fetch`?`Fetching`:e===`pull`?`Pulling`:`Pushing`,p6=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function bme(e,t){if(e.kind===`hint`)return e.hint;if(e.kind===`commit`)return`Commit ${p6(t.changes.length,`changed file`)}`;let n=c6(t);if(e.kind===`stash`){let e=n?.stashes?.[0]?.message;return e?`Apply the stash “${e}”`:`Apply the latest stash`}let r=n?.upstream??`the configured remote`;return e.action===`pull`?`Pull from ${r}`:`Push ${p6(n?.ahead??0,`commit`)} to ${r}`}var xme=Gp(`GitMenu.runNetwork`)(function*(e,t,n,r){let{details:i}=e,a=e.onResult,o=d6(n);if(n===`pull`&&e.pull.kind===`blocked`){a({title:`${o} did not run`,description:e.pull.reason,type:`error`});return}let s=Qx(i.result)?i.result.value:void 0,c=!s;c&&e.enableDetails();let l=_me(s??(yield*i.read()),r,c);if(!l.ready){a({title:`${o} did not run`,description:l.reason,type:`error`});return}let{looked:u}=l,d=vme(n,u.branch,e.pull.kind===`ready`?e.pull.strategy:`merge`);a(f6(n,yield*yp(V(()=>e.onProgress(!0)),()=>t.run(d,t6(u,[],u.branch?.upstreamOid??null)),()=>V(()=>e.onProgress(!1)))))},(e,t,n,r)=>e.pipe(Xf(e=>V(()=>t.onResult({title:`${d6(r)} outcome not confirmed`,description:a6(e),type:`error`}))))),Sme=Gp(`GitMenu.recoverNetwork`)(function*(e,t,n){let r=yield*t.recover();e.onResult(f6(n,r))},(e,t,n,r)=>e.pipe(Xf(e=>V(()=>t.onResult({title:`${d6(r)} outcome not confirmed`,description:a6(e),type:`error`}))))),Cme=Gp(`GitMenu.restoreDiscarded`)(function*(e,t,n){let{details:r,notify:i}=e,a=n.kind===`rename`?`rename of ${n.path}`:`hunk of ${n.path}`,o=Un(sS(r.result));(!o||eS(r.result))&&(e.enableDetails(),o=yield*r.read()),yield*u6(t,{stashOid:n.oid,restoreIndex:n.kind===`rename`},t6(o,[n.path],void 0,!0),i,{restored:`Restored the discarded ${a}`,failed:`Could not restore the discarded ${a}`})},(e,t,n,r)=>e.pipe(Xf(e=>V(()=>t.notify({title:`Could not restore the discarded ${r.kind===`rename`?`rename of ${r.path}`:`hunk of ${r.path}`}`,description:a6(e),type:`error`}))))),wme=Gp(`GitActions.lookAgain`)(function*(e,t){yield*e,yield*t}),Tme=Gp(`GitActions.refreshLook`)(function*(e,t){t(s6(yield*e))});function m6(e){return P4.of({read:()=>Lf(()=>{if(!e)throw Error(`Pair this environment again to identify its pending Git operations.`);return window.sessionStorage.getItem(e)}),write:t=>Lf(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.setItem(e,t)}),clear:()=>Lf(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.removeItem(e)})})}var Eme=Er(`@effect/platform-browser/Crypto/WebCrypto`,{defaultValue:()=>globalThis.crypto}),h6=Uu(hW,H(function*(){let e=yield*Eme;return e?gW({randomBytes:t=>{let n=new Uint8Array(t);for(let t=0;t<n.length;t+=65536)e.getRandomValues(n.subarray(t,t+65536));return n},digest:(t,n)=>typeof e.subtle?.digest==`function`?Kf(Df({try:()=>e.subtle.digest(t,new Uint8Array(n)),catch:e=>Uw({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`Could not compute digest`,cause:e})}),e=>new Uint8Array(e)):U(Uw({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`crypto.subtle.digest is not available`}))}):yield*If(Error(`Web Crypto API is not available`))}));function Dme(e){if(!e)throw Error(`A connected environment is required`);return e}var g6={name:()=>typeof navigator>`u`?`Browser`:B3(navigator.userAgent).slice(0,120)||`Browser`,send:fetch,statusActivity:H3};function Ome(e,t){return G3({environmentId:e,address:t.address,transport:t.transport,liveUpdates:t.liveUpdates,timeoutMs:t3},Yu(h6,Ru(P4,m6(t.operationsKey))),y6.memoMap)}var _6=Aj(void 0);function kme({inventory:e,principal:t}){_6.set(t.kind===`device`?t.deviceId:void 0);let n=t.kind===`owner`?`owner`:t.deviceId,r=Ome(e.environmentId,{address:window.location.href,transport:L2(fetch),liveUpdates:Ape(H3),operationsKey:`porcelain-git-requests:${JSON.stringify([e.environmentId,t.kind,n])}`});return r.atoms.addGlobalLayer(Ru(g2,Ln(e))),r}function Ame(e){return kpe({...e,send:fetch,...g6.statusActivity?{activity:g6.statusActivity}:{},socket:K3,onStatusChange:()=>B0(g6,e),timeoutMs:t3},Yu(h6,Ru(P4,m6(t0(e)?`porcelain-git-requests:${t0(e)}`:void 0))),y6.memoMap)}var jme=Ju(Yu(h0.layer,D2.layer).pipe(Zu(Ru(VW,ype))),Ru(HW,g6),T2.layer,Ru(g0,{local:e=>vp(V(()=>kme(e)),e=>Ef(()=>e.close()))}),Ru(_0,{open:e=>vp(V(()=>Ame(e)),e=>Ef(()=>e.close()))}),Ru(O2,{forgetEnvironment:()=>Af})),v6=b0.pipe(Qu(Ju(k2.layer,v0.layer,y0.layer).pipe(Qu(jme)))),y6=AW(v6),b6=OE({memoMap:y6.memoMap})(v6),Mme=y6.runSync(h0),x6=y6.runSync(v0),S6=y6.runSync(y0),C6=S6.state,Nme=b6.atom(H(function*(){yield*(yield*k2).read()}));function Pme(){yN(Nme)}function w6(){return DN(Mme.state)}function T6(){return DN(x6.state).connection}function Fme(){return DN(S6.state)}function E6(e){let t=(0,QB.c)(5),n=DN(S6.state),r;if(t[0]!==e||t[1]!==n){let i;t[3]===e?i=t[4]:(i=t=>t.remote.environmentId===e,t[3]=e,t[4]=i),r=n.find(i),t[0]=e,t[1]=n,t[2]=r}else r=t[2];return r}function D6(e){let t=(0,QB.c)(6),n=T6();if(e){let n;return t[0]===e?n=t[1]:(n={connection:e},t[0]=e,t[1]=n),n}let r;t[2]===n?r=t[3]:(r=Dme(n),t[2]=n,t[3]=r);let i;return t[4]===r?i=t[5]:(i={connection:r},t[4]=r,t[5]=i),i}var Ime=Uce({transport:L2(fetch),platform:g6});function Lme(e,t,n){return y6.runPromise(Dle(e,Ime,t,t3),{signal:n})}var Rme=X(e=>bE(t=>{let n=()=>{window.location.hash&&e()};window.addEventListener(`hashchange`,n),t.addFinalizer(()=>window.removeEventListener(`hashchange`,n))})),zme=Cle(L2(fetch,{reportUnauthorized:!1}));function Bme(e){return y6.runPromise(Ole(e,zme))}var Vme=bE(e=>{e.addFinalizer(Lle(()=>{y6.runFork(x6.clear())}))});function Hme(){return SN(Vme),I2}function O6(e){let t=(0,QB.c)(3),n=E6(e.environmentId)?.connection,r;return t[0]!==e||t[1]!==n?(r=H0(g6,e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],yN(r)}function Ume(e){let t=(0,QB.c)(7),{className:n}=e,r;t[0]===n?r=t[1]:(r=HV(`shrink-0`,n),t[0]=n,t[1]=r);let i,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`rect`,{x:`1.5`,y:`1.5`,width:`21`,height:`21`,rx:`4.5`}),a=(0,Q.jsx)(`path`,{d:`M12 3v5.5q0 .5-.5 .5h-2q-.5 0-.5 .5V11q0 .5.5 .5H12v2q0 .5.5 .5h2q.5 0 .5 .5V16q0 .5-.5 .5H12V21`}),t[2]=i,t[3]=a):(i=t[2],a=t[3]);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`g`,{fill:`currentColor`,stroke:`none`,children:[(0,Q.jsx)(`circle`,{cx:`12`,cy:`6.5`,r:`1.25`}),(0,Q.jsx)(`circle`,{cx:`12`,cy:`11.5`,r:`1.25`}),(0,Q.jsx)(`circle`,{cx:`12`,cy:`16.5`,r:`1.25`})]}),t[4]=o):o=t[4];let s;return t[5]===r?s=t[6]:(s=(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.25,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:r,children:[i,a,o]}),t[5]=r,t[6]=s),s}function k6(e){let t=(0,QB.c)(5),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(Ume,{className:`size-6`}),i=(0,Q.jsx)(`h1`,{className:`text-lg font-medium tracking-tight`,children:`Porcelain`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-2 px-6 md:px-8`,children:[r,i,(0,Q.jsxs)(`a`,{href:`https://porcelain.fabiofiorita.com/install`,target:`_blank`,rel:`noreferrer`,className:`ml-auto inline-flex items-center gap-1 rounded-md p-1 text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[`Install guide`,` `,(0,Q.jsx)(fH,{"aria-hidden":`true`,className:`size-3.5`})]})]}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,Q.jsxs)(`div`,{className:`pairing-page flex min-h-svh flex-col bg-background`,children:[a,(0,Q.jsx)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col px-6 pb-7 pt-10 md:px-14 md:pt-14`,children:n})]}),t[3]=n,t[4]=o),o}var Wme=[`a[href]`,`button`,`summary`,`[role="button"]`,`[role="link"]:not([aria-disabled="true"])`,`[role="tab"]`,`[role="option"]`,`[role="checkbox"]`,`[role="radio"]`,`[role="switch"]`,`[role^="menuitem"]`,`[tabindex]:not([tabindex="-1"])`,`[data-truncated]`].join(`, `);function A6(e,t){return e===`start`?(0,Q.jsx)(`bdi`,{dir:`ltr`,children:t}):t}function Gme(e,t){if(t===1)return e.scrollWidth>e.clientWidth;let n=e.clientHeight,r=e.style.webkitLineClamp;try{return e.style.webkitLineClamp=`unset`,e.clientHeight>n}finally{e.style.webkitLineClamp=r}}function j6(e){let t=(0,QB.c)(39),{text:n,children:r,className:i,render:a,renderTrigger:o,propagateEscape:s,lines:c,disclose:l,cut:u}=e,d=s!==void 0&&s,f=c===void 0?1:c,p=l===void 0?`clipped`:l,m=u===void 0?`end`:u,h=(0,Z.useId)(),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(!1),w;t[0]!==g||t[1]!==p||t[2]!==n?(w=n.trim()!==``&&(g||p===`always`),t[0]=g,t[1]=p,t[2]=n,t[3]=w):w=t[3];let T=w,E=o!==void 0,D;t[4]!==h||t[5]!==f||t[6]!==d||t[7]!==E?(D=()=>e=>{if(!e)return;let t=()=>[e,...e.querySelectorAll(`[data-truncated]`)].filter(e=>e.getAttribute(`data-truncated`)===h),n=E?null:e.parentElement?.closest(Wme)??null,r=!0,i=()=>{r&&_(t().some(e=>Gme(e,f)))},a=()=>{n?.matches(`:focus-visible`)&&!n.hasAttribute(`data-clipped`)&&n.querySelector(`[data-clipped]`)===e&&C(!0)},o=()=>C(!1),s=t=>{t.key===`Escape`&&e.hasAttribute(`data-popup-open`)&&(C(!1),x(!1),d||t.stopPropagation())};y(n!==null),i();let c=new ResizeObserver(i);for(let e of t())c.observe(e);let l=new MutationObserver(i);return l.observe(e,{characterData:!0,childList:!0,subtree:!0}),document.fonts.ready.then(i),n?.addEventListener(`focus`,a),n?.addEventListener(`blur`,o),n?.addEventListener(`keydown`,s),()=>{r=!1,c.disconnect(),l.disconnect(),n?.removeEventListener(`focus`,a),n?.removeEventListener(`blur`,o),n?.removeEventListener(`keydown`,s)}},t[4]=h,t[5]=f,t[6]=d,t[7]=E,t[8]=D):D=t[8];let[O]=(0,Z.useState)(D),k=!E&&!v,A;t[9]===h?A=t[10]:(A=(e,t,n)=>{let r=n===void 0?`end`:n;return(0,Q.jsx)(`span`,{dir:r===`start`?`rtl`:void 0,className:HV(`min-w-0 truncate`,r===`start`&&`text-left`,t),"data-truncated":h,children:A6(r,e)})},t[9]=h,t[10]=A);let j=A,M;t[11]===a?M=t[12]:(M=a??(0,Q.jsx)(`span`,{}),t[11]=a,t[12]=M);let N=M,P;if(t[13]!==r||t[14]!==i||t[15]!==j||t[16]!==m||t[17]!==T||t[18]!==N||t[19]!==h||t[20]!==f||t[21]!==a?.props.className||t[22]!==o||t[23]!==k||t[24]!==n||t[25]!==E){let e=(0,Z.cloneElement)(N,{tabIndex:k&&T?0:void 0,dir:m===`start`?`rtl`:void 0,"aria-label":k?n:void 0,"data-truncated":h,"data-clipped":!E&&T?``:void 0,className:HV(`relative min-w-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,f===3?`line-clamp-3 whitespace-normal`:`truncate`,m===`start`&&`text-left`,a?.props.className,i)},A6(m,r??n));P=o?.(e,j)??e,t[13]=r,t[14]=i,t[15]=j,t[16]=m,t[17]=T,t[18]=N,t[19]=h,t[20]=f,t[21]=a?.props.className,t[22]=o,t[23]=k,t[24]=n,t[25]=E,t[26]=P}else P=t[26];let F=P,I=!T,L=T&&(b||S),R;t[27]===d?R=t[28]:(R=(e,t)=>{x(e),e||C(!1),d&&t.reason===`escape-key`&&t.allowPropagation()},t[27]=d,t[28]=R);let ee;t[29]===F?ee=t[30]:(ee=(0,Q.jsx)(LU,{ref:O,render:F,children:F.props.children}),t[29]=F,t[30]=ee);let z;t[31]===n?z=t[32]:(z=(0,Q.jsx)(RU,{role:`tooltip`,className:`wrap-anywhere`,children:n}),t[31]=n,t[32]=z);let te;return t[33]!==I||t[34]!==L||t[35]!==R||t[36]!==ee||t[37]!==z?(te=(0,Q.jsxs)(IU,{disabled:I,disableHoverablePopup:!0,open:L,onOpenChange:R,children:[ee,z]}),t[33]=I,t[34]=L,t[35]=R,t[36]=ee,t[37]=z,t[38]=te):te=t[38],te}function M6({className:e,...t}){return(0,Q.jsx)(BH,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:HV(`size-4 animate-spin`,e),...t})}function N6(){return typeof window>`u`?`http://127.0.0.1:3000`:window.location.origin}function P6(e){let t=(0,QB.c)(56),{reason:n,pending:r}=e,i=r!==void 0&&r,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=N6(),t[0]=a):a=t[0];let o=`porcelain pair "This browser" --address ${a}`,s=`This browser cannot open your worktrees yet`,c=`On your computer, run this`;n&&(s=`That link did not let this browser in`,c=`On your computer, run it again`),i&&(s=`Checking the link with your computer`,c=`Ran porcelain pair on your computer`);let l=i?`bg-brand-soft text-brand`:`bg-foreground text-background`,u;t[1]===l?u=t[2]:(u=HV(`inline-flex items-center gap-1 rounded-full px-2 py-1 text-xs font-medium`,l),t[1]=l,t[2]=u);let d;t[3]===i?d=t[4]:(d=i&&(0,Q.jsx)(M6,{className:`size-3`}),t[3]=i,t[4]=d);let f=i?`Pairing`:`Not paired`,p;t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,Q.jsxs)(`span`,{className:u,children:[d,f]}),t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==p?(m=(0,Q.jsxs)(`p`,{role:`status`,className:`flex w-fit max-w-full flex-wrap items-center gap-2 rounded-full border bg-background p-1 pr-3 text-ui text-muted-foreground`,children:[p,s]}),t[9]=s,t[10]=p,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`text-4xl font-semibold leading-none tracking-tighter md:text-6xl`,children:[(0,Q.jsx)(`h2`,{"aria-label":`This browser is not paired`,className:`text-title-dim`,children:`This browser is not paired.`}),(0,Q.jsx)(`p`,{children:`Pair it from your computer.`})]}),(0,Q.jsx)(`p`,{className:`max-w-xl text-lg leading-relaxed text-muted-foreground`,children:`Porcelain runs on the computer where your agents work, and this browser reads from it. That computer prints a link to let it in.`})]}),t[12]=h):h=t[12];let g=!i,_;t[13]===c?_=t[14]:(_=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:c}),t[13]=c,t[14]=_);let v;t[15]!==i||t[16]!==n?(v=!i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`my-3 flex min-w-0 items-center gap-3 rounded-full border bg-muted py-1 pl-4 pr-1 text-ui`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`$`}),(0,Q.jsx)(j6,{text:o,render:(0,Q.jsx)(`code`,{}),className:`flex-1`}),(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{variant:`ghost`,size:`icon-sm`,"aria-label":`Copy the command`,onClick:()=>HU(o,`the command`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{children:`Copy the command`})]})]}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[n?`Same command, a new link. `:``,`It prints a link that works once, for 15 minutes.`]})]}),t[15]=i,t[16]=n,t[17]=v):v=t[17];let y;t[18]!==i||t[19]!==g||t[20]!==_||t[21]!==v?(y=(0,Q.jsxs)(F6,{number:1,current:g,done:i,children:[_,v]}),t[18]=i,t[19]=g,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b=!!n,x=i?`Checking the link`:`Open the link it prints, here`,S;t[23]===x?S=t[24]:(S=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:x}),t[23]=x,t[24]=S);let C=n?`alert`:void 0,w=n?`text-destructive`:`text-muted-foreground`,T;t[25]===w?T=t[26]:(T=HV(`mt-1 text-ui leading-relaxed [overflow-wrap:anywhere]`,w),t[25]=w,t[26]=T);let E;t[27]!==i||t[28]!==n?(E=n??(i?`Checking that the link belongs to this Porcelain installation.`:(0,Q.jsxs)(Q.Fragment,{children:[`Its Porcelain page continues here, at`,` `,(0,Q.jsxs)(`code`,{children:[N6(),`/pair`]}),`. On a phone, scan the QR code it prints.`]})),t[27]=i,t[28]=n,t[29]=E):E=t[29];let D;t[30]!==C||t[31]!==T||t[32]!==E?(D=(0,Q.jsx)(`p`,{role:C,className:T,children:E}),t[30]=C,t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==i||t[35]!==b||t[36]!==S||t[37]!==D?(O=(0,Q.jsxs)(F6,{number:2,current:i,failed:b,children:[S,D]}),t[34]=i,t[35]=b,t[36]=S,t[37]=D,t[38]=O):O=t[38];let k;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:`Read what your agents changed`}),t[39]=k):k=t[39];let A;t[40]===i?A=t[41]:(A=!i&&(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:`This browser stays paired until you revoke it.`}),t[40]=i,t[41]=A);let j;t[42]===A?j=t[43]:(j=(0,Q.jsxs)(F6,{number:3,children:[k,A]}),t[42]=A,t[43]=j);let M;t[44]!==y||t[45]!==O||t[46]!==j?(M=(0,Q.jsxs)(`ol`,{"aria-label":`How pairing works`,className:`flex max-w-3xl flex-col`,children:[y,O,j]}),t[44]=y,t[45]=O,t[46]=j,t[47]=M):M=t[47];let N;t[48]===i?N=t[49]:(N=!1,t[48]=i,t[49]=N);let P;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`code`,{children:`porcelain devices`}),t[50]=P):P=t[50];let F;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(`p`,{className:`mt-auto border-t pt-4 text-ui text-muted-foreground`,children:[`Revoke this browser at any time with `,P,` and`,` `,(0,Q.jsx)(`code`,{children:`porcelain revoke`}),`.`]}),t[51]=F):F=t[51];let I;return t[52]!==M||t[53]!==N||t[54]!==m?(I=(0,Q.jsxs)(`section`,{className:`flex w-full min-w-0 flex-1 flex-col gap-8`,children:[m,h,M,N,F]}),t[52]=M,t[53]=N,t[54]=m,t[55]=I):I=t[55],I}function F6(e){let t=(0,QB.c)(19),{number:n,current:r,done:i,failed:a,children:o}=e,s=r!==void 0&&r,c=i!==void 0&&i,l=a!==void 0&&a,u=``,d=n;if(l){u=`, failed`;let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(cU,{className:`size-3`}),t[0]=e):e=t[0],d=e}if(c){u=`, done`;let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(mH,{className:`size-3`}),t[1]=e):e=t[1],d=e}s&&(u=`, current`);let f;t[2]===n?f=t[3]:(f=n!==3&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-1 left-3 top-8 border-l`}),t[2]=n,t[3]=f);let p=s?`step`:void 0,m=`Step ${n}${u}`,h=s&&`border-brand text-brand ring-4 ring-brand-soft`,g=c&&`border-brand bg-brand text-brand-foreground`,_=l&&`border-destructive text-destructive`,v;t[4]!==h||t[5]!==g||t[6]!==_?(v=HV(`relative flex size-6 shrink-0 items-center justify-center rounded-full border bg-background text-xs tabular-nums text-muted-foreground`,h,g,_),t[4]=h,t[5]=g,t[6]=_,t[7]=v):v=t[7];let y;t[8]!==d||t[9]!==v||t[10]!==p||t[11]!==m?(y=(0,Q.jsx)(`span`,{"aria-current":p,"aria-label":m,className:v,children:d}),t[8]=d,t[9]=v,t[10]=p,t[11]=m,t[12]=y):y=t[12];let b;t[13]===o?b=t[14]:(b=(0,Q.jsx)(`div`,{className:`min-w-0`,children:o}),t[13]=o,t[14]=b);let x;return t[15]!==y||t[16]!==b||t[17]!==f?(x=(0,Q.jsxs)(`li`,{className:`relative grid grid-cols-[auto_minmax(0,1fr)] gap-4 pb-8 last:pb-0`,children:[f,y,b]}),t[15]=y,t[16]=b,t[17]=f,t[18]=x):x=t[18],x}function Kme(e){let t=(0,QB.c)(3),{reason:n}=e,r=!n,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(k6,{children:(0,Q.jsx)(P6,{reason:n,pending:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function I6({className:e,...t}){return(0,Q.jsx)(`label`,{"data-slot":`label`,className:HV(`flex items-center gap-2 text-xs/relaxed leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var L6=Z.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return TI(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function qme({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(L6,{"data-slot":`separator`,orientation:t,className:HV(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function R6({className:e,...t}){return(0,Q.jsx)(`fieldset`,{"data-slot":`field-set`,className:HV(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function z6({className:e,variant:t=`legend`,...n}){return(0,Q.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:HV(`mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm`,e),...n})}function Jme({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`field-group`,className:HV(`group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var Yme=JV(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function B6({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:HV(Yme({orientation:t}),e),...n})}function Xme({className:e,...t}){return(0,Q.jsx)(I6,{"data-slot":`field-label`,className:HV(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-input/40 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-2 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/30 *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function V6({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`field-description`,className:HV(`text-left text-xs/relaxed leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Zme({className:e,children:t,errors:n,...r}){let i=(0,Z.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,Q.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,Q.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,Q.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:HV(`text-xs/relaxed font-normal text-destructive`,e),...r,children:i}):null}function H6(e){return TI(e.defaultTagName??`div`,e,e)}function U6({className:e,...t}){return(0,Q.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:HV(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var Qme=JV(`group/item flex w-full flex-wrap items-center rounded-md border text-xs/relaxed transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2.5 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function W6({className:e,variant:t=`default`,size:n=`default`,render:r,...i}){return H6({defaultTagName:`div`,props:dI({className:HV(Qme({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var $me=JV(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-8 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function G6({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:HV($me({variant:t,className:e})),...n})}function K6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-content`,className:HV(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none`,e),...t})}function q6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-title`,className:HV(`line-clamp-1 flex w-fit items-center gap-2 text-xs/relaxed leading-snug font-medium underline-offset-4`,e),...t})}function J6({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`item-description`,className:HV(`line-clamp-2 text-left text-xs/relaxed font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Y6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-actions`,className:HV(`flex items-center gap-2`,e),...t})}function X6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-footer`,className:HV(`flex basis-full items-center justify-between gap-2`,e),...t})}var ehe=JV(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2 py-1.5 text-left text-xs/relaxed has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-1.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function Z6({className:e,variant:t,...n}){return(0,Q.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:HV(ehe({variant:t}),e),...n})}function Q6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-title`,className:HV(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function $6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-description`,className:HV(`text-xs/relaxed text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function the({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-action`,className:HV(`absolute top-1.5 right-2`,e),...t})}var nhe=JV(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-2.5!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border bg-input/20 text-foreground dark:bg-input/30 [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,warn:`border-warn-border bg-warn-soft text-warn [a]:hover:bg-warn-soft/80`,brand:`bg-brand text-brand-foreground [a]:hover:bg-brand/80`,"brand-soft":`bg-brand-soft text-brand [a]:hover:bg-brand-soft/80`,open:`bg-add-bg text-add-fg [a]:hover:bg-add-bg/80`,draft:`bg-muted text-muted-foreground [a]:hover:bg-muted/80`,merged:`bg-brand-soft text-brand [a]:hover:bg-brand-soft/80`,closed:`bg-del-bg text-del-fg [a]:hover:bg-del-bg/80`}},defaultVariants:{variant:`default`}});function e8({className:e,variant:t=`default`,render:n,...r}){return H6({defaultTagName:`span`,props:dI({className:HV(nhe({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function t8(e){let t=(0,QB.c)(17),{section:n,title:r,lead:i,status:a,action:o,children:s}=e,c;t[0]===a?c=t[1]:(c=a&&(0,Q.jsx)(`div`,{className:`mb-1.5 flex h-5.5 min-w-0 items-center gap-2 text-ui leading-4.5`,children:a}),t[0]=a,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Q.jsxs)(`span`,{className:`text-title-dim`,children:[n,`.`]}),t[2]=n,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,Q.jsxs)(`h1`,{className:`min-w-0 text-4xl font-semibold tracking-title wrap-anywhere`,children:[l,` `,r]}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[u,o]}),t[7]=o,t[8]=u,t[9]=d):d=t[9];let f;t[10]===i?f=t[11]:(f=(0,Q.jsx)(`p`,{className:`mt-3 max-w-160 text-base tracking-lead text-foreground-2`,children:i}),t[10]=i,t[11]=f);let p;return t[12]!==s||t[13]!==c||t[14]!==d||t[15]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[c,d,f,s]}),t[12]=s,t[13]=c,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function n8(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=s2(e),t[0]=e,t[1]=n),yN(n)}function r8(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=c2(e),t[0]=e,t[1]=n),yN(n)}function rhe(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=l2(e),t[0]=e,t[1]=n),yN(n)}var ihe=X(e=>b6.fn((t,n)=>H(function*(){yield*n.setResult(Ele(e),void 0),yield*(yield*v0).clear()})));function ahe(e){let t=(0,QB.c)(8),n;t[0]===e?n=t[1]:(n=ihe(e),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promiseExit`},t[2]=r):r=t[2];let[i,a]=TN(n,r),o;t[3]===a?o=t[4]:(o=()=>{a()},t[3]=a,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s={result:i,submit:o},t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function ohe(e){let t=(0,QB.c)(17),{computer:n}=e,{connection:r}=D6(),{result:i,submit:a}=ahe(r),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`p`,{className:`text-sm leading-5 font-medium`,children:`Disconnect this browser`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,(0,Q.jsxs)(`p`,{className:`mt-0.5 text-ui leading-4.5 text-muted-foreground`,children:[`Ends its session on `,n,`. Pair it again with a new link.`]})]}),t[1]=n,t[2]=s);let c;t[3]===i.waiting?c=t[4]:(c=i.waiting?(0,Q.jsx)(M6,{}):(0,Q.jsx)(oU,{}),t[3]=i.waiting,t[4]=c);let l;t[5]!==i.waiting||t[6]!==a||t[7]!==c?(l=(0,Q.jsxs)(XV,{variant:`outline`,size:`sm`,className:`shrink-0 self-start sm:self-auto`,"aria-label":`Disconnect this browser`,disabled:i.waiting,onClick:a,children:[c,`Disconnect`]}),t[5]=i.waiting,t[6]=a,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==s||t[10]!==l?(u=(0,Q.jsxs)(`div`,{className:`settings-danger flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;t[12]===i?d=t[13]:(d=eS(i)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Vl(i.cause))})}),t[12]=i,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}var i8=kE(V3.layer),a8=i8.atom(H(function*(){let e=yield*V3;return{isDesktopShell:e.isDesktopShell,hasAppUpdateFeed:e.hasAppUpdateFeed}})),o8=i8.atom(H(function*(){return yield*(yield*V3).checkUpdate})).pipe(WE),s8=i8.atom(rT(H(function*(){return(yield*V3).updateStates}))).pipe(uE(0));function c8(){let e=(0,QB.c)(2),t=yN(s8),n;return e[0]===t?n=e[1]:(n=Vn(sS(t),she),e[0]=t,e[1]=n),n}function she(){return{status:`idle`}}function che(){return yN(a8)}var lhe=`data-valid`,uhe=`data-invalid`,dhe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fhe={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},l8={valid(e){return e===null?null:e?{[lhe]:``}:{[uhe]:``}}},phe={invalid:void 0,name:void 0,validityData:{state:dhe,errors:[],error:``,value:``,initialValue:null},setValidityData:kN,disabled:void 0,setTouched:kN,setDirty:kN,setFilled:kN,setFocused:kN,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:fhe,registerFieldControl:kN,validation:{getValidationProps:(e,t=jN)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:kN,getInputControl:()=>null,commit:async()=>{},change:kN}},mhe=Z.createContext(phe);function u8(e=!0){let t=Z.useContext(mhe);if(t.setValidityData===kN&&!e)throw Error(LN(28));return t}var hhe=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:kN,validationMode:`onSubmit`,submitCountRef:{current:0}});function d8(){return Z.useContext(hhe)}var ghe=Z.createContext({controlId:void 0,registerControlId:kN,resetControlId:kN,labelId:void 0,setLabelId:kN,messageIds:[],setMessageIds:kN,getDescriptionProps:e=>e});function f8(){return Z.useContext(ghe)}function p8(e,t,n,r=!0,i){let[a,o]=Z.useState(),s=vU(i?`${i}-label`:void 0),c=e??t??a;return FN(()=>{let i=e||t||!r?void 0:_he(n.current,s);a!==i&&o(i)}),c}function _he(e,t){let n=vhe(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function vhe(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function m8(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=f8(),o=vU(),s=PN(()=>Symbol()),c=Z.useRef(!1),l=Z.useRef(!1),u=KN(()=>{c.current&&i!==kN&&(c.current=!1,i(s.current,void 0))});return FN(()=>{if(!n||i===kN){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}if(e===void 0){u();return}c.current=!0,i(s.current,e)},[t,n,i,a,o,s,u]),FN(()=>u,[u]),(n?r:void 0)??t??o}function h8({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Z.useRef(e!==void 0),[a,o]=Z.useState(t);return[i&&e!==void 0?e:a,Z.useCallback(e=>{i||o(e)},[])]}function g8(e,t,n,r,i=!0,a){let{registerFieldControl:o}=u8(),s=PN(()=>Symbol());FN(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),FN(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}function _8(e,t){let n=Z.useRef(e),r=KN(t);FN(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var yhe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=u8(),{clearErrors:C,elementRef:w,submitCountRef:T}=d8(),E=h||s,D=m??a,O={...p,disabled:E},{labelId:k}=f8(),A=m8({id:i}),[j]=h8({controlled:o,default:l,name:`FieldControl`,state:`value`}),M=o!==void 0,N=M?j:void 0,P=N==null?void 0:String(N),F=KN(()=>S.inputRef.current?.value);g8(S.inputRef,A,P,F,!E,a),FN(()=>{let e=P??S.inputRef.current?.value;e!==void 0&&b(e!==``)},[P,S.inputRef,b]),_8(P,()=>{P!==void 0&&(C(D),_(P!==(v.initialValue??``)),S.change(P))});let I=Z.useRef(null),L=wP();return FN(()=>{u&&I.current===NP(gP(I.current))&&y(!0)},[u,y]),TI(`input`,e,{ref:[t,I],state:O,props:[{id:A,disabled:E,name:D,ref:S.inputRef,"aria-labelledby":k,autoFocus:u,...M?{value:N}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=SL(aL,e.nativeEvent);c?.(t,n),!M&&(_(t!==(v.initialValue??``)),b(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(C(D),S.change(t)))},onFocus(){y(!0)},onBlur(e){if(g(!0),y(!1),x===`onBlur`){let t=e.currentTarget.value;S.commit(t),M&&queueMicrotask(()=>{let e=S.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&S.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===w.current&&!e.defaultPrevented){let t=e.currentTarget,n=T.current;L.start(0,()=>{T.current===n&&S.commit(t.value)})}else S.commit(t)}}},f,e=>S.getValidationProps(E,e)],stateAttributesMapping:l8})}),bhe=Z.forwardRef(function(e,t){return(0,Q.jsx)(yhe,{ref:t,...e})});function v8({className:e,type:t,...n}){return(0,Q.jsx)(bhe,{type:t,"data-slot":`input`,className:HV(`h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function y8(e){e.catch(()=>void 0)}function b8(e,t){e.preventDefault(),y8(t())}function xhe(e){let t=(0,QB.c)(3),n;t[0]===e?n=t[1]:(n=ple(e),t[0]=e,t[1]=n);let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},t[2]=r):r=t[2],TN(n,r)}function She(e,t){let n=(0,QB.c)(3),r;return n[0]!==e||n[1]!==t?(r=mle({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],TN(r)}function Che(e,t){let n=(0,QB.c)(3),r;return n[0]!==e||n[1]!==t?(r=hle({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],TN(r)}function whe(e,t){let n=(0,QB.c)(3),r;return n[0]!==e||n[1]!==t?(r=gle({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],TN(r)}function The(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=_le(e),t[0]=e,t[1]=n),TN(n)}function Ehe(e){let t=(0,QB.c)(3),n;t[0]===e?n=t[1]:(n=ble(e),t[0]=e,t[1]=n);let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},t[2]=r):r=t[2],TN(n,r)}function Dhe(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=xle(e),t[0]=e,t[1]=n),TN(n)}function Ohe(e,t){let n=(0,QB.c)(3),r;return n[0]!==e||n[1]!==t?(r=yle({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],TN(r)}function khe(e){let t=(0,QB.c)(31),{connection:n,environment:r,onCancel:i}=e,[a,o]=(0,Z.useState)(null),[s]=(0,Z.useState)(Ahe),[c,l]=Ehe(n),u=a??(r.custom?r.name:``),d;t[0]===u?d=t[1]:(d=u.trim(),t[0]=u,t[1]=d);let f=d,p=r.custom?f===r.name:f===``,m;t[2]!==f||t[3]!==l?(m=e=>b8(e,async()=>l(f===``?null:f)),t[2]=f,t[3]=l,t[4]=m):m=t[4];let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(I6,{htmlFor:`environment-name`,children:`Name of this computer`}),t[5]=h):h=t[5];let g;t[6]===i?g=t[7]:(g=e=>{e.key===`Escape`&&i()},t[6]=i,t[7]=g);let _=r.custom?`Host name`:r.name,v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>o(e.target.value),t[8]=v):v=t[8];let y;t[9]!==g||t[10]!==_||t[11]!==u?(y=(0,Q.jsx)(v8,{ref:s,id:`environment-name`,className:`min-w-0 flex-1`,onKeyDown:g,placeholder:_,maxLength:_de,value:u,onChange:v}),t[9]=g,t[10]=_,t[11]=u,t[12]=y):y=t[12];let b=p||c.waiting,x=c.waiting?`Saving…`:`Save`,S;t[13]!==b||t[14]!==x?(S=(0,Q.jsx)(XV,{type:`submit`,variant:`outline`,disabled:b,children:x}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===i?C=t[17]:(C=(0,Q.jsx)(XV,{type:`button`,variant:`ghost`,onClick:i,children:`Cancel`}),t[16]=i,t[17]=C);let w;t[18]!==S||t[19]!==C||t[20]!==y?(w=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[y,S,C]}),t[18]=S,t[19]=C,t[20]=y,t[21]=w):w=t[21];let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(V6,{children:`Paired devices show it so you know where they are connected. Leave it empty to use the host name.`}),t[22]=T):T=t[22];let E;t[23]===w?E=t[24]:(E=(0,Q.jsxs)(B6,{children:[h,w,T]}),t[23]=w,t[24]=E);let D;t[25]===c?D=t[26]:(D=eS(c)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Vl(c.cause))})}),t[25]=c,t[26]=D);let O;return t[27]!==E||t[28]!==D||t[29]!==m?(O=(0,Q.jsxs)(`form`,{className:`flex max-w-160 flex-col gap-2`,onSubmit:m,children:[E,D]}),t[27]=E,t[28]=D,t[29]=m,t[30]=O):O=t[30],O}function Ahe(){return jhe}function jhe(e){return e?.focus()}var x8=Z.createContext(void 0);function S8(e){let t=Z.useContext(x8);if(t===void 0&&!e)throw Error(LN(33));return t}var C8=Z.createContext(void 0);function w8(e){let t=Z.useContext(C8);if(t===void 0&&!e)throw Error(LN(36));return t}var T8=Z.createContext(void 0);function E8(e=!0){let t=Z.useContext(T8);if(t===void 0&&!e)throw Error(LN(25));return t}var D8=Z.createContext(void 0);function Mhe(){let e=Z.useContext(D8);if(e===void 0)throw Error(LN(30));return e}function Nhe(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=E8(!0),f=d!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:uL})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!AP&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&tL(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var O8={type:`regular-item`};function k8(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Z.useRef(null),{getButtonProps:d,buttonRef:f}=nL({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Nhe({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>dI(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=$F(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var A8=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Phe(){return Z.useContext(A8)}function j8(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Phe(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return FN(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Fhe=`data-checked`,Ihe=`data-unchecked`,M8={checked(e){return e?{[Fhe]:``}:{[Ihe]:``}},...BP},Lhe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=j8({guess:!0,label:a}),h=S8(!0),g=vU(i),{store:_}=w8(),v=_.useState(`disabled`),y=s||v,b=_.useState(`isActive`,m.index),x=_.useState(`itemProps`),[S,C]=h8({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:w,itemRef:T}=k8({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:O8}),E=Z.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=SL(uL,e.nativeEvent,void 0,{preventUnmountOnClose:kN});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=TI(`div`,e,{state:E,stateAttributesMapping:M8,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,Q.jsx)(D8.Provider,{value:E,children:O})}),Rhe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Mhe(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Mz(s.checked);return LI({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),TI(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:M8,props:{"aria-hidden":!0,...o},enabled:a||u})}),N8=Z.createContext(void 0);function zhe(){let e=Z.useContext(N8);if(e===void 0)throw Error(LN(31));return e}var P8=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(void 0),c=TI(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Q.jsx)(N8.Provider,{value:s,children:c})}),Bhe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=vU(a),c=zhe();return FN(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),TI(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),F8=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=j8({guess:!0,label:a}),f=S8(!0),p=vU(i),{store:m}=w8(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=k8({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:O8});return TI(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),Vhe=Z.createContext(void 0);function I8(e){let t=Z.useContext(Vhe);if(t===void 0&&!e)throw Error(LN(69));return t}var L8=`ArrowUp`,R8=`ArrowDown`,z8=`ArrowLeft`,B8=`ArrowRight`,V8=new Set([L8,R8,z8,B8,`Home`,`End`]),Hhe=[`Shift`,`Control`,`Alt`,`Meta`];function Uhe(e){return eP(e)&&e.tagName===`INPUT`}function H8(e){return!!(Uhe(e)&&e.selectionStart!=null||eP(e)&&e.tagName===`TEXTAREA`)}function U8(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=W8(e,t,`left`),a=G8(e),o=G8(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=W8(e,t,`top`),r=G8(e),i=G8(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function W8(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function G8(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var K8=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=w8(),{side:c,align:l}=S8(),u=I8(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;LI({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,SL(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),fB(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=TI(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:GP,props:[p,{onKeyDown(e){u&&V8.has(e.key)&&e.stopPropagation()}},XB(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,Q.jsx)(vR,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),q8=Z.createContext(void 0);function Whe(){let e=Z.useContext(q8);if(e===void 0)throw Error(LN(32));return e}var J8=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=w8();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,Q.jsx)(q8.Provider,{value:n,children:(0,Q.jsx)(OL,{ref:t,...r,portalOwnerRole:o})})});function Y8(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=KN(i),[,o]=Z.useState(!1),s=PN(Khe).current,c=PN(Ghe).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=KN(()=>{u.current||(u.current=!0,o(e=>!e))}),m=KN((e,t)=>{c.set(e,t),p()}),h=KN(e=>{c.delete(e),p()}),g=KN(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Yhe(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&X8(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=Jhe(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=KN(()=>{let[e,t]=qhe(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});FN(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),FN(()=>{u.current&&v()}),FN(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=KN(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(A8.Provider,{value:b,children:t})}function Ghe(){return new Map}function Khe(){return new Set}function qhe(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>X8(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Jhe(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Yhe(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function X8(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Z8=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Q8={},$8={},e5=``;function t5(e,t){return nP(e)?e:t}function n5(e,t,n){return/hidden|clip/.test(e.getComputedStyle(t5(t,n)).overflowY)}function Xhe(e){if(typeof document>`u`)return!1;let t=gP(e);return XN(t).innerWidth-t.documentElement.clientWidth>0}function Zhe(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=gP(e),n=t.documentElement,r=t.body,i=t5(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Qhe(e){let t=gP(e),n=t.documentElement,r=t.body,i=t5(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function $he(e){let t=gP(e),n=t.documentElement,r=t.body,i=XN(n),a=0,o=0,s=!1,c=bP.create();if(jP&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Q8={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},e5=n.style.scrollBehavior,$8={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=t5(n,r);if(s=Zhe(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,Q8),Object.assign(r.style,$8),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=e5)}function d(){u(),c.request(l)}l();let f=_P(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var ege=new class{lockCount=0;restore=null;timeoutLock=CP.create();timeoutUnlock=CP.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=gP(e),n=t.documentElement,r=t.body,i=XN(n);if(n5(i,n,r)){let t=new i.MutationObserver(()=>{n5(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=DP||!Xhe(e);this.restore=a?Qhe(e):$he(e)}};function r5(e=!0,t=null){FN(()=>{if(e)return ege.acquire(t)},[e,t])}var tge=20;function i5(e,t,n,r){let[i,a]=Z.useState(!1);FN(()=>{if(!e||!t||n==null){a(!1);return}let r=gP(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-tge)},[e,t,n]),r5(e&&(!t||i),r)}var a5=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=WI,style:g,..._}=e,{store:v}=w8(),y=Whe(),b=E8(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=Z.useRef(null),R=II(A),ee=n,z=c,te=l,ne=s,re=h;x.type===`context-menu`&&(ee=n??x.context?.anchor,ne??=`start`,!o&&ne!==`center`&&(te=e.alignOffset??2,z=e.sideOffset??-5));let ie=o,ae=ne;x.type===`menu`?(ie??=`inline-end`,ae??=`start`,re=e.collisionAvoidance??GI):x.type===`menubar`&&(ie??=x.context.orientation===`vertical`?`inline-end`:`bottom`,ae??=`start`);let oe=x.type===`context-menu`,se=qB({anchor:ee,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:ie,sideOffset:z,align:ae,alignOffset:te,arrowPadding:oe?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:re,shift:oe?{crossAxis:!(`side`in re&&re.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,SL(gL)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Z.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,SL(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ce=wP();Z.useEffect(()=>{T||ce.clear()},[T,ce]),Z.useEffect(()=>{function e(e){if(T&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ce.isStarted()||ce.start(e,()=>{v.setOpen(!1,SL(gL))}):v.setOpen(!1,SL(gL))}else ce.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ce]),Z.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),FN(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let le={open:T,side:se.side,align:se.align,anchorHidden:se.anchorHidden,nested:x.type===`menu`,instant:j},ue=x.type===`menubar`&&x.context.modal;i5(T&&(ue||E&&N!==`trigger-hover`),D===`touch`,A,O);let de=ZB(e,le,{styles:se.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),fe=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),pe=null;return x.type===`menubar`?pe=x.context.contentElement:x.type===void 0&&(pe=O),(0,Q.jsxs)(x8.Provider,{value:se,children:[fe&&(0,Q.jsx)(Z8,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:MI(!T),cutout:pe}),(0,Q.jsx)(cR,{id:P,children:(0,Q.jsx)(Y8,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:de})})]})}),o5=Z.createContext(void 0);function nge(){let e=Z.useContext(o5);if(e===void 0)throw Error(LN(34));return e}var rge=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Z.useState(void 0),[p,m]=h8({controlled:i,default:a,name:`MenuRadioGroup`}),h=KN((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=TI(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Z.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,Q.jsx)(N8.Provider,{value:f,children:(0,Q.jsx)(o5.Provider,{value:_,children:g})})})),s5=Z.createContext(void 0);function ige(){let e=Z.useContext(s5);if(e===void 0)throw Error(LN(35));return e}var age=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=j8({guess:!0,label:a}),p=S8(!0),m=vU(i),{store:h}=w8(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=nge(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=k8({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:O8}),E=Z.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=SL(uL,e.nativeEvent,void 0,{preventUnmountOnClose:kN});y(l,t)}let O=TI(`div`,e,{state:E,stateAttributesMapping:M8,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,Q.jsx)(s5.Provider,{value:E,children:O})}),oge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=ige(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Mz(s.checked);return LI({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),TI(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:M8,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),sge=Z.createContext(null);function c5(e){let t=Z.useContext(sge);if(t===null&&!e)throw Error(LN(5));return t}function cge(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function l5(e,t){let{onClick:n,onPointerDown:r}=cge(KN((n,r)=>{(typeof e==`function`?e():e)||t(r||(DP?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function u5(e){let[t,n]=Z.useState(null),r=l5(e,n);return _8(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var lge={...eB,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},uge=class extends qN{constructor(e,t,n=!1){let r=new qz,i=fge(r,t,n,e);super(i,dge(r),lge),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function dge(e){return{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function fge(e,t,n=!1,r){return{...Jz(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new nR,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:jN,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var pge=Z.createContext(void 0);function mge(){return Z.useContext(pge)}var d5=VN(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=E8(!0),_=w8(!0),v=c5(!0),y=mge(),b=Z.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=ZI(),S=ZI(),C=aR(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=PN(()=>T?w?.state.instantType:void 0).current,D=hge({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b,disabled:o,highlightItemOnHover:h,modal:b.type===void 0?s:void 0,rootId:x,instantType:E},S,C!=null);D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,p),D.useContextCallback(`onOpenChangeComplete`,i);let O=D.useState(`floatingTreeRoot`),k=sR(O),A=D.useState(`open`),j=D.useState(`activeTriggerElement`),M=D.useState(`positionerElement`),N=D.useState(`hoverEnabled`),P=D.useState(`disabled`),F=D.useState(`lastOpenChangeReason`),I=D.useState(`parent`),L=D.useState(`activeIndex`),R=D.useState(`payload`),ee=D.useState(`floatingParentNodeId`),z=Z.useRef(null),te=Z.useRef(I.type!==`context-menu`),ne=wP(),re=Z.useRef(!0),ie=wP(),ae=ee!=null,{openMethod:oe,triggerProps:se}=u5(A);D.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:I.type===void 0?s:void 0,openMethod:oe,rootId:x}),Uz(D);let{forceUnmount:ce,transitionStatus:le}=Wz(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),ue=II(D.context.popupRef);Z.useEffect(()=>{if(E===void 0)return;let e=()=>{D.state.instantType===E&&D.set(`instantType`,void 0)};if(!A){e();return}if(le!==void 0)return;if(D.context.popupRef.current==null){e();return}let t=new AbortController;return ue(e,t.signal),()=>{t.abort()}},[E,A,le,ue,D]),FN(()=>{g&&!_?D.update({parent:{type:`context-menu`,context:g},floatingNodeId:k,floatingParentNodeId:C}):_&&D.update({floatingNodeId:k,floatingParentNodeId:C})},[g,_,k,C,D]),Z.useEffect(()=>{if(A||(z.current=null),I.type===`context-menu`){if(!A){ne.clear(),te.current=!1;return}ne.start(500,()=>{te.current=!0})}},[ne,A,I.type]),FN(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let de=KN((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=Bz(t);if(!e&&t.trigger==null&&(t.trigger=j??void 0),r?.(e,t),t.isCanceled)return;D.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!re.current)return;e&&n===`trigger-focus`?(re.current=!1,ie.start(300,()=>{re.current=!0})):(re.current=!0,ie.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);z.current=t.event;let c=zz(D.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=I.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,D.update(c)}),fe=jz({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:de}),pe=fe.context.events;FN(()=>{let e=({open:e,eventDetails:t})=>de(e,t);return pe.on(`setOpen`,e),()=>{pe?.off(`setOpen`,e)}},[pe,de]);let me=Z.useCallback(()=>{D.setOpen(!1,SL(bL))},[D]);Z.useImperativeHandle(u,()=>({unmount:ce,close:me}),[ce,me]);let he;I.type===`context-menu`&&(he=I.context),Z.useImperativeHandle(he?.positionerRef,()=>M,[M]),Z.useImperativeHandle(he?.actionsRef,()=>({setOpen:de}),[de]);let ge=TR(fe,{enabled:!P,bubbles:{escapeKey:d&&I.type===`menu`},outsidePress(){return I.type!==`context-menu`||z.current?.type===`contextmenu`||te.current},externalTree:ae?O:void 0}),_e=NB(),ve=Z.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),ye=SB(fe,{enabled:!P,listRef:D.context.itemDomElements,activeIndex:L,nested:I.type!==void 0,loopFocus:c,orientation:l,parentOrientation:I.type===`menubar`?I.context.orientation:void 0,rtl:_e===`rtl`,disabledIndices:AN,onNavigate:ve,openOnArrowKeyDown:I.type!==`context-menu`,externalTree:ae?O:void 0,focusItemOnHover:h}),be=Z.useCallback(e=>{D.context.typingRef.current=e},[D]),xe=CB(fe,{enabled:!P,listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:L,resetMs:500,onMatch:e=>{A&&e!==L&&D.set(`activeIndex`,e)},onTyping:be}),Se=Z.useMemo(()=>{let e=dI(xe.reference,ye.reference,ge.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[D,xe.reference,ye.reference,ge.reference,se,A]),Ce=Z.useMemo(()=>{let e=dI(ye.trigger,ge.trigger,se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ye.trigger,ge.trigger,se]);PN(()=>(D.update({inactiveTriggerProps:Ce}),null)),Gz(D,{floatingRootContext:fe,activeTriggerProps:Se,inactiveTriggerProps:Ce,popupProps:Z.useMemo(()=>dI(Nz,{id:S,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":j?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),I.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},xe.floating,ye.floating,ge.floating),[j,S,l,I.type,D,xe.floating,ye.floating,ge.floating]),itemProps:ye.item??jN});let we=Z.useMemo(()=>({store:D,parent:b}),[D,b]),Te=(0,Q.jsxs)(C8.Provider,{value:we,children:[f&&(0,Q.jsx)(Iz,{handle:f,store:D}),typeof t==`function`?t({payload:R}):t]});return I.type===void 0||I.type===`context-menu`?(0,Q.jsx)(lR,{externalTree:O,children:Te}):Te});function hge(e,t,n){return PN(()=>new uge(e,t,n)).current}var f5=5;function p5(e,t){let n=gge(t);return e.clientX>=n.left-f5&&e.clientX<=n.right+f5&&e.clientY>=n.top-f5&&e.clientY<=n.bottom+f5}function gge(e){let t=e.getBoundingClientRect(),n=XN(e);if(MP)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function m5(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=$I(),{ref:i,index:a}=j8(e),o=n===a,s=Z.useRef(null),c=$F(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function _ge(e){let{render:t,className:n,style:r,state:i=jN,props:a=AN,refs:o=AN,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=m5({metadata:s});return TI(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function h5(e){if(eP(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!cP(e))return h5(dP(e))}function g5(e,t){let n=Z.useRef(null);function r(t){IN.flushSync(()=>{e.setOpen(!1,SL(fL,t.nativeEvent,t.currentTarget))}),GF(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&KF(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{IN.flushSync(()=>{e.setOpen(!1,SL(fL,n.nativeEvent,n.currentTarget))});let i=bce(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&PP(r,i);){let e=i;if(i=HF(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function vge(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,gP(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:jN,[t,n,r])}var yge=HN(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=w8(!0),h=tB(d)??m?.store;if(!h)throw Error(LN(85));let g=vU(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),S=xge(),C=$I(!0),w=oR(),T=Z.useMemo(()=>w??new nR,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Hz(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:sR(T),floatingParentNodeId:aR(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=nL({disabled:A,native:o});Z.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=Z.useRef(null),P=wP(),F=KN(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;PP(N.current,t)||PP(h.select(`positionerElement`),t)||t===N.current||(t==null||h5(t)!==h.select(`rootId`))&&(p5(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:hL}))});Z.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&gP(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=mB(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:jB({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=bge(y,h.select(`lastOpenChangeReason`)),ee=yR(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),z=oB(v,{enabled:!A&&I}),te=vge({open:y,enabled:O,mouseDownAction:`open`}),ne=Z.useMemo(()=>dI(z.reference,ee.reference),[z.reference,ee.reference]),re=h.useState(`triggerProps`,D),{preFocusGuardRef:ie,handlePreFocusGuardFocus:ae,handleFocusTargetFocus:oe}=g5(h,x),se={disabled:A,open:y},ce=[N,t,M,E,x],le=[ne,L??jN,re,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),gP(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},te,p,j],ue=TI(`button`,e,{enabled:!O,stateAttributesMapping:UP,state:se,ref:ce,props:le});return O?(0,Q.jsx)(_ge,{tag:`button`,render:n,className:r,style:i,state:se,refs:ce,props:le,stateAttributesMapping:UP}):y?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(QF,{ref:ie,onFocus:ae},`${g}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:ue},g),(0,Q.jsx)(QF,{ref:h.context.triggerFocusTargetRef,onFocus:oe},`${g}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:ue},g)});function bge(e,t){let n=wP(),[r,i]=Z.useState(!1);return FN(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function xge(){let e=c5(!0);return Z.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function _5(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function v5({...e}){return(0,Q.jsx)(d5,{"data-slot":`dropdown-menu`,...e})}function y5({...e}){return(0,Q.jsx)(yge,{"data-slot":`dropdown-menu-trigger`,...e})}function b5({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,Q.jsx)(J8,{children:(0,Q.jsx)(a5,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Q.jsx)(K8,{"data-slot":`dropdown-menu-content`,className:HV(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,i),...a})})})}function x5({...e}){return(0,Q.jsx)(P8,{"data-slot":`dropdown-menu-group`,...e})}function S5({className:e,inset:t,...n}){return(0,Q.jsx)(Bhe,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:HV(`px-2 py-1.5 text-xs text-muted-foreground data-inset:pl-7.5`,e),...n})}function Sge({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(F8,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:HV(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Cge({className:e,children:t,checked:n,inset:r,...i}){return(0,Q.jsxs)(Lhe,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:HV(`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),checked:n,...i,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,Q.jsx)(Rhe,{children:(0,Q.jsx)(mH,{})})}),t]})}function wge({...e}){return(0,Q.jsx)(rge,{"data-slot":`dropdown-menu-radio-group`,...e})}function Tge({className:e,children:t,inset:n,...r}){return(0,Q.jsxs)(age,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:HV(`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),...r,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Q.jsx)(oge,{children:(0,Q.jsx)(mH,{})})}),t]})}function Ege({className:e,...t}){return(0,Q.jsx)(L6,{"data-slot":`dropdown-menu-separator`,className:HV(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var Dge={desktop:WH,laptop:IH,server:QH,cloud:EH};function C5(e){let t=(0,QB.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Dge[n],a;return t[3]!==i||t[4]!==r?(a=(0,Q.jsx)(i,{...r}),t[3]=i,t[4]=r,t[5]=a):a=t[5],a}function Oge(e){let t=(0,QB.c)(18),{icon:n,pending:r,onChange:i}=e,a=`Icon: ${E4[n]}`,o;t[0]!==r||t[1]!==a?(o=(0,Q.jsx)(XV,{variant:`ghost`,size:`sm`,disabled:r,"aria-label":a}),t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Q.jsx)(C5,{icon:n}),t[3]=n,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,Q.jsxs)(y5,{render:o,children:[s,`Icon`]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(S5,{children:`Icon of this computer`}),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=e=>i(e),t[9]=i,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=que.map(kge),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==u?(f=(0,Q.jsx)(b5,{align:`end`,className:`w-44`,children:(0,Q.jsxs)(x5,{children:[l,(0,Q.jsx)(wge,{value:n,onValueChange:u,children:d})]})}),t[12]=n,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==c||t[16]!==f?(p=(0,Q.jsxs)(v5,{children:[c,f]}),t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function kge(e){return(0,Q.jsxs)(Tge,{value:e,className:`cursor-pointer`,children:[(0,Q.jsx)(C5,{icon:e}),E4[e]]},e)}function w5(e){switch(e.status){case`checking`:return`Checking for a new version…`;case`downloading`:return`Downloading ${e.version}…`;case`ready`:return`${e.version} is ready; the app restarts to finish.`;case`installing`:return`Installing ${e.version}; the app restarts in a moment.`;default:return}}function Age(e){return e.status===`unavailable`?`This build updates by reinstalling; there is no update feed yet.`:`Up to date`}var jge=kE(V3.layer).atom(Kf(V3,e=>t=>e.installUpdate.pipe($f(e=>new N2({message:e.message}))))),Mge=bE(e=>{e.addFinalizer(x6.state.subscribe(()=>e.refreshSelf())),e.addFinalizer(C6.subscribe(()=>e.refreshSelf()));let t=[],n=[],r=!1,i=x6.state.value.connection,a=Un(sS(e(a8)));if(i&&a){if(a.isDesktopShell){let i=e(o8),a=Un(Xn(sS(i))),o=Un(sS(e(s8)));r||=i.waiting;let s=D5(o,i);s&&n.push({id:`mac-app`,name:`Mac app`,message:s});let c=Un(sS(e(jge)));a&&c&&t.push({current:a.current,checking:i.waiting,error:D5(o,i),note:o?Age(o):void 0,target:{kind:`mac-app`,id:`mac-app`,name:`Mac app`,available:Qx(i)&&o?.status===`available`&&!i.waiting,latest:o&&`version`in o?o.version:void 0,update:c}})}else{let a=e(l2(i));r||=a.waiting,eS(a)&&n.push({id:i.environmentId,name:`This computer`,message:x2(Vl(a.cause))});let o=r2(a),s=Un(sS(e(R2(i))));o&&t.push({current:o.version,target:{kind:`service`,id:i.environmentId,name:s?.environment.name??`This computer`,connection:i,state:o,deviceId:_6.value}})}}for(let{remote:i,connection:a}of C6.value){a.activeRoute&&e.addFinalizer(a.activeRoute.subscribe(()=>e.refreshSelf()));let o=e(H0(g6,i,a));if(o.kind!==`online`)continue;let s=e(l2(a));r||=s.waiting,eS(s)&&n.push({id:i.environmentId,name:o.name,message:x2(Vl(s.cause))});let c=r2(s);c&&t.push({current:c.version,target:{kind:`service`,id:i.environmentId,name:o.name,connection:a,state:c,deviceId:a.activeRoute?.value?.deviceId??i.deviceId}})}return{rows:t,failures:n,checking:r}}),T5=PE((e,t)=>{let n=x6.state.value.connection,r=Un(sS(t(a8)));e===`retry`&&r?.isDesktopShell&&!t(o8).waiting&&t.refresh(o8);let i=new Set([...n&&!r?.isDesktopShell?[n]:[],...C6.value.map(({connection:e})=>e)]);for(let e of i){let n=l2(e);t(n).waiting||t.refresh(n)}}),Nge=bE(e=>{Qx(e(a8))&&e.set(T5,`entry`)}).pipe(uE(0));function Pge(){SN(Nge)}function E5(){let e=(0,QB.c)(11),{rows:t,failures:n,checking:r}=yN(Mge),i=CN(T5),a=yN(M2),[o,s]=TN(Fle),c;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==o||e[5]!==t||e[6]!==s){let l=t.map(Fge),u,d;e[8]===i?(u=e[9],d=e[10]):(u=()=>i(`entry`),d=()=>i(`retry`),e[8]=i,e[9]=u,e[10]=d),c={rows:t,failures:n,checking:r,refresh:u,retry:d,batch:a,result:o,run:s,targets:l,count:Mle(l)},e[0]=a,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=t,e[6]=s,e[7]=c}else c=e[7];return c}function Fge(e){return e.target}function D5(e,t){if(e?.status===`error`)return e.message;if(!t.waiting&&eS(t))return x2(Vl(t.cause))}function Ige(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=h8({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=Mz(a,!0,!0),u=vU(),[d,f]=Z.useState(),p=d===null?void 0:d??u,m=KN(e=>{let t=!a,n=SL(oL,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return Z.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var O5=Z.createContext(void 0);function k5(){let e=Z.useContext(O5);if(e===void 0)throw Error(LN(15));return e}var Lge=`data-open`,Rge=`data-closed`,zge=RP,Bge=`data-panel-open`,Vge={[Lge]:``},Hge={[Rge]:``},Uge={open(e){return e?{[Bge]:``}:null}},A5={open(e){return e?Vge:Hge},...BP},Wge=Z.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=KN(o),d=Ige({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=Z.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=Z.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=TI(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:A5});return(0,Q.jsx)(O5.Provider,{value:p,children:m})}),Gge={...Uge,...BP},Kge=Z.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=k5(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=nL({disabled:c,focusableWhenDisabled:!0,native:u});return TI(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:Gge})}),j5={height:void 0,width:void 0};function qge(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=Z.useRef(null),f=Z.useRef(null),[p,m]=Z.useState(j5),h=Z.useRef(j5),g=Z.useRef(!1),_=Z.useRef(s),v=Z.useRef(!1),[y,b]=Z.useState(!1),x=Z.useRef(null),S=$F(t,d),C=AL(s),w=II(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=KN((e,t=!0)=>{t&&(h.current=e),m(e)}),j=KN(()=>{x.current?.(),x.current=null}),M=KN(e=>{j(),x.current=()=>{x.current=null,e()}}),N=KN(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});FN(()=>{y&&u!==`starting`&&b(!1)},[y,u]),Z.useEffect(()=>()=>{N(),j()},[N,j]),FN(()=>{let e=d.current;if(!e)return;!s&&x.current&&j();let t=Jge(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=M5(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(M5(e)),b(!0);return}if(t===`css-transition`){let t=Yge(e);if(A(M5(e)),!n)return t;let r=P5(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(M5(e));let r=P5(e,`animation-name`,`none`);if(!n){r();return}let i=P5(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(_.current=!1,v.current=!1,t===`none`){A(j5,!1),c(!1);return}A(M5(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=M5(e);if(!(n.height>0||n.width>0)){c(!1);return}A(n),t===`css-animation`&&P5(e,`animation-name`,`none`)()},[a,s,j,A,c,M,D,u]),LI({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(j5,!1)}}),Z.useEffect(()=>{if(s||!a||E!==`ending`||!d.current)return;let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(j5,!1))}return t=bP.request(()=>{w(n,e.signal)}),()=>{bP.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),FN(()=>{let e=d.current;e&&n&&T&&e.setAttribute(`hidden`,`until-found`)},[T,n]),Z.useEffect(function(){let e=d.current;if(!e)return;function t(e){let t=SL(aL,e);o(!0,t),!t.isCanceled&&(g.current=!0,l(!0))}return _P(e,`beforematch`,t)},[o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[zge]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function M5(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Jge(e,t){let n=XN(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&N5(n.animationDuration),i=N5(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function N5(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function P5(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function Yge(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=bP.request(n);return()=>{bP.cancel(r),n()}}var Xge=`--collapsible-panel-height`,Zge=`--collapsible-panel-width`,Qge=Z.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=k5(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;FN(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=qge({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=lI(s,k),j=TI(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[Xge]:S===void 0?`auto`:`${S}px`,[Zge]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:A5});return E?j:null});function F5({...e}){return(0,Q.jsx)(Wge,{"data-slot":`collapsible`,...e})}function I5({...e}){return(0,Q.jsx)(Kge,{"data-slot":`collapsible-trigger`,...e})}function L5({...e}){return(0,Q.jsx)(Qge,{"data-slot":`collapsible-content`,...e})}function R5(e){let t=(0,QB.c)(86),{row:n,showName:r,prominent:i}=e,a=r!==void 0&&r,o=i!==void 0&&i,{target:s,current:c}=n,{batch:l,run:u}=E5(),d=c8(),f=T6(),p;if(t[0]!==l.entries||t[1]!==s.id||t[2]!==s.kind){let e;t[4]!==s.id||t[5]!==s.kind?(e=e=>e.id===s.id&&e.kind===s.kind,t[4]=s.id,t[5]=s.kind,t[6]=e):e=t[6],p=l.entries.find(e),t[0]=l.entries,t[1]=s.id,t[2]=s.kind,t[3]=p}else p=t[3];let m=p,h=j2(s),g;t[7]===s?g=t[8]:(g=s.kind===`service`?jle(s):void 0,t[7]=s,t[8]=g);let _=g,v;t[9]!==d||t[10]!==s.kind||t[11]!==s.state?(v=s.kind===`service`?xde(s.state,!1):w5(d),t[9]=d,t[10]=s.kind,t[11]=s.state,t[12]=v):v=t[12];let y=v;n.checking&&(y=`Checking for a new version…`);let b;t[13]!==s.kind||t[14]!==s.state?(b=s.kind===`service`?Sde(s.state):void 0,t[13]=s.kind,t[14]=s.state,t[15]=b):b=t[15];let x=b,S=s.kind===`service`?s.state.latest:s.latest,C=l.running&&(m?.status===`updating`||m?.status===`queued`),w;if(C||y){let e;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(M6,{}),t[16]=e):e=t[16];let n=y??(m?.status===`queued`?`Queued`:`Updating…`),r;t[17]===n?r=t[18]:(r=(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs leading-4`,children:[e,n]}),t[17]=n,t[18]=r),w=r}else if(h){let e=s.kind===`mac-app`?`Restart to update`:`Update ${s.name}`,n;t[19]!==u||t[20]!==s?(n=()=>u([s]),t[19]=u,t[20]=s,t[21]=n):n=t[21];let r=s.kind===`mac-app`?`Restart to update`:`Update`,i;t[22]!==l.running||t[23]!==e||t[24]!==n||t[25]!==r?(i=(0,Q.jsx)(XV,{size:`sm`,"aria-label":e,disabled:l.running,onClick:n,children:r}),t[22]=l.running,t[23]=e,t[24]=n,t[25]=r,t[26]=i):i=t[26],w=i}else if(_&&s.kind===`service`&&s.state.available){let e;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(I5,{render:(0,Q.jsx)(XV,{size:`sm`,variant:`ghost`}),children:[(0,Q.jsx)(HH,{}),`Needs trust`]}),t[27]=e):e=t[27],w=e}else{let e=n.note??(S?`Up to date`:`Latest version unavailable`);s.kind===`service`&&!s.state.managed&&(e=`Managed on that computer`);let r;t[28]!==e||t[29]!==n.error?(r=!n.error&&(0,Q.jsx)(`span`,{className:`text-xs leading-4 text-muted-foreground`,children:e}),t[28]=e,t[29]=n.error,t[30]=r):r=t[30],w=r}let T=`${s.name} update`,E=o?`gap-x-6 gap-y-3`:`gap-3`,D;t[31]===E?D=t[32]:(D=HV(`flex flex-wrap items-center justify-between`,E),t[31]=E,t[32]=D);let O;t[33]!==a||t[34]!==s.name?(O=a&&(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:s.name}),t[33]=a,t[34]=s.name,t[35]=O):O=t[35];let k=o?`text-sm leading-5 font-medium`:`text-xs leading-4 text-muted-foreground`,A;t[36]===k?A=t[37]:(A=HV(`tabular-nums`,k),t[36]=k,t[37]=A);let j=c??`Development build`,M;t[38]===j?M=t[39]:(M=(0,Q.jsx)(`span`,{children:j}),t[38]=j,t[39]=M);let N;t[40]!==S||t[41]!==s?(N=A2(s)&&S&&(0,Q.jsxs)(Q.Fragment,{children:[` → `,S]}),t[40]=S,t[41]=s,t[42]=N):N=t[42];let P;t[43]!==A||t[44]!==M||t[45]!==N?(P=(0,Q.jsxs)(`p`,{className:A,children:[M,N]}),t[43]=A,t[44]=M,t[45]=N,t[46]=P):P=t[46];let F;t[47]!==O||t[48]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[O,P]}),t[47]=O,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==w||t[51]!==F||t[52]!==D?(I=(0,Q.jsxs)(`div`,{className:D,children:[F,w]}),t[50]=w,t[51]=F,t[52]=D,t[53]=I):I=t[53];let L;t[54]!==s.kind||t[55]!==s.state||t[56]!==_?(L=_&&s.kind===`service`&&s.state.available&&(0,Q.jsx)(L5,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:_.hint}),_.deviceId&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`code`,{className:`break-all`,children:_.deviceId}),(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy device ID`,onClick:()=>HU(_.deviceId??``,`device ID`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{role:`tooltip`,className:`break-all`,children:`Copy device ID`})]})]})]})}),t[54]=s.kind,t[55]=s.state,t[56]=_,t[57]=L):L=t[57];let R;t[58]===n.error?R=t[59]:(R=n.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:n.error}),t[58]=n.error,t[59]=R);let ee;t[60]===m?ee=t[61]:(ee=m?.status===`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:m.message}),t[60]=m,t[61]=ee);let z;t[62]!==m?.status||t[63]!==x||t[64]!==C?(z=!C&&x?.kind===`failed`&&m?.status!==`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:x.reason}),t[62]=m?.status,t[63]=x,t[64]=C,t[65]=z):z=t[65];let te;t[66]===m?te=t[67]:(te=m?.status===`updated`&&(0,Q.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Updated to `,m.version,`.`]}),t[66]=m,t[67]=te);let ne;t[68]!==m?.status||t[69]!==f?.environmentId||t[70]!==s.id||t[71]!==s.kind?(ne=m?.status===`updated`&&s.kind===`service`&&f?.environmentId===s.id&&(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,className:`self-start`,onClick:$ge,children:`Reload`}),t[68]=m?.status,t[69]=f?.environmentId,t[70]=s.id,t[71]=s.kind,t[72]=ne):ne=t[72];let re;t[73]!==s.kind||t[74]!==s.state?(re=s.kind===`service`&&!s.state.managed&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This computer runs outside the installed service. Update it with npm, then run porcelain service update.`}),t[73]=s.kind,t[74]=s.state,t[75]=re):re=t[75];let ie;return t[76]!==I||t[77]!==L||t[78]!==R||t[79]!==ee||t[80]!==z||t[81]!==te||t[82]!==ne||t[83]!==re||t[84]!==T?(ie=(0,Q.jsx)(F5,{children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,role:`group`,"aria-label":T,children:[I,L,R,ee,z,te,ne,re]})}),t[76]=I,t[77]=L,t[78]=R,t[79]=ee,t[80]=z,t[81]=te,t[82]=ne,t[83]=re,t[84]=T,t[85]=ie):ie=t[85],ie}function $ge(){return window.location.reload()}function z5(e){let t=(0,QB.c)(19),{connection:n,prominent:r}=e,{rows:i}=E5(),a;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>{let{target:t}=e;return t.kind===`service`&&t.id===n.environmentId},t[3]=n,t[4]=e),a=i.find(e),t[0]=n,t[1]=i,t[2]=a}else a=t[2];let o=a,s=rhe(n),c;t[5]===n?c=t[6]:(c=l2(n),t[5]=n,t[6]=c);let l=wN(c);if(o){let e;return t[7]!==r||t[8]!==o?(e=(0,Q.jsx)(R5,{row:o,prominent:r}),t[7]=r,t[8]=o,t[9]=e):e=t[9],e}if(eS(s)){let e;t[10]===s.cause?e=t[11]:(e=x2(Vl(s.cause)),t[10]=s.cause,t[11]=e);let n;t[12]!==l||t[13]!==s.waiting?(n=(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,disabled:s.waiting,onClick:l,children:`Try again`}),t[12]=l,t[13]=s.waiting,t[14]=n):n=t[14];let r;return t[15]!==e||t[16]!==n?(r=(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsxs)($6,{children:[e,n]})}),t[15]=e,t[16]=n,t[17]=r):r=t[17],r}let u;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(M6,{}),t[18]=u):u=t[18],u}function e_e(e){let t=(0,QB.c)(3),{prominent:n}=e,r=n!==void 0&&n,i=T6(),a;return t[0]!==i||t[1]!==r?(a=i&&(0,Q.jsx)(z5,{connection:i,prominent:r}),t[0]=i,t[1]=r,t[2]=a):a=t[2],a}function t_e(e){let t=(0,QB.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(z5,{connection:n,prominent:!0}),t[0]=n,t[1]=r),r}function n_e(e){let t=(0,QB.c)(7),{prominent:n}=e,r=n!==void 0&&n,{rows:i,checking:a}=E5(),o;t[0]===i?o=t[1]:(o=i.find(r_e),t[0]=i,t[1]=o);let s=o;if(s){let e;return t[2]!==r||t[3]!==s?(e=(0,Q.jsx)(R5,{row:s,prominent:r}),t[2]=r,t[3]=s,t[4]=e):e=t[4],e}let c;return t[5]===a?c=t[6]:(c=a?(0,Q.jsx)(M6,{}):null,t[5]=a,t[6]=c),c}function r_e(e){let{target:t}=e;return t.kind===`mac-app`}var B5=Z.createContext(void 0);function i_e(){let e=Z.useContext(B5);if(e===void 0)throw Error(LN(63));return e}var a_e=`data-checked`,o_e=`data-unchecked`,V5={...l8,checked(e){return e?{[a_e]:``}:{[o_e]:``}}},s_e=Z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=d8(),{state:x,setTouched:S,setDirty:C,validityData:w,setFilled:T,setFocused:E,validationMode:D,disabled:O,name:k,validation:A}=u8(),{labelId:j}=f8(),M=O||m,N=k??l,P=Z.useRef(null),F=$F(P,c,A.inputRef),I=Z.useRef(null),L=vU(),R=m8({id:s}),ee=u?void 0:R,[z,te]=h8({controlled:n,default:!!i,name:`Switch`,state:`checked`});g8(I,L,z,void 0,!M,l),FN(()=>{T(z)},[z,T]),_8(z,()=>{b(N),C(z!==w.initialValue),A.change(z)});let{getButtonProps:ne,buttonRef:re}=nL({disabled:M,native:u}),ie=p8(a,j,P,!u,ee),ae={id:u?R:L,role:`switch`,"aria-checked":z,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ie,onFocus(){M||E(!0)},onBlur(){let e=P.current;e&&!M&&(S(!0),E(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){if(f||M)return;e.preventDefault();let t=P.current;t&&tL(t,e)}},oe={...A.getValidationProps(M),checked:z,disabled:M,form:o,id:ee,name:N,required:p,style:N?ZF:XF,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=SL(aL,e.nativeEvent);d?.(t,n),!n.isCanceled&&te(t)},onClick(e){e.stopPropagation()},onFocus(){I.current?.focus()},..._===void 0?jN:{value:_}},se=Z.useMemo(()=>({...x,checked:z,disabled:M,readOnly:f,required:p}),[x,z,M,f,p]),ce=TI(`span`,e,{state:se,ref:[t,I,re],props:[ae,y,ne,e=>A.getValidationProps(M,e)],stateAttributesMapping:V5});return(0,Q.jsxs)(B5.Provider,{value:se,children:[ce,!z&&N&&g!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:o,name:N,value:g,disabled:M}),(0,Q.jsx)(`input`,{...oe,suppressHydrationWarning:!0})]})}),c_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return TI(`span`,e,{state:i_e(),ref:t,stateAttributesMapping:V5,props:a})});function H5({className:e,size:t=`default`,...n}){return(0,Q.jsx)(s_e,{"data-slot":`switch`,"data-size":t,className:HV(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,Q.jsx)(c_e,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function l_e(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}var U5=Z.createContext(void 0),W5=Z.createContext(void 0),G5=Z.createContext(void 0);function K5(){let e=Z.useContext(U5);if(e===void 0)throw Error(LN(60));return e}function q5(){let e=Z.useContext(W5);if(e===void 0)throw Error(LN(101));return e}function J5(){let e=Z.useContext(G5);if(e===void 0)throw Error(LN(61));return e}function u_e(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var Y5=(e,t)=>Object.is(e,t);function X5(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function d_e(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!u_e(e,t,(e,t)=>X5(e,t,n)):e!==t}function Z5(e,t,n){return e?e.some(e=>e!==void 0&&X5(t,e,n)):!1}function Q5(e,t,n){return e?e.findIndex(e=>e!==void 0&&X5(e,t,n)):-1}function f_e(e,t){if(t!==Y5)return n=>Z5(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function $5(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(f_e(t,n)):Q5(e,t,n);return i===-1?null:i}function p_e(e,t,n,r,i,a){return Z5(r,t,i)?a!=null&&e>a&&Z5(r,n[a],i)?a:e:e===a?$5(n,r,i,!0):a}function m_e(e,t,n){return e.filter(e=>!X5(t,e,n))}function e7(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function h_e(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function t7(e){return h_e(e?.[0])}function g_e(e){return t7(e)?e.flatMap(e=>e.items):e}function __e(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(t7(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function n7(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return e7(e)}function r7(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?e7(e.value):e7(e)}function i7(e,t,n){function r(){return n7(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=g_e(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function v_e(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:i7(r,t,n)},i)),e),[])}var y_e={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:r7(t,r)!==``},hasNullItemLabel:(e,t)=>t?__e(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>X5(t,e,n)):X5(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function a7(e,t){return Math.max(0,e-t)}function o7(e,t){if(t<=0)return 0;let n=qI(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function b_e(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=Y5,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=d8(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=u8(),F=m8({id:t}),I=M||d,L=j??c,[R,ee]=h8({controlled:n,default:y?r??AN:r,name:`Select`,state:`value`}),[z,te]=h8({controlled:a,default:o,name:`Select`,state:`open`}),ne=Z.useRef([]),re=Z.useRef([]),ie=Z.useRef(null),ae=Z.useRef(null),oe=Z.useRef(0),se=Z.useRef(null),ce=Z.useRef([]),le=Z.useRef(!1),ue=Z.useRef(null),de=Z.useRef(null),fe=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=Z.useRef(!1),me=Z.useRef(R),{mounted:he,setMounted:ge,transitionStatus:_e}=Mz(z),{openMethod:ve,triggerProps:ye}=u5(z),be=PN(()=>new qN({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:z,mounted:he,transitionStatus:_e,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:jN,triggerProps:jN,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:kN,setOpen:kN,handleScrollArrowVisibility:kN,onOpenChangeComplete:kN,listRef:ne,popupRef:ie,scrollHandlerRef:ae,scrollArrowsMountedCountRef:oe,valueRef:se,valuesRef:ce,labelsRef:re,typingRef:le,selectionRef:fe,firstItemTextRef:ue,selectedItemTextRef:de,alignItemWithTriggerActiveRef:pe,initialValueRef:me},y_e)).current,xe=be.useState(`activeIndex`),Se=be.useState(`selectedIndex`),Ce=be.useState(`triggerElement`),we=be.useState(`positionerElement`),Te=PU(ve),Ee=ve??Te,De=Z.useMemo(()=>y?``:r7(R,x),[y,R,x]),Oe=Z.useMemo(()=>y&&Array.isArray(R)?R.map(e=>r7(e,x)):r7(R,x),[y,R,x]);g8(AL(Ce),F,R,KN(()=>Oe),!I,c);let ke=y?Array.isArray(R)&&R.length>0:R!=null&&De!==``;FN(()=>{A(ke)},[ke,A]),FN(function(){let e=$5(ce.current,R,S,y);e===null&&(de.current=null),!z&&be.set(`selectedIndex`,e)},[y,z,R,S,be]),_8(R,()=>{T(L),E(d_e(R,k.initialValue,S)),N.change(R)});let Ae=KN((e,t)=>{s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),je=KN(()=>{ge(!1),be.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});LI({enabled:!h,open:z,ref:ie,onComplete(){z||je()}}),Z.useImperativeHandle(h,()=>({unmount:je}),[je]);let Me=KN((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ne=KN(e=>{let t=a7(e.scrollHeight,e.clientHeight),n=o7(e.scrollTop,t),r=n>0,i=n<t;be.set(`scrollUpArrowVisible`,r),be.set(`scrollDownArrowVisible`,i)}),Pe=nB({open:z,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Fe=yR(Pe,{enabled:!I,event:`mousedown`}),Ie=TR(Pe),Le=SB(Pe,{enabled:!I,listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:AN,onNavigate(e){(e!==null||z)&&be.set(`activeIndex`,e)},focusItemOnHover:C}),Re=CB(Pe,{enabled:!I&&(z||!f&&!y),listRef:re,activeIndex:xe,selectedIndex:Se,disabledIndices:e=>_5(ne.current[e]),onMatch(e){z?be.set(`activeIndex`,e):Me(ce.current[e],SL(aL))},onTyping(e){le.current=e}}),ze=Z.useMemo(()=>dI(Re.reference,Le.reference,Ie.reference,Fe.reference,ye),[Fe.reference,Re.reference,Le.reference,Ie.reference,ye]),Be=Z.useMemo(()=>dI(Nz,Re.floating,Le.floating,Ie.floating),[Re.floating,Le.floating,Ie.floating]),Ve=Le.item??jN;be.useContextCallback(`setValue`,Me),be.useContextCallback(`setOpen`,Ae),be.useContextCallback(`handleScrollArrowVisibility`,Ne),be.useContextCallback(`onOpenChangeComplete`,_),l_e(()=>{be.update({popupProps:Be,triggerProps:ze})}),be.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:z,mounted:he,transitionStatus:_e,popupProps:Be,triggerProps:ze,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:Ee});let He=Z.useMemo(()=>({disabled:I,readOnly:f,required:p,multiple:y,highlightItemOnHover:C,itemProps:Ve}),[I,f,p,y,C,Ve]),Ue=$F(g,N.inputRef),We=y?void 0:L,Ge=Z.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=r7(e,x);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,Q.jsxs)(U5.Provider,{value:be,children:[(0,Q.jsx)(W5.Provider,{value:He,children:(0,Q.jsx)(G5.Provider,{value:Pe,children:w})}),(0,Q.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){be.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=SL(aL,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ce.current.findIndex(t=>r7(t,x).toLowerCase()===e||n7(t,b).toLowerCase()===e);r===-1&&(r=ce.current.findIndex((t,n)=>{let r=re.current[n];return r!=null&&r.toLowerCase()===e}));let i=ce.current[r];i!=null&&Me(i,n)}be.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&We==null?`${F}-hidden-input`:void 0,form:l,name:We,autoComplete:u,value:De,disabled:I,required:p&&!(y&&ke),readOnly:f,ref:Ue,style:L?ZF:XF,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ge]})}function x_e(e,t){return e??t}var S_e=`data-popup-side`,C_e=400,w_e={...UP,...l8,popupSide:e=>e?{[S_e]:e}:null,value:()=>null},T_e=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=u8(),{labelId:h}=f8(),g=K5(),{readOnly:_,required:v,disabled:y}=q5(),b=m||y||a,x=g.useState(`open`),S=g.useState(`mounted`),C=g.useState(`value`),w=g.useState(`triggerProps`),T=g.useState(`positionerElement`),E=g.useState(`listElement`),D=g.useState(`popupSide`),O=g.useState(`id`),k=g.useState(`labelId`),A=g.useState(`hasSelectedValue`),j=S&&T?D:null,M=i??O,N=x_e(h,k);m8({id:i});let P=AL(T),F=Z.useRef(null),{getButtonProps:I,buttonRef:L}=nL({disabled:b,native:o}),R=g.useStateSetter(`triggerElement`),ee=wP(),z=wP(),te=wP();Z.useEffect(()=>{if(x)return te.start(C_e,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},z.clear()},[x,g,z,te]);let ne=dI(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??QP(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":_||void 0,"aria-required":v||void 0,tabIndex:b?-1:0,onFocus(e){u(!0),x&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,SL(aL,e.nativeEvent)),ee.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){PP(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=gP(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;PP(F.current,t)||PP(P.current,t)||p5(e,F.current)||g.context.setOpen(!1,SL(hL,e))}z.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),re=f.getValidationProps(b,ne);re.role=`combobox`;let ie={...p,open:x,disabled:b,value:C,readOnly:_,popupSide:j,placeholder:!A};return TI(`button`,e,{ref:[t,F,L,R],state:ie,stateAttributesMapping:w_e,props:re})}),E_e={value:()=>null},D_e=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=K5(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?v_e(l,u,d):i7(l,u,d)),TI(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:E_e})}),O_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return TI(`span`,e,{state:{open:K5().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:HP})}),k_e=Z.forwardRef(function(e,t){let n=K5(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Q.jsx)(OL,{ref:t,...e}):null}),s7=Z.createContext(void 0);function c7(){let e=Z.useContext(s7);if(!e)throw Error(LN(59));return e}function l7(e,t){e&&Object.assign(e.style,t)}var u7={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},A_e={position:`fixed`},j_e=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=WI,style:_,...v}=e,y=K5(),b=J5(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=Z.useRef(null),j=Z.useRef(null),[M,N]=Z.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),Z.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),i5((P||C)&&x,T===`touch`,E,D);let F=qB({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?A_e:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};FN(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=ZB(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),z=Z.useRef(0),te=KN(e=>{if(y.context.valuesRef.current.length===0)return;let t=z.current;z.current=e.size;let n=SL(aL);if(t!==0&&!y.state.multiple&&w!==null&&Q5(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&Q5(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>Q5(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};l7(E,e),l7(y.context.popupRef.current,e)}}),ne=Z.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,Q.jsx)(Y8,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:te,children:(0,Q.jsxs)(s7.Provider,{value:ne,children:[S&&C&&(0,Q.jsx)(Z8,{inert:MI(!x),cutout:D}),ee]})})}),d7=`base-ui-disable-scrollbar`,f7={className:d7,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:d7,precedence:`base-ui:low`,children:`.${d7}{scrollbar-width:none}.${d7}::-webkit-scrollbar{display:none}`})}},M_e=Z.createContext(void 0),N_e={disableStyleElements:!1};function p7(){return Z.useContext(M_e)??N_e}var m7=`--transform-origin`,P_e={...WP,...BP},F_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=K5(),{multiple:c,readOnly:l,highlightItemOnHover:u}=q5(),d=J5(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=c7(),_=I8(!0)!=null,v=NB(),{nonce:y,disableStyleElements:b}=p7(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef({}),N=xP(),P=KN(e=>{if(!O||!s.context.popupRef.current||!j.current)return;let t=O.style.top===`0px`,n=O.style.bottom===`0px`;if(A.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=_7(O),i=v7(O.getBoundingClientRect().height,`y`,r),a=gP(O),o=XN(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=h7(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=g7(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=qI(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=qI(g,0,g7(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});Z.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),LI({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};FN(()=>{O&&s.context.popupRef.current&&!Object.keys(M.current).length&&(M.current={top:O.style.top||`0`,left:O.style.left||`0`,right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[s,O]),FN(()=>{S||m||(j.current=!1,A.current=!1,l7(O,M.current))},[S,m,O]),FN(()=>{let e=s.context.popupRef.current;if(!S||!D||!O||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(j.current=!0,e.style.removeProperty(m7),!m){N.request(()=>s.context.handleScrollArrowVisibility(k||e));return}let t=I_e(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=XN(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=gP(D),c=_7(D),l=y7(D.getBoundingClientRect(),c),d=y7(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=h7(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=y7(n.getBoundingClientRect(),c);T=y7(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${qI(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=g7(p),ee=I>=R-1;ee&&(P=Math.min(S,d.height)-(I-R));let z=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),te=(r.visualViewport?.scale??1)!==1&&jP;if(z||te){l7(O,M.current),g(!1);return}let ne=Math.max(b,P);if(ee){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=g7(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=qI(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(m7,`50% ${i}%`)}(ne===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),Z.useEffect(()=>{if(!m||!O||!S)return;let e=XN(O);function t(e){s.context.setOpen(!1,SL(xL,e))}return _P(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&V8.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:u7},className:!k&&m?f7.className:void 0},L=TI(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:P_e,props:[T,I,XB(E),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!b&&f7.getElement(y),(0,Q.jsx)(vR,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})});function h7(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function g7(e){return a7(e.scrollHeight,e.clientHeight)}function _7(e){return cz.getScale(e)}function v7(e,t,n){return e/n[t]}function y7(e,t){return CF({x:v7(e.x,`x`,t),y:v7(e.y,`y`,t),width:v7(e.width,`x`,t),height:v7(e.height,`y`,t)})}var b7=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function I_e(e){let{style:t}=e,n={};for(let[e,r]of b7)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of b7){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var L_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K5(),{multiple:s,readOnly:c}=q5(),{alignItemWithTriggerActive:l}=c7(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:u7},className:u&&d!==`touch`?f7.className:void 0};return TI(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),x7=Z.createContext(void 0);function S7(){let e=Z.useContext(x7);if(!e)throw Error(LN(57));return e}var R_e=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=j8({guess:!0,label:o,textRef:u}),f=K5(),{itemProps:p,multiple:m,disabled:h,readOnly:g}=q5(),_=h||s,v=f.useState(`isActive`,d.index),y=f.useState(`open`),b=f.useState(`isSelected`,a),x=f.useState(`isSelectedByFocus`,d.index),S=f.useState(`isItemEqualToValue`),C=d.index,w=Z.useRef(null);FN(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),FN(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=p_e(C,a,f.context.valuesRef.current,e,S,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&X5(a,e,S),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,S,f,a]);let T=Z.useRef(`mouse`),E=Z.useRef(!1),{getButtonProps:D,buttonRef:O}=nL({disabled:_,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:_,selected:b,highlighted:v};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=b?m_e(n,a,S):[...n,a];f.context.setValue(r,SL(uL,e))}else f.context.setValue(a,SL(uL,e)),f.context.setOpen(!1,SL(uL,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":b,tabIndex:y&&v?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&nF(e.nativeEvent)&&(n!==void 0||v),i=t&&!r&&!E.current;E.current=!1,!(_||i)&&A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),_||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&b,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!b;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=TI(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=Z.useMemo(()=>({selected:b,index:C,textRef:u,selectedByFocus:x}),[b,C,u,x]);return(0,Q.jsx)(x7.Provider,{value:P,children:N})})),z_e=Z.forwardRef(function(e,t){let{selected:n}=S7();return e.keepMounted||n?(0,Q.jsx)(B_e,{...e,ref:t}):null}),B_e=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=S7(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=Mz(s),d=TI(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:BP});return LI({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),V_e=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=S7(),a=K5(),{render:o,className:s,style:c,...l}=e;return TI(`div`,e,{ref:[Z.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),C7=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=K5(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=c7(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=wP(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=Mz(g);FN(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),LI({open:g,ref:v,onComplete(){g||x(!1)}});let S=TI(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=a7(e.scrollHeight,e.clientHeight),r=o7(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){_.clear();return}if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=H_e(a,c,r,e.clientHeight,t,n)}_.start(40,t)}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:BP});return y||o?S:null});function H_e(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?o7(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?o7(l.offsetTop+l.offsetHeight-r+i,a):a}var U_e=Z.forwardRef(function(e,t){return(0,Q.jsx)(C7,{...e,ref:t,direction:`down`})}),W_e=Z.forwardRef(function(e,t){return(0,Q.jsx)(C7,{...e,ref:t,direction:`up`})}),w7=Z.createContext(void 0);function G_e(){let e=Z.useContext(w7);if(e===void 0)throw Error(LN(56));return e}var K_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(),c=Z.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=TI(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(w7.Provider,{value:c,children:l})}),q_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=G_e(),c=vU(a);return FN(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),TI(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),T7=b_e;function J_e({className:e,...t}){return(0,Q.jsx)(K_e,{"data-slot":`select-group`,className:HV(`scroll-my-1 p-1`,e),...t})}function E7({className:e,...t}){return(0,Q.jsx)(D_e,{"data-slot":`select-value`,className:HV(`flex flex-1 text-left`,e),...t})}function D7({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(T_e,{"data-slot":`select-trigger`,"data-size":t,className:HV(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed whitespace-nowrap transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),...r,children:[n,(0,Q.jsx)(O_e,{render:(0,Q.jsx)(gH,{className:`pointer-events-none size-3.5 text-muted-foreground`})})]})}function O7({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,Q.jsx)(k_e,{children:(0,Q.jsx)(j_e,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Q.jsxs)(F_e,{"data-slot":`select-content`,"data-align-trigger":o,className:HV(`isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,e),...s,children:[(0,Q.jsx)(X_e,{}),(0,Q.jsx)(L_e,{children:t}),(0,Q.jsx)(Z_e,{})]})})})}function Y_e({className:e,...t}){return(0,Q.jsx)(q_e,{"data-slot":`select-label`,className:HV(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function k7({className:e,children:t,...n}){return(0,Q.jsxs)(R_e,{"data-slot":`select-item`,className:HV(`relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,Q.jsx)(V_e,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(z_e,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`}),children:(0,Q.jsx)(mH,{className:`pointer-events-none`})})]})}function X_e({className:e,...t}){return(0,Q.jsx)(W_e,{"data-slot":`select-scroll-up-button`,className:HV(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5`,e),...t,children:(0,Q.jsx)(vH,{})})}function Z_e({className:e,...t}){return(0,Q.jsx)(U_e,{"data-slot":`select-scroll-down-button`,className:HV(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5`,e),...t,children:(0,Q.jsx)(gH,{})})}var A7=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(A7||{}),Q_e=[0,1],j7=[1,0],M7=[2,3],N7=[3,2],$_e={L:Q_e,M:j7,Q:M7,H:N7},eve=/^\d*$/,tve=/^[A-Z0-9 $%*+./:-]*$/,P7=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,F7=1,I7=40,L7=3,nve=3,R7=40,rve=10,z7=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],B7=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],ive=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<F7||e>I7)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,A7.Timing),this.setFunctionModule(e,6,e%2==0,A7.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,H7(r,e));this.setFunctionModule(8,7,H7(r,6)),this.setFunctionModule(8,8,H7(r,7)),this.setFunctionModule(7,8,H7(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,H7(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,H7(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,H7(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=H7(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,A7.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,A7.Alignment)}setFunctionModule(e,t,n,r=A7.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Y7(t,n))throw RangeError(`Invalid argument`);let r=B7[n[0]][t],i=z7[n[0]][t],a=Math.floor(J7(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=pve(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=mve(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(J7(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=H7(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=L7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*R7),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*R7}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=L7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*R7),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*R7}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=nve)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*rve,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function V7(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function H7(e,t){return!!(e>>>t&1)}var U7=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},ave=[1,10,12,14],ove=[2,9,11,13],sve=[4,8,16,16];function W7(e,t){return e[Math.floor((t+7)/17)+1]}function G7(e){let t=[];for(let n of e)V7(n,8,t);return new U7(sve,e.length,t)}function cve(e){if(!K7(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);V7(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new U7(ave,e.length,t)}function lve(e){if(!q7(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=P7.indexOf(e.charAt(n))*45;r+=P7.indexOf(e.charAt(n+1)),V7(r,11,t)}return n<e.length&&V7(P7.indexOf(e.charAt(n)),6,t),new U7(ove,e.length,t)}function uve(e){return e===``?[]:K7(e)?[cve(e)]:q7(e)?[lve(e)]:[G7(fve(e))]}function K7(e){return eve.test(e)}function q7(e){return tve.test(e)}function dve(e,t){let n=0;for(let r of e){let e=W7(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function fve(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function J7(e){if(e<F7||e>I7)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function Y7(e,t){return Math.floor(J7(e)/8)-z7[t[0]][e]*B7[t[0]][e]}function pve(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=X7(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=X7(n,2)}return t}function mve(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=X7(t,e))}return n}function X7(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function hve(e,t,n=1,r=40,i=-1,a=!0){if(!(F7<=n&&n<=r&&r<=I7)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=Y7(o,t)*8,i=dve(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[j7,M7,N7])a&&s<=Y7(o,e)*8&&(t=e);let c=[];for(let t of e){V7(t.mode[0],4,c),V7(t.numChars,W7(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Y7(o,t)*8;V7(0,Math.min(4,l-c.length),c),V7(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)V7(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new ive(o,t,u,i)}function gve(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?uve(e):Array.isArray(e)?[G7(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=hve(c,$_e[n],i,a,o,r),u=_ve({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function _ve(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=A7.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function vve(e){let t=(0,QB.c)(9),{link:n}=e,r,i;if(t[0]!==n){let{size:e,data:a}=gve(n,{ecc:`M`,border:2});r=e,i=a.flatMap(yve).join(``),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a=i,o=r*2,s=`0 0 ${r} ${r}`,c;t[3]===a?c=t[4]:(c=(0,Q.jsx)(`path`,{d:a,fill:`currentColor`}),t[3]=a,t[4]=c);let l;return t[5]!==o||t[6]!==s||t[7]!==c?(l=(0,Q.jsx)(`svg`,{role:`img`,"aria-label":`Pairing QR code`,width:o,height:o,viewBox:s,shapeRendering:`crispEdges`,className:`shrink-0 rounded-sm bg-white text-black`,children:c}),t[5]=o,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function yve(e,t){return e.flatMap((e,n)=>e?[`M${n} ${t}h1v1h-1z`]:[])}function bve(e){let t=(0,QB.c)(50),{connection:n,remote:r,disabled:i}=e,a=i!==void 0&&i,o=tle(r),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(!0),[p,m]=(0,Z.useState)(!0),[h,g]=xhe(n),_=n8(n),v;t[0]!==_||t[1]!==h?(v=Qx(h)&&Qx(_)&&_.value?.grants.some(e=>e.id===h.value?.id)===!0?h.value:null,t[0]=_,t[1]=h,t[2]=v):v=t[2];let y=v,b=o.find(e=>{let{url:t}=e;return t===l})??o[0],x=y&&o.find(e=>{let{url:t}=e;return t===y.address})?.route;if(b===void 0){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on a way in above to pair a device.`}),t[3]=e):e=t[3],e}let S=e=>b8(e,async()=>g({label:s.trim(),addresses:[b.url],trusted:d,canManageSharing:p})),C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(I6,{htmlFor:`pairing-label`,children:`Device name`}),t[4]=C):C=t[4];let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>c(e.target.value),t[5]=w):w=t[5];let T;t[6]===s?T=t[7]:(T=(0,Q.jsxs)(B6,{className:`min-w-0 flex-1`,children:[C,(0,Q.jsx)(v8,{id:`pairing-label`,placeholder:`My phone`,maxLength:gde,value:s,onChange:w})]}),t[6]=s,t[7]=T);let E=o.length>1&&(0,Q.jsxs)(B6,{className:`min-w-0`,children:[(0,Q.jsx)(I6,{htmlFor:`pairing-address`,children:`Opens through`}),(0,Q.jsxs)(T7,{items:o.map(Sve),disabled:a,value:b.url,onValueChange:e=>{e&&u(e)},children:[(0,Q.jsx)(D7,{id:`pairing-address`,"aria-describedby":`pairing-address-url`,className:`w-full`,children:(0,Q.jsx)(E7,{children:Q0[b.route]})}),(0,Q.jsx)(O7,{children:o.map(xve)})]}),(0,Q.jsx)(`p`,{id:`pairing-address-url`,className:`text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:b.url})]}),D;t[8]!==a||t[9]!==h.waiting||t[10]!==s?(D=a||h.waiting||s.trim()===``,t[8]=a,t[9]=h.waiting,t[10]=s,t[11]=D):D=t[11];let O;t[12]===h.waiting?O=t[13]:(O=h.waiting?(0,Q.jsx)(M6,{}):(0,Q.jsx)(RH,{}),t[12]=h.waiting,t[13]=O);let k;t[14]!==D||t[15]!==O?(k=(0,Q.jsxs)(XV,{type:`submit`,size:`sm`,className:`shrink-0`,disabled:D,children:[O,`Create pairing link`]}),t[14]=D,t[15]=O,t[16]=k):k=t[16];let A;t[17]!==T||t[18]!==E||t[19]!==k||t[20]!==S?(A=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:S,children:[T,E,k]}),t[17]=T,t[18]=E,t[19]=k,t[20]=S,t[21]=A):A=t[21];let j;t[22]!==a||t[23]!==p||t[24]!==m?(j=(0,Q.jsx)(H5,{id:`pairing-management`,checked:p,disabled:a,onCheckedChange:m}),t[22]=a,t[23]=p,t[24]=m,t[25]=j):j=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(I6,{htmlFor:`pairing-management`,children:`Can manage sharing`}),t[26]=M):M=t[26];let N;t[27]===j?N=t[28]:(N=(0,Q.jsxs)(B6,{orientation:`horizontal`,children:[j,M]}),t[27]=j,t[28]=N);let P;t[29]!==a||t[30]!==f||t[31]!==d?(P=(0,Q.jsx)(H5,{id:`pairing-trusted`,checked:d,disabled:a,onCheckedChange:f}),t[29]=a,t[30]=f,t[31]=d,t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(I6,{htmlFor:`pairing-trusted`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`The paired device can update Porcelain`}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`Can update Porcelain`})]}),t[33]=F):F=t[33];let I;t[34]===P?I=t[35]:(I=(0,Q.jsxs)(B6,{orientation:`horizontal`,children:[P,F]}),t[34]=P,t[35]=I);let L=Q0[b.route],R;t[36]===L?R=t[37]:(R=(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Uses `,L,`. Pair again to add another way in.`]}),t[36]=L,t[37]=R);let ee;t[38]===h?ee=t[39]:(ee=eS(h)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Vl(h.cause))})}),t[38]=h,t[39]=ee);let z;t[40]!==y||t[41]!==x?(z=y&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg bg-white p-1 inset-ring inset-ring-border`,children:(0,Q.jsx)(vve,{link:y.link})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-20 flex-col gap-1 pt-0.5`,children:[(0,Q.jsxs)(`p`,{className:`text-ui leading-4.5 font-medium`,children:[`Scan on `,y.label]}),(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Works once, until`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:new Date(y.expiresAt).toLocaleTimeString()}),x&&(0,Q.jsxs)(Q.Fragment,{children:[`, through `,Q0[x]]}),`.`]})]})]}),(0,Q.jsx)(`p`,{"aria-label":`Pairing link`,className:`font-mono text-2xs leading-4 break-all text-muted-foreground`,children:y.link}),(0,Q.jsxs)(XV,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>HU(y?.link??``,`pairing link`),children:[(0,Q.jsx)(OH,{}),`Copy link`]})]}),t[40]=y,t[41]=x,t[42]=z):z=t[42];let te;return t[43]!==A||t[44]!==N||t[45]!==I||t[46]!==R||t[47]!==ee||t[48]!==z?(te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[A,N,I,R,ee,z]}),t[43]=A,t[44]=N,t[45]=I,t[46]=R,t[47]=ee,t[48]=z,t[49]=te):te=t[49],te}function xve(e){let{route:t,url:n}=e;return(0,Q.jsx)(k7,{value:n,children:(0,Q.jsx)(`span`,{className:`mr-4 min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:`${Q0[t]} · ${n}`})},n)}function Sve(e){let{route:t,url:n}=e;return{value:n,label:`${Q0[t]} · ${n}`}}var Z7=Z.createContext(void 0);function Q7(){let e=Z.useContext(Z7);if(e===void 0)throw Error(LN(64));return e}var Cve=`data-activation-direction`,$7={tabActivationDirection:e=>({[Cve]:e})},wve=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=Z.useRef([]),[f,p]=Z.useState(()=>new Map),[m,h]=h8({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=Z.useState(()=>new Map),y=Z.useRef(void 0),b=Z.useCallback(e=>e9(_,e),[_]),[x,S]=Z.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==m&&(T=t9(C,m,a,_),E=C!=null&&m!=null&&b(m)==null);let D=E?C:m,O=C!==D||w!==T;FN(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=KN((e,t)=>{t.activationDirection=t9(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),A=KN((e,t)=>{i?.(e,SL(t,void 0,void 0,{activationDirection:`none`}))}),j=KN((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),M=Z.useCallback(e=>f.get(e),[f]),N=Z.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),P=Z.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:T,value:m}),[b,N,M,k,a,j,v,T,m]),F=Z.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=Z.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=Z.useRef(!u),R=Z.useRef(r),ee=Z.useRef(u),z=Z.useRef(!1);FN(()=>{if(g)return;function e(e,t){h(e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),L.current=!1}if(_.size===0){z.current&&m!==null&&!y.current?.isConnected&&e(null,vL);return}z.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(ee.current=!1),ee.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=vL;r?i=yL:t&&(i=_L),e(n,i);return}r&&F!=null&&(A(m,yL),L.current=!1)},[I,g,A,F,h,_,m]);let te=TI(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:$7});return(0,Q.jsx)(Z7.Provider,{value:P,children:(0,Q.jsx)(Y8,{elementsRef:d,children:te})})});function e9(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function t9(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=e9(r,e),c=e9(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var Tve=`data-composite-item-active`,n9=Z.createContext(void 0);function Eve(){let e=Z.useContext(n9);if(e===void 0)throw Error(LN(65));return e}var Dve=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=Q7(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=Eve(),{highlightedIndex:v,onHighlightedIndexChange:y}=$I(),b=vU(o),{compositeProps:x,compositeRef:S,index:C}=m5({metadata:Z.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),w=a===u,T=Z.useRef(!1),E=Z.useRef(null),D=KN(e=>{E.current?.(),E.current=e?g(e):null});FN(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=NP(gP(e));if(t&&PP(e,t))return}r||y(C)},[w,C,v,y,r,_]);let{getButtonProps:O,buttonRef:k}=nL({disabled:r,native:s,focusableWhenDisabled:!0}),A=d(a),j=Z.useRef(!1),M=Z.useRef(!1);function N(e){f(a,SL(aL,e.nativeEvent,void 0,{activationDirection:`none`}))}function P(e){w||r||N(e)}function F(e){w||r||h&&(!j.current||M.current)&&N(e)}function I(e){if(w||r)return;j.current=!0,M.current=e.button===0;let t=gP(e.currentTarget);function n(){j.current=!1,M.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return TI(`button`,e,{state:{disabled:r,active:w,orientation:p,tabActivationDirection:m},ref:[t,k,S,D],props:[x,{role:`tab`,"aria-controls":A,"aria-selected":w,id:b,onClick:P,onFocus:F,onPointerDown:I,[Tve]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,O],stateAttributesMapping:$7})}),Ove=`data-index`,kve={...$7,...BP},Ave=Z.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=Q7(),p=vU(),{ref:m,index:h}=j8(),g=r===c,{mounted:_,transitionStatus:v,setMounted:y}=Mz(g),b=!_,x=l(r),S={hidden:b,orientation:u,tabActivationDirection:d,transitionStatus:v},C=Z.useRef(null),w=TI(`div`,e,{state:S,ref:[t,m,C],props:[{"aria-labelledby":x,hidden:b,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:MI(!g),[Ove]:h},s],stateAttributesMapping:kve});return LI({open:g,ref:C,onComplete(){g||y(!1)}}),FN(()=>{if(!(p==null||b&&!a))return f(r,p)},[b,a,r,p,f]),a||_?w:null});function jve(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=AN}=e,[p,m]=Z.useState(0),h=r!=null,g=Z.useRef(null),_=$F(g,c),v=Z.useRef([]),y=Z.useRef(!1),b=Z.useRef(null),x=o??p,S=KN((e,t=!1)=>{if(b.current=v.current[e]??null,(s??m)(e),t){let t=v.current[e];U8(g.current,t,a,n)}}),C=KN(e=>{if(e.size===0)return;if(y.current){let e=v.current,t=e.indexOf(b.current);if(t===-1){let t=e[x];!t||OF(e,x,d)?S(Mve(e,d)):b.current=t}else t!==x&&S(t);return}y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)S(i);else if(OF(t,x,d)){let e=DF(t,{disabledIndices:d});wF(t,e)||S(e)}U8(g.current,r,a,n)});FN(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(OF(e,x,d)){let t=DF(e,{disabledIndices:d});wF(e,t)||S(t)}},[d,o,x,v,S]);let w=KN((e,t,n)=>i?i(e,t,n,v):n),T=KN(e=>{let o=e.key===`Home`||e.key===`End`;if(!V8.has(e.key)||!l&&o||Nve(e,f)||!g.current)return;let s=a===`rtl`,c=s?z8:B8,p=s?B8:z8,m=n===`vertical`?R8:c,_=n===`vertical`?L8:p,y=FP(e.nativeEvent);if(y!=null&&H8(y)&&!_5(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=x,C=TF(v,d),T=EF(v,d);r!=null&&(b=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E||D)&&(t&&b===T&&E?(b=C,i&&(b=i(e,x,b,v))):t&&b===C&&D?(b=T,i&&(b=i(e,x,b,v))):b=DF(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!wF(v.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{v.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=FP(e.nativeEvent);t&&n!=null&&H8(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:v,onMapChange:C,relayKeyboardEvent:T}}function Mve(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!OF(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function Nve(e,t){for(let n of Hhe)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Pve(e){let{render:t,className:n,style:r,refs:i=AN,props:a=AN,state:o=jN,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=jve({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:NB(),disabledIndices:v,modifierKeys:y}),k=TI(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Z.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,Q.jsx)(QI.Provider,{value:A,children:(0,Q.jsx)(Y8,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var Fve=Z.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=Q7(),[d,f]=Z.useState(0),[p,m]=Z.useState(null),h=Z.useRef(new Set),g=Z.useRef(new Set),_=Z.useRef(null);FN(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let v=KN(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=KN(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),b={orientation:c,tabActivationDirection:u},x={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},S=Z.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[n,v,y,p]);return(0,Q.jsx)(n9.Provider,{value:S,children:(0,Q.jsx)(Pve,{render:a,className:r,style:o,state:b,refs:[t,m],props:[x,s],stateAttributesMapping:$7,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:AN})})});function r9({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(wve,{"data-slot":`tabs`,"data-orientation":t,className:HV(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Ive=JV(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function i9({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(Fve,{"data-slot":`tabs-list`,"data-variant":t,className:HV(Ive({variant:t}),e),...n})}function a9({className:e,...t}){return(0,Q.jsx)(Dve,{"data-slot":`tabs-trigger`,className:HV(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Lve({className:e,...t}){return(0,Q.jsx)(Ave,{"data-slot":`tabs-content`,className:HV(`flex-1 text-xs/relaxed outline-none`,e),...t})}var o9=kE(V3.layer).atom(H(function*(){return In()}));function Rve(){let e=(0,QB.c)(8),t=yN(o9),n;e[0]===t?n=e[1]:(n=Un(Xn(sS(t))),e[0]=t,e[1]=n);let r;e[2]===t?r=e[3]:(r=eS(t),e[2]=t,e[3]=r);let i=wN(o9),a;return e[4]!==n||e[5]!==r||e[6]!==i?(a={configuration:n,failed:r,retry:i},e[4]=n,e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function zve(){let e=(0,QB.c)(36),[t,n]=(0,Z.useState)(`claude`),{configuration:r,failed:i,retry:a}=Rve(),o=`claude mcp add porcelain -- porcelain mcp`,s;e[0]!==t||e[1]!==o?(s=ope(o,t),e[0]=t,e[1]=o,e[2]=s):s=e[2];let c=s,l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(`h2`,{id:`agents-heading`,className:`text-xs leading-4 font-medium text-muted-foreground`,children:`Agents`}),e[3]=l):l=e[3];let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{(e===`claude`||e===`codex`)&&n(e)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsxs)(i9,{"aria-label":`Agent`,"data-size":`sm`,children:[(0,Q.jsx)(a9,{value:`claude`,children:`Claude Code`}),(0,Q.jsx)(a9,{value:`codex`,children:`Codex`})]}),e[5]=d):d=e[5];let f;e[6]===t?f=e[7]:(f=(0,Q.jsxs)(`div`,{className:`mb-px flex min-h-6 items-center justify-between gap-2`,children:[l,(0,Q.jsx)(r9,{value:t,onValueChange:u,children:d})]}),e[6]=t,e[7]=f);let p;e[8]!==c||e[9]!==i?(p=(0,Q.jsx)(`code`,{className:`block font-mono text-xs leading-4.75 wrap-anywhere`,role:`status`,children:(0,Q.jsx)(Bve,{command:c,failed:i})}),e[8]=c,e[9]=i,e[10]=p):p=e[10];let m=c===void 0,h;e[11]===c?h=e[12]:(h=()=>{c!==void 0&&HU(c,`MCP configuration`)},e[11]=c,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Q.jsx)(XV,{size:`icon-sm`,variant:`ghost`,className:`absolute top-1.5 right-1.5`,"aria-label":`Copy MCP configuration`,disabled:m,onClick:h}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(OH,{}),e[16]=_):_=e[16];let v;e[17]===g?v=e[18]:(v=(0,Q.jsx)(LU,{render:g,children:_}),e[17]=g,e[18]=v);let y;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(RU,{role:`tooltip`,children:`Copy MCP configuration`}),e[19]=y):y=e[19];let b;e[20]===v?b=e[21]:(b=(0,Q.jsxs)(IU,{children:[v,y]}),e[20]=v,e[21]=b);let x;e[22]!==b||e[23]!==p?(x=(0,Q.jsxs)(`div`,{className:`relative rounded-lg bg-muted py-2.25 pr-11 pl-3 inset-ring inset-ring-border`,children:[p,b]}),e[22]=b,e[23]=p,e[24]=x):x=e[24];let S;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:[`Run it once on the computer hosting your Porcelain server.`,` `,`Agents publish reviews, answer comments and read your reviewed marks through the Porcelain MCP server. It needs no credential.`,!1]}),e[25]=S):S=e[25];let C;e[26]===r?C=e[27]:(C=!1,e[26]=r,e[27]=C);let w;e[28]!==i||e[29]!==a?(w=!1,e[28]=i,e[29]=a,e[30]=w):w=e[30];let T;return e[31]!==x||e[32]!==C||e[33]!==w||e[34]!==f?(T=(0,Q.jsxs)(`section`,{"aria-labelledby":`agents-heading`,className:`flex min-w-0 flex-col gap-2`,children:[f,x,S,C,w]}),e[31]=x,e[32]=C,e[33]=w,e[34]=f,e[35]=T):T=e[35],T}function Bve({command:e,failed:t}){return e===void 0?t?`MCP configuration is unavailable.`:`Loading MCP configuration…`:upe(e).map((e,t)=>(0,Q.jsx)(`span`,{className:Vve[e.kind],children:e.text},t))}var Vve={program:`text-(--syn-fn)`,quoted:`text-(--syn-str)`,plain:void 0},Hve=new Intl.RelativeTimeFormat(`en`,{numeric:`always`});function s9(e,t=Jne()){let n=cm(e),r=Qne(n,t),[i,a]=r?[t,n]:[n,t],o=Zne(i,a),s=Fi(o),c=Xne(),l=(s+um(lm(a,c))-um(lm(i,c)))/Fi(Ni(1)),u,d;return s<Fi(ji(1))?(u=`second`,d=Math.round(Ii(o))):s<Fi(Mi(1))?(u=`minute`,d=Math.round(Li(o))):s<Fi(Ni(1))?(u=`hour`,d=Math.round(Oee(o))):l<30?(u=`day`,d=Math.round(l)):l<365?(d=Math.round(l/30),u=d===12?`year`:`month`,u===`year`&&(d=1)):(u=`year`,d=Math.round(l/365)),Hve.format(r?d:-d,u)}var Uve={phone:(0,Q.jsx)(nU,{"aria-hidden":!0}),tablet:(0,Q.jsx)(iU,{"aria-hidden":!0}),browser:(0,Q.jsx)(AH,{"aria-hidden":!0})};function Wve(e){let t=(0,QB.c)(22),{connection:n,access:r,disabled:i}=e,a=i!==void 0&&i,o=r,s;if(t[0]!==o.devices||t[1]!==n||t[2]!==a){let e;t[4]!==n||t[5]!==a?(e=e=>(0,Q.jsxs)(W6,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsx)(G6,{variant:`icon`,children:Uve[spe(e.platform)]}),(0,Q.jsxs)(K6,{className:`basis-48`,children:[(0,Q.jsxs)(q6,{className:`flex-wrap`,children:[e.label,e.current&&(0,Q.jsx)(e8,{variant:`secondary`,children:`This device`}),(0,Q.jsx)(e8,{variant:`outline`,children:$0[e.route]})]}),(0,Q.jsxs)(J6,{children:[`Last seen `,s9(e.lastSeenAt),` ·`,` `,B3(e.platform)]}),e.routeInferred&&(0,Q.jsxs)(J6,{children:[`Paired before each device was tied to one way in, so it now works only through `,$0[e.route],`, where it was last seen. Pair it again to use another way in.`]})]}),(0,Q.jsxs)(Y6,{className:`flex-wrap`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[auto_auto] items-center gap-x-2 gap-y-1.5`,children:[(0,Q.jsx)(qve,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canManageSharing===!0}),(0,Q.jsx)(Gve,{disabled:a,connection:n,id:e.id,label:e.label,trusted:e.trusted}),!e.canManageSharing&&Qce(e)&&(0,Q.jsx)(Kve,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canEditWaysIn})]}),!e.current&&(0,Q.jsx)(l9,{disabled:a,connection:n,id:e.id,label:e.label,cancelLink:!1})]})]},e.id),t[4]=n,t[5]=a,t[6]=e):e=t[6],s=o.devices.map(e),t[0]=o.devices,t[1]=n,t[2]=a,t[3]=s}else s=t[3];let c;if(t[7]!==o.grants||t[8]!==n||t[9]!==a){let e;t[11]!==n||t[12]!==a?(e=e=>(0,Q.jsxs)(W6,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsx)(G6,{variant:`icon`,children:(0,Q.jsx)(RH,{"aria-hidden":!0})}),(0,Q.jsxs)(K6,{className:`min-w-0`,children:[(0,Q.jsxs)(q6,{children:[e.label,(0,Q.jsx)(e8,{variant:`outline`,children:`Pending link`})]}),(0,Q.jsxs)(J6,{children:[`Works once, until`,` `,new Date(e.expiresAt).toLocaleTimeString()]})]}),(0,Q.jsx)(Y6,{children:(0,Q.jsx)(l9,{disabled:a,connection:n,id:e.id,label:e.label,cancelLink:!0})})]},e.id),t[11]=n,t[12]=a,t[13]=e):e=t[13],c=o.grants.map(e),t[7]=o.grants,t[8]=n,t[9]=a,t[10]=c}else c=t[10];let l;t[14]!==s||t[15]!==c?(l=(0,Q.jsxs)(U6,{role:`list`,"aria-label":`Paired devices and links`,children:[s,c]}),t[14]=s,t[15]=c,t[16]=l):l=t[16];let u;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:`Each device has separate access. Revoking signs it out.`}),t[17]=u):u=t[17];let d;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(I5,{render:(0,Q.jsx)(XV,{size:`sm`,variant:`ghost`}),children:`About device permissions`}),t[18]=d):d=t[18];let f;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(F5,{children:[d,(0,Q.jsx)(L5,{children:(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:`Sharing managers can pair devices, revoke access and configure ways in. Update permission is separate. Each credential works only through the way in it paired over. Pair again to add another way in.`})})]}),t[19]=f):f=t[19];let p;return t[20]===l?p=t[21]:(p=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l,u,f]}),t[20]=l,t[21]=p),p}function Gve(e){let t=(0,QB.c)(6),{connection:n,id:r,label:i,trusted:a,disabled:o}=e,[s,c]=Che(n,r),l=`${i} can update Porcelain`,u;return t[0]!==o||t[1]!==c||t[2]!==s||t[3]!==l||t[4]!==a?(u=(0,Q.jsx)(c9,{caption:`Can update`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=o,t[1]=c,t[2]=s,t[3]=l,t[4]=a,t[5]=u):u=t[5],u}function Kve(e){let t=(0,QB.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=whe(n,r),l=`${i} can edit ways in`,u;return t[0]!==a||t[1]!==o||t[2]!==c||t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(c9,{caption:`Can edit ways in`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=a,t[1]=o,t[2]=c,t[3]=s,t[4]=l,t[5]=u):u=t[5],u}function c9(e){let t=(0,QB.c)(13),{caption:n,name:r,checked:i,result:a,disabled:o,onChange:s}=e,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-xs text-muted-foreground`,children:n}),t[0]=n,t[1]=c);let l=o||a.waiting,u;t[2]!==i||t[3]!==r||t[4]!==s||t[5]!==l?(u=(0,Q.jsx)(H5,{"aria-label":r,checked:i,disabled:l,onCheckedChange:s}),t[2]=i,t[3]=r,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]===a?d=t[8]:(d=eS(a)&&(0,Q.jsx)(Z6,{variant:`destructive`,className:`col-span-2`,children:(0,Q.jsx)($6,{children:x2(Vl(a.cause))})}),t[7]=a,t[8]=d);let f;return t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function l9(e){let t=(0,QB.c)(12),{connection:n,id:r,label:i,cancelLink:a,disabled:o}=e,s=o!==void 0&&o,[c,l]=She(n,r),u=a?`Cancel the link for ${i}`:`Revoke ${i}`,d=s||c.waiting,f;t[0]===l?f=t[1]:(f=()=>l(),t[0]=l,t[1]=f);let p=a?`Cancel`:`Revoke`,m;t[2]!==u||t[3]!==d||t[4]!==f||t[5]!==p?(m=(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,className:`ml-1`,"aria-label":u,disabled:d,onClick:f,children:p}),t[2]=u,t[3]=d,t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]===c?h=t[8]:(h=eS(c)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Vl(c.cause))})}),t[7]=c,t[8]=h);let g;return t[9]!==m||t[10]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[m,h]}),t[9]=m,t[10]=h,t[11]=g):g=t[11],g}function qve(e){let t=(0,QB.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=Ohe(n,r),l=`${i} can manage sharing`,u;return t[0]!==a||t[1]!==o||t[2]!==c||t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(c9,{caption:`Manage sharing`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=a,t[1]=o,t[2]=c,t[3]=s,t[4]=l,t[5]=u):u=t[5],u}var u9={lan:void 0,tailnet:`Encrypted, from anywhere`,cloudflare:`Encrypted, from anywhere`};function Jve(e){let t=(0,QB.c)(13),{name:n,route:r}=e,{status:i}=r,a;t[0]!==n||t[1]!==r?(a=ale(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a;if(o===null)return null;if(i.kind===`off`||i.kind===`starting`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(M6,{}),t[3]=e):e=t[3];let n;return t[4]===o?n=t[5]:(n=(0,Q.jsxs)(e8,{variant:`outline`,children:[e,o]}),t[4]=o,t[5]=n),n}if(i.kind===`paused`){let e;return t[6]===o?e=t[7]:(e=(0,Q.jsx)(e8,{variant:`outline`,children:o}),t[6]=o,t[7]=e),e}if(i.kind===`failed`){let e;return t[8]===o?e=t[9]:(e=(0,Q.jsx)(e8,{variant:`destructive`,children:o}),t[8]=o,t[9]=e),e}let s;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-add-fg`}),t[10]=s):s=t[10];let c;return t[11]===o?c=t[12]:(c=(0,Q.jsxs)(e8,{variant:`secondary`,children:[s,o]}),t[11]=o,t[12]=c),c}function Yve(e){let t=(0,QB.c)(14),{name:n,route:r,note:i}=e,{status:a}=r;if(a.kind===`failed`){let e;t[0]!==n||t[1]!==a.reason?(e=ule(n,a.reason),t[0]=n,t[1]=a.reason,t[2]=e):e=t[2];let r;return t[3]===e?r=t[4]:(r=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:e}),t[3]=e,t[4]=r),r}if(a.kind!==`on`||a.urls.length===0){let e=Kce[n],r;return t[5]===e?r=t[6]:(r=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:e}),t[5]=e,t[6]=r),r}let o;if(t[7]!==n||t[8]!==i||t[9]!==a.urls){let e;t[11]!==n||t[12]!==i?(e=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs leading-4.5 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-1`,children:[(0,Q.jsx)(j6,{className:`font-mono text-foreground-2`,text:e}),(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{size:`icon-xs`,variant:`ghost`,className:`size-5`,"aria-label":`Copy ${e}`,onClick:()=>HU(e,`address`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{role:`tooltip`,className:`break-all`,children:`Copy ${e}`})]})]}),(i??u9[n])&&(0,Q.jsx)(`span`,{children:i??u9[n]})]},e),t[11]=n,t[12]=i,t[13]=e):e=t[13],o=a.urls.map(e),t[7]=n,t[8]=i,t[9]=a.urls,t[10]=o}else o=t[10];return o}function d9(e){let t=(0,QB.c)(40),{name:n,route:r,disabled:i,connectedThrough:a,onChange:o,setup:s,note:c,children:l}=e,u=Q0[n],[d,f]=(0,Z.useState)(!1),p=n!==`lan`||r.status.kind!==`on`,m=d||(s?.open??!1),h;t[0]!==n||t[1]!==r?(h=(0,Q.jsx)(Jve,{name:n,route:r}),t[0]=n,t[1]=r,t[2]=h):h=t[2];let g;t[3]===p?g=t[4]:(g=!p&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-xs leading-4 font-medium text-warn`,children:[(0,Q.jsx)(eU,{"aria-hidden":!0,className:`size-3.5`}),`Not encrypted`]}),t[3]=p,t[4]=g);let _;t[5]!==h||t[6]!==g||t[7]!==u?(_=(0,Q.jsxs)(q6,{className:`flex-wrap`,children:[u,h,g]}),t[5]=h,t[6]=g,t[7]=u,t[8]=_):_=t[8];let v;t[9]!==n||t[10]!==c||t[11]!==r?(v=(0,Q.jsx)(Yve,{name:n,route:r,note:c}),t[9]=n,t[10]=c,t[11]=r,t[12]=v):v=t[12];let y;t[13]!==_||t[14]!==v?(y=(0,Q.jsxs)(K6,{children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]!==a||t[17]!==s||t[18]!==u?(b=s&&!a&&(0,Q.jsxs)(I5,{render:(0,Q.jsx)(XV,{size:`sm`,variant:s.configured?`ghost`:`outline`,"aria-label":s.configured?`${u} setup`:`Set up ${u}`,className:`group/setup`}),children:[s.configured?`Setup`:`Set up`,s.configured&&(0,Q.jsx)(gH,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground transition-transform group-data-panel-open/setup:rotate-180`})]}),t[16]=a,t[17]=s,t[18]=u,t[19]=b):b=t[19];let x=i||a,S;t[20]===o?S=t[21]:(S=e=>o(e),t[20]=o,t[21]=S);let C;t[22]!==r.enabled||t[23]!==x||t[24]!==S||t[25]!==u?(C=(0,Q.jsx)(H5,{"aria-label":u,checked:r.enabled,disabled:x,onCheckedChange:S}),t[22]=r.enabled,t[23]=x,t[24]=S,t[25]=u,t[26]=C):C=t[26];let w;t[27]!==C||t[28]!==b?(w=(0,Q.jsxs)(Y6,{children:[b,C]}),t[27]=C,t[28]=b,t[29]=w):w=t[29];let T;t[30]!==l||t[31]!==a||t[32]!==n||t[33]!==s?(T=a?(0,Q.jsx)(X6,{children:(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:qce(n)})}):l&&(s?(0,Q.jsx)(L5,{className:`basis-full`,children:(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:l})}):(0,Q.jsx)(X6,{children:(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:l})})),t[30]=l,t[31]=a,t[32]=n,t[33]=s,t[34]=T):T=t[34];let E;return t[35]!==m||t[36]!==w||t[37]!==T||t[38]!==y?(E=(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsxs)(F5,{open:m,onOpenChange:f,className:`contents`,children:[y,w,T]})}),t[35]=m,t[36]=w,t[37]=T,t[38]=y,t[39]=E):E=t[39],E}function Xve(e){let t=(0,QB.c)(26),{remote:n,disabled:r,onTurnOn:i}=e,{lan:a}=n.routes,o=n.localNetwork,s=a.enabled&&a.status.kind===`paused`,c;t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==s?(c=s&&o&&(0,Q.jsxs)(XV,{variant:`outline`,size:`sm`,className:`self-start`,disabled:r,onClick:i,children:[`Turn on for `,e2(o)]}),t[0]=r,t[1]=o,t[2]=i,t[3]=s,t[4]=c):c=t[4];let l;t[5]!==o||t[6]!==a.status.kind||t[7]!==s||t[8]!==n?(l=a.status.kind!==`on`&&(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:s||!o?t2(n):`Uses ${e2(o)}.`}),t[5]=o,t[6]=a.status.kind,t[7]=s,t[8]=n,t[9]=l):l=t[9];let u,d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-6.5 -left-6.5 hidden size-1.5 rounded-full bg-warn lg:block`}),d=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-7.25 -left-5 hidden h-px w-5 bg-warn-border lg:block`}),t[10]=u,t[11]=d):(u=t[10],d=t[11]);let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(Q6,{children:[(0,Q.jsx)(eU,{"aria-hidden":!0}),`Not encrypted`]}),t[12]=f):f=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{children:`Devices on this network can read the connection.`}),t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(I5,{render:(0,Q.jsx)(XV,{size:`sm`,variant:`ghost`}),children:`Details`}),t[14]=m):m=t[14];let h;t[15]===n?h=t[16]:(h=t2(n),t[15]=n,t[16]=h);let g;t[17]===h?g=t[18]:(g=(0,Q.jsx)(`p`,{children:h}),t[17]=h,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`p`,{children:Jce}),t[19]=_):_=t[19];let v;t[20]===g?v=t[21]:(v=(0,Q.jsxs)(`div`,{className:`settings-margin-note lg:absolute lg:top-0 lg:left-full lg:ml-8 lg:w-62`,children:[u,d,(0,Q.jsxs)(Z6,{role:`note`,"aria-label":`Local network warning`,children:[f,(0,Q.jsxs)($6,{children:[p,(0,Q.jsxs)(F5,{children:[m,(0,Q.jsxs)(L5,{children:[g,_]})]})]})]})]}),t[20]=g,t[21]=v);let y;return t[22]!==c||t[23]!==v||t[24]!==l?(y=(0,Q.jsxs)(Q.Fragment,{children:[c,l,v]}),t[22]=c,t[23]=v,t[24]=l,t[25]=y):y=t[25],y}function f9(e){let t=(0,QB.c)(26),{route:n,remote:r,disabled:i,onChange:a}=e,[o,s]=(0,Z.useState)(null),c;t[0]!==o||t[1]!==r||t[2]!==n?(c=lle(r,n,o),t[0]=o,t[1]=r,t[2]=n,t[3]=c):c=t[3];let l=c,u;t[4]!==l.save||t[5]!==a?(u=e=>b8(e,async()=>{a(l.save),s(null)}),t[4]=l.save,t[5]=a,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>s(e.target.value),t[7]=d):d=t[7];let f;t[8]!==i||t[9]!==l.label||t[10]!==l.placeholder||t[11]!==l.value?(f=(0,Q.jsx)(v8,{"aria-label":l.label,placeholder:l.placeholder,value:l.value,disabled:i,onChange:d}),t[8]=i,t[9]=l.label,t[10]=l.placeholder,t[11]=l.value,t[12]=f):f=t[12];let p=i||!l.canSave,m;t[13]!==l.saveLabel||t[14]!==p?(m=(0,Q.jsx)(XV,{type:`submit`,variant:`outline`,className:`shrink-0`,disabled:p,children:l.saveLabel}),t[13]=l.saveLabel,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==i||t[17]!==l.check||t[18]!==l.failed||t[19]!==a?(h=l.failed&&(0,Q.jsx)(XV,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:i,onClick:()=>a(l.check),children:`Check again`}),t[16]=i,t[17]=l.check,t[18]=l.failed,t[19]=a,t[20]=h):h=t[20];let g;return t[21]!==u||t[22]!==f||t[23]!==m||t[24]!==h?(g=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:u,children:[f,m,h]}),t[21]=u,t[22]=f,t[23]=m,t[24]=h,t[25]=g):g=t[25],g}function Zve(e){let t=(0,QB.c)(18),{remote:n,disabled:r,onChange:i}=e,a=n.routes.tailnet,o;t[0]===n.tailnetTarget?o=t[1]:(o=n.tailnetTarget===void 0?void 0:rle(n.tailnetTarget),t[0]=n.tailnetTarget,t[1]=o);let s=o,c;t[2]!==r||t[3]!==i||t[4]!==n?(c=(0,Q.jsx)(f9,{route:`tailnet`,remote:n,disabled:r,onChange:i}),t[2]=r,t[3]=i,t[4]=n,t[5]=c):c=t[5];let l;t[6]===n.tailnetHostname?l=t[7]:(l=n.tailnetHostname===void 0&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this computer’s name on your tailnet, as tailscale status or the Tailscale admin console shows it, to turn this on. Porcelain then names the one command to run.`}),t[6]=n.tailnetHostname,t[7]=l);let u;t[8]!==n.tailnetHostname||t[9]!==a?(u=n.tailnetHostname!==void 0&&!a.enabled&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`If you set up tailscale serve for Porcelain, remove it with tailscale serve --https=443 off, or Tailscale keeps forwarding to a port Porcelain no longer holds.`}),t[8]=n.tailnetHostname,t[9]=a,t[10]=u):u=t[10];let d;t[11]===s?d=t[12]:(d=s!==void 0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Run this once on this computer. Tailscale keeps it across restarts; remove it with tailscale serve --https=443 off.`}),(0,Q.jsxs)(`div`,{className:`flex max-w-full items-center gap-1`,children:[(0,Q.jsx)(j6,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,render:(0,Q.jsx)(`code`,{}),text:s}),(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy the tailscale serve command`,onClick:()=>HU(s,`command`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{role:`tooltip`,className:`break-all`,children:`Copy the tailscale serve command`})]})]})]}),t[11]=s,t[12]=d);let f;return t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,l,u,d]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Qve(e){let t=(0,QB.c)(9),{remote:n,disabled:r,onChange:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(f9,{route:`cloudflare`,remote:n,disabled:r,onChange:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===n.serviceUrl?o=t[5]:(o=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`In Cloudflare, publish this hostname from your tunnel to`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.serviceUrl}),`, and run cloudflared on this computer as a service. Porcelain answers to the hostname only while this is on.`]}),t[4]=n.serviceUrl,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function $ve(e){let t=(0,QB.c)(63),{connection:n,remote:r}=e,[i,a]=The(n),o=i.waiting,s;t[0]===r.editing.protectedRoute?s=t[1]:(s=e=>r.editing.protectedRoute===e,t[0]=r.editing.protectedRoute,t[1]=s);let c=s,l;t[2]!==r.editing.fingerprint||t[3]!==a?(l=e=>a({expected:r.editing.fingerprint,change:e}),t[2]=r.editing.fingerprint,t[3]=a,t[4]=l):l=t[4];let u=l,d=r.routes.lan,f;t[5]===r?f=t[6]:(f=t2(r),t[5]=r,t[6]=f);let p=c(`lan`),m=o||!r.routes.lan.enabled&&r.localNetwork===void 0,h;t[7]===u?h=t[8]:(h=e=>u({lan:e}),t[7]=u,t[8]=h);let g;t[9]===u?g=t[10]:(g=()=>u({lan:!0}),t[9]=u,t[10]=g);let _;t[11]!==o||t[12]!==r||t[13]!==g?(_=(0,Q.jsx)(Xve,{remote:r,disabled:o,onTurnOn:g}),t[11]=o,t[12]=r,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==r.routes.lan||t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==_?(v=(0,Q.jsx)(d9,{name:`lan`,route:d,note:f,connectedThrough:p,disabled:m,onChange:h,children:_}),t[15]=r.routes.lan,t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=_,t[21]=v):v=t[21];let y=r.routes.tailnet,b=r.tailnetHostname!==void 0,x=r.routes.tailnet.status.kind===`failed`,S;t[22]!==b||t[23]!==x?(S={configured:b,open:x},t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=c(`tailnet`),w=o||r.tailnetHostname===void 0,T;t[25]===u?T=t[26]:(T=e=>u({tailnet:e}),t[25]=u,t[26]=T);let E;t[27]!==o||t[28]!==r||t[29]!==u?(E=(0,Q.jsx)(Zve,{remote:r,disabled:o,onChange:u}),t[27]=o,t[28]=r,t[29]=u,t[30]=E):E=t[30];let D;t[31]!==r.routes.tailnet||t[32]!==S||t[33]!==C||t[34]!==w||t[35]!==T||t[36]!==E?(D=(0,Q.jsx)(d9,{name:`tailnet`,route:y,setup:S,connectedThrough:C,disabled:w,onChange:T,children:E}),t[31]=r.routes.tailnet,t[32]=S,t[33]=C,t[34]=w,t[35]=T,t[36]=E,t[37]=D):D=t[37];let O=r.routes.cloudflare,k=r.cloudflareHostname!==void 0,A=r.routes.cloudflare.status.kind===`failed`,j;t[38]!==k||t[39]!==A?(j={configured:k,open:A},t[38]=k,t[39]=A,t[40]=j):j=t[40];let M=c(`cloudflare`),N=o||r.cloudflareHostname===void 0,P;t[41]===u?P=t[42]:(P=e=>u({cloudflare:e}),t[41]=u,t[42]=P);let F;t[43]!==o||t[44]!==r||t[45]!==u?(F=(0,Q.jsx)(Qve,{remote:r,disabled:o,onChange:u}),t[43]=o,t[44]=r,t[45]=u,t[46]=F):F=t[46];let I;t[47]!==r.routes.cloudflare||t[48]!==j||t[49]!==M||t[50]!==N||t[51]!==P||t[52]!==F?(I=(0,Q.jsx)(d9,{name:`cloudflare`,route:O,setup:j,connectedThrough:M,disabled:N,onChange:P,children:F}),t[47]=r.routes.cloudflare,t[48]=j,t[49]=M,t[50]=N,t[51]=P,t[52]=F,t[53]=I):I=t[53];let L;t[54]!==v||t[55]!==D||t[56]!==I?(L=(0,Q.jsxs)(U6,{children:[v,D,I]}),t[54]=v,t[55]=D,t[56]=I,t[57]=L):L=t[57];let R;t[58]===i?R=t[59]:(R=eS(i)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Vl(i.cause))})}),t[58]=i,t[59]=R);let ee;return t[60]!==L||t[61]!==R?(ee=(0,Q.jsxs)(Q.Fragment,{children:[L,R]}),t[60]=L,t[61]=R,t[62]=ee):ee=t[62],ee}function p9(e){let t=(0,QB.c)(14),{connection:n,children:r}=e,i=r8(n),a,o;if(t[0]!==r||t[1]!==n||t[2]!==i){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Un(sS(i));if(e===null){let e;t[5]===n.address?e=t[6]:(e=$ce(n.address),t[5]=n.address,t[6]=e);let r;t[7]===e?r=t[8]:(r=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e}),t[7]=e,t[8]=r),o=r;break bb0}if(eS(i)){let e;t[9]===i.cause?e=t[10]:(e=x2(Vl(i.cause)),t[9]=i.cause,t[10]=e);let n;t[11]===e?n=t[12]:(n=(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:e})}),t[11]=e,t[12]=n),o=n;break bb0}if(!e){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(M6,{}),t[13]=e):e=t[13],o=e;break bb0}a=r(e)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o}else a=t[3],o=t[4];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function m9(e){let t=(0,QB.c)(6),{connection:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(z6,{variant:`label`,children:`Ways in`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=e=>(0,Q.jsx)($ve,{connection:n,remote:e}),t[1]=n,t[2]=i);let a;return t[3]!==n||t[4]!==i?(a=(0,Q.jsxs)(R6,{id:`ways-in`,className:`relative`,children:[r,(0,Q.jsx)(p9,{connection:n,children:i})]}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}function eye(e){let t=(0,QB.c)(5),{connection:n,children:r}=e,i=n8(n),a,o;if(t[0]!==i||t[1]!==r){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Un(sS(i));if(e===null){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This device cannot manage sharing. Allow it from a device with sharing access.`}),t[4]=e):e=t[4],o=e;break bb0}let n=eS(i)?x2(Vl(i.cause)):void 0;if(!e){o=n?(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:n})}):(0,Q.jsx)(M6,{});break bb0}a=r(e,n)}t[0]=i,t[1]=r,t[2]=a,t[3]=o}else a=t[2],o=t[3];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function h9(e){let t=(0,QB.c)(5),{prominent:n}=e,r=n!==void 0&&n,i=Un(sS(che()))?.isDesktopShell;if(i===!0){let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(n_e,{prominent:r}),t[0]=r,t[1]=e),e}if(i===!1){let e;return t[2]===r?e=t[3]:(e=(0,Q.jsx)(e_e,{prominent:r}),t[2]=r,t[3]=e),e}let a;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(M6,{}),t[4]=a):a=t[4],a}function tye(e){let t=(0,QB.c)(46),{environment:n}=e,{connection:r}=D6(),i=Un(sS(n8(r)))?.canEditIdentity===!0,a=`${n.custom}:${n.name}`,[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u;if(t[0]!==r.address){let e=new URL(r.address);u=/^https?:$/.test(e.protocol)?e.origin:void 0,t[0]=r.address,t[1]=u}else u=t[1];let d=u,f=o===a,[p,m]=Dhe(r),h,g,_,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full bg-add-fg`}),g=(0,Q.jsx)(`span`,{children:`Online`}),_=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground`,children:`·`}),v=(0,Q.jsx)(e8,{variant:`secondary`,children:`This computer`}),t[2]=h,t[3]=g,t[4]=_,t[5]=v):(h=t[2],g=t[3],_=t[4],v=t[5]);let y;t[6]===d?y=t[7]:(y=d&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground`,children:`·`}),(0,Q.jsx)(j6,{text:d,className:`font-mono text-xs text-muted-foreground`})]}),t[6]=d,t[7]=y);let b;t[8]===y?b=t[9]:(b=(0,Q.jsxs)(Q.Fragment,{children:[h,g,_,v,y]}),t[8]=y,t[9]=b);let x;t[10]!==i||t[11]!==n||t[12]!==p||t[13]!==a||t[14]!==f||t[15]!==c||t[16]!==m?(x=i&&!f&&(0,Q.jsxs)(`span`,{className:`mt-1 flex items-center gap-1 text-muted-foreground`,children:[(0,Q.jsx)(Oge,{icon:O4(n),pending:p.waiting,onChange:e=>m(Jue(e))}),(0,Q.jsxs)(XV,{variant:`ghost`,size:`sm`,ref:c?e=>{e&&(e.focus(),l(!1))}:void 0,onClick:()=>{l(!0),s(a)},children:[(0,Q.jsx)(JH,{}),`Rename`]})]}),t[10]=i,t[11]=n,t[12]=p,t[13]=a,t[14]=f,t[15]=c,t[16]=m,t[17]=x):x=t[17];let S;t[18]!==i||t[19]!==p?(S=i&&eS(p)&&(0,Q.jsx)(Z6,{variant:`destructive`,className:`mt-4 max-w-160`,children:(0,Q.jsx)($6,{children:x2(Vl(p.cause))})}),t[18]=i,t[19]=p,t[20]=S):S=t[20];let C;t[21]!==i||t[22]!==r||t[23]!==n||t[24]!==f?(C=i&&f&&(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(khe,{connection:r,environment:n,onCancel:()=>s(null)})}),t[21]=i,t[22]=r,t[23]=n,t[24]=f,t[25]=C):C=t[25];let w;t[26]!==n.name||t[27]!==C||t[28]!==b||t[29]!==x||t[30]!==S?(w=(0,Q.jsxs)(t8,{section:`Computers`,title:n.name,lead:`Manage connections and device access.`,status:b,action:x,children:[S,C]}),t[26]=n.name,t[27]=C,t[28]=b,t[29]=x,t[30]=S,t[31]=w):w=t[31];let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(U6,{"aria-label":`Version`,children:(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsx)(K6,{children:(0,Q.jsx)(h9,{prominent:!0})})})}),t[32]=T):T=t[32];let E,D;t[33]===r?(E=t[34],D=t[35]):(E=(0,Q.jsx)(m9,{connection:r}),D=(0,Q.jsx)(g9,{connection:r}),t[33]=r,t[34]=E,t[35]=D);let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(zve,{}),t[36]=O):O=t[36];let k;t[37]===n.name?k=t[38]:(k=(0,Q.jsxs)(R6,{children:[(0,Q.jsx)(z6,{variant:`label`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:`This browser`}),(0,Q.jsx)(e8,{variant:`outline`,children:`Shown in a browser tab`})]})}),(0,Q.jsx)(U6,{children:(0,Q.jsx)(W6,{children:(0,Q.jsx)(K6,{children:(0,Q.jsx)(ohe,{computer:n.name})})})})]}),t[37]=n.name,t[38]=k);let A;t[39]!==E||t[40]!==D||t[41]!==k?(A=(0,Q.jsxs)(`div`,{className:`settings-computer grid min-w-0 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_--spacing(62)]`,children:[T,E,D,O,k]}),t[39]=E,t[40]=D,t[41]=k,t[42]=A):A=t[42];let j;return t[43]!==w||t[44]!==A?(j=(0,Q.jsxs)(Q.Fragment,{children:[w,A]}),t[43]=w,t[44]=A,t[45]=j):j=t[45],j}function g9(e){let t=(0,QB.c)(6),{connection:n}=e,r=Un(sS(n8(n))),i;t[0]!==n||t[1]!==r?(i=(e,t)=>(0,Q.jsx)(p9,{connection:n,children:i=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(R6,{id:`devices`,className:`min-w-0`,disabled:t!==void 0,children:[(0,Q.jsx)(z6,{variant:`label`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Devices`,r&&(0,Q.jsx)(`span`,{className:`tabular-nums`,children:r.devices.length})]})}),t&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:t})}),(0,Q.jsx)(Wve,{connection:n,access:e,disabled:t!==void 0})]}),(0,Q.jsxs)(`aside`,{"aria-label":`Pair a device`,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border bg-card p-3 shadow-pop lg:col-start-2 lg:row-span-2 lg:row-start-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-ui leading-4.5 font-semibold`,children:`Pair a device`}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs leading-4.25 text-muted-foreground`,children:`A link works once, for a few minutes.`})]}),(0,Q.jsx)(R6,{className:`contents`,disabled:t!==void 0,children:(0,Q.jsx)(bve,{connection:n,remote:i,disabled:t!==void 0})})]})]})}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]!==n||t[4]!==i?(a=(0,Q.jsx)(eye,{connection:n,children:i}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}var nye=X(e=>b6.fn(e=>H(function*(){let t=yield*(yield*k2).pair({value:e,localEnvironmentId:x6.state.value.connection?.environmentId}).pipe(rp(t3));return B0(g6,t),t}))),rye=X(e=>b6.fn(t=>H(function*(){yield*(yield*k2).forget(e.environmentId)}))),iye=b6.fn(e=>H(function*(){yield*(yield*k2).read()}));function aye(e){let t=(0,QB.c)(12),[n]=(0,Z.useState)(Symbol),r;t[0]===n?r=t[1]:(r=nye(n),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={mode:`promiseExit`},t[2]=a):a=t[2];let[o,s]=TN(i,a),c=CN(i),l;t[3]!==e||t[4]!==s?(l=async t=>{cu(await s(t))&&e()},t[3]=e,t[4]=s,t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=()=>c(IE),t[6]=c,t[7]=u);let d;return t[8]!==o||t[9]!==l||t[10]!==u?(d={result:o,submit:l,reset:u},t[8]=o,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function oye(e,t){let n=(0,QB.c)(9),r;n[0]===e?r=n[1]:(r=rye(e),n[0]=e,n[1]=r);let i;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promiseExit`},n[2]=i):i=n[2];let[a,o]=TN(r,i),s;n[3]!==t||n[4]!==o?(s=async()=>{cu(await o(void 0))&&t()},n[3]=t,n[4]=o,n[5]=s):s=n[5];let c;return n[6]!==a||n[7]!==s?(c={result:a,submit:s},n[6]=a,n[7]=s,n[8]=c):c=n[8],c}function sye(){let e=(0,QB.c)(5),[t,n]=TN(iye),r;e[0]===n?r=e[1]:(r=()=>n(void 0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i={result:t,read:r},e[2]=t,e[3]=r,e[4]=i):i=e[4],i}function cye(e){let t=(0,QB.c)(31),{remote:n,onOpen:r,showUpdates:i}=e,a=O6(n),o=a.kind===`online`?a.name:n.name,{rows:s}=E5(),c;if(t[0]!==n.environmentId||t[1]!==s){let e;t[3]===n.environmentId?e=t[4]:(e=e=>{let{target:t}=e;return t.kind===`service`&&t.id===n.environmentId},t[3]=n.environmentId,t[4]=e),c=s.find(e),t[0]=n.environmentId,t[1]=s,t[2]=c}else c=t[2];let l=c,u=`Open ${o}`,d;t[5]!==r||t[6]!==n.environmentId?(d=()=>r(n.environmentId),t[5]=r,t[6]=n.environmentId,t[7]=d):d=t[7];let f=a.kind,p;t[8]===a?p=t[9]:(p=p0(a),t[8]=a,t[9]=p);let m;t[10]===n.address?m=t[11]:(m=(0,Q.jsx)(`span`,{className:`font-mono`,children:n.address}),t[10]=n.address,t[11]=m);let h;t[12]===n.environmentId?h=t[13]:(h=n.environmentId.slice(0,8),t[12]=n.environmentId,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Q.jsx)(`span`,{className:`font-mono`,children:h}),t[14]=h,t[15]=g);let _;t[16]!==p||t[17]!==m||t[18]!==g?(_=(0,Q.jsxs)(Q.Fragment,{children:[p,` ·`,` `,m,` ·`,` `,g]}),t[16]=p,t[17]=m,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==i||t[21]!==a.kind||t[22]!==l?(v=i&&(l?(0,Q.jsx)(R5,{row:l}):a.kind===`offline`&&(0,Q.jsx)(`p`,{className:`text-xs leading-4 text-muted-foreground`,children:`Version unavailable while offline`})),t[20]=i,t[21]=a.kind,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==o||t[25]!==a.kind||t[26]!==v||t[27]!==u||t[28]!==d||t[29]!==_?(y=(0,Q.jsx)(y9,{name:o,label:o,openLabel:u,onOpen:d,status:f,description:_,update:v}),t[24]=o,t[25]=a.kind,t[26]=v,t[27]=u,t[28]=d,t[29]=_,t[30]=y):y=t[30],y}function lye(){let e=(0,QB.c)(27),[t,n]=(0,Z.useState)(``),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>n(``),e[0]=r):r=e[0];let i=aye(r),{status:a}=w6(),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`p`,{className:`text-ui leading-5 text-foreground-2`,children:[`On the other computer, run`,` `,(0,Q.jsx)(`code`,{className:`rounded-sm bg-muted px-1.5 py-px font-mono text-xs leading-4.5 font-medium text-foreground inset-ring inset-ring-border`,children:`porcelain pair`}),` `,`and paste the link it prints. This device keeps its own credential for that computer.`]}),e[1]=o):o=e[1];let s;e[2]!==i||e[3]!==t?(s=e=>b8(e,()=>i.submit(t)),e[2]=i,e[3]=t,e[4]=s):s=e[4];let c=i.result.waiting||a!==`ready`,l;e[5]===i?l=e[6]:(l=e=>{i.reset(),n(e.target.value)},e[5]=i,e[6]=l);let u;e[7]!==t||e[8]!==c||e[9]!==l?(u=(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 font-mono`,children:(0,Q.jsx)(v8,{"aria-label":`Pairing link`,placeholder:`https://porcelain.fabiofiorita.com/open/pair#c=…`,value:t,disabled:c,onChange:l})}),e[7]=t,e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;e[11]!==i.result.waiting||e[12]!==t||e[13]!==a?(d=i.result.waiting||a!==`ready`||t.trim()===``,e[11]=i.result.waiting,e[12]=t,e[13]=a,e[14]=d):d=e[14];let f=i.result.waiting?`Pairing…`:`Add`,p;e[15]!==d||e[16]!==f?(p=(0,Q.jsx)(XV,{type:`submit`,className:`shrink-0`,disabled:d,children:f}),e[15]=d,e[16]=f,e[17]=p):p=e[17];let m;e[18]!==s||e[19]!==u||e[20]!==p?(m=(0,Q.jsxs)(`form`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,onSubmit:s,children:[u,p]}),e[18]=s,e[19]=u,e[20]=p,e[21]=m):m=e[21];let h;e[22]===i.result?h=e[23]:(h=eS(i.result)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Vl(i.result.cause))})}),e[22]=i.result,e[23]=h);let g;return e[24]!==h||e[25]!==m?(g=(0,Q.jsx)(W6,{children:(0,Q.jsxs)(K6,{children:[o,m,h]})}),e[24]=h,e[25]=m,e[26]=g):g=e[26],g}function uye(e){let{connection:t}=e,n=Un(sS(r8(t))),r=Un(sS(n8(t)));return n&&r?`Online · ${lpe(n,r.devices.length)}`:`Online · Connected computer`}function dye(e){let t=(0,QB.c)(60),{environment:n,onOpen:r,showUpdates:i}=e,{connection:a}=D6(),{remotes:o,error:s}=w6(),c=sye();Pge();let{targets:l,count:u,batch:d,run:f,retry:p,checking:m}=E5(),h=c8(),g;t[0]===h?g=t[1]:(g=w5(h),t[0]=h,t[1]=g);let _=g!==void 0,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(t8,{section:`Settings`,title:`Computers`,lead:`Manage your paired computers.`,children:(0,Q.jsxs)(`p`,{className:`mt-3.5 flex max-w-160 items-start gap-2 text-ui leading-5 text-muted-foreground`,children:[(0,Q.jsx)(AH,{"aria-hidden":!0,className:`mt-0.75 size-3.5 shrink-0`}),`Browser tabs each connect to one computer.`]})}),t[2]=v):v=t[2];let y;t[3]!==c||t[4]!==s?(y=s!==void 0&&(0,Q.jsxs)(Z6,{variant:`destructive`,children:[(0,Q.jsx)(PH,{}),(0,Q.jsx)(Q6,{children:`Saved computers could not be read`}),(0,Q.jsxs)($6,{children:[`Porcelain keeps them as they are and saves no change over them. Allow Porcelain to read its saved credentials, then try again.`,` `,s,(0,Q.jsx)(XV,{variant:`outline`,disabled:c.result.waiting,onClick:()=>c.read(),children:`Read saved computers`})]})]}),t[3]=c,t[4]=s,t[5]=y):y=t[5];let b=o.length+1,x;t[6]===b?x=t[7]:(x=(0,Q.jsxs)(`h2`,{id:`computers-heading`,className:`flex items-center gap-1 text-xs leading-4 font-medium text-muted-foreground`,children:[`Computers`,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:b})]}),t[6]=b,t[7]=x);let S=d.running||m||_,C;t[8]!==p||t[9]!==S?(C=(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,disabled:S,onClick:p,children:`Check for updates`}),t[8]=p,t[9]=S,t[10]=C):C=t[10];let w=d.running||u===0,T;t[11]!==f||t[12]!==l?(T=()=>f(l),t[11]=f,t[12]=l,t[13]=T):T=t[13];let E;t[14]!==u||t[15]!==T||t[16]!==w?(E=(0,Q.jsxs)(XV,{size:`sm`,disabled:w,onClick:T,children:[`Update all (`,u,`)`]}),t[14]=u,t[15]=T,t[16]=w,t[17]=E):E=t[17];let D;t[18]!==E||t[19]!==C?(D=(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[C,E]}),t[18]=E,t[19]=C,t[20]=D):D=t[20];let O;t[21]!==D||t[22]!==x?(O=(0,Q.jsxs)(`div`,{className:`mb-1.5 flex min-h-7 items-center justify-between gap-2`,children:[x,D]}),t[21]=D,t[22]=x,t[23]=O):O=t[23];let k=`This computer: ${n.name}`,A=`Open This computer: ${n.name}`,j;t[24]===r?j=t[25]:(j=()=>r(`this-computer`),t[24]=r,t[25]=j);let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(e8,{variant:`secondary`,children:`This computer`}),t[26]=M):M=t[26];let N;t[27]===a?N=t[28]:(N=(0,Q.jsx)(uye,{connection:a}),t[27]=a,t[28]=N);let P;t[29]===i?P=t[30]:(P=i&&(0,Q.jsx)(h9,{}),t[29]=i,t[30]=P);let F;t[31]!==n.name||t[32]!==k||t[33]!==A||t[34]!==j||t[35]!==N||t[36]!==P?(F=(0,Q.jsx)(y9,{name:n.name,label:k,openLabel:A,onOpen:j,status:`online`,badge:M,description:N,update:P}),t[31]=n.name,t[32]=k,t[33]=A,t[34]=j,t[35]=N,t[36]=P,t[37]=F):F=t[37];let I;if(t[38]!==r||t[39]!==o||t[40]!==i){let e;t[42]!==r||t[43]!==i?(e=e=>(0,Q.jsx)(cye,{remote:e,showUpdates:i,onOpen:r},e.environmentId),t[42]=r,t[43]=i,t[44]=e):e=t[44],I=[...o].sort(fye).map(e),t[38]=r,t[39]=o,t[40]=i,t[41]=I}else I=t[41];let L;t[45]!==F||t[46]!==I?(L=(0,Q.jsxs)(U6,{"aria-label":`Computers`,children:[F,I]}),t[45]=F,t[46]=I,t[47]=L):L=t[47];let R;t[48]!==O||t[49]!==L?(R=(0,Q.jsxs)(`section`,{"aria-labelledby":`computers-heading`,className:`@container flex min-w-0 flex-col gap-2`,children:[O,L]}),t[48]=O,t[49]=L,t[50]=R):R=t[50];let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(z6,{variant:`label`,children:`Add computer`}),t[51]=ee):ee=t[51];let z;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsxs)(R6,{children:[ee,(0,Q.jsx)(U6,{children:(0,Q.jsx)(lye,{})})]}),t[52]=z):z=t[52];let te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(te={section:`computers`,environmentId:`this-computer`},t[53]=te):te=t[53];let ne;t[54]===n.name?ne=t[55]:(ne=(0,Q.jsxs)(`p`,{className:`-mt-3.5 text-ui leading-5 text-muted-foreground`,children:[`To pair a phone, tablet or browser with this computer, open`,` `,(0,Q.jsxs)(dN,{to:`/settings/$section/$environmentId`,params:te,hash:`devices`,className:`rounded-sm font-medium text-foreground underline underline-offset-3 outline-none focus-visible:ring-3 focus-visible:ring-ring/30`,children:[n.name,` › Devices`]}),`.`]}),t[54]=n.name,t[55]=ne);let re;return t[56]!==R||t[57]!==ne||t[58]!==y?(re=(0,Q.jsxs)(Q.Fragment,{children:[v,y,R,z,ne]}),t[56]=R,t[57]=ne,t[58]=y,t[59]=re):re=t[59],re}function fye(e,t){return e.name.localeCompare(t.name)||e.environmentId.localeCompare(t.environmentId)}var _9=(0,Q.jsx)(SH,{"aria-hidden":!0,strokeWidth:3.5,className:`size-2.5 text-border-strong`});function v9(e){return(0,Q.jsx)(`span`,{"aria-hidden":!0,className:HV(`size-2 rounded-full`,e)})}var pye={online:v9(`bg-add-fg`),checking:_9,reconnecting:_9,offline:_9,"needs-pairing":v9(`bg-destructive`),"other-server":v9(`bg-destructive`),incompatible:v9(`bg-warn`)};function y9(e){let t=(0,QB.c)(24),{name:n,label:r,openLabel:i,status:a,badge:o,description:s,update:c,onOpen:l}=e,u=pye[a],d;t[0]===u?d=t[1]:(d=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex h-5 w-4 items-center justify-center self-start`,children:u}),t[0]=u,t[1]=d);let f;t[2]!==l||t[3]!==i?(f=e=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":i,onClick:l,className:`flex min-w-0 rounded-sm text-left outline-none after:absolute after:inset-0 focus-visible:ring-3 focus-visible:ring-ring/30`,children:e}),t[2]=l,t[3]=i,t[4]=f):f=t[4];let p;t[5]!==n||t[6]!==f?(p=(0,Q.jsx)(j6,{text:n,className:`text-sm leading-5 font-medium`,renderTrigger:f}),t[5]=n,t[6]=f,t[7]=p):p=t[7];let m;t[8]!==o||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[p,o]}),t[8]=o,t[9]=p,t[10]=m):m=t[10];let h;t[11]===s?h=t[12]:(h=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs leading-4.5 text-muted-foreground`,children:s}),t[11]=s,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`min-w-0 self-start`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===c?_=t[17]:(_=c&&(0,Q.jsx)(`div`,{className:`relative col-span-2 col-start-2 row-start-2 min-w-0 @2xl:col-span-1 @2xl:col-start-3 @2xl:row-start-1 @2xl:max-w-80`,children:c}),t[16]=c,t[17]=_);let v;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(bH,{"aria-hidden":!0,className:`col-start-3 row-start-1 size-4 justify-self-center text-muted-foreground @2xl:col-start-4`}),t[18]=v):v=t[18];let y;return t[19]!==r||t[20]!==d||t[21]!==g||t[22]!==_?(y=(0,Q.jsxs)(W6,{role:`listitem`,"aria-label":r,className:`relative grid grid-cols-[--spacing(4)_minmax(0,1fr)_--spacing(7)] @2xl:grid-cols-[--spacing(4)_minmax(0,1fr)_auto_--spacing(7)]`,children:[d,g,_,v]}),t[19]=r,t[20]=d,t[21]=g,t[22]=_,t[23]=y):y=t[23],y}function b9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:HV(`animate-pulse rounded-md bg-muted`,e),...t})}function mye(e){let t=(0,QB.c)(10),{navigation:n,title:r,children:i}=e;if(!n)return i;let a;t[0]===r?a=t[1]:(a=(0,Q.jsx)(`span`,{className:`text-ui font-medium`,children:r}),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-b px-3`,children:[n,a]}),t[2]=n,t[3]=a,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-paper border bg-background`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function x9(e){let t=(0,QB.c)(18),{title:n,description:r,icon:i,children:a,role:o}=e,s;t[0]===i?s=t[1]:(s=i??(0,Q.jsx)(MH,{}),t[0]=i,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground [&>svg]:size-4`,children:s}),t[2]=s,t[3]=c);let l;t[4]===n?l=t[5]:(l=(0,Q.jsx)(`h2`,{className:`min-w-0 text-base font-semibold wrap-anywhere`,children:n}),t[4]=n,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=r&&(0,Q.jsx)(`div`,{className:`text-ui leading-relaxed text-muted-foreground [overflow-wrap:anywhere]`,children:r}),t[9]=r,t[10]=d);let f;t[11]===a?f=t[12]:(f=a&&(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:a}),t[11]=a,t[12]=f);let p;return t[13]!==o||t[14]!==u||t[15]!==d||t[16]!==f?(p=(0,Q.jsxs)(`section`,{"data-slot":`state-notice`,role:o,className:`flex w-full min-w-0 max-w-xl flex-col gap-3 p-6 text-left`,children:[u,d,f]}),t[13]=o,t[14]=u,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function hye(e){let t=(0,QB.c)(14),{label:n,caption:r}=e,i=r===void 0||r,a;t[0]!==i||t[1]!==n?(a=i&&(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Q.jsx)(M6,{"aria-hidden":`true`,className:`size-3.5`}),` `,n,`…`]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o,s,c,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(b9,{className:`h-5 w-2/3`}),s=(0,Q.jsx)(b9,{className:`h-4 w-full`}),c=(0,Q.jsx)(b9,{className:`h-4 w-4/5`}),l=(0,Q.jsx)(b9,{className:`h-4 w-1/2`}),t[3]=o,t[4]=s,t[5]=c,t[6]=l):(o=t[3],s=t[4],c=t[5],l=t[6]);let u;t[7]!==i||t[8]!==n?(u=!i&&(0,Q.jsxs)(`span`,{className:`sr-only`,children:[n,`…`]}),t[7]=i,t[8]=n,t[9]=u):u=t[9];let d;return t[10]!==n||t[11]!==a||t[12]!==u?(d=(0,Q.jsxs)(`div`,{role:`status`,"aria-label":n,className:`flex w-full min-w-0 flex-1 flex-col gap-3 bg-background p-6`,children:[a,o,s,c,l,u]}),t[10]=n,t[11]=a,t[12]=u,t[13]=d):d=t[13],d}function gye(e){let t=(0,QB.c)(10),{description:n,onRetry:r,onBack:i,title:a}=e,o=a===void 0?`Could not display`:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(wH,{}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=(0,Q.jsx)(XV,{variant:`outline`,onClick:r,children:`Try again`}),t[1]=r,t[2]=c);let l;t[3]===i?l=t[4]:(l=i&&(0,Q.jsx)(XV,{variant:`ghost`,onClick:i,children:`Back to workspace`}),t[3]=i,t[4]=l);let u;return t[5]!==n||t[6]!==c||t[7]!==l||t[8]!==o?(u=(0,Q.jsxs)(x9,{role:`alert`,title:o,description:n,icon:s,children:[c,l]}),t[5]=n,t[6]=c,t[7]=l,t[8]=o,t[9]=u):u=t[9],u}function _ye(e){let t=(0,QB.c)(16),{name:n,status:r,onOpenRemotes:i}=e;if(r.kind===`online`)return null;let a=r.kind===`checking`||r.kind===`reconnecting`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(XH,{}),t[0]=o):o=t[0];let s=o;if(r.kind===`needs-pairing`){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(RH,{}),t[1]=e):e=t[1],s=e}if(a){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(M6,{}),t[2]=e):e=t[2],s=e}let c=s,l;t[3]!==n||t[4]!==r?(l=r.kind===`offline`?`${n} is offline`:`${n}: ${p0(r)}`,t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=m0(r),t[6]=r,t[7]=u);let d;t[8]!==i||t[9]!==a?(d=!a&&(0,Q.jsx)(XV,{variant:`outline`,onClick:i,children:`Computer settings`}),t[8]=i,t[9]=a,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Q.jsx)(x9,{role:`status`,icon:c,title:l,description:u,children:d}),t[11]=s,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function vye(e){let t=(0,QB.c)(14),{remote:n}=e,r,i,a,o;if(t[0]!==n){let e=e0(n);i=R6,t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(z6,{variant:`label`,children:`Saved connections`}),t[5]=o):o=t[5],r=U6,a=e.map(yye),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];let s;t[6]!==r||t[7]!==a?(s=(0,Q.jsx)(r,{children:a}),t[6]=r,t[7]=a,t[8]=s):s=t[8];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The addresses this app tries, in order, to reach that computer.`}),t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==s?(l=(0,Q.jsxs)(i,{children:[o,s,c]}),t[10]=i,t[11]=o,t[12]=s,t[13]=l):l=t[13],l}function yye(e){let{address:t}=e;return(0,Q.jsxs)(W6,{children:[(0,Q.jsxs)(K6,{children:[(0,Q.jsx)(q6,{children:r0(t)}),(0,Q.jsx)(J6,{className:`break-all`,children:t})]}),(0,Q.jsx)(Y6,{children:(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{size:`icon-sm`,variant:`ghost`,"aria-label":`Copy ${t}`,onClick:()=>HU(t,`address`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{role:`tooltip`,className:`break-all`,children:`Copy ${t}`})]})})]},t)}function bye(e){let t=(0,QB.c)(2),{remote:n}=e,r=O6(n),i=r.kind===`online`?r.name:n.name,a;return t[0]===i?a=t[1]:(a=(0,Q.jsx)(j6,{text:i,className:`block min-w-0`}),t[0]=i,t[1]=a),a}function xye(e){let t=(0,QB.c)(13),{environmentId:n,onForgotten:r}=e,{remotes:i,status:a,error:o}=w6(),s;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),s=i.find(e),t[0]=n,t[1]=i,t[2]=s}else s=t[2];let c=s;if(!c){let e=a===`ready`?`Computer unavailable`:void 0,n=a===`ready`?`This computer is no longer saved on this app. Return to Computers to add it again.`:o??`Reading saved remote computers…`,r;t[5]===n?r=t[6]:(r=(0,Q.jsx)($6,{children:n}),t[5]=n,t[6]=r);let i;return t[7]!==e||t[8]!==r?(i=(0,Q.jsx)(Z6,{"data-unavailable-page":e,children:r}),t[7]=e,t[8]=r,t[9]=i):i=t[9],i}let l;return t[10]!==r||t[11]!==c?(l=(0,Q.jsx)(Sye,{remote:c,onForgotten:r}),t[10]=r,t[11]=c,t[12]=l):l=t[12],l}function Sye(e){let t=(0,QB.c)(76),{remote:n,onForgotten:r}=e,i=O6(n),a=E6(n.environmentId),o=oye(n,r),s=i.kind===`online`,c=s?i.name:n.name,l;t[0]===i?l=t[1]:(l=m0(i),t[0]=i,t[1]=l);let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(z6,{variant:`label`,children:`Overview`}),t[2]=d):d=t[2];let f;t[3]===c?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`min-w-0`,children:c}),t[3]=c,t[4]=f);let p;t[5]===i?p=t[6]:(p=U3(i),t[5]=i,t[6]=p);let m;t[7]===i?m=t[8]:(m=p0(i),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,Q.jsx)(e8,{variant:p,children:m}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==f||t[13]!==h?(g=(0,Q.jsxs)(q6,{className:`min-w-0 flex-wrap`,children:[f,` `,h]}),t[12]=f,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=u&&(0,Q.jsx)(J6,{children:u}),t[15]=u,t[16]=_);let v;t[17]===s?v=t[18]:(v=!s&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Saved details · Stale. This computer has not been verified online.`}),t[17]=s,t[18]=v);let y;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(I5,{render:(0,Q.jsx)(XV,{variant:`ghost`,size:`sm`}),children:`Details`}),t[19]=y):y=t[19];let b;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Address`}),t[20]=b):b=t[20];let x;t[21]===n.address?x=t[22]:(x=(0,Q.jsxs)(`div`,{children:[b,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.address})]}),t[21]=n.address,t[22]=x);let S;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Computer ID`}),t[23]=S):S=t[23];let C;t[24]===n.environmentId?C=t[25]:(C=(0,Q.jsxs)(`div`,{children:[S,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.environmentId})]}),t[24]=n.environmentId,t[25]=C);let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Porcelain version`}),t[26]=w):w=t[26];let T=s?i.version??`Not reported`:`Unavailable while this computer is not online`,E;t[27]===T?E=t[28]:(E=(0,Q.jsxs)(`div`,{children:[w,(0,Q.jsx)(`dd`,{children:T})]}),t[27]=T,t[28]=E);let D;t[29]===n.deviceId?D=t[30]:(D=n.deviceId&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`This app’s device ID`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.deviceId})]}),t[29]=n.deviceId,t[30]=D);let O;t[31]!==x||t[32]!==C||t[33]!==E||t[34]!==D?(O=(0,Q.jsxs)(F5,{children:[y,(0,Q.jsx)(L5,{children:(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[x,C,E,D]})})]}),t[31]=x,t[32]=C,t[33]=E,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==O||t[37]!==g||t[38]!==_||t[39]!==v?(k=(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsxs)(K6,{children:[g,_,v,O]})}),t[36]=O,t[37]=g,t[38]=_,t[39]=v,t[40]=k):k=t[40];let A;t[41]!==a||t[42]!==s?(A=s&&a&&(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsx)(K6,{children:(0,Q.jsx)(t_e,{connection:a.connection})})}),t[41]=a,t[42]=s,t[43]=A):A=t[43];let j;t[44]!==k||t[45]!==A?(j=(0,Q.jsxs)(R6,{className:`lg:col-span-2`,children:[d,(0,Q.jsxs)(U6,{children:[k,A]})]}),t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==a||t[48]!==s?(M=s&&a&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(m9,{connection:a.connection}),(0,Q.jsx)(g9,{connection:a.connection})]}),t[47]=a,t[48]=s,t[49]=M):M=t[49];let N;t[50]===n?N=t[51]:(N=(0,Q.jsx)(vye,{remote:n}),t[50]=n,t[51]=N);let P;t[52]===s?P=t[53]:(P=!s&&(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsxs)(K6,{children:[(0,Q.jsx)(q6,{children:`Pair again`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`On this computer, run porcelain pair. Return to Computers and add the new link to replace this app’s saved connection.`})]})}),t[52]=s,t[53]=P);let F;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(z6,{variant:`label`,children:`Danger zone`}),t[54]=F):F=t[54];let I;t[55]===c?I=t[56]:(I=(0,Q.jsxs)(q6,{children:[`Forget `,c]}),t[55]=c,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removes this computer from this app. Other devices keep their access.`}),t[57]=L):L=t[57];let R;t[58]===o?R=t[59]:(R=()=>void o.submit(),t[58]=o,t[59]=R);let ee=o.result.waiting?`Forgetting…`:`Forget on this app`,z;t[60]!==o.result.waiting||t[61]!==R||t[62]!==ee?(z=(0,Q.jsx)(XV,{variant:`destructive`,className:`w-fit`,disabled:o.result.waiting,onClick:R,children:ee}),t[60]=o.result.waiting,t[61]=R,t[62]=ee,t[63]=z):z=t[63];let te;t[64]===o.result?te=t[65]:(te=eS(o.result)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Vl(o.result.cause))})}),t[64]=o.result,t[65]=te);let ne;t[66]!==I||t[67]!==z||t[68]!==te?(ne=(0,Q.jsxs)(R6,{children:[F,(0,Q.jsx)(`div`,{className:`rounded-2xl border border-destructive/30`,children:(0,Q.jsx)(U6,{children:(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsxs)(K6,{children:[I,L,z,te]})})})})]}),t[66]=I,t[67]=z,t[68]=te,t[69]=ne):ne=t[69];let re;return t[70]!==j||t[71]!==M||t[72]!==N||t[73]!==P||t[74]!==ne?(re=(0,Q.jsxs)(`div`,{className:`settings-computer grid min-w-0 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_--spacing(62)]`,children:[j,M,N,P,ne]}),t[70]=j,t[71]=M,t[72]=N,t[73]=P,t[74]=ne,t[75]=re):re=t[75],re}var Cye=bE(e=>e.registry),S9=X(e=>bE(t=>{let n=window.matchMedia(e),r=()=>t.setSelf(n.matches);return n.addEventListener(`change`,r),t.addFinalizer(()=>n.removeEventListener(`change`,r)),n.matches})),wye=bE(()=>{let e=document.title,t=new Map;return n=>{let r=Symbol();return t.set(r,n),document.title=n,()=>{t.delete(r),document.title=[...t.values()].at(-1)??e}}}),Tye=X(e=>bE(t=>{t.addFinalizer(t(wye)(e))}));function C9(){let e=(0,QB.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=S9(`(max-width: 767px)`),e[0]=t):t=e[0],yN(t)}var w9=Z.createContext(void 0);function T9(e){let t=Z.useContext(w9);if(!e&&t===void 0)throw Error(LN(27));return t}var E9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=T9(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return TI(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:GP,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),D9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=T9(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=nL({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,SL(dL,e.nativeEvent))}return TI(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),O9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=T9(),c=vU(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),TI(`p`,e,{ref:t,props:[{id:c},o]})}),k9=Z.createContext(void 0);function Eye(){let e=Z.useContext(k9);if(e===void 0)throw Error(LN(26));return e}var Dye=`--nested-dialogs`,Oye=`data-nested-dialog-open`,kye={...WP,...BP,nestedDialogOpen(e){return e?{[Oye]:``}:null}},A9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=T9(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Eye(),LI({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?Pz(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=TI(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...Nz,hidden:!m,onKeyDown(e){V8.has(e.key)&&e.stopPropagation()},style:{[Dye]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:kye});return(0,Q.jsx)(vR,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),j9=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=T9(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(k9.Provider,{value:n,children:(0,Q.jsxs)(OL,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(Z8,{ref:i.context.internalBackdropRef,inert:MI(!s)}),e.children]})}):null});function Aye({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Z.useState(0),[u,d]=Z.useState(0),f=c===0,p=TR(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=FP(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||PP(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return r5(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),FN(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),Gz(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var M9={...eB,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},jye=class extends qN{constructor(e,t,n){let r=new qz,i=N9(e,r,t,n);super(i,P9(r),M9)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(zz(this.state,e,t.trigger)))}};function Mye(){let e=new qz;return new dU(Object.freeze(N9(void 0,e)),Object.freeze(P9(e)),M9)}function N9(e,t,n,r=!1){return{...Jz(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function P9(e){return{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function F9(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=T9(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=Fz((e,t)=>new jye({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Kz(b,x),Uz(b);let{forceUnmount:w}=Wz(x,b);Z.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,SL(bL))}),[w,b]);let T=x||S;return(0,Q.jsxs)(w9.Provider,{value:b,children:[u&&(0,Q.jsx)(Iz,{handle:u,store:b}),T&&(0,Q.jsx)(Aye,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var I9=VN(function(e){return F9(`dialog`,e)}),L9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=T9(),c=vU(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),TI(`h2`,e,{ref:t,props:[{id:c},o]})});function R9({...e}){return(0,Q.jsx)(I9,{"data-slot":`sheet`,...e})}function Nye({...e}){return(0,Q.jsx)(j9,{"data-slot":`sheet-portal`,...e})}function Pye({className:e,...t}){return(0,Q.jsx)(E9,{"data-slot":`sheet-overlay`,className:HV(`fixed inset-0 z-50 bg-black/80 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function z9({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,Q.jsxs)(Nye,{children:[(0,Q.jsx)(Pye,{}),(0,Q.jsxs)(A9,{"data-slot":`sheet-content`,"data-side":n,className:HV(`fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,Q.jsxs)(D9,{"data-slot":`sheet-close`,render:(0,Q.jsx)(XV,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,Q.jsx)(cU,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function B9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:HV(`flex flex-col gap-1.5 p-6`,e),...t})}function V9({className:e,...t}){return(0,Q.jsx)(L9,{"data-slot":`sheet-title`,className:HV(`font-heading text-sm font-medium text-foreground`,e),...t})}function H9({className:e,...t}){return(0,Q.jsx)(O9,{"data-slot":`sheet-description`,className:HV(`text-xs/relaxed text-muted-foreground`,e),...t})}var Fye=`sidebar_state`,Iye=604800,Lye=`16rem`,Rye=`18rem`,zye=`3rem`,Bye=`b`,U9=Z.createContext(null);function W9(){let e=Z.useContext(U9);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Vye({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=C9(),[c,l]=Z.useState(!1),[u,d]=Z.useState(e),f=t??u,p=Z.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${Fye}=${t}; path=/; max-age=${Iye}`},[n,f]),m=Z.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);Z.useEffect(()=>{let e=e=>{e.key===Bye&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=Z.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,Q.jsx)(U9.Provider,{value:g,children:(0,Q.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Lye,"--sidebar-width-icon":zye,...i},className:HV(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Hye({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=W9();return n===`none`?(0,Q.jsx)(`div`,{"data-slot":`sidebar`,className:HV(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,Q.jsx)(R9,{open:l,onOpenChange:u,...o,children:(0,Q.jsxs)(z9,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Rye},side:e,children:[(0,Q.jsxs)(B9,{className:`sr-only`,children:[(0,Q.jsx)(V9,{children:`Sidebar`}),(0,Q.jsx)(H9,{children:`Displays the mobile sidebar.`})]}),(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,Q.jsx)(`div`,{"data-slot":`sidebar-gap`,className:HV(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,Q.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:HV(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,Q.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function Uye({className:e,onClick:t,...n}){let{toggleSidebar:r}=W9();return(0,Q.jsxs)(XV,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:HV(e),onClick:e=>{t?.(e),r()},...n,children:[(0,Q.jsx)(KH,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Wye({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:HV(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function Gye({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:HV(`relative flex w-full min-w-0 flex-col px-2 py-1`,e),...t})}function Kye({className:e,render:t,...n}){return H6({defaultTagName:`div`,props:dI({className:HV(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-label`,sidebar:`group-label`}})}function qye({className:e,render:t,...n}){return H6({defaultTagName:`button`,props:dI({className:HV(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-action`,sidebar:`group-action`}})}function Jye({className:e,...t}){return(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:HV(`flex w-full min-w-0 flex-col gap-px`,e),...t})}function Yye({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:HV(`group/menu-item relative`,e),...t})}var G9=Z.createContext(void 0);function K9(e){let t=Z.useContext(G9);if(t===void 0&&!e)throw Error(LN(47));return t}var Xye={...eB,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Zye=class extends qN{constructor(e,t,n){let r=new qz;super(Qye(e,r,t,n),$ye(r),Xye)}setOpen=(e,t)=>{let n=t.reason===sL,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=Bz(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=zz(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),IN.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Qye(e,t,n,r=!1){let i={...Jz(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function $ye(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new CP,triggerElements:e}}var q9=VN(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=tbe(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),Kz(u,d),Uz(u);let{forceUnmount:m}=Wz(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),Z.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,SL(bL))}),[m,u]);let h=d||f;return(0,Q.jsxs)(G9.Provider,{value:u,children:[s&&(0,Q.jsx)(Iz,{handle:s,store:u}),h&&(0,Q.jsx)(nbe,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function ebe(e){return K9(!0)?(0,Q.jsx)(q9,{props:e}):(0,Q.jsx)(lR,{children:(0,Q.jsx)(q9,{props:e})})}function tbe(e,t){let n=Fz((e,n)=>new Zye(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function nbe({store:e,modal:t}){let n=TR(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return Gz(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var rbe=HN(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=K9(!0),h=tB(s)??m;if(!h)throw Error(LN(74));let g=vU(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Hz(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=mB(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:jB(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=yR(v,{stickIfOpen:T}),A=l5(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=nL({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?UP.open(e):HP.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=g5(h,x),R=TI(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[zI]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),ee=(0,Q.jsx)(Z.Fragment,{children:R},g);return C&&!D?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(QF,{ref:F,onFocus:I}),ee,(0,Q.jsx)(QF,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):ee}),J9=Z.createContext(void 0);function ibe(){let e=Z.useContext(J9);if(e===void 0)throw Error(LN(45));return e}var abe=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return K9().useState(`mounted`)||n?(0,Q.jsx)(J9.Provider,{value:n,children:(0,Q.jsx)(OL,{ref:t,...r})}):null}),Y9=Z.createContext(void 0);function obe(){let e=Z.useContext(Y9);if(!e)throw Error(LN(46));return e}var sbe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=GI,..._}=e,v=K9(),y=ibe(),b=sR(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=Z.useRef(null),N=II(O),P=qB({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),F=x.useState(`domReferenceElement`);FN(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I=E===!0&&w!==`trigger-hover`;i5(C&&I,D===`touch`,O,T);let L=v.useStateSetter(`positionerElement`),R=ZB(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,Q.jsxs)(Y9.Provider,{value:P,children:[S&&I&&(0,Q.jsx)(Z8,{inert:MI(!C),cutout:T}),(0,Q.jsx)(cR,{id:b,children:R})]})}),cbe=Z.createContext(void 0);function lbe(){let[e,t]=Z.useState(0),n=KN(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var ube=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=K9(),l=obe(),u=I8(!0)!=null,{context:d,hasClosePart:f}=lbe(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);LI({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),fB(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?Pz(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=TI(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...Nz,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&V8.has(e.key)&&e.stopPropagation()}},XB(g),s],stateAttributesMapping:GP});return(0,Q.jsx)(vR,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:eP(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(cbe.Provider,{value:d,children:M})})}),dbe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=vU(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),TI(`h2`,e,{ref:t,props:[{id:s},a]})}),fbe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=vU(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),TI(`p`,e,{ref:t,props:[{id:s},a]})});function X9({...e}){return(0,Q.jsx)(ebe,{"data-slot":`popover`,...e})}function Z9({...e}){return(0,Q.jsx)(rbe,{"data-slot":`popover-trigger`,...e})}function Q9({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,Q.jsx)(abe,{children:(0,Q.jsx)(sbe,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,Q.jsx)(ube,{"data-slot":`popover-content`,className:HV(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}function pbe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`popover-header`,className:HV(`flex flex-col gap-1 text-xs`,e),...t})}function $9({className:e,...t}){return(0,Q.jsx)(dbe,{"data-slot":`popover-title`,className:HV(`text-sm font-medium`,e),...t})}function mbe({className:e,...t}){return(0,Q.jsx)(fbe,{"data-slot":`popover-description`,className:HV(`text-muted-foreground`,e),...t})}function hbe(e){let t=(0,QB.c)(84),{fallbackFocus:n}=e,{rows:r,targets:i,count:a,batch:o,run:s,failures:c,checking:l,refresh:u,retry:d}=E5(),f=aN(),{setOpenMobile:p}=W9(),[m,h]=(0,Z.useState)(!1),g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;if(t[0]!==o||t[1]!==l||t[2]!==c||t[3]!==n||t[4]!==m||t[5]!==u||t[6]!==d||t[7]!==r||t[8]!==i){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.filter(ybe),a=r.filter(t=>e.includes(t)||o.entries.some(e=>e.id===t.target.id&&e.kind===t.target.kind)),s;t[24]===o?s=t[25]:(s=Nle(o),t[24]=o,t[25]=s);let f=s;v=f.label?`${f.label}…`:`Preparing updates…`;let p;t[26]!==o||t[27]!==i?(p=Ale(i,o),t[26]=o,t[27]=i,t[28]=p):p=t[28];let j=p,M=`Updates available`;if(!j&&o.entries.length===0&&(M=`No updates available`),c.length>0&&(M=`Could not check for updates`),!j&&!m){S=null;break bb0}_=X9,A=m,t[29]===u?b=t[30]:(b=e=>{h(e),e&&u()},t[29]=u,t[30]=b);let N=!j&&`invisible`,P;t[31]===N?P=t[32]:(P=HV(N),t[31]=N,t[32]=P);let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(e8,{render:(0,Q.jsx)(`button`,{type:`button`})}),t[33]=F):F=t[33];let I=o.running?`Updating…`:`Update`;t[34]!==P||t[35]!==I?(x=(0,Q.jsx)(`span`,{className:`inline-flex [--primary:var(--brand-soft)] [--primary-foreground:var(--brand)]`,children:(0,Q.jsx)(Z9,{className:P,render:F,children:I})}),t[34]=P,t[35]=I,t[36]=x):x=t[36],g=Q9,w=`top`,T=`end`,E=`max-h-(--available-height) w-88 max-w-[calc(100vw-1rem)] overflow-y-auto`,t[37]!==n||t[38]!==j?(D=j?!0:()=>n.element,t[37]=n,t[38]=j,t[39]=D):D=t[39],t[40]===M?O=t[41]:(O=(0,Q.jsx)($9,{children:M}),t[40]=M,t[41]=O),t[42]!==l||t[43]!==c||t[44]!==d?(k=c.length>0&&(0,Q.jsxs)(Z6,{variant:`destructive`,children:[(0,Q.jsx)(Q6,{children:`The update check failed`}),(0,Q.jsxs)($6,{children:[c.map(vbe),(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,disabled:l,onClick:d,children:`Try again`})]})]}),t[42]=l,t[43]=c,t[44]=d,t[45]=k):k=t[45],y=`flex max-h-[60svh] flex-col divide-y overflow-y-auto`,C=a.map(_be)}t[0]=o,t[1]=l,t[2]=c,t[3]=n,t[4]=m,t[5]=u,t[6]=d,t[7]=r,t[8]=i,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A}else g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21],k=t[22],A=t[23];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let j;if(t[46]!==o.entries||t[47]!==r){let e;t[49]===r?e=t[50]:(e=e=>!r.some(t=>{let{target:n}=t;return n.id===e.id&&n.kind===e.kind}),t[49]=r,t[50]=e),j=o.entries.filter(e).map(gbe),t[46]=o.entries,t[47]=r,t[48]=j}else j=t[48];let M;t[51]!==y||t[52]!==j||t[53]!==C?(M=(0,Q.jsxs)(`div`,{className:y,children:[C,j]}),t[51]=y,t[52]=j,t[53]=C,t[54]=M):M=t[54];let N;t[55]!==f||t[56]!==p?(N=(0,Q.jsx)(XV,{size:`sm`,variant:`ghost`,onClick:()=>{h(!1),p(!1),f({to:`/settings/$section`,params:{section:`computers`}})},children:`Manage computers`}),t[55]=f,t[56]=p,t[57]=N):N=t[57];let P=o.running||a===0,F;t[58]!==s||t[59]!==i?(F=()=>s(i),t[58]=s,t[59]=i,t[60]=F):F=t[60];let I=o.running?v:`Update all (${a})`,L;t[61]!==P||t[62]!==F||t[63]!==I?(L=(0,Q.jsx)(XV,{size:`sm`,disabled:P,"aria-live":`polite`,onClick:F,children:I}),t[61]=P,t[62]=F,t[63]=I,t[64]=L):L=t[64];let R;t[65]!==N||t[66]!==L?(R=(0,Q.jsxs)(`footer`,{className:`flex items-center justify-between gap-2 border-t pt-3`,children:[N,L]}),t[65]=N,t[66]=L,t[67]=R):R=t[67];let ee;t[68]!==g||t[69]!==M||t[70]!==R||t[71]!==w||t[72]!==T||t[73]!==E||t[74]!==D||t[75]!==O||t[76]!==k?(ee=(0,Q.jsxs)(g,{side:w,align:T,className:E,finalFocus:D,children:[O,k,M,R]}),t[68]=g,t[69]=M,t[70]=R,t[71]=w,t[72]=T,t[73]=E,t[74]=D,t[75]=O,t[76]=k,t[77]=ee):ee=t[77];let z;return t[78]!==_||t[79]!==b||t[80]!==x||t[81]!==ee||t[82]!==A?(z=(0,Q.jsxs)(_,{open:A,onOpenChange:b,children:[x,ee]}),t[78]=_,t[79]=b,t[80]=x,t[81]=ee,t[82]=A,t[83]=z):z=t[83],z}function gbe(e){return(0,Q.jsxs)(`div`,{className:`py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,Q.jsx)(`p`,{role:e.status===`failed`?`alert`:`status`,className:`text-xs text-muted-foreground`,children:bbe(e)})]},`${e.kind}:${e.id}`)}function _be(e){return(0,Q.jsx)(`div`,{className:`py-3`,children:(0,Q.jsx)(R5,{row:e,showName:!0})},`${e.target.kind}:${e.target.id}`)}function vbe(e){return(0,Q.jsxs)(`p`,{className:`wrap-anywhere`,children:[e.name,`: `,e.message]},e.id)}function ybe(e){let{target:t}=e;return A2(t)}function bbe(e){return e.status===`failed`?e.message:e.status===`updated`?`Updated to ${e.version}.`:e.status===`queued`?`Queued`:`Updating to ${e.version}…`}export{O7 as $,G2 as $a,CM as $c,Nue as $i,xb as $l,nme as $n,gH as $o,Ofe as $r,LN as $s,K6 as $t,D9 as A,fue as Aa,Boe as Ac,bde as Ai,Vae as Al,Tme as An,$W as Ao,_pe as Ar,QF as As,E8 as At,Qu as Au,gye as B,aue as Ba,jM as Bc,X4 as Bi,$x as Bl,ume as Bn,vU as Bo,Vfe as Br,NP as Bs,p8 as Bt,tr as Bu,L9 as C,gue as Ca,$M as Cc,Ade as Ci,NT as Cl,Rme as Cn,p0 as Co,Mpe as Cr,zI as Cs,l5 as Ct,_p as Cu,j9 as D,g4 as Da,Woe as Dc,r3 as Di,coe as Dl,Fme as Dn,IK as Do,V3 as Dr,TI as Ds,F8 as Dt,Df as Du,Mye as E,due as Ea,Uoe as Ec,n3 as Ei,LT as El,E6 as En,rq as Eo,U3 as Er,MI as Es,K8 as Et,Uf as Eu,Tye as F,c4 as Fa,Noe as Fc,hde as Fi,eS as Fl,yme as Fn,BU as Fo,$fe as Fr,UP as Fs,v8 as Ft,cu as Fu,dye as G,eue as Ga,Doe as Gc,L4 as Gi,Gb as Gl,ame as Gn,HH as Go,Kfe as Gr,wP as Gs,t8 as Gt,Rn as Gu,x9 as H,tue as Ha,Ooe as Hc,$ue as Hi,J as Hl,cme as Hn,QH as Ho,Ufe as Hr,FP as Hs,d8 as Ht,Vn as Hu,S9 as I,oue as Ia,Moe as Ic,lde as Ii,Yx as Il,bme as In,IU as Io,Rfe as Ir,HP as Is,_8 as It,su as Iu,r9 as J,$le as Ja,yM as Jc,Uue as Ji,q as Jl,sme as Jn,MH as Jo,Jfe as Jr,hP as Js,the as Jt,In as Ju,tye as K,Q2 as Ka,xM as Kc,M4 as Ki,Rb as Kl,ime as Kn,BH as Ko,Gfe as Kr,_P as Ks,e8 as Kt,zn as Ku,bye as L,r4 as La,Aoe as Lc,dde as Li,Qx as Ll,hme as Ln,RU as Lo,Yfe as Lr,BP as Ls,g8 as Lt,$l as Lu,T9 as M,l4 as Ma,qM as Mc,vde as Mi,Jae as Ml,Cme as Mn,KW as Mo,fpe as Mr,ZF as Ms,w8 as Mt,Eu as Mu,C9 as N,s4 as Na,VM as Nc,pde as Ni,dS as Nl,xme as Nn,GU as No,ape as Nr,tF as Ns,y8 as Nt,rne as Nu,A9 as O,hue as Oa,zoe as Oc,jde as Oi,vT as Ol,Pme as On,sG as Oo,gpe as Or,dI as Os,P8 as Ot,kp as Ou,Cye as P,sue as Pa,joe as Pc,fde as Pi,Zx as Pl,gme as Pn,HU as Po,epe as Pr,ZP as Ps,b8 as Pt,lu as Pu,T7 as Q,W2 as Qa,xoe as Qc,Lue as Qi,die as Ql,n6 as Qn,vH as Qo,kfe as Qr,HN as Qs,Y6 as Qt,xye as R,a4 as Ra,Foe as Rc,ude as Ri,Kx as Rl,c6 as Rn,FU as Ro,zfe as Rr,zP as Rs,h8 as Rt,Vl as Ru,V9 as S,_ue as Sa,eN as Sc,Cde as Si,MT as Sl,Lme as Sn,m0 as So,Ppe as Sr,HI as Ss,d5 as St,zp as Su,F9 as T,lue as Ta,ZM as Tc,i3 as Ti,FT as Tl,T6 as Tn,hZ as To,Cpe as Tr,LI as Ts,J8 as Tt,V as Tu,hye as U,n4 as Ua,Eoe as Uc,Que as Ui,Fb as Ul,s6 as Un,JH as Uo,Bfe as Ur,jP as Us,u8 as Ut,Kn as Uu,mye as V,rue as Va,Toe as Vc,Y4 as Vi,sS as Vl,fme as Vn,cU as Vo,F3 as Vr,PP as Vs,f8 as Vt,$n as Vu,b9 as W,$2 as Wa,OM as Wc,I4 as Wi,Wb as Wl,dme as Wn,WH as Wo,Wfe as Wr,CP as Ws,l8 as Wt,Un as Wu,i9 as X,Zle as Xa,Soe as Xc,Bue as Xi,vie as Xl,t6 as Xn,SH as Xo,Mfe as Xr,qN as Xs,Q6 as Xt,Zn as Xu,Lve as Y,Qle as Ya,AM as Yc,Wue as Yi,Mb as Yl,i6 as Yn,OH as Yo,I3 as Yr,XN as Ys,$6 as Yt,Ln as Yu,a9 as Z,Xle as Za,bM as Zc,T4 as Zi,qb as Zl,a6 as Zn,bH as Zo,Afe as Zr,KN as Zs,W6 as Zt,W9 as _,Sue as _a,cse as _c,Tde as _i,uE as _l,j6 as _n,G0 as _o,Hpe as _r,oL as _s,Sge as _t,np as _u,pbe as a,Pue as aa,TN as ac,zde as ai,IE as al,V6 as an,Ule as ao,$3 as ar,JV as as,p7 as at,Hg as au,H9 as b,Cue as ba,iN as bc,Ide as bi,vE as bl,Hme as bn,T0 as bo,Npe as br,ZI as bs,y5 as bt,fp as bu,Hye as c,C4 as ca,wN as cc,Bde as ci,PE as cl,Xme as cn,Tle as co,Gpe as cr,tB as cs,H5 as ct,qne as cu,qye as d,Fue as da,yN as dc,Hde as di,bE as dl,qme as dn,f2 as do,Bpe as dr,yR as ds,I5 as dt,xp as du,Rue as ea,FN as ec,jfe as ei,hoe as el,J6 as en,B2 as eo,e6 as er,mH as es,J_e as et,uie as eu,Kye as f,b4 as fa,gN as fc,Ede as fi,qE as fl,L6 as fn,l2 as fo,Vpe as fr,kL as fs,C5 as ft,U as fu,Uye as g,Eue as ga,dN as gc,Nde as gi,kE as gl,M6 as gn,W0 as go,Lpe as gr,aL as gs,x5 as gt,H as gu,Vye as h,Tue as ha,fN as hc,Ode as hi,tD as hl,P6 as hn,K0 as ho,Wpe as hr,bL as hs,b5 as ht,wf as hu,mbe as i,Due as ia,kN as ic,Pfe as ii,ej as il,B6 as in,U2 as io,Zpe as ir,YV as is,E7 as it,l_ as iu,E9 as j,mue as ja,KM as jc,mde as ji,rT as jl,Sme as jn,qW as jo,hpe as jr,XF as js,C8 as jt,Ru as ju,O9 as k,pue as ka,Hoe as kc,yde as ki,iT as kl,wme as kn,ZW as ko,vpe as kr,$F as ks,T8 as kt,Uu as ku,Wye as l,x4 as la,CN as lc,Rde as li,WE as ll,z6 as ln,x2 as lo,qpe as lr,Hz as ls,F5 as lt,vp as lu,Yye as m,v4 as ma,pN as mc,Dde as mi,rD as ml,Kme as mn,Gce as mo,Y3 as mr,hL as ms,Cge as mt,Gp as mu,X9 as n,jue as na,MN as nc,Lfe as ni,_M as nl,q6 as nn,H2 as no,tme as nr,uH as ns,Y_e as nt,rx as nu,$9 as o,w4 as oa,SN as oc,Vde as oi,X as ol,Zme as on,Wle as oo,Ype as or,HV as os,f7 as ot,Ug as ou,Jye as p,y4 as pa,mN as pc,kde as pi,_E as pl,I6 as pn,Y0 as po,Rpe as pr,SL as ps,v5 as pt,Bf as pu,s9 as q,t4 as qa,yoe as qc,Hue as qi,K as ql,ome as qn,RH as qo,qfe as qr,gP as qs,Z6 as qt,qn as qu,Q9 as r,zue as ra,jN as rc,Ife as ri,Aj as rl,H6 as rn,Hle as ro,$pe as rr,XV as rs,D7 as rt,W as ru,Z9 as s,Iue as sa,DN as sc,Lde as si,RE as sl,Jme as sn,R2 as so,Jpe as sr,NB as ss,o7 as st,dm as su,hbe as t,Mue as ta,PN as tc,Nfe as ti,vM as tl,U6 as tn,Vle as to,rme as tr,fH as ts,k7 as tt,mx as tu,Gye as u,kue as ua,_se as uc,o3 as ui,nD as ul,R6 as un,h2 as uo,Kpe as ur,Mz as us,L5 as ut,Qf as uu,R9 as v,xue as va,Qoe as vc,Fde as vi,GE as vl,k6 as vn,Ace as vo,Ipe as vr,nL as vs,S5 as vt,Kf as vu,I9 as w,m4 as wa,qoe as wc,Pde as wi,jT as wl,D6 as wn,Y1 as wo,wpe as wr,UI as ws,a5 as wt,B as wu,B9 as x,vue as xa,nN as xc,Mde as xi,BT as xl,Bme as xn,C0 as xo,q3 as xr,qI as xs,h5 as xt,Ip as xu,z9 as y,yue as ya,aN as yc,wde as yi,JE as yl,O6 as yn,N0 as yo,Fpe as yr,tL as ys,Ege as yt,$f as yu,_ye as z,i4 as za,MM as zc,Z4 as zi,uS as zl,lme as zn,LU as zo,P3 as zr,RP as zs,m8 as zt,ki as zu};
|