@fabiofiorita/porcelain 0.76.0 → 0.77.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 +8243 -7639
- package/web/dist/assets/_-BTvJDc4N.js +1 -0
- package/web/dist/assets/_layerId-NWxUwyYM.js +1 -0
- package/web/dist/assets/_paired-Cd6bWv-d.js +1 -0
- package/web/dist/assets/_paired-Dhf6bO7a.js +1 -0
- package/web/dist/assets/_paired-LyVh2Ev9.js +1 -0
- package/web/dist/assets/_paired-z3_np6A6.js +1 -0
- package/web/dist/assets/_reviewId-DskS2QHc.js +1 -0
- package/web/dist/assets/_revision-DbkYDGJy.js +1 -0
- package/web/dist/assets/{_section-BQ20AKhJ.js → _section-CJMMR6oZ.js} +1 -1
- package/web/dist/assets/_worktreeId-CIrrQ4wO.js +1 -0
- package/web/dist/assets/_worktreeId-CMLa7jIe.js +1 -0
- package/web/dist/assets/_worktreeId-Dhf6bO7a.js +1 -0
- package/web/dist/assets/_worktreeId-LyVh2Ev9.js +1 -0
- package/web/dist/assets/access-Cc9LnHhZ.js +19 -0
- package/web/dist/assets/connected-workspace-BCSEyUOs.js +1 -0
- package/web/dist/assets/desktop-actions-BxLgt0EB.js +1 -0
- package/web/dist/assets/{edit-file-rWLFkawP.js → edit-file-oBFPJFcX.js} +20 -20
- package/web/dist/assets/{file-editor-CmaAI7mD.js → file-editor--RrdNChU.js} +11 -11
- package/web/dist/assets/index-BXmzx3MO.js +10 -0
- package/web/dist/assets/{lazyRouteComponent-DF1peoaD.js → lazyRouteComponent-B5-ihfdW.js} +1 -1
- package/web/dist/assets/pair-BC_fDEO8.js +1 -0
- package/web/dist/assets/pair-Dhf6bO7a.js +1 -0
- package/web/dist/assets/{review-route-CilLpBvt.js → review-route-BHH1bYmh.js} +1 -1
- package/web/dist/assets/reviews-URZ7SKqW.js +1396 -0
- package/web/dist/assets/useMatch-DLaUbB76.js +1 -0
- package/web/dist/assets/useRouterState-BxhFGwfy.js +1 -0
- package/web/dist/assets/workspace-error-CjLz95tb.js +1 -0
- package/web/dist/assets/workspace-pending-CSiUulq0.js +1 -0
- package/web/dist/index.html +7 -7
- package/web/dist/assets/_-mTAQQLxa.js +0 -1
- package/web/dist/assets/_layerId-D-Ld4zoA.js +0 -1
- package/web/dist/assets/_paired-DQq2L_lM.js +0 -1
- package/web/dist/assets/_paired-DwQfzpPo.js +0 -1
- package/web/dist/assets/_paired-P-FUnX-y.js +0 -1
- package/web/dist/assets/_paired-VrOGlA1G.js +0 -1
- package/web/dist/assets/_reviewId-CR5Y2cjT.js +0 -1
- package/web/dist/assets/_revision-1wivYK0j.js +0 -1
- package/web/dist/assets/_worktreeId-BPp_s24t.js +0 -1
- package/web/dist/assets/_worktreeId-DQq2L_lM.js +0 -1
- package/web/dist/assets/_worktreeId-Dfp8EiPX.js +0 -1
- package/web/dist/assets/_worktreeId-P-FUnX-y.js +0 -1
- package/web/dist/assets/access-CPhumIOz.js +0 -19
- package/web/dist/assets/connected-workspace-Cqk_MV5h.js +0 -1
- package/web/dist/assets/desktop-actions-DEpOe60L.js +0 -1
- package/web/dist/assets/index-DbOyN2aI.js +0 -10
- package/web/dist/assets/pair-CwRRIQuD.js +0 -1
- package/web/dist/assets/pair-DQq2L_lM.js +0 -1
- package/web/dist/assets/reviews-Knu80SJM.js +0 -1396
- package/web/dist/assets/useMatch-CmjLPEeI.js +0 -1
- package/web/dist/assets/useRouterState-CFV0Nv_N.js +0 -1
- package/web/dist/assets/workspace-error-B0KK7kzA.js +0 -1
- package/web/dist/assets/workspace-pending-DnmDeSe-.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 ei=a(2,(e,t)=>{let n=Math.floor(t);if($r(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]}),See=e=>e[e.length-1],ti=()=>[],ni=e=>[e],ri=a(2,(e,t)=>e.map(t)),Cee=cee,ii=`~effect/Duration`,ai=BigInt(0),oi=BigInt(1),wee=BigInt(2),Tee=BigInt(10),si=BigInt(24),ci=BigInt(60),li=BigInt(1e3),ui=BigInt(1e6),di=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),fi=e=>di(e*1e6),pi=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=Tee**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*wee>=a?oi:ai);return r?-s:s},Eee=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,mi=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=Eee.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return Oi(pi(r,oi));if(i===`micro`||i===`micros`)return Oi(pi(r,li));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(ii in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(S)?hi(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:bi(di(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?bi(n):bi(di(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return hi(e)},hi=e=>{throw Error(`Invalid Input: ${e}`)},gi={_tag:`Millis`,millis:0},_i={_tag:`Infinity`},vi={_tag:`NegativeInfinity`},yi={[ii]:ii,[ee](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?z(di(e)):oe(this.value.millis)}case`Nanos`:return z(this.value.nanos);default:return le(this.value)}},[ve](e){return xi(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)}},bi=e=>{let t=Object.create(yi);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?gi:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:fi(e)}:e>0?_i:vi:e===ai?gi:{_tag:`Nanos`,nanos:e},t},xi=e=>F(e,ii),Si=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,Ci=e=>{switch(e.value._tag){case`Millis`:return e.value.millis===0;case`Nanos`:return e.value.nanos===ai;case`Infinity`:case`NegativeInfinity`:return!1}},Dee=e=>{switch(e.value._tag){case`Millis`:return e.value.millis<0;case`Nanos`:return e.value.nanos<ai;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?bi(-e.value.millis):e;case`Nanos`:return e.value.nanos<ai?bi(-e.value.nanos):e}},Ti=bi(0),Ei=bi(1/0),Di=bi(-1/0),Oi=e=>bi(e),ki=e=>bi(e),Ai=e=>bi(e*1e3),ji=e=>bi(e*6e4),Mi=e=>bi(e*36e5),Ni=e=>bi(e*864e5),Pi=e=>bi(e*6048e5),Fi=e=>zi(mi(e),{onMillis:o,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ii=e=>zi(mi(e),{onMillis:e=>e/1e3,onNanos:e=>Number(e)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Li=e=>zi(mi(e),{onMillis:e=>e/6e4,onNanos:e=>Number(e)/6e10,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Oee=e=>zi(mi(e),{onMillis:e=>e/36e5,onNanos:e=>Number(e)/36e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ri=e=>{let t=mi(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 fi(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<ai,r=n?-t:t,i=r/ui,a=i/li,o=a/ci,s=o/ci,c=s/si,l=n?-1:1;return{days:l*Number(c),hours:l*Number(s%si),minutes:l*Number(o%ci),seconds:l*Number(a%ci),millis:l*Number(i%li),nanos:l*Number(r%ui)}},Hi=e=>{if(e.value._tag===`Infinity`)return`Infinity`;if(e.value._tag===`NegativeInfinity`)return`-Infinity`;if(Ci(e))return`0`;if(Dee(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)),Ui=e=>t=>t.has(e)?kr(t):Ar(t),Wi=a(2,(e,t)=>n=>{let r=e(n);return Mr(r)?r:t(r.success)}),Gi=e=>t=>{let n=e(t);return Mr(n)?In():Ln(n.success)},Ki=Er(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new Zi}),qi=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Ji=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Yi=e=>{try{return Ji(e)}catch{return qi(e)}},Xi=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}},Zi=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?qi:Yi)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new Qi(this.setImmediate)}},Qi=class{tasks=new Xi;running=void 0;setImmediate;constructor(e=Yi){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()}},$i=Er(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),ea=Er(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),ta=class extends i{constructor(e){super(),e&&ct(this,e)}},na=e=>class extends ta{_tag=e},ra=Zt,ia=Qt,aa=`~effect/encoding/EncodingError`,oa=class extends ia(`EncodingError`){[aa]=aa},sa=e=>{switch(e){case 16:return da();case 32:return fa();default:{let t=``;for(let n=e>>>3;n>0;n--)t+=ua();return t}}},ca=Uint8Array.from(`0123456789abcdef`,e=>e.charCodeAt(0)),la=()=>Math.random()*4294967296>>>0,ua=()=>{let e=la();return String.fromCharCode(ca[e>>>28],ca[e>>>24&15],ca[e>>>20&15],ca[e>>>16&15],ca[e>>>12&15],ca[e>>>8&15],ca[e>>>4&15],ca[e&15])},da=()=>{let e=la(),t=la();return String.fromCharCode(ca[e>>>28],ca[e>>>24&15],ca[e>>>20&15],ca[e>>>16&15],ca[e>>>12&15],ca[e>>>8&15],ca[e>>>4&15],ca[e&15],ca[t>>>28],ca[t>>>24&15],ca[t>>>20&15],ca[t>>>16&15],ca[t>>>12&15],ca[t>>>8&15],ca[t>>>4&15],ca[t&15])},fa=()=>{let e=la(),t=la(),n=la(),r=la();return String.fromCharCode(ca[e>>>28],ca[e>>>24&15],ca[e>>>20&15],ca[e>>>16&15],ca[e>>>12&15],ca[e>>>8&15],ca[e>>>4&15],ca[e&15],ca[t>>>28],ca[t>>>24&15],ca[t>>>20&15],ca[t>>>16&15],ca[t>>>12&15],ca[t>>>8&15],ca[t>>>4&15],ca[t&15],ca[n>>>28],ca[n>>>24&15],ca[n>>>20&15],ca[n>>>16&15],ca[n>>>12&15],ca[n>>>8&15],ca[n>>>4&15],ca[n&15],ca[r>>>28],ca[r>>>24&15],ca[r>>>20&15],ca[r>>>16&15],ca[r>>>12&15],ca[r>>>8&15],ca[r>>>4&15],ca[r&15])},pa=`effect/Tracer/ParentSpan`,ma=class extends tr()(pa,{fiberCached:!0}){},ha=e=>e,ga=Er(`effect/Tracer/DisablePropagation`,{defaultValue:l}),_a=Er(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),va=Er(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),ya=`effect/Tracer`,ba=ha({span:e=>new xa(e)}),xa=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??sa(32)}get spanId(){return this._spanId??=sa(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)}},Sa=`effect/Metric/FiberRuntimeMetrics`,Ca=Er(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:u}),wa=Er(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:c}),Ta=Er(`effect/References/TracerTimingEnabled`,{defaultValue:c}),Ea=Er(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),Da=Er(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),Oa=Er(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),ka=Er(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Aa=Er(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),ja=Er(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),Ma=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:Pa(()=>n.stack)}},Na=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}},Pa=Na(3),Fa=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))}},Ia=e=>new Fa(e),La=e=>new Dt([new Fa(e)]),Fee=e=>{let t=e.reasons.find(Rt);return t?kr(t):Ar(e)},Ra=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)},Iee=Gi(Ra),za=e=>e.reasons.some(zt),Ba=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)},Lee=e=>{let t=Ba(e);return Mr(t)?Ree:t.success},Ree=new Set,zee=e=>e.reasons.length>0&&e.reasons.every(zt),Bee=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}),Va=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},Vee=(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(Ha(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=Gee(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(Ha(i,r[0].annotations,t))}}finally{i!==0&&it(i)}return n},Ha=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(Hee(e),{cause:e.cause?Ha(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=Wee(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?Ua(e,t):e}n?.includeCauseInStack&&(i.stack=Ka(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},Hee=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)},Uee=/\((.*)\)/g,Wee=(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?Ua(a.join(`
|
|
8
|
+
`),n):a.join(`
|
|
9
|
+
`)},Ua=(e,t)=>{let n=t?.get(Wt.key);return n&&(e=`${e}\n${Wa(n)}`),e},Gee=(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(Wa(r))}return n.join(`
|
|
10
|
+
`)},Wa=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(Uee),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
|
+
`)},Ga=e=>Vee(e).map(Ka).join(`
|
|
12
|
+
`),Ka=e=>e.cause?`${e.stack} {\n${qa(e.cause,` `)}\n}`:e.stack,qa=(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${qa(e.cause,`${t} `)}\n${t}}`),r},Ja=`~effect/Fiber`,Kee={_A:o,_E:o},qee={id:0},Ya=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),Xa=()=>Ya===void 0?void 0:new Ya(`effect/Fiber`),Za=()=>globalThis[Be],Qa=class{constructor(e,t=!0){this.setContext(e),this.id=++qee.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[Ja](){return Kee}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=La(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(so(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=Xa();return}let n=$a.interruptChildren&&$a.interruptChildren(this);if(n!==void 0)return this.evaluate(Go(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=so(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=Go(fo,()=>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,Yee;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&Xee-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??=Jee(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}},Jee=e=>{let t=_r(e,ya);return{scheduler:yr(e,Ki),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:yr(e,wa),span:_r(e,pa),logLevel:yr(e,ka),minimumLogLevel:yr(e,Aa),stackFrame:yr(e,Ca),runtimeMetrics:_r(e,Sa),maxOpsBeforeYield:yr(e,$i),preventYield:yr(e,ea)}},Yee={[ht](e,t){return so(t._interruptedCause)},[gt](e,t){return so(t._interruptedCause)}},Xee=32,$a={interruptChildren:void 0},eo=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Gt.key,e.cache.stackFrame),ur(t)},Zee=e=>{if(e._children!==void 0&&e._children.size!==0)return ao(e._children)},to=e=>{let t=e;return t._exit?oo(t._exit):vo(n=>t._exit?n(oo(t._exit)):lo(e.addObserver(e=>n(oo(e)))))},no=e=>vo(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(oo(r))}return a(),lo(()=>i?.())}),ro=e=>{let t=e;return t._exit?t._exit:vo(n=>t._exit?n(t._exit):lo(e.addObserver(n)))},Qee=e=>vo(t=>{let n=Array.from(e);if(n.length===0)return t(oo(ti()));let r=Array(n.length),i=ti(),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(oo(r))};i.push(c),n[e].addObserver(c)}return lo(()=>{s=!0,a()})}),io=e=>Yt(t=>$ee(e,t.id)),$ee=a(e=>F(e[0],Ja),(e,t,n)=>Yt(r=>{let i=eo(r);return i=i&&n?wr(i,n):i??n,e.interruptUnsafe(t,i),Ho(to(e))})),ao=e=>Yt(t=>{let n=eo(t),r=ti();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return Ho(no(r))}),oo=Ut,so=Kt,co=qt,lo=Vt({op:`Sync`,[mt](e){let t=this[pt](),n=e.getCont(ht);return n?n[ht](t,e):e.yieldWith(Ut(t))}}),uo=Vt({op:`Suspend`,[mt](e){return this[pt]()}}),ete=Fr({onFailure:co,onSuccess:oo}),fo=Vt({op:`Yield`,[mt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(as)},this[pt]??0),e.yieldWith(()=>{t=!0})}})(0),po=oo(In()),tte=e=>uo(()=>so(e())),mo=e=>Jt(e),ho=e=>uo(()=>co(e())),go=oo(void 0),nte=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new _l(e,`An error occurred in Effect.try`):e.catch;return uo(()=>{try{return oo(t())}catch(e){return co(n(e))}})},rte=e=>_o(function(t,n){e(n).then(e=>t(oo(e)),e=>t(mo(e)))},e.length!==0),ite=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new _l(e,`An error occurred in Effect.tryPromise`):e.catch;return _o(function(e,r){let i=e=>uo(()=>{try{return co(ot(()=>n(e)))}catch(e){return mo(e)}});try{t(r).then(t=>e(oo(t)),t=>e(i(t)))}catch(t){e(i(t))}},t.length!==0)},ate=e=>Yt(t=>e(t.id)),_o=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(ote(()=>(t=!0,r?.abort(),i??as))),vt):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),ote=Vt({op:`AsyncFinalizer`,[_t](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Mc))},[gt](e,t){return za(e)?Go(cc(Kt(e),this[pt]()),()=>so(e)):so(e)}}),vo=e=>_o(e,e.length>=2),yo=vo(d),ste=(...e)=>{if(e.length===1){let t=e[0];return uo(()=>Do(t()))}let[t,n]=e;return uo(()=>Do(n.call(t.self)))},bo=(e,...t)=>{let n=t.length===0?function(){return uo(()=>Do(e.apply(this,arguments)))}:function(){let n=uo(()=>Do(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return xo(e.length,n)},xo=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),So=Na(2),Co=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)=>wo(t,r,i,a,e,n):wo(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},wo=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.shift().bind(t.self),s=`${e} (definition)`,c=n?So(()=>n.stack):u;return xo(o.length,function(...t){let n=uo(()=>{let e=o.apply(this,arguments);return xt(e)?e:Do(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)),ps(i?rl(e,a,e=>il(n,e)):n,Ca,t=>({name:e,stack:d?So(()=>d.stack):u,parent:{name:s,stack:c,parent:t}}))})},To=(e,...t)=>xo(e.length,t.length===0?function(){return Eo(()=>e.apply(this,arguments))}:function(){let n=Eo(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),Eo=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return oo(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 uo(()=>n?(n=!1,Go(r.value,e=>Do(t,e))):uo(()=>Do(e())))}}}catch(e){return mo(e)}},Do=function(){let e=Bt({op:`Iterator`,[ht](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return oo(r.value);if(!Ko(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)}}(),Oo=a(2,(e,t)=>new jo(e,Mo,oo(t))),ko=function(e){return e._stack.push(this),this[pt]},Ao=Bt({op:`OnSuccess`,[mt]:ko}),jo=function(e,t,n){this[pt]=e,this[ht]=t,this.payload=n};jo.prototype=Ao;var Mo=function(){return this.payload},No=function(e,t){return t.succeedWith(this.payload)},Po=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),Fo=function(e,t){let n=this.payload;return t.succeedWith(Po?n(e):ot(()=>n(e)))},Io=function(e){let t=this.payload;return t(e)},Lo=function(e){let t=this.payload;return new jo(t(e),No,e)},Ro=function(e){return new jo(this.payload,No,e)},zo=e=>Yo(e,Ln),Bo=a(2,(e,t)=>new jo(e,xt(t)?Mo:Io,t)),Vo=a(2,(e,t)=>new jo(e,xt(t)?Ro:Lo,t)),Ho=e=>new jo(e,Mo,as),Uo=(e,t)=>Yt(n=>{let r=new Set;return Oc(n,()=>r.size===0?void 0:ao(r)),vo(i=>{let a=!1,o=0;for(let s of e){if(a)break;let e=o++,c=Hc(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})})}})}),Wo=a(e=>xt(e[1]),(e,t,n)=>Uo([e,t],n)),Go=a(2,(e,t)=>new jo(e,Io,t)),Ko=e=>e[ut]!==void 0,qo=a(2,(e,t)=>Ko(e)?e._tag===`Success`?t(e.value):e:Go(e,t)),Jo=e=>Go(e,o),Yo=a(2,(e,t)=>new jo(e,Fo,t)),Xo=a(2,(e,t)=>Ko(e)?os(e,t):Yo(e,t)),Zo=a(2,(e,t)=>Ko(e)?ss(e,t):Ns(e,t)),Qo=a(2,(e,t)=>Ko(e)?cs(e,t):Ps(e,t)),$o=a(2,(e,t)=>{if(Ko(e)){if(e._tag===`Success`)return e;let n=Ra(e.cause);return Mr(n)?e:t(n.success)}return Ds(e,t)}),es=e=>Kt(La(e)),ts=e=>e._tag===`Success`,ns=e=>e._tag===`Failure`,rs=e=>e._tag===`Failure`?kr(e.cause):Ar(e),is=e=>e._tag===`Failure`&&za(e.cause),as=Ut(void 0),os=a(2,(e,t)=>e._tag===`Success`?Ut(t(e.value)):e),ss=a(2,(e,t)=>{if(e._tag===`Success`)return e;let n=Ra(e.cause);return Mr(n)?e:qt(t(n.success))}),cs=a(2,(e,t)=>{if(e._tag===`Success`)return Ut(t.onSuccess(e.value));let n=Ra(e.cause);return Mr(n)?e:qt(t.onFailure(n.success))}),ls=a(2,(e,t)=>ts(e)?t:e),us=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?as:Kt(Mt(t))},ds=e=>Yt(t=>oo(Cr(t.context,e))),fs=a(2,(e,t)=>Yt(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),Oc(n,()=>{n.setContext(r)}),e)})),ps=a(3,(e,t,n)=>fs(e,e=>{let r=vr(e,t),i=n(r);return r===i?e:hr(e,t,i)})),ms=()=>hs,hs=Yt(e=>oo(e.context)),gs=e=>Yt(t=>e(t.context)),_s=a(2,(e,t)=>Ko(e)?e:fs(e,wr(t))),vs=function(){return arguments.length===1?a(2,(e,t)=>ys(e,arguments[0],t)):a(3,(e,t,n)=>ys(e,t,n)).apply(this,arguments)},ys=(e,t,n)=>fs(e,hr(t,n)),bs=a(2,(e,t)=>Go(t,t=>t?zo(e):po)),xs=a(e=>xt(e[0]),(e,t)=>Ic({while:c,body:s(t?.disableYield?e:Go(e,e=>fo)),step:d})),Ss=a(2,(e,t)=>new ws(e,t.length===1?t:e=>t(e))),Cs=Bt({op:`OnFailure`,[mt]:ko}),ws=function(e,t){this[pt]=e,this[gt]=t};ws.prototype=Cs;var Ts=a(3,(e,t,n)=>Ss(e,e=>t(e)?n(e):so(e))),Es=a(3,(e,t,n)=>Ss(e,e=>{let r=t(e);return Mr(r)?so(r.failure):n(r.success,e)})),Ds=a(2,(e,t)=>Es(e,Ra,e=>t(e))),Os=a(2,(e,t)=>Ss(e,e=>Bo(t(e),so(e)))),ks=a(3,(e,t,n)=>Ss(e,e=>{let r=t(e);return Mr(r)?so(e):Bo(n(r.success,e),so(e))})),As=a(2,(e,t)=>ks(e,Ra,e=>t(e))),js=a(e=>xt(e[0]),(e,t,n,r)=>Ss(e,e=>{let i=Ra(e);return Mr(i)?so(i.failure):t(i.success)?n(i.success):r?r(i.success):so(e)})),Ms=a(e=>xt(e[0]),(e,t,n,r)=>js(e,Array.isArray(t)?e=>F(e,`_tag`)&&t.includes(e._tag):I(t),n,r)),Ns=a(2,(e,t)=>Ds(e,e=>ho(()=>t(e)))),Ps=a(2,(e,t)=>Ks(e,{onFailure:e=>ho(()=>t.onFailure(e)),onSuccess:e=>lo(()=>t.onSuccess(e))})),Fs=e=>Ds(e,mo),Is=a(2,(e,t)=>Ds(e,e=>lo(()=>t(e)))),Ls=a(e=>xt(e[0]),(e,t)=>{if(!t?.log)return Ks(e,{onFailure:e=>go,onSuccess:e=>go});let n=Tl(t.log===!0?void 0:t.log);return Vs(e,{onFailure(e){let r=Fee(e);return Mr(r)?so(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>go})}),Rs=a(e=>xt(e[0]),(e,t)=>{if(!t?.log)return Vs(e,{onFailure:e=>go,onSuccess:e=>go});let n=Tl(t.log===!0?void 0:t.log);return Vs(e,{onFailure:e=>t.message===void 0?n(e):n(t.message,e),onSuccess:e=>go})}),zs=e=>qs(e,{onFailure:In,onSuccess:Ln}),Bs=e=>Js(e,{onFailure:Ar,onSuccess:kr}),Vs=a(2,(e,t)=>new Us(e,t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),t.onFailure.length===1?t.onFailure:e=>t.onFailure(e))),Hs=Bt({op:`OnSuccessAndFailure`,[mt]:ko}),Us=function(e,t,n){this[pt]=e,this[ht]=t,this[gt]=n};Us.prototype=Hs;var Ws=function(e,t){let n=this.payload;return t.succeedWith(Po?n.onSuccess(e):ot(()=>n.onSuccess(e)))},Gs=((e,t)=>{let n=Bt({op:e,[mt]:ko,[ht]:Ws,[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 so(e);let r=this.payload;return t.succeedWith(Po?r.onFailure(n.error):ot(()=>r.onFailure(n.error)))}),Ks=a(2,(e,t)=>Vs(e,{onFailure:e=>{let n=e.reasons.find(Rt);return n?t.onFailure(n.error):so(e)},onSuccess:t.onSuccess})),qs=a(2,(e,t)=>new Gs(e,t)),Js=a(2,(e,t)=>{if(Ko(e)){if(e._tag===`Success`)return Ut(t.onSuccess(e.value));let n=Ra(e.cause);return Mr(n)?e:Ut(t.onFailure(n.success))}return qs(e,t)}),Ys=e=>Ko(e)?Ut(e):Xs(e),Xs=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))}}),Zs=a(2,(e,t)=>Bo(ul(t),e)),Qs=a(2,(e,t)=>Go(tc(e,t.duration),e=>Rn(e)?t.orElse():oo(e.value))),$s=e=>new Wte(`Operation timed out after '${Hi(e)}'`),ec=a(2,(e,t)=>{let n=mi(t);return Qs(e,{duration:n,orElse:()=>co($s(n))})}),tc=a(2,(e,t)=>Wo(zo(e),Oo(ul(t),In()))),nc=`~effect/Scope`,rc=`~effect/Scope/Closeable`,ic=tr(`effect/Scope`),ac=(e,t)=>Yt(n=>{let r=oc(e,t);return r===void 0?go:(bte(n),r)}),oc=(e,t)=>{let n=e.state;if(n._tag===`Closed`||(e.state={_tag:`Closed`,exit:t},e.parent!==void 0&&hc(e.parent,e),n._tag===`Empty`))return;if(n.finalizer!==void 0)return sc(n.finalizer,t);let r=n.finalizers;return r.size===1?sc(r.values().next().value,t):lc(e,r,t)},sc=(e,t)=>{try{return e(t)}catch(e){return Jt(e)}},cc=(e,t)=>ts(e)?t:Ss(t,t=>so(Nt(e.cause,t))),lc=bo(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=Za();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*Ys(sc(s,n))):i.push(Hc(o,sc(s,n),!0,!0,`inherit`))}return i.length>0&&(r=yield*no(i)),yield*us(r)}),uc=(e,t)=>lo(()=>dc(e,t)),dc=(e,t)=>{let n=_c(t,e);return e.state._tag===`Closed`?(n.state=e.state,n):(mc(e,n,e=>ac(n,e)),n)},fc=(e,t)=>uo(()=>e.state._tag===`Closed`?t(e.state.exit):(mc(e,{},t),go)),pc=(e,t)=>fc(e,s(t)),mc=(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))}},hc=(e,t)=>{if(e.state._tag!==`Open`)return;let n=e.state;n.finalizerKey===t?e.state=vc:n.finalizers!==void 0&&(n.finalizers.delete(t),n.finalizers.size===0&&(e.state=vc))},gc=e=>_c(e,void 0),_c=(e=`sequential`,t)=>({[rc]:rc,[nc]:nc,strategy:e,parent:t,state:vc}),vc={_tag:`Empty`},yc=e=>lo(()=>gc(e)),bc=ic,xc=vs(ic),Sc=e=>Yt(t=>{let n=t.context,r=gc();return t.setContext(hr(t.context,ic,r)),Oc(t,e=>(t.setContext(n),oc(r,e))),e}),Cc=e=>uo(()=>{let t=gc();return kc(e(t),e=>uo(()=>oc(t,e)??go))}),wc=(e,t,n)=>gs(r=>Pc(i=>Go(bc,a=>Vo(n?.interruptible?i(e):e,e=>fc(a,n=>_s(t(e,n),r)))))),Tc=e=>Go(bc,t=>gs(n=>fc(t,t=>_s(e(t),n)))),Ec=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(Mc),e.interruptible=!1)},[ht](e,t,n){n??=Ut(e);let r;try{r=this.onExit(n)}catch(e){r=Jt(e)}return r?Go(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?Go(cc(n,r),e=>n):n}}),t=function(e,t,n){this.effect=e,this.onExit=t,this.interruptible=n};return t.prototype=e,t}(),Dc=(e,t,n)=>new Ec(e,t,n),Oc=(e,t)=>{e._stack.push(new Ec(void 0,t,void 0))},kc=a(2,Dc),cte=a(2,(e,t)=>kc(e,e=>t)),lte=a(3,(e,t,n)=>kc(e,e=>{let r=t(e);return Mr(r)?go:n(r.success,e)})),ute=a(2,(e,t)=>lte(e,rs,t)),dte=a(3,(e,t,n)=>kc(e,e=>{if(e._tag!==`Failure`)return go;let r=t(e.cause);return Mr(r)?go:n(r.success,e.cause)})),fte=a(2,(e,t)=>dte(Ba,t)(e)),pte=(e,t,n)=>Pc(r=>Go(e,e=>Dc(uo(()=>r(t(e))),t=>n(e,t),!0))),mte=s(1/0),hte=(e,t)=>{let n=0,r,i,a=(e,t)=>(t.awaiters++,Oc(e,()=>{if(!(--t.awaiters>0||i!==t))return i=void 0,io(t.fiber)}),ro(t.fiber));return[Yt(o=>{if(i!==void 0)return a(o,i);if(r!==void 0&&(n===1/0||o.getRef(al).currentTimeMillisUnsafe()<n))return r;r=void 0;let s=o.getRef(al),c={fiber:void 0,awaiters:0};return i=c,c.fiber=Hc(o,Dc(e,e=>{if(i!==c||(i=void 0,is(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)}),lo(()=>{r=void 0})]},gte=e=>lo(()=>hte(e,mte)[0]),_te=Yt(e=>so(La(e.id))),Ac=e=>Yt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Mc),e):e),jc=Vt({op:`SetInterruptible`,[_t](e){if(e.interruptible=this[pt],e._interruptedCause&&e.interruptible)return()=>so(e._interruptedCause)}}),Mc=jc(!0),vte=jc(!1),yte=e=>{if(e.interruptible=!0,e._stack.push(vte),e._interruptedCause)return so(e._interruptedCause)},bte=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Mc))},Nc=e=>Yt(t=>t.interruptible?e:yte(t)??e),Pc=e=>Yt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Mc),e(Nc)):e(o)),Fc=(e,t)=>R(e)?t?.mode===`result`?Lc(e,Bs,t):Lc(e,o,t):t?.discard?t.mode===`result`?Lc(Object.values(e),Bs,t):Lc(Object.values(e),o,t):uo(()=>{let n={};return Oo(Lc(Object.entries(e),([e,r])=>Yo(t?.mode===`result`?Bs(r):r,t=>{st(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),Ic=Vt({op:`While`,[ht](e,t){return this[pt].step(e),this[pt].while()?(t._stack.push(this),this[pt].body()):as},[mt](e){return this[pt].while()?(e._stack.push(this),this[pt].body()):as}}),Lc=a(e=>typeof e[1]==`function`,(e,t,n)=>uo(()=>{let r=Rc(n?.concurrency);if(r===1)return xte(e,t,n);let i=qr(e),a=i.length;if(a===0)return n?.discard?go:oo([]);let o=n?.discard?void 0:Array(a),s=Ste({f:t,out:o},i,{concurrency:r});return s?Oo(s,o):oo(o)})),xte=(e,t,n)=>uo(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return Oo(Ic({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),Rc=e=>e===`unbounded`?1/0:Math.max(1,e??1),zc=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>Go(Ys(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??go),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!Ko(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},Bc=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?Go(Ac(ao(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(Ko(g)){if(f=n(e,o,g,a),f)break}else if(l){p=void 0;let t=Hc(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??go)}catch(e){d(m(e))}}),u.size<s)continue;i=!0,a++;return}else return vo(e=>{l=Za(),u=new Set,p=g,d=e;let t;try{t=h()}catch(t){return e(m(t))}return t?e(t):uo(()=>(f??=as,Go(u?ao(u):go,()=>f?._tag===`Failure`?f:go)))})}if(c=!0,f){if(u&&u.size>0){let e=eo(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(go);else return as}};return h()}},Vc=()=>e=>Bc(e),Ste=Bc({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)}}),Cte=a(e=>xt(e[0]),(e,t)=>Yt(n=>(Al(),oo(Hc(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),Hc=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new Qa(a.context,o);return n?s.evaluate(t):(s._asyncContext=Xa(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),!r&&!s._exit&&(a.children().add(s),s._parent=a),s},wte=a(e=>xt(e[0]),(e,t)=>Yt(n=>oo(Hc(n,e,t?.startImmediately,!0,t?.uninterruptible)))),Uc=a(e=>xt(e[0]),(e,t,n)=>Yt(r=>{let i=Hc(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit){if(t.state._tag!==`Closed`){let e={};mc(t,e,()=>ate(e=>e===i.id?go:io(i))),i.addObserver(()=>hc(t,e))}else i.interruptUnsafe(r.id,eo(r))}return oo(i)})),Tte=a(e=>xt(e[0]),(e,t)=>Go(bc,n=>Uc(e,n,t))),Wc=e=>(t,n)=>{let r=new Qa(n?.scheduler?hr(e,Ki,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},Ete=a(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return mc(t,n,()=>io(e)),e.addObserver(()=>hc(t,n)),e}),Dte=Wc(pr()),Gc=e=>{let t=Wc(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},Ote=Gc(pr()),Kc=e=>{let t=Wc(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},kte=Kc(pr()),qc=e=>{let t=Kc(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw Va(e.cause);return e.value})},Ate=qc(pr()),Jc=e=>{let t=Wc(e);return e=>{if(Ko(e))return e;let n=new Zi(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Jt(new hl(r))}},jte=Jc(pr()),Yc=e=>{let t=Jc(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw Va(n.cause);return n.value}},Mte=Yc(pr()),Xc=oo(!0),Zc=oo(!1),Nte=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return Xc;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=[],Xc}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](as)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](as)}open=Yt(e=>this._isOpen?Zc:(this._isOpen=!0,this.scheduleUnsafe(e)));release=Yt(e=>this._isOpen?Zc:this.scheduleUnsafe(e));openUnsafe(){return!this._isOpen&&(this._isOpen=!0,this.flushWaiters(),!0)}await=vo(e=>this._isOpen?e(go):(this.waiters.push(e),lo(()=>{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=lo(()=>this.closeUnsafe());whenOpen=e=>Go(this.await,()=>e);isOpen(){return this._isOpen}},Qc=e=>new Nte(e??!1),Pte=e=>lo(()=>Qc(e)),$c=BigInt(0),Fte={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:$c,endTime:$c,exit:as},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},Ite=e=>Object.assign(Object.create(Fte),e),el=e=>e?yr(e.annotations,ga)?e._tag===`Span`?el(Un(e.parent)):In():Ln(e):In(),tl=(e,t,n)=>{let r=!e.cache.tracerEnabled||n?.annotations&&yr(n.annotations,ga),i=n?.parent===void 0?n?.root?In():el(e.cache.span):Ln(n.parent),a;if(r)a=Ite({name:t,parent:i,annotations:hr(n?.annotations??pr(),ga,!0)});else{let r=e.cache.tracer??ba,o=e.getRef(al),s=e.getRef(Ta),c=e.getRef(Ea),l=e.getRef(Da),u=n?.level??e.getRef(_a),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():$c,kind:n?.kind??`internal`,root:n?.root??Rn(i),sampled:n?.sampled??(zn(i)&&i.value.sampled===!1?!1:!yl(e.getRef(va),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},Lte=(e,t)=>Ac(Yt(n=>{let r=vr(n.context,ic),i=tl(n,e,t??{}),a=n.getRef(al),o=n.getRef(Ta);return Oo(fc(r,e=>nl(i,e,a,o)),i)})),Rte=(e,t)=>(t=typeof t==`function`?t:u,ps(Ca,n=>({name:e,stack:t,parent:n}))),nl=(e,t,n,r)=>lo(()=>{e.status._tag!==`Ended`&&e.end(r?n.currentTimeNanosUnsafe():$c,t)}),rl=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return Yt(t=>{let i=tl(t,e,n),a=t.getRef(al),o=t.getRef(Ta);return Oc(t,e=>nl(i,e,a,o)),r(i)})},il=vs(ma),zte=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=Ma(n),r=Rte(t.name,n?.captureStackTrace)),e?il(r(arguments[0]),t):e=>il(r(e),t)},Bte=(...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 go}),al=Er(`effect/Clock`,{defaultValue:()=>new Vte}),ol=2**31-1,Vte=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=lo(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Hte()}currentTimeNanos=lo(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return cl()}monotonicTimeNanos=lo(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(Fi(e))}sleepMillis(e){return e<=0?fo:Number.isFinite(e)?vo(t=>{let n=e>ol?this.sleepMillis(e-ol):go,r=setTimeout(()=>t(n),Math.min(e,ol));return lo(()=>clearTimeout(r))}):yo}},sl=BigInt(1e6),cl=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())*sl;return e>t&&(t=e),t}}(),Hte=function(){let e=BigInt(1e9),t;return()=>{let n=cl(),r=BigInt(Date.now())*sl;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}}(),ll=e=>Yt(t=>e(t.getRef(al))),ul=e=>ll(t=>t.sleep(mi(e))),Ute=ll(e=>e.currentTimeMillis),dl=`~effect/Cause/TimeoutError`,Wte=class extends Qt(`TimeoutError`){[dl]=dl;constructor(e){super({message:e})}},fl=`~effect/Cause/IllegalArgumentError`,Gte=class extends Qt(`IllegalArgumentError`){[fl]=fl;constructor(e){super({message:e})}},pl=`~effect/Cause/ExceededCapacityError`,Kte=class extends Qt(`ExceededCapacityError`){[pl]=pl;constructor(e){super({message:e})}},ml=`~effect/Cause/AsyncFiberError`,hl=class extends Qt(`AsyncFiberError`){[ml]=ml;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},gl=`~effect/Cause/UnknownError`,_l=class extends Qt(`UnknownError`){[gl]=gl;constructor(e,t){super({message:t,cause:e})}},vl=Er(`effect/Console`,{defaultValue:()=>globalThis.console}),yl=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}})),qte=Er(`effect/Logger/CurrentLoggers`,{defaultValue:()=>new Set([Ol,kl])}),bl=Er(`effect/Logger/LogToStderr`,{defaultValue:l}),xl={"~effect/Logger":{_Message:o,_Output:o},pipe(){return n(this,arguments)}},Sl=e=>{let t=Object.create(xl);return t.log=e,t},Cl=e=>e.replace(/[\s="]/g,`_`),wl=(e,t)=>`${Cl(e[0])}=${t-e[1]}ms`,Tl=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(yl(r.cache.minimumLogLevel,i))return go;let a=r.getRef(al),o=r.getRef(qte);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 go})},El={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};El.gray,El.blue,El.green,El.yellow,El.red,El.bgBrightRed,El.black;var Dl=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`)}`,Ol=Sl(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(Ga(e));let o=t.getTime(),s=n.getRef(ja),c=``;for(let e of s)c+=` ${wl(e,o)}`;let l=n.getRef(Oa);Object.keys(l).length>0&&a.push(l);let u=n.getRef(vl);(n.getRef(bl)?u.error:u.log)(`[${Dl(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),kl=Sl(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(al),a=t.getRef(Oa),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`]=Ga(e)),o.event($e(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)});function Al(){$a.interruptChildren??=Zee}var jl=oo(void 0),Ml=Tt,Nl=Et,Pl=Rt,Fl=Mt,Il=Pt,Ll=It,Rl=La,zl=e=>new jt(e),Bl=e=>new Ft(e),Vl=Ia,Jte=zee,Hl=Bee,Yte=Nt,Ul=Va,Wl=Ra,Gl=Iee,Kl=za,ql=Lee,Jl=Ba,Yl=Ga,Xl=en,Zl=nn,Ql=aee,$l=Gte,eu=Kte,tu=_l,nu=Lt,ru=St,iu=Ut,au=Kt,ou=qt,su=Jt,cu=es,lu=as,uu=ts,du=ns,fu=is,pu={"~effect/Deferred":{_A:o,_E:o},pipe(){return n(this,arguments)}},mu=function(){this.resumes=void 0,this.effect=void 0};mu.prototype=pu;var hu=()=>new mu,gu=()=>lo(()=>hu()),_u=e=>vo(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),lo(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)}))),vu=a(2,(e,t)=>lo(()=>bu(e,t))),Xte=a(2,(e,t)=>vu(e,qt(t))),Zte=a(2,(e,t)=>vu(e,Kt(t))),Qte=a(2,(e,t)=>Zte(e,La(t))),yu=a(2,(e,t)=>vu(e,Ut(t))),bu=(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},$te=a(2,(e,t)=>Pc(n=>Go(Ys(n(e)),e=>vu(t,e)))),ene=Oa,xu=ic,tne=yc,Su=gc,Cu=xc,wu=fc,Tu=pc,Eu=uc,Du=dc,Ou=ac,nne=`~effect/Layer`,ku=`~effect/Layer/MemoMap`,rne=(e,t)=>{let n={observers:0,deferred:hu(),scope:Su(),finalizer:r=>uo(()=>--n.observers>0?go:(e.map.delete(t),Ou(n.scope,r)))};return n},Au=(e,t)=>t.state._tag!==`Closed`&&(e.observers++,mc(t,{},e.finalizer),!0),ine={[nne]:{_ROut:o,_E:o,_RIn:o},pipe(){return n(this,arguments)}},ju=e=>{let t=Object.create(ine);return t.build=e,t},Mu=e=>ju((t,n)=>{let r=Du(n);return kc(e(t,r),e=>e._tag===`Failure`?Ou(r,e):go)}),Nu=e=>{let t=Mu((n,r)=>n.getOrElseMemoize(t,r,e));return t},Pu=class{get[ku](){return ku}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);return n?(Au(n,t),n.deferred.effect??_u(n.deferred)):this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return uo(()=>{let r;return Dc(uo(()=>{let i=this.get(e,t);if(i)return i;let a=rne(this,e);return Au(a,t)?(r=a.deferred,this.map.set(e,a),n(this,a.scope)):n(this,t)}),e=>{r&&bu(r,e)})})}},Fu=()=>new Pu,Iu=e=>new Pu(e),Lu=class e extends tr()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=gr(t,e);return n?Iu(n):Fu()}},Ru=a(3,(e,t,n)=>vs(Yo(e.build(t,n),hr(Lu,t)),Lu,t)),zu=e=>Yt(t=>Ru(e,Lu.forkOrCreate(t.context),vr(t.context,xu))),Bu=a(2,(e,t)=>Yt(n=>Ru(e,Lu.forkOrCreate(n.context),t))),Vu=function(){return arguments.length===1?e=>Hu(mr(arguments[0],e)):Hu(mr(arguments[0],arguments[1]))},Hu=e=>ju(s(oo(e))),Uu=Hu(pr()),Wu=function(){return arguments.length===1?e=>Gu(()=>mr(arguments[0],e())):Gu(()=>mr(arguments[0],arguments[1]()))},Gu=e=>Nu(s(lo(e))),Ku=function(){return arguments.length===1?e=>qu(arguments[0],e):qu(arguments[0],arguments[1])},qu=(e,t)=>Ju(Yo(t,t=>mr(e,t))),Ju=e=>Nu((t,n)=>Cu(e,n)),Yu=e=>Ju(Oo(e,pr())),Xu=(e,t,n)=>{let r=Du(n,`parallel`);return Lc(e,e=>e.build(t,Du(r,`sequential`)),{concurrency:e.length}).pipe(Yo(e=>Tr(...e)))},Zu=(...e)=>Mu((t,n)=>Xu(e,t,n)),Qu=a(2,(e,t)=>Zu(e,...Array.isArray(t)?t:[t])),$u=(e,t,n)=>Mu((r,i)=>Go(Array.isArray(t)?Xu(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(_s(t),Yo(e=>n(e,t))))),ed=a(2,(e,t)=>$u(e,t,o)),td=a(2,(e,t)=>$u(e,t,(e,t)=>wr(t,e))),nd=e=>ju((t,n)=>e.build(Fu(),n)),rd=al,id=Ute,ad=`~effect/DateTime`,od=`~effect/DateTime/TimeZone`,sd={[ad]:ad,pipe(){return n(this,arguments)},[Ze](){return this.toString()},toJSON(){return Nd(this).toJSON()}},cd={...sd,_tag:`Utc`,[ee](){return oe(this.epochMilliseconds)},[ve](e){return pd(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Nd(this).toJSON()})`}},ld={...sd,_tag:`Zoned`,[ee](){return re(oe(this.epochMilliseconds))(z(this.zone))},[ve](e){return pd(e)&&e._tag===`Zoned`&&this.epochMilliseconds===e.epochMilliseconds&&ye(this.zone,e.zone)},toString(){return`DateTime.Zoned(${Jd(this)})`}},ud={[od]:od,[Ze](){return this.toString()}},dd={...ud,_tag:`Named`,[ee](){return se(`Named:${this.id}`)},[ve](e){return hd(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}};({...ud});var fd=(e,t,n)=>{let r=Object.create(ld);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},pd=e=>F(e,ad),md=e=>pd(e[0]),hd=e=>F(e,od),gd=e=>e._tag===`Utc`,_d=kn((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:+(e.epochMilliseconds>t.epochMilliseconds)),vd=e=>{let t=Object.create(cd);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},yd=e=>{let t=e.getTime();if(Number.isNaN(t))throw new $l(`Invalid date`);return vd(t)},bd=e=>{if(pd(e))return e;if(e instanceof Date)return yd(e);if(typeof e==`object`){if(`epochMilliseconds`in e)return yd(new Date(e.epochMilliseconds));let t=new Date(0);return zd(t,e),yd(t)}return typeof e==`string`&&!xd(e)?yd(new Date(e+`Z`)):yd(new Date(e))},xd=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),Sd=Wn(bd),Cd=Yo(id,vd),wd=()=>vd(Date.now()),Td=e=>vd(e.epochMilliseconds),Ed=a(md,(e,t,n)=>n?.adjustForTimeZone===!0?Vd(e.epochMilliseconds,t,n?.disambiguation??`compatible`):fd(e.epochMilliseconds,t,e.partsUtc)),Dd=new Map,Od={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},kd=e=>{let t=e.resolvedOptions().timeZone,n=Dd.get(t);if(n!==void 0)return n;let r=Object.create(dd);return r.id=t,r.format=e,Dd.set(t,r),r},Ad=()=>kd(new Intl.DateTimeFormat(`en-US`,Od)),jd=a(2,(e,t)=>ki(Rd(t)-Rd(e))),Md=Mn(_d),Nd=e=>new Date(e.epochMilliseconds),Pd=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},Fd=e=>Pd(e).getTime()-Rd(e),Id=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`)}`},Ld=e=>Id(Fd(e)),Rd=e=>e.epochMilliseconds,zd=(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)},Bd=864e5,Vd=(e,t,n)=>{if(t._tag===`Offset`)return fd(e-t.offset,t);let r=Wd(e-Bd,e,t),i=Wd(e+Bd,e,t);if(r===i)return fd(e-r,t);let a=r<i,o=r-i;if(a){if(Wd(e-i,e,t)===i)return fd(e-i,t);let a=fd(e-r,t);if(e!==Pd(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 fd(e-i,t);case`compatible`:case`later`:return a}return a}if(Wd(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||Wd(e-r+o,e+o,t)===r)return fd(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 fd(e-i,t)},Hd=/([+-])(\d{2}):(\d{2})$/,Ud=e=>{let t=Hd.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},Wd=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=Ud(r);return i===null?Fd(fd(t,n)):i},Gd=e=>Nd(e).toISOString(),Kd=e=>Pd(e).toISOString().slice(0,10),qd=e=>{let t=Pd(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${Ld(e)}`},Jd=e=>e.zone._tag===`Offset`?qd(e):`${qd(e)}[${e.zone.id}]`;globalThis.String;var Yd=e=>e.trim(),Xd=(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)},Zd=a(2,(e,t)=>Es(e,tf,e=>t(e))),Qd=e=>e.reasons.some($d),$d=e=>e._tag===`Fail`&&Zl(e.error),ef=e=>{let t,n=!1;for(let r of e.reasons)$d(r)?t??=r.error:r._tag!==`Interrupt`&&(n=!0);return t===void 0?Ar(e):n?Ar(Fl(e.reasons.filter(e=>!$d(e)))):kr(t)},tf=e=>{let t=ef(e);return Mr(t)?t:kr(t.success.value)},nf=e=>{let t=ef(e);return Mr(t)?au(t.failure):iu(t.success.value)},rf=a(2,(e,t)=>Vs(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=ef(e);return Mr(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),af=`~effect/Schedule`,of=Er(`effect/Schedule/CurrentMetadata`,{defaultValue:s({input:void 0,output:void 0,duration:Ti,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),sf={[af]:{_Out:o,_In:o,_Env:o},pipe(){return n(this,arguments)}},cf=e=>{let t=Object.create(sf);return t.step=e,t},lf=()=>{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}}},uf=e=>cf(Yo(e,e=>{let t=lf();return(n,r)=>e(t(n,r))})),df=e=>Ss(e.step,e=>oo(()=>so(e))),ff=e=>ll(t=>Yo(df(e),e=>{let n=lf();return r=>uo(()=>{let i=t.currentTimeMillisUnsafe();return Go(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,Oo(ul(t),a)})})})),pf=e=>cf(Yo(Fc(e.map(df)),e=>(t,n)=>Go(Lc(e,e=>rf(e(t,n),{onSuccess:e=>oo(e[1]),onDone:()=>jl,onFailure:so})),e=>{let t=mf(e);return t===void 0?Ql(Ti):oo([t,t])}))),mf=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},hf=(e,t=2)=>{let n=Fi(mi(e));return uf(oo(e=>{let r=ki(n*t**(e.attempt-1));return oo([r,r])}))},gf=e=>{let t=mi(e);return uf(oo(e=>oo([e.attempt-1,t])))},_f=a(2,(e,t)=>cf(Yo(df(e),e=>{let n=lf();return(r,i)=>Vo(e(r,i),([e,a])=>t({...n(r,i),output:e,duration:a}))}))),vf=a(2,(e,t)=>{let n=t.duration===void 0?void 0:mi(t.duration);return yf(e,({attempt:e,elapsed:r})=>oo((t.times===void 0||e<=t.times)&&(n===void 0||jee(ki(r),n))))}),yf=a(2,(e,t)=>cf(Yo(df(e),e=>{let n=lf();return(r,i)=>Go(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return Go(xt(s)?s:oo(s),t=>t?oo(e):Ql(a))})}))),bf=gf(Ti),xf=()=>e=>e,Sf=(e,t,n)=>Cc(r=>Go(n?.local?Ru(t,Fu(),r):Bu(t,r),t=>_s(e,t))),Cf=a(e=>xt(e[0]),(e,t,n)=>dr(t)?_s(e,t):Sf(e,Array.isArray(t)?Zu(...t):t,n)),wf=a(3,(e,t,n)=>Go(ff(t),t=>{let r=of.defaultValue(),i,a=Ds(uo(()=>vs(e,of,r)),e=>(i=e,Go(t(e),e=>(r=e,a))));return Zd(a,e=>ot(()=>n(i,e)))})),Tf=xt,Ef=Fc,Df=Lc,Of=Ic,kf=rte,Af=ite,B=oo,jf=po,Mf=uo,V=lo,Nf=go,Pf=jl,Ff=vo,If=yo,H=ste,U=co,Lf=so,Rf=tte,zf=mo,Bf=nte,Vf=fo,Hf=Yt,ane=ete,Uf=Go,Wf=Jo,Gf=Bo,Kf=Vo,qf=Bs,one=zs,Jf=Ys,Yf=Yo,Xf=Oo,Zf=zo,Qf=Ho,$f=Ds,ep=Ms,tp=Ss,sne=Ts,np=Ns,rp=Fs,ip=As,cne=Os,lne=wf,ap=Ls,une=Rs,dne=Is,op=ec,sp=tc,cp=Qs,fne=Zs,lp=ul,up=Wo,pne=bs,dp=qs,fp=Vs,mne=Ks,pp=ms,mp=gs,hp=Cf,gp=_s,hne=ds,_p=fs,vp=vs,yp=bc,bp=Sc,gne=Cc,xp=wc,Sp=pte,Cp=Tc,wp=cte,Tp=ute,Ep=kc,Dp=gte,Op=_te,kp=Nc,Ap=fte,jp=Ac,Mp=Pc,Np=xs,_ne=Bte,vne=Lte,Pp=rl,Fp=zte,Ip=Cte,Lp=Uc,Rp=Tte,yne=wte,zp=Dte,Bp=Wc,Vp=Gc,bne=Ote,Hp=Ate,xne=qc,Up=kte,Sne=Kc,Wp=Mte,Gp=Yc,Kp=jte,Cne=Jc,qp=bo,Jp=Co,Yp=ll,Xp=Tl(`Error`),wne=a(e=>Tf(e[0]),(e,...t)=>ps(e,ene,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||st(n,t[0],t[1]),n})),Zp=Xo,Qp=Zo,$p=Qo,em=qo,Tne=$o,Ene=To,tm=`~effect/BigDecimal`,Dne={[tm]:tm,[ee](){let e=im(this);return re(se(String(e.value)),oe(e.scale))},[ve](e){return One(e)&&Fne(this,e)===0},toString(){return`BigDecimal(${Ine(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Ze](){return this.toJSON()},pipe(){return n(this,arguments)}},One=e=>F(e,tm),kne=(e,t)=>{if(!Number.isSafeInteger(t))throw RangeError(`Scale must be a safe integer, got ${t}`);let n=Object.create(Dne);return n.value=e,n.scale=t,n},nm=(e,t)=>{let n=kne(e,t);return n.normalized=n,n},rm=BigInt(0),Ane=BigInt(1),jne=BigInt(10),Mne=nm(rm,0),im=e=>{if(e.normalized===void 0){if(e.value===rm)e.normalized=Mne;else{let t=`${e.value}`,n=t.length;for(;t[n-1]===`0`;)n--;e.normalized=nm(BigInt(t.slice(0,n)),e.scale-(t.length-n))}}return e.normalized},Nne=100,Pne=[Ane],am=(e,t)=>e===t?0:e<t?-1:1,om=(e,t)=>{let n=`${e.value<rm?-e.value:e.value}`,r=`${t.value<rm?-t.value:t.value}`,i=BigInt(n.length-r.length)-BigInt(e.scale)+BigInt(t.scale);if(i!==rm)return i<rm?-1:1;let a=Math.max(n.length,r.length);return dee(n.padEnd(a,`0`),r.padEnd(a,`0`))},Fne=(e,t)=>{if(e.scale===t.scale)return am(e.value,t.value);let n=sm(e),r=sm(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>Nne)return n===-1?om(t,e):om(e,t);let o=Pne[a]??=jne**BigInt(a);return i>0?am(e.value,t.value*o):am(e.value*o,t.value)},sm=e=>e.value===rm?0:e.value<rm?-1:1,Ine=e=>{let t=im(e);if(Math.abs(t.scale)>=16)return Lne(t);let n=t.value<rm,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},Lne=e=>{if(Rne(e))return`0e+0`;let t=im(e),n=`${t.value}`,r=t.value<rm?2:1,i=n.slice(0,r),a=n.slice(r),o=a.length-t.scale;return`${i}${a===``?``:`.${a}`}e${o>=0?`+`:``}${o}`},Rne=e=>e.value===rm,zne=BigInt(1),cm=BigInt(1e3),lm=BigInt(1024),um=[{symbol:`B`,factor:zne,names:[`B`,`byte`,`bytes`]},{symbol:`kB`,factor:cm,names:[`kB`,`kilobyte`,`kilobytes`]},{symbol:`MB`,factor:cm**BigInt(2),names:[`MB`,`megabyte`,`megabytes`]},{symbol:`GB`,factor:cm**BigInt(3),names:[`GB`,`gigabyte`,`gigabytes`]},{symbol:`TB`,factor:cm**BigInt(4),names:[`TB`,`terabyte`,`terabytes`]},{symbol:`PB`,factor:cm**BigInt(5),names:[`PB`,`petabyte`,`petabytes`]},{symbol:`EB`,factor:cm**BigInt(6),names:[`EB`,`exabyte`,`exabytes`]},{symbol:`ZB`,factor:cm**BigInt(7),names:[`ZB`,`zettabyte`,`zettabytes`]},{symbol:`YB`,factor:cm**BigInt(8),names:[`YB`,`yottabyte`,`yottabytes`]},{symbol:`RB`,factor:cm**BigInt(9),names:[`RB`,`ronnabyte`,`ronnabytes`]},{symbol:`QB`,factor:cm**BigInt(10),names:[`QB`,`quettabyte`,`quettabytes`]}],Bne=[um[0],{symbol:`KiB`,factor:lm,names:[`KiB`,`kibibyte`,`kibibytes`]},{symbol:`MiB`,factor:lm**BigInt(2),names:[`MiB`,`mebibyte`,`mebibytes`]},{symbol:`GiB`,factor:lm**BigInt(3),names:[`GiB`,`gibibyte`,`gibibytes`]},{symbol:`TiB`,factor:lm**BigInt(4),names:[`TiB`,`tebibyte`,`tebibytes`]},{symbol:`PiB`,factor:lm**BigInt(5),names:[`PiB`,`pebibyte`,`pebibytes`]},{symbol:`EiB`,factor:lm**BigInt(6),names:[`EiB`,`exbibyte`,`exbibytes`]},{symbol:`ZiB`,factor:lm**BigInt(7),names:[`ZiB`,`zebibyte`,`zebibytes`]},{symbol:`YiB`,factor:lm**BigInt(8),names:[`YiB`,`yobibyte`,`yobibytes`]}];[...um,...Bne.slice(1)];var Vne=pd,Hne=gd,dm=bd,Une=Sd,Wne=Cd,Gne=wd,Kne=Td,fm=Ed,qne=Ad,Jne=jd,Yne=Md,pm=Fd,mm=Gd,Xne=Kd,hm=e=>Zne(typeof e==`string`?Qne.encode(e):e),gm=e=>{let t=$ne(e),n=t.length;if(n%4!=0)return Ar(new oa({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 oa({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=ym(t.charCodeAt(e))<<18|ym(t.charCodeAt(e+1))<<12|ym(t.charCodeAt(e+2))<<6|ym(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 oa({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},Zne=e=>{let t=e.length,n=``,r=2;for(;r<t;r+=3)n+=_m[e[r-2]>>2],n+=_m[(e[r-2]&3)<<4|e[r-1]>>4],n+=_m[(e[r-1]&15)<<2|e[r]>>6],n+=_m[e[r]&63];return r===t+1&&(n+=_m[e[r-2]>>2],n+=_m[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=_m[e[r-2]>>2],n+=_m[(e[r-2]&3)<<4|e[r-1]>>4],n+=_m[(e[r-1]&15)<<2],n+=`=`),n},Qne=new TextEncoder,$ne=e=>e.replace(/[\n\r]/g,``),_m=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,vm=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)vm[_m.charCodeAt(e)]=e;vm[61]=0;var ym=e=>{if(e>=vm.length||vm[e]===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return vm[e]},bm=`~effect/HashMap`,xm=5,Sm=32,Cm=Sm/4,wm=Sm/2,Tm=31,Em=e=>(e-=e>>>1&1431655765,e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),Dm=(e,t)=>e>>>t&Tm,Om=(e,t)=>1<<Dm(e,t),km=(e,t)=>Em(e&t-1);function Am(e,t,n,r,i,a){if(t>32)throw Error(`HashMap: max depth exceeded`);let o=Om(n,t),s=Om(i,t);return o===s?new Rm(e,o,[Am(e,t+xm,n,r,i,a)]):new Rm(e,o|s,o>>>0<s>>>0?[r,a]:[a,r])}var jm=se(`HashMap`),Mm=(e,t)=>re(z(e),z(t)),Nm=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e[n];r&&(t^=r.subtreeHash())}return t},Pm=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}},Fm=class extends Pm{_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 Im(e,n,r,i)}remove(e,t,n,r,i){return this}canEdit(e){return!1}computeHash(){return 0}},Im=class e extends Pm{_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 Lm(t,r,[[this.key,this.value],[i,a]]);let s=Om(r,n),c=Om(this.hash,n);return s===c?new Rm(t,s,[this.set(t,n+xm,r,i,a,o)]):new Rm(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 Mm(this.key,this.value)}},Lm=class e extends Pm{_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,Am(t,n,this.hash,this,r,new Im(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 Im(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^=Mm(t[n][0],t[n][1]);return e}},Rm=class e extends Pm{_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=Om(t,e);if((this.bitmap&r)===0)return In();let i=km(this.bitmap,r);return this.children[i].get(e+xm,t,n)}has(e,t,n){let r=Om(t,e);if((this.bitmap&r)===0)return!1;let i=km(this.bitmap,r);return this.children[i].has(e+xm,t,n)}set(t,n,r,i,a,o){this.canEdit(t)&&(this._hash=void 0);let s=Om(r,n),c=km(this.bitmap,s);if((this.bitmap&s)!==0){let s=this.children[c],l=s.set(t,n+xm,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 Im(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>wm?this.expand(t,l,this.children):this;let u=[...this.children];return u.splice(c,0,n),u.length>wm?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=Om(r,n);if((this.bitmap&o)===0)return this;let s=km(this.bitmap,o),c=this.children[s],l=c.remove(t,n+xm,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(Sm),i=0;for(let e=0;e<Sm;e++)t&1<<e&&(r[e]=n[i++]);return new zm(e,n.length,r)}computeHash(){return Nm(this.children)}},zm=class e extends Pm{_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=Dm(t,e),i=this.children[r];return i?i.get(e+xm,t,n):In()}has(e,t,n){let r=Dm(t,e),i=this.children[r];return i?i.has(e+xm,t,n):!1}set(t,n,r,i,a,o){this.canEdit(t)&&(this._hash=void 0);let s=Dm(r,n),c=this.children[s];if(c){let l=c.set(t,n+xm,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 Im(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=Dm(r,n),s=this.children[o];if(!s)return this;let c=s.remove(t,n+xm,r,i,a);if(!a.value)return this;let l=this.count-+!c;if(l<Cm)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 Rm(e,i,r)}computeHash(){return Nm(this.children)}},Bm=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}},Vm=(e,t)=>[e,t],Hm=(e,t)=>t,Um=class{[bm]=bm;_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 Bm(this._root,Vm)}[ve](e){if(Gm(e)){let t=e;if(this.size!==t.size)return!1;for(let[t,n]of this){let r=f(e,qm(t));if(Rn(r)||!ye(n,r.value))return!1}return!0}return!1}[ee](){return ie(jm^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)}},Wm=new Fm,Gm=e=>F(e,bm),Km=()=>new Um(!1,0,Wm,0),qm=a(2,(e,t)=>e._root.get(0,z(t),t)),Jm=(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 Um(!1,i._edit,s,i._size+ +!!a.value)},Ym=a(3,(e,t,n)=>Jm(e,t,z(t),n)),Xm=e=>new Bm(e._root,Hm),Zm=(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??Wm,r._size--,e):o===void 0?Km():new Um(!1,r._edit,o,r._size-1):e},Qm=a(2,(e,t)=>Zm(e,t,z(t))),$m=Km,eh=Ym,th=Xm,nh=Qm,rh=`~effect/http/Cookies`,ih=`~effect/http/Cookies/Cookie`,ah={[rh]:rh,...et,toJSON(){return{_id:`effect/Cookies`,cookies:Hr(this.cookies,e=>e.toJSON())}},pipe(){return n(this,arguments)}},oh=e=>{let t=Object.create(ah);return t.cookies=e,t},sh=e=>{let t={};for(let n of e)st(t,n.name,n);return oh(t)},ch=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=lh(e.trim());t&&n.push(t)}return sh(n)};function lh(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(!uh.test(r))return;let i=t[0].slice(n+1),a=fh(i);if(t.length===1)return Object.assign(Object.create(dh),{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(dh),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var uh=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,dh={[ih]:ih,...et,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},fh=e=>{try{return decodeURIComponent(e)}catch{return e}},ph=new WeakMap,mh=e=>{if(ph.has(e))return ph.get(e);throw Error(`Unable to get redacted value`+(e.label?` with label: "${e.label}"`:``))},hh=`~effect/Redacted`,gh=e=>F(e,hh),_h=(e,t)=>{let n=Object.create(vh);return t?.label&&(n.label=t.label),ph.set(n,e),n},vh={[hh]:{_A:e=>e},label:void 0,...yt,toJSON(){return this.toString()},toString(){return`<redacted${x(this.label)?`:`+this.label:``}>`},[ee](){return z(ph.get(this))},[ve](e){return gh(e)&&ye(ph.get(this),ph.get(e))}},yh=mh,bh=e=>sn((t,n)=>e(yh(t),yh(n))),xh=Symbol.for(`~effect/http/Headers`),Sh=Object.defineProperties(Object.create(null),{[xh]:{value:xh},[Ie]:{value(e){return Mh(this,yr(e,Ph))}},toJSON:{value(){return Re(this)}},[ve]:{value(e){return wh(this,e)}},[ee]:{value(){return le(this)}},toString:{value:et.toString},[Ze]:{value:et[Ze]}}),Ch=e=>Object.assign(Object.create(Sh),e),wh=Gr(cn()),Th=Object.create(Sh),Eh=e=>{if(e===void 0)return Th;if(Symbol.iterator in e){let t=Object.create(Sh);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(Sh);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},Dh=e=>Object.setPrototypeOf(e,Sh),Oh=a(3,(e,t,n)=>{let r=Ch(e);return r[t.toLowerCase()]=n,r}),kh=a(2,(e,t)=>Ch({...e,...Eh(t)})),Ah=a(2,(e,t)=>{let n=Ch(e);return Object.assign(n,t),n}),jh=a(2,(e,t)=>{let n=Ch(e);return delete n[t.toLowerCase()],n}),Mh=a(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=_h(e[r]))}else for(let r in e)r.search(t)!==-1&&(n[r]=_h(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),Nh=(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},Ph=Er(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),Fh=`~effect/http/UrlParams`,Ih=e=>F(e,Fh),Lh={...yt,[Fh]:Fh,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[ve](e){return Vh(this,e)},[ee](){return de(this.params.flat())}},Rh=e=>{let t=Object.create(Lh);return t.params=e,t},zh=e=>{if(Ih(e))return e;let t=Bh(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 Rh(n)},Bh=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=Bh(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},Vh=sn((e,t)=>Hh(e.params,t.params)),Hh=Cee(Ir([cn(),cn()])),Uh=Rh([]),Wh=a(2,(e,t)=>Rh(t(e.params))),Gh=a(2,(e,t)=>{let n=zh(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 Rh(n)}),Kh=a(2,(e,t)=>Wh(e,Xr(zh(t).params))),qh=e=>new URLSearchParams(zh(e).params).toString(),Jh=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 Yh(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Xh(e){return t=>Yh(t)?.[e]}var Zh=`~structural`,Qh=`~sentinels`,$h=`~constructor`,eg=m(e=>{let t=Yh(e)?.identifier;return typeof t==`string`?t:e.getExpected(eg)}),tg=Symbol(),ng=iu,rg=ng(tg),ig=ng(tg),ag=e=>e===tg?In():Ln(e),og=e=>e._tag===`None`?rg:ng(e.value),sg=`~effect/SchemaIssue/Issue`;function cg(e){return F(e,sg)&&e[sg]===sg}function lg(e){return Object.hasOwn(e,`input`)}var ug=class{[sg]=sg;constructor(e,t){t?.reportInput===!0&&e!==tg&&(this.input=e)}},dg=class extends ug{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},fg=class extends ug{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},pg=class extends ug{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},mg=class extends ug{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},hg=class extends ug{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},gg=class extends ug{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},_g=class extends ug{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},vg=class extends ug{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}};function yg(e,t,n,r,i){return new gg(e,[new pg([t],n)],r,i)}var bg=class extends ug{_tag=`Forbidden`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},xg=class extends ug{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Sg=class extends ug{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function Cg(e,t,n){if(cg(e))return e;if(typeof e==`string`)return new vg({message:e},t,n);let r=typeof e.issue==`string`?new vg({message:e.issue},t,n):e.issue;return new pg(e.path,r)}function wg(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new vg(void 0,t,n):Cg(e,t,n)}function Tg(e,t,n,r){return Array.isArray(t)?Qr(t)?t.length===1?Cg(t[0],n,r):new gg(e,ri(t,e=>Cg(e,n,r)),n,r):void 0:wg(t,n,r)}var Eg=e=>{let t=Lg(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return jg(eg(e.ast),e);case`InvalidValue`:{let t=Ag(e);if(t!==void 0)return jg(t,e);let n=kg(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=kg(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=kg(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},Dg=e=>Lg(e.issue)??Lg(e);function Og(e){return t=>({issues:Mg(t,[],e?.leafHook??Eg,e?.checkHook??Dg)})}function kg(e){return lg(e)?Ue(e.input):void 0}function Ag(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function jg(e,t){let n=kg(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Mg(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 Mg(e.issue,t,n,r);let a=Ag(e.issue);return[{path:t,message:a===void 0?jg(Ng(e.filter),e):jg(a,e.issue)}]}case`Encoding`:return Mg(e.issue,t,n,r);case`Pointer`:return Mg(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Mg(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:Lg(e)??jg(eg(e.ast),e)}]:e.issues.flatMap(e=>Mg(e,t,n,r));default:return[{path:t,message:n(e)}]}}function Ng(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=>Ng(e)).join(` & `)}}function Pg(){return e=>Ig(e,``)}var Fg=Pg();function Ig(e,t){let n;switch(e._tag){case`Filter`:{let r=Dg(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Ig(e.issue,t);let r=Ag(e.issue);n=r===void 0?jg(Ng(e.filter),e):jg(r,e.issue)}break}case`Encoding`:return Ig(e.issue,t);case`Pointer`:return Ig(e.issue,t+Ke(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Ig(e,t)).join(`
|
|
14
|
+
`);n=Lg(e)??jg(eg(e.ast),e);break;default:n=Eg(e)}return t?`${n}\n at ${t}`:n}function Lg(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Lg(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 Rg(e){let t;for(let n of e.reasons){if(!Pl(n)||!cg(n.error))return;t??=n.error}return t}function zg(e,t){let n=Rg(e);if(n===void 0)throw Error(t,{cause:e});return n}var Bg=e=>Object.assign(Object.create(r),e);function Vg(e){return Yg((t,n)=>U(e(t,n)))}function Hg(e){return Vg((t,n)=>{let r={message:e(t)};return zn(t)?new bg(r,t.value,n):new bg(r)})}var Ug=Hg(()=>`Encoding is not supported`),Wg=Bg({_tag:`Passthrough`});function Gg(){return Wg}function Kg(e){return Bg({_tag:`Transform`,transform:e})}function qg(e){return Bg({_tag:`TransformEffect`,transform:e})}function Jg(e){return Bg({_tag:`TransformOptional`,transform:e})}function Yg(e){return Bg({_tag:`TransformOptionalEffect`,transform:e})}function Xg(){return Jg(()=>In())}function Zg(e){return Yg(t=>{let n=Qn(t,k);return zn(n)?B(n):Zp(e,Ln)})}function Qg(){return Kg(globalThis.String)}function $g(){return Kg(globalThis.Number)}function e_(){return Kg(globalThis.BigInt)}function t_(){return Kg(Yd)}function n_(e){return qg((t,n)=>Bf({try:()=>JSON.parse(t,e?.reviver),catch:()=>new vg({expected:`a valid JSON string`},t,n)}))}function r_(e){return qg((t,n)=>Bf({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 vg({expected:`a JSON-serializable value`},t,n)}))}function i_(){return Kg(hm)}function a_(){return qg((e,t)=>Qp(ane(gm(e)),()=>new vg({expected:`a valid Base64 string`},e,t)))}var o_=class extends i{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new o_(this.encode,this.decode)}},s_=`~effect/SchemaTransformation/Transformation`,c_=class extends i{[s_]=s_;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new c_(this.encode,this.decode)}};function l_(e){return F(e,s_)&&e[s_]===s_}var u_=e=>l_(e)?e:new c_(e.decode,e.encode);function d_(e){return new c_(qg(e.decode),qg(e.encode))}function f_(e){return new c_(Kg(e.decode),Kg(e.encode))}function p_(){return new c_(t_(),Gg())}var m_=new c_(Gg(),Gg());function h_(){return m_}var g_=new c_($g(),Qg()),__=new c_(e_(),Qg()),v_=e=>N(e)&&typeof e.message==`string`,y_=e=>{let t=Object.hasOwn(e,`cause`)?Error(e.message,{cause:C_(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},b_=e=>{try{let t=Xe(e);return t===void 0?Ue(e):JSON.parse(t)}catch{return Ue(e)}},x_=(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},S_=e=>{let t=new WeakSet,n=r=>{if(L(r)){if(t.has(r))return`[Circular]`;t.add(r);let i=x_(r,e,n);return t.delete(r),i}return b_(r)};return n},C_=e=>v_(e)?y_(e):e,w_=e=>f_({decode:C_,encode:S_(e)}),T_=d_({decode:(e,t)=>URL.canParse(e)?B(new URL(e)):U(new vg({expected:`a valid URL string`},e,t)),encode:e=>B(e.href)}),E_=new c_(a_(),i_());function D_(e){return new c_(n_(e??{}),r_(e))}function O_(e){return t=>t._tag===e}var k_=O_(`Declaration`),A_=O_(`Null`),j_=O_(`Void`),M_=O_(`Never`),N_=O_(`Literal`),P_=O_(`UniqueSymbol`),F_=O_(`Arrays`),I_=O_(`Objects`),L_=O_(`Union`),R_=O_(`Suspend`),z_=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},B_={},V_=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}},H_=`~effect/Schema`,U_=class{[H_]=H_;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}>`}},W_=class extends U_{_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===tg?rg:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=hy(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new W_(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>`}},G_=new class extends U_{_tag=`Null`;getParser(){return Ty(this,null)}getExpected(){return`null`}},K_=class extends U_{_tag=`Undefined`;getParser(){return Ty(this,void 0)}toCodecJson(){return ny(this,[q_])}getExpected(){return`undefined`}},q_=new z_(G_,new c_(Kg(()=>void 0),Kg(()=>null))),J_=new K_,Y_=new class extends U_{_tag=`Void`;getParser(){let e=ng(void 0);return t=>t===tg?rg:e}toCodecJson(){return ny(this,[q_])}getExpected(){return`void`}},X_=new class extends U_{_tag=`Never`;getParser(){return Ey(this,j)}getExpected(){return`never`}},Z_=new class extends U_{_tag=`Unknown`;getParser(){return Ey(this,M)}getExpected(){return`unknown`}},Q_=class extends U_{_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 Ty(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?$_(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:$_(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function $_(e){let t=globalThis.String(e.literal);return ny(e,[new z_(new Q_(t),new c_(Kg(()=>e.literal),Kg(()=>t)))])}var ev=new class extends U_{_tag=`String`;getParser(){return Ey(this,x)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&My(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},tv=class extends U_{_tag=`Number`;getParser(){return Ey(this,S)}matchKey(e,t){return this._match(ure,e,t)}matchPart(e,t){return this._match(ky,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:My(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(nv(this.checks,`effect/schema/isFinite`)||nv(this.checks,`effect/schema/isInt`))?this:ny(this,[Zv])}toCodecStringTree(){return this.toCodecJson()===this?ny(this,[fre]):ny(this,[pre])}getExpected(){return`number`}};function nv(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&nv(e.checks,t))}var rv=new tv,iv=new class extends U_{_tag=`Boolean`;getParser(){return Ey(this,C)}getExpected(){return`boolean`}},av=new class extends U_{_tag=`BigInt`;getParser(){return Ey(this,w)}matchPart(e,t){if(!jy.test(e))return;let n=globalThis.BigInt(e);return t.disableChecks||!this.checks?n:My(this.checks,n,void 0,this,t)?void 0:n}toCodecStringTree(){return ny(this,[hre])}getExpected(){return`bigint`}},ov=class extends U_{_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(yy(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(yy(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 hg(n,t[o],i),a=new pg([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return U(new gg(n,[a],t,i))}return e.issues?U(new gg(n,e.issues,t,i)):ng(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:Rc(t.concurrency),f=d===1?lv(i,e,0,u):uv(i,e,{concurrency:d,end:u});if(!f)return c(i);if(Ko(f))return em(f,()=>c(i));let p=!0;return Mf(()=>p?(p=!1,Uf(f,()=>c(i))):l(e,t))};return(e,a)=>{if(e===tg)return rg;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 _g(n,e,a))}catch(e){return zf(e)}}}_rebuild(e,t,n){let r=hy(this.elements,e),i=hy(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new ov(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 sv(e,t,n,r){if(n._tag===`Failure`)return dv(e,e.ast,r,n);let i=n===ig?t:n[pt];if(i!==tg)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(yy(t.ast))return;let n=new pg([r],new mg(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return ou(new gg(e.ast,[n],e.input,e.options))}}var cv={onItem(e,t,n){let r=n<e.len?t:tg;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:sv},lv=zc()(cv),uv=Vc()(cv),dv=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Rg(r.cause);if(i===void 0)return au(Hl(r.cause,r=>new gg(t,[new pg([n],r)],e.input,e.options)));let a=new pg([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return ou(new gg(t,[a],e.input,e.options))},fv=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function pv(e,t,n=B_){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(Dy(Sy(t)))}var mv=class{name;type;constructor(e,t){this.name=e,this.type=t}};function hv(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(hv);default:return!1}}function gv(e){let t=iy(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(gv);default:return!1}}function _v(e){return hv(e)&&gv(e)}var vv=class{parameter;type;constructor(e,t){if(!_v(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,yy(t)&&!wy(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},yv=class extends U_{_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 Ey(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(Dy(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 dv(t,n,i,s)??lu;let c=s===ig?o:s[pt];if(a!==tg&&c!==tg){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return lu;st(t.out,a,c)}return lu},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!Ko(t))return Uf(Jf(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return dv(e,n,r,a)??lu;let o=a===ig?r:a[pt],s=e.input[r],l=i.parserValue(s,e.options);return Ko(l)?t(e,r,o,s,l):Uf(Jf(l),n=>t(e,r,o,s,n))},l=(e,n,r)=>{let i=e.input[n],a=r.parserValue(i,e.options);return Ko(a)?t(e,n,n,i,a):Uf(Jf(a),r=>t(e,n,n,i,r))},u=i?Vc()({onItem:(e,[t,n])=>n.is.parameter===ev?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return Ene(function*(t,d){if(t===tg)return tg;if(typeof t!=`object`||!t||Array.isArray(t))return yield*U(new _g(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:Rc(d.concurrency),v=i&&g?n.indexSignatures.map(e=>pv(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 hg(n,f[a],d),r=new pg([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*U(new gg(n,[r],t,d))}}}if(r){let e=_===1?Sv(m,a):Cv(m,a,{concurrency:_});e&&(yield*e)}if(i&&_===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===ev?l:c,r=v?.[e]??(t.is.parameter===ev?Object.keys(f):pv(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!Ko(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=ti();for(let t=0;t<i;t++){let n=o[t],r=v?.[t]??(n.is.parameter===ev?Object.keys(f):pv(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 gg(n,m.issues,t,d)):p})};if(i)return c();let l,u=(e,t,n)=>{let r=a[t];return Uf(Jf(n),n=>{let i=bv(e,r,n);if(i)return i;let o=()=>ng(e.out),s=Sv(e,a.slice(t+1));return s?em(s,o):o()})};return(e,t)=>{if(e===tg)return rg;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&Rc(t.concurrency)!==1)return(l??=c())(e,t);if(typeof e!=`object`||!e||Array.isArray(e))return U(new _g(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=Fv(i,s),l=c?i[s]:tg,d=n.parser(l,t);if(!Ko(d))return u(o,e,d);if(d===ig){c&&st(a,s,l);continue}let f=bv(o,n,d);if(f)return f}}catch(e){return zf(e)}return ng(a)}}_rebuild(e,t,n,r){let i=hy(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new mv(t.name,n)}),a=hy(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new vv(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new yv(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 bv(e,t,n){if(n._tag===`Failure`)return dv(e,e.ast,t.name,n);if(n===ig)return;let r=n[pt];if(r!==tg){st(e.out,t.name,r);return}if(delete e.out[t.name],!yy(t.type)){let n=new pg([t.name],new mg(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return ou(new gg(e.ast,[n],e.input,e.options))}}var xv={onItem(e,t){if(!Fv(e.input,t.name))return t.parser(tg,e.options);let n=e.input[t.name];return st(e.out,t.name,n),t.parser(n,e.options)},step:bv},Sv=zc()(xv),Cv=Vc()(xv);function wv(e,t){return e?t?[...e,...t]:e:t}function Tv(e,t,n){return new yv(Reflect.ownKeys(e).map(t=>new mv(t,e[t].ast)),[],n,t)}function Ev(e){return e.ast}function Dv(e,t=void 0){return new ov(!1,e.map(e=>e.ast),[],void 0,t)}function Ov(e,t,n){return new Lv(e.map(Ev),t,void 0,n)}var kv=h(e=>{for(;;){if(R_(e))return Z_;let t=e.encoding;if(!t)return e.recur?.(kv,o)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==o))return Z_;e=t[t.length-1].to}});function Av(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(Av)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function jv(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[Qh];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!yy(t)){if(N_(t))return[{key:e.name,literal:t.literal}];if(P_(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!yy(e)){if(N_(e))return[{key:t,literal:e.literal}];if(P_(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>jv(kv(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return jv(e.thunk())}}var Mv=new WeakMap,Nv=Object.freeze([]),Pv=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Fv=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Iv(e){let t=Mv.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=kv(c);if(M_(l))continue;if(N_(l)||P_(l)){a??=new Map;let e=N_(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=jv(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=Av(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??Nv);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??Nv;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=Fv(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??Nv;if(t)return o}return Nv}}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=Pv(t);if(!P(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=Fv(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=Fv(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=Fv(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(Pv(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return Mv.set(e,t),t}var Lv=class extends U_{_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===tg)return rg;let i=(o??=Iv(n.types))(e,r);if(i.length===0)return U(new xg(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:Ko(r)?Rv(n,r.cause,e,t):zv(n,r,e,t)}return Bv(n,a,i,e,t)}}_rebuild(e,t,n){let r=hy(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Lv(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=Sy(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(N_);if(t.length>0)return`${Wv(n.isMutable)}[ ${t.map(t=>e(t)+Gv(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>N_(e.type));if(t.length>0)return`{ ${t.map(t=>`${Wv(t.type.context?.isMutable)}${Ge(t.name)}${Gv(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function Rv(e,t,n,r){let i=Rg(t);return i?ou(new xg(e,[i],n,r)):au(t)}function zv(e,t,n,r){return tp(t,t=>Rv(e,t,n,r))}function Bv(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=Hv(a,n);return o?Vv(o,a):a.out?a.out:U(new xg(e,a.issues??[],r,i))}function Vv(e,t){return em(e,e=>t.out===ig?B(t.input):t.out?t.out:U(new xg(t.ast,t.issues??[],t.input,t.options)))}var Hv=zc()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Rg(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]),ou(new Sg(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return lu}}}),Uv=new Lv([new Q_(`Infinity`),new Q_(`-Infinity`),new Q_(`NaN`)]);function Wv(e){return e?``:`readonly `}function Gv(e){return e?`?`:``}var Kv=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 Kv(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Kv(this.run,this.annotations,!0)}and(e,t){return new qv([this,e],t)}},qv=class extends i{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new qv(this.checks,{...this.annotations,...e})}and(e,t){return new qv([this,e],t)}};function Jv(e,t,n=!1){return new Kv((t,n,r)=>Tg(n,e(t,n,r),t,r),t,n)}function Yv(e){return Jv(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 Xv=sy(rv,[Yv()]),Zv=new z_(new Lv([Xv,Uv]),new c_($g(),Kg(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Qv(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Jv(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 $v=new WeakMap;function ey(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&$v.set(n,ty(e)),n}function ty(e){let t=$v.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 $v.set(e,n),n}function ny(e,t){return e.encoding===t?e:ey(e,{encoding:t})}function ry(e,t){if(e.context===t)return e;let n=ty(e);return n.context===t&&n.encoding===e.encoding?n:ey(e,{context:t})}function iy(e){return e.encoding?iy(e.encoding[e.encoding.length-1].to):e}function ay(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return oy(e,Yr(e.checks.slice(0,-1),n.annotate(t)))}return ey(e,{annotations:{...e.annotations,...t}})}function oy(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:ey(e,{checks:t})}function sy(e,t){return oy(e,wv(e.checks,t))}function cy(e,t){let n=t(e.to);return n===e.to?e:new z_(n,e.transformation)}function ly(e,t){let n=e,r=n[n.length-1],i=cy(r,t);return i===r?e:Yr(e.slice(0,e.length-1),i)}function uy(e){return t=>t.encoding?ny(t,ly(t.encoding,e)):t}function dy(e,t){return uy(e=>ry(e,t))(e)}function fy(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:ny(r,ly(r.encoding,n))}return e(r)}return h(n)}function py(e,t){return my(e,t,xy(e))}function my(e,t,n){let r=new z_(e,t);return ny(n,n.encoding?[...n.encoding,r]:[r])}function hy(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 gy(e,t){return ry(e,e.context?new V_(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new V_(!1,!1,void 0,t))}var _y=h(e=>ere(ry(e,e.context?e.context.isOptional===!1?new V_(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new V_(!0,!1)))),ere=uy(_y),tre=m(e=>_y(new Lv([e,J_]))),vy=h(e=>nre(ry(e,e.context?e.context.isMutable===!1?new V_(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new V_(!1,!0)))),nre=uy(vy);function rre(e,t){return ry(e,e.context?new V_(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new V_(!1,!1,t))}function ire(e,t,n){return my(e,n,t)}function are(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 ore(e,t){let{literals:n,parameters:r}=are(e);return new yv(n.map(e=>new mv(e,t)),r.map(e=>new vv(e,t)))}function yy(e){return e.context?.isOptional??!1}function by(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(by)}function sre(e){function t(e){return by(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return Zr(n)?n:void 0}function cre(e){let t=!0;function n(e){return t=t&&!e.encoding&&!R_(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var xy=h(e=>{let t=ty(e);if(t!==e){let n=xy(t);return n===t&&e.encoding===void 0?e:ry(n,e.context)}let n=`recur`in e?e.recur(xy):e;if(`encodingChecks`in n&&n.encodingChecks){let t=cre(e)?n.encodingChecks:F_(n)||I_(n)||k_(n)&&n.typeParameters.length>0?sre(n.encodingChecks):void 0;return ey(n,{encodingChecks:void 0,checks:wv(n.checks,t)})}return n}),Sy=h(e=>xy(Cy(e)));function lre(e,t){let n=t,r=n.length,i=n[r-1],a=[new z_(Cy(ny(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new z_(Cy(n[e-1].to),n[e].transformation.flip()));let o=Cy(i.to);return o.encoding?ny(o,[...o.encoding,...a]):ny(o,a)}var Cy=m(e=>{if(e.encoding)return lre(e,e.encoding);let t=ty(e);if(t!==e){let n=Cy(t);return n===t?e:ry(n,e.context)}return`flip`in e?e.flip(Cy):`recur`in e?e.recur(Cy):e});function wy(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(wy);default:return!1}}function Ty(e,t){let n=t===0?ig:ng(t);return(r,i)=>r===tg?rg:r===t?n:U(new _g(e,r,i))}function Ey(e,t){return(n,r)=>n===tg?rg:t(n)?ig:U(new _g(e,n,r))}var Dy=fy(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(Dy)}}),Oy=fy(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(Oy)}}),ky=new globalThis.RegExp(`^${fv}$`),ure=new globalThis.RegExp(`^(?:${fv}|Infinity|-Infinity|NaN)$`);function dre(e){return Qv(ky,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:ky.source}),...e})}var Ay=sy(ev,[dre()]),fre=new z_(Ay,g_),pre=new z_(new Lv([Ay,Uv]),g_),jy=new globalThis.RegExp(`^-?\\d+$`);function mre(e){return Qv(jy,{expected:`a string representing a bigint`,representation:{id:`effect/schema/isStringBigInt`,payload:null},toJsonSchema:()=>({pattern:jy.source}),...e})}var hre=new z_(sy(ev,[mre({expected:`a string representing a bigint`})]),__);function My(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=My(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 dg(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function gre(e){if(!k_(e))return;let t=e.annotations?.[$h];return D(t)?t(e.typeParameters):void 0}var Ny=Xh;function _re(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function vre(e){return e===void 0||typeof e==`string`}function Py(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 yre(e){return Py(e,_re)}var Fy=new W_([],()=>(e,t,n)=>yre(e)?ig:U(new _g(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>Ly}),bre=ay(Fy,{representation:{id:`effect/schema/MutableJson`,payload:null}}),Iy=new z_(Fy,h_()),xre=new z_(new Lv([new ov(!1,[],[Fy]),new yv([],[new vv(ev,Fy)])]),h_());function Sre(e){return Py(e,vre)}var Ly=new z_(new W_([],()=>(e,t,n)=>Sre(e)?ig:U(new _g(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),h_()),Ry=(e,t,n)=>e===ig?n(t):em(e,n);function zy(e){if(e._tag===`Middleware`)return(t,n,r)=>By(t===ig?e.decode(ng(ag(n)),r):e.decode(Zp(t,ag),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===ig?ng(t):e;case`Transform`:{let e=e=>e===tg?rg:ng(t.transform(e));return(t,n)=>Ry(t,n,e)}case`TransformOptional`:{let e=e=>og(t.transform(ag(e)));return(t,n)=>Ry(t,n,e)}case`TransformEffect`:return(e,n,r)=>Ry(e,n,e=>e===tg?rg:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>Ry(e,n,e=>By(t.transform(ag(e),r)))}}var By=e=>em(e,og),Vy=(e,t,n,r)=>tp(r,r=>Rf(()=>Hl(r,r=>new fg(e,r,t,n))));function Cre(e,t){let n=zy(e.link.transformation),r;return(i,a)=>{if(i===tg)return rg;if(e.isConstructed(i))return ig;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function wre(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==tg&&r!==void 0)return t(r,i);let a=n;if(Ko(a)&&a._tag===`Success`){let e=t(a[pt],i);return e===ig?a:e}return em(Vy(e,r,i,a),e=>{let n=t(e,i);return n===ig?ng(e):n})}}function Tre(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:wre(e,n)}function Hy(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?gre(e):void 0,o=a?Cre(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>zy(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(Ko(r)){if(r._tag===`Success`){let i=r===ig?t:r[pt];if(t!==tg&&i!==tg){let i=My(u,t,void 0,e,n);i&&(r=U(new gg(e,i,t,n)))}}}else r=Uf(r,r=>{if(t!==tg&&r!==tg){let r=My(u,t,void 0,e,n);if(r)return U(new gg(e,r,t,n))}return B(r)})}if(s&&!n.disableChecks){if(Ko(r)){if(r._tag===`Success`){let i=r===ig?t:r[pt];if(i===tg)return r;let a=My(s,i,void 0,e,n);a&&(r=U(new gg(e,a,i,n)))}}else r=Uf(r,t=>{if(t!==tg){let r=My(s,t,void 0,e,n);if(r)return U(new gg(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=em(o,e=>{let n=t(e,r);return n===ig?ng(e):n})}if(o._tag===`Success`){let e=o[pt],t=p(e,r);return t===ig?o:t}return o=Vy(e,n,r,o),em(o,e=>{let t=p(e,r);return t===ig?ng(e):t})}:p}var Ere=Symbol(),Uy=new WeakMap,Dre=e=>Gy(e).parser,Wy=e=>Gy(e).makeEffect,Ore=e=>Tre(e,Wy),kre=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=Hy(this.ast,Dre)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=Hy(this.ast,Wy,Ore)}};function Gy(e){let t=Uy.get(e);if(t!==void 0)return t;let n=new kre(e);return Uy.set(e,n),n}function Ky(e){let t=e.ast,n;return(e,r)=>(n??=$y(Ure,xy(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function qy(e){let t=Ky(e);return(e,n)=>{let r=Kp(t(e,n));return uu(r)?Ln(r.value):(zg(r.cause,`Option adapter can only return none for schema issues`),In())}}function Jy(e){return Vre(xy(e.ast))}function Are(e){return Mre(e.ast)}function jre(e){{let t=eb(Qy(e));return e=>{let n=t(e,B_);return uu(n)?!0:(zg(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}}function Mre(e){let t=xy(e),n=e=>(n=jre(t),n(e));return e=>n(e)}function Nre(e){let t=Qy(e);return(e,n)=>{let r=Kp(t(e,n));if(!uu(r))return zg(r.cause,`Issue adapter can only return schema issues`)}}function Yy(e,t){let n=Qy(e.ast);return t===void 0?n:(e,r)=>n(e,Xy(t,r))}function Pre(e,t){return Rre(Yy(e,t))}function Fre(e,t){return zre(Yy(e,t))}function Ire(e,t){let n=Qy(Cy(e.ast));return t===void 0?n:(e,r)=>n(e,Xy(t,r))}var Xy=(e,t)=>t?{...e,...t}:e,Zy=e=>e===tg?U(new vg):B(e);function Qy(e){return $y(Hre,e)}function Lre(e,t){return e===ig?B(t):Ko(e)?e[pt]===tg?Zy(tg):e:em(e,Zy)}function $y(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??B_);return a===ig?B(r):Ko(a)?a[pt]===tg?Zy(tg):a:em(a,Zy)}}function eb(e){return(t,n)=>Kp(e(t,n))}function Rre(e){let t=eb(e);return(e,n)=>{let r=t(e,n);return uu(r)?Ln(r.value):(zg(r.cause,`Option adapter can only return none for schema issues`),In())}}function zre(e){let t=eb(e);return(e,n)=>{let r=t(e,n);return uu(r)?kr(r.value):Ar(zg(r.cause,`Result adapter can only return schema issues`))}}function Bre(e,t){let n=Kp(e);if(uu(n))return n.value;let r=zg(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}function Vre(e){let t,n;return(r,i)=>{t??=Gy(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??B_,o=t.make;if(o!==void 0&&r!==tg){let e;try{e=o(r,a)}catch(e){throw zg(Ll(e),`Constructor adapter can only throw schema issues`),e}if(e!==Ere&&e!==tg)return e}return Bre(Lre((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var Hre=e=>Gy(e).parser,Ure=e=>Gy(e).makeEffect,tb=`~effect/Schema/Schema`,nb=Symbol(),Wre={[tb]:tb,get make(){let e=Jy(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Ky(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=qy(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return n(this,arguments)},annotate(e){return this.rebuild(ay(this.ast,e))},annotateKey(e){return this.rebuild(gy(this.ast,e))},check(...e){return this.rebuild(sy(this.ast,e))},rebuild(e){return rb(e,this[nb])}};function rb(e,t){function n(){}let r=Object.setPrototypeOf(n,Wre);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[nb]=t,r.ast=e,r}function Gre(e){return rb(ib(e.ast),{schema:e})}var ib=fy(e=>{let t=qre(e,ib),n=e.context;return t===e||n===void 0?t:dy(t,ab(n))});function ab(e){return e.constructorDefault===void 0?e:new V_(e.isOptional,e.isMutable,void 0,e.annotations)}function ob(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function sb(e){return t=>{let n=[...t].sort((t,n)=>e(Sy(t))-e(Sy(n)));return n.some((e,n)=>e!==t[n])?n:t}}var Kre=sb(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function qre(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!D(n))return ny(e,[Iy]);let r=n(e.typeParameters.map(e=>rb(Sy(e))));return r===void 0?e:ny(e,[cy(r,t)])}case`Unknown`:return ny(e,[Iy]);case`ObjectKeyword`:return ny(e,[xre]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return ob(e),e.recur(t,Oy);case`Union`:{let n=Kre(e.types);return n===e.types?e.recur(t):new Lv(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 Jre(e){return rb(cb(e.ast),{schema:e})}var Yre=sb(e=>{switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function Xre(e,t,n){switch(e._tag){case`Declaration`:{let r=e.typeParameters.map(e=>rb(t(Sy(e)))),i=e.annotations?.toCodecStringTree;if(D(i)){let n=i(r);return n===void 0?e:ny(e,[cy(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):ny(e,[cy(c,t)])}case`Null`:return ny(e,[Zre]);case`Boolean`:return ny(e,[Qre]);case`Unknown`:case`ObjectKeyword`:return ny(e,[Ly]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return ob(e),e.recur(t,Oy);case`Union`:{let n=Yre(e.types);return n===e.types?e.recur(t):new Lv(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 Zre=new z_(new Q_(`null`),new c_(Kg(()=>null),Kg(()=>`null`))),Qre=new z_(new Lv([new Q_(`true`),new Q_(`false`)]),new c_(Kg(e=>e===`true`),Qg())),$re=new c_(Kg(e=>typeof e==`string`?[e]:e),Gg()),cb=fy(e=>{let t=Xre(e,cb,e=>{throw new globalThis.Error(`Missing structural codec for StringTree`,{cause:e})});return t!==e&&e.context!==void 0?dy(t,ab(e.context)):t},{stopAt:e=>e.transformation===$re});function lb(e){return uu(e)?e.value:{issues:[{message:Yl(e.cause)}]}}function eie(e,t){let n=Yy(e),r={errors:`all`,...t?.parseOptions},i=Og(t),a=e=>{let t=new Zi(`sync`),a=zp(dp(n(e,r),{onFailure:i,onSuccess:e=>({value:e})}),{scheduler:t});a.currentDispatcher?.flush();let o=a.pollUnsafe();return o?lb(o):new Promise(e=>{a.addObserver(t=>{e(lb(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 tie=a(2,(e,t)=>db(e,(e,n)=>rie(t,e)?void 0:[e,n])),ub=e=>e,nie=a(2,(e,t)=>db(e,(e,n)=>[e,t(n)]));function rie(e,t){return e.some(e=>e===t||typeof e==`number`&&String(e)===t)}function db(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 fb=`~effect/Schema/SchemaError`;function iie(e){return F(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}var pb=tb;function mb(){return(e,t,n)=>Ob(new W_(e.map(Ev),e=>t(e.map(e=>Ob(e))),n))}function hb(e,t){return mb()([],()=>(t,n,r)=>e(t)?B(t):U(new _g(n,t,r)),t)}var gb=class extends ia(`SchemaError`){[fb]=fb;constructor(e){let t=rt();it(0);try{super({issue:e})}finally{it(t)}}get message(){return Fg(this.issue)}toString(){return`SchemaError(${this.message})`}};function _b(e){return iie(e)}function vb(e){return Ko(e)?aie(e):tp(e,e=>Rf(()=>Hl(e,e=>new gb(e))))}function aie(e){return uu(e)?e:au(Hl(e.cause,e=>new gb(e)))}function oie(e,t){let n;for(let r of e.reasons){if(!Pl(r)||!_b(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 yb(e){let t=Kp(e);if(uu(t))return t.value;throw oie(t.cause,`Sync adapter can only throw schema errors`)}function bb(e,t){return eie(e,t)}var sie=Are;function xb(e,t){let n=Yy(e,t);return(e,t)=>vb(n(e,t))}var Sb=xb,cie=Pre;function Cb(e,t){let n=Fre(e,t);return(e,t)=>Pr(n(e,t),e=>new gb(e))}function wb(e,t){let n=xb(e,t);return(e,t)=>yb(n(e,t))}var lie=wb;function Tb(e,t){let n=Ire(e,t);return(e,t)=>vb(n(e,t))}var Eb=Tb;function uie(e,t){let n=Tb(e,t);return(e,t)=>yb(n(e,t))}var Db=uie,Ob=rb;function kb(e){return F(e,pb)&&e[pb]===pb}var Ab=ub(e=>Ob(_y(e.ast),{schema:e})),W=ub(e=>{let t=Yb(e);return Ob(tre(e.ast),{schema:t})}),jb=ub(e=>Ob(vy(e.ast),{schema:e})),Mb=ub(e=>Ob(xy(e.ast),{schema:e})),Nb=ub(e=>Ob(Sy(e.ast),{schema:e}));function G(e){let t=Ob(new Q_(e),{literal:e,transform(n){return t.pipe(Xb(G(n),{decode:Kg(()=>n),encode:Kg(()=>e)}))}});return t}var Pb=Ob(X_),Fb=Ob(Z_),die=Ob(G_),Ib=Ob(J_),K=Ob(ev),Lb=Ob(rv),Rb=Ob(iv),fie=Ob(av),zb=Ob(Y_);function Bb(e,t){return Ob(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Bb(Tv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function q(e){return Bb(Tv(e,void 0),e)}function Vb(e,t){return Ob(ore(e.ast,t.ast),{key:e,value:t})}function Hb(e,t){return Ob(e,{elements:t,mapElements(e,t){let n=e(this.elements);return Hb(Dv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Ub(e){return Hb(Dv(e),e)}var J=ub(e=>Ob(new ov(!1,[],[e.ast]),{value:e})),Wb=ub(e=>Ob(new ov(!1,[e.ast],[e.ast]),{value:e}));function Gb(e,t){return Ob(e,{members:t,mapMembers(e,t){let n=e(this.members);return Gb(Ov(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Kb(e,t){return Gb(Ov(e,t,void 0),e)}function qb(e){let t=e.map(G);return Ob(Ov(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return Kb(e(this.members))},pick(e){return qb(e)},transform(e){return Kb(t.map((t,n)=>t.transform(e[n])))}})}var Jb=ub(e=>Kb([e,die])),Yb=ub(e=>Kb([e,Ib]));function pie(e){return t=>Ob(t.ast,{schema:t,identifier:e})}function mie(e){return t=>Ob(py(t.ast,new o_(e,o)),{schema:t})}function hie(e){return gie(e)}function gie(e){return t=>mie(Tne(e))(t)}function Xb(e,t){return n=>Ob(ire(n.ast,e.ast,t?u_(t):h_()),{from:n,to:e})}function _ie(){return(e,t)=>rx()(e,{decode:t,encode:Ug})}function Zb(e){return t=>Xb(Mb(t),e)(t)}function Qb(e){return t=>Ob(rre(t.ast,e),{schema:t})}function $b(e){return tp(e,e=>Rf(()=>Hl(e,e=>e.issue)))}function ex(e,t){let n=t?.encodingStrategy===`omit`?Xg():Gg();return t=>Ab(Nb(t)).pipe(Xb(t,{decode:Zg($b(e)),encode:n}))}function vie(e,t){let n=t?.encodingStrategy===`omit`?Xg():Gg();return t=>W(Nb(t)).pipe(Xb(t,{decode:Zg($b(e)),encode:n}))}function tx(e){return G(e).pipe(Qb(B(e)))}function yie(e,t){return q({_tag:tx(e),...t})}function nx(e,t){return hb(t=>t instanceof e,t)}function rx(){return(e,t)=>new z_(e.ast,u_(t))}var ix=Jv;function ax(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 Qv(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}var bie=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 ox(e,t){let n=bie(e);return ax(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 sx=Ob(Xv);function xie(e){let t=Mn(e.order),n=e.formatter??Ue;return(r,i)=>ix(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function Sie(e){let t=Pn(e.order),n=e.formatter??Ue;return(r,i)=>ix(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 Cie(e){let t=Nn(e.order),n=e.formatter??Ue;return(r,i)=>ix(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 wie(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 ix(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 cx(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Ue(e)}`);return e}var lx=xie({order:An,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:cx(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Ue(e)})`})})}),ux=Sie({order:An,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:cx(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Ue(e)})`})})}),dx=Cie({order:An,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:cx(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Ue(e)})`})})}),fx=wie({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:cx(e.minimum),maximum:cx(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 px(e){return ix(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 mx=Lb.check(px());function hx(e,t){return e=vx(e),gx(e,Math.ceil(e/2),t)}function gx(e,t,n){return ix(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})`}),[Zh]:!0,arbitraryConstraint:{minLength:e},...n})}function Tie(e){return gx(1,1,e)}function _x(e,t){return e=vx(e),ix(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})`}),[Zh]:!0,arbitraryConstraint:{maxLength:e},...t})}function vx(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function Eie(e,t){return e=vx(e),ix(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})`}),[Zh]:!0,arbitraryConstraint:{minProperties:e},...t})}function Die(e,t){let n=Nb(e),r=Nre(n.ast);return ix((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 pg([e],t)),n.errors===`first`))break}return!Zr(a)||new gg(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})`}),[Zh]:!0,...t})}var yx=K.check(Tie()),Oie=e=>+(e?.includeStack===!0)|(e?.excludeCause===!0?2:0),kie=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},bx=[];function xx(e){let t=Oie(e),n=bx[t];if(n!==void 0)return n;let r=Bie.pipe(Xb(Fb,w_(kie(t))));return bx[t]=r,r}globalThis.RegExp;var Sx=K.annotate({expected:`a string that will be decoded as a URL`}),Aie=nx(globalThis.URL,{representation:{id:`effect/schema/URL`,payload:null},toCode:()=>({runtime:`Schema.URL`,Type:`globalThis.URL`}),expected:`URL`,toCodecJson:()=>rx()(Sx,T_)}),Cx=Sx.pipe(Xb(Aie,T_)),jie=K.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function wx(e,t){return jie.pipe(Xb(e,D_(t)))}var Mie=wx(Fb);globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var Tx=K.annotate({expected:`a string that will be decoded as a number`}).pipe(Xb(Lb,g_)),Ex=K.annotate({expected:`a string that will be decoded as a finite number`}).pipe(Xb(sx,g_)),Nie=K.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),Pie=nx(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>rx()(Nie,E_)});function Dx(e,t){return Ob(mb()([e,t],([e,t])=>(n,r,i)=>{if(!Nl(n))return U(new _g(r,n,i));switch(n._tag){case`Fail`:return $p(Yy(e)(n.error,i),{onSuccess:zl,onFailure:e=>yg(r,`error`,e,n,i)});case`Die`:return $p(Yy(t)(n.defect,i),{onSuccess:Bl,onFailure:e=>yg(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])=>rx()(Kb([q({_tag:G(`Fail`),error:e}),q({_tag:G(`Die`),defect:t}),q({_tag:G(`Interrupt`),fiberId:Yb(sx)})]),f_({decode:e=>{switch(e._tag){case`Fail`:return zl(e.error);case`Die`:return Bl(e.defect);case`Interrupt`:return Vl(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 Ox(e,t){return Ob(mb()([e,t],([e,t])=>{let n=J(Dx(e,t));return(e,t,r)=>Ml(e)?$p(Yy(n)(e.reasons,r),{onSuccess:Fl,onFailure:n=>yg(t,`failures`,n,e,r)}):U(new _g(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])=>rx()(J(Dx(e,t)),f_({decode:Fl,encode:({reasons:e})=>e}))}).ast,{error:e,defect:t})}var kx=d_({decode:(e,t)=>Bn(Une(e),{onNone:()=>U(new vg({expected:`a valid UTC DateTime string`},e,t)),onSome:e=>B(Kne(e))}),encode:e=>B(mm(e))}),Fie=-864e13,Iie=864e13;function Ax(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 Lie(e,t){return mx.check(fx({minimum:e,maximum:t}))}var jx=hb(e=>Vne(e)&&Hne(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]=Ax(e,Fie,Iie);return _ie()(Lie(t,n),Kg(dm))},toCodecJson:()=>rx()(K,kx),toFormatter:()=>e=>e.toString()}),Mx=K.annotate({expected:`a string that will be decoded as a DateTime.Utc`}).pipe(Xb(jx,kx)),Nx=hb(xi,{representation:{id:`effect/schema/Duration`,payload:null},toCode:()=>({runtime:`Schema.Duration`,Type:`Duration.Duration`,importDeclarations:[`import * as Duration from "effect/Duration"`]}),expected:`Duration`,toCodecJson:()=>rx()(Kb([q({_tag:G(`Infinity`)}),q({_tag:G(`NegativeInfinity`)}),q({_tag:G(`Nanos`),value:fie}),q({_tag:G(`Millis`),value:mx})]),f_({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 Px(e,t,n){return Ob(mb()([e,t,n],([e,t,n])=>{let r=Ox(t,n);return(t,n,i)=>{if(!ru(t))return U(new _g(n,t,i));switch(t._tag){case`Success`:return $p(Yy(e)(t.value,i),{onSuccess:iu,onFailure:e=>yg(n,`value`,e,t,i)});case`Failure`:return $p(Yy(r)(t.cause,i),{onSuccess:au,onFailure:e=>yg(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])=>rx()(Kb([q({_tag:G(`Success`),value:e}),q({_tag:G(`Failure`),cause:Ox(t,n)})]),f_({decode:e=>e._tag===`Success`?iu(e.value):au(e.cause),encode:e=>uu(e)?{_tag:`Success`,value:e.value}:{_tag:`Failure`,cause:e.cause}}))}).ast,{value:e,error:t,defect:n})}var Rie=hb(Ih,{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:()=>Vh,toCodec:()=>rx()(J(Ub([K,K])),f_({decode:Rh,encode:e=>e.params}))}).pipe(Xb(Vb(K,Kb([K,Wb(K)])),f_({decode:Jh,encode:zh})));function Fx(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:Yy(G(n));return Ob(mb()([e],([e])=>(t,n,r)=>gh(t)?em(a===void 0?Nf:Qp(a(t.label,r),e=>new pg([`label`],e)),()=>$p(Yy(e)(yh(t),r),{onSuccess:e=>_h(e,{label:t.label}),onFailure:()=>new gg(n,[new pg([`value`],new vg(void 0,t,r))],t,r)})):U(new _g(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])=>rx()(e,{decode:Kg(e=>_h(e,{label:n})),encode:r?Hg(e=>`Cannot serialize Redacted`+(zn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):Kg(yh)}),toEquivalence:([e])=>bh(e)}).ast,{value:e})}function zie(e,t){return Xb(Fx(Mb(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Kg(e=>_h(e,{label:t?.label})),encode:t?.disallowEncode?Hg(e=>`Cannot encode Redacted`+(zn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):Kg(yh)})(e)}var Ix=globalThis.Symbol.for(`immer-draftable`),Lx={};function Rx(e,t,r,i,a){let o=Vx(r,t,i),s=Bx(t),c=class extends e{constructor(...[e,t]){let n=t?.[`~payload`],i=n?.token===Lx?n.value:r.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:Lx,value:i}})}static[pb]=pb;get[s](){return s}static[Ix]=!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 Jy(o(this))(e??{},t)}static makeOption(e,t){return qy(o(this))(e??{},t)}static makeEffect(e,t){return o(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(ay(this.ast,e))}static annotateKey(e){return this.rebuild(gy(this.ast,e))}static check(...e){return this.rebuild(sy(this.ast,e))}static extend(e){return(t,n)=>{let i=Hx(t)?t:q(t),o={...r.fields,...i.fields},s=Tv(o,r.ast.checks,{identifier:e});return Rx(this,e,Bb(sy(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 zx(e){return new c_(Kg(t=>new e(t,{"~payload":{token:Lx,value:t}})),Gg())}function Bx(e){return`~effect/Schema/Class/${e}`}function Vx(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=Bx(t),o=e=>e instanceof i||F(e,a),s=zx(i);return r=Xb(Ob(new W_([e.ast],()=>(e,t,n)=>o(e)?B(e):U(new _g(t,e,n)),{identifier:t,[$h]:([e])=>({isConstructed:o,link:new z_(e,s)}),toCodec:([e])=>new z_(e.ast,s),toEquivalence:([e])=>e,toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[Qh]:jv(e.ast),...n})),s)(e)}}function Hx(e){return kb(e)}var Ux=e=>(t,n)=>Rx(ta,e,Hx(t)?t:q(t),n,e=>({toString(){return`${e}(${Ue({...this})})`}})),Wx=e=>(t,n)=>Rx(Zt,e,Hx(t)?t:q(t),n,e=>({name:e})),Y=e=>(t,n,r)=>{let i=Hx(n)?n.mapFields(e=>({_tag:tx(t),...e}),{unsafePreserveChecks:!0}):yie(t,n);return Wx(e??t)(i,r)},Gx=Gre,Kx=Jre,Bie=Ob(ay(Fy,{toCode:()=>({runtime:`Schema.Json`,Type:`Schema.Json`})})),Vie=Ob(ay(bre,{toCode:()=>({runtime:`Schema.MutableJson`,Type:`Schema.MutableJson`})})),qx=`~effect/reactivity/AsyncResult`,Jx=e=>F(e,qx),Yx={[qx]:{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))}},Xx=e=>e.waiting,Zx=(e,t)=>e._tag===`Success`?rS(e.value):oS(e.cause,{previous:t}),Qx=e=>e._tag===`None`?tS(!0):cS(e.value),$x=e=>e._tag===`Initial`,eS=e=>e._tag!==`Initial`,tS=(e=!1)=>{let t=Object.create(Yx);return t._tag=`Initial`,t.waiting=e,t},nS=e=>e._tag===`Success`,rS=(e,t)=>{let n=Object.create(Yx);return n._tag=`Success`,n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},iS=e=>e._tag===`Failure`,aS=(e,t)=>{let n=Object.create(Yx);return n._tag=`Failure`,n.cause=e,n.previousSuccess=t?.previousSuccess??In(),n.waiting=t?.waiting??!1,n},oS=(e,t)=>aS(e,{previousSuccess:Jn(t.previous,e=>nS(e)?Ln(e):iS(e)?e.previousSuccess:In()),waiting:t.waiting}),sS=(e,t)=>oS(Il(e),t),cS=a(e=>Jx(e[0]),(e,t)=>{if(e.waiting)return t?.touch?lS(e):e;let n=Object.assign(Object.create(Yx),e);return n.waiting=!0,t?.touch&&nS(n)&&(n.timestamp=Date.now()),n}),lS=e=>nS(e)?rS(e.value,{waiting:e.waiting}):e,uS=a(2,(e,t)=>e._tag===`Failure`?oS(e.cause,{previous:t,waiting:e.waiting}):e),dS=e=>e._tag===`Success`?Ln(e.value):e._tag===`Failure`?qn(e.previousSuccess,e=>e.value):In(),fS=e=>Gn(dS(e),()=>new Xl(`AsyncResult.getOrThrow: no value found`)),pS=e=>{switch(e._tag){case`Success`:return iu(e.value);case`Failure`:return au(e.cause);default:return ou(new Xl)}},mS=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return aS(e.cause,{previousSuccess:qn(e.previousSuccess,e=>rS(t(e.value),e)),waiting:e.waiting});case`Success`:return rS(t(e.value),e)}}),hS=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return aS(e.cause,{previousSuccess:Jn(e.previousSuccess,e=>{let n=t(e.value,e);return nS(n)?Ln(n):In()}),waiting:e.waiting});case`Success`:return t(e.value,e)}}),gS=to,_S=ro,vS=Qee,yS=io,bS=ao,xS=Za,SS=Ete,CS=Qc,wS=Pte,TS=`~effect/MutableRef`,ES={[TS]:TS,...yt,toJSON(){return{_id:`MutableRef`,current:Qe(this.current)}}},DS=e=>{let t=Object.create(ES);return t.current=e,t},OS=a(2,(e,t)=>(e.current=t,e)),kS=Symbol.for(`effect/MutableList/Empty`),AS=()=>({head:void 0,tail:void 0,length:0}),jS=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})},MS=()=>({array:[],mutable:!0,offset:0,next:void 0}),NS=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=MS(),e.tail=e.tail.next):e.head=e.tail=MS(),e.tail.array.push(t),e.length++},Hie=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||=e.head,e.length++},Uie=(e,t)=>Wie(e,qr(t),!Array.isArray(t)),Wie=(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},PS=e=>{e.head=e.tail=void 0,e.length=0},FS=(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 PS(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?PS(e):jS(e),n;i=i.next}return PS(e),n},Gie=e=>FS(e,e.length),IS=e=>{if(!e.head)return kS;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:PS(e):jS(e),t},Kie=(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){PS(e);return}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length},qie=(e,t)=>Kie(e,e=>e!==t),Jie=`~effect/PubSub`,Yie=`~effect/PubSub/Subscription`,Xie=e=>V(()=>BS(e.atomicPubSub(),new Map,Su(),CS(!1),DS(!1),e.strategy(),DS(In()))),Zie=e=>Xie({atomicPubSub:()=>Qie(e),strategy:()=>new VS}),Qie=e=>{let t=e?.replay;return new oae(t&&t>0?new WS(Math.ceil(t)):void 0)},LS=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),$ie=e=>jp(mp(t=>{let n=yr(t,xu),r=Du(e.scope),i=aae(e.pubsub,e.subscribers,e.strategy,e.ended);return Tu(r,eae(i)).pipe(Gf(wu(n,e=>Ou(r,e))),Xf(i))})),eae=e=>jp(Hf(t=>(OS(e.shutdownFlag,!0),Df(Gie(e.pollers),e=>Qte(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(Kf(()=>V(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),pne(e.shutdownHook.open),Qf)))),tae=e=>Mf(function t(n){if(e.shutdownFlag.current)return Op;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):Uf(nae(e),e=>t([e]))}),nae=e=>Ff(t=>{if(e.shutdownFlag.current)return t(Op);if(zn(e.ended.current))return t(B(e.ended.current.value));let n=hu(),r=e.subscribers.get(e.subscription);return r||(r=new Set,e.subscribers.set(e.subscription,r)),r.add(e.pollers),NS(e.pollers,n),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),n.effect?t(n.effect):(n.resumes=[t],V(()=>qie(e.pollers,n)))}),RS=Symbol.for(`effect/PubSub/AbsentValue`),rae=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},iae=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},aae=(e,t,n,r)=>new cae(e,t,e.subscribe(),AS(),CS(!1),DS(!1),n,e.replayWindow(),r),oae=class{publisherHead={value:RS,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 GS(this.replayBuffer):KS}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=RS,this.subscribersIndex+=1,this.replayBuffer?.slide(t,e.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new sae(this,this.publisherTail,this.publisherIndex,!1)}},sae=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===RS?(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 kS;let e=!0,t=kS;for(;e;)if(this.subscriberHead===this.self.publisherTail)e=!1;else{let n=this.subscriberHead.next.value;n!==RS&&(t=n,--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=RS,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===kS?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!==RS&&(--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=RS,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},cae=class{[Yie]={_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)}},zS=class{[Jie]={_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)}},BS=(e,t,n,r,i,a,o)=>new zS(e,t,n,r,i,a,o),VS=class{get shutdown(){return Nf}handleSurplus(e,t,n,r){return B(!1)}onPubSubEmptySpaceUnsafe(e,t){}completePollersUnsafe(e,t,n,r){return HS(this,e,t,n,r)}completeSubscribersUnsafe(e,t){return US(this,e,t)}},HS=(e,t,n,r,i)=>{let a=!0;for(;a&&!r.isEmpty();){let o=IS(i);if(o===kS)iae(n,r,i),i.length===0?a=!1:rae(n,r,i);else{let a=r.poll();a===kS?Hie(i,o):(bu(o,iu(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},US=(e,t,n)=>{for(let[r,i]of n)for(let a of i)e.completePollersUnsafe(t,n,r,a)},WS=class{capacity;head={value:RS,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:RS,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)}},GS=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]=RS,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)}},KS={remaining:0,take:()=>void 0,takeN:()=>[],takeAll:()=>[],close:()=>void 0},qS=`~effect/Queue`,JS=`~effect/Queue/Enqueue`,YS=`~effect/Queue/Dequeue`,XS={_A:o,_E:o},ZS={[qS]:XS,[JS]:XS,[YS]:XS,...yt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:mC(this)}}},QS=e=>Yt(t=>{let n=Object.create(ZS);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=AS(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},oo(n)}),$S=e=>QS({capacity:e}),eC=e=>QS({capacity:e,strategy:`sliding`}),tC=a(2,(e,t)=>uo(()=>nC(e,t)?gC:e.state._tag===`Open`&&e.strategy===`suspend`?wC(e,t):hC)),nC=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(IS(e.messages),NS(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0&&(NS(e.messages,t),yC(e),!0):(NS(e.messages,t),bC(e),!0):!1,rC=a(2,(e,t)=>vo(n=>{let r=iC(e,t);return r.length===0||e.strategy===`dropping`?n(Ut(r)):TC(e,{_tag:`Array`,remaining:r,offset:0,resume:n})})),iC=(e,t)=>{if(e.state._tag!==`Open`)return qr(t);if(e.capacity===1/0||e.strategy===`sliding`)return Uie(e.messages,t),e.strategy===`sliding`&&FS(e.messages,e.messages.length-e.capacity),bC(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?NS(e.messages,a):r.push(a),i++;return bC(e),r},aC=a(2,(e,t)=>lo(()=>oC(e,t))),oC=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=ls(Kt(t),_C);return e.state.offers.size===0&&e.messages.length===0?(kC(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},bC(e),!0)},sC=e=>aC(e,Pt(an())),cC=e=>lo(()=>lC(e)),lC=e=>{if(e.state._tag===`Done`)return!1;PS(e.messages);let t=e.state.offers;kC(e,e.state._tag===`Open`?vC:e.state.exit);for(let e of t)EC(e);return!0},uC=e=>dC(e,1,1/0),dC=a(3,(e,t,n)=>(t=Or(t),n=Or(n),uo(()=>xC(e,t,n)??Bo(CC(e,()=>SC(e,t)),dC(e,t,n))))),fC=e=>uo(()=>pC(e)??Bo(CC(e,()=>SC(e,1)),fC(e))),pC=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=IS(e.messages);return OC(e),Ut(t)}if(e.capacity<=0&&e.state.offers.size>0){let t=DC(e.state.offers);return OC(e),Ut(t)}},mC=e=>e.state._tag===`Done`?0:e.messages.length,hC=Ut(!1),gC=Ut(!0),_C=qt(an()),vC=es(),yC=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(as),e.messages.length===0))break}},bC=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,yC(e)},0))},xC=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return Ut([]);if(!SC(e,t))return;let r=e.messages.length>0?FS(e.messages,n):[DC(e.state.offers)];return OC(e),Ut(r)},SC=(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,CC=(e,t)=>vo(n=>{if(e.state._tag===`Done`)return n(e.state.exit);if(t())return n(as);let r={ready:t,resume:n};return e.state.takers.add(r),lo(()=>{e.state._tag!==`Done`&&e.state.takers.delete(r)})}),wC=(e,t)=>vo(n=>nC(e,t)?n(gC):TC(e,{_tag:`Single`,message:t,resume:n})),TC=(e,t)=>{if(e.state._tag!==`Open`)return EC(t);let n=e.state.offers;return n.add(t),lo(()=>{e.state._tag!==`Done`&&(n.delete(t),e.state._tag===`Closing`&&n.size===0&&e.messages.length===0&&kC(e,e.state.exit))})},EC=e=>e._tag===`Single`?e.resume(hC):e.resume(Ut(e.remaining.slice(e.offset))),DC=e=>{let t=e.values().next().value;if(t._tag===`Single`)return e.delete(t),t.resume(gC),t.message;let n=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Ut([]))),n},OC=e=>{if(e.state._tag===`Done`)return Qd(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0&&(kC(e,e.state.exit),Qd(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`)NS(e.messages,t.message),e.state.offers.delete(t),t.resume(gC);else{for(;t.offset<t.remaining.length;t.offset++){if(n===0)return!1;NS(e.messages,t.remaining[t.offset]),n--}e.state.offers.delete(t),t.resume(Ut([]))}}return!1},kC=(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()},AC=e=>new MC(e),jC=(e,t,n)=>vo(r=>{if(e.free>=t)return r(n);let i=()=>{e.free<t||(e.waiters.delete(i),r(n))};return e.waiters.add(i),lo(()=>{e.waiters.delete(i)})}),MC=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=uo(()=>this.free<e?jC(this,e,t):(this.taken+=e,oo(e)));return t}takeIfAvailable(e){return uo(()=>this.free<e?oo(!1):(this.taken+=e,oo(!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),go))}release(e){return Yt(t=>oo(this.releaseUnsafe(t,e)))}get releaseAll(){return Yt(e=>oo(this.releaseUnsafe(e,this.taken)))}withPermits(e){return t=>Pc(n=>{let r=uo(()=>this.free<e?Go(n(jC(this,e,go)),()=>r):(this.taken+=e,Dc(n(t),()=>{this.releaseUnsafe(Za(),e)},!0)));return r})}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>Pc(n=>this.free<e?po:(this.taken+=e,Dc(n(zo(t)),()=>{this.releaseUnsafe(Za(),e)},!0)))}},NC=e=>lo(()=>new MC(e)),PC=(e,t)=>t?e.withPermit(t):e.withPermit,FC=`~effect/Channel`,IC=e=>F(e,FC),LC={[FC]:{_Env:o,_InErr:o,_InElem:o,_OutErr:o,_OutElem:o},pipe(){return n(this,arguments)}},RC=e=>{let t=Object.create(LC);return t.transform=(t,n)=>tp(e(t,n),e=>B(Lf(e))),t},zC=(e,t)=>RC((n,r)=>Uf(HC(e)(n,r),e=>t(e,r))),BC=e=>RC((t,n)=>e),VC=e=>RC(qp(function*(t,n){let r=Du(n),i=e=>Ou(r,nf(e));return Tp(yield*Tp(e(t,n,r),i),i)})),HC=e=>e.transform,UC=(e,t,n)=>QS({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Kf(t=>Tu(e,cC(t))),Kf(n=>Lp(Cu(t(n),e),e))),WC=(e,t)=>RC((n,r)=>Yf(UC(r,e,t),uC)),GC=e=>RC((t,n)=>Mf(()=>HC(e())(t,n))),KC=e=>BC(V(()=>{let t=e();return Mf(()=>{let e=t.next();return e.done?Ql(e.value):B(e.value)})})),qC=e=>BC(V(()=>{let t=0;return Mf(()=>t>=e.length?Ql():B(e[t++]))})),JC=e=>$C(B(e)),YC=BC(B(Ql())),XC=BC(B(If)),ZC=e=>BC(B(U(e))),QC=e=>BC(Lf(e)),$C=e=>BC(V(()=>{let t=!1;return Mf(()=>t?Ql():(t=!0,e))})),ew=e=>BC(B(uC(e))),tw=e=>BC(B(Ap(tae(e),()=>Ql()))),nw=e=>Dw(Yf($ie(e),tw)),rw=e=>RC((t,n)=>iw({scope:n,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd})),iw=e=>{let t=e.readable.getReader(),n=e.exit??DS(void 0),r=Mf(()=>n.current?n.current:fp(Af({try:()=>t.read(),catch:e.onError}),{onFailure:e=>n.current??Lf(e),onSuccess:({done:e,value:t})=>n.current?n.current:e?Ql():B(ni(t))}));return Xf(Tu(e.scope,e.releaseLockOnEnd?V(()=>t.releaseLock()):kf(()=>t.cancel().catch(d))),r)},aw=a(2,(e,t)=>zC(e,e=>V(()=>{let n=0;return Yf(e,e=>t(e,n++))}))),ow=e=>e===void 0||e!==`unbounded`&&e<=1,sw=a(e=>IC(e[0]),(e,t,n)=>ow(n?.concurrency)?cw(e,t):lw(e,t,n)),cw=(e,t)=>RC((n,r)=>{let i=0;return Yf(HC(e)(n,r),Uf(e=>t(e,i++)))}),lw=(e,t,n)=>VC(qp(function*(r,i,a){let o=0,c=yield*HC(e)(r,i),l=n.concurrency===`unbounded`?2**53-1:n.concurrency,u=yield*$S(0);yield*Tu(a,cC(u));let d=Bp(yield*pp()),f=SS(a);if(n.unordered){let e=AC(l),n=s(e.release(1)),r=fp({onFailure:e=>Uf(aC(u,e),n),onSuccess:e=>Uf(tC(u,e),n)});yield*e.take(1).pipe(Uf(()=>c),Uf(e=>{let n=o++;return f(d(r(Mf(()=>t(e,n))))),Nf}),Np({disableYield:!0}),tp(t=>e.withPermits(l-1)(aC(u,t))),Lp(a))}else{let e=yield*$S(l-2);yield*Tu(a,cC(e)),yield*fC(e).pipe(Wf,Uf(e=>tC(u,e)),Np({disableYield:!0}),tp(e=>aC(u,e)),Lp(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,oC(u,e.cause))};yield*c.pipe(Uf(i=>{if(n)return Lf(n);let a=o++,s=d(Mf(()=>t(i,a)));return f(s),s.addObserver(r),tC(e,_S(s))}),Np({disableYield:!0}),tp(t=>tC(e,au(t)).pipe(Gf(aC(e,t)))),Lp(a))}return fC(u)})),uw=a(e=>IC(e[0]),(e,t,n)=>ow(n?.concurrency)?dw(e,t):fw(e,t,n)),dw=(e,t)=>RC((n,r)=>Yf(HC(e)(n,r),e=>{let i,a,o=Uf(e,e=>(a??=Du(r),em(HC(t(e))(n,a),e=>(i=s(e),i)))),s=Zd(e=>{if(i=void 0,a.state._tag===`Empty`)return o;let t=Ou(a,lu);return a=void 0,Uf(t,()=>o)});return Mf(()=>i??o)})),fw=(e,t,n)=>e.pipe(aw(t),ww(n)),pw=e=>uw(e,o),mw=e=>zC(e,e=>{let t,n=0;return B(Mf(function r(){if(t===void 0)return Uf(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)}))}),hw=e=>zC(e,e=>B(Np(e,{disableYield:!0}))),gw=a(2,(e,t)=>ff(typeof t==`function`?t(o):t).pipe(Yf(t=>{let n=of.defaultValue();return _w(Pw(e,of,V(()=>n)),e=>t(e).pipe(Yf(e=>{n=e}),Zd(()=>Ql(e))))}),Dw)),_w=(e,t)=>RC((n,r)=>V(()=>{let i,a=()=>{let o=Du(r);return Uf(HC(e)(n,o),e=>(i=Zd(e,e=>Ou(o,lu).pipe(Uf(()=>t(e)),Uf(a))),i))};return Mf(()=>i??a())})),vw=a(2,(e,t)=>RC((n,r)=>Yf(HC(e)(n,r),e=>Uf(e,function n(r){return t(r)?B(r):Uf(e,n)})))),yw=a(2,(e,t)=>zC(e,e=>B(Uf(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):Uf(e,n)})))),bw=a(2,(e,t)=>RC((n,r)=>{let i=Du(r);return Yf(HC(e)(n,i),e=>{let a=e.pipe(tp(e=>{if(Qd(e))return Lf(e);let o=i;return i=Du(r),Ou(o,au(e)).pipe(Gf(HC(t(e))(n,i)),Uf(e=>(a=e,e)))}));return Mf(()=>a)})})),xw=a(3,(e,t,n)=>bw(e,e=>{let r=t(e);return Mr(r)?QC(r.failure):n(r.success,e)})),Sw=a(2,(e,t)=>xw(e,Wl,e=>t(e))),Cw=a(e=>IC(e[0]),(e,t,n)=>e.pipe(aw(t),ww({...n,concurrency:n?.concurrency??1,switch:!0}))),ww=a(2,(e,{bufferSize:t=16,concurrency:n,switch:r=!1})=>VC(qp(function*(i,a,o){let s=n===`unbounded`?2**53-1:Math.max(1,n),c=r?void 0:AC(s),l=yield*wS(!0),u=new Set,d=yield*$S(t);yield*Tu(o,cC(d));let f=yield*HC(e)(i,a);return yield*H(function*(){for(;;){let e;c&&(u.size<s?yield*c.take(1):(e=yield*Ip(f),yield*up(c.take(1),Gf(_S(e),If))));let t=e===void 0?yield*f:yield*_S(e),n=Du(o),r=yield*HC(t)(i,n);for(;u.size>=s;){let e=Lr(u);u.delete(e),u.size===0&&(yield*l.open),yield*yS(e)}let a=yield*r.pipe(Kf(()=>Vf),Uf(e=>tC(d,e)),Np({disableYield:!0}),Tp(qp(function*(e){let t=ef(e);if(yield*Jf(Ou(n,Mr(t)?au(t.failure):iu(t.success.value))),u.has(a)&&(u.delete(a),c&&(yield*c.release(1)),u.size===0&&(yield*l.open),!Nr(t)))return yield*aC(d,e)})),Ip);l.closeUnsafe(),u.add(a)}}).pipe(tp(e=>Nr(ef(e))?l.whenOpen(aC(d,e)):aC(d,e)),Lp(o)),fC(d)}))),Tw=a(e=>IC(e[0])&&IC(e[1]),(e,t,n)=>VC(qp(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*$S(0);yield*Tu(a,cC(s));let c=0;function l(e,t){if(c++,!Qd(t))return aC(s,t);switch(o){case`both`:return c===2?aC(s,t):Nf;case`left`:case`right`:return e===o?aC(s,t):Nf;case`either`:return aC(s,t)}}let u=(e,t,n)=>HC(t)(r,n).pipe(Uf(e=>e.pipe(Uf(e=>tC(s,e)),Np)),Tp(t=>Gf(Ou(n,nf(t)),l(e,t))),Lp(a));return yield*u(`left`,e,Du(a)),yield*u(`right`,t,Du(a)),fC(s)}))),Ew=a(2,(e,t)=>RC((n,r)=>Uf(HC(e)(n,r),e=>HC(t)(e,r)))),Dw=e=>RC((t,n)=>{let r;return B(Mf(()=>r||e.pipe(Cu(n),Uf(e=>HC(e)(t,n)),Uf(e=>r=e))))}),Ow=a(2,(e,t)=>VC((n,r,i)=>wu(i,t).pipe(Gf(HC(e)(n,r))))),kw=a(2,(e,t)=>zC(e,e=>B(Zd(e,e=>Uf(t,()=>Ql(e)))))),Aw=a(2,(e,t)=>Ow(e,e=>t)),jw=(e,t,n)=>Mf(()=>{let r=Su();return Zd(Uf(HC(e)(Ql(),r),t),n||B).pipe(Ep(e=>Ou(r,e)))}),Mw=a(2,(e,t)=>RC((n,r)=>Yf(gp(HC(e)(n,r),t),gp(t)))),Nw=a(3,(e,t,n)=>RC((r,i)=>Yf(vp(HC(e)(r,i),t,n),vp(t,n)))),Pw=a(3,(e,t,n)=>RC((r,i)=>Uf(n,n=>HC(Nw(e,t,n))(r,i)))),Fw=a(2,(e,t)=>jw(e,e=>Np(Uf(e,t),{disableYield:!0}))),Iw=e=>Mf(()=>{let t=In();return jw(e,e=>e.pipe(Zf,Uf(e=>(t=e,Ql()))),()=>B(t))}),Lw=qp(function*(e){let t=AC(1),n=yield*pp(),r=yr(n,xu);return(yield*HC(e)(Ql(),r)).pipe(gp(n),t.withPermits(1))},tp(e=>B(Lf(e)))),Rw=(e,t)=>HC(e)(Ql(),t),zw=`~effect/MutableHashMap`,lae={[zw]:zw,[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)}},Bw=()=>{let e=Object.create(lae);return e.backing=new Map,e.buckets=new Map,e},uae=(...e)=>dae(e),dae=e=>{let t=Bw();for(let[n,r]of e)Uw(t,n,r);return t},Vw=a(2,(e,t)=>{if(e.backing.has(t))return Ln(e.backing.get(t));if(Hw(t))return In();let n=z(t),r=e.buckets.get(n);return r===void 0?In():pae(e,r,t)}),Hw=e=>typeof e!=`object`&&typeof e!=`function`,fae=e=>e.backing.values(),pae=(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()},mae=a(2,(e,t)=>zn(Vw(e,t))),Uw=a(3,(e,t,n)=>{if(e.backing.has(t)||Hw(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=hae(i,t);return a===void 0&&(i.push(t),a=t),e.backing.set(a,n),e}),hae=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(ye(t,e[n]))return e[n]},Ww=a(2,(e,t)=>{if(Hw(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}),gae=e=>(e.backing.clear(),e.buckets.clear(),e),Gw=e=>e.backing.size,Kw=`~effect/PlatformError`,_ae=class extends ia(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},vae=class extends ra{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}},qw=class extends ia(`PlatformError`){constructor(e){`cause`in e?super({reason:e,cause:e.cause}):super({reason:e})}[Kw]=Kw;get message(){return this.reason.message}},Jw=e=>new qw(new vae(e)),yae=e=>new qw(new _ae(e)),bae=`~effect/Stream`,xae={_R:o,_E:o,_A:o},Yw=function(e){this.channel=e};Yw.prototype={[bae]:xae,pipe(){return n(this,arguments)}};var Sae=e=>new Yw(e),Xw=`~effect/RcMap`,Cae=e=>({[Xw]:Xw,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:`Open`,map:Bw()},pipe(){return n(this,arguments)}}),wae=e=>Hf(t=>{let n=t.context,r=yr(n,xu),i=Cae({lookup:e.lookup,context:n,scope:r,idleTimeToLive:typeof e.idleTimeToLive==`function`?p(e.idleTimeToLive,mi):s(mi(e.idleTimeToLive??Ti)),capacity:Math.max(e.capacity??1/0,0)});return Xf(wu(r,()=>{if(i.state._tag===`Closed`)return Nf;let e=i.state.map;return i.state={_tag:`Closed`},Df(e,([,e])=>Jf(Zw(e))).pipe(Kf(()=>V(()=>{gae(e)})))}),i)}),Tae=a(2,(e,t)=>Mp(n=>{if(e.state._tag===`Closed`)return Op;let r=e.state,i=xS(),a=Vw(r.map,t),o;if(a._tag===`Some`)o=a.value,o.refCount++;else if(Number.isFinite(e.capacity)&&Gw(e.state.map)>=e.capacity)return U(new eu(`RcMap attempted to exceed capacity of ${e.capacity}`));else{o={deferred:hu(),scope:Su(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},o.finalizer=Dae(e,t,o),Uw(r.map,t,o);let n=new Map(e.context.mapUnsafe);i.context.mapUnsafe.forEach((e,t)=>{n.set(t,e)}),n.set(xu.key,o.scope);let a=ur(n);Mf(()=>e.lookup(t)).pipe(Bp(a),SS(o.scope)).addObserver(n=>{fu(n)&&Eae(e,t,o,a),bu(o.deferred,n)})}return Tu(vr(i.context,xu),o.finalizer).pipe(Gf(n(_u(o.deferred))))})),Eae=(e,t,n,r)=>{if(e.state._tag===`Closed`)return;let i=Vw(e.state.map,t);i._tag!==`None`&&i.value===n&&(Ww(e.state.map,t),!(n.refCount>0)&&Zw(n).pipe(Bp(r),SS(e.scope)))},Zw=e=>e.fiber?yS(e.fiber).pipe(Gf(Ou(e.scope,lu))):Ou(e.scope,lu),Dae=(e,t,n)=>Hf(r=>{if(n.refCount--,n.refCount>0)return Nf;if(e.state._tag===`Closed`)return Zw(n);let i=Vw(e.state.map,t);if(i._tag===`None`||i.value!==n)return Zw(n);if(Ci(n.idleTimeToLive))return Ww(e.state.map,t),Zw(n);if(!Si(n.idleTimeToLive))return Nf;let a=r.getRef(rd);return n.expiresAt=a.currentTimeMillisUnsafe()+Fi(n.idleTimeToLive),n.fiber||=Mp(function r(i){let o=a.currentTimeMillisUnsafe(),s=n.expiresAt-o;if(s<=0){if(e.state._tag===`Closed`||n.refCount>0)return Nf;let r=Vw(e.state.map,t);return r._tag===`None`||r.value!==n?Nf:(Ww(e.state.map,t),Ou(n.scope,lu))}return Uf(i(a.sleep(ki(s))),()=>r(i))}).pipe(wp(V(()=>{n.fiber=void 0})),Bp(r.context),SS(e.scope)),Nf}),Oae=`~effect/Stream`,Qw=e=>F(e,Oae),$w=Sae,eT=e=>$w($C(Yf(e,ni))),kae=e=>$w(BC(e)),tT=(e,t)=>$w(RC((n,r)=>Uf(Rw(e.channel,r),e=>t(e,r)))),nT=e=>e.channel,rT=(e,t)=>$w(WC(e,t)),iT=$w(YC),aT=e=>$w(JC(ni(e))),Aae=(...e)=>Nae(e),oT=e=>$w(GC(()=>e().channel)),jae=e=>$w(ZC(e)),Mae=e=>$w(QC(e)),Nae=e=>Qr(e)?$w(JC(e)):iT,sT=e=>$w(ew(e)),Pae=e=>$w(nw(e)),Fae=e=>$w(rw(e)),Iae=(e,t)=>kae(V(()=>{let n=e,r=!1;return Mf(function e(){return r?Ql():Uf(t(n),([t,i])=>(Rn(i)?r=!0:n=i.value,Qr(t)?B(t):e()))})})),Lae=$w(XC),cT=e=>$w(Dw(Yf(e,nT))),lT=a(2,(e,t)=>oT(()=>{let n=0;return $w(aw(e.channel,ri(e=>t(e,n++))))})),uT=a(e=>Qw(e[0]),(e,t,n)=>e.channel.pipe(mw,sw(t,n),aw(ni),$w)),Rae=a(e=>Qw(e[0]),(e,t,n)=>e.channel.pipe(mw,Cw(e=>t(e).channel,n),$w)),zae=e=>$w(hw(e.channel)),dT=a(2,(e,t)=>$w(gw(e.channel,t))),fT=a(2,(e,t)=>{let n=$w(pw(KC(()=>Bae(e,t))));return pT.set(n,[e,t]),n}),pT=new WeakMap;function*Bae(e,t){let n=[t,e];for(;n.length>0;){let e=n.pop(),t=pT.get(e);t===void 0?yield e.channel:n.push(t[1],t[0])}}var Vae=a(e=>Qw(e[0])&&Qw(e[1]),(e,t,n)=>$w(Tw(nT(e),nT(t),n))),Hae=(...e)=>$w(GC(()=>{let t=[],n=new Set,r=CS();return ww(qC(e.map((i,a)=>i.channel.pipe(mw,sw(i=>(t[a]=i,n.has(a)?B(ni(t.slice())):(n.add(a),n.size<e.length?r.await:Xf(r.open,ni(t.slice()))))),vw(k)))),{concurrency:`unbounded`,bufferSize:0})})),Uae=a(3,(e,t,n)=>lT(Hae(e,t),([e,t])=>n(e,t))),mT=a(2,(e,t)=>$w(yw(nT(e),t))),Wae=a(2,(e,t)=>$w(Sw(e.channel,e=>t(e).channel))),Gae=a(e=>Qw(e[0]),(e,t,n)=>tT(e,(e,r)=>V(()=>{let r=0,i=!1;return Uf(Mf(()=>i?Ql():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):Ql()}return B(e)})}))),Kae=a(2,(e,t)=>$w(Ew(e.channel,t))),qae=a(e=>Qw(e[0]),(e,t)=>oT(()=>{let n=new TextDecoder(t?.encoding);return lT(e,e=>n.decode(e,{stream:!0}))})),Jae=a(2,(e,t)=>$w(kw(e.channel,t))),hT=a(2,(e,t)=>$w(Aw(e.channel,t))),gT=a(2,(e,t)=>$w(Mw(e.channel,t))),_T=e=>Yf(Iw(e.channel),qn(ei(0))),vT=a(2,(e,t)=>Fw(e.channel,e=>{let n=0;return Of({while:()=>n<e.length,body:()=>t(e[n++]),step:d})})),yT=a(2,(e,t)=>Fw(e.channel,t)),Yae=e=>Lw(e.channel),Xae=a(e=>Qw(e[0]),(e,t,n)=>{let r,i,a=CS(!1);return new ReadableStream({start(n){i=zp(gp(yT(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(Ul(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return Hp(Qf(yS(i)))}},n?.strategy)}),Zae=a(e=>Qw(e[0]),(e,t)=>Yf(pp(),n=>Xae(e,n,t))),bT=`~effect/reactivity/Reactivity`,xT=tr(`effect/reactivity/Reactivity`),Qae=V(()=>{let e=new Map,t=t=>{ET(t,t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})},n=e=>mp(n=>{let r=gr(n,ST);return r?ET(e,e=>{r.add(e)}):t(e),Nf}),r=(e,t)=>Kf(t,n(e)),i=(t,n)=>{let r=[];return ET(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*pp(),r=yr(n,xu),a=yield*QS(),o=p(Bp(n),SS(r)),s=!1,c=!1,l=e=>{e._tag===`Failure`?oC(a,e.cause):nC(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*Tu(r,V(i(e,u))),u(),a}),o=(e,t)=>a(e,t).pipe(Yf(sT),cT),s=t=>Mf(()=>{let n=new Set;return t.pipe(vp(ST,n),Ep(t=>V(()=>{n.forEach(t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})})))});return xT.of({[bT]:bT,mutation:r,query:a,stream:o,invalidateUnsafe:t,invalidate:n,registerUnsafe:i,withBatch:s})}),ST=class extends tr()(`effect/reactivity/Reactivity/PendingInvalidation`){},$ae=a(2,(e,t)=>xT.use(n=>n.mutation(t,e))),CT=e=>xT.use(t=>t.invalidate(e)),wT=Ku(xT)(Qae);function TT(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return z(e)}}var ET=(e,t)=>{if(Array.isArray(e)){for(let n=0;n<e.length;n++)t(TT(e[n]));return}for(let n in e){t(n);let r=e[n];for(let e=0;e<r.length;e++)t(`${n}:${TT(r[e])}`)}},DT=a(2,(e,t)=>e===void 0?void 0:t(e)),eoe=a(2,(e,{onDefined:t,onUndefined:n})=>e===void 0?n():t(e)),OT=`~effect/persistence/KeyValueStore`,kT=`~effect/persistence/KeyValueStore/KeyValueStoreError`,AT=class extends ia(`KeyValueStoreError`){[kT]=kT},jT=tr(`effect/persistence/KeyValueStore`),toe=e=>jT.of({[OT]:OT,has:t=>Yf(e.get(t),k),isEmpty:Yf(e.size,e=>e===0),modify:(t,n)=>Uf(e.get(t),r=>{if(r===void 0)return Pf;let i=n(r);return Xf(e.set(t,i),i)}),modifyUint8Array:(t,n)=>Uf(e.getUint8Array(t),r=>{if(r===void 0)return Pf;let i=n(r);return Xf(e.set(t,i),i)}),...e}),noe=e=>{let t=new TextEncoder;return toe({...e,getUint8Array:n=>e.get(n).pipe(Yf(DT(e=>Fr(gm(e),{onFailure:()=>t.encode(e),onSuccess:o})))),set:(t,n)=>typeof n==`string`?e.set(t,n):Mf(()=>e.set(t,hm(n)))})},MT=`~effect/persistence/KeyValueStore/SchemaStore`,NT=(e,t)=>{let n=wx(Gx(t)),r=Sb(n),i=Eb(n),a=t=>Uf(e.get(t),eoe({onUndefined:()=>jf,onDefined:e=>Zf(r(e))})),o=(t,n)=>Uf(i(n),n=>e.set(t,n)),s=(e,t)=>Uf(a(e),n=>{if(Rn(n))return jf;let r=t(n.value);return Xf(o(e,r),Ln(r))});return{[MT]:MT,get:a,set:o,modify:s,remove:e.remove,clear:e.clear,size:e.size,has:e.has,isEmpty:e.isEmpty}},PT=e=>Wu(jT)(()=>{let t=e();return noe({get:e=>Bf({try:()=>t.getItem(e)??void 0,catch:t=>new AT({key:e,method:`get`,message:`Unable to get item with key ${e}`,cause:t})}),set:(e,n)=>Bf({try:()=>t.setItem(e,n),catch:t=>new AT({key:e,method:`set`,message:`Unable to set item with key ${e}`,cause:t})}),remove:e=>Bf({try:()=>t.removeItem(e),catch:t=>new AT({key:e,method:`remove`,message:`Unable to remove item with key ${e}`,cause:t})}),clear:Bf({try:()=>t.clear(),catch:e=>new AT({method:`clear`,message:`Unable to clear storage`,cause:e})}),size:Bf({try:()=>t.length,catch:e=>new AT({method:`size`,message:`Unable to get size`,cause:e})})})}),FT=`~effect/SubscriptionRef`,IT=e=>F(e,FT),LT={...yt,[FT]:{_A:o},toJSON(){return{_id:`SubscriptionRef`,value:this.value}}},RT=e=>Yf(Zie({replay:1}),t=>{let n=Object.create(LT);return n.semaphore=AC(1),n.value=e,n.pubsub=t,LS(n.pubsub,e),n}),zT=e=>Pae(e.pubsub),BT=e=>V(()=>e.value),VT=(e,t)=>{e.value=t,LS(e.pubsub,t)},HT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>{let[n,r]=t(e.value);return VT(e,r),n}))),UT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>VT(e,t)))),WT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>VT(e,t(e.value))))),GT=`~effect/reactivity/AtomRegistry`,KT=e=>F(e,GT),qT=e=>new rE(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),JT=tr(GT),YT=a(2,(e,t)=>rT(n=>Mf(()=>Tu(vr(xS().context,xu),V(e.subscribe(t,e=>nC(n,e),{immediate:!0})))))),XT=a(e=>KT(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return Ff(n=>{let i=e.get(t);if(i._tag!==`Initial`&&!(r&&i.waiting))return n(pS(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n(pS(e)),a())});return V(a)})}),ZT={immediate:!0},QT=e=>{e()},$T={};function eE(e,t){let n=$T;for(let r of e)try{t(r)}catch(e){n===$T&&(n=e)}if(n!==$T)throw n}var tE=`~effect-atom/atom/Atom/Serializable`,nE=e=>tE in e?e[tE].key:e,rE=class{[GT];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[GT]=GT,this.scheduler=new Zi(`sync`,t),this.schedulerAsync=new Zi(`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===aE.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,ZT)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=nE(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[tE].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 oE(this,e)}invalidateAtom=e=>{this.ensureNode(e).invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get(nE(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(nE(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(nE(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),eE(t,this.removeIdleNode)}removeIdleNode=e=>{if(this.nodeTimeoutBucket.delete(e),e.canBeRemoved){this.nodes.delete(nE(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=aE.removed;eE(e,this.destroyNode)}destroyNode=e=>{e.remove(),this.onNodeRemoved?.(e)};dispose(){this.disposed=!0,this.reset()}},iE={alive:1,initialized:2,waitingForValue:4},aE={uninitialized:iE.alive|iE.waitingForValue,stale:iE.alive|iE.initialized|iE.waitingForValue,valid:iE.alive|iE.initialized,removed:0},oE=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new lE(e,this)}registry;atom;state=aE.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 aE.uninitialized:return`uninitialized`;case aE.stale:return`stale`;case aE.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&iE.waitingForValue)!==0;)this.build();return this._value}build(){this.disposeLifetime(),this.invalidatedDuringBuild=!1;let e=cE(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&iE.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.failed=!1,this.state=aE.valid):this.setValue(t)),e.failure!==$T)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!==aE.valid)throw e;return t.failure===$T&&(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&iE.initialized)===0?In():Ln(this._value)}setInitialValue(e){if((this.state&iE.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=aE.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&iE.initialized)!==0;if(this.state=aE.valid,n&&this.atom.equals(this._value,e)){t&&this.invalidateChildren();return}this._value=e;let r=$T;try{this.invalidateChildren()}catch(e){r=e}if(this.listeners.size>0)try{this.announce()}catch(e){r===$T&&(r=e)}if(r!==$T)throw r}announce(){dE.phase===uE.collect?dE.notify.add(this):this.notify()}invalidate(){if(this.state===aE.valid){this.state=aE.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&dE.phase!==uE.collect?this.build():this.propagate()}propagate(){dE.phase===uE.collect?(this.building&&(this.invalidatedDuringBuild=!0),dE.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let e=$T;for(let t of Array.from(this.children))if(t.affectedBy(this))try{t.invalidate()}catch(t){e===$T&&(e=t)}if(e!==$T)throw e}affectedBy(e){if(this.state===aE.valid)return!0;let t=this.lifetime?.reads;return t===void 0?this.isObserved&&e.state===aE.valid:t.has(e)}notify(){dE.phase===uE.commit&&dE.notify.delete(this),eE(this.listeners,QT)}disposeLifetime(){let e=this.lifetime;e!==void 0&&(this.lifetime=void 0,e.dispose())}remove(){let e=this.isObserved;this.state=aE.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let t=Array.from(this.parents);this.parents.clear(),eE(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)}}},sE={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 If;switch(n._tag){case`Initial`:return If;case`Failure`:return au(n.cause);case`Success`:return B(n.value)}},resultOnce(e,t){return Ff(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n(pS(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n(pS(e)))},{immediate:!1});return V(i)})},setResult(e,t){return this.disposed?If:(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`?If:B(t.value)},someOnce(e){return Ff(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?iT:rT(n=>V(()=>{this.subscribe(e,e=>nC(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(mT(eS),uT(e=>e._tag===`Success`?B(e.value):Lf(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,eE(e.reverse(),QT)}},cE=e=>{function t(n){return t.disposed||t.isFn?e.registry.get(n):e.readTracked(n,t)}return Object.setPrototypeOf(t,sE),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=$T,t},lE=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()}},uE={disabled:0,collect:1,commit:2},dE={phase:uE.disabled,depth:0,stale:[],notify:new Set};function fE(e){let t=dE.phase;dE.phase=uE.collect,dE.depth++;let n=$T;try{e()}catch(e){n=e}if(dE.depth===1){let{notify:e,stale:t}=dE,r=0;do{for(dE.phase=uE.collect;r<t.length;r++)try{pE(t[r])}catch(e){n===$T&&(n=e)}dE.phase=uE.commit;for(let t of e)try{t.notify()}catch(e){n===$T&&(n=e)}}while(r<t.length);dE.stale=[],e.clear()}if(dE.depth--,dE.phase=t,n!==$T)throw n}function pE(e){if(e.state===aE.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=aE.stale,e.disposeLifetime()}e.value()}var mE=`~effect/reactivity/Atom`,hE=e=>F(e,mE),gE=`~effect/reactivity/Atom/Writable`,_E=a(2,(e,t)=>{let n=mi(t),r=Si(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Fi(n):void 0})}),vE=_E(0),yE={[mE]:mE,equals:Object.is,...yt,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},bE={...yE,atom(e,t){let n=OE(e,t);return wE(e=>{let t=e.self(),r=e(this);return r._tag===`Success`?n(e,r.value):uS(r,t)})},fn(e,t){return arguments.length===0?(e,t)=>xE(this,e,t):xE(this,e,t)},pull(e,t){let n=vE(jE(0));return YE(n,wE(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?NE(r,JE(r,n,e,t),tS(!0),a.value):uS(a,i)}))},subscriptionRef(e){return BE(vE(wE(t=>{let n=t.self(),r=t(this);if(r._tag!==`Success`)return uS(r,n);let i=typeof e==`function`?e(t):e;return IT(i)?i:NE(t,i,tS(!0),r.value)})),(e,t)=>zE(e,t,fS(e(this))))}},xE=(e,t,n)=>{let[r,i,a]=qE(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return Tf(i)?$ae(i,n.reactivityKeys):hT(i,CT(n.reactivityKeys))}:t,n);return TE(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):uS(i,n)},i)},SE={...yE,[gE]:gE},CE=e=>gE in e,wE=(e,t)=>{let n=Object.create(yE);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},TE=(e,t,n)=>{let r=Object.create(SE);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function EE(e,t){e.setSelf(t)}var DE=(e,t)=>{let n=OE(e,t);return`~effect/reactivity/Atom`in n?n:wE(n)},OE=(e,t)=>{if(typeof e==`function`&&!Tf(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:kE in i?ME(e,i,t,r):AE in i?LE(e,i,t,r):i;default:return i}}}return Tf(e)?function(n,r){return ME(n,e,t,r)}:Qw(e)?function(n,r){return LE(n,e,t,r)}:jE(e)},kE=`~effect/Effect`,AE=`~effect/Stream`,jE=e=>TE(function(t){return e},EE),ME=(e,t,n,r)=>NE(e,t,n?.initialValue===void 0?tS():rS(n.initialValue),r,n?.uninterruptible);function NE(e,t,n,r=pr(),i=!1){let a=e.self(),o=Su();e.addFinalizer(()=>{Bp(r)(Ou(o,lu))});let s,c=!1,l=PE(r.pipe(hr(xu,o),hr(JT,e.registry),hr(Ki,e.registry.scheduler)),t,function(t){s=Zx(t,a),c&&e.setSelf(s)},i);return c=!0,l!==void 0&&e.addFinalizer(l),s===void 0?a._tag===`Some`?Qx(a):cS(n):s}function PE(e,t,n,r=!1){if(ru(t)){n(t);return}let i=Bp(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 FE(e){let t=e?.memoMap??vE(DE(()=>Fu())),n=e=>hE(t)?e(t):t,r=wT;function i(e){let t=Object.create(bE);t.keepAlive=!1,t.lazy=!0,t.refresh=void 0,t.factory=i;let a=ZE(wE(typeof e==`function`?t=>td(e(t),r):()=>td(e,r)));return t.layer=a,t.read=function(e){let t=e(a);return ME(e,Uf(yp,r=>Ru(t,n(e),r)),{uninterruptible:!0})},t}i.memoMap=t,i.addGlobalLayer=e=>{r=td(r,ed(e,wT))};let a=vE(DE(e=>mp(t=>Ru(wT,n(e),yr(t,xu))).pipe(Yf(yr(xT)))));return i.withReactivity=e=>t=>QE(t,n=>{let r=fS(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 IE=FE();IE.withReactivity;var LE=(e,t,n,r)=>RE(e,t,n?.initialValue===void 0?tS():rS(n.initialValue),r);function RE(e,t,n,r=pr()){let i=e.self();r=hr(r,JT,e.registry);let a=gne(n=>Uf(Rw(t.channel,n),t=>Of({while:c,body:()=>t,step(t){e.setSelf(rS(See(t),{waiting:!0}))}}))).pipe(tp(t=>(Qd(t)?f(e.self(),Jn(dS),Bn({onNone:()=>e.setSelf(sS(new Xl,{previous:e.self()})),onSome:t=>e.setSelf(rS(t))})):e.setSelf(oS(t,{previous:e.self()})),Nf))),o=PE(r.pipe(hr(JT,e.registry),hr(Ki,e.registry.scheduler)),a,d,!1);return o!==void 0&&e.addFinalizer(o),i._tag===`Some`?Qx(i):cS(n)}var zE=(e,t,n=pr())=>IT(t)?(e.addFinalizer(zT(t).pipe(yT(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return Nf}),Vp(n))),Gp(n)(BT(t))):t._tag===`Success`?RE(e,zT(t.value),tS(!0),n):t,BE=(e,t)=>{function n(t,n){let r=t.get(e);IT(r)?Wp(UT(r,n)):nS(r)&&Wp(UT(r.value,n))}return TE(n=>{let r=n(e);return IT(r)||nS(r)?t(n,r):r},n)},VE=function(...e){return e.length===0?HE:HE(...e)},HE=(e,t)=>{let n=vE(jE([0,void 0])),r=t?.initialValue!==void 0;return TE(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){sD(()=>{e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})})},UE=Symbol.for(`effect/reactivity/atom/Atom/Reset`),WE=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`),GE=function(...e){return e.length===0?KE:KE(...e)},KE=(e,t)=>{let[n,r]=qE(e,t);return TE(n,r)};function qE(e,t){let n=vE(jE([0,void 0])),r=t?.initialValue===void 0?tS():rS(t.initialValue),i=t?.concurrent?vE(wE(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===WE)return oS(Rl(),{previous:t.self()});let l=e(c,t);return kE in l?(o&&(l=Uf(yne(l,{startImmediately:!0}),e=>{o.add(e);let t=Array.from(o);return e.addObserver(()=>o.delete(e)),Yf(vS(t),e=>e[0])})),NE(t,l,r,a,!1)):RE(t,l,r,a)}function o(e,t){sD(()=>{t===UE?e.set(n,[0,void 0]):t===WE?e.set(n,[e.get(n)[0]+1,WE]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var JE=(e,t,n,r)=>Uf(Yae(typeof n==`function`?n(e):n),n=>{let i=xS().context,a=ti(),o=fp(n,{onFailure(e){return Qd(e)?Qr(a)?B({done:!0,items:a}):U(new Xl(`Atom.pull: no items`)):Lf(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(Qx(e.self()));let t;t=PE(i,o,n=>{t&&s.delete(t);let r=Zx(n,e.self()),i=s.size>0;e.setSelf(i?cS(r):r)}),t&&s.add(t)}),o}),YE=(e,t)=>TE(t.read,function(t,n){t.set(e,t.get(e)+1)}),X=typeof WeakRef>`u`||typeof FinalizationRegistry>`u`?e=>{let t=Bw();return function(n){let r=Vw(t,n);if(r._tag===`Some`)return r.value;let i=e(n);return Uw(t,n,i),i}}:e=>{let t=Bw(),n=new FinalizationRegistry(e=>{let n=Vw(t,e);n._tag===`Some`&&n.value.deref()===void 0&&Ww(t,e)});return function(r){let i=Vw(t,r).pipe(Yn(e=>e.deref()));if(i._tag===`Some`)return i.value;let a=e(r);return Uw(t,r,new WeakRef(a)),n.register(a,r),a}},XE=a(2,(e,t)=>{function n(n){let r=n(e);return r._tag===`Initial`?cS(n(t)):r}return CE(e)?TE(n,function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):wE(n,e.refresh??function(t){t(e)})}),ZE=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),QE=a(e=>hE(e[0]),(e,t,n)=>{let r=vE(CE(e)?TE(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):wE(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=$E(n.initialValueTarget)),r}),$E=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},eD=a(2,(e,t)=>QE(e,n=>t(n(e)))),tD=a(2,(e,t)=>{let n=Fi(mi(t));return QE(e,function(t){let r=setTimeout(()=>t.refresh(e),n);return t.addFinalizer(()=>clearTimeout(r)),t(e)},{initialValueTarget:e})}),nD=a(2,(e,t)=>{let n=Fi(mi(t.staleTime));return QE(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):()=>{aD(r.once(e),n)&&r.refresh(e)})),Rn(r.self())&&t.revalidateOnMount===!1)return i;if(aD(i,n)){let t=!0;r.addFinalizer(()=>{t=!1}),r.registry.schedulerAsync.makeDispatcher().scheduleTask(()=>{t&&aD(r.once(e),n)&&r.refresh(e)},0)}return i},{initialValueTarget:e})}),rD=e=>e._tag===`Success`?Ln(e.timestamp):e._tag===`Failure`?qn(e.previousSuccess,e=>e.timestamp):In(),iD=(e,t,n)=>n-e<t,aD=(e,t)=>{if(e.waiting)return!1;let n=Un(rD(e));return n===void 0?e._tag!==`Initial`:!iD(n,t,Date.now())},oD=e=>{let t=0,n=vE(jE([t,void 0]));return TE(t=>{let r=t.once(e),i=!1;t.subscribe(e,e=>{if(r=e,a.size>0)return;if(i=!1,!Jx(e))return t.setSelf(e);let n=Un(t.self());switch(e._tag){case`Initial`:$x(n)&&t.setSelf(e);return;case`Success`:nS(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(nS(c)&&c.waiting)return t.setSelf(c.value);a.delete(n),s&&(o.delete(s),s()),!i&&!iS(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))},sD=fE,cD=(e=>t=>QE(t,n=>(n.once(e),n.subscribe(e,e=>n.refresh(t)),n.subscribe(t,e=>n.setSelf(e)),n.once(t)),{initialValueTarget:t}))(wE(e=>{let t=0;function n(){document.visibilityState===`visible`&&e.setSelf(++t)}return window.addEventListener(`visibilitychange`,n),e.addFinalizer(()=>{window.removeEventListener(`visibilitychange`,n)}),t})),lD=e=>{let t=e.runtime.fn(t=>jT.use(n=>NT(n,e.schema).set(e.key,t))),n=e.runtime.atom(jT.use(t=>NT(t,e.schema).get(e.key)));return TE(e.mode===`async`?r=>{r.mount(t);let i=mS(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(nS(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`?rS(r):r)})},uD=e=>Yf(JT,t=>t.refresh(e)),dD=`~effect-atom/atom/Atom/ServerValue`,fD=a(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[dD](e=>t.get(e)):t.get(e)),pD=(e,t)=>()=>{let n=Sb(Wb(e),t);return RC((e,t)=>B(Uf(e,e=>n(e))))},mD=`~effect/encoding/Sse/SseError`,hD=class extends ia(`EventTooLarge`){get message(){return`Pending SSE event exceeded the maximum size of ${this.maxEventSize}`}},gD=class extends ia(`SseError`){[mD]=mD;get message(){return this.reason.message}},_D=10485760,vD=e=>RC((t,n)=>V(()=>{let n=[],r,i=bD(e=>{e._tag===`Retry`?r=e:n.push(e)},e),a=Uf(t,e=>{for(let t=0;t<e.length;t++){let n=i.feed(e[t]);if(n!==void 0)return U(n)}return Nf});return Mf(function e(){if(Zr(n)){let e=n;return n=[],B(e)}return r?U(r):Uf(a,e)})})),yD=(e,t,n)=>Ew(vD(t),pD(SD.pipe(Xb(e,CD)),n)());function bD(e,t){let n=t?.maxEventSize??_D,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(xD)&&(i=i.slice(xD.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 gD({reason:new hD({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 TD({duration:ki(parseInt(p,10)),lastEventId:c}))}}var xD=``,SD=q({_tag:tx(`Event`),id:Yb(K),event:K,data:K}),CD=f_({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})}),wD=`~effect/encoding/Sse/Retry`,TD=class e extends na(`Retry`){[wD]=wD;static is(e){return F(e,wD)}static filter(t){return e.is(t)?kr(t):Ar(t)}},ED=`~effect/http/HttpBody`,DD=e=>F(e,ED),OD=class{[ED];constructor(){this[ED]=ED}[Ze](){return this.toJSON()}toString(){return Ue(this,{ignoreToString:!0})}},kD=new class extends OD{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},AD=class extends OD{_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??=PD(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}}},jD=(e,t)=>new AD(e,t??`application/octet-stream`,e.length),MD=new TextEncoder,ND=globalThis.Buffer,PD=ND===void 0?e=>MD.encode(e):e=>ND.from(e,`utf8`),FD=(e,t)=>{if(typeof e!=`string`&&(e=e===void 0?``:String(e)),ND!==void 0)return new AD(void 0,t??`text/plain`,ND.byteLength(e,`utf8`),e);let n=MD.encode(e);return new AD(n,t??`text/plain`,n.length,e)},ID=(e,t)=>FD(qh(zh(e)),t??`application/x-www-form-urlencoded`),LD=class extends OD{_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}}},RD=e=>new LD(e),zD={"~effect/Ref":{_A:o},...yt,toJSON(){return{_id:`Ref`,ref:this.ref}}},BD=e=>{let t=Object.create(zD);return t.ref=DS(e),t},VD=e=>V(()=>BD(e)),HD=e=>V(()=>e.ref.current),UD=a(2,(e,t)=>V(()=>OS(e.ref,t))),WD=a(2,(e,t)=>V(()=>{let n=e.ref.current;return e.ref.current=t,n})),GD=a(2,(e,t)=>V(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),KD=a(2,(e,t)=>V(()=>{e.ref.current=t(e.ref.current)})),qD=`~effect/http/HttpClientError`,JD=e=>F(e,qD),YD=class extends ia(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[qD]=qD;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},XD=e=>e.endsWith(`Error`)?e.slice(0,-5):e,ZD=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,QD=class extends ia(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return ZD(XD(this._tag),this.description,this.methodAndUrl)}},$D=class extends ia(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return ZD(XD(this._tag),this.description,this.methodAndUrl)}},eO=class extends ia(`StatusCodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return ZD(XD(this._tag),this.description,e)}},tO=class extends ia(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return ZD(XD(this._tag),this.description,e)}},nO=class extends ia(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return ZD(XD(this._tag),this.description,e)}},rO=class e extends Wx(qD)({_tag:tx(`HttpError`),kind:qb([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:W(xx())}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}},iO=e=>e!==`GET`&&e!==`HEAD`&&e!==`OPTIONS`&&e!==`TRACE`,aO=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],oO=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?jh(jh(e,`content-type`),`content-length`):(e=t.contentType===void 0?jh(e,`content-type`):Oh(e,`content-type`,t.contentType),t.contentLength===void 0?jh(e,`content-length`):Oh(e,`content-length`,t.contentLength.toString())),sO=class extends ia(`UrlError`){},cO=(e,t,n)=>jr({try:()=>{let r=new URL(e,lO());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 sO({cause:e})}),lO=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},uO=`~effect/http/HttpClientRequest`,dO={[uO]:uO,...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 fO(e,t,n,r,i,a){let o=Object.create(dO);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var pO=fO(`GET`,``,Uh,In(),Th,kD),mO=e=>(t,n)=>gO(pO,{method:e,url:t,...n??void 0}),hO=mO(`GET`),gO=a(2,(e,t)=>{let n=e;return t.method&&(n=_O(n,t.method)),t.url&&(n=SO(n,t.url)),t.headers&&(n=yO(n,t.headers)),t.urlParams&&(n=TO(n,t.urlParams)),t.hash&&(n=DO(n,t.hash)),t.body&&(n=OO(n,t.body)),t.accept&&(n=bO(n,t.accept)),t.acceptJson&&(n=xO(n)),n}),_O=a(2,(e,t)=>fO(t,e.url,e.urlParams,e.hash,e.headers,e.body)),vO=a(3,(e,t,n)=>fO(e.method,e.url,e.urlParams,e.hash,Oh(e.headers,t,n),e.body)),yO=a(2,(e,t)=>fO(e.method,e.url,e.urlParams,e.hash,kh(e.headers,t),e.body)),bO=a(2,(e,t)=>vO(e,`Accept`,t)),xO=bO(`application/json`),SO=a(2,(e,t)=>{if(typeof t==`string`)return fO(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=zh(n.searchParams),i=Hn(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,fO(e.method,n.toString(),r,i,e.headers,e.body)}),CO=a(2,(e,t)=>t===``?e:fO(e.method,wO(t,e.url),e.urlParams,e.hash,e.headers,e.body)),wO=(e,t)=>{let n=e.endsWith(`/`),r=t.startsWith(`/`);return n&&r?e+t.slice(1):!n&&!r?e+`/`+t:e+t},TO=a(2,(e,t)=>fO(e.method,e.url,Gh(e.urlParams,t),e.hash,e.headers,e.body)),EO=a(2,(e,t)=>fO(e.method,e.url,Kh(e.urlParams,t),e.hash,e.headers,e.body)),DO=a(2,(e,t)=>fO(e.method,e.url,e.urlParams,Ln(t),e.headers,e.body)),OO=a(2,(e,t)=>fO(e.method,e.url,e.urlParams,e.hash,oO(e.headers,t),t)),kO=a(2,(e,t)=>OO(e,RD(t)));function AO(e){let t=cO(e.url,e.urlParams,Un(e.hash));return Nr(t)?Ln(t.success):In()}var jO=`~effect/http/HttpIncomingMessage`,MO=(e,t)=>{let n=e.headers[`content-type`]??``,r;if(n.includes(`application/json`))try{r=Wp(e.json)}catch{}else if(n.includes(`text/`)||n.includes(`urlencoded`))try{r=Wp(e.text)}catch{}let i={...t,headers:Re(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(i.body=r),i},NO=`~effect/http/HttpClientResponse`,PO=(e,t)=>new FO(e,t),FO=class extends tt{[jO];[NO];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[jO]=jO,this[NO]=NO}toJSON(){return MO(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=AO(this.request);return Rn(e)?``:(e.value.hash=``,e.value.href)}get headers(){return Eh(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=ch(this.source.headers.getSetCookie())}get remoteAddress(){return In()}get stream(){return this.source.body?Fae({evaluate:()=>this.source.body,onError:e=>new YD({reason:new tO({request:this.request,response:this,cause:e})})}):jae(new YD({reason:new nO({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return Uf(this.text,e=>Bf({try:()=>e===``?null:JSON.parse(e),catch:e=>new YD({reason:new tO({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody??=Yf(this.arrayBuffer,e=>new TextDecoder().decode(e))}get urlParamsBody(){return Uf(this.text,e=>Bf({try:()=>zh(new URLSearchParams(e)),catch:e=>new YD({reason:new tO({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=Af({try:()=>this.source.formData(),catch:e=>new YD({reason:new tO({request:this.request,response:this,cause:e})})}).pipe(Dp,Wp)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=Af({try:()=>this.source.arrayBuffer(),catch:e=>new YD({reason:new tO({request:this.request,response:this,cause:e})})}).pipe(Dp,Wp),this.arrayBufferBody}pipe(){return n(this,arguments)}},IO=e=>Dh({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`}`}),LO=`~effect/http/HttpClient`,RO=tr(`effect/HttpClient`),zO=a(2,(e,t)=>BO(n=>t(e.postprocess(n)),e.preprocess)),BO=(e,t)=>{let n=Object.create(VO);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},VO={[LO]:LO,pipe(){return n(this,arguments)},...et,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(aO.map(([e,t])=>[t,function(t,n){return this.execute(mO(e)(t,n))}]))},HO=e=>BO(t=>Uf(t,t=>Hf(n=>{let r=XO.get(t),i=r??new AbortController,a=cO(t.url,t.urlParams,Un(t.hash));if(Mr(a))return U(new YD({reason:new $D({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(ga)||n.getRef(WO)(t)){let a=e(t,o,i.signal,n);return r?a:Mp(e=>fp(e(a),{onSuccess(e){return YO.register(e,i),B(new ZO(e,i))},onFailure(e){return Kl(e)&&i.abort(),Lf(e)}}))}return Pp(n.getRef(qO)(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(Ph),l=n.getRef(GO);for(let e in t.headers)l(e,`request`)&&a.attribute(`http.request.header.${e}`,Nh(e,c)?`<redacted>`:t.headers[e]);return t=n.getRef(KO)?yO(t,IO(a)):t,Mp(s=>s(e(t,o,i.signal,n)).pipe(Fp(a,{captureStackTrace:!1}),fp({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}`,Nh(t,c)?`<redacted>`:e.headers[t]);return r?B(e):(YO.register(e,i),B(new ZO(e,i)))},onFailure(e){return!r&&Kl(e)&&i.abort(),Lf(e)}})))})})),B),UO=a(2,(e,t)=>BO(e.postprocess,n=>Yf(e.preprocess(n),t))),WO=Er(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>l}),GO=Er(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>c}),KO=Er(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:c}),qO=Er(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),JO=e=>Ku(RO)(mp(t=>Yf(e,e=>zO(e,_p(e=>wr(t,e)))))),YO=(()=>{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))}}})(),XO=new WeakMap,ZO=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[NO]=NO;[jO]=jO;applyInterrupt(e){return Mf(()=>(YO.unregister(this.original),Ap(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 oT(()=>(YO.unregister(this.original),hT(this.original.stream,V(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Ze](){return this.original[Ze]()}pipe(){return n(this,arguments)}};({...yt});var QO=`~effect/socket/Socket`,$O=tr(`effect/socket/Socket`),ek=e=>$O.of({[QO]:QO,reader:e.reader,writer:e.writer}),tk=new TextEncoder,nk=`~effect/socket/Socket/CloseEvent`,rk=e=>F(e,nk),ik=`~effect/socket/Socket/SocketError`,ak=e=>F(e,ik),ok=class extends Wx(`effect/socket/Socket/SocketReadError`)({_tag:tx(`SocketReadError`),cause:xx()}){message=`An error occurred during Read`},sk=class extends Wx(`effect/socket/Socket/SocketWriteError`)({_tag:tx(`SocketWriteError`),cause:xx()}){message=`An error occurred during Write`},ck=class extends Wx(`effect/socket/Socket/SocketOpenError`)({_tag:tx(`SocketOpenError`),kind:qb([`Unknown`,`Timeout`]),cause:xx()}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},lk=class e extends Wx(`effect/socket/Socket/SocketUpgradeError`)({_tag:tx(`SocketUpgradeError`),cause:W(xx())}){static unsupported=()=>U(new fk({reason:new e({})}));get message(){return this.cause===void 0?`Socket does not support TLS upgrade`:`An error occurred during TLS upgrade`}},uk=class extends Wx(`effect/socket/Socket/SocketCloseError`)({_tag:tx(`SocketCloseError`),code:mx,closeReason:W(K)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},dk=Kb([ok,sk,ck,lk,uk]),fk=class extends Y(ik)(`SocketError`,{_tag:tx(`SocketError`),reason:dk}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[ik]=ik;static is(e){return ak(e)}message=this.reason.message},pk=(e,t)=>new fk({reason:new uk({code:e,closeReason:t})}),mk=class extends tr()(`@effect/platform/Socket/WebSocketConstructor`){},hk=(e,t)=>mk.use(n=>_k(xp((typeof e==`string`?B(e):e).pipe(Yf(e=>n(e,t?.protocols))),e=>V(()=>e.close(1e3))),t)),gk=e=>`pause`in e&&typeof e.pause==`function`,_k=(e,t)=>Hf(n=>{let r,i=CS(!1),a=n.context,o=H(function*(){let n=yield*yp,a=yield*Cu(e,n);`binaryType`in a&&(a.binaryType=`arraybuffer`);let o=gk(a),s=t?.highWaterMark??(o?vk: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`?tk.encode(e).byteLength:e.byteLength),p!==void 0&&v(),o&&d>=s?h():!o&&!p&&s!==void 0&&d>s&&b(new fk({reason:new ok({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 fk({reason:new ok({cause:e})}))});return}y(t instanceof ArrayBuffer?new Uint8Array(t):t)}function S(e){b(new fk({reason:c?new ok({cause:e}):new ck({kind:`Unknown`,cause:e})}))}function C(e){b(pk(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*Tu(n,V(()=>{if(b(pk(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??pk(1006)):(c||=(yield*Ff(e=>{let t=()=>{m?.resume===e&&(m=void 0,a.removeEventListener(`open`,t),e(Nf))},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(cp({duration:t?.openTimeout??1e4,orElse:()=>U(new fk({reason:new ck({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))})),!0),f===void 0&&d<s&&g(),r=a,i.openUnsafe(),{pull:Ff(e=>u.length>0?e(B(_())):f===void 0?(p=e,V(()=>{p===e&&(p=void 0)})):e(U(f))),upgrade:lk.unsupported})}).pipe(_p(e=>wr(a,e))),s=e=>Mf(()=>{let t=r;if(t===void 0)return i.whenOpen(s(e));try{return rk(e)?t.close(e.code,e.reason):t.send(e),Nf}catch(e){return U(new fk({reason:new sk({cause:e})}))}}),c=e=>Mf(()=>{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 Nf}catch(e){return U(new fk({reason:new sk({cause:e})}))}});return B(ek({reader:o,writer:B({write:s,writeAll:c})}))}),vk=65536,yk=new Uint8Array(256);for(let e of"!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")yk[e.charCodeAt(0)]=1;var bk=new Uint8Array(256);bk[9]=1;for(let e=32;e<=126;e++)bk[e]=1;for(let e=128;e<=255;e++)bk[e]=1;var xk=tr(`effect/http/HttpServerRequest`),Sk=new WeakSet,Ck=e=>Hf(t=>{let n=vr(t.context,xk);return Sk.add(n.source),e}),wk=tr(`effect/http/HttpRouter`),Tk=e=>e.endsWith(`/`)?e.slice(0,-1):e,Ek=a(2,(e,t)=>(t=Tk(t),e===`*`?`${t}/*`:e===`/`?t:t+e)),Dk=`~effect/http/HttpRouter/Middleware`,Ok=function(){return arguments.length===0?kk:kk(arguments[0],arguments[1])},kk=(e,t)=>t?.global?Yu(H(function*(){let t=yield*wk,n=Tf(e)?yield*e:e;yield*t.addGlobalMiddleware(n)})):new Mk(Tf(e)?Ju(Yf(e,e=>ur(new Map([[jk,e]])))):Hu(ur(new Map([[jk,e]])))),Ak=0,jk=`effect/http/HttpRouter/MiddlewareFn`,Mk=class e{[Dk]={};layerFn;dependencies;constructor(e,t){this.layerFn=e,this.dependencies=t;let n=`effect/http/HttpRouter/Middleware-${++Ak}`;this.layer=Ju(H({self:this},function*(){let e=yield*pp(),t=[_r(e,jk)];if(this.dependencies){let n=yield*Lu,r=yr(e,xu),i=yield*Ru(this.dependencies,n,r);t.push(...Pk(i))}return ur(new Map([[n,t]]))})).pipe(ed(this.layerFn))}layer;combine(t){return new e(this.layerFn,this.dependencies?td(this.dependencies,t.layer):t.layer)}},Nk=new WeakMap,Pk=e=>{let t=Nk.get(e);if(t)return t;let n=ti(),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 Nk.set(e,t),t};Ok(Ck).layer;var Fk={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},Ik=e=>Fk[e],Lk=`~effect/http-api/HttpApiSchema/Stream`;function Rk(e){let t=typeof e==`string`?Ik(e):e;return e=>e.annotate({httpApiStatus:t})}var zk=(e=>zb.pipe(Rk(e)))(204);function Bk(e){return t=>zb.pipe(Xb(Mb(t),f_({decode:e.decode,encode:d})))}var Vk=e=>kb(e)&&F(e,Lk),Hk=e=>Vk(e)&&e._tag===`StreamSse`,Uk=e=>Vk(e)&&e._tag===`StreamUint8Array`,Wk=`~effect/http-api/HttpApiSchema/WithHeaders`,Gk=`~effect/http-api/HttpApiSchema/WithHeadersValue`,Kk=e=>({[Gk]:Gk,body:e.body,headers:e.headers}),qk=e=>kb(e)&&F(e,`~effect/http-api/HttpApiSchema/WithHeaders`);function Jk(e,t,n){return Ob(e.ast,{[Wk]:Wk,schema:t,headers:n})}function Yk(e,t){return e.annotate({"~httpApiEncoding":{_tag:t._tag,contentType:t.contentType??Xk(t._tag)}})}function Xk(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 Zk(e){return t=>Yk(t,{_tag:`FormUrlEncoded`,...e})}function Qk(e){return t=>Yk(t,{_tag:`Text`,...e})}var $k=e=>{if(j_(e)||j_(Sy(e)))return!0;let t=e.encoding?.[0].to;return t!==void 0&&j_(t)},eA=Ny(`~httpApiEncoding`),tA=Ny(`~httpApiWithHeaders`),nA=Ny(`httpApiStatus`),rA={_tag:`Json`,contentType:`application/json`},iA={_tag:`FormUrlEncoded`,contentType:`application/x-www-form-urlencoded`};function aA(e){return eA(e)??rA}function oA(e,t){return eA(e)||(iO(t)?rA:iA)}function sA(e){let t=aA(e);if(t._tag===`Multipart`)throw Error(`Multipart is not supported in response`);return t}function cA(e){return nA(e)??200}function lA(e){return qk(e)?nA(e.ast)??cA(e.schema.ast):cA(e.ast)}function uA(e){return qk(e)&&eA(e.ast)===void 0?sA(e.schema.ast):sA(e.ast)}function dA(e){return nA(e)??500}function fA(e){return qk(e)?nA(e.ast)??dA(e.schema.ast):dA(e.ast)}function pA(e){let t=e.toLowerCase().trim(),n=t.indexOf(`;`);return n===-1?t:t.slice(0,n).trim()}var mA=`~effect/http-api/HttpApiEndpoint`;function hA(e){let t=[];for(let{schemas:n}of e.payload.values())t.push(...n);return t}function gA(e){let t=Array.from(e.success);return Zr(t)?t:[zk]}function _A(e){let t=new Set(e.error),n=e.disableCodecs?o:EA;for(let r of e.middlewares){let e=r;for(let r of e.error)t.add(n(r))}return Array.from(t)}var vA={[mA]:mA,pipe(){return n(this,arguments)},prefix(e){return bA({...yA(this),path:Ek(this.path,e)})},middleware(e){return bA({...yA(this),middlewares:new Set([...this.middlewares,e])})},annotate(e,t){return bA({...yA(this),annotations:hr(this.annotations,e,t)})},annotateMerge(e){return bA({...yA(this),annotations:wr(this.annotations,e)})}},yA=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 bA(e){function t(){}return Object.setPrototypeOf(t,vA),Object.assign(t,e)}var xA=e=>(t,n,r)=>{let i=r?.disableCodecs??!1,a=i?o:Kx;return bA({identifier:t,path:n,method:e,params:SA(r?.params,a),query:SA(r?.query,a),headers:SA(r?.headers,a),payload:CA(r?.payload,e,i),success:TA(r?.success,e,i),error:DA(r?.error,i),annotations:pr(),middlewares:new Set,disableCodecs:i})};function SA(e,t){if(e!==void 0)return kb(e)?t(e):t(q(e))}function CA(e,t,n){let r=new Map;if(e===void 0)return r;let i=Array.isArray(e)?e:kb(e)?[e]:[q(e).pipe(Zk())],a=n?o:LA;for(let e of i){let n=oA(e.ast,t),i=pA(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 wA=`effect/http-api/stream/failure`;function TA(e,t,n){if(e===void 0)return new Set;let r=Jr(e);return OA(r,t),new Set(n?r:r.map(EA))}var EA=m(e=>Vk(e)?e:qk(e)?Jk(e,Vk(e.schema)?e.schema:IA(e.schema,uA(e)),Kx(e.headers)):FA(e));function DA(e,t){if(e===void 0)return new Set;let n=Jr(e);for(let e of n)if(Vk(qk(e)?e.schema:e))throw Error(`Streaming schemas are not supported in error responses`);return AA(n,fA),new Set(t?n:n.map(EA))}function OA(e,t){let n=!1,r=new Map;for(let i of e){let e=qk(i)?i.schema:i,a=lA(i);if(Vk(e)){if(jA(e,t),n)throw Error(`Multiple streaming success responses are not supported`);n=!0;let i=kA(r,a);if(i.noContent)throw Error(`Cannot combine no-content and streaming success responses for status: ${a}`);if(i.bufferedContentTypes.has(pA(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=kA(r,a),n=$k(e.ast);if(t.stream!==void 0){if(n)throw Error(`Cannot combine no-content and streaming success responses for status: ${a}`);let e=uA(i);if(pA(e.contentType)===pA(t.stream.contentType))throw Error(`Cannot combine buffered and streaming success responses for status ${a} and content-type: ${e.contentType}`)}n||t.bufferedContentTypes.add(pA(uA(i).contentType)),t.noContent=t.noContent||n}}AA(e,lA)}function kA(e,t){let n=e.get(t);return n===void 0&&(n={bufferedContentTypes:new Set,noContent:!1},e.set(t,n)),n}function AA(e,t){let n=new Map;for(let r of e){let e=t(r),i=tA(r.ast),a=qk(r)?r.schema:i?.body??r,o=$k(a.ast)?``:pA(Vk(a)?a.contentType:uA(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(qk(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 jA(e,t){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare streaming success responses`);if(Hk(e)&&MA(e.events.ast))throw Error(`SSE event name is reserved: ${wA}`)}function MA(e){return NA(Sy(e),new Set)}function NA(e,t){if(t.has(e))return!1;if(t.add(e),L_(e))return e.types.some(e=>NA(e,t));if(R_(e))return NA(e.thunk(),t);if(!I_(e))return!1;let n=e.propertySignatures.find(e=>e.name===`event`);return n!==void 0&&PA(n.type,t)}function PA(e,t){if(t.has(e))return!1;t.add(e);let n=Sy(e);return n===e?N_(e)?e.literal===wA:L_(e)?e.types.some(e=>PA(e,t)):R_(e)?PA(e.thunk(),t):!1:PA(n,t)}function FA(e){let t=sA(e.ast),n=tA(e.ast);return n===void 0?IA(e,t):e.annotate({"~httpApiWithHeaders":{...n,bodyCodec:IA(n.body,t),headersCodec:Kx(n.headers)}})}function IA(e,t){switch(t._tag){case`Json`:return Gx(e);case`FormUrlEncoded`:return Kx(e);case`Text`:case`Uint8Array`:return e}}function LA(e,t){switch(oA(e.ast,t)._tag){case`Json`:return Gx(e);case`FormUrlEncoded`:return Kx(e);case`Text`:case`Uint8Array`:case`Multipart`:return e}}var RA=xA(`GET`),zA=xA(`POST`),BA=xA(`PUT`),VA=xA(`PATCH`),HA=xA(`DELETE`),UA=`~effect/http-api/HttpApi`,WA={[UA]:UA,pipe(){return n(this,arguments)},add(...e){let t={...this.groups};for(let n of e)st(t,n.identifier,n);return KA({...GA(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 KA({...GA(this),groups:t})},prefix(e){return KA({...GA(this),groups:Hr(this.groups,t=>t.prefix(e))})},middleware(e){return KA({...GA(this),groups:Hr(this.groups,t=>t.middleware(e))})},annotate(e,t){return KA({...GA(this),annotations:hr(this.annotations,e,t)})},annotateMerge(e){return KA({...GA(this),annotations:wr(this.annotations,e)})}},GA=e=>({identifier:e.identifier,groups:e.groups,annotations:e.annotations}),KA=e=>{function t(){}return Object.setPrototypeOf(t,WA),Object.assign(t,e)},qA=e=>KA({identifier:e,groups:{},annotations:pr()}),JA=(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:YA(gA(e),lA),errors:YA(_A(e),fA)})}},YA=(e,t)=>{let n=new Map;return e.forEach(r),n;function r(e){if(Vk(qk(e)?e.schema:e))return;let r=t(e),i=n.get(r);i===void 0?n.set(r,[e]):i.push(e)}},XA=class extends tr()(`effect/http-api/HttpApi/ParseOptions`){},ZA=class extends tr()(`effect/http-api/HttpApi/ParamsParseOptions`){},QA=class extends tr()(`effect/http-api/HttpApi/QueryParseOptions`){},$A=class extends tr()(`effect/http-api/HttpApi/HeadersParseOptions`){},ej=class extends tr()(`effect/http-api/HttpApi/PayloadParseOptions`){},tj=class extends tr()(`effect/http-api/HttpApi/SuccessParseOptions`){},nj=class extends tr()(`effect/http-api/HttpApi/ErrorParseOptions`){},rj=e=>{let t=gr(e,XA);return{params:gr(e,ZA)??t,query:gr(e,QA)??t,headers:gr(e,$A)??t,payload:gr(e,ej)??t,success:gr(e,tj)??t,error:gr(e,nj)??t}},ij=new Set;function aj(e){if(e===void 0)return ij;let t=iy(e.ast);return I_(t)&&t.indexSignatures.length===0?new Set(t.propertySignatures.map(e=>String(e.name))):void 0}var oj=(e,t)=>H(function*(){let n=yield*pp(),r=t.httpClient.pipe(t?.baseUrl===void 0?o:UO(CO(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)}})}JA(e,{predicate:t?.predicate,onGroup(e){t.onGroup?.(e)},onEndpoint(e){let{group:n,endpoint:r,errors:a,successes:o,mergedAnnotations:s}=e,c=rj(s),l=dj(r.path,r.params),u={orElse:jj},d=new Map;for(let[e,t]of a.entries()){let n=_j(t);for(let[t,r]of n.entries())hj(d,e,t,fj(r,c.error,c.headers))}for(let[e,t]of d.entries()){let n=gj(t);u[e]=e=>Uf(tp(n(e),t=>Lf(Yte(Il(new YD({reason:new eO({request:e.request,response:e})})),t))),U)}let f=new Map;for(let[e,t]of o.entries()){let n=_j(t);for(let[t,r]of n.entries())hj(f,e,t,fj(r,c.success,c.headers))}for(let e of xj(r)){let t=bj(e)?e.schema:e;hj(f,lA(e),t.contentType,Sj(e,c.success,c.headers))}for(let[e,t]of f.entries())u[e]=gj(t);let p=DT(r.params,e=>Tb(e,c.params)),m=hA(r),h=Zr(m)?Tb(iO(r.method)?Nj(m,r.method):Kb(m),c.payload):void 0,g=DT(r.headers,e=>Tb(e,c.headers)),_=DT(r.query,e=>Tb(e,c.query)),v=Array.from(e.middleware,e=>`${e.key}/Client`),y=qp(function*(e){let a=mO(r.method)(r.path);if(e!==void 0){if(p!==void 0){let t=yield*p(e.params);a=SO(a,l(t))}if(h!==void 0){if(iO(r.method)){if(e.payload instanceof FormData)a=kO(a,e.payload);else{let t=yield*h(e.payload);a=OO(a,t)}}else{let t=yield*h(e.payload);a=EO(a,t)}}if(g!==void 0){let t=yield*g(e.headers);a=yO(a,t)}if(_!==void 0){let t=yield*_(e.query);a=EO(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})}})}),sj=(e,t)=>Uf(RO,n=>cj(e,{...t,httpClient:t?.transformClient?t.transformClient(n):n})),cj=(e,t)=>{let n={};return oj(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(Xf(n))},lj=(e,t)=>{let n={};return JA(e,{onGroup({group:e}){e.topLevel||st(n,e.identifier,{})},onEndpoint({group:e,endpoint:r,mergedAnnotations:i}){let a=rj(i),o=dj(r.path,r.params),s=r.params===void 0?void 0:Db(r.params,a.params),c=r.query===void 0?void 0:Db(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?Uh:zh(a);if(t?.baseUrl===void 0){let e=qh(l);return e===``?i:`${i}?${e}`}let u=new URL(CO(hO(i),t.baseUrl.toString()).url);for(let[e,t]of l.params)t!==void 0&&u.searchParams.append(e,t);return u.toString()})}}),n},uj=/(\/?):(\w+)(\?)?/g,dj=(e,t)=>{if(t===void 0||!e.includes(`:`))return t=>e;let n=aj(t);return t=>e.replace(uj,(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 fj(e,t,n){let r=e.some(e=>qk(e)||tA(e.ast)!==void 0),i=xb(r?Kb(e.map(e=>mj(e,t,n))):kj(e),t);return e=>Uf(e.arrayBuffer,r?t=>i({body:t,headers:e.headers}):i)}var pj=q({body:Fb,headers:Fb});function mj(e,t,n){let r=tA(e.ast),i=r===void 0?qk(e)?{body:e.schema,headers:e.headers,toValue:Kk}:{body:e,headers:Fb,toValue:e=>e.body}:{body:r.bodyCodec,headers:r.headersCodec,toValue:r.transformation.decode},a=xb(Aj(i.body).pipe(Xb(i.body)),t),o=xb(i.headers,n);return pj.pipe(Xb(qk(e)?e:Mb(e),d_({decode:e=>Ef({body:a(e.body),headers:o(e.headers)}).pipe(Yf(i.toValue),np(e=>e.issue)),encode:(e,t)=>U(new bg({message:`Decode only schema`},e,t))})))}function hj(e,t,n,r){let i=pA(n),a=e.get(t);a===void 0?e.set(t,[{contentType:i,decode:r}]):a.push({contentType:i,decode:r})}function gj(e){let t=e[0];return e.length===1&&t!==void 0?t.decode:(t,n)=>{let r=pA(t.headers[`content-type`]??``),i=e.find(e=>e.contentType===r);return i===void 0?vj(t,r,e):i.decode(t,n)}}function _j(e){let t=new Map;for(let n of e){let e=$k((qk(n)?n.schema:n).ast)?``:pA(uA(n).contentType),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return t}function vj(e,t,n){let r=Array.from(new Set(n.map(e=>e.contentType))).join(`, `);return U(new YD({reason:new tO({request:e.request,response:e,description:`Unsupported response content-type for status ${e.status}: ${t||`<missing>`}. Expected one of: ${r}`})}))}var yj=`effect/http-api/stream/failure`,bj=e=>qk(e);function xj(e){let t=[];for(let n of e.success)Vk(qk(n)?n.schema:n)&&t.push(n);return t}function Sj(e,t,n){let r=bj(e),i=r?e.schema:e,a=Uk(i)?void 0:{declaration:i,decoder:Cj(i,t)},o=(e,t)=>Yf(pp(),n=>gT(a===void 0?e.stream:wj(e.stream,a.declaration,a.decoder(t)),n));if(!r)return o;let s=xb(e.headers,n);return(e,t)=>Uf(s(e.headers),n=>Yf(o(e,t),e=>Kk({body:e,headers:n})))}function Cj(e,t){let n=Kb([q({id:W(K),event:G(yj),data:wx(Gx(Ox(e.error,xx())))}),e.events]),r=yD(n,void 0,t);return e=>e===void 0?r:yD(n,e,t)}function wj(e,t,n){let r=tT(e.pipe(qae,Kae(n)),e=>V(()=>{let t;return Mf(()=>t===void 0?Uf(e,e=>{for(let n=0;n<e.length;n++){let r=e[n];if(r.event===yj&&Ml(r.data)){if(n===0)return Lf(r.data);t=r.data,e=e.slice(0,n);break}}return B(e)}):Lf(t))}));return t.sseMode===`data`?lT(r,e=>e.data):r}var Tj=nx(globalThis.ArrayBuffer,{expected:`ArrayBuffer`}),Ej=Tj.pipe(Xb(Pie,f_({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)}}))),Dj=Tj.pipe(Xb(K,f_({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)}}))),Oj=Dj.pipe(Xb(Kb([G(``).pipe(Xb(Ib,f_({decode:()=>void 0,encode:()=>``}))),Mie])));function kj(e){return Kb(e.map(t));function t(e){return Aj(e).pipe(Xb(e))}}function Aj(e){switch(sA(e.ast)._tag){case`Json`:return A_(Sy(e.ast))?Oj.pipe(Xb(Fb,f_({decode:e=>e===void 0?null:e,encode:e=>e===null?void 0:e}))):Oj;case`FormUrlEncoded`:return Dj.pipe(Xb(Rie,f_({decode:e=>zh(new URLSearchParams(e)),encode:qh})));case`Uint8Array`:return Ej;case`Text`:return Dj}}var jj=e=>U(new YD({reason:new tO({request:e.request,response:e})})),Mj=hb(DD);function Nj(e,t){return Kb(e.map(e=>Fj(e,t)))}var Pj=new WeakMap;function Fj(e,t){let n=e.ast,r=Pj.get(n);if(r!==void 0)return r;let i=oA(n,t),a=Mj.pipe(Xb(e,d_({decode(e,t){return U(new bg({message:`Encode only schema`},e,t))},encode(e,t){switch(i._tag){case`Multipart`:return U(new bg({message:`Payload must be a FormData`},e,t));case`Json`:try{return B(FD(JSON.stringify(e),i.contentType))}catch{return U(new vg({expected:`a JSON-serializable request body`},e,t))}case`Text`:return typeof e==`string`?B(FD(e,i.contentType)):U(new vg({message:`Expected a string`},e,t));case`FormUrlEncoded`:return N(e)?B(ID(zh(e),i.contentType)):U(new vg({message:`Expected a record`},e,t));case`Uint8Array`:return e instanceof Uint8Array?B(jD(e,i.contentType)):U(new vg({message:`Expected a Uint8Array`},e,t))}}})));return Pj.set(n,a),a}var Ij=`~effect/reactivity/AtomRef`,Lj=e=>new Bj(e),Rj={count:0,generate(){return`AtomRef-${this.count++}`}},zj=class{[Ij];key=Rj.generate();value;constructor(e){this[Ij]=Ij,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 Vj(this,e)}},Bj=class extends zj{prop(e){return new Hj(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))}},Vj=class e{[Ij];key=Rj.generate();parent;transform;constructor(e,t){this[Ij]=Ij,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)}},Hj=class e{[Ij];key=Rj.generate();previous;parent;_prop;constructor(e,t){this[Ij]=Ij,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 Vj(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}},Uj=class extends tr()(`effect/workers/Transferable/Collector`){},Wj=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return Uj.of({addAllUnsafe:t,addAll:e=>V(()=>t(e)),readUnsafe:n,read:V(n),clearUnsafe:r,clear:V(r)})},Gj=Kb([class extends Wx(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:tx(`WorkerSpawnError`),message:K,cause:W(xx())}){},class extends Wx(`effect/workers/WorkerError/WorkerSendError`)({_tag:tx(`WorkerSendError`),message:K,cause:W(xx())}){},class extends Wx(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:tx(`WorkerReceiveError`),message:K,cause:W(xx())}){},class extends Wx(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:tx(`WorkerUnknownError`),message:K,cause:W(xx())}){}]),Kj=`~effect/PrimaryKey`,qj=`~effect/rpc/RpcSchema/StreamSchema`;function Jj(e){return F(e,qj)}function Yj(e){return Jj(e)?Ln({success:e.success,error:e.error}):In()}var Xj=hb(Qw);function Zj(e,t){return Ob(Xj.ast,{[qj]:qj,success:e,error:t})}var Qj=`~effect/rpc/Rpc`,$j={[Qj]:Qj,pipe(){return n(this,arguments)},setSuccess(e){return eM({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return eM({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return eM({_tag:this._tag,payloadSchema:kb(e)?e:q(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return eM({_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 eM({_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 eM({_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 eM({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:wr(this.annotations,e)})}},eM=e=>{function t(){}return Object.setPrototypeOf(t,$j),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},tM=(e,t)=>{let n=t?.success??zb,r=t?.error??Pb,i=t?.defect??xx(),a;return a=t?.primaryKey?class extends Ux(`effect/rpc/Rpc/${e}`)(t.payload){[Kj](){return t.primaryKey(this)}}:kb(t?.payload)?t?.payload:t?.payload?q(t?.payload):zb,eM({_tag:e,payloadSchema:a,successSchema:t?.stream?Zj(n,r):n,errorSchema:t?.stream?Pb:r,defectSchema:i,annotations:pr(),middlewares:new Set})},nM=new WeakMap,rM=e=>{if(nM.has(e))return nM.get(e);let t=e,n=new Set([t.errorSchema]),r=Yj(t.successSchema);zn(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=Px(zn(r)?zb:t.successSchema,Kb([...n]),t.defectSchema);return nM.set(e,i),i},iM=`~effect/rpc/Rpc/Wrapper`,aM=e=>iM in e,oM=`~effect/rpc/RpcClientError`,sM=class extends Wx(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:tx(`RpcClientDefect`),message:K,cause:xx()}){},cM=class extends Wx(oM)({_tag:tx(`RpcClientError`),reason:Kb([Gj,dk,rO,sM])}){[oM]=oM;get message(){return`${this.reason._tag}: ${this.reason.message}`}},lM=e=>e,uM={_tag:`Ping`},dM=Gx,fM,pM=e=>(fM??=new TextDecoder).decode(e),mM=class extends tr()(`effect/rpc/RpcSerialization`){},hM=mM.of({contentType:`application/json`,includesFraming:!1,codecFor:dM,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e==`string`?e:pM(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),gM=e=>Mf(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>mp(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),Nf});return Yf(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*gp(Mf(()=>i(e)),t)}return yield*Ep(If,()=>(t.delete(e),r.delete(e),Nf))})}}))}),_M=0,vM=qp(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>_M++),s=yield*pp(),c=yr(s,xu),l=new Map,u=!1;yield*Tu(c,Hf(e=>(u=!0,d(cu(e.id)))));let d=qp(function*(e){for(let[t,n]of l)l.delete(t),n._tag===`Queue`?yield*e._tag===`Success`?sC(n.queue):aC(n.queue,e.cause):n.resume(e)}),f=e=>{let r=Jj(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?Eh(s.headers):Th,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):Pp(`${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:cT(Yf(u,sT))}},p=(e,n,r,i,s,c,d)=>Hf(f=>{if(u)return Op;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:Ah(f.getRef(bM),s)});if(d)return m;let h;return Ap(Ff(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?Fp(r,{captureStackTrace:!1}):o,Bp(f.context)),h.addObserver(e=>{if(e._tag===`Failure`)return t(e)})}),e=>(l.delete(p),Gf(yS(h),g(p,Array.from(e),c))))}),m=qp(function*(e,r,s,c,d,f){if(u)return yield*Op;let p=i?void 0:yield*vne(`${n}.${e._tag}`,{attributes:t.spanAttributes}),m=xS(),h=a(),_=vr(m.context,xu),v=yield*$S(d);return yield*wu(_,e=>(lC(v),l.has(h)?(l.delete(h),g(h,du(e)?Array.from(ql(e.cause)):[],f)):Nf)),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:Ah(m.getRef(bM),c)}).pipe(p?Fp(p,{captureStackTrace:!1}):o,Tp(e=>aC(v,e)),kp,Lp(_,{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)=>Ff(i=>{let a=xS();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r,discard:!1}).pipe(op(1e3),Bp(a.context)).addObserver(()=>{i(Nf)})}),_=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=l.get(n);return!i||i._tag!==`Queue`?Nf:rC(i.queue,e.values).pipe(r?Uf(()=>t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context,discard:!1})):o,tp(e=>aC(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),Nf):e.exit._tag===`Success`?sC(n.queue):aC(n.queue,e.exit.cause)):Nf}case`Defect`:return d(su(e.defect));case`ClientEnd`:return Nf}},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:_}}),yM=0,roe=qp(function*(e,t){let n=yM++,{codecFor:r,run:i,send:a,supportsAck:o,supportsTransferables:s}=yield*xM,c=ioe(r),l=lie(r(xx())),u=new Map,d=e=>u.has(e)?(u.delete(e),a(n,{_tag:`Interrupt`,requestId:e})):Nf,{client:f,write:p}=yield*vM(e,{...t,supportsAck:o,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),i=s?Wj():void 0,o=xS(),l={rpc:r,context:i?hr(o.context,Uj,i):o.context,schemas:c(r)};return u.set(t.id,l),l.schemas.encodePayload(t.payload).pipe(gp(l.context),rp,Uf(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}):Nf;case`Interrupt`:return d(t.requestId);case`Eof`:return Nf}}});return yield*i(n,e=>{switch(e._tag){case`Chunk`:{let t=lM(e.requestId),n=u.get(t);if(!n||Rn(n.schemas.decodeChunk))return Nf;let r=n.schemas.decodeChunk.value;return Mp(i=>i(r(e.values).pipe(gp(n.context),rp,Uf(e=>p({_tag:`Chunk`,clientId:0,requestId:t,values:e})))).pipe(Tp(e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:au(e)}).pipe(Gf(Kl(e)?Nf:ap(d(t))))),sne(e=>!Kl(e),()=>Nf)))}case`Exit`:{let t=lM(e.requestId),n=u.get(t);return n?(u.delete(t),n.schemas.decodeExit(e.exit).pipe(gp(n.context),rp,fp({onSuccess:e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:au(e)})}))):Nf}case`Defect`:return p({_tag:`Defect`,clientId:0,defect:l(e.defect)});case`ClientProtocolError`:{let t=ou(e.error);return Df(Array.from(u.keys()),e=>p({_tag:`Exit`,clientId:0,requestId:e,exit:t}))}default:return Nf}}).pipe(tp(Xp),kp,Rp),f}),ioe=e=>{let t=new WeakMap;return n=>{let r=t.get(n);return r===void 0?(r={decodeChunk:qn(Yj(n.successSchema),t=>xb(e(Wb(t.success)))),encodePayload:Eb(e(n.payloadSchema)),decodeExit:xb(e(rM(n)))},t.set(n,r),r):r}},bM=Er(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>Th}),xM=class extends tr()(`effect/rpc/RpcClient/Protocol`){static make=gM},aoe=e=>xM.make(qp(function*(t,n){let r=yield*$O,i=yield*mM,a=yield*hne(coe),s=new Map,c=yield*r.writer,l=i.makeUnsafe(),u=yield*soe(Mf(()=>c.write(l.encode(uM)))),f,p=e=>Df(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 Nf;let r=0;return Of({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return u.onPong(),Nf;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 cM({reason:new sM({message:`Error decoding message`,cause:e})})})}};return yield*Mf(()=>(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(bp,up(Uf(u.timeout,()=>U(new fk({reason:new ok({cause:Error(`ping timeout`)})}))))))).pipe(zn(a)?wp(a.value.onDisconnect):o,cne(t=>{let n=Wl(t),r=Nr(n),i=new cM({reason:r?n.success.reason:new sM({message:`Unknown socket error`,cause:Ul(t)})});return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?(e.onTransientError?.(i)??Nf).pipe(une({log:!0,message:`RpcClient onTransientError hook failed`})):m(i)}),lne(e?.retryPolicy??ooe,e=>m(new cM({reason:e.reason}))),wne({module:`RpcClient`,method:`makeProtocolSocket`}),Rp),{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?Nf:rp(c.write(n))},supportsAck:!0,supportsTransferables:!1,codecFor:i.codecFor}})),ooe=pf([hf(500,1.5),gf(5e3)]),soe=qp(function*(e){let t=!0,n=CS();return yield*Mf(()=>t?(t=!1,e):n.open).pipe(fne(`5 seconds`),ap,Np,kp,Rp),{timeout:n.await,reset:()=>{t=!0,n.closeUnsafe()},onPong:()=>{t=!0}}}),coe=class extends tr()(`effect/rpc/RpcClient/ConnectionHooks`){},loe=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`})),SM=t(((e,t)=>{t.exports=loe()})),Z=e(SM(),1),uoe=Z.use,CM=Z.useLayoutEffect;function doe(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 foe(e){let t=Z.useRef(null);return Z.useImperativeHandle(e,()=>t.current,[]),t}function wM(e){if(URL.canParse)return URL.canParse(e);try{return new URL(e),!0}catch{return!1}}function TM(e){return e[e.length-1]}function EM(e,t){return typeof e==`function`?e(t):e}var DM=Object.prototype.hasOwnProperty,poe=Object.prototype.propertyIsEnumerable;function moe(e){for(let t in e)if(DM.call(e,t))return!0;return!1}var hoe=()=>Object.create(null),goe=(e,t)=>OM(e,t,hoe);function OM(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=MM(e)&&MM(i);if(!a&&!(AM(e)&&AM(i)))return i;let o=a?e:kM(e);if(!o)return i;let s=a?i:kM(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:DM.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=OM(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function kM(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(!poe.call(e,r))return!1;t.push(r)}return t}function AM(e){if(!jM(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!jM(n)||!n.hasOwnProperty(`isPrototypeOf`))}function jM(e){return Object.prototype.toString.call(e)===`[object Object]`}function MM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function NM(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(!NM(e[r],t[r],n))return!1;return!0}if(AM(e)&&AM(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!NM(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||!NM(e[o],t[o],n)))return!1;return i===a}return!1}function _oe(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 voe=/[\x00-\x1f\x7f"<>`{}]/g;function yoe(e){return e.replace(voe,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function PM(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 yoe(t)}var boe=[`http:`,`https:`,`mailto:`,`tel:`];function FM(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function xoe(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+=PM(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=PM(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Soe(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Coe(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 IM(){throw Error(`Invariant failed`)}function LM(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 RM=4,zM=5;function BM(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 VM(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=BM(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=UM(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=woe(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=UM(r);e.kind=zM,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=UM(r);e.kind=RM,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)VM(e,t,r,c,i,a,o,s)}function HM(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 UM(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 woe(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 Toe(e,t){let n=UM(`/`),r=new Uint16Array(6),i=[];for(let t of e)VM(!1,r,t,1,n,0,i);for(let e of i)e.sort(HM);t.masksTree=n,t.flatCache=LM(1e3)}function Eoe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=WM(e,t.masksTree);return t.flatCache.set(e,r),r}function Doe(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=UM(`/`),VM(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),WM(r,o,n)}function Ooe(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=WM(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=KM(a.route)),t.matchCache.set(r,a),a}function koe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Aoe(e,t=!1,n){let r=UM(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;VM(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&IM(),o[e.id]=e,c!==0&&e.path){let t=koe(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(HM);return{processedTree:{segmentTree:r,singleCache:LM(1e3),matchCache:LM(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function WM(e,t,n=!1){let r=e.split(`/`),i=Moe(e,r,t,n);if(!i)return null;let[a]=GM(e,r,i);return{route:i.node.route,rawParams:a}}function GM(e,t,n){let r=joe(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===RM)break;if(u.kind===zM){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 KM(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function joe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Moe(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!TM(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&&!YM(l,n))continue;if(i.parse){if(!JM(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==RM&&YM(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===RM||i.kind===2)&&YM(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&&(JM(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Noe(f,o))return n;YM(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+qM(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+qM(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+qM(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+qM(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 qM(e,t){return 2**(e-t-1)}function Noe(e,t){return e===2**(t-1)-1}function JM(e,t,n){let r,i;try{[r,i]=GM(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 YM(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===RM)>(e.node.kind===RM)||t.node.kind===RM==(e.node.kind===RM)&&t.node.depth>e.node.depth)))}function Poe(e){return XM(e.filter(e=>e!==void 0).join(`/`))}function XM(e){return e.replace(/\/{2,}/g,`/`)}function ZM(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 Foe(e){return QM(ZM(e))}function $M(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ioe(e,t,n){return $M(e,n)===$M(t,n)}function Loe({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=XM(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=XM(e)),o=e.split(`/`);o.length>1&&TM(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&&(TM(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?XM(s):s)||`/`;return a&&r&&r.set(a,c),c}function Roe(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 eN(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>tN(e,n)).join(`/`):tN(r,n):r}function zoe({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=BM(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=eN(`_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=eN(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=eN(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function tN(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Boe=`Error preloading route! ☝️`,Voe=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})),nN=t(((e,t)=>{t.exports=Voe()})),Q=nN();function Hoe({children:e,fallback:t=null}){return(0,Q.jsx)(Z.Fragment,{children:rN()?e:t})}function rN(){return Z.useSyncExternalStore(Uoe,()=>!0,()=>!1)}function Uoe(){return()=>{}}var iN=Z.createContext(null);function aN(e){return Z.useContext(iN)}var Woe=t((e=>{var t=SM();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})),oN=t(((e,t)=>{t.exports=Woe()})),Goe=t((e=>{var t=SM(),n=oN();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}})),sN=t(((e,t)=>{t.exports=Goe()})),cN=sN();function Koe(e,t){return e===t}function lN(e,t,n=Koe){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,cN.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function uN(e){let t=aN();return Z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function qoe(e){let t=aN(),n=uN(),r=Z.useRef(null);return CM(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function dN(e){let t=Z.useRef(e);return NM(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Joe(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Yoe(e,t,n){if(e?.external)return FM(e.href,n)?void 0:e.href;if(!nse(t)&&wM(t))return FM(t,n)?void 0:t}function Xoe(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Ioe(e.pathname,t.pathname,r))return!1}else{let n=$M(e.pathname,r),i=$M(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!NM(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function Zoe(e,t){let n=aN(),r=foe(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=rN(),z=dN(e.search),te=dN(e.params),ne=dN(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=tse(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=Yoe(r,R,n.protocolAllowlist);return[r?.href,i,Xoe(e,t,ne,n.basepath,ee,i!==void 0)]},[ne,v,ee,re,n,R]),[ae,oe,se]=lN(n.stores.location,ie,Joe),ce=se?EM(i,{})??Qoe:fN,le=se?fN:EM(a,{})??fN,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(Boe)})},[n,re]),ge=Z.useCallback(e=>{if(!e){mN(r);return}if(!(e.isIntersecting??pe===`intent`)){e.isIntersecting===!1&&mN(r);return}if(!me){he();return}pN.has(r)||pN.set(r,setTimeout(()=>{pN.delete(r),he()},me))},[he,r,pe,me]);doe(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`&&mN(r)};return{...L,...ce,...le,href:ae,ref:r,onClick:hN([x,_e]),onBlur:hN([S,ye]),onFocus:hN([C,ge]),onMouseEnter:hN([w,ge]),onMouseLeave:hN([T,ye]),onTouchStart:hN([E,ve]),disabled:!!v,target:_,...de&&{style:de},...ue&&{className:ue},...v&&$oe,...se&&ese}}var fN={},Qoe={className:`active`},$oe={role:`link`,"aria-disabled":!0},ese={"data-status":`active`,"aria-current":`page`},pN=new WeakMap,mN=e=>{clearTimeout(pN.get(e)),pN.delete(e)},hN=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function tse(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function nse(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var gN=Z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Zoe(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)}),rse=e=>e,ise=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}}}})),_N=t(((e,t)=>{t.exports=ise()})),ase=t((e=>{var t=SM();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`})),vN=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=ase()})),ose=t((e=>{var t=SM().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}})),yN=t(((e,t)=>{t.exports=ose()})),bN=e(_N(),1);function sse(e){let t=bN.unstable_scheduleCallback(4,e);return()=>bN.unstable_cancelCallback(t)}var xN=Z.createContext(qT({scheduleTask:sse,defaultIdleTTL:400})),SN=new WeakMap;function cse(e,t){let n=SN.get(e);n===void 0&&(n=new WeakMap,SN.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 fD(t,e)}};return n.set(t,i),i}function CN(e,t){let n=cse(e,t);return Z.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}var wN=(e,t)=>{let n=Z.useContext(xN);return t?CN(n,Z.useMemo(()=>eD(e,t),[e,t])):CN(n,e)};function TN(e,t){Z.useEffect(()=>e.mount(t),[t,e])}function EN(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?Z.useCallback(r=>{e.set(t,r);let i=Up(XT(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(lse):i},[e,t,n.mode]):Z.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var lse=e=>{if(uu(e))return e.value;throw Ul(e.cause)},DN=e=>{TN(Z.useContext(xN),e)},ON=(e,t)=>{let n=Z.useContext(xN);return TN(n,e),EN(n,e,t)},kN=e=>{let t=Z.useContext(xN);return TN(t,e),Z.useCallback(()=>{t.refresh(e)},[t,e])},AN=(e,t)=>{let n=Z.useContext(xN);return[CN(n,e),EN(n,e,t)]},jN={suspendOnWaiting:new WeakMap,default:new WeakMap};function use(e,t,n){let r=n?jN.suspendOnWaiting:jN.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 dse(e,t,n){let r=CN(e,t);if(r._tag===`Initial`||n&&r.waiting)throw use(e,t,n);return r}var fse=(e,t)=>{let n=dse(Z.useContext(xN),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw Ul(n.cause);return n},MN=e=>{let[,t]=Z.useReducer(e=>e+1,0);return Z.useEffect(()=>e.subscribe(t),[e]),e.value},NN=oN();function PN(){}var FN=Object.freeze([]),IN=Object.freeze({});function LN(e){Z.useEffect(e,FN)}var RN={};function zN(e,t){let n=Z.useRef(RN);return n.current===RN&&(n.current=e(t)),n}var BN=typeof document<`u`?Z.useLayoutEffect:()=>{},VN=e(vN(),1);function pse(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 HN=pse(`https://base-ui.com/production-error`,`Base UI`),mse=19;function UN(e){return mse>=e}var WN=[],GN=void 0;function hse(){return GN}function gse(e){WN.push(e)}function KN(e){let t=(t,n)=>{let r=zN(_se).current,i;try{GN=r;for(let e of WN)e.before(r);i=e(t,n);for(let e of WN)e.after(r);r.didInitialize=!0}finally{GN=void 0}return i};return t.displayName=e.displayName||e.name,t}function qN(e){return Z.forwardRef(KN(e))}function _se(){return{didInitialize:!1}}var vse=UN(19)?bse:xse;function JN(e,t,n,r,i){return vse(e,t,n,r,i)}function yse(e,t,n,r,i){let a=Z.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,NN.useSyncExternalStore)(e.subscribe,a,a)}gse({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,NN.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function bse(e,t,n,r,i){let a=hse();if(!a)return yse(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 xse(e,t,n,r,i){return(0,cN.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Sse=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 JN(this,e,t,n,r)}},YN={...Z},XN=YN.useInsertionEffect,Cse=XN&&XN!==YN.useLayoutEffect?XN:e=>e();function ZN(e){let t=zN(wse).current;return t.next=e,Cse(t.effect),t.trampoline}function wse(){let e={next:void 0,callback:Tse,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Tse(){}var QN=class extends Sse{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Z.useDebugValue(e);let n=this;BN(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;BN(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;BN(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){Z.useDebugValue(e);let n=this,r=t!==void 0;BN(()=>{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),JN(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Z.useDebugValue(e);let n=ZN(t??PN);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 $N(){return typeof window<`u`}function eP(e){return rP(e)?(e.nodeName||``).toLowerCase():`#document`}function tP(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function nP(e){return((rP(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function rP(e){return $N()?e instanceof Node||e instanceof tP(e).Node:!1}function iP(e){return $N()?e instanceof Element||e instanceof tP(e).Element:!1}function aP(e){return $N()?e instanceof HTMLElement||e instanceof tP(e).HTMLElement:!1}function oP(e){return!$N()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof tP(e).ShadowRoot}function sP(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=mP(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ese(e){return/^(table|td|th)$/.test(eP(e))}function cP(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Dse=/transform|translate|scale|rotate|perspective|filter/,Ose=/paint|layout|strict|content/,lP=e=>!!e&&e!==`none`,uP;function dP(e){let t=iP(e)?mP(e):e;return lP(t.transform)||lP(t.translate)||lP(t.scale)||lP(t.rotate)||lP(t.perspective)||!fP()&&(lP(t.backdropFilter)||lP(t.filter))||Dse.test(t.willChange||``)||Ose.test(t.contain||``)}function kse(e){let t=gP(e);for(;aP(t)&&!pP(t);){if(dP(t))return t;if(cP(t))return null;t=gP(t)}return null}function fP(){return uP??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),uP}function pP(e){return/^(html|body|#document)$/.test(eP(e))}function mP(e){return tP(e).getComputedStyle(e)}function hP(e){return iP(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gP(e){if(eP(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||oP(e)&&e.host||nP(e);return oP(t)?t.host:t}function _P(e){let t=gP(e);return pP(t)?(e.ownerDocument||e).body:aP(t)&&sP(t)?t:_P(t)}function vP(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=_P(e),i=r===e.ownerDocument?.body,a=tP(r);if(i){let e=yP(a);return t.concat(a,a.visualViewport||[],sP(r)?r:[],e&&n?vP(e):[])}return t.concat(r,vP(r,[],n))}function yP(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bP(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function xP(e){return e?.ownerDocument||document}function SP(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var CP=null;globalThis.requestAnimationFrame;var wP=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)}},TP=class e{static create(){return new e}static request(e){return wP.request(e)}static cancel(e){return wP.cancel(e)}currentId=CP;request(e){this.cancel(),this.currentId=wP.request(()=>{this.currentId=CP,e()})}cancel=()=>{this.currentId!==CP&&(wP.cancel(this.currentId),this.currentId=CP)};disposeEffect=()=>this.cancel};function EP(){let e=zN(TP.create).current;return LN(e.disposeEffect),e}var DP=0,OP=class e{static create(){return new e}currentId=DP;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=DP,t()},e)}isStarted(){return this.currentId!==DP}clear=()=>{this.currentId!==DP&&(clearTimeout(this.currentId),this.currentId=DP)};disposeEffect=()=>this.clear};function kP(){let e=zN(OP.create).current;return LN(e.disposeEffect),e}function Ase(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:jse,platform:Mse,maxTouchPoints:Nse}=Ase(),AP=jse.toLowerCase(),jP=Mse.toLowerCase(),MP=/^i(os$|p)/.test(jP)||jP===`macintel`&&Nse>1,NP=`android`,PP=jP===NP||AP.includes(NP),FP=!MP&&jP.startsWith(`mac`);jP.startsWith(`win`),!PP&&/^(linux|chrome os)/.test(jP);var Pse=FP||MP,IP=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!IP&&AP.includes(`firefox`),!IP&&AP.includes(`chrom`);var Fse=Pse,LP=/jsdom|happydom/.test(AP);function RP(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function zP(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&oP(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function BP(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var Ise=`data-base-ui-focusable`,Lse=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,VP=`ArrowLeft`,HP=`ArrowRight`,Rse=`ArrowUp`,zse=`ArrowDown`,UP=`data-starting-style`,WP=`data-ending-style`,Bse={[UP]:``},Vse={[WP]:``},GP={transitionStatus(e){return e===`starting`?Bse:e===`ending`?Vse:null}},Hse=`data-open`,Use=`data-closed`,Wse=`data-anchor-hidden`,KP=`data-popup-open`,Gse=`data-pressed`,Kse={[KP]:``},qse={[KP]:``,[Gse]:``},Jse={[Hse]:``},Yse={[Use]:``},Xse={[Wse]:``},qP={open(e){return e?Kse:null}},JP={open(e){return e?qse:null}},YP={open(e){return e?Jse:Yse},anchorHidden(e){return e?Xse:null}},XP={...YP,...GP},ZP=`data-trigger-disabled`;function QP(e,t){if(!iP(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(ZP);for(let[,e]of t.entries())if(zP(e,n))return!e.hasAttribute(ZP);return!1}function $P(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 Zse(e){return e.matches(`html,body`)}function eF(e){return aP(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Qse(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Lse}`)!=null}function tF(e){return e?e.getAttribute(`role`)===`combobox`&&eF(e):!1}function nF(e){if(!e||LP)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function rF(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function iF(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...iF(e,t.id,n)])}function aF(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 oF(e){e.preventDefault(),e.stopPropagation()}function $se(e){return`nativeEvent`in e}function sF(e){return e.pointerType===``&&e.isTrusted?!0:PP&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function cF(e){return LP?!1:!PP&&e.width===0&&e.height===0||PP&&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 lF(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function ece(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var uF=Math.min,dF=Math.max,fF=Math.round,pF=Math.floor,mF=e=>({x:e,y:e}),tce={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function hF(e,t,n){return dF(e,uF(t,n))}function gF(e,t){return typeof e==`function`?e(t):e}function _F(e){return e.split(`-`)[0]}function vF(e){return e.split(`-`)[1]}function yF(e){return e===`x`?`y`:`x`}function bF(e){return e===`y`?`height`:`width`}function xF(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function SF(e){return yF(xF(e))}function nce(e,t,n){n===void 0&&(n=!1);let r=vF(e),i=SF(e),a=bF(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=EF(o)),[o,EF(o)]}function rce(e){let t=EF(e);return[CF(e),t,CF(t)]}function CF(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var wF=[`left`,`right`],TF=[`right`,`left`],ice=[`top`,`bottom`],ace=[`bottom`,`top`];function oce(e,t,n){switch(e){case`top`:case`bottom`:return n?t?TF:wF:t?wF:TF;case`left`:case`right`:return t?ice:ace;default:return[]}}function sce(e,t,n,r){let i=vF(e),a=oce(_F(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(CF)))),a}function EF(e){let t=_F(e);return tce[t]+e.slice(t.length)}function cce(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function DF(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:cce(e)}function OF(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 kF(e,t){return t<0||t>=e.length}function AF(e,t){return MF(e.current,{disabledIndices:t})}function jF(e,t){return MF(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function MF(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&&NF(e,a,r));return a}function NF(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!PF(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function lce(e){return e.visibility===`hidden`||e.visibility===`collapse`}function PF(e,t=e?mP(e):null){return!e||!e.isConnected||!t||lce(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var uce=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function dce(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return oP(n)?n.host:null}function FF(e){for(let t of Array.from(e.children))if(eP(t)===`summary`)return t;return null}function fce(e,t){let n=FF(t);return!!n&&(e===n||zP(n,e))}function IF(e){let t=e?eP(e):``;return e!=null&&e.matches(uce)&&(t!==`summary`||e.parentElement!=null&&eP(e.parentElement)===`details`&&FF(e.parentElement)===e)&&(t!==`details`||FF(e)==null)&&(t!==`input`||e.type!==`hidden`)}function LF(e){if(!IF(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=dce(t)){let n=t!==e,r=eP(t)===`slot`;if(t.hasAttribute(`inert`)||n&&eP(t)===`details`&&!t.open&&!fce(e,t)||t.hasAttribute(`hidden`)||!r&&!pce(t,n))return!1}return!0}function pce(e,t){let n=mP(e);return t?n.display!==`none`:PF(e,n)}function RF(e){let t=e.tabIndex;if(t<0){let t=eP(e);if(t===`details`||t===`audio`||t===`video`||aP(e)&&e.isContentEditable)return 0}return t}function zF(e){if(eP(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function mce(e,t){let n=zF(e);if(!n)return!0;let r=t.find(e=>{let t=zF(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=zF(e);return t?.name===n.name&&t.form===n.form})===n}function BF(e){if(aP(e)&&eP(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return aP(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function VF(e,t){BF(e).forEach(e=>{IF(e)&&t.push(e),VF(e,t)})}function HF(e,t,n){BF(e).forEach(e=>{aP(e)&&e.matches(t)&&n.push(e),HF(e,t,n)})}function UF(e){return LF(e)&&RF(e)>=0}function WF(e){let t=[];return VF(e,t),t.filter(LF)}function GF(e){let t=WF(e);return t.filter(e=>RF(e)>=0&&mce(e,t))}function KF(e,t){let n=GF(e),r=n.length;if(r===0)return;let i=RP(xP(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function qF(e){return KF(xP(e).body,1)||e}function JF(e){return KF(xP(e).body,-1)||e}function YF(e,t){if(!e)return null;let n=GF(xP(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 XF(e){return YF(e,1)}function ZF(e){return YF(e,-1)}function QF(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!zP(n,r)}function $F(e){GF(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function eI(e){let t=[];HF(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 tI={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},nI={...tI,position:`fixed`,top:0,left:0},rI={...tI,position:`absolute`},iI=Z.forwardRef(function(e,t){let[n,r]=Z.useState();BN(()=>{Fse&&IP&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Q.jsx)(`span`,{...e,ref:t,style:nI,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function aI(e,t,n,r){let i=zN(sI).current;return cI(i,e,t,n,r)&&uI(i,[e,t,n,r]),i.callback}function oI(e){let t=zN(sI).current;return lI(t,e)&&uI(t,e),t.callback}function sI(){return{callback:null,cleanup:null,refs:[]}}function cI(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function lI(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function uI(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 dI(e){if(!Z.isValidElement(e))return null;let t=e,n=t.props;return(UN(19)?n?.ref:t.ref)??null}function fI(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function pI(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 mI(e,t){return typeof e==`function`?e(t):e}function hI(e,t){return typeof e==`function`?e(t):e}var gI={};function _I(e,t,n,r,i){if(!n&&!r&&!i&&!e)return yI(t);let a=yI(e);return t&&(a=bI(a,t)),n&&(a=bI(a,n)),r&&(a=bI(a,r)),i&&(a=bI(a,i)),a}function vI(e){if(e.length===0)return gI;if(e.length===1)return yI(e[0]);let t=yI(e[0]);for(let n=1;n<e.length;n+=1)t=bI(t,e[n]);return t}function yI(e){return wI(e)?{...TI(e,gI)}:xI(e)}function bI(e,t){return wI(t)?TI(t,e):SI(e,t)}function xI(e){let t={...e};for(let e in t){let n=t[e];CI(e,n)&&(t[e]=DI(n))}return t}function SI(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=fI(e.style,r);break;case`className`:e[n]=kI(e.className,r);break;default:e[n]=CI(n,r)?EI(e[n],r):r}}return e}function CI(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 wI(e){return typeof e==`function`}function TI(e,t){return wI(e)?e(t):e??gI}function EI(e,t){return t?e?(...n)=>{let r=n[0];if(AI(r)){let i=r;OI(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:DI(t):e}function DI(e){return e&&((...t)=>{let n=t[0];return AI(n)&&OI(n),e(...t)})}function OI(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function kI(e,t){return t?e?t+` `+e:t:e}function AI(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function jI(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=FI(r));let i=MI(t,n,r);if(n.enabled===!1)return null;let a=n.state??IN;return II(e,r,i,a)}function MI(e,t,n){let{className:r,style:i}=e,{state:a=IN,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?mI(r,a):void 0,d=l?hI(i,a):void 0,f=l?pI(a,c):IN,p=l&&s?NI(s):void 0,m=l?fI(f,p)??{}:IN;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?oI([m.ref,dI(n),...o]):aI(m.ref,dI(n),o):aI(null,null)),l?(u!==void 0&&(m.className=kI(m.className,u)),d!==void 0&&(m.style=fI(m.style,d)),m):IN}function NI(e){return Array.isArray(e)?vI(e):_I(void 0,e)}var PI=Symbol.for(`react.lazy`);function FI(e){if(e?.$$typeof!==PI)return e;let t=Z.Children.toArray(e)[0];return Z.isValidElement(t)?t:e}function II(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=_I(n,t.props);return e.ref=n.ref,Z.cloneElement(t,e)}if(e&&typeof e==`string`)return LI(e,n);throw Error(HN(8))}function LI(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 RI(e){return UN(19)?e:e?`true`:void 0}function zI(e){return e==null?e:`current`in e?e.current:e}var BI=null;function VI(e){if(!BI){let e=[];BI=e,queueMicrotask(()=>{BI=null,VN.flushSync(()=>{for(let t of e)t()})})}BI.push(e)}function HI(e,t=!1,n=!1){let r=EP();return ZN((i,a=null)=>{r.cancel();let o=zI(e);if(o==null)return;let s=o,c=()=>{if(!n){VN.flushSync(i);return}VI(()=>{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=UP;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 UI(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=ZN(a),s=HI(r,n,i);Z.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var WI={style:{transition:`none`}},GI=`data-base-ui-click-trigger`,KI=`data-base-ui-swipe-ignore`,qI=`data-swipe-ignore`,JI=`[${KI}]`,YI=`[${qI}]`,XI={fallbackAxisSide:`none`},ZI={fallbackAxisSide:`end`},QI={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function $I(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var eL=0;function tL(e,t=`mui`){let[n,r]=Z.useState(e),i=e||n;return Z.useEffect(()=>{n??(eL+=1,r(`${t}-${eL}`))},[n,t]),i}var nL=YN.useId;function rL(e,t){if(nL!==void 0){let n=nL();return e??(t?`${t}-${n}`:n)}return tL(e,t)}var iL=Z.createContext(void 0);function aL(e=!1){let t=Z.useContext(iL);if(t===void 0&&!e)throw Error(HN(16));return t}function oL(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 sL(e,t,{detail:n=0}={}){e.dispatchEvent(new(tP(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function cL(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),s=aL(!0),c=a??s!==void 0,{props:l}=oL({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=Z.useCallback(()=>{let e=o.current;lL(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return BN(u,[u]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return _I({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(OI(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=lL(r),s=!i&&uL(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(),sL(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),sL(r,e)))},onKeyUp(e){if(!t){if(OI(e),a?.(e),e.target===e.currentTarget&&i&&c&&lL(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),sL(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:ZN(e=>{o.current=e,u()})}}function lL(e){return aP(e)&&e.tagName===`BUTTON`}function uL(e){return aP(e)&&e.tagName===`A`&&!!e.href}var dL=`none`,fL=`trigger-press`,pL=`trigger-hover`,mL=`trigger-focus`,hL=`outside-press`,gL=`item-press`,_L=`close-press`,vL=`focus-out`,yL=`escape-key`,bL=`list-navigation`,xL=`cancel-open`,SL=`sibling-open`,CL=`disabled`,wL=`missing`,TL=`initial`,EL=`imperative-action`,DL=`window-resize`;function OL(e,t,n,r){let i=!1,a=!1,o=r??IN;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 kL(e){return`data-base-ui-${e}`}var AL=Z.createContext(null),jL=()=>Z.useContext(AL),ML=kL(`portal`);function NL(e={}){let{ref:t,container:n,componentProps:r=IN,elementProps:i}=e,a=rL(),o=jL()?.portalNode,[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=ZN(e=>{e!==null&&u(e)}),f=Z.useRef(null);BN(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(rP(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=jI(`div`,r,{ref:[t,d],props:[{id:a,[ML]:``},i]}),m=s&&p?VN.createPortal(p,s):null;return{node:l,nodeId:Z.isValidElement(p)?p.props.id:void 0,subtree:m}}var PL=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}=NL({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&&QF(e)&&(e.type===`focusin`?v.current&&=(eI(l),!1):($F(l),v.current=!0))}return bP(SP(l,`focusin`,e,!0),SP(l,`focusout`,e,!0))},[l,y]),BN(()=>{l&&b===!0&&v.current&&(eI(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)(AL.Provider,{value:S,children:[x&&l&&(0,Q.jsx)(iI,{"data-type":`outside`,ref:f,onFocus:e=>{QF(e,l)?m.current?.focus():JF(g?g.domReference:null)?.focus()}}),x&&l&&(0,Q.jsx)(`span`,{role:s,"aria-owns":u,style:QI}),l&&VN.createPortal(a,l),x&&l&&(0,Q.jsx)(iI,{"data-type":`outside`,ref:p,onFocus:e=>{QF(e,l)?h.current?.focus():(qF(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,OL(`focus-out`,e.nativeEvent)))}})]})]})}),FL=Z.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=NL({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Q.jsxs)(Z.Fragment,{children:[l,c&&VN.createPortal(n,c)]})});function IL(e){let t=zN(LL,e).current;return t.next=e,BN(t.effect),t}function LL(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function RL(e,t){return t!=null&&!lF(t)?0:typeof e==`function`?e():e}function zL(e,t,n){let r=RL(e,n);return typeof r==`number`?r:r?.[t]}function BL(e){return typeof e==`function`?e():e}function VL(e,t){return t||e===`click`||e===`mousedown`}function HL(e){return e?.includes(`mouse`)&&e!==`mousedown`}var UL=Z.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new OP,currentIdRef:{current:null},currentContextRef:{current:null}});function WL(e,t){e.current=t.current}function GL(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=kP();return BN(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:zL(i.current,`open`),close:zL(n,`close`)}},[n,o,i,a]),(0,Q.jsx)(UL.Provider,{value:Z.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function KL(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(UL),[f,p]=Z.useState(!1),m=Z.useRef(n);return BN(()=>{m.current=n},[n]),BN(()=>{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]),BN(()=>{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:zL(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,OL(dL))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),BN(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,WL(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 qL=0;function JL(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(qL);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),PN;let o=requestAnimationFrame(a);return qL=o,()=>{qL===o&&(cancelAnimationFrame(o),qL=0)}}var YL={inert:new WeakMap,"aria-hidden":new WeakMap},XL=`data-base-ui-inert`,ZL={inert:new WeakSet,"aria-hidden":new WeakSet},QL=new WeakMap,$L=0;function eR(e){return ZL[e]}function tR(e){return e?oP(e)?e.host:tR(e.parentNode):null}var nR=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=tR(t);return e.contains(n)?n:null}).filter(e=>e!=null),rR=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},iR=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{eP(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function aR(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=nR(t,e),l=i?iR(t,rR(c),new Set(c)):[],u=[],d=[];if(a){let e=YL[a],n=eR(a);s=n,o=e;let r=nR(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);iR(t,rR(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=(QL.get(e)||0)+1;QL.set(e,t),d.push(e),t===1&&e.setAttribute(XL,``)}),$L+=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=(QL.get(e)||0)-1;QL.set(e,t),t||e.removeAttribute(XL)}),--$L,$L||(YL.inert=new WeakMap,YL[`aria-hidden`]=new WeakMap,ZL.inert=new WeakSet,ZL[`aria-hidden`]=new WeakSet,QL=new WeakMap)}}function oR(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=xP(e[0]).body;return aR(e,a,n,r,{mark:i})}function sR(){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 cR=class{nodesRef={current:[]};events=sR();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)}},lR=Z.createContext(null),uR=Z.createContext(null),dR=()=>Z.useContext(lR)?.id||null,fR=e=>{let t=Z.useContext(uR);return e??t};function pR(e){let t=rL(),n=fR(e),r=dR();return BN(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function mR(e){let{children:t,id:n}=e,r=dR();return(0,Q.jsx)(lR.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function hR(e){let{children:t,externalTree:n}=e,r=zN(()=>n??new cR).current;return(0,Q.jsx)(uR.Provider,{value:r,children:t})}function gR(e,t){let n=tP(BP(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 _R=20,vR=[];function yR(){vR=vR.filter(e=>e.deref()?.isConnected)}function bR(e){yR(),e&&eP(e)!==`body`&&(vR.push(new WeakRef(e)),vR.length>_R&&(vR=vR.slice(-20)))}function xR(){return yR(),vR[vR.length-1]?.deref()}function SR(e){return e?UF(e)?e:GF(e)[0]||e:null}function CR(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=WF(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return UF(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 wR(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=ZN(()=>b.current.floatingContext?.nodeId),S=i===!1,C=tF(_)&&S,w=IL(i),T=IL(a),E=IL(l),D=IL(g),O=fR(p),k=jL(),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=aI(I,f,k?.beforeInsideRef),ee=aI(L,k?.afterInsideRef),z=kP(),te=kP(),ne=EP(),re=k!=null,ie=rF(v),ae=ZN((e=ie)=>e?GF(e):[]),oe=ZN(()=>m?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&zP(ie,RP(xP(ie)))&&ae().length===0&&!C&&oF(e)}return SP(xP(ie),`keydown`,e)},[r,ie,s,C,ae]),Z.useEffect(()=>{if(r||!g)return;let e=xP(ie);function t(){M.current=!1}function n(e){let t=BP(e),n=oe(),r=zP(v,t)||zP(_,t)||zP(k?.portalNode,t)||n.some(e=>e===t||zP(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 bP(SP(e,`pointerdown`,n,!0),SP(e,`pointerup`,t,!0),SP(e,`pointercancel`,t,!0),SP(e,`keydown`,i,!0),t)},[r,v,_,ie,g,k,te,oe]),Z.useEffect(()=>{if(r||!c)return;let e=xP(ie);function t(){j.current=!0,te.start(0,()=>{j.current=!1})}function n(e){let t=BP(e);UF(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=BP(t);s&&n==null&&i!=null&&zP(v,i)&&bR(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=oe(),f=n?.hasAttribute(kL(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,zI(d),zI(u)].includes(n),p=!(zP(_,n)||zP(v,n)||zP(n,v)||zP(k?.portalNode,n)||l.some(e=>e===n||zP(e,n))||c.hasMatchingElement(e=>zP(e,n))||f||O&&(iF(O.nodesRef.current,a).find(e=>zP(e.context?.elements.floating,n)||zP(e.context?.elements.domReference,n))||aF(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,rF(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&ie&&CR(ie),o&&r!==_&&!PF(i)&&RP(e)===e.body){if(aP(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;aP(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!j.current&&(C||n!==xR())&&(A.current=!0,h.setOpen(!1,OL(vL,t)))})}function a(){M.current||(b.current.insideReactTree=!0,z.start(0,()=>{b.current.insideReactTree=!1}))}let l=aP(_)?_:null;if(v||l)return bP(l&&SP(l,`focusout`,i),l&&SP(l,`pointerdown`,t),v&&SP(v,`focusin`,n),v&&SP(v,`focusout`,i),v&&k&&SP(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(`[${kL(`portal`)}]`)||[]),t=(O?aF(O.nodesRef.current,x()):[]).find(e=>tF(e.context?.elements.domReference||null))?.context?.elements.domReference,n=oR([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...oe(),t,zI(d),zI(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=oR([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,oe]),BN(()=>{if(!g||r||!aP(ie))return;P.current=``,F.current=``;let e=xP(ie),t=RP(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||zP(ie,t))return;let i=null,a=()=>(i??=ae(ie),i[0]||ie),o;o=r===!0||r===null?a():zI(r),o||=a();let s=zP(ie,RP(e));JL(o,{preventScroll:o===ie,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=RP(e);return!(t!==o&&zP(ie,t))}})})},[r,g,ie,ae,w,E,D]),BN(()=>{if(r||!ie)return;let e=xP(ie),t=RP(e),n=E.current==null;bR(t);function i(e){if(e.open||(P.current=gR(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(sF(e.nativeEvent)||cF(e.nativeEvent))A.current=!1;else{let e=!1;xP(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&&eP(t)!==`body`?t:null,s=n?o||a:a||o;return s||=xR()||null,typeof i==`boolean`?s:zI(i)||s||null}return()=>{y.off(`openchange`,i);let t=RP(e),n=oe(),r=zP(v,t)||n.some(e=>e===t||zP(e,t))||O&&iF(O.nodesRef.current,x(),!1).some(e=>zP(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=SR(c),i=typeof o!=`boolean`;if(o&&!A.current&&aP(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]),BN(()=>{if(!IP||g||!v)return;let e=RP(xP(v));aP(e)&&eF(e)&&zP(v,e)&&e.blur()},[g,v]),BN(()=>{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,_]),BN(()=>{if(!r&&ie)return CR(ie),()=>{queueMicrotask(yR)}},[r,ie]);let se=!r&&(!s||!C)&&(re||s);return(0,Q.jsxs)(Z.Fragment,{children:[se&&(0,Q.jsx)(iI,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=ae();JL(e[e.length-1])}else k?.portalNode&&(A.current=!1,QF(e,k.portalNode)?qF(_)?.focus():zI(d??k.beforeOutsideRef)?.focus())}}),n,se&&(0,Q.jsx)(iI,{"data-type":`inside`,ref:ee,onFocus:e=>{s?JL(ae()[0]):k?.portalNode&&(c&&(A.current=!0),QF(e,k.portalNode)?JF(_)?.focus():zI(u??k.afterOutsideRef)?.focus())}})]})}function TR(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=fL}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),f=EP(),p=kP(),m=Z.useMemo(()=>{function e(e,t,n,r){let i=OL(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=lF(e.pointerType,!0)&&cF(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||lF(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=BP(o);if(eF(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}lF(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}:IN,[n,m])}function ER(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 DR(e){return e!=null&&e.clientX!=null}function OR(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=ZN(e=>{i.set(`positionReference`,e)}),g=ZN((e,t,n)=>{l.current||(!c.current.openEvent||DR(c.current.openEvent))&&i.set(`positionReference`,ER(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=ZN(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=lF(d)?o:a;Z.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=tP(o);function r(t){let n=BP(t);zP(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||DR(c.current.openEvent)?u.current=SP(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 kR(){return!1}function AR(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function jR(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=kR,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=fR(c),h=ZN(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=ZN(()=>a),{escapeKey:y,outsidePress:b}=AR(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=kP(),k=kP(),A=ZN(()=>{k.clear(),f.current.insideReactTree=!1}),j=ZN(e=>{let t=f.current.floatingContext?.nodeId;return(m?iF(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=ZN(e=>$P(e,l.select(`floatingElement`))||$P(e,l.select(`domReferenceElement`))),N=ZN(e=>{o()&&l.setOpen(!1,OL(fL,e.nativeEvent))}),P=ZN(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=OL(yL,$se(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),F=ZN(()=>{f.current.insideReactTree=!0,k.start(0,A)}),I=ZN(e=>{if(!u||!n||e.button!==0)return;let t=BP(e.nativeEvent);zP(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),L=ZN(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 OP,t=new OP,i=xP(d);function a(){e.clear(),T.current=!0}function o(){e.start(IP?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&&iF(m.nodesRef.current,t).some(t=>$P(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=BP(e),r=`[${kL(`inert`)}]`,i=iP(n)?n.getRootNode():null,a=Array.from((oP(i)?i:xP(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>zP(e,n))))return;let s=iP(n)?n:null;for(;s&&!pP(s);){let e=gP(s);if(pP(e)||!iP(e))break;s=e}if(!(a.length&&iP(n)&&!Zse(n)&&!zP(n,l.select(`floatingElement`))&&a.every(e=>!zP(s,e)))){if(aP(n)&&!(`touches`in e)){let t=pP(n),r=mP(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&&!sF(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}(typeof g!=`function`||g(e))&&(j(`__outsidePressBubbles`)||(l.setOpen(!1,OL(hL,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=BP(e);if(!n)return;let r=SP(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=bP(r&&bP(SP(i,`keydown`,P),SP(i,`compositionstart`,a),SP(i,`compositionend`,o)),_&&bP(SP(i,`click`,ee,!0),SP(i,`pointerdown`,ee,!0),SP(i,`pointerup`,z,!0),SP(i,`pointercancel`,z,!0),SP(i,`mousedown`,ee,!0),SP(i,`mouseup`,z,!0),SP(i,`touchstart`,R,{capture:!0,passive:!0}),SP(i,`touchmove`,ne,{capture:!0,passive:!0}),SP(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 MR(e,t,n){let{reference:r,floating:i}=e,a=xF(t),o=SF(t),s=bF(o),c=_F(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=vF(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function NR(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}=gF(t,e),p=DF(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=OF(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=OF(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 PR=50,FR=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:NR},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=MR(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<PR&&(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}=MR(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},IR=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}=gF(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=_F(r),_=xF(o),v=_F(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[EF(o)]:rce(o)),x=p!==`none`;!d&&x&&b.push(...sce(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=nce(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`||_===xF(t)||T.every(e=>xF(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=xF(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{}}}},LR=new Set([`left`,`top`]);async function RR(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=_F(n),s=vF(n),c=xF(n)===`y`,l=LR.has(o)?-1:1,u=a&&c?-1:1,d=gF(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 zR=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 RR(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}}}}},BR=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}=gF(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=xF(i),p=yF(f),m=u[p],h=u[f],g=(e,t)=>hF(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}}}}}},VR=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}=gF(e,t),u={x:n,y:r},d=xF(i),f=yF(d),p=u[f],m=u[d],h=gF(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=LR.has(_F(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}}}},HR=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}=gF(e,t),c=await i.detectOverflow(t,s),l=_F(n),u=vF(n),d=xF(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=uF(p-c[m],g),y=uF(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*dF(c.left,c.right):S=p-2*dF(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 UR(e){let t=mP(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=aP(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=fF(n)!==a||fF(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function WR(e){return iP(e)?e:e.contextElement}function GR(e){let t=WR(e);if(!aP(t))return mF(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=UR(t),o=(a?fF(n.width):n.width)/r,s=(a?fF(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var KR=mF(0);function qR(e){let t=tP(e);return!fP()||!t.visualViewport?KR:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function JR(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===tP(e)}function YR(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=WR(e),o=mF(1);t&&(r?iP(r)&&(o=GR(r)):o=GR(e));let s=JR(a,n,r)?qR(a):mF(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=tP(a),t=iP(r)?tP(r):r,n=e,i=yP(n);for(;i&&t!==n;){let e=GR(i),t=i.getBoundingClientRect(),r=mP(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=tP(i),i=yP(n)}}return OF({width:u,height:d,x:c,y:l})}function XR(e,t){let n=hP(e).scrollLeft;return t?t.left+n:YR(nP(e)).left+n}function ZR(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-XR(e,n),y:n.top+t.scrollTop}}function QR(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=nP(r),s=t?cP(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=mF(1),u=mF(0),d=aP(r);if((d||!a)&&((eP(r)!==`body`||sP(o))&&(c=hP(r)),d)){let e=YR(r);l=GR(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ZR(o,c):mF(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 $R(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ez(e){let t=hP(e),n=e.ownerDocument.body,r=dF(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=dF(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+XR(e),o=-t.scrollTop;return mP(n).direction===`rtl`&&(a+=dF(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var tz=25;function nz(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=tP(e),a=nP(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!fP()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(XR(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<=tz&&(s-=o)}return{width:s,height:c,x:l,y:u}}function rz(e,t){let n=YR(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=GR(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function iz(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=nz(e,n,t);else if(t===`document`)r=ez(nP(e));else if(iP(t))r=rz(t,n);else{let n=qR(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return OF(r)}function az(e,t){let n=t.get(e);if(n)return n;let r=vP(e,[],!1).filter(e=>iP(e)&&eP(e)!==`body`),i=null,a=mP(e).position===`fixed`,o=a?gP(e):e;for(;iP(o)&&!pP(o);){let e=mP(o),t=dP(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=gP(o)}return t.set(e,r),r}function oz(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?cP(t)?[]:az(t,this._c):[].concat(n),r],o=iz(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=iz(t,a[e],i);s=dF(n.top,s),c=uF(n.right,c),l=uF(n.bottom,l),u=dF(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function sz(e){let{width:t,height:n}=UR(e);return{width:t,height:n}}function cz(e,t,n){let r=aP(t),i=nP(t),a=n===`fixed`,o=YR(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=mF(0);if((r||!a)&&((eP(t)!==`body`||sP(i))&&(s=hP(t)),r)){let e=YR(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=XR(i));let l=i&&!r&&!a?ZR(i,s):mF(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 lz(e){return mP(e).position===`static`}function uz(e,t){if(!aP(e)||mP(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return nP(e)===n&&(n=n.ownerDocument.body),n}function dz(e,t){let n=tP(e);if(cP(e))return n;if(!aP(e)){let t=gP(e);for(;t&&!pP(t);){if(iP(t)&&!lz(t))return t;t=gP(t)}return n}let r=uz(e,t);for(;r&&Ese(r)&&lz(r);)r=uz(r,t);return r&&pP(r)&&lz(r)&&!dP(r)?n:r||kse(e)||n}var fz=async function(e){let t=this.getOffsetParent||dz,n=this.getDimensions,r=await n(e.floating);return{reference:cz(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pz(e){return mP(e).direction===`rtl`}var mz={convertOffsetParentRelativeRectToViewportRelativeRect:QR,getDocumentElement:nP,getClippingRect:oz,getOffsetParent:dz,getElementRects:fz,getClientRects:$R,getDimensions:sz,getScale:GR,isElement:iP,isRTL:pz};function hz(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gz(e,t,n){let r=null,i,a=nP(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=pF(d),h=pF(a.clientWidth-(u+f)),g=pF(a.clientHeight-(d+p)),_=pF(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:dF(0,uF(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!hz(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=tP(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function _z(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=WR(e),u=i||a?[...l?vP(l):[],...t?vP(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?gz(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?YR(e):null;c&&g();function g(){let t=YR(e);h&&!hz(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 vz=zR,yz=BR,bz=IR,xz=HR,Sz=VR,Cz=(e,t,n)=>{let r=new Map,i=n??{},a={...mz,...i.platform,_c:r};return FR(e,t,{...i,platform:a})},wz=typeof document<`u`?Z.useLayoutEffect:function(){};function Tz(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(!Tz(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)&&!Tz(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Ez(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dz(e,t){let n=Ez(e);return Math.round(t*n)/n}function Oz(e){let t=Z.useRef(e);return wz(()=>{t.current=e}),t}function kz(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);Tz(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=Oz(c),D=Oz(i),O=Oz(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Cz(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Tz(w.current,t)&&(w.current=t,VN.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);wz(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);wz(()=>(A.current=!0,()=>{A.current=!1}),[]),wz(()=>{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=Dz(M.floating,u.x),r=Dz(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ez(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 Az=(e,t)=>{let n=vz(e);return{name:n.name,fn:n.fn,options:[e,t]}},jz=(e,t)=>{let n=yz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mz=(e,t)=>({fn:Sz(e).fn,options:[e,t]}),Nz=(e,t)=>{let n=bz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pz=(e,t)=>{let n=xz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fz={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},Iz=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:sR(),nested:n,triggerElements:i},Fz),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&ece(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 Lz(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 Iz({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),BN(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};iP(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 Rz(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),BN(()=>{if(!e&&o&&i!==`ending`&&n){let e=TP.request(()=>{a(`ending`)});return()=>{TP.cancel(e)}}},[e,o,i,n]),BN(()=>{if(!e||t)return;let n=TP.request(()=>{a(void 0)});return()=>{TP.cancel(n)}},[t,e]),BN(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=TP.request(()=>{a(`idle`)});return()=>{TP.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var zz={tabIndex:-1,[Ise]:``};function Bz(e){return t=>t!==`touch`||e.current}function Vz(e,t=!1){let n=rL(),r=dR()!=null,i=zN(()=>e(n,r)).current;return Lz({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function Hz({handle:e,store:t}){return BN(()=>e.attachStore(t),[e,t]),null}function Uz(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function Wz(e,t){let n=Z.useRef(null);return ZN(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),Uz(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Uz(t))})}function Gz(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 Kz(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function qz(e,t,n,r={}){let i=n.reason,a=i===pL,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Kz(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=Gz(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?VN.flushSync(l):l()}function Jz(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Wz(e,n),o=ZN(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=ZN(e=>{a(e),e&&o(e)});return BN(()=>(s(t.current),()=>s(null)),[s,t,n,e]),BN(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Yz(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Z.useRef(null),i=e.useState(`open`);BN(()=>{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=OL(dL);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 Xz(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=Rz(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=ZN(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return UI({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function Zz(e,t){e.useSyncedValues(t),BN(()=>()=>{e.update({activeTriggerProps:IN,inactiveTriggerProps:IN,popupProps:IN})},[e])}function Qz(e,t){BN(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),BN(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var $z=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 eB(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Iz({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:IN,inactiveTriggerProps:IN,popupProps:IN}}var tB=e=>e.triggerIdProp??e.activeTriggerId,nB=e=>e.openProp??e.open,rB=e=>(e.popupElement?.id??e.floatingId)||void 0;function iB(e,t){return t!==void 0&&nB(e)&&tB(e)===t}function aB(e,t){return iB(e,t)?!0:t!==void 0&&nB(e)&&tB(e)==null&&e.triggerCount===1}var oB={open:nB,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:tB,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:rB,isTriggerActive:(e,t)=>t!==void 0&&tB(e)===t,isOpenedByTrigger:(e,t)=>iB(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&tB(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>aB(e,t)?rB(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function sB(e){let t=Z.useCallback(t=>e===void 0?PN:e.subscribeStore(t),[e]),n=Z.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,NN.useSyncExternalStore)(t,n,()=>e?.serverStore)}function cB(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=rL(),a=dR()!=null,o=zN(()=>new Iz({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new $z,floatingId:i,syncOnly:!1,nested:a})).current;return BN(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=iP(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 lB(e){return uB(e,e.rootContext)}function uB(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=fR(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=kz({...e,elements:{..._,...l&&{reference:l}}}),y=iP(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=iP(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(iP(e)||e===null)&&(h.current=e,f(e)),(iP(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!iP(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 BN(()=>{o&&(h.current=o)},[o]),BN(()=>{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 dB=FP&&IP;function fB(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=kP();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=tP(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&aP(e)&&e===RP(xP(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return bP(SP(t,`blur`,r),dB&&SP(t,`keydown`,a,!0),dB&&SP(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`);iP(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=BP(t.nativeEvent);if(iP(a)){if(dB&&!t.relatedTarget){if(!l.current&&!eF(a))return}else if(!nF(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,OL(mL,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,OL(mL,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=iP(n)&&n.hasAttribute(kL(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=RP(xP(e));(n||t!==e)&&(zP(o.current.floatingContext?.refs.floating.current,t)||zP(e,t)||a||QP(n??t,i.context.triggerElements)||i.setOpen(!1,OL(mL,r)))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var pB=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 OP,this.restTimeout=new OP,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},mB=new WeakMap;function hB(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&mB.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),mB.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function gB(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=mB.get(n);a&&a!==e&&hB(a),hB(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,mB.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function _B(e){let t=e.context.dataRef.current,n=zN(()=>t.hoverInteractionState??pB.create()).current;return t.hoverInteractionState||=n,LN(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function vB(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=fR(),d=dR(),f=_B(a),p=kP(),m=ZN(()=>VL(l.current.openEvent?.type,f.interactedInside)),h=ZN(()=>HL(l.current.openEvent?.type)),g=ZN(()=>{hB(f)});BN(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Z.useEffect(()=>g,[g]),BN(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&iP(c)&&s){let e=c,t=s,n=xP(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 gB(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&&iF(u.nodesRef.current,d).length>0)}function t(e){let t=zL(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,OL(pL,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=BP(e);if(!Qse(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&&iP(o)&&iF(u.nodesRef.current,r,!1).some(e=>zP(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,OL(pL,t)),u.events.emit(`floating.closed`,t)})}let y=s;return bP(y&&SP(y,`mouseenter`,c),y&&SP(y,`mouseleave`,_),y&&SP(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var yB={current:null};function bB(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=yB,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=fR(l),y=_B(h),b=Z.useRef(!1),x=IL(i),S=IL(r),C=IL(o),w=IL(n),T=IL(p),E=IL(f),D=ZN(()=>VL(g.current.openEvent?.type,y.interactedInside)),O=ZN(()=>T.current?.()!==!1),k=ZN((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!zP(e,t);if(!iP(n))return!1;let i=n;return r.hasMatchingElement(e=>zP(e,i))&&(!e||!zP(e,i))}),A=ZN(()=>{y.handler&&=(xP(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=ZN(()=>{hB(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===pL,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=zL(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,OL(pL,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,OL(pL,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!iP(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!lF(y.pointerType))return;let t=BL(C.current),n=zL(S.current,`open`,y.pointerType),r=BP(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(iP(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(zP(e,r)){s=e;break}}iP(i)&&iP(o)&&!h.context.triggerElements.hasElement(i)&&zP(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&&iP(s)&&iP(o)&&zP(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,OL(pL,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,OL(pL,e,s))}):g&&O()&&h.setOpen(!0,OL(pL,e,s)))}function i(t){if(D()){j();return}A();let n=xP(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`||!zP(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){zP(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?SP(t,`mouseout`,o):void 0;return s?bP(SP(t,`mousemove`,r,{once:!0}),SP(t,`mouseenter`,r),SP(t,`mouseleave`,i),l):bP(SP(t,`mouseenter`,r),SP(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&&!lF(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;gB(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=BL(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,OL(pL,t,n))}y.pointerType===`touch`?VN.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var xB=`Escape`;function SB(e){return IP&&e.movementX===0&&e.movementY===0}function CB(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function wB(e,t){return CB(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function TB(e,t,n){return CB(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function EB(e,t,n){return CB(t,n?e===VP:e===HP,e===zse)}function DB(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===xB:CB(t,n?e===HP:e===VP,e===Rse)}function OB(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=rF(T),k=tF(E),A=IL(O),j=dR(),M=fR(b),N=Z.useRef(f),P=Z.useRef(o??-1),F=Z.useRef(null),I=Z.useRef(!0),L=ZN(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=IL(h),ie=IL(w),ae=IL(o),oe=IL(y),se=EP(),ce=EP(),le=ZN(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):ne.current=JL(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`}))})});BN(()=>{D.current.orientation=g},[D,g]),BN(()=>{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]),BN(()=>{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||TB(F.current,g,u)||l?AF(n):jF(n),F.current=null,L())};t()}}else kF(n.current,r)||(P.current=r,le(),te.current=!1)}}},[a,w,T,r,ae,l,n,g,u,L,le,ce]),BN(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=RP(xP(E??t??null)),r=e.some(e=>e.context&&zP(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),BN(()=>{ee.current=w,R.current=!!T}),BN(()=>{w||(F.current=null,N.current=f)},[w,f]);let ue=r!=null,de=ZN(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=ZN(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),pe=ZN(()=>AF(n,re.current)),me=ZN(e=>{if(I.current=!1,z.current=!0,e.which===229||!ie.current&&e.currentTarget===A.current)return;if(l&&DB(e.key,g,u,S)){wB(e.key,fe())||oF(e),C.setOpen(!1,OL(bL,e.nativeEvent)),aP(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=AF(n,h),i=jF(n,h);if(k||(e.key===`Home`&&(oF(e),P.current=r,L(e)),e.key===`End`&&(oF(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(wB(e.key,g)){if(oF(e),w&&!d&&RP(e.currentTarget.ownerDocument)===e.currentTarget){P.current=TB(e.key,g,u)?r:i,L(e);return}TB(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(z.current=!1,P.current=r):P.current=MF(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,MF(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=MF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,MF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),kF(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){SB(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=RP(xP(e));e&&zP(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=BP(e.nativeEvent);if(t&&!zP(A.current,t))return;oF(e),C.setOpen(!1,OL(vL,e.nativeEvent)),aP(E)&&E.focus();return}me(e)},onPointerMove(e){SB(e)||(I.current=!0)}}),[ge,me,A,k,C,w,d,E]),ve=Z.useMemo(()=>{function e(e){C.setOpen(!0,OL(bL,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&sF(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&cF(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=EB(t.key,fe(),u),a=wB(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=wB(t.key,fe());F.current=l&&e?null:t.key}if(l){i&&(oF(t),n?(P.current=pe(),L(t)):e(t));return}a&&(ae.current!=null&&(P.current=ae.current),oF(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 kB(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=kP(),m=Z.useRef(``),h=Z.useRef(u??i??-1),g=Z.useRef(null),_=ZN(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!PF(n)||n?.matches(`:disabled`)?!1:o==null||!NF(FN,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===` `&&(oF(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!==` `&&(oF(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=ZN(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);zP(n,t)||zP(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});BN(()=>{(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 AB=.1,jB=AB*AB,MB=.5;function NB(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function PB(e,t,n,r,i,a,o,s,c,l){let u=!1;return NB(e,t,n,r,i,a)&&(u=!u),NB(e,t,i,a,o,s)&&(u=!u),NB(e,t,o,s,c,l)&&(u=!u),NB(e,t,c,l,n,r)&&(u=!u),u}function FB(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function IB(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 LB(e={}){let{blockPointerEvents:t=!1}=e,n=new OP,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*jB;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=BP(r),g=r.type===`mouseleave`,_=zP(u,h),v=zP(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&iP(r.relatedTarget)&&zP(u,r.relatedTarget))return;function y(){return!!(s&&iF(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=IB(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=IB(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=IB(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=IB(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!FB(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?MB/2:MB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+MB+1,o=C||T?S.bottom-MB:S.top,s=C?T?S.bottom-MB:S.top:S.bottom-MB;M=PB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?MB/2:MB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-MB,o=C||T?S.top+MB:S.bottom,s=C?T?S.top+MB:S.bottom:S.top+MB;M=PB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?MB/2:MB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+MB+1,o=w||E?S.right-MB:S.left,s=w?E?S.right-MB:S.left:S.right-MB;M=PB(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?MB/2:MB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-MB,o=w||E?S.left+MB:S.right,s=w?E?S.left+MB:S.right:S.left+MB;M=PB(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 RB=Z.createContext(void 0);function zB(){return Z.useContext(RB)?.direction??`ltr`}var BB=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`}=gF(e,t)||{};if(l==null)return{};let f=DF(u),p={x:n,y:r},m=SF(i),h=bF(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=hF(k,j,A),N=!c.arrow&&vF(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}}}),VB=(e,t)=>{let{name:n,fn:r}=BB(e);return{name:n,fn:r,options:[e,t]}},HB={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}}}},UB={sideX:`left`,sideY:`top`},WB=`--available-width`,GB=`--available-height`,KB=`--anchor-width`,qB=`--anchor-height`,JB=`--transform-origin`,YB=WB,XB=GB;function ZB(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 QB(e,t,n){let{rects:r,placement:i}=e;return{side:ZB(t,_F(i),n),align:vF(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function $B(e){return eV(e,lB)}function eV(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=ZN(A),M=A?j:n,N=IL(n),P=IL(g),F=zB()===`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=IL(a),oe=IL(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(Az(e=>{let t=QB(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:Nz({...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:jz({...re,rootBoundary:k,mainAxis:E!==`none`,crossAxis:de,limiter:u||O?void 0:Mz(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=xF(_F(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(Pz({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(YB,`${t}px`),i.setProperty(XB,`${n}px`);let a=tP(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(KB,`${u}px`),i.setProperty(qB,`${d}px`)}}),VB(e=>({element:ie.current||xP(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=_F(r),u=vF(r),d=xF(l)===`y`,f=ie.current,p=typeof a==`function`?a(QB(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(JB,d?`${m} ${h}`:`${h} ${m}`),{}}},HB,b),BN(()=>{!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)=>_z(...e,me),nodeId:y,externalTree:S}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||UB,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[YB]=`100vw`,e[XB]=`100vh`,Ce||(e.opacity=0),e},[b,De,Te,_e,Ee,ve,we,Ce]),ke=Z.useRef(null);BN(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(tV(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`&&tV(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 _z(ge.reference,ge.floating,be,me)},[m,g,ge,be,me]);let Ae=_F(xe),je=ZB(i,Ae,F),Me=vF(xe)||`center`,Ne=!!ye.hide?.referenceHidden;BN(()=>{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 tV(e){return e!=null&&`current`in e}function nV(e){return e===`starting`?WI:IN}function rV(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),jI(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},nV(r),i],stateAttributesMapping:YP})}var iV=yN(),aV=48,oV=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-aV-t;return n},sV=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},cV=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-aV;n+=i>>>1^-(i&1),t[r]=n}return t},lV=384,uV=[],dV=sV(oV(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),fV=sV(oV(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),pV=`@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`,mV=(()=>{let e=dV.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=dV[n];i<dV[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(dV[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=dV[i];a<dV[i+1];a++)n[r++]=e,e+=t[e]}return n})(),hV=oV(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),gV=sV(oV(`123333359346463635126536711576`)),_V=oV(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),vV=oV(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),yV=cV(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),bV=(()=>{let e=new Int32Array(319).fill(-1),t=cV(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=cV(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),xV=`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}),SV=cV(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),CV=cV(`ɠ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`),wV=cV(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~22
:22|22222222222G000qOVI00000}2>40000B00000I¨©000¬00000000000000021M®00°000000000000000000000222HGHa1º222¿2À2222ÉÌ000°2±`),TV=new Int32Array(995),EV=new Int32Array(995),DV=new Int32Array(995),OV=``,kV=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<SV.length;r++)for(let i of xV[wV[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),kV[a*2]=OV.length,kV[a*2+1]=i.length,OV+=i),TV[n]=SV[r],EV[n]=CV[r],DV[n]=a,n++}}var AV=cV(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),jV=sV(oV(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),MV=cV(`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`),NV=oV(`ij`),PV=oV(``),FV=oV(`1`),IV={GROUP_COUNT:lV,customValidatorNames:uV,edgeStart:dV,labelStart:fV,labelText:pV,edgeTarget:mV,nodeGroup:hV,nodeVlist:bV,vlistPat:gV,vlistOps:_V,vlistRef:vV,vlistGroup:yV,litAnchor:TV,litGroup:EV,litPool:DV,poolOffsets:kV,poolText:OV,adjGid:AV,adjStart:jV,adjTgt:MV,patGid:NV,patTgt:PV,postfixLookupGroups:FV,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},LV=`line`in Error(),RV=-1,zV=-1,BV=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},VV=(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},HV=(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=(BV(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=(BV(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=BV(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?RV: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 RV},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[_]=RV,We(y,e,p,h,v,RV,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=zV,z=0;for(let t=M;t<D;t++)if(t===A&&(ee=F<I?zV:P,z=R),P!==zV){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=zV;else{let e=i[P],t=i[P+1],c=zV;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?zV:P,z=R);let re=F<I?zV:P,ie,ae=!1;if(A>=0){if(ae=!0,ie=dt(e,E,A,ee,z),ie!==RV&&ie<r&&j[ie]){let t=dt(e,E,D,re,R);t!==RV&&t!==ie&&(ie=t,ae=!1)}else ie===RV&&(ie=dt(e,E,D,re,R),ae=!1)}else ie=dt(e,E,D,re,R);let oe=0,se=0;ie===RV?Xe[_]=RV:(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===RV){$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=VV(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=VV(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=VV(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:LV?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(GV.apply(null,arguments))},mergeString:Dt,seenBefore:ee===0?()=>!1:Et,mergeUncached:ft}},UV=(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:UV(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},WV=(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:UV(i,t);a&&(n&&(n+=` `),n+=a)}return n},GV=function(){return WV(arguments,!1)},KV=(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]=UV(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(UV(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)}},qV=HV(IV),JV=KV(qV.mergeString,qV);qV.merge;var YV=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}=cL({disabled:i,focusableWhenDisabled:a,native:o});return jI(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function XV(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=XV(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ZV(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=XV(e))&&(r&&(r+=` `),r+=t);return r}var QV=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,$V=ZV,eH=(e,t)=>n=>{if(t?.variants==null)return $V(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=QV(t)||QV(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 $V(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)},tH=eH(`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 nH({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Q.jsx)(YV,{"data-slot":`button`,className:JV(tH({variant:t,size:n,className:e})),...r})}var rH=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function iH(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:rH(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var aH=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},oH=e=>{let t=aH(e);return t.charAt(0).toUpperCase()+t.slice(1)},sH=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),cH={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 lH(e){return e!=null}function uH(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??cH.width,a=e.size??e.height??cH.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?sH(...c):sH(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??cH[`stroke-width`])*Number(e.size??e.width??cH.width)/Number(t.size??t.width??cH.width):t.strokeWidth??cH[`stroke-width`];return[`svg`,{...Object.entries(cH).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&lH(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&lH(t.width)&&{[r(`width`)]:t.width},...`height`in t&&lH(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 dH(e,t={}){return uH(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var fH=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},pH=(0,Z.createContext)({}),mH=()=>(0,Z.useContext)(pH),hH=(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=``}=mH()??{},y=!!c||fH(d),[b,x,S=[]]=dH(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:sH(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 gH(e,t=[],n=[]){let r=typeof e==`string`?iH(e,t,n):e,i=(0,Z.forwardRef)(({className:e,...t},n)=>(0,Z.createElement)(hH,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=oH(r.name)),i}var _H={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};_H.node;var vH=gH(_H),yH={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};yH.node;var bH=gH(yH),xH={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};xH.node;var SH=gH(xH),CH={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};CH.node;var wH=gH(CH),TH={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};TH.node;var EH=gH(TH),DH={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};DH.node;var OH=gH(DH),kH={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`}]]};kH.node;var AH=gH(kH),jH={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`}]]};jH.node;var MH=gH(jH),NH={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`}]]};NH.node;var PH=gH(NH),FH={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`}]]};FH.node;var IH=gH(FH),LH={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`}]]};LH.node;var RH=gH(LH),zH={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`}]]};zH.node;var BH=gH(zH),VH={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`}]]};VH.node;var HH=gH(VH),UH={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`}]]};UH.node;var WH=gH(UH),GH={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};GH.node;var KH=gH(GH),qH={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`}]]};qH.node;var JH=gH(qH),YH={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`}]]};YH.node;var XH=gH(YH),ZH={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`]};ZH.node;var QH=gH(ZH),$H={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`}]]};$H.node;var eU=gH($H),tU={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`}]]};tU.node;var nU=gH(tU),rU={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`}]]};rU.node;var iU=gH(rU),aU={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`}]]};aU.node;var oU=gH(aU),sU={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`}]]};sU.node;var cU=gH(sU),lU={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`}]]};lU.node;var uU=gH(lU),dU={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`}]]};dU.node;var fU=gH(dU),pU={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};pU.node;var mU=gH(pU),hU=Z.createContext(void 0);function gU(e){let t=Z.useContext(hU);if(t===void 0&&!e)throw Error(HN(72));return t}var _U=class extends QN{setState(e){}update(e){}set(e,t){}notifyAll(){}},vU={...oB,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},yU=class extends QN{constructor(e,t,n){let r=new $z;super(bU(e,r,t,n),xU(r),vU)}setOpen=(e,t)=>{qz(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,OL(fL,e))}};function bU(e,t,n,r=!1){return{...eB(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 xU(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var SU=KN(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=Vz((e,t)=>new yU({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}),Yz(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Xz(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Z.useRef(null);BN(()=>{m&&t&&p.setOpen(!1,OL(CL))},[m,t,p]),BN(()=>{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]),BN(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Z.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,OL(EL))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,Q.jsxs)(hU.Provider,{value:p,children:[l&&(0,Q.jsx)(Hz,{handle:l,store:p}),T&&(0,Q.jsx)(CU,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function CU({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=jR(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=OR(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Z.useMemo(()=>_I(a.reference,i.reference),[a.reference,i.reference]);return Zz(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??IN}),null}function wU(e){return rL(e,`base-ui`)}var TU=Z.createContext(void 0);function EU(){return Z.useContext(TU)}var DU=`data-base-ui-tooltip-trigger`;function OU(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(iP(n))return n}}let t=e.target;return iP(t)?t:null}function kU(e){let t=e;for(;t;){let e=t.closest(`[${DU}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&iP(n.host)?n.host:null}return null}var AU=qN(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=gU(!0),m=sB(a)??p;if(!m)throw Error(HN(82));let h=wU(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}=Jz(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=EU(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=KL(v,{open:_}),O=_B(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=IL(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Z.useRef(!1),F=kP(),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=kU(e);return n!==null&&n!==t&&zP(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=bB(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?LB():null,restMs:L,delay(){return u==null&&D?{close:zL(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),te=fB(v,{enabled:!A}).reference,ne=e=>{let t=P.current,n=OU(e),r=ee(n),i=y.current,a=i&&n&&zP(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,OL(pL,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&lF(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,OL(pL,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},re=m.useState(`triggerProps`,S);return jI(`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(OU(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,[ZP]:A?``:void 0,[DU]:A?void 0:``},f],stateAttributesMapping:qP})}),jU=Z.createContext(void 0);function MU(){let e=Z.useContext(jU);if(e===void 0)throw Error(HN(70));return e}var NU=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return gU().useState(`mounted`)||n?(0,Q.jsx)(jU.Provider,{value:n,children:(0,Q.jsx)(FL,{ref:t,...r})}):null}),PU=Z.createContext(void 0);function FU(){let e=Z.useContext(PU);if(e===void 0)throw Error(HN(71));return e}var IU=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=ZI,style:g,..._}=e,v=gU(),y=MU(),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=$B({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=rV(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)(PU.Provider,{value:D,children:O})}),LU=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=gU(),{side:s,align:c}=FU(),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`);UI({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),vB(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return jI(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[zz,f,nV(d),a],stateAttributesMapping:XP})}),RU=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=gU(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=FU();return jI(`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:YP})}),zU=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Z.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Q.jsx)(TU.Provider,{value:t,children:(0,Q.jsx)(GL,{delay:i,timeoutMs:r,children:e.children})})};function BU(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 VU({delay:e=0,...t}){return(0,Q.jsx)(zU,{"data-slot":`tooltip-provider`,delay:e,...t})}function HU({...e}){return(0,Q.jsx)(SU,{"data-slot":`tooltip`,...e})}function UU({...e}){return(0,Q.jsx)(AU,{"data-slot":`tooltip-trigger`,...e})}function WU({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,Q.jsx)(NU,{children:(0,Q.jsx)(IU,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,Q.jsxs)(LU,{"data-slot":`tooltip-content`,className:JV(`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)(RU,{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 GU=new Set;function KU(e){return GU.add(e),()=>GU.delete(e)}function qU(e){for(let t of[...GU])t(e)}function JU(e,t){let n=()=>qU({title:`Copied ${t}`,description:e,type:`success`}),r=()=>qU({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,()=>{YU(e)?n():r()});return}YU(e)?n():r()}function YU(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 XU=X(e=>DE(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 ZU(e){let t=(0,iV.c)(2),n;t[0]===e?n=t[1]:(n=XU(e),t[0]=e,t[1]=n),DN(n)}var QU=`~effect/Cache`,$U=(e,t)=>gs(n=>{let r=Object.create(tW);return r.lookup=t=>fs(e(t),e=>wr(n,e)),r.map=uae(),r.capacity=t.capacity,r.timeToLive=t.timeToLive?(e,n)=>mi(t.timeToLive(e,n)):nW,oo(r)}),eW=e=>$U(e.lookup,{...e,timeToLive:e.timeToLive===void 0?nW:()=>e.timeToLive}),tW={...yt,[QU]:QU,toJSON(){return{_id:`Cache`,capacity:this.capacity,map:this.map}}},nW=(e,t)=>Ei,rW=a(2,(e,t)=>Yt(n=>{let r=Vw(e.map,t);if(zn(r)&&(Ww(e.map,t),!oW(r.value,n)))return Uw(e.map,t,r.value),r.value.await();let i=new iW(n,e.lookup(t));i.onInterrupt=()=>aW(e,t,i);let a=!1;i.fiber.addObserver(r=>{if(i.onInterrupt=void 0,is(r)){aW(e,t,i);return}let o=e.timeToLive(r,t);Ci(o)?(a=!0,aW(e,t,i)):Si(o)&&(i.expiresAt=n.getRef(al).currentTimeMillisUnsafe()+Fi(o))});let o=i.fiber.pollUnsafe();return!a&&(o===void 0||!is(o))&&Uw(e.map,t,i),Number.isFinite(e.capacity)&&sW(e),i.await()})),iW=class{expiresAt;awaiters;fiber;onInterrupt;constructor(e,t){this.fiber=Hc(e,t,!0,!0),this.awaiters=0,this.expiresAt=void 0}await(){return this.fiber.pollUnsafe()||(this.awaiters++,kc(ro(this.fiber),()=>(this.awaiters--,this.awaiters>0||this.fiber.pollUnsafe()?go:(this.onInterrupt?.(),io(this.fiber)))))}},aW=(e,t,n)=>{let r=Vw(e.map,t);zn(r)&&r.value===n&&Ww(e.map,t)},oW=(e,t)=>e.expiresAt!==void 0&&t.getRef(al).currentTimeMillisUnsafe()>=e.expiresAt,sW=e=>{let t=Gw(e.map)-e.capacity;if(!(t<=0)){for(let[n]of e.map)if(Ww(e.map,n),t--,t===0)return}},cW=a(2,(e,t)=>lo(()=>{Ww(e.map,t)})),lW=2**48-1,uW=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,dW=(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)),lW),r=``;for(let e=45;e>=0;e-=5)r+=uW[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+=uW[i>>>a&31];i&=(1<<a)-1}return r},fW=e=>e.toString(16).padStart(2,`0`),pW=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,fW).join(``)).join(`-`),mW=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function hW(e=mW()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var gW=e=>pW(e===void 0?hW():hW(e)),_W=2**48-1;function vW(e,t=mW()){let n=Math.min(Math.max(0,Math.trunc(e)),_W);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 yW=(e,t)=>pW(t===void 0?vW(e):vW(e,t)),bW=`~effect/Crypto`,xW=tr(`effect/Crypto`),SW=e=>{let t=e.randomBytes,n=e=>Yf(CW(`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 xW.of({[bW]:bW,randomBytes:n,nextDoubleUnsafe:i,nextIntUnsafe:a,digest:e.digest,random:V(()=>i()),randomBoolean:V(()=>i()>.5),randomInt:V(()=>a()),randomBetween:(e,t)=>V(()=>Xd(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(()=>gW(t(16))),randomUUIDv7:Yp(e=>B(yW(e.currentTimeMillisUnsafe(),t(16)))),randomULID:Yp(e=>B(dW(e.currentTimeMillisUnsafe(),t(10))))})},CW=(e,t)=>Number.isSafeInteger(t)&&t>=0?B(t):U(yae({module:`Crypto`,method:e,description:`size must be a non-negative safe integer`})),wW=`~effect/FiberMap`,TW=e=>F(e,wW),EW={[wW]:wW,[Symbol.iterator](){return this.state._tag===`Closed`?Br():this.state.backing[Symbol.iterator]()},...yt,toJSON(){return{_id:`FiberMap`,state:this.state}}},DW=(e,t)=>{let n=Object.create(EW);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},OW=()=>xp(V(()=>DW(Bw(),hu())),e=>Mf(()=>{let t=e.state;return t._tag===`Closed`?Nf:(e.state={_tag:`Closed`},bS(fae(t.backing)).pipe($te(e.deferred)))})),kW=-1,AW=Pee(Wi(Jl,Ui(kW))),jW=a(e=>TW(e[0]),(e,t,n,r)=>{if(e.state._tag===`Closed`){n.interruptUnsafe(kW);return}let i=Vw(e.state.backing,t);if(i._tag===`Some`){if(i.value===n)return;if(r?.onlyIfMissing===!0){n.interruptUnsafe(kW);return}}Uw(e.state.backing,t,n),i._tag===`Some`&&i.value.interruptUnsafe(kW),n.addObserver(i=>{if(e.state._tag===`Closed`)return;let a=Vw(e.state.backing,t);zn(a)&&n===a.value&&Ww(e.state.backing,t),du(i)&&(r?.propagateInterruption===!0?!AW(i.cause):!Jte(i.cause))&&bu(e.deferred,i)})}),MW=a(2,(e,t)=>e.state._tag!==`Closed`&&mae(e.state.backing,t)),NW=function(){let e;return()=>(e===void 0&&(e=zp(Op)),e)}(),PW=e=>()=>Yf(pp(),t=>{let n=Bp(t);return(t,r,i)=>{if(e.state._tag===`Closed`||i?.onlyIfMissing===!0&&MW(e,t))return NW();let a=n(r,i);return jW(e,t,a,i),a}}),FW=`~effect/ManagedRuntime`,IW=(e,t)=>{let n=t?.memoMap??Fu(),r=Su(`sequential`),i=Du(r,`sequential`),a={onFiberStart:SS(Du(r,`parallel`))},o=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,s,c=Hf(t=>(s||=zp(Kf(Ru(e,n,i),e=>V(()=>{l.cachedContext=e})),{...a,scheduler:t.cache.scheduler}),Wf(gS(s)))),l={[FW]:FW,memoMap:n,scope:r,contextEffect:c,cachedContext:void 0,context(){return l.cachedContext===void 0?Hp(l.contextEffect):Promise.resolve(l.cachedContext)},dispose(){return Hp(l.disposeEffect)},[Symbol.asyncDispose](){return l.dispose()},disposeEffect:Mf(()=>(l.contextEffect=zf(`ManagedRuntime disposed`),l.cachedContext=void 0,Ou(l.scope,lu))),runFork(e,t){return l.cachedContext===void 0?zp(LW(l,e),o(t)):Bp(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?bne(LW(l,e),o(t)):Vp(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Kp(LW(l,e)):Cne(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?Wp(LW(l,e)):Gp(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Up(LW(l,e),o(t)):Sne(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?Hp(LW(l,e),o(t)):xne(l.cachedContext)(e,o(t))}};return l};function LW(e,t){return Uf(e.contextEffect,e=>gp(t,e))}var RW=`~effect/SynchronizedRef`,zW={...yt,[RW]:RW,toJSON(){return{_id:`SynchronizedRef`,value:this.backing.ref.current}}},BW=e=>{let t=Object.create(zW);return t.semaphore=AC(1),t.backing=BD(e),t},VW=e=>V(()=>BW(e)),HW=e=>e.backing.ref.current,UW=a(2,(e,t)=>e.semaphore.withPermit(GD(e.backing,t))),WW=a(2,(e,t)=>e.semaphore.withPermit(Mf(()=>Yf(t(HW(e)),([t,n])=>(e.backing.ref.current=n,t))))),GW=a(2,(e,t)=>e.semaphore.withPermit(UD(e.backing,t))),KW=a(2,(e,t)=>e.semaphore.withPermit(KD(e.backing,t))),qW=class extends tr()(`@porcelain/client/EnvironmentStorage`){},JW=class extends tr()(`@porcelain/client/AccessPlatform`){},YW=class extends Y()(`WriteNotSentError`,{cause:Fb}){get message(){return`An earlier change failed, so this one was not sent.`}},XW=class extends tr()(`@porcelain/client/WriteQueue`){static make=H(function*(){let e=yield*NC(1),t=yield*VD({pending:0,failure:In()});return{enqueue:n=>Mp(r=>H(function*(){return yield*KD(t,e=>({...e,pending:e.pending+1})),yield*Vf,yield*e.withPermit(H(function*(){let e=yield*HD(t),i=yield*Jf(r(zn(e.failure)?U(new YW({cause:e.failure.value})):n));return yield*KD(t,e=>{let t=e.pending-1,n=du(i)?Ul(i.cause):void 0;return{pending:t,failure:t===0?In():pee(e.failure,()=>du(i)?Ln(n instanceof YW?n.cause:n):In())}}),yield*uu(i)?B(i.value):Lf(i.cause)}))}))}})},ZW=class e extends tr()(`@porcelain/client/WriteQueues`){static layer=Ku(e,H(function*(){let e=yield*wae({lookup:e=>H(function*(){return{scope:yield*Eu(yield*xu,`parallel`),queue:yield*XW.make}}),idleTimeToLive:0});return{run:(t,n)=>bp(H(function*(){let{scope:r,queue:i}=yield*Tae(e,JSON.stringify(t)),a=yield*Lp(i.enqueue(n),r,{startImmediately:!0});return yield*_S(a).pipe(wp(yS(a)))}))}}))},QW=class extends Y()(`ConnectionError`,{message:K,cause:Ab(Fb)}){},$W=Jp(`persistedState`)(function*(e){let t=Lj({...e.initial,status:`loading`,error:void 0}),n=yield*XW.make;return{state:t,load:()=>n.enqueue(H(function*(){t.update(e=>({...e,status:`loading`,error:void 0})),yield*e.read().pipe(mne({onSuccess:e=>V(()=>t.set({...e,status:`ready`,error:void 0})),onFailure:()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.readFailed})))}),jp)})),write:r=>n.enqueue(H(function*(){if(t.value.status!==`ready`)return yield*U(new QW({message:e.messages.beforeRead}));let n=yield*r(t.value);yield*e.write(n).pipe(np(({cause:t})=>new QW({message:e.messages.writeFailed,cause:t})),ip(()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.writeFailed})))),Kf(()=>V(()=>t.update(e=>({...e,...n})))),jp)}))}}),eG=1024,tG=1024*eG,nG=10*tG,rG=16*eG,iG=2e3,aG=2e3,oG=4096,sG=2147483647,cG=1e3,lG=1e4,uG=lG,dG=1024,fG=5e4,pG=16e3,mG=4e3,hG=2e3,gG=1e3,_G=4e3,vG=2048;8*tG,32*tG;var yG=qb([`content_changed`,`file_too_large`,`unsupported_text`,`worktree_changed`]),bG=q({statusCode:Lb.check(px()).check(ux(400)).check(dx(599)),error:K,message:K,code:W(yG)}),xG=K.check(ix(e=>Nr(Cb(Cx)(e)),{expected:`an absolute URL`})),SG=K.check(ax(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z$/),ix(e=>{let t=Cb(Mx)(e);return Nr(t)&&Xne(t.success)===e.split(`T`)[0]},{expected:`a valid UTC timestamp`})),CG=K.check(ox()),wG=K.check(ax(RegExp(`^[0-9a-f]{32}$`)));function TG(e){return Jb(e).pipe(Xb(Yb(Mb(e)),f_({decode:e=>e===null?void 0:e,encode:e=>e===void 0?null:e})))}var EG=q({worktreeId:wG}),DG=`~effect/http-api/HttpApiMiddleware`,OG=`~effect/http-api/HttpApiMiddleware/Security`,kG=()=>(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[DG]=DG,a.error=AG(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[OG]=OG,a.security=t.security}return a};function AG(e){return e===void 0?new Set:new Set(Array.isArray(e)?e:[e])}var jG=`~effect/http-api/HttpApiGroup`,MG={[jG]:jG,add(...e){let t={...this.endpoints};for(let n of e)st(t,n.identifier,n);return PG({...NG(this),endpoints:t})},prefix(e){return PG({...NG(this),endpoints:Hr(this.endpoints,t=>t.prefix(e))})},middleware(e){return PG({...NG(this),endpoints:Hr(this.endpoints,t=>t.middleware(e))})},annotateMerge(e){return PG({...NG(this),annotations:wr(this.annotations,e)})},annotate(e,t){return PG({...NG(this),annotations:hr(this.annotations,e,t)})},annotateEndpointsMerge(e){return PG({...NG(this),endpoints:Hr(this.endpoints,t=>t.annotateMerge(e))})},annotateEndpoints(e,t){return PG({...NG(this),endpoints:Hr(this.endpoints,n=>n.annotate(e,t))})},pipe(){return n(this,arguments)}},NG=e=>({identifier:e.identifier,topLevel:e.topLevel,endpoints:e.endpoints,annotations:e.annotations}),PG=e=>{function t(){}return Object.setPrototypeOf(t,MG),t.key=`effect/http-api/HttpApiGroup/${e.identifier}`,Object.assign(t,e)},FG=(e,t)=>PG({identifier:e,topLevel:t?.topLevel??!1,endpoints:{},annotations:pr()}),IG=Kb([q({kind:G(`owner`)}),q({kind:G(`device`),deviceId:K.check(ox())})]);function LG(e){let t=[`c=${encodeURIComponent(e.code)}`,`e=${encodeURIComponent(e.environmentId)}`,...e.addresses.length>1?[`a=${encodeURIComponent(e.addresses.join(`,`))}`]:[]].join(`&`);return`${e.addresses[0]??``}/pair#${t}`}function RG(e){let[t=``,n=``]=e.split(`/pair#`),r=new Map(n.split(`&`).map(e=>{let[t=``,n=``]=e.split(`=`);return[t,decodeURIComponent(n)]})),i=r.get(`a`);return{addresses:i===void 0?[t]:i.split(`,`),code:r.get(`c`)??``,environmentId:r.get(`e`)??``}}var zG=K,BG=q({addresses:J(K),code:K,environmentId:K}),VG=zG.pipe(Xb(BG,f_({decode:RG,encode:LG}))),HG=q({code:K.check(hx(1)).check(_x(200)),platform:K.check(hx(1)).check(_x(120)),label:W(K.check(hx(1)).check(_x(80)))}),UG=q({device:q({id:K,label:K,platform:K,createdAt:K}),credential:W(K)}),WG=q({id:K,label:K,addresses:J(K),createdAt:K,expiresAt:K,trusted:Rb,canManageSharing:W(Rb)}),GG=qb([`loopback`,`lan`,`tailnet`,`tunnel`]),KG=q({id:K,label:K,platform:K,createdAt:K,lastSeenAt:K,lastSeenAddress:W(K),route:GG,routeInferred:W(Rb),trusted:Rb,canManageSharing:W(Rb),canEditWaysIn:Rb,current:W(Rb)}),qG=q({canEditIdentity:W(Rb),grants:J(WG),devices:J(KG)}),JG=q({labels:J(K.check(hx(1)).check(_x(80))).check(hx(1)).check(_x(20)),addresses:J(xG).check(hx(1)).check(_x(10)),trusted:W(Rb),canManageSharing:W(Rb)}),YG=q({grants:J(q({grant:WG,code:K,link:VG}))}),XG=q({id:K.check(hx(1))}),ZG=q({revoked:Rb,kind:W(qb([`grant`,`device`]))}),QG=q({id:K.check(hx(1)),trusted:Rb}),$G=q({id:K,trusted:Rb}),eK=q({id:K.check(hx(1)),allowed:Rb}),tK=q({id:K,allowed:Rb}),nK=q({id:K.check(hx(1)),allowed:Rb}),rK=q({id:K,allowed:Rb}),iK=Ib;q({route:GG,local:Rb}),tr()(`@porcelain/http/RequestConnection`);var aK=class extends kG()(`@porcelain/http/ClientRequest`){};tr()(`@porcelain/http/RequestCaller`);var oK=class extends kG()(`@porcelain/http/PairedRequest`){},sK=class extends Y()(`InvalidDeviceDetailsError`,{}){get message(){return`The device name or platform is missing, too long, or contains control characters.`}},cK=class extends Y()(`InvalidPairingAddressError`,{}){get message(){return`This server does not answer at that address, so a link aimed there would not reach it.`}},lK=class extends Y()(`InvalidPairingError`,{}){get message(){return`This pairing link is not valid.`}},uK=class extends Y()(`MissingEnvironmentIdentityError`,{}){get message(){return`This server has no environment identity.`}};Y()(`TooManyPairingAttemptsError`,{});var dK=class extends Y()(`InvalidTunnelHostnameError`,{}){get message(){return`Enter the public hostname your Cloudflare tunnel serves, such as porcelain.example.com.`}},fK=class extends Y()(`MissingTunnelHostnameError`,{}){get message(){return`Cloudflare needs the public hostname your tunnel serves.`}},pK=class extends Y()(`InvalidTailnetHostnameError`,{}){get message(){return`Enter this computer's Tailscale name, such as laptop.tail1234.ts.net.`}},mK=class extends Y()(`MissingTailnetHostnameError`,{}){get message(){return`Tailscale needs this computer's Tailscale name.`}},hK=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.`}},gK=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.`}},_K=class extends Y()(`ServiceNotManagedError`,{}){get message(){return`Porcelain is not running as the installed service, so it cannot update itself`}},vK=class extends Y()(`ServiceUpdateNotOfferedError`,{}){get message(){return`That version is not the newer version this server offers`}},yK=class extends Y()(`ServiceUpdateRunningError`,{}){get message(){return`An update is already running`}},bK=class extends Y()(`DeviceViewerRequiredError`,{}){get message(){return`A live ticket is issued to a paired device`}},xK=class extends Y()(`TooManyLiveTicketsError`,{}){get message(){return`Too many live tickets are waiting to be used. Try again shortly.`}},SK=class extends Y()(`DeviceNotFoundError`,{}){get message(){return`Device not found`}},CK=class extends Y()(`UntrustedDeviceError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can update Porcelain`}},wK=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`}},TK=class extends Y()(`WaysInChangedError`,{}){get message(){return`The ways in changed since you last looked. Check them again, then save your change.`}},EK=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.`}},DK=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`}},OK=class extends Y()(`ReviewGitSettingsNotConfiguredError`,{}){get message(){return`Choose Reviews & Git settings for this computer before changing one of them`}},kK=class extends Y()(`SharingManagementRequiredError`,{}){get message(){return`This device cannot manage sharing. Allow it from a device with sharing access.`}},AK=Er(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),jK=class extends tr()(`effect/http/FetchHttpClient/RequestInit`){},MK=JO(B(HO((e,t,n,r)=>{let i=r.getRef(AK),a=gr(r.context,jK)??{},o=a.headers?Ah(Eh(a.headers),e.headers):e.headers;o[`content-length`]&&(o=jh(o,`content-length`));let s=r=>Yf(Af({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 YD({reason:new QD({request:e,cause:t})})}),t=>PO(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 Uf(Zae(e.body.stream),s)}return s(void 0)}))),NK={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`},PK=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:Ik(t),error:NK[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:Ab(n.code===void 0?Pb:G(n.code))}).pipe(Xb(hb(t=>t instanceof e||t instanceof PK&&t.name===e.name),f_({decode:t=>r===void 0?new PK({name:e.name,message:t.message}):new e,encode:e=>({...i,message:r??e.message})})),Rk(t))}var FK=$(uK,`ServiceUnavailable`,{message:`Operation unavailable`}),IK={onExcessProperty:`error`},LK=qA(`porcelain`).annotate(ZA,IK).annotate(QA,IK).annotate(ej,IK),RK=q({pullStrategy:qb([`merge`,`rebase`]),collapseSpecs:Rb,archiveDeleteWorktree:Rb,archiveDeleteLocalBranch:Rb,archiveDeleteRemoteBranch:Rb}),zK=qb([`desktop`,`laptop`,`server`,`cloud`]),BK=q({name:K,custom:Rb,icon:Ab(zK)}),VK=q({environmentId:K,name:K,version:TG(K),protocol:Lb.check(px()).check(lx(0))}),HK=q({name:Jb(K.pipe(Zb(p_())).check(hx(1)).check(_x(64)).check(ix(e=>!/\p{Cc}/u.test(e))))}),UK=BK,WK=q({icon:Jb(zK)}),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*pp(),r=Tf(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 Ju(this.toHandlers(e))},of:o,toLayerHandler(e,t){let n=this;return Ju(H(function*(){let r=yield*pp(),i=Tf(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 mp(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=aM(a)?a.value:a;return Tf(o)?hp(o,i):gT(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(ax(RegExp(`^${XK}$`))),QK=K.check(ax(RegExp(`^${XK}(?:,${XK})*$`))),$K=qb([`switch`,`fetch`,`pull`,`push`,`commit`,`amend`,`stash-create`,`stash-apply`,`stash-pop`,`discard`]),eq=q({requestId:K.check(ox()),projectId:K.check(ox()),worktreeId:wG,action:$K,state:qb([`running`,`succeeded`,`no-change`,`rejected`,`conflicted`,`interrupted`]),reason:W(qb([`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(Rb),restoreStashOid:W(ZK),restoreIndex:W(Rb),branch:W(K)})),acceptedAt:SG,finishedAt:W(SG)}),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(hx(1)).check(_x(oG)).check(ix(e=>nq(e,oG),{expected:`Expected a normalized relative path`})),iq=q({projects:J(K.check(ox())).check(_x(128)),worktrees:J(q({projectId:K.check(ox()),worktreeId:wG,paths:J(rq).check(_x(64))})).check(_x(32))}).annotate({parseOptions:{onExcessProperty:`error`}}),aq=YK(tM(`notices`,{success:Kb([q({type:G(`ready`)}),q({type:G(`subscribed`)}),q({type:G(`heartbeat`)}),q({type:G(`inventory`)}),q({type:G(`git-action`),projectId:K.check(ox()),worktreeId:wG,receipt:eq}),q({type:G(`project`),projectId:K.check(ox()),change:qb([`files`,`preferences`])}),q({type:G(`worktree`),projectId:K.check(ox()),worktreeId:wG,change:qb([`files`,`git`,`reviewed`,`comments`,`review`])})]),stream:!0}),tM(`follow`,{payload:iq})),oq=q({ticket:K,expiresAt:K}),sq=q({ticket:W(K)}),cq=Ib,lq=q({address:K,dataDirectory:K,pid:Lb.check(px()).check(lx(0))}),uq=Kb([q({kind:G(`off`)}),q({kind:G(`starting`)}),q({kind:G(`on`),urls:J(K)}),q({kind:G(`paused`)}),q({kind:G(`failed`),reason:qb([`address-in-use`,`address-unavailable`,`unreachable`,`other-server`])})]),dq=q({interfaceName:K,subnet:K,gateway:K,gatewayHardware:W(K)}),fq=q({enabled:Rb,status:uq}),pq=K.check(ax(/^[a-f0-9]{64}$/)).pipe(pie(`WaysInFingerprint`)),mq=qb([`lan`,`tailnet`,`cloudflare`]),hq=q({routes:q({lan:fq,tailnet:fq,cloudflare:fq}),lanNetwork:W(dq),localNetwork:W(dq),tailnetHostname:W(K),tailnetTarget:W(K),cloudflareHostname:W(K),serviceUrl:K,editing:q({fingerprint:pq,protectedRoute:W(mq)})}),gq=q({expected:pq,change:q({lan:W(Rb),tailnet:W(Rb),tailnetHostname:W(K.check(hx(1)).check(_x(253))),cloudflare:W(Rb),cloudflareHostname:W(K.check(hx(1)).check(_x(253)))}).check(ix(e=>Object.keys(e).length>0))}),_q=hq,vq=mx.check(lx(0)).check(dx(2**53-1)),yq=q({kind:G(`configured`),revision:vq,settings:RK}),bq=Kb([q({kind:G(`unconfigured`)}),yq]),xq=Kb([q({kind:G(`initialize`),settings:RK}),q({kind:G(`change`),change:RK.mapFields(nie(Ab)).check(Eie(1))})]),Sq=yq,Cq=q({from:K,target:K,stage:qb([`downloading`,`installing`,`restarting`,`updated`,`failed`]),reason:TG(K)}),wq=q({managed:Rb,version:TG(K),latest:TG(K),available:Rb,running:Rb,last:TG(Cq),canUpdate:Rb}),Tq=q({version:K.check(hx(1)).check(_x(128))}),Eq=wq,Dq=$(sK,`BadRequest`),Oq=FG(`publicAccess`).add(RA(`readHealth`,`/health`,{disableCodecs:!0,success:KK,error:FK}),RA(`readEnvironment`,`/environment`,{disableCodecs:!0,success:VK,error:FK})),kq=FG(`browserAccess`).add(HA(`clearBrowserSession`,`/session`,{disableCodecs:!0,success:iK.pipe(Bk({decode:()=>void 0}),Rk(`NoContent`))})),Aq=FG(`pairing`).add(zA(`redeemPairing`,`/pair`,{disableCodecs:!0,payload:HG,success:UG,error:[Dq,$(lK,`Unauthorized`)]})).middleware(aK),jq=FG(`session`).add(RA(`readSession`,`/session`,{disableCodecs:!0,success:IG}),zA(`issueLiveTicket`,`/live/tickets`,{disableCodecs:!0,success:oq,error:[$(bK,`Forbidden`),$(xK,`TooManyRequests`)]})).middleware(oK).middleware(aK),Mq=FG(`serviceUpdates`).add(RA(`readServiceUpdate`,`/service/update`,{disableCodecs:!0,success:wq}),zA(`startServiceUpdate`,`/service/update`,{disableCodecs:!0,payload:Tq,success:Eq.pipe(Rk(`Accepted`)),error:[$(CK,`Forbidden`),$(_K,`Conflict`),$(yK,`Conflict`),$(vK,`Conflict`)]})).middleware(oK).middleware(aK),Nq=FG(`reviewGitSettings`).add(RA(`readReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,success:bq}),VA(`saveReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,payload:xq,success:Sq,error:[$(DK,`Forbidden`),$(OK,`Conflict`)]})).middleware(oK).middleware(aK),Pq=$(kK,`Forbidden`),Fq=FG(`administration`).add(RA(`listAccess`,`/access`,{disableCodecs:!0,success:qG,error:Pq}),zA(`issuePairing`,`/pairings`,{disableCodecs:!0,payload:JG,success:YG,error:[Pq,FK,Dq,$(cK,`BadRequest`)]}),zA(`revokeAccess`,`/access/revoke`,{disableCodecs:!0,payload:XG,success:ZG,error:Pq}),zA(`setDeviceTrust`,`/access/trust`,{disableCodecs:!0,payload:QG,success:$G,error:[Pq,$(SK,`NotFound`)]}),zA(`setManagementPermission`,`/access/management-permission`,{disableCodecs:!0,payload:nK,success:rK,error:[Pq,$(SK,`NotFound`)]}),zA(`setWaysInPermission`,`/access/ways-in-permission`,{disableCodecs:!0,payload:eK,success:tK,error:[Pq,$(SK,`NotFound`)]})).middleware(oK).middleware(aK),Iq=$(wK,`Forbidden`),Lq=FG(`remoteAccess`).add(RA(`readRemoteAccess`,`/remote-access`,{disableCodecs:!0,success:hq,error:Iq}),VA(`setRemoteAccess`,`/remote-access`,{disableCodecs:!0,payload:gq,success:_q,error:[Iq,$(TK,`Conflict`),$(EK,`Conflict`),$(pK,`BadRequest`),$(dK,`BadRequest`),$(mK,`BadRequest`),$(fK,`BadRequest`),$(hK,`Conflict`),$(gK,`Conflict`)]})).middleware(oK).middleware(aK),Rq=FG(`environmentLabel`).add(BA(`renameEnvironment`,`/environment/name`,{disableCodecs:!0,payload:HK,success:UK})).add(BA(`setEnvironmentIcon`,`/environment/icon`,{disableCodecs:!0,payload:WK,success:GK})).middleware(oK),zq=FG(`ownerStatus`).add(RA(`readOwnerStatus`,`/status`,{disableCodecs:!0,success:lq})).middleware(oK);LK.add(Oq).prefix(`/api`),LK.add(kq).prefix(`/api`);var Bq=class extends LK.add(Aq).prefix(`/api`){};LK.add(jq).prefix(`/api`),LK.add(Mq).prefix(`/api`),LK.add(Lq).prefix(`/api`),LK.add(Nq).prefix(`/api`),LK.add(Fq).prefix(`/api`),LK.add(Rq).prefix(`/api`),LK.add(Fq,Lq,zq);var Vq=class extends LK.add(Oq,kq,Aq,jq,Mq,Lq,Nq,Fq,Rq).prefix(`/api`){},Hq=class extends Y()(`InvalidLineRangeError`,{}){get message(){return`The line range ends before it starts`}},Uq=class extends Y()(`WorktreeChangedError`,{}){get message(){return`Worktree changed during inspection`}},Wq=class extends Y()(`WorktreeNotFoundError`,{}){get message(){return`Worktree not found`}},Gq=class extends Y()(`RepositoryUnavailableError`,{}){get message(){return`Repository could not be inspected`}},Kq=class extends Y()(`FilePreferenceLimitError`,{}){get message(){return`File preference limit reached`}},qq=class extends Y()(`FolderNotFoundError`,{}){get message(){return`Path not found`}},Jq=class extends Y()(`FolderNotReadableError`,{}){get message(){return`Path could not be read`}};Y()(`NoWorktreeAtPathError`,{});var Yq=class extends Y()(`ProjectNotFoundError`,{}){get message(){return`Project not found`}},Xq=class extends Y()(`UnsupportedFolderNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},Zq=class extends Y()(`WorktreeUnavailableError`,{}){get message(){return`Worktree is unavailable`}},Qq=[$(Uq,`Conflict`,{code:`worktree_changed`,message:`Refresh status and retry inspection`}),$(Wq,`NotFound`),$(Yq,`NotFound`),$(Zq,`UnprocessableEntity`,{message:`Repository could not be inspected`})];Y()(`GitActionRejectedError`,{reason:qb([`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(Fb)}),Y()(`RepositoryIdentityMismatchError`,{});var $q=class extends Error{name=`GitError`},eJ=class extends $q{name=`HistorySnapshotUnavailableError`;constructor(e){super(`History snapshot is unavailable`,e)}},tJ=class extends $q{name=`HistoryWorktreeUnavailableError`;constructor(e){super(`Worktree is unavailable`,e)}},nJ=class extends $q{name=`InvalidHistoryRequestError`;constructor(e){super(`Invalid history request`,e)}},rJ=class extends $q{name=`ReadLimitExceededError`;constructor(e){super(`History read exceeds its limit`,e)}},iJ=class extends $q{name=`UnsupportedHistoryDataError`;constructor(e){super(`History contains unsupported data`,e)}},aJ=class extends Y()(`GitTimeoutError`,{}){get message(){return`Git command exceeded its deadline`}},oJ=class extends $q{name=`InspectionLimitError`;constructor(e){super(`Git inspection exceeds its limit`,e)}},sJ=class extends $q{name=`InvalidGitDiffError`;constructor(){super(`Invalid Git diff output`)}},cJ=class extends $q{name=`InvalidGitStatusError`;constructor(){super(`Invalid Git status output`)}},lJ=class extends $q{name=`UnsupportedGitFiltersError`;constructor(){super(`Git conversion filters are unsupported for worktree inspection`)}},uJ=class extends $q{name=`UnsupportedPathEncodingError`;constructor(e){super(`Git paths require valid UTF-8`,e)}};Y()(`GitCommandError`,{checkout:K,args:J(K),exitCode:Yb(Lb),stderr:K,cause:W(Fb)}),Y()(`GitFilesystemError`,{cause:Fb}),Y()(`UnsupportedFilesystemIdentityError`,{}),Y()(`UnsupportedRepositoryError`,{});var dJ=[$(eJ,`UnprocessableEntity`,{message:`History snapshot is unavailable; start a new listing`}),$(tJ,`UnprocessableEntity`,{message:`Worktree is unavailable`}),$(nJ,`BadRequest`),$(rJ,`UnprocessableEntity`,{message:`History read exceeds its limit`}),$(iJ,`UnprocessableEntity`,{message:`History contains unsupported data`}),$(aJ,`ServiceUnavailable`,{message:`Operation unavailable`}),$(oJ,`PayloadTooLarge`,{message:`Git inspection exceeds its limit`}),$(sJ,`BadGateway`,{message:`Git produced output that could not be read`}),$(cJ,`BadGateway`,{message:`Git produced output that could not be read`}),$(lJ,`UnprocessableEntity`,{message:`Git conversion filters are unsupported for worktree inspection`}),$(uJ,`UnprocessableEntity`,{message:`Git paths require valid UTF-8`}),$(Gq,`UnprocessableEntity`,{message:`Repository could not be inspected`})],fJ=class extends Y()(`ContentChangedError`,{}){get message(){return`Content changed; retry the operation`}},pJ=class extends Y()(`CrossDeviceMoveError`,{}){get message(){return`Destination is on another filesystem; nothing was moved`}},mJ=class extends Y()(`DiskFullError`,{}){get message(){return`There is not enough space on the disk`}},hJ=class extends Y()(`DirectoryTooLargeError`,{}){get message(){return`Directory exceeds the listing limit`}},gJ=class extends Y()(`EntryExistsError`,{}){get message(){return`An entry already exists at that path`}},_J=class extends Y()(`FileTooLargeError`,{}){get message(){return`File exceeds the read limit`}},vJ=class extends Y()(`InvalidMoveError`,{}){get message(){return`An entry cannot be moved onto or into itself`}},yJ=class extends Y()(`PathNotFoundError`,{}){get message(){return`Path not found`}},bJ=class extends Y()(`PathNotReadableError`,{}){get message(){return`Path could not be read`}},xJ=class extends Y()(`TrashUnavailableError`,{}){get message(){return`This machine has no trash; nothing was deleted`}},SJ=class extends Y()(`UnsupportedAssetTypeError`,{}){get message(){return`File type cannot be previewed`}},CJ=class extends Y()(`UnsupportedEntryNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},wJ=class extends Y()(`UnsupportedTextError`,{}){get message(){return`File is not supported UTF-8 text`}},TJ=$(vJ,`BadRequest`,{message:`Invalid request`}),EJ=$(yJ,`NotFound`),DJ=$(fJ,`Conflict`,{code:`content_changed`}),OJ=$(gJ,`Conflict`),kJ=$(bJ,`UnprocessableEntity`),AJ=$(CJ,`UnprocessableEntity`),jJ=$(hJ,`UnprocessableEntity`),MJ=$(pJ,`UnprocessableEntity`),NJ=$(xJ,`UnprocessableEntity`),PJ=$(SJ,`UnprocessableEntity`),FJ=$(wJ,`UnprocessableEntity`,{code:`unsupported_text`}),IJ=$(_J,`UnprocessableEntity`,{code:`file_too_large`}),LJ=$(mJ,`UnprocessableEntity`),RJ=[...Qq,EJ,kJ,DJ],zJ=[...RJ,FJ,IJ],BJ=class extends Y()(`BranchBaseNotFoundError`,{}){get message(){return`Base branch not found`}},VJ=class extends Y()(`CommitNotFoundError`,{}){get message(){return`Commit not found`}},HJ=class extends Y()(`IncompleteDiffReadError`,{}){get message(){return`Diff read returned fewer results than requested`}},UJ=class extends Y()(`SelectionMismatchError`,{}){get message(){return`Selections must cover exactly the expected files`}},WJ=class extends Y()(`UnnamedDiffSelectionError`,{}){get message(){return`A diff selection names neither an old nor a new path`}},GJ=class extends Y()(`UnbornBranchError`,{}){get message(){return`The branch has no commits yet`}},KJ=class extends Y()(`UnrelatedBranchError`,{}){get message(){return`The branch shares no history with its base`}},qJ=K.check(hx(1)).check(_x(dG)).check(ax(/^refs\/(?:heads|remotes)\/\S+$/u)),JJ=K.check(ax(/^[a-f0-9]{64}$/)),YJ=Kb([q({kind:G(`text`),patch:K}),q({kind:G(`binary`)}),q({kind:G(`metadata-only`),patch:K}),q({kind:G(`omitted`),reason:qb([`size-limit`,`unsupported-encoding`,`unsupported-submodule`])})]),XJ=q({ref:K,oid:ZK}),ZJ=q({path:K,oldPath:TG(K),newPath:TG(K),status:qb([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldOid:W(ZK),newOid:W(ZK),oldMode:K,newMode:K,fingerprint:JJ}),QJ=q({base:W(qJ)}),$J=q({worktreeId:wG,head:q({oid:ZK,branch:TG(K)}),base:TG(XJ),mergeBaseOid:TG(ZK),commits:Lb.check(px()).check(ux(0)),files:J(ZJ).check(_x(lG))}),eY=q({baseOid:ZK,headOid:ZK,paths:J(J(K).check(hx(1)).check(_x(2))).check(hx(1)).check(_x(200))}),tY=q({diffs:J(q({paths:J(K),content:YJ}))}),nY=q({defaultRef:TG(K),bases:J(q({ref:K,name:K,remote:Rb})).check(_x(500))}),rY=q({additions:mx,deletions:mx,binaryFiles:mx}),iY={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`},aY={"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`},oY=qb([`DD`,`AU`,`UD`,`UA`,`DU`,`AA`,`UU`]),sY=qb([`both-deleted`,`added-by-us`,`deleted-by-them`,`added-by-them`,`deleted-by-us`,`both-added`,`both-modified`]),cY=oY.pipe(Xb(sY,f_({decode:e=>iY[e],encode:e=>aY[e]}))),lY=q({scope:qb([`staged`,`unstaged`]),oldPath:TG(rq),newPath:TG(rq)}),uY=Kb([q({scope:qb([`staged`,`unstaged`]),kind:qb([`added`,`modified`,`deleted`,`renamed`,`type-changed`]),oldPath:TG(rq),newPath:TG(rq),oldMode:K.check(ax(/^[0-7]{6}$/)),newMode:K.check(ax(/^[0-7]{6}$/)),oldOid:TG(ZK),newOid:TG(ZK),supported:Rb}),q({scope:G(`untracked`),path:rq}),q({scope:G(`unmerged`),path:rq,conflict:cY})]),dY=q({environmentId:K.check(ox()),worktreeId:wG,statusToken:JJ,branch:W(q({name:TG(K),upstream:TG(K),ahead:Lb.check(px()).check(ux(0)),behind:Lb.check(px()).check(ux(0)),remoteName:TG(K),sourceRef:TG(K),upstreamOid:TG(ZK),stashes:J(q({oid:ZK,message:K})),discarded:J(q({oid:ZK,path:rq,kind:qb([`hunk`,`rename`])})).check(_x(50))})),consistency:G(`best-effort`),headOid:TG(ZK),inProgress:TG(qb([`merge`,`rebase`])),mergeHeadOid:TG(ZK),headCommit:TG(q({subject:K,body:W(K)})),changes:J(uY).check(_x(iG))}),fY=q({environmentId:K.check(ox()),worktreeId:wG,...rY.fields,additions:rY.fields.additions.check(ux(0)),deletions:rY.fields.deletions.check(ux(0)),binaryFiles:rY.fields.binaryFiles.check(ux(0))}),pY=q({path:rq,fingerprint:TG(JJ),comparisons:J(uY).check(hx(1))}),mY=q({name:TG(K),upstream:TG(K),ahead:Lb.check(px()).check(ux(0)),behind:Lb.check(px()).check(ux(0))}),hY=q({environmentId:K.check(ox()),worktreeId:wG,statusToken:JJ,headOid:TG(ZK),inProgress:TG(qb([`merge`,`rebase`])),mergeHeadOid:TG(ZK),branch:TG(mY),interrupted:W(q({requestId:K.check(ox()),action:$K})),changes:J(pY).check(_x(iG))}),gY=q({expectedStatusToken:JJ,expectedFiles:J(q({path:rq,fingerprint:TG(JJ)})).check(hx(1)).check(_x(200)),selections:J(lY).check(hx(1)).check(_x(200))}),_Y=q({environmentId:K.check(ox()),worktreeId:wG,statusToken:JJ,diffs:J(q({selection:lY,content:YJ}))}),vY=q({path:rq,from:Tx.check(px()).check(ux(1)),to:Tx.check(px()).check(ux(1)),at:qb([`head`,`worktree`])}),yY=q({environmentId:K.check(ox()),worktreeId:wG,at:qb([`head`,`worktree`]),path:rq,from:Lb.check(px()).check(ux(0)),to:Lb.check(px()).check(ux(0)),lines:J(K)}),bY=QK,xY=J(ZK),SY=bY.pipe(Xb(xY,f_({decode:e=>e.split(`,`),encode:e=>e.join(`,`)}))),CY=q({limit:W(Tx.check(px()).check(ux(1)).check(dx(100))),after:W(SY),tip:W(ZK)}),wY=Kb([q({kind:G(`attached`),ref:K}),q({kind:G(`detached`)}),q({kind:G(`unborn`),ref:K})]),TY=Kb([q({kind:qb([`local-branch`,`remote-branch`,`tag`]),name:K}),q({kind:G(`head`),name:G(`HEAD`)})]),EY=q({oid:ZK,parentOids:J(ZK),author:q({name:K,timestamp:K}),subject:K,subjectTruncated:Rb,body:TG(K),bodyTruncated:Rb,refs:J(TY)}),DY=q({snapshot:TG(q({tipOid:TG(ZK),head:wY})),commits:J(EY).check(_x(100)),nextAfter:TG(J(ZK).check(_x(100))),tip:TG(ZK),boundary:TG(qb([`shallow`,`wide`])),restarted:Rb}),OY=q({tip:ZK,offset:mx.check(ux(1)).check(dx(2**53-1-100-1))}),kY=q({path:rq,after:W(wx(OY)),limit:W(Tx.check(px()).check(ux(1)).check(dx(100)))}),AY=q({commits:J(q({commit:EY,path:K,previousPath:TG(K),status:qb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})).check(_x(100)),nextAfter:TG(OY),tip:TG(ZK),boundary:TG(G(`shallow`)),restarted:Rb}),jY=Kb([q({kind:G(`parent`),parentNumber:Lb.check(px()).check(lx(0)),baseOid:ZK}),q({kind:G(`empty-tree`)})]),MY=q({oldPath:TG(K),newPath:TG(K),status:qb([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldMode:K,newMode:K}),NY=q({worktreeId:wG,oid:ZK}),PY=q({parent:W(Tx.check(px()).check(ux(1)).check(dx(cG)))}),FY=q({commit:EY,comparison:jY,files:J(MY).check(_x(lG))}),IY=q({worktreeId:wG,oid:ZK}),LY=q({parent:W(Lb.check(px()).check(ux(1)).check(dx(cG))),paths:J(J(K).check(hx(1)).check(_x(2))).check(hx(1)).check(_x(200))}),RY=q({commitOid:ZK,diffs:J(q({paths:J(K),content:YJ}))}),zY=class extends LK.add(FG(`changes`).add(RA(`readWorktreeSummary`,`/api/worktrees/:worktreeId/summary`,{disableCodecs:!0,params:EG,success:fY,error:[FK,...Qq,...dJ]}),RA(`listBranchBases`,`/api/worktrees/:worktreeId/branch-bases`,{disableCodecs:!0,params:EG,success:nY,error:[...Qq,...dJ]}),RA(`listCommits`,`/api/worktrees/:worktreeId/commits`,{disableCodecs:!0,params:EG,query:CY.fields,success:DY,error:[...Qq,...dJ]}),RA(`listFileCommits`,`/api/worktrees/:worktreeId/file-commits`,{disableCodecs:!0,params:EG,query:kY.fields,success:AY,error:[...Qq,...dJ]}),RA(`readBranchChanges`,`/api/worktrees/:worktreeId/branch-changes`,{disableCodecs:!0,params:EG,query:QJ.fields,success:$J,error:[...Qq,...dJ,$(BJ,`NotFound`),$(GJ,`Conflict`),$(KJ,`Conflict`)]}),zA(`readBranchDiffs`,`/api/worktrees/:worktreeId/branch-changes/diffs`,{disableCodecs:!0,params:EG,payload:eY,success:tY,error:[...Qq,...dJ,$(VJ,`NotFound`),$(HJ,`UnprocessableEntity`)]}),zA(`readChangeDiffs`,`/api/worktrees/:worktreeId/changes/diffs`,{disableCodecs:!0,params:EG,payload:gY,success:_Y,error:[FK,...Qq,...dJ,$(UJ,`BadRequest`,{message:`Invalid request`}),$(WJ,`BadRequest`,{message:`Invalid request`}),$(HJ,`UnprocessableEntity`)]}),RA(`readChangeLines`,`/api/worktrees/:worktreeId/changes/lines`,{disableCodecs:!0,params:EG,query:vY.fields,success:yY,error:[FK,...zJ,$(Hq,`BadRequest`,{message:`Invalid request`})]}),RA(`readChanges`,`/api/worktrees/:worktreeId/changes`,{disableCodecs:!0,params:EG,success:hY,error:[FK,...Qq,...dJ]}),zA(`readCommitDiffs`,`/api/worktrees/:worktreeId/commits/:oid/diffs`,{disableCodecs:!0,params:IY,payload:LY,success:RY,error:[...Qq,...dJ,$(VJ,`NotFound`)]}),RA(`readCommitFiles`,`/api/worktrees/:worktreeId/commits/:oid/files`,{disableCodecs:!0,params:NY,query:PY.fields,success:FY,error:[...Qq,...dJ,$(VJ,`NotFound`)]}),RA(`readGitStatus`,`/api/worktrees/:worktreeId/git/status`,{disableCodecs:!0,params:EG,success:dY,error:[FK,...Qq,...dJ]})).middleware(oK)){};function BY(e){return new TextEncoder().encode(e).byteLength}var VY=Kb([G(``),rq]),HY=K.check(ix(e=>e.length<=1048576&&!e.includes(`\0`)&&BY(e)<=1048576,{expected:`UTF-8 text without NUL within the write limit`})),UY=q({path:VY}),WY=bb(q({worktreeId:wG,path:K,entries:J(q({name:K,kind:qb([`file`,`directory`,`symlink`,`submodule`,`other`]),ignored:W(Rb),target:W(K)}))})),GY=bb(q({worktreeId:wG,paths:J(K).check(_x(fG))})),KY=q({path:rq}),qY=bb(q({worktreeId:wG,path:K,encoding:G(`utf-8`),byteLength:mx.check(ux(0)),text:K,contentFingerprint:W(JJ)})),JY=Kb([q({kind:G(`write`),path:rq,text:HY,expectedFingerprint:JJ}),q({kind:G(`create`),path:rq,entryKind:qb([`file`,`directory`])}),q({kind:G(`move`),path:rq,destination:rq}),q({kind:G(`trash`),path:rq}),q({kind:G(`copy`),path:rq,destination:rq})]),YY=bb(q({path:K,contentFingerprint:W(JJ)})),XY=q({path:rq}),ZY=bb(q({path:K,mediaType:K,base64:K})),QY=q({document:rq,paths:J(K.check(_x(oG))).check(hx(1),_x(64))}),$Y=bb(q({assets:J(Kb([q({kind:G(`asset`),path:K,mediaType:K,base64:K}),q({kind:G(`unavailable`),path:K})]))})),eX=class extends LK.add(FG(`files`).add(RA(`listDirectory`,`/api/worktrees/:worktreeId/directory`,{disableCodecs:!0,params:EG,query:UY.fields,success:WY,error:[...RJ,AJ,jJ]}),RA(`listWorktreePaths`,`/api/worktrees/:worktreeId/paths`,{disableCodecs:!0,params:EG,success:GY,error:[...Qq,jJ]}),RA(`readTextFile`,`/api/worktrees/:worktreeId/text`,{disableCodecs:!0,params:EG,query:KY.fields,success:qY,error:[...RJ,FJ,IJ]}),RA(`readFileAsset`,`/api/worktrees/:worktreeId/asset`,{disableCodecs:!0,params:EG,query:XY.fields,success:ZY,error:[...RJ,PJ,IJ]}),zA(`readPreviewAssets`,`/api/worktrees/:worktreeId/preview-assets`,{disableCodecs:!0,params:EG,payload:QY,success:$Y,error:Qq}),zA(`editFile`,`/api/worktrees/:worktreeId/files`,{disableCodecs:!0,params:EG,payload:JY,success:YY,error:[...RJ,FJ,OJ,MJ,NJ,IJ,LJ,TJ]})).middleware(oK)){},tX=class extends Y()(`CommitDraftSelectionError`,{}){get message(){return`Select readable changed files to generate a commit draft.`}},nX=class extends Y()(`CommitDraftTooLargeError`,{}){get message(){return`Select fewer files to generate a commit draft.`}},rX=class extends Y()(`CommitGenerationFailedError`,{}){get message(){return`Commit generation failed.`}},iX=class extends Y()(`CommitGroupsMismatchError`,{}){get message(){return`The generated draft did not cover the selected files. Generate again or write the message manually.`}},aX=class extends Y()(`CommitToolFailedError`,{}){get message(){return`Commit generation failed. Check that the selected CLI is up to date and signed in.`}},oX=class extends Y()(`CommitToolMissingError`,{}){get message(){return`The selected coding CLI is not installed.`}},sX=class extends Y()(`DiscardExpectationMismatchError`,{}){get message(){return`A discard expects exactly the discarded path`}},cX=class extends Y()(`DuplicateExpectedFileError`,{}){get message(){return`Each expected file may appear only once`}},lX=class extends Y()(`EmptyCommitSelectionError`,{}){get message(){return`Select at least one path to commit`}},uX=class extends Y()(`ExpectedFilesMismatchError`,{}){get message(){return`The expected files do not match the selected paths`}},dX=class extends Y()(`GitActionNotFoundError`,{}){get message(){return`Git action receipt not found`}},fX=class extends Y()(`GitActionReceiptMismatchError`,{}){get message(){return`Git action receipt does not match this request`}},pX=class extends Y()(`InvalidHunkRangeError`,{}){get message(){return`The hunk ends before it starts`}},mX=class extends Y()(`MergeExpectationMismatchError`,{}){get message(){return`A merge in progress and its merge head must be expected together`}},hX=class extends Y()(`MissingExpectedFilesError`,{}){get message(){return`This action needs the files the client expects`}},gX=class extends Y()(`MissingUpstreamExpectationError`,{}){get message(){return`This action needs the upstream the client expects`}},_X=class extends Y()(`UnsupportedCommitModelError`,{}){get message(){return`Unsupported commit model.`}},vX=class extends Y()(`WorktreeCleanupRefusedError`,{message:K}){},yX=J(q({id:K,label:K})),bX=q({mode:qb([`message`,`groups`]),model:K.check(hx(1)).check(_x(160)),expectedStatusToken:JJ,paths:J(rq).check(hx(1)).check(_x(iG))}),xX=q({groups:J(q({message:K.check(hx(1)).check(_x(rG)),paths:J(rq).check(hx(1)).check(_x(iG))})).check(hx(1)).check(_x(20)),expectedFiles:J(q({path:rq,fingerprint:JJ})).check(_x(iG))}),SX=K.check(hx(1)).check(_x(rG)).check(ix(e=>e.trim().length>0&&!e.includes(`\0`)&&BY(e)<=16384)),CX=K.check(_x(dG)).check(ax(/^refs\/heads\/[\s\S]/u)).check(ix(e=>!e.includes(`\0`))),wX=K.check(ax(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/)),TX=q({path:rq,fingerprint:JJ}),EX=q({worktreeId:wG,requestId:K.check(ox())}),DX=Kb([q({action:G(`switch`),targetRef:CX}),q({action:G(`fetch`),remoteName:wX,sourceRef:CX}),q({action:G(`pull`),remoteName:wX,sourceRef:CX,strategy:W(qb([`ff-only`,`merge`,`rebase`]))}),q({action:G(`push`),remoteName:wX,destinationRef:CX,allowCreate:Rb}),q({action:G(`commit`),message:SX,paths:J(rq).check(_x(iG))}),q({action:G(`amend`),message:SX,paths:J(rq).check(_x(iG))}),q({action:G(`stash-create`),message:SX,includeUntracked:Rb}),q({action:qb([`stash-apply`,`stash-pop`]),stashOid:ZK,restoreIndex:Rb.pipe(ex(B(!1)))}),q({action:G(`discard`),path:rq,hunk:W(q({scope:qb([`staged`,`unstaged`]),startLine:Lb.check(px()).check(lx(0)),endLine:Lb.check(px()).check(lx(0))}))})]),OX=q({headOid:TG(ZK),branch:TG(K),inProgress:TG(qb([`merge`,`rebase`])),mergeHeadOid:TG(ZK),upstreamOid:W(Jb(ZK)),files:W(J(TX).check(_x(iG)))}),kX=q({requestId:K.check(ox()),input:DX,expected:OX}),AX=eq,jX=Kb([eq,bG]),MX=EX,NX=eq,PX=EX,FX=q({dismissed:G(!0)}),IX=$(fX,`Conflict`,{message:`Git action request does not match its receipt`}),LX=$(dX,`NotFound`),RX=[$(pX,`BadRequest`,{message:`Invalid request`}),$(cX,`BadRequest`,{message:`Invalid request`}),$(mX,`BadRequest`,{message:`Invalid request`}),$(lX,`BadRequest`,{message:`Invalid request`}),$(uX,`BadRequest`,{message:`Invalid request`}),$(sX,`BadRequest`,{message:`Invalid request`}),$(hX,`BadRequest`,{message:`Invalid request`}),$(gX,`BadRequest`,{message:`Invalid request`})],zX=[$(tX,`UnprocessableEntity`),$(nX,`UnprocessableEntity`),$(rX,`UnprocessableEntity`),$(iX,`UnprocessableEntity`),$(aX,`UnprocessableEntity`),$(oX,`UnprocessableEntity`),$(_X,`UnprocessableEntity`)],BX=class extends LK.add(FG(`gitActions`).add(HA(`dismissInterruptedGitAction`,`/api/worktrees/:worktreeId/git/interrupted/:requestId`,{disableCodecs:!0,params:PX,success:FX,error:[...Qq,LX,IX]}),zA(`generateCommitDraft`,`/api/worktrees/:worktreeId/git/commit-draft`,{disableCodecs:!0,params:EG,payload:bX,success:xX,error:[...Qq,...dJ,...zX]}),RA(`listCommitModels`,`/api/git/commit-models`,{disableCodecs:!0,success:yX}),RA(`readGitActionReceipt`,`/api/worktrees/:worktreeId/git/receipts/:requestId`,{disableCodecs:!0,params:MX,success:NX,error:[...Qq,LX]}),zA(`runGitAction`,`/api/worktrees/:worktreeId/git/actions`,{disableCodecs:!0,params:EG,payload:kX,success:[AX,AX.pipe(Rk(202)),jX.pipe(Rk(409)),jX.pipe(Rk(503))],error:[...Qq,IX,...RX]})).middleware(oK)){};q({address:K,dataDirectory:K,pid:mx}),q({path:jb(K),fingerprint:jb(Kb([K,Ib]))});var VX=q({deleteWorktree:Rb,deleteLocalBranch:Rb,deleteRemoteBranch:Rb}),HX=q({worktreePath:W(K),detachWorktreePath:W(K),localBranch:W(K),remoteBranch:W(K),remoteBranchNote:W(K),mainCheckout:Rb,dirty:Rb,unpushed:Rb,fingerprint:K}),UX=q({options:VX,confirmation:W(q({plan:HX,discardChanges:Rb}))}),WX=UX,GX=q({deleted:Rb,plan:HX}),KX=K.check(ix(e=>nq(e,oG),{expected:`a normalized relative path`})),qX=bb(q({preferences:J(q({path:KX,pinned:Rb,hidden:Rb}))})),JX=q({path:KX,flag:qb([`pinned`,`hidden`]),value:Rb}),YX=qX,XX=qb([`moved`,`missing`,`permission`,`git-failed`]),ZX=K.check(hx(1),_x(oG),ix(e=>e.startsWith(`/`)&&!e.includes(`\0`),{expected:`an absolute path without NUL`})),QX={id:CG,name:K,worktrees:J(q({id:wG,path:K,main:Rb,branch:TG(K),headCommittedAt:Ab(SG),available:Rb,status:TG(qb([`pending`,`reviewed`,`replied`]))}))},$X=Kb([q({...QX,available:G(!0),unavailableReason:Ab(Pb)}),q({...QX,available:G(!1),unavailableReason:Ab(XX)})]),eZ=q({projectId:CG}),tZ=eZ,nZ=eZ,rZ=eZ,iZ=bb(q({environmentId:CG,environment:BK,projects:J($X)})),aZ=q({path:ZX}),oZ=bb($X),sZ=q({deleted:Rb}),cZ=q({path:Ab(ZX)}),lZ=bb(q({path:K,parent:TG(K),directories:J(q({name:K,path:K})),repository:Rb,truncated:Rb})),uZ=bb(q({name:K.pipe(Xb(K.check(hx(1),_x(100),ix(e=>!/[\p{Cc}\p{Cf}]/u.test(e),{expected:`a name without control characters`})),f_({decode:e=>e.trim(),encode:e=>e})))}),{parseOptions:IK}),dZ=q({id:CG,name:K}),fZ=$(Yq,`NotFound`),pZ=class extends LK.add(FG(`projects`).add(zA(`deleteWorktree`,`/api/worktrees/:worktreeId/delete`,{disableCodecs:!0,params:EG,payload:WX,success:GX,error:[...Qq,$(vX,`Conflict`,{message:{fromError:!0}})]}),RA(`browseProjectFolders`,`/api/projects/folders`,{disableCodecs:!0,query:cZ.fields,success:lZ,error:[$(qq,`NotFound`),$(Jq,`UnprocessableEntity`),$(Xq,`UnprocessableEntity`)]}),RA(`readInventory`,`/api/inventory`,{disableCodecs:!0,success:iZ,error:FK}),zA(`refreshInventory`,`/api/inventory/refresh`,{disableCodecs:!0,success:iZ,error:FK}),RA(`listFilePreferences`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:nZ,success:qX,error:fZ}),zA(`registerProject`,`/api/projects`,{disableCodecs:!0,payload:aZ,success:oZ,error:[fZ,$(Gq,`UnprocessableEntity`,{message:`Repository could not be inspected`})]}),HA(`removeProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:tZ,success:sZ,error:fZ}),VA(`renameProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:eZ,payload:uZ,success:dZ,error:fZ}),BA(`setFilePreference`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:rZ,payload:JX,success:YX,error:[fZ,$(Kq,`Conflict`,{message:`File preference limit reached`})]})).middleware(oK)){},mZ=class extends Y()(`UnknownBoxLayerError`,{}){get message(){return`A diagram box names a layer the review does not have`}},hZ=class extends Y()(`CommentAuthorMismatchError`,{}){get message(){return`Only the author of a comment may change it`}},gZ=class extends Y()(`CommentIdentityConflictError`,{}){get message(){return`Comment ID belongs to a different write`}},_Z=class extends Y()(`CommentLimitExceededError`,{}){get message(){return`Comment capacity exceeded`}},vZ=class extends Y()(`CommentRevisionMismatchError`,{}){get message(){return`The comparison must identify the revision it belongs to`}},yZ=class extends Y()(`CommentTargetNotFoundError`,{}){get message(){return`Comment target not found`}},bZ=class extends Y()(`DuplicateLayerIdError`,{}){get message(){return`Layer IDs repeat within the review`}},xZ=class extends Y()(`DuplicateStepIdError`,{}){get message(){return`Step IDs repeat within a layer`}},SZ=class extends Y()(`ReviewConflictError`,{}){get message(){return`The review changed; reload before retrying`}},CZ=class extends Y()(`ReviewLayerNotFoundError`,{}){get message(){return`Review layer not found`}},wZ=class extends Y()(`ReviewSummaryNotFoundError`,{}){get message(){return`Review summary not found`}},TZ=class extends Y()(`ReviewedMarkConflictError`,{}){get message(){return`The reviewed mark is based on a version that has changed`}},EZ=class extends Y()(`StepLaneOutOfRangeError`,{}){get message(){return`A step names a lane its layer does not have`}},DZ=class extends Y()(`UnsupportedCommentComparisonError`,{}){get message(){return`A comment on the whole change compares only against a branch`}},OZ=class extends Y()(`UnknownArrowBoxError`,{}){get message(){return`A diagram arrow joins a box its diagram does not have`}},kZ=class extends Y()(`InvalidDecisionBoxError`,{}){get message(){return`A decision box must name a layer and be the only decision box for that layer`}},AZ=class extends Y()(`ProofFileNotFoundError`,{}){get message(){return`Proof file not found`}},jZ=class extends Y()(`ProofFileUnreadableError`,{}){get message(){return`A proof file is missing from the worktree or is not a readable file`}},MZ=class extends Y()(`ProofTooLargeError`,{}){get message(){return`A proof file, or the proof files together, are over their size limit`}},NZ=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`}},PZ=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`}},FZ=class extends Y()(`UnknownProofFileError`,{}){get message(){return`A proofId names no image or video of the current review`}},IZ=class extends Y()(`InvalidReviewPointerError`,{layerId:K,stepId:K,path:K,startLine:Lb,endLine:Lb,reason:qb([`missing`,`unreadable`,`out-of-range`]),lineCount:Ab(Lb)}){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}}},LZ=class extends Y()(`ReviewPublishRefusedError`,{message:K}){},RZ=class extends Y()(`ReviewNotFoundError`,{}){get message(){return`Review or revision not found`}},zZ=class extends Y()(`InvalidReviewComparisonError`,{}){get message(){return`The from revision must not be newer than the to revision`}},BZ=qb([`gh-not-installed`,`no-accounts`,`no-access`,`not-github`,`rate-limited`,`offline`,`invalid-response`,`pull-request-not-found`]),VZ=q({kind:G(`unavailable`),reason:BZ}),HZ=q({account:K,source:qb([`detected`,`overridden`])}),UZ=q({repository:W(K),accounts:J(K),choice:W(HZ),override:W(K),unavailable:W(VZ)}),WZ=Jb(q({login:K,avatarUrl:W(K)})),GZ=q({hasNextPage:Rb}),KZ=Kb([q({__typename:G(`CheckRun`),name:K,status:K,conclusion:Jb(K),detailsUrl:Jb(K),startedAt:W(Jb(K)),completedAt:W(Jb(K))}),q({__typename:G(`StatusContext`),context:K,state:K,targetUrl:Jb(K)})]),qZ=q({number:mx,title:K,url:K,state:qb([`OPEN`,`CLOSED`,`MERGED`]),isDraft:Rb,author:WZ,headRefName:K,updatedAt:K,commits:q({nodes:J(q({commit:q({statusCheckRollup:Jb(q({state:K}))})}))})}),JZ=q({id:K,author:WZ,createdAt:K,body:K,url:K});q({...qZ.fields,commits:q({nodes:J(q({commit:q({statusCheckRollup:Jb(q({state:K,contexts:q({nodes:J(KZ),pageInfo:GZ})}))})}))}),body:K,createdAt:W(K),baseRefName:K,headRefOid:K,mergeable:K,labels:q({nodes:J(q({name:K,color:K})),pageInfo:GZ}),comments:q({nodes:J(JZ),pageInfo:GZ}),reviews:q({nodes:J(q({id:K,author:WZ,submittedAt:Jb(K),createdAt:W(K),body:K,url:K,state:K,comments:q({nodes:J(q({...JZ.fields,path:K,diffHunk:W(K),line:Jb(mx),originalLine:Jb(mx)})),pageInfo:GZ})})),pageInfo:GZ})});var YZ=q({name:K,status:K,conclusion:W(K),detailsUrl:W(K),durationMs:W(mx)}),XZ=q({number:mx,title:K,url:K,state:qb([`open`,`closed`,`merged`]),draft:Rb,author:W(K),headBranch:K,updatedAt:K,checksSummary:W(K),checksTruncated:Rb}),ZZ=q({id:K,kind:qb([`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(mx),originalLine:W(mx)}),QZ=q({...XZ.fields,description:K,createdAt:W(K),authorAvatarUrl:W(K),baseBranch:K,headSha:K,matchesReviewHead:Rb,mergeable:K,labels:J(q({name:K,color:K})),checks:J(YZ),timeline:J(ZZ),truncated:Rb});q({number:mx,commits:q({nodes:J(q({commit:q({statusCheckRollup:Jb(q({state:qb([`SUCCESS`,`PENDING`,`EXPECTED`,`FAILURE`,`ERROR`])}))})}))})});var $Z=qb([`passed`,`running`,`failed`,`none`]);Y()(`GitHubReadError`,{reason:BZ}),Y()(`GitHubPullRequestNotFoundError`,{});var eQ=class extends Y()(`ReviewArchiveRefusedError`,{message:K}){},tQ=class extends Y()(`ReviewPullRequestRefusedError`,{message:K}){},nQ=class extends Y()(`AgentFeedbackConflictError`,{reviewId:K,reason:qb([`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`}}},rQ=q({path:jb(K),startLine:jb(Lb),endLine:jb(Lb),symbol:jb(W(Kb([K,Ib])))}),iQ=q({id:jb(K),lane:jb(Lb),title:jb(K),text:jb(K),kind:jb(Kb([G(`changed`),G(`context`)])),pointer:jb(rQ)}),aQ=q({id:jb(K),title:jb(K),summary:jb(K),lanes:jb(J(K)),steps:jb(J(iQ))}),oQ=q({...iQ.fields,published:jb(J(K))});q({...tie(aQ.fields,[`steps`]),steps:jb(J(oQ)),fingerprint:jb(K)});var sQ=q({id:jb(K),label:jb(K),detail:jb(W(Kb([K,Ib]))),change:jb(W(Kb([G(`new`),G(`changed`),G(`removed`),Ib]))),problem:jb(W(Kb([K,Ib]))),layerId:jb(W(Kb([K,Ib]))),decision:jb(W(G(!0)))}),cQ=q({from:jb(K),to:jb(K),label:jb(W(Kb([K,Ib])))});q({after:jb(q({boxes:jb(J(sQ)),arrows:jb(J(cQ))}))});var lQ=qb([`merge`,`hold`]),uQ=q({what:K,why:K}),dQ=q({behavior:K,why:K,paths:J(K)});q({asked:q({text:K,links:W(J(q({title:K,url:K})))}),recommendation:lQ,reasons:J(K),notProven:J(uQ),removed:J(dQ)}),q({reviewId:K,projectId:K,commonDirectory:K,branch:K,pullRequest:W(K),state:qb([`open`,`closed`]),archived:W(Rb),latestRevision:mx,lastSeenRevision:mx}),q({path:K,oldPath:W(K),newPath:W(K),oldOid:W(K),newOid:W(K),oldMode:K,newMode:K,status:qb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])}),q({path:K,ranges:J(q({startLine:Lb,endLine:Lb})),deleted:W(Rb),binary:W(Rb)});var fQ=q({layerId:jb(W(Kb([K,Ib]))),stepId:jb(W(Kb([K,Ib])))}),pQ=q({...fQ.fields,name:jb(K),result:jb(Kb([G(`pass`),G(`fail`)])),output:jb(W(Kb([K,Ib])))}),mQ=Kb([G(`image`),G(`video`)]),hQ=Kb([G(`image/png`),G(`image/jpeg`),G(`image/gif`),G(`image/webp`),G(`video/mp4`),G(`video/webm`)]),gQ=Kb([q({...fQ.fields,id:jb(K),kind:jb(mQ),title:jb(K),mediaType:jb(hQ),byteLength:jb(Lb)}),q({...q({...fQ.fields,kind:jb(G(`link`)),title:jb(K),url:jb(K)}).fields,id:jb(K)})]);q({paths:W(J(K)),checks:jb(J(pQ)),assets:jb(J(gQ))});var _Q=Kb([q({kind:jb(G(`worktree`)),scope:jb(Kb([G(`staged`),G(`unstaged`),G(`untracked`)]))}),q({kind:jb(G(`file`))}),q({kind:jb(G(`commit`)),parent:jb(Lb)}),q({kind:jb(G(`branch`)),base:jb(K)})]);Kb([q({comparison:jb(W(Kb([_Q,Ib]))),revision:jb(W(Kb([K,Ib]))),contentFingerprint:jb(W(Kb([K,Ib]))),kind:jb(G(`change`))}),q({comparison:jb(W(Kb([_Q,Ib]))),revision:jb(W(Kb([K,Ib]))),contentFingerprint:jb(W(Kb([K,Ib]))),kind:jb(G(`file`)),filePath:jb(K)}),q({comparison:jb(W(Kb([_Q,Ib]))),revision:jb(W(Kb([K,Ib]))),contentFingerprint:jb(W(Kb([K,Ib]))),kind:jb(G(`codeRange`)),filePath:jb(K),startLine:jb(Lb),endLine:jb(Lb),side:jb(W(Kb([G(`additions`),G(`deletions`),Ib])))})]),Kb([G(`reviewer`),G(`agent`)]);var vQ=J(K),yQ=q({path:K,headBlobOid:K}),bQ=q({layerId:K,fingerprint:K}),xQ=q({area:qb([`baseline`,`file-marks`,`conversation`,`proof`]),reason:K,ids:vQ}),SQ=q({files:J(Kb([q({path:K,change:qb([`entered`,`left`])}),q({path:K,change:qb([`changed`,`unchanged`]),headChanged:Rb,baseChanged:Rb})])),decisions:q({affected:vQ,new:vQ,gone:vQ,resetMarks:J(bQ)}),fileMarks:q({carriedCount:mx,carried:J(yQ),reset:J(yQ)}),verdict:q({recommendation:q({from:lQ,to:lQ}),removed:q({added:J(dQ),dropped:J(dQ)}),deletedFiles:q({added:vQ,dropped:vQ}),notProven:q({added:J(uQ),dropped:J(uQ)})}),conversation:q({agentMessageCount:mx,agentThreadIds:vQ,agentMessages:J(q({threadId:K,messageId:K,body:K,createdAt:K})),resolvedThreadCount:mx,resolvedThreadIds:vQ}),proof:q({publishedChecks:J(pQ),changedResults:J(q({from:pQ,to:pQ}))}),unknown:J(xQ)}),CQ=UX,wQ=q({archived:Rb,plan:HX}),TQ=q({kind:G(`t3`),threadId:K}),EQ=q({id:K,reviewId:K,reviewRevision:mx,commentRevision:mx,state:qb([`pending`,`delivered`,`acknowledged`]),attempted:Rb,error:W(K)}),DQ=q({session:W(TQ),delivery:W(EQ)}),OQ=K.check(ox()),kQ=K.pipe(Zb(p_())).check(hx(1)).check(_x(200)),AQ={layerId:W(OQ),stepId:W(OQ)},jQ=qb([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/webm`]),MQ=q({name:kQ,result:qb([`pass`,`fail`]),output:W(K.check(hx(1)).check(_x(_G))),...AQ}),NQ=xG.check(ix(e=>{let t=Cb(Cx)(e);return Nr(t)&&/^https?:$/.test(t.success.protocol)})).check(_x(vG)),PQ=e=>q({kind:G(e),title:kQ,path:W(rq),proofId:W(OQ),...AQ}).check(ix(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`})),FQ=Kb([PQ(`image`),PQ(`video`),q({kind:G(`link`),title:kQ,url:NQ,...AQ})]),IQ=q({checks:W(J(MQ).check(_x(100))),assets:W(J(FQ).check(_x(20)))}),LQ=Kb([q({id:OQ,kind:qb([`image`,`video`]),title:kQ,mediaType:jQ,byteLength:Lb.check(px()).check(lx(0)),...AQ}),q({id:OQ,kind:G(`link`),title:kQ,url:NQ,...AQ})]),RQ=q({checks:J(MQ).check(_x(100)),assets:J(LQ).check(_x(20)),current:Rb}),zQ=q({proofId:OQ}),BQ=q({id:OQ,mediaType:jQ,base64:K}),VQ=/^\/review-summaries\/(?<token>[^?]*)\?expires=(?<expires>[^&]*)&signature=(?<signature>.*)$/,HQ=Lb.check(px()).check(lx(0)),UQ=q({url:K.check(hx(1)),byteLength:HQ}),WQ=q({token:K,expires:K,signature:K,byteLength:HQ}),GQ=UQ.pipe(Xb(WQ,f_({decode:e=>{let t=VQ.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})}))),KQ=K.check(ox()),qQ=Lb.check(px()).check(ux(1)).check(dx(sG)),JQ=q({path:rq,startLine:qQ,endLine:qQ,symbol:W(K.pipe(Zb(p_())).check(hx(1)).check(_x(500)))}),YQ=q({...JQ.fields,textFingerprint:JJ}),XQ=Kb([q({state:G(`changed`)}),q({state:G(`broken`)}),q({state:G(`current`),startLine:qQ,endLine:qQ}),q({state:G(`committed`),startLine:qQ,endLine:qQ})]),ZQ=q({id:KQ,lane:Lb.check(px()).check(ux(0)).check(dx(99)),title:K.pipe(Zb(p_())).check(hx(1)).check(_x(200)),text:K.pipe(Zb(p_())).check(hx(1)).check(_x(mG)),kind:qb([`changed`,`context`]),pointer:JQ}),QQ=q({published:W(J(K)),...ZQ.fields,pointer:YQ,location:XQ}),$Q=q({id:KQ,title:K.pipe(Zb(p_())).check(hx(1)).check(_x(200)),summary:K.pipe(Zb(p_())).check(hx(1)).check(_x(hG)),lanes:J(K.pipe(Zb(p_())).check(hx(1)).check(_x(100))).check(hx(1)).check(_x(100)),steps:J(ZQ).check(hx(1)).check(_x(500))}),e$=q({...$Q.fields,steps:J(QQ).check(hx(1)).check(_x(500)),fingerprint:JJ,codeMoved:W(Rb)}),t$=q({from:KQ,to:KQ,label:W(K.pipe(Zb(p_())).check(hx(1)).check(_x(200)))}),n$=q({after:q({boxes:J(q({id:KQ,label:K.pipe(Zb(p_())).check(hx(1)).check(_x(200)),detail:W(K.pipe(Zb(p_())).check(hx(1)).check(_x(hG))),change:W(qb([`new`,`changed`,`removed`])),problem:W(K.pipe(Zb(p_())).check(hx(1)).check(_x(hG))),layerId:W(KQ),decision:W(G(!0))})).check(_x(500)),arrows:J(t$).check(_x(gG))})}),r$=K.check(hx(1)).check(_x(nG)).check(ix(e=>e.isWellFormed(),{expected:`Expected valid Unicode text`})).check(ix(e=>BY(e)<=nG,{expected:`Summary exceeds 10 MiB`})),i$=q({path:rq,ranges:J(q({startLine:qQ,endLine:qQ})),deleted:W(Rb),binary:W(Rb)}),a$=K.check(ox()),o$=mx.check(lx(0)),s$=K.check(hx(1)).check(_x(hG)),c$=q({asked:q({text:s$,links:W(J(q({title:s$,url:K.check(ax(/^https?:\/\//))})))}),recommendation:qb([`merge`,`hold`]),reasons:J(s$).check(hx(1)).check(_x(5)),notProven:J(q({what:s$,why:s$})),removed:J(q({behavior:s$,why:s$,paths:J(rq).check(hx(1))}))}),l$=Kb([q({kind:G(`available`).pipe(ex(B(`available`))),web:K,app:K,revision:q({web:K,app:K}),decisions:J(q({layerId:KQ,web:K,app:K}))}),q({kind:G(`unavailable`),reason:G(`no-reachable-route`)})]),u$=qb([`http`,`https`]),d$=q({reviewId:a$,projectId:K,revision:o$,headOid:K,base:K,baseOid:K,mergeBaseOid:K,publishedAt:SG,branch:K,worktreePath:K,worktreeName:K}),f$=q({reviewId:W(a$),headOid:W(K),baseOid:W(K),base:W(K),mergeBaseOid:W(K),verdict:W(c$),links:W(l$),environmentId:K.check(ox()),worktreeId:wG,revision:Lb.check(px()).check(lx(0)),publishedAt:SG,active:Rb,diagnostics:qb([`current`,`unavailable`]),summary:GQ,diagram:W(n$),layers:J(e$).check(_x(100)),notExplained:J(i$).check(_x(iG)),proof:RQ}),p$=q({expectedRevision:Lb.check(px()).check(ux(0)).check(dx(2**53-1-1)),summaryHtml:W(r$),verdict:c$,base:W(K.check(hx(1))),pullRequest:W(K.check(ax(/^https:\/\/github\.com\/[^/]+\/[^/]+\/pull\/[1-9][0-9]*\/?$/))),reviewId:W(a$),diagram:W(n$),layers:J($Q).check(hx(1)).check(_x(100)),proof:W(IQ)}),m$=q({review:TG(f$)}),h$=q({...m$.fields,reviewId:a$,revision:o$,headOid:K,baseOid:K,links:l$}),g$=q({projectId:K}),_$=q({revision:W(o$)}),v$=q({paths:eY.fields.paths}),y$=q({reviewId:a$}),b$=q({...y$.fields,revision:Ex.check(px()).check(lx(0))}),x$=q({reviewId:a$,projectId:K,branch:K,pullRequest:W(K),state:qb([`open`,`closed`]),archived:W(Rb),latestRevision:o$,lastSeenRevision:mx}),S$=q({review:TG(x$),revisions:J(d$),revision:TG(q({...d$.fields,files:J(q({path:rq,oldPath:W(rq),newPath:W(rq),oldOid:W(K),newOid:W(K),oldMode:K,newMode:K,status:qb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})),verdict:c$,content:f$}))}),C$=J(x$),w$=q({revision:o$}),T$=q({state:G(`closed`)}),E$=q({deleted:Rb}),D$=q({updated:Rb}),O$=q({path:rq}),k$=Kb([q({kind:G(`text`),text:K,blobOid:K}),q({kind:G(`missing`)}),q({kind:qb([`too-large`,`unsupported`]),blobOid:K})]),A$=q({path:rq,fingerprint:K,reviewedAt:SG,stale:Rb}),j$=q({layerId:KQ,fingerprint:JJ,reviewedAt:SG}),M$=q({files:J(A$),decisions:J(j$)}),N$=Kb([q({kind:G(`file`),revision:o$,path:rq,headBlobOid:K}),q({kind:G(`decision`),revision:o$,layerId:KQ,fingerprint:JJ})]),P$=Kb([q({kind:G(`file`),path:rq,headBlobOid:K}),q({kind:G(`decision`),layerId:KQ,fingerprint:JJ})]);Kb([q({worktreeId:wG,reviewId:W(a$)}),q({reviewId:a$,worktreeId:W(wG)})]);var F$=q({...DQ.fields,acknowledgementAccepted:W(Rb),currentCommentRevision:mx.check(ux(0))}),I$=q({reviewRevision:mx.check(lx(0))}),L$=q({...y$.fields,session:q({...TQ.fields,threadId:K.check(hx(1),_x(2048),ax(/^\S[^\0]*$/))})}),R$=q({...y$.fields,deliveryId:K.check(ox())}),z$=Ex.check(px()).check(lx(0)),B$=q({from:W(z$),to:W(z$)}),V$=q({reviewId:K.check(ox()),from:TG(mx),to:mx,comparison:TG(SQ),unknown:J(xQ)}),H$=q({...B$.fields,path:rq}),U$=Kb([q({kind:G(`diff`),from:mx,to:mx,path:rq,...tY.fields}),q({kind:G(`unavailable`),reason:qb([`no-baseline`,`path-not-reviewed`,`not-changed`])})]),W$=Kb([q({kind:G(`available`),account:K,pullRequest:QZ}),q({kind:G(`not-linked`)}),VZ]),G$=Kb([q({kind:G(`available`),account:K,pullRequests:J(q({...XZ.fields,reviewId:W(K)})),truncated:Rb,recentlyClosedSince:K}),VZ]),K$=q({account:TG(K.check(ax(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/)))});q({override:Ab(K$)});var q$=q({pullRequest:TG(K.check(ax(/^https:\/\/github\.com\/[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+\/pull\/[1-9][0-9]*$/)))}),J$=Kb([q({kind:G(`updated`)}),VZ]),Y$=Kb([q({kind:G(`available`),number:mx,checks:$Z}),q({kind:G(`not-linked`)}),VZ]),X$={comparison:W(Kb([q({kind:G(`worktree`),scope:qb([`staged`,`unstaged`,`untracked`])}),q({kind:G(`file`)}),q({kind:G(`commit`),parent:Lb.check(px()).check(ux(1)).check(dx(cG))}),q({kind:G(`branch`),base:qJ})])),revision:W(K.check(hx(1)).check(_x(256))),contentFingerprint:W(K.check(hx(1)).check(_x(256)))},Z$=K.check(hx(1)).check(_x(pG)).check(ix(e=>e.trim().length>0&&!e.includes(`\0`))),Q$=qb([`reviewer`,`agent`]),$$=Kb([q({kind:G(`change`),filePath:W(Pb),...X$}),q({kind:G(`file`),filePath:rq,...X$}),q({kind:G(`codeRange`),filePath:rq,startLine:Lb.check(px()).check(ux(1)).check(dx(sG)),endLine:Lb.check(px()).check(ux(1)).check(dx(sG)),side:W(qb([`additions`,`deletions`])),...X$})]),e1=q({id:K.check(ox()),body:Z$,author:Q$,createdAt:W(SG),editedAt:W(SG)}),t1=q({review:W(q({reviewId:K.check(ox()),revision:mx.check(lx(0)),headOid:K})),id:K.check(ox()),worktreeId:wG,anchor:$$,resolved:Rb,messages:J(e1).check(hx(1)),revision:Lb.check(px()).check(ux(0))}),n1=q({threadId:K.check(ox())}),r1=q({worktreeId:wG,...n1.fields}),i1=qb([`waiting`,`all`]);q({reviewId:W(K.check(ox())),scope:W(i1)}),q({kind:qb([`owner`,`device`,`agent`])});var a1=J(t1),o1=q({reviewRevision:W(mx.check(lx(0))),reviewId:W(K.check(ox())),threadId:W(K.check(ox())),messageId:W(K.check(ox())),anchor:$$,body:Z$}),s1=t1,c1=q({reviewId:W(K.check(ox())),messageId:W(K.check(ox())),body:Z$}),l1=t1,u1=q({reviewId:W(K.check(ox())),resolved:Rb}),d1=t1,f1=q({reviewId:W(K.check(ox())),messageId:K.check(ox()),body:Z$}),p1=q({reviewId:W(K.check(ox())),messageId:K.check(ox())}),m1=t1,h1=q({threadId:K.check(ox()),thread:TG(t1)}),g1=q({reviewId:W(K.check(ox())),threads:J(q({threadId:K.check(ox()),revision:Lb.check(px()).check(ux(0))})).check(hx(1)).check(_x(100))}),_1=q({deleted:J(K.check(ox())),skipped:J(K.check(ox()))}),v1=q({throughRevision:Lb.check(px()).check(ux(0))}),y1=q({worktreeId:wG,seenThrough:Lb.check(px()).check(ux(0))}),b1=q({path:rq,fingerprint:JJ,reviewedAt:SG}),x1=qb([`worktree`,`branch`]),S1={scope:G(`branch`),base:qJ},C1=q({scope:W(x1),branch:W(qJ)}),w1=q({worktreeId:wG,marks:J(b1).check(_x(uG))}),T1={path:rq,reviewed:G(!0),fingerprint:JJ},E1=Kb([q({...T1,scope:W(G(`worktree`))}),q({...T1,...S1})]),D1=w1,O1={files:J(q({path:rq,fingerprint:JJ})).check(hx(1)).check(_x(aG))},k1=Kb([q({...O1,scope:W(G(`worktree`))}),q({...O1,...S1})]),A1=q({...w1.fields,marked:J(rq).check(_x(aG)),conflicts:J(q({path:rq,reason:qb([`stale`,`missing`])})).check(_x(aG))}),j1=q({path:rq,scope:W(x1),branch:W(qJ)}),M1=w1,N1=q({paths:J(rq).check(hx(1)).check(_x(aG)),scope:W(x1),branch:W(qJ)}),P1=w1,F1=q({worktreeId:wG,marks:J(q({layerId:K.check(ox()),fingerprint:JJ,reviewedAt:SG,stale:Rb})).check(_x(100))}),I1=q({layerId:K.check(ox()),reviewed:G(!0),fingerprint:JJ}),L1=F1,R1=q({layerId:K.check(ox())}),z1=F1,B1=class extends LK.add(FG(`reviews`).add(RA(`readReviewAgentFeedback`,`/api/reviews/:reviewId/agent-feedback`,{disableCodecs:!0,params:y$,success:F$,error:[$(RZ,`NotFound`),$(nQ,`Conflict`,{message:{fromError:!0}})]}),zA(`sendReviewAgentFeedback`,`/api/reviews/:reviewId/agent-feedback`,{disableCodecs:!0,params:y$,payload:I$,success:F$,error:[$(RZ,`NotFound`),$(nQ,`Conflict`,{message:{fromError:!0}})]}),HA(`disconnectReviewAgentSession`,`/api/reviews/:reviewId/agent-session`,{disableCodecs:!0,params:y$,success:F$,error:[$(RZ,`NotFound`),$(nQ,`Conflict`,{message:{fromError:!0}})]}),zA(`archiveReview`,`/api/reviews/:reviewId/archive`,{disableCodecs:!0,params:y$,payload:CQ,success:wQ,error:[$(RZ,`NotFound`),$(Yq,`NotFound`),$(eQ,`Conflict`,{message:{fromError:!0}})]}),RA(`compareReview`,`/api/reviews/:reviewId/compare`,{disableCodecs:!0,params:y$,query:B$.fields,success:V$,error:[$(RZ,`NotFound`),$(zZ,`BadRequest`,{message:{fromError:!0}})]}),RA(`readReviewInterdiff`,`/api/reviews/:reviewId/interdiff`,{disableCodecs:!0,params:y$,query:H$.fields,success:U$,error:[...Qq,...dJ,$(RZ,`NotFound`),$(zZ,`BadRequest`,{message:{fromError:!0}}),$(VJ,`NotFound`),$(HJ,`UnprocessableEntity`)]}),BA(`setReviewPullRequest`,`/api/reviews/:reviewId/pull-request`,{disableCodecs:!0,params:y$,payload:q$,success:J$,error:[$(RZ,`NotFound`),$(Yq,`NotFound`),$(tQ,`Conflict`,{message:{fromError:!0}})]}),RA(`readReviewPullChecks`,`/api/reviews/:reviewId/pull-request/checks`,{disableCodecs:!0,params:y$,success:Y$,error:[$(RZ,`NotFound`),$(Yq,`NotFound`)]}),RA(`readReviewPullRequest`,`/api/reviews/:reviewId/pull-request`,{disableCodecs:!0,params:y$,success:W$,error:[$(RZ,`NotFound`),$(Yq,`NotFound`)]}),RA(`listProjectPullRequests`,`/api/projects/:projectId/pull-requests`,{disableCodecs:!0,params:g$,success:G$,error:[$(Yq,`NotFound`)]}),RA(`readProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:g$,success:UZ,error:[$(Yq,`NotFound`)]}),BA(`setProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:g$,payload:K$,success:UZ,error:[$(Yq,`NotFound`)]})).add(HA(`deleteReviewCommentMessage`,`/api/reviews/:reviewId/comments/:threadId/messages`,{disableCodecs:!0,params:q({...y$.fields,...n1.fields}),query:p1.fields,success:h1,error:[...Qq,$(RZ,`NotFound`),$(yZ,`NotFound`,{message:`Comment target not found`}),$(hZ,`Forbidden`)]}),zA(`deleteResolvedReviewComments`,`/api/reviews/:reviewId/comments/resolved/deletion`,{disableCodecs:!0,params:y$,payload:g1,success:_1,error:[...Qq,$(RZ,`NotFound`)]}),VA(`editReviewCommentMessage`,`/api/reviews/:reviewId/comments/:threadId/messages`,{disableCodecs:!0,params:q({...y$.fields,...n1.fields}),payload:f1,success:m1,error:[...Qq,$(RZ,`NotFound`),$(yZ,`NotFound`,{message:`Comment target not found`}),$(hZ,`Forbidden`),$(_Z,`Conflict`)]}),RA(`listReviewMarks`,`/api/reviews/:reviewId/marks`,{disableCodecs:!0,params:y$,success:M$,error:[$(RZ,`NotFound`)]}),BA(`setReviewMark`,`/api/reviews/:reviewId/marks`,{disableCodecs:!0,params:y$,payload:N$,success:D$,error:[$(RZ,`NotFound`),$(TZ,`Conflict`)]}),zA(`removeReviewMark`,`/api/reviews/:reviewId/marks/removal`,{disableCodecs:!0,params:y$,payload:P$,success:D$,error:[$(RZ,`NotFound`)]}),zA(`createReviewCommentThread`,`/api/reviews/:reviewId/comments`,{disableCodecs:!0,params:y$,payload:o1,success:s1,error:[...Qq,$(RZ,`NotFound`),$(gZ,`Conflict`),$(_Z,`Conflict`),$(Hq,`BadRequest`,{message:`Invalid request`}),$(vZ,`BadRequest`,{message:`Invalid request`}),$(DZ,`BadRequest`,{message:`Invalid request`})]}),RA(`listReviewCommentThreads`,`/api/reviews/:reviewId/comments`,{disableCodecs:!0,params:y$,success:a1,error:[...Qq,$(RZ,`NotFound`)]}),zA(`replyToReviewComment`,`/api/reviews/:reviewId/comments/:threadId/replies`,{disableCodecs:!0,params:q({...y$.fields,...n1.fields}),payload:c1,success:l1,error:[...Qq,$(RZ,`NotFound`),$(gZ,`Conflict`),$(yZ,`NotFound`,{message:`Comment target not found`}),$(_Z,`Conflict`)]}),BA(`updateReviewCommentThread`,`/api/reviews/:reviewId/comments/:threadId`,{disableCodecs:!0,params:q({...y$.fields,...n1.fields}),payload:u1,success:d1,error:[...Qq,$(RZ,`NotFound`),$(yZ,`NotFound`,{message:`Comment target not found`})]}),RA(`readReview`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:y$,success:S$,error:[FK,...Qq,$(RZ,`NotFound`)]}),RA(`readReviewRevision`,`/api/reviews/:reviewId/revisions/:revision`,{disableCodecs:!0,params:b$,success:S$,error:[FK,...Qq,$(RZ,`NotFound`)]}),RA(`listProjectReviews`,`/api/projects/:projectId/reviews`,{disableCodecs:!0,params:g$,success:C$}),BA(`setReviewSeen`,`/api/reviews/:reviewId/seen`,{disableCodecs:!0,params:y$,payload:w$,success:D$,error:[$(RZ,`NotFound`)]}),VA(`setReviewState`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:y$,payload:T$,success:D$,error:[$(RZ,`NotFound`)]}),HA(`deleteProjectReview`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:y$,success:E$,error:[...Qq,$(RZ,`NotFound`)]}),RA(`readReviewProofFile`,`/api/reviews/:reviewId/revisions/:revision/proof`,{disableCodecs:!0,params:b$,query:zQ.fields,success:BQ,error:[...Qq,$(AZ,`NotFound`)]}),RA(`readReviewFile`,`/api/reviews/:reviewId/revisions/:revision/file`,{disableCodecs:!0,params:b$,query:O$.fields,success:k$,error:[$(RZ,`NotFound`)]}),zA(`readReviewDiffs`,`/api/reviews/:reviewId/revisions/:revision/diffs`,{disableCodecs:!0,params:b$,payload:v$,success:tY,error:[...Qq,...dJ,$(RZ,`NotFound`),$(VJ,`NotFound`),$(HJ,`UnprocessableEntity`)]}),zA(`createCommentThread`,`/api/worktrees/:worktreeId/comments`,{disableCodecs:!0,params:EG,payload:o1,success:s1,error:[...Qq,$(RZ,`NotFound`),$(gZ,`Conflict`),$(_Z,`Conflict`),$(Hq,`BadRequest`,{message:`Invalid request`}),$(vZ,`BadRequest`,{message:`Invalid request`}),$(DZ,`BadRequest`,{message:`Invalid request`})]}),HA(`deleteCommentMessage`,`/api/worktrees/:worktreeId/comments/:threadId/messages`,{disableCodecs:!0,params:r1,query:p1.fields,success:h1,error:[...Qq,$(RZ,`NotFound`),$(yZ,`NotFound`,{message:`Comment target not found`}),$(hZ,`Forbidden`)]}),zA(`deleteResolvedComments`,`/api/worktrees/:worktreeId/comments/resolved/deletion`,{disableCodecs:!0,params:EG,payload:g1,success:_1,error:[...Qq,$(RZ,`NotFound`)]}),VA(`editCommentMessage`,`/api/worktrees/:worktreeId/comments/:threadId/messages`,{disableCodecs:!0,params:r1,payload:f1,success:m1,error:[...Qq,$(RZ,`NotFound`),$(yZ,`NotFound`,{message:`Comment target not found`}),$(hZ,`Forbidden`),$(_Z,`Conflict`)]}),RA(`listCommentThreads`,`/api/worktrees/:worktreeId/comments`,{disableCodecs:!0,params:EG,success:a1,error:[...Qq,$(RZ,`NotFound`)]}),RA(`listReviewedFiles`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:EG,query:C1.fields,success:w1,error:[...Qq,$(RZ,`NotFound`)]}),RA(`listReviewedLayers`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:EG,success:F1,error:[...Qq,$(RZ,`NotFound`)]}),zA(`markCommentsSeen`,`/api/worktrees/:worktreeId/comments/seen`,{disableCodecs:!0,params:EG,payload:v1,success:y1,error:[...Qq,$(RZ,`NotFound`)]}),HA(`deleteReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:EG,success:E$,error:[...Qq,$(RZ,`NotFound`)]}),BA(`publishReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:EG,payload:p$,success:h$,error:[FK,...Qq,...dJ,$(bZ,`BadRequest`,{message:`Invalid request`}),$(xZ,`BadRequest`,{message:`Invalid request`}),$(Hq,`BadRequest`,{message:`Invalid request`}),$(EZ,`BadRequest`,{message:`Invalid request`}),$(kZ,`BadRequest`,{message:`Invalid request`}),$(mZ,`BadRequest`,{message:`Invalid request`}),$(OZ,`BadRequest`,{message:`Invalid request`}),$(NZ,`BadRequest`),$(IZ,`BadRequest`,{message:{fromError:!0}}),$(SZ,`Conflict`),$(LZ,`Conflict`,{message:{fromError:!0}}),$(VJ,`NotFound`),$(MZ,`PayloadTooLarge`),$(FZ,`BadRequest`),$(PZ,`UnprocessableEntity`),$(jZ,`UnprocessableEntity`),$(HJ,`UnprocessableEntity`)]}),RA(`readProofFile`,`/api/worktrees/:worktreeId/review/proof`,{disableCodecs:!0,params:EG,query:zQ.fields,success:BQ,error:[...Qq,$(AZ,`NotFound`)]}),RA(`readPublishedReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:EG,success:m$,error:[FK,...Qq,...dJ,$(HJ,`UnprocessableEntity`)]}),HA(`removeReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:EG,query:j1.fields,success:M1,error:Qq}),HA(`removeReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:EG,payload:N1,success:P1,error:Qq}),HA(`removeReviewedLayer`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:EG,query:R1.fields,success:z1,error:[...Qq,$(RZ,`NotFound`)]}),zA(`replyToComment`,`/api/worktrees/:worktreeId/comments/:threadId/replies`,{disableCodecs:!0,params:r1,payload:c1,success:l1,error:[...Qq,$(RZ,`NotFound`),$(gZ,`Conflict`),$(yZ,`NotFound`,{message:`Comment target not found`}),$(_Z,`Conflict`)]}),BA(`setReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:EG,payload:E1,success:D1,error:[...Qq,...dJ,$(TZ,`Conflict`),$(BJ,`NotFound`),$(GJ,`Conflict`),$(KJ,`Conflict`)]}),BA(`setReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:EG,payload:k1,success:A1,error:[...Qq,...dJ,$(TZ,`Conflict`),$(BJ,`NotFound`),$(GJ,`Conflict`),$(KJ,`Conflict`)]}),BA(`setReviewedLayer`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:EG,payload:I1,success:L1,error:[...Qq,$(CZ,`NotFound`),$(TZ,`Conflict`)]}),BA(`updateCommentThread`,`/api/worktrees/:worktreeId/comments/:threadId/resolution`,{disableCodecs:!0,params:r1,payload:u1,success:d1,error:[...Qq,$(RZ,`NotFound`),$(yZ,`NotFound`,{message:`Comment target not found`})]})).middleware(oK)){},V1=q({token:K.check(ox())}),H1=q({expires:SG,signature:K.check(ax(/^[A-Za-z0-9_-]{43}$/))}),U1=K,W1=class extends LK.add(FG(`reviewSummary`).add(RA(`readReviewSummary`,`/review-summaries/:token`,{disableCodecs:!0,params:V1,query:H1.fields,success:U1.pipe(Qk({contentType:`text/html; charset=utf-8`})),error:wZ.pipe(Bk({decode:()=>new wZ}),Rk(`NotFound`))}))){},G1=class extends LK.addHttpApi(Vq).addHttpApi(pZ).addHttpApi(eX).addHttpApi(zY).addHttpApi(B1).addHttpApi(W1).addHttpApi(BX){},K1=q({address:K,credential:zie(K),deviceId:W(K)}),q1=q({...K1.fields,environmentId:K,name:K,alternateRoutes:W(J(K1)),operationIdentity:W(K)});function J1({address:e,credential:t,deviceId:n}){return{address:e,credential:t,...n?{deviceId:n}:{}}}function Y1(e){return[J1(e),...(e.alternateRoutes??[]).map(J1)]}function X1(e){return e.operationIdentity??(e.deviceId?JSON.stringify([e.environmentId,e.address,e.deviceId]):void 0)}function Z1(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,...J1(n),...X1(e)?{operationIdentity:X1(e)}:{},...r.length?{alternateRoutes:r.map(J1)}:{}}}function Q1(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 $1(e){return JSON.stringify(Db(J(q1))(e))}function e0(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 t0(e,t){let n=Reflect.get(e,t);return typeof n==`string`?n:void 0}function n0(e){if(!e||typeof e!=`object`)return;let t=t0(e,`address`),n=t0(e,`credential`),r=t0(e,`deviceId`);return t&&n?{address:t,credential:_h(n),...r?{deviceId:r}:{}}:void 0}function r0(e){if(!e||typeof e!=`object`)return[];let t=t0(e,`environmentId`),n=t0(e,`name`),r=n0(e),i=Reflect.get(e,`alternateRoutes`);return t&&n!==void 0&&r?[{environmentId:t,name:n,...r,...t0(e,`operationIdentity`)?{operationIdentity:t0(e,`operationIdentity`)}:{},...Array.isArray(i)?{alternateRoutes:i.flatMap(e=>{let t=n0(e);return t?[t]:[]})}:{}}]:[]}function i0(e){return Array.isArray(e)?e.flatMap(r0):[]}function a0(e,t){let n=e.find(e=>e.environmentId===t.environmentId);if(!n)return[...e,t];let r=Y1(t),i=Y1(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),Z1({...n,name:t.name},i)]}var o0=bh((e,t)=>e===t);function s0(e,t){return e.environmentId===t.environmentId&&e.address===t.address&&o0(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&&o0(e.credential,r.credential)})}function c0(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 l0(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 u0=class e extends tr()(`@porcelain/client/AccessStore`){static layer=Ku(e,H(function*(){let e=yield*qW,t=yield*$W({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:Jp(`AccessStore.save`)(e=>t.write(t=>{let n=t.missingCredentials.find(t=>t.environmentId===e.environmentId),r=Y1(e),i=n?.operationIdentity?{...e,operationIdentity:n.operationIdentity}:e;return B({remotes:a0(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:Jp(`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 QW({message:`That environment is no longer saved.`}));let i=Y1(r),a=i.find(t=>t.address===e.address);if(!a)return yield*U(new QW({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 QW({message:`Forget the environment to remove its last connection.`}));let s=Z1(r,e.kind===`prefer`?[a,...o]:o);return{missingCredentials:n,remotes:t.map(t=>t.environmentId===e.environmentId?s:t)}}))),forget:Jp(`AccessStore.forget`)(e=>t.write(t=>B({remotes:t.remotes.filter(t=>t.environmentId!==e),missingCredentials:t.missingCredentials.filter(t=>t.environmentId!==e)})))}}))},d0=class extends tr()(`@porcelain/client/ConnectionFactory`){},f0=class extends tr()(`@porcelain/client/RemoteConnectionFactory`){},p0=class e extends tr()(`@porcelain/client/AccessSession`){static layer=Ku(e,H(function*(){let e=yield*d0,t=yield*xu,n,r=Lj({connection:null,generation:0,writerIdentity:void 0});return{state:r,beginConnection:Jp(`AccessSession.beginConnection`)((i=!1)=>V(()=>{if(i&&r.value.generation!==0)return null;let a=r.value.generation;return Jp(`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*Eu(t,`sequential`),l=yield*e.local(i).pipe(vp(xu,c))),a!==r.value.generation)return!s&&c&&(yield*Ou(c,lu)),!1;let u=n;return n=c,r.update(e=>({...e,connection:l,writerIdentity:o,generation:a+1})),u&&u!==n&&(yield*Ou(u,lu)),!0},jp)})),clear:Jp(`AccessSession.clear`)(function*(){let e=n;n=void 0,r.update(e=>({...e,connection:null,writerIdentity:void 0,generation:e.generation+1})),e&&(yield*Ou(e,lu))},jp)}}))},m0=class e extends tr()(`@porcelain/client/RemoteConnections`){static layer=Ku(e,H(function*(){let e=yield*f0,t=yield*xu,n=yield*NC(1),r=[],i=Lj([]);return{state:i,synchronize:Jp(`RemoteConnections.synchronize`)(a=>H(function*(){let n=yield*Df(a,n=>H(function*(){let i=r.find(e=>s0(e.remote,n));if(i)return{...i,remote:n};let a=yield*Eu(t,`sequential`);return{remote:n,connection:yield*e.open(n).pipe(vp(xu,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*Df(o,e=>Ou(e.scope,lu),{discard:!0})}).pipe(PC(n),jp))}}))},h0=Yu(H(function*(){let e=yield*u0,t=yield*m0;yield*t.synchronize(e.state.value.remotes),yield*rT(Jp(`RemoteConnections.subscribe`)(function*(t){yield*xp(V(()=>e.state.subscribe(({remotes:e})=>{nC(t,e)})),e=>V(e))})).pipe(vT(t.synchronize),Rp({startImmediately:!0}))}));function g0(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 ${yh(t)}`),n(a,{...i,headers:o,mode:`cors`,credentials:`omit`,redirect:`error`,cache:`no-store`})}}var _0=class extends Y()(`RequestError`,{status:Lb,message:K,code:bG.fields.code}){};function v0(e){return Ku(RO,Yf(RO,e=>e.pipe(UO(CO(`http://porcelain.invalid`)),zO(vp(KO,!1))))).pipe(ed(nd(MK).pipe(ed(Qu(Vu(AK,(t,n)=>t instanceof URL?e(`${t.pathname}${t.search}`,n):Promise.reject(TypeError(`FetchHttpClient sends every request as a parsed URL.`))),Vu(jK,{redirect:`error`,cache:`no-store`}))))))}function y0(e){let t=e.response;return t===void 0?B(new QW({message:`Could not reach Porcelain. Try again.`,cause:e.reason._tag===`TransportError`?e.reason.cause:e})):Yf(dne(t.json,()=>void 0),e=>{let n=Cb(bG)(e);return new _0({status:t.status,message:Nr(n)?n.success.message:`Request failed (${t.status})`,code:void 0})})}function b0(e){return $f(e,e=>JD(e)?Uf(y0(e),U):U(e))}function x0(e,t){return t(b0(e))}var S0=class extends tr()(`@porcelain/client/PairingPlatform`){};function C0(e){let t;try{t=new URL(e.trim())}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`||t.pathname!==`/pair`)return;let n=w0(t.hash);return n?{address:t.origin,...n}:void 0}function w0(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`c`),r=t.get(`e`);return n&&r?{code:n,environmentId:r}:null}var T0=3e3,E0=8e3,D0=1e4,O0=1e4,k0=1e4,A0=1e3,j0=1e3,M0=1e3,N0=3e4,P0=2500,F0=5e3,I0=6e4,L0=18e5,R0=6e4,z0=X(e=>Lj(void 0)),hce=X(e=>FE()),gce=sj(G1),B0=class e extends tr()(`@porcelain/client/BootstrapClient`){static layer=X(t=>ed(Ku(e,gce),v0(t)))},_ce=X(e=>IE(B0.layer(e)));function vce(e,t){return iS(t)?{kind:`offline`}:e0(e,Un(dS(t)))}function V0(e,t){return H(function*(){let e=yield*B0,n=yield*b0(e.publicAccess.readEnvironment()).pipe(ep(`ConnectionError`,t=>b0(e.session.readSession()).pipe(Gf(U(t)))));return n.environmentId===t&&n.protocol===3&&(yield*b0(e.session.readSession())),{kind:`described`,environment:n}}).pipe(hp(B0.layer(e)),$f(e=>B(e instanceof _0&&e.status===401?{kind:`unauthorized`}:{kind:`unreachable`})),sp(F0),Yf(e=>Vn(e,()=>({kind:`unreachable`}))))}function H0(e,t){z0(e.send).set({remote:t,revision:Symbol()})}var U0=Jp(`Environments.readVerifiedRoute`)(function*(e,t,n){let r=g0(e.address,e.credential,n);return yield*H(function*(){return(yield*b0((yield*B0).publicAccess.readHealth())).environmentId===t?yield*V0(r,t):{kind:`foreign`}}).pipe(hp(B0.layer(r)),$f(()=>B({kind:`unreachable`})))}),yce=Jp(`Environments.readRoutes`)(function*(e,t){let n={kind:`unreachable`};for(let r of Y1(t)){let i=yield*U0(r,t.environmentId,e.send).pipe(sp(P0),Yf(e=>Vn(e,()=>({kind:`unreachable`}))));if(e0(t,i).kind===`online`)return i;i.kind!==`unreachable`&&(n=i)}return n}),bce=X(({platform:e,remote:t})=>{let{send:n,statusActivity:r}=e;return hce(e)(Uu).atom(()=>{let i=!1,a=!1,o=!1,s,c=rT(e=>H(function*(){let s=t=>{t&&(o=t===`suspend`);let n=!o&&(r?.isActive()??!0),s=n&&!a;a=n,(!n||s||!i)&&nC(e,n)};yield*xp(V(()=>{let e=r?.subscribe(s),i=z0(n).subscribe(()=>{let e=z0(n).value;e&&s0(e.remote,t)&&s()});return()=>{e?.(),i?.()}}),e=>V(e)),s()}),{bufferSize:1,strategy:`sliding`}),l=H(function*(){i=!0;let n=yield*yce(e,t);return s=n,n}).pipe(wp(V(()=>{i=!1})));return c.pipe(Rae(e=>e?oT(()=>s?.kind===`unreachable`?fT(Aae({kind:`reconnecting`}),eT(l)):eT(l)).pipe(dT(gf(N0))):Lae))}).pipe(_E(0))});function xce(e,t){return bce({platform:e,remote:t})}var Sce=X(({platform:e,remote:t,connection:n})=>wE(r=>{let i=n?.liveUpdates.state;i&&r.addFinalizer(i.subscribe(()=>r.refreshSelf()));let a=vce(t,r(xce(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 W0(e,t,n){return Sce({platform:e,remote:t,connection:n})}function G0(e){return e instanceof _0?!0:e instanceof QW?!1:e._tag===`InvalidPairingError`||e._tag===`InvalidDeviceDetailsError`}function Cce(e,t,n){return H(function*(){let r=C0(t);if(!r)return yield*U(new QW({message:`Paste the whole link porcelain pair printed, starting with http.`}));if(n&&r.environmentId!==n)return yield*U(new QW({message:`That pairing link belongs to another computer. Add it as a separate environment.`}));let i=g0(r.address,void 0,e.send);if((yield*b0(H(function*(){return yield*(yield*B0).publicAccess.readHealth()}).pipe(hp(B0.layer(i))))).environmentId!==r.environmentId)return yield*U(new QW({message:`Another Porcelain answered at that address than the one that made the link.`}));let a=yield*b0(H(function*(){return yield*(yield*B0).pairing.redeemPairing({payload:{code:r.code,platform:e.name()}})}).pipe(hp(B0.layer(i)))).pipe(np(e=>G0(e)?new QW({message:`That link was not accepted. It works once, for a few minutes; run porcelain pair again.`}):e instanceof QW?new QW({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 QW({message:`The remote paired but sent no credential.`}));let o=_h(a.credential),s=e0(r,yield*V0(g0(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 QW({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 wce=Jp(`Environments.pairAndSave`)(function*(e,t){let n=yield*u0,r=yield*JW;if(n.state.value.status!==`ready`)return yield*U(new QW({message:`Read saved environments before pairing.`}));let i=n.state.value.missingCredentials.find(t=>t.environmentId===C0(e)?.environmentId);if(i&&!i.routes.some(t=>t.address===C0(e)?.address))return yield*U(new QW({message:`Use a pairing link for the connection whose credential is missing.`}));let a=yield*Cce(r,e,t);return yield*n.save(a),a}),Tce=Jp(`BrowserSession.pair`)(function*(e){let t=yield*S0,n=yield*B0;if((yield*b0(n.publicAccess.readHealth()).pipe(np(e=>!(e instanceof QW)&&!(e instanceof _0)&&e._tag!==`MissingEnvironmentIdentityError`?new QW({message:`That address answered, but it is not a Porcelain server.`}):new QW({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 QW({message:`This link was made for a different Porcelain installation.`}));let r=yield*b0(n.pairing.redeemPairing({payload:{code:e.code,platform:t.name()}})).pipe(np(e=>G0(e)?new QW({message:`This pairing link is not usable. Ask for a new one.`}):e));return{inventory:yield*b0(n.projects.readInventory()).pipe(np(e=>e instanceof _0?new QW({message:`Pairing succeeded but the workspace could not be loaded. Reload the page.`}):e)),principal:{kind:`device`,deviceId:r.device.id}}}),Ece=X(({transport:e,platform:t})=>IE(Qu(B0.layer(e),Vu(S0,t))).fn(e=>Tce(e))),K0=X(e=>{class t extends tr()(`@porcelain/client/HttpClient`){static runtime=e.atoms(Ku(t,Yf(sj(G1),t=>({request:(n,r)=>x0(n(t),t=>e.request(t,r))}))).pipe(ed(v0(e.transport))))}return t}),q0=Jp(`Client.requestApi`)(function*(e,t){return yield*(yield*K0(e)).request(t)}),J0=X(e=>e.atoms(t=>Qu(t(K0(e).runtime.layer),Ju(e.runtime.contextEffect)))),Y0=class e extends tr()(`@porcelain/client/AccessSnapshots`){static layer=Ku(e,H(function*(){return{sharing:yield*VD(In()),remote:yield*VD(In()),update:yield*VD(In())}}))},X0=X(e=>e.atoms(t=>td(Y0.layer,t(J0(e).layer))));function Dce(){return new QW({message:`The connected context changed. Reopen Porcelain to continue safely.`})}function Z0(e,t=!0){return Mf(()=>e.isClosed()?Op:Q0(t))}function Q0(e=!0){return e?Nf:U(Dce())}function Oce(e){return e instanceof Uq}var $0=Fb,kce=Ib,Ace=class extends LK.add(FG(`live`).add(RA(`liveUpdates`,`/api/live`,{disableCodecs:!0,query:sq.fields,success:cq.pipe(Bk({decode:()=>void 0}),Rk(`SwitchingProtocols`))})).middleware(oK)){};LK.add(FG(`reviewMcp`).add(zA(`reviewMcp`,`/mcp`,{disableCodecs:!0,payload:$0,success:[$0,kce.pipe(Bk({decode:()=>void 0}),Rk(`Accepted`))]})).middleware(oK));var e2=[`lan`,`tailnet`,`cloudflare`],t2={lan:`Local network`,tailnet:`Tailscale`,cloudflare:`Cloudflare tunnel`},jce={lan:`Devices on this network.`,tailnet:`Encrypted access through your Tailscale network.`,cloudflare:`HTTPS through your existing tunnel.`},n2={loopback:`This computer`,lan:`Local network`,tailnet:`Tailscale`,tunnel:`Cloudflare tunnel`};function Mce(e){return`This device is connected through ${t2[e]}, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}var Nce=`Anyone on the same network can read what Porcelain shows and the device credentials it sends. For an encrypted connection, use Tailscale.`,Pce=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/,Fce=/^::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}$/;function Ice(e,t){let n=new URL(e).hostname.replace(/^\[|\]$/g,``).replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n===`::1`||t.includes(n)||Pce.test(n)||Fce.test(n)}function Lce(e){return e.route!==`loopback`||e.canEditWaysIn}function Rce(e,t=[]){return Ice(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 r2(e){return`${e.subnet} on ${e.interfaceName}`}function i2(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?r2(r)===r2(n)?`Paused on this network. It looks like ${r2(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 ${r2(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 ${r2(r)}.`:`Paused: this computer is not on a local network.`:r?`Listening on ${r2(r)} only.`:`Listening on this network only.`:n?n.gatewayHardware?`Turning it on listens on ${r2(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 zce(e){return e?e2.some(t=>{let n=e.routes[t];return n.enabled?n.status.kind===`starting`||n.status.kind===`off`:n.status.kind!==`off`}):!1}function Bce(e){return e===void 0?[]:e2.flatMap(t=>{let{status:n}=e.routes[t];return n.kind===`on`?n.urls.map(e=>({route:t,url:e})):[]})}function Vce(e){let[t]=e.grants;return t?{id:t.grant.id,label:t.grant.label,link:LG(t.link),expiresAt:t.grant.expiresAt}:null}function Hce(e){return`tailscale serve --bg --https=443 ${e}`}var Uce={lan:`Starting`,tailnet:`Checking the Tailscale name`,cloudflare:`Checking the tunnel`};function Wce(e,t){switch(t.status.kind){case`off`:return t.enabled?`Starting`:null;case`starting`:return Uce[e];case`paused`:return`Paused on this network`;case`failed`:return`Failed`;case`on`:return t.enabled?`On`:`Stopping`}}var Gce={tailnet:{label:`Tailscale name`,saveLabel:`Save name`,placeholder:`laptop.tail1234.ts.net`},cloudflare:{label:`Public hostname`,saveLabel:`Save hostname`,placeholder:`porcelain.example.com`}};function a2(e,t){return(t===`tailnet`?e.tailnetHostname:e.cloudflareHostname)??``}function Kce(e,t){let{enabled:n,status:r}=e.routes[t];return n&&r.kind===`failed`}function qce(e,t,n){let r=a2(e,t)===``;return t===`tailnet`?{tailnetHostname:n,...r?{tailnet:!0}:{}}:{cloudflareHostname:n,...r?{cloudflare:!0}:{}}}function Jce(e,t,n){let r=a2(e,t),i=n??r,a=i.trim();return{...Gce[t],value:i,canSave:a!==``&&a!==r,save:qce(e,t,a),failed:Kce(e,t),check:t===`tailnet`?{tailnet:!0}:{cloudflare:!0}}}function Yce(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 o2(e){return nS(e)?e.value:void 0}function Xce(e,t,n){return H(function*(){let r=yield*Jf(n.pipe(Kf(()=>Z0(e))));if(du(r)&&Kl(r.cause))return yield*Op;if(uu(r))yield*UD(t,Ln(r.value));else{let e=Un(Gl(r.cause));e instanceof _0&&e.status===401&&(yield*UD(t,In()))}return Zx(r,qn(yield*HD(t),rS))})}function s2(e,t,n,r){let i=e.atom(e=>{let i=Jn(e.self(),dS);return cT(Yf(r,e=>fT(aT(Qx(i)),eT(t).pipe(dT(gf(n)),Gae(t=>!e(Un(dS(t))))))))}).pipe(eD(e=>hS(e,e=>e)));return oD(i).pipe(QE((e,t)=>{let n=e(t);return e(i).waiting?Qx(Ln(n)):n}),_E(0))}function c2(e,t,n){return Uf(Y0,r=>Xce(e,t(r),n))}function l2(e){return e.pipe($f(e=>e instanceof _0&&e.status===403||I(e,`WaysInPermissionRequiredError`)||I(e,`SharingManagementRequiredError`)?B(null):U(e)))}var u2=X(e=>s2(X0(e),c2(e,e=>e.sharing,l2(q0(e,e=>e.administration.listAccess()))),M0,B(()=>!0))),d2=X(e=>s2(X0(e),c2(e,e=>e.remote,l2(q0(e,e=>e.remoteAccess.readRemoteAccess()))),A0,B(zce))),f2=X(e=>s2(X0(e),c2(e,e=>e.update,q0(e,e=>e.serviceUpdates.readServiceUpdate())),j0,H(function*(){let e=Un(yield*HD((yield*Y0).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 Zce(e){return H(function*(){let t=yield*K0(e),n=yield*ZW,r=yield*Y0,i=yield*JT;function a(t,r){return n.run([t],H(function*(){yield*Z0(e);let t=yield*r;return yield*Z0(e),t}))}function o(t){return V(()=>{e.isClosed()||i.refresh(t)})}function s(e,t,n){return Sp(V(()=>{let t=i.mount(e),n=DE(rS(i.get(e),{waiting:!0}));return i.set(e,n),{transition:n,unmount:t}}),({transition:e})=>n.pipe(Kf(n=>H(function*(){yield*UD(t,Ln(n)),i.set(e,rS(rS(n),{waiting:!0}))}))),({transition:e,unmount:t},n)=>V(()=>{i.set(e,uu(n)?rS(rS(n.value)):aS(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(Kf(()=>o(u2(e))))),revoke:n=>a(`paired-access`,t.request(e=>e.administration.revokeAccess({payload:{id:n}})).pipe(wp(o(u2(e))))),trust:n=>a(`paired-access`,t.request(e=>e.administration.setDeviceTrust({payload:n})).pipe(wp(o(u2(e))))),allowManagement:n=>a(`paired-access`,t.request(e=>e.administration.setManagementPermission({payload:n})).pipe(wp(o(u2(e))))),allowWaysIn:n=>a(`paired-access`,t.request(e=>e.administration.setWaysInPermission({payload:n})).pipe(wp(o(u2(e))))),setRemote:n=>a(`remote-access`,s(d2(e),r.remote,t.request(e=>e.remoteAccess.setRemoteAccess({payload:n})).pipe(Kf(()=>Z0(e)),ip(()=>o(d2(e)))))),startUpdate:n=>a(`service-update`,s(f2(e),r.update,t.request(e=>e.serviceUpdates.startServiceUpdate({payload:{version:n}})).pipe(Kf(()=>Z0(e)),ip(()=>o(f2(e))))))}})}var p2=class e extends tr()(`@porcelain/client/AccessCommands`){static layer(t){return Ku(e,Zce(t))}},m2=X(e=>e.atoms(t=>td(p2.layer(e),t(X0(e).layer)))),Qce=X(e=>m2(e).fn(e=>p2.use(t=>t.issue(e)).pipe(Yf(Vce)),{concurrent:!0})),$ce=X(({connection:e,id:t})=>m2(e).fn(()=>p2.use(e=>e.revoke(t)),{concurrent:!0})),ele=X(({connection:e,id:t})=>m2(e).fn(e=>p2.use(n=>n.trust({id:t,trusted:e})),{concurrent:!0})),tle=X(({connection:e,id:t})=>m2(e).fn(e=>p2.use(n=>n.allowWaysIn({id:t,allowed:e})),{concurrent:!0})),nle=X(e=>m2(e).fn(e=>p2.use(t=>t.setRemote(e)),{concurrent:!0})),rle=X(e=>m2(e).fn(e=>p2.use(t=>t.startUpdate(e)),{concurrent:!0})),ile=X(({connection:e,id:t})=>m2(e).fn(e=>p2.use(n=>n.allowManagement({id:t,allowed:e})),{concurrent:!0})),h2={withIdentity:(e,t)=>[...e,...t.cacheIdentity??[]],worktreeSurface:(e,t,n)=>h2.withIdentity(h2.reviewSurface(e.environmentId,t,n),e),worktreeReads:(e,t,n)=>[h2.environment(e.environmentId),h2.review(e.environmentId,t),h2.reviewSurface(e.environmentId,t,n.slice(0,1)),h2.reviewSurface(e.environmentId,t,n)],connectedInventory:e=>h2.withIdentity(h2.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)=>[...h2.reviewProject(e,t.projectId),t.worktreeId],reviewSurface:(e,t,n)=>[...h2.review(e,t),...n]},g2=new Set([`changes`,`directory`,`text`,`paths`,`git-status`,`asset`,`html-preview`,`step-lines`]),_2=new Set([`changes`,`git-status`,`paths`,`step-lines`]);function v2(e,t,n,r=In(),i=[t,h2.environment(e.environmentId)]){return H(function*(){let a=yield*ZW,o=yield*xT,s=yield*RT({epoch:0,result:Bn(r,{onNone:()=>tS(),onSome:e=>rS(e)})}),c=(t=n,r=!1)=>H(function*(){let n=(yield*BT(s)).epoch;yield*WT(s,e=>({...e,result:cS(e.result)}));let i=yield*Jf(t.pipe(Kf(()=>Z0(e))));yield*WT(s,e=>e.epoch===n?{...e,epoch:e.epoch+ +!!r,result:Zx(i,Ln(e.result))}:e)});function l(n,r){return a.run(h2.withIdentity(t,e),H(function*(){yield*Z0(e),yield*WT(s,e=>({...e,epoch:e.epoch+1}));let t=yield*n;return yield*Z0(e),yield*WT(s,e=>({epoch:e.epoch+1,result:Bn(r(dS(e.result),t),{onNone:()=>e.result,onSome:e=>rS(e)})})),t}).pipe(wp(o.invalidate([t]))))}return{confirm:l,refresh:e=>H(function*(){yield*WT(s,e=>({...e,epoch:e.epoch+1})),yield*c(e,!0)}),stream:Vae(zT(s).pipe(lT(e=>e.result)),o.stream(i,c()).pipe(zae))}})}var y2=Er(`@porcelain/client/InventorySeed`,{defaultValue:()=>In()}),b2=class e extends tr()(`@porcelain/client/InventoryState`){static layer(t){return Ku(e,H(function*(){let e=yield*y2,n=yield*K0(t),r=e=>Z0(t,e.environmentId===t.environmentId),i=n.request(e=>e.projects.readInventory()),a=yield*v2(t,h2.inventory(t.environmentId),i.pipe(Kf(r)),e,[h2.inventory(t.environmentId),h2.environment(t.environmentId),h2.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(ep(`RequestError`,e=>e.status===404?i:U(e)),Kf(r)))}}))}},x2=X(e=>e.atoms(t=>td(b2.layer(e),t(J0(e).layer))));function S2(e){return X(t=>x2(t).fn(n=>H(function*(){let r=yield*K0(t);return yield*(yield*b2).confirm(r.request(t=>e(t.environmentLabel,n)),(e,t)=>({...e,environment:t}))}),{concurrent:!0}))}var ale=S2((e,t)=>e.renameEnvironment({payload:{name:t}})),ole=S2((e,t)=>e.setEnvironmentIcon({payload:{icon:t}})),sle=Jp(`BrowserSession.restore`)(function*(){let e=yield*B0;return{principal:yield*b0(e.session.readSession()),inventory:yield*b0(e.projects.readInventory())}},$f(e=>e instanceof _0&&e.status===401?B(null):U(e instanceof _0||_b(e)?new QW({message:`Could not reach Porcelain to restore this browser session.`,cause:e}):e))),cle=X(e=>_ce(e).atom(sle())),C2=`Save or discard unsaved file drafts before disconnecting.`;function w2(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 T2=class extends tr()(`@porcelain/client/FileDraftWriter`){},lle=Er(`@porcelain/client/FileDraftTiming`,{defaultValue:()=>({autosave:ki(T0),diskNotice:ki(E0)})}),E2=class e extends tr()(`@porcelain/client/FileDraft`){static layer(t,n){return Ku(e,H(function*(){let e=yield*T2,r=yield*lle,i=Lj({text:t.text,savedText:t.text,fingerprint:t.fingerprint,saving:!1,owner:null,error:null,diskChanged:new Set}),a=Lj(!1),o=Lj(null),s=yield*VW(void 0),c=yield*NC(1),l=yield*VD(void 0),u=yield*VW(new Map),d=Lj(new Map),f=e=>i.update(t=>({...t,...e})),p=()=>e.isBlockedError?e.isBlockedError(i.value.error):i.value.error instanceof fJ,m=H(function*(){let e=yield*WD(l,void 0);e&&(yield*yS(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})},_=Jp(`FileDraft.forgetDiskChange`)(function*(e){let t=yield*UW(u,t=>{let n=new Map(t);return n.delete(e),[t.get(e),n]});t&&(yield*yS(t)),g(e)}),v=Jp(`FileDraft.save`)(function*(){return yield*c.withPermit(m),yield*yield*WW(s,t=>t?B([_S(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}),Yf(Lp(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(tp(e=>V(()=>(f({error:Ul(e)}),!1))),wp(Vf.pipe(Gf(GW(s,void 0)),Gf(V(()=>f({saving:!1})))))),n,{startImmediately:!0}),e=>[_S(e),e])))});return yield*Tu(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:Jp(`FileDraft.finishEditing`)(function*(e,t,n=()=>{}){let r=d.value.get(e);r&&(yield*Vf,!(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:Jp(`FileDraft.noticeDiskChange`)(function*(e,t){yield*WW(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 Yf(Lp(lp(r.diskNotice).pipe(Gf(KW(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:Jp(`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*Lp(lp(r.autosave).pipe(Gf(UD(l,void 0)),Gf(v()),Qf),n,{startImmediately:!0});yield*UD(l,e)})))}),reset:Jp(`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:Jp(`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:()=>Mf(()=>(a.set(!0),Ou(n,lu)))}}))}},D2=(e,t)=>`${JSON.stringify([e.projectId,e.worktreeId])}/${t}`,O2=class e extends tr()(`@porcelain/client/FileDrafts`){static layer=Ku(e,H(function*(){let e=yield*yp,t=Lj(new Map),n=Lj(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:Jp(`FileDrafts.retain`)(function*(t){let n=D2(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*Eu(e),s=Lj(t.path),c=yr(yield*zu(E2.layer(t,o).pipe(ed(Vu(T2,{...t.writer,write:(e,n)=>t.writer.write({path:s.value,text:e,expectedFingerprint:n})})))).pipe(vp(xu,o)),E2);return i(t.environmentId,new Map(r(t.environmentId)).set(n,{scope:o,draft:c,path:s})),yield*Tu(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(D2(t,``))&&(n.state.value.saving||n.state.value.text!==n.state.value.savedText||n.blocked)),save:Jp(`FileDrafts.save`)(function*(e){for(let{draft:t}of r(e).values())if(!(yield*t.save()))return!1;return!0}),drop:Jp(`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*Df(t,e=>Ou(e.scope,lu),{concurrency:`unbounded`,discard:!0})}),relocate:Jp(`FileDrafts.relocate`)(function*(e,t,n,a){let o=r(e),s=new Map(o),c=[],l=D2(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(D2(a,r),t)}else c.push(t)}}i(e,s),yield*Df(c,e=>Ou(e.scope,lu),{concurrency:`unbounded`,discard:!0})})}}))},k2=X(e=>e.atoms(O2.layer)),ule=X(e=>k2(e).atom(O2)),dle=X(e=>e.atoms(t=>Qu(t(K0(e).runtime.layer),O2.layer)).fn(Jp(`BrowserSession.disconnect`)(function*(){let t=yield*O2,n=yield*K0(e);if(!(yield*t.save(e.environmentId)))return yield*U(new QW({message:C2}));yield*n.request(e=>e.browserAccess.clearBrowserSession())},np(e=>e instanceof QW?e:new QW({message:`Could not disconnect. Check the connection and try again.`,cause:e}))))),fle=Jp(`BrowserSession.connect`)(function*(e,t,n,r){let i=yield*p0,a=yield*i.beginConnection(),o=yield*Sp(V(()=>e.set(t,n)),()=>XT(e,t,{suspendOnWaiting:!0}),()=>V(()=>e.set(t,WE))).pipe(cp({duration:r,orElse:()=>Op}),tp(e=>U(new QW({message:w2(Ul(e)),cause:Ul(e)}))));if(a&&(yield*a(o)),i.state.value.connection?.environmentId!==o.inventory.environmentId)return yield*U(new QW({message:`Could not connect to the environment. Try again.`}))}),ple=Jp(`BrowserSession.restoreConnection`)(function*(e,t){let n=yield*p0;if(n.state.value.connection)return!0;let r=yield*n.beginConnection(!0);if(!r)return!1;let i=e.get(t);iS(i)&&!i.waiting&&e.refresh(t);let a=yield*XT(e,t,{suspendOnWaiting:!0});return a!==null&&(yield*r(a),n.state.value.connection!==null)}),A2=class e extends tr()(`@porcelain/client/EnvironmentMutations`){static layer=Ku(e,H(function*(){let e=yield*NC(1),t=Lj(0);return{pendingSelections:t,run:(n,r)=>Sp(V(()=>{n===`selection`&&t.update(e=>e+1)}),()=>e.withPermit(r),()=>V(()=>{n===`selection`&&t.update(e=>e-1)}))}}))},j2=class extends tr()(`@porcelain/client/WorkspaceSelectionCleanup`){},mle=H(function*(){let e=yield*u0,t=yield*JW,n=yield*A2,r=yield*O2,i=yield*j2;return{read:Jp(`Environments.read`)(()=>n.run(`access`,e.load())),pair:Jp(`Environments.pair`)(r=>n.run(`access`,H(function*(){return r.localEnvironmentId&&C0(r.value)?.environmentId===r.localEnvironmentId?yield*U(new QW({message:`That link is for this computer.`})):yield*wce(r.value,r.environmentId).pipe(vp(u0,e),vp(JW,t))}))),route:Jp(`Environments.route`)(t=>n.run(`access`,H(function*(){if(!(yield*r.save(t.environmentId)))return yield*U(new QW({message:C2}));yield*e.route(t)}))),forget:Jp(`Environments.forget`)(t=>n.run(`selection`,H(function*(){if(!(yield*r.save(t)))return yield*U(new QW({message:C2}));yield*H(function*(){yield*e.forget(t),yield*i.forgetEnvironment(t),yield*r.drop(t)}).pipe(jp)})))}}),M2=class e extends tr()(`@porcelain/client/EnvironmentCommands`){static layer=Ku(e,mle)};function N2(e){return e.kind===`service`?e.state.managed&&e.state.available&&e.state.latest!==void 0:e.available&&e.latest!==void 0}function hle(e,t){return t.running||e.some(N2)}function P2(e){if(e.kind===`mac-app`)return N2(e)?e.latest:void 0;let{state:t}=e;return N2(e)&&t.managed&&t.canUpdate&&!t.running?t.latest:void 0}function gle(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 _le(e){let t=new Set;for(let n of e)P2(n)!==void 0&&t.add(`${n.kind}:${n.id}`);return t.size}function vle(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 F2=DE({running:!1,entries:[]}).pipe(ZE),I2=class extends Y()(`SettingsUpdateError`,{message:K}){},yle=Jp(`updateSettingsTarget`)(function*(e,t,n){if(e.kind===`mac-app`)return yield*e.update(t);let r=rle(e.connection),i=n.mount(r);yield*Cp(()=>V(i)),n.set(r,t),yield*XT(n,r,{suspendOnWaiting:!0});let a=yield*YT(n,f2(e.connection)).pipe(lT(e=>{if(iS(e)){let t=Ul(e.cause);return t instanceof _0&&(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(!nS(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.`})}),mT(zn),lT(e=>e.value),_T);if(Rn(a))return yield*new I2({message:`The update stopped before completion.`});if(a.value.status===`failed`)return yield*new I2({message:a.value.message})}),ble=GE((e,t)=>H(function*(){let n=t.registry;if(n.get(F2).running)return;let r=[],i=new Set;for(let t of e){let e=P2(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(F2,{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*Jf(yle(t,i,n).pipe(bp)),s=du(r)?Ul(r.cause):void 0;a=a.map((t,n)=>n===e?uu(r)?{...t,status:`updated`}:{...t,status:`failed`,message:s instanceof Error?s.message:`The update failed.`}:t),o(!0)}}).pipe(wp(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(ZE),L2=lj(Ace).live.liveUpdates,xle=lj(Bq).pairing.redeemPairing,R2=new Set;function Sle(e){return R2.add(e),()=>R2.delete(e)}function z2(){for(let e of[...R2])e()}function B2(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!==xle()&&t.reportUnauthorized!==!1&&z2(),a}}var V2=X(e=>x2(e).atom(cT(Yf(b2,e=>e.stream))).pipe(eD(e=>hS(e,e=>e)),_E(0)));X(e=>wE(t=>e.map(e=>({connection:e,result:t(V2(e))}))));var Cle=class extends tr()(`@porcelain/client/ProjectSelectionStorage`){},H2=class e extends tr()(`@porcelain/client/ProjectSelectionStore`){static layer=Ku(e,H(function*(){let e=yield*Cle,t=yield*$W({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:Jp(`ProjectSelectionStore.selectEnvironment`)(e=>n(({selections:t})=>B({currentEnvironmentId:e,selections:t}))),selectWorkspace:Jp(`ProjectSelectionStore.selectWorkspace`)((e,t,r)=>n(({selections:n})=>B({currentEnvironmentId:e,selections:{...n,[e]:{projectId:t,worktreeId:r}}}))),forgetEnvironment:Jp(`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))})))}}))},U2={projects:void 0,environments:void 0,reviews:void 0,older:!1};function wle(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 W2(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 Tle(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 Ele(e){return e.review.state===`none`?``:W2(e.review).replace(`Review · `,``)}function G2(e){if(e.state!==`available`)return;let t=e.summary;return t?.state===`available`&&(t.additions||t.deletions||t.binaryFiles)?t:void 0}function Dle(e){if(e.state===`loading`)return`Reading changes…`;if(e.state===`unavailable`)return`Changes unavailable`;let t=G2(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 Ole(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 kle(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,W2(e.review),e.kind===`worktree`?Tle(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 Ale(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 jle(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 Mle(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 Nle(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 K2=DE({query:``,filter:U2,expanded:{}}).pipe(ZE),q2=DE([]).pipe(ZE);function Ple(e){return H(function*(){let t=yield*K0(e),n=yield*b2,r=yield*O2;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 QW({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 J2=class extends tr()(`@porcelain/client/ProjectCommands`){},Y2=X(e=>e.atoms(t=>td(Ku(J2,Ple(e)),Qu(t(x2(e).layer),O2.layer)))),Fle=X(e=>Y2(e).fn(e=>J2.use(t=>t.register(e)),{concurrent:!0})),Ile=X(e=>Y2(e).fn(e=>J2.use(t=>t.rename(e)),{concurrent:!0})),Lle=X(e=>Y2(e).fn(e=>J2.use(t=>t.remove(e)),{concurrent:!0})),X2=X(e=>x2(e).fn(e=>b2.use(e=>e.refresh()),{concurrent:!0})),Rle=X(e=>TE(t=>e.map(e=>t(X2(e))),(t,n)=>{for(let n of e)t.set(X2(n),void 0)})),Z2=class e extends tr()(`@porcelain/client/FilePreferencesState`){static layer(t,n){return Ku(e,H(function*(){let e=yield*K0(t);return yield*v2(t,h2.filePreferences(t.environmentId,n),e.request(e=>e.projects.listFilePreferences({params:{projectId:n}})))}))}},Q2=X(({connection:e,projectId:t})=>e.atoms(n=>td(Z2.layer(e,t),n(J0(e).layer)))),zle=X(({connection:e,projectId:t})=>Q2({connection:e,projectId:t}).fn(n=>H(function*(){let r=yield*K0(e);return yield*(yield*Z2).confirm(r.request(e=>e.projects.setFilePreference({params:{projectId:t},payload:n})),(e,t)=>Ln(t))}),{concurrent:!0})),$2=class e extends tr()(`@porcelain/client/ReadSubscriptions`){static layer=Ku(e,H(function*(){let e=yield*RT($m());return{snapshot:BT(e),changes:zT(e),reviewsFor:Jp(`ReadSubscriptions.reviewsFor`)(function*(t){let n=yield*BT(e);return[...new Set([...th(n)].flatMap(e=>e.reviewId&&(e.projectId===void 0||e.projectId===t.projectId&&e.worktreeId===t.worktreeId)?[e.reviewId]:[]))]}),retain:Jp(`ReadSubscriptions.retain`)(function*(t){yield*xp(H(function*(){let n=Symbol();return yield*WT(e,eh(n,t)),n}),t=>WT(e,nh(t)))})}}))};function e4(e,t,n,r,i,a=[]){let o=n4(e,t,n,i.atom(i=>H(function*(){yield*(yield*$2).retain({...t,paths:a,surface:String(n[0]),settled:XT(i.registry,o,{suspendOnWaiting:!0}).pipe(ap,Qf)});let s=yield*r;return yield*Z0(e),s})));return o}function t4(e){let t=DE(tS()).pipe(ZE),n=e.pipe(XE(t));return QE(n,r=>{let i=r(e);return nS(i)&&r.once(t)!==i&&r.set(t,i),r(n)}).pipe(_E(0))}function Ble(e,t,n,r,i){let a=n4(e,t,n,i.pull(e=>cT(H(function*(){return yield*(yield*$2).retain({...t,paths:[],surface:String(n[0]),settled:XT(e.registry,a,{suspendOnWaiting:!0}).pipe(ap,Qf)}),typeof r==`function`?r(e):r}))));return a}function n4(e,t,n,r){return r.pipe(e.atoms.withReactivity(h2.worktreeReads(e,t,n)),_E(0))}function r4(e,t,n,r){let i=r.atom(r=>cT(H(function*(){return yield*(yield*$2).retain({...e,paths:[],surface:t,settled:XT(r.registry,i,{suspendOnWaiting:!0}).pipe(ap,Qf)}),(yield*n).stream}))).pipe(eD(e=>hS(e,e=>e)),_E(0));return i}function i4(e,t,n,r=()=>!0,i=[]){return e4(e.connection,e.scope,t,q0(e.connection,n).pipe(Kf(t=>Z0(e.connection,r(t)))),J0(e.connection),i)}var Vle=X(e=>Q2(e).atom(cT(Yf(Z2,e=>e.stream))).pipe(eD(e=>hS(e,e=>e)),_E(0),t4)),Hle=X(({connection:e,path:t})=>J0(e).atom(H(function*(){return yield*(yield*K0(e)).request(e=>e.projects.browseProjectFolders({query:t===void 0?{}:{path:t}}))})));function Ule(e,t){return Hle({connection:e,path:t})}q({currentEnvironmentId:W(CG),selections:Vb(K,q({projectId:CG,worktreeId:wG})).check(Die(CG))});var Wle=H(function*(){let e=yield*u0,t=yield*H2,n=yield*A2;return{pending:n.pendingSelections,execute:Jp(`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 QW({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=Ku(e,Wle)});var Gle=X(e=>GE((t,n)=>H(function*(){let r=yield*n.setResult(Fle(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}))})));Ku(j2,Yf(H2,e=>({forgetEnvironment:e.forgetEnvironment})));var a4=Jp(`Changes.readSnapshot`)(function*({connection:e,scope:t}){let n=yield*q0(e,e=>e.changes.readChanges({params:{worktreeId:t.worktreeId}}));return yield*Z0(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),Kle=X(e=>e4(e.connection,e.scope,[`changes`],a4(e),J0(e.connection)).pipe(t4)),o4=Jp(`Changes.readGitStatusSnapshot`)(function*({connection:e,scope:t}){let n=yield*q0(e,e=>e.changes.readGitStatus({params:{worktreeId:t.worktreeId}}));return yield*Z0(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),s4=X(e=>e4(e.connection,e.scope,[`git-status`],o4(e),J0(e.connection)).pipe(t4)),c4=X(e=>e4(e.connection,e.scope,[`git-status`],H(function*(){let t=yield*q0(e.connection,t=>t.changes.readWorktreeSummary({params:{worktreeId:e.scope.worktreeId}}));return yield*Z0(e.connection,t.environmentId===e.connection.environmentId&&t.worktreeId===e.scope.worktreeId),t}),J0(e.connection)).pipe(t4)),l4=class e extends tr()(`@porcelain/client/CommentThreadsState`){static layer(t,n){return Ku(e,H(function*(){let e=yield*K0(t);return yield*v2(t,h2.reviewSurface(t.environmentId,n,[`comments`]),H(function*(){let r=yield*e.request(e=>e.reviews.listCommentThreads({params:{worktreeId:n.worktreeId}}));if(yield*Z0(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*Z0(t,i?.environmentId===t.environmentId&&i.worktreeId===n.worktreeId&&r.every(e=>e.worktreeId===n.worktreeId||e.review?.reviewId===i.reviewId))}return yield*Z0(t),r}),In(),h2.worktreeReads(t,n,[`comments`]))}))}},u4=X(({connection:e,scope:t})=>e.atoms(n=>td(l4.layer(e,t),n(J0(e).layer)))),qle=X(e=>DE({snapshot:``,filters:new Set,through:0})),Jle=X(e=>r4(e.scope,`comments`,l4,u4(e)).pipe(t4));function d4({connection:e,scope:t}){return Jle({connection:e,scope:t})}function f4(e,t,n=()=>!0,r={}){return J0(e).atom(r=>{let i=Jn(r.self(),dS);return H(function*(){let r=yield*q0(e,e=>t(e,i));return yield*Z0(e,n(r)),r})}).pipe(e.atoms.withReactivity([h2.environment(e.environmentId),...r.inventory===!1?[]:[h2.inventory(e.environmentId)]]),_E(0))}function p4(e,t=!1){return n=>{let r=n.pipe(e.connection.atoms.withReactivity([h2.durableReview(e.connection.environmentId,e.reviewId)]));return QE(r,n=>(t&&n.mount(g4(e)),n(r)))}}function m4(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(ep(`ReviewNotFoundError`,()=>B({review:void 0,revisions:[],revision:void 0})))}function h4(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 g4=X(e=>{let t=DE(In()).pipe(ZE),n=f4(e.connection,(n,r)=>H(function*(){let i=yield*JT,a=Un(i.get(t));if(Rn(r)&&a?.review&&a.revision){let n=(yield*XT(i,_4({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*m4(e,n);return yield*Z0(e.connection,h4(e,o)),i.set(t,Ln(o)),o}),t=>h4(e,t)).pipe(e.connection.atoms.withReactivity([h2.durableReview(e.connection.environmentId,e.reviewId)]),_E(0)),r=J0(e.connection).atom(t=>H(function*(){let r=t(n),i=Un(dS(r)),a=yield*$2,o={reviewId:e.reviewId,surface:`review`,settled:XT(t.registry,n,{suspendOnWaiting:!0}).pipe(ap,Qf)};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(eD(e=>hS(e,e=>e)),_E(0)),i=eD(t,e=>zn(e)?rS(e.value):tS());return QE(n,e=>e(r)).pipe(XE(i),_E(0))}),_4=X(e=>{let t=f4(e.connection,t=>t.reviews.listProjectReviews({params:{projectId:e.projectId}}),t=>t.every(t=>t.projectId===e.projectId)).pipe(e.connection.atoms.withReactivity([h2.projectReviews(e.connection.environmentId,e.projectId)]));return QE(t,n=>{let r=n(t),i=Un(dS(r)),a=e.connection.runtime.runSync(xT);return n.addFinalizer(a.registerUnsafe(i?i.map(t=>h2.durableReview(e.connection.environmentId,t.reviewId)):[h2.projectReviews(e.connection.environmentId)],()=>n.refresh(t))),r}).pipe(t4)}),v4=X(e=>f4(e.connection,t=>t.reviews.listReviewMarks({params:{reviewId:e.reviewId}})).pipe(p4(e,!0),t4)),Yle=X(e=>f4(e.connection,t=>t.reviews.readReviewAgentFeedback({params:{reviewId:e.reviewId}})).pipe(p4(e,!0),t4)),Xle=X(e=>f4(e.connection,t=>t.reviews.listReviewCommentThreads({params:{reviewId:e.reviewId}}),t=>t.every(t=>t.review?.reviewId===e.reviewId)).pipe(p4(e,!0))),Zle=X(e=>{let t=Xle({connection:e.connection,reviewId:e.reviewId});if(!e.worktree)return t;let n=d4({connection:e.connection,scope:e.worktree});return wE(e=>{let r=e(t),i=e(n),a=iS(i)?Un(Gl(i.cause)):void 0,o=a&&`_tag`in a&&(a._tag===`WorktreeUnavailableError`||a._tag===`WorktreeNotFoundError`||a._tag===`ProjectNotFoundError`)?rS(Vn(dS(i),()=>[])):i;return hS(r,e=>mS(o,t=>[...e,...t.filter(e=>e.review===void 0)]))}).pipe(_E(0))}),Qle=X(e=>f4(e.connection,t=>t.reviews.readReviewFile({params:{reviewId:e.reviewId,revision:e.revision},query:{path:e.path}}))),$le=X(e=>f4(e.connection,t=>t.reviews.readReviewDiffs({params:{reviewId:e.reviewId,revision:e.revision},payload:{paths:e.paths}}))),eue=X(e=>f4(e.connection,t=>t.reviews.readReviewProofFile({params:{reviewId:e.reviewId,revision:e.revision},query:{proofId:e.proofId}}),t=>t.id===e.proofId));X(e=>f4(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(p4(e))),X(e=>f4(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(p4(e)));var tue=X(e=>f4(e.connection,t=>t.reviews.readReviewPullRequest({params:{reviewId:e.reviewId}})).pipe(p4(e,!0))),nue=X(e=>f4(e.connection,t=>t.reviews.listProjectPullRequests({params:{projectId:e.projectId}})).pipe(e.connection.atoms.withReactivity([h2.projectReviews(e.connection.environmentId),h2.projectReviews(e.connection.environmentId,e.projectId)]))),rue=X(e=>f4(e.connection,t=>t.reviews.readProjectGitHubAccount({params:{projectId:e.projectId}})).pipe(t4)),iue=X(e=>J0(e.connection).atom(H(function*(){let t={connection:e.connection,reviewId:e.reviewId},n=yield*q0(e.connection,e=>m4(t,e));return yield*Z0(e.connection,h4(t,n)),!n.review||n.review.lastSeenRevision>=e.revision?{updated:!1}:yield*q0(e.connection,t=>t.reviews.setReviewSeen({params:{reviewId:e.reviewId},payload:{revision:e.revision}}))})).pipe(e.connection.atoms.withReactivity([h2.environment(e.connection.environmentId)]),ZE)),y4=X(e=>f4(e.connection,t=>t.reviews.readReviewPullChecks({params:{reviewId:e.reviewId}}),void 0,{inventory:!1}).pipe(p4(e),t4));function b4(e,t){return e?.some(e=>e.layerId===t.id&&e.fingerprint===t.fingerprint)===!0}function aue({revision:e,marks:t,status:n,pull:r}){let i=e?.content.layers??[],a=i.filter(e=>b4(t?.decisions,e)).length,o=i.length,s=t!==void 0&&o>0&&a===o,c=n===`replied`,l=oue(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 oue(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 sue(e,t){return e.archived===!0||e.state===`closed`||t?.kind===`available`&&t.pullRequest!==void 0&&t.pullRequest.state!==`open`}function cue(e,t){return e.archived!==!0&&t?.kind===`available`&&t.pullRequest!==void 0&&t.pullRequest.state!==`open`}function lue(e,t,n){return n?.trim()||t?.verdict.asked.text.trim()||e.branch}function uue(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 due(e,t){return e===void 0&&t?.kind===`unavailable`&&t.reason===`not-github`}function fue(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 x4(e,t,n=`${t}s`){return e===1?t:n}function S4(e,t,n=`${t}s`){return`${e} ${x4(e,t,n)}`}function pue(e){return e.matchesReviewHead?`Same head as the review`:`Different head from the review`}function C4(e){return e.state===`open`&&e.draft?`draft`:e.state}var mue={open:`Open`,draft:`Draft`,merged:`Merged`,closed:`Closed`};function hue(e){return mue[C4(e)]}var gue=new Set([`FAILURE`,`ERROR`,`CANCELLED`,`TIMED_OUT`,`ACTION_REQUIRED`,`STARTUP_FAILURE`,`STALE`]);function w4(e){return e.status!==`COMPLETED`||e.conclusion===`EXPECTED`?`running`:gue.has(e.conclusion??``)?`failed`:`passed`}function _ue(e,t,n){let r=`${e.length}${t?`+`:``}`;if(t){let e=T4(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=S4(e.length,`check`),a=e.filter(e=>w4(e)===`failed`);if(a.length>0)return{tone:`failed`,label:`${a.length} of ${i} failed`,short:`${a.length} failed`};let o=e.filter(e=>w4(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 vue(e){return w4(e)}function T4(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 yue(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 bue(e){return e===`MERGEABLE`?{label:`No conflicts`,tone:`passed`}:e===`CONFLICTING`?{label:`Conflicts`,tone:`failed`}:{label:`Not known yet`,tone:`none`}}function xue(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 E4(e){let t=/\/pull\/([1-9][0-9]*)$/.exec(e);return t?Number(t[1]):void 0}function Sue(e){return/^https:\/\/github\.com\/([^/]+\/[^/]+)\/pull\//.exec(e)?.[1]}function Cue(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 wue(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 Tue(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 D4(e){return e??`Detached HEAD`}function Eue(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 Due(e){let t=e.projects.flatMap(e=>e.worktrees);return t.find(e=>e.available&&!e.main)??t.find(e=>e.available)}function Oue(e){return e.projects.flatMap(e=>e.worktrees).find(e=>e.available&&(e.status===`replied`||e.status===`pending`))??Due(e)}function kue(e){return e.worktrees.find(e=>e.main)?.path??e.worktrees[0]?.path??``}function Aue(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.`}}var jue=zK.literals,O4={desktop:`Desktop`,laptop:`Laptop`,server:`Server`,cloud:`Cloud`},k4=`desktop`;function A4(e){return e.icon??k4}function Mue(e){return e===k4?null:e}function j4(e){return{state:`available`,reviewId:e.reviewId,closed:e.state===`closed`||e.archived===!0,archived:e.archived===!0,pullRequestNumber:e.pullRequest?E4(e.pullRequest):void 0,progress:void 0}}function Nue(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??uue(e.path).name,branch:D4(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(wle)}var Pue=X(e=>wE(t=>{let n=t(V2(e.connection)),r=Un(dS(n)),i=r?.projects.find(t=>t.id===e.projectId);if(!r||!i)return{entries:[],messages:[],statusFailures:[]};let a=iS(n)?{...i,available:!1}:i,o=r.environment.name,s=Nue({...e,project:a,environmentName:o}),c=t(_4({connection:e.connection,projectId:a.id})),l=Un(dS(c)),u=[],d=[],f=(l??[]).filter(e=>e.state===`open`&&!e.archived),p=new Set(s.map(e=>e.branch)),m=f.filter(e=>p.has(e.branch)).map(n=>{let r=t(g4({connection:e.connection,reviewId:n.reviewId}));return{record:n,result:r,revision:Un(dS(r))?.revision}}).sort((e,t)=>(t.revision?.publishedAt??``).localeCompare(e.revision?.publishedAt??``)||e.record.reviewId.localeCompare(t.record.reviewId));iS(c)&&u.push(`Reviews for ${a.name} could not be read.`);let h=new Map,g=new Set,_=new Set;for(let e of m){$x(e.result)&&g.add(e.record.branch),(iS(e.result)||!e.revision)&&_.add(e.record.branch);let t=e.revision;if(!t||t.projectId!==a.id)continue;let n=JSON.stringify([t.worktreePath,t.content.worktreeId]);h.has(n)||h.set(n,e)}let v=new Set;for(let n of s){if(n.available&&n.worktreeId){let r=t(s4({connection:e.connection,scope:{projectId:n.projectId,worktreeId:n.worktreeId}})),i=Un(dS(r));iS(r)&&d.push({entry:n,detail:Un(Gl(r.cause))?.message}),n.changes=iS(r)?{state:`unavailable`}:i?{state:`available`,count:new Set(i.changes.map(e=>e.scope===`untracked`||e.scope===`unmerged`?e.path:e.newPath??e.oldPath)).size}:{state:`loading`}}if(iS(c)){n.review={state:`unavailable`};continue}if(!l)continue;let r=h.get(JSON.stringify([n.path,n.worktreeId]));if(!r){_.has(n.branch)&&!g.has(n.branch)&&u.push(`Review for ${n.name} on ${o} could not be read.`),n.review={state:`none`},_.has(n.branch)&&(n.review={state:`unavailable`}),g.has(n.branch)&&(n.review={state:`loading`});continue}v.add(r.record.reviewId);let i=t(v4({connection:e.connection,reviewId:r.record.reviewId})),a=Un(dS(i));iS(i)&&u.push(`Progress for ${n.name} on ${o} could not be read.`);let s=r.revision?.content.layers;n.review={...j4(r.record),...a&&s&&!iS(i)?{progress:{reviewed:s.filter(e=>b4(a.decisions,e)).length,total:s.length}}:{},progressUnavailable:iS(i)}}if(e.older)for(let t of l??[]){if(v.has(t.reviewId))continue;let n=m.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:{...j4(t),retained:!0},changes:{state:`unavailable`}})}return{entries:s,messages:u,statusFailures:d}}).pipe(_E(0))),M4=X(e=>wE(t=>{let n=t(K2),r=[],i=[],a=[],o=[],s=[],c=!1;for(let i of e){let e=t(V2(i)),o=Un(dS(e));nS(e)&&a.push(i.environmentId),$x(e)&&(c=!0),iS(e)&&s.push(`${o?.environment.name??`Computer`}: projects could not be read.`);for(let t of o?.projects??[]){let a=iS(e)?{...t,available:!1}:t,s=`${i.environmentId}/${a.id}`;r.push({key:s,connection:i,project:a,environmentName:o.environment.name,environmentIcon:A4(o.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=Mle(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(Pue({connection:e.connection,projectId:e.project.id,older:n.filter.older}));if(i.push(...r.entries),s.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=>jle(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(c4({connection:e.connection,scope:{projectId:n.projectId,worktreeId:n.worktreeId}})),i=Un(dS(r));n.changes.summary={state:`loading`},iS(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(y4({connection:e.connection,reviewId:n.review.reviewId})),i=Un(dS(r));n.review.checks={state:`loading`},iS(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(q2),f=Nle(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(q2,f),{projects:u,allProjects:r,statusIssues:t(q2),filters:l,loading:c,messages:[...new Set(s)]}})),N4=class extends tr()(`@porcelain/client/OperationStore`){},P4=class extends tr()(`@porcelain/client/OperationStorage`){},F4=wx(J(q({requestId:kX.fields.requestId,projectId:K.check(hx(1)),worktreeId:EG.fields.worktreeId,request:kX}).check(ix(e=>e.requestId===e.request.requestId))));function I4(e){return e.state!==`running`}var L4=(e,t)=>JSON.stringify([e.projectId,e.worktreeId,t]),Fue=Ku(N4,H(function*(){let e=yield*P4,t=yield*NC(1),n=yield*RT(0),r=yield*e.read().pipe(Uf(e=>xb(F4)(e??`[]`)),qf),i=Lj({operations:Nr(r)?new Map(r.success.map(e=>[L4(e,e.request.input.action),e])):new Map,closed:!1,restorationError:Mr(r)?new QW({message:`Could not restore pending Git operations. Check the previous operation before starting another.`,cause:r.failure}):void 0}),a=Jp(`OperationStore.publish`)(function*(e){i.set(e),yield*WT(n,e=>e+1)});yield*Cp(()=>t.withPermit(a({...i.value,operations:new Map,closed:!0})));let o=Jp(`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*Eb(F4)(n).pipe(np(e=>new QW({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e})));yield*(n.length?e.write(r):e.clear()).pipe(np(({cause:e})=>new QW({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*Op:yield*e().pipe(jp)}));return{state:i,set:Jp(`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:Jp(`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:Jp(`OperationStore.wait`)(function*(e,t){return yield*Bn(yield*zT(n).pipe(uT(()=>H(function*(){let n=i.value.operations.get(e);return yield*Q0(!i.value.closed&&n?.requestId===t),n?.receipt&&I4(n.receipt)?Ln(n.receipt):In()})),mT(zn),lT(e=>e.value),_T),{onSome:B,onNone:()=>Q0(!1).pipe(Gf(If))})})}})),Iue=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(q2,e(q2).flatMap(e=>{if(e.environmentId!==t)return[e];let r=n(e.failures);return r.length>0?[{...e,failures:r}]:[]}))}var Lue=X(e=>GE(Jp(`WorktreeNavigator.refresh`)(function*(t,n){if(t){let r=e.find(e=>e.environmentId===t.environmentId),i=n(q2).find(e=>e.environmentId===t.environmentId);if(!r||!i)return;yield*n.setResult(X2(r),void 0);let a=yield*n.result(V2(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*Df(o,e=>{let i=e.entry;if(!i.worktreeId)return Nf;let a=s4({connection:r,scope:{projectId:i.projectId,worktreeId:i.worktreeId}});return n.refresh(a),n.result(a,{suspendOnWaiting:!0}).pipe(dp({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*Df(e,e=>n.setResult(X2(e),void 0),{concurrency:`unbounded`});let r=n(M4(e));for(let e of r.projects){if(!e.expanded)continue;let t=_4({connection:e.connection,projectId:e.project.id}),r=Un(dS(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(g4({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(c4({connection:e.connection,scope:{projectId:t.projectId,worktreeId:t.worktreeId}})),n.refresh(s4({connection:e.connection,scope:{projectId:t.projectId,worktreeId:t.worktreeId}}))),t.review.state===`available`&&t.review.pullRequestNumber&&n.refresh(y4({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(v4(r))}}}))),z4=[`review`,`reviewed-layers`],Rue={files:z4,git:z4,review:z4,reviewed:[`reviewed`,`reviewed-layers`],comments:[`comments`]};function zue(e){return e.type===`worktree`?{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(Rue[e.change])}:null}function Bue(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 Vue(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(zue(e)?.surfaces);if(e.change===`files`)for(let e of g2)t.add(e);if(e.change===`git`)for(let e of[..._2,...B4])t.add(e);return{scope:e,surfaces:t}}function V4(e,t){let n=Vue(t);return n?[...n.surfaces].map(t=>h2.reviewSurface(e,n.scope,[t])):[]}function Hue(e){if(e.state!==`running`&&e.state!==`rejected`&&e.state!==`no-change`)return new Set([...e.action===`fetch`||e.action===`push`?[`git-status`,`changes`]:[..._2,...g2],...B4,...Bue(e)?.surfaces??[]])}function H4(e,t){let n=Hue(t);return n?[...n].map(n=>h2.reviewSurface(e,t,[n])):[]}var Uue=class extends ta{},U4=class e extends tr()(`@porcelain/client/GitReceiptRefresh`){static layer(t){return Ku(e,H(function*(){let e=yield*yp,n=yield*xT,r=yield*$2,i=yield*eW({capacity:1/0,timeToLive:Ei,lookup:a=>H(function*(){let o=new Set(H4(t.environmentId,a).map(e=>String(e[4]))),s=[...th(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*Lp(H(function*(){n.invalidateUnsafe([h2.worktreeInventory(t.environmentId),h2.projectReviews(t.environmentId,a.projectId),...c.map(e=>h2.durableReview(t.environmentId,e)),...H4(t.environmentId,a)]),yield*Df(l,e=>e.settled,{concurrency:`unbounded`,discard:!0})}),e);return yield*Lp(gS(u).pipe(Gf(cW(i,a))),e),u})});return{refresh:Jp(`GitReceiptRefresh.refresh`)(function*(e){if(e.state===`running`||e.state===`rejected`||e.state===`no-change`)return;let t=new Uue({projectId:e.projectId,worktreeId:e.worktreeId,requestId:e.requestId,action:e.action,state:e.state}),n=yield*rW(i,t);n.pollUnsafe()&&(yield*cW(i,t)),yield*_S(n)})}}))}},W4=X(e=>e.atoms(t=>td(U4.layer(e),t(J0(e).layer))));function G4(e,t){return H(function*(){let n=yield*(yield*K0(e)).request(e=>e.gitActions.readGitActionReceipt({params:{worktreeId:t.worktreeId,requestId:t.requestId}}));return yield*Z0(e,n.projectId===t.projectId&&n.worktreeId===t.worktreeId&&n.requestId===t.requestId),n})}var K4=class extends Y()(`GitOperationStateError`,{reason:qb([`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.`}}},Wue=Jp(`GitActionController.make`)(function*({connection:e,scope:t,action:n}){let r=yield*K0(e),i=yield*N4,a=yield*xW,o=yield*U4,s=yield*NC(1),c=L4(t,n),l=Jp(`GitActionController.accept`)(function*(t){yield*Z0(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*o.refresh(t),yield*Z0(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*i.accept(t)}),u=Jp(`GitActionController.send`)(function*(a){let o=yield*r.request(e=>e.gitActions.runGitAction({params:{worktreeId:t.worktreeId},payload:a}));return`requestId`in o?(yield*Z0(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 _0({status:o.statusCode,message:o.message}))});return{execute:Jp(`GitActionController.execute`)(function*(r){return yield*e.request(H(function*(){let o=yield*s.withPermit(H(function*(){yield*Z0(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(np(e=>new QW({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:Jp(`GitActionController.recover`)(function*(){return yield*e.request(H(function*(){yield*Z0(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(ep(`GitActionNotFoundError`,()=>U(new K4({reason:`receipt-unavailable`}))),np(e=>e instanceof _0&&e.status===404?new K4({reason:`receipt-unavailable`}):e));return yield*Z0(e,r.action===n),yield*l(r),yield*i.wait(c,t.requestId)}))}),startNew:Jp(`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 Ku(e,Wue(t))}},J4=X(e=>e.connection.atoms(t=>td(q4.layer(e),Zu(t(W4(e.connection).layer),Ju(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})),Gue=X(e=>J4(e).fn(e=>q4.use(e=>e.startNew())));function Kue(e,t){let n=Y4(e),r=X4(e),i=Gue(e),a=()=>{t.set(n,UE),t.set(r,UE)};return{run:Jp(`GitActions.run`)(function*(e,r){return t.set(n,{input:e,expected:r}),yield*XT(t,n,{suspendOnWaiting:!0})}),recover:Jp(`GitActions.recover`)(function*(){return t.set(r,void 0),yield*XT(t,r,{suspendOnWaiting:!0})}),startNew:Jp(`GitActions.startNew`)(function*(){t.set(i,void 0),(yield*XT(t,i,{suspendOnWaiting:!0}))&&a()}),reset:a}}var Z4=X(e=>DE(H(function*(){return Kue(e,yield*JT)}))),Q4=Jp(`Projects.branchSwitchCommands`)(function*(e){return yield*XT(yield*JT,Z4({...e,action:`switch`}),{suspendOnWaiting:!0})}),$4=X(e=>e.atoms(t=>Qu(t(J0(e).layer),O2.layer))),e3=Jp(`Projects.requireSavedWorktreeDrafts`)(function*(e){if((yield*O2).hasUnsavedWorktree(e.connection.environmentId,e.scope))return yield*new QW({message:`Save or discard unsaved file drafts before changing this worktree.`})}),que=X(e=>$4(e.connection).fn(Jp(`Projects.deleteWorktree`)(function*(t){t.confirmation&&(yield*e3(e));let n=yield*q0(e.connection,n=>n.projects.deleteWorktree({params:{worktreeId:e.scope.worktreeId},payload:t}));return yield*Z0(e.connection),n.deleted&&(yield*CT([h2.inventory(e.connection.environmentId),h2.worktreeInventory(e.connection.environmentId),h2.projectReviews(e.connection.environmentId)])),n}))),Jue=X(e=>$4(e.connection).fn(Jp(`Projects.switchWorktreeBranch`)(function*(t){yield*e3(e);let n=yield*Q4(e),r=yield*o4(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})}))),Yue=X(e=>$4(e.connection).fn(Jp(`Projects.recoverWorktreeBranchSwitch`)(function*(t){return yield*e3(e),yield*(yield*Q4(e)).recover()}))),Xue=1.5,Zue=29360128,Que=1e4,$ue=8192,ede=80,tde=64,nde=1e4,t3=15e3,rde=2166136261,ide=16777619;function ade(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 ode(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 sde(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 cde(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 lde(e,t){return e.contentFingerprint!==null&&e.contentFingerprint!==void 0&&e.contentFingerprint!==t.contentFingerprint}function ude(e){return e.comparison?.kind===`branch`?e.comparison.base:void 0}function dde(e){return e.kind===`change`?void 0:e.filePath}function fde(e){return e?{kind:`change`,comparison:{kind:`branch`,base:e.base},revision:e.tip}:{kind:`change`}}function pde(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 mde(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 hde(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 gde(e,t){return`${e.split(`
|
|
18
|
+
`).map(e=>`> ${e}`).join(`
|
|
19
|
+
`)}\n\n${t}`}function _de(e){return e.trim().length>0&&!e.includes(`\0`)&&e.length<=16e3}function vde(e,t,n){return e?.body===t?e:n()}function yde(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 bde(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 xde(e){return[...e].sort((e,t)=>a3.indexOf(e.result)-a3.indexOf(t.result))}function Sde(e,t){let n=e=>e.layerId===t;return{checks:(e?.checks??[]).filter(n),assets:(e?.assets??[]).filter(n),current:e?.current??!0}}function Cde(e){switch(e){case`fail`:return`Failed`;case`pass`:return`Passed`}}function wde(e){return Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0))}function Tde(e){return URL.parse(e)?.host??e}function Ede(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}var s3=q({method:qb([`GET`,`POST`,`PATCH`,`PUT`,`DELETE`,`HEAD`,`OPTIONS`,`TRACE`,`QUERY`]),url:K,urlParams:J(Ub([K,K])),hash:W(K),headers:Vb(K,Kb([K,Fx(K)]))}).annotate({identifier:`HttpRequestDetails`}),Dde=q({status:mx,headers:Vb(K,Kb([K,Fx(K)]))}).annotate({identifier:`HttpResponseDetails`}),c3=`~effect/ai/AiError/Reason`,l3=()=>Ade.pipe(Qb(B({})),vie(B({}))),Ode=e=>{let t=Re(e),n={};for(let e in t){let r=t[e];st(n,e,gh(r)?r.toString():r)}return n},kde=class e extends Wx(`effect/ai/AiError/NetworkError`)({_tag:tx(`NetworkError`),reason:qb([`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:Ode(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}},Ade=Vb(K,Jb(Vie)),u3=q({promptTokens:W(mx),completionTokens:W(mx),totalTokens:W(mx)}).annotate({identifier:`UsageInfo`}),d3=q({request:s3,response:W(Dde),body:W(K)}).annotate({identifier:`HttpContext`}),jde=class extends Wx(`effect/ai/AiError/RateLimitError`)({_tag:tx(`RateLimitError`),retryAfter:W(Nx),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}},Mde=class extends Wx(`effect/ai/AiError/QuotaExhaustedError`)({_tag:tx(`QuotaExhaustedError`),resetAt:W(jx),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.`}},Nde=class extends Wx(`effect/ai/AiError/AuthenticationError`)({_tag:tx(`AuthenticationError`),kind:qb([`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}},Pde=class extends Wx(`effect/ai/AiError/ContentPolicyError`)({_tag:tx(`ContentPolicyError`),description:K,metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){return`Content policy violation: ${this.description}`}},Fde=class extends Wx(`effect/ai/AiError/InvalidRequestError`)({_tag:tx(`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}},Ide=class extends Wx(`effect/ai/AiError/InternalProviderError`)({_tag:tx(`InternalProviderError`),description:K,metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!0}get message(){return`Internal provider error: ${this.description}`}},Lde=class e extends Wx(`effect/ai/AiError/InvalidOutputError`)({_tag:tx(`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}`}},Rde=class e extends Wx(`effect/ai/AiError/StructuredOutputError`)({_tag:tx(`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}`}},zde=class extends Wx(`effect/ai/AiError/UnsupportedSchemaError`)({_tag:tx(`UnsupportedSchemaError`),description:K,metadata:l3()}){[c3]=c3;get isRetryable(){return!1}get message(){return`Unsupported schema: ${this.description}`}},Bde=class extends Wx(`effect/ai/AiError/UnknownError`)({_tag:tx(`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 Wx(`effect/ai/AiError/ToolNotFoundError`)({_tag:tx(`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 Wx(`effect/ai/AiError/ToolParameterValidationError`)({_tag:tx(`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 Wx(`effect/ai/AiError/InvalidToolResultError`)({_tag:tx(`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 Wx(`effect/ai/AiError/ToolResultEncodingError`)({_tag:tx(`ToolResultEncodingError`),toolName:K,toolResult:Fb,description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Failed to encode result for tool '${this.toolName}': ${this.description}`}},Vde=Kb([jde,Mde,Nde,Pde,Fde,Ide,kde,Lde,Rde,zde,Bde,f3,p3,m3,h3,class extends Wx(`effect/ai/AiError/ToolConfigurationError`)({_tag:tx(`ToolConfigurationError`),toolName:K,description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Invalid configuration for tool '${this.toolName}': ${this.description}`}},class extends Wx(`effect/ai/AiError/ToolkitRequiredError`)({_tag:tx(`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 Wx(`effect/ai/AiError/InvalidUserInputError`)({_tag:tx(`InvalidUserInputError`),description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Invalid user input: ${this.description}`}}]),g3=`~effect/ai/AiError`,_3=class extends Wx(`effect/ai/AiError/AiError`)({_tag:tx(`AiError`),module:K,method:K,reason:Vde}){[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}`}},Hde=e=>F(e,c3),v3=e=>new _3(e),Ude=`~effect/ai/Tool`,y3=(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),e,t),b3={[Ude]:{_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 Wde=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??zb,r=t?.failure??Pb;return Wde({name:e,description:t?.description,parametersSchema:t?.parameters??qde,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}),Gde=q({type:qb([`execution-denied`,`execution-interrupted`]),reason:K}).annotate({identifier:`ToolExecutionFailure`}),Kde=e=>Kb([_3,e.failureSchema,Gde]),qde=Vb(K,Pb),D3=`~effect/ai/Toolkit`,Jde=Er(`effect/ai/Toolkit/FailureOrigin`,{defaultValue:()=>`result`}),O3=(e,t)=>nu(Il(e),mr(Jde,t)),Yde={...on({label:`Toolkit`,evaluate:qp(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=kb(e.parametersSchema)?xb(e.parametersSchema):e=>B(e),o=Tb(e.successSchema),s=Tb(Kde(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:qp(function*(e,n,r,a){let o=Object.hasOwn(t,e)?t[e]:void 0;if(yield*_ne({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(np(n=>v3({module:`Toolkit`,method:`${e}.handle`,reason:new h3({toolName:e,toolResult:t,description:n.message})}))),l=yield*qf(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*Lf(O3(t,`parameters`)):eT(Yf(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=>Qf(tC(d,{result:e,isFailure:!1,preliminary:!0}))},p=yield*s.handler(u,f).pipe(Uf(e=>tC(d,{result:e,isFailure:!1,preliminary:!1})),_p(e=>wr(s.context,e)),fp({onFailure:e=>aC(d,e),onSuccess:()=>sC(d)}),Ip),m=t=>_b(t)?v3({module:`Toolkit`,method:`${e}.handle`,reason:new m3({toolName:e,description:`Tool handler returned invalid result: ${t.message}`})}):Hde(t)?v3({module:`Toolkit`,method:`${e}.handle`,reason:t}):t;return sT(d).pipe(Wae(e=>{let t=m(e),n=_b(e)?`result`:`handler`;return o.failureMode===`error`?Mae(O3(t,n)):aT({result:t,isFailure:!0,failureOrigin:n,preliminary:!1})}),uT(qp(function*(e){let t=yield*c(e.result,e.isFailure);return{...e,encodedResult:t}})),Jae(yS(p)))})}})}),[D3]:D3,of:o,toHandlers(e){return H({self:this},function*(){let t=yield*pp(),n=Tf(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 Ju(this.toHandlers(e))},toJSON(){return{_id:`effect/ai/Toolkit`,tools:Array.from(Object.values(this.tools)).map(e=>e.name)}}},Xde=e=>Object.assign(function(){},Yde,{tools:e}),Zde=(...e)=>{let t={};for(let n of e)st(t,n.name,n);return t},Qde=(...e)=>Xde(Zde(...e)),k3=q({cwd:Ab(K.check(hx(1)).check(_x(oG)))}),$de=q({...k3.fields,...p$.fields}),efe=q({...h$.fields,warnings:J(K)}),tfe=q({...k3.fields,reviewId:W(K.check(ox())),..._$.fields}),nfe=q({reviewId:W(K.check(ox())),...k3.fields,scope:i1.pipe(ex(B(`waiting`)))}),rfe=q({...k3.fields,...o1.fields}),ife=q({...k3.fields,...n1.fields,...c1.fields}),afe=q({...k3.fields,...n1.fields,...u1.fields}),ofe=x3(`publish_review`,{parameters:$de,success:efe,failure:bG,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),sfe=x3(`read_review`,{parameters:tfe,success:S$,failure:bG,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),cfe=x3(`list_comments`,{parameters:nfe,success:q({threads:a1}),failure:bG,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),lfe=x3(`create_comment`,{parameters:rfe,success:s1,failure:bG,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),ufe=x3(`reply_to_comment`,{parameters:ife,success:l1,failure:bG,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:afe,success:d1,failure:bG,failureMode:`return`,description:`Resolve or reopen a review thread.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1).annotate(w3,!0);Qde(x3(`connect_review_agent`,{parameters:L$,success:F$,failure:bG,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:R$,success:F$,failure:bG,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),ofe,sfe,cfe,lfe,ufe,dfe);function ffe(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 pfe(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 mfe(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 hfe(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`WriteNotSentError`||e instanceof tQ||e.name===tQ.name)?e.message:`This review surface could not be loaded. Try again.`}function M3(e){return e.fingerprint!==null&&e.fingerprint!==void 0}function gfe(e){return e.split(`/`).at(-1)??e}function _fe(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 vfe(e,t){return!(Date.parse(e.expires)-t>R0)}function yfe(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?[`${S4(i,`line`)} in ${S4(t.length,`file`)}`]:[],...n>0?[S4(n,`binary file`)]:[],...r>0?[S4(r,`removed file`)]:[]],o=a.at(-1);return o===void 0?null:a.length===1?o:`${a.slice(0,-1).join(`, `)} and ${o}`}function bfe(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 xfe(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 Sfe={kind:`worktree`};function Cfe(e){return{kind:`branch`,base:e?.base?.ref??``,branch:e?.head.branch}}function wfe(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 Tfe(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 ${S4(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 ${x4(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 Efe(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 Dfe(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 Ofe(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 ${S4(r.length,`file`)} reviewed`,text:n.length===0?`No reviewable files`:c??`Mark all reviewed`}}function kfe(e,t){return t===`reviewed`?`Unmark ${e} as unreviewed`:t===`stale`?`Mark changed ${e} as reviewed`:`Mark ${e} as reviewed`}function Afe(e,t){return!e?.fingerprint||t?null:e.reviewed?{kind:`unmark`,path:e.path}:{kind:`mark`,input:{path:e.path,fingerprint:e.fingerprint}}}function jfe(e){return e.kind===`branch`?{kind:`branch`,branch:e.branch}:{kind:`worktree`}}function Mfe(e){return[`reviewed`,...e.kind===`branch`?[`branch`,e.branch??``]:[]]}function Nfe(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 Pfe(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 ${S4(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:`${S4(n,`check`)} passed`,value:`${n} passed`,tone:`ok`}}function Ffe(e){if(e===null)return{key:`unexplained`,label:`No review published`,value:`No review`,tone:`attention`};let t=yfe(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 Ife(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:`${S4(e,`comment`)} waiting on the agent`,value:`${e} awaiting agent`,tone:`attention`}),t>0&&n.push({key:`replies`,label:`${S4(t,`comment`)} waiting on you`,value:`${t} awaiting you`,tone:`attention`}),n}function Lfe(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?Ffe(e.review):null;return[t===0?{key:`files`,label:`No changed files`,value:`None changed`,tone:`ok`}:{key:`files`,label:`${n} of ${S4(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:`${S4(r,`mark`)} changed since reviewed`,value:`${r} changed`,tone:`attention`},...a===null?[]:[a],...Ife(i.awaitingAgent,i.awaitingYou),Pfe(e.review?.proof)]}function R3(e,t){return e?`Unmark as reviewed`:t?`Mark as reviewed again`:`Mark as reviewed`}function Rfe(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=Efe(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(ox()),zfe=Ex.check(px()).check(fx({minimum:1,maximum:2**53-1}));q({reviewId:z3,environmentId:yx,host:yx,protocol:W(u$),revision:W(zfe),decision:W(z3)});function Bfe(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 Vfe(e){let t=B3(e);return t.startsWith(`iPadOS`)?`tablet`:/^(?:iOS|Android|Mobile)\b/.test(t)?`phone`:`browser`}var Hfe=new Intl.ListFormat(`en-GB`,{type:`conjunction`});function Ufe(e,t){let n=e2.filter(t=>e.routes[t].status.kind===`on`).map(e=>t2[e]);return[n.length===0?`No way in on`:Hfe.format(n),S4(t,`device`)].join(` · `)}function Wfe(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 Gfe(e,t,n){let r=Su(),{timeoutMs:i,...a}=e,o=IW(Zu(nd(ZW.layer),wT,nd($2.layer),n),{memoMap:t}),s=FE({memoMap:o.memoMap}),c=!1,l=Wp(Dp(Mf(()=>(c=!0,Ou(r,lu).pipe(wp(o.disposeEffect)))).pipe(jp))),u=()=>(c=!0,Hp(l));return{connection:Pe({runtime:o,atoms:s,scope:r,isClosed:()=>c||r.state._tag===`Closed`,close:u,...a,request:Jp(`Connection.request`)(function*(e,t){if(c)return yield*Op;let n=yield*(t?Sp(Lp(e,t),_S,yS):e).pipe(cp({duration:i,orElse:()=>Op}),Lp(r));return yield*_S(n).pipe(wp(yS(n)),Uf(e=>c?Op:B(e)))})}),close:u,closeEffect:l}}var Kfe=X(e=>e.atoms(Uu).fn(t=>H(function*(){(yield*xT).invalidateUnsafe([h2.review(e.environmentId,t)])})));function qfe(e){return()=>void 0}function Jfe(e){return()=>void 0}function Yfe(e){}function Xfe(){return()=>void 0}var V3=class e extends tr()(`@porcelain/web/DesktopHost`){static layer=Wu(e,()=>({isDesktopShell:!1,hasAppUpdateFeed:!1,canPickProject:e=>!1,pickProject:Jp(`Desktop.pickProject`)(function*(e){return yield*U(new QW({message:`The native project picker is unavailable for this computer.`}))}),mcpConfiguration:Mf(()=>U(new QW({message:`The desktop bridge is unavailable.`}))),checkUpdate:H(function*(){return In()}),installUpdate:Mf(()=>U(new QW({message:`The native app updater is unavailable.`}))),updateStates:aT({status:`idle`})}))};function Zfe(){}var Qfe=X(e=>DE(t=>{t.addFinalizer(Jfe(e))})),H3={isActive:()=>document.visibilityState!==`hidden`&&!0,subscribe:e=>{let t=qfe(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 $fe=qW.of({read:()=>Af({try:async()=>{{let e=localStorage.getItem(`porcelain.remotes`);return{remotes:e===null?[]:i0(JSON.parse(e)),missingCredentials:[]}}},catch:e=>new tu(e)}),write:({remotes:e})=>Af({try:async()=>{let t=$1(e);localStorage.setItem(`porcelain.remotes`,t)},catch:e=>new tu(e)})});function epe(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 tpe=Jp(`Live.connect`)(function*(e,t){let n=yield*JT,r=yield*$2,i=yield*N4,a=yield*U4,o=yield*xT,s=yield*xp(Eu(e.scope,`sequential`),e=>Ou(e,lu)),c=yield*PW(yield*OW().pipe(vp(xu,s)))(),l=yield*pp(),u=Jp(`Live.applyNotice`)(function*(t){if(t.type===`git-action`)return yield*a.refresh(t.receipt);if(t.type===`inventory`&&(yield*o.invalidate([h2.inventory(e.environmentId),h2.reviewGitSettings(e.environmentId)])),t.type===`worktree`){let n=yield*r.reviewsFor(t);yield*o.invalidate([h2.worktreeInventory(e.environmentId),h2.projectReviews(e.environmentId,t.projectId),...n.map(t=>h2.durableReview(e.environmentId,t))])}t.type===`project`&&t.change===`preferences`&&(yield*o.invalidate([h2.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(gp(l));yield*Z0(e),yield*a.refresh(n),yield*i.accept(n)}).pipe(ap,Qf))},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(tp(()=>V(()=>{!e.isClosed()&&s.state._tag!==`Closed`&&d()})),Qf)))},onReconnect:()=>{!e.isClosed()&&s.state._tag!==`Closed`&&(e.onStatusChange?.(),c(Symbol(),o.invalidate([h2.environment(e.environmentId)])))},onUnauthorized:()=>{e.isClosed()||s.state._tag===`Closed`||(e.onStatusChange?.(),t?t():c(Symbol(),o.invalidate([h2.inventory(e.environmentId)])))}}).pipe(vp(xu,s)),p=``,m=H(function*(){if(e.isClosed()||s.state._tag===`Closed`)return;let t=epe(i,Un(dS(n.get(V2(e)))),th(yield*r.snapshot)),a=JSON.stringify(t);a!==p&&(p=a,f.subscribe(t))}),h=()=>{!e.isClosed()&&s.state._tag!==`Closed`&&c(`subscription`,Gf(Vf,m),{onlyIfMissing:!0})};yield*xp(V(()=>n.subscribe(V2(e),h)),e=>V(e)).pipe(vp(xu,s)),yield*xp(V(()=>i.state.subscribe(h)),e=>V(()=>e?.())).pipe(vp(xu,s)),c(Symbol(),vT(r.changes,()=>V(h))),h()}),npe=X(e=>e.atoms(t=>Zu(t(x2(e).layer),t(W4(e).layer),Ju(e.runtime.contextEffect)))),rpe=X(({connection:e,onUnauthorized:t})=>npe(e).atom(tpe(e,t)).pipe(_E(0))),ipe=DE(rS(void 0)),ape=()=>Lj(`idle`);function ope(e){return e instanceof _0?e.status===401:e instanceof cM||ak(e)?e.reason._tag===`SocketCloseError`&&e.reason.code===4001:!1}function W3(e,t=pr(),n){let r=ape();return{state:r,connect:Jp(`LiveUpdates.connect`)(function*({onNotice:i,onReconnect:a,onUnauthorized:o}){let s=yield*VD({projects:[],worktrees:[]}),c=yield*rd,l=yield*eC(1),u=!1,d=fC(l);if(n?.activity){let e=n.activity,t=e.isActive(),r=!1,i=c.monotonicTimeNanosUnsafe();yield*xp(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,nC(l,void 0)),t=a})),e=>V(e))}let f=yield*eC(1),p=0,m=500,h=bp(H(function*(){r.set(p===0?`connecting`:`reconnecting`);let t=yield*e,n=yield*gu(),o=yield*gu(),c=yield*gu(),l=yield*aoe({retryPolicy:bf.pipe(xf(),_f(({input:e})=>Xte(c,e)),vf({times:0}))}).pipe(vp($O,t),vp(mM,hM)),h=yield*roe(aq,{disableTracing:!0}).pipe(vp(xM,l)),g=(yield*NC(1)).withPermit(Uf(HD(s),e=>h.follow(e))),_=h.notices(void 0).pipe(vT(e=>H(function*(){if(e.type===`ready`){yield*yu(o,void 0);return}i(e)}))),v=H(function*(){yield*_u(o),yield*g,p>0&&a(),p+=1,m=500,r.set(`connected`),yield*yu(n,void 0),i({type:`ready`})}).pipe(op(O0),Gf(If));yield*Ef([_,_u(n).pipe(Gf(Np(fC(f).pipe(Gf(g))))),Np(H(function*(){yield*d,yield*_u(n);let e=u;u=!1,yield*g.pipe(op(k0)),e&&(a(),i({type:`ready`}))})),v],{concurrency:`unbounded`}).pipe(up(_u(c)))})),g=bp(H(function*(){for(yield*Cp(()=>V(()=>r.set(`idle`)).pipe(Gf(cC(f)),Gf(cC(l))));;){let e=yield*Jf(h);if(du(e)&&ope(Ul(e.cause))&&!(yield*n?.recoverUnauthorized?.()??B(!1)))return r.set(`unauthorized`),o(),yield*If;r.set(p===0?`connecting`:`reconnecting`),yield*lp(m).pipe(up(d)),m=Math.min(m*2,D0)}}));return yield*Vf.pipe(Gf(g),gp(t),tp(e=>Kl(e)?Nf:Xp(`Live updates stopped unexpectedly`)),Rp),{subscribe(e){f.state._tag!==`Done`&&(Wp(UD(s,e)),nC(f,void 0))}}})}}function spe(e,t){let n=Lj(void 0),r=Y1(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=AC(1),c=Jp(`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*U0(a,e.environmentId,t).pipe(sp(P0));if(zn(r)&&e0(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 _0({status:401,message:`This computer no longer accepts the saved connections. Pair it again.`})):yield*U(new QW({message:`None of this computer’s saved connections could be reached and authorized.`}))}).pipe(PC(s))),l=e=>g0(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 Hp(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 Hp(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 Hp(c().pipe(one),n);return zn(d)&&d.value.address!==i.address?s(d.value):u},transportFor:l}}function cpe(e,t,n,r,i){return W3(H(function*(){let i=r?yield*r.select():void 0;return i&&r&&(yield*Cp(e=>V(()=>{du(e)&&!Kl(e.cause)&&r.failed(i)}))),yield*H(function*(){let{ticket:a}=yield*H(function*(){return yield*b0((yield*B0).session.issueLiveTicket())}).pipe(hp(B0.layer(i&&r?r.transportFor(i):t))),o=new URL(i?.address??e);return yield*n(`${o.protocol===`https:`?`wss:`:`ws:`}//${o.host}${L2({query:{ticket:a}})}`)}).pipe(op(O0))}),void 0,{...i?{activity:i}:{},...r?{recoverUnauthorized:()=>r.select().pipe(dp({onSuccess:()=>!0,onFailure:e=>!(e instanceof _0&&e.status===401)}))}:{}})}function G3(e,t,n){let{connection:r}=Gfe(e,n,Qu(nd(Fue),O2.layer).pipe(td(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(O2).adopt(i),i}function lpe(e,t,n){let r=spe({...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:cpe(e.address,i,e.socket,r,e.activity),...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},timeoutMs:e.timeoutMs},t,n)}function K3(e){return hk(e).pipe(vp(mk,e=>new WebSocket(e)))}function upe(e){return W3(K3(`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${L2({query:{}})}`),void 0,{activity:e})}function dpe(e){return e instanceof wJ?`This file is binary or uses an unsupported text encoding.`:e instanceof _J?`This file is too large to display as text.`:null}var fpe=X(({connection:e,scope:t,path:n})=>i4({connection:e,scope:t},[`text`,n],e=>e.files.readTextFile({params:{worktreeId:t.worktreeId},query:{path:n}}).pipe($f(e=>{let t=dpe(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})=>i4({connection:e,scope:t},[`directory`,n],e=>e.files.listDirectory({params:{worktreeId:t.worktreeId},query:{path:n}}),e=>e.worktreeId===t.worktreeId,[n]).pipe(t4));function J3({connection:e,scope:t,paths:n}){return n.map(n=>q3({connection:e,scope:t,path:n}))}var ppe=X(e=>DE(t=>J3(e).map(e=>t(e)))),mpe=X(e=>VE((t,n)=>{for(let t of J3(e))n.refresh(t)})),hpe=X(e=>i4(e,[`paths`],t=>t.files.listWorktreePaths({params:{worktreeId:e.scope.worktreeId}}),t=>t.worktreeId===e.scope.worktreeId)),gpe=X(({connection:e,scope:t,path:n})=>e4(e,t,[`asset`,n],H(function*(){return yield*(yield*K0(e)).request(e=>e.files.readFileAsset({params:{worktreeId:t.worktreeId},query:{path:n}}))}),J0(e),[n]));function _pe(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 vpe(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 ype(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 xpe(e){return e.filter(e=>e.endsWith(`/`))}function Spe(e){return e.split(`/`).slice(0,-1).map((e,t,n)=>`${n.slice(0,t+1).join(`/`)}/`)}function Cpe(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 Cpe({...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 Ku(e,H(function*(){let e=yield*K0(t),r=yield*O2,i=yield*xT;return{execute:Jp(`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(Sp(V(Symbol),i=>Mp(o=>H(function*(){if(yield*o(Z0(t)),s.some(([,e])=>e.state.value.owner!==null))return yield*U(new QW({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 QW({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 QW({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*Z0(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=>td(X3.layer(e,t),Qu(n(J0(e).layer),O2.layer)))),Tpe=X(e=>Z3(e).fn(e=>X3.use(t=>t.execute(e)),{concurrent:!0})),Epe=X(e=>k2(e.connection).atom(H(function*(){let t=yield*O2,n=yield*JT;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 Sp(V(()=>n.mount(o)),()=>H(function*(){let e=yield*yr(yield*XT(n,o),X3).execute({kind:`write`,path:r,text:i,expectedFingerprint:a});return e.contentFingerprint?e.contentFingerprint:yield*U(new QW({message:`The server did not confirm the saved version.`}))}),e=>V(e))}}})}))),Dpe=Jp(`Files.moveEntries`)(function*(e,t,n){for(let r of ype(e)){let e=`${t}${Y3(r)}`;r.replace(/\/$/,``)!==e.replace(/\/$/,``)&&(yield*n(r,e))}}),Ope=Jp(`Files.completeDraft`)(function*(e,t){(yield*e.save())&&t()}),Q3=X(e=>{class t extends tr()(`@porcelain/client/PreviewAssets`){static layer=Ku(t,H(function*(){let t=yield*K0(e);return{read:Jp(`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*Z0(e),new Map(a.assets.map(e=>[e.path,e.kind===`asset`?e:null]))})}}))}return t}),kpe=class extends Y()(`HtmlPreviewUnavailable`,{}){get message(){return`Could not prepare the HTML preview. Try again.`}},$3=class extends tr()(`@porcelain/client/HtmlPreviewPlatform`){},Ape=X(({connection:e,platform:t})=>e.atoms(n=>td(Qu(Q3(e).layer,t),n(J0(e).layer)))),jpe=X(({connection:e,scope:t,path:n,html:r,platform:i})=>e4(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))}),Ape({connection:e,platform:i}),[n]));function Mpe(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}var Npe=Jp(`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(Mpe(t),e))}a=l}return r}),Ppe=X(e=>J0(e).atom(q0(e,e=>e.gitActions.listCommitModels())).pipe(_E(I0),nD({staleTime:I0,revalidateOnFocus:!1})));function Fpe(e){return Ppe(e)}var e6=X(({connection:e,scope:t})=>J0(e).fn(Jp(`GitActions.generateCommitDraft`)(function*({lifetime:n,...r}){let i=yield*(yield*K0(e)).request(e=>e.gitActions.generateCommitDraft({params:{worktreeId:t.worktreeId},payload:r}),n);return yield*Z0(e),i}),{concurrent:!0})),Ipe=X(({connection:e,scope:t})=>J0(e).fn(Jp(`GitActions.dismissInterrupted`)(function*(n){yield*(yield*K0(e)).request(e=>e.gitActions.dismissInterruptedGitAction({params:{worktreeId:t.worktreeId,requestId:n}})),yield*Z0(e),yield*CT([h2.reviewSurface(e.environmentId,t,[`changes`])])}))),Lpe=X(e=>DE(H(function*(){let t=yield*JT,n=e6(e);return Jp(`CommitDraft.submit`)(function*(e,r){return t.set(n,{...e,lifetime:r}),yield*XT(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(()=>{Kl(t)||e.setError(Ul(t))}),Rpe=Jp(`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*Cp(()=>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()})))},bp,(e,t)=>e.pipe(tp(o6(t)))),zpe=Jp(`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*Cp(()=>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*Cp(()=>V(()=>p(!1)));for(let e of v){if(!e.message.trim()||s!==`amend`&&l.inProgress!==`merge`&&!e.paths.length)return yield*U(new tu(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 tu(void 0,r6(t)));t.result?.headOid&&(y=t.result.headOid,g(y)),_(t=>new Set([...t,e.id])),m(null)}},bp,(e,t)=>e.pipe(tp(o6(t)))),Bpe=Jp(`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*Cp(()=>V(()=>r(!1))),yield*t,yield*a.startNew(),o(null))},bp,(e,t)=>e.pipe(tp(o6(t)))),Vpe=Jp(`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(tp(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 Hpe(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 Upe(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 Wpe(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 Gpe(e,t){let n=c6(t);return e.kind!==`run`||n==null?null:e.action===`pull`?n.behind:n.ahead}function Kpe(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=Jp(`GitActions.restoreStash`)(function*(e,t,n,r,i){let a=yield*e.run({action:`stash-apply`,...t},n).pipe(Yf(e=>n6(e)?r6(e):null),$f(e=>B(a6(e))));r(a===null?{title:i.restored,type:`success`}:{title:i.failed,description:a,type:`error`})}),qpe=Jp(`Discard.restore`)(function*({what:e,readChanges:t,notify:n,dismissNotice:r,restore:i},a,o,s){let c=yield*t().pipe(Yf(s6),$f(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 Jpe(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(qpe(e,a,o,s))}}:{}});return null}var Ype=Jp(`Discard.finish`)(function*(e,t){return Jpe(t,yield*e)});function Xpe(e){return e===`fetch`||e===`pull`||e===`push`}function Zpe(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 Qpe(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 $pe=e=>e===`fetch`?`Fetching`:e===`pull`?`Pulling`:`Pushing`,p6=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function eme(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 tme=Jp(`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=nS(i.result)?i.result.value:void 0,c=!s;c&&e.enableDetails();let l=Zpe(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=Qpe(n,u.branch,e.pull.kind===`ready`?e.pull.strategy:`merge`);a(f6(n,yield*Sp(V(()=>e.onProgress(!0)),()=>t.run(d,t6(u,[],u.branch?.upstreamOid??null)),()=>V(()=>e.onProgress(!1)))))},(e,t,n,r)=>e.pipe($f(e=>V(()=>t.onResult({title:`${d6(r)} outcome not confirmed`,description:a6(e),type:`error`}))))),nme=Jp(`GitMenu.recoverNetwork`)(function*(e,t,n){let r=yield*t.recover();e.onResult(f6(n,r))},(e,t,n,r)=>e.pipe($f(e=>V(()=>t.onResult({title:`${d6(r)} outcome not confirmed`,description:a6(e),type:`error`}))))),rme=Jp(`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(dS(r.result));(!o||iS(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($f(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`}))))),ime=Jp(`GitActions.lookAgain`)(function*(e,t){yield*e,yield*t}),ame=Jp(`GitActions.refreshLook`)(function*(e,t){t(s6(yield*e))});function m6(e){return P4.of({read:()=>Bf(()=>{if(!e)throw Error(`Pair this environment again to identify its pending Git operations.`);return window.sessionStorage.getItem(e)}),write:t=>Bf(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.setItem(e,t)}),clear:()=>Bf(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.removeItem(e)})})}var ome=Er(`@effect/platform-browser/Crypto/WebCrypto`,{defaultValue:()=>globalThis.crypto}),h6=Ku(xW,H(function*(){let e=yield*ome;return e?SW({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`?Yf(Af({try:()=>e.subtle.digest(t,new Uint8Array(n)),catch:e=>Jw({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`Could not compute digest`,cause:e})}),e=>new Uint8Array(e)):U(Jw({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`crypto.subtle.digest is not available`}))}):yield*zf(Error(`Web Crypto API is not available`))}));function sme(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 cme(e,t){return G3({environmentId:e,address:t.address,transport:t.transport,liveUpdates:t.liveUpdates,timeoutMs:t3},Qu(h6,Vu(P4,m6(t.operationsKey))),y6.memoMap)}var _6=Lj(void 0);function lme({inventory:e,principal:t}){_6.set(t.kind===`device`?t.deviceId:void 0);let n=t.kind===`owner`?`owner`:t.deviceId,r=cme(e.environmentId,{address:window.location.href,transport:B2(fetch),liveUpdates:upe(H3),operationsKey:`porcelain-git-requests:${JSON.stringify([e.environmentId,t.kind,n])}`});return r.atoms.addGlobalLayer(Vu(y2,Ln(e))),r}function ume(e){return lpe({...e,send:fetch,...g6.statusActivity?{activity:g6.statusActivity}:{},socket:K3,onStatusChange:()=>H0(g6,e),timeoutMs:t3},Qu(h6,Vu(P4,m6(X1(e)?`porcelain-git-requests:${X1(e)}`:void 0))),y6.memoMap)}var dme=Zu(Qu(u0.layer,A2.layer).pipe(ed(Vu(qW,$fe))),Vu(JW,g6),O2.layer,Vu(d0,{local:e=>xp(V(()=>lme(e)),e=>kf(()=>e.close()))}),Vu(f0,{open:e=>xp(V(()=>ume(e)),e=>kf(()=>e.close()))}),Vu(j2,{forgetEnvironment:()=>Nf})),v6=h0.pipe(td(Zu(M2.layer,p0.layer,m0.layer).pipe(td(dme)))),y6=IW(v6),b6=FE({memoMap:y6.memoMap})(v6),fme=y6.runSync(u0),x6=y6.runSync(p0),S6=y6.runSync(m0),C6=S6.state,pme=b6.atom(H(function*(){yield*(yield*M2).read()}));function mme(){wN(pme)}function w6(){return MN(fme.state)}function T6(){return MN(x6.state).connection}function hme(){return MN(S6.state)}function E6(e){let t=(0,iV.c)(5),n=MN(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,iV.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=sme(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 gme=Ece({transport:B2(fetch),platform:g6});function _me(e,t,n){return y6.runPromise(fle(e,gme,t,t3),{signal:n})}var vme=X(e=>DE(t=>{let n=()=>{window.location.hash&&e()};window.addEventListener(`hashchange`,n),t.addFinalizer(()=>window.removeEventListener(`hashchange`,n))})),yme=cle(B2(fetch,{reportUnauthorized:!1}));function bme(e){return y6.runPromise(ple(e,yme))}var xme=DE(e=>{e.addFinalizer(Sle(()=>{y6.runFork(x6.clear())}))});function Sme(){return DN(xme),z2}function O6(e){let t=(0,iV.c)(3),n=E6(e.environmentId)?.connection,r;return t[0]!==e||t[1]!==n?(r=W0(g6,e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],wN(r)}function Cme(e){let t=(0,iV.c)(7),{className:n}=e,r;t[0]===n?r=t[1]:(r=JV(`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,iV.c)(5),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(Cme,{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)(vH,{"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 Tme(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,iV.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=>Tme(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:JV(`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:JV(`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)(UU,{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)(WU,{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)(HU,{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)(KH,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:JV(`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,iV.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=JV(`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)(HU,{children:[(0,Q.jsx)(UU,{render:(0,Q.jsx)(nH,{variant:`ghost`,size:`icon-sm`,"aria-label":`Copy the command`,onClick:()=>JU(o,`the command`),children:(0,Q.jsx)(PH,{})})}),(0,Q.jsx)(WU,{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=JV(`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:[`It starts with `,(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,iV.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)(mU,{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)(bH,{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=JV(`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 Eme(e){let t=(0,iV.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:JV(`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 jI(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Dme({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(L6,{"data-slot":`separator`,orientation:t,className:JV(`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:JV(`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:JV(`mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm`,e),...n})}function Ome({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`field-group`,className:JV(`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 kme=eH(`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:JV(kme({orientation:t}),e),...n})}function Ame({className:e,...t}){return(0,Q.jsx)(I6,{"data-slot":`field-label`,className:JV(`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:JV(`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 jme({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:JV(`text-xs/relaxed font-normal text-destructive`,e),...r,children:i}):null}function H6(e){return jI(e.defaultTagName??`div`,e,e)}function U6({className:e,...t}){return(0,Q.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:JV(`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 Mme=eH(`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:_I({className:JV(Mme({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var Nme=eH(`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:JV(Nme({variant:t,className:e})),...n})}function K6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-content`,className:JV(`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:JV(`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:JV(`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:JV(`flex items-center gap-2`,e),...t})}function X6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-footer`,className:JV(`flex basis-full items-center justify-between gap-2`,e),...t})}var Pme=eH(`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:JV(Pme({variant:t}),e),...n})}function Q6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-title`,className:JV(`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:JV(`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 Fme({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-action`,className:JV(`absolute top-1.5 right-2`,e),...t})}var Ime=eH(`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:_I({className:JV(Ime({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function t8(e){let t=(0,iV.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,iV.c)(2),n;return t[0]===e?n=t[1]:(n=u2(e),t[0]=e,t[1]=n),wN(n)}function r8(e){let t=(0,iV.c)(2),n;return t[0]===e?n=t[1]:(n=d2(e),t[0]=e,t[1]=n),wN(n)}function Lme(e){let t=(0,iV.c)(2),n;return t[0]===e?n=t[1]:(n=f2(e),t[0]=e,t[1]=n),wN(n)}var Rme=X(e=>b6.fn((t,n)=>H(function*(){yield*n.setResult(dle(e),void 0),yield*(yield*p0).clear()})));function zme(e){let t=(0,iV.c)(8),n;t[0]===e?n=t[1]:(n=Rme(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]=AN(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 Bme(e){let t=(0,iV.c)(17),{computer:n}=e,{connection:r}=D6(),{result:i,submit:a}=zme(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)(fU,{}),t[3]=i.waiting,t[4]=c);let l;t[5]!==i.waiting||t[6]!==a||t[7]!==c?(l=(0,Q.jsxs)(nH,{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=iS(i)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:w2(Ul(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=IE(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(ZE),s8=i8.atom(cT(H(function*(){return(yield*V3).updateStates}))).pipe(_E(0));function c8(){let e=(0,iV.c)(2),t=wN(s8),n;return e[0]===t?n=e[1]:(n=Vn(dS(t),Vme),e[0]=t,e[1]=n),n}function Vme(){return{status:`idle`}}function Hme(){return wN(a8)}var Ume=`data-valid`,Wme=`data-invalid`,Gme={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Kme={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},l8={valid(e){return e===null?null:e?{[Ume]:``}:{[Wme]:``}}},qme={invalid:void 0,name:void 0,validityData:{state:Gme,errors:[],error:``,value:``,initialValue:null},setValidityData:PN,disabled:void 0,setTouched:PN,setDirty:PN,setFilled:PN,setFocused:PN,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Kme,registerFieldControl:PN,validation:{getValidationProps:(e,t=IN)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:PN,getInputControl:()=>null,commit:async()=>{},change:PN}},Jme=Z.createContext(qme);function u8(e=!0){let t=Z.useContext(Jme);if(t.setValidityData===PN&&!e)throw Error(HN(28));return t}var Yme=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:PN,validationMode:`onSubmit`,submitCountRef:{current:0}});function d8(){return Z.useContext(Yme)}var Xme=Z.createContext({controlId:void 0,registerControlId:PN,resetControlId:PN,labelId:void 0,setLabelId:PN,messageIds:[],setMessageIds:PN,getDescriptionProps:e=>e});function f8(){return Z.useContext(Xme)}function p8(e,t,n,r=!0,i){let[a,o]=Z.useState(),s=wU(i?`${i}-label`:void 0),c=e??t??a;return BN(()=>{let i=e||t||!r?void 0:Zme(n.current,s);a!==i&&o(i)}),c}function Zme(e,t){let n=Qme(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Qme(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=wU(),s=zN(()=>Symbol()),c=Z.useRef(!1),l=Z.useRef(!1),u=ZN(()=>{c.current&&i!==PN&&(c.current=!1,i(s.current,void 0))});return BN(()=>{if(!n||i===PN){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]),BN(()=>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=zN(()=>Symbol());BN(()=>{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]),BN(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}function _8(e,t){let n=Z.useRef(e),r=ZN(t);BN(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var $me=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=ZN(()=>S.inputRef.current?.value);g8(S.inputRef,A,P,F,!E,a),BN(()=>{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=kP();return BN(()=>{u&&I.current===RP(xP(I.current))&&y(!0)},[u,y]),jI(`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=OL(dL,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})}),ehe=Z.forwardRef(function(e,t){return(0,Q.jsx)($me,{ref:t,...e})});function v8({className:e,type:t,...n}){return(0,Q.jsx)(ehe,{type:t,"data-slot":`input`,className:JV(`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 the(e){let t=(0,iV.c)(3),n;t[0]===e?n=t[1]:(n=Qce(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],AN(n,r)}function nhe(e,t){let n=(0,iV.c)(3),r;return n[0]!==e||n[1]!==t?(r=$ce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],AN(r)}function rhe(e,t){let n=(0,iV.c)(3),r;return n[0]!==e||n[1]!==t?(r=ele({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],AN(r)}function ihe(e,t){let n=(0,iV.c)(3),r;return n[0]!==e||n[1]!==t?(r=tle({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],AN(r)}function ahe(e){let t=(0,iV.c)(2),n;return t[0]===e?n=t[1]:(n=nle(e),t[0]=e,t[1]=n),AN(n)}function ohe(e){let t=(0,iV.c)(3),n;t[0]===e?n=t[1]:(n=ale(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],AN(n,r)}function she(e){let t=(0,iV.c)(2),n;return t[0]===e?n=t[1]:(n=ole(e),t[0]=e,t[1]=n),AN(n)}function che(e,t){let n=(0,iV.c)(3),r;return n[0]!==e||n[1]!==t?(r=ile({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],AN(r)}function lhe(e){let t=(0,iV.c)(31),{connection:n,environment:r,onCancel:i}=e,[a,o]=(0,Z.useState)(null),[s]=(0,Z.useState)(uhe),[c,l]=ohe(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:tde,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)(nH,{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)(nH,{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=iS(c)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:w2(Ul(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 uhe(){return dhe}function dhe(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(HN(33));return t}var C8=Z.createContext(void 0);function w8(e){let t=Z.useContext(C8);if(t===void 0&&!e)throw Error(HN(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(HN(25));return t}var D8=Z.createContext(void 0);function fhe(){let e=Z.useContext(D8);if(e===void 0)throw Error(HN(30));return e}function phe(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:gL})},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&&!FP&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&sL(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}=cL({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=phe({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>_I(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=aI(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var A8=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function mhe(){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}=mhe(),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 BN(()=>{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 hhe=`data-checked`,ghe=`data-unchecked`,M8={checked(e){return e?{[hhe]:``}:{[ghe]:``}},...GP},_he=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=wU(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=OL(gL,e.nativeEvent,void 0,{preventUnmountOnClose:PN});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=jI(`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})}),vhe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=fhe(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Rz(s.checked);return UI({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),jI(`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 yhe(){let e=Z.useContext(N8);if(e===void 0)throw Error(HN(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=jI(`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=wU(a),c=yhe();return BN(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),jI(`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=wU(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 jI(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),xhe=Z.createContext(void 0);function I8(e){let t=Z.useContext(xhe);if(t===void 0&&!e)throw Error(HN(69));return t}var L8=`ArrowUp`,R8=`ArrowDown`,z8=`ArrowLeft`,B8=`ArrowRight`,V8=new Set([L8,R8,z8,B8,`Home`,`End`]),She=[`Shift`,`Control`,`Alt`,`Meta`];function Che(e){return aP(e)&&e.tagName===`INPUT`}function H8(e){return!!(Che(e)&&e.selectionStart!=null||aP(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`;UI({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,OL(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),vB(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=jI(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:XP,props:[p,{onKeyDown(e){u&&V8.has(e.key)&&e.stopPropagation()}},nV(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,Q.jsx)(wR,{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(HN(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)(PL,{ref:t,...r,portalOwnerRole:o})})});function Y8(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=ZN(i),[,o]=Z.useState(!1),s=zN(Ehe).current,c=zN(The).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=ZN(()=>{u.current||(u.current=!0,o(e=>!e))}),m=ZN((e,t)=>{c.set(e,t),p()}),h=ZN(e=>{c.delete(e),p()}),g=ZN(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(!khe(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=Ohe(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=ZN(()=>{let[e,t]=Dhe(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))});BN(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),BN(()=>{u.current&&v()}),BN(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=ZN(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 The(){return new Map}function Ehe(){return new Set}function Dhe(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 Ohe(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function khe(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 sP(e)?e:t}function n5(e,t,n){return/hidden|clip/.test(e.getComputedStyle(t5(t,n)).overflowY)}function Ahe(e){if(typeof document>`u`)return!1;let t=xP(e);return tP(t).innerWidth-t.documentElement.clientWidth>0}function jhe(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=xP(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 Mhe(e){let t=xP(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 Nhe(e){let t=xP(e),n=t.documentElement,r=t.body,i=tP(n),a=0,o=0,s=!1,c=TP.create();if(IP&&(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=jhe(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=SP(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Phe=new class{lockCount=0;restore=null;timeoutLock=OP.create();timeoutUnlock=OP.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=xP(e),n=t.documentElement,r=t.body,i=tP(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=MP||!Ahe(e);this.restore=a?Mhe(e):Nhe(e)}};function r5(e=!0,t=null){BN(()=>{if(e)return Phe.acquire(t)},[e,t])}var Fhe=20;function i5(e,t,n,r){let[i,a]=Z.useState(!1);BN(()=>{if(!e||!t||n==null){a(!1);return}let r=xP(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Fhe)},[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=XI,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=HI(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??ZI):x.type===`menubar`&&(ie??=x.context.orientation===`vertical`?`inline-end`:`bottom`,ae??=`start`);let oe=x.type===`context-menu`,se=$B({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,OL(SL)))}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,OL(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ce=kP();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,OL(SL))}):v.setOpen(!1,OL(SL))}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]),BN(()=>{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=rV(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:RI(!T),cutout:pe}),(0,Q.jsx)(mR,{id:P,children:(0,Q.jsx)(Y8,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:de})})]})}),o5=Z.createContext(void 0);function Ihe(){let e=Z.useContext(o5);if(e===void 0)throw Error(HN(34));return e}var Lhe=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=ZN((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=jI(`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 Rhe(){let e=Z.useContext(s5);if(e===void 0)throw Error(HN(35));return e}var zhe=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=wU(i),{store:h}=w8(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Ihe(),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=OL(gL,e.nativeEvent,void 0,{preventUnmountOnClose:PN});y(l,t)}let O=jI(`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})}),Bhe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Rhe(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Rz(s.checked);return UI({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),jI(`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})}),Vhe=Z.createContext(null);function c5(e){let t=Z.useContext(Vhe);if(t===null&&!e)throw Error(HN(5));return t}function Hhe(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}=Hhe(ZN((n,r)=>{(typeof e==`function`?e():e)||t(r||(MP?`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 Uhe={...oB,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`)}},Whe=class extends QN{constructor(e,t,n=!1){let r=new $z,i=Khe(r,t,n,e);super(i,Ghe(r),Uhe),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 Ghe(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 Khe(e,t,n=!1,r){return{...eB(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 cR,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:IN,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var qhe=Z.createContext(void 0);function Jhe(){return Z.useContext(qhe)}var d5=KN(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=Jhe(),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=rL(),S=rL(),C=dR(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=zN(()=>T?w?.state.instantType:void 0).current,D=Yhe({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=pR(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=kP(),re=Z.useRef(!0),ie=kP(),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}),Yz(D);let{forceUnmount:ce,transitionStatus:le}=Xz(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),ue=HI(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]),BN(()=>{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]),BN(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let de=ZN((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=Kz(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=Gz(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=Lz({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:de}),pe=fe.context.events;BN(()=>{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,OL(EL))},[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=jR(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=zB(),ve=Z.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),ye=OB(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:FN,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=kB(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=_I(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=_I(ye.trigger,ge.trigger,se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ye.trigger,ge.trigger,se]);zN(()=>(D.update({inactiveTriggerProps:Ce}),null)),Zz(D,{floatingRootContext:fe,activeTriggerProps:Se,inactiveTriggerProps:Ce,popupProps:Z.useMemo(()=>_I(zz,{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??IN});let we=Z.useMemo(()=>({store:D,parent:b}),[D,b]),Te=(0,Q.jsxs)(C8.Provider,{value:we,children:[f&&(0,Q.jsx)(Hz,{handle:f,store:D}),typeof t==`function`?t({payload:R}):t]});return I.type===void 0||I.type===`context-menu`?(0,Q.jsx)(hR,{externalTree:O,children:Te}):Te});function Yhe(e,t,n){return zN(()=>new Whe(e,t,n)).current}var f5=5;function p5(e,t){let n=Xhe(t);return e.clientX>=n.left-f5&&e.clientX<=n.right+f5&&e.clientY>=n.top-f5&&e.clientY<=n.bottom+f5}function Xhe(e){let t=e.getBoundingClientRect(),n=tP(e);if(LP)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}=aL(),{ref:i,index:a}=j8(e),o=n===a,s=Z.useRef(null),c=aI(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 Zhe(e){let{render:t,className:n,style:r,state:i=IN,props:a=FN,refs:o=FN,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=m5({metadata:s});return jI(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function h5(e){if(aP(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!pP(e))return h5(gP(e))}function g5(e,t){let n=Z.useRef(null);function r(t){VN.flushSync(()=>{e.setOpen(!1,OL(vL,t.nativeEvent,t.currentTarget))}),ZF(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&QF(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{VN.flushSync(()=>{e.setOpen(!1,OL(vL,n.nativeEvent,n.currentTarget))});let i=XF(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&zP(r,i);){let e=i;if(i=qF(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Qhe(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,xP(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:IN,[t,n,r])}var $he=qN(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=sB(d)??m?.store;if(!h)throw Error(HN(85));let g=wU(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),S=tge(),C=aL(!0),w=fR(),T=Z.useMemo(()=>w??new cR,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Jz(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:pR(T),floatingParentNodeId:dR(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=cL({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=kP(),F=ZN(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;zP(N.current,t)||zP(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:xL}))});Z.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&xP(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=bB(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:LB({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=ege(y,h.select(`lastOpenChangeReason`)),ee=TR(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),z=fB(v,{enabled:!A&&I}),te=Qhe({open:y,enabled:O,mouseDownAction:`open`}),ne=Z.useMemo(()=>_I(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??IN,re,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),xP(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},te,p,j],ue=jI(`button`,e,{enabled:!O,stateAttributesMapping:JP,state:se,ref:ce,props:le});return O?(0,Q.jsx)(Zhe,{tag:`button`,render:n,className:r,style:i,state:se,refs:ce,props:le,stateAttributesMapping:JP}):y?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(iI,{ref:ie,onFocus:ae},`${g}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:ue},g),(0,Q.jsx)(iI,{ref:h.context.triggerFocusTargetRef,onFocus:oe},`${g}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:ue},g)});function ege(e,t){let n=kP(),[r,i]=Z.useState(!1);return BN(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function tge(){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)($he,{"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:JV(`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:JV(`px-2 py-1.5 text-xs text-muted-foreground data-inset:pl-7.5`,e),...n})}function nge({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:JV(`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 rge({className:e,children:t,checked:n,inset:r,...i}){return(0,Q.jsxs)(_he,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:JV(`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)(vhe,{children:(0,Q.jsx)(bH,{})})}),t]})}function ige({...e}){return(0,Q.jsx)(Lhe,{"data-slot":`dropdown-menu-radio-group`,...e})}function age({className:e,children:t,inset:n,...r}){return(0,Q.jsxs)(zhe,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:JV(`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)(Bhe,{children:(0,Q.jsx)(bH,{})})}),t]})}function oge({className:e,...t}){return(0,Q.jsx)(L6,{"data-slot":`dropdown-menu-separator`,className:JV(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var sge={desktop:XH,laptop:HH,server:iU,cloud:MH};function C5(e){let t=(0,iV.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=sge[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 cge(e){let t=(0,iV.c)(18),{icon:n,pending:r,onChange:i}=e,a=`Icon: ${O4[n]}`,o;t[0]!==r||t[1]!==a?(o=(0,Q.jsx)(nH,{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=jue.map(lge),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)(ige,{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 lge(e){return(0,Q.jsxs)(age,{value:e,className:`cursor-pointer`,children:[(0,Q.jsx)(C5,{icon:e}),O4[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 uge(e){return e.status===`unavailable`?`This build updates by reinstalling; there is no update feed yet.`:`Up to date`}var dge=IE(V3.layer).atom(Yf(V3,e=>t=>e.installUpdate.pipe(np(e=>new I2({message:e.message}))))),fge=DE(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(dS(e(a8)));if(i&&a){if(a.isDesktopShell){let i=e(o8),a=Un(Xn(dS(i))),o=Un(dS(e(s8)));r||=i.waiting;let s=D5(o,i);s&&n.push({id:`mac-app`,name:`Mac app`,message:s});let c=Un(dS(e(dge)));a&&c&&t.push({current:a.current,checking:i.waiting,error:D5(o,i),note:o?uge(o):void 0,target:{kind:`mac-app`,id:`mac-app`,name:`Mac app`,available:nS(i)&&o?.status===`available`&&!i.waiting,latest:o&&`version`in o?o.version:void 0,update:c}})}else{let a=e(f2(i));r||=a.waiting,iS(a)&&n.push({id:i.environmentId,name:`This computer`,message:w2(Ul(a.cause))});let o=o2(a),s=Un(dS(e(V2(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(W0(g6,i,a));if(o.kind!==`online`)continue;let s=e(f2(a));r||=s.waiting,iS(s)&&n.push({id:i.environmentId,name:o.name,message:w2(Ul(s.cause))});let c=o2(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=VE((e,t)=>{let n=x6.state.value.connection,r=Un(dS(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=f2(e);t(n).waiting||t.refresh(n)}}),pge=DE(e=>{nS(e(a8))&&e.set(T5,`entry`)}).pipe(_E(0));function mge(){DN(pge)}function E5(){let e=(0,iV.c)(11),{rows:t,failures:n,checking:r}=wN(fge),i=ON(T5),a=wN(F2),[o,s]=AN(ble),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(hge),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:_le(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 hge(e){return e.target}function D5(e,t){if(e?.status===`error`)return e.message;if(!t.waiting&&iS(t))return w2(Ul(t.cause))}function gge(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}=Rz(a,!0,!0),u=wU(),[d,f]=Z.useState(),p=d===null?void 0:d??u,m=ZN(e=>{let t=!a,n=OL(fL,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(HN(15));return e}var _ge=`data-open`,vge=`data-closed`,yge=UP,bge=`data-panel-open`,xge={[_ge]:``},Sge={[vge]:``},Cge={open(e){return e?{[bge]:``}:null}},A5={open(e){return e?xge:Sge},...GP},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=ZN(o),d=gge({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=jI(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:A5});return(0,Q.jsx)(O5.Provider,{value:p,children:m})}),Tge={...Cge,...GP},Ege=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}=cL({disabled:c,focusableWhenDisabled:!0,native:u});return jI(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:Tge})}),j5={height:void 0,width:void 0};function Dge(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=aI(t,d),C=IL(s),w=HI(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=ZN((e,t=!0)=>{t&&(h.current=e),m(e)}),j=ZN(()=>{x.current?.(),x.current=null}),M=ZN(e=>{j(),x.current=()=>{x.current=null,e()}}),N=ZN(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});BN(()=>{y&&u!==`starting`&&b(!1)},[y,u]),Z.useEffect(()=>()=>{N(),j()},[N,j]),BN(()=>{let e=d.current;if(!e)return;!s&&x.current&&j();let t=Oge(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=kge(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]),UI({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=TP.request(()=>{w(n,e.signal)}),()=>{TP.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),BN(()=>{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=OL(dL,e);o(!0,t),!t.isCanceled&&(g.current=!0,l(!0))}return SP(e,`beforematch`,t)},[o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[yge]:``}: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 Oge(e,t){let n=tP(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 kge(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=TP.request(n);return()=>{TP.cancel(r),n()}}var Age=`--collapsible-panel-height`,jge=`--collapsible-panel-width`,Mge=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;BN(()=>(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}=Dge({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=hI(s,k),j=jI(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[Age]:S===void 0?`auto`:`${S}px`,[jge]: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)(Ege,{"data-slot":`collapsible-trigger`,...e})}function L5({...e}){return(0,Q.jsx)(Mge,{"data-slot":`collapsible-content`,...e})}function R5(e){let t=(0,iV.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=P2(s),g;t[7]===s?g=t[8]:(g=s.kind===`service`?gle(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`?ade(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`?ode(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)(nH,{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)(nH,{size:`sm`,variant:`ghost`}),children:[(0,Q.jsx)(JH,{}),`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=JV(`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=JV(`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=N2(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)(HU,{children:[(0,Q.jsx)(UU,{render:(0,Q.jsx)(nH,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy device ID`,onClick:()=>JU(_.deviceId??``,`device ID`),children:(0,Q.jsx)(PH,{})})}),(0,Q.jsx)(WU,{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)(nH,{size:`sm`,variant:`outline`,className:`self-start`,onClick:Nge,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 Nge(){return window.location.reload()}function z5(e){let t=(0,iV.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=Lme(n),c;t[5]===n?c=t[6]:(c=f2(n),t[5]=n,t[6]=c);let l=kN(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(iS(s)){let e;t[10]===s.cause?e=t[11]:(e=w2(Ul(s.cause)),t[10]=s.cause,t[11]=e);let n;t[12]!==l||t[13]!==s.waiting?(n=(0,Q.jsx)(nH,{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 Pge(e){let t=(0,iV.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 Fge(e){let t=(0,iV.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 Ige(e){let t=(0,iV.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(Lge),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 Lge(e){let{target:t}=e;return t.kind===`mac-app`}var B5=Z.createContext(void 0);function Rge(){let e=Z.useContext(B5);if(e===void 0)throw Error(HN(63));return e}var zge=`data-checked`,Bge=`data-unchecked`,V5={...l8,checked(e){return e?{[zge]:``}:{[Bge]:``}}},Vge=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=aI(P,c,A.inputRef),I=Z.useRef(null),L=wU(),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),BN(()=>{T(z)},[z,T]),_8(z,()=>{b(N),C(z!==w.initialValue),A.change(z)});let{getButtonProps:ne,buttonRef:re}=cL({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&&sL(t,e)}},oe={...A.getValidationProps(M),checked:z,disabled:M,form:o,id:ee,name:N,required:p,style:N?rI:nI,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=OL(dL,e.nativeEvent);d?.(t,n),!n.isCanceled&&te(t)},onClick(e){e.stopPropagation()},onFocus(){I.current?.focus()},..._===void 0?IN:{value:_}},se=Z.useMemo(()=>({...x,checked:z,disabled:M,readOnly:f,required:p}),[x,z,M,f,p]),ce=jI(`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})]})}),Hge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return jI(`span`,e,{state:Rge(),ref:t,stateAttributesMapping:V5,props:a})});function H5({className:e,size:t=`default`,...n}){return(0,Q.jsx)(Vge,{"data-slot":`switch`,"data-size":t,className:JV(`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)(Hge,{"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 Uge(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(HN(60));return e}function q5(){let e=Z.useContext(W5);if(e===void 0)throw Error(HN(101));return e}function J5(){let e=Z.useContext(G5);if(e===void 0)throw Error(HN(61));return e}function Wge(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 Gge(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Wge(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 Kge(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(Kge(t,n)):Q5(e,t,n);return i===-1?null:i}function qge(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 Jge(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 Yge(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function t7(e){return Yge(e?.[0])}function Xge(e){return t7(e)?e.flatMap(e=>e.items):e}function Zge(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=Xge(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 Qge(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 $ge={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?Zge(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=$I(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 e_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??FN: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}=Rz(z),{openMethod:ve,triggerProps:ye}=u5(z),be=zN(()=>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:IN,triggerProps:IN,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:PN,setOpen:PN,handleScrollArrowVisibility:PN,onOpenChangeComplete:PN,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},$ge)).current,xe=be.useState(`activeIndex`),Se=be.useState(`selectedIndex`),Ce=be.useState(`triggerElement`),we=be.useState(`positionerElement`),Te=BU(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(IL(Ce),F,R,ZN(()=>Oe),!I,c);let ke=y?Array.isArray(R)&&R.length>0:R!=null&&De!==``;BN(()=>{A(ke)},[ke,A]),BN(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(Gge(R,k.initialValue,S)),N.change(R)});let Ae=ZN((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=ZN(()=>{ge(!1),be.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});UI({enabled:!h,open:z,ref:ie,onComplete(){z||je()}}),Z.useImperativeHandle(h,()=>({unmount:je}),[je]);let Me=ZN((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ne=ZN(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=cB({open:z,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Fe=TR(Pe,{enabled:!I,event:`mousedown`}),Ie=jR(Pe),Le=OB(Pe,{enabled:!I,listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:FN,onNavigate(e){(e!==null||z)&&be.set(`activeIndex`,e)},focusItemOnHover:C}),Re=kB(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],OL(dL))},onTyping(e){le.current=e}}),ze=Z.useMemo(()=>_I(Re.reference,Le.reference,Ie.reference,Fe.reference,ye),[Fe.reference,Re.reference,Le.reference,Ie.reference,ye]),Be=Z.useMemo(()=>_I(zz,Re.floating,Le.floating,Ie.floating),[Re.floating,Le.floating,Ie.floating]),Ve=Le.item??IN;be.useContextCallback(`setValue`,Me),be.useContextCallback(`setOpen`,Ae),be.useContextCallback(`handleScrollArrowVisibility`,Ne),be.useContextCallback(`onOpenChangeComplete`,_),Uge(()=>{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=aI(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=OL(dL,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?rI:nI,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ge]})}function t_e(e,t){return e??t}var n_e=`data-popup-side`,r_e=400,i_e={...JP,...l8,popupSide:e=>e?{[n_e]:e}:null,value:()=>null},a_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=t_e(h,k);m8({id:i});let P=IL(T),F=Z.useRef(null),{getButtonProps:I,buttonRef:L}=cL({disabled:b,native:o}),R=g.useStateSetter(`triggerElement`),ee=kP(),z=kP(),te=kP();Z.useEffect(()=>{if(x)return te.start(r_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=_I(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??rF(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,OL(dL,e.nativeEvent)),ee.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){zP(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=xP(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;zP(F.current,t)||zP(P.current,t)||p5(e,F.current)||g.context.setOpen(!1,OL(xL,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 jI(`button`,e,{ref:[t,F,L,R],state:ie,stateAttributesMapping:i_e,props:re})}),o_e={value:()=>null},s_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)?Qge(l,u,d):i7(l,u,d)),jI(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:o_e})}),c_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return jI(`span`,e,{state:{open:K5().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:qP})}),l_e=Z.forwardRef(function(e,t){let n=K5(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Q.jsx)(PL,{ref:t,...e}):null}),s7=Z.createContext(void 0);function c7(){let e=Z.useContext(s7);if(!e)throw Error(HN(59));return e}function l7(e,t){e&&Object.assign(e.style,t)}var u7={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},u_e={position:`fixed`},d_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=XI,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=$B({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?u_e:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};BN(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=rV(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),z=Z.useRef(0),te=ZN(e=>{if(y.context.valuesRef.current.length===0)return;let t=z.current;z.current=e.size;let n=OL(dL);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:RI(!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}`})}},f_e=Z.createContext(void 0),p_e={disableStyleElements:!1};function p7(){return Z.useContext(f_e)??p_e}var m7=`--transform-origin`,m_e={...YP,...GP},h_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=zB(),{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=EP(),P=ZN(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=xP(O),o=tP(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=$I(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=$I(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]),UI({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};BN(()=>{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]),BN(()=>{S||m||(j.current=!1,A.current=!1,l7(O,M.current))},[S,m,O]),BN(()=>{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=g_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=tP(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=xP(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=`${$I(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&&IP;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=$I(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=tP(O);function t(e){s.context.setOpen(!1,OL(DL,e))}return SP(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=jI(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:m_e,props:[T,I,nV(E),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!b&&f7.getElement(y),(0,Q.jsx)(wR,{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 mz.getScale(e)}function v7(e,t,n){return e/n[t]}function y7(e,t){return OF({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 g_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 __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 jI(`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(HN(57));return e}var v_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);BN(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),BN(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=qge(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}=cL({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?Jge(n,a,S):[...n,a];f.context.setValue(r,OL(gL,e))}else f.context.setValue(a,OL(gL,e)),f.context.setOpen(!1,OL(gL,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&&sF(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=jI(`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})})),y_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}=Rz(s),d=jI(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:GP});return UI({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),x_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 jI(`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`,_=kP(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=Rz(g);BN(()=>(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]),UI({open:g,ref:v,onComplete(){g||x(!1)}});let S=jI(`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=S_e(a,c,r,e.clientHeight,t,n)}_.start(40,t)}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:GP});return y||o?S:null});function S_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 C_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 T_e(){let e=Z.useContext(w7);if(e===void 0)throw Error(HN(56));return e}var E_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=jI(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(w7.Provider,{value:c,children:l})}),D_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=T_e(),c=wU(a);return BN(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),jI(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),T7=e_e;function O_e({className:e,...t}){return(0,Q.jsx)(E_e,{"data-slot":`select-group`,className:JV(`scroll-my-1 p-1`,e),...t})}function E7({className:e,...t}){return(0,Q.jsx)(s_e,{"data-slot":`select-value`,className:JV(`flex flex-1 text-left`,e),...t})}function D7({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(a_e,{"data-slot":`select-trigger`,"data-size":t,className:JV(`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)(c_e,{render:(0,Q.jsx)(SH,{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)(l_e,{children:(0,Q.jsx)(d_e,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Q.jsxs)(h_e,{"data-slot":`select-content`,"data-align-trigger":o,className:JV(`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)(A_e,{}),(0,Q.jsx)(__e,{children:t}),(0,Q.jsx)(j_e,{})]})})})}function k_e({className:e,...t}){return(0,Q.jsx)(D_e,{"data-slot":`select-label`,className:JV(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function k7({className:e,children:t,...n}){return(0,Q.jsxs)(v_e,{"data-slot":`select-item`,className:JV(`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)(x_e,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(y_e,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`}),children:(0,Q.jsx)(bH,{className:`pointer-events-none`})})]})}function A_e({className:e,...t}){return(0,Q.jsx)(w_e,{"data-slot":`select-scroll-up-button`,className:JV(`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)(wH,{})})}function j_e({className:e,...t}){return(0,Q.jsx)(C_e,{"data-slot":`select-scroll-down-button`,className:JV(`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)(SH,{})})}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||{}),M_e=[0,1],j7=[1,0],M7=[2,3],N7=[3,2],N_e={L:M_e,M:j7,Q:M7,H:N7},P_e=/^\d*$/,F_e=/^[A-Z0-9 $%*+./:-]*$/,P7=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,F7=1,I7=40,L7=3,I_e=3,R7=40,L_e=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]],R_e=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=q_e(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=J_e(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+=I_e)}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*L_e,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()}},z_e=[1,10,12,14],B_e=[2,9,11,13],V_e=[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(V_e,e.length,t)}function H_e(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(z_e,e.length,t)}function U_e(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(B_e,e.length,t)}function W_e(e){return e===``?[]:K7(e)?[H_e(e)]:q7(e)?[U_e(e)]:[G7(K_e(e))]}function K7(e){return P_e.test(e)}function q7(e){return F_e.test(e)}function G_e(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 K_e(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 q_e(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 J_e(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 Y_e(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=G_e(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 R_e(o,t,u,i)}function X_e(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`?W_e(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=Y_e(c,N_e[n],i,a,o,r),u=Z_e({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 Z_e(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 Q_e(e){let t=(0,iV.c)(9),{link:n}=e,r,i;if(t[0]!==n){let{size:e,data:a}=X_e(n,{ecc:`M`,border:2});r=e,i=a.flatMap($_e).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 $_e(e,t){return e.flatMap((e,n)=>e?[`M${n} ${t}h1v1h-1z`]:[])}function eve(e){let t=(0,iV.c)(50),{connection:n,remote:r,disabled:i}=e,a=i!==void 0&&i,o=Bce(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]=the(n),_=n8(n),v;t[0]!==_||t[1]!==h?(v=nS(h)&&nS(_)&&_.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 y.link.startsWith(`${t}/pair#`)})?.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:ede,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(nve),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:t2[b.route]})}),(0,Q.jsx)(O7,{children:o.map(tve)})]}),(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)(WH,{}),t[12]=h.waiting,t[13]=O);let k;t[14]!==D||t[15]!==O?(k=(0,Q.jsxs)(nH,{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=t2[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=iS(h)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:w2(Ul(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)(Q_e,{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 `,t2[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)(nH,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>JU(y?.link??``,`pairing link`),children:[(0,Q.jsx)(PH,{}),`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 tve(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:`${t2[t]} · ${n}`})},n)}function nve(e){let{route:t,url:n}=e;return{value:n,label:`${t2[t]} · ${n}`}}var Z7=Z.createContext(void 0);function Q7(){let e=Z.useContext(Z7);if(e===void 0)throw Error(HN(64));return e}var rve=`data-activation-direction`,$7={tabActivationDirection:e=>({[rve]:e})},ive=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;BN(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=ZN((e,t)=>{t.activationDirection=t9(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),A=ZN((e,t)=>{i?.(e,OL(t,void 0,void 0,{activationDirection:`none`}))}),j=ZN((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);BN(()=>{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,wL);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=wL;r?i=TL:t&&(i=CL),e(n,i);return}r&&F!=null&&(A(m,TL),L.current=!1)},[I,g,A,F,h,_,m]);let te=jI(`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 ave=`data-composite-item-active`,n9=Z.createContext(void 0);function ove(){let e=Z.useContext(n9);if(e===void 0)throw Error(HN(65));return e}var sve=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:_}=ove(),{highlightedIndex:v,onHighlightedIndexChange:y}=aL(),b=wU(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=ZN(e=>{E.current?.(),E.current=e?g(e):null});BN(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=RP(xP(e));if(t&&zP(e,t))return}r||y(C)},[w,C,v,y,r,_]);let{getButtonProps:O,buttonRef:k}=cL({disabled:r,native:s,focusableWhenDisabled:!0}),A=d(a),j=Z.useRef(!1),M=Z.useRef(!1);function N(e){f(a,OL(dL,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=xP(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 jI(`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,[ave]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,O],stateAttributesMapping:$7})}),cve=`data-index`,lve={...$7,...GP},uve=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=wU(),{ref:m,index:h}=j8(),g=r===c,{mounted:_,transitionStatus:v,setMounted:y}=Rz(g),b=!_,x=l(r),S={hidden:b,orientation:u,tabActivationDirection:d,transitionStatus:v},C=Z.useRef(null),w=jI(`div`,e,{state:S,ref:[t,m,C],props:[{"aria-labelledby":x,hidden:b,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:RI(!g),[cve]:h},s],stateAttributesMapping:lve});return UI({open:g,ref:C,onComplete(){g||y(!1)}}),BN(()=>{if(!(p==null||b&&!a))return f(r,p)},[b,a,r,p,f]),a||_?w:null});function dve(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=FN}=e,[p,m]=Z.useState(0),h=r!=null,g=Z.useRef(null),_=aI(g,c),v=Z.useRef([]),y=Z.useRef(!1),b=Z.useRef(null),x=o??p,S=ZN((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=ZN(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||NF(e,x,d)?S(fve(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(NF(t,x,d)){let e=MF(t,{disabledIndices:d});kF(t,e)||S(e)}U8(g.current,r,a,n)});BN(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(NF(e,x,d)){let t=MF(e,{disabledIndices:d});kF(e,t)||S(t)}},[d,o,x,v,S]);let w=ZN((e,t,n)=>i?i(e,t,n,v):n),T=ZN(e=>{let o=e.key===`Home`||e.key===`End`;if(!V8.has(e.key)||!l&&o||pve(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=BP(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=AF(v,d),T=jF(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=MF(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!kF(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=BP(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 fve(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!NF(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function pve(e,t){for(let n of She)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function mve(e){let{render:t,className:n,style:r,refs:i=FN,props:a=FN,state:o=IN,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}=dve({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:zB(),disabledIndices:v,modifierKeys:y}),k=jI(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)(iL.Provider,{value:A,children:(0,Q.jsx)(Y8,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var hve=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);BN(()=>{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=ZN(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=ZN(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)(mve,{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:FN})})});function r9({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(ive,{"data-slot":`tabs`,"data-orientation":t,className:JV(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var gve=eH(`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)(hve,{"data-slot":`tabs-list`,"data-variant":t,className:JV(gve({variant:t}),e),...n})}function a9({className:e,...t}){return(0,Q.jsx)(sve,{"data-slot":`tabs-trigger`,className:JV(`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 _ve({className:e,...t}){return(0,Q.jsx)(uve,{"data-slot":`tabs-content`,className:JV(`flex-1 text-xs/relaxed outline-none`,e),...t})}var o9=IE(V3.layer).atom(H(function*(){return In()}));function vve(){let e=(0,iV.c)(8),t=wN(o9),n;e[0]===t?n=e[1]:(n=Un(Xn(dS(t))),e[0]=t,e[1]=n);let r;e[2]===t?r=e[3]:(r=iS(t),e[2]=t,e[3]=r);let i=kN(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 yve(){let e=(0,iV.c)(36),[t,n]=(0,Z.useState)(`claude`),{configuration:r,failed:i,retry:a}=vve(),o=`claude mcp add porcelain -- porcelain mcp`,s;e[0]!==t||e[1]!==o?(s=Bfe(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&&JU(c,`MCP configuration`)},e[11]=c,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Q.jsx)(nH,{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)(PH,{}),e[16]=_):_=e[16];let v;e[17]===g?v=e[18]:(v=(0,Q.jsx)(UU,{render:g,children:_}),e[17]=g,e[18]=v);let y;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(WU,{role:`tooltip`,children:`Copy MCP configuration`}),e[19]=y):y=e[19];let b;e[20]===v?b=e[21]:(b=(0,Q.jsxs)(HU,{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…`:Wfe(e).map((e,t)=>(0,Q.jsx)(`span`,{className:xve[e.kind],children:e.text},t))}var xve={program:`text-(--syn-fn)`,quoted:`text-(--syn-str)`,plain:void 0},Sve=new Intl.RelativeTimeFormat(`en`,{numeric:`always`});function s9(e,t=Gne()){let n=dm(e),r=Yne(n,t),[i,a]=r?[t,n]:[n,t],o=Jne(i,a),s=Fi(o),c=qne(),l=(s+pm(fm(a,c))-pm(fm(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)),Sve.format(r?d:-d,u)}var Cve={phone:(0,Q.jsx)(cU,{"aria-hidden":!0}),tablet:(0,Q.jsx)(uU,{"aria-hidden":!0}),browser:(0,Q.jsx)(IH,{"aria-hidden":!0})};function wve(e){let t=(0,iV.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:Cve[Vfe(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:n2[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 `,n2[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)(Dve,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canManageSharing===!0}),(0,Q.jsx)(Tve,{disabled:a,connection:n,id:e.id,label:e.label,trusted:e.trusted}),!e.canManageSharing&&Lce(e)&&(0,Q.jsx)(Eve,{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)(WH,{"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)(nH,{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 Tve(e){let t=(0,iV.c)(6),{connection:n,id:r,label:i,trusted:a,disabled:o}=e,[s,c]=rhe(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 Eve(e){let t=(0,iV.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=ihe(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,iV.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=iS(a)&&(0,Q.jsx)(Z6,{variant:`destructive`,className:`col-span-2`,children:(0,Q.jsx)($6,{children:w2(Ul(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,iV.c)(12),{connection:n,id:r,label:i,cancelLink:a,disabled:o}=e,s=o!==void 0&&o,[c,l]=nhe(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)(nH,{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=iS(c)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:w2(Ul(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 Dve(e){let t=(0,iV.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=che(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 Ove(e){let t=(0,iV.c)(13),{name:n,route:r}=e,{status:i}=r,a;t[0]!==n||t[1]!==r?(a=Wce(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 kve(e){let t=(0,iV.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=Yce(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=jce[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)(HU,{children:[(0,Q.jsx)(UU,{render:(0,Q.jsx)(nH,{size:`icon-xs`,variant:`ghost`,className:`size-5`,"aria-label":`Copy ${e}`,onClick:()=>JU(e,`address`),children:(0,Q.jsx)(PH,{})})}),(0,Q.jsx)(WU,{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,iV.c)(40),{name:n,route:r,disabled:i,connectedThrough:a,onChange:o,setup:s,note:c,children:l}=e,u=t2[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)(Ove,{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)(oU,{"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)(kve,{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)(nH,{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)(SH,{"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:Mce(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 Ave(e){let t=(0,iV.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)(nH,{variant:`outline`,size:`sm`,className:`self-start`,disabled:r,onClick:i,children:[`Turn on for `,r2(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?i2(n):`Uses ${r2(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)(oU,{"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)(nH,{size:`sm`,variant:`ghost`}),children:`Details`}),t[14]=m):m=t[14];let h;t[15]===n?h=t[16]:(h=i2(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:Nce}),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,iV.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=Jce(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)(nH,{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)(nH,{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 jve(e){let t=(0,iV.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:Hce(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)(HU,{children:[(0,Q.jsx)(UU,{render:(0,Q.jsx)(nH,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy the tailscale serve command`,onClick:()=>JU(s,`command`),children:(0,Q.jsx)(PH,{})})}),(0,Q.jsx)(WU,{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 Mve(e){let t=(0,iV.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 Nve(e){let t=(0,iV.c)(63),{connection:n,remote:r}=e,[i,a]=ahe(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=i2(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)(Ave,{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)(jve,{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)(Mve,{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=iS(i)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:w2(Ul(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,iV.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(dS(i));if(e===null){let e;t[5]===n.address?e=t[6]:(e=Rce(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(iS(i)){let e;t[9]===i.cause?e=t[10]:(e=w2(Ul(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,iV.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)(Nve,{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 Pve(e){let t=(0,iV.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(dS(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=iS(i)?w2(Ul(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,iV.c)(5),{prominent:n}=e,r=n!==void 0&&n,i=Un(dS(Hme()))?.isDesktopShell;if(i===!0){let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(Ige,{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)(Pge,{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 Fve(e){let t=(0,iV.c)(46),{environment:n}=e,{connection:r}=D6(),i=Un(dS(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]=she(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)(cge,{icon:A4(n),pending:p.waiting,onChange:e=>m(Mue(e))}),(0,Q.jsxs)(nH,{variant:`ghost`,size:`sm`,ref:c?e=>{e&&(e.focus(),l(!1))}:void 0,onClick:()=>{l(!0),s(a)},children:[(0,Q.jsx)(eU,{}),`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&&iS(p)&&(0,Q.jsx)(Z6,{variant:`destructive`,className:`mt-4 max-w-160`,children:(0,Q.jsx)($6,{children:w2(Ul(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)(lhe,{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)(yve,{}),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)(Bme,{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,iV.c)(6),{connection:n}=e,r=Un(dS(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)(eve,{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)(Pve,{connection:n,children:i}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}var Ive=X(e=>b6.fn(e=>H(function*(){let t=yield*(yield*M2).pair({value:e,localEnvironmentId:x6.state.value.connection?.environmentId}).pipe(op(t3));return H0(g6,t),t}))),Lve=X(e=>b6.fn(t=>H(function*(){yield*(yield*M2).forget(e.environmentId)}))),Rve=b6.fn(e=>H(function*(){yield*(yield*M2).read()}));function zve(e){let t=(0,iV.c)(12),[n]=(0,Z.useState)(Symbol),r;t[0]===n?r=t[1]:(r=Ive(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]=AN(i,a),c=ON(i),l;t[3]!==e||t[4]!==s?(l=async t=>{uu(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(UE),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 Bve(e,t){let n=(0,iV.c)(9),r;n[0]===e?r=n[1]:(r=Lve(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]=AN(r,i),s;n[3]!==t||n[4]!==o?(s=async()=>{uu(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 Vve(){let e=(0,iV.c)(5),[t,n]=AN(Rve),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 Hve(e){let t=(0,iV.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=c0(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 Uve(){let e=(0,iV.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=zve(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:`http://192.168.1.20:4738/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)(nH,{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=iS(i.result)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:w2(Ul(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 Wve(e){let{connection:t}=e,n=Un(dS(r8(t))),r=Un(dS(n8(t)));return n&&r?`Online · ${Ufe(n,r.devices.length)}`:`Online · Connected computer`}function Gve(e){let t=(0,iV.c)(60),{environment:n,onOpen:r,showUpdates:i}=e,{connection:a}=D6(),{remotes:o,error:s}=w6(),c=Vve();mge();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)(IH,{"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)(BH,{}),(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)(nH,{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)(nH,{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)(nH,{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)(Wve,{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)(Hve,{remote:e,showUpdates:i,onOpen:r},e.environmentId),t[42]=r,t[43]=i,t[44]=e):e=t[44],I=[...o].sort(Kve).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)(Uve,{})})]}),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)(gN,{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 Kve(e,t){return e.name.localeCompare(t.name)||e.environmentId.localeCompare(t.environmentId)}var _9=(0,Q.jsx)(OH,{"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:JV(`size-2 rounded-full`,e)})}var qve={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,iV.c)(24),{name:n,label:r,openLabel:i,status:a,badge:o,description:s,update:c,onOpen:l}=e,u=qve[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)(EH,{"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:JV(`animate-pulse rounded-md bg-muted`,e),...t})}function Jve(e){let t=(0,iV.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,iV.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)(RH,{}),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 Yve(e){let t=(0,iV.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 Xve(e){let t=(0,iV.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)(AH,{}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=(0,Q.jsx)(nH,{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)(nH,{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 Zve(e){let t=(0,iV.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)(nU,{}),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)(WH,{}),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}: ${c0(r)}`,t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=l0(r),t[6]=r,t[7]=u);let d;t[8]!==i||t[9]!==a?(d=!a&&(0,Q.jsx)(nH,{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 Qve(e){let t=(0,iV.c)(14),{remote:n}=e,r,i,a,o;if(t[0]!==n){let e=Y1(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($ve),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 $ve(e){let{address:t}=e;return(0,Q.jsxs)(W6,{children:[(0,Q.jsxs)(K6,{children:[(0,Q.jsx)(q6,{children:Q1(t)}),(0,Q.jsx)(J6,{className:`break-all`,children:t})]}),(0,Q.jsx)(Y6,{children:(0,Q.jsxs)(HU,{children:[(0,Q.jsx)(UU,{render:(0,Q.jsx)(nH,{size:`icon-sm`,variant:`ghost`,"aria-label":`Copy ${t}`,onClick:()=>JU(t,`address`),children:(0,Q.jsx)(PH,{})})}),(0,Q.jsx)(WU,{role:`tooltip`,className:`break-all`,children:`Copy ${t}`})]})})]},t)}function eye(e){let t=(0,iV.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 tye(e){let t=(0,iV.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)(nye,{remote:c,onForgotten:r}),t[10]=r,t[11]=c,t[12]=l):l=t[12],l}function nye(e){let t=(0,iV.c)(76),{remote:n,onForgotten:r}=e,i=O6(n),a=E6(n.environmentId),o=Bve(n,r),s=i.kind===`online`,c=s?i.name:n.name,l;t[0]===i?l=t[1]:(l=l0(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=c0(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)(nH,{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)(Fge,{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)(Qve,{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)(nH,{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=iS(o.result)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:w2(Ul(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 rye=DE(e=>e.registry),S9=X(e=>DE(t=>{let n=window.matchMedia(e),r=()=>t.setSelf(n.matches);return n.addEventListener(`change`,r),t.addFinalizer(()=>n.removeEventListener(`change`,r)),n.matches})),iye=DE(()=>{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}}}),aye=X(e=>DE(t=>{t.addFinalizer(t(iye)(e))}));function C9(){let e=(0,iV.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=S9(`(max-width: 767px)`),e[0]=t):t=e[0],wN(t)}var w9=Z.createContext(void 0);function T9(e){let t=Z.useContext(w9);if(!e&&t===void 0)throw Error(HN(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 jI(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:XP,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}=cL({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,OL(_L,e.nativeEvent))}return jI(`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=wU(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),jI(`p`,e,{ref:t,props:[{id:c},o]})}),k9=Z.createContext(void 0);function oye(){let e=Z.useContext(k9);if(e===void 0)throw Error(HN(26));return e}var sye=`--nested-dialogs`,cye=`data-nested-dialog-open`,lye={...YP,...GP,nestedDialogOpen(e){return e?{[cye]:``}: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`);oye(),UI({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?Bz(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=jI(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...zz,hidden:!m,onKeyDown(e){V8.has(e.key)&&e.stopPropagation()},style:{[sye]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:lye});return(0,Q.jsx)(wR,{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)(PL,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(Z8,{ref:i.context.internalBackdropRef,inert:RI(!s)}),e.children]})}):null});function uye({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=jR(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=BP(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||zP(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)}),BN(()=>(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]),Zz(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var M9={...oB,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},dye=class extends QN{constructor(e,t,n){let r=new $z,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(Gz(this.state,e,t.trigger)))}};function fye(){let e=new $z;return new _U(Object.freeze(N9(void 0,e)),Object.freeze(P9(e)),M9)}function N9(e,t,n,r=!1){return{...eB(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=Vz((e,t)=>new dye({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`);Qz(b,x),Yz(b);let{forceUnmount:w}=Xz(x,b);Z.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,OL(EL))}),[w,b]);let T=x||S;return(0,Q.jsxs)(w9.Provider,{value:b,children:[u&&(0,Q.jsx)(Hz,{handle:u,store:b}),T&&(0,Q.jsx)(uye,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var I9=KN(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=wU(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),jI(`h2`,e,{ref:t,props:[{id:c},o]})});function R9({...e}){return(0,Q.jsx)(I9,{"data-slot":`sheet`,...e})}function pye({...e}){return(0,Q.jsx)(j9,{"data-slot":`sheet-portal`,...e})}function mye({className:e,...t}){return(0,Q.jsx)(E9,{"data-slot":`sheet-overlay`,className:JV(`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)(pye,{children:[(0,Q.jsx)(mye,{}),(0,Q.jsxs)(A9,{"data-slot":`sheet-content`,"data-side":n,className:JV(`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)(nH,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,Q.jsx)(mU,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function B9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:JV(`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:JV(`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:JV(`text-xs/relaxed text-muted-foreground`,e),...t})}var hye=`sidebar_state`,gye=604800,_ye=`16rem`,vye=`18rem`,yye=`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 xye({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=`${hye}=${t}; path=/; max-age=${gye}`},[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":_ye,"--sidebar-width-icon":yye,...i},className:JV(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Sye({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:JV(`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":vye},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:JV(`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:JV(`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 Cye({className:e,onClick:t,...n}){let{toggleSidebar:r}=W9();return(0,Q.jsxs)(nH,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:JV(e),onClick:e=>{t?.(e),r()},...n,children:[(0,Q.jsx)(QH,{}),(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:JV(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function Tye({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:JV(`relative flex w-full min-w-0 flex-col px-2 py-1`,e),...t})}function Eye({className:e,render:t,...n}){return H6({defaultTagName:`div`,props:_I({className:JV(`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 Dye({className:e,render:t,...n}){return H6({defaultTagName:`button`,props:_I({className:JV(`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 Oye({className:e,...t}){return(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:JV(`flex w-full min-w-0 flex-col gap-px`,e),...t})}function kye({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:JV(`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(HN(47));return t}var Aye={...oB,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},jye=class extends QN{constructor(e,t,n){let r=new $z;super(Mye(e,r,t,n),Nye(r),Aye)}setOpen=(e,t)=>{let n=t.reason===pL,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=Kz(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=Gz(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)}),VN.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Mye(e,t,n,r=!1){let i={...eB(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 Nye(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new OP,triggerElements:e}}var q9=KN(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=Fye(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),Qz(u,d),Yz(u);let{forceUnmount:m}=Xz(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,OL(EL))}),[m,u]);let h=d||f;return(0,Q.jsxs)(G9.Provider,{value:u,children:[s&&(0,Q.jsx)(Hz,{handle:s,store:u}),h&&(0,Q.jsx)(Iye,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function Pye(e){return K9(!0)?(0,Q.jsx)(q9,{props:e}):(0,Q.jsx)(hR,{children:(0,Q.jsx)(q9,{props:e})})}function Fye(e,t){let n=Vz((e,n)=>new jye(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Iye({store:e,modal:t}){let n=jR(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return Zz(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var Lye=qN(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=sB(s)??m;if(!h)throw Error(HN(74));let g=wU(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}=Jz(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=bB(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:LB(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=TR(v,{stickIfOpen:T}),A=l5(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=cL({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?JP.open(e):qP.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=g5(h,x),R=jI(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[GI]:``,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)(iI,{ref:F,onFocus:I}),ee,(0,Q.jsx)(iI,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):ee}),J9=Z.createContext(void 0);function Rye(){let e=Z.useContext(J9);if(e===void 0)throw Error(HN(45));return e}var zye=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)(PL,{ref:t,...r})}):null}),Y9=Z.createContext(void 0);function Bye(){let e=Z.useContext(Y9);if(!e)throw Error(HN(46));return e}var Vye=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=ZI,..._}=e,v=K9(),y=Rye(),b=pR(),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=HI(O),P=$B({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`);BN(()=>{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=rV(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:RI(!C),cutout:T}),(0,Q.jsx)(mR,{id:b,children:R})]})}),Hye=Z.createContext(void 0);function Uye(){let[e,t]=Z.useState(0),n=ZN(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var Wye=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=K9(),l=Bye(),u=I8(!0)!=null,{context:d,hasClosePart:f}=Uye(),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`);UI({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),vB(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?Bz(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=jI(`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`,...zz,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&V8.has(e.key)&&e.stopPropagation()}},nV(g),s],stateAttributesMapping:XP});return(0,Q.jsx)(wR,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:aP(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(Hye.Provider,{value:d,children:M})})}),Gye=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=wU(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),jI(`h2`,e,{ref:t,props:[{id:s},a]})}),Kye=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=wU(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),jI(`p`,e,{ref:t,props:[{id:s},a]})});function X9({...e}){return(0,Q.jsx)(Pye,{"data-slot":`popover`,...e})}function Z9({...e}){return(0,Q.jsx)(Lye,{"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)(zye,{children:(0,Q.jsx)(Vye,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,Q.jsx)(Wye,{"data-slot":`popover-content`,className:JV(`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 qye({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`popover-header`,className:JV(`flex flex-col gap-1 text-xs`,e),...t})}function $9({className:e,...t}){return(0,Q.jsx)(Gye,{"data-slot":`popover-title`,className:JV(`text-sm font-medium`,e),...t})}function Jye({className:e,...t}){return(0,Q.jsx)(Kye,{"data-slot":`popover-description`,className:JV(`text-muted-foreground`,e),...t})}function Yye(e){let t=(0,iV.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=uN(),{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($ye),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=vle(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=hle(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=JV(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(Qye),(0,Q.jsx)(nH,{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(Zye)}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(Xye),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)(nH,{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)(nH,{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 Xye(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:ebe(e)})]},`${e.kind}:${e.id}`)}function Zye(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 Qye(e){return(0,Q.jsxs)(`p`,{className:`wrap-anywhere`,children:[e.name,`: `,e.message]},e.id)}function $ye(e){let{target:t}=e;return N2(t)}function ebe(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 $,U2 as $a,uoe as $c,wue as $i,sie as $l,Ipe as $n,bH as $o,hfe as $r,BN as $s,K6 as $t,D9 as A,eue as Aa,ZM as Ac,Que as Ai,cT as Al,ame as An,$W as Ao,Zfe as Ar,nI as As,E8 as At,Vu as Au,Xve as B,Ule as Ba,boe as Bc,Y4 as Bi,dS as Bl,Wpe as Bn,mU as Bo,F3 as Br,zP as Bs,p8 as Bt,$n as Bu,L9 as C,g4 as Ca,Hoe as Cc,vde as Ci,RT as Cl,vme as Cn,W1 as Co,fpe as Cr,YI as Cs,l5 as Ct,B as Cu,j9 as D,tue as Da,Poe as Dc,hde as Di,CT as Dl,hme as Dn,pG as Do,V3 as Dr,_I as Ds,F8 as Dt,Mp as Du,fye as E,v4 as Ea,zoe as Ec,r3 as Ei,PT as El,E6 as En,RK as Eo,U3 as Er,jI as Es,K8 as Et,Af as Eu,aye as F,Kle as Fa,Doe as Fc,que as Fi,$x as Fl,$pe as Fn,HU as Fo,Sfe as Fr,qP as Fs,v8 as Ft,lu as Fu,Gve as G,e4 as Ga,EM as Gc,M4 as Gi,Vb as Gl,zpe as Gn,KH as Go,kfe as Gr,SP as Gs,t8 as Gt,zn as Gu,x9 as H,i4 as Ha,xoe as Hc,Iue as Hi,Rb as Hl,Hpe as Hn,eU as Ho,wfe as Hr,IP as Hs,d8 as Ht,Kn as Hu,S9 as I,a4 as Ia,Toe as Ic,Yue as Ii,nS as Il,eme as In,WU as Io,Nfe as Ir,GP as Is,_8 as It,tu as Iu,r9 as J,Rle as Ja,FM as Jc,Aue as Ji,Fb as Jl,Vpe as Jn,PH as Jo,I3 as Jr,tP as Js,Fme as Jt,Ln as Ju,Fve as K,r4 as Ka,moe as Kc,Oue as Ki,K as Kl,Rpe as Kn,WH as Ko,jfe as Kr,xP as Ks,e8 as Kt,qn as Ku,eye as L,s4 as La,Aoe as Lc,Jue as Li,Xx as Ll,Ype as Ln,VU as Lo,Cfe as Lr,WP as Ls,g8 as Lt,Ul as Lu,T9 as M,l4 as Ma,KM as Mc,Zue as Mi,hS as Ml,rme as Mn,ZU as Mo,Kfe as Mr,oF as Ms,w8 as Mt,tne as Mu,C9 as N,qle as Na,Eoe as Nc,Xue as Ni,tS as Nl,tme as Nn,JU as No,Rfe as Nr,nF as Ns,y8 as Nt,du as Nu,A9 as O,$le as Oa,Loe as Oc,rde as Oi,lT as Ol,mme as On,rG as Oo,Xfe as Or,aI as Os,P8 as Ot,Ku as Ou,rye as P,u4 as Pa,Ooe as Pc,$ue as Pi,iS as Pl,Xpe as Pn,KU as Po,Lfe as Pr,JP as Ps,b8 as Pt,uu as Pu,T7 as Q,q2 as Qa,OM as Qc,yue as Qi,wb as Ql,n6 as Qn,SH as Qo,ffe as Qr,HN as Qs,Y6 as Qt,tye as R,o4 as Ra,LM as Rc,Z4 as Ri,mS as Rl,c6 as Rn,UU as Ro,P3 as Rr,UP as Rs,h8 as Rt,ki as Ru,V9 as S,nue as Sa,iN as Sc,mde as Si,BT as Sl,_me as Sn,c0 as So,mpe as Sr,GI as Ss,d5 as St,bp as Su,F9 as T,Zle as Ta,Roe as Tc,n3 as Ti,WT as Tl,T6 as Tn,rq as To,rpe as Tr,RI as Ts,J8 as Tt,Kf as Tu,Yve as U,t4 as Ua,NM as Uc,I4 as Ui,qb as Ul,s6 as Un,XH as Uo,Ofe as Ur,OP as Us,u8 as Ut,Un as Uu,Jve as V,Vle as Va,Coe as Vc,Lue as Vi,J as Vl,Kpe as Vn,iU as Vo,Dfe as Vr,BP as Vs,f8 as Vt,Vn as Vu,b9 as W,Ble as Wa,Soe as Wc,L4 as Wi,Jb as Wl,Gpe as Wn,JH as Wo,Afe as Wr,kP as Ws,l8 as Wt,Rn as Wu,i9 as X,Ile as Xa,TM as Xc,D4 as Xi,Xb as Xl,t6 as Xn,EH as Xo,mfe as Xr,ZN as Xs,Q6 as Xt,_ve as Y,Lle as Ya,_oe as Yc,Eue as Yi,hie as Yl,i6 as Yn,OH as Yo,gfe as Yr,QN as Ys,$6 as Yt,Zn as Yu,a9 as Z,K2 as Za,goe as Zc,Cue as Zi,cie as Zl,a6 as Zn,wH as Zo,pfe as Zr,qN as Zs,W6 as Zt,W9 as _,sue as _a,qoe as _c,yde as _i,QE as _l,j6 as _n,L0 as _o,Spe as _r,cL as _s,nge as _t,Yf as _u,qye as a,E4 as aa,DN as ac,Tde as ai,X as al,V6 as an,Ale as ao,$3 as ar,JV as as,p7 as at,Kg as au,H9 as b,iue as ba,sN as bc,gde as bi,qT as bl,Sme as bn,v0 as bo,ppe as br,$I as bs,y5 as bt,zp as bu,Sye as c,C4 as ca,ON as cc,Sde as ci,ZE as cl,Ame as cn,w2 as co,Tpe as cr,Jz as cs,H5 as ct,xp as cu,Dye as d,S4 as da,xN as dc,ude as di,eD as dl,Dme as dn,f2 as do,bpe as dr,FL as ds,I5 as dt,U as du,vue as ea,zN as ec,_fe as ei,CM as el,J6 as en,Dle as eo,e6 as er,vH as es,O_e as et,_x as eu,Eye as f,x4 as fa,yN as fc,pde as fi,wE as fl,L6 as fn,Z0 as fo,xpe as fr,OL as fs,C5 as ft,Uf as fu,Cye as g,cue as ga,rse as gc,lde as gi,_E as gl,M6 as gn,q0 as go,_pe as gr,fL as gs,x5 as gt,ap as gu,xye as h,fue as ha,gN as hc,_de as hi,IE as hl,P6 as hn,K0 as ho,wpe as hr,dL as hs,b5 as ht,H as hu,Jye as i,bue as ia,AN as ic,Cde as ii,UE as il,B6 as in,kle as io,jpe as ir,eH as is,E7 as it,Gg as iu,E9 as j,d4 as ja,QM as jc,nde as ji,Uae as jl,nme as jn,QW as jo,Yfe as jr,rI as js,C8 as jt,Ou as ju,O9 as k,Qle as ka,Foe as kc,ide as ki,Iae as kl,ime as kn,aG as ko,Qfe as kr,iI as ks,T8 as kt,td as ku,wye as l,hue as la,fse as lc,o3 as li,lD as ll,z6 as ln,v2 as lo,Dpe as lr,Rz as ls,F5 as lt,tp as lu,kye as m,due as ma,_N as mc,fde as mi,cD as ml,Eme as mn,J0 as mo,Y3 as mr,EL as ms,rge as mt,Df as mu,X9 as n,Tue as na,IN as nc,bfe as ni,Lj as nl,q6 as nn,Ole as no,Fpe as nr,nH as ns,k_e as nt,W as nu,$9 as o,Sue as oa,MN as oc,xde as oi,GE as ol,jme as on,V2 as oo,kpe as or,zB as os,f7 as ot,mm as ou,Oye as p,b4 as pa,vN as pc,dde as pi,uD as pl,I6 as pn,Oce as po,vpe as pr,xL as ps,v5 as pt,Jp as pu,s9 as q,zle as qa,wM as qc,kue as qi,q as ql,Bpe as qn,RH as qo,Mfe as qr,bP as qs,Z6 as qt,In as qu,Q9 as r,pue as ra,PN as rc,vfe as ri,sj as rl,H6 as rn,G2 as ro,Npe as rr,tH as rs,D7 as rt,f_ as ru,Z9 as s,T4 as sa,kN as sc,wde as si,VE as sl,Ome as sn,ule as so,Ope as sr,sB as ss,o7 as st,Wne as su,Yye as t,_ue as ta,LN as tc,xfe as ti,SM as tl,U6 as tn,Ele as to,Lpe as tr,gH as ts,k7 as tt,ox as tu,Tye as u,xue as ua,wN as uc,Ede as ui,DE as ul,R6 as un,h2 as uo,Epe as ur,TR as us,L5 as ut,wp as uu,R9 as v,aue as va,uN as vc,cde as vi,tD as vl,k6 as vn,w0 as vo,gpe as vr,sL as vs,S5 as vt,np as vu,I9 as w,Yle as wa,nN as wc,i3 as wi,HT as wl,D6 as wn,uZ as wo,ipe as wr,UI as ws,a5 as wt,V as wu,B9 as x,rue as xa,aN as xc,sde as xi,zT as xl,bme as xn,l0 as xo,q3 as xr,JI as xs,h5 as xt,Hp as xu,z9 as y,lue as ya,lN as yc,bde as yi,TE as yl,O6 as yn,b0 as yo,hpe as yr,rL as ys,oge as yt,hp as yu,Zve as z,Gle as za,IM as zc,X4 as zi,rS as zl,Upe as zn,wU as zo,Tfe as zr,RP as zs,m8 as zt,tr as zu};
|