@fabiofiorita/porcelain 0.78.0 → 0.80.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.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/server/src/bootstrap/watch-host.mjs +115 -0
  4. package/server/src/cli/main.mjs +8100 -6816
  5. package/web/dist/assets/_-BshWuX2r.js +1 -0
  6. package/web/dist/assets/_layerId-B2Mhwdgd.js +1 -0
  7. package/web/dist/assets/_paired-BsiX749W.js +1 -0
  8. package/web/dist/assets/{_paired-BQ0y29Xb.js → _paired-ByXCZfON.js} +1 -1
  9. package/web/dist/assets/_paired-Qv7e73Az.js +1 -0
  10. package/web/dist/assets/_paired-RaEpohFx.js +1 -0
  11. package/web/dist/assets/_projectId-K3HYfGmC.js +1 -0
  12. package/web/dist/assets/_reviewId-BgaLSHh-.js +1 -0
  13. package/web/dist/assets/{_revision-BMXAJq_Z.js → _revision-CEkztxVf.js} +1 -1
  14. package/web/dist/assets/_section-eV0dGQ8T.js +1 -0
  15. package/web/dist/assets/_worktreeId-BsiX749W.js +1 -0
  16. package/web/dist/assets/_worktreeId-C634iX0I.js +1 -0
  17. package/web/dist/assets/_worktreeId-Dp2IijNU.js +1 -0
  18. package/web/dist/assets/_worktreeId-RaEpohFx.js +1 -0
  19. package/web/dist/assets/access-CgdAbsDB.js +19 -0
  20. package/web/dist/assets/connected-workspace-73Vq_-Pm.js +1 -0
  21. package/web/dist/assets/desktop-actions-DbUXvsow.js +1 -0
  22. package/web/dist/assets/{edit-file-Bcu9LCmp.js → edit-file-NoqbTKtz.js} +20 -20
  23. package/web/dist/assets/{file-editor-B_jE48tv.js → file-editor-BcKWP6Pq.js} +2 -2
  24. package/web/dist/assets/index-CEW83Kj-.css +2 -0
  25. package/web/dist/assets/index-iGH92IrA.js +10 -0
  26. package/web/dist/assets/{lazyRouteComponent-C0NLdQ95.js → lazyRouteComponent-DGmhBXYn.js} +1 -1
  27. package/web/dist/assets/pair-Cs-YnRFF.js +1 -0
  28. package/web/dist/assets/pair-RaEpohFx.js +1 -0
  29. package/web/dist/assets/review-route-C2awZrL6.js +1 -0
  30. package/web/dist/assets/reviews-BkUaPv4P.js +1413 -0
  31. package/web/dist/assets/reviews-DLioOiRN.css +1 -0
  32. package/web/dist/assets/useMatch-DNkNC5QD.js +1 -0
  33. package/web/dist/assets/useRouterState-7m7hAzAG.js +1 -0
  34. package/web/dist/assets/workspace-error-DZyPmDw9.js +1 -0
  35. package/web/dist/assets/{workspace-pending-DgQgV-cu.js → workspace-pending-D8mUCjic.js} +1 -1
  36. package/web/dist/index.html +9 -8
  37. package/web/dist/assets/_-CSJHpFdT.js +0 -1
  38. package/web/dist/assets/_layerId-DODyO-4v.js +0 -1
  39. package/web/dist/assets/_paired-Bse7nsmg.js +0 -1
  40. package/web/dist/assets/_paired-CmZDjtRz.js +0 -1
  41. package/web/dist/assets/_paired-CrNFab02.js +0 -1
  42. package/web/dist/assets/_reviewId-CBVBAvNp.js +0 -1
  43. package/web/dist/assets/_section-DdvA8EEA.js +0 -1
  44. package/web/dist/assets/_worktreeId-B27bXYEK.js +0 -1
  45. package/web/dist/assets/_worktreeId-Bse7nsmg.js +0 -1
  46. package/web/dist/assets/_worktreeId-C8Q6GcvL.js +0 -1
  47. package/web/dist/assets/_worktreeId-CmZDjtRz.js +0 -1
  48. package/web/dist/assets/access-E2mYEqnl.js +0 -19
  49. package/web/dist/assets/connected-workspace-8ch85vkt.js +0 -1
  50. package/web/dist/assets/desktop-actions-BPv0J8RL.js +0 -1
  51. package/web/dist/assets/index-BHlOFndd.js +0 -10
  52. package/web/dist/assets/index-Bg-CecA5.css +0 -2
  53. package/web/dist/assets/pair-Bse7nsmg.js +0 -1
  54. package/web/dist/assets/pair-CbpILDh2.js +0 -1
  55. package/web/dist/assets/review-route-CZyVDwAY.js +0 -1
  56. package/web/dist/assets/reviews-DCiXZMLG.js +0 -1404
  57. package/web/dist/assets/useMatch-CPSFM0JI.js +0 -1
  58. package/web/dist/assets/useRouterState-DtsAJKLm.js +0 -1
  59. package/web/dist/assets/workspace-error-DIuDMViV.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 ee(e){return e instanceof Error}function L(e){return F(e,Symbol.iterator)||x(e)}var te=`~effect/Hash`,R=e=>{switch(typeof e){case`number`:return se(e);case`bigint`:return ce(e.toString(10));case`string`:return ce(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?ce(`Invalid Date`):ce(e.toISOString());if(e instanceof RegExp)return ce(e.toString());{if(_.has(e))return ne(e);let t=_e.get(e);if(t!==void 0)return t;if(ve.has(e))return b(),ce(`[Circular]`);ve.add(e);let n=y,r;try{r=`~effect/Hash`in e?e[te]():typeof e==`function`?ne(e):e instanceof DataView?fe(v(e)):Array.isArray(e)||ArrayBuffer.isView(e)?fe(e):e instanceof Map?pe(e):e instanceof Set?he(e):ue(e)}finally{ve.delete(e)}return n===y&&_e.set(e,r),r}}return ae(re(ce(String(e))))},ne=e=>(ge.has(e)||ge.set(e,ae(Math.random()*4294967296|0)),ge.get(e)),re=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),ie=a(2,(e,t)=>re(Math.imul(e,2654435761)+Math.imul(t,2246822507))),ae=e=>e&3221225471|e>>>1&1073741824,oe=new DataView(new ArrayBuffer(8)),se=e=>{let t=e|0;return t===e?ae(t):(oe.setFloat64(0,e===e?e:NaN),ae(ie(oe.getInt32(0),oe.getInt32(4))))},ce=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return ae(t)},le=(e,t)=>{let n=12289;for(let r of t)n^=ie(R(r),R(e[r]));return ae(n)},ue=e=>le(e,g(e)),de=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return ae(r)},fe=e=>{let t=6151;for(let n of e)t=ie(t,R(n));return ae(t)},pe=de(ce(`Map`),([e,t])=>ie(R(e),R(t))),me=ce(`Set`),he=de(me,e=>ie(me,R(e))),ge=new WeakMap,_e=new WeakMap,ve=new WeakSet,ye=`~effect/Equal`;function be(){return arguments.length===1?e=>xe(e,arguments[0]):xe(arguments[0],arguments[1])}function xe(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:Se(e,t):!1}function Se(e,t){let n=we.length;for(let r=n;r-->0;)if(we[r]===e&&Te[r]===t)return!0;if(n)return Ce(e,t);let r=Ee.get(e);r||Ee.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=Ce(e,t)),i}function Ce(e,t){we.push(e),Te.push(t);try{return De(e,t)}finally{we.pop(),Te.pop()}}var we=[],Te=[],Ee=new WeakMap;function De(e,t){if(R(e)!==R(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=Pe(e);if(n!==Pe(t)||typeof e==`function`&&!n)return!1;if(n)return e[ye](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:Oe(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?ke(v(e),v(t)):ke(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:je(e,t,Me,Ne):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:je(e,t,R,xe):Ae(e,t)}function Oe(e,t){for(let n=0;n<e.length;n++)if(!xe(e[n],t[n]))return!1;return!0}function ke(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 Ae(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)||!xe(e[i],t[i]))return!1;return!0}function je(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 Me=e=>R(e[0]),Ne=(e,t)=>xe(e[0],t[0])&&xe(e[1],t[1]),Pe=e=>F(e,ye),Fe=e=>Ie(new Proxy(e,{})),Ie=e=>(_.add(e),e),Le=Symbol.for(`~effect/Redactable`),Re=e=>F(e,Le);function ze(e){return Re(e)?Be(e):e}function Be(e){return e[Le](globalThis[`~effect/Fiber/currentFiber`]?.context??Ue)}var Ve=`~effect/Fiber/currentFiber`,He=new Map,Ue={"~effect/Context":{},base:He,depth:0,mapUnsafe:He,pipe(){return n(this,arguments)}};function We(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 Ge;r.add(e);let l;if(Le in e)l=c(Be(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=Je(e);else if(!t?.ignoreToString&&F(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Ye(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=>`${Ke(t)}:${c(Xe(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Ke(t)}: ${c(Xe(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 Ge=`[Circular]`;function Ke(e){return typeof e==`string`?JSON.stringify(e):String(e)}function qe(e){return e.map(e=>`[${Ke(e)}]`).join(``)}function Je(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Ye(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Xe(e,t){try{return e[t]}catch{return`[property access threw]`}}function Ze(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=F(r,Le)?ze(r):ze(t);if(typeof i==`bigint`)return We(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 Qe=Symbol.for(`nodejs.util.inspect.custom`),$e=e=>{try{return e=ze(e),F(e,`toJSON`)&&D(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map($e):e}catch{return`[toJSON threw]`}},et=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?Ze(e,{space:t}):We(e,{space:t})}catch{return String(e)}},tt={toJSON(){return $e(this)},[Qe](){return this.toJSON()},toString(){return We(this.toJSON())}},nt=class{[Qe](){return this.toJSON()}toString(){return We(this.toJSON())}},rt=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),it=()=>Error.stackTraceLimit,at=e=>{rt&&(Error.stackTraceLimit=e)},ot=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})}},st=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return it()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})();function ct(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function lt(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&ct(e,n,t[n])}var ut=`~effect/Effect`,dt=`~effect/Exit`,ft={_A:o,_E:o,_R:o},pt=`${ut}/identifier`,mt=`${ut}/args`,ht=`${ut}/evaluate`,gt=`${ut}/successCont`,_t=`${ut}/failureCont`,vt=`${ut}/ensureCont`,yt=Symbol.for(`effect/Effect/Yield`),bt={pipe(){return n(this,arguments)},toJSON(){return{...this}},toString(){return We(this.toJSON(),{ignoreToString:!0,space:2})},[Qe](){return this.toJSON()}},xt={[ut]:ft,...bt,[Symbol.iterator](){return new ot(this)},toJSON(){return{_id:`Effect`,op:this[pt],...mt in this?{args:this[mt]}:void 0}}},St=e=>F(e,ut),Ct=e=>F(e,dt),wt=`~effect/Cause`,Tt=`~effect/Cause/Reason`,Et=e=>F(e,wt),Dt=e=>F(e,Tt),Ot=class{constructor(e){this[wt]=wt,this.reasons=e}pipe(){return n(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${We(this.reasons)})`}[Qe](){return this.toJSON()}[ye](e){return Et(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>be(t,e.reasons[n]))}[te](){return fe(this.reasons)}},kt=new WeakMap,At=class{[Tt];annotations;_tag;constructor(e,t,n){if(this[Tt]=Tt,this._tag=e,t!==jt&&typeof n==`object`&&n&&t.size>0){let e=kt.get(n);e&&(t=new Map([...e,...t])),kt.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 We(this)}[Qe](){return this.toString()}},jt=new Map,Mt=class extends At{constructor(e,t=jt){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${We(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[ye](e){return Bt(e)&&be(this.error,e.error)&&be(this.annotations,e.annotations)}[te](){return ie(ce(this._tag))(ie(R(this.error))(R(this.annotations)))}},Nt=e=>new Ot(e),eee=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=R(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>be(e,i)))continue;else t.push(i);r.push(i)}return r},Pt=a(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Ot(eee(e.reasons,t.reasons));return be(e,n)?e:n}),Ft=new Ot([]),It=e=>new Ot([new Mt(e)]),Lt=class extends At{constructor(e,t=jt){super(`Die`,t,e),this.defect=e}toString(){return`Die(${We(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[ye](e){return tee(e)&&be(this.defect,e.defect)&&be(this.annotations,e.annotations)}[te](){return ie(ce(this._tag))(ie(R(this.defect))(R(this.annotations)))}},Rt=e=>new Ot([new Lt(e)]),zt=a(e=>Et(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Ot(e.reasons.map(e=>e.annotate(t,n)))),Bt=e=>e._tag===`Fail`,tee=e=>e._tag===`Die`,Vt=e=>e._tag===`Interrupt`;function Ht(e){return Zt(`Effect.evaluate: Not implemented`)}var Ut=e=>({...xt,[pt]:e.op,[ht]:e[ht]??Ht,[gt]:e[gt],[_t]:e[_t],[vt]:e[vt]}),Wt=e=>{let t=Ut(e),n=function(e){this[mt]=e};return n.prototype=t,function(e){return new n(e)}},Gt=e=>{let t={[dt]:dt,_tag:e.op,get[e.prop](){return this[mt]},...Ut(e),toString(){return`${e.op}(${We(this[mt])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[mt]}},[ye](e){return Ct(e)&&e._tag===this._tag&&be(this[mt],e[mt])},[te](){return ie(ce(e.op),R(this[mt]))}},n=function(e){this[mt]=e};return n.prototype=t,function(e){return new n(e)}},Kt=Gt({op:`Success`,prop:`value`,[ht](e){let t=e.getCont(gt);return t?t[gt](this[mt],e,this):e.yieldWith(this)}}),qt={key:`effect/Cause/StackTrace`},Jt={key:`effect/Cause/InterruptorStackTrace`},Yt=Gt({op:`Failure`,prop:`cause`,[ht](e){let t=this[mt],n=!1;e.cache.stackFrame&&(t=zt(t,{mapUnsafe:new Map([[qt.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(_t),i=e._interruptedCause;if(i&&e.interruptible){let a=!1;for(;r&&e.interruptible;)a||=pt in r,r=e.getCont(_t);a&&(t=Nt(t.reasons.filter(e=>e._tag!==`Fail`))),t=Pt(t,i),n=!0}return r?r[_t](t,e,n?void 0:this):e.yieldWith(n?Yt(t):this)}}),Xt=e=>Yt(It(e)),Zt=e=>Yt(Rt(e)),Qt=Wt({op:`WithFiber`,[ht](e){return this[mt](e)}}),$t=function(){class e extends globalThis.Error{}let t=Ut({op:`YieldableError`,[ht](){return Xt(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),en=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends $t{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(lt(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),tn=e=>{class t extends en{_tag=e}return t.prototype.name=e,t},nn=`~effect/Cause/NoSuchElementError`,nee=class extends tn(`NoSuchElementError`){[nn]=nn;constructor(e){super({message:e})}},rn=`~effect/Cause/Done`,an=e=>F(e,rn),on={[rn]:rn,_tag:`Done`,value:void 0},sn=e=>e===void 0?on:{[rn]:rn,_tag:`Done`,value:e},ree=Xt(on),iee=e=>e===void 0?ree:Xt(sn(e)),cn=e=>Ut({op:e.label,[ht]:e.evaluate}),ln=e=>(t,n)=>t===n||e(t,n),aee=(e,t)=>e===t,un=()=>aee;function oee(e){return ln((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 see(e){return ln((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 dn=`~effect/Option`,fn={[dn]:{_A:e=>e},...bt,[Symbol.iterator](){return new ot(this)}},pn=Object.defineProperty(Object.assign(Object.create(fn),{_tag:`Some`,_op:`Some`,[ye](e){return gn(e)&&vn(e)&&be(this.value,e.value)},[te](){return ie(R(this._tag))(R(this.value))},toString(){return`some(${We(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:$e(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),mn=R(`None`),hn=Object.assign(Object.create(fn),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[ye](e){return gn(e)&&_n(e)},[te](){return mn},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),gn=e=>F(e,dn),_n=e=>e._tag===`None`,vn=e=>e._tag===`Some`,yn=Object.create(hn),bn=function(e){this.value=e};bn.prototype=pn;var xn=e=>new bn(e),Sn=`~effect/Result`,Cn={[Sn]:{_A:e=>e,_E:e=>e},...bt,[Symbol.iterator](){return new ot(this)}},wn=Object.assign(Object.create(Cn),{_tag:`Success`,_op:`Success`,[ye](e){return En(e)&&On(e)&&be(this.success,e.success)},[te](){return ie(R(this._tag))(R(this.success))},toString(){return`success(${We(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:$e(this.success)}}}),Tn=Object.assign(Object.create(Cn),{_tag:`Failure`,_op:`Failure`,[ye](e){return En(e)&&Dn(e)&&be(this.failure,e.failure)},[te](){return ie(R(this._tag))(R(this.failure))},toString(){return`failure(${We(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:$e(this.failure)}}}),En=e=>F(e,Sn),Dn=e=>e._tag===`Failure`,On=e=>e._tag===`Success`,kn=function(e){this.failure=e};kn.prototype=Tn;var cee=e=>new kn(e),An=function(e){this.success=e};An.prototype=wn;var lee=e=>new An(e);function jn(e){return(t,n)=>t===n?0:e(t,n)}var uee=jn((e,t)=>e<t?-1:1),Mn=jn((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),dee=a(2,(e,t)=>jn((n,r)=>e(t(n),t(r)))),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)=>e(t,n)!==1),In=e=>a(2,(t,n)=>e(t,n)!==-1),Ln=e=>a(2,(t,n)=>t===n||e(t,n)<1?t:n),Rn=()=>yn,zn=xn,Bn=_n,Vn=vn,Hn=a(2,(e,{onNone:t,onSome:n})=>Bn(e)?t():n(e.value)),Un=a(2,(e,t)=>Bn(e)?t():e.value),fee=a(2,(e,t)=>Bn(e)?t():e),Wn=e=>e==null?Rn():zn(e),Gn=Un(u),Kn=e=>(...t)=>{try{return zn(e(...t))}catch{return Rn()}},qn=a(2,(e,t)=>{if(Vn(e))return e.value;throw t()}),Jn=qn(()=>Error(`getOrThrow called on a None`)),Yn=a(2,(e,t)=>Bn(e)?Rn():zn(t(e.value))),Xn=a(2,(e,t)=>Bn(e)?Rn():t(e.value)),Zn=a(2,(e,t)=>Bn(e)?Rn():Wn(t(e.value))),Qn=Xn(o),$n=e=>Bn(e)?[]:[e.value],er=a(2,(e,t)=>Bn(e)?Rn():t(e.value)?zn(e.value):Rn()),tr=a(2,(e,t)=>!Bn(e)&&t(e.value)),nr=`~effect/Context/Service`,rr=function(){function e(){}let t=e;Object.setPrototypeOf(t,pee);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[ar]=ar,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&ir.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},pee={[nr]:nr,...cn({label:`Service`,evaluate(e){return Kt(Sr(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return gr(this,e)},use(e){return Qt(t=>e(Sr(t.context,this)))},useSync(e){return Qt(t=>Kt(e(Sr(t.context,this))))}},ir=new Set,ar=`~effect/Context/Reference`,or=`~effect/Context`,mee=8,hee=8,sr=(e,t,n,r)=>{let i=Object.create(_ee);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},cr=(e,t)=>{t&&(cr(e,t.parent),e.set(t.key,t.value))},lr=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return cr(t,e.overlay),e._flat=t},gee=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),fr(n)},ur=Symbol(),dr=(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)?ur:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=hee&&(n.base=lr(n),n.overlay=void 0,n.depth=0),r)},fr=e=>sr(void 0,e,void 0,0),_ee={get mapUnsafe(){return lr(this)},...bt,[or]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ye](e){if(!pr(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)||!be(r,n.get(e)))return!1;return!0},[te](){return se(this.mapUnsafe.size)}},vee=(e,t)=>e.cacheRoot===t.cacheRoot,pr=e=>F(e,or),mr=e=>!!e[ar],hr=()=>yee,yee=fr(new Map),gr=(e,t)=>fr(new Map([[e.key,t]])),_r=a(3,(e,t,n)=>vr(e,t.key,n)),vr=(e,t,n)=>{let r=e,i=ir.has(t)?void 0:r.cacheRoot;if(r.depth>=mee){let e=new Map(r.mapUnsafe);return e.set(t,n),sr(i,e,void 0,0)}return sr(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},yr=a(2,(e,t)=>br(e,t.key)),br=(e,t)=>{let n=dr(e,t);return n===ur?void 0:n},xr=a(2,(e,t)=>{let n=dr(e,t.key);if(n===ur){if(mr(t))return wr(t);throw Tr(t)}return n}),Sr=xr,Cr=`~effect/Context/defaultValue`,wr=e=>Cr in e?e[Cr]:e[Cr]=e.defaultValue(),Tr=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},Er=a(2,(e,t)=>{let n=dr(e,t.key);return n===ur?mr(t)?zn(wr(t)):Rn():zn(n)}),Dr=a(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:gee(e,e=>t.mapUnsafe.forEach((t,n)=>e.set(n,t)))),Or=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return fr(t)},kr=rr,Ar=e=>e.length>0,jr=e=>e>0?Math.floor(e):0,Mr=e=>Math.max(1,jr(e)),Nr=lee,Pr=cee,Fr=e=>{if(D(e))try{return Nr(e())}catch(e){return Pr(e)}try{return Nr(e.try())}catch(t){return Pr(e.catch(t))}},Ir=Dn,Lr=On,Rr=a(2,(e,t)=>Ir(e)?Pr(t(e.failure)):e),zr=a(2,(e,{onFailure:t,onSuccess:n})=>Ir(e)?t(e.failure):n(e.success)),Br=oee,Vr=e=>{let t=e[Symbol.iterator]().next();if(t.done)throw Error(`headUnsafe: empty iterable`);return t.value},Hr={[Symbol.iterator](){return Ur}},Ur={next(){return{done:!0,value:void 0}}},Wr=()=>Hr,Gr=a(2,(e,t)=>Object.hasOwn(e,t)),Kr=a(2,(e,t)=>{let n={...e};for(let r of qr(e))ct(n,r,t(e[r],r));return n}),qr=e=>Object.keys(e),Jr=e=>a(2,(t,n)=>{for(let r of qr(t))if(!Gr(n,r)||!e(t[r],n[r]))return!1;return!0}),Yr=e=>{let t=Jr(e);return(e,n)=>t(e,n)&&t(n,e)},Xr=globalThis.Array,Zr=e=>Xr.isArray(e)?e:Xr.from(e),Qr=e=>Xr.isArray(e)?e:[e],$r=a(2,(e,t)=>[t,...e]),ei=a(2,(e,t)=>[...e,t]),ti=a(2,(e,t)=>Zr(e).concat(Zr(t)));Xr.isArray;var ni=Ar,ri=Ar;function bee(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var ii=a(2,(e,t)=>{let n=Math.floor(t);if(bee(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]}),xee=ii(0),See=e=>e[e.length-1],Cee=a(2,(e,t)=>{let n=Zr(e);if(ri(n)){let[e,r]=t(n),i=[e],a=r;for(;Ar(a);){let[e,n]=t(a);i.push(e),a=n}return i}return[]}),wee=a(2,(e,t)=>{let n=Mr(t);return n>=e.length?[Tee(e),[]]:[$r(e.slice(1,n),xee(e)),e.slice(n)]}),Tee=e=>e.slice(),Eee=a(2,(e,t)=>{let n=Zr(e);return ri(n)?Cee(n,wee(t)):[]}),ai=()=>[],oi=e=>[e],si=a(2,(e,t)=>e.map(t)),Dee=see,ci=`~effect/Duration`,li=BigInt(0),ui=BigInt(1),Oee=BigInt(2),kee=BigInt(10),di=BigInt(24),fi=BigInt(60),pi=BigInt(1e3),mi=BigInt(1e6),hi=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),gi=e=>hi(e*1e6),_i=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=kee**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*Oee>=a?ui:li);return r?-s:s},vi=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,yi=e=>{switch(typeof e){case`number`:return Fi(e);case`bigint`:return Pi(e);case`string`:{if(e===`Infinity`)return Mi;if(e===`-Infinity`)return Ni;let t=vi.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return Pi(_i(r,ui));if(i===`micro`||i===`micros`)return Pi(_i(r,pi));let a=Number(r);switch(i){case`milli`:case`millis`:return Fi(a);case`second`:case`seconds`:return Ii(a);case`minute`:case`minutes`:return Li(a);case`hour`:case`hours`:return Ri(a);case`day`:case`days`:return zi(a);case`week`:case`weeks`:return Aee(a)}break}case`object`:{if(e===null)break;if(ci in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(S)?bi(e):Number.isNaN(e[0])||Number.isNaN(e[1])?ji:e[0]===-1/0||e[1]===-1/0?Ni:e[0]===1/0||e[1]===1/0?Mi:Ti(hi(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?Ti(n):Ti(hi(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return bi(e)},bi=e=>{throw Error(`Invalid Input: ${e}`)},xi={_tag:`Millis`,millis:0},Si={_tag:`Infinity`},Ci={_tag:`NegativeInfinity`},wi={[ci]:ci,[te](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?R(hi(e)):se(this.value.millis)}case`Nanos`:return R(this.value.nanos);default:return ue(this.value)}},[ye](e){return Ei(e)&&Ji(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`}}},[Qe](){return this.toJSON()},pipe(){return n(this,arguments)}},Ti=e=>{let t=Object.create(wi);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?xi:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:gi(e)}:e>0?Si:Ci:e===li?xi:{_tag:`Nanos`,nanos:e},t},Ei=e=>F(e,ci),Di=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,Oi=e=>{switch(e.value._tag){case`Millis`:return e.value.millis===0;case`Nanos`:return e.value.nanos===li;case`Infinity`:case`NegativeInfinity`:return!1}},ki=e=>{switch(e.value._tag){case`Millis`:return e.value.millis<0;case`Nanos`:return e.value.nanos<li;case`NegativeInfinity`:return!0;case`Infinity`:return!1}},Ai=e=>{switch(e.value._tag){case`Infinity`:case`NegativeInfinity`:return Mi;case`Millis`:return e.value.millis<0?Ti(-e.value.millis):e;case`Nanos`:return e.value.nanos<li?Ti(-e.value.nanos):e}},ji=Ti(0),Mi=Ti(1/0),Ni=Ti(-1/0),Pi=e=>Ti(e),Fi=e=>Ti(e),Ii=e=>Ti(e*1e3),Li=e=>Ti(e*6e4),Ri=e=>Ti(e*36e5),zi=e=>Ti(e*864e5),Aee=e=>Ti(e*6048e5),Bi=e=>Hi(yi(e),{onMillis:o,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),jee=e=>Hi(yi(e),{onMillis:e=>e/1e3,onNanos:e=>Number(e)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Mee=e=>Hi(yi(e),{onMillis:e=>e/6e4,onNanos:e=>Number(e)/6e10,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Nee=e=>Hi(yi(e),{onMillis:e=>e/36e5,onNanos:e=>Number(e)/36e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Vi=e=>{let t=yi(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 gi(t.value.millis)}},Hi=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)()}}),Ui=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(Vi(e),t.value.nanos):n.onNanos(e.value.nanos,Vi(t))),Wi=jn((e,t)=>Ui(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})),Gi=(e,t)=>Ui(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Ki=Ln(Wi),qi=Fn(Wi),Ji=a(2,(e,t)=>Gi(e,t)),Yi=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=Vi(e),n=t<li,r=n?-t:t,i=r/mi,a=i/pi,o=a/fi,s=o/fi,c=s/di,l=n?-1:1;return{days:l*Number(c),hours:l*Number(s%di),minutes:l*Number(o%fi),seconds:l*Number(a%fi),millis:l*Number(i%pi),nanos:l*Number(r%mi)}},Xi=e=>{if(e.value._tag===`Infinity`)return`Infinity`;if(e.value._tag===`NegativeInfinity`)return`-Infinity`;if(Oi(e))return`0`;if(ki(e))return`-`+Xi(Ai(e));let t=Yi(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(` `)},Zi=e=>t=>!Ir(e(t)),Qi=e=>t=>t.has(e)?Nr(t):Pr(t),$i=a(2,(e,t)=>n=>{let r=e(n);return Ir(r)?r:t(r.success)}),ea=e=>t=>{let n=e(t);return Ir(n)?Rn():zn(n.success)},ta=kr(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new oa}),na=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},ra=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},ia=e=>{try{return ra(e)}catch{return na(e)}},aa=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}},oa=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?na:ia)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new sa(this.setImmediate)}},sa=class{tasks=new aa;running=void 0;setImmediate;constructor(e=ia){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()}},ca=kr(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),la=kr(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),ua=class extends i{constructor(e){super(),e&&lt(this,e)}},da=e=>class extends ua{_tag=e},fa=en,pa=tn,ma=`~effect/encoding/EncodingError`,ha=class extends pa(`EncodingError`){[ma]=ma},ga=e=>{switch(e){case 16:return ba();case 32:return xa();default:{let t=``;for(let n=e>>>3;n>0;n--)t+=ya();return t}}},_a=Uint8Array.from(`0123456789abcdef`,e=>e.charCodeAt(0)),va=()=>Math.random()*4294967296>>>0,ya=()=>{let e=va();return String.fromCharCode(_a[e>>>28],_a[e>>>24&15],_a[e>>>20&15],_a[e>>>16&15],_a[e>>>12&15],_a[e>>>8&15],_a[e>>>4&15],_a[e&15])},ba=()=>{let e=va(),t=va();return String.fromCharCode(_a[e>>>28],_a[e>>>24&15],_a[e>>>20&15],_a[e>>>16&15],_a[e>>>12&15],_a[e>>>8&15],_a[e>>>4&15],_a[e&15],_a[t>>>28],_a[t>>>24&15],_a[t>>>20&15],_a[t>>>16&15],_a[t>>>12&15],_a[t>>>8&15],_a[t>>>4&15],_a[t&15])},xa=()=>{let e=va(),t=va(),n=va(),r=va();return String.fromCharCode(_a[e>>>28],_a[e>>>24&15],_a[e>>>20&15],_a[e>>>16&15],_a[e>>>12&15],_a[e>>>8&15],_a[e>>>4&15],_a[e&15],_a[t>>>28],_a[t>>>24&15],_a[t>>>20&15],_a[t>>>16&15],_a[t>>>12&15],_a[t>>>8&15],_a[t>>>4&15],_a[t&15],_a[n>>>28],_a[n>>>24&15],_a[n>>>20&15],_a[n>>>16&15],_a[n>>>12&15],_a[n>>>8&15],_a[n>>>4&15],_a[n&15],_a[r>>>28],_a[r>>>24&15],_a[r>>>20&15],_a[r>>>16&15],_a[r>>>12&15],_a[r>>>8&15],_a[r>>>4&15],_a[r&15])},Sa=`effect/Tracer/ParentSpan`,Ca=class extends rr()(Sa,{fiberCached:!0}){},wa=e=>e,Ta=kr(`effect/Tracer/DisablePropagation`,{defaultValue:l}),Ea=kr(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),Da=kr(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),Oa=`effect/Tracer`,ka=wa({span:e=>new Aa(e)}),Aa=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??=Gn(this.parent)?.traceId??ga(32)}get spanId(){return this._spanId??=ga(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)}},ja=`effect/Metric/FiberRuntimeMetrics`,Ma=kr(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:u}),Na=kr(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:c}),Pa=kr(`effect/References/TracerTimingEnabled`,{defaultValue:c}),Pee=kr(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),Fee=kr(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),Fa=kr(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),Iee=kr(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Lee=kr(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Ree=kr(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),zee=e=>{if(e?.captureStackTrace===!1||e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=`boolean`)return e;let t=it();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};at(3);let n=Error();return at(t),{...e,captureStackTrace:Bee(()=>n.stack)}},Ia=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}},Bee=Ia(3),La=class extends At{constructor(e,t=jt){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[ye](e){return Vt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[te](){return ie(ce(`${this._tag}:${this.fiberId}`))(ne(this.annotations))}},Vee=e=>new La(e),Ra=e=>new Ot([new La(e)]),Hee=e=>{let t=e.reasons.find(Bt);return t?Nr(t):Pr(e)},za=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Nr(n.error)}return Pr(e)},Uee=ea(za),Ba=e=>e.reasons.some(Vt),Va=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?Nr(t):Pr(e)},Wee=e=>{let t=Va(e);return Ir(t)?Gee:t.success},Gee=new Set,Kee=e=>e.reasons.length>0&&e.reasons.every(Vt),qee=a(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>Bt(e)?(n=!0,new Mt(t(e.error),e.annotations)):e);return n?Nt(r):e}),Ha=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},Jee=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=it();i!==0&&at(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(Ua(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=Qee(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(Ua(i,r[0].annotations,t))}}finally{i!==0&&at(i)}return n},Ua=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(Yee(e),{cause:e.cause?Ua(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=Zee(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?Wa(e,t):e}n?.includeCauseInStack&&(i.stack=qa(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else i=new globalThis.Error(e?r===`string`?e:Ze(e):`Unknown error: ${e}`);return i},Yee=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 Ze(e)},Xee=/\((.*)\)/g,Zee=(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?Wa(a.join(`
8
+ `),n):a.join(`
9
+ `)},Wa=(e,t)=>{let n=t?.get(qt.key);return n&&(e=`${e}\n${Ga(n)}`),e},Qee=(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(Jt.key);n.push(` at fiber (${t})`),r&&n.push(Ga(r))}return n.join(`
10
+ `)},Ga=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(Xee),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
+ `)},Ka=e=>Jee(e).map(qa).join(`
12
+ `),qa=e=>e.cause?`${e.stack} {\n${Ja(e.cause,` `)}\n}`:e.stack,Ja=(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${Ja(e.cause,`${t} `)}\n${t}}`),r},Ya=`~effect/Fiber`,$ee={_A:o,_E:o},ete={id:0},Xa=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),Za=()=>Xa===void 0?void 0:new Xa(`effect/Fiber`),Qa=()=>globalThis[Ve],$a=class{constructor(e,t=!0){this.setContext(e),this.id=++ete.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[Ya](){return $ee}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return Sr(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=Ra(e);this.cache.stackFrame&&(n=zt(n,gr(qt,this.cache.stackFrame))),t&&(n=zt(n,t)),this._interruptedCause=this._interruptedCause?Pt(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(co(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===yt){this._asyncContext=Za();return}let n=eo.interruptChildren&&eo.interruptChildren(this);if(n!==void 0)return this.evaluate(Yo(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=hr()}runLoop(e){let t=globalThis[Ve];globalThis[Ve]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;){this._deferredInterrupt&&(this._deferredInterrupt=!1,i=co(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=Yo(po,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[ht](this),i===yt){let e=this._yielded;if(dt in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return yt}}}catch(e){return F(i,ht)?this.runLoop(Zt(e)):Zt(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{this._running=n,globalThis[Ve]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,nte;for(;;){let t=this._stack.pop();if(!t)return;let n=t[vt];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&rte-1))return Kt(e);let t=this.getCont(gt);return t?t[gt](e,this):this.yieldWith(Kt(e))}yieldWith(e){return this._yielded=e,yt}children(){return this._children??=new Set}pipe(){return n(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&vee(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=tte(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}},tte=e=>{let t=br(e,Oa);return{scheduler:Sr(e,ta),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:Sr(e,Na),span:br(e,Sa),logLevel:Sr(e,Iee),minimumLogLevel:Sr(e,Lee),stackFrame:Sr(e,Ma),runtimeMetrics:br(e,ja),maxOpsBeforeYield:Sr(e,ca),preventYield:Sr(e,la)}},nte={[gt](e,t){return co(t._interruptedCause)},[_t](e,t){return co(t._interruptedCause)}},rte=32,eo={interruptChildren:void 0},to=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Jt.key,e.cache.stackFrame),fr(t)},ite=e=>{if(e._children!==void 0&&e._children.size!==0)return oo(e._children)},no=e=>{let t=e;return t._exit?so(t._exit):xo(n=>t._exit?n(so(t._exit)):uo(e.addObserver(e=>n(so(e)))))},ro=e=>xo(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(so(r))}return a(),uo(()=>i?.())}),io=e=>{let t=e;return t._exit?t._exit:xo(n=>t._exit?n(t._exit):uo(e.addObserver(n)))},ate=e=>xo(t=>{let n=Array.from(e);if(n.length===0)return t(so(ai()));let r=Array(n.length),i=ai(),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(so(r))};i.push(c),n[e].addObserver(c)}return uo(()=>{s=!0,a()})}),ao=e=>Qt(t=>ote(e,t.id)),ote=a(e=>F(e[0],Ya),(e,t,n)=>Qt(r=>{let i=to(r);return i=i&&n?Dr(i,n):i??n,e.interruptUnsafe(t,i),Ko(no(e))})),oo=e=>Qt(t=>{let n=to(t),r=ai();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return Ko(ro(r))}),so=Kt,co=Yt,lo=Xt,uo=Wt({op:`Sync`,[ht](e){let t=this[mt](),n=e.getCont(gt);return n?n[gt](t,e):e.yieldWith(Kt(t))}}),fo=Wt({op:`Suspend`,[ht](e){return this[mt]()}}),ste=zr({onFailure:lo,onSuccess:so}),po=Wt({op:`Yield`,[ht](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(ls)},this[mt]??0),e.yieldWith(()=>{t=!0})}})(0),mo=so(Rn()),cte=e=>fo(()=>co(e())),ho=e=>Zt(e),go=e=>fo(()=>lo(e())),_o=so(void 0),lte=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new vl(e,`An error occurred in Effect.try`):e.catch;return fo(()=>{try{return so(t())}catch(e){return lo(n(e))}})},ute=e=>yo(function(t,n){e(n).then(e=>t(so(e)),e=>t(ho(e)))},e.length!==0),dte=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new vl(e,`An error occurred in Effect.tryPromise`):e.catch;return yo(function(e,r){let i=e=>fo(()=>{try{return lo(st(()=>n(e)))}catch(e){return ho(e)}});try{t(r).then(t=>e(so(t)),t=>e(i(t)))}catch(t){e(i(t))}},t.length!==0)},vo=e=>Qt(t=>e(t.id)),yo=function(){let e=Ut({op:`Async`,[ht](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(bo(()=>(t=!0,r?.abort(),i??ls))),yt):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),bo=Wt({op:`AsyncFinalizer`,[vt](e){e.interruptible&&(e.interruptible=!1,e._stack.push(jc))},[_t](e,t){return Ba(e)?Yo(fc(Yt(e),this[mt]()),()=>co(e)):co(e)}}),xo=e=>yo(e,e.length>=2),So=xo(d),Co=(...e)=>{if(e.length===1){let t=e[0];return fo(()=>jo(t()))}let[t,n]=e;return fo(()=>jo(n.call(t.self)))},wo=(e,...t)=>{let n=t.length===0?function(){return fo(()=>jo(e.apply(this,arguments)))}:function(){let n=fo(()=>jo(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return To(e.length,n)},To=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Eo=Ia(2),Do=function(){let e=typeof arguments[0]==`string`,t=e?arguments[0]:`Effect.fn`,n=e?arguments[1]:void 0,r=it(),i;return r!==0&&(at(2),i=new globalThis.Error,at(r)),e?(r,...a)=>Oo(t,r,i,a,e,n):Oo(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},Oo=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.shift().bind(t.self),s=`${e} (definition)`,c=n?Eo(()=>n.stack):u;return To(o.length,function(...t){let n=fo(()=>{let e=o.apply(this,arguments);return St(e)?e:jo(e)});for(let e=0;e<r.length;e++)n=r[e](n,...t);if(!St(n))return n;let l=it(),d;return l!==0&&(at(2),d=new globalThis.Error,at(l)),_s(i?nl(e,a,e=>rl(n,e)):n,Ma,t=>({name:e,stack:d?Eo(()=>d.stack):u,parent:{name:s,stack:c,parent:t}}))})},ko=(e,...t)=>To(e.length,t.length===0?function(){return Ao(()=>e.apply(this,arguments))}:function(){let n=Ao(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),Ao=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return so(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 fo(()=>n?(n=!1,Yo(r.value,e=>jo(t,e))):fo(()=>jo(e())))}}}catch(e){return ho(e)}},jo=function(){let e=Ut({op:`Iterator`,[gt](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return so(r.value);if(!Xo(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[ht](e){return this[gt](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)}}(),Mo=a(2,(e,t)=>new Fo(e,Io,so(t))),No=function(e){return e._stack.push(this),this[mt]},Po=Ut({op:`OnSuccess`,[ht]:No}),Fo=function(e,t,n){this[mt]=e,this[gt]=t,this.payload=n};Fo.prototype=Po;var Io=function(){return this.payload},Lo=function(e,t){return t.succeedWith(this.payload)},Ro=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),zo=function(e,t){let n=this.payload;return t.succeedWith(Ro?n(e):st(()=>n(e)))},Bo=function(e){let t=this.payload;return t(e)},Vo=function(e){let t=this.payload;return new Fo(t(e),Lo,e)},Ho=function(e){return new Fo(this.payload,Lo,e)},Uo=e=>$o(e,zn),Wo=a(2,(e,t)=>new Fo(e,St(t)?Io:Bo,t)),Go=a(2,(e,t)=>new Fo(e,St(t)?Ho:Vo,t)),Ko=e=>new Fo(e,Io,ls),qo=(e,t)=>Qt(n=>{let r=new Set;return Dc(n,()=>r.size===0?void 0:oo(r)),xo(i=>{let a=!1,o=0;for(let s of e){if(a)break;let e=o++,c=Vc(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})})}})}),Jo=a(e=>St(e[1]),(e,t,n)=>qo([e,t],n)),Yo=a(2,(e,t)=>new Fo(e,Bo,t)),Xo=e=>e[dt]!==void 0,Zo=a(2,(e,t)=>Xo(e)?e._tag===`Success`?t(e.value):e:Yo(e,t)),Qo=e=>Yo(e,o),$o=a(2,(e,t)=>new Fo(e,zo,t)),es=a(2,(e,t)=>Xo(e)?us(e,t):$o(e,t)),ts=a(2,(e,t)=>Xo(e)?ds(e,t):Ls(e,t)),ns=a(2,(e,t)=>Xo(e)?fs(e,t):Rs(e,t)),rs=a(2,(e,t)=>{if(Xo(e)){if(e._tag===`Success`)return e;let n=za(e.cause);return Ir(n)?e:t(n.success)}return js(e,t)}),is=e=>Yt(Ra(e)),as=e=>e._tag===`Success`,os=e=>e._tag===`Failure`,ss=e=>e._tag===`Failure`?Nr(e.cause):Pr(e),cs=e=>e._tag===`Failure`&&Ba(e.cause),ls=Kt(void 0),us=a(2,(e,t)=>e._tag===`Success`?Kt(t(e.value)):e),ds=a(2,(e,t)=>{if(e._tag===`Success`)return e;let n=za(e.cause);return Ir(n)?e:Xt(t(n.success))}),fs=a(2,(e,t)=>{if(e._tag===`Success`)return Kt(t.onSuccess(e.value));let n=za(e.cause);return Ir(n)?e:Xt(t.onFailure(n.success))}),ps=a(2,(e,t)=>as(e)?t:e),ms=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?ls:Yt(Nt(t))},hs=e=>Qt(t=>so(Er(t.context,e))),gs=a(2,(e,t)=>Qt(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),Dc(n,()=>{n.setContext(r)}),e)})),_s=a(3,(e,t,n)=>gs(e,e=>{let r=xr(e,t),i=n(r);return r===i?e:_r(e,t,i)})),vs=()=>ys,ys=Qt(e=>so(e.context)),bs=e=>Qt(t=>e(t.context)),xs=a(2,(e,t)=>Xo(e)?e:gs(e,Dr(t))),Ss=function(){return arguments.length===1?a(2,(e,t)=>Cs(e,arguments[0],t)):a(3,(e,t,n)=>Cs(e,t,n)).apply(this,arguments)},Cs=(e,t,n)=>gs(e,_r(t,n)),ws=a(2,(e,t)=>Yo(t,t=>t?Uo(e):mo)),Ts=a(e=>St(e[0]),(e,t)=>Fc({while:c,body:s(t?.disableYield?e:Yo(e,e=>po)),step:d})),Es=a(2,(e,t)=>new Os(e,t.length===1?t:e=>t(e))),Ds=Ut({op:`OnFailure`,[ht]:No}),Os=function(e,t){this[mt]=e,this[_t]=t};Os.prototype=Ds;var ks=a(3,(e,t,n)=>Es(e,e=>t(e)?n(e):co(e))),As=a(3,(e,t,n)=>Es(e,e=>{let r=t(e);return Ir(r)?co(r.failure):n(r.success,e)})),js=a(2,(e,t)=>As(e,za,e=>t(e))),Ms=a(2,(e,t)=>Es(e,e=>Wo(t(e),co(e)))),Ns=a(3,(e,t,n)=>Es(e,e=>{let r=t(e);return Ir(r)?co(e):Wo(n(r.success,e),co(e))})),Ps=a(2,(e,t)=>Ns(e,za,e=>t(e))),Fs=a(e=>St(e[0]),(e,t,n,r)=>Es(e,e=>{let i=za(e);return Ir(i)?co(i.failure):t(i.success)?n(i.success):r?r(i.success):co(e)})),Is=a(e=>St(e[0]),(e,t,n,r)=>Fs(e,Array.isArray(t)?e=>F(e,`_tag`)&&t.includes(e._tag):I(t),n,r)),Ls=a(2,(e,t)=>js(e,e=>go(()=>t(e)))),Rs=a(2,(e,t)=>Xs(e,{onFailure:e=>go(()=>t.onFailure(e)),onSuccess:e=>uo(()=>t.onSuccess(e))})),zs=e=>js(e,ho),Bs=a(2,(e,t)=>js(e,e=>uo(()=>t(e)))),Vs=a(e=>St(e[0]),(e,t)=>{if(!t?.log)return Xs(e,{onFailure:e=>_o,onSuccess:e=>_o});let n=Dl(t.log===!0?void 0:t.log);return Gs(e,{onFailure(e){let r=Hee(e);return Ir(r)?co(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>_o})}),Hs=a(e=>St(e[0]),(e,t)=>{if(!t?.log)return Gs(e,{onFailure:e=>_o,onSuccess:e=>_o});let n=Dl(t.log===!0?void 0:t.log);return Gs(e,{onFailure:e=>t.message===void 0?n(e):n(t.message,e),onSuccess:e=>_o})}),Us=e=>Zs(e,{onFailure:Rn,onSuccess:zn}),Ws=e=>Qs(e,{onFailure:Pr,onSuccess:Nr}),Gs=a(2,(e,t)=>new qs(e,t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),t.onFailure.length===1?t.onFailure:e=>t.onFailure(e))),Ks=Ut({op:`OnSuccessAndFailure`,[ht]:No}),qs=function(e,t,n){this[mt]=e,this[gt]=t,this[_t]=n};qs.prototype=Ks;var Js=function(e,t){let n=this.payload;return t.succeedWith(Ro?n.onSuccess(e):st(()=>n.onSuccess(e)))},Ys=((e,t)=>{let n=Ut({op:e,[ht]:No,[gt]:Js,[_t]:t}),r=function(e,t){this[mt]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(Bt);if(n===void 0)return co(e);let r=this.payload;return t.succeedWith(Ro?r.onFailure(n.error):st(()=>r.onFailure(n.error)))}),Xs=a(2,(e,t)=>Gs(e,{onFailure:e=>{let n=e.reasons.find(Bt);return n?t.onFailure(n.error):co(e)},onSuccess:t.onSuccess})),Zs=a(2,(e,t)=>new Ys(e,t)),Qs=a(2,(e,t)=>{if(Xo(e)){if(e._tag===`Success`)return Kt(t.onSuccess(e.value));let n=za(e.cause);return Ir(n)?e:Kt(t.onFailure(n.success))}return Zs(e,t)}),$s=e=>Xo(e)?Kt(e):ec(e),ec=Wt({op:`Exit`,[ht](e){return e._stack.push(this),this[mt]},[gt](e,t,n){return t.succeedWith(n??Kt(e))},[_t](e,t,n){return t.succeedWith(n??Yt(e))}}),tc=a(2,(e,t)=>Wo(ll(t),e)),nc=a(2,(e,t)=>Yo(ac(e,t.duration),e=>Bn(e)?t.orElse():so(e.value))),rc=e=>new fl(`Operation timed out after '${Xi(e)}'`),ic=a(2,(e,t)=>{let n=yi(t);return nc(e,{duration:n,orElse:()=>lo(rc(n))})}),ac=a(2,(e,t)=>Jo(Uo(e),Mo(ll(t),Rn()))),oc=`~effect/Scope`,sc=`~effect/Scope/Closeable`,cc=rr(`effect/Scope`),lc=(e,t)=>Qt(n=>{let r=uc(e,t);return r===void 0?_o:(kte(n),r)}),uc=(e,t)=>{let n=e.state;if(n._tag===`Closed`||(e.state={_tag:`Closed`,exit:t},e.parent!==void 0&&yc(e.parent,e),n._tag===`Empty`))return;if(n.finalizer!==void 0)return dc(n.finalizer,t);let r=n.finalizers;return r.size===1?dc(r.values().next().value,t):pc(e,r,t)},dc=(e,t)=>{try{return e(t)}catch(e){return Zt(e)}},fc=(e,t)=>as(e)?t:Es(t,t=>co(Pt(e.cause,t))),pc=wo(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=Qa();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*$s(dc(s,n))):i.push(Vc(o,dc(s,n),!0,!0,`inherit`))}return i.length>0&&(r=yield*ro(i)),yield*ms(r)}),mc=(e,t)=>uo(()=>hc(e,t)),hc=(e,t)=>{let n=xc(t,e);return e.state._tag===`Closed`?(n.state=e.state,n):(vc(e,n,e=>lc(n,e)),n)},gc=(e,t)=>fo(()=>e.state._tag===`Closed`?t(e.state.exit):(vc(e,{},t),_o)),_c=(e,t)=>gc(e,s(t)),vc=(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))}},yc=(e,t)=>{if(e.state._tag!==`Open`)return;let n=e.state;n.finalizerKey===t?e.state=Sc:n.finalizers!==void 0&&(n.finalizers.delete(t),n.finalizers.size===0&&(e.state=Sc))},bc=e=>xc(e,void 0),xc=(e=`sequential`,t)=>({[sc]:sc,[oc]:oc,strategy:e,parent:t,state:Sc}),Sc={_tag:`Empty`},fte=e=>uo(()=>bc(e)),Cc=cc,pte=Ss(cc),mte=e=>Qt(t=>{let n=t.context,r=bc();return t.setContext(_r(t.context,cc,r)),Dc(t,e=>(t.setContext(n),uc(r,e))),e}),wc=e=>fo(()=>{let t=bc();return Oc(e(t),e=>fo(()=>uc(t,e)??_o))}),hte=(e,t,n)=>bs(r=>Nc(i=>Yo(Cc,a=>Go(n?.interruptible?i(e):e,e=>gc(a,n=>xs(t(e,n),r)))))),gte=e=>Yo(Cc,t=>bs(n=>gc(t,t=>xs(e(t),n)))),Tc=function(){let e=Ut({op:`OnExit`,[ht](e){return e._stack.push(this),this.effect},[vt](e){e.interruptible&&this.interruptible!==!0&&(e._stack.push(jc),e.interruptible=!1)},[gt](e,t,n){n??=Kt(e);let r;try{r=this.onExit(n)}catch(e){r=Zt(e)}return r?Yo(r,e=>n):n},[_t](e,t,n){n??=Yt(e);let r;try{r=this.onExit(n)}catch(e){r=Zt(e)}return r?Yo(fc(n,r),e=>n):n}}),t=function(e,t,n){this.effect=e,this.onExit=t,this.interruptible=n};return t.prototype=e,t}(),Ec=(e,t,n)=>new Tc(e,t,n),Dc=(e,t)=>{e._stack.push(new Tc(void 0,t,void 0))},Oc=a(2,Ec),_te=a(2,(e,t)=>Oc(e,e=>t)),vte=a(3,(e,t,n)=>Oc(e,e=>{let r=t(e);return Ir(r)?_o:n(r.success,e)})),yte=a(2,(e,t)=>vte(e,ss,t)),bte=a(3,(e,t,n)=>Oc(e,e=>{if(e._tag!==`Failure`)return _o;let r=t(e.cause);return Ir(r)?_o:n(r.success,e.cause)})),xte=a(2,(e,t)=>bte(Va,t)(e)),Ste=(e,t,n)=>Nc(r=>Yo(e,e=>Ec(fo(()=>r(t(e))),t=>n(e,t),!0))),Cte=s(1/0),wte=(e,t)=>{let n=0,r,i,a=(e,t)=>(t.awaiters++,Dc(e,()=>{if(!(--t.awaiters>0||i!==t))return i=void 0,ao(t.fiber)}),io(t.fiber));return[Qt(o=>{if(i!==void 0)return a(o,i);if(r!==void 0&&(n===1/0||o.getRef(il).currentTimeMillisUnsafe()<n))return r;r=void 0;let s=o.getRef(il),c={fiber:void 0,awaiters:0};return i=c,c.fiber=Vc(o,Ec(e,e=>{if(i!==c||(i=void 0,cs(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)}),uo(()=>{r=void 0})]},Tte=e=>uo(()=>wte(e,Cte)[0]),Ete=Qt(e=>co(Ra(e.id))),kc=e=>Qt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(jc),e):e),Ac=Wt({op:`SetInterruptible`,[vt](e){if(e.interruptible=this[mt],e._interruptedCause&&e.interruptible)return()=>co(e._interruptedCause)}}),jc=Ac(!0),Dte=Ac(!1),Ote=e=>{if(e.interruptible=!0,e._stack.push(Dte),e._interruptedCause)return co(e._interruptedCause)},kte=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(jc))},Mc=e=>Qt(t=>t.interruptible?e:Ote(t)??e),Nc=e=>Qt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(jc),e(Mc)):e(o)),Pc=(e,t)=>L(e)?t?.mode===`result`?Ic(e,Ws,t):Ic(e,o,t):t?.discard?t.mode===`result`?Ic(Object.values(e),Ws,t):Ic(Object.values(e),o,t):fo(()=>{let n={};return Mo(Ic(Object.entries(e),([e,r])=>$o(t?.mode===`result`?Ws(r):r,t=>{ct(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),Fc=Wt({op:`While`,[gt](e,t){return this[mt].step(e),this[mt].while()?(t._stack.push(this),this[mt].body()):ls},[ht](e){return this[mt].while()?(e._stack.push(this),this[mt].body()):ls}}),Ic=a(e=>typeof e[1]==`function`,(e,t,n)=>fo(()=>{let r=Lc(n?.concurrency);if(r===1)return Ate(e,t,n);let i=Zr(e),a=i.length;if(a===0)return n?.discard?_o:so([]);let o=n?.discard?void 0:Array(a),s=jte({f:t,out:o},i,{concurrency:r});return s?Mo(s,o):so(o)})),Ate=(e,t,n)=>fo(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return Mo(Fc({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),Lc=e=>e===`unbounded`?1/0:Math.max(1,e??1),Rc=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>Yo($s(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??_o),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!Xo(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},zc=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=Zt(e);return f=t,c=!0,u&&u.size>0?Yo(kc(oo(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(Xo(g)){if(f=n(e,o,g,a),f)break}else if(l){p=void 0;let t=Vc(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=Nt(e);f=Yt(f._tag===`Failure`?Pt(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??_o)}catch(e){d(m(e))}}),u.size<s)continue;i=!0,a++;return}else return xo(e=>{l=Qa(),u=new Set,p=g,d=e;let t;try{t=h()}catch(t){return e(m(t))}return t?e(t):fo(()=>(f??=ls,Yo(u?oo(u):_o,()=>f?._tag===`Failure`?f:_o)))})}if(c=!0,f){if(u&&u.size>0){let e=to(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(_o);else return ls}};return h()}},Bc=()=>e=>zc(e),jte=zc({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)}}),Mte=a(e=>St(e[0]),(e,t)=>Qt(n=>(Ml(),so(Vc(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),Vc=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new $a(a.context,o);return n?s.evaluate(t):(s._asyncContext=Za(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),!r&&!s._exit&&(a.children().add(s),s._parent=a),s},Nte=a(e=>St(e[0]),(e,t)=>Qt(n=>so(Vc(n,e,t?.startImmediately,!0,t?.uninterruptible)))),Hc=a(e=>St(e[0]),(e,t,n)=>Qt(r=>{let i=Vc(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit){if(t.state._tag!==`Closed`){let e={};vc(t,e,()=>vo(e=>e===i.id?_o:ao(i))),i.addObserver(()=>yc(t,e))}else i.interruptUnsafe(r.id,to(r))}return so(i)})),Pte=a(e=>St(e[0]),(e,t)=>Yo(Cc,n=>Hc(e,n,t))),Uc=e=>(t,n)=>{let r=new $a(n?.scheduler?_r(e,ta,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},Fte=a(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return vc(t,n,()=>ao(e)),e.addObserver(()=>yc(t,n)),e}),Ite=Uc(hr()),Wc=e=>{let t=Uc(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},Lte=Wc(hr()),Gc=e=>{let t=Uc(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Rte=Gc(hr()),Kc=e=>{let t=Gc(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw Ha(e.cause);return e.value})},zte=Kc(hr()),qc=e=>{let t=Uc(e);return e=>{if(Xo(e))return e;let n=new oa(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Zt(new $te(r))}},Bte=qc(hr()),Jc=e=>{let t=qc(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw Ha(n.cause);return n.value}},Vte=Jc(hr()),Yc=so(!0),Xc=so(!1),Hte=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return Yc;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=[],Yc}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](ls)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](ls)}open=Qt(e=>this._isOpen?Xc:(this._isOpen=!0,this.scheduleUnsafe(e)));release=Qt(e=>this._isOpen?Xc:this.scheduleUnsafe(e));openUnsafe(){return!this._isOpen&&(this._isOpen=!0,this.flushWaiters(),!0)}await=xo(e=>this._isOpen?e(_o):(this.waiters.push(e),uo(()=>{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=uo(()=>this.closeUnsafe());whenOpen=e=>Yo(this.await,()=>e);isOpen(){return this._isOpen}},Zc=e=>new Hte(e??!1),Ute=e=>uo(()=>Zc(e)),Qc=BigInt(0),Wte={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Qc,endTime:Qc,exit:ls},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},Gte=e=>Object.assign(Object.create(Wte),e),$c=e=>e?Sr(e.annotations,Ta)?e._tag===`Span`?$c(Gn(e.parent)):Rn():zn(e):Rn(),el=(e,t,n)=>{let r=!e.cache.tracerEnabled||n?.annotations&&Sr(n.annotations,Ta),i=n?.parent===void 0?n?.root?Rn():$c(e.cache.span):zn(n.parent),a;if(r)a=Gte({name:t,parent:i,annotations:_r(n?.annotations??hr(),Ta,!0)});else{let r=e.cache.tracer??ka,o=e.getRef(il),s=e.getRef(Pa),c=e.getRef(Pee),l=e.getRef(Fee),u=n?.level??e.getRef(Ea),d=n?.links===void 0?l.length===0?[]:l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??hr(),links:d,startTime:s?o.currentTimeNanosUnsafe():Qc,kind:n?.kind??`internal`,root:n?.root??Bn(i),sampled:n?.sampled??(Vn(i)&&i.value.sampled===!1?!1:!bl(e.getRef(Da),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},Kte=(e,t)=>kc(Qt(n=>{let r=xr(n.context,cc),i=el(n,e,t??{}),a=n.getRef(il),o=n.getRef(Pa);return Mo(gc(r,e=>tl(i,e,a,o)),i)})),qte=(e,t)=>(t=typeof t==`function`?t:u,_s(Ma,n=>({name:e,stack:t,parent:n}))),tl=(e,t,n,r)=>uo(()=>{e.status._tag!==`Ended`&&e.end(r?n.currentTimeNanosUnsafe():Qc,t)}),nl=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return Qt(t=>{let i=el(t,e,n),a=t.getRef(il),o=t.getRef(Pa);return Dc(t,e=>tl(i,e,a,o)),r(i)})},rl=Ss(Ca),Jte=function(){let e=St(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=o;return t._tag===`Span`&&(n=zee(n),r=qte(t.name,n?.captureStackTrace)),e?rl(r(arguments[0]),t):e=>rl(r(e),t)},Yte=(...e)=>Qt(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 _o}),il=kr(`effect/Clock`,{defaultValue:()=>new Xte}),al=2**31-1,Xte=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=uo(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Zte()}currentTimeNanos=uo(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return sl()}monotonicTimeNanos=uo(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(Bi(e))}sleepMillis(e){return e<=0?po:Number.isFinite(e)?xo(t=>{let n=e>al?this.sleepMillis(e-al):_o,r=setTimeout(()=>t(n),Math.min(e,al));return uo(()=>clearTimeout(r))}):So}},ol=BigInt(1e6),sl=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())*ol;return e>t&&(t=e),t}}(),Zte=function(){let e=BigInt(1e9),t;return()=>{let n=sl(),r=BigInt(Date.now())*ol;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}}(),cl=e=>Qt(t=>e(t.getRef(il))),ll=e=>cl(t=>t.sleep(yi(e))),ul=cl(e=>e.currentTimeMillis),dl=`~effect/Cause/TimeoutError`,fl=class extends tn(`TimeoutError`){[dl]=dl;constructor(e){super({message:e})}},pl=`~effect/Cause/IllegalArgumentError`,ml=class extends tn(`IllegalArgumentError`){[pl]=pl;constructor(e){super({message:e})}},hl=`~effect/Cause/ExceededCapacityError`,Qte=class extends tn(`ExceededCapacityError`){[hl]=hl;constructor(e){super({message:e})}},gl=`~effect/Cause/AsyncFiberError`,$te=class extends tn(`AsyncFiberError`){[gl]=gl;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},_l=`~effect/Cause/UnknownError`,vl=class extends tn(`UnknownError`){[_l]=_l;constructor(e,t){super({message:t,cause:e})}},yl=kr(`effect/Console`,{defaultValue:()=>globalThis.console}),bl=Pn(dee(Mn,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}})),xl=kr(`effect/Logger/CurrentLoggers`,{defaultValue:()=>new Set([Al,jl])}),Sl=kr(`effect/Logger/LogToStderr`,{defaultValue:l}),Cl={"~effect/Logger":{_Message:o,_Output:o},pipe(){return n(this,arguments)}},wl=e=>{let t=Object.create(Cl);return t.log=e,t},Tl=e=>e.replace(/[\s="]/g,`_`),El=(e,t)=>`${Tl(e[0])}=${t-e[1]}ms`,Dl=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];Et(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?Nt(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=Ft),Qt(r=>{let i=e??r.cache.logLevel;if(bl(r.cache.minimumLogLevel,i))return _o;let a=r.getRef(il),o=r.getRef(xl);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 _o})},Ol={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Ol.gray,Ol.blue,Ol.green,Ol.yellow,Ol.red,Ol.bgBrightRed,Ol.black;var kl=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`)}`,Al=wl(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(Ka(e));let o=t.getTime(),s=n.getRef(Ree),c=``;for(let e of s)c+=` ${El(e,o)}`;let l=n.getRef(Fa);Object.keys(l).length>0&&a.push(l);let u=n.getRef(yl);(n.getRef(Sl)?u.error:u.log)(`[${kl(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),jl=wl(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(il),a=t.getRef(Fa),o=t.cache.span;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))ct(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=Ka(e)),o.event(et(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)});function Ml(){eo.interruptChildren??=ite}var Nl=so(void 0),Pl=Et,Fl=Dt,Il=Bt,Ll=Nt,Rl=It,ene=Rt,tne=Ra,zl=e=>new Mt(e),Bl=e=>new Lt(e),nne=Vee,rne=Kee,Vl=qee,Hl=Pt,Ul=Ha,Wl=za,Gl=Uee,Kl=Ba,ql=Wee,Jl=Va,Yl=Ka,Xl=nee,Zl=an,Ql=iee,$l=ml,eu=Qte,tu=vl,nu=zt,ru=Ct,iu=Kt,au=Yt,ou=Xt,su=Zt,cu=is,lu=ls,uu=as,du=os,fu=cs,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=()=>uo(()=>hu()),_u=e=>xo(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),uo(()=>{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)=>uo(()=>bu(e,t))),ine=a(2,(e,t)=>vu(e,Xt(t))),ane=a(2,(e,t)=>vu(e,Yt(t))),one=a(2,(e,t)=>ane(e,Ra(t))),yu=a(2,(e,t)=>vu(e,Kt(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},sne=a(2,(e,t)=>Nc(n=>Yo($s(n(e)),e=>vu(t,e)))),cne=Fa,xu=cc,lne=fte,Su=bc,Cu=pte,wu=gc,Tu=_c,Eu=mc,Du=hc,Ou=lc,une=`~effect/Layer`,ku=`~effect/Layer/MemoMap`,dne=(e,t)=>{let n={observers:0,deferred:hu(),scope:Su(),finalizer:r=>fo(()=>--n.observers>0?_o:(e.map.delete(t),Ou(n.scope,r)))};return n},Au=(e,t)=>t.state._tag!==`Closed`&&(e.observers++,vc(t,{},e.finalizer),!0),fne={[une]:{_ROut:o,_E:o,_RIn:o},pipe(){return n(this,arguments)}},ju=e=>{let t=Object.create(fne);return t.build=e,t},Mu=e=>ju((t,n)=>{let r=Du(n);return Oc(e(t,r),e=>e._tag===`Failure`?Ou(r,e):_o)}),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 fo(()=>{let r;return Ec(fo(()=>{let i=this.get(e,t);if(i)return i;let a=dne(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 rr()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=yr(t,e);return n?Iu(n):Fu()}},Ru=a(3,(e,t,n)=>Ss($o(e.build(t,n),_r(Lu,t)),Lu,t)),zu=e=>Qt(t=>Ru(e,Lu.forkOrCreate(t.context),xr(t.context,xu))),Bu=a(2,(e,t)=>Qt(n=>Ru(e,Lu.forkOrCreate(n.context),t))),Vu=function(){return arguments.length===1?e=>Hu(gr(arguments[0],e)):Hu(gr(arguments[0],arguments[1]))},Hu=e=>ju(s(so(e))),Uu=Hu(hr()),Wu=function(){return arguments.length===1?e=>Gu(()=>gr(arguments[0],e())):Gu(()=>gr(arguments[0],arguments[1]()))},Gu=e=>Nu(s(uo(e))),Ku=function(){return arguments.length===1?e=>qu(arguments[0],e):qu(arguments[0],arguments[1])},qu=(e,t)=>Ju($o(t,t=>gr(e,t))),Ju=e=>Nu((t,n)=>Cu(e,n)),Yu=e=>Ju(Mo(e,hr())),Xu=(e,t,n)=>{let r=Du(n,`parallel`);return Ic(e,e=>e.build(t,Du(r,`sequential`)),{concurrency:e.length}).pipe($o(e=>Or(...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)=>Yo(Array.isArray(t)?Xu(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(xs(t),$o(e=>n(e,t))))),ed=a(2,(e,t)=>$u(e,t,o)),td=a(2,(e,t)=>$u(e,t,(e,t)=>Dr(t,e))),nd=e=>ju((t,n)=>e.build(Fu(),n)),rd=il,id=ul,ad=`~effect/DateTime`,od=`~effect/DateTime/TimeZone`,sd={[ad]:ad,pipe(){return n(this,arguments)},[Qe](){return this.toString()},toJSON(){return Nd(this).toJSON()}},cd={...sd,_tag:`Utc`,[te](){return se(this.epochMilliseconds)},[ye](e){return pd(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Nd(this).toJSON()})`}},ld={...sd,_tag:`Zoned`,[te](){return ie(se(this.epochMilliseconds))(R(this.zone))},[ye](e){return pd(e)&&e._tag===`Zoned`&&this.epochMilliseconds===e.epochMilliseconds&&be(this.zone,e.zone)},toString(){return`DateTime.Zoned(${Jd(this)})`}},ud={[od]:od,[Qe](){return this.toString()}},dd={...ud,_tag:`Named`,[te](){return ce(`Named:${this.id}`)},[ye](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=jn((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=Kn(bd),Cd=$o(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)=>Fi(Rd(t)-Rd(e))),Md=Pn(_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)=>As(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?Pr(e):n?Pr(Ll(e.reasons.filter(e=>!$d(e)))):Nr(t)},tf=e=>{let t=ef(e);return Ir(t)?t:Nr(t.success.value)},nf=e=>{let t=ef(e);return Ir(t)?au(t.failure):iu(t.success.value)},rf=a(2,(e,t)=>Gs(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=ef(e);return Ir(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),af=`~effect/Schedule`,of=kr(`effect/Schedule/CurrentMetadata`,{defaultValue:s({input:void 0,output:void 0,duration:ji,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($o(e,e=>{let t=lf();return(n,r)=>e(t(n,r))})),df=e=>Es(e.step,e=>so(()=>co(e))),ff=e=>cl(t=>$o(df(e),e=>{let n=lf();return r=>fo(()=>{let i=t.currentTimeMillisUnsafe();return Yo(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,Mo(ll(t),a)})})})),pf=e=>cf($o(Pc(e.map(df)),e=>(t,n)=>Yo(Ic(e,e=>rf(e(t,n),{onSuccess:e=>so(e[1]),onDone:()=>Nl,onFailure:co})),e=>{let t=mf(e);return t===void 0?Ql(ji):so([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:Ki(t,r))}return t},hf=(e,t=2)=>{let n=Bi(yi(e));return uf(so(e=>{let r=Fi(n*t**(e.attempt-1));return so([r,r])}))},gf=e=>{let t=yi(e);return uf(so(e=>so([e.attempt-1,t])))},_f=a(2,(e,t)=>cf($o(df(e),e=>{let n=lf();return(r,i)=>Go(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:yi(t.duration);return yf(e,({attempt:e,elapsed:r})=>so((t.times===void 0||e<=t.times)&&(n===void 0||qi(Fi(r),n))))}),yf=a(2,(e,t)=>cf($o(df(e),e=>{let n=lf();return(r,i)=>Yo(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return Yo(St(s)?s:so(s),t=>t?so(e):Ql(a))})}))),bf=gf(ji),xf=()=>e=>e,Sf=(e,t,n)=>wc(r=>Yo(n?.local?Ru(t,Fu(),r):Bu(t,r),t=>xs(e,t))),Cf=a(e=>St(e[0]),(e,t,n)=>pr(t)?xs(e,t):Sf(e,Array.isArray(t)?Zu(...t):t,n)),wf=a(3,(e,t,n)=>Yo(ff(t),t=>{let r=of.defaultValue(),i,a=js(fo(()=>Ss(e,of,r)),e=>(i=e,Yo(t(e),e=>(r=e,a))));return Zd(a,e=>st(()=>n(i,e)))})),Tf=St,Ef=Pc,Df=Ic,Of=Fc,kf=ute,Af=dte,z=so,jf=mo,Mf=fo,B=uo,Nf=_o,Pf=Nl,Ff=xo,If=So,V=Co,H=lo,Lf=co,Rf=cte,zf=ho,Bf=lte,Vf=po,Hf=Qt,pne=ste,Uf=Yo,Wf=Qo,Gf=Wo,Kf=Go,qf=Ws,mne=Us,Jf=$s,Yf=$o,Xf=Mo,Zf=Uo,Qf=Ko,$f=js,ep=Is,tp=Es,hne=ks,np=Ls,rp=zs,ip=Ps,gne=Ms,_ne=wf,ap=Vs,vne=Hs,yne=Bs,op=ic,sp=ac,cp=nc,bne=tc,lp=ll,up=Jo,xne=ws,dp=Zs,fp=Gs,Sne=Xs,pp=vs,mp=bs,hp=Cf,gp=xs,Cne=hs,_p=gs,vp=Ss,yp=Cc,bp=mte,wne=wc,xp=hte,Sp=Ste,Cp=gte,wp=_te,Tp=yte,Ep=Oc,Dp=Tte,Op=Ete,kp=Mc,Ap=xte,jp=kc,Mp=Nc,Np=Ts,Tne=Yte,Ene=Kte,Pp=nl,Fp=Jte,Ip=Mte,Lp=Hc,Rp=Pte,Dne=Nte,zp=Ite,Bp=Uc,Vp=Wc,One=Lte,Hp=zte,kne=Kc,Up=Rte,Ane=Gc,Wp=Vte,Gp=Jc,Kp=Bte,jne=qc,qp=wo,Jp=Do,Yp=cl,Xp=Dl(`Error`),Mne=a(e=>Tf(e[0]),(e,...t)=>_s(e,cne,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||ct(n,t[0],t[1]),n})),Zp=es,Qp=ts,$p=ns,em=Zo,Nne=rs,Pne=ko,tm=`~effect/BigDecimal`,Fne={[tm]:tm,[te](){let e=im(this);return ie(ce(String(e.value)),se(e.scale))},[ye](e){return Ine(e)&&Une(this,e)===0},toString(){return`BigDecimal(${Wne(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Qe](){return this.toJSON()},pipe(){return n(this,arguments)}},Ine=e=>F(e,tm),Lne=(e,t)=>{if(!Number.isSafeInteger(t))throw RangeError(`Scale must be a safe integer, got ${t}`);let n=Object.create(Fne);return n.value=e,n.scale=t,n},nm=(e,t)=>{let n=Lne(e,t);return n.normalized=n,n},rm=BigInt(0),Rne=BigInt(1),zne=BigInt(10),Bne=nm(rm,0),im=e=>{if(e.normalized===void 0){if(e.value===rm)e.normalized=Bne;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},Vne=100,Hne=[Rne],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 uee(n.padEnd(a,`0`),r.padEnd(a,`0`))},Une=(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>Vne)return n===-1?om(t,e):om(e,t);let o=Hne[a]??=zne**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,Wne=e=>{let t=im(e);if(Math.abs(t.scale)>=16)return Gne(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},Gne=e=>{if(Kne(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}`},Kne=e=>e.value===rm,qne=BigInt(1),cm=BigInt(1e3),lm=BigInt(1024),um=[{symbol:`B`,factor:qne,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`]}],Jne=[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,...Jne.slice(1)];var Yne=pd,Xne=gd,dm=bd,Zne=Sd,Qne=Cd,$ne=wd,ere=Td,fm=Ed,tre=Ad,nre=jd,rre=Md,pm=Fd,mm=Gd,ire=Kd,hm=e=>are(typeof e==`string`?_m.encode(e):e),gm=e=>{let t=vm(e),n=t.length;if(n%4!=0)return Pr(new ha({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 Pr(new ha({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=xm(t.charCodeAt(e))<<18|xm(t.charCodeAt(e+1))<<12|xm(t.charCodeAt(e+2))<<6|xm(t.charCodeAt(e+3));r[i]=n>>16,r[i+1]=n>>8&255,r[i+2]=n&255}return Nr(r)}catch(e){return Pr(new ha({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},are=e=>{let t=e.length,n=``,r=2;for(;r<t;r+=3)n+=ym[e[r-2]>>2],n+=ym[(e[r-2]&3)<<4|e[r-1]>>4],n+=ym[(e[r-1]&15)<<2|e[r]>>6],n+=ym[e[r]&63];return r===t+1&&(n+=ym[e[r-2]>>2],n+=ym[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=ym[e[r-2]>>2],n+=ym[(e[r-2]&3)<<4|e[r-1]>>4],n+=ym[(e[r-1]&15)<<2],n+=`=`),n},_m=new TextEncoder,vm=e=>e.replace(/[\n\r]/g,``),ym=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,bm=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)bm[ym.charCodeAt(e)]=e;bm[61]=0;var xm=e=>{if(e>=bm.length||bm[e]===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return bm[e]},Sm=`~effect/HashMap`,Cm=5,wm=32,Tm=wm/4,Em=wm/2,Dm=31,Om=e=>(e-=e>>>1&1431655765,e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),km=(e,t)=>e>>>t&Dm,Am=(e,t)=>1<<km(e,t),jm=(e,t)=>Om(e&t-1);function Mm(e,t,n,r,i,a){if(t>32)throw Error(`HashMap: max depth exceeded`);let o=Am(n,t),s=Am(i,t);return o===s?new Bm(e,o,[Mm(e,t+Cm,n,r,i,a)]):new Bm(e,o|s,o>>>0<s>>>0?[r,a]:[a,r])}var Nm=ce(`HashMap`),Pm=(e,t)=>ie(R(e),R(t)),Fm=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e[n];r&&(t^=r.subtreeHash())}return t},Im=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}},Lm=class extends Im{_tag=`EmptyNode`;edit=0;get size(){return 0}get(e,t,n){return Rn()}has(e,t,n){return!1}set(e,t,n,r,i,a){return a.value=!0,new Rm(e,n,r,i)}remove(e,t,n,r,i){return this}canEdit(e){return!1}computeHash(){return 0}},Rm=class e extends Im{_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&&be(this.key,n)?zn(this.value):Rn()}has(e,t,n){return this.hash===t&&be(this.key,n)}set(t,n,r,i,a,o){if(this.canEdit(t)&&(this._hash=void 0),this.hash===r&&be(this.key,i))return be(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 zm(t,r,[[this.key,this.value],[i,a]]);let s=Am(r,n),c=Am(this.hash,n);return s===c?new Bm(t,s,[this.set(t,n+Cm,r,i,a,o)]):new Bm(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&&be(this.key,r)){i.value=!0;return}return this}computeHash(){return Pm(this.key,this.value)}},zm=class e extends Im{_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 Rn();for(let[e,t]of this.entries)if(be(e,n))return zn(t);return Rn()}has(e,t,n){if(this.hash!==t)return!1;for(let[e]of this.entries)if(be(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,Mm(t,n,this.hash,this,r,new Rm(t,r,i,a));for(let n=0;n<this.entries.length;n++)if(be(this.entries[n][0],i)){if(be(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])=>be(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 Rm(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^=Pm(t[n][0],t[n][1]);return e}},Bm=class e extends Im{_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=Am(t,e);if((this.bitmap&r)===0)return Rn();let i=jm(this.bitmap,r);return this.children[i].get(e+Cm,t,n)}has(e,t,n){let r=Am(t,e);if((this.bitmap&r)===0)return!1;let i=jm(this.bitmap,r);return this.children[i].has(e+Cm,t,n)}set(t,n,r,i,a,o){this.canEdit(t)&&(this._hash=void 0);let s=Am(r,n),c=jm(this.bitmap,s);if((this.bitmap&s)!==0){let s=this.children[c],l=s.set(t,n+Cm,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 Rm(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>Em?this.expand(t,l,this.children):this;let u=[...this.children];return u.splice(c,0,n),u.length>Em?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=Am(r,n);if((this.bitmap&o)===0)return this;let s=jm(this.bitmap,o),c=this.children[s],l=c.remove(t,n+Cm,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(wm),i=0;for(let e=0;e<wm;e++)t&1<<e&&(r[e]=n[i++]);return new Vm(e,n.length,r)}computeHash(){return Fm(this.children)}},Vm=class e extends Im{_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=km(t,e),i=this.children[r];return i?i.get(e+Cm,t,n):Rn()}has(e,t,n){let r=km(t,e),i=this.children[r];return i?i.has(e+Cm,t,n):!1}set(t,n,r,i,a,o){this.canEdit(t)&&(this._hash=void 0);let s=km(r,n),c=this.children[s];if(c){let l=c.set(t,n+Cm,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 Rm(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=km(r,n),s=this.children[o];if(!s)return this;let c=s.remove(t,n+Cm,r,i,a);if(!a.value)return this;let l=this.count-+!c;if(l<Tm)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 Bm(e,i,r)}computeHash(){return Fm(this.children)}},Hm=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}},Um=(e,t)=>[e,t],Wm=(e,t)=>t,Gm=class{[Sm]=Sm;_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 Hm(this._root,Um)}[ye](e){if(qm(e)){let t=e;if(this.size!==t.size)return!1;for(let[t,n]of this){let r=f(e,Ym(t));if(Bn(r)||!be(n,r.value))return!1}return!0}return!1}[te](){return ae(Nm^this._root.subtreeHash())}[Qe](){return $e(this)}toString(){return`HashMap(${We(Array.from(this))})`}toJSON(){return{_id:`HashMap`,values:Array.from(this).map(([e,t])=>[$e(e),$e(t)])}}pipe(){return n(this,arguments)}},Km=new Lm,qm=e=>F(e,Sm),Jm=()=>new Gm(!1,0,Km,0),Ym=a(2,(e,t)=>e._root.get(0,R(t),t)),Xm=(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 Gm(!1,i._edit,s,i._size+ +!!a.value)},Zm=a(3,(e,t,n)=>Xm(e,t,R(t),n)),Qm=e=>new Hm(e._root,Wm),$m=(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??Km,r._size--,e):o===void 0?Jm():new Gm(!1,r._edit,o,r._size-1):e},eh=a(2,(e,t)=>$m(e,t,R(t))),th=Jm,nh=Zm,rh=Qm,ih=eh,ah=`~effect/http/Cookies`,oh=`~effect/http/Cookies/Cookie`,sh={[ah]:ah,...tt,toJSON(){return{_id:`effect/Cookies`,cookies:Kr(this.cookies,e=>e.toJSON())}},pipe(){return n(this,arguments)}},ch=e=>{let t=Object.create(sh);return t.cookies=e,t},lh=e=>{let t={};for(let n of e)ct(t,n.name,n);return ch(t)},uh=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=dh(e.trim());t&&n.push(t)}return lh(n)};function dh(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(!fh.test(r))return;let i=t[0].slice(n+1),a=mh(i);if(t.length===1)return Object.assign(Object.create(ph),{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=Ii(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(ph),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var fh=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,ph={[oh]:oh,...tt,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},mh=e=>{try{return decodeURIComponent(e)}catch{return e}},hh=new WeakMap,gh=e=>{if(hh.has(e))return hh.get(e);throw Error(`Unable to get redacted value`+(e.label?` with label: "${e.label}"`:``))},_h=`~effect/Redacted`,vh=e=>F(e,_h),yh=(e,t)=>{let n=Object.create(bh);return t?.label&&(n.label=t.label),hh.set(n,e),n},bh={[_h]:{_A:e=>e},label:void 0,...bt,toJSON(){return this.toString()},toString(){return`<redacted${x(this.label)?`:`+this.label:``}>`},[te](){return R(hh.get(this))},[ye](e){return vh(e)&&be(hh.get(this),hh.get(e))}},xh=gh,Sh=e=>ln((t,n)=>e(xh(t),xh(n))),Ch=Symbol.for(`~effect/http/Headers`),wh=Object.defineProperties(Object.create(null),{[Ch]:{value:Ch},[Le]:{value(e){return Ph(this,Sr(e,Ih))}},toJSON:{value(){return ze(this)}},[ye]:{value(e){return Eh(this,e)}},[te]:{value(){return ue(this)}},toString:{value:tt.toString},[Qe]:{value:tt[Qe]}}),Th=e=>Object.assign(Object.create(wh),e),Eh=Yr(un()),Dh=Object.create(wh),Oh=e=>{if(e===void 0)return Dh;if(Symbol.iterator in e){let t=Object.create(wh);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(wh);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},kh=e=>Object.setPrototypeOf(e,wh),Ah=a(3,(e,t,n)=>{let r=Th(e);return r[t.toLowerCase()]=n,r}),jh=a(2,(e,t)=>Th({...e,...Oh(t)})),Mh=a(2,(e,t)=>{let n=Th(e);return Object.assign(n,t),n}),Nh=a(2,(e,t)=>{let n=Th(e);return delete n[t.toLowerCase()],n}),Ph=a(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=yh(e[r]))}else for(let r in e)r.search(t)!==-1&&(n[r]=yh(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),Fh=(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},Ih=kr(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),Lh=`~effect/http/UrlParams`,Rh=e=>F(e,Lh),zh={...bt,[Lh]:Lh,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[ye](e){return Uh(this,e)},[te](){return fe(this.params.flat())}},Bh=e=>{let t=Object.create(zh);return t.params=e,t},Vh=e=>{if(Rh(e))return e;let t=Hh(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 Bh(n)},Hh=e=>{let t=typeof e[Symbol.iterator]==`function`?Zr(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=Hh(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},Uh=ln((e,t)=>Wh(e.params,t.params)),Wh=Dee(Br([un(),un()])),Gh=Bh([]),Kh=a(2,(e,t)=>Bh(t(e.params))),qh=a(2,(e,t)=>{let n=Vh(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 Bh(n)}),Jh=a(2,(e,t)=>Kh(e,ti(Vh(t).params))),Yh=e=>new URLSearchParams(Vh(e).params).toString(),Xh=e=>{let t={};for(let[n,r]of e.params)if(!Object.hasOwn(t,n))ct(t,n,r);else{let e=t[n];typeof e==`string`?ct(t,n,[e,r]):e.push(r)}return t};function Zh(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Qh(e){return t=>Zh(t)?.[e]}var $h=`~structural`,eg=`~sentinels`,tg=`~constructor`,ng=m(e=>{let t=Zh(e)?.identifier;return typeof t==`string`?t:e.getExpected(ng)}),rg=Symbol(),ig=iu,ag=ig(rg),og=ig(rg),sg=e=>e===rg?Rn():zn(e),cg=e=>e._tag===`None`?ag:ig(e.value),lg=`~effect/SchemaIssue/Issue`;function ug(e){return F(e,lg)&&e[lg]===lg}function dg(e){return Object.hasOwn(e,`input`)}var fg=class{[lg]=lg;constructor(e,t){t?.reportInput===!0&&e!==rg&&(this.input=e)}},pg=class extends fg{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},mg=class extends fg{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},hg=class extends fg{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},gg=class extends fg{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},_g=class extends fg{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},vg=class extends fg{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},yg=class extends fg{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},bg=class extends fg{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}};function xg(e,t,n,r,i){return new vg(e,[new hg([t],n)],r,i)}var Sg=class extends fg{_tag=`Forbidden`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},Cg=class extends fg{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},wg=class extends fg{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function Tg(e,t,n){if(ug(e))return e;if(typeof e==`string`)return new bg({message:e},t,n);let r=typeof e.issue==`string`?new bg({message:e.issue},t,n):e.issue;return new hg(e.path,r)}function Eg(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new bg(void 0,t,n):Tg(e,t,n)}function Dg(e,t,n,r){return Array.isArray(t)?ri(t)?t.length===1?Tg(t[0],n,r):new vg(e,si(t,e=>Tg(e,n,r)),n,r):void 0:Eg(t,n,r)}var Og=e=>{let t=zg(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Ng(ng(e.ast),e);case`InvalidValue`:{let t=Mg(e);if(t!==void 0)return Ng(t,e);let n=jg(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=jg(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=jg(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},kg=e=>zg(e.issue)??zg(e);function Ag(e){return t=>({issues:Pg(t,[],e?.leafHook??Og,e?.checkHook??kg)})}function jg(e){return dg(e)?We(e.input):void 0}function Mg(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function Ng(e,t){let n=jg(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Pg(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 Pg(e.issue,t,n,r);let a=Mg(e.issue);return[{path:t,message:a===void 0?Ng(Fg(e.filter),e):Ng(a,e.issue)}]}case`Encoding`:return Pg(e.issue,t,n,r);case`Pointer`:return Pg(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Pg(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:zg(e)??Ng(ng(e.ast),e)}]:e.issues.flatMap(e=>Pg(e,t,n,r));default:return[{path:t,message:n(e)}]}}function Fg(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=>Fg(e)).join(` & `)}}function Ig(){return e=>Rg(e,``)}var Lg=Ig();function Rg(e,t){let n;switch(e._tag){case`Filter`:{let r=kg(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Rg(e.issue,t);let r=Mg(e.issue);n=r===void 0?Ng(Fg(e.filter),e):Ng(r,e.issue)}break}case`Encoding`:return Rg(e.issue,t);case`Pointer`:return Rg(e.issue,t+qe(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Rg(e,t)).join(`
14
+ `);n=zg(e)??Ng(ng(e.ast),e);break;default:n=Og(e)}return t?`${n}\n at ${t}`:n}function zg(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return zg(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 Bg(e){let t;for(let n of e.reasons){if(!Il(n)||!ug(n.error))return;t??=n.error}return t}function Vg(e,t){let n=Bg(e);if(n===void 0)throw Error(t,{cause:e});return n}var Hg=e=>Object.assign(Object.create(r),e);function Ug(e){return Zg((t,n)=>H(e(t,n)))}function Wg(e){return Ug((t,n)=>{let r={message:e(t)};return Vn(t)?new Sg(r,t.value,n):new Sg(r)})}var Gg=Wg(()=>`Encoding is not supported`),Kg=Hg({_tag:`Passthrough`});function qg(){return Kg}function Jg(e){return Hg({_tag:`Transform`,transform:e})}function Yg(e){return Hg({_tag:`TransformEffect`,transform:e})}function Xg(e){return Hg({_tag:`TransformOptional`,transform:e})}function Zg(e){return Hg({_tag:`TransformOptionalEffect`,transform:e})}function Qg(){return Xg(()=>Rn())}function $g(e){return Zg(t=>{let n=er(t,k);return Vn(n)?z(n):Zp(e,zn)})}function e_(){return Jg(globalThis.String)}function t_(){return Jg(globalThis.Number)}function n_(){return Jg(globalThis.BigInt)}function r_(){return Jg(Yd)}function i_(e){return Yg((t,n)=>Bf({try:()=>JSON.parse(t,e?.reviver),catch:()=>new bg({expected:`a valid JSON string`},t,n)}))}function a_(e){return Yg((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 bg({expected:`a JSON-serializable value`},t,n)}))}function o_(){return Jg(hm)}function s_(){return Yg((e,t)=>Qp(pne(gm(e)),()=>new bg({expected:`a valid Base64 string`},e,t)))}var c_=class extends i{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new c_(this.encode,this.decode)}},l_=`~effect/SchemaTransformation/Transformation`,u_=class extends i{[l_]=l_;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new u_(this.encode,this.decode)}};function d_(e){return F(e,l_)&&e[l_]===l_}var f_=e=>d_(e)?e:new u_(e.decode,e.encode);function p_(e){return new u_(Yg(e.decode),Yg(e.encode))}function m_(e){return new u_(Jg(e.decode),Jg(e.encode))}function h_(){return new u_(r_(),qg())}var g_=new u_(qg(),qg());function __(){return g_}var v_=new u_(t_(),e_()),y_=new u_(n_(),e_()),b_=e=>N(e)&&typeof e.message==`string`,x_=e=>{let t=Object.hasOwn(e,`cause`)?Error(e.message,{cause:T_(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},S_=e=>{try{let t=Ze(e);return t===void 0?We(e):JSON.parse(t)}catch{return We(e)}},C_=(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},w_=e=>{let t=new WeakSet,n=r=>{if(ee(r)){if(t.has(r))return`[Circular]`;t.add(r);let i=C_(r,e,n);return t.delete(r),i}return S_(r)};return n},T_=e=>b_(e)?x_(e):e,E_=e=>m_({decode:T_,encode:w_(e)}),D_=p_({decode:(e,t)=>URL.canParse(e)?z(new URL(e)):H(new bg({expected:`a valid URL string`},e,t)),encode:e=>z(e.href)}),O_=new u_(s_(),o_());function k_(e){return new u_(i_(e??{}),a_(e))}function A_(e){return t=>t._tag===e}var j_=A_(`Declaration`),M_=A_(`Null`),N_=A_(`Void`),P_=A_(`Never`),F_=A_(`Literal`),I_=A_(`UniqueSymbol`),L_=A_(`Arrays`),R_=A_(`Objects`),z_=A_(`Union`),B_=A_(`Suspend`),V_=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},H_={},U_=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}},W_=`~effect/Schema`,G_=class{[W_]=W_;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}>`}},K_=class extends G_{_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===rg?ag:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=gy(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new K_(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>`}},q_=new class extends G_{_tag=`Null`;getParser(){return Ey(this,null)}getExpected(){return`null`}},J_=class extends G_{_tag=`Undefined`;getParser(){return Ey(this,void 0)}toCodecJson(){return iy(this,[Y_])}getExpected(){return`undefined`}},Y_=new V_(q_,new u_(Jg(()=>void 0),Jg(()=>null))),X_=new J_,Z_=new class extends G_{_tag=`Void`;getParser(){let e=ig(void 0);return t=>t===rg?ag:e}toCodecJson(){return iy(this,[Y_])}getExpected(){return`void`}},Q_=new class extends G_{_tag=`Never`;getParser(){return Dy(this,j)}getExpected(){return`never`}},$_=new class extends G_{_tag=`Unknown`;getParser(){return Dy(this,M)}getExpected(){return`unknown`}},ev=class extends G_{_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 ${We(e)}`);this.literal=e}getParser(){return Ey(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?tv(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:tv(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function tv(e){let t=globalThis.String(e.literal);return iy(e,[new V_(new ev(t),new u_(Jg(()=>e.literal),Jg(()=>t)))])}var nv=new class extends G_{_tag=`String`;getParser(){return Dy(this,x)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&Ny(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},rv=class extends G_{_tag=`Number`;getParser(){return Dy(this,S)}matchKey(e,t){return this._match(_re,e,t)}matchPart(e,t){return this._match(Ay,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:Ny(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(iv(this.checks,`effect/schema/isFinite`)||iv(this.checks,`effect/schema/isInt`))?this:iy(this,[$v])}toCodecStringTree(){return this.toCodecJson()===this?iy(this,[yre]):iy(this,[bre])}getExpected(){return`number`}};function iv(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&iv(e.checks,t))}var av=new rv,ov=new class extends G_{_tag=`Boolean`;getParser(){return Dy(this,C)}getExpected(){return`boolean`}},sv=new class extends G_{_tag=`BigInt`;getParser(){return Dy(this,w)}matchPart(e,t){if(!My.test(e))return;let n=globalThis.BigInt(e);return t.disableChecks||!this.checks?n:Ny(this.checks,n,void 0,this,t)?void 0:n}toCodecStringTree(){return iy(this,[Sre])}getExpected(){return`bigint`}},cv=class extends G_{_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(by(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(by(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 _g(n,t[o],i),a=new hg([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return H(new vg(n,[a],t,i))}return e.issues?H(new vg(n,e.issues,t,i)):ig(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:Lc(t.concurrency),f=d===1?dv(i,e,0,u):fv(i,e,{concurrency:d,end:u});if(!f)return c(i);if(Xo(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===rg)return ag;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)):H(new yg(n,e,a))}catch(e){return zf(e)}}}_rebuild(e,t,n){let r=gy(this.elements,e),i=gy(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new cv(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 lv(e,t,n,r){if(n._tag===`Failure`)return pv(e,e.ast,r,n);let i=n===og?t:n[mt];if(i!==rg)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(by(t.ast))return;let n=new hg([r],new gg(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return ou(new vg(e.ast,[n],e.input,e.options))}}var uv={onItem(e,t,n){let r=n<e.len?t:rg;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:lv},dv=Rc()(uv),fv=Bc()(uv),pv=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Bg(r.cause);if(i===void 0)return au(Vl(r.cause,r=>new vg(t,[new hg([n],r)],e.input,e.options)));let a=new hg([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return ou(new vg(t,[a],e.input,e.options))},mv=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function hv(e,t,n=H_){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(Oy(Cy(t)))}var gv=class{name;type;constructor(e,t){this.name=e,this.type=t}};function _v(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(_v);default:return!1}}function vv(e){let t=oy(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(vv);default:return!1}}function yv(e){return _v(e)&&vv(e)}var bv=class{parameter;type;constructor(e,t){if(!yv(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,by(t)&&!Ty(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},xv=class extends G_{_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 Dy(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(Oy(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 pv(t,n,i,s)??lu;let c=s===og?o:s[mt];if(a!==rg&&c!==rg){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return lu;ct(t.out,a,c)}return lu},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!Xo(t))return Uf(Jf(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return pv(e,n,r,a)??lu;let o=a===og?r:a[mt],s=e.input[r],l=i.parserValue(s,e.options);return Xo(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 Xo(a)?t(e,n,n,i,a):Uf(Jf(a),r=>t(e,n,n,i,r))},u=i?Bc()({onItem:(e,[t,n])=>n.is.parameter===nv?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return Pne(function*(t,d){if(t===rg)return rg;if(typeof t!=`object`||!t||Array.isArray(t))return yield*H(new yg(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:Lc(d.concurrency),v=i&&g?n.indexSignatures.map(e=>hv(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 _g(n,f[a],d),r=new hg([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*H(new vg(n,[r],t,d))}}}if(r){let e=_===1?wv(m,a):Tv(m,a,{concurrency:_});e&&(yield*e)}if(i&&_===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===nv?l:c,r=v?.[e]??(t.is.parameter===nv?Object.keys(f):hv(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!Xo(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=ai();for(let t=0;t<i;t++){let n=o[t],r=v?.[t]??(n.is.parameter===nv?Object.keys(f):hv(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*H(new vg(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=Sv(e,r,n);if(i)return i;let o=()=>ig(e.out),s=wv(e,a.slice(t+1));return s?em(s,o):o()})};return(e,t)=>{if(e===rg)return ag;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&Lc(t.concurrency)!==1)return(l??=c())(e,t);if(typeof e!=`object`||!e||Array.isArray(e))return H(new yg(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=Lv(i,s),l=c?i[s]:rg,d=n.parser(l,t);if(!Xo(d))return u(o,e,d);if(d===og){c&&ct(a,s,l);continue}let f=Sv(o,n,d);if(f)return f}}catch(e){return zf(e)}return ig(a)}}_rebuild(e,t,n,r){let i=gy(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new gv(t.name,n)}),a=gy(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new bv(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new xv(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 Sv(e,t,n){if(n._tag===`Failure`)return pv(e,e.ast,t.name,n);if(n===og)return;let r=n[mt];if(r!==rg){ct(e.out,t.name,r);return}if(delete e.out[t.name],!by(t.type)){let n=new hg([t.name],new gg(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return ou(new vg(e.ast,[n],e.input,e.options))}}var Cv={onItem(e,t){if(!Lv(e.input,t.name))return t.parser(rg,e.options);let n=e.input[t.name];return ct(e.out,t.name,n),t.parser(n,e.options)},step:Sv},wv=Rc()(Cv),Tv=Bc()(Cv);function Ev(e,t){return e?t?[...e,...t]:e:t}function Dv(e,t,n){return new xv(Reflect.ownKeys(e).map(t=>new gv(t,e[t].ast)),[],n,t)}function Ov(e){return e.ast}function kv(e,t=void 0){return new cv(!1,e.map(e=>e.ast),[],void 0,t)}function Av(e,t,n){return new zv(e.map(Ov),t,void 0,n)}var jv=h(e=>{for(;;){if(B_(e))return $_;let t=e.encoding;if(!t)return e.recur?.(jv,o)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==o))return $_;e=t[t.length-1].to}});function Mv(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(Mv)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Nv(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[eg];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!by(t)){if(F_(t))return[{key:e.name,literal:t.literal}];if(I_(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!by(e)){if(F_(e))return[{key:t,literal:e.literal}];if(I_(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>Nv(jv(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return Nv(e.thunk())}}var Pv=new WeakMap,Fv=Object.freeze([]),Iv=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Lv=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Rv(e){let t=Pv.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=jv(c);if(P_(l))continue;if(F_(l)||I_(l)){a??=new Map;let e=F_(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=Nv(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=Mv(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??Fv);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??Fv;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=Lv(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??Fv;if(t)return o}return Fv}}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=Iv(t);if(!P(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=Lv(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=Lv(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=Lv(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(Iv(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return Pv.set(e,t),t}var zv=class extends G_{_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===rg)return ag;let i=(o??=Rv(n.types))(e,r);if(i.length===0)return H(new Cg(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:Xo(r)?Bv(n,r.cause,e,t):Vv(n,r,e,t)}return Hv(n,a,i,e,t)}}_rebuild(e,t,n){let r=gy(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new zv(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=Cy(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(F_);if(t.length>0)return`${Kv(n.isMutable)}[ ${t.map(t=>e(t)+qv(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>F_(e.type));if(t.length>0)return`{ ${t.map(t=>`${Kv(t.type.context?.isMutable)}${Ke(t.name)}${qv(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function Bv(e,t,n,r){let i=Bg(t);return i?ou(new Cg(e,[i],n,r)):au(t)}function Vv(e,t,n,r){return tp(t,t=>Bv(e,t,n,r))}function Hv(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=Wv(a,n);return o?Uv(o,a):a.out?a.out:H(new Cg(e,a.issues??[],r,i))}function Uv(e,t){return em(e,e=>t.out===og?z(t.input):t.out?t.out:H(new Cg(t.ast,t.issues??[],t.input,t.options)))}var Wv=Rc()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Bg(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 wg(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return lu}}}),Gv=new zv([new ev(`Infinity`),new ev(`-Infinity`),new ev(`NaN`)]);function Kv(e){return e?``:`readonly `}function qv(e){return e?`?`:``}var Jv=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 Jv(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Jv(this.run,this.annotations,!0)}and(e,t){return new Yv([this,e],t)}},Yv=class extends i{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Yv(this.checks,{...this.annotations,...e})}and(e,t){return new Yv([this,e],t)}};function Xv(e,t,n=!1){return new Jv((t,n,r)=>Dg(n,e(t,n,r),t,r),t,n)}function Zv(e){return Xv(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitraryConstraint:{number:`finite`},...e})}var Qv=ly(av,[Zv()]),$v=new V_(new zv([Qv,Gv]),new u_(t_(),Jg(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function ey(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Xv(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 ty=new WeakMap;function ny(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&ty.set(n,ry(e)),n}function ry(e){let t=ty.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 ty.set(e,n),n}function iy(e,t){return e.encoding===t?e:ny(e,{encoding:t})}function ay(e,t){if(e.context===t)return e;let n=ry(e);return n.context===t&&n.encoding===e.encoding?n:ny(e,{context:t})}function oy(e){return e.encoding?oy(e.encoding[e.encoding.length-1].to):e}function sy(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return cy(e,ei(e.checks.slice(0,-1),n.annotate(t)))}return ny(e,{annotations:{...e.annotations,...t}})}function cy(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:ny(e,{checks:t})}function ly(e,t){return cy(e,Ev(e.checks,t))}function uy(e,t){let n=t(e.to);return n===e.to?e:new V_(n,e.transformation)}function dy(e,t){let n=e,r=n[n.length-1],i=uy(r,t);return i===r?e:ei(e.slice(0,e.length-1),i)}function fy(e){return t=>t.encoding?iy(t,dy(t.encoding,e)):t}function py(e,t){return fy(e=>ay(e,t))(e)}function my(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:iy(r,dy(r.encoding,n))}return e(r)}return h(n)}function ore(e,t){return hy(e,t,Sy(e))}function hy(e,t,n){let r=new V_(e,t);return iy(n,n.encoding?[...n.encoding,r]:[r])}function gy(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 _y(e,t){return ay(e,e.context?new U_(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new U_(!1,!1,void 0,t))}var vy=h(e=>sre(ay(e,e.context?e.context.isOptional===!1?new U_(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new U_(!0,!1)))),sre=fy(vy),cre=m(e=>vy(new zv([e,X_]))),yy=h(e=>lre(ay(e,e.context?e.context.isMutable===!1?new U_(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new U_(!1,!0)))),lre=fy(yy);function ure(e,t){return ay(e,e.context?new U_(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new U_(!1,!1,t))}function dre(e,t,n){return hy(e,n,t)}function fre(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 pre(e,t){let{literals:n,parameters:r}=fre(e);return new xv(n.map(e=>new gv(e,t)),r.map(e=>new bv(e,t)))}function by(e){return e.context?.isOptional??!1}function xy(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(xy)}function mre(e){function t(e){return xy(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return ni(n)?n:void 0}function hre(e){let t=!0;function n(e){return t=t&&!e.encoding&&!B_(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var Sy=h(e=>{let t=ry(e);if(t!==e){let n=Sy(t);return n===t&&e.encoding===void 0?e:ay(n,e.context)}let n=`recur`in e?e.recur(Sy):e;if(`encodingChecks`in n&&n.encodingChecks){let t=hre(e)?n.encodingChecks:L_(n)||R_(n)||j_(n)&&n.typeParameters.length>0?mre(n.encodingChecks):void 0;return ny(n,{encodingChecks:void 0,checks:Ev(n.checks,t)})}return n}),Cy=h(e=>Sy(wy(e)));function gre(e,t){let n=t,r=n.length,i=n[r-1],a=[new V_(wy(iy(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new V_(wy(n[e-1].to),n[e].transformation.flip()));let o=wy(i.to);return o.encoding?iy(o,[...o.encoding,...a]):iy(o,a)}var wy=m(e=>{if(e.encoding)return gre(e,e.encoding);let t=ry(e);if(t!==e){let n=wy(t);return n===t?e:ay(n,e.context)}return`flip`in e?e.flip(wy):`recur`in e?e.recur(wy):e});function Ty(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(Ty);default:return!1}}function Ey(e,t){let n=t===0?og:ig(t);return(r,i)=>r===rg?ag:r===t?n:H(new yg(e,r,i))}function Dy(e,t){return(n,r)=>n===rg?ag:t(n)?og:H(new yg(e,n,r))}var Oy=my(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(Oy)}}),ky=my(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(ky)}}),Ay=new globalThis.RegExp(`^${mv}$`),_re=new globalThis.RegExp(`^(?:${mv}|Infinity|-Infinity|NaN)$`);function vre(e){return ey(Ay,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:Ay.source}),...e})}var jy=ly(nv,[vre()]),yre=new V_(jy,v_),bre=new V_(new zv([jy,Gv]),v_),My=new globalThis.RegExp(`^-?\\d+$`);function xre(e){return ey(My,{expected:`a string representing a bigint`,representation:{id:`effect/schema/isStringBigInt`,payload:null},toJsonSchema:()=>({pattern:My.source}),...e})}var Sre=new V_(ly(nv,[xre({expected:`a string representing a bigint`})]),y_);function Ny(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=Ny(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 pg(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function Cre(e){if(!j_(e))return;let t=e.annotations?.[tg];return D(t)?t(e.typeParameters):void 0}var Py=Qh;function wre(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function Tre(e){return e===void 0||typeof e==`string`}function Fy(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 Ere(e){return Fy(e,wre)}var Iy=new K_([],()=>(e,t,n)=>Ere(e)?og:H(new yg(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>zy}),Ly=sy(Iy,{representation:{id:`effect/schema/MutableJson`,payload:null}}),Ry=new V_(Iy,__()),Dre=new V_(new zv([new cv(!1,[],[Iy]),new xv([],[new bv(nv,Iy)])]),__());function Ore(e){return Fy(e,Tre)}var zy=new V_(new K_([],()=>(e,t,n)=>Ore(e)?og:H(new yg(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),__()),By=(e,t,n)=>e===og?n(t):em(e,n);function Vy(e){if(e._tag===`Middleware`)return(t,n,r)=>Hy(t===og?e.decode(ig(sg(n)),r):e.decode(Zp(t,sg),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===og?ig(t):e;case`Transform`:{let e=e=>e===rg?ag:ig(t.transform(e));return(t,n)=>By(t,n,e)}case`TransformOptional`:{let e=e=>cg(t.transform(sg(e)));return(t,n)=>By(t,n,e)}case`TransformEffect`:return(e,n,r)=>By(e,n,e=>e===rg?ag:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>By(e,n,e=>Hy(t.transform(sg(e),r)))}}var Hy=e=>em(e,cg),Uy=(e,t,n,r)=>tp(r,r=>Rf(()=>Vl(r,r=>new mg(e,r,t,n))));function kre(e,t){let n=Vy(e.link.transformation),r;return(i,a)=>{if(i===rg)return ag;if(e.isConstructed(i))return og;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function Are(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==rg&&r!==void 0)return t(r,i);let a=n;if(Xo(a)&&a._tag===`Success`){let e=t(a[mt],i);return e===og?a:e}return em(Uy(e,r,i,a),e=>{let n=t(e,i);return n===og?ig(e):n})}}function jre(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:Are(e,n)}function Wy(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?Cre(e):void 0,o=a?kre(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>Vy(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(Xo(r)){if(r._tag===`Success`){let i=r===og?t:r[mt];if(t!==rg&&i!==rg){let i=Ny(u,t,void 0,e,n);i&&(r=H(new vg(e,i,t,n)))}}}else r=Uf(r,r=>{if(t!==rg&&r!==rg){let r=Ny(u,t,void 0,e,n);if(r)return H(new vg(e,r,t,n))}return z(r)})}if(s&&!n.disableChecks){if(Xo(r)){if(r._tag===`Success`){let i=r===og?t:r[mt];if(i===rg)return r;let a=Ny(s,i,void 0,e,n);a&&(r=H(new vg(e,a,i,n)))}}else r=Uf(r,t=>{if(t!==rg){let r=Ny(s,t,void 0,e,n);if(r)return H(new vg(e,r,t,n))}return z(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[mt],o=t(a,r)):o=em(o,e=>{let n=t(e,r);return n===og?ig(e):n})}if(o._tag===`Success`){let e=o[mt],t=p(e,r);return t===og?o:t}return o=Uy(e,n,r,o),em(o,e=>{let t=p(e,r);return t===og?ig(e):t})}:p}var Mre=Symbol(),Gy=new WeakMap,Nre=e=>qy(e).parser,Ky=e=>qy(e).makeEffect,Pre=e=>jre(e,Ky),Fre=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=Wy(this.ast,Nre)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=Wy(this.ast,Ky,Pre)}};function qy(e){let t=Gy.get(e);if(t!==void 0)return t;let n=new Fre(e);return Gy.set(e,n),n}function Jy(e){let t=e.ast,n;return(e,r)=>(n??=tb(Yre,Sy(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Yy(e){let t=Jy(e);return(e,n)=>{let r=Kp(t(e,n));return uu(r)?zn(r.value):(Vg(r.cause,`Option adapter can only return none for schema issues`),Rn())}}function Xy(e){return qre(Sy(e.ast))}function Ire(e){return Rre(e.ast)}function Lre(e){{let t=nb(eb(e));return e=>{let n=t(e,H_);return uu(n)?!0:(Vg(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}}function Rre(e){let t=Sy(e),n=e=>(n=Lre(t),n(e));return e=>n(e)}function zre(e){let t=eb(e);return(e,n)=>{let r=Kp(t(e,n));if(!uu(r))return Vg(r.cause,`Issue adapter can only return schema issues`)}}function Zy(e,t){let n=eb(e.ast);return t===void 0?n:(e,r)=>n(e,Qy(t,r))}function Bre(e,t){return Wre(Zy(e,t))}function Vre(e,t){return Gre(Zy(e,t))}function Hre(e,t){let n=eb(wy(e.ast));return t===void 0?n:(e,r)=>n(e,Qy(t,r))}var Qy=(e,t)=>t?{...e,...t}:e,$y=e=>e===rg?H(new bg):z(e);function eb(e){return tb(Jre,e)}function Ure(e,t){return e===og?z(t):Xo(e)?e[mt]===rg?$y(rg):e:em(e,$y)}function tb(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??H_);return a===og?z(r):Xo(a)?a[mt]===rg?$y(rg):a:em(a,$y)}}function nb(e){return(t,n)=>Kp(e(t,n))}function Wre(e){let t=nb(e);return(e,n)=>{let r=t(e,n);return uu(r)?zn(r.value):(Vg(r.cause,`Option adapter can only return none for schema issues`),Rn())}}function Gre(e){let t=nb(e);return(e,n)=>{let r=t(e,n);return uu(r)?Nr(r.value):Pr(Vg(r.cause,`Result adapter can only return schema issues`))}}function Kre(e,t){let n=Kp(e);if(uu(n))return n.value;let r=Vg(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}function qre(e){let t,n;return(r,i)=>{t??=qy(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??H_,o=t.make;if(o!==void 0&&r!==rg){let e;try{e=o(r,a)}catch(e){throw Vg(ene(e),`Constructor adapter can only throw schema issues`),e}if(e!==Mre&&e!==rg)return e}return Kre(Ure((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var Jre=e=>qy(e).parser,Yre=e=>qy(e).makeEffect,rb=`~effect/Schema/Schema`,ib=Symbol(),Xre={[rb]:rb,get make(){let e=Xy(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Jy(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=Yy(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return n(this,arguments)},annotate(e){return this.rebuild(sy(this.ast,e))},annotateKey(e){return this.rebuild(_y(this.ast,e))},check(...e){return this.rebuild(ly(this.ast,e))},rebuild(e){return ab(e,this[ib])}};function ab(e,t){function n(){}let r=Object.setPrototypeOf(n,Xre);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[ib]=t,r.ast=e,r}function Zre(e){return ab(ob(e.ast),{schema:e})}var ob=my(e=>{let t=$re(e,ob),n=e.context;return t===e||n===void 0?t:py(t,sb(n))});function sb(e){return e.constructorDefault===void 0?e:new U_(e.isOptional,e.isMutable,void 0,e.annotations)}function cb(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function lb(e){return t=>{let n=[...t].sort((t,n)=>e(Cy(t))-e(Cy(n)));return n.some((e,n)=>e!==t[n])?n:t}}var Qre=lb(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function $re(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!D(n))return iy(e,[Ry]);let r=n(e.typeParameters.map(e=>ab(Cy(e))));return r===void 0?e:iy(e,[uy(r,t)])}case`Unknown`:return iy(e,[Ry]);case`ObjectKeyword`:return iy(e,[Dre]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return cb(e),e.recur(t,ky);case`Union`:{let n=Qre(e.types);return n===e.types?e.recur(t):new zv(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 eie(e){return ab(ub(e.ast),{schema:e})}var tie=lb(e=>{switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function nie(e,t,n){switch(e._tag){case`Declaration`:{let r=e.typeParameters.map(e=>ab(t(Cy(e)))),i=e.annotations?.toCodecStringTree;if(D(i)){let n=i(r);return n===void 0?e:iy(e,[uy(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):iy(e,[uy(c,t)])}case`Null`:return iy(e,[rie]);case`Boolean`:return iy(e,[iie]);case`Unknown`:case`ObjectKeyword`:return iy(e,[zy]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return cb(e),e.recur(t,ky);case`Union`:{let n=tie(e.types);return n===e.types?e.recur(t):new zv(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 rie=new V_(new ev(`null`),new u_(Jg(()=>null),Jg(()=>`null`))),iie=new V_(new zv([new ev(`true`),new ev(`false`)]),new u_(Jg(e=>e===`true`),e_())),aie=new u_(Jg(e=>typeof e==`string`?[e]:e),qg()),ub=my(e=>{let t=nie(e,ub,e=>{throw new globalThis.Error(`Missing structural codec for StringTree`,{cause:e})});return t!==e&&e.context!==void 0?py(t,sb(e.context)):t},{stopAt:e=>e.transformation===aie});function db(e){return uu(e)?e.value:{issues:[{message:Yl(e.cause)}]}}function oie(e,t){let n=Zy(e),r={errors:`all`,...t?.parseOptions},i=Ag(t),a=e=>{let t=new oa(`sync`),a=zp(dp(n(e,r),{onFailure:i,onSuccess:e=>({value:e})}),{scheduler:t});a.currentDispatcher?.flush();let o=a.pollUnsafe();return o?db(o):new Promise(e=>{a.addObserver(t=>{e(db(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 sie=a(2,(e,t)=>pb(e,(e,n)=>lie(t,e)?void 0:[e,n])),fb=e=>e,cie=a(2,(e,t)=>pb(e,(e,n)=>[e,t(n)]));function lie(e,t){return e.some(e=>e===t||typeof e==`number`&&String(e)===t)}function pb(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;ct(n,e,t)}}return n}var mb=`~effect/Schema/SchemaError`;function uie(e){return F(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}var hb=rb;function gb(){return(e,t,n)=>Ab(new K_(e.map(Ov),e=>t(e.map(e=>Ab(e))),n))}function _b(e,t){return gb()([],()=>(t,n,r)=>e(t)?z(t):H(new yg(n,t,r)),t)}var vb=class extends pa(`SchemaError`){[mb]=mb;constructor(e){let t=it();at(0);try{super({issue:e})}finally{at(t)}}get message(){return Lg(this.issue)}toString(){return`SchemaError(${this.message})`}};function yb(e){return uie(e)}function bb(e){return Xo(e)?die(e):tp(e,e=>Rf(()=>Vl(e,e=>new vb(e))))}function die(e){return uu(e)?e:au(Vl(e.cause,e=>new vb(e)))}function fie(e,t){let n;for(let r of e.reasons){if(!Il(r)||!yb(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 xb(e){let t=Kp(e);if(uu(t))return t.value;throw fie(t.cause,`Sync adapter can only throw schema errors`)}function Sb(e,t){return oie(e,t)}var pie=Ire;function Cb(e,t){let n=Zy(e,t);return(e,t)=>bb(n(e,t))}var wb=Cb,mie=Bre;function Tb(e,t){let n=Vre(e,t);return(e,t)=>Rr(n(e,t),e=>new vb(e))}function Eb(e,t){let n=Cb(e,t);return(e,t)=>xb(n(e,t))}var hie=Eb;function Db(e,t){let n=Hre(e,t);return(e,t)=>bb(n(e,t))}var Ob=Db;function gie(e,t){let n=Db(e,t);return(e,t)=>xb(n(e,t))}var kb=gie,Ab=ab;function jb(e){return F(e,hb)&&e[hb]===hb}var Mb=fb(e=>Ab(vy(e.ast),{schema:e})),U=fb(e=>{let t=Zb(e);return Ab(cre(e.ast),{schema:t})}),Nb=fb(e=>Ab(yy(e.ast),{schema:e})),Pb=fb(e=>Ab(Sy(e.ast),{schema:e})),Fb=fb(e=>Ab(Cy(e.ast),{schema:e}));function W(e){let t=Ab(new ev(e),{literal:e,transform(n){return t.pipe(Qb(W(n),{decode:Jg(()=>n),encode:Jg(()=>e)}))}});return t}var Ib=Ab(Q_),Lb=Ab($_),_ie=Ab(q_),Rb=Ab(X_),G=Ab(nv),zb=Ab(av),Bb=Ab(ov),vie=Ab(sv),Vb=Ab(Z_);function Hb(e,t){return Ab(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Hb(Dv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function K(e){return Hb(Dv(e,void 0),e)}function Ub(e,t){return Ab(pre(e.ast,t.ast),{key:e,value:t})}function Wb(e,t){return Ab(e,{elements:t,mapElements(e,t){let n=e(this.elements);return Wb(kv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Gb(e){return Wb(kv(e),e)}var q=fb(e=>Ab(new cv(!1,[],[e.ast]),{value:e})),Kb=fb(e=>Ab(new cv(!1,[e.ast],[e.ast]),{value:e}));function qb(e,t){return Ab(e,{members:t,mapMembers(e,t){let n=e(this.members);return qb(Av(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Jb(e,t){return qb(Av(e,t,void 0),e)}function Yb(e){let t=e.map(W);return Ab(Av(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return Jb(e(this.members))},pick(e){return Yb(e)},transform(e){return Jb(t.map((t,n)=>t.transform(e[n])))}})}var Xb=fb(e=>Jb([e,_ie])),Zb=fb(e=>Jb([e,Rb]));function yie(e){return t=>Ab(t.ast,{schema:t,identifier:e})}function bie(e){return t=>Ab(ore(t.ast,new c_(e,o)),{schema:t})}function xie(e){return Sie(e)}function Sie(e){return t=>bie(Nne(e))(t)}function Qb(e,t){return n=>Ab(dre(n.ast,e.ast,t?f_(t):__()),{from:n,to:e})}function Cie(){return(e,t)=>ax()(e,{decode:t,encode:Gg})}function $b(e){return t=>Qb(Pb(t),e)(t)}function ex(e){return t=>Ab(ure(t.ast,e),{schema:t})}function tx(e){return tp(e,e=>Rf(()=>Vl(e,e=>e.issue)))}function nx(e,t){let n=t?.encodingStrategy===`omit`?Qg():qg();return t=>Mb(Fb(t)).pipe(Qb(t,{decode:$g(tx(e)),encode:n}))}function wie(e,t){let n=t?.encodingStrategy===`omit`?Qg():qg();return t=>U(Fb(t)).pipe(Qb(t,{decode:$g(tx(e)),encode:n}))}function rx(e){return W(e).pipe(ex(z(e)))}function Tie(e,t){return K({_tag:rx(e),...t})}function ix(e,t){return _b(t=>t instanceof e,t)}function ax(){return(e,t)=>new V_(e.ast,f_(t))}var ox=Xv;function sx(e,t){let n=e.source,r=e.flags,i=/^[dg]*uy?$/.test(r),a=r===``?`new RegExp(${We(n)})`:`new RegExp(${We(n)}, ${We(r)})`;return ey(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}var Eie=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 cx(e,t){let n=Eie(e);return sx(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 lx=Ab(Qv);function Die(e){let t=Pn(e.order),n=e.formatter??We;return(r,i)=>ox(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function Oie(e){let t=In(e.order),n=e.formatter??We;return(r,i)=>ox(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 kie(e){let t=Fn(e.order),n=e.formatter??We;return(r,i)=>ox(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 Aie(e){let t=In(e.order),n=Pn(e.order),r=Fn(e.order),i=Nn(e.order),a=e.formatter??We;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return ox(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 ux(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${We(e)}`);return e}var dx=Die({order:Mn,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:ux(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${We(e)})`})})}),fx=Oie({order:Mn,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:ux(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${We(e)})`})})}),px=kie({order:Mn,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:ux(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${We(e)})`})})}),mx=Aie({order:Mn,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:ux(e.minimum),maximum:ux(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${We(e.minimum)}, maximum: ${We(e.maximum)}, exclusiveMinimum: ${We(t)}, exclusiveMaximum: ${We(n)} })`})}}});function hx(e){return ox(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 gx=zb.check(hx());function _x(e,t){return e=yx(e),vx(e,Math.ceil(e/2),t)}function vx(e,t,n){return ox(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})`}),[$h]:!0,arbitraryConstraint:{minLength:e},...n})}function jie(e){return vx(1,1,e)}function J(e,t){return e=yx(e),ox(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})`}),[$h]:!0,arbitraryConstraint:{maxLength:e},...t})}function yx(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function Mie(e,t){return e=yx(e),ox(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})`}),[$h]:!0,arbitraryConstraint:{minProperties:e},...t})}function Nie(e,t){let n=Fb(e),r=zre(n.ast);return ox((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 hg([e],t)),n.errors===`first`))break}return!ni(a)||new vg(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})`}),[$h]:!0,...t})}var bx=G.check(jie()),Pie=e=>+(e?.includeStack===!0)|(e?.excludeCause===!0?2:0),Fie=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},xx=[];function Sx(e){let t=Pie(e),n=xx[t];if(n!==void 0)return n;let r=Kie.pipe(Qb(Lb,E_(Fie(t))));return xx[t]=r,r}globalThis.RegExp;var Cx=G.annotate({expected:`a string that will be decoded as a URL`}),Iie=ix(globalThis.URL,{representation:{id:`effect/schema/URL`,payload:null},toCode:()=>({runtime:`Schema.URL`,Type:`globalThis.URL`}),expected:`URL`,toCodecJson:()=>ax()(Cx,D_)}),wx=Cx.pipe(Qb(Iie,D_)),Lie=G.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function Tx(e,t){return Lie.pipe(Qb(e,k_(t)))}var Rie=Tx(Lb);globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var Ex=G.annotate({expected:`a string that will be decoded as a number`}).pipe(Qb(zb,v_)),Dx=G.annotate({expected:`a string that will be decoded as a finite number`}).pipe(Qb(lx,v_)),zie=G.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),Bie=ix(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>ax()(zie,O_)});function Ox(e,t){return Ab(gb()([e,t],([e,t])=>(n,r,i)=>{if(!Fl(n))return H(new yg(r,n,i));switch(n._tag){case`Fail`:return $p(Zy(e)(n.error,i),{onSuccess:zl,onFailure:e=>xg(r,`error`,e,n,i)});case`Die`:return $p(Zy(t)(n.defect,i),{onSuccess:Bl,onFailure:e=>xg(r,`defect`,e,n,i)});case`Interrupt`:return z(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])=>ax()(Jb([K({_tag:W(`Fail`),error:e}),K({_tag:W(`Die`),defect:t}),K({_tag:W(`Interrupt`),fiberId:Zb(lx)})]),m_({decode:e=>{switch(e._tag){case`Fail`:return zl(e.error);case`Die`:return Bl(e.defect);case`Interrupt`:return nne(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 kx(e,t){return Ab(gb()([e,t],([e,t])=>{let n=q(Ox(e,t));return(e,t,r)=>Pl(e)?$p(Zy(n)(e.reasons,r),{onSuccess:Ll,onFailure:n=>xg(t,`failures`,n,e,r)}):H(new yg(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])=>ax()(q(Ox(e,t)),m_({decode:Ll,encode:({reasons:e})=>e}))}).ast,{error:e,defect:t})}var Ax=p_({decode:(e,t)=>Hn(Zne(e),{onNone:()=>H(new bg({expected:`a valid UTC DateTime string`},e,t)),onSome:e=>z(ere(e))}),encode:e=>z(mm(e))}),Vie=-864e13,jx=864e13;function Mx(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 Nx(e,t){return gx.check(mx({minimum:e,maximum:t}))}var Px=_b(e=>Yne(e)&&Xne(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]=Mx(e,Vie,jx);return Cie()(Nx(t,n),Jg(dm))},toCodecJson:()=>ax()(G,Ax),toFormatter:()=>e=>e.toString()}),Hie=G.annotate({expected:`a string that will be decoded as a DateTime.Utc`}).pipe(Qb(Px,Ax)),Uie=_b(Ei,{representation:{id:`effect/schema/Duration`,payload:null},toCode:()=>({runtime:`Schema.Duration`,Type:`Duration.Duration`,importDeclarations:[`import * as Duration from "effect/Duration"`]}),expected:`Duration`,toCodecJson:()=>ax()(Jb([K({_tag:W(`Infinity`)}),K({_tag:W(`NegativeInfinity`)}),K({_tag:W(`Nanos`),value:vie}),K({_tag:W(`Millis`),value:gx})]),m_({decode:e=>{switch(e._tag){case`Infinity`:return Mi;case`NegativeInfinity`:return Ni;case`Nanos`:return Pi(e.value);case`Millis`:return Fi(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 Wie(e,t,n){return Ab(gb()([e,t,n],([e,t,n])=>{let r=kx(t,n);return(t,n,i)=>{if(!ru(t))return H(new yg(n,t,i));switch(t._tag){case`Success`:return $p(Zy(e)(t.value,i),{onSuccess:iu,onFailure:e=>xg(n,`value`,e,t,i)});case`Failure`:return $p(Zy(r)(t.cause,i),{onSuccess:au,onFailure:e=>xg(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])=>ax()(Jb([K({_tag:W(`Success`),value:e}),K({_tag:W(`Failure`),cause:kx(t,n)})]),m_({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 Fx=_b(Rh,{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:()=>Uh,toCodec:()=>ax()(q(Gb([G,G])),m_({decode:Bh,encode:e=>e.params}))}).pipe(Qb(Ub(G,Jb([G,Kb(G)])),m_({decode:Xh,encode:Vh})));function Ix(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:Zy(W(n));return Ab(gb()([e],([e])=>(t,n,r)=>vh(t)?em(a===void 0?Nf:Qp(a(t.label,r),e=>new hg([`label`],e)),()=>$p(Zy(e)(xh(t),r),{onSuccess:e=>yh(e,{label:t.label}),onFailure:()=>new vg(n,[new hg([`value`],new bg(void 0,t,r))],t,r)})):H(new yg(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}, ${We(i)})`,Type:`Redacted.Redacted<${e[0].Type}>`,importDeclarations:[`import * as Redacted from "effect/Redacted"`]}),expected:`Redacted`,toCodecJson:([e])=>ax()(e,{decode:Jg(e=>yh(e,{label:n})),encode:r?Wg(e=>`Cannot serialize Redacted`+(Vn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):Jg(xh)}),toEquivalence:([e])=>Sh(e)}).ast,{value:e})}function Lx(e,t){return Qb(Ix(Pb(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Jg(e=>yh(e,{label:t?.label})),encode:t?.disallowEncode?Wg(e=>`Cannot encode Redacted`+(Vn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):Jg(xh)})(e)}var Rx=globalThis.Symbol.for(`immer-draftable`),zx={};function Bx(e,t,r,i,a){let o=Ux(r,t,i),s=Hx(t),c=class extends e{constructor(...[e,t]){let n=t?.[`~payload`],i=n?.token===zx?n.value:r.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:zx,value:i}})}static[hb]=hb;get[s](){return s}static[Rx]=!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 Xy(o(this))(e??{},t)}static makeOption(e,t){return Yy(o(this))(e??{},t)}static makeEffect(e,t){return o(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(sy(this.ast,e))}static annotateKey(e){return this.rebuild(_y(this.ast,e))}static check(...e){return this.rebuild(ly(this.ast,e))}static extend(e){return(t,n)=>{let i=Wx(t)?t:K(t),o={...r.fields,...i.fields},s=Dv(o,r.ast.checks,{identifier:e});return Bx(this,e,Hb(ly(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 Vx(e){return new u_(Jg(t=>new e(t,{"~payload":{token:zx,value:t}})),qg())}function Hx(e){return`~effect/Schema/Class/${e}`}function Ux(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=Hx(t),o=e=>e instanceof i||F(e,a),s=Vx(i);return r=Qb(Ab(new K_([e.ast],()=>(e,t,n)=>o(e)?z(e):H(new yg(t,e,n)),{identifier:t,[tg]:([e])=>({isConstructed:o,link:new V_(e,s)}),toCodec:([e])=>new V_(e.ast,s),toEquivalence:([e])=>e,toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[eg]:Nv(e.ast),...n})),s)(e)}}function Wx(e){return jb(e)}var Gie=e=>(t,n)=>Bx(ua,e,Wx(t)?t:K(t),n,e=>({toString(){return`${e}(${We({...this})})`}})),Gx=e=>(t,n)=>Bx(en,e,Wx(t)?t:K(t),n,e=>({name:e})),Y=e=>(t,n,r)=>{let i=Wx(n)?n.mapFields(e=>({_tag:rx(t),...e}),{unsafePreserveChecks:!0}):Tie(t,n);return Gx(e??t)(i,r)},Kx=Zre,qx=eie,Kie=Ab(sy(Iy,{toCode:()=>({runtime:`Schema.Json`,Type:`Schema.Json`})})),qie=Ab(sy(Ly,{toCode:()=>({runtime:`Schema.MutableJson`,Type:`Schema.MutableJson`})})),Jx=`~effect/reactivity/AsyncResult`,Yx=e=>F(e,Jx),Xx={[Jx]:{E:o,A:o},pipe(){return n(this,arguments)},[ye](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return be(this.value,e.value);case`Failure`:return be(this.cause,e.cause)}},[te](){let e=ce(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:ie(e)(this._tag===`Success`?R(this.value):R(this.cause))}},Zx=e=>e.waiting,Qx=(e,t)=>e._tag===`Success`?iS(e.value):sS(e.cause,{previous:t}),$x=e=>e._tag===`None`?nS(!0):lS(e.value),eS=e=>e._tag===`Initial`,tS=e=>e._tag!==`Initial`,nS=(e=!1)=>{let t=Object.create(Xx);return t._tag=`Initial`,t.waiting=e,t},rS=e=>e._tag===`Success`,iS=(e,t)=>{let n=Object.create(Xx);return n._tag=`Success`,n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},aS=e=>e._tag===`Failure`,oS=(e,t)=>{let n=Object.create(Xx);return n._tag=`Failure`,n.cause=e,n.previousSuccess=t?.previousSuccess??Rn(),n.waiting=t?.waiting??!1,n},sS=(e,t)=>oS(e,{previousSuccess:Xn(t.previous,e=>rS(e)?zn(e):aS(e)?e.previousSuccess:Rn()),waiting:t.waiting}),cS=(e,t)=>sS(Rl(e),t),lS=a(e=>Yx(e[0]),(e,t)=>{if(e.waiting)return t?.touch?uS(e):e;let n=Object.assign(Object.create(Xx),e);return n.waiting=!0,t?.touch&&rS(n)&&(n.timestamp=Date.now()),n}),uS=e=>rS(e)?iS(e.value,{waiting:e.waiting}):e,dS=a(2,(e,t)=>e._tag===`Failure`?sS(e.cause,{previous:t,waiting:e.waiting}):e),fS=e=>e._tag===`Success`?zn(e.value):e._tag===`Failure`?Yn(e.previousSuccess,e=>e.value):Rn(),pS=e=>qn(fS(e),()=>new Xl(`AsyncResult.getOrThrow: no value found`)),mS=e=>{switch(e._tag){case`Success`:return iu(e.value);case`Failure`:return au(e.cause);default:return ou(new Xl)}},hS=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return oS(e.cause,{previousSuccess:Yn(e.previousSuccess,e=>iS(t(e.value),e)),waiting:e.waiting});case`Success`:return iS(t(e.value),e)}}),gS=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return oS(e.cause,{previousSuccess:Xn(e.previousSuccess,e=>{let n=t(e.value,e);return rS(n)?zn(n):Rn()}),waiting:e.waiting});case`Success`:return t(e.value,e)}}),_S=no,vS=io,yS=ate,bS=ao,xS=oo,SS=Qa,CS=Fte,wS=Zc,TS=Ute,ES=`~effect/MutableRef`,Jie={[ES]:ES,...bt,toJSON(){return{_id:`MutableRef`,current:$e(this.current)}}},DS=e=>{let t=Object.create(Jie);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++},Yie=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||=e.head,e.length++},Xie=(e,t)=>Zie(e,Zr(t),!Array.isArray(t)),Zie=(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=jr(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},Qie=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},$ie=(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},eae=(e,t)=>$ie(e,e=>e!==t),tae=`~effect/PubSub`,nae=`~effect/PubSub/Subscription`,rae=e=>B(()=>BS(e.atomicPubSub(),new Map,Su(),wS(!1),DS(!1),e.strategy(),DS(Rn()))),iae=e=>rae({atomicPubSub:()=>aae(e),strategy:()=>new VS}),aae=e=>{let t=e?.replay;return new pae(t&&t>0?new WS(Math.ceil(t)):void 0)},LS=a(2,(e,t)=>e.shutdownFlag.current||Vn(e.ended.current)?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),oae=e=>jp(mp(t=>{let n=Sr(t,xu),r=Du(e.scope),i=fae(e.pubsub,e.subscribers,e.strategy,e.ended);return Tu(r,sae(i)).pipe(Gf(wu(n,e=>Ou(r,e))),Xf(i))})),sae=e=>jp(Hf(t=>(OS(e.shutdownFlag,!0),Df(Qie(e.pollers),e=>one(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(Kf(()=>B(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),xne(e.shutdownHook.open),Qf)))),cae=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?z(e.replayWindow.takeAll().concat(r)):ni(r)?z(r):Uf(lae(e),e=>t([e]))}),lae=e=>Ff(t=>{if(e.shutdownFlag.current)return t(Op);if(Vn(e.ended.current))return t(z(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],B(()=>eae(e.pollers,n)))}),RS=Symbol.for(`effect/PubSub/AbsentValue`),uae=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},dae=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},fae=(e,t,n,r)=>new hae(e,t,e.subscribe(),AS(),wS(!1),DS(!1),n,e.replayWindow(),r),pae=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 mae(this,this.publisherTail,this.publisherIndex,!1)}},mae=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=jr(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}},hae=class{[nae]={_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{[tae]={_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 z(!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)dae(n,r,i),i.length===0?a=!1:uae(n,r,i);else{let a=r.poll();a===kS?Yie(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=jr(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,...bt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:mC(this)}}},QS=e=>Qt(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},so(n)}),$S=e=>QS({capacity:e}),eC=e=>QS({capacity:e,strategy:`sliding`}),tC=a(2,(e,t)=>fo(()=>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)=>xo(n=>{let r=iC(e,t);return r.length===0||e.strategy===`dropping`?n(Kt(r)):TC(e,{_tag:`Array`,remaining:r,offset:0,resume:n})})),iC=(e,t)=>{if(e.state._tag!==`Open`)return Zr(t);if(e.capacity===1/0||e.strategy===`sliding`)return Xie(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 Zr(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)=>uo(()=>oC(e,t))),oC=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=ps(Yt(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,It(sn())),cC=e=>uo(()=>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=jr(t),n=jr(n),fo(()=>xC(e,t,n)??Wo(CC(e,()=>SC(e,t)),dC(e,t,n))))),fC=e=>fo(()=>pC(e)??Wo(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),Kt(t)}if(e.capacity<=0&&e.state.offers.size>0){let t=DC(e.state.offers);return OC(e),Kt(t)}},mC=e=>e.state._tag===`Done`?0:e.messages.length,hC=Kt(!1),gC=Kt(!0),_C=Xt(sn()),vC=is(),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(ls),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 Kt([]);if(!SC(e,t))return;let r=e.messages.length>0?FS(e.messages,n):[DC(e.state.offers)];return OC(e),Kt(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)=>xo(n=>{if(e.state._tag===`Done`)return n(e.state.exit);if(t())return n(ls);let r={ready:t,resume:n};return e.state.takers.add(r),uo(()=>{e.state._tag!==`Done`&&e.state.takers.delete(r)})}),wC=(e,t)=>xo(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),uo(()=>{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(Kt(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(Kt([]))),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(Kt([]))}}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)=>xo(r=>{if(e.free>=t)return r(n);let i=()=>{e.free<t||(e.waiters.delete(i),r(n))};return e.waiters.add(i),uo(()=>{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=fo(()=>this.free<e?jC(this,e,t):(this.taken+=e,so(e)));return t}takeIfAvailable(e){return fo(()=>this.free<e?so(!1):(this.taken+=e,so(!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 Qt(t=>(this.permits=e,this.free<0||this.releaseUnsafe(t,0),_o))}release(e){return Qt(t=>so(this.releaseUnsafe(t,e)))}get releaseAll(){return Qt(e=>so(this.releaseUnsafe(e,this.taken)))}withPermits(e){return t=>Nc(n=>{let r=fo(()=>this.free<e?Yo(n(jC(this,e,_o)),()=>r):(this.taken+=e,Ec(n(t),()=>{this.releaseUnsafe(Qa(),e)},!0)));return r})}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>Nc(n=>this.free<e?mo:(this.taken+=e,Ec(n(Uo(t)),()=>{this.releaseUnsafe(Qa(),e)},!0)))}},NC=e=>uo(()=>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=>z(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(B(()=>{let t=e();return Mf(()=>{let e=t.next();return e.done?Ql(e.value):z(e.value)})})),qC=e=>BC(B(()=>{let t=0;return Mf(()=>t>=e.length?Ql():z(e[t++]))})),JC=e=>$C(z(e)),YC=BC(z(Ql())),XC=BC(z(If)),ZC=e=>BC(z(H(e))),QC=e=>BC(Lf(e)),$C=e=>BC(B(()=>{let t=!1;return Mf(()=>t?Ql():(t=!0,e))})),ew=e=>BC(z(uC(e))),tw=e=>BC(z(Ap(cae(e),()=>Ql()))),nw=e=>Dw(Yf(oae(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():z(oi(t))}));return Xf(Tu(e.scope,e.releaseLockOnEnd?B(()=>t.releaseLock()):kf(()=>t.cancel().catch(d))),r)},aw=a(2,(e,t)=>zC(e,e=>B(()=>{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=CS(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,vS(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 z(Mf(function r(){if(t===void 0)return Uf(e,e=>{switch(e.length){case 0:return r();case 1:return z(e[0]);default:return t=e,z(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),z(i)}))}),hw=e=>zC(e,e=>z(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,B(()=>n)),e=>t(e).pipe(Yf(e=>{n=e}),Zd(()=>Ql(e))))}),Dw)),_w=(e,t)=>RC((n,r)=>B(()=>{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)?z(r):Uf(e,n)})))),yw=a(2,(e,t)=>zC(e,e=>z(Uf(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return ri(i)?z(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 Ir(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*TS(!0),u=new Set,d=yield*$S(t);yield*Tu(o,cC(d));let f=yield*HC(e)(i,a);return yield*V(function*(){for(;;){let e;c&&(u.size<s?yield*c.take(1):(e=yield*Ip(f),yield*up(c.take(1),Gf(vS(e),If))));let t=e===void 0?yield*f:yield*vS(e),n=Du(o),r=yield*HC(t)(i,n);for(;u.size>=s;){let e=Vr(u);u.delete(e),u.size===0&&(yield*l.open),yield*bS(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,Ir(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),!Lr(t)))return yield*aC(d,e)})),Ip);l.closeUnsafe(),u.add(a)}}).pipe(tp(e=>Lr(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 z(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=>z(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||z).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=Rn();return jw(e,e=>e.pipe(Zf,Uf(e=>(t=e,Ql()))),()=>z(t))}),Lw=qp(function*(e){let t=AC(1),n=yield*pp(),r=Sr(n,xu);return(yield*HC(e)(Ql(),r)).pipe(gp(n),t.withPermits(1))},tp(e=>z(Lf(e)))),Rw=(e,t)=>HC(e)(Ql(),t),zw=`~effect/MutableHashMap`,gae={[zw]:zw,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${We(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:$e(Array.from(this))}},[Qe](){return this.toJSON()},pipe(){return n(this,arguments)}},Bw=()=>{let e=Object.create(gae);return e.backing=new Map,e.buckets=new Map,e},_ae=(...e)=>vae(e),vae=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 zn(e.backing.get(t));if(Hw(t))return Rn();let n=R(t),r=e.buckets.get(n);return r===void 0?Rn():bae(e,r,t)}),Hw=e=>typeof e!=`object`&&typeof e!=`function`,yae=e=>e.backing.values(),bae=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(be(n,t[r])){let n=t[r];return zn(e.backing.get(n))}return Rn()},xae=a(2,(e,t)=>Vn(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=R(t),i=e.buckets.get(r);if(i===void 0)return e.buckets.set(r,[t]),e.backing.set(t,n),e;let a=Sae(i,t);return a===void 0&&(i.push(t),a=t),e.backing.set(a,n),e}),Sae=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(be(t,e[n]))return e[n]},Ww=a(2,(e,t)=>{if(Hw(t))return e.backing.delete(t),e;let n=R(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||be(t,i)){e.backing.delete(i),r.splice(n,1);break}}return r.length===0&&e.buckets.delete(n),e}),Cae=e=>(e.backing.clear(),e.buckets.clear(),e),Gw=e=>e.backing.size,Kw=`~effect/PlatformError`,wae=class extends pa(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},Tae=class extends fa{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}},qw=class extends pa(`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 Tae(e)),Eae=e=>new qw(new wae(e)),Dae=`~effect/Stream`,Oae={_R:o,_E:o,_A:o},Yw=function(e){this.channel=e};Yw.prototype={[Dae]:Oae,pipe(){return n(this,arguments)}};var kae=e=>new Yw(e),Xw=`~effect/RcMap`,Aae=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)}}),jae=e=>Hf(t=>{let n=t.context,r=Sr(n,xu),i=Aae({lookup:e.lookup,context:n,scope:r,idleTimeToLive:typeof e.idleTimeToLive==`function`?p(e.idleTimeToLive,yi):s(yi(e.idleTimeToLive??ji)),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(()=>B(()=>{Cae(e)})))}),i)}),Mae=a(2,(e,t)=>Mp(n=>{if(e.state._tag===`Closed`)return Op;let r=e.state,i=SS(),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 H(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=Pae(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=fr(n);Mf(()=>e.lookup(t)).pipe(Bp(a),CS(o.scope)).addObserver(n=>{fu(n)&&Nae(e,t,o,a),bu(o.deferred,n)})}return Tu(xr(i.context,xu),o.finalizer).pipe(Gf(n(_u(o.deferred))))})),Nae=(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),CS(e.scope)))},Zw=e=>e.fiber?bS(e.fiber).pipe(Gf(Ou(e.scope,lu))):Ou(e.scope,lu),Pae=(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(Oi(n.idleTimeToLive))return Ww(e.state.map,t),Zw(n);if(!Di(n.idleTimeToLive))return Nf;let a=r.getRef(rd);return n.expiresAt=a.currentTimeMillisUnsafe()+Bi(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(Fi(s))),()=>r(i))}).pipe(wp(B(()=>{n.fiber=void 0})),Bp(r.context),CS(e.scope)),Nf}),Fae=`~effect/Stream`,Qw=e=>F(e,Fae),$w=kae,eT=e=>$w($C(Yf(e,oi))),Iae=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(oi(e))),Lae=(...e)=>Bae(e),oT=e=>$w(GC(()=>e().channel)),Rae=e=>$w(ZC(e)),zae=e=>$w(QC(e)),Bae=e=>ri(e)?$w(JC(e)):iT,sT=e=>$w(ew(e)),Vae=e=>$w(nw(e)),Hae=e=>$w(rw(e)),Uae=(e,t)=>Iae(B(()=>{let n=e,r=!1;return Mf(function e(){return r?Ql():Uf(t(n),([t,i])=>(Bn(i)?r=!0:n=i.value,ri(t)?z(t):e()))})})),Wae=$w(XC),cT=e=>$w(Dw(Yf(e,nT))),lT=a(2,(e,t)=>oT(()=>{let n=0;return $w(aw(e.channel,si(e=>t(e,n++))))})),uT=a(e=>Qw(e[0]),(e,t,n)=>e.channel.pipe(mw,sw(t,n),aw(oi),$w)),Gae=a(e=>Qw(e[0]),(e,t,n)=>e.channel.pipe(mw,Cw(e=>t(e).channel,n),$w)),Kae=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(()=>qae(e,t))));return pT.set(n,[e,t]),n}),pT=new WeakMap;function*qae(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 Jae=a(e=>Qw(e[0])&&Qw(e[1]),(e,t,n)=>$w(Tw(nT(e),nT(t),n))),Yae=(...e)=>$w(GC(()=>{let t=[],n=new Set,r=wS();return ww(qC(e.map((i,a)=>i.channel.pipe(mw,sw(i=>(t[a]=i,n.has(a)?z(oi(t.slice())):(n.add(a),n.size<e.length?r.await:Xf(r.open,oi(t.slice()))))),vw(k)))),{concurrency:`unbounded`,bufferSize:0})})),Xae=a(3,(e,t,n)=>lT(Yae(e,t),([e,t])=>n(e,t))),mT=a(2,(e,t)=>$w(yw(nT(e),t))),Zae=a(2,(e,t)=>$w(Sw(e.channel,e=>t(e).channel))),Qae=a(e=>Qw(e[0]),(e,t,n)=>tT(e,(e,r)=>B(()=>{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 ri(t)?z(t):Ql()}return z(e)})}))),$ae=a(2,(e,t)=>$w(Ew(e.channel,t))),eoe=a(e=>Qw(e[0]),(e,t)=>oT(()=>{let n=new TextDecoder(t?.encoding);return lT(e,e=>n.decode(e,{stream:!0}))})),toe=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),Yn(ii(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)),noe=e=>Lw(e.channel),roe=a(e=>Qw(e[0]),(e,t,n)=>{let r,i,a=wS(!1);return new ReadableStream({start(n){i=zp(gp(yT(e,e=>a.whenOpen(B(()=>{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(bS(i)))}},n?.strategy)}),ioe=a(e=>Qw(e[0]),(e,t)=>Yf(pp(),n=>roe(e,n,t))),bT=`~effect/reactivity/Reactivity`,xT=rr(`effect/reactivity/Reactivity`),aoe=B(()=>{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=yr(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)=>V(function*(){let n=yield*pp(),r=Sr(n,xu),a=yield*QS(),o=p(Bp(n),CS(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,B(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=>B(()=>{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 rr()(`effect/reactivity/Reactivity/PendingInvalidation`){},ooe=a(2,(e,t)=>xT.use(n=>n.mutation(t,e))),CT=e=>xT.use(t=>t.invalidate(e)),wT=Ku(xT)(aoe);function TT(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return R(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)),soe=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 pa(`KeyValueStoreError`){[kT]=kT},jT=rr(`effect/persistence/KeyValueStore`),coe=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}),loe=e=>{let t=new TextEncoder;return coe({...e,getUint8Array:n=>e.get(n).pipe(Yf(DT(e=>zr(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=Tx(Kx(t)),r=wb(n),i=Ob(n),a=t=>Uf(e.get(t),soe({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(Bn(n))return jf;let r=t(n.value);return Xf(o(e,r),zn(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}},uoe=e=>Wu(jT)(()=>{let t=e();return loe({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})})})}),PT=`~effect/SubscriptionRef`,FT=e=>F(e,PT),IT={...bt,[PT]:{_A:o},toJSON(){return{_id:`SubscriptionRef`,value:this.value}}},LT=e=>Yf(iae({replay:1}),t=>{let n=Object.create(IT);return n.semaphore=AC(1),n.value=e,n.pubsub=t,LS(n.pubsub,e),n}),RT=e=>Vae(e.pubsub),zT=e=>B(()=>e.value),BT=(e,t)=>{e.value=t,LS(e.pubsub,t)},VT=a(2,(e,t)=>e.semaphore.withPermit(B(()=>{let[n,r]=t(e.value);return BT(e,r),n}))),HT=a(2,(e,t)=>e.semaphore.withPermit(B(()=>BT(e,t)))),UT=a(2,(e,t)=>e.semaphore.withPermit(B(()=>BT(e,t(e.value))))),WT=`~effect/reactivity/AtomRegistry`,GT=e=>F(e,WT),KT=e=>new nE(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),qT=rr(WT),JT=a(2,(e,t)=>rT(n=>Mf(()=>Tu(xr(SS().context,xu),B(e.subscribe(t,e=>nC(n,e),{immediate:!0})))))),YT=a(e=>GT(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(mS(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n(mS(e)),a())});return B(a)})}),XT={immediate:!0},ZT=e=>{e()},QT={};function $T(e,t){let n=QT;for(let r of e)try{t(r)}catch(e){n===QT&&(n=e)}if(n!==QT)throw n}var eE=`~effect-atom/atom/Atom/Serializable`,tE=e=>eE in e?e[eE].key:e,nE=class{[WT];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[WT]=WT,this.scheduler=new oa(`sync`,t),this.schedulerAsync=new oa(`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===iE.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,XT)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=tE(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[eE].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 aE(this,e)}invalidateAtom=e=>{this.ensureNode(e).invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get(tE(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(tE(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(tE(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),$T(t,this.removeIdleNode)}removeIdleNode=e=>{if(this.nodeTimeoutBucket.delete(e),e.canBeRemoved){this.nodes.delete(tE(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=iE.removed;$T(e,this.destroyNode)}destroyNode=e=>{e.remove(),this.onNodeRemoved?.(e)};dispose(){this.disposed=!0,this.reset()}},rE={alive:1,initialized:2,waitingForValue:4},iE={uninitialized:rE.alive|rE.waitingForValue,stale:rE.alive|rE.initialized|rE.waitingForValue,valid:rE.alive|rE.initialized,removed:0},aE=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new cE(e,this)}registry;atom;state=iE.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 iE.uninitialized:return`uninitialized`;case iE.stale:return`stale`;case iE.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&rE.waitingForValue)!==0;)this.build();return this._value}build(){this.disposeLifetime(),this.invalidatedDuringBuild=!1;let e=sE(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&rE.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.failed=!1,this.state=iE.valid):this.setValue(t)),e.failure!==QT)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!==iE.valid)throw e;return t.failure===QT&&(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&rE.initialized)===0?Rn():zn(this._value)}setInitialValue(e){if((this.state&rE.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=iE.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&rE.initialized)!==0;if(this.state=iE.valid,n&&this.atom.equals(this._value,e)){t&&this.invalidateChildren();return}this._value=e;let r=QT;try{this.invalidateChildren()}catch(e){r=e}if(this.listeners.size>0)try{this.announce()}catch(e){r===QT&&(r=e)}if(r!==QT)throw r}announce(){uE.phase===lE.collect?uE.notify.add(this):this.notify()}invalidate(){if(this.state===iE.valid){this.state=iE.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&uE.phase!==lE.collect?this.build():this.propagate()}propagate(){uE.phase===lE.collect?(this.building&&(this.invalidatedDuringBuild=!0),uE.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let e=QT;for(let t of Array.from(this.children))if(t.affectedBy(this))try{t.invalidate()}catch(t){e===QT&&(e=t)}if(e!==QT)throw e}affectedBy(e){if(this.state===iE.valid)return!0;let t=this.lifetime?.reads;return t===void 0?this.isObserved&&e.state===iE.valid:t.has(e)}notify(){uE.phase===lE.commit&&uE.notify.delete(this),$T(this.listeners,ZT)}disposeLifetime(){let e=this.lifetime;e!==void 0&&(this.lifetime=void 0,e.dispose())}remove(){let e=this.isObserved;this.state=iE.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let t=Array.from(this.parents);this.parents.clear(),$T(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)}}},oE={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 z(n.value)}},resultOnce(e,t){return Ff(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n(mS(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n(mS(e)))},{immediate:!1});return B(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:z(t.value)},someOnce(e){return Ff(t=>{let n=this.once(e);if(Vn(n))return t(z(n.value));let r=this.node.registry.subscribe(e,e=>{Bn(e)||(r(),t(z(e.value)))},{immediate:!1});return B(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?Rn():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=>B(()=>{this.subscribe(e,e=>nC(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(mT(tS),uT(e=>e._tag===`Success`?z(e.value):Lf(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,$T(e.reverse(),ZT)}},sE=e=>{function t(n){return t.disposed||t.isFn?e.registry.get(n):e.readTracked(n,t)}return Object.setPrototypeOf(t,oE),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=QT,t},cE=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()}},lE={disabled:0,collect:1,commit:2},uE={phase:lE.disabled,depth:0,stale:[],notify:new Set};function dE(e){let t=uE.phase;uE.phase=lE.collect,uE.depth++;let n=QT;try{e()}catch(e){n=e}if(uE.depth===1){let{notify:e,stale:t}=uE,r=0;do{for(uE.phase=lE.collect;r<t.length;r++)try{fE(t[r])}catch(e){n===QT&&(n=e)}uE.phase=lE.commit;for(let t of e)try{t.notify()}catch(e){n===QT&&(n=e)}}while(r<t.length);uE.stale=[],e.clear()}if(uE.depth--,uE.phase=t,n!==QT)throw n}function fE(e){if(e.state===iE.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=iE.stale,e.disposeLifetime()}e.value()}var pE=`~effect/reactivity/Atom`,mE=e=>F(e,pE),hE=`~effect/reactivity/Atom/Writable`,gE=a(2,(e,t)=>{let n=yi(t),r=Di(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Bi(n):void 0})}),_E=gE(0),vE={[pE]:pE,equals:Object.is,...bt,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},yE={...vE,atom(e,t){let n=DE(e,t);return CE(e=>{let t=e.self(),r=e(this);return r._tag===`Success`?n(e,r.value):dS(r,t)})},fn(e,t){return arguments.length===0?(e,t)=>bE(this,e,t):bE(this,e,t)},pull(e,t){let n=_E(AE(0));return JE(n,CE(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?ME(r,qE(r,n,e,t),nS(!0),a.value):dS(a,i)}))},subscriptionRef(e){return zE(_E(CE(t=>{let n=t.self(),r=t(this);if(r._tag!==`Success`)return dS(r,n);let i=typeof e==`function`?e(t):e;return FT(i)?i:ME(t,i,nS(!0),r.value)})),(e,t)=>RE(e,t,pS(e(this))))}},bE=(e,t,n)=>{let[r,i,a]=KE(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return Tf(i)?ooe(i,n.reactivityKeys):hT(i,CT(n.reactivityKeys))}:t,n);return wE(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):dS(i,n)},i)},xE={...vE,[hE]:hE},SE=e=>hE in e,CE=(e,t)=>{let n=Object.create(vE);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},wE=(e,t,n)=>{let r=Object.create(xE);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function TE(e,t){e.setSelf(t)}var EE=(e,t)=>{let n=DE(e,t);return`~effect/reactivity/Atom`in n?n:CE(n)},DE=(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:OE in i?jE(e,i,t,r):kE in i?IE(e,i,t,r):i;default:return i}}}return Tf(e)?function(n,r){return jE(n,e,t,r)}:Qw(e)?function(n,r){return IE(n,e,t,r)}:AE(e)},OE=`~effect/Effect`,kE=`~effect/Stream`,AE=e=>wE(function(t){return e},TE),jE=(e,t,n,r)=>ME(e,t,n?.initialValue===void 0?nS():iS(n.initialValue),r,n?.uninterruptible);function ME(e,t,n,r=hr(),i=!1){let a=e.self(),o=Su();e.addFinalizer(()=>{Bp(r)(Ou(o,lu))});let s,c=!1,l=NE(r.pipe(_r(xu,o),_r(qT,e.registry),_r(ta,e.registry.scheduler)),t,function(t){s=Qx(t,a),c&&e.setSelf(s)},i);return c=!0,l!==void 0&&e.addFinalizer(l),s===void 0?a._tag===`Some`?$x(a):lS(n):s}function NE(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 PE(e){let t=e?.memoMap??_E(EE(()=>Fu())),n=e=>mE(t)?e(t):t,r=wT;function i(e){let t=Object.create(yE);t.keepAlive=!1,t.lazy=!0,t.refresh=void 0,t.factory=i;let a=XE(CE(typeof e==`function`?t=>td(e(t),r):()=>td(e,r)));return t.layer=a,t.read=function(e){let t=e(a);return jE(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=_E(EE(e=>mp(t=>Ru(wT,n(e),Sr(t,xu))).pipe(Yf(Sr(xT)))));return i.withReactivity=e=>t=>ZE(t,n=>{let r=pS(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 FE=PE();FE.withReactivity;var IE=(e,t,n,r)=>LE(e,t,n?.initialValue===void 0?nS():iS(n.initialValue),r);function LE(e,t,n,r=hr()){let i=e.self();r=_r(r,qT,e.registry);let a=wne(n=>Uf(Rw(t.channel,n),t=>Of({while:c,body:()=>t,step(t){e.setSelf(iS(See(t),{waiting:!0}))}}))).pipe(tp(t=>(Qd(t)?f(e.self(),Xn(fS),Hn({onNone:()=>e.setSelf(cS(new Xl,{previous:e.self()})),onSome:t=>e.setSelf(iS(t))})):e.setSelf(sS(t,{previous:e.self()})),Nf))),o=NE(r.pipe(_r(qT,e.registry),_r(ta,e.registry.scheduler)),a,d,!1);return o!==void 0&&e.addFinalizer(o),i._tag===`Some`?$x(i):lS(n)}var RE=(e,t,n=hr())=>FT(t)?(e.addFinalizer(RT(t).pipe(yT(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return Nf}),Vp(n))),Gp(n)(zT(t))):t._tag===`Success`?LE(e,RT(t.value),nS(!0),n):t,zE=(e,t)=>{function n(t,n){let r=t.get(e);FT(r)?Wp(HT(r,n)):rS(r)&&Wp(HT(r.value,n))}return wE(n=>{let r=n(e);return FT(r)||rS(r)?t(n,r):r},n)},BE=function(...e){return e.length===0?VE:VE(...e)},VE=(e,t)=>{let n=_E(AE([0,void 0])),r=t?.initialValue!==void 0;return wE(function(i){i.isFn=!0;let[a,o]=i.get(n);return a===0?r?t.initialValue:Rn():r?e(o,i):zn(e(o,i))},function(e,t){oD(()=>{e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})})},HE=Symbol.for(`effect/reactivity/atom/Atom/Reset`),UE=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`),WE=function(...e){return e.length===0?GE:GE(...e)},GE=(e,t)=>{let[n,r]=KE(e,t);return wE(n,r)};function KE(e,t){let n=_E(AE([0,void 0])),r=t?.initialValue===void 0?nS():iS(t.initialValue),i=t?.concurrent?_E(CE(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===UE)return sS(tne(),{previous:t.self()});let l=e(c,t);return OE in l?(o&&(l=Uf(Dne(l,{startImmediately:!0}),e=>{o.add(e);let t=Array.from(o);return e.addObserver(()=>o.delete(e)),Yf(yS(t),e=>e[0])})),ME(t,l,r,a,!1)):LE(t,l,r,a)}function o(e,t){oD(()=>{t===HE?e.set(n,[0,void 0]):t===UE?e.set(n,[e.get(n)[0]+1,UE]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var qE=(e,t,n,r)=>Uf(noe(typeof n==`function`?n(e):n),n=>{let i=SS().context,a=ai(),o=fp(n,{onFailure(e){return Qd(e)?ri(a)?z({done:!0,items:a}):H(new Xl(`Atom.pull: no items`)):Lf(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=ti(a,e),a=t),z({done:!1,items:t})}}),s=new Set;return e.addFinalizer(()=>{for(let e of s)e()}),e.once(t),e.subscribe(t,()=>{e.setSelf($x(e.self()));let t;t=NE(i,o,n=>{t&&s.delete(t);let r=Qx(n,e.self()),i=s.size>0;e.setSelf(i?lS(r):r)}),t&&s.add(t)}),o}),JE=(e,t)=>wE(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(Zn(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}},YE=a(2,(e,t)=>{function n(n){let r=n(e);return r._tag===`Initial`?lS(n(t)):r}return SE(e)?wE(n,function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):CE(n,e.refresh??function(t){t(e)})}),XE=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),ZE=a(e=>mE(e[0]),(e,t,n)=>{let r=_E(SE(e)?wE(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):CE(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=QE(n.initialValueTarget)),r}),QE=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},$E=a(2,(e,t)=>ZE(e,n=>t(n(e)))),eD=a(2,(e,t)=>{let n=Bi(yi(t));return ZE(e,function(t){let r=setTimeout(()=>t.refresh(e),n);return t.addFinalizer(()=>clearTimeout(r)),t(e)},{initialValueTarget:e})}),tD=a(2,(e,t)=>{let n=Bi(yi(t.staleTime));return ZE(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):()=>{iD(r.once(e),n)&&r.refresh(e)})),Bn(r.self())&&t.revalidateOnMount===!1)return i;if(iD(i,n)){let t=!0;r.addFinalizer(()=>{t=!1}),r.registry.schedulerAsync.makeDispatcher().scheduleTask(()=>{t&&iD(r.once(e),n)&&r.refresh(e)},0)}return i},{initialValueTarget:e})}),nD=e=>e._tag===`Success`?zn(e.timestamp):e._tag===`Failure`?Yn(e.previousSuccess,e=>e.timestamp):Rn(),rD=(e,t,n)=>n-e<t,iD=(e,t)=>{if(e.waiting)return!1;let n=Gn(nD(e));return n===void 0?e._tag!==`Initial`:!rD(n,t,Date.now())},aD=e=>{let t=0,n=_E(AE([t,void 0]));return wE(t=>{let r=t.once(e),i=!1;t.subscribe(e,e=>{if(r=e,a.size>0)return;if(i=!1,!Yx(e))return t.setSelf(e);let n=Gn(t.self());switch(e._tag){case`Initial`:eS(n)&&t.setSelf(e);return;case`Success`:rS(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(rS(c)&&c.waiting)return t.setSelf(c.value);a.delete(n),s&&(o.delete(s),s()),!i&&!aS(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))},oD=dE,sD=(e=>t=>ZE(t,n=>(n.once(e),n.subscribe(e,e=>n.refresh(t)),n.subscribe(t,e=>n.setSelf(e)),n.once(t)),{initialValueTarget:t}))(CE(e=>{let t=0;function n(){document.visibilityState===`visible`&&e.setSelf(++t)}return window.addEventListener(`visibilitychange`,n),e.addFinalizer(()=>{window.removeEventListener(`visibilitychange`,n)}),t})),cD=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 wE(e.mode===`async`?r=>{r.mount(t);let i=hS(Un(()=>{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(rS(n)){if(Vn(n.value))r.setSelf(n.value.value);else{let n=Un(r.self(),e.defaultValue);r.setSelf(n),r.set(t,n)}}},{immediate:!0}),Un(r.self(),e.defaultValue)),(n,r)=>{n.set(t,r),n.setSelf(e.mode===`async`?iS(r):r)})},lD=e=>Yf(qT,t=>t.refresh(e)),uD=`~effect-atom/atom/Atom/ServerValue`,dD=a(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[uD](e=>t.get(e)):t.get(e)),fD=(e,t)=>()=>{let n=wb(Kb(e),t);return RC((e,t)=>z(Uf(e,e=>n(e))))},pD=`~effect/encoding/Sse/SseError`,mD=class extends pa(`EventTooLarge`){get message(){return`Pending SSE event exceeded the maximum size of ${this.maxEventSize}`}},hD=class extends pa(`SseError`){[pD]=pD;get message(){return this.reason.message}},gD=10485760,_D=e=>RC((t,n)=>B(()=>{let n=[],r,i=yD(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 H(n)}return Nf});return Mf(function e(){if(ni(n)){let e=n;return n=[],z(e)}return r?H(r):Uf(a,e)})})),vD=(e,t,n)=>Ew(_D(t),fD(xD.pipe(Qb(e,SD)),n)());function yD(e,t){let n=t?.maxEventSize??gD,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(bD)&&(i=i.slice(bD.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 hD({reason:new mD({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 wD({duration:Fi(parseInt(p,10)),lastEventId:c}))}}var bD=``,xD=K({_tag:rx(`Event`),id:Zb(G),event:G,data:G}),SD=m_({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})}),CD=`~effect/encoding/Sse/Retry`,wD=class e extends da(`Retry`){[CD]=CD;static is(e){return F(e,CD)}static filter(t){return e.is(t)?Nr(t):Pr(t)}},TD=`~effect/http/HttpBody`,ED=e=>F(e,TD),DD=class{[TD];constructor(){this[TD]=TD}[Qe](){return this.toJSON()}toString(){return We(this,{ignoreToString:!0})}},OD=new class extends DD{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},kD=class extends DD{_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??=ND(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}}},AD=(e,t)=>new kD(e,t??`application/octet-stream`,e.length),jD=new TextEncoder,MD=globalThis.Buffer,ND=MD===void 0?e=>jD.encode(e):e=>MD.from(e,`utf8`),PD=(e,t)=>{if(typeof e!=`string`&&(e=e===void 0?``:String(e)),MD!==void 0)return new kD(void 0,t??`text/plain`,MD.byteLength(e,`utf8`),e);let n=jD.encode(e);return new kD(n,t??`text/plain`,n.length,e)},FD=(e,t)=>PD(Yh(Vh(e)),t??`application/x-www-form-urlencoded`),ID=class extends DD{_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}}},LD=e=>new ID(e),RD={"~effect/Ref":{_A:o},...bt,toJSON(){return{_id:`Ref`,ref:this.ref}}},zD=e=>{let t=Object.create(RD);return t.ref=DS(e),t},BD=e=>B(()=>zD(e)),VD=e=>B(()=>e.ref.current),HD=a(2,(e,t)=>B(()=>OS(e.ref,t))),UD=a(2,(e,t)=>B(()=>{let n=e.ref.current;return e.ref.current=t,n})),WD=a(2,(e,t)=>B(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),GD=a(2,(e,t)=>B(()=>{e.ref.current=t(e.ref.current)})),KD=`~effect/http/HttpClientError`,qD=e=>F(e,KD),JD=class extends pa(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[KD]=KD;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},YD=e=>e.endsWith(`Error`)?e.slice(0,-5):e,XD=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,ZD=class extends pa(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return XD(YD(this._tag),this.description,this.methodAndUrl)}},QD=class extends pa(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return XD(YD(this._tag),this.description,this.methodAndUrl)}},$D=class extends pa(`StatusCodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return XD(YD(this._tag),this.description,e)}},eO=class extends pa(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return XD(YD(this._tag),this.description,e)}},tO=class extends pa(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return XD(YD(this._tag),this.description,e)}},nO=class e extends Gx(KD)({_tag:rx(`HttpError`),kind:Yb([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:U(Sx())}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}},rO=e=>e!==`GET`&&e!==`HEAD`&&e!==`OPTIONS`&&e!==`TRACE`,iO=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],aO=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?Nh(Nh(e,`content-type`),`content-length`):(e=t.contentType===void 0?Nh(e,`content-type`):Ah(e,`content-type`,t.contentType),t.contentLength===void 0?Nh(e,`content-length`):Ah(e,`content-length`,t.contentLength.toString())),oO=class extends pa(`UrlError`){},sO=(e,t,n)=>Fr({try:()=>{let r=new URL(e,cO());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 oO({cause:e})}),cO=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},lO=`~effect/http/HttpClientRequest`,uO={[lO]:lO,...tt,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:ze(this.headers),body:this.body.toJSON()}},pipe(){return n(this,arguments)}};function dO(e,t,n,r,i,a){let o=Object.create(uO);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var fO=dO(`GET`,``,Gh,Rn(),Dh,OD),pO=e=>(t,n)=>hO(fO,{method:e,url:t,...n??void 0}),mO=pO(`GET`),hO=a(2,(e,t)=>{let n=e;return t.method&&(n=gO(n,t.method)),t.url&&(n=xO(n,t.url)),t.headers&&(n=vO(n,t.headers)),t.urlParams&&(n=wO(n,t.urlParams)),t.hash&&(n=EO(n,t.hash)),t.body&&(n=DO(n,t.body)),t.accept&&(n=yO(n,t.accept)),t.acceptJson&&(n=bO(n)),n}),gO=a(2,(e,t)=>dO(t,e.url,e.urlParams,e.hash,e.headers,e.body)),_O=a(3,(e,t,n)=>dO(e.method,e.url,e.urlParams,e.hash,Ah(e.headers,t,n),e.body)),vO=a(2,(e,t)=>dO(e.method,e.url,e.urlParams,e.hash,jh(e.headers,t),e.body)),yO=a(2,(e,t)=>_O(e,`Accept`,t)),bO=yO(`application/json`),xO=a(2,(e,t)=>{if(typeof t==`string`)return dO(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=Vh(n.searchParams),i=Wn(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,dO(e.method,n.toString(),r,i,e.headers,e.body)}),SO=a(2,(e,t)=>t===``?e:dO(e.method,CO(t,e.url),e.urlParams,e.hash,e.headers,e.body)),CO=(e,t)=>{let n=e.endsWith(`/`),r=t.startsWith(`/`);return n&&r?e+t.slice(1):!n&&!r?e+`/`+t:e+t},wO=a(2,(e,t)=>dO(e.method,e.url,qh(e.urlParams,t),e.hash,e.headers,e.body)),TO=a(2,(e,t)=>dO(e.method,e.url,Jh(e.urlParams,t),e.hash,e.headers,e.body)),EO=a(2,(e,t)=>dO(e.method,e.url,e.urlParams,zn(t),e.headers,e.body)),DO=a(2,(e,t)=>dO(e.method,e.url,e.urlParams,e.hash,aO(e.headers,t),t)),OO=a(2,(e,t)=>DO(e,LD(t)));function kO(e){let t=sO(e.url,e.urlParams,Gn(e.hash));return Lr(t)?zn(t.success):Rn()}var AO=`~effect/http/HttpIncomingMessage`,jO=(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:ze(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(i.body=r),i},MO=`~effect/http/HttpClientResponse`,NO=(e,t)=>new PO(e,t),PO=class extends nt{[AO];[MO];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[AO]=AO,this[MO]=MO}toJSON(){return jO(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=kO(this.request);return Bn(e)?``:(e.value.hash=``,e.value.href)}get headers(){return Oh(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=uh(this.source.headers.getSetCookie())}get remoteAddress(){return Rn()}get stream(){return this.source.body?Hae({evaluate:()=>this.source.body,onError:e=>new JD({reason:new eO({request:this.request,response:this,cause:e})})}):Rae(new JD({reason:new tO({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 JD({reason:new eO({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:()=>Vh(new URLSearchParams(e)),catch:e=>new JD({reason:new eO({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=Af({try:()=>this.source.formData(),catch:e=>new JD({reason:new eO({request:this.request,response:this,cause:e})})}).pipe(Dp,Wp)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=Af({try:()=>this.source.arrayBuffer(),catch:e=>new JD({reason:new eO({request:this.request,response:this,cause:e})})}).pipe(Dp,Wp),this.arrayBufferBody}pipe(){return n(this,arguments)}},FO=e=>kh({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${Hn(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),IO=`~effect/http/HttpClient`,LO=rr(`effect/HttpClient`),RO=a(2,(e,t)=>zO(n=>t(e.postprocess(n)),e.preprocess)),zO=(e,t)=>{let n=Object.create(BO);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},BO={[IO]:IO,pipe(){return n(this,arguments)},...tt,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(iO.map(([e,t])=>[t,function(t,n){return this.execute(pO(e)(t,n))}]))},VO=e=>zO(t=>Uf(t,t=>Hf(n=>{let r=YO.get(t),i=r??new AbortController,a=sO(t.url,t.urlParams,Gn(t.hash));if(Ir(a))return H(new JD({reason:new QD({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(Ta)||n.getRef(UO)(t)){let a=e(t,o,i.signal,n);return r?a:Mp(e=>fp(e(a),{onSuccess(e){return JO.register(e,i),z(new XO(e,i))},onFailure(e){return Kl(e)&&i.abort(),Lf(e)}}))}return Pp(n.getRef(KO)(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(Ih),l=n.getRef(WO);for(let e in t.headers)l(e,`request`)&&a.attribute(`http.request.header.${e}`,Fh(e,c)?`<redacted>`:t.headers[e]);return t=n.getRef(GO)?vO(t,FO(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}`,Fh(t,c)?`<redacted>`:e.headers[t]);return r?z(e):(JO.register(e,i),z(new XO(e,i)))},onFailure(e){return!r&&Kl(e)&&i.abort(),Lf(e)}})))})})),z),HO=a(2,(e,t)=>zO(e.postprocess,n=>Yf(e.preprocess(n),t))),UO=kr(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>l}),WO=kr(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>c}),GO=kr(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:c}),KO=kr(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),qO=e=>Ku(LO)(mp(t=>Yf(e,e=>RO(e,_p(e=>Dr(t,e)))))),JO=(()=>{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))}}})(),YO=new WeakMap,XO=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[MO]=MO;[AO]=AO;applyInterrupt(e){return Mf(()=>(JO.unregister(this.original),Ap(e,()=>B(()=>{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(()=>(JO.unregister(this.original),hT(this.original.stream,B(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Qe](){return this.original[Qe]()}pipe(){return n(this,arguments)}};({...bt});var ZO=`~effect/socket/Socket`,QO=rr(`effect/socket/Socket`),$O=e=>QO.of({[ZO]:ZO,reader:e.reader,writer:e.writer}),ek=new TextEncoder,tk=`~effect/socket/Socket/CloseEvent`,nk=e=>F(e,tk),rk=`~effect/socket/Socket/SocketError`,ik=e=>F(e,rk),ak=class extends Gx(`effect/socket/Socket/SocketReadError`)({_tag:rx(`SocketReadError`),cause:Sx()}){message=`An error occurred during Read`},ok=class extends Gx(`effect/socket/Socket/SocketWriteError`)({_tag:rx(`SocketWriteError`),cause:Sx()}){message=`An error occurred during Write`},sk=class extends Gx(`effect/socket/Socket/SocketOpenError`)({_tag:rx(`SocketOpenError`),kind:Yb([`Unknown`,`Timeout`]),cause:Sx()}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},ck=class e extends Gx(`effect/socket/Socket/SocketUpgradeError`)({_tag:rx(`SocketUpgradeError`),cause:U(Sx())}){static unsupported=()=>H(new dk({reason:new e({})}));get message(){return this.cause===void 0?`Socket does not support TLS upgrade`:`An error occurred during TLS upgrade`}},lk=class extends Gx(`effect/socket/Socket/SocketCloseError`)({_tag:rx(`SocketCloseError`),code:gx,closeReason:U(G)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},uk=Jb([ak,ok,sk,ck,lk]),dk=class extends Y(rk)(`SocketError`,{_tag:rx(`SocketError`),reason:uk}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[rk]=rk;static is(e){return ik(e)}message=this.reason.message},fk=(e,t)=>new dk({reason:new lk({code:e,closeReason:t})}),pk=class extends rr()(`@effect/platform/Socket/WebSocketConstructor`){},mk=(e,t)=>pk.use(n=>gk(xp((typeof e==`string`?z(e):e).pipe(Yf(e=>n(e,t?.protocols))),e=>B(()=>e.close(1e3))),t)),hk=e=>`pause`in e&&typeof e.pause==`function`,gk=(e,t)=>Hf(n=>{let r,i=wS(!1),a=n.context,o=V(function*(){let n=yield*yp,a=yield*Cu(e,n);`binaryType`in a&&(a.binaryType=`arraybuffer`);let o=hk(a),s=t?.highWaterMark??(o?_k: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(z(_()))}function y(e){u.push(e),s!==void 0&&(d+=typeof e==`string`?ek.encode(e).byteLength:e.byteLength),p!==void 0&&v(),o&&d>=s?h():!o&&!p&&s!==void 0&&d>s&&b(new dk({reason:new ak({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(H(f))}if(p!==void 0){let e=p;p=void 0,e(u.length>0?z(_()):H(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 dk({reason:new ak({cause:e})}))});return}y(t instanceof ArrayBuffer?new Uint8Array(t):t)}function S(e){b(new dk({reason:c?new ak({cause:e}):new sk({kind:`Unknown`,cause:e})}))}function C(e){b(fk(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,B(()=>{if(b(fk(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*H(f??fk(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}),B(()=>{m?.resume===e&&(m=void 0),n()})}).pipe(cp({duration:t?.openTimeout??1e4,orElse:()=>H(new dk({reason:new sk({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(z(_())):f===void 0?(p=e,B(()=>{p===e&&(p=void 0)})):e(H(f))),upgrade:ck.unsupported})}).pipe(_p(e=>Dr(a,e))),s=e=>Mf(()=>{let t=r;if(t===void 0)return i.whenOpen(s(e));try{return nk(e)?t.close(e.code,e.reason):t.send(e),Nf}catch(e){return H(new dk({reason:new ok({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 H(new dk({reason:new ok({cause:e})}))}});return z($O({reader:o,writer:z({write:s,writeAll:c})}))}),_k=65536,vk=new Uint8Array(256);for(let e of"!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")vk[e.charCodeAt(0)]=1;var yk=new Uint8Array(256);yk[9]=1;for(let e=32;e<=126;e++)yk[e]=1;for(let e=128;e<=255;e++)yk[e]=1;var bk=rr(`effect/http/HttpServerRequest`),xk=new WeakSet,Sk=e=>Hf(t=>{let n=xr(t.context,bk);return xk.add(n.source),e}),Ck=rr(`effect/http/HttpRouter`),wk=e=>e.endsWith(`/`)?e.slice(0,-1):e,Tk=a(2,(e,t)=>(t=wk(t),e===`*`?`${t}/*`:e===`/`?t:t+e)),Ek=`~effect/http/HttpRouter/Middleware`,Dk=function(){return arguments.length===0?Ok:Ok(arguments[0],arguments[1])},Ok=(e,t)=>t?.global?Yu(V(function*(){let t=yield*Ck,n=Tf(e)?yield*e:e;yield*t.addGlobalMiddleware(n)})):new jk(Tf(e)?Ju(Yf(e,e=>fr(new Map([[Ak,e]])))):Hu(fr(new Map([[Ak,e]])))),kk=0,Ak=`effect/http/HttpRouter/MiddlewareFn`,jk=class e{[Ek]={};layerFn;dependencies;constructor(e,t){this.layerFn=e,this.dependencies=t;let n=`effect/http/HttpRouter/Middleware-${++kk}`;this.layer=Ju(V({self:this},function*(){let e=yield*pp(),t=[br(e,Ak)];if(this.dependencies){let n=yield*Lu,r=Sr(e,xu),i=yield*Ru(this.dependencies,n,r);t.push(...Nk(i))}return fr(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)}},Mk=new WeakMap,Nk=e=>{let t=Mk.get(e);if(t)return t;let n=ai(),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=Zr(e).reverse()}return Mk.set(e,t),t};Dk(Sk).layer;var Pk={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},Fk=e=>Pk[e],Ik=`~effect/http-api/HttpApiSchema/Stream`;function Lk(e){let t=typeof e==`string`?Fk(e):e;return e=>e.annotate({httpApiStatus:t})}var Rk=(e=>Vb.pipe(Lk(e)))(204);function zk(e){return t=>Vb.pipe(Qb(Pb(t),m_({decode:e.decode,encode:d})))}var Bk=e=>jb(e)&&F(e,Ik),Vk=e=>Bk(e)&&e._tag===`StreamSse`,Hk=e=>Bk(e)&&e._tag===`StreamUint8Array`,Uk=`~effect/http-api/HttpApiSchema/WithHeaders`,Wk=`~effect/http-api/HttpApiSchema/WithHeadersValue`,Gk=e=>({[Wk]:Wk,body:e.body,headers:e.headers}),Kk=e=>jb(e)&&F(e,`~effect/http-api/HttpApiSchema/WithHeaders`);function qk(e,t,n){return Ab(e.ast,{[Uk]:Uk,schema:t,headers:n})}function Jk(e,t){return e.annotate({"~httpApiEncoding":{_tag:t._tag,contentType:t.contentType??Yk(t._tag)}})}function Yk(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 Xk(e){return t=>Jk(t,{_tag:`FormUrlEncoded`,...e})}function Zk(e){return t=>Jk(t,{_tag:`Text`,...e})}var Qk=e=>{if(N_(e)||N_(Cy(e)))return!0;let t=e.encoding?.[0].to;return t!==void 0&&N_(t)},$k=Py(`~httpApiEncoding`),eA=Py(`~httpApiWithHeaders`),tA=Py(`httpApiStatus`),nA={_tag:`Json`,contentType:`application/json`},rA={_tag:`FormUrlEncoded`,contentType:`application/x-www-form-urlencoded`};function iA(e){return $k(e)??nA}function aA(e,t){return $k(e)||(rO(t)?nA:rA)}function oA(e){let t=iA(e);if(t._tag===`Multipart`)throw Error(`Multipart is not supported in response`);return t}function sA(e){return tA(e)??200}function cA(e){return Kk(e)?tA(e.ast)??sA(e.schema.ast):sA(e.ast)}function lA(e){return Kk(e)&&$k(e.ast)===void 0?oA(e.schema.ast):oA(e.ast)}function uA(e){return tA(e)??500}function dA(e){return Kk(e)?tA(e.ast)??uA(e.schema.ast):uA(e.ast)}function fA(e){let t=e.toLowerCase().trim(),n=t.indexOf(`;`);return n===-1?t:t.slice(0,n).trim()}var pA=`~effect/http-api/HttpApiEndpoint`;function mA(e){let t=[];for(let{schemas:n}of e.payload.values())t.push(...n);return t}function hA(e){let t=Array.from(e.success);return ni(t)?t:[Rk]}function gA(e){let t=new Set(e.error),n=e.disableCodecs?o:TA;for(let r of e.middlewares){let e=r;for(let r of e.error)t.add(n(r))}return Array.from(t)}var _A={[pA]:pA,pipe(){return n(this,arguments)},prefix(e){return yA({...vA(this),path:Tk(this.path,e)})},middleware(e){return yA({...vA(this),middlewares:new Set([...this.middlewares,e])})},annotate(e,t){return yA({...vA(this),annotations:_r(this.annotations,e,t)})},annotateMerge(e){return yA({...vA(this),annotations:Dr(this.annotations,e)})}},vA=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 yA(e){function t(){}return Object.setPrototypeOf(t,_A),Object.assign(t,e)}var bA=e=>(t,n,r)=>{let i=r?.disableCodecs??!1,a=i?o:qx;return yA({identifier:t,path:n,method:e,params:xA(r?.params,a),query:xA(r?.query,a),headers:xA(r?.headers,a),payload:SA(r?.payload,e,i),success:wA(r?.success,e,i),error:EA(r?.error,i),annotations:hr(),middlewares:new Set,disableCodecs:i})};function xA(e,t){if(e!==void 0)return jb(e)?t(e):t(K(e))}function SA(e,t,n){let r=new Map;if(e===void 0)return r;let i=Array.isArray(e)?e:jb(e)?[e]:[K(e).pipe(Xk())],a=n?o:IA;for(let e of i){let n=aA(e.ast,t),i=fA(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 CA=`effect/http-api/stream/failure`;function wA(e,t,n){if(e===void 0)return new Set;let r=Qr(e);return DA(r,t),new Set(n?r:r.map(TA))}var TA=m(e=>Bk(e)?e:Kk(e)?qk(e,Bk(e.schema)?e.schema:FA(e.schema,lA(e)),qx(e.headers)):PA(e));function EA(e,t){if(e===void 0)return new Set;let n=Qr(e);for(let e of n)if(Bk(Kk(e)?e.schema:e))throw Error(`Streaming schemas are not supported in error responses`);return kA(n,dA),new Set(t?n:n.map(TA))}function DA(e,t){let n=!1,r=new Map;for(let i of e){let e=Kk(i)?i.schema:i,a=cA(i);if(Bk(e)){if(AA(e,t),n)throw Error(`Multiple streaming success responses are not supported`);n=!0;let i=OA(r,a);if(i.noContent)throw Error(`Cannot combine no-content and streaming success responses for status: ${a}`);if(i.bufferedContentTypes.has(fA(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=OA(r,a),n=Qk(e.ast);if(t.stream!==void 0){if(n)throw Error(`Cannot combine no-content and streaming success responses for status: ${a}`);let e=lA(i);if(fA(e.contentType)===fA(t.stream.contentType))throw Error(`Cannot combine buffered and streaming success responses for status ${a} and content-type: ${e.contentType}`)}n||t.bufferedContentTypes.add(fA(lA(i).contentType)),t.noContent=t.noContent||n}}kA(e,cA)}function OA(e,t){let n=e.get(t);return n===void 0&&(n={bufferedContentTypes:new Set,noContent:!1},e.set(t,n)),n}function kA(e,t){let n=new Map;for(let r of e){let e=t(r),i=eA(r.ast),a=Kk(r)?r.schema:i?.body??r,o=Qk(a.ast)?``:fA(Bk(a)?a.contentType:lA(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(Kk(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 AA(e,t){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare streaming success responses`);if(Vk(e)&&jA(e.events.ast))throw Error(`SSE event name is reserved: ${CA}`)}function jA(e){return MA(Cy(e),new Set)}function MA(e,t){if(t.has(e))return!1;if(t.add(e),z_(e))return e.types.some(e=>MA(e,t));if(B_(e))return MA(e.thunk(),t);if(!R_(e))return!1;let n=e.propertySignatures.find(e=>e.name===`event`);return n!==void 0&&NA(n.type,t)}function NA(e,t){if(t.has(e))return!1;t.add(e);let n=Cy(e);return n===e?F_(e)?e.literal===CA:z_(e)?e.types.some(e=>NA(e,t)):B_(e)?NA(e.thunk(),t):!1:NA(n,t)}function PA(e){let t=oA(e.ast),n=eA(e.ast);return n===void 0?FA(e,t):e.annotate({"~httpApiWithHeaders":{...n,bodyCodec:FA(n.body,t),headersCodec:qx(n.headers)}})}function FA(e,t){switch(t._tag){case`Json`:return Kx(e);case`FormUrlEncoded`:return qx(e);case`Text`:case`Uint8Array`:return e}}function IA(e,t){switch(aA(e.ast,t)._tag){case`Json`:return Kx(e);case`FormUrlEncoded`:return qx(e);case`Text`:case`Uint8Array`:case`Multipart`:return e}}var LA=bA(`GET`),RA=bA(`POST`),zA=bA(`PUT`),BA=bA(`PATCH`),VA=bA(`DELETE`),HA=`~effect/http-api/HttpApi`,UA={[HA]:HA,pipe(){return n(this,arguments)},add(...e){let t={...this.groups};for(let n of e)ct(t,n.identifier,n);return GA({...WA(this),groups:t})},addHttpApi(e){let t={...this.groups};for(let n of Object.keys(e.groups)){let r=e.groups[n];ct(t,n,r.annotateMerge(Dr(e.annotations,r.annotations)))}return GA({...WA(this),groups:t})},prefix(e){return GA({...WA(this),groups:Kr(this.groups,t=>t.prefix(e))})},middleware(e){return GA({...WA(this),groups:Kr(this.groups,t=>t.middleware(e))})},annotate(e,t){return GA({...WA(this),annotations:_r(this.annotations,e,t)})},annotateMerge(e){return GA({...WA(this),annotations:Dr(this.annotations,e)})}},WA=e=>({identifier:e.identifier,groups:e.groups,annotations:e.annotations}),GA=e=>{function t(){}return Object.setPrototypeOf(t,UA),Object.assign(t,e)},KA=e=>GA({identifier:e,groups:{},annotations:hr()}),qA=(e,t)=>{let n=Object.values(e.groups);for(let r of n){let n=Dr(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:Dr(n,e.annotations),successes:JA(hA(e),cA),errors:JA(gA(e),dA)})}},JA=(e,t)=>{let n=new Map;return e.forEach(r),n;function r(e){if(Bk(Kk(e)?e.schema:e))return;let r=t(e),i=n.get(r);i===void 0?n.set(r,[e]):i.push(e)}},YA=class extends rr()(`effect/http-api/HttpApi/ParseOptions`){},XA=class extends rr()(`effect/http-api/HttpApi/ParamsParseOptions`){},ZA=class extends rr()(`effect/http-api/HttpApi/QueryParseOptions`){},QA=class extends rr()(`effect/http-api/HttpApi/HeadersParseOptions`){},$A=class extends rr()(`effect/http-api/HttpApi/PayloadParseOptions`){},ej=class extends rr()(`effect/http-api/HttpApi/SuccessParseOptions`){},tj=class extends rr()(`effect/http-api/HttpApi/ErrorParseOptions`){},nj=e=>{let t=yr(e,YA);return{params:yr(e,XA)??t,query:yr(e,ZA)??t,headers:yr(e,QA)??t,payload:yr(e,$A)??t,success:yr(e,ej)??t,error:yr(e,tj)??t}},rj=new Set;function ij(e){if(e===void 0)return rj;let t=oy(e.ast);return R_(t)&&t.indexSignatures.length===0?new Set(t.propertySignatures.map(e=>String(e.name))):void 0}var aj=(e,t)=>V(function*(){let n=yield*pp(),r=t.httpClient.pipe(t?.baseUrl===void 0?o:HO(SO(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)}})}qA(e,{predicate:t?.predicate,onGroup(e){t.onGroup?.(e)},onEndpoint(e){let{group:n,endpoint:r,errors:a,successes:o,mergedAnnotations:s}=e,c=nj(s),l=uj(r.path,r.params),u={orElse:Aj},d=new Map;for(let[e,t]of a.entries()){let n=gj(t);for(let[t,r]of n.entries())mj(d,e,t,dj(r,c.error,c.headers))}for(let[e,t]of d.entries()){let n=hj(t);u[e]=e=>Uf(tp(n(e),t=>Lf(Hl(Rl(new JD({reason:new $D({request:e.request,response:e})})),t))),H)}let f=new Map;for(let[e,t]of o.entries()){let n=gj(t);for(let[t,r]of n.entries())mj(f,e,t,dj(r,c.success,c.headers))}for(let e of bj(r)){let t=yj(e)?e.schema:e;mj(f,cA(e),t.contentType,xj(e,c.success,c.headers))}for(let[e,t]of f.entries())u[e]=hj(t);let p=DT(r.params,e=>Db(e,c.params)),m=mA(r),h=ni(m)?Db(rO(r.method)?Mj(m,r.method):Jb(m),c.payload):void 0,g=DT(r.headers,e=>Db(e,c.headers)),_=DT(r.query,e=>Db(e,c.query)),v=Array.from(e.middleware,e=>`${e.key}/Client`),y=qp(function*(e){let a=pO(r.method)(r.path);if(e!==void 0){if(p!==void 0){let t=yield*p(e.params);a=xO(a,l(t))}if(h!==void 0){if(rO(r.method)){if(e.payload instanceof FormData)a=OO(a,e.payload);else{let t=yield*h(e.payload);a=DO(a,t)}}else{let t=yield*h(e.payload);a=TO(a,t)}}if(g!==void 0){let t=yield*g(e.headers);a=vO(a,t)}if(_!==void 0){let t=yield*_(e.query);a=TO(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})}})}),oj=(e,t)=>Uf(LO,n=>sj(e,{...t,httpClient:t?.transformClient?t.transformClient(n):n})),sj=(e,t)=>{let n={};return aj(e,{...t,onGroup({group:e}){e.topLevel||ct(n,e.identifier,{})},onEndpoint({endpoint:e,endpointFn:t,group:r}){ct(r.topLevel?n:n[r.identifier],e.identifier,t)}}).pipe(Xf(n))},cj=(e,t)=>{let n={};return qA(e,{onGroup({group:e}){e.topLevel||ct(n,e.identifier,{})},onEndpoint({group:e,endpoint:r,mergedAnnotations:i}){let a=nj(i),o=uj(r.path,r.params),s=r.params===void 0?void 0:kb(r.params,a.params),c=r.query===void 0?void 0:kb(r.query,a.query);ct(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?Gh:Vh(a);if(t?.baseUrl===void 0){let e=Yh(l);return e===``?i:`${i}?${e}`}let u=new URL(SO(mO(i),t.baseUrl.toString()).url);for(let[e,t]of l.params)t!==void 0&&u.searchParams.append(e,t);return u.toString()})}}),n},lj=/(\/?):(\w+)(\?)?/g,uj=(e,t)=>{if(t===void 0||!e.includes(`:`))return t=>e;let n=ij(t);return t=>e.replace(lj,(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 dj(e,t,n){let r=e.some(e=>Kk(e)||eA(e.ast)!==void 0),i=Cb(r?Jb(e.map(e=>pj(e,t,n))):Oj(e),t);return e=>Uf(e.arrayBuffer,r?t=>i({body:t,headers:e.headers}):i)}var fj=K({body:Lb,headers:Lb});function pj(e,t,n){let r=eA(e.ast),i=r===void 0?Kk(e)?{body:e.schema,headers:e.headers,toValue:Gk}:{body:e,headers:Lb,toValue:e=>e.body}:{body:r.bodyCodec,headers:r.headersCodec,toValue:r.transformation.decode},a=Cb(kj(i.body).pipe(Qb(i.body)),t),o=Cb(i.headers,n);return fj.pipe(Qb(Kk(e)?e:Pb(e),p_({decode:e=>Ef({body:a(e.body),headers:o(e.headers)}).pipe(Yf(i.toValue),np(e=>e.issue)),encode:(e,t)=>H(new Sg({message:`Decode only schema`},e,t))})))}function mj(e,t,n,r){let i=fA(n),a=e.get(t);a===void 0?e.set(t,[{contentType:i,decode:r}]):a.push({contentType:i,decode:r})}function hj(e){let t=e[0];return e.length===1&&t!==void 0?t.decode:(t,n)=>{let r=fA(t.headers[`content-type`]??``),i=e.find(e=>e.contentType===r);return i===void 0?_j(t,r,e):i.decode(t,n)}}function gj(e){let t=new Map;for(let n of e){let e=Qk((Kk(n)?n.schema:n).ast)?``:fA(lA(n).contentType),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return t}function _j(e,t,n){let r=Array.from(new Set(n.map(e=>e.contentType))).join(`, `);return H(new JD({reason:new eO({request:e.request,response:e,description:`Unsupported response content-type for status ${e.status}: ${t||`<missing>`}. Expected one of: ${r}`})}))}var vj=`effect/http-api/stream/failure`,yj=e=>Kk(e);function bj(e){let t=[];for(let n of e.success)Bk(Kk(n)?n.schema:n)&&t.push(n);return t}function xj(e,t,n){let r=yj(e),i=r?e.schema:e,a=Hk(i)?void 0:{declaration:i,decoder:Sj(i,t)},o=(e,t)=>Yf(pp(),n=>gT(a===void 0?e.stream:Cj(e.stream,a.declaration,a.decoder(t)),n));if(!r)return o;let s=Cb(e.headers,n);return(e,t)=>Uf(s(e.headers),n=>Yf(o(e,t),e=>Gk({body:e,headers:n})))}function Sj(e,t){let n=Jb([K({id:U(G),event:W(vj),data:Tx(Kx(kx(e.error,Sx())))}),e.events]),r=vD(n,void 0,t);return e=>e===void 0?r:vD(n,e,t)}function Cj(e,t,n){let r=tT(e.pipe(eoe,$ae(n)),e=>B(()=>{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===vj&&Pl(r.data)){if(n===0)return Lf(r.data);t=r.data,e=e.slice(0,n);break}}return z(e)}):Lf(t))}));return t.sseMode===`data`?lT(r,e=>e.data):r}var wj=ix(globalThis.ArrayBuffer,{expected:`ArrayBuffer`}),Tj=wj.pipe(Qb(Bie,m_({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)}}))),Ej=wj.pipe(Qb(G,m_({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)}}))),Dj=Ej.pipe(Qb(Jb([W(``).pipe(Qb(Rb,m_({decode:()=>void 0,encode:()=>``}))),Rie])));function Oj(e){return Jb(e.map(t));function t(e){return kj(e).pipe(Qb(e))}}function kj(e){switch(oA(e.ast)._tag){case`Json`:return M_(Cy(e.ast))?Dj.pipe(Qb(Lb,m_({decode:e=>e===void 0?null:e,encode:e=>e===null?void 0:e}))):Dj;case`FormUrlEncoded`:return Ej.pipe(Qb(Fx,m_({decode:e=>Vh(new URLSearchParams(e)),encode:Yh})));case`Uint8Array`:return Tj;case`Text`:return Ej}}var Aj=e=>H(new JD({reason:new eO({request:e.request,response:e})})),jj=_b(ED);function Mj(e,t){return Jb(e.map(e=>Pj(e,t)))}var Nj=new WeakMap;function Pj(e,t){let n=e.ast,r=Nj.get(n);if(r!==void 0)return r;let i=aA(n,t),a=jj.pipe(Qb(e,p_({decode(e,t){return H(new Sg({message:`Encode only schema`},e,t))},encode(e,t){switch(i._tag){case`Multipart`:return H(new Sg({message:`Payload must be a FormData`},e,t));case`Json`:try{return z(PD(JSON.stringify(e),i.contentType))}catch{return H(new bg({expected:`a JSON-serializable request body`},e,t))}case`Text`:return typeof e==`string`?z(PD(e,i.contentType)):H(new bg({message:`Expected a string`},e,t));case`FormUrlEncoded`:return N(e)?z(FD(Vh(e),i.contentType)):H(new bg({message:`Expected a record`},e,t));case`Uint8Array`:return e instanceof Uint8Array?z(AD(e,i.contentType)):H(new bg({message:`Expected a Uint8Array`},e,t))}}})));return Nj.set(n,a),a}var Fj=`~effect/reactivity/AtomRef`,Ij=e=>new zj(e),Lj={count:0,generate(){return`AtomRef-${this.count++}`}},Rj=class{[Fj];key=Lj.generate();value;constructor(e){this[Fj]=Fj,this.value=e}[ye](e){return be(this.value,e.value)}[te](){return R(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 Bj(this,e)}},zj=class extends Rj{prop(e){return new Vj(this,e)}set(e){return be(e,this.value)?this:(this.value=e,this.notify(e),this)}update(e){return this.set(e(this.value))}},Bj=class e{[Fj];key=Lj.generate();parent;transform;constructor(e,t){this[Fj]=Fj,this.parent=e,this.transform=t}[ye](e){return be(this.value,e.value)}[te](){return R(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);be(r,t)||(t=r,e(r))})}map(t){return new e(this,t)}},Vj=class e{[Fj];key=Lj.generate();previous;parent;_prop;constructor(e,t){this[Fj]=Fj,this.parent=e,this._prop=t,this.previous=e.value[t]}[ye](e){return be(this.value,e.value)}[te](){return R(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];be(r,t)||(t=r,e(r))})}map(e){return new Bj(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}},Hj=class extends rr()(`effect/workers/Transferable/Collector`){},Uj=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return Hj.of({addAllUnsafe:t,addAll:e=>B(()=>t(e)),readUnsafe:n,read:B(n),clearUnsafe:r,clear:B(r)})},Wj=Jb([class extends Gx(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:rx(`WorkerSpawnError`),message:G,cause:U(Sx())}){},class extends Gx(`effect/workers/WorkerError/WorkerSendError`)({_tag:rx(`WorkerSendError`),message:G,cause:U(Sx())}){},class extends Gx(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:rx(`WorkerReceiveError`),message:G,cause:U(Sx())}){},class extends Gx(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:rx(`WorkerUnknownError`),message:G,cause:U(Sx())}){}]),Gj=`~effect/PrimaryKey`,Kj=`~effect/rpc/RpcSchema/StreamSchema`;function qj(e){return F(e,Kj)}function Jj(e){return qj(e)?zn({success:e.success,error:e.error}):Rn()}var Yj=_b(Qw);function Xj(e,t){return Ab(Yj.ast,{[Kj]:Kj,success:e,error:t})}var Zj=`~effect/rpc/Rpc`,Qj={[Zj]:Zj,pipe(){return n(this,arguments)},setSuccess(e){return $j({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return $j({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return $j({_tag:this._tag,payloadSchema:jb(e)?e:K(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return $j({_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 $j({_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 $j({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:_r(this.annotations,e,t)})},annotateMerge(e){return $j({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Dr(this.annotations,e)})}},$j=e=>{function t(){}return Object.setPrototypeOf(t,Qj),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},eM=(e,t)=>{let n=t?.success??Vb,r=t?.error??Ib,i=t?.defect??Sx(),a;return a=t?.primaryKey?class extends Gie(`effect/rpc/Rpc/${e}`)(t.payload){[Gj](){return t.primaryKey(this)}}:jb(t?.payload)?t?.payload:t?.payload?K(t?.payload):Vb,$j({_tag:e,payloadSchema:a,successSchema:t?.stream?Xj(n,r):n,errorSchema:t?.stream?Ib:r,defectSchema:i,annotations:hr(),middlewares:new Set})},tM=new WeakMap,nM=e=>{if(tM.has(e))return tM.get(e);let t=e,n=new Set([t.errorSchema]),r=Jj(t.successSchema);Vn(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=Wie(Vn(r)?Vb:t.successSchema,Jb([...n]),t.defectSchema);return tM.set(e,i),i},rM=`~effect/rpc/Rpc/Wrapper`,iM=e=>rM in e,aM=`~effect/rpc/RpcClientError`,oM=class extends Gx(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:rx(`RpcClientDefect`),message:G,cause:Sx()}){},sM=class extends Gx(aM)({_tag:rx(`RpcClientError`),reason:Jb([Wj,uk,nO,oM])}){[aM]=aM;get message(){return`${this.reason._tag}: ${this.reason.message}`}},cM=e=>e,lM={_tag:`Ping`},uM=Kx,dM,fM=e=>(dM??=new TextDecoder).decode(e),pM=class extends rr()(`effect/rpc/RpcSerialization`){},doe=pM.of({contentType:`application/json`,includesFraming:!1,codecFor:uM,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e==`string`?e:fM(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),foe=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 V(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))})}}))}),poe=0,moe=qp(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>poe++),s=yield*pp(),c=Sr(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=qj(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?Oh(s.headers):Dh,l=s?.context??hr();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:Mh(f.getRef(mM),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(bS(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*Ene(`${n}.${e._tag}`,{attributes:t.spanAttributes}),m=SS(),h=a(),_=xr(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:Mh(m.getRef(mM),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=br(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=SS();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=>{ct(v,e._tag,f(e))});return{client:v,write:_}}),hoe=0,goe=qp(function*(e,t){let n=hoe++,{codecFor:r,run:i,send:a,supportsAck:o,supportsTransferables:s}=yield*hM,c=_oe(r),l=hie(r(Sx())),u=new Map,d=e=>u.has(e)?(u.delete(e),a(n,{_tag:`Interrupt`,requestId:e})):Nf,{client:f,write:p}=yield*moe(e,{...t,supportsAck:o,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),i=s?Uj():void 0,o=SS(),l={rpc:r,context:i?_r(o.context,Hj,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=cM(e.requestId),n=u.get(t);if(!n||Bn(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))))),hne(e=>!Kl(e),()=>Nf)))}case`Exit`:{let t=cM(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}),_oe=e=>{let t=new WeakMap;return n=>{let r=t.get(n);return r===void 0?(r={decodeChunk:Yn(Jj(n.successSchema),t=>Cb(e(Kb(t.success)))),encodePayload:Ob(e(n.payloadSchema)),decodeExit:Cb(e(nM(n)))},t.set(n,r),r):r}},mM=kr(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>Dh}),hM=class extends rr()(`effect/rpc/RpcClient/Protocol`){static make=foe},voe=e=>hM.make(qp(function*(t,n){let r=yield*QO,i=yield*pM,a=yield*Cne(xoe),s=new Map,c=yield*r.writer,l=i.makeUnsafe(),u=yield*boe(Mf(()=>c.write(l.encode(lM)))),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 sM({reason:new oM({message:`Error decoding message`,cause:e})})})}};return yield*Mf(()=>(l=i.makeUnsafe(),u.reset(),V(function*(){let{pull:e}=yield*r.reader;for(f=void 0,Vn(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,()=>H(new dk({reason:new ak({cause:Error(`ping timeout`)})}))))))).pipe(Vn(a)?wp(a.value.onDisconnect):o,gne(t=>{let n=Wl(t),r=Lr(n),i=new sM({reason:r?n.success.reason:new oM({message:`Unknown socket error`,cause:Ul(t)})});return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?(e.onTransientError?.(i)??Nf).pipe(vne({log:!0,message:`RpcClient onTransientError hook failed`})):m(i)}),_ne(e?.retryPolicy??yoe,e=>m(new sM({reason:e.reason}))),Mne({module:`RpcClient`,method:`makeProtocolSocket`}),Rp),{send(e,t){if(f)return H(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}})),yoe=pf([hf(500,1.5),gf(5e3)]),boe=qp(function*(e){let t=!0,n=wS();return yield*Mf(()=>t?(t=!1,e):n.open).pipe(bne(`5 seconds`),ap,Np,kp,Rp),{timeout:n.await,reset:()=>{t=!0,n.closeUnsafe()},onPong:()=>{t=!0}}}),xoe=class extends rr()(`effect/rpc/RpcClient/ConnectionHooks`){},Soe=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)},ee={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=ee,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`})),gM=t(((e,t)=>{t.exports=Soe()})),Z=e(gM(),1),Coe=Z.use,_M=Z.useLayoutEffect;function woe(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 Toe(e){let t=Z.useRef(null);return Z.useImperativeHandle(e,()=>t.current,[]),t}function vM(e){if(URL.canParse)return URL.canParse(e);try{return new URL(e),!0}catch{return!1}}function yM(e){return e[e.length-1]}function bM(e,t){return typeof e==`function`?e(t):e}var xM=Object.prototype.hasOwnProperty,Eoe=Object.prototype.propertyIsEnumerable;function Doe(e){for(let t in e)if(xM.call(e,t))return!0;return!1}var Ooe=()=>Object.create(null),koe=(e,t)=>SM(e,t,Ooe);function SM(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=EM(e)&&EM(i);if(!a&&!(wM(e)&&wM(i)))return i;let o=a?e:CM(e);if(!o)return i;let s=a?i:CM(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:xM.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=SM(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function CM(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(!Eoe.call(e,r))return!1;t.push(r)}return t}function wM(e){if(!TM(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!TM(n)||!n.hasOwnProperty(`isPrototypeOf`))}function TM(e){return Object.prototype.toString.call(e)===`[object Object]`}function EM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function DM(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(!DM(e[r],t[r],n))return!1;return!0}if(wM(e)&&wM(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!DM(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||!DM(e[o],t[o],n)))return!1;return i===a}return!1}function Aoe(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 joe=/[\x00-\x1f\x7f"<>`{}]/g;function Moe(e){return e.replace(joe,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function OM(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 Moe(t)}var Noe=[`http:`,`https:`,`mailto:`,`tel:`];function kM(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Poe(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+=OM(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=OM(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Foe(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ioe(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 AM(){throw Error(`Invariant failed`)}function jM(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 MM=4,NM=5;function PM(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 FM(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=PM(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=LM(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=Loe(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=LM(r);e.kind=NM,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=LM(r);e.kind=MM,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)FM(e,t,r,c,i,a,o,s)}function IM(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 LM(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 Loe(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 Roe(e,t){let n=LM(`/`),r=new Uint16Array(6),i=[];for(let t of e)FM(!1,r,t,1,n,0,i);for(let e of i)e.sort(IM);t.masksTree=n,t.flatCache=jM(1e3)}function zoe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=RM(e,t.masksTree);return t.flatCache.set(e,r),r}function Boe(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=LM(`/`),FM(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),RM(r,o,n)}function Voe(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=RM(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=BM(a.route)),t.matchCache.set(r,a),a}function Hoe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Uoe(e,t=!1,n){let r=LM(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;FM(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&AM(),o[e.id]=e,c!==0&&e.path){let t=Hoe(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(IM);return{processedTree:{segmentTree:r,singleCache:jM(1e3),matchCache:jM(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function RM(e,t,n=!1){let r=e.split(`/`),i=Goe(e,r,t,n);if(!i)return null;let[a]=zM(e,r,i);return{route:i.node.route,rawParams:a}}function zM(e,t,n){let r=Woe(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===MM)break;if(u.kind===NM){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 BM(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Woe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Goe(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!yM(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&&!UM(l,n))continue;if(i.parse){if(!HM(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==MM&&UM(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===MM||i.kind===2)&&UM(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&&(HM(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Koe(f,o))return n;UM(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+VM(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+VM(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+VM(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+VM(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 VM(e,t){return 2**(e-t-1)}function Koe(e,t){return e===2**(t-1)-1}function HM(e,t,n){let r,i;try{[r,i]=zM(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 UM(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===MM)>(e.node.kind===MM)||t.node.kind===MM==(e.node.kind===MM)&&t.node.depth>e.node.depth)))}function qoe(e){return WM(e.filter(e=>e!==void 0).join(`/`))}function WM(e){return e.replace(/\/{2,}/g,`/`)}function GM(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function KM(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Joe(e){return KM(GM(e))}function qM(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Yoe(e,t,n){return qM(e,n)===qM(t,n)}function Xoe({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=WM(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=WM(e)),o=e.split(`/`);o.length>1&&yM(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&&(yM(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?WM(s):s)||`/`;return a&&r&&r.set(a,c),c}function Zoe(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 JM(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>YM(e,n)).join(`/`):YM(r,n):r}function Qoe({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=PM(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=JM(`_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=JM(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=JM(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function YM(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var $oe=`Error preloading route! ☝️`,ese=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})),XM=t(((e,t)=>{t.exports=ese()})),Q=XM();function tse({children:e,fallback:t=null}){return(0,Q.jsx)(Z.Fragment,{children:ZM()?e:t})}function ZM(){return Z.useSyncExternalStore(nse,()=>!0,()=>!1)}function nse(){return()=>{}}var QM=Z.createContext(null);function $M(e){return Z.useContext(QM)}var rse=t((e=>{var t=gM();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})),eN=t(((e,t)=>{t.exports=rse()})),ise=t((e=>{var t=gM(),n=eN();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}})),tN=t(((e,t)=>{t.exports=ise()})),nN=e(tN(),1);function ase(e,t){return e===t}function rN(e,t,n=ase){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,nN.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function iN(e){let t=$M();return Z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ose(e){let t=$M(),n=iN(),r=Z.useRef(null);return _M(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function aN(e){let t=Z.useRef(e);return DM(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function sse(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function cse(e,t,n){if(e?.external)return kM(e.href,n)?void 0:e.href;if(!hse(t)&&vM(t))return kM(t,n)?void 0:t}function lse(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Yoe(e.pathname,t.pathname,r))return!1}else{let n=qM(e.pathname,r),i=qM(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!DM(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function use(e,t){let n=$M(),r=Toe(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,...ee}=e,L=s,te=ZM(),R=aN(e.search),ne=aN(e.params),re=aN(o),ie=Z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,R,ne,e.state,e.mask,e.unsafeRelative]),ae=Z.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...ie}),r=mse(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=cse(r,L,n.protocolAllowlist);return[r?.href,i,lse(e,t,re,n.basepath,te,i!==void 0)]},[re,v,te,ie,n,L]),[oe,se,ce]=rN(n.stores.location,ae,sse),le=ce?bM(i,{})??dse:oN,ue=ce?oN:bM(a,{})??oN,de=[b,le.className,ue.className].filter(Boolean).join(` `),fe=(y||le.style||ue.style)&&{...y,...le.style,...ue.style},pe=Z.useRef(!1),me=e.reloadDocument||se||v?!1:c??n.options.defaultPreload,he=l??n.options.defaultPreloadDelay??0,ge=Z.useCallback(()=>{n.preloadRoute(ie).catch(e=>{console.warn(e),console.warn($oe)})},[n,ie]),_e=Z.useCallback(e=>{if(!e){cN(r);return}if(!(e.isIntersecting??me===`intent`)){e.isIntersecting===!1&&cN(r);return}if(!he){ge();return}sN.has(r)||sN.set(r,setTimeout(()=>{sN.delete(r),ge()},he))},[ge,r,me,he]);woe(r,_e,me!==`viewport`),Z.useEffect(()=>{pe.current||me===`render`&&(ge(),pe.current=!0)},[ge,me]);let ve=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({...ie,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(se)return{...ee,ref:r,href:se,...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 ye=()=>{me===`intent`&&ge()},be=()=>{me===`intent`&&cN(r)};return{...ee,...le,...ue,href:oe,ref:r,onClick:lN([x,ve]),onBlur:lN([S,be]),onFocus:lN([C,_e]),onMouseEnter:lN([w,_e]),onMouseLeave:lN([T,be]),onTouchStart:lN([E,ye]),disabled:!!v,target:_,...fe&&{style:fe},...de&&{className:de},...v&&fse,...ce&&pse}}var oN={},dse={className:`active`},fse={role:`link`,"aria-disabled":!0},pse={"data-status":`active`,"aria-current":`page`},sN=new WeakMap,cN=e=>{clearTimeout(sN.get(e)),sN.delete(e)},lN=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function mse(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function hse(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var uN=Z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=use(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)}),gse=e=>e,_se=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}}}})),dN=t(((e,t)=>{t.exports=_se()})),vse=t((e=>{var t=gM();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`})),fN=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=vse()})),yse=t((e=>{var t=gM().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}})),pN=t(((e,t)=>{t.exports=yse()})),mN=e(dN(),1);function bse(e){let t=mN.unstable_scheduleCallback(4,e);return()=>mN.unstable_cancelCallback(t)}var hN=Z.createContext(KT({scheduleTask:bse,defaultIdleTTL:400})),gN=new WeakMap;function xse(e,t){let n=gN.get(e);n===void 0&&(n=new WeakMap,gN.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 dD(t,e)}};return n.set(t,i),i}function _N(e,t){let n=xse(e,t);return Z.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}var vN=(e,t)=>{let n=Z.useContext(hN);return t?_N(n,Z.useMemo(()=>$E(e,t),[e,t])):_N(n,e)};function yN(e,t){Z.useEffect(()=>e.mount(t),[t,e])}function bN(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?Z.useCallback(r=>{e.set(t,r);let i=Up(YT(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(Sse):i},[e,t,n.mode]):Z.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var Sse=e=>{if(uu(e))return e.value;throw Ul(e.cause)},xN=e=>{yN(Z.useContext(hN),e)},SN=(e,t)=>{let n=Z.useContext(hN);return yN(n,e),bN(n,e,t)},CN=e=>{let t=Z.useContext(hN);return yN(t,e),Z.useCallback(()=>{t.refresh(e)},[t,e])},wN=(e,t)=>{let n=Z.useContext(hN);return[_N(n,e),bN(n,e,t)]},TN={suspendOnWaiting:new WeakMap,default:new WeakMap};function Cse(e,t,n){let r=n?TN.suspendOnWaiting:TN.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 wse(e,t,n){let r=_N(e,t);if(r._tag===`Initial`||n&&r.waiting)throw Cse(e,t,n);return r}var Tse=(e,t)=>{let n=wse(Z.useContext(hN),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw Ul(n.cause);return n},EN=e=>{let[,t]=Z.useReducer(e=>e+1,0);return Z.useEffect(()=>e.subscribe(t),[e]),e.value},DN=eN();function ON(){}var kN=Object.freeze([]),AN=Object.freeze({});function jN(e){Z.useEffect(e,kN)}var MN={};function NN(e,t){let n=Z.useRef(MN);return n.current===MN&&(n.current=e(t)),n}var PN=typeof document<`u`?Z.useLayoutEffect:()=>{},FN=e(fN(),1);function Ese(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 IN=Ese(`https://base-ui.com/production-error`,`Base UI`),Dse=19;function LN(e){return Dse>=e}var RN=[],zN=void 0;function Ose(){return zN}function kse(e){RN.push(e)}function BN(e){let t=(t,n)=>{let r=NN(Ase).current,i;try{zN=r;for(let e of RN)e.before(r);i=e(t,n);for(let e of RN)e.after(r);r.didInitialize=!0}finally{zN=void 0}return i};return t.displayName=e.displayName||e.name,t}function VN(e){return Z.forwardRef(BN(e))}function Ase(){return{didInitialize:!1}}var jse=LN(19)?Nse:Pse;function HN(e,t,n,r,i){return jse(e,t,n,r,i)}function Mse(e,t,n,r,i){let a=Z.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,DN.useSyncExternalStore)(e.subscribe,a,a)}kse({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,DN.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Nse(e,t,n,r,i){let a=Ose();if(!a)return Mse(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 Pse(e,t,n,r,i){return(0,nN.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Fse=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 HN(this,e,t,n,r)}},UN={...Z},WN=UN.useInsertionEffect,Ise=WN&&WN!==UN.useLayoutEffect?WN:e=>e();function GN(e){let t=NN(Lse).current;return t.next=e,Ise(t.effect),t.trampoline}function Lse(){let e={next:void 0,callback:Rse,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Rse(){}var KN=class extends Fse{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Z.useDebugValue(e);let n=this;PN(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;PN(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;PN(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){Z.useDebugValue(e);let n=this,r=t!==void 0;PN(()=>{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),HN(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Z.useDebugValue(e);let n=GN(t??ON);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 qN(){return typeof window<`u`}function JN(e){return ZN(e)?(e.nodeName||``).toLowerCase():`#document`}function YN(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function XN(e){return((ZN(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ZN(e){return qN()?e instanceof Node||e instanceof YN(e).Node:!1}function QN(e){return qN()?e instanceof Element||e instanceof YN(e).Element:!1}function $N(e){return qN()?e instanceof HTMLElement||e instanceof YN(e).HTMLElement:!1}function eP(e){return!qN()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof YN(e).ShadowRoot}function tP(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=cP(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function zse(e){return/^(table|td|th)$/.test(JN(e))}function nP(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Bse=/transform|translate|scale|rotate|perspective|filter/,Vse=/paint|layout|strict|content/,rP=e=>!!e&&e!==`none`,iP;function aP(e){let t=QN(e)?cP(e):e;return rP(t.transform)||rP(t.translate)||rP(t.scale)||rP(t.rotate)||rP(t.perspective)||!oP()&&(rP(t.backdropFilter)||rP(t.filter))||Bse.test(t.willChange||``)||Vse.test(t.contain||``)}function Hse(e){let t=uP(e);for(;$N(t)&&!sP(t);){if(aP(t))return t;if(nP(t))return null;t=uP(t)}return null}function oP(){return iP??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),iP}function sP(e){return/^(html|body|#document)$/.test(JN(e))}function cP(e){return YN(e).getComputedStyle(e)}function lP(e){return QN(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uP(e){if(JN(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||eP(e)&&e.host||XN(e);return eP(t)?t.host:t}function dP(e){let t=uP(e);return sP(t)?(e.ownerDocument||e).body:$N(t)&&tP(t)?t:dP(t)}function fP(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=dP(e),i=r===e.ownerDocument?.body,a=YN(r);if(i){let e=pP(a);return t.concat(a,a.visualViewport||[],tP(r)?r:[],e&&n?fP(e):[])}return t.concat(r,fP(r,[],n))}function pP(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mP(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function hP(e){return e?.ownerDocument||document}function gP(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var _P=null;globalThis.requestAnimationFrame;var vP=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)}},yP=class e{static create(){return new e}static request(e){return vP.request(e)}static cancel(e){return vP.cancel(e)}currentId=_P;request(e){this.cancel(),this.currentId=vP.request(()=>{this.currentId=_P,e()})}cancel=()=>{this.currentId!==_P&&(vP.cancel(this.currentId),this.currentId=_P)};disposeEffect=()=>this.cancel};function bP(){let e=NN(yP.create).current;return jN(e.disposeEffect),e}var xP=0,SP=class e{static create(){return new e}currentId=xP;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=xP,t()},e)}isStarted(){return this.currentId!==xP}clear=()=>{this.currentId!==xP&&(clearTimeout(this.currentId),this.currentId=xP)};disposeEffect=()=>this.clear};function CP(){let e=NN(SP.create).current;return jN(e.disposeEffect),e}function Use(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Wse,platform:Gse,maxTouchPoints:Kse}=Use(),wP=Wse.toLowerCase(),TP=Gse.toLowerCase(),EP=/^i(os$|p)/.test(TP)||TP===`macintel`&&Kse>1,DP=`android`,OP=TP===DP||wP.includes(DP),kP=!EP&&TP.startsWith(`mac`);TP.startsWith(`win`),!OP&&/^(linux|chrome os)/.test(TP);var qse=kP||EP,AP=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!AP&&wP.includes(`firefox`),!AP&&wP.includes(`chrom`);var Jse=qse,jP=/jsdom|happydom/.test(wP);function MP(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function NP(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&eP(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function PP(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var Yse=`data-base-ui-focusable`,Xse=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,FP=`ArrowLeft`,IP=`ArrowRight`,Zse=`ArrowUp`,Qse=`ArrowDown`,LP=`data-starting-style`,RP=`data-ending-style`,$se={[LP]:``},ece={[RP]:``},zP={transitionStatus(e){return e===`starting`?$se:e===`ending`?ece:null}},tce=`data-open`,nce=`data-closed`,rce=`data-anchor-hidden`,BP=`data-popup-open`,ice=`data-pressed`,ace={[BP]:``},oce={[BP]:``,[ice]:``},sce={[tce]:``},cce={[nce]:``},lce={[rce]:``},VP={open(e){return e?ace:null}},HP={open(e){return e?oce:null}},UP={open(e){return e?sce:cce},anchorHidden(e){return e?lce:null}},WP={...UP,...zP},GP=`data-trigger-disabled`;function KP(e,t){if(!QN(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(GP);for(let[,e]of t.entries())if(NP(e,n))return!e.hasAttribute(GP);return!1}function qP(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 uce(e){return e.matches(`html,body`)}function JP(e){return $N(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function dce(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Xse}`)!=null}function YP(e){return e?e.getAttribute(`role`)===`combobox`&&JP(e):!1}function XP(e){if(!e||jP)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function ZP(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function QP(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...QP(e,t.id,n)])}function $P(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 eF(e){e.preventDefault(),e.stopPropagation()}function fce(e){return`nativeEvent`in e}function tF(e){return e.pointerType===``&&e.isTrusted?!0:OP&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function nF(e){return jP?!1:!OP&&e.width===0&&e.height===0||OP&&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 rF(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function pce(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var iF=Math.min,aF=Math.max,oF=Math.round,sF=Math.floor,cF=e=>({x:e,y:e}),mce={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function lF(e,t,n){return aF(e,iF(t,n))}function uF(e,t){return typeof e==`function`?e(t):e}function dF(e){return e.split(`-`)[0]}function fF(e){return e.split(`-`)[1]}function pF(e){return e===`x`?`y`:`x`}function mF(e){return e===`y`?`height`:`width`}function hF(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function gF(e){return pF(hF(e))}function hce(e,t,n){n===void 0&&(n=!1);let r=fF(e),i=gF(e),a=mF(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bF(o)),[o,bF(o)]}function gce(e){let t=bF(e);return[_F(e),t,_F(t)]}function _F(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var vF=[`left`,`right`],yF=[`right`,`left`],_ce=[`top`,`bottom`],vce=[`bottom`,`top`];function yce(e,t,n){switch(e){case`top`:case`bottom`:return n?t?yF:vF:t?vF:yF;case`left`:case`right`:return t?_ce:vce;default:return[]}}function bce(e,t,n,r){let i=fF(e),a=yce(dF(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(_F)))),a}function bF(e){let t=dF(e);return mce[t]+e.slice(t.length)}function xce(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function xF(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xce(e)}function SF(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 CF(e,t){return t<0||t>=e.length}function wF(e,t){return EF(e.current,{disabledIndices:t})}function TF(e,t){return EF(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function EF(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&&DF(e,a,r));return a}function DF(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!OF(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Sce(e){return e.visibility===`hidden`||e.visibility===`collapse`}function OF(e,t=e?cP(e):null){return!e||!e.isConnected||!t||Sce(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Cce=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function wce(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return eP(n)?n.host:null}function kF(e){for(let t of Array.from(e.children))if(JN(t)===`summary`)return t;return null}function Tce(e,t){let n=kF(t);return!!n&&(e===n||NP(n,e))}function AF(e){let t=e?JN(e):``;return e!=null&&e.matches(Cce)&&(t!==`summary`||e.parentElement!=null&&JN(e.parentElement)===`details`&&kF(e.parentElement)===e)&&(t!==`details`||kF(e)==null)&&(t!==`input`||e.type!==`hidden`)}function jF(e){if(!AF(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=wce(t)){let n=t!==e,r=JN(t)===`slot`;if(t.hasAttribute(`inert`)||n&&JN(t)===`details`&&!t.open&&!Tce(e,t)||t.hasAttribute(`hidden`)||!r&&!Ece(t,n))return!1}return!0}function Ece(e,t){let n=cP(e);return t?n.display!==`none`:OF(e,n)}function MF(e){let t=e.tabIndex;if(t<0){let t=JN(e);if(t===`details`||t===`audio`||t===`video`||$N(e)&&e.isContentEditable)return 0}return t}function NF(e){if(JN(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Dce(e,t){let n=NF(e);if(!n)return!0;let r=t.find(e=>{let t=NF(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=NF(e);return t?.name===n.name&&t.form===n.form})===n}function PF(e){if($N(e)&&JN(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return $N(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function FF(e,t){PF(e).forEach(e=>{AF(e)&&t.push(e),FF(e,t)})}function IF(e,t,n){PF(e).forEach(e=>{$N(e)&&e.matches(t)&&n.push(e),IF(e,t,n)})}function LF(e){return jF(e)&&MF(e)>=0}function RF(e){let t=[];return FF(e,t),t.filter(jF)}function zF(e){let t=RF(e);return t.filter(e=>MF(e)>=0&&Dce(e,t))}function BF(e,t){let n=zF(e),r=n.length;if(r===0)return;let i=MP(hP(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function VF(e){return BF(hP(e).body,1)||e}function HF(e){return BF(hP(e).body,-1)||e}function UF(e,t){if(!e)return null;let n=zF(hP(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 WF(e){return UF(e,1)}function GF(e){return UF(e,-1)}function KF(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!NP(n,r)}function qF(e){zF(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function JF(e){let t=[];IF(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var YF={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},XF={...YF,position:`fixed`,top:0,left:0},ZF={...YF,position:`absolute`},QF=Z.forwardRef(function(e,t){let[n,r]=Z.useState();PN(()=>{Jse&&AP&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Q.jsx)(`span`,{...e,ref:t,style:XF,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function $F(e,t,n,r){let i=NN(tI).current;return nI(i,e,t,n,r)&&iI(i,[e,t,n,r]),i.callback}function eI(e){let t=NN(tI).current;return rI(t,e)&&iI(t,e),t.callback}function tI(){return{callback:null,cleanup:null,refs:[]}}function nI(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function rI(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function iI(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}function aI(e){if(!Z.isValidElement(e))return null;let t=e,n=t.props;return(LN(19)?n?.ref:t.ref)??null}function oI(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function sI(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function cI(e,t){return typeof e==`function`?e(t):e}function lI(e,t){return typeof e==`function`?e(t):e}var uI={};function dI(e,t,n,r,i){if(!n&&!r&&!i&&!e)return pI(t);let a=pI(e);return t&&(a=mI(a,t)),n&&(a=mI(a,n)),r&&(a=mI(a,r)),i&&(a=mI(a,i)),a}function fI(e){if(e.length===0)return uI;if(e.length===1)return pI(e[0]);let t=pI(e[0]);for(let n=1;n<e.length;n+=1)t=mI(t,e[n]);return t}function pI(e){return vI(e)?{...yI(e,uI)}:hI(e)}function mI(e,t){return vI(t)?yI(t,e):gI(e,t)}function hI(e){let t={...e};for(let e in t){let n=t[e];_I(e,n)&&(t[e]=xI(n))}return t}function gI(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=oI(e.style,r);break;case`className`:e[n]=CI(e.className,r);break;default:e[n]=_I(n,r)?bI(e[n],r):r}}return e}function _I(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function vI(e){return typeof e==`function`}function yI(e,t){return vI(e)?e(t):e??uI}function bI(e,t){return t?e?(...n)=>{let r=n[0];if(wI(r)){let i=r;SI(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:xI(t):e}function xI(e){return e&&((...t)=>{let n=t[0];return wI(n)&&SI(n),e(...t)})}function SI(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function CI(e,t){return t?e?t+` `+e:t:e}function wI(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function TI(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=kI(r));let i=EI(t,n,r);if(n.enabled===!1)return null;let a=n.state??AN;return AI(e,r,i,a)}function EI(e,t,n){let{className:r,style:i}=e,{state:a=AN,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?cI(r,a):void 0,d=l?lI(i,a):void 0,f=l?sI(a,c):AN,p=l&&s?DI(s):void 0,m=l?oI(f,p)??{}:AN;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?eI([m.ref,aI(n),...o]):$F(m.ref,aI(n),o):$F(null,null)),l?(u!==void 0&&(m.className=CI(m.className,u)),d!==void 0&&(m.style=oI(m.style,d)),m):AN}function DI(e){return Array.isArray(e)?fI(e):dI(void 0,e)}var OI=Symbol.for(`react.lazy`);function kI(e){if(e?.$$typeof!==OI)return e;let t=Z.Children.toArray(e)[0];return Z.isValidElement(t)?t:e}function AI(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=dI(n,t.props);return e.ref=n.ref,Z.cloneElement(t,e)}if(e&&typeof e==`string`)return jI(e,n);throw Error(IN(8))}function jI(e,t){return e===`button`?(0,Z.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,Z.createElement)(`img`,{alt:``,...t,key:t.key}):Z.createElement(e,t)}function MI(e){return LN(19)?e:e?`true`:void 0}function NI(e){return e==null?e:`current`in e?e.current:e}var PI=null;function FI(e){if(!PI){let e=[];PI=e,queueMicrotask(()=>{PI=null,FN.flushSync(()=>{for(let t of e)t()})})}PI.push(e)}function II(e,t=!1,n=!1){let r=bP();return GN((i,a=null)=>{r.cancel();let o=NI(e);if(o==null)return;let s=o,c=()=>{if(!n){FN.flushSync(i);return}FI(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(s.getAnimations().some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=LP;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function LI(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=GN(a),s=II(r,n,i);Z.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var RI={style:{transition:`none`}},zI=`data-base-ui-click-trigger`,BI=`data-base-ui-swipe-ignore`,VI=`data-swipe-ignore`,HI=`[${BI}]`,UI=`[${VI}]`,WI={fallbackAxisSide:`none`},GI={fallbackAxisSide:`end`},KI={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function qI(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var JI=0;function YI(e,t=`mui`){let[n,r]=Z.useState(e),i=e||n;return Z.useEffect(()=>{n??(JI+=1,r(`${t}-${JI}`))},[n,t]),i}var XI=UN.useId;function ZI(e,t){if(XI!==void 0){let n=XI();return e??(t?`${t}-${n}`:n)}return YI(e,t)}var QI=Z.createContext(void 0);function $I(e=!1){let t=Z.useContext(QI);if(t===void 0&&!e)throw Error(IN(16));return t}function eL(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:Z.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function tL(e,t,{detail:n=0}={}){e.dispatchEvent(new(YN(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function nL(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),s=$I(!0),c=a??s!==void 0,{props:l}=eL({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=Z.useCallback(()=>{let e=o.current;rL(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return PN(u,[u]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return dI({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(SI(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=rL(r),s=!i&&iL(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),tL(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),tL(r,e)))},onKeyUp(e){if(!t){if(SI(e),a?.(e),e.target===e.currentTarget&&i&&c&&rL(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),tL(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:GN(e=>{o.current=e,u()})}}function rL(e){return $N(e)&&e.tagName===`BUTTON`}function iL(e){return $N(e)&&e.tagName===`A`&&!!e.href}var aL=`none`,oL=`trigger-press`,sL=`trigger-hover`,cL=`trigger-focus`,lL=`outside-press`,uL=`item-press`,dL=`close-press`,fL=`focus-out`,pL=`escape-key`,mL=`list-navigation`,hL=`cancel-open`,gL=`sibling-open`,_L=`disabled`,vL=`missing`,yL=`initial`,bL=`imperative-action`,xL=`window-resize`;function SL(e,t,n,r){let i=!1,a=!1,o=r??AN;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function CL(e){return`data-base-ui-${e}`}var wL=Z.createContext(null),TL=()=>Z.useContext(wL),EL=CL(`portal`);function DL(e={}){let{ref:t,container:n,componentProps:r=AN,elementProps:i}=e,a=ZI(),o=TL()?.portalNode,[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=GN(e=>{e!==null&&u(e)}),f=Z.useRef(null);PN(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(ZN(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=TI(`div`,r,{ref:[t,d],props:[{id:a,[EL]:``},i]}),m=s&&p?FN.createPortal(p,s):null;return{node:l,nodeId:Z.isValidElement(p)?p.props.id:void 0,subtree:m}}var OL=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=DL({container:o,ref:t,componentProps:e,elementProps:c}),f=Z.useRef(null),p=Z.useRef(null),m=Z.useRef(null),h=Z.useRef(null),[g,_]=Z.useState(null),v=Z.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;Z.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&KF(e)&&(e.type===`focusin`?v.current&&=(JF(l),!1):(qF(l),v.current=!0))}return mP(gP(l,`focusin`,e,!0),gP(l,`focusout`,e,!0))},[l,y]),PN(()=>{l&&b===!0&&v.current&&(JF(l),v.current=!1)},[b,l]);let S=Z.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,Q.jsxs)(Z.Fragment,{children:[d,(0,Q.jsxs)(wL.Provider,{value:S,children:[x&&l&&(0,Q.jsx)(QF,{"data-type":`outside`,ref:f,onFocus:e=>{KF(e,l)?m.current?.focus():HF(g?g.domReference:null)?.focus()}}),x&&l&&(0,Q.jsx)(`span`,{role:s,"aria-owns":u,style:KI}),l&&FN.createPortal(a,l),x&&l&&(0,Q.jsx)(QF,{"data-type":`outside`,ref:p,onFocus:e=>{KF(e,l)?h.current?.focus():(VF(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,SL(`focus-out`,e.nativeEvent)))}})]})]})}),kL=Z.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=DL({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Q.jsxs)(Z.Fragment,{children:[l,c&&FN.createPortal(n,c)]})});function AL(e){let t=NN(jL,e).current;return t.next=e,PN(t.effect),t}function jL(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ML(e,t){return t!=null&&!rF(t)?0:typeof e==`function`?e():e}function NL(e,t,n){let r=ML(e,n);return typeof r==`number`?r:r?.[t]}function PL(e){return typeof e==`function`?e():e}function FL(e,t){return t||e===`click`||e===`mousedown`}function IL(e){return e?.includes(`mouse`)&&e!==`mousedown`}var LL=Z.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new SP,currentIdRef:{current:null},currentContextRef:{current:null}});function RL(e,t){e.current=t.current}function zL(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Z.useRef(n),a=Z.useRef(n),o=Z.useRef(null),s=Z.useRef(null),c=CP();return PN(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:NL(i.current,`open`),close:NL(n,`close`)}},[n,o,i,a]),(0,Q.jsx)(LL.Provider,{value:Z.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function BL(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Z.useContext(LL),[f,p]=Z.useState(!1),m=Z.useRef(n);return PN(()=>{m.current=n},[n]),PN(()=>{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]),PN(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:NL(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,SL(aL))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),PN(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,RL(o,c),d.clear()}},[l,a,o,i,c,d]),Z.useMemo(()=>({activeIdRef:a,hasProvider:u,delayRef:o,isInstantPhase:f}),[a,u,o,f])}var VL=0;function HL(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(VL);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),ON;let o=requestAnimationFrame(a);return VL=o,()=>{VL===o&&(cancelAnimationFrame(o),VL=0)}}var UL={inert:new WeakMap,"aria-hidden":new WeakMap},WL=`data-base-ui-inert`,GL={inert:new WeakSet,"aria-hidden":new WeakSet},KL=new WeakMap,qL=0;function JL(e){return GL[e]}function YL(e){return e?eP(e)?e.host:YL(e.parentNode):null}var XL=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=YL(t);return e.contains(n)?n:null}).filter(e=>e!=null),ZL=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},QL=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{JN(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function $L(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=XL(t,e),l=i?QL(t,ZL(c),new Set(c)):[],u=[],d=[];if(a){let e=UL[a],n=JL(a);s=n,o=e;let r=XL(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);QL(t,ZL(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(KL.get(e)||0)+1;KL.set(e,t),d.push(e),t===1&&e.setAttribute(WL,``)}),qL+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(KL.get(e)||0)-1;KL.set(e,t),t||e.removeAttribute(WL)}),--qL,qL||(UL.inert=new WeakMap,UL[`aria-hidden`]=new WeakMap,GL.inert=new WeakSet,GL[`aria-hidden`]=new WeakSet,KL=new WeakMap)}}function eR(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=hP(e[0]).body;return $L(e,a,n,r,{mark:i})}function tR(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var nR=class{nodesRef={current:[]};events=tR();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},rR=Z.createContext(null),iR=Z.createContext(null),aR=()=>Z.useContext(rR)?.id||null,oR=e=>{let t=Z.useContext(iR);return e??t};function sR(e){let t=ZI(),n=oR(e),r=aR();return PN(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function cR(e){let{children:t,id:n}=e,r=aR();return(0,Q.jsx)(rR.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function lR(e){let{children:t,externalTree:n}=e,r=NN(()=>n??new nR).current;return(0,Q.jsx)(iR.Provider,{value:r,children:t})}function uR(e,t){let n=YN(PP(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var dR=20,fR=[];function pR(){fR=fR.filter(e=>e.deref()?.isConnected)}function mR(e){pR(),e&&JN(e)!==`body`&&(fR.push(new WeakRef(e)),fR.length>dR&&(fR=fR.slice(-20)))}function hR(){return pR(),fR[fR.length-1]?.deref()}function gR(e){return e?LF(e)?e:zF(e)[0]||e:null}function _R(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=RF(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return LF(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function vR(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=GN(()=>b.current.floatingContext?.nodeId),S=i===!1,C=YP(_)&&S,w=AL(i),T=AL(a),E=AL(l),D=AL(g),O=oR(p),k=TL(),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef(!1),N=Z.useRef(null),P=Z.useRef(``),F=Z.useRef(``),I=Z.useRef(null),ee=Z.useRef(null),L=$F(I,f,k?.beforeInsideRef),te=$F(ee,k?.afterInsideRef),R=CP(),ne=CP(),re=bP(),ie=k!=null,ae=ZP(v),oe=GN((e=ae)=>e?zF(e):[]),se=GN(()=>m?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&NP(ae,MP(hP(ae)))&&oe().length===0&&!C&&eF(e)}return gP(hP(ae),`keydown`,e)},[r,ae,s,C,oe]),Z.useEffect(()=>{if(r||!g)return;let e=hP(ae);function t(){M.current=!1}function n(e){let t=PP(e),n=se(),r=NP(v,t)||NP(_,t)||NP(k?.portalNode,t)||n.some(e=>e===t||NP(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,ne.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return mP(gP(e,`pointerdown`,n,!0),gP(e,`pointerup`,t,!0),gP(e,`pointercancel`,t,!0),gP(e,`keydown`,i,!0),t)},[r,v,_,ae,g,k,ne,se]),Z.useEffect(()=>{if(r||!c)return;let e=hP(ae);function t(){j.current=!0,ne.start(0,()=>{j.current=!1})}function n(e){let t=PP(e);LF(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=PP(t);s&&n==null&&i!=null&&NP(v,i)&&mR(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=se(),f=n?.hasAttribute(CL(`focus-guard`))&&[I.current,ee.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,NI(d),NI(u)].includes(n),p=!(NP(_,n)||NP(v,n)||NP(n,v)||NP(k?.portalNode,n)||l.some(e=>e===n||NP(e,n))||c.hasMatchingElement(e=>NP(e,n))||f||O&&(QP(O.nodesRef.current,a).find(e=>NP(e.context?.elements.floating,n)||NP(e.context?.elements.domReference,n))||$P(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,ZP(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&ae&&_R(ae),o&&r!==_&&!OF(i)&&MP(e)===e.body){if($N(ae)&&(ae.focus(),o===`popup`)){re.request(()=>{ae.focus()});return}let e=oe(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ae;$N(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!j.current&&(C||n!==hR())&&(A.current=!0,h.setOpen(!1,SL(fL,t)))})}function a(){M.current||(b.current.insideReactTree=!0,R.start(0,()=>{b.current.insideReactTree=!1}))}let l=$N(_)?_:null;if(v||l)return mP(l&&gP(l,`focusout`,i),l&&gP(l,`pointerdown`,t),v&&gP(v,`focusin`,n),v&&gP(v,`focusout`,i),v&&k&&gP(v,`focusout`,a,!0))},[r,_,v,ae,s,O,k,h,c,o,oe,C,x,b,R,ne,re,u,d,se]),Z.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${CL(`portal`)}]`)||[]),t=(O?$P(O.nodesRef.current,x()):[]).find(e=>YP(e.context?.elements.domReference||null))?.context?.elements.domReference,n=eR([v,...e,I.current,ee.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...se(),t,NI(d),NI(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=eR([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,se]),PN(()=>{if(!g||r||!$N(ae))return;P.current=``,F.current=``;let e=hP(ae),t=MP(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||NP(ae,t))return;let i=null,a=()=>(i??=oe(ae),i[0]||ae),o;o=r===!0||r===null?a():NI(r),o||=a();let s=NP(ae,MP(e));HL(o,{preventScroll:o===ae,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=MP(e);return!(t!==o&&NP(ae,t))}})})},[r,g,ae,oe,w,E,D]),PN(()=>{if(r||!ae)return;let e=hP(ae),t=MP(e),n=E.current==null;mR(t);function i(e){if(e.open||(P.current=uR(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(tF(e.nativeEvent)||nF(e.nativeEvent))A.current=!1;else{let e=!1;hP(ae).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&&JN(t)!==`body`?t:null,s=n?o||a:a||o;return s||=hR()||null,typeof i==`boolean`?s:NI(i)||s||null}return()=>{y.off(`openchange`,i);let t=MP(e),n=se(),r=NP(v,t)||n.some(e=>e===t||NP(e,t))||O&&QP(O.nodesRef.current,x(),!1).some(e=>NP(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=gR(c),i=typeof o!=`boolean`;if(o&&!A.current&&$N(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,ae,T,E,y,O,_,x,se]),PN(()=>{if(!AP||g||!v)return;let e=MP(hP(v));$N(e)&&JP(e)&&NP(v,e)&&e.blur()},[g,v]),PN(()=>{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,_]),PN(()=>{if(!r&&ae)return _R(ae),()=>{queueMicrotask(pR)}},[r,ae]);let ce=!r&&(!s||!C)&&(ie||s);return(0,Q.jsxs)(Z.Fragment,{children:[ce&&(0,Q.jsx)(QF,{"data-type":`inside`,ref:L,onFocus:e=>{if(s){let e=oe();HL(e[e.length-1])}else k?.portalNode&&(A.current=!1,KF(e,k.portalNode)?VF(_)?.focus():NI(d??k.beforeOutsideRef)?.focus())}}),n,ce&&(0,Q.jsx)(QF,{"data-type":`inside`,ref:te,onFocus:e=>{s?HL(oe()[0]):k?.portalNode&&(c&&(A.current=!0),KF(e,k.portalNode)?HF(_)?.focus():NI(u??k.afterOutsideRef)?.focus())}})]})}function yR(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=oL}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),f=bP(),p=CP(),m=Z.useMemo(()=>{function e(e,t,n,r){let i=SL(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=rF(e.pointerType,!0)&&nF(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||rF(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=PP(o);if(JP(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}rF(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}:AN,[n,m])}function bR(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function xR(e){return e!=null&&e.clientX!=null}function SR(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Z.useRef(!1),u=Z.useRef(null),[d,f]=Z.useState(),[p,m]=Z.useState([]),h=GN(e=>{i.set(`positionReference`,e)}),g=GN((e,t,n)=>{l.current||(!c.current.openEvent||xR(c.current.openEvent))&&i.set(`positionReference`,bR(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=GN(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=rF(d)?o:a;Z.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=YN(o);function r(t){let n=PP(t);NP(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||xR(c.current.openEvent)?u.current=gP(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),Z.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Z.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Z.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=Z.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return Z.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function CR(){return!1}function wR(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function TR(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=CR,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f,events:p}=l.context,m=oR(c),h=GN(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=GN(()=>a),{escapeKey:y,outsidePress:b}=wR(s),x=Z.useRef(!1),S=Z.useRef(!1),C=Z.useRef(!1),w=Z.useRef(!1),T=Z.useRef(!1),E=Z.useRef(``),D=Z.useRef(null),O=CP(),k=CP(),A=GN(()=>{k.clear(),f.current.insideReactTree=!1}),j=GN(e=>{let t=f.current.floatingContext?.nodeId;return(m?QP(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=GN(e=>qP(e,l.select(`floatingElement`))||qP(e,l.select(`domReferenceElement`))),N=GN(e=>{o()&&l.setOpen(!1,SL(oL,e.nativeEvent))}),P=GN(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=SL(pL,fce(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),F=GN(()=>{f.current.insideReactTree=!0,k.start(0,A)}),I=GN(e=>{if(!u||!n||e.button!==0)return;let t=PP(e.nativeEvent);NP(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),ee=GN(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 SP,t=new SP,i=hP(d);function a(){e.clear(),T.current=!0}function o(){e.start(AP?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&&QP(m.nodesRef.current,t).some(t=>qP(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=PP(e),r=`[${CL(`inert`)}]`,i=QN(n)?n.getRootNode():null,a=Array.from((eP(i)?i:hP(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>NP(e,n))))return;let s=QN(n)?n:null;for(;s&&!sP(s);){let e=uP(s);if(sP(e)||!QN(e))break;s=e}if(!(a.length&&QN(n)&&!uce(n)&&!NP(n,l.select(`floatingElement`))&&a.every(e=>!NP(s,e)))){if($N(n)&&!(`touches`in e)){let t=sP(n),r=cP(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&&!tF(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}(typeof g!=`function`||g(e))&&(j(`__outsidePressBubbles`)||(l.setOpen(!1,SL(lL,e)),A()))}}}function F(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!M(e)&&N(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function ee(e,t){let n=PP(e);if(!n)return;let r=gP(n,e.type,()=>{t(e),r()})}function L(e){E.current=`touch`,ee(e,I)}function te(e){O.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!D.current||D.current.dismissOnMouseDown)&&ee(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function R(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 ne(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 re(e){ee(e,ne)}function ie(e){p()===`sloppy`&&D.current&&!M(e)&&(D.current.dismissOnTouchEnd&&N(e),O.clear(),D.current=null)}function ae(e){ee(e,ie)}let oe=mP(r&&mP(gP(i,`keydown`,P),gP(i,`compositionstart`,a),gP(i,`compositionend`,o)),_&&mP(gP(i,`click`,te,!0),gP(i,`pointerdown`,te,!0),gP(i,`pointerup`,R,!0),gP(i,`pointercancel`,R,!0),gP(i,`mousedown`,te,!0),gP(i,`mouseup`,R,!0),gP(i,`touchstart`,L,{capture:!0,passive:!0}),gP(i,`touchmove`,re,{capture:!0,passive:!0}),gP(i,`touchend`,ae,{capture:!0,passive:!0})));return()=>{oe(),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 L=Z.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),te=Z.useMemo(()=>({onKeyDown:P,onPointerDown:ee,onMouseDown:ee,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,ee]);return Z.useMemo(()=>n?{reference:L,floating:te,trigger:L}:{},[n,L,te])}function ER(e,t,n){let{reference:r,floating:i}=e,a=hF(t),o=gF(t),s=mF(o),c=dF(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=fF(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function DR(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=uF(t,e),p=xF(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=SF(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=SF(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var OR=50,kR=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:DR},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ER(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<OR&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ER(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},AR=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=uF(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=dF(r),_=hF(o),v=dF(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[bF(o)]:gce(o)),x=p!==`none`;!d&&x&&b.push(...bce(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=hce(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`||_===hF(t)||T.every(e=>hF(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=hF(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},jR=new Set([`left`,`top`]);async function MR(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=dF(n),s=fF(n),c=hF(n)===`y`,l=jR.has(o)?-1:1,u=a&&c?-1:1,d=uF(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var NR=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await MR(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},PR=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=uF(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=hF(i),p=pF(f),m=u[p],h=u[f],g=(e,t)=>lF(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},FR=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=uF(e,t),u={x:n,y:r},d=hF(i),f=pF(d),p=u[f],m=u[d],h=uF(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=jR.has(dF(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},IR=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=uF(e,t),c=await i.detectOverflow(t,s),l=dF(n),u=fF(n),d=hF(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=iF(p-c[m],g),y=iF(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*aF(c.left,c.right):S=p-2*aF(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function LR(e){let t=cP(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=$N(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=oF(n)!==a||oF(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function RR(e){return QN(e)?e:e.contextElement}function zR(e){let t=RR(e);if(!$N(t))return cF(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=LR(t),o=(a?oF(n.width):n.width)/r,s=(a?oF(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var BR=cF(0);function VR(e){let t=YN(e);return!oP()||!t.visualViewport?BR:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function HR(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===YN(e)}function UR(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=RR(e),o=cF(1);t&&(r?QN(r)&&(o=zR(r)):o=zR(e));let s=HR(a,n,r)?VR(a):cF(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=YN(a),t=QN(r)?YN(r):r,n=e,i=pP(n);for(;i&&t!==n;){let e=zR(i),t=i.getBoundingClientRect(),r=cP(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=YN(i),i=pP(n)}}return SF({width:u,height:d,x:c,y:l})}function WR(e,t){let n=lP(e).scrollLeft;return t?t.left+n:UR(XN(e)).left+n}function GR(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-WR(e,n),y:n.top+t.scrollTop}}function KR(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=XN(r),s=t?nP(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=cF(1),u=cF(0),d=$N(r);if((d||!a)&&((JN(r)!==`body`||tP(o))&&(c=lP(r)),d)){let e=UR(r);l=zR(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?GR(o,c):cF(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function qR(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function JR(e){let t=lP(e),n=e.ownerDocument.body,r=aF(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=aF(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+WR(e),o=-t.scrollTop;return cP(n).direction===`rtl`&&(a+=aF(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var YR=25;function XR(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=YN(e),a=XN(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!oP()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(WR(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=YR&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ZR(e,t){let n=UR(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=zR(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function QR(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=XR(e,n,t);else if(t===`document`)r=JR(XN(e));else if(QN(t))r=ZR(t,n);else{let n=VR(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return SF(r)}function $R(e,t){let n=t.get(e);if(n)return n;let r=fP(e,[],!1).filter(e=>QN(e)&&JN(e)!==`body`),i=null,a=cP(e).position===`fixed`,o=a?uP(e):e;for(;QN(o)&&!sP(o);){let e=cP(o),t=aP(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=uP(o)}return t.set(e,r),r}function ez(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?nP(t)?[]:$R(t,this._c):[].concat(n),r],o=QR(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=QR(t,a[e],i);s=aF(n.top,s),c=iF(n.right,c),l=iF(n.bottom,l),u=aF(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function tz(e){let{width:t,height:n}=LR(e);return{width:t,height:n}}function nz(e,t,n){let r=$N(t),i=XN(t),a=n===`fixed`,o=UR(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=cF(0);if((r||!a)&&((JN(t)!==`body`||tP(i))&&(s=lP(t)),r)){let e=UR(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=WR(i));let l=i&&!r&&!a?GR(i,s):cF(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function rz(e){return cP(e).position===`static`}function iz(e,t){if(!$N(e)||cP(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return XN(e)===n&&(n=n.ownerDocument.body),n}function az(e,t){let n=YN(e);if(nP(e))return n;if(!$N(e)){let t=uP(e);for(;t&&!sP(t);){if(QN(t)&&!rz(t))return t;t=uP(t)}return n}let r=iz(e,t);for(;r&&zse(r)&&rz(r);)r=iz(r,t);return r&&sP(r)&&rz(r)&&!aP(r)?n:r||Hse(e)||n}var oz=async function(e){let t=this.getOffsetParent||az,n=this.getDimensions,r=await n(e.floating);return{reference:nz(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sz(e){return cP(e).direction===`rtl`}var cz={convertOffsetParentRelativeRectToViewportRelativeRect:KR,getDocumentElement:XN,getClippingRect:ez,getOffsetParent:az,getElementRects:oz,getClientRects:qR,getDimensions:tz,getScale:zR,isElement:QN,isRTL:sz};function lz(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uz(e,t,n){let r=null,i,a=XN(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=sF(d),h=sF(a.clientWidth-(u+f)),g=sF(a.clientHeight-(d+p)),_=sF(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:aF(0,iF(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!lz(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=YN(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function dz(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=RR(e),u=i||a?[...l?fP(l):[],...t?fP(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?uz(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?UR(e):null;c&&g();function g(){let t=UR(e);h&&!lz(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var fz=NR,pz=PR,mz=AR,hz=IR,gz=FR,_z=(e,t,n)=>{let r=new Map,i=n??{},a={...cz,...i.platform,_c:r};return kR(e,t,{...i,platform:a})},vz=typeof document<`u`?Z.useLayoutEffect:function(){};function yz(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!yz(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!yz(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bz(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xz(e,t){let n=bz(e);return Math.round(t*n)/n}function Sz(e){let t=Z.useRef(e);return vz(()=>{t.current=e}),t}function Cz(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);yz(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=Sz(c),D=Sz(i),O=Sz(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),_z(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!yz(w.current,t)&&(w.current=t,FN.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);vz(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);vz(()=>(A.current=!0,()=>{A.current=!1}),[]),vz(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=xz(M.floating,u.x),r=xz(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bz(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var wz=(e,t)=>{let n=fz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tz=(e,t)=>{let n=pz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ez=(e,t)=>({fn:gz(e).fn,options:[e,t]}),Dz=(e,t)=>{let n=mz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oz=(e,t)=>{let n=hz(e);return{name:n.name,fn:n.fn,options:[e,t]}},kz={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},Az=class extends KN{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:tR(),nested:n,triggerElements:i},kz),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&pce(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function jz(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=Z.useRef(null);r===void 0&&f.current===null&&(f.current=new Az({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),PN(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};QN(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function Mz(e,t=!1,n=!1,r=!1){let[i,a]=Z.useState(e&&t?`idle`:void 0),[o,s]=Z.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),PN(()=>{if(!e&&o&&i!==`ending`&&n){let e=yP.request(()=>{a(`ending`)});return()=>{yP.cancel(e)}}},[e,o,i,n]),PN(()=>{if(!e||t)return;let n=yP.request(()=>{a(void 0)});return()=>{yP.cancel(n)}},[t,e]),PN(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=yP.request(()=>{a(`idle`)});return()=>{yP.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var Nz={tabIndex:-1,[Yse]:``};function Pz(e){return t=>t!==`touch`||e.current}function Fz(e,t=!1){let n=ZI(),r=aR()!=null,i=NN(()=>e(n,r)).current;return jz({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function Iz({handle:e,store:t}){return PN(()=>e.attachStore(t),[e,t]),null}function Lz(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function Rz(e,t){let n=Z.useRef(null);return GN(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),Lz(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Lz(t))})}function zz(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s}}function Bz(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Vz(e,t,n,r={}){let i=n.reason,a=i===sL,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Bz(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=zz(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?FN.flushSync(l):l()}function Hz(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Rz(e,n),o=GN(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=GN(e=>{a(e),e&&o(e)});return PN(()=>(s(t.current),()=>s(null)),[s,t,n,e]),PN(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Uz(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Z.useRef(null),i=e.useState(`open`);PN(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=SL(aL);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function Wz(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=Mz(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=GN(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return LI({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function Gz(e,t){e.useSyncedValues(t),PN(()=>()=>{e.update({activeTriggerProps:AN,inactiveTriggerProps:AN,popupProps:AN})},[e])}function Kz(e,t){PN(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),PN(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var qz=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function Jz(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Az({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:AN,inactiveTriggerProps:AN,popupProps:AN}}var Yz=e=>e.triggerIdProp??e.activeTriggerId,Xz=e=>e.openProp??e.open,Zz=e=>(e.popupElement?.id??e.floatingId)||void 0;function Qz(e,t){return t!==void 0&&Xz(e)&&Yz(e)===t}function $z(e,t){return Qz(e,t)?!0:t!==void 0&&Xz(e)&&Yz(e)==null&&e.triggerCount===1}var eB={open:Xz,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Yz,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Zz,isTriggerActive:(e,t)=>t!==void 0&&Yz(e)===t,isOpenedByTrigger:(e,t)=>Qz(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Yz(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>$z(e,t)?Zz(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function tB(e){let t=Z.useCallback(t=>e===void 0?ON:e.subscribeStore(t),[e]),n=Z.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,DN.useSyncExternalStore)(t,n,()=>e?.serverStore)}function nB(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=ZI(),a=aR()!=null,o=NN(()=>new Az({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new qz,floatingId:i,syncOnly:!1,nested:a})).current;return PN(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=QN(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function rB(e){return iB(e,e.rootContext)}function iB(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=oR(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=Cz({...e,elements:{..._,...l&&{reference:l}}}),y=QN(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=QN(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(QN(e)||e===null)&&(h.current=e,f(e)),(QN(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!QN(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 PN(()=>{o&&(h.current=o)},[o]),PN(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var aB=kP&&AP;function oB(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Z.useRef(!1),c=Z.useRef(null),l=Z.useRef(!0),u=CP();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=YN(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&$N(e)&&e===MP(hP(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return mP(gP(t,`blur`,r),aB&&gP(t,`keydown`,a,!0),aB&&gP(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`);QN(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=PP(t.nativeEvent);if(QN(a)){if(aB&&!t.relatedTarget){if(!l.current&&!JP(a))return}else if(!XP(a))return}let o=KP(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,SL(cL,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,SL(cL,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=QN(n)&&n.hasAttribute(CL(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=MP(hP(e));(n||t!==e)&&(NP(o.current.floatingContext?.refs.floating.current,t)||NP(e,t)||a||KP(n??t,i.context.triggerElements)||i.setOpen(!1,SL(cL,r)))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var sB=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new SP,this.restTimeout=new SP,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},cB=new WeakMap;function lB(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&cB.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),cB.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function uB(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=cB.get(n);a&&a!==e&&lB(a),lB(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,cB.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function dB(e){let t=e.context.dataRef.current,n=NN(()=>t.hoverInteractionState??sB.create()).current;return t.hoverInteractionState||=n,jN(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function fB(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=oR(),d=aR(),f=dB(a),p=CP(),m=GN(()=>FL(l.current.openEvent?.type,f.interactedInside)),h=GN(()=>IL(l.current.openEvent?.type)),g=GN(()=>{lB(f)});PN(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Z.useEffect(()=>g,[g]),PN(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&QN(c)&&s){let e=c,t=s,n=hP(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return uB(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Z.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&QP(u.nodesRef.current,d).length>0)}function t(e){let t=NL(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,SL(sL,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=PP(e);if(!dce(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(KP(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&QN(o)&&QP(u.nodesRef.current,r,!1).some(e=>NP(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){u&&d&&!e()&&p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,SL(sL,t)),u.events.emit(`floating.closed`,t)})}let y=s;return mP(y&&gP(y,`mouseenter`,c),y&&gP(y,`mouseleave`,_),y&&gP(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var pB={current:null};function mB(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=pB,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=oR(l),y=dB(h),b=Z.useRef(!1),x=AL(i),S=AL(r),C=AL(o),w=AL(n),T=AL(p),E=AL(f),D=GN(()=>FL(g.current.openEvent?.type,y.interactedInside)),O=GN(()=>T.current?.()!==!1),k=GN((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!NP(e,t);if(!QN(n))return!1;let i=n;return r.hasMatchingElement(e=>NP(e,i))&&(!e||!NP(e,i))}),A=GN(()=>{y.handler&&=(hP(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=GN(()=>{lB(y)});return u&&(y.handleCloseOptions=i?.__options),Z.useEffect(()=>A,[A]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===sL,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),Z.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=NL(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,SL(sL,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,SL(sL,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!QN(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!rF(y.pointerType))return;let t=PL(C.current),n=NL(S.current,`open`,y.pointerType),r=PP(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(QN(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(NP(e,r)){s=e;break}}QN(i)&&QN(o)&&!h.context.triggerElements.hasElement(i)&&NP(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&&QN(s)&&QN(o)&&NP(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,SL(sL,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,SL(sL,e,s))}):g&&O()&&h.setOpen(!0,SL(sL,e,s)))}function i(t){if(D()){j();return}A();let n=hP(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!KP(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`||!NP(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){NP(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?gP(t,`mouseout`,o):void 0;return s?mP(gP(t,`mousemove`,r,{once:!0}),gP(t,`mouseenter`,r),gP(t,`mouseleave`,i),l):mP(gP(t,`mouseenter`,r),gP(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&&!rF(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;uB(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=PL(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,SL(sL,t,n))}y.pointerType===`touch`?FN.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var hB=`Escape`;function gB(e){return AP&&e.movementX===0&&e.movementY===0}function _B(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function vB(e,t){return _B(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function yB(e,t,n){return _B(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function bB(e,t,n){return _B(t,n?e===FP:e===IP,e===Qse)}function xB(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===hB:_B(t,n?e===IP:e===FP,e===Zse)}function SB(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=ZP(T),k=YP(E),A=AL(O),j=aR(),M=oR(b),N=Z.useRef(f),P=Z.useRef(o??-1),F=Z.useRef(null),I=Z.useRef(!0),ee=GN(e=>{i(P.current===-1?null:P.current,e)}),L=Z.useRef(!!T),te=Z.useRef(w),R=Z.useRef(!1),ne=Z.useRef(!1),re=Z.useRef(null),ie=AL(h),ae=AL(w),oe=AL(o),se=AL(y),ce=bP(),le=bP(),ue=GN(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):re.current=HL(e,{sync:R.current,preventScroll:!0})}let t=n.current[P.current],r=ne.current;t&&e(t),(R.current?e=>e():e=>ce.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),ge&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});PN(()=>{D.current.orientation=g},[D,g]),PN(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(ne.current=!0,ee())):L.current&&(P.current=-1,ee()))},[a,w,T,o,ee]),PN(()=>{if(a){if(!w){R.current=!1;return}if(T){if(r==null){if(R.current=!1,oe.current!=null)return;if(L.current&&(P.current=-1,ue()),(!te.current||!L.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>le.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||yB(F.current,g,u)||l?wF(n):TF(n),F.current=null,ee())};t()}}else CF(n.current,r)||(P.current=r,ue(),ne.current=!1)}}},[a,w,T,r,oe,l,n,g,u,ee,ue,le]),PN(()=>{if(!a||T||!M||d||!L.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=MP(hP(E??t??null)),r=e.some(e=>e.context&&NP(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),PN(()=>{te.current=w,L.current=!!T}),PN(()=>{w||(F.current=null,N.current=f)},[w,f]);let de=r!=null,fe=GN(e=>{if(!ae.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,ee(e))}),pe=GN(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),me=GN(()=>wF(n,ie.current)),he=GN(e=>{if(I.current=!1,R.current=!0,e.which===229||!ae.current&&e.currentTarget===A.current)return;if(l&&xB(e.key,g,u,S)){vB(e.key,pe())||eF(e),C.setOpen(!1,SL(mL,e.nativeEvent)),$N(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=wF(n,h),i=TF(n,h);if(k||(e.key===`Home`&&(eF(e),P.current=r,ee(e)),e.key===`End`&&(eF(e),P.current=i,ee(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,ee(e)),g===`both`)return}if(vB(e.key,g)){if(eF(e),w&&!d&&MP(e.currentTarget.ownerDocument)===e.currentTarget){P.current=yB(e.key,g,u)?r:i,ee(e);return}yB(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(R.current=!1,P.current=r):P.current=EF(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,EF(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(R.current=!1,P.current=i):P.current=EF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,EF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),CF(n.current,P.current)&&(P.current=-1),ee(e)}}),ge=Z.useMemo(()=>({onFocus(e){R.current=!0,fe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){gB(e)||(R.current=!0,ne.current=!1,p&&fe(e))},onPointerLeave(e){if(!ae.current||!I.current||e.pointerType===`touch`)return;R.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&se.current&&(re.current?.(),re.current=null,P.current=-1,ee(e),!d)){let e=A.current,t=MP(hP(e));e&&NP(e,t)&&e.focus({preventScroll:!0})}}}),[fe,ae,A,p,n,ee,se,d]),_e=Z.useMemo(()=>d&&w&&de&&{"aria-activedescendant":`${v}-${r}`},[d,w,de,v,r]),ve=Z.useMemo(()=>({...k?{}:_e,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=PP(e.nativeEvent);if(t&&!NP(A.current,t))return;eF(e),C.setOpen(!1,SL(fL,e.nativeEvent)),$N(E)&&E.focus();return}he(e)},onPointerMove(e){gB(e)||(I.current=!0)}}),[_e,he,A,k,C,w,d,E]),ye=Z.useMemo(()=>{function e(e){C.setOpen(!0,SL(mL,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&tF(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&nF(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=bB(t.key,pe(),u),a=vB(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return he(t);if(n||m||!r){if(o){let e=vB(t.key,pe());F.current=l&&e?null:t.key}if(l){i&&(eF(t),n?(P.current=me(),ee(t)):e(t));return}a&&(oe.current!=null&&(P.current=oe.current),eF(t),!n&&m?e(t):he(t),n&&ee(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,ee(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[he,f,me,l,ee,C,m,g,pe,u,oe,d]),be=Z.useMemo(()=>({..._e,...ye}),[_e,ye]);return Z.useMemo(()=>a?{reference:be,floating:ve,item:ge,trigger:ye}:{},[a,be,ve,ye,ge])}function CB(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=CP(),m=Z.useRef(``),h=Z.useRef(u??i??-1),g=Z.useRef(null),_=GN(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!OF(n)||n?.matches(`:disabled`)?!1:o==null||!DF(kN,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===` `&&(eF(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!==` `&&(eF(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=GN(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);NP(n,t)||NP(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});PN(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Z.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Z.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var wB=.1,TB=wB*wB,EB=.5;function DB(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function OB(e,t,n,r,i,a,o,s,c,l){let u=!1;return DB(e,t,n,r,i,a)&&(u=!u),DB(e,t,i,a,o,s)&&(u=!u),DB(e,t,o,s,c,l)&&(u=!u),DB(e,t,c,l,n,r)&&(u=!u),u}function kB(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function AB(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function jB(e={}){let{blockPointerEvents:t=!1}=e,n=new SP,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*TB;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=PP(r),g=r.type===`mouseleave`,_=NP(u,h),v=NP(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&QN(r.relatedTarget)&&NP(u,r.relatedTarget))return;function y(){return!!(s&&QP(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=AB(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=AB(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=AB(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=AB(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!kB(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?EB/2:EB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+EB+1,o=C||T?S.bottom-EB:S.top,s=C?T?S.bottom-EB:S.top:S.bottom-EB;M=OB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?EB/2:EB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-EB,o=C||T?S.top+EB:S.bottom,s=C?T?S.top+EB:S.bottom:S.top+EB;M=OB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?EB/2:EB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+EB+1,o=w||E?S.right-EB:S.left,s=w?E?S.right-EB:S.left:S.right-EB;M=OB(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?EB/2:EB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-EB,o=w||E?S.left+EB:S.right,s=w?E?S.left+EB:S.right:S.left+EB;M=OB(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var MB=Z.createContext(void 0);function NB(){return Z.useContext(MB)?.direction??`ltr`}var PB=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=uF(e,t)||{};if(l==null)return{};let f=xF(u),p={x:n,y:r},m=gF(i),h=mF(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=lF(k,j,A),N=!c.arrow&&fF(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),FB=(e,t)=>{let{name:n,fn:r}=PB(e);return{name:n,fn:r,options:[e,t]}},IB={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},LB={sideX:`left`,sideY:`top`},RB=`--available-width`,zB=`--available-height`,BB=`--anchor-width`,VB=`--anchor-height`,HB=`--transform-origin`,UB=RB,WB=zB;function GB(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function KB(e,t,n){let{rects:r,placement:i}=e;return{side:GB(t,dF(i),n),align:fF(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function qB(e){return JB(e,rB)}function JB(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Z.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=GN(A),M=A?j:n,N=AL(n),P=AL(g),F=NB()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],ee=o===`center`?I:`${I}-${o}`,L=l;typeof L==`number`?L={top:L,right:L,bottom:L,left:L}:L&&={top:L.top||0,right:L.right||0,bottom:L.bottom||0,left:L.left||0};let te=+(i===`bottom`),R=+(i===`top`),ne=+(i===`right`),re=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:L},ae=Z.useRef(null),oe=AL(a),se=AL(s),ce=typeof a==`function`?0:a,le=typeof s==`function`?0:s,ue=[];p&&ue.push(p),ue.push(wz(e=>{let t=KB(e,i,F),n=typeof oe.current==`function`?oe.current(t):oe.current,r=typeof se.current==`function`?se.current(t):se.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[ce,le,F,i]));let de=E===`none`&&T!==`shift`,fe=!de&&(u||O||T===`shift`),pe=T===`none`?null:Dz({...ie,padding:{top:L.top+1+te,right:L.right+1+re,bottom:L.bottom+1+R,left:L.left+1+ne},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),me=de?null:Tz({...ie,rootBoundary:k,mainAxis:E!==`none`,crossAxis:fe,limiter:u||O?void 0:Ez(e=>{if(!ae.current)return{};let{width:t,height:n}=ae.current.getBoundingClientRect(),r=hF(dF(e.placement)),i=r===`y`?t:n,a=r===`y`?L.left+L.right:L.top+L.bottom;return{offset:i/2+a/2}})},[ie,u,O,k,L,E]);T===`shift`||E===`shift`||o===`center`?ue.push(me,pe):ue.push(pe,me),ue.push(Oz({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(UB,`${t}px`),i.setProperty(WB,`${n}px`);let a=YN(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(BB,`${u}px`),i.setProperty(VB,`${d}px`)}}),FB(e=>({element:ae.current||hP(e.elements.floating).createElement(`div`),padding:ae.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=dF(r),u=fF(r),d=hF(l)===`y`,f=ae.current,p=typeof a==`function`?a(KB(e,i,F)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return fe&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(HB,d?`${m} ${h}`:`${h} ${m}`),{}}},IB,b),PN(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let he=Z.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:ge,elements:_e,x:ve,y:ye,middlewareData:be,update:xe,placement:Se,context:Ce,isPositioned:we,floatingStyles:Te}=t({rootContext:h,open:m?g:void 0,placement:ee,middleware:ue,strategy:r,whileElementsMounted:m?void 0:(...e)=>dz(...e,he),nodeId:y,externalTree:S}),{sideX:Ee,sideY:De}=be.adaptiveOrigin||LB,Oe=we?r:`fixed`,ke=Z.useMemo(()=>{let e;return e=we?b?{position:Oe,[Ee]:ve,[De]:ye}:{...Te,position:Oe}:{position:Oe,top:0,left:0},e[UB]=`100vw`,e[WB]=`100vh`,we||(e.opacity=0),e},[b,Oe,Ee,ve,De,ye,Te,we]),Ae=Z.useRef(null);PN(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(YB(t)?t.current:t)||null;n!==Ae.current&&(ge.setPositionReference(n),Ae.current=n)},[g,ge,M,N]),Z.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&YB(e)&&e.current!==Ae.current&&(ge.setPositionReference(e.current),Ae.current=e.current)},[g,ge,M,N]),Z.useEffect(()=>{if(m&&g&&_e.reference&&_e.floating)return dz(_e.reference,_e.floating,xe,he)},[m,g,_e,xe,he]);let je=dF(Se),Me=GB(i,je,F),Ne=fF(Se)||`center`,Pe=!!be.hide?.referenceHidden;PN(()=>{x&&g&&we&&je!==I&&w(je)},[x,g,we,je,I]);let Fe=Z.useMemo(()=>({position:`absolute`,top:be.arrow?.y,left:be.arrow?.x}),[be.arrow]),Ie=be.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:ke,arrowStyles:Fe,arrowRef:ae,arrowUncentered:Ie,side:Me,align:Ne,physicalSide:je,anchorHidden:Pe,refs:ge,context:Ce,isPositioned:we,update:xe}),[ke,Fe,ae,Ie,Me,Ne,je,Pe,ge,Ce,we,xe])}function YB(e){return e!=null&&`current`in e}function XB(e){return e===`starting`?RI:AN}function ZB(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),TI(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},XB(r),i],stateAttributesMapping:UP})}var QB=pN(),$B=48,eV=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-$B-t;return n},tV=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},nV=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-$B;n+=i>>>1^-(i&1),t[r]=n}return t},rV=384,iV=[],aV=tV(eV(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),oV=tV(eV(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),sV=`@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom`,cV=(()=>{let e=aV.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=aV[n];i<aV[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(aV[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=aV[i];a<aV[i+1];a++)n[r++]=e,e+=t[e]}return n})(),lV=eV(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000…ŏ000ˆ0000ŏ0000000000—0000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),uV=tV(eV(`123333359346463635126536711576`)),dV=eV(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),fV=eV(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),pV=nV(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),mV=(()=>{let e=new Int32Array(319).fill(-1),t=nV(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=nV(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),hV=`container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top| bounce none ping pulse spin| auto square video| auto fr max min px|none | auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform`.split(`|`).map(e=>{let t=e.split(` `),n=t.shift();for(let e=0;e<t.length;e++)t[e]=n+t[e];return t}),gV=nV(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),_V=nV(`ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622`),vV=nV(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~‚22…ˆ‡:22|22222222222G000q†OVI00000}š2›>40000ŒB00000I¨©000¬00000000000000021M®­00°“000000000000000000000–222›HGHa1º222¿2À2222ÉÌ000­°2±`),yV=new Int32Array(995),bV=new Int32Array(995),xV=new Int32Array(995),SV=``,CV=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<gV.length;r++)for(let i of hV[vV[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),CV[a*2]=SV.length,CV[a*2+1]=i.length,SV+=i),yV[n]=gV[r],bV[n]=_V[r],xV[n]=a,n++}}var wV=nV(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),TV=tV(eV(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),EV=nV(`2Š4A;33N=C@H4A;33N=C@<27;83:;8393NQ:3NQʰ222ˉºŴŽ2R2=18cƴÅҜ=cĞÛC1ƈǝȈ:ħ25=11D3A@4=<1;1DEr25;11B3?<6;:371BCn9@7=<8192>2E121@9@EHE@9>2T25511<398454131<=V25511<398454131<=„ƧNž2Đå242L222290000f22500ɛ000ǘ222`),DV=eV(`ij`),OV=eV(`—`),kV=eV(`1`),AV={GROUP_COUNT:rV,customValidatorNames:iV,edgeStart:aV,labelStart:oV,labelText:sV,edgeTarget:cV,nodeGroup:lV,nodeVlist:mV,vlistPat:uV,vlistOps:dV,vlistRef:fV,vlistGroup:pV,litAnchor:yV,litGroup:bV,litPool:xV,poolOffsets:CV,poolText:SV,adjGid:wV,adjStart:TV,adjTgt:EV,patGid:DV,patTgt:OV,postfixLookupGroups:kV,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},jV=`line`in Error(),MV=-1,NV=-1,PV=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},FV=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15|0},IV=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let ee=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(PV(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;ee[n]!==-1;)n=n+1&I-1;ee[n]=e}let L=(e,t,n,r)=>{let i=(PV(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=ee[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}},te=n.cacheSize??8192,R=n.prefix??e.prefix??``,ne=R===``?``:R+`:`,re=ne.length,ie=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),ae=/\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$/,oe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,se=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ce=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,le=0,ue=-1,de=-1,fe=-1,pe=-1,me=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,he=e=>/\s/.test(String.fromCharCode(e)),ge=(e,t,n)=>{if(le=0,ue=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)le=1;else if(r===40&&i===41)le=2;else return;fe=t+1,pe=n-1;let a=t+1;if(me(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!me(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(ue=t+1,de=a,fe=a+1)}},_e=(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},ve=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ye=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,be=e=>!!e&&!Number.isNaN(Number(e)),xe=(e,t,n)=>{if(n-t<11||!_e(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&&_e(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&_e(e,t+10,t+18,`-normal/`)},Se=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Ce=`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(` `)),we=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],Te=(e,t,n,r)=>{if(e>=10){if(e>=25)return ie[e-25](t.slice(n,r));let i=e-10;if(le!==Se[i])return!1;if(ue>=0){for(let e of Ce[i])if(_e(t,ue,de,e))return!0;return!1}switch(we[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(fe,pe);return ae.test(e)&&!oe.test(e)}case 3:return be(t.slice(fe,pe));case 4:return ce.test(t.slice(fe,pe));default:return se.test(t.slice(fe,pe))}}switch(e){case 0:return!0;case 1:return le===0;case 2:return le===1;case 3:return le===2;case 4:return ve.test(t.slice(n,r));case 5:return be(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&&be(t.slice(n,r-1));case 8:return ye.test(t.slice(n,r));default:return xe(t,n,r)}},Ee=new Set(typeof E==`string`?E.split(` `):E),De=(e,t,n,r,i,a)=>{let o=PV(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},Oe=new Map,ke=new Map,Ae=2,je=4096,Me=(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||Ee.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=ke.get(s);return c===void 0&&ke.set(s,c=Ae++),c},Ne=new Map,Pe=r,Fe=r+4096,Ie=()=>Pe++,Le=2097152,Re=8192,ze=new Int32Array(Re),Be=Array(Re).fill(null),Ve=new Int32Array(Re),He=new Int32Array(Re),Ue=new Uint8Array(Re),We=0,Ge=(e,t,n,r,i,a,o,s)=>{let c=e;if(Be[e]!==null){if(Be[e|1]===null)c=e|1;else if(!(We++&3))c=e|We>>2&1;else return}Be[c]=t.slice(n,r),ze[c]=i,Ve[c]=a,He[c]=o,Ue[c]=s},Ke=()=>Be.fill(null),qe=256,Je=[new Int32Array(qe),new Int32Array(qe),new Int32Array(qe),new Int32Array(qe)],[Ye,Xe,Ze,Qe]=Je,$e=new Uint8Array(qe),et=new Uint8Array(qe),tt=()=>{qe*=2,Je=Je.map(e=>{let t=new Int32Array(qe);return t.set(e),t}),[Ye,Xe,Ze,Qe]=Je;let e=new Uint8Array(qe);e.set($e),$e=e,et=new Uint8Array(qe)},nt=64,rt=new Int32Array(nt),it=new Int32Array(nt),at=new Int32Array(r),ot=2048,st=21,ct=new Float64Array(ot),lt=new Int32Array(ot),ut=0,dt=(e,t)=>{if(e===0&&t<r)return at[t]===ut?1:(at[t]=ut,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>st;for(;lt[i]===ut;){if(ct[i]===n)return 1;i=i+1&ot-1}return ct[i]=n,lt[i]=ut,0},ft=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?MV:De(Ne,e,t+1,r,0,Ie)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=it[t];if(r>n)continue;let i=rt[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=L(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;ge(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(Te(d[t],e,r,n))return p[h+t]}return MV},pt=e=>{let t=e.length,n=0,c=0,u=!1;(Ae>je||Oe.size>je)&&(Oe=new Map,ke=new Map,Ae=2,Ke()),Pe>Fe&&(Ne=new Map,Pe=r,Ke());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&he(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&&he(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===qe&&tt();let _=n++;Ye[_]=p,Xe[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(ze[y]===v&&Be[y]!==null&&Be[y].length===g?t=y:ze[y|1]===v&&Be[y|1]!==null&&Be[y|1].length===g&&(t=y|1),t>=0){let n=Be[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Ze[_]=Ve[t],Qe[_]=He[t],$e[_]=Ue[t];continue}}}let b=p;if(re!==0){if(h-p<=re||!e.startsWith(ne,p)){Ze[_]=MV,Ge(y,e,p,h,v,MV,0,0);continue}b=p+re}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,ee=-1,L=0;(l[0]>=0||N[0]===1)&&(rt[0]=0,it[0]=M,L=1);let te=NV,R=0;for(let t=M;t<D;t++)if(t===A&&(te=F<I?NV:P,R=L),P!==NV){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=ee)):P=NV;else{let e=i[P],t=i[P+1],c=NV;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],ee=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(L===nt){nt*=2;let e=new Int32Array(nt);e.set(rt),rt=e;let t=new Int32Array(nt);t.set(it),it=t}rt[L]=r,it[L]=t+2,L++}}A===D&&(te=F<I?NV:P,R=L);let ie=F<I?NV:P,ae,oe=!1;if(A>=0){if(oe=!0,ae=ft(e,E,A,te,R),ae!==MV&&ae<r&&j[ae]){let t=ft(e,E,D,ie,L);t!==MV&&t!==ae&&(ae=t,oe=!1)}else ae===MV&&(ae=ft(e,E,D,ie,L),oe=!1)}else ae=ft(e,E,D,ie,L);let se=0,ce=0;ae===MV?Ze[_]=MV:(ce=+!!oe,se=b>=C?+!!O:De(Oe,e,b,C,+!!O,e=>Me(e,O)),Ze[_]=ae,$e[_]=ce,Qe[_]=se),Ge(y,e,p,h,v,ae,se,ce)}if(n===0)return``;if(n===1)return Ye[0]===0&&Xe[0]===t?e:e.slice(Ye[0],Xe[0]);if(n*k>ot){for(;n*k>ot;)ot<<=1,st--;ct=new Float64Array(ot),lt=new Int32Array(ot)}if(Ae>=Le||Pe>=Le)throw Error(`cn: too many distinct classes in one merge`);ut=ut+1|0,ut===0&&(at.fill(0),lt.fill(0),ut=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Ze[e];if(t===MV){et[e]=1;continue}let n=Qe[e];if(dt(n,t)===1){et[e]=0,f=!0;continue}if(et[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)dt(n,x[e]);if($e[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&dt(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!et[m]){m++;continue}let t=Ye[m],r=Xe[m],i=m+1;for(;i<n&&et[i]&&Ye[i]===r+1&&e.charCodeAt(r)===32;)r=Xe[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},mt=16384,ht=new Int32Array(mt*2),gt=0,_t=1,vt=Object.create(null),yt=Object.create(null),bt=new Map,xt=new Map,St=0,Ct=0,wt=()=>{gt^=mt,_t=_t+1|0,Ct=0},Tt=e=>{let t=vt[e];if(t!==void 0)return t;let n=FV(e,0,e.length),r=(n&16383)+gt,i=ht[r]===(n^_t)||ht[r^mt]===(n^_t-1);return i&&(t=yt[e],t!==void 0)?(vt[e]=t,t):(t=pt(e),i?(vt[e]=t,++St>te&&(St=0,yt=vt,vt=Object.create(null),wt())):(ht[r]=n^_t,++Ct>mt&&wt()),t)},Et=e=>{let t=bt.get(e);if(t!==void 0)return t;let n=FV(e,0,e.length),r=(n&16383)+gt,i=ht[r]===(n^_t)||ht[r^mt]===(n^_t-1);return i&&(t=xt.get(e),t!==void 0)?(bt.set(e,t),t):(t=pt(e),i?(bt.set(e,t),++St>te&&(St=0,xt=bt,bt=new Map,wt())):(ht[r]=n^_t,++Ct>mt&&wt()),t)},Dt=e=>{let t=FV(e,0,e.length),n=(t&16383)+gt;return ht[n]===(t^_t)||ht[n^mt]===(t^_t-1)||(ht[n]=t^_t,++Ct>mt&&wt(),!1)},Ot=te===0?pt:jV?e=>{let t=bt.get(e);return t===void 0?Et(e):t}:Tt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?Ot(arguments[0]):Ot(zV.apply(null,arguments))},mergeString:Ot,seenBefore:te===0?()=>!1:Dt,mergeUncached:pt}},LV=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:LV(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},RV=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:LV(i,t);a&&(n&&(n+=` `),n+=a)}return n},zV=function(){return RV(arguments,!1)},BV=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},l=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},u=(t,c)=>{let u=t.length,d=s===null?null:s.n;if(!c){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let f=``,p=-1,m=0,h=!1;for(let e=0;e<u;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=LV(n,!0),!n)continue;h=!0}p<0&&(f=n,p=e),m++}}if(m===0)return``;if(m===1)return e(f);if(h){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let g=i.get(f);g===void 0&&(g=a.get(f),g!==void 0&&i.set(f,g));let _=null;if(g!==void 0)outer:for(let e=0;e<g.length;e++){let n=g[e];if(n.t!==m)continue;let r=n.a,i=1;for(let e=p+1;e<u;e++){let n=t[e];if(n&&n!==r[i++])continue outer}_=n;break}if(_===null){let s=f,c=[f];for(let e=p+1;e<u;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);_={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},g===void 0&&i.set(f,g=[]),g.length>=256&&g.shift(),g.push(_),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==_&&(s.n=_),s=_,_.r},d=t=>Array.isArray(t)?u(t.slice(),!1):e(LV(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},VV=IV(AV),HV=BV(VV.mergeString,VV);VV.merge;var UV=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=nL({disabled:i,focusableWhenDisabled:a,native:o});return TI(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function WV(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=WV(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function GV(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=WV(e))&&(r&&(r+=` `),r+=t);return r}var KV=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,qV=GV,JV=(e,t)=>n=>{if(t?.variants==null)return qV(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=KV(t)||KV(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return qV(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},YV=JV(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,xs:`h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5`,sm:`h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,lg:`h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4`,icon:`size-7 [&_svg:not([class*='size-'])]:size-3.5`,"icon-xs":`size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5`,"icon-sm":`size-6 [&_svg:not([class*='size-'])]:size-3`,"icon-lg":`size-8 [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`,size:`default`}});function XV({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Q.jsx)(UV,{"data-slot":`button`,className:HV(YV({variant:t,size:n,className:e})),...r})}var ZV=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function QV(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:ZV(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var $V=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},eH=e=>{let t=$V(e);return t.charAt(0).toUpperCase()+t.slice(1)},tH=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),nH={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function rH(e){return e!=null}function iH(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??nH.width,a=e.size??e.height??nH.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?tH(...c):tH(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??nH[`stroke-width`])*Number(e.size??e.width??nH.width)/Number(t.size??t.width??nH.width):t.strokeWidth??nH[`stroke-width`];return[`svg`,{...Object.entries(nH).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&rH(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&rH(t.width)&&{[r(`width`)]:t.width},...`height`in t&&rH(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function aH(e,t={}){return iH(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var oH=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},sH=(0,Z.createContext)({}),cH=()=>(0,Z.useContext)(sH),lH=(0,Z.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=cH()??{},y=!!c||oH(d),[b,x,S=[]]=aH(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:tH(v,s),hasA11yProp:y,attributes:d});return(0,Z.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,Z.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function uH(e,t=[],n=[]){let r=typeof e==`string`?QV(e,t,n):e,i=(0,Z.forwardRef)(({className:e,...t},n)=>(0,Z.createElement)(lH,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=eH(r.name)),i}var dH={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};dH.node;var fH=uH(dH),pH={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};pH.node;var mH=uH(pH),hH={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};hH.node;var gH=uH(hH),_H={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};_H.node;var vH=uH(_H),yH={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};yH.node;var bH=uH(yH),xH={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};xH.node;var SH=uH(xH),CH={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};CH.node;var wH=uH(CH),TH={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};TH.node;var EH=uH(TH),DH={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};DH.node;var OH=uH(DH),kH={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};kH.node;var AH=uH(kH),jH={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};jH.node;var MH=uH(jH),NH={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};NH.node;var PH=uH(NH),FH={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};FH.node;var IH=uH(FH),LH={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};LH.node;var RH=uH(LH),zH={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};zH.node;var BH=uH(zH),VH={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};VH.node;var HH=uH(VH),UH={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};UH.node;var WH=uH(UH),GH={name:`panel-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]],aliases:[`sidebar`]};GH.node;var KH=uH(GH),qH={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};qH.node;var JH=uH(qH),YH={name:`server-off`,size:24,node:[[`path`,{d:`M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5`,key:`bt2siv`}],[`path`,{d:`M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z`,key:`1hjrv1`}],[`path`,{d:`M22 17v-1a2 2 0 0 0-2-2h-1`,key:`1iynyr`}],[`path`,{d:`M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z`,key:`161ggg`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};YH.node;var XH=uH(YH),ZH={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};ZH.node;var QH=uH(ZH),$H={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};$H.node;var eU=uH($H),tU={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};tU.node;var nU=uH(tU),rU={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};rU.node;var iU=uH(rU),aU={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};aU.node;var oU=uH(aU),sU={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};sU.node;var cU=uH(sU),lU=Z.createContext(void 0);function uU(e){let t=Z.useContext(lU);if(t===void 0&&!e)throw Error(IN(72));return t}var dU=class extends KN{setState(e){}update(e){}set(e,t){}notifyAll(){}},fU={...eB,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},pU=class extends KN{constructor(e,t,n){let r=new qz;super(mU(e,r,t,n),hU(r),fU)}setOpen=(e,t)=>{Vz(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,SL(oL,e))}};function mU(e,t,n,r=!1){return{...Jz(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function hU(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var gU=BN(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=Fz((e,t)=>new pU({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Uz(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Wz(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Z.useRef(null);PN(()=>{m&&t&&p.setOpen(!1,SL(_L))},[m,t,p]),PN(()=>{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]),PN(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Z.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,SL(bL))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,Q.jsxs)(lU.Provider,{value:p,children:[l&&(0,Q.jsx)(Iz,{handle:l,store:p}),T&&(0,Q.jsx)(_U,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function _U({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=TR(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=SR(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Z.useMemo(()=>dI(a.reference,i.reference),[a.reference,i.reference]);return Gz(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??AN}),null}function vU(e){return ZI(e,`base-ui`)}var yU=Z.createContext(void 0);function bU(){return Z.useContext(yU)}var xU=`data-base-ui-tooltip-trigger`;function SU(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(QN(n))return n}}let t=e.target;return QN(t)?t:null}function CU(e){let t=e;for(;t;){let e=t.closest(`[${xU}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&QN(n.host)?n.host:null}return null}var wU=VN(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=uU(!0),m=tB(a)??p;if(!m)throw Error(IN(82));let h=vU(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Z.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=Hz(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=bU(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=BL(v,{open:_}),O=dB(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=AL(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Z.useRef(!1),F=CP(),I=Z.useRef(void 0);function ee(){return D&&w.current!=null?0:c??C??600}function L(e){let t=y.current;if(!t||!e)return!1;let n=CU(e);return n!==null&&n!==t&&NP(t,n)}function te(e){let t=L(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let R=mB(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?jB():null,restMs:ee,delay(){return u==null&&D?{close:NL(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),ne=oB(v,{enabled:!A}).reference,re=e=>{let t=P.current,n=SU(e),r=te(n),i=y.current,a=i&&n&&NP(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,SL(sL,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&rF(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,SL(sL,e,i))},n=ee();n===0?(F.clear(),t()):F.start(n,t)}},ie=m.useState(`triggerProps`,S);return TI(`button`,e,{state:{open:_},ref:[t,x,y],props:[R,ne,S||M!==`none`?ie:void 0,{onMouseOver(e){re(e.nativeEvent)},onFocus(e){L(SU(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[GP]:A?``:void 0,[xU]:A?void 0:``},f],stateAttributesMapping:VP})}),TU=Z.createContext(void 0);function EU(){let e=Z.useContext(TU);if(e===void 0)throw Error(IN(70));return e}var DU=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return uU().useState(`mounted`)||n?(0,Q.jsx)(TU.Provider,{value:n,children:(0,Q.jsx)(kL,{ref:t,...r})}):null}),OU=Z.createContext(void 0);function kU(){let e=Z.useContext(OU);if(e===void 0)throw Error(IN(71));return e}var AU=Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=GI,style:g,..._}=e,v=uU(),y=EU(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=qB({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=ZB(e,Z.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,Q.jsx)(OU.Provider,{value:D,children:O})}),jU=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=uU(),{side:s,align:c}=kU(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);LI({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),fB(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return TI(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[Nz,f,XB(d),a],stateAttributesMapping:WP})}),MU=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=uU(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=kU();return TI(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:UP})}),NU=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Z.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Q.jsx)(yU.Provider,{value:t,children:(0,Q.jsx)(zL,{delay:i,timeoutMs:r,children:e.children})})};function PU(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function FU({delay:e=0,...t}){return(0,Q.jsx)(NU,{"data-slot":`tooltip-provider`,delay:e,...t})}function IU({...e}){return(0,Q.jsx)(gU,{"data-slot":`tooltip`,...e})}function LU({...e}){return(0,Q.jsx)(wU,{"data-slot":`tooltip-trigger`,...e})}function RU({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,Q.jsx)(DU,{children:(0,Q.jsx)(AU,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,Q.jsxs)(jU,{"data-slot":`tooltip-content`,className:HV(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,Q.jsx)(MU,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var zU=new Set;function BU(e){return zU.add(e),()=>zU.delete(e)}function VU(e){for(let t of[...zU])t(e)}function HU(e,t){let n=()=>VU({title:`Copied ${t}`,description:e,type:`success`}),r=()=>VU({title:`Could not copy ${t}`,description:e,type:`error`});if(window.isSecureContext&&navigator.clipboard!==null&&navigator.clipboard!==void 0){navigator.clipboard.writeText(e).then(n,()=>{UU(e)?n():r()});return}UU(e)?n():r()}function UU(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();try{return document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}var WU=X(e=>EE(t=>{window.addEventListener(`focus`,e),window.addEventListener(`online`,e),window.addEventListener(`visibilitychange`,e),t.addFinalizer(()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`online`,e),window.removeEventListener(`visibilitychange`,e)})}));function GU(e){let t=(0,QB.c)(2),n;t[0]===e?n=t[1]:(n=WU(e),t[0]=e,t[1]=n),xN(n)}var KU=`~effect/Cache`,qU=(e,t)=>bs(n=>{let r=Object.create(YU);return r.lookup=t=>gs(e(t),e=>Dr(n,e)),r.map=_ae(),r.capacity=t.capacity,r.timeToLive=t.timeToLive?(e,n)=>yi(t.timeToLive(e,n)):XU,so(r)}),JU=e=>qU(e.lookup,{...e,timeToLive:e.timeToLive===void 0?XU:()=>e.timeToLive}),YU={...bt,[KU]:KU,toJSON(){return{_id:`Cache`,capacity:this.capacity,map:this.map}}},XU=(e,t)=>Mi,ZU=a(2,(e,t)=>Qt(n=>{let r=Vw(e.map,t);if(Vn(r)&&(Ww(e.map,t),!eW(r.value,n)))return Uw(e.map,t,r.value),r.value.await();let i=new QU(n,e.lookup(t));i.onInterrupt=()=>$U(e,t,i);let a=!1;i.fiber.addObserver(r=>{if(i.onInterrupt=void 0,cs(r)){$U(e,t,i);return}let o=e.timeToLive(r,t);Oi(o)?(a=!0,$U(e,t,i)):Di(o)&&(i.expiresAt=n.getRef(il).currentTimeMillisUnsafe()+Bi(o))});let o=i.fiber.pollUnsafe();return!a&&(o===void 0||!cs(o))&&Uw(e.map,t,i),Number.isFinite(e.capacity)&&tW(e),i.await()})),QU=class{expiresAt;awaiters;fiber;onInterrupt;constructor(e,t){this.fiber=Vc(e,t,!0,!0),this.awaiters=0,this.expiresAt=void 0}await(){return this.fiber.pollUnsafe()||(this.awaiters++,Oc(io(this.fiber),()=>(this.awaiters--,this.awaiters>0||this.fiber.pollUnsafe()?_o:(this.onInterrupt?.(),ao(this.fiber)))))}},$U=(e,t,n)=>{let r=Vw(e.map,t);Vn(r)&&r.value===n&&Ww(e.map,t)},eW=(e,t)=>e.expiresAt!==void 0&&t.getRef(il).currentTimeMillisUnsafe()>=e.expiresAt,tW=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}},nW=a(2,(e,t)=>uo(()=>{Ww(e.map,t)})),rW=2**48-1,iW=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,aW=(e,t)=>{if(t.length!==10)throw Error(`ULID randomness must be exactly 10 bytes, received ${t.length}`);let n=Math.min(Math.max(0,Math.trunc(e)),rW),r=``;for(let e=45;e>=0;e-=5)r+=iW[Math.floor(n/2**e)&31];let i=0,a=0;for(let e of t){for(i=i<<8|e,a+=8;a>=5;)a-=5,r+=iW[i>>>a&31];i&=(1<<a)-1}return r},oW=e=>e.toString(16).padStart(2,`0`),sW=e=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map(e=>Array.from(e,oW).join(``)).join(`-`),cW=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function lW(e=cW()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var uW=e=>sW(e===void 0?lW():lW(e)),dW=2**48-1;function fW(e,t=cW()){let n=Math.min(Math.max(0,Math.trunc(e)),dW);return t[0]=Math.floor(n/2**40),t[1]=Math.floor(n/2**32)&255,t[2]=Math.floor(n/2**24)&255,t[3]=Math.floor(n/2**16)&255,t[4]=Math.floor(n/256)&255,t[5]=n&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var pW=(e,t)=>sW(t===void 0?fW(e):fW(e,t)),mW=`~effect/Crypto`,hW=rr(`effect/Crypto`),gW=e=>{let t=e.randomBytes,n=e=>Yf(_W(`randomBytes`,e),t),r=e=>(e[0]&31)*2**48+e[1]*2**40+e[2]*2**32+e[3]*2**24+e[4]*2**16+e[5]*256+e[6],i=()=>r(t(7))/2**53,a=()=>{for(;;){let e=t(7),n=r(e);if(!(e[0]&32))return n+-(2**53-1);if(n<2**53-1)return n+1}};return hW.of({[mW]:mW,randomBytes:n,nextDoubleUnsafe:i,nextIntUnsafe:a,digest:e.digest,random:B(()=>i()),randomBoolean:B(()=>i()>.5),randomInt:B(()=>a()),randomBetween:(e,t)=>B(()=>Xd(e,t,i())),randomIntBetween(e,t,n){let r=n?.halfOpen===!0?0:1;return B(()=>{let n=Math.ceil(e),a=Math.floor(t);return Math.floor(i()*(a-n+r))+n})},randomShuffle:e=>B(()=>{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:B(()=>uW(t(16))),randomUUIDv7:Yp(e=>z(pW(e.currentTimeMillisUnsafe(),t(16)))),randomULID:Yp(e=>z(aW(e.currentTimeMillisUnsafe(),t(10))))})},_W=(e,t)=>Number.isSafeInteger(t)&&t>=0?z(t):H(Eae({module:`Crypto`,method:e,description:`size must be a non-negative safe integer`})),vW=`~effect/FiberMap`,yW=e=>F(e,vW),bW={[vW]:vW,[Symbol.iterator](){return this.state._tag===`Closed`?Wr():this.state.backing[Symbol.iterator]()},...bt,toJSON(){return{_id:`FiberMap`,state:this.state}}},xW=(e,t)=>{let n=Object.create(bW);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},SW=()=>xp(B(()=>xW(Bw(),hu())),e=>Mf(()=>{let t=e.state;return t._tag===`Closed`?Nf:(e.state={_tag:`Closed`},xS(yae(t.backing)).pipe(sne(e.deferred)))})),CW=-1,wW=Zi($i(Jl,Qi(CW))),TW=a(e=>yW(e[0]),(e,t,n,r)=>{if(e.state._tag===`Closed`){n.interruptUnsafe(CW);return}let i=Vw(e.state.backing,t);if(i._tag===`Some`){if(i.value===n)return;if(r?.onlyIfMissing===!0){n.interruptUnsafe(CW);return}}Uw(e.state.backing,t,n),i._tag===`Some`&&i.value.interruptUnsafe(CW),n.addObserver(i=>{if(e.state._tag===`Closed`)return;let a=Vw(e.state.backing,t);Vn(a)&&n===a.value&&Ww(e.state.backing,t),du(i)&&(r?.propagateInterruption===!0?!wW(i.cause):!rne(i.cause))&&bu(e.deferred,i)})}),EW=a(2,(e,t)=>e.state._tag!==`Closed`&&xae(e.state.backing,t)),DW=function(){let e;return()=>(e===void 0&&(e=zp(Op)),e)}(),OW=e=>()=>Yf(pp(),t=>{let n=Bp(t);return(t,r,i)=>{if(e.state._tag===`Closed`||i?.onlyIfMissing===!0&&EW(e,t))return DW();let a=n(r,i);return TW(e,t,a,i),a}}),kW=`~effect/ManagedRuntime`,AW=(e,t)=>{let n=t?.memoMap??Fu(),r=Su(`sequential`),i=Du(r,`sequential`),a={onFiberStart:CS(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=>B(()=>{l.cachedContext=e})),{...a,scheduler:t.cache.scheduler}),Wf(_S(s)))),l={[kW]:kW,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(jW(l,e),o(t)):Bp(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?One(jW(l,e),o(t)):Vp(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Kp(jW(l,e)):jne(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?Wp(jW(l,e)):Gp(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Up(jW(l,e),o(t)):Ane(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?Hp(jW(l,e),o(t)):kne(l.cachedContext)(e,o(t))}};return l};function jW(e,t){return Uf(e.contextEffect,e=>gp(t,e))}var MW=`~effect/SynchronizedRef`,NW={...bt,[MW]:MW,toJSON(){return{_id:`SynchronizedRef`,value:this.backing.ref.current}}},PW=e=>{let t=Object.create(NW);return t.semaphore=AC(1),t.backing=zD(e),t},FW=e=>B(()=>PW(e)),IW=e=>e.backing.ref.current,LW=a(2,(e,t)=>e.semaphore.withPermit(WD(e.backing,t))),RW=a(2,(e,t)=>e.semaphore.withPermit(Mf(()=>Yf(t(IW(e)),([t,n])=>(e.backing.ref.current=n,t))))),zW=a(2,(e,t)=>e.semaphore.withPermit(HD(e.backing,t))),BW=a(2,(e,t)=>e.semaphore.withPermit(GD(e.backing,t))),VW=class extends rr()(`@porcelain/client/EnvironmentStorage`){},HW=class extends rr()(`@porcelain/client/AccessPlatform`){},UW=class extends Y()(`WriteNotSentError`,{cause:Lb}){get message(){return`An earlier change failed, so this one was not sent.`}},WW=class extends rr()(`@porcelain/client/WriteQueue`){static make=V(function*(){let e=yield*NC(1),t=yield*BD({pending:0,failure:Rn()});return{enqueue:n=>Mp(r=>V(function*(){return yield*GD(t,e=>({...e,pending:e.pending+1})),yield*Vf,yield*e.withPermit(V(function*(){let e=yield*VD(t),i=yield*Jf(r(Vn(e.failure)?H(new UW({cause:e.failure.value})):n));return yield*GD(t,e=>{let t=e.pending-1,n=du(i)?Ul(i.cause):void 0;return{pending:t,failure:t===0?Rn():fee(e.failure,()=>du(i)?zn(n instanceof UW?n.cause:n):Rn())}}),yield*uu(i)?z(i.value):Lf(i.cause)}))}))}})},GW=class e extends rr()(`@porcelain/client/WriteQueues`){static layer=Ku(e,V(function*(){let e=yield*jae({lookup:e=>V(function*(){return{scope:yield*Eu(yield*xu,`parallel`),queue:yield*WW.make}}),idleTimeToLive:0});return{run:(t,n)=>bp(V(function*(){let{scope:r,queue:i}=yield*Mae(e,JSON.stringify(t)),a=yield*Lp(i.enqueue(n),r,{startImmediately:!0});return yield*vS(a).pipe(wp(bS(a)))}))}}))},KW=class extends Y()(`ConnectionError`,{message:G,cause:Mb(Lb)}){},qW=Jp(`persistedState`)(function*(e){let t=Ij({...e.initial,status:`loading`,error:void 0}),n=yield*WW.make;return{state:t,load:()=>n.enqueue(V(function*(){t.update(e=>({...e,status:`loading`,error:void 0})),yield*e.read().pipe(Sne({onSuccess:e=>B(()=>t.set({...e,status:`ready`,error:void 0})),onFailure:()=>B(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.readFailed})))}),jp)})),write:r=>n.enqueue(V(function*(){if(t.value.status!==`ready`)return yield*H(new KW({message:e.messages.beforeRead}));let n=yield*r(t.value);yield*e.write(n).pipe(np(({cause:t})=>new KW({message:e.messages.writeFailed,cause:t})),ip(()=>B(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.writeFailed})))),Kf(()=>B(()=>t.update(e=>({...e,...n})))),jp)}))}}),JW=1024,YW=1024*JW,XW=10*YW,ZW=16*JW,QW=2e3,$W=2e3,eG=4096,tG=2147483647,nG=1e3,rG=1e4,iG=rG,aG=1024,oG=5e4,sG=16e3,cG=4e3,lG=2e3,uG=1e3,dG=4e3,fG=2048;8*YW,32*YW;var pG=Yb([`content_changed`,`file_too_large`,`unsupported_text`,`worktree_changed`]),mG=K({statusCode:zb.check(hx()).check(fx(400)).check(px(599)),error:G,message:G,code:U(pG)}),hG=G.check(ox(e=>Lr(Tb(wx)(e)),{expected:`an absolute URL`})),gG=G.check(sx(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z$/),ox(e=>{let t=Tb(Hie)(e);return Lr(t)&&ire(t.success)===e.split(`T`)[0]},{expected:`a valid UTC timestamp`})),_G=G.check(cx()),vG=G.check(sx(RegExp(`^[0-9a-f]{32}$`)));function yG(e){return Xb(e).pipe(Qb(Zb(Pb(e)),m_({decode:e=>e===null?void 0:e,encode:e=>e===void 0?null:e})))}var bG=K({worktreeId:vG}),xG=`~effect/http-api/HttpApiMiddleware`,SG=`~effect/http-api/HttpApiMiddleware/Security`,CG=()=>(e,t)=>{let n=it(),r;n!==0&&(at(2),r=new globalThis.Error,at(n));class i extends rr()(e){}let a=i;if(Object.defineProperty(i,"stack",{get(){return r?.stack}}),a[xG]=xG,a.error=wG(t?.error),a.requiredForClient=t?.requiredForClient??!1,t?.security!==void 0){if(Object.keys(t.security).length===0)throw Error(`HttpApiMiddleware.Service: security object must not be empty`);a[SG]=SG,a.security=t.security}return a};function wG(e){return e===void 0?new Set:new Set(Array.isArray(e)?e:[e])}var TG=`~effect/http-api/HttpApiGroup`,EG={[TG]:TG,add(...e){let t={...this.endpoints};for(let n of e)ct(t,n.identifier,n);return OG({...DG(this),endpoints:t})},prefix(e){return OG({...DG(this),endpoints:Kr(this.endpoints,t=>t.prefix(e))})},middleware(e){return OG({...DG(this),endpoints:Kr(this.endpoints,t=>t.middleware(e))})},annotateMerge(e){return OG({...DG(this),annotations:Dr(this.annotations,e)})},annotate(e,t){return OG({...DG(this),annotations:_r(this.annotations,e,t)})},annotateEndpointsMerge(e){return OG({...DG(this),endpoints:Kr(this.endpoints,t=>t.annotateMerge(e))})},annotateEndpoints(e,t){return OG({...DG(this),endpoints:Kr(this.endpoints,n=>n.annotate(e,t))})},pipe(){return n(this,arguments)}},DG=e=>({identifier:e.identifier,topLevel:e.topLevel,endpoints:e.endpoints,annotations:e.annotations}),OG=e=>{function t(){}return Object.setPrototypeOf(t,EG),t.key=`effect/http-api/HttpApiGroup/${e.identifier}`,Object.assign(t,e)},kG=(e,t)=>OG({identifier:e,topLevel:t?.topLevel??!1,endpoints:{},annotations:hr()}),AG=Jb([K({kind:W(`owner`)}),K({kind:W(`device`),deviceId:G.check(cx())})]),jG=`/open/pair`,MG=`/pair`;function NG(e){return e.replace(/\/$/,``)===jG}function PG(e){let t=t=>[`c=${encodeURIComponent(e.code)}`,`e=${encodeURIComponent(e.environmentId)}`,...t?[`a=${encodeURIComponent(e.addresses.join(`,`))}`]:[]].join(`&`);return e.appOrigin===void 0?`${e.addresses[0]??``}${MG}#${t(e.addresses.length>1)}`:`${e.appOrigin}${jG}#${t(!0)}`}function FG(e){let t=e.indexOf(`#`);if(t===-1)return;let n=e.slice(0,t),r;try{r=new Map(e.slice(t+1).split(`&`).map(e=>{let[t=``,n=``]=e.split(`=`);return[t,decodeURIComponent(n)]}))}catch{return}let i=(r.get(`a`)??``).split(`,`).filter(e=>e!==``),a={code:r.get(`c`)??``,environmentId:r.get(`e`)??``};if(n.endsWith(`/open/pair`))return i.length===0?void 0:{...a,addresses:i,appOrigin:n.slice(0,-10)};if(n.endsWith(MG))return{...a,addresses:i.length===0?[n.slice(0,-5)]:i}}var IG=G,LG=K({addresses:q(G),code:G,environmentId:G,appOrigin:U(G)}),RG=IG.pipe(Qb(LG,p_({decode:e=>{let t=FG(e);return t===void 0?H(new bg({message:`Expected a Porcelain pairing link`})):z(t)},encode:e=>z(PG(e))}))),zG=K({code:G.check(_x(1)).check(J(200)),platform:G.check(_x(1)).check(J(120)),label:U(G.check(_x(1)).check(J(80)))}),BG=K({device:K({id:G,label:G,platform:G,createdAt:G}),credential:U(G)}),VG=K({id:G,label:G,addresses:q(G),createdAt:G,expiresAt:G,trusted:Bb,canManageSharing:U(Bb)}),HG=Yb([`loopback`,`lan`,`tailnet`,`tunnel`]),UG=K({id:G,label:G,platform:G,createdAt:G,lastSeenAt:G,lastSeenAddress:U(G),route:HG,routeInferred:U(Bb),trusted:Bb,canManageSharing:U(Bb),canEditWaysIn:Bb,current:U(Bb)}),WG=K({canEditIdentity:U(Bb),grants:q(VG),devices:q(UG)}),GG=K({labels:q(G.check(_x(1)).check(J(80))).check(_x(1)).check(J(20)),addresses:q(hG).check(_x(1)).check(J(10)),trusted:U(Bb),canManageSharing:U(Bb)}),KG=K({grants:q(K({grant:VG,code:G,link:RG}))}),qG=K({id:G.check(_x(1))}),JG=K({revoked:Bb,kind:U(Yb([`grant`,`device`]))}),YG=K({id:G.check(_x(1)),trusted:Bb}),XG=K({id:G,trusted:Bb}),ZG=K({id:G.check(_x(1)),allowed:Bb}),QG=K({id:G,allowed:Bb}),$G=K({id:G.check(_x(1)),allowed:Bb}),eK=K({id:G,allowed:Bb}),tK=Rb;K({route:HG,local:Bb}),rr()(`@porcelain/http/RequestConnection`);var nK=class extends CG()(`@porcelain/http/ClientRequest`){};rr()(`@porcelain/http/RequestCaller`);var rK=class extends CG()(`@porcelain/http/PairedRequest`){},iK=class extends Y()(`InvalidDeviceDetailsError`,{}){get message(){return`The device name or platform is missing, too long, or contains control characters.`}},aK=class extends Y()(`InvalidPairingAddressError`,{}){get message(){return`This server does not answer at that address, so a link aimed there would not reach it.`}},oK=class extends Y()(`InvalidPairingError`,{}){get message(){return`This pairing link is not valid.`}},sK=class extends Y()(`MissingEnvironmentIdentityError`,{}){get message(){return`This server has no environment identity.`}};Y()(`TooManyPairingAttemptsError`,{});var cK=class extends Y()(`InvalidTunnelHostnameError`,{}){get message(){return`Enter the public hostname your Cloudflare tunnel serves, such as porcelain.example.com.`}},lK=class extends Y()(`MissingTunnelHostnameError`,{}){get message(){return`Cloudflare needs the public hostname your tunnel serves.`}},uK=class extends Y()(`InvalidTailnetHostnameError`,{}){get message(){return`Enter this computer's Tailscale name, such as laptop.tail1234.ts.net.`}},dK=class extends Y()(`MissingTailnetHostnameError`,{}){get message(){return`Tailscale needs this computer's Tailscale name.`}},fK=class extends Y()(`NoLocalNetworkError`,{}){get message(){return`This computer is not on a local network right now, so there is no network to share on.`}},pK=class extends Y()(`UnidentifiedLocalNetworkError`,{}){get message(){return`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known. Try again in a moment.`}},mK=class extends Y()(`ServiceNotManagedError`,{}){get message(){return`Porcelain is not running as the installed service, so it cannot update itself`}},hK=class extends Y()(`ServiceUpdateNotOfferedError`,{}){get message(){return`That version is not the newer version this server offers`}},gK=class extends Y()(`ServiceUpdateRunningError`,{}){get message(){return`An update is already running`}},_K=class extends Y()(`DeviceViewerRequiredError`,{}){get message(){return`A live ticket is issued to a paired device`}},vK=class extends Y()(`TooManyLiveTicketsError`,{}){get message(){return`Too many live tickets are waiting to be used. Try again shortly.`}},yK=class extends Y()(`DeviceNotFoundError`,{}){get message(){return`Device not found`}},bK=class extends Y()(`UntrustedDeviceError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can update Porcelain`}},xK=class extends Y()(`WaysInPermissionRequiredError`,{}){get message(){return`An owner must let this device edit ways in on the computer that runs Porcelain before it can see or change them`}},SK=class extends Y()(`WaysInChangedError`,{}){get message(){return`The ways in changed since you last looked. Check them again, then save your change.`}},CK=class extends Y()(`RemoteRouteInUseError`,{}){get message(){return`This device is connected through this way in, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}},wK=class extends Y()(`ReviewGitSettingsTrustRequiredError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can change Reviews & Git settings`}},TK=class extends Y()(`ReviewGitSettingsNotConfiguredError`,{}){get message(){return`Choose Reviews & Git settings for this computer before changing one of them`}},EK=class extends Y()(`SharingManagementRequiredError`,{}){get message(){return`This device cannot manage sharing. Allow it from a device with sharing access.`}},DK=class extends Y()(`PushRegistrationDeviceRequiredError`,{}){get message(){return`Notifications are registered by a paired device`}},OK=kr(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),kK=class extends rr()(`effect/http/FetchHttpClient/RequestInit`){},AK=qO(z(VO((e,t,n,r)=>{let i=r.getRef(OK),a=yr(r.context,kK)??{},o=a.headers?Mh(Oh(a.headers),e.headers):e.headers;o[`content-length`]&&(o=Nh(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 JD({reason:new ZD({request:e,cause:t})})}),t=>NO(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(ioe(e.body.stream),s)}return s(void 0)}))),jK={BadRequest:`Bad Request`,Unauthorized:`Unauthorized`,Forbidden:`Forbidden`,PayloadTooLarge:`Payload Too Large`,TooManyRequests:`Too Many Requests`,BadGateway:`Bad Gateway`,ServiceUnavailable:`Service Unavailable`,NotFound:`Not Found`,Conflict:`Conflict`,UnprocessableEntity:`Unprocessable Entity`},MK=class extends Y()(`HttpFailureMessage`,{name:G,message:G}){};function $(e,t,n={}){let r=typeof n.message==`object`?void 0:n.message??new e().message,i={statusCode:Fk(t),error:jK[t],...n.code===void 0?{}:{code:n.code}};return K({statusCode:W(i.statusCode),error:W(i.error),message:r===void 0?G:W(r),code:Mb(n.code===void 0?Ib:W(n.code))}).pipe(Qb(_b(t=>t instanceof e||t instanceof MK&&t.name===e.name),m_({decode:t=>r===void 0?new MK({name:e.name,message:t.message}):new e,encode:e=>({...i,message:r??e.message})})),Lk(t))}var NK=$(sK,`ServiceUnavailable`,{message:`Operation unavailable`}),PK={onExcessProperty:`error`},FK=KA(`porcelain`).annotate(XA,PK).annotate(ZA,PK).annotate($A,PK),IK=K({pullStrategy:Yb([`merge`,`rebase`]),collapseSpecs:Bb,archiveDeleteWorktree:Bb,archiveDeleteLocalBranch:Bb,archiveDeleteRemoteBranch:Bb}),LK=Yb([`desktop`,`laptop`,`server`,`cloud`]),RK=Yb([`review-ready`,`agent-reply`]),zK=Yb([`ios`,`android`]),BK=K({name:G,custom:Bb,icon:Mb(LK)}),VK=K({environmentId:G,name:G,version:yG(G),protocol:zb.check(hx()).check(dx(0))}),HK=K({name:Xb(G.pipe($b(h_())).check(_x(1)).check(J(64)).check(ox(e=>!/\p{Cc}/u.test(e))))}),UK=BK,WK=K({icon:Xb(LK)}),GK=BK,KK=K({status:W(`ok`),environmentId:G}),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:fr(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 V(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})}),fr(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(V(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}),fr(a)}))},accessHandler(e){return mp(t=>{let n=this.requests.get(e),{handler:r,context:i}=br(t,n.key);return z((e,t)=>{t.rpc=n;let a=r(e,t),o=iM(a)?a.value:a;return Tf(o)?hp(o,i):gT(o,i)})})},annotate(e,t){return JK({requests:this.requests,annotations:_r(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(gr(e,t))},annotateMerge(e){return JK({requests:this.requests,annotations:Dr(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(Dr(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:hr()}),XK=`(?:[0-9a-f]{40}|[0-9a-f]{64})`,ZK=G.check(sx(RegExp(`^${XK}$`))),QK=G.check(sx(RegExp(`^${XK}(?:,${XK})*$`))),$K=Yb([`switch`,`fetch`,`pull`,`push`,`commit`,`amend`,`stash-create`,`stash-apply`,`stash-pop`,`discard`]),eq=K({requestId:G.check(cx()),projectId:G.check(cx()),worktreeId:vG,action:$K,state:Yb([`running`,`succeeded`,`no-change`,`rejected`,`conflicted`,`interrupted`]),reason:U(Yb([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`])),message:U(G),progress:q(G),result:U(K({headOid:U(ZK),trackingOid:U(ZK),sourceOid:U(ZK),destinationRef:U(G),stashOid:U(ZK),stashRetained:U(Bb),restoreStashOid:U(ZK),restoreIndex:U(Bb),branch:U(G)})),acceptedAt:gG,finishedAt:U(gG)}),tq=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;function nq(e,t){return e.length>0&&e.length<=t&&!e.includes(`\0`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)&&!tq.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e.toLowerCase()!==`.git`)}var rq=G.check(_x(1)).check(J(eG)).check(ox(e=>nq(e,eG),{expected:`Expected a normalized relative path`})),iq=K({projects:q(G.check(cx())).check(J(128)),worktrees:q(K({projectId:G.check(cx()),worktreeId:vG,paths:q(rq).check(J(64))})).check(J(32))}).annotate({parseOptions:{onExcessProperty:`error`}}),aq=YK(eM(`notices`,{success:Jb([K({type:W(`ready`)}),K({type:W(`subscribed`)}),K({type:W(`heartbeat`)}),K({type:W(`inventory`)}),K({type:W(`git-action`),projectId:G.check(cx()),worktreeId:vG,receipt:eq}),K({type:W(`project`),projectId:G.check(cx()),change:Yb([`files`,`preferences`])}),K({type:W(`worktree`),projectId:G.check(cx()),worktreeId:vG,change:Yb([`files`,`git`,`reviewed`,`comments`,`review`])})]),stream:!0}),eM(`follow`,{payload:iq})),oq=K({ticket:G,expiresAt:G}),sq=K({ticket:U(G)}),cq=Rb,lq=K({address:G,dataDirectory:G,pid:zb.check(hx()).check(dx(0))}),uq=K({token:G.check(_x(1)).check(J(256)),platform:zK,kinds:q(RK).check(J(2))}),dq=K({kinds:q(RK)}),fq=Rb,pq=Jb([K({kind:W(`off`)}),K({kind:W(`starting`)}),K({kind:W(`on`),urls:q(G)}),K({kind:W(`paused`)}),K({kind:W(`failed`),reason:Yb([`address-in-use`,`address-unavailable`,`unreachable`,`other-server`])})]),mq=K({interfaceName:G,subnet:G,gateway:G,gatewayHardware:U(G)}),hq=K({enabled:Bb,status:pq}),gq=G.check(sx(/^[a-f0-9]{64}$/)).pipe(yie(`WaysInFingerprint`)),_q=Yb([`lan`,`tailnet`,`cloudflare`]),vq=K({routes:K({lan:hq,tailnet:hq,cloudflare:hq}),lanNetwork:U(mq),localNetwork:U(mq),tailnetHostname:U(G),tailnetTarget:U(G),cloudflareHostname:U(G),serviceUrl:G,editing:K({fingerprint:gq,protectedRoute:U(_q)})}),yq=K({expected:gq,change:K({lan:U(Bb),tailnet:U(Bb),tailnetHostname:U(G.check(_x(1)).check(J(253))),cloudflare:U(Bb),cloudflareHostname:U(G.check(_x(1)).check(J(253)))}).check(ox(e=>Object.keys(e).length>0))}),bq=vq,xq=gx.check(dx(0)).check(px(2**53-1)),Sq=K({kind:W(`configured`),revision:xq,settings:IK}),Cq=Jb([K({kind:W(`unconfigured`)}),Sq]),wq=Jb([K({kind:W(`initialize`),settings:IK}),K({kind:W(`change`),change:IK.mapFields(cie(Mb)).check(Mie(1))})]),Tq=Sq,Eq=K({from:G,target:G,stage:Yb([`downloading`,`installing`,`restarting`,`updated`,`failed`]),reason:yG(G)}),Dq=K({managed:Bb,version:yG(G),latest:yG(G),available:Bb,running:Bb,last:yG(Eq),canUpdate:Bb}),Oq=K({version:G.check(_x(1)).check(J(128))}),kq=Dq,Aq=$(iK,`BadRequest`),jq=kG(`publicAccess`).add(LA(`readHealth`,`/health`,{disableCodecs:!0,success:KK,error:NK}),LA(`readEnvironment`,`/environment`,{disableCodecs:!0,success:VK,error:NK})),Mq=kG(`browserAccess`).add(VA(`clearBrowserSession`,`/session`,{disableCodecs:!0,success:tK.pipe(zk({decode:()=>void 0}),Lk(`NoContent`))})),Nq=kG(`pairing`).add(RA(`redeemPairing`,`/pair`,{disableCodecs:!0,payload:zG,success:BG,error:[Aq,$(oK,`Unauthorized`)]})).middleware(nK),Pq=kG(`session`).add(LA(`readSession`,`/session`,{disableCodecs:!0,success:AG}),RA(`issueLiveTicket`,`/live/tickets`,{disableCodecs:!0,success:oq,error:[$(_K,`Forbidden`),$(vK,`TooManyRequests`)]})).middleware(rK).middleware(nK),Fq=$(DK,`Forbidden`),Iq=kG(`pushRegistration`).add(zA(`setPushRegistration`,`/push-registration`,{disableCodecs:!0,payload:uq,success:dq,error:Fq}),VA(`clearPushRegistration`,`/push-registration`,{disableCodecs:!0,success:fq.pipe(zk({decode:()=>void 0}),Lk(`NoContent`)),error:Fq})).middleware(rK).middleware(nK),Lq=kG(`serviceUpdates`).add(LA(`readServiceUpdate`,`/service/update`,{disableCodecs:!0,success:Dq}),RA(`startServiceUpdate`,`/service/update`,{disableCodecs:!0,payload:Oq,success:kq.pipe(Lk(`Accepted`)),error:[$(bK,`Forbidden`),$(mK,`Conflict`),$(gK,`Conflict`),$(hK,`Conflict`)]})).middleware(rK).middleware(nK),Rq=kG(`reviewGitSettings`).add(LA(`readReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,success:Cq}),BA(`saveReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,payload:wq,success:Tq,error:[$(wK,`Forbidden`),$(TK,`Conflict`)]})).middleware(rK).middleware(nK),zq=$(EK,`Forbidden`),Bq=kG(`administration`).add(LA(`listAccess`,`/access`,{disableCodecs:!0,success:WG,error:zq}),RA(`issuePairing`,`/pairings`,{disableCodecs:!0,payload:GG,success:KG,error:[zq,NK,Aq,$(aK,`BadRequest`)]}),RA(`revokeAccess`,`/access/revoke`,{disableCodecs:!0,payload:qG,success:JG,error:zq}),RA(`setDeviceTrust`,`/access/trust`,{disableCodecs:!0,payload:YG,success:XG,error:[zq,$(yK,`NotFound`)]}),RA(`setManagementPermission`,`/access/management-permission`,{disableCodecs:!0,payload:$G,success:eK,error:[zq,$(yK,`NotFound`)]}),RA(`setWaysInPermission`,`/access/ways-in-permission`,{disableCodecs:!0,payload:ZG,success:QG,error:[zq,$(yK,`NotFound`)]})).middleware(rK).middleware(nK),Vq=$(xK,`Forbidden`),Hq=kG(`remoteAccess`).add(LA(`readRemoteAccess`,`/remote-access`,{disableCodecs:!0,success:vq,error:Vq}),BA(`setRemoteAccess`,`/remote-access`,{disableCodecs:!0,payload:yq,success:bq,error:[Vq,$(SK,`Conflict`),$(CK,`Conflict`),$(uK,`BadRequest`),$(cK,`BadRequest`),$(dK,`BadRequest`),$(lK,`BadRequest`),$(fK,`Conflict`),$(pK,`Conflict`)]})).middleware(rK).middleware(nK),Uq=kG(`environmentLabel`).add(zA(`renameEnvironment`,`/environment/name`,{disableCodecs:!0,payload:HK,success:UK})).add(zA(`setEnvironmentIcon`,`/environment/icon`,{disableCodecs:!0,payload:WK,success:GK})).middleware(rK),Wq=kG(`ownerStatus`).add(LA(`readOwnerStatus`,`/status`,{disableCodecs:!0,success:lq})).middleware(rK);FK.add(jq).prefix(`/api`),FK.add(Mq).prefix(`/api`);var Gq=class extends FK.add(Nq).prefix(`/api`){};FK.add(Pq).prefix(`/api`),FK.add(Iq).prefix(`/api`),FK.add(Lq).prefix(`/api`),FK.add(Hq).prefix(`/api`),FK.add(Rq).prefix(`/api`),FK.add(Bq).prefix(`/api`),FK.add(Uq).prefix(`/api`),FK.add(Bq,Hq,Wq);var Kq=class extends FK.add(jq,Mq,Nq,Pq,Iq,Lq,Hq,Rq,Bq,Uq).prefix(`/api`){},qq=class extends Y()(`InvalidLineRangeError`,{}){get message(){return`The line range ends before it starts`}},Jq=class extends Y()(`WorktreeChangedError`,{}){get message(){return`Worktree changed during inspection`}},Yq=class extends Y()(`WorktreeNotFoundError`,{}){get message(){return`Worktree not found`}},Xq=class extends Y()(`RepositoryUnavailableError`,{}){get message(){return`Repository could not be inspected`}},Zq=class extends Y()(`FilePreferenceLimitError`,{}){get message(){return`File preference limit reached`}},Qq=class extends Y()(`FolderNotFoundError`,{}){get message(){return`Path not found`}},$q=class extends Y()(`FolderNotReadableError`,{}){get message(){return`Path could not be read`}};Y()(`NoWorktreeAtPathError`,{});var eJ=class extends Y()(`ProjectNotFoundError`,{}){get message(){return`Project not found`}},tJ=class extends Y()(`UnsupportedFolderNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},nJ=class extends Y()(`WorktreeUnavailableError`,{}){get message(){return`Worktree is unavailable`}},rJ=[$(Jq,`Conflict`,{code:`worktree_changed`,message:`Refresh status and retry inspection`}),$(Yq,`NotFound`),$(eJ,`NotFound`),$(nJ,`UnprocessableEntity`,{message:`Repository could not be inspected`})];Y()(`GitActionRejectedError`,{reason:Yb([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`]),detail:U(G),cause:U(Lb)}),Y()(`RepositoryIdentityMismatchError`,{});var iJ=class extends Error{name=`GitError`},aJ=class extends iJ{name=`HistorySnapshotUnavailableError`;constructor(e){super(`History snapshot is unavailable`,e)}},oJ=class extends iJ{name=`HistoryWorktreeUnavailableError`;constructor(e){super(`Worktree is unavailable`,e)}},sJ=class extends iJ{name=`InvalidHistoryRequestError`;constructor(e){super(`Invalid history request`,e)}},cJ=class extends iJ{name=`ReadLimitExceededError`;constructor(e){super(`History read exceeds its limit`,e)}},lJ=class extends iJ{name=`UnsupportedHistoryDataError`;constructor(e){super(`History contains unsupported data`,e)}},uJ=class extends Y()(`GitTimeoutError`,{}){get message(){return`Git command exceeded its deadline`}},dJ=class extends iJ{name=`InspectionLimitError`;constructor(e){super(`Git inspection exceeds its limit`,e)}},fJ=class extends iJ{name=`InvalidGitDiffError`;constructor(){super(`Invalid Git diff output`)}},pJ=class extends iJ{name=`InvalidGitStatusError`;constructor(){super(`Invalid Git status output`)}},mJ=class extends iJ{name=`UnsupportedGitFiltersError`;constructor(){super(`Git conversion filters are unsupported for worktree inspection`)}},hJ=class extends iJ{name=`UnsupportedPathEncodingError`;constructor(e){super(`Git paths require valid UTF-8`,e)}};Y()(`GitCommandError`,{checkout:G,args:q(G),exitCode:Zb(zb),stderr:G,cause:U(Lb)}),Y()(`GitFilesystemError`,{cause:Lb}),Y()(`UnsupportedFilesystemIdentityError`,{}),Y()(`UnsupportedRepositoryError`,{});var gJ=[$(aJ,`UnprocessableEntity`,{message:`History snapshot is unavailable; start a new listing`}),$(oJ,`UnprocessableEntity`,{message:`Worktree is unavailable`}),$(sJ,`BadRequest`),$(cJ,`UnprocessableEntity`,{message:`History read exceeds its limit`}),$(lJ,`UnprocessableEntity`,{message:`History contains unsupported data`}),$(uJ,`ServiceUnavailable`,{message:`Operation unavailable`}),$(dJ,`PayloadTooLarge`,{message:`Git inspection exceeds its limit`}),$(fJ,`BadGateway`,{message:`Git produced output that could not be read`}),$(pJ,`BadGateway`,{message:`Git produced output that could not be read`}),$(mJ,`UnprocessableEntity`,{message:`Git conversion filters are unsupported for worktree inspection`}),$(hJ,`UnprocessableEntity`,{message:`Git paths require valid UTF-8`}),$(Xq,`UnprocessableEntity`,{message:`Repository could not be inspected`})],_J=class extends Y()(`ContentChangedError`,{}){get message(){return`Content changed; retry the operation`}},vJ=class extends Y()(`CrossDeviceMoveError`,{}){get message(){return`Destination is on another filesystem; nothing was moved`}},yJ=class extends Y()(`DiskFullError`,{}){get message(){return`There is not enough space on the disk`}},bJ=class extends Y()(`DirectoryTooLargeError`,{}){get message(){return`Directory exceeds the listing limit`}},xJ=class extends Y()(`EntryExistsError`,{}){get message(){return`An entry already exists at that path`}},SJ=class extends Y()(`FileTooLargeError`,{}){get message(){return`File exceeds the read limit`}},CJ=class extends Y()(`InvalidMoveError`,{}){get message(){return`An entry cannot be moved onto or into itself`}},wJ=class extends Y()(`PathNotFoundError`,{}){get message(){return`Path not found`}},TJ=class extends Y()(`PathNotReadableError`,{}){get message(){return`Path could not be read`}},EJ=class extends Y()(`TrashUnavailableError`,{}){get message(){return`This machine has no trash; nothing was deleted`}},DJ=class extends Y()(`UnsupportedAssetTypeError`,{}){get message(){return`File type cannot be previewed`}},OJ=class extends Y()(`UnsupportedEntryNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},kJ=class extends Y()(`UnsupportedTextError`,{}){get message(){return`File is not supported UTF-8 text`}},AJ=$(CJ,`BadRequest`,{message:`Invalid request`}),jJ=$(wJ,`NotFound`),MJ=$(_J,`Conflict`,{code:`content_changed`}),NJ=$(xJ,`Conflict`),PJ=$(TJ,`UnprocessableEntity`),FJ=$(OJ,`UnprocessableEntity`),IJ=$(bJ,`UnprocessableEntity`),LJ=$(vJ,`UnprocessableEntity`),RJ=$(EJ,`UnprocessableEntity`),zJ=$(DJ,`UnprocessableEntity`),BJ=$(kJ,`UnprocessableEntity`,{code:`unsupported_text`}),VJ=$(SJ,`UnprocessableEntity`,{code:`file_too_large`}),HJ=$(yJ,`UnprocessableEntity`),UJ=[...rJ,jJ,PJ,MJ],WJ=[...UJ,BJ,VJ],GJ=class extends Y()(`BranchBaseNotFoundError`,{}){get message(){return`Base branch not found`}},KJ=class extends Y()(`CommitNotFoundError`,{}){get message(){return`Commit not found`}},qJ=class extends Y()(`IncompleteDiffReadError`,{}){get message(){return`Diff read returned fewer results than requested`}},JJ=class extends Y()(`SelectionMismatchError`,{}){get message(){return`Selections must cover exactly the expected files`}},YJ=class extends Y()(`UnnamedDiffSelectionError`,{}){get message(){return`A diff selection names neither an old nor a new path`}},XJ=class extends Y()(`UnbornBranchError`,{}){get message(){return`The branch has no commits yet`}},ZJ=class extends Y()(`UnrelatedBranchError`,{}){get message(){return`The branch shares no history with its base`}},QJ=G.check(_x(1)).check(J(aG)).check(sx(/^refs\/(?:heads|remotes)\/\S+$/u)),$J=G.check(sx(/^[a-f0-9]{64}$/)),eY=Jb([K({kind:W(`text`),patch:G}),K({kind:W(`binary`)}),K({kind:W(`metadata-only`),patch:G}),K({kind:W(`omitted`),reason:Yb([`size-limit`,`unsupported-encoding`,`unsupported-submodule`])})]),tY=K({ref:G,oid:ZK}),nY=K({path:G,oldPath:yG(G),newPath:yG(G),status:Yb([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldOid:U(ZK),newOid:U(ZK),oldMode:G,newMode:G,fingerprint:$J}),rY=K({base:U(QJ)}),iY=K({worktreeId:vG,head:K({oid:ZK,branch:yG(G)}),base:yG(tY),mergeBaseOid:yG(ZK),commits:zb.check(hx()).check(fx(0)),files:q(nY).check(J(rG))}),aY=K({baseOid:ZK,headOid:ZK,paths:q(q(G).check(_x(1)).check(J(2))).check(_x(1)).check(J(200))}),oY=K({diffs:q(K({paths:q(G),content:eY}))}),sY=K({defaultRef:yG(G),bases:q(K({ref:G,name:G,remote:Bb})).check(J(500))}),cY=K({additions:gx,deletions:gx,binaryFiles:gx}),lY={DD:`both-deleted`,AU:`added-by-us`,UD:`deleted-by-them`,UA:`added-by-them`,DU:`deleted-by-us`,AA:`both-added`,UU:`both-modified`},uY={"both-deleted":`DD`,"added-by-us":`AU`,"deleted-by-them":`UD`,"added-by-them":`UA`,"deleted-by-us":`DU`,"both-added":`AA`,"both-modified":`UU`},dY=Yb([`DD`,`AU`,`UD`,`UA`,`DU`,`AA`,`UU`]),fY=Yb([`both-deleted`,`added-by-us`,`deleted-by-them`,`added-by-them`,`deleted-by-us`,`both-added`,`both-modified`]),pY=dY.pipe(Qb(fY,m_({decode:e=>lY[e],encode:e=>uY[e]}))),mY=K({scope:Yb([`staged`,`unstaged`]),oldPath:yG(rq),newPath:yG(rq)}),hY=Jb([K({scope:Yb([`staged`,`unstaged`]),kind:Yb([`added`,`modified`,`deleted`,`renamed`,`type-changed`]),oldPath:yG(rq),newPath:yG(rq),oldMode:G.check(sx(/^[0-7]{6}$/)),newMode:G.check(sx(/^[0-7]{6}$/)),oldOid:yG(ZK),newOid:yG(ZK),supported:Bb}),K({scope:W(`untracked`),path:rq}),K({scope:W(`unmerged`),path:rq,conflict:pY})]),gY=K({environmentId:G.check(cx()),worktreeId:vG,statusToken:$J,branch:U(K({name:yG(G),upstream:yG(G),ahead:zb.check(hx()).check(fx(0)),behind:zb.check(hx()).check(fx(0)),remoteName:yG(G),sourceRef:yG(G),upstreamOid:yG(ZK),stashes:q(K({oid:ZK,message:G})),discarded:q(K({oid:ZK,path:rq,kind:Yb([`hunk`,`rename`])})).check(J(50))})),consistency:W(`best-effort`),headOid:yG(ZK),inProgress:yG(Yb([`merge`,`rebase`])),mergeHeadOid:yG(ZK),headCommit:yG(K({subject:G,body:U(G)})),changes:q(hY).check(J(QW))}),_Y=K({environmentId:G.check(cx()),worktreeId:vG,...cY.fields,additions:cY.fields.additions.check(fx(0)),deletions:cY.fields.deletions.check(fx(0)),binaryFiles:cY.fields.binaryFiles.check(fx(0))}),vY=K({path:rq,fingerprint:yG($J),comparisons:q(hY).check(_x(1))}),yY=K({name:yG(G),upstream:yG(G),ahead:zb.check(hx()).check(fx(0)),behind:zb.check(hx()).check(fx(0))}),bY=K({environmentId:G.check(cx()),worktreeId:vG,statusToken:$J,headOid:yG(ZK),inProgress:yG(Yb([`merge`,`rebase`])),mergeHeadOid:yG(ZK),branch:yG(yY),interrupted:U(K({requestId:G.check(cx()),action:$K})),changes:q(vY).check(J(QW))}),xY=K({expectedStatusToken:$J,expectedFiles:q(K({path:rq,fingerprint:yG($J)})).check(_x(1)).check(J(200)),selections:q(mY).check(_x(1)).check(J(200))}),SY=K({environmentId:G.check(cx()),worktreeId:vG,statusToken:$J,diffs:q(K({selection:mY,content:eY}))}),CY=K({path:rq,from:Ex.check(hx()).check(fx(1)),to:Ex.check(hx()).check(fx(1)),at:Yb([`head`,`worktree`])}),wY=K({environmentId:G.check(cx()),worktreeId:vG,at:Yb([`head`,`worktree`]),path:rq,from:zb.check(hx()).check(fx(0)),to:zb.check(hx()).check(fx(0)),lines:q(G)}),TY=QK,EY=q(ZK),DY=TY.pipe(Qb(EY,m_({decode:e=>e.split(`,`),encode:e=>e.join(`,`)}))),OY=K({limit:U(Ex.check(hx()).check(fx(1)).check(px(100))),after:U(DY),tip:U(ZK)}),kY=Jb([K({kind:W(`attached`),ref:G}),K({kind:W(`detached`)}),K({kind:W(`unborn`),ref:G})]),AY=Jb([K({kind:Yb([`local-branch`,`remote-branch`,`tag`]),name:G}),K({kind:W(`head`),name:W(`HEAD`)})]),jY=K({oid:ZK,parentOids:q(ZK),author:K({name:G,timestamp:G}),subject:G,subjectTruncated:Bb,body:yG(G),bodyTruncated:Bb,refs:q(AY)}),MY=K({snapshot:yG(K({tipOid:yG(ZK),head:kY})),commits:q(jY).check(J(100)),nextAfter:yG(q(ZK).check(J(100))),tip:yG(ZK),boundary:yG(Yb([`shallow`,`wide`])),restarted:Bb}),NY=K({tip:ZK,offset:gx.check(fx(1)).check(px(2**53-1-100-1))}),PY=K({path:rq,after:U(Tx(NY)),limit:U(Ex.check(hx()).check(fx(1)).check(px(100)))}),FY=K({commits:q(K({commit:jY,path:G,previousPath:yG(G),status:Yb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})).check(J(100)),nextAfter:yG(NY),tip:yG(ZK),boundary:yG(W(`shallow`)),restarted:Bb}),IY=Jb([K({kind:W(`parent`),parentNumber:zb.check(hx()).check(dx(0)),baseOid:ZK}),K({kind:W(`empty-tree`)})]),LY=K({oldPath:yG(G),newPath:yG(G),status:Yb([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldMode:G,newMode:G}),RY=K({worktreeId:vG,oid:ZK}),zY=K({parent:U(Ex.check(hx()).check(fx(1)).check(px(nG)))}),BY=K({commit:jY,comparison:IY,files:q(LY).check(J(rG))}),VY=K({worktreeId:vG,oid:ZK}),HY=K({parent:U(zb.check(hx()).check(fx(1)).check(px(nG))),paths:q(q(G).check(_x(1)).check(J(2))).check(_x(1)).check(J(200))}),UY=K({commitOid:ZK,diffs:q(K({paths:q(G),content:eY}))}),WY=class extends FK.add(kG(`changes`).add(LA(`readWorktreeSummary`,`/api/worktrees/:worktreeId/summary`,{disableCodecs:!0,params:bG,success:_Y,error:[NK,...rJ,...gJ]}),LA(`listBranchBases`,`/api/worktrees/:worktreeId/branch-bases`,{disableCodecs:!0,params:bG,success:sY,error:[...rJ,...gJ]}),LA(`listCommits`,`/api/worktrees/:worktreeId/commits`,{disableCodecs:!0,params:bG,query:OY.fields,success:MY,error:[...rJ,...gJ]}),LA(`listFileCommits`,`/api/worktrees/:worktreeId/file-commits`,{disableCodecs:!0,params:bG,query:PY.fields,success:FY,error:[...rJ,...gJ]}),LA(`readBranchChanges`,`/api/worktrees/:worktreeId/branch-changes`,{disableCodecs:!0,params:bG,query:rY.fields,success:iY,error:[...rJ,...gJ,$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),RA(`readBranchDiffs`,`/api/worktrees/:worktreeId/branch-changes/diffs`,{disableCodecs:!0,params:bG,payload:aY,success:oY,error:[...rJ,...gJ,$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),RA(`readChangeDiffs`,`/api/worktrees/:worktreeId/changes/diffs`,{disableCodecs:!0,params:bG,payload:xY,success:SY,error:[NK,...rJ,...gJ,$(JJ,`BadRequest`,{message:`Invalid request`}),$(YJ,`BadRequest`,{message:`Invalid request`}),$(qJ,`UnprocessableEntity`)]}),LA(`readChangeLines`,`/api/worktrees/:worktreeId/changes/lines`,{disableCodecs:!0,params:bG,query:CY.fields,success:wY,error:[NK,...WJ,$(qq,`BadRequest`,{message:`Invalid request`})]}),LA(`readChanges`,`/api/worktrees/:worktreeId/changes`,{disableCodecs:!0,params:bG,success:bY,error:[NK,...rJ,...gJ]}),RA(`readCommitDiffs`,`/api/worktrees/:worktreeId/commits/:oid/diffs`,{disableCodecs:!0,params:VY,payload:HY,success:UY,error:[...rJ,...gJ,$(KJ,`NotFound`)]}),LA(`readCommitFiles`,`/api/worktrees/:worktreeId/commits/:oid/files`,{disableCodecs:!0,params:RY,query:zY.fields,success:BY,error:[...rJ,...gJ,$(KJ,`NotFound`)]}),LA(`readGitStatus`,`/api/worktrees/:worktreeId/git/status`,{disableCodecs:!0,params:bG,success:gY,error:[NK,...rJ,...gJ]})).middleware(rK)){};function GY(e){return new TextEncoder().encode(e).byteLength}var KY=Jb([W(``),rq]),qY=G.check(ox(e=>e.length<=1048576&&!e.includes(`\0`)&&GY(e)<=1048576,{expected:`UTF-8 text without NUL within the write limit`})),JY=K({path:KY}),YY=Sb(K({worktreeId:vG,path:G,entries:q(K({name:G,kind:Yb([`file`,`directory`,`symlink`,`submodule`,`other`]),ignored:U(Bb),target:U(G)}))})),XY=Sb(K({worktreeId:vG,paths:q(G).check(J(oG))})),ZY=K({path:rq}),QY=Sb(K({worktreeId:vG,path:G,encoding:W(`utf-8`),byteLength:gx.check(fx(0)),text:G,contentFingerprint:U($J)})),$Y=Jb([K({kind:W(`write`),path:rq,text:qY,expectedFingerprint:$J}),K({kind:W(`create`),path:rq,entryKind:Yb([`file`,`directory`])}),K({kind:W(`move`),path:rq,destination:rq}),K({kind:W(`trash`),path:rq}),K({kind:W(`copy`),path:rq,destination:rq})]),eX=Sb(K({path:G,contentFingerprint:U($J)})),tX=K({path:rq}),nX=Sb(K({path:G,mediaType:G,base64:G})),rX=K({document:rq,paths:q(G.check(J(eG))).check(_x(1),J(64))}),iX=Sb(K({assets:q(Jb([K({kind:W(`asset`),path:G,mediaType:G,base64:G}),K({kind:W(`unavailable`),path:G})]))})),aX=class extends FK.add(kG(`files`).add(LA(`listDirectory`,`/api/worktrees/:worktreeId/directory`,{disableCodecs:!0,params:bG,query:JY.fields,success:YY,error:[...UJ,FJ,IJ]}),LA(`listWorktreePaths`,`/api/worktrees/:worktreeId/paths`,{disableCodecs:!0,params:bG,success:XY,error:[...rJ,IJ]}),LA(`readTextFile`,`/api/worktrees/:worktreeId/text`,{disableCodecs:!0,params:bG,query:ZY.fields,success:QY,error:[...UJ,BJ,VJ]}),LA(`readFileAsset`,`/api/worktrees/:worktreeId/asset`,{disableCodecs:!0,params:bG,query:tX.fields,success:nX,error:[...UJ,zJ,VJ]}),RA(`readPreviewAssets`,`/api/worktrees/:worktreeId/preview-assets`,{disableCodecs:!0,params:bG,payload:rX,success:iX,error:rJ}),RA(`editFile`,`/api/worktrees/:worktreeId/files`,{disableCodecs:!0,params:bG,payload:$Y,success:eX,error:[...UJ,BJ,NJ,LJ,RJ,VJ,HJ,AJ]})).middleware(rK)){},oX=class extends Y()(`CommitDraftSelectionError`,{}){get message(){return`Select readable changed files to generate a commit draft.`}},sX=class extends Y()(`CommitDraftTooLargeError`,{}){get message(){return`Select fewer files to generate a commit draft.`}},cX=class extends Y()(`CommitGenerationFailedError`,{}){get message(){return`Commit generation failed.`}},lX=class extends Y()(`CommitGroupsMismatchError`,{}){get message(){return`The generated draft did not cover the selected files. Generate again or write the message manually.`}},uX=class extends Y()(`CommitToolFailedError`,{}){get message(){return`Commit generation failed. Check that the selected CLI is up to date and signed in.`}},dX=class extends Y()(`CommitToolMissingError`,{}){get message(){return`The selected coding CLI is not installed.`}},fX=class extends Y()(`DiscardExpectationMismatchError`,{}){get message(){return`A discard expects exactly the discarded path`}},pX=class extends Y()(`DuplicateExpectedFileError`,{}){get message(){return`Each expected file may appear only once`}},mX=class extends Y()(`EmptyCommitSelectionError`,{}){get message(){return`Select at least one path to commit`}},hX=class extends Y()(`ExpectedFilesMismatchError`,{}){get message(){return`The expected files do not match the selected paths`}},gX=class extends Y()(`GitActionNotFoundError`,{}){get message(){return`Git action receipt not found`}},_X=class extends Y()(`GitActionReceiptMismatchError`,{}){get message(){return`Git action receipt does not match this request`}},vX=class extends Y()(`InvalidHunkRangeError`,{}){get message(){return`The hunk ends before it starts`}},yX=class extends Y()(`MergeExpectationMismatchError`,{}){get message(){return`A merge in progress and its merge head must be expected together`}},bX=class extends Y()(`MissingExpectedFilesError`,{}){get message(){return`This action needs the files the client expects`}},xX=class extends Y()(`MissingUpstreamExpectationError`,{}){get message(){return`This action needs the upstream the client expects`}},SX=class extends Y()(`UnsupportedCommitModelError`,{}){get message(){return`Unsupported commit model.`}},CX=class extends Y()(`WorktreeCleanupRefusedError`,{message:G}){},wX=q(K({id:G,label:G})),TX=K({mode:Yb([`message`,`groups`]),model:G.check(_x(1)).check(J(160)),expectedStatusToken:$J,paths:q(rq).check(_x(1)).check(J(QW))}),EX=K({groups:q(K({message:G.check(_x(1)).check(J(ZW)),paths:q(rq).check(_x(1)).check(J(QW))})).check(_x(1)).check(J(20)),expectedFiles:q(K({path:rq,fingerprint:$J})).check(J(QW))}),DX=G.check(_x(1)).check(J(ZW)).check(ox(e=>e.trim().length>0&&!e.includes(`\0`)&&GY(e)<=16384)),OX=G.check(J(aG)).check(sx(/^refs\/heads\/[\s\S]/u)).check(ox(e=>!e.includes(`\0`))),kX=G.check(sx(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/)),AX=K({path:rq,fingerprint:$J}),jX=K({worktreeId:vG,requestId:G.check(cx())}),MX=Jb([K({action:W(`switch`),targetRef:OX}),K({action:W(`fetch`),remoteName:kX,sourceRef:OX}),K({action:W(`pull`),remoteName:kX,sourceRef:OX,strategy:U(Yb([`ff-only`,`merge`,`rebase`]))}),K({action:W(`push`),remoteName:kX,destinationRef:OX,allowCreate:Bb}),K({action:W(`commit`),message:DX,paths:q(rq).check(J(QW))}),K({action:W(`amend`),message:DX,paths:q(rq).check(J(QW))}),K({action:W(`stash-create`),message:DX,includeUntracked:Bb}),K({action:Yb([`stash-apply`,`stash-pop`]),stashOid:ZK,restoreIndex:Bb.pipe(nx(z(!1)))}),K({action:W(`discard`),path:rq,hunk:U(K({scope:Yb([`staged`,`unstaged`]),startLine:zb.check(hx()).check(dx(0)),endLine:zb.check(hx()).check(dx(0))}))})]),NX=K({headOid:yG(ZK),branch:yG(G),inProgress:yG(Yb([`merge`,`rebase`])),mergeHeadOid:yG(ZK),upstreamOid:U(Xb(ZK)),files:U(q(AX).check(J(QW)))}),PX=K({requestId:G.check(cx()),input:MX,expected:NX}),FX=eq,IX=Jb([eq,mG]),LX=jX,RX=eq,zX=jX,BX=K({dismissed:W(!0)}),VX=$(_X,`Conflict`,{message:`Git action request does not match its receipt`}),HX=$(gX,`NotFound`),UX=[$(vX,`BadRequest`,{message:`Invalid request`}),$(pX,`BadRequest`,{message:`Invalid request`}),$(yX,`BadRequest`,{message:`Invalid request`}),$(mX,`BadRequest`,{message:`Invalid request`}),$(hX,`BadRequest`,{message:`Invalid request`}),$(fX,`BadRequest`,{message:`Invalid request`}),$(bX,`BadRequest`,{message:`Invalid request`}),$(xX,`BadRequest`,{message:`Invalid request`})],WX=[$(oX,`UnprocessableEntity`),$(sX,`UnprocessableEntity`),$(cX,`UnprocessableEntity`),$(lX,`UnprocessableEntity`),$(uX,`UnprocessableEntity`),$(dX,`UnprocessableEntity`),$(SX,`UnprocessableEntity`)],GX=class extends FK.add(kG(`gitActions`).add(VA(`dismissInterruptedGitAction`,`/api/worktrees/:worktreeId/git/interrupted/:requestId`,{disableCodecs:!0,params:zX,success:BX,error:[...rJ,HX,VX]}),RA(`generateCommitDraft`,`/api/worktrees/:worktreeId/git/commit-draft`,{disableCodecs:!0,params:bG,payload:TX,success:EX,error:[...rJ,...gJ,...WX]}),LA(`listCommitModels`,`/api/git/commit-models`,{disableCodecs:!0,success:wX}),LA(`readGitActionReceipt`,`/api/worktrees/:worktreeId/git/receipts/:requestId`,{disableCodecs:!0,params:LX,success:RX,error:[...rJ,HX]}),RA(`runGitAction`,`/api/worktrees/:worktreeId/git/actions`,{disableCodecs:!0,params:bG,payload:PX,success:[FX,FX.pipe(Lk(202)),IX.pipe(Lk(409)),IX.pipe(Lk(503))],error:[...rJ,VX,...UX]})).middleware(rK)){};K({address:G,dataDirectory:G,pid:gx}),K({path:Nb(G),fingerprint:Nb(Jb([G,Rb]))});var KX=K({deleteWorktree:Bb,deleteLocalBranch:Bb,deleteRemoteBranch:Bb}),qX=K({worktreePath:U(G),detachWorktreePath:U(G),localBranch:U(G),remoteBranch:U(G),remoteBranchNote:U(G),mainCheckout:Bb,dirty:Bb,unpushed:Bb,fingerprint:G}),JX=K({options:KX,confirmation:U(K({plan:qX,discardChanges:Bb}))}),YX=JX,XX=K({deleted:Bb,plan:qX}),ZX=G.check(ox(e=>nq(e,eG),{expected:`a normalized relative path`})),QX=Sb(K({preferences:q(K({path:ZX,pinned:Bb,hidden:Bb}))})),$X=K({path:ZX,flag:Yb([`pinned`,`hidden`]),value:Bb}),eZ=QX,tZ=Yb([`moved`,`missing`,`permission`,`git-failed`]),nZ=G.check(_x(1),J(eG),ox(e=>e.startsWith(`/`)&&!e.includes(`\0`),{expected:`an absolute path without NUL`})),rZ={id:_G,name:G,worktrees:q(K({id:vG,path:G,main:Bb,branch:yG(G),headCommittedAt:Mb(gG),available:Bb,status:yG(Yb([`pending`,`reviewed`,`replied`]))}))},iZ=Jb([K({...rZ,available:W(!0),unavailableReason:Mb(Ib)}),K({...rZ,available:W(!1),unavailableReason:Mb(tZ)})]),aZ=K({projectId:_G}),oZ=aZ,sZ=aZ,cZ=aZ,lZ=Sb(K({environmentId:_G,environment:BK,projects:q(iZ)})),uZ=K({path:nZ}),dZ=Sb(iZ),fZ=K({deleted:Bb}),pZ=K({path:Mb(nZ)}),mZ=Sb(K({path:G,parent:yG(G),directories:q(K({name:G,path:G})),repository:Bb,truncated:Bb})),hZ=Sb(K({name:G.pipe(Qb(G.check(_x(1),J(100),ox(e=>!/[\p{Cc}\p{Cf}]/u.test(e),{expected:`a name without control characters`})),m_({decode:e=>e.trim(),encode:e=>e})))}),{parseOptions:PK}),gZ=K({id:_G,name:G}),_Z=$(eJ,`NotFound`),vZ=class extends FK.add(kG(`projects`).add(RA(`deleteWorktree`,`/api/worktrees/:worktreeId/delete`,{disableCodecs:!0,params:bG,payload:YX,success:XX,error:[...rJ,$(CX,`Conflict`,{message:{fromError:!0}})]}),LA(`browseProjectFolders`,`/api/projects/folders`,{disableCodecs:!0,query:pZ.fields,success:mZ,error:[$(Qq,`NotFound`),$($q,`UnprocessableEntity`),$(tJ,`UnprocessableEntity`)]}),LA(`readInventory`,`/api/inventory`,{disableCodecs:!0,success:lZ,error:NK}),RA(`refreshInventory`,`/api/inventory/refresh`,{disableCodecs:!0,success:lZ,error:NK}),LA(`listFilePreferences`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:sZ,success:QX,error:_Z}),RA(`registerProject`,`/api/projects`,{disableCodecs:!0,payload:uZ,success:dZ,error:[_Z,$(Xq,`UnprocessableEntity`,{message:`Repository could not be inspected`})]}),VA(`removeProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:oZ,success:fZ,error:_Z}),BA(`renameProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:aZ,payload:hZ,success:gZ,error:_Z}),zA(`setFilePreference`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:cZ,payload:$X,success:eZ,error:[_Z,$(Zq,`Conflict`,{message:`File preference limit reached`})]})).middleware(rK)){},yZ=class extends Y()(`UnknownBoxLayerError`,{}){get message(){return`A diagram box names a layer the review does not have`}},bZ=class extends Y()(`CommentAuthorMismatchError`,{}){get message(){return`Only the author of a comment may change it`}},xZ=class extends Y()(`CommentIdentityConflictError`,{}){get message(){return`Comment ID belongs to a different write`}},SZ=class extends Y()(`CommentLimitExceededError`,{}){get message(){return`Comment capacity exceeded`}},CZ=class extends Y()(`CommentRevisionMismatchError`,{}){get message(){return`The comparison must identify the revision it belongs to`}},wZ=class extends Y()(`CommentTargetNotFoundError`,{}){get message(){return`Comment target not found`}},TZ=class extends Y()(`DuplicateLayerIdError`,{}){get message(){return`Layer IDs repeat within the review`}},EZ=class extends Y()(`DuplicateStepIdError`,{}){get message(){return`Step IDs repeat within a layer`}},DZ=class extends Y()(`ReviewConflictError`,{}){get message(){return`The review changed; reload before retrying`}},OZ=class extends Y()(`ReviewLayerNotFoundError`,{}){get message(){return`Review layer not found`}},kZ=class extends Y()(`ReviewSummaryNotFoundError`,{}){get message(){return`Review summary not found`}},AZ=class extends Y()(`ReviewedMarkConflictError`,{}){get message(){return`The reviewed mark is based on a version that has changed`}},jZ=class extends Y()(`StepLaneOutOfRangeError`,{}){get message(){return`A step names a lane its layer does not have`}},MZ=class extends Y()(`UnsupportedCommentComparisonError`,{}){get message(){return`A comment on the whole change compares only against a branch`}},NZ=class extends Y()(`UnknownArrowBoxError`,{}){get message(){return`A diagram arrow joins a box its diagram does not have`}},PZ=class extends Y()(`InvalidDecisionBoxError`,{}){get message(){return`A decision box must name a layer and be the only decision box for that layer`}},FZ=class extends Y()(`ProofFileNotFoundError`,{}){get message(){return`Proof file not found`}},IZ=class extends Y()(`ProofFileUnreadableError`,{}){get message(){return`A proof file is missing from the worktree or is not a readable file`}},LZ=class extends Y()(`ProofTooLargeError`,{}){get message(){return`A proof file, or the proof files together, are over their size limit`}},RZ=class extends Y()(`UnknownProofTargetError`,{}){get message(){return`A check or asset names a layer or step the review does not have; a step also needs its layer`}},zZ=class extends Y()(`UnsupportedProofFileError`,{}){get message(){return`A proof file is not the kind it names: an image must be PNG, JPEG, GIF or WebP and a video MP4 or WebM`}},BZ=class extends Y()(`UnknownProofFileError`,{}){get message(){return`A proofId names no image or video of the current review`}},VZ=class extends Y()(`InvalidReviewPointerError`,{layerId:G,stepId:G,path:G,startLine:zb,endLine:zb,reason:Yb([`missing`,`unreadable`,`out-of-range`]),lineCount:Mb(zb)}){get message(){let e=`Step \`${this.stepId}\` in layer \`${this.layerId}\` points to \`${this.path}:${this.startLine}-${this.endLine}\``;switch(this.reason){case`missing`:return`${e}, which does not exist in this worktree`;case`unreadable`:return`${e}, which is not a readable text file`;case`out-of-range`:return`${e}, but the file has ${this.lineCount} lines`;default:return this.reason}}},HZ=class extends Y()(`ReviewPublishRefusedError`,{message:G}){},UZ=class extends Y()(`ReviewNotFoundError`,{}){get message(){return`Review or revision not found`}},WZ=class extends Y()(`InvalidReviewComparisonError`,{}){get message(){return`The from revision must not be newer than the to revision`}},GZ=Yb([`gh-not-installed`,`no-accounts`,`no-access`,`not-github`,`rate-limited`,`offline`,`invalid-response`,`pull-request-not-found`]),KZ=K({kind:W(`unavailable`),reason:GZ}),qZ=K({account:G,source:Yb([`detected`,`overridden`])}),JZ=K({repository:U(G),accounts:q(G),choice:U(qZ),override:U(G),unavailable:U(KZ)}),YZ=Xb(K({login:G,avatarUrl:U(G)})),XZ=K({hasNextPage:Bb}),ZZ=Jb([K({__typename:W(`CheckRun`),name:G,status:G,conclusion:Xb(G),detailsUrl:Xb(G),startedAt:U(Xb(G)),completedAt:U(Xb(G))}),K({__typename:W(`StatusContext`),context:G,state:G,targetUrl:Xb(G)})]),QZ=K({number:gx,title:G,url:G,state:Yb([`OPEN`,`CLOSED`,`MERGED`]),isDraft:Bb,author:YZ,headRefName:G,updatedAt:G,commits:K({nodes:q(K({commit:K({statusCheckRollup:Xb(K({state:G}))})}))})}),$Z=K({id:G,author:YZ,createdAt:G,body:G,url:G});K({...QZ.fields,commits:K({nodes:q(K({commit:K({statusCheckRollup:Xb(K({state:G,contexts:K({nodes:q(ZZ),pageInfo:XZ})}))})}))}),body:G,bodyHTML:U(G),createdAt:U(G),baseRefName:G,headRefOid:G,mergeable:G,labels:K({nodes:q(K({name:G,color:G})),pageInfo:XZ}),comments:K({nodes:q($Z),pageInfo:XZ}),reviews:K({nodes:q(K({id:G,author:YZ,submittedAt:Xb(G),createdAt:U(G),body:G,url:G,state:G,comments:K({nodes:q(K({...$Z.fields,path:G,diffHunk:U(G),line:Xb(gx),originalLine:Xb(gx)})),pageInfo:XZ})})),pageInfo:XZ})});var eQ=K({name:G,status:G,conclusion:U(G),detailsUrl:U(G),durationMs:U(gx)}),tQ=K({number:gx,title:G,url:G,state:Yb([`open`,`closed`,`merged`]),draft:Bb,author:U(G),headBranch:G,updatedAt:G,checksSummary:U(G),checksTruncated:Bb}),nQ=K({id:G,kind:Yb([`comment`,`review`,`review-comment`]),author:U(G),time:G,body:G,url:G,reviewState:U(G),authorAvatarUrl:U(G),reviewId:U(G),diffHunk:U(G),path:U(G),line:U(gx),originalLine:U(gx)}),rQ=K({...tQ.fields,description:G,createdAt:U(G),authorAvatarUrl:U(G),baseBranch:G,headSha:G,matchesReviewHead:Bb,mergeable:G,labels:q(K({name:G,color:G})),checks:q(eQ),timeline:q(nQ),truncated:Bb});K({number:gx,commits:K({nodes:q(K({commit:K({statusCheckRollup:Xb(K({state:Yb([`SUCCESS`,`PENDING`,`EXPECTED`,`FAILURE`,`ERROR`])}))})}))})});var iQ=Yb([`passed`,`running`,`failed`,`none`]);Y()(`GitHubReadError`,{reason:GZ}),Y()(`GitHubPullRequestNotFoundError`,{});var aQ=class extends Y()(`ReviewArchiveRefusedError`,{message:G}){},oQ=class extends Y()(`ReviewPullRequestRefusedError`,{message:G}){},sQ=class extends Y()(`AgentFeedbackConflictError`,{detail:U(Yb([`command-missing`,`deadline`,`command-failed`,`protocol`,`archived`,`pending-input`])),reviewId:G,reason:Yb([`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 this.detail?{"command-missing":`The T3 command is not available to the Porcelain server. Add it to the server’s PATH.`,deadline:`T3 did not answer before the command deadline. The review and comments are saved.`,"command-failed":`The T3 command failed. Check that T3 is running on this machine.`,protocol:`T3 returned an unsupported response. Update the T3 command to match its server.`,archived:`This T3 thread is archived. Reopen it before connecting.`,"pending-input":`This T3 thread is waiting for an answer. Answer it before sending feedback.`}[this.detail]:`The associated T3 session is unavailable on this machine`;case`recipient-mismatch`:return`The associated T3 session belongs to a different worktree`}}},cQ=K({path:Nb(G),startLine:Nb(zb),endLine:Nb(zb),symbol:Nb(U(Jb([G,Rb])))}),lQ=K({id:Nb(G),lane:Nb(zb),title:Nb(G),text:Nb(G),kind:Nb(Jb([W(`changed`),W(`context`)])),pointer:Nb(cQ)}),uQ=K({alternatives:U(q(K({label:G,whyNot:G}))),id:Nb(G),title:Nb(G),summary:Nb(G),lanes:Nb(q(G)),steps:Nb(q(lQ))}),dQ=K({...lQ.fields,published:Nb(q(G))});K({...sie(uQ.fields,[`steps`]),steps:Nb(q(dQ)),fingerprint:Nb(G)});var fQ=Yb([`merge`,`hold`]),pQ=K({what:G,why:G}),mQ=K({behavior:G,why:G,paths:q(G)}),hQ=K({url:G,accounts:q(K({label:G,signIn:G})),steps:q(G)}),gQ=q(K({asked:G,built:G,left:U(K({what:G,owner:U(Jb([K({kind:W(`ticket`),name:G}),K({kind:W(`teammate`),name:G,message:U(G)})]))}))}));K({tryIt:U(hQ),coverage:U(gQ),asked:K({text:G,links:U(q(K({title:G,url:G})))}),recommendation:fQ,reasons:q(G),notProven:q(pQ),removed:q(mQ)}),K({timing:U(Yb([`decision`,`record`])),reviewId:G,projectId:G,commonDirectory:G,branch:G,pullRequest:U(G),state:Yb([`open`,`closed`]),archived:U(Bb),latestRevision:gx,lastSeenRevision:gx}),K({path:G,oldPath:U(G),newPath:U(G),oldOid:U(G),newOid:U(G),oldMode:G,newMode:G,status:Yb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])}),K({path:G,ranges:q(K({startLine:zb,endLine:zb})),deleted:U(Bb),binary:U(Bb)});var _Q=K({options:U(q(K({id:G,label:G,consequence:G}))),id:Nb(G),label:Nb(G),detail:Nb(U(Jb([G,Rb]))),change:Nb(U(Jb([W(`new`),W(`changed`),W(`removed`),Rb]))),problem:Nb(U(Jb([G,Rb]))),layerId:Nb(U(Jb([G,Rb]))),decision:Nb(U(W(!0)))}),vQ=K({from:Nb(G),to:Nb(G),label:Nb(U(Jb([G,Rb])))});K({after:Nb(K({boxes:Nb(q(_Q)),arrows:Nb(q(vQ))}))});var yQ=K({optionId:U(G),layerId:Nb(U(Jb([G,Rb]))),stepId:Nb(U(Jb([G,Rb])))}),bQ=K({...yQ.fields,name:Nb(G),result:Nb(Jb([W(`pass`),W(`fail`)])),output:Nb(U(Jb([G,Rb])))}),xQ=Jb([W(`image`),W(`video`)]),SQ=Jb([W(`image/png`),W(`image/jpeg`),W(`image/gif`),W(`image/webp`),W(`video/mp4`),W(`video/webm`)]),CQ=Jb([K({...yQ.fields,id:Nb(G),kind:Nb(xQ),title:Nb(G),mediaType:Nb(SQ),byteLength:Nb(zb)}),K({...K({...yQ.fields,kind:Nb(W(`link`)),title:Nb(G),url:Nb(G)}).fields,id:Nb(G)})]);K({paths:U(q(G)),checks:Nb(q(bQ)),assets:Nb(q(CQ))});var wQ=Jb([K({kind:Nb(W(`worktree`)),scope:Nb(Jb([W(`staged`),W(`unstaged`),W(`untracked`)]))}),K({kind:Nb(W(`file`))}),K({kind:Nb(W(`commit`)),parent:Nb(zb)}),K({kind:Nb(W(`branch`)),base:Nb(G)})]);Jb([K({comparison:Nb(U(Jb([wQ,Rb]))),revision:Nb(U(Jb([G,Rb]))),contentFingerprint:Nb(U(Jb([G,Rb]))),kind:Nb(W(`change`)),reviewTarget:U(K({kind:Yb([`decision`,`question`]),id:G}))}),K({comparison:Nb(U(Jb([wQ,Rb]))),revision:Nb(U(Jb([G,Rb]))),contentFingerprint:Nb(U(Jb([G,Rb]))),kind:Nb(W(`file`)),filePath:Nb(G)}),K({comparison:Nb(U(Jb([wQ,Rb]))),revision:Nb(U(Jb([G,Rb]))),contentFingerprint:Nb(U(Jb([G,Rb]))),kind:Nb(W(`codeRange`)),filePath:Nb(G),startLine:Nb(zb),endLine:Nb(zb),side:Nb(U(Jb([W(`additions`),W(`deletions`),Rb])))})]),Jb([W(`reviewer`),W(`agent`)]);var TQ=q(G),EQ=K({path:G,headBlobOid:G}),DQ=K({layerId:G,fingerprint:G}),OQ=K({area:Yb([`baseline`,`file-marks`,`conversation`,`proof`]),reason:G,ids:TQ}),kQ=K({files:q(Jb([K({path:G,change:Yb([`entered`,`left`])}),K({path:G,change:Yb([`changed`,`unchanged`]),headChanged:Bb,baseChanged:Bb})])),decisions:K({affected:TQ,new:TQ,gone:TQ,resetMarks:q(DQ)}),fileMarks:K({carriedCount:gx,carried:q(EQ),reset:q(EQ)}),verdict:K({recommendation:K({from:fQ,to:fQ}),removed:K({added:q(mQ),dropped:q(mQ)}),deletedFiles:K({added:TQ,dropped:TQ}),notProven:K({added:q(pQ),dropped:q(pQ)})}),conversation:K({agentMessageCount:gx,agentThreadIds:TQ,agentMessages:q(K({threadId:G,messageId:G,body:G,createdAt:G})),resolvedThreadCount:gx,resolvedThreadIds:TQ}),proof:K({publishedChecks:q(bQ),changedResults:q(K({from:bQ,to:bQ}))}),unknown:q(OQ)}),AQ=JX,jQ=K({archived:Bb,plan:qX}),MQ=K({kind:W(`t3`),threadId:G}),NQ=K({id:G,reviewId:G,reviewRevision:gx,commentRevision:gx,state:Yb([`pending`,`delivered`,`acknowledged`]),attempted:Bb,error:U(G)}),PQ=K({session:U(MQ),delivery:U(NQ)}),FQ=G.check(cx()),IQ=G.pipe($b(h_())).check(_x(1)).check(J(200)),LQ={optionId:U(FQ),layerId:U(FQ),stepId:U(FQ)},RQ=Yb([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/webm`]),zQ=K({name:IQ,result:Yb([`pass`,`fail`]),output:U(G.check(_x(1)).check(J(dG))),...LQ}),BQ=hG.check(ox(e=>{let t=Tb(wx)(e);return Lr(t)&&/^https?:$/.test(t.success.protocol)})).check(J(fG)),VQ=e=>K({kind:W(e),title:IQ,path:U(rq),proofId:U(FQ),...LQ}).check(ox(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`})),HQ=Jb([VQ(`image`),VQ(`video`),K({kind:W(`link`),title:IQ,url:BQ,...LQ})]),UQ=K({checks:U(q(zQ).check(J(100))),assets:U(q(HQ).check(J(20)))}),WQ=Jb([K({id:FQ,kind:Yb([`image`,`video`]),title:IQ,mediaType:RQ,byteLength:zb.check(hx()).check(dx(0)),...LQ}),K({id:FQ,kind:W(`link`),title:IQ,url:BQ,...LQ})]),GQ=K({checks:q(zQ).check(J(100)),assets:q(WQ).check(J(20)),current:Bb}),KQ=K({proofId:FQ}),qQ=K({id:FQ,mediaType:RQ,base64:G}),JQ=/^\/review-summaries\/(?<token>[^?]*)\?expires=(?<expires>[^&]*)&signature=(?<signature>.*)$/,YQ=zb.check(hx()).check(dx(0)),XQ=K({url:G.check(_x(1)),byteLength:YQ}),ZQ=K({token:G,expires:G,signature:G,byteLength:YQ}),QQ=XQ.pipe(Qb(ZQ,m_({decode:e=>{let t=JQ.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})}))),$Q=G.check(cx()),e$=zb.check(hx()).check(fx(1)).check(px(tG)),t$=K({path:rq,startLine:e$,endLine:e$,symbol:U(G.pipe($b(h_())).check(_x(1)).check(J(500)))}),n$=K({...t$.fields,textFingerprint:$J}),r$=Jb([K({state:W(`changed`)}),K({state:W(`broken`)}),K({state:W(`current`),startLine:e$,endLine:e$}),K({state:W(`committed`),startLine:e$,endLine:e$})]),i$=K({id:$Q,lane:zb.check(hx()).check(fx(0)).check(px(99)),title:G.pipe($b(h_())).check(_x(1)).check(J(200)),text:G.pipe($b(h_())).check(_x(1)).check(J(cG)),kind:Yb([`changed`,`context`]),pointer:t$}),a$=K({published:U(q(G)),...i$.fields,pointer:n$,location:r$}),o$=K({alternatives:U(q(K({label:G.check(_x(1)).check(J(200)),whyNot:G.check(_x(1)).check(J(lG))})).check(J(8))),id:$Q,title:G.pipe($b(h_())).check(_x(1)).check(J(200)),summary:G.pipe($b(h_())).check(_x(1)).check(J(lG)),lanes:q(G.pipe($b(h_())).check(_x(1)).check(J(100))).check(_x(1)).check(J(100)),steps:q(i$).check(_x(1)).check(J(500))}),s$=K({...o$.fields,steps:q(a$).check(_x(1)).check(J(500)),fingerprint:$J,codeMoved:U(Bb)}),c$=K({from:$Q,to:$Q,label:U(G.pipe($b(h_())).check(_x(1)).check(J(200)))}),l$=K({after:K({boxes:q(K({options:U(q(K({id:$Q,label:G.check(_x(1)).check(J(200)),consequence:G.check(_x(1)).check(J(lG))})).check(_x(2)).check(J(6))),id:$Q,label:G.pipe($b(h_())).check(_x(1)).check(J(200)),detail:U(G.pipe($b(h_())).check(_x(1)).check(J(lG))),change:U(Yb([`new`,`changed`,`removed`])),problem:U(G.pipe($b(h_())).check(_x(1)).check(J(lG))),layerId:U($Q),decision:U(W(!0))})).check(J(500)),arrows:q(c$).check(J(uG))})}),u$=G.check(_x(1)).check(J(XW)).check(ox(e=>e.isWellFormed(),{expected:`Expected valid Unicode text`})).check(ox(e=>GY(e)<=XW,{expected:`Summary exceeds 10 MiB`})),d$=K({path:rq,ranges:q(K({startLine:e$,endLine:e$})),deleted:U(Bb),binary:U(Bb)}),f$=G.check(cx()),p$=gx.check(dx(0)),m$=G.check(_x(1)).check(J(lG)),h$=G.check(sx(/^https?:\/\//)),g$=K({url:h$.check(J(lG)),accounts:q(K({label:m$,signIn:m$})).check(J(10)),steps:q(m$).check(_x(1)).check(J(20))}),_$=q(K({asked:m$,built:m$,left:U(K({what:m$,owner:U(Jb([K({kind:W(`ticket`),name:m$}),K({kind:W(`teammate`),name:m$,message:U(m$)})]))}))})).check(J(30)),v$=K({tryIt:U(g$),coverage:U(_$),asked:K({text:m$,links:U(q(K({title:m$,url:h$})))}),recommendation:Yb([`merge`,`hold`]),reasons:q(m$).check(_x(1)).check(J(5)),notProven:q(K({what:m$,why:m$})),removed:q(K({behavior:m$,why:m$,paths:q(rq).check(_x(1))}))}),y$=Jb([K({kind:W(`available`).pipe(nx(z(`available`))),web:G,app:G,revision:K({web:G,app:G}),decisions:q(K({layerId:$Q,web:G,app:G}))}),K({kind:W(`unavailable`),reason:W(`no-reachable-route`)})]),b$=Yb([`http`,`https`]),x$=K({reviewId:f$,projectId:G,revision:p$,headOid:G,base:G,baseOid:G,mergeBaseOid:G,publishedAt:gG,branch:G,worktreePath:G,worktreeName:G}),S$=K({reviewId:U(f$),headOid:U(G),baseOid:U(G),base:U(G),mergeBaseOid:U(G),verdict:U(v$),links:U(y$),environmentId:G.check(cx()),worktreeId:vG,revision:zb.check(hx()).check(dx(0)),publishedAt:gG,active:Bb,diagnostics:Yb([`current`,`unavailable`]),summary:QQ,diagram:U(l$),timing:U(Yb([`decision`,`record`])),layers:q(s$).check(J(100)),notExplained:q(d$).check(J(QW)),proof:GQ}),C$=K({timing:U(Yb([`decision`,`record`])),expectedRevision:zb.check(hx()).check(fx(0)).check(px(2**53-1-1)),summaryHtml:U(u$),verdict:v$,base:U(G.check(_x(1))),pullRequest:U(G.check(sx(/^https:\/\/github\.com\/[^/]+\/[^/]+\/pull\/[1-9][0-9]*\/?$/))),reviewId:U(f$),diagram:U(l$),layers:q(o$).check(_x(1)).check(J(100)),proof:U(UQ)}),w$=K({review:yG(S$)}),T$=K({...w$.fields,reviewId:f$,revision:p$,headOid:G,baseOid:G,links:y$}),E$=K({projectId:G}),D$=K({revision:U(p$)}),O$=K({paths:aY.fields.paths}),k$=K({reviewId:f$}),A$=K({...k$.fields,revision:Dx.check(hx()).check(dx(0))}),j$=K({timing:U(Yb([`decision`,`record`])),publishedAt:U(gG),title:U(G),diagram:U(l$),guards:U(q(G)),reviewId:f$,projectId:G,branch:G,pullRequest:U(G),state:Yb([`open`,`closed`]),archived:U(Bb),latestRevision:p$,lastSeenRevision:gx}),M$=K({review:yG(j$),revisions:q(x$),revision:yG(K({...x$.fields,files:q(K({path:rq,oldPath:U(rq),newPath:U(rq),oldOid:U(G),newOid:U(G),oldMode:G,newMode:G,status:Yb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})),verdict:v$,content:S$}))}),N$=q(j$),P$=K({revision:p$}),F$=K({state:W(`closed`)}),I$=K({deleted:Bb}),L$=K({updated:Bb}),R$=K({path:rq}),z$=Jb([K({kind:W(`text`),text:G,blobOid:G}),K({kind:W(`missing`)}),K({kind:Yb([`too-large`,`unsupported`]),blobOid:G})]),B$=K({path:rq,fingerprint:G,reviewedAt:gG,stale:Bb}),V$=K({layerId:$Q,fingerprint:$J,reviewedAt:gG}),H$=K({files:q(B$),decisions:q(V$)}),U$=Jb([K({kind:W(`file`),revision:p$,path:rq,headBlobOid:G}),K({kind:W(`decision`),revision:p$,layerId:$Q,fingerprint:$J})]),W$=Jb([K({kind:W(`file`),path:rq,headBlobOid:G}),K({kind:W(`decision`),layerId:$Q,fingerprint:$J})]);Jb([K({worktreeId:vG,reviewId:U(f$)}),K({reviewId:f$,worktreeId:U(vG)})]);var G$=K({...PQ.fields,acknowledgementAccepted:U(Bb),currentCommentRevision:gx.check(fx(0))}),K$=K({reviewRevision:gx.check(dx(0))}),q$=K({...k$.fields,session:K({...MQ.fields,threadId:G.check(_x(1),J(2048),sx(/^\S[^\0]*$/))})}),J$=K({...k$.fields,deliveryId:G.check(cx())}),Y$=Dx.check(hx()).check(dx(0)),X$=K({from:U(Y$),to:U(Y$)}),Z$=K({reviewId:G.check(cx()),from:yG(gx),to:gx,comparison:yG(kQ),unknown:q(OQ)}),Q$=K({...X$.fields,path:rq}),$$=Jb([K({kind:W(`diff`),from:gx,to:gx,path:rq,...oY.fields}),K({kind:W(`unavailable`),reason:Yb([`no-baseline`,`path-not-reviewed`,`not-changed`])})]),e1=Jb([K({kind:W(`available`),account:G,pullRequest:rQ}),K({kind:W(`not-linked`)}),KZ]),t1=Jb([K({kind:W(`available`),account:G,pullRequests:q(K({...tQ.fields,reviewId:U(G)})),truncated:Bb,recentlyClosedSince:G}),KZ]),n1=K({account:yG(G.check(sx(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/)))});K({override:Mb(n1)});var r1=K({pullRequest:yG(G.check(sx(/^https:\/\/github\.com\/[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+\/pull\/[1-9][0-9]*$/)))}),i1=Jb([K({kind:W(`updated`)}),KZ]),a1=Jb([K({kind:W(`available`),number:gx,checks:iQ}),K({kind:W(`not-linked`)}),KZ]),o1={comparison:U(Jb([K({kind:W(`worktree`),scope:Yb([`staged`,`unstaged`,`untracked`])}),K({kind:W(`file`)}),K({kind:W(`commit`),parent:zb.check(hx()).check(fx(1)).check(px(nG))}),K({kind:W(`branch`),base:QJ})])),revision:U(G.check(_x(1)).check(J(256))),contentFingerprint:U(G.check(_x(1)).check(J(256)))},s1=G.check(_x(1)).check(J(sG)).check(ox(e=>e.trim().length>0&&!e.includes(`\0`))),c1=Yb([`reviewer`,`agent`]),l1=Jb([K({kind:W(`change`),reviewTarget:U(K({kind:Yb([`decision`,`question`]),id:G.check(cx())})),filePath:U(Ib),...o1}),K({kind:W(`file`),filePath:rq,...o1}),K({kind:W(`codeRange`),filePath:rq,startLine:zb.check(hx()).check(fx(1)).check(px(tG)),endLine:zb.check(hx()).check(fx(1)).check(px(tG)),side:U(Yb([`additions`,`deletions`])),...o1})]),u1=K({id:G.check(cx()),body:s1,author:c1,createdAt:U(gG),editedAt:U(gG)}),d1=K({review:U(K({reviewId:G.check(cx()),revision:gx.check(dx(0)),headOid:G})),id:G.check(cx()),worktreeId:vG,anchor:l1,resolved:Bb,messages:q(u1).check(_x(1)),revision:zb.check(hx()).check(fx(0))}),f1=K({threadId:G.check(cx())}),p1=K({worktreeId:vG,...f1.fields}),m1=Yb([`waiting`,`all`]);K({reviewId:U(G.check(cx())),scope:U(m1)}),K({kind:Yb([`owner`,`device`,`agent`])});var h1=q(d1),g1=K({reviewRevision:U(gx.check(dx(0))),reviewId:U(G.check(cx())),threadId:U(G.check(cx())),messageId:U(G.check(cx())),anchor:l1,body:s1}),_1=d1,v1=K({reviewId:U(G.check(cx())),messageId:U(G.check(cx())),body:s1}),y1=d1,b1=K({reviewId:U(G.check(cx())),resolved:Bb}),x1=d1,S1=K({reviewId:U(G.check(cx())),messageId:G.check(cx()),body:s1}),C1=K({reviewId:U(G.check(cx())),messageId:G.check(cx())}),w1=d1,T1=K({threadId:G.check(cx()),thread:yG(d1)}),E1=K({reviewId:U(G.check(cx())),threads:q(K({threadId:G.check(cx()),revision:zb.check(hx()).check(fx(0))})).check(_x(1)).check(J(100))}),D1=K({deleted:q(G.check(cx())),skipped:q(G.check(cx()))}),O1=K({throughRevision:zb.check(hx()).check(fx(0))}),k1=K({worktreeId:vG,seenThrough:zb.check(hx()).check(fx(0))}),A1=K({path:rq,fingerprint:$J,reviewedAt:gG}),j1=Yb([`worktree`,`branch`]),M1={scope:W(`branch`),base:QJ},N1=K({scope:U(j1),branch:U(QJ)}),P1=K({worktreeId:vG,marks:q(A1).check(J(iG))}),F1={path:rq,reviewed:W(!0),fingerprint:$J},I1=Jb([K({...F1,scope:U(W(`worktree`))}),K({...F1,...M1})]),L1=P1,R1={files:q(K({path:rq,fingerprint:$J})).check(_x(1)).check(J($W))},z1=Jb([K({...R1,scope:U(W(`worktree`))}),K({...R1,...M1})]),B1=K({...P1.fields,marked:q(rq).check(J($W)),conflicts:q(K({path:rq,reason:Yb([`stale`,`missing`])})).check(J($W))}),V1=K({path:rq,scope:U(j1),branch:U(QJ)}),H1=P1,U1=K({paths:q(rq).check(_x(1)).check(J($W)),scope:U(j1),branch:U(QJ)}),W1=P1,G1=K({worktreeId:vG,marks:q(K({layerId:G.check(cx()),fingerprint:$J,reviewedAt:gG,stale:Bb})).check(J(100))}),K1=K({layerId:G.check(cx()),reviewed:W(!0),fingerprint:$J}),q1=G1,J1=K({layerId:G.check(cx())}),Y1=G1,X1=class extends FK.add(kG(`reviews`).add(LA(`readReviewAgentFeedback`,`/api/reviews/:reviewId/agent-feedback`,{disableCodecs:!0,params:k$,success:G$,error:[$(UZ,`NotFound`),$(sQ,`Conflict`,{message:{fromError:!0}})]}),RA(`sendReviewAgentFeedback`,`/api/reviews/:reviewId/agent-feedback`,{disableCodecs:!0,params:k$,payload:K$,success:G$,error:[$(UZ,`NotFound`),$(sQ,`Conflict`,{message:{fromError:!0}})]}),VA(`disconnectReviewAgentSession`,`/api/reviews/:reviewId/agent-session`,{disableCodecs:!0,params:k$,success:G$,error:[$(UZ,`NotFound`),$(sQ,`Conflict`,{message:{fromError:!0}})]}),RA(`archiveReview`,`/api/reviews/:reviewId/archive`,{disableCodecs:!0,params:k$,payload:AQ,success:jQ,error:[$(UZ,`NotFound`),$(eJ,`NotFound`),$(aQ,`Conflict`,{message:{fromError:!0}})]}),LA(`compareReview`,`/api/reviews/:reviewId/compare`,{disableCodecs:!0,params:k$,query:X$.fields,success:Z$,error:[$(UZ,`NotFound`),$(WZ,`BadRequest`,{message:{fromError:!0}})]}),LA(`readReviewInterdiff`,`/api/reviews/:reviewId/interdiff`,{disableCodecs:!0,params:k$,query:Q$.fields,success:$$,error:[...rJ,...gJ,$(UZ,`NotFound`),$(WZ,`BadRequest`,{message:{fromError:!0}}),$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),zA(`setReviewPullRequest`,`/api/reviews/:reviewId/pull-request`,{disableCodecs:!0,params:k$,payload:r1,success:i1,error:[$(UZ,`NotFound`),$(eJ,`NotFound`),$(oQ,`Conflict`,{message:{fromError:!0}})]}),LA(`readReviewPullChecks`,`/api/reviews/:reviewId/pull-request/checks`,{disableCodecs:!0,params:k$,success:a1,error:[$(UZ,`NotFound`),$(eJ,`NotFound`)]}),LA(`readReviewPullRequest`,`/api/reviews/:reviewId/pull-request`,{disableCodecs:!0,params:k$,success:e1,error:[$(UZ,`NotFound`),$(eJ,`NotFound`)]}),LA(`listProjectPullRequests`,`/api/projects/:projectId/pull-requests`,{disableCodecs:!0,params:E$,success:t1,error:[$(eJ,`NotFound`)]}),LA(`readProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:E$,success:JZ,error:[$(eJ,`NotFound`)]}),zA(`setProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:E$,payload:n1,success:JZ,error:[$(eJ,`NotFound`)]})).add(VA(`deleteReviewCommentMessage`,`/api/reviews/:reviewId/comments/:threadId/messages`,{disableCodecs:!0,params:K({...k$.fields,...f1.fields}),query:C1.fields,success:T1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(bZ,`Forbidden`)]}),RA(`deleteResolvedReviewComments`,`/api/reviews/:reviewId/comments/resolved/deletion`,{disableCodecs:!0,params:k$,payload:E1,success:D1,error:[...rJ,$(UZ,`NotFound`)]}),BA(`editReviewCommentMessage`,`/api/reviews/:reviewId/comments/:threadId/messages`,{disableCodecs:!0,params:K({...k$.fields,...f1.fields}),payload:S1,success:w1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(bZ,`Forbidden`),$(SZ,`Conflict`)]}),LA(`listReviewMarks`,`/api/reviews/:reviewId/marks`,{disableCodecs:!0,params:k$,success:H$,error:[$(UZ,`NotFound`)]}),zA(`setReviewMark`,`/api/reviews/:reviewId/marks`,{disableCodecs:!0,params:k$,payload:U$,success:L$,error:[$(UZ,`NotFound`),$(AZ,`Conflict`)]}),RA(`removeReviewMark`,`/api/reviews/:reviewId/marks/removal`,{disableCodecs:!0,params:k$,payload:W$,success:L$,error:[$(UZ,`NotFound`)]}),RA(`createReviewCommentThread`,`/api/reviews/:reviewId/comments`,{disableCodecs:!0,params:k$,payload:g1,success:_1,error:[...rJ,$(UZ,`NotFound`),$(xZ,`Conflict`),$(SZ,`Conflict`),$(qq,`BadRequest`,{message:`Invalid request`}),$(CZ,`BadRequest`,{message:`Invalid request`}),$(MZ,`BadRequest`,{message:`Invalid request`})]}),LA(`listReviewCommentThreads`,`/api/reviews/:reviewId/comments`,{disableCodecs:!0,params:k$,success:h1,error:[...rJ,$(UZ,`NotFound`)]}),RA(`replyToReviewComment`,`/api/reviews/:reviewId/comments/:threadId/replies`,{disableCodecs:!0,params:K({...k$.fields,...f1.fields}),payload:v1,success:y1,error:[...rJ,$(UZ,`NotFound`),$(xZ,`Conflict`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(SZ,`Conflict`)]}),zA(`updateReviewCommentThread`,`/api/reviews/:reviewId/comments/:threadId`,{disableCodecs:!0,params:K({...k$.fields,...f1.fields}),payload:b1,success:x1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`})]}),LA(`readReview`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:k$,success:M$,error:[NK,...rJ,$(UZ,`NotFound`)]}),LA(`readReviewRevision`,`/api/reviews/:reviewId/revisions/:revision`,{disableCodecs:!0,params:A$,success:M$,error:[NK,...rJ,$(UZ,`NotFound`)]}),LA(`listProjectReviews`,`/api/projects/:projectId/reviews`,{disableCodecs:!0,params:E$,success:N$}),zA(`setReviewSeen`,`/api/reviews/:reviewId/seen`,{disableCodecs:!0,params:k$,payload:P$,success:L$,error:[$(UZ,`NotFound`)]}),BA(`setReviewState`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:k$,payload:F$,success:L$,error:[$(UZ,`NotFound`)]}),VA(`deleteProjectReview`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:k$,success:I$,error:[...rJ,$(UZ,`NotFound`)]}),LA(`readReviewProofFile`,`/api/reviews/:reviewId/revisions/:revision/proof`,{disableCodecs:!0,params:A$,query:KQ.fields,success:qQ,error:[...rJ,$(FZ,`NotFound`)]}),LA(`readReviewFile`,`/api/reviews/:reviewId/revisions/:revision/file`,{disableCodecs:!0,params:A$,query:R$.fields,success:z$,error:[$(UZ,`NotFound`)]}),RA(`readReviewDiffs`,`/api/reviews/:reviewId/revisions/:revision/diffs`,{disableCodecs:!0,params:A$,payload:O$,success:oY,error:[...rJ,...gJ,$(UZ,`NotFound`),$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),RA(`createCommentThread`,`/api/worktrees/:worktreeId/comments`,{disableCodecs:!0,params:bG,payload:g1,success:_1,error:[...rJ,$(UZ,`NotFound`),$(xZ,`Conflict`),$(SZ,`Conflict`),$(qq,`BadRequest`,{message:`Invalid request`}),$(CZ,`BadRequest`,{message:`Invalid request`}),$(MZ,`BadRequest`,{message:`Invalid request`})]}),VA(`deleteCommentMessage`,`/api/worktrees/:worktreeId/comments/:threadId/messages`,{disableCodecs:!0,params:p1,query:C1.fields,success:T1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(bZ,`Forbidden`)]}),RA(`deleteResolvedComments`,`/api/worktrees/:worktreeId/comments/resolved/deletion`,{disableCodecs:!0,params:bG,payload:E1,success:D1,error:[...rJ,$(UZ,`NotFound`)]}),BA(`editCommentMessage`,`/api/worktrees/:worktreeId/comments/:threadId/messages`,{disableCodecs:!0,params:p1,payload:S1,success:w1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(bZ,`Forbidden`),$(SZ,`Conflict`)]}),LA(`listCommentThreads`,`/api/worktrees/:worktreeId/comments`,{disableCodecs:!0,params:bG,success:h1,error:[...rJ,$(UZ,`NotFound`)]}),LA(`listReviewedFiles`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:bG,query:N1.fields,success:P1,error:[...rJ,$(UZ,`NotFound`)]}),LA(`listReviewedLayers`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:bG,success:G1,error:[...rJ,$(UZ,`NotFound`)]}),RA(`markCommentsSeen`,`/api/worktrees/:worktreeId/comments/seen`,{disableCodecs:!0,params:bG,payload:O1,success:k1,error:[...rJ,$(UZ,`NotFound`)]}),VA(`deleteReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:bG,success:I$,error:[...rJ,$(UZ,`NotFound`)]}),zA(`publishReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:bG,payload:C$,success:T$,error:[NK,...rJ,...gJ,$(TZ,`BadRequest`,{message:`Invalid request`}),$(EZ,`BadRequest`,{message:`Invalid request`}),$(qq,`BadRequest`,{message:`Invalid request`}),$(jZ,`BadRequest`,{message:`Invalid request`}),$(PZ,`BadRequest`,{message:`Invalid request`}),$(yZ,`BadRequest`,{message:`Invalid request`}),$(NZ,`BadRequest`,{message:`Invalid request`}),$(RZ,`BadRequest`),$(VZ,`BadRequest`,{message:{fromError:!0}}),$(DZ,`Conflict`),$(HZ,`Conflict`,{message:{fromError:!0}}),$(KJ,`NotFound`),$(LZ,`PayloadTooLarge`),$(BZ,`BadRequest`),$(zZ,`UnprocessableEntity`),$(IZ,`UnprocessableEntity`),$(qJ,`UnprocessableEntity`)]}),LA(`readProofFile`,`/api/worktrees/:worktreeId/review/proof`,{disableCodecs:!0,params:bG,query:KQ.fields,success:qQ,error:[...rJ,$(FZ,`NotFound`)]}),LA(`readPublishedReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:bG,success:w$,error:[NK,...rJ,...gJ,$(qJ,`UnprocessableEntity`)]}),VA(`removeReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:bG,query:V1.fields,success:H1,error:rJ}),VA(`removeReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:bG,payload:U1,success:W1,error:rJ}),VA(`removeReviewedLayer`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:bG,query:J1.fields,success:Y1,error:[...rJ,$(UZ,`NotFound`)]}),RA(`replyToComment`,`/api/worktrees/:worktreeId/comments/:threadId/replies`,{disableCodecs:!0,params:p1,payload:v1,success:y1,error:[...rJ,$(UZ,`NotFound`),$(xZ,`Conflict`),$(wZ,`NotFound`,{message:`Comment target not found`}),$(SZ,`Conflict`)]}),zA(`setReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:bG,payload:I1,success:L1,error:[...rJ,...gJ,$(AZ,`Conflict`),$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),zA(`setReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:bG,payload:z1,success:B1,error:[...rJ,...gJ,$(AZ,`Conflict`),$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),zA(`setReviewedLayer`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:bG,payload:K1,success:q1,error:[...rJ,$(OZ,`NotFound`),$(AZ,`Conflict`)]}),zA(`updateCommentThread`,`/api/worktrees/:worktreeId/comments/:threadId/resolution`,{disableCodecs:!0,params:p1,payload:b1,success:x1,error:[...rJ,$(UZ,`NotFound`),$(wZ,`NotFound`,{message:`Comment target not found`})]})).middleware(rK)){},Z1=K({token:G.check(cx())}),Q1=K({expires:gG,signature:G.check(sx(/^[A-Za-z0-9_-]{43}$/))}),$1=G,e0=class extends FK.add(kG(`reviewSummary`).add(LA(`readReviewSummary`,`/review-summaries/:token`,{disableCodecs:!0,params:Z1,query:Q1.fields,success:$1.pipe(Zk({contentType:`text/html; charset=utf-8`})),error:kZ.pipe(zk({decode:()=>new kZ}),Lk(`NotFound`))}))){},t0=class extends FK.addHttpApi(Kq).addHttpApi(vZ).addHttpApi(aX).addHttpApi(WY).addHttpApi(X1).addHttpApi(e0).addHttpApi(GX){},n0=K({address:G,credential:Lx(G),deviceId:U(G)}),r0=K({...n0.fields,environmentId:G,name:G,alternateRoutes:U(q(n0)),operationIdentity:U(G)});function i0({address:e,credential:t,deviceId:n}){return{address:e,credential:t,...n?{deviceId:n}:{}}}function a0(e){return[i0(e),...(e.alternateRoutes??[]).map(i0)]}function o0(e){return e.operationIdentity??(e.deviceId?JSON.stringify([e.environmentId,e.address,e.deviceId]):void 0)}function s0(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,...i0(n),...o0(e)?{operationIdentity:o0(e)}:{},...r.length?{alternateRoutes:r.map(i0)}:{}}}function c0(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 l0(e){return JSON.stringify(kb(q(r0))(e))}function u0(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 d0(e,t){let n=Reflect.get(e,t);return typeof n==`string`?n:void 0}function f0(e){if(!e||typeof e!=`object`)return;let t=d0(e,`address`),n=d0(e,`credential`),r=d0(e,`deviceId`);return t&&n?{address:t,credential:yh(n),...r?{deviceId:r}:{}}:void 0}function p0(e){if(!e||typeof e!=`object`)return[];let t=d0(e,`environmentId`),n=d0(e,`name`),r=f0(e),i=Reflect.get(e,`alternateRoutes`);return t&&n!==void 0&&r?[{environmentId:t,name:n,...r,...d0(e,`operationIdentity`)?{operationIdentity:d0(e,`operationIdentity`)}:{},...Array.isArray(i)?{alternateRoutes:i.flatMap(e=>{let t=f0(e);return t?[t]:[]})}:{}}]:[]}function m0(e){return Array.isArray(e)?e.flatMap(p0):[]}function h0(e,t){let n=e.find(e=>e.environmentId===t.environmentId);if(!n)return[...e,t];let r=a0(t),i=a0(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),s0({...n,name:t.name},i)]}var g0=Sh((e,t)=>e===t);function _0(e,t){return e.environmentId===t.environmentId&&e.address===t.address&&g0(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&&g0(e.credential,r.credential)})}function v0(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 y0(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 b0=class e extends rr()(`@porcelain/client/AccessStore`){static layer=Ku(e,V(function*(){let e=yield*VW,t=yield*qW({initial:{remotes:[],missingCredentials:[]},read:e.read,write:e.write,messages:{beforeRead:`Saved environments must be read before changing them.`,readFailed:`Saved environments could not be read. Try reading them again.`,writeFailed:`The saved environments could not be updated. Read them again before making changes.`}});return{state:t.state,load:t.load,save:Jp(`AccessStore.save`)(e=>t.write(t=>{let n=t.missingCredentials.find(t=>t.environmentId===e.environmentId),r=a0(e),i=n?.operationIdentity?{...e,operationIdentity:n.operationIdentity}:e;return z({remotes:h0(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})=>V(function*(){let r=t.find(t=>t.environmentId===e.environmentId);if(!r)return yield*H(new KW({message:`That environment is no longer saved.`}));let i=a0(r),a=i.find(t=>t.address===e.address);if(!a)return yield*H(new KW({message:`That connection is no longer saved.`}));let o=i.filter(t=>t.address!==e.address);if(e.kind===`remove`&&!o.length)return yield*H(new KW({message:`Forget the environment to remove its last connection.`}));let s=s0(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=>z({remotes:t.remotes.filter(t=>t.environmentId!==e),missingCredentials:t.missingCredentials.filter(t=>t.environmentId!==e)})))}}))},x0=class extends rr()(`@porcelain/client/ConnectionFactory`){},S0=class extends rr()(`@porcelain/client/RemoteConnectionFactory`){},C0=class e extends rr()(`@porcelain/client/AccessSession`){static layer=Ku(e,V(function*(){let e=yield*x0,t=yield*xu,n,r=Ij({connection:null,generation:0,writerIdentity:void 0});return{state:r,beginConnection:Jp(`AccessSession.beginConnection`)((i=!1)=>B(()=>{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)}}))},w0=class e extends rr()(`@porcelain/client/RemoteConnections`){static layer=Ku(e,V(function*(){let e=yield*S0,t=yield*xu,n=yield*NC(1),r=[],i=Ij([]);return{state:i,synchronize:Jp(`RemoteConnections.synchronize`)(a=>V(function*(){let n=yield*Df(a,n=>V(function*(){let i=r.find(e=>_0(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))}}))},T0=Yu(V(function*(){let e=yield*b0,t=yield*w0;yield*t.synchronize(e.state.value.remotes),yield*rT(Jp(`RemoteConnections.subscribe`)(function*(t){yield*xp(B(()=>e.state.subscribe(({remotes:e})=>{nC(t,e)})),e=>B(e))})).pipe(vT(t.synchronize),Rp({startImmediately:!0}))}));function E0(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 ${xh(t)}`),n(a,{...i,headers:o,mode:`cors`,credentials:`omit`,redirect:`error`,cache:`no-store`})}}var D0=class extends Y()(`RequestError`,{status:zb,message:G,code:mG.fields.code}){};function O0(e){return Ku(LO,Yf(LO,e=>e.pipe(HO(SO(`http://porcelain.invalid`)),RO(vp(GO,!1))))).pipe(ed(nd(AK).pipe(ed(Qu(Vu(OK,(t,n)=>t instanceof URL?e(`${t.pathname}${t.search}`,n):Promise.reject(TypeError(`FetchHttpClient sends every request as a parsed URL.`))),Vu(kK,{redirect:`error`,cache:`no-store`}))))))}function Oce(e){let t=e.response;return t===void 0?z(new KW({message:`Could not reach Porcelain. Try again.`,cause:e.reason._tag===`TransportError`?e.reason.cause:e})):Yf(yne(t.json,()=>void 0),e=>{let n=Tb(mG)(e);return new D0({status:t.status,message:Lr(n)?n.success.message:`Request failed (${t.status})`,code:void 0})})}function k0(e){return $f(e,e=>qD(e)?Uf(Oce(e),H):H(e))}function kce(e,t){return t(k0(e))}var A0=class extends rr()(`@porcelain/client/PairingPlatform`){},j0=Lb,Ace=Rb,jce=class extends FK.add(kG(`live`).add(LA(`liveUpdates`,`/api/live`,{disableCodecs:!0,query:sq.fields,success:cq.pipe(zk({decode:()=>void 0}),Lk(`SwitchingProtocols`))})).middleware(rK)){};FK.add(kG(`reviewMcp`).add(RA(`reviewMcp`,`/mcp`,{disableCodecs:!0,payload:j0,success:[j0,Ace.pipe(zk({decode:()=>void 0}),Lk(`Accepted`))]})).middleware(rK));function Mce(e){let t;try{t=new URL(e.trim())}catch{return}return t.protocol===`http:`||t.protocol===`https:`?t.origin:void 0}function M0(e){let t;try{t=new URL(e.trim())}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`)return;let n=N0(t.hash);if(!n)return;if(t.pathname===`/pair`)return{address:t.origin,...n};if(!NG(t.pathname))return;let[r=``]=(new URLSearchParams(t.hash.replace(/^#/,``)).get(`a`)??``).split(`,`),i=Mce(r);return i===void 0?void 0:{address:i,...n}}function N0(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`c`),r=t.get(`e`);return n&&r?{code:n,environmentId:r}:null}var Nce=3e3,Pce=8e3,Fce=1e4,P0=1e4,Ice=1e4,Lce=1e3,Rce=1e3,zce=1e3,Bce=3e4,F0=2500,Vce=5e3,I0=6e4,Hce=18e5,Uce=6e4,L0=X(e=>Ij(void 0)),Wce=X(e=>PE()),Gce=oj(t0),R0=class e extends rr()(`@porcelain/client/BootstrapClient`){static layer=X(t=>ed(Ku(e,Gce),O0(t)))},Kce=X(e=>FE(R0.layer(e)));function qce(e,t){return aS(t)?{kind:`offline`}:u0(e,Gn(fS(t)))}function z0(e,t){return V(function*(){let e=yield*R0,n=yield*k0(e.publicAccess.readEnvironment()).pipe(ep(`ConnectionError`,t=>k0(e.session.readSession()).pipe(Gf(H(t)))));return n.environmentId===t&&n.protocol===3&&(yield*k0(e.session.readSession())),{kind:`described`,environment:n}}).pipe(hp(R0.layer(e)),$f(e=>z(e instanceof D0&&e.status===401?{kind:`unauthorized`}:{kind:`unreachable`})),sp(Vce),Yf(e=>Un(e,()=>({kind:`unreachable`}))))}function B0(e,t){L0(e.send).set({remote:t,revision:Symbol()})}var V0=Jp(`Environments.readVerifiedRoute`)(function*(e,t,n){let r=E0(e.address,e.credential,n);return yield*V(function*(){return(yield*k0((yield*R0).publicAccess.readHealth())).environmentId===t?yield*z0(r,t):{kind:`foreign`}}).pipe(hp(R0.layer(r)),$f(()=>z({kind:`unreachable`})))}),Jce=Jp(`Environments.readRoutes`)(function*(e,t){let n={kind:`unreachable`};for(let r of a0(t)){let i=yield*V0(r,t.environmentId,e.send).pipe(sp(F0),Yf(e=>Un(e,()=>({kind:`unreachable`}))));if(u0(t,i).kind===`online`)return i;i.kind!==`unreachable`&&(n=i)}return n}),Yce=X(({platform:e,remote:t})=>{let{send:n,statusActivity:r}=e;return Wce(e)(Uu).atom(()=>{let i=!1,a=!1,o=!1,s,c=rT(e=>V(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(B(()=>{let e=r?.subscribe(s),i=L0(n).subscribe(()=>{let e=L0(n).value;e&&_0(e.remote,t)&&s()});return()=>{e?.(),i?.()}}),e=>B(e)),s()}),{bufferSize:1,strategy:`sliding`}),l=V(function*(){i=!0;let n=yield*Jce(e,t);return s=n,n}).pipe(wp(B(()=>{i=!1})));return c.pipe(Gae(e=>e?oT(()=>s?.kind===`unreachable`?fT(Lae({kind:`reconnecting`}),eT(l)):eT(l)).pipe(dT(gf(Bce))):Wae))}).pipe(gE(0))});function Xce(e,t){return Yce({platform:e,remote:t})}var Zce=X(({platform:e,remote:t,connection:n})=>CE(r=>{let i=n?.liveUpdates.state;i&&r.addFinalizer(i.subscribe(()=>r.refreshSelf()));let a=qce(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 H0(e,t,n){return Zce({platform:e,remote:t,connection:n})}function U0(e){return e instanceof D0?!0:e instanceof KW?!1:e._tag===`InvalidPairingError`||e._tag===`InvalidDeviceDetailsError`}function Qce(e,t,n){return V(function*(){let r=M0(t);if(!r)return yield*H(new KW({message:`Paste the whole link porcelain pair printed, starting with http.`}));if(n&&r.environmentId!==n)return yield*H(new KW({message:`That pairing link belongs to another computer. Add it as a separate environment.`}));let i=E0(r.address,void 0,e.send);if((yield*k0(V(function*(){return yield*(yield*R0).publicAccess.readHealth()}).pipe(hp(R0.layer(i))))).environmentId!==r.environmentId)return yield*H(new KW({message:`Another Porcelain answered at that address than the one that made the link.`}));let a=yield*k0(V(function*(){return yield*(yield*R0).pairing.redeemPairing({payload:{code:r.code,platform:e.name()}})}).pipe(hp(R0.layer(i)))).pipe(np(e=>U0(e)?new KW({message:`That link was not accepted. It works once, for a few minutes; run porcelain pair again.`}):e instanceof KW?new KW({message:`Could not reach ${r.address}. Check that Porcelain runs there and that this device reaches it.`,cause:e.cause}):e));if(!a.credential)return yield*H(new KW({message:`The remote paired but sent no credential.`}));let o=yh(a.credential),s=u0(r,yield*z0(E0(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*H(new KW({message:s.kind===`other-server`?`Another Porcelain answered at that address than the one that made the link.`:s.kind===`incompatible`?`That Porcelain runs a version this app cannot talk to. Update both to the same version.`:`The remote paired but did not answer afterwards. Try again.`}))})}var $ce=Jp(`Environments.pairAndSave`)(function*(e,t){let n=yield*b0,r=yield*HW;if(n.state.value.status!==`ready`)return yield*H(new KW({message:`Read saved environments before pairing.`}));let i=n.state.value.missingCredentials.find(t=>t.environmentId===M0(e)?.environmentId);if(i&&!i.routes.some(t=>t.address===M0(e)?.address))return yield*H(new KW({message:`Use a pairing link for the connection whose credential is missing.`}));let a=yield*Qce(r,e,t);return yield*n.save(a),a}),ele=Jp(`BrowserSession.pair`)(function*(e){let t=yield*A0,n=yield*R0;if((yield*k0(n.publicAccess.readHealth()).pipe(np(e=>!(e instanceof KW)&&!(e instanceof D0)&&e._tag!==`MissingEnvironmentIdentityError`?new KW({message:`That address answered, but it is not a Porcelain server.`}):new KW({message:`Could not reach Porcelain. Check that the server is running, then open the link again.`,cause:e})))).environmentId!==e.environmentId)return yield*H(new KW({message:`This link was made for a different Porcelain installation.`}));let r=yield*k0(n.pairing.redeemPairing({payload:{code:e.code,platform:t.name()}})).pipe(np(e=>U0(e)?new KW({message:`This pairing link is not usable. Ask for a new one.`}):e));return{inventory:yield*k0(n.projects.readInventory()).pipe(np(e=>e instanceof D0?new KW({message:`Pairing succeeded but the workspace could not be loaded. Reload the page.`}):e)),principal:{kind:`device`,deviceId:r.device.id}}}),tle=X(({transport:e,platform:t})=>FE(Qu(R0.layer(e),Vu(A0,t))).fn(e=>ele(e))),W0=X(e=>{class t extends rr()(`@porcelain/client/HttpClient`){static runtime=e.atoms(Ku(t,Yf(oj(t0),t=>({request:(n,r)=>kce(n(t),t=>e.request(t,r))}))).pipe(ed(O0(e.transport))))}return t}),G0=Jp(`Client.requestApi`)(function*(e,t){return yield*(yield*W0(e)).request(t)}),K0=X(e=>e.atoms(t=>Qu(t(W0(e).runtime.layer),Ju(e.runtime.contextEffect)))),q0=class e extends rr()(`@porcelain/client/AccessSnapshots`){static layer=Ku(e,V(function*(){return{sharing:yield*BD(Rn()),remote:yield*BD(Rn()),update:yield*BD(Rn())}}))},J0=X(e=>e.atoms(t=>td(q0.layer,t(K0(e).layer))));function nle(){return new KW({message:`The connected context changed. Reopen Porcelain to continue safely.`})}function Y0(e,t=!0){return Mf(()=>e.isClosed()?Op:X0(t))}function X0(e=!0){return e?Nf:H(nle())}function rle(e){return e instanceof Jq}var Z0=[`lan`,`tailnet`,`cloudflare`],Q0={lan:`Local network`,tailnet:`Tailscale`,cloudflare:`Cloudflare tunnel`},ile={lan:`Devices on this network.`,tailnet:`Encrypted access through your Tailscale network.`,cloudflare:`HTTPS through your existing tunnel.`},$0={loopback:`This computer`,lan:`Local network`,tailnet:`Tailscale`,tunnel:`Cloudflare tunnel`};function ale(e){return`This device is connected through ${Q0[e]}, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}var ole=`Anyone on the same network can read what Porcelain shows and the device credentials it sends. For an encrypted connection, use Tailscale.`,sle=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/,cle=/^::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}$/;function lle(e,t){let n=new URL(e).hostname.replace(/^\[|\]$/g,``).replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n===`::1`||t.includes(n)||sle.test(n)||cle.test(n)}function ule(e){return e.route!==`loopback`||e.canEditWaysIn}function dle(e,t=[]){return lle(e,t)?`Use the computer running Porcelain to manage ways in, or pair over the local network or an existing encrypted route.`:`Turn on Manage sharing for this device in Computers → Devices, from a computer with sharing access.`}function e2(e){return`${e.subnet} on ${e.interfaceName}`}function t2(e){let{lan:t}=e.routes,n=e.localNetwork,r=e.lanNetwork,i=`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known.`;return t.enabled?t.status.kind===`paused`?n?n.gatewayHardware?r?e2(r)===e2(n)?`Paused on this network. It looks like ${e2(r)}, but its router is another one, so this is another network; turn it on for this network to listen here.`:`Paused on this network. It was turned on for ${e2(r)}, and listens again there, or here once you turn it on for this network.`:`Paused on this network. It was turned on before Porcelain kept the network it was turned on for; turn it on for this network to listen here.`:`Paused. ${i}`:r?`Paused: this computer is not on a local network. Porcelain listens again when it is back on ${e2(r)}.`:`Paused: this computer is not on a local network.`:r?`Listening on ${e2(r)} only.`:`Listening on this network only.`:n?n.gatewayHardware?`Turning it on listens on ${e2(n)} only, and pauses on any other network.`:`${i} Try again in a moment.`:`This computer is not on a local network right now.`}function fle(e){return e?Z0.some(t=>{let n=e.routes[t];return n.enabled?n.status.kind===`starting`||n.status.kind===`off`:n.status.kind!==`off`}):!1}function ple(e){return e===void 0?[]:Z0.flatMap(t=>{let{status:n}=e.routes[t];return n.kind===`on`?n.urls.map(e=>({route:t,url:e})):[]})}function mle(e){let[t]=e.grants;return t?{id:t.grant.id,label:t.grant.label,address:t.link.addresses[0],link:PG(t.link),expiresAt:t.grant.expiresAt}:null}function hle(e){return`tailscale serve --bg --https=443 ${e}`}var gle={lan:`Starting`,tailnet:`Checking the Tailscale name`,cloudflare:`Checking the tunnel`};function _le(e,t){switch(t.status.kind){case`off`:return t.enabled?`Starting`:null;case`starting`:return gle[e];case`paused`:return`Paused on this network`;case`failed`:return`Failed`;case`on`:return t.enabled?`On`:`Stopping`}}var vle={tailnet:{label:`Tailscale name`,saveLabel:`Save name`,placeholder:`laptop.tail1234.ts.net`},cloudflare:{label:`Public hostname`,saveLabel:`Save hostname`,placeholder:`porcelain.example.com`}};function n2(e,t){return(t===`tailnet`?e.tailnetHostname:e.cloudflareHostname)??``}function yle(e,t){let{enabled:n,status:r}=e.routes[t];return n&&r.kind===`failed`}function ble(e,t,n){let r=n2(e,t)===``;return t===`tailnet`?{tailnetHostname:n,...r?{tailnet:!0}:{}}:{cloudflareHostname:n,...r?{cloudflare:!0}:{}}}function xle(e,t,n){let r=n2(e,t),i=n??r,a=i.trim();return{...vle[t],value:i,canSave:a!==``&&a!==r,save:ble(e,t,a),failed:yle(e,t),check:t===`tailnet`?{tailnet:!0}:{cloudflare:!0}}}function Sle(e,t){let n=`Your devices may reach that program instead of Porcelain: run tailscale serve --https=443 off now, then turn Tailscale off and on here to pick a free port and run the new command Porcelain names.`;switch(t){case`address-in-use`:return e===`tailnet`?`Another program already listens on the port Tailscale forwards to. ${n}`:`Another program already listens on this port.`;case`address-unavailable`:return e===`tailnet`?`Porcelain could not open the local listener Tailscale forwards to. ${n}`:`This computer could not listen at its address.`;case`unreachable`:return e===`tailnet`?`Nothing answered at this Tailscale name yet. Check that you ran the command below, that Tailscale is connected on this computer and uses MagicDNS, and that MagicDNS and HTTPS Certificates are on in the Tailscale admin console. Porcelain keeps checking.`:`Nothing answered at this hostname. Check that cloudflared is running and routes it here.`;case`other-server`:return e===`tailnet`?`Another server answered at this Tailscale name. Run the command below so Tailscale forwards to this Porcelain; Porcelain keeps checking.`:`Another server answered at this hostname.`}}function r2(e){return rS(e)?e.value:void 0}function Cle(e,t,n){return V(function*(){let r=yield*Jf(n.pipe(Kf(()=>Y0(e))));if(du(r)&&Kl(r.cause))return yield*Op;if(uu(r))yield*HD(t,zn(r.value));else{let e=Gn(Gl(r.cause));e instanceof D0&&e.status===401&&(yield*HD(t,Rn()))}return Qx(r,Yn(yield*VD(t),iS))})}function i2(e,t,n,r){let i=e.atom(e=>{let i=Xn(e.self(),fS);return cT(Yf(r,e=>fT(aT($x(i)),eT(t).pipe(dT(gf(n)),Qae(t=>!e(Gn(fS(t))))))))}).pipe($E(e=>gS(e,e=>e)));return aD(i).pipe(ZE((e,t)=>{let n=e(t);return e(i).waiting?$x(zn(n)):n}),gE(0))}function a2(e,t,n){return Uf(q0,r=>Cle(e,t(r),n))}function o2(e){return e.pipe($f(e=>e instanceof D0&&e.status===403||I(e,`WaysInPermissionRequiredError`)||I(e,`SharingManagementRequiredError`)?z(null):H(e)))}var s2=X(e=>i2(J0(e),a2(e,e=>e.sharing,o2(G0(e,e=>e.administration.listAccess()))),zce,z(()=>!0))),c2=X(e=>i2(J0(e),a2(e,e=>e.remote,o2(G0(e,e=>e.remoteAccess.readRemoteAccess()))),Lce,z(fle))),l2=X(e=>i2(J0(e),a2(e,e=>e.update,G0(e,e=>e.serviceUpdates.readServiceUpdate())),Rce,V(function*(){let e=Gn(yield*VD((yield*q0).update)),t=e?.running?e.last?.target:void 0;return e=>e?.managed===!0?e.running?(t=e.last?.target,!0):t!==void 0&&e.last?.stage===`updated`&&e.last.target===t&&e.version===e.last.from&&e.version!==t:!1})));function wle(e){return V(function*(){let t=yield*W0(e),n=yield*GW,r=yield*q0,i=yield*qT;function a(t,r){return n.run([t],V(function*(){yield*Y0(e);let t=yield*r;return yield*Y0(e),t}))}function o(t){return B(()=>{e.isClosed()||i.refresh(t)})}function s(e,t,n){return Sp(B(()=>{let t=i.mount(e),n=EE(iS(i.get(e),{waiting:!0}));return i.set(e,n),{transition:n,unmount:t}}),({transition:e})=>n.pipe(Kf(n=>V(function*(){yield*HD(t,zn(n)),i.set(e,iS(iS(n),{waiting:!0}))}))),({transition:e,unmount:t},n)=>B(()=>{i.set(e,uu(n)?iS(iS(n.value)):oS(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(s2(e))))),revoke:n=>a(`paired-access`,t.request(e=>e.administration.revokeAccess({payload:{id:n}})).pipe(wp(o(s2(e))))),trust:n=>a(`paired-access`,t.request(e=>e.administration.setDeviceTrust({payload:n})).pipe(wp(o(s2(e))))),allowManagement:n=>a(`paired-access`,t.request(e=>e.administration.setManagementPermission({payload:n})).pipe(wp(o(s2(e))))),allowWaysIn:n=>a(`paired-access`,t.request(e=>e.administration.setWaysInPermission({payload:n})).pipe(wp(o(s2(e))))),setRemote:n=>a(`remote-access`,s(c2(e),r.remote,t.request(e=>e.remoteAccess.setRemoteAccess({payload:n})).pipe(Kf(()=>Y0(e)),ip(()=>o(c2(e)))))),startUpdate:n=>a(`service-update`,s(l2(e),r.update,t.request(e=>e.serviceUpdates.startServiceUpdate({payload:{version:n}})).pipe(Kf(()=>Y0(e)),ip(()=>o(l2(e))))))}})}var u2=class e extends rr()(`@porcelain/client/AccessCommands`){static layer(t){return Ku(e,wle(t))}},d2=X(e=>e.atoms(t=>td(u2.layer(e),t(J0(e).layer)))),Tle=X(e=>d2(e).fn(e=>u2.use(t=>t.issue(e)).pipe(Yf(mle)),{concurrent:!0})),Ele=X(({connection:e,id:t})=>d2(e).fn(()=>u2.use(e=>e.revoke(t)),{concurrent:!0})),Dle=X(({connection:e,id:t})=>d2(e).fn(e=>u2.use(n=>n.trust({id:t,trusted:e})),{concurrent:!0})),Ole=X(({connection:e,id:t})=>d2(e).fn(e=>u2.use(n=>n.allowWaysIn({id:t,allowed:e})),{concurrent:!0})),kle=X(e=>d2(e).fn(e=>u2.use(t=>t.setRemote(e)),{concurrent:!0})),Ale=X(e=>d2(e).fn(e=>u2.use(t=>t.startUpdate(e)),{concurrent:!0})),jle=X(({connection:e,id:t})=>d2(e).fn(e=>u2.use(n=>n.allowManagement({id:t,allowed:e})),{concurrent:!0})),f2={withIdentity:(e,t)=>[...e,...t.cacheIdentity??[]],worktreeSurface:(e,t,n)=>f2.withIdentity(f2.reviewSurface(e.environmentId,t,n),e),worktreeReads:(e,t,n)=>[f2.environment(e.environmentId),f2.review(e.environmentId,t),f2.reviewSurface(e.environmentId,t,n.slice(0,1)),f2.reviewSurface(e.environmentId,t,n)],connectedInventory:e=>f2.withIdentity(f2.inventory(e.environmentId),e),projectReviews:(e,t)=>[`project-reviews`,e,...t?[t]:[]],durableReview:(e,t)=>[`project-review`,e,t],environment:e=>[`environment`,e],reviewGitSettings:e=>[`review-git-settings`,e],filePreferences:(e,t)=>[`review`,e,t,`file-preferences`],inventory:e=>[`inventory`,e],worktreeInventory:e=>[`worktree-inventory`,e],reviewProject:(e,t)=>[`review`,e,t],review:(e,t)=>[...f2.reviewProject(e,t.projectId),t.worktreeId],reviewSurface:(e,t,n)=>[...f2.review(e,t),...n]},p2=new Set([`changes`,`directory`,`text`,`paths`,`git-status`,`asset`,`html-preview`,`step-lines`]),m2=new Set([`changes`,`git-status`,`paths`,`step-lines`]);function h2(e,t,n,r=Rn(),i=[t,f2.environment(e.environmentId)]){return V(function*(){let a=yield*GW,o=yield*xT,s=yield*LT({epoch:0,result:Hn(r,{onNone:()=>nS(),onSome:e=>iS(e)})}),c=(t=n,r=!1)=>V(function*(){let n=(yield*zT(s)).epoch;yield*UT(s,e=>({...e,result:lS(e.result)}));let i=yield*Jf(t.pipe(Kf(()=>Y0(e))));yield*UT(s,e=>e.epoch===n?{...e,epoch:e.epoch+ +!!r,result:Qx(i,zn(e.result))}:e)});function l(n,r){return a.run(f2.withIdentity(t,e),V(function*(){yield*Y0(e),yield*UT(s,e=>({...e,epoch:e.epoch+1}));let t=yield*n;return yield*Y0(e),yield*UT(s,e=>({epoch:e.epoch+1,result:Hn(r(fS(e.result),t),{onNone:()=>e.result,onSome:e=>iS(e)})})),t}).pipe(wp(o.invalidate([t]))))}return{confirm:l,refresh:e=>V(function*(){yield*UT(s,e=>({...e,epoch:e.epoch+1})),yield*c(e,!0)}),stream:Jae(RT(s).pipe(lT(e=>e.result)),o.stream(i,c()).pipe(Kae))}})}var g2=kr(`@porcelain/client/InventorySeed`,{defaultValue:()=>Rn()}),_2=class e extends rr()(`@porcelain/client/InventoryState`){static layer(t){return Ku(e,V(function*(){let e=yield*g2,n=yield*W0(t),r=e=>Y0(t,e.environmentId===t.environmentId),i=n.request(e=>e.projects.readInventory()),a=yield*h2(t,f2.inventory(t.environmentId),i.pipe(Kf(r)),e,[f2.inventory(t.environmentId),f2.environment(t.environmentId),f2.worktreeInventory(t.environmentId)]);function o(e,t){return a.confirm(e,(e,n)=>Yn(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:H(e)),Kf(r)))}}))}},v2=X(e=>e.atoms(t=>td(_2.layer(e),t(K0(e).layer))));function y2(e){return X(t=>v2(t).fn(n=>V(function*(){let r=yield*W0(t);return yield*(yield*_2).confirm(r.request(t=>e(t.environmentLabel,n)),(e,t)=>({...e,environment:t}))}),{concurrent:!0}))}var Mle=y2((e,t)=>e.renameEnvironment({payload:{name:t}})),Nle=y2((e,t)=>e.setEnvironmentIcon({payload:{icon:t}})),Ple=Jp(`BrowserSession.restore`)(function*(){let e=yield*R0;return{principal:yield*k0(e.session.readSession()),inventory:yield*k0(e.projects.readInventory())}},$f(e=>e instanceof D0&&e.status===401?z(null):H(e instanceof D0||yb(e)?new KW({message:`Could not reach Porcelain to restore this browser session.`,cause:e}):e))),Fle=X(e=>Kce(e).atom(Ple())),b2=`Save or discard unsaved file drafts before disconnecting.`;function x2(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`RequestError`||`_tag`in e)?e.message:`Could not connect to the environment. Try again.`}var S2=class extends rr()(`@porcelain/client/FileDraftWriter`){},Ile=kr(`@porcelain/client/FileDraftTiming`,{defaultValue:()=>({autosave:Fi(Nce),diskNotice:Fi(Pce)})}),C2=class e extends rr()(`@porcelain/client/FileDraft`){static layer(t,n){return Ku(e,V(function*(){let e=yield*S2,r=yield*Ile,i=Ij({text:t.text,savedText:t.text,fingerprint:t.fingerprint,saving:!1,owner:null,error:null,diskChanged:new Set}),a=Ij(!1),o=Ij(null),s=yield*FW(void 0),c=yield*NC(1),l=yield*BD(void 0),u=yield*FW(new Map),d=Ij(new Map),f=e=>i.update(t=>({...t,...e})),p=()=>e.isBlockedError?e.isBlockedError(i.value.error):i.value.error instanceof _J,m=V(function*(){let e=yield*UD(l,void 0);e&&(yield*bS(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*LW(u,t=>{let n=new Map(t);return n.delete(e),[t.get(e),n]});t&&(yield*bS(t)),g(e)}),v=Jp(`FileDraft.save`)(function*(){return yield*c.withPermit(m),yield*yield*RW(s,t=>t?z([vS(t),t]):a.value||p()?z([z(!1),void 0]):i.value.text===i.value.savedText?z([z(!0),void 0]):(f({saving:!0,error:null}),Yf(Lp(V(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=>B(()=>(f({error:Ul(e)}),!1))),wp(Vf.pipe(Gf(zW(s,void 0)),Gf(B(()=>f({saving:!1})))))),n,{startImmediately:!0}),e=>[vS(e),e])))});return yield*Tu(n,B(()=>{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*RW(u,s=>{if(a.value||i.value.saving||i.value.owner!==null||s.has(e)||o.value===t)return z([void 0,s]);f({diskChanged:new Set([...i.value.diskChanged,e])});let c;return Yf(Lp(lp(r.diskNotice).pipe(Gf(BW(u,t=>{if(t.get(e)!==c)return t;let n=new Map(t);return n.delete(e),g(e),n}))),n,{startImmediately:!0}),t=>(c=t,[void 0,new Map(s).set(e,t)]))})}),forgetDiskChange:_,change:Jp(`FileDraft.change`)(function*(e){a.value||i.value.text===e||(f({text:e}),yield*c.withPermit(V(function*(){if(yield*m,a.value)return;let e=yield*Lp(lp(r.autosave).pipe(Gf(HD(l,void 0)),Gf(v()),Qf),n,{startImmediately:!0});yield*HD(l,e)})))}),reset:Jp(`FileDraft.reset`)(function*(e,t){yield*c.withPermit(V(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(B(()=>{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)))}}))}},w2=(e,t)=>`${JSON.stringify([e.projectId,e.worktreeId])}/${t}`,T2=class e extends rr()(`@porcelain/client/FileDrafts`){static layer=Ku(e,V(function*(){let e=yield*yp,t=Ij(new Map),n=Ij(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=w2(t.scope,t.path),a=r(t.environmentId).get(n);if(a)return yield*a.draft.refresh(t.text,t.fingerprint),a.draft;let o=yield*Eu(e),s=Ij(t.path),c=Sr(yield*zu(C2.layer(t,o).pipe(ed(Vu(S2,{...t.writer,write:(e,n)=>t.writer.write({path:s.value,text:e,expectedFingerprint:n})})))).pipe(vp(xu,o)),C2);return i(t.environmentId,new Map(r(t.environmentId)).set(n,{scope:o,draft:c,path:s})),yield*Tu(o,B(()=>i(t.environmentId,new Map([...r(t.environmentId)].filter(([,e])=>e.scope!==o))))),c}),adopt:e=>{n.update(t=>new Map(t).set(e.environmentId,e))},connection:e=>n.value.get(e.environmentId)??e,hasUnsaved:e=>e.some(e=>[...r(e).values()].some(({draft:e})=>e.state.value.saving||e.state.value.text!==e.state.value.savedText)),hasUnsavedWorktree:(e,t)=>[...r(e)].some(([e,{draft:n}])=>e.startsWith(w2(t,``))&&(n.state.value.saving||n.state.value.text!==n.state.value.savedText||n.blocked)),save: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=w2(a,n.path);for(let e of t){let t=o.get(e);if(t){if(s.delete(e),n.kind===`move`){let r=`${n.destination}${e.slice(l.length)}`;t.path.set(r),s.set(w2(a,r),t)}else c.push(t)}}i(e,s),yield*Df(c,e=>Ou(e.scope,lu),{concurrency:`unbounded`,discard:!0})})}}))},E2=X(e=>e.atoms(T2.layer)),Lle=X(e=>E2(e).atom(T2)),Rle=X(e=>e.atoms(t=>Qu(t(W0(e).runtime.layer),T2.layer)).fn(Jp(`BrowserSession.disconnect`)(function*(){let t=yield*T2,n=yield*W0(e);if(!(yield*t.save(e.environmentId)))return yield*H(new KW({message:b2}));yield*n.request(e=>e.browserAccess.clearBrowserSession())},np(e=>e instanceof KW?e:new KW({message:`Could not disconnect. Check the connection and try again.`,cause:e}))))),zle=Jp(`BrowserSession.connect`)(function*(e,t,n,r){let i=yield*C0,a=yield*i.beginConnection(),o=yield*Sp(B(()=>e.set(t,n)),()=>YT(e,t,{suspendOnWaiting:!0}),()=>B(()=>e.set(t,UE))).pipe(cp({duration:r,orElse:()=>Op}),tp(e=>H(new KW({message:x2(Ul(e)),cause:Ul(e)}))));if(a&&(yield*a(o)),i.state.value.connection?.environmentId!==o.inventory.environmentId)return yield*H(new KW({message:`Could not connect to the environment. Try again.`}))}),Ble=Jp(`BrowserSession.restoreConnection`)(function*(e,t){let n=yield*C0;if(n.state.value.connection)return!0;let r=yield*n.beginConnection(!0);if(!r)return!1;let i=e.get(t);aS(i)&&!i.waiting&&e.refresh(t);let a=yield*YT(e,t,{suspendOnWaiting:!0});return a!==null&&(yield*r(a),n.state.value.connection!==null)}),D2=class e extends rr()(`@porcelain/client/EnvironmentMutations`){static layer=Ku(e,V(function*(){let e=yield*NC(1),t=Ij(0);return{pendingSelections:t,run:(n,r)=>Sp(B(()=>{n===`selection`&&t.update(e=>e+1)}),()=>e.withPermit(r),()=>B(()=>{n===`selection`&&t.update(e=>e-1)}))}}))},O2=class extends rr()(`@porcelain/client/WorkspaceSelectionCleanup`){},Vle=V(function*(){let e=yield*b0,t=yield*HW,n=yield*D2,r=yield*T2,i=yield*O2;return{read:Jp(`Environments.read`)(()=>n.run(`access`,e.load())),pair:Jp(`Environments.pair`)(r=>n.run(`access`,V(function*(){return r.localEnvironmentId&&M0(r.value)?.environmentId===r.localEnvironmentId?yield*H(new KW({message:`That link is for this computer.`})):yield*$ce(r.value,r.environmentId).pipe(vp(b0,e),vp(HW,t))}))),route:Jp(`Environments.route`)(t=>n.run(`access`,V(function*(){if(!(yield*r.save(t.environmentId)))return yield*H(new KW({message:b2}));yield*e.route(t)}))),forget:Jp(`Environments.forget`)(t=>n.run(`selection`,V(function*(){if(!(yield*r.save(t)))return yield*H(new KW({message:b2}));yield*V(function*(){yield*e.forget(t),yield*i.forgetEnvironment(t),yield*r.drop(t)}).pipe(jp)})))}}),k2=class e extends rr()(`@porcelain/client/EnvironmentCommands`){static layer=Ku(e,Vle)};function A2(e){return e.kind===`service`?e.state.managed&&e.state.available&&e.state.latest!==void 0:e.available&&e.latest!==void 0}function Hle(e,t){return t.running||e.some(A2)}function j2(e){if(e.kind===`mac-app`)return A2(e)?e.latest:void 0;let{state:t}=e;return A2(e)&&t.managed&&t.canUpdate&&!t.running?t.latest:void 0}function Ule(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 Wle(e){let t=new Set;for(let n of e)j2(n)!==void 0&&t.add(`${n.kind}:${n.id}`);return t.size}function Gle(e){let t=e.entries.findIndex(e=>e.status===`updating`);return{total:e.entries.length,current:t<0?void 0:t+1,label:t<0?void 0:`Updating ${t+1} of ${e.entries.length}`}}var M2=EE({running:!1,entries:[]}).pipe(XE),N2=class extends Y()(`SettingsUpdateError`,{message:G}){},Kle=Jp(`updateSettingsTarget`)(function*(e,t,n){if(e.kind===`mac-app`)return yield*e.update(t);let r=Ale(e.connection),i=n.mount(r);yield*Cp(()=>B(i)),n.set(r,t),yield*YT(n,r,{suspendOnWaiting:!0});let a=yield*JT(n,l2(e.connection)).pipe(lT(e=>{if(aS(e)){let t=Ul(e.cause);return t instanceof D0&&(t.status===401||t.status===403)?zn({status:`failed`,message:`Could not confirm the update: access to this computer was denied (${t.status}). Pair or trust this device again.`}):Rn()}if(!rS(e))return Rn();let n=e.value;return n.managed?n.running?Rn():n.version===t?zn({status:`updated`}):n.last?.target===t&&n.last.stage===`failed`?zn({status:`failed`,message:n.last.reason??`The updater gave no reason.`}):Rn():zn({status:`failed`,message:`This computer no longer runs the managed service.`})}),mT(Vn),lT(e=>e.value),_T);if(Bn(a))return yield*new N2({message:`The update stopped before completion.`});if(a.value.status===`failed`)return yield*new N2({message:a.value.message})}),qle=WE((e,t)=>V(function*(){let n=t.registry;if(n.get(M2).running)return;let r=[],i=new Set;for(let t of e){let e=j2(t),n=`${t.kind}:${t.id}`;e===void 0||i.has(n)||(i.add(n),r.push({target:t,version:e}))}if(r.sort((e,t)=>Number(e.target.kind===`mac-app`)-Number(t.target.kind===`mac-app`)),r.length===0)return;let a=r.map(({target:e,version:t})=>({id:e.id,name:e.name,kind:e.kind,version:t,status:`queued`})),o=e=>n.set(M2,{running:e,entries:a});o(!0),yield*V(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(Kle(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(B(()=>{a=a.map(e=>e.status===`queued`||e.status===`updating`?{...e,status:`failed`,message:`The update was interrupted.`}:e),o(!1)})))}),{concurrent:!0}).pipe(XE),P2=cj(jce).live.liveUpdates,Jle=cj(Gq).pairing.redeemPairing,F2=new Set;function Yle(e){return F2.add(e),()=>F2.delete(e)}function I2(){for(let e of[...F2])e()}function L2(e,t={}){return async(n,r)=>{let i=new Headers(r?.headers);i.delete(`authorization`),i.set(`x-porcelain-browser`,`1`);let a=await e(n,{...r,headers:i,credentials:`same-origin`});return a.status===401&&n!==Jle()&&t.reportUnauthorized!==!1&&I2(),a}}var R2=X(e=>v2(e).atom(cT(Yf(_2,e=>e.stream))).pipe($E(e=>gS(e,e=>e)),gE(0)));X(e=>CE(t=>e.map(e=>({connection:e,result:t(R2(e))}))));var Xle=class extends rr()(`@porcelain/client/ProjectSelectionStorage`){},z2=class e extends rr()(`@porcelain/client/ProjectSelectionStore`){static layer=Ku(e,V(function*(){let e=yield*Xle,t=yield*qW({initial:{currentEnvironmentId:void 0,selections:{}},read:e.read,write:e.write,messages:{beforeRead:`Saved workspace selections must be read before changing them.`,readFailed:`Saved workspace selections could not be read. Try reading them again.`,writeFailed:`Saved workspace selections could not be updated. Read them again before making changes.`}}),n=t.write;return{state:t.state,load:t.load,selectEnvironment:Jp(`ProjectSelectionStore.selectEnvironment`)(e=>n(({selections:t})=>z({currentEnvironmentId:e,selections:t}))),selectWorkspace:Jp(`ProjectSelectionStore.selectWorkspace`)((e,t,r)=>n(({selections:n})=>z({currentEnvironmentId:e,selections:{...n,[e]:{projectId:t,worktreeId:r}}}))),forgetEnvironment:Jp(`ProjectSelectionStore.forgetEnvironment`)(e=>n(({currentEnvironmentId:t,selections:n})=>z({currentEnvironmentId:t===e?void 0:t,selections:Object.fromEntries(Object.entries(n).filter(([t])=>t!==e))})))}}))},B2={projects:void 0,environments:void 0,reviews:void 0,older:!1};function Zle(e,t){return Number(t.main)-Number(e.main)||Number(t.headCommittedAt!==void 0)-Number(e.headCommittedAt!==void 0)||(t.headCommittedAt??``).localeCompare(e.headCommittedAt??``)||e.name.localeCompare(t.name)||e.key.localeCompare(t.key)}function V2(e){return e.state===`none`?`No review`:e.state===`loading`?`Reading review…`:e.state===`unavailable`?`Review unavailable`:e.archived?`Archived review`:e.closed?`Closed review`:e.retained?`Retained review`:e.progressUnavailable?`Review · progress unavailable`:e.progress?`Review · ${e.progress.reviewed}/${e.progress.total} decisions`:`Review · reading progress…`}function Qle(e){return e.state===`loading`?`Reading changes…`:e.state===`unavailable`?`Changes unavailable`:e.count===0?`Working tree clean`:`${e.count} ${e.count===1?`file`:`files`} changed`}function H2(e){return e.review.state===`none`?``:V2(e.review).replace(`Review · `,``)}function U2(e){if(e.state!==`available`)return;let t=e.summary;return t?.state===`available`&&(t.additions||t.deletions||t.binaryFiles)?t:void 0}function $le(e){if(e.state===`loading`)return`Reading changes…`;if(e.state===`unavailable`)return`Changes unavailable`;let t=U2(e);if(t){let e=t.binaryFiles?` · ${t.binaryFiles} binary`:``;return`+${t.additions} −${t.deletions}${e}`}return e.count===0?``:`${e.count} ${e.count===1?`file`:`files`}`}function eue(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 tue(e){return[e.name,e.projectName,e.environmentName,e.main?`Main worktree`:void 0,e.detached?`Detached HEAD`:void 0,e.detached?e.path:void 0,V2(e.review),e.kind===`worktree`?Qle(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 nue(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 rue(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 iue(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 aue(e,t){let n=new Map(e.map(e=>[e.environmentId,{...e,failures:e.failures.filter(({entry:e})=>!t.recoveredKeys.includes(e.key)&&(!t.environments.includes(e.environmentId)||t.inventoryKeys.includes(e.key)))}]));for(let e of t.issues){let t=n.get(e.environmentId),r=new Map((t?.failures??[]).map(e=>[e.entry.key,e]));for(let t of e.failures)r.set(t.entry.key,t);n.set(e.environmentId,{...e,dismissed:t?.dismissed??!1,failures:[...r.values()]})}let r=[...n.values()].filter(e=>e.failures.length>0);return JSON.stringify(r)===JSON.stringify(e)?e:r}var W2=EE({query:``,filter:B2,expanded:{}}).pipe(XE),G2=EE([]).pipe(XE);function oue(e){return V(function*(){let t=yield*W0(e),n=yield*_2,r=yield*T2;return{register:e=>n.confirm(t.request(t=>t.projects.registerProject({payload:{path:e}})),(e,t)=>({...e,projects:e.projects.some(e=>e.id===t.id)?e.projects.map(e=>e.id===t.id?t:e):[...e.projects,t]})),rename:e=>n.confirm(t.request(t=>t.projects.renameProject({params:{projectId:e.projectId},payload:{name:e.name}})),(e,t)=>({...e,projects:e.projects.map(e=>e.id===t.id?{...e,name:t.name}:e)})),remove:i=>n.confirm(V(function*(){let n=`[${JSON.stringify(i)},`;for(let[t,i]of r.entries(e))if(t.startsWith(n)&&!(yield*i.save()))return yield*H(new KW({message:`Save or discard unsaved file drafts before removing this project.`}));return yield*t.request(e=>e.projects.removeProject({params:{projectId:i}}))}),e=>({...e,projects:e.projects.filter(e=>e.id!==i)}))}})}var K2=class extends rr()(`@porcelain/client/ProjectCommands`){},q2=X(e=>e.atoms(t=>td(Ku(K2,oue(e)),Qu(t(v2(e).layer),T2.layer)))),sue=X(e=>q2(e).fn(e=>K2.use(t=>t.register(e)),{concurrent:!0})),cue=X(e=>q2(e).fn(e=>K2.use(t=>t.rename(e)),{concurrent:!0})),lue=X(e=>q2(e).fn(e=>K2.use(t=>t.remove(e)),{concurrent:!0})),J2=X(e=>v2(e).fn(e=>_2.use(e=>e.refresh()),{concurrent:!0})),uue=X(e=>wE(t=>e.map(e=>t(J2(e))),(t,n)=>{for(let n of e)t.set(J2(n),void 0)})),Y2=class e extends rr()(`@porcelain/client/FilePreferencesState`){static layer(t,n){return Ku(e,V(function*(){let e=yield*W0(t);return yield*h2(t,f2.filePreferences(t.environmentId,n),e.request(e=>e.projects.listFilePreferences({params:{projectId:n}})))}))}},X2=X(({connection:e,projectId:t})=>e.atoms(n=>td(Y2.layer(e,t),n(K0(e).layer)))),due=X(({connection:e,projectId:t})=>X2({connection:e,projectId:t}).fn(n=>V(function*(){let r=yield*W0(e);return yield*(yield*Y2).confirm(r.request(e=>e.projects.setFilePreference({params:{projectId:t},payload:n})),(e,t)=>zn(t))}),{concurrent:!0})),Z2=class e extends rr()(`@porcelain/client/ReadSubscriptions`){static layer=Ku(e,V(function*(){let e=yield*LT(th());return{snapshot:zT(e),changes:RT(e),reviewsFor:Jp(`ReadSubscriptions.reviewsFor`)(function*(t){let n=yield*zT(e);return[...new Set([...rh(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(V(function*(){let n=Symbol();return yield*UT(e,nh(n,t)),n}),t=>UT(e,ih(t)))})}}))};function Q2(e,t,n,r,i,a=[]){let o=e4(e,t,n,i.atom(i=>V(function*(){yield*(yield*Z2).retain({...t,paths:a,surface:String(n[0]),settled:YT(i.registry,o,{suspendOnWaiting:!0}).pipe(ap,Qf)});let s=yield*r;return yield*Y0(e),s})));return o}function $2(e){let t=EE(nS()).pipe(XE),n=e.pipe(YE(t));return ZE(n,r=>{let i=r(e);return rS(i)&&r.once(t)!==i&&r.set(t,i),r(n)}).pipe(gE(0))}function fue(e,t,n,r,i){let a=e4(e,t,n,i.pull(e=>cT(V(function*(){return yield*(yield*Z2).retain({...t,paths:[],surface:String(n[0]),settled:YT(e.registry,a,{suspendOnWaiting:!0}).pipe(ap,Qf)}),typeof r==`function`?r(e):r}))));return a}function e4(e,t,n,r){return r.pipe(e.atoms.withReactivity(f2.worktreeReads(e,t,n)),gE(0))}function t4(e,t,n,r){let i=r.atom(r=>cT(V(function*(){return yield*(yield*Z2).retain({...e,paths:[],surface:t,settled:YT(r.registry,i,{suspendOnWaiting:!0}).pipe(ap,Qf)}),(yield*n).stream}))).pipe($E(e=>gS(e,e=>e)),gE(0));return i}function n4(e,t,n,r=()=>!0,i=[]){return Q2(e.connection,e.scope,t,G0(e.connection,n).pipe(Kf(t=>Y0(e.connection,r(t)))),K0(e.connection),i)}var pue=X(e=>X2(e).atom(cT(Yf(Y2,e=>e.stream))).pipe($E(e=>gS(e,e=>e)),gE(0),$2)),mue=X(({connection:e,path:t})=>K0(e).atom(V(function*(){return yield*(yield*W0(e)).request(e=>e.projects.browseProjectFolders({query:t===void 0?{}:{path:t}}))})));function hue(e,t){return mue({connection:e,path:t})}K({currentEnvironmentId:U(_G),selections:Ub(G,K({projectId:_G,worktreeId:vG})).check(Nie(_G))});var gue=V(function*(){let e=yield*b0,t=yield*z2,n=yield*D2;return{pending:n.pendingSelections,execute:Jp(`WorkspaceSelection.execute`)(r=>n.run(`selection`,V(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*H(new KW({message:`That environment is no longer paired. Open the workspace picker again.`}));if(r.kind===`environment`){yield*t.selectEnvironment(r.environmentId);return}yield*t.selectWorkspace(r.environmentId,r.projectId,r.worktreeId)})))}});(class e extends rr()(`@porcelain/client/ProjectSelectionCommands`){static layer=Ku(e,gue)});var _ue=X(e=>WE((t,n)=>V(function*(){let r=yield*n.setResult(sue(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(O2,Yf(z2,e=>({forgetEnvironment:e.forgetEnvironment})));var r4=Jp(`Changes.readSnapshot`)(function*({connection:e,scope:t}){let n=yield*G0(e,e=>e.changes.readChanges({params:{worktreeId:t.worktreeId}}));return yield*Y0(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),vue=X(e=>Q2(e.connection,e.scope,[`changes`],r4(e),K0(e.connection)).pipe($2)),i4=Jp(`Changes.readGitStatusSnapshot`)(function*({connection:e,scope:t}){let n=yield*G0(e,e=>e.changes.readGitStatus({params:{worktreeId:t.worktreeId}}));return yield*Y0(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),a4=X(e=>Q2(e.connection,e.scope,[`git-status`],i4(e),K0(e.connection)).pipe($2)),o4=X(e=>Q2(e.connection,e.scope,[`git-status`],V(function*(){let t=yield*G0(e.connection,t=>t.changes.readWorktreeSummary({params:{worktreeId:e.scope.worktreeId}}));return yield*Y0(e.connection,t.environmentId===e.connection.environmentId&&t.worktreeId===e.scope.worktreeId),t}),K0(e.connection)).pipe($2)),s4=class e extends rr()(`@porcelain/client/CommentThreadsState`){static layer(t,n){return Ku(e,V(function*(){let e=yield*W0(t);return yield*h2(t,f2.reviewSurface(t.environmentId,n,[`comments`]),V(function*(){let r=yield*e.request(e=>e.reviews.listCommentThreads({params:{worktreeId:n.worktreeId}}));if(yield*Y0(t,r.every(e=>e.worktreeId===n.worktreeId||e.review!==void 0)),r.some(e=>e.worktreeId!==n.worktreeId)){let{review:i}=yield*e.request(e=>e.reviews.readPublishedReview({params:{worktreeId:n.worktreeId}}));yield*Y0(t,i?.environmentId===t.environmentId&&i.worktreeId===n.worktreeId&&r.every(e=>e.worktreeId===n.worktreeId||e.review?.reviewId===i.reviewId))}return yield*Y0(t),r}),Rn(),f2.worktreeReads(t,n,[`comments`]))}))}},c4=X(({connection:e,scope:t})=>e.atoms(n=>td(s4.layer(e,t),n(K0(e).layer)))),yue=X(e=>EE({snapshot:``,filters:new Set,through:0})),bue=X(e=>t4(e.scope,`comments`,s4,c4(e)).pipe($2));function l4({connection:e,scope:t}){return bue({connection:e,scope:t})}function u4(e,t,n=()=>!0,r={}){return K0(e).atom(r=>{let i=Xn(r.self(),fS);return V(function*(){let r=yield*G0(e,e=>t(e,i));return yield*Y0(e,n(r)),r})}).pipe(e.atoms.withReactivity([f2.environment(e.environmentId),...r.inventory===!1?[]:[f2.inventory(e.environmentId)]]),gE(0))}function d4(e,t=!1){return n=>{let r=n.pipe(e.connection.atoms.withReactivity([f2.durableReview(e.connection.environmentId,e.reviewId)]));return ZE(r,n=>(t&&n.mount(m4(e)),n(r)))}}function f4(e,t){return(e.revision===void 0?t.reviews.readReview({params:{reviewId:e.reviewId}}):t.reviews.readReviewRevision({params:{reviewId:e.reviewId,revision:e.revision}})).pipe(ep(`ReviewNotFoundError`,()=>z({review:void 0,revisions:[],revision:void 0})))}function p4(e,t){return(t.review===void 0||t.review.reviewId===e.reviewId)&&(t.revision===void 0||(e.revision===void 0||t.revision.revision===e.revision)&&t.revision.content.environmentId===e.connection.environmentId)}var m4=X(e=>{let t=EE(Rn()).pipe(XE),n=u4(e.connection,(n,r)=>V(function*(){let i=yield*qT,a=Gn(i.get(t));if(Bn(r)&&a?.review&&a.revision){let n=(yield*YT(i,h4({connection:e.connection,projectId:a.review.projectId}),{suspendOnWaiting:!0})).find(t=>t.reviewId===e.reviewId);if(n&&n.latestRevision===a.review.latestRevision){let e={...a,review:n};return i.set(t,zn(e)),e}}let o=yield*f4(e,n);return yield*Y0(e.connection,p4(e,o)),i.set(t,zn(o)),o}),t=>p4(e,t)).pipe(e.connection.atoms.withReactivity([f2.durableReview(e.connection.environmentId,e.reviewId)]),gE(0)),r=K0(e.connection).atom(t=>V(function*(){let r=t(n),i=Gn(fS(r)),a=yield*Z2,o={reviewId:e.reviewId,surface:`review`,settled:YT(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($E(e=>gS(e,e=>e)),gE(0)),i=$E(t,e=>Vn(e)?iS(e.value):nS());return ZE(n,e=>e(r)).pipe(YE(i),gE(0))}),h4=X(e=>{let t=u4(e.connection,t=>t.reviews.listProjectReviews({params:{projectId:e.projectId}}),t=>t.every(t=>t.projectId===e.projectId)).pipe(e.connection.atoms.withReactivity([f2.projectReviews(e.connection.environmentId,e.projectId)]));return ZE(t,n=>{let r=n(t),i=Gn(fS(r)),a=e.connection.runtime.runSync(xT);return n.addFinalizer(a.registerUnsafe(i?i.map(t=>f2.durableReview(e.connection.environmentId,t.reviewId)):[f2.projectReviews(e.connection.environmentId)],()=>n.refresh(t))),r}).pipe($2)}),g4=X(e=>u4(e.connection,t=>t.reviews.listReviewMarks({params:{reviewId:e.reviewId}})).pipe(d4(e,!0),$2)),xue=X(e=>u4(e.connection,t=>t.reviews.readReviewAgentFeedback({params:{reviewId:e.reviewId}})).pipe(d4(e,!0),$2)),Sue=X(e=>u4(e.connection,t=>t.reviews.listReviewCommentThreads({params:{reviewId:e.reviewId}}),t=>t.every(t=>t.review?.reviewId===e.reviewId)).pipe(d4(e,!0))),Cue=X(e=>{let t=Sue({connection:e.connection,reviewId:e.reviewId});if(!e.worktree)return t;let n=l4({connection:e.connection,scope:e.worktree});return CE(e=>{let r=e(t),i=e(n),a=aS(i)?Gn(Gl(i.cause)):void 0,o=a&&`_tag`in a&&(a._tag===`WorktreeUnavailableError`||a._tag===`WorktreeNotFoundError`||a._tag===`ProjectNotFoundError`)?iS(Un(fS(i),()=>[])):i;return gS(r,e=>hS(o,t=>[...e,...t.filter(e=>e.review===void 0)]))}).pipe(gE(0))}),wue=X(e=>u4(e.connection,t=>t.reviews.readReviewFile({params:{reviewId:e.reviewId,revision:e.revision},query:{path:e.path}}))),Tue=X(e=>u4(e.connection,t=>Df(Eee(e.paths,200),n=>t.reviews.readReviewDiffs({params:{reviewId:e.reviewId,revision:e.revision},payload:{paths:n}}),{concurrency:1}).pipe(Yf(e=>({diffs:e.flatMap(e=>e.diffs)}))))),Eue=X(e=>u4(e.connection,t=>t.reviews.readReviewProofFile({params:{reviewId:e.reviewId,revision:e.revision},query:{proofId:e.proofId}}),t=>t.id===e.proofId));X(e=>u4(e.connection,t=>t.reviews.compareReview({params:{reviewId:e.reviewId},query:{from:e.from,to:e.to}}),t=>t.reviewId===e.reviewId&&(e.from===void 0||t.from===e.from)&&(e.to===void 0||t.to===e.to)).pipe(d4(e))),X(e=>u4(e.connection,t=>t.reviews.readReviewInterdiff({params:{reviewId:e.reviewId},query:{from:e.from,to:e.to,path:e.path}}),t=>t.kind===`unavailable`||t.path===e.path&&(e.from===void 0||t.from===e.from)&&(e.to===void 0||t.to===e.to)).pipe(d4(e)));var Due=X(e=>u4(e.connection,t=>t.reviews.readReviewPullRequest({params:{reviewId:e.reviewId}})).pipe(d4(e,!0))),Oue=X(e=>u4(e.connection,t=>t.reviews.listProjectPullRequests({params:{projectId:e.projectId}})).pipe(e.connection.atoms.withReactivity([f2.projectReviews(e.connection.environmentId),f2.projectReviews(e.connection.environmentId,e.projectId)]))),kue=X(e=>u4(e.connection,t=>t.reviews.readProjectGitHubAccount({params:{projectId:e.projectId}})).pipe($2)),Aue=X(e=>K0(e.connection).atom(V(function*(){let t={connection:e.connection,reviewId:e.reviewId},n=yield*G0(e.connection,e=>f4(t,e));return yield*Y0(e.connection,p4(t,n)),!n.review||n.review.lastSeenRevision>=e.revision?{updated:!1}:yield*G0(e.connection,t=>t.reviews.setReviewSeen({params:{reviewId:e.reviewId},payload:{revision:e.revision}}))})).pipe(e.connection.atoms.withReactivity([f2.environment(e.connection.environmentId)]),XE)),_4=X(e=>u4(e.connection,t=>t.reviews.readReviewPullChecks({params:{reviewId:e.reviewId}}),void 0,{inventory:!1}).pipe(d4(e),$2));function v4(e,t){return e?.some(e=>e.layerId===t.id&&e.fingerprint===t.fingerprint)===!0}function jue({revision:e,marks:t,status:n,pull:r}){let i=e?.content.layers??[],a=i.filter(e=>v4(t?.decisions,e)).length,o=i.length,s=t!==void 0&&o>0&&a===o,c=n===`replied`,l=Mue(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 Mue(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 Nue(e,t){return e.archived===!0||e.state===`closed`||t?.kind===`available`&&t.pullRequest!==void 0&&t.pullRequest.state!==`open`}function Pue(e,t){return e.archived!==!0&&t?.kind===`available`&&t.pullRequest!==void 0&&t.pullRequest.state!==`open`}function Fue(e,t,n){return n?.trim()||t?.verdict.asked.text.trim()||e.branch}function Iue(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 Lue(e,t){return e===void 0&&t?.kind===`unavailable`&&t.reason===`not-github`}function Rue(e){let t=/^https:\/\/github\.com\/([a-zA-Z0-9_.-]+)\/([a-zA-Z0-9_.-]+)\/pull\/([1-9][0-9]*)(?:\/[^?#]*)?(?:[?#].*)?$/.exec(e.trim());return t?`https://github.com/${t[1]}/${t[2]}/pull/${t[3]}`:void 0}function y4(e,t,n=`${t}s`){return e===1?t:n}function b4(e,t,n=`${t}s`){return`${e} ${y4(e,t,n)}`}function zue(e){return e.matchesReviewHead?`Same head as the review`:`Different head from the review`}function x4(e){return e.state===`open`&&e.draft?`draft`:e.state}var Bue={open:`Open`,draft:`Draft`,merged:`Merged`,closed:`Closed`};function Vue(e){return Bue[x4(e)]}var Hue=new Set([`FAILURE`,`ERROR`,`CANCELLED`,`TIMED_OUT`,`ACTION_REQUIRED`,`STARTUP_FAILURE`,`STALE`]);function S4(e){return e.status!==`COMPLETED`||e.conclusion===`EXPECTED`?`running`:Hue.has(e.conclusion??``)?`failed`:`passed`}function Uue(e,t,n){let r=`${e.length}${t?`+`:``}`;if(t){let e=C4(n);return e.tone===`none`?{tone:`none`,label:`${r} checks listed · result incomplete`,short:`Checks incomplete`}:{tone:e.tone,label:e.label,short:e.label}}if(e.length===0)return{tone:`none`,label:`No checks`,short:`No checks`};let i=b4(e.length,`check`),a=e.filter(e=>S4(e)===`failed`);if(a.length>0)return{tone:`failed`,label:`${a.length} of ${i} failed`,short:`${a.length} failed`};let o=e.filter(e=>S4(e)===`running`);return o.length>0?{tone:`running`,label:`${o.length} of ${i} running`,short:`${o.length} running`}:{tone:`passed`,label:`${i} passed`,short:i}}function Wue(e){return S4(e)}function C4(e){return e===`SUCCESS`?{tone:`passed`,label:`Checks passing`}:e===`FAILURE`||e===`ERROR`?{tone:`failed`,label:`Checks failing`}:e===`PENDING`||e===`EXPECTED`?{tone:`running`,label:`Checks running`}:{tone:`none`,label:`No checks`}}function Gue(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 Kue(e){return e===`MERGEABLE`?{label:`No conflicts`,tone:`passed`}:e===`CONFLICTING`?{label:`Conflicts`,tone:`failed`}:{label:`Not known yet`,tone:`none`}}function que(e){if(e===`APPROVED`)return{label:`Approved`,tone:`passed`};if(e===`CHANGES_REQUESTED`)return{label:`Changes requested`,tone:`failed`};if(e===`DISMISSED`)return{label:`Dismissed`,tone:`none`}}function w4(e){let t=/\/pull\/([1-9][0-9]*)$/.exec(e);return t?Number(t[1]):void 0}function Jue(e){return/^https:\/\/github\.com\/([^/]+\/[^/]+)\/pull\//.exec(e)?.[1]}function Yue(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 Xue(e){if(e===void 0)return;let t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Zue(e){let t=new Set(e.filter(e=>e.kind===`review`).map(e=>e.id));return e.filter(e=>e.kind!==`review-comment`||e.reviewId===void 0||!t.has(e.reviewId)).map(t=>({item:t,comments:t.kind===`review`?e.filter(e=>e.kind===`review-comment`&&e.reviewId===t.id):[]}))}function T4(e){return e??`Detached HEAD`}function Que(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 $ue(e){let t=e.projects.flatMap(e=>e.worktrees);return t.find(e=>e.available&&!e.main)??t.find(e=>e.available)}function ede(e){return e.projects.flatMap(e=>e.worktrees).find(e=>e.available&&(e.status===`replied`||e.status===`pending`))??$ue(e)}function tde(e){return e.worktrees.find(e=>e.main)?.path??e.worktrees[0]?.path??``}function nde(e){switch(e.unavailableReason){case`moved`:return`Porcelain doesn't recognise this repository as the one it registered. Remove the project and add it again.`;case`missing`:return`The repository folder is missing.`;case`permission`:return`Porcelain cannot read this repository because access is denied.`;case`git-failed`:return`Git could not read this repository.`;default:return`Porcelain can't reach this repository right now.`}}function rde(e){return e.progressUnavailable?`unavailable`:e.progress?e.progress.reviewed<e.progress.total?`needs-you`:`reviewed`:`reading`}function ide(e){let t=e.flatMap(e=>e.review.state===`available`&&!e.review.archived&&(!e.review.closed||e.review.timing===`record`)?[{key:e.key,entry:e,review:e.review,status:rde(e.review),label:H2(e)}]:[]),n=new Map;for(let e of t){if(e.status===`needs-you`||e.review.timing===`record`)continue;let t=`${e.entry.environmentId}/${e.entry.projectId}`,r=n.get(t);n.set(t,{key:t,name:e.entry.projectName,environmentName:e.entry.environmentName,rows:[...r?.rows??[],e]})}return{needsYou:t.filter(e=>e.status===`needs-you`&&e.review.timing!==`record`),landed:t.filter(e=>e.review.timing===`record`),projects:[...n.values()].sort((e,t)=>e.name.localeCompare(t.name)||e.environmentName.localeCompare(t.environmentName)||e.key.localeCompare(t.key)),reading:e.some(e=>e.review.state===`loading`)}}var ade=LK.literals,E4={desktop:`Desktop`,laptop:`Laptop`,server:`Server`,cloud:`Cloud`},D4=`desktop`;function O4(e){return e.icon??D4}function ode(e){return e===D4?null:e}function k4(e){return{state:`available`,timing:e.timing??`decision`,reviewId:e.reviewId,closed:e.state===`closed`||e.archived===!0,archived:e.archived===!0,pullRequestNumber:e.pullRequest?w4(e.pullRequest):void 0,progress:void 0}}function sde(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??Iue(e.path).name,branch:T4(e.branch),main:e.main,...e.headCommittedAt?{headCommittedAt:e.headCommittedAt}:{},detached:!e.branch,available:t.available&&e.available,review:{state:`loading`},changes:{state:t.available&&e.available?`loading`:`unavailable`}})).sort(Zle)}var A4=X(e=>CE(t=>{let n=t(R2(e.connection)),r=Gn(fS(n)),i=r?.projects.find(t=>t.id===e.projectId);if(!r||!i)return{entries:[],messages:[]};let a=aS(n)?{...i,available:!1}:i,o=r.environment.name,s=sde({...e,project:a,environmentName:o}),c=t(h4({connection:e.connection,projectId:a.id})),l=Gn(fS(c)),u=[],d=(l??[]).filter(e=>(e.state===`open`||e.timing===`record`)&&!e.archived),f=new Set(s.map(e=>e.branch)),p=d.filter(e=>f.has(e.branch)).map(n=>{let r=t(m4({connection:e.connection,reviewId:n.reviewId}));return{record:n,result:r,revision:Gn(fS(r))?.revision}}).sort((e,t)=>(t.revision?.publishedAt??``).localeCompare(e.revision?.publishedAt??``)||e.record.reviewId.localeCompare(t.record.reviewId));aS(c)&&u.push(`Reviews for ${a.name} could not be read.`);let m=new Map,h=new Set,g=new Set;for(let e of p){eS(e.result)&&h.add(e.record.branch),(aS(e.result)||!e.revision)&&g.add(e.record.branch);let t=e.revision;if(!t||t.projectId!==a.id)continue;let n=JSON.stringify([t.worktreePath,t.content.worktreeId]);m.has(n)||m.set(n,e)}let _=new Set;for(let n of s){if(aS(c)){n.review={state:`unavailable`};continue}if(!l)continue;let r=m.get(JSON.stringify([n.path,n.worktreeId]));if(!r){g.has(n.branch)&&!h.has(n.branch)&&u.push(`Review for ${n.name} on ${o} could not be read.`),n.review={state:`none`},g.has(n.branch)&&(n.review={state:`unavailable`}),h.has(n.branch)&&(n.review={state:`loading`});continue}_.add(r.record.reviewId);let i=t(g4({connection:e.connection,reviewId:r.record.reviewId})),a=Gn(fS(i));aS(i)&&u.push(`Progress for ${n.name} on ${o} could not be read.`);let s=r.revision?.content.layers;n.review={...k4(r.record),...a&&s&&!aS(i)?{progress:{reviewed:s.filter(e=>v4(a.decisions,e)).length,total:s.length}}:{},progressUnavailable:aS(i)}}if(l!==void 0)for(let t of l??[]){if(_.has(t.reviewId)||!e.older&&(t.archived||t.state===`closed`&&t.timing!==`record`))continue;let n=p.find(e=>e.record.reviewId===t.reviewId)?.revision;s.push({key:`${e.connection.environmentId}/${t.reviewId}`,kind:`review`,environmentId:e.connection.environmentId,environmentName:o,projectId:a.id,projectName:a.name,worktreeId:s.find(e=>n?.worktreePath===e.path)?.worktreeId,path:n?.worktreePath,name:t.branch,branch:t.branch,main:!1,detached:t.branch===`Detached HEAD`,available:!0,review:{...k4(t),retained:!0},changes:{state:`unavailable`}})}return{entries:s,messages:u}}).pipe(gE(0))),cde=X(e=>CE(t=>{let n=t(A4(e)),r=[];return{entries:n.entries.map(n=>{let i={...n};if(i.available&&i.worktreeId){let n=t(a4({connection:e.connection,scope:{projectId:i.projectId,worktreeId:i.worktreeId}})),a=Gn(fS(n));aS(n)&&r.push({entry:i,detail:Gn(Gl(n.cause))?.message}),i.changes=aS(n)?{state:`unavailable`}:a?{state:`available`,count:new Set(a.changes.map(e=>e.scope===`untracked`||e.scope===`unmerged`?e.path:e.newPath??e.oldPath)).size}:{state:`loading`}}return i}),messages:n.messages,statusFailures:r}}).pipe(gE(0)));function j4(e,t){let n=t.map(t=>{let n=e(R2(t));return{connection:t,result:n,inventory:Gn(fS(n))}});return{reads:n,loading:n.some(({result:e})=>eS(e)),messages:n.flatMap(({result:e,inventory:t})=>aS(e)?[`${t?.environment.name??`Computer`}: projects could not be read.`]:[])}}var M4=X(e=>CE(t=>{let n=t(W2),r=[],i=[],a=[],o=[],s=j4(t,e),c=[...s.messages];for(let{connection:e,result:t,inventory:i}of s.reads){rS(t)&&a.push(e.environmentId);for(let a of i?.projects??[]){let o=aS(t)?{...a,available:!1}:a,s=`${e.environmentId}/${o.id}`;r.push({key:s,connection:e,project:o,environmentName:i.environment.name,environmentIcon:O4(i.environment),expanded:n.query.trim().length>0||n.expanded[s]!==!1,entries:[]})}}r.sort((e,t)=>e.project.name.localeCompare(t.project.name)||e.environmentName.localeCompare(t.environmentName)||e.key.localeCompare(t.key));let l=iue(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(cde({connection:e.connection,projectId:e.project.id,older:n.filter.older}));if(i.push(...r.entries),c.push(...r.messages),r.statusFailures.length>0){let t=o.find(t=>t.connection.environmentId===e.connection.environmentId);t?t.failures.push(...r.statusFailures):o.push({connection:e.connection,environmentName:e.environmentName,failures:[...r.statusFailures]})}let a=r.entries.filter(e=>rue(e,n.query,n.filter)).map(e=>({...e,review:{...e.review},changes:{...e.changes}}));for(let n of a){if(n.changes.state===`available`&&n.worktreeId){if(n.changes.count===0)n.changes.summary={state:`available`,additions:0,deletions:0,binaryFiles:0};else{let r=t(o4({connection:e.connection,scope:{projectId:n.projectId,worktreeId:n.worktreeId}})),i=Gn(fS(r));n.changes.summary={state:`loading`},aS(r)?n.changes.summary={state:`unavailable`}:i&&(n.changes.summary={state:`available`,additions:i.additions,deletions:i.deletions,binaryFiles:i.binaryFiles})}}if(n.review.state===`available`&&n.review.pullRequestNumber){let r=t(_4({connection:e.connection,reviewId:n.review.reviewId})),i=Gn(fS(r));n.review.checks={state:`loading`},aS(r)||i&&(i.kind!==`available`||i.number!==n.review.pullRequestNumber)?n.review.checks={state:`unavailable`}:i?.kind===`available`&&(n.review.checks={state:`available`,result:i.checks})}}(a.length!==0||!n.query.trim()&&n.filter.reviews===void 0)&&u.push({...e,entries:a})}let d=t.once(G2),f=aue(d,{issues:o.map(({connection:e,environmentName:t,failures:n})=>({environmentId:e.environmentId,environmentName:t,failures:n})),recoveredKeys:i.filter(e=>e.changes.state===`available`).map(e=>e.key),inventoryKeys:r.flatMap(e=>e.project.worktrees.map(t=>`${e.connection.environmentId}/${e.project.id}/${t.id}`)),environments:a});return f!==d&&t.set(G2,f),{projects:u,allProjects:r,statusIssues:t(G2),filters:l,loading:s.loading,messages:[...new Set(c)]}}));X(e=>CE(t=>{let n=[],r=j4(t,e),i=[...r.messages];for(let{connection:e,inventory:a}of r.reads)for(let r of a?.projects??[]){let a=t(A4({connection:e,projectId:r.id,older:!1}));n.push(...a.entries),i.push(...a.messages)}return{inbox:ide(n),loading:r.loading,messages:[...new Set(i)]}}));var N4=class extends rr()(`@porcelain/client/OperationStore`){},P4=class extends rr()(`@porcelain/client/OperationStorage`){},F4=Tx(q(K({requestId:PX.fields.requestId,projectId:G.check(_x(1)),worktreeId:bG.fields.worktreeId,request:PX}).check(ox(e=>e.requestId===e.request.requestId))));function I4(e){return e.state!==`running`}var L4=(e,t)=>JSON.stringify([e.projectId,e.worktreeId,t]),lde=Ku(N4,V(function*(){let e=yield*P4,t=yield*NC(1),n=yield*LT(0),r=yield*e.read().pipe(Uf(e=>Cb(F4)(e??`[]`)),qf),i=Ij({operations:Lr(r)?new Map(r.success.map(e=>[L4(e,e.request.input.action),e])):new Map,closed:!1,restorationError:Ir(r)?new KW({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*UT(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*H(i.value.restorationError);let n=[...t.values()].filter(e=>!e.receipt||!I4(e.receipt)).map(({receipt:e,...t})=>t),r=yield*Ob(F4)(n).pipe(np(e=>new KW({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e})));yield*(n.length?e.write(r):e.clear()).pipe(np(({cause:e})=>new KW({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e}))),yield*a({...i.value,operations:t})}),s=e=>t.withPermit(V(function*(){return i.value.closed?yield*Op:yield*e().pipe(jp)}));return{state:i,set:Jp(`OperationStore.set`)((e,t)=>s(()=>V(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(()=>V(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*Hn(yield*RT(n).pipe(uT(()=>V(function*(){let n=i.value.operations.get(e);return yield*X0(!i.value.closed&&n?.requestId===t),n?.receipt&&I4(n.receipt)?zn(n.receipt):Rn()})),mT(Vn),lT(e=>e.value),_T),{onSome:z,onNone:()=>X0(!1).pipe(Gf(If))})})}})),ude=X(({connection:e,scope:t})=>e.operations.state.map(({operations:e})=>{let n=e.get(L4(t,`switch`));return{unresolved:!(!n||n.receipt&&I4(n.receipt))}}));function R4(e,t,n){e.set(G2,e(G2).flatMap(e=>{if(e.environmentId!==t)return[e];let r=n(e.failures);return r.length>0?[{...e,failures:r}]:[]}))}var dde=X(e=>WE(Jp(`WorktreeNavigator.refresh`)(function*(t,n){if(t){let r=e.find(e=>e.environmentId===t.environmentId),i=n(G2).find(e=>e.environmentId===t.environmentId);if(!r||!i)return;yield*n.setResult(J2(r),void 0);let a=yield*n.result(R2(r),{suspendOnWaiting:!0}),o=i.failures.filter(({entry:e})=>a.projects.some(t=>t.id===e.projectId&&t.available&&t.worktrees.some(t=>t.id===e.worktreeId&&t.available))),s=o.map(({entry:e})=>e.key);R4(n,t.environmentId,e=>e.filter(({entry:e})=>s.includes(e.key))),yield*Df(o,e=>{let i=e.entry;if(!i.worktreeId)return Nf;let a=a4({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(J2(e),void 0),{concurrency:`unbounded`});let r=n(M4(e));for(let e of r.projects){if(!e.expanded)continue;let t=h4({connection:e.connection,projectId:e.project.id}),r=Gn(fS(n(t)));n.refresh(t);for(let t of r??[])t.state!==`open`||t.archived||e.project.worktrees.some(e=>(e.branch??`Detached HEAD`)===t.branch)&&n.refresh(m4({connection:e.connection,reviewId:t.reviewId}));for(let t of e.entries)if(t.worktreeId&&t.available&&(t.changes.state===`available`&&t.changes.count>0&&n.refresh(o4({connection:e.connection,scope:{projectId:t.projectId,worktreeId:t.worktreeId}})),n.refresh(a4({connection:e.connection,scope:{projectId:t.projectId,worktreeId:t.worktreeId}}))),t.review.state===`available`&&t.review.pullRequestNumber&&n.refresh(_4({connection:e.connection,reviewId:t.review.reviewId})),t.kind===`worktree`&&t.review.state===`available`&&!t.review.closed){let r={connection:e.connection,reviewId:t.review.reviewId};n.refresh(g4(r))}}}))),z4=[`review`,`reviewed-layers`],fde={files:z4,git:z4,review:z4,reviewed:[`reviewed`,`reviewed-layers`],comments:[`comments`]};function pde(e){return e.type===`worktree`?{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(fde[e.change])}:null}function mde(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 hde(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(pde(e)?.surfaces);if(e.change===`files`)for(let e of p2)t.add(e);if(e.change===`git`)for(let e of[...m2,...B4])t.add(e);return{scope:e,surfaces:t}}function V4(e,t){let n=hde(t);return n?[...n.surfaces].map(t=>f2.reviewSurface(e,n.scope,[t])):[]}function gde(e){if(e.state!==`running`&&e.state!==`rejected`&&e.state!==`no-change`)return new Set([...e.action===`fetch`||e.action===`push`?[`git-status`,`changes`]:[...m2,...p2],...B4,...mde(e)?.surfaces??[]])}function H4(e,t){let n=gde(t);return n?[...n].map(n=>f2.reviewSurface(e,t,[n])):[]}var _de=class extends ua{},U4=class e extends rr()(`@porcelain/client/GitReceiptRefresh`){static layer(t){return Ku(e,V(function*(){let e=yield*yp,n=yield*xT,r=yield*Z2,i=yield*JU({capacity:1/0,timeToLive:Mi,lookup:a=>V(function*(){let o=new Set(H4(t.environmentId,a).map(e=>String(e[4]))),s=[...rh(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(V(function*(){n.invalidateUnsafe([f2.worktreeInventory(t.environmentId),f2.projectReviews(t.environmentId,a.projectId),...c.map(e=>f2.durableReview(t.environmentId,e)),...H4(t.environmentId,a)]),yield*Df(l,e=>e.settled,{concurrency:`unbounded`,discard:!0})}),e);return yield*Lp(_S(u).pipe(Gf(nW(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 _de({projectId:e.projectId,worktreeId:e.worktreeId,requestId:e.requestId,action:e.action,state:e.state}),n=yield*ZU(i,t);n.pollUnsafe()&&(yield*nW(i,t)),yield*vS(n)})}}))}},W4=X(e=>e.atoms(t=>td(U4.layer(e),t(K0(e).layer))));function G4(e,t){return V(function*(){let n=yield*(yield*W0(e)).request(e=>e.gitActions.readGitActionReceipt({params:{worktreeId:t.worktreeId,requestId:t.requestId}}));return yield*Y0(e,n.projectId===t.projectId&&n.worktreeId===t.worktreeId&&n.requestId===t.requestId),n})}var K4=class extends Y()(`GitOperationStateError`,{reason:Yb([`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.`}}},vde=Jp(`GitActionController.make`)(function*({connection:e,scope:t,action:n}){let r=yield*W0(e),i=yield*N4,a=yield*hW,o=yield*U4,s=yield*NC(1),c=L4(t,n),l=Jp(`GitActionController.accept`)(function*(t){yield*Y0(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*o.refresh(t),yield*Y0(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*i.accept(t)}),u=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*Y0(e,o.projectId===t.projectId&&o.worktreeId===t.worktreeId&&o.requestId===a.requestId&&o.action===n),yield*l(o),yield*i.wait(c,a.requestId)):yield*H(new D0({status:o.statusCode,message:o.message}))});return{execute:Jp(`GitActionController.execute`)(function*(r){return yield*e.request(V(function*(){let o=yield*s.withPermit(V(function*(){yield*Y0(e);let o=i.state.value.operations.get(c);if(o&&(!o.receipt||!I4(o.receipt)))return yield*H(new K4({reason:`pending`}));if(r.input.action!==n)return yield*H(new K4({reason:`mismatch`}));let s={...r,requestId:yield*a.randomUUIDv4.pipe(np(e=>new KW({message:`Could not create a Git recovery identity.`,cause:e})))};return yield*i.set(c,{...t,requestId:s.requestId,request:s}),s}));return yield*u(o)}))}),recover:Jp(`GitActionController.recover`)(function*(){return yield*e.request(V(function*(){yield*Y0(e);let t=i.state.value.operations.get(c);if(!t)return yield*H(new K4({reason:`missing`}));let r=yield*G4(e,t).pipe(ep(`GitActionNotFoundError`,()=>H(new K4({reason:`receipt-unavailable`}))),np(e=>e instanceof D0&&e.status===404?new K4({reason:`receipt-unavailable`}):e));return yield*Y0(e,r.action===n),yield*l(r),yield*i.wait(c,t.requestId)}))}),startNew:Jp(`GitActionController.startNew`)(function*(){return yield*s.withPermit(V(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 rr()(`@porcelain/client/GitActionController`){static layer(t){return Ku(e,vde(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})),yde=X(e=>J4(e).fn(e=>q4.use(e=>e.startNew())));function bde(e,t){let n=Y4(e),r=X4(e),i=yde(e),a=()=>{t.set(n,HE),t.set(r,HE)};return{run:Jp(`GitActions.run`)(function*(e,r){return t.set(n,{input:e,expected:r}),yield*YT(t,n,{suspendOnWaiting:!0})}),recover:Jp(`GitActions.recover`)(function*(){return t.set(r,void 0),yield*YT(t,r,{suspendOnWaiting:!0})}),startNew:Jp(`GitActions.startNew`)(function*(){t.set(i,void 0),(yield*YT(t,i,{suspendOnWaiting:!0}))&&a()}),reset:a}}var Z4=X(e=>EE(V(function*(){return bde(e,yield*qT)}))),Q4=Jp(`Projects.branchSwitchCommands`)(function*(e){return yield*YT(yield*qT,Z4({...e,action:`switch`}),{suspendOnWaiting:!0})}),$4=X(e=>e.atoms(t=>Qu(t(K0(e).layer),T2.layer))),e3=Jp(`Projects.requireSavedWorktreeDrafts`)(function*(e){if((yield*T2).hasUnsavedWorktree(e.connection.environmentId,e.scope))return yield*new KW({message:`Save or discard unsaved file drafts before changing this worktree.`})}),xde=X(e=>$4(e.connection).fn(Jp(`Projects.deleteWorktree`)(function*(t){t.confirmation&&(yield*e3(e));let n=yield*G0(e.connection,n=>n.projects.deleteWorktree({params:{worktreeId:e.scope.worktreeId},payload:t}));return yield*Y0(e.connection),n.deleted&&(yield*CT([f2.inventory(e.connection.environmentId),f2.worktreeInventory(e.connection.environmentId),f2.projectReviews(e.connection.environmentId)])),n}))),Sde=X(e=>$4(e.connection).fn(Jp(`Projects.switchWorktreeBranch`)(function*(t){yield*e3(e);let n=yield*Q4(e),r=yield*i4(e);return yield*n.startNew(),yield*n.run({action:`switch`,targetRef:t},{headOid:r.headOid,branch:r.branch?.name,inProgress:r.inProgress,mergeHeadOid:r.mergeHeadOid})}))),Cde=X(e=>$4(e.connection).fn(Jp(`Projects.recoverWorktreeBranchSwitch`)(function*(t){return yield*e3(e),yield*(yield*Q4(e)).recover()}))),wde=1.5,Tde=29360128,Ede=1e4,Dde=8192,Ode=80,kde=64,Ade=1e4,t3=15e3,jde=2166136261,Mde=16777619;function Nde(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 Pde(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 Fde(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 Ide(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 Rde(e){return e.comparison?.kind===`branch`?e.comparison.base:void 0}function zde(e){return e.kind===`change`?void 0:e.filePath}function Bde(e){return e?{kind:`change`,comparison:{kind:`branch`,base:e.base},revision:e.tip}:{kind:`change`}}function Vde(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 Hde(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 Ude(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 Wde(e,t){return`${e.split(`
18
+ `).map(e=>`> ${e}`).join(`
19
+ `)}\n\n${t}`}function Gde(e){return e.trim().length>0&&!e.includes(`\0`)&&e.length<=16e3}function Kde(e,t,n){return e?.body===t?e:n()}function qde(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 Jde(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 Yde(e){return[...e].sort((e,t)=>a3.indexOf(e.result)-a3.indexOf(t.result))}function Xde(e,t){let n=e=>e.layerId===t;return{checks:(e?.checks??[]).filter(n),assets:(e?.assets??[]).filter(n),current:e?.current??!0}}function Zde(e){switch(e){case`fail`:return`Failed`;case`pass`:return`Passed`}}function Qde(e){return Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0))}function $de(e){return URL.parse(e)?.host??e}function efe(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}var s3=K({method:Yb([`GET`,`POST`,`PATCH`,`PUT`,`DELETE`,`HEAD`,`OPTIONS`,`TRACE`,`QUERY`]),url:G,urlParams:q(Gb([G,G])),hash:U(G),headers:Ub(G,Jb([G,Ix(G)]))}).annotate({identifier:`HttpRequestDetails`}),tfe=K({status:gx,headers:Ub(G,Jb([G,Ix(G)]))}).annotate({identifier:`HttpResponseDetails`}),c3=`~effect/ai/AiError/Reason`,l3=()=>ife.pipe(ex(z({})),wie(z({}))),nfe=e=>{let t=ze(e),n={};for(let e in t){let r=t[e];ct(n,e,vh(r)?r.toString():r)}return n},rfe=class e extends Gx(`effect/ai/AiError/NetworkError`)({_tag:rx(`NetworkError`),reason:Yb([`TransportError`,`EncodeError`,`InvalidUrlError`]),request:s3,description:U(G)}){[c3]=c3;get isRetryable(){return this.reason===`TransportError`}static fromRequestError(t){return new e({description:t.description,reason:t._tag,request:{hash:Gn(t.request.hash),headers:nfe(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}},ife=Ub(G,Xb(qie)),u3=K({promptTokens:U(gx),completionTokens:U(gx),totalTokens:U(gx)}).annotate({identifier:`UsageInfo`}),d3=K({request:s3,response:U(tfe),body:U(G)}).annotate({identifier:`HttpContext`}),afe=class extends Gx(`effect/ai/AiError/RateLimitError`)({_tag:rx(`RateLimitError`),retryAfter:U(Uie),metadata:l3(),http:U(d3)}){[c3]=c3;get isRetryable(){return!0}get message(){let e=`Rate limit exceeded`;return this.retryAfter&&(e+=`. Retry after ${Xi(this.retryAfter)}`),e}},ofe=class extends Gx(`effect/ai/AiError/QuotaExhaustedError`)({_tag:rx(`QuotaExhaustedError`),resetAt:U(Px),metadata:l3(),http:U(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.`}},sfe=class extends Gx(`effect/ai/AiError/AuthenticationError`)({_tag:rx(`AuthenticationError`),kind:Yb([`InvalidKey`,`ExpiredKey`,`MissingKey`,`InsufficientPermissions`,`Unknown`]),description:U(G),metadata:l3(),http:U(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}},cfe=class extends Gx(`effect/ai/AiError/ContentPolicyError`)({_tag:rx(`ContentPolicyError`),description:G,metadata:l3(),http:U(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){return`Content policy violation: ${this.description}`}},lfe=class extends Gx(`effect/ai/AiError/InvalidRequestError`)({_tag:rx(`InvalidRequestError`),parameter:U(G),constraint:U(G),description:U(G),metadata:l3(),http:U(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}},ufe=class extends Gx(`effect/ai/AiError/InternalProviderError`)({_tag:rx(`InternalProviderError`),description:G,metadata:l3(),http:U(d3)}){[c3]=c3;get isRetryable(){return!0}get message(){return`Internal provider error: ${this.description}`}},dfe=class e extends Gx(`effect/ai/AiError/InvalidOutputError`)({_tag:rx(`InvalidOutputError`),description:G,metadata:l3(),usage:U(u3)}){[c3]=c3;get isRetryable(){return!0}static fromSchemaError(t){return new e({description:t.message})}get message(){return`Invalid output: ${this.description}`}},ffe=class e extends Gx(`effect/ai/AiError/StructuredOutputError`)({_tag:rx(`StructuredOutputError`),description:G,responseText:G,metadata:l3(),usage:U(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}`}},pfe=class extends Gx(`effect/ai/AiError/UnsupportedSchemaError`)({_tag:rx(`UnsupportedSchemaError`),description:G,metadata:l3()}){[c3]=c3;get isRetryable(){return!1}get message(){return`Unsupported schema: ${this.description}`}},mfe=class extends Gx(`effect/ai/AiError/UnknownError`)({_tag:rx(`UnknownError`),description:U(G),metadata:l3(),http:U(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){return this.description??`Unknown error`}},f3=class extends Gx(`effect/ai/AiError/ToolNotFoundError`)({_tag:rx(`ToolNotFoundError`),toolName:G,availableTools:q(G)}){[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 Gx(`effect/ai/AiError/ToolParameterValidationError`)({_tag:rx(`ToolParameterValidationError`),toolName:G,description:G}){[c3]=c3;get isRetryable(){return!0}get message(){return`Invalid parameters for tool '${this.toolName}': ${this.description}`}},m3=class extends Gx(`effect/ai/AiError/InvalidToolResultError`)({_tag:rx(`InvalidToolResultError`),toolName:G,description:G}){[c3]=c3;get isRetryable(){return!1}get message(){return`Tool '${this.toolName}' returned invalid result: ${this.description}`}},h3=class extends Gx(`effect/ai/AiError/ToolResultEncodingError`)({_tag:rx(`ToolResultEncodingError`),toolName:G,toolResult:Lb,description:G}){[c3]=c3;get isRetryable(){return!1}get message(){return`Failed to encode result for tool '${this.toolName}': ${this.description}`}},hfe=Jb([afe,ofe,sfe,cfe,lfe,ufe,rfe,dfe,ffe,pfe,mfe,f3,p3,m3,h3,class extends Gx(`effect/ai/AiError/ToolConfigurationError`)({_tag:rx(`ToolConfigurationError`),toolName:G,description:G}){[c3]=c3;get isRetryable(){return!1}get message(){return`Invalid configuration for tool '${this.toolName}': ${this.description}`}},class extends Gx(`effect/ai/AiError/ToolkitRequiredError`)({_tag:rx(`ToolkitRequiredError`),pendingApprovals:q(G),description:U(G)}){[c3]=c3;get isRetryable(){return!1}get message(){return`Toolkit required to resolve pending tool approvals: ${this.pendingApprovals.join(`, `)}`}},class extends Gx(`effect/ai/AiError/InvalidUserInputError`)({_tag:rx(`InvalidUserInputError`),description:G}){[c3]=c3;get isRetryable(){return!1}get message(){return`Invalid user input: ${this.description}`}}]),g3=`~effect/ai/AiError`,_3=class extends Gx(`effect/ai/AiError/AiError`)({_tag:rx(`AiError`),module:G,method:G,reason:hfe}){[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}`}},gfe=e=>F(e,c3),v3=e=>new _3(e),_fe=`~effect/ai/Tool`,y3=(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),e,t),b3={[_fe]:{_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:_r(this.annotations,e,t)})},annotateMerge(e){return y3(this,{annotations:Dr(this.annotations,e)})}};({...b3}),{...b3};var vfe=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??Vb,r=t?.failure??Ib;return vfe({name:e,description:t?.description,parametersSchema:t?.parameters??xfe,successSchema:n,failureSchema:r,failureMode:t?.failureMode??`error`,annotations:hr(),needsApproval:t?.needsApproval})},S3=kr(`effect/ai/Tool/Readonly`,{defaultValue:l}),C3=kr(`effect/ai/Tool/Destructive`,{defaultValue:c}),w3=kr(`effect/ai/Tool/Idempotent`,{defaultValue:l}),T3=kr(`effect/ai/Tool/OpenWorld`,{defaultValue:c}),E3=kr(`effect/ai/Tool/Strict`,{defaultValue:()=>void 0}),yfe=K({type:Yb([`execution-denied`,`execution-interrupted`]),reason:G}).annotate({identifier:`ToolExecutionFailure`}),bfe=e=>Jb([_3,e.failureSchema,yfe]),xfe=Ub(G,Ib),D3=`~effect/ai/Toolkit`,Sfe=kr(`effect/ai/Toolkit/FailureOrigin`,{defaultValue:()=>`result`}),O3=(e,t)=>nu(Rl(e),gr(Sfe,t)),Cfe={...cn({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=jb(e.parametersSchema)?Cb(e.parametersSchema):e=>z(e),o=Db(e.successSchema),s=Db(bfe(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*Tne({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(Ir(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=>Dr(s.context,e)),fp({onFailure:e=>aC(d,e),onSuccess:()=>sC(d)}),Ip),m=t=>yb(t)?v3({module:`Toolkit`,method:`${e}.handle`,reason:new m3({toolName:e,description:`Tool handler returned invalid result: ${t.message}`})}):gfe(t)?v3({module:`Toolkit`,method:`${e}.handle`,reason:t}):t;return sT(d).pipe(Zae(e=>{let t=m(e),n=yb(e)?`result`:`handler`;return o.failureMode===`error`?zae(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}})),toe(bS(p)))})}})}),[D3]:D3,of:o,toHandlers(e){return V({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 fr(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)}}},wfe=e=>Object.assign(function(){},Cfe,{tools:e}),Tfe=(...e)=>{let t={};for(let n of e)ct(t,n.name,n);return t},Efe=(...e)=>wfe(Tfe(...e)),k3=K({cwd:Mb(G.check(_x(1)).check(J(eG)))}),Dfe=K({...k3.fields,...C$.fields}),Ofe=K({...T$.fields,warnings:q(G)}),kfe=K({...k3.fields,reviewId:U(G.check(cx())),...D$.fields}),Afe=K({reviewId:U(G.check(cx())),...k3.fields,scope:m1.pipe(nx(z(`waiting`)))}),jfe=K({...k3.fields,...g1.fields}),Mfe=K({...k3.fields,...f1.fields,...v1.fields}),Nfe=K({...k3.fields,...f1.fields,...b1.fields}),Pfe=x3(`publish_review`,{parameters:Dfe,success:Ofe,failure:mG,failureMode:`return`,description:`Publish an immutable revision of committed branch work with a required verdict. Read the current revision and porcelain://review-guide first. Include your own CSS, matching the reviewed application where possible; missing CSS produces an advisory warning. Attach proof that the work is done: checks you ran with their result, and screenshots, short videos or links.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!0),Ffe=x3(`read_review`,{parameters:kfe,success:M$,failure:mG,failureMode:`return`,description:`Read the latest published review, resolved pointers and uncovered changed lines.`}).annotate(E3,!0).annotate(T3,!1).annotate(S3,!0).annotate(w3,!0),Ife=x3(`list_comments`,{parameters:Afe,success:K({threads:h1}),failure:mG,failureMode:`return`,description:`Read review threads waiting for the agent. Omit scope, or pass waiting, for unresolved threads whose latest message is not from the agent. Pass all to include every thread.`}).annotate(E3,!0).annotate(T3,!1).annotate(S3,!0).annotate(w3,!0),Lfe=x3(`create_comment`,{parameters:jfe,success:_1,failure:mG,failureMode:`return`,description:`Create an agent review thread on the whole change (kind change, with a branch comparison and its tip for a branch review), a file or a code range. Stable optional IDs make retries idempotent.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),Rfe=x3(`reply_to_comment`,{parameters:Mfe,success:y1,failure:mG,failureMode:`return`,description:`Reply to a review thread. Stable optional messageId makes retries idempotent.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),zfe=x3(`resolve_comment`,{parameters:Nfe,success:x1,failure:mG,failureMode:`return`,description:`Resolve or reopen a review thread.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1).annotate(w3,!0);Efe(x3(`connect_review_agent`,{parameters:q$,success:G$,failure:mG,failureMode:`return`,description:`Associate this published review with your existing local T3 Code thread. Supply its exact threadId, never guess from a branch or title. The server verifies that the thread belongs to the published worktree. Owner feedback can then queue a notification in this session.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),x3(`acknowledge_feedback`,{parameters:J$,success:G$,failure:mG,failureMode:`return`,description:`Acknowledge receipt of the exact Porcelain feedback delivery before handling it. Only handle the batch if acknowledgementAccepted is true; false means it was already acknowledged. This is receipt, not resolution or implementation/merge authorization. Read the named revision and comments, then reply with stable message IDs.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),Pfe,Ffe,Ife,Lfe,Rfe,zfe);function Bfe(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 Vfe(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 Hfe(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 Ufe(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`WriteNotSentError`||e instanceof oQ||e.name===oQ.name)?e.message:`This review surface could not be loaded. Try again.`}function M3(e){return e.fingerprint!==null&&e.fingerprint!==void 0}function Wfe(e){return e.split(`/`).at(-1)??e}function Gfe(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 Kfe(e,t){return!(Date.parse(e.expires)-t>Uce)}function qfe(e){let t=e.filter(e=>e.binary!==!0&&e.deleted!==!0),n=e.filter(e=>e.binary===!0).length,r=e.filter(e=>e.deleted===!0).length,i=t.reduce((e,t)=>e+t.ranges.reduce((e,t)=>e+t.endLine-t.startLine+1,0),0),a=[...t.length>0?[`${b4(i,`line`)} in ${b4(t.length,`file`)}`]:[],...n>0?[b4(n,`binary file`)]:[],...r>0?[b4(r,`removed file`)]:[]],o=a.at(-1);return o===void 0?null:a.length===1?o:`${a.slice(0,-1).join(`, `)} and ${o}`}function Jfe(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 Yfe(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 Xfe={kind:`worktree`};function Zfe(e){return{kind:`branch`,base:e?.base?.ref??``,branch:e?.head.branch}}function Qfe(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 $fe(e,t){return{...e,marked:[...e.marked,...t.marked],failed:[...e.failed,...t.conflicts.map(e=>({path:e.path,error:Error(e.reason===`missing`?`That file is no longer in the change list.`:`The file changed since it was shown.`)}))]}}function F3(e){let t=e.failed.length,n=e.skipped.filter(e=>e.reason===`not-fingerprintable`).length,r=e.skipped.length-n;return[e.marked.length>0?`Marked ${b4(e.marked.length,`file`)}.`:`No files marked.`,n>0?`Skipped ${n}.`:``,r>0?`${r} already reviewed.`:``,t>0?`${t} failed.`:``].filter(Boolean).join(` `)}function I3(e){return`${e.join(`, `)} cannot be marked reviewed because ${y4(e.length,`its fingerprint is`,`their fingerprints are`)} unavailable (too large or unreadable).`}function L3(e){return`${I3(e)} This stop stays open until every file can be marked reviewed.`}function epe(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 tpe(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 npe(e){let t=N3(e),n=t.filter(M3),r=n.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0&&e.reviewStatus!==`reviewed`),i=n.filter(e=>e.reviewStatus===`reviewed`),a=t.length-n.length,o=r.length===0&&i.length>0,s=a>0?`${n.length} reviewed · ${a} unavailable`:`All reviewed`,c=n.length===0?null:o?`Unmark all`:r.length===0?s:null;return{entries:t,reviewedPaths:i.map(e=>e.path),unmarking:o,blocked:n.length===0||r.length===0&&i.length===0,label:n.length===0?`No files can be marked reviewed`:c??`Mark all ${b4(r.length,`file`)} reviewed`,text:n.length===0?`No reviewable files`:c??`Mark all reviewed`}}function rpe(e,t){return t===`reviewed`?`Unmark ${e} as unreviewed`:t===`stale`?`Mark changed ${e} as reviewed`:`Mark ${e} as reviewed`}function ipe(e,t){return!e?.fingerprint||t?null:e.reviewed?{kind:`unmark`,path:e.path}:{kind:`mark`,input:{path:e.path,fingerprint:e.fingerprint}}}function ape(e){return e.kind===`branch`?{kind:`branch`,branch:e.branch}:{kind:`worktree`}}function ope(e){return[`reviewed`,...e.kind===`branch`?[`branch`,e.branch??``]:[]]}function spe(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 cpe(e){let t=o3(e),n=t.failing+t.passing;return t.failing>0?{key:`checks`,value:`${t.failing} of ${n} failing`,label:`${t.failing} of ${b4(n,`check`)} failing`,tone:`failing`}:n===0?{key:`checks`,label:`No checks attached`,value:`None attached`,tone:`attention`}:e?.current===!1?{key:`checks`,value:`Outdated`,label:`Checks ran before the latest changes`,tone:`attention`}:{key:`checks`,label:`${b4(n,`check`)} passed`,value:`${n} passed`,tone:`ok`}}function lpe(e){if(e===null)return{key:`unexplained`,label:`No review published`,value:`No review`,tone:`attention`};let t=qfe(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 upe(e,t){if(e===0&&t===0)return[{key:`comments`,label:`No open comments`,value:`None open`,tone:`ok`}];let n=[];return e>0&&n.push({key:`comments`,label:`${b4(e,`comment`)} waiting on the agent`,value:`${e} awaiting agent`,tone:`attention`}),t>0&&n.push({key:`replies`,label:`${b4(t,`comment`)} waiting on you`,value:`${t} awaiting you`,tone:`attention`}),n}function dpe(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?lpe(e.review):null;return[t===0?{key:`files`,label:`No changed files`,value:`None changed`,tone:`ok`}:{key:`files`,label:`${n} of ${b4(t,`file`)} reviewed`,value:`${n} of ${t} reviewed`,tone:n===t?`ok`:`attention`},r===0?{key:`stale`,label:`No marks went stale`,value:`None stale`,tone:`ok`}:{key:`stale`,label:`${b4(r,`mark`)} changed since reviewed`,value:`${r} changed`,tone:`attention`},...a===null?[]:[a],...upe(i.awaitingAgent,i.awaitingYou),cpe(e.review?.proof)]}function R3(e,t){return e?`Unmark as reviewed`:t?`Mark as reviewed again`:`Mark as reviewed`}function fpe(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=epe(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=G.check(cx()),ppe=Dx.check(hx()).check(mx({minimum:1,maximum:2**53-1})),mpe=K({reviewId:z3,environmentId:bx,host:bx,protocol:U(b$),revision:U(ppe),decision:U(z3)});function hpe(e){try{let t=new URL(e,`https://porcelain.fabiofiorita.com`);if(t.origin!==`https://porcelain.fabiofiorita.com`||t.username||t.password||t.hash||!/^\/open\/reviews\/[^/]+$/.test(t.pathname))return;let n=new Set([`environment`,`host`,`protocol`,`revision`,`decision`]);for(let e of t.searchParams.keys())if(n.has(e)&&t.searchParams.getAll(e).length!==1)return;let r=t.searchParams.get(`revision`);if(r!==null&&!/^[1-9]\d*$/.test(r))return;let i=Eb(mpe)({reviewId:decodeURIComponent(t.pathname.slice(14)),environmentId:t.searchParams.get(`environment`),host:t.searchParams.get(`host`),...t.searchParams.has(`protocol`)?{protocol:t.searchParams.get(`protocol`)}:{},...r===null?{}:{revision:r},...t.searchParams.has(`decision`)?{decision:t.searchParams.get(`decision`)}:{}});if(!/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*|\[[a-fA-F0-9:]+\])(?::[1-9]\d{0,4})?$/.test(i.host))return;let a=i.protocol??`https`,o=new URL(`${a}://${i.host}`);return o.host!==i.host.toLowerCase()&&o.host!==i.host.toLowerCase().replace(a===`http`?/:80$/:/:443$/,``)?void 0:{...i,webUrl:gpe(i)}}catch{return}}function gpe(e){let t=new URL(`/reviews/${encodeURIComponent(e.reviewId)}`,`${e.protocol??`https`}://${e.host}`);return e.revision!==void 0&&(t.pathname+=`/${e.revision}`),e.decision!==void 0&&(e.revision===void 0?t.searchParams.set(`decision`,e.decision):t.pathname+=`/decisions/${encodeURIComponent(e.decision)}`),t.toString()}function _pe(e){try{let t=new URL(e);return t.protocol!==`porcelain-desktop:`||t.host!==`open`||t.username||t.password||t.hash?void 0:hpe(`https://porcelain.fabiofiorita.com/open${t.pathname}${t.search}`)}catch{return}}function vpe(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 ype(e){let t=B3(e);return t.startsWith(`iPadOS`)?`tablet`:/^(?:iOS|Android|Mobile)\b/.test(t)?`phone`:`browser`}var bpe=new Intl.ListFormat(`en-GB`,{type:`conjunction`});function xpe(e,t){let n=Z0.filter(t=>e.routes[t].status.kind===`on`).map(e=>Q0[e]);return[n.length===0?`No way in on`:bpe.format(n),b4(t,`device`)].join(` · `)}function Spe(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 Cpe(e,t,n){let r=Su(),{timeoutMs:i,...a}=e,o=AW(Zu(nd(GW.layer),wT,nd(Z2.layer),n),{memoMap:t}),s=PE({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:Fe({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),vS,bS):e).pipe(cp({duration:i,orElse:()=>Op}),Lp(r));return yield*vS(n).pipe(wp(bS(n)),Uf(e=>c?Op:z(e)))})}),close:u,closeEffect:l}}var wpe=X(e=>e.atoms(Uu).fn(t=>V(function*(){(yield*xT).invalidateUnsafe([f2.review(e.environmentId,t)])})));function Tpe(e){return()=>void 0}function Epe(e){return()=>void 0}function Dpe(e){}function Ope(){return()=>void 0}var V3=class e extends rr()(`@porcelain/web/DesktopHost`){static layer=Wu(e,()=>({isDesktopShell:!1,hasAppUpdateFeed:!1,canPickProject:e=>!1,pickProject:Jp(`Desktop.pickProject`)(function*(e){return yield*H(new KW({message:`The native project picker is unavailable for this computer.`}))}),mcpConfiguration:Mf(()=>H(new KW({message:`The desktop bridge is unavailable.`}))),checkUpdate:V(function*(){return Rn()}),installUpdate:Mf(()=>H(new KW({message:`The native app updater is unavailable.`}))),updateStates:aT({status:`idle`})}))};function kpe(){}var Ape=X(e=>EE(t=>{t.addFinalizer(Epe(e))})),H3={isActive:()=>document.visibilityState!==`hidden`&&!0,subscribe:e=>{let t=Tpe(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 jpe=VW.of({read:()=>Af({try:async()=>{{let e=localStorage.getItem(`porcelain.remotes`);return{remotes:e===null?[]:m0(JSON.parse(e)),missingCredentials:[]}}},catch:e=>new tu(e)}),write:({remotes:e})=>Af({try:async()=>{let t=l0(e);localStorage.setItem(`porcelain.remotes`,t)},catch:e=>new tu(e)})});function Mpe(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 Npe=Jp(`Live.connect`)(function*(e,t){let n=yield*qT,r=yield*Z2,i=yield*N4,a=yield*U4,o=yield*xT,s=yield*xp(Eu(e.scope,`sequential`),e=>Ou(e,lu)),c=yield*OW(yield*SW().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([f2.inventory(e.environmentId),f2.reviewGitSettings(e.environmentId)])),t.type===`worktree`){let n=yield*r.reviewsFor(t);yield*o.invalidate([f2.worktreeInventory(e.environmentId),f2.projectReviews(e.environmentId,t.projectId),...n.map(t=>f2.durableReview(e.environmentId,t))])}t.type===`project`&&t.change===`preferences`&&(yield*o.invalidate([f2.filePreferences(e.environmentId,t.projectId)])),yield*o.invalidate(V4(e.environmentId,t))}),d=()=>{for(let t of i.state.value.operations.values())t.receipt&&I4(t.receipt)||c(Symbol(),V(function*(){let n=yield*G4(e,{...t}).pipe(gp(l));yield*Y0(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(),V(function*(){yield*u(t),t.type===`git-action`&&!e.isClosed()&&s.state._tag!==`Closed`&&(yield*i.accept(t.receipt))}).pipe(tp(()=>B(()=>{!e.isClosed()&&s.state._tag!==`Closed`&&d()})),Qf)))},onReconnect:()=>{!e.isClosed()&&s.state._tag!==`Closed`&&(e.onStatusChange?.(),c(Symbol(),o.invalidate([f2.environment(e.environmentId)])))},onUnauthorized:()=>{e.isClosed()||s.state._tag===`Closed`||(e.onStatusChange?.(),t?t():c(Symbol(),o.invalidate([f2.inventory(e.environmentId)])))}}).pipe(vp(xu,s)),p=``,m=V(function*(){if(e.isClosed()||s.state._tag===`Closed`)return;let t=Mpe(i,Gn(fS(n.get(R2(e)))),rh(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(B(()=>n.subscribe(R2(e),h)),e=>B(e)).pipe(vp(xu,s)),yield*xp(B(()=>i.state.subscribe(h)),e=>B(()=>e?.())).pipe(vp(xu,s)),c(Symbol(),vT(r.changes,()=>B(h))),h()}),Ppe=X(e=>e.atoms(t=>Zu(t(v2(e).layer),t(W4(e).layer),Ju(e.runtime.contextEffect)))),Fpe=X(({connection:e,onUnauthorized:t})=>Ppe(e).atom(Npe(e,t)).pipe(gE(0))),Ipe=EE(iS(void 0)),Lpe=()=>Ij(`idle`);function Rpe(e){return e instanceof D0?e.status===401:e instanceof sM||ik(e)?e.reason._tag===`SocketCloseError`&&e.reason.code===4001:!1}function W3(e,t=hr(),n){let r=Lpe();return{state:r,connect:Jp(`LiveUpdates.connect`)(function*({onNotice:i,onReconnect:a,onUnauthorized:o}){let s=yield*BD({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(B(()=>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=>B(e))}let f=yield*eC(1),p=0,m=500,h=bp(V(function*(){r.set(p===0?`connecting`:`reconnecting`);let t=yield*e,n=yield*gu(),o=yield*gu(),c=yield*gu(),l=yield*voe({retryPolicy:bf.pipe(xf(),_f(({input:e})=>ine(c,e)),vf({times:0}))}).pipe(vp(QO,t),vp(pM,doe)),h=yield*goe(aq,{disableTracing:!0}).pipe(vp(hM,l)),g=(yield*NC(1)).withPermit(Uf(VD(s),e=>h.follow(e))),_=h.notices(void 0).pipe(vT(e=>V(function*(){if(e.type===`ready`){yield*yu(o,void 0);return}i(e)}))),v=V(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(P0),Gf(If));yield*Ef([_,_u(n).pipe(Gf(Np(fC(f).pipe(Gf(g))))),Np(V(function*(){yield*d,yield*_u(n);let e=u;u=!1,yield*g.pipe(op(Ice)),e&&(a(),i({type:`ready`}))})),v],{concurrency:`unbounded`}).pipe(up(_u(c)))})),g=bp(V(function*(){for(yield*Cp(()=>B(()=>r.set(`idle`)).pipe(Gf(cC(f)),Gf(cC(l))));;){let e=yield*Jf(h);if(du(e)&&Rpe(Ul(e.cause))&&!(yield*n?.recoverUnauthorized?.()??z(!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,Fce)}}));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(HD(s,e)),nC(f,void 0))}}})}}function zpe(e,t){let n=Ij(void 0),r=a0(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)=>V(function*(){if(o&&a(),n.value)return n.value;r.every(e=>i.has(e.address))&&i.clear();let s=0;for(let a of r){if(i.has(a.address))continue;let r=yield*V0(a,e.environmentId,t).pipe(sp(F0));if(Vn(r)&&u0(e,r.value).kind===`online`)return n.set(a),a;Vn(r)&&r.value.kind===`unauthorized`&&s++}return i.clear(),s===r.length?yield*H(new D0({status:401,message:`This computer no longer accepts the saved connections. Pair it again.`})):yield*H(new KW({message:`None of this computer’s saved connections could be reached and authorized.`}))}).pipe(PC(s))),l=e=>E0(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(mne),n);return Vn(d)&&d.value.address!==i.address?s(d.value):u},transportFor:l}}function Bpe(e,t,n,r,i){return W3(V(function*(){let i=r?yield*r.select():void 0;return i&&r&&(yield*Cp(e=>B(()=>{du(e)&&!Kl(e.cause)&&r.failed(i)}))),yield*V(function*(){let{ticket:a}=yield*V(function*(){return yield*k0((yield*R0).session.issueLiveTicket())}).pipe(hp(R0.layer(i&&r?r.transportFor(i):t))),o=new URL(i?.address??e);return yield*n(`${o.protocol===`https:`?`wss:`:`ws:`}//${o.host}${P2({query:{ticket:a}})}`)}).pipe(op(P0))}),void 0,{...i?{activity:i}:{},...r?{recoverUnauthorized:()=>r.select().pipe(dp({onSuccess:()=>!0,onFailure:e=>!(e instanceof D0&&e.status===401)}))}:{}})}function G3(e,t,n){let{connection:r}=Cpe(e,n,Qu(nd(lde),T2.layer).pipe(td(t))),i=Fe({...r,get address(){return e.activeRoute?.value?.address??e.address},...e.activeRoute?{activeRoute:e.activeRoute}:{},liveUpdates:e.liveUpdates,...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},operations:r.runtime.runSync(N4)});return r.runtime.runSync(T2).adopt(i),i}function Vpe(e,t,n){let r=zpe({...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:Bpe(e.address,i,e.socket,r,e.activity),...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},timeoutMs:e.timeoutMs},t,n)}function K3(e){return mk(e).pipe(vp(pk,e=>new WebSocket(e)))}function Hpe(e){return W3(K3(`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${P2({query:{}})}`),void 0,{activity:e})}function Upe(e){return e instanceof kJ?`This file is binary or uses an unsupported text encoding.`:e instanceof SJ?`This file is too large to display as text.`:null}var Wpe=X(({connection:e,scope:t,path:n})=>n4({connection:e,scope:t},[`text`,n],e=>e.files.readTextFile({params:{worktreeId:t.worktreeId},query:{path:n}}).pipe($f(e=>{let t=Upe(e);return t?z({kind:`unreadable`,reason:t}):H(e)})),e=>`reason`in e||e.worktreeId===t.worktreeId&&e.path===n,[n])),q3=X(({connection:e,scope:t,path:n})=>n4({connection:e,scope:t},[`directory`,n],e=>e.files.listDirectory({params:{worktreeId:t.worktreeId},query:{path:n}}),e=>e.worktreeId===t.worktreeId,[n]).pipe($2));function J3({connection:e,scope:t,paths:n}){return n.map(n=>q3({connection:e,scope:t,path:n}))}var Gpe=X(e=>EE(t=>J3(e).map(e=>t(e)))),Kpe=X(e=>BE((t,n)=>{for(let t of J3(e))n.refresh(t)})),qpe=X(e=>n4(e,[`paths`],t=>t.files.listWorktreePaths({params:{worktreeId:e.scope.worktreeId}}),t=>t.worktreeId===e.scope.worktreeId)),Jpe=X(({connection:e,scope:t,path:n})=>Q2(e,t,[`asset`,n],V(function*(){return yield*(yield*W0(e)).request(e=>e.files.readFileAsset({params:{worktreeId:t.worktreeId},query:{path:n}}))}),K0(e),[n]));function Ype(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 Xpe(e,t){let n=e.lastIndexOf(`/`)+1,r=e.slice(n),i=r.lastIndexOf(`.`),a=i>0?r.slice(0,i):r,o=i>0?r.slice(i):``,s=t=>`${e.slice(0,n)}${a} copy${t}${o}`;if(!t(s(``)))return s(``);let c=2;for(;t(s(` ${c}`));)c+=1;return s(` ${c}`)}function Zpe(e){return e.filter(t=>!e.some(e=>e!==t&&e.endsWith(`/`)&&t.startsWith(e)))}function Qpe(e,t){return!e.some(e=>e.endsWith(`/`)&&t.startsWith(e))}function Y3(e){return e.replace(/\/$/,``).split(`/`).at(-1)??e}function $pe(e){return e.filter(e=>e.endsWith(`/`))}function eme(e){return e.split(`/`).slice(0,-1).map((e,t,n)=>`${n.slice(0,t+1).join(`/`)}/`)}function tme(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 nme(e,t){return tme({...t,folder:e?.kind===`directory`,link:e?.kind===`symlink`||e?.kind===`submodule`,openable:e?.kind===`file`})}var X3=class e extends rr()(`@porcelain/client/FileEdits`){static layer(t,n){return Ku(e,V(function*(){let e=yield*W0(t),r=yield*T2,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(B(Symbol),i=>Mp(o=>V(function*(){if(yield*o(Y0(t)),s.some(([,e])=>e.state.value.owner!==null))return yield*H(new KW({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!e.claim(i))return yield*H(new KW({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!(yield*o(e.save())))return yield*H(new KW({message:`Save or discard the unsaved draft before moving this entry.`}));let c={worktreeId:n.worktreeId},l=yield*o(e.request(e=>{switch(a.kind){case`write`:return e.files.editFile({params:c,payload:a});case`create`:return e.files.editFile({params:c,payload:a});case`move`:return e.files.editFile({params:c,payload:a});case`copy`:return e.files.editFile({params:c,payload:a});case`trash`:return e.files.editFile({params:c,payload:a})}}));return yield*Y0(t,l.path===(a.kind===`move`||a.kind===`copy`?a.destination:a.path)),(a.kind===`move`||a.kind===`trash`)&&(yield*r.relocate(t.environmentId,s.map(([e])=>e),a,n)),l})),e=>V(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(K0(e).layer),T2.layer)))),rme=X(e=>Z3(e).fn(e=>X3.use(t=>t.execute(e)),{concurrent:!0})),ime=X(e=>E2(e.connection).atom(V(function*(){let t=yield*T2,n=yield*qT;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(B(()=>n.mount(o)),()=>V(function*(){let e=yield*Sr(yield*YT(n,o),X3).execute({kind:`write`,path:r,text:i,expectedFingerprint:a});return e.contentFingerprint?e.contentFingerprint:yield*H(new KW({message:`The server did not confirm the saved version.`}))}),e=>B(e))}}})}))),ame=Jp(`Files.moveEntries`)(function*(e,t,n){for(let r of Zpe(e)){let e=`${t}${Y3(r)}`;r.replace(/\/$/,``)!==e.replace(/\/$/,``)&&(yield*n(r,e))}}),ome=Jp(`Files.completeDraft`)(function*(e,t){(yield*e.save())&&t()}),Q3=X(e=>{class t extends rr()(`@porcelain/client/PreviewAssets`){static layer=Ku(t,V(function*(){let t=yield*W0(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*Y0(e),new Map(a.assets.map(e=>[e.path,e.kind===`asset`?e:null]))})}}))}return t}),sme=class extends Y()(`HtmlPreviewUnavailable`,{}){get message(){return`Could not prepare the HTML preview. Try again.`}},$3=class extends rr()(`@porcelain/client/HtmlPreviewPlatform`){},cme=X(({connection:e,platform:t})=>e.atoms(n=>td(Qu(Q3(e).layer,t),n(K0(e).layer)))),lme=X(({connection:e,scope:t,path:n,html:r,platform:i})=>Q2(e,t,[`html-preview`,n,r],V(function*(){let i=yield*$3,a=yield*Q3(e);return yield*i.render(r,n,e=>a.read(t,n,e))}),cme({connection:e,platform:i}),[n]));function ume(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}var dme=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(ume(t),e))}a=l}return r}),fme=X(e=>K0(e).atom(G0(e,e=>e.gitActions.listCommitModels())).pipe(gE(I0),tD({staleTime:I0,revalidateOnFocus:!1})));function pme(e){return fme(e)}var e6=X(({connection:e,scope:t})=>K0(e).fn(Jp(`GitActions.generateCommitDraft`)(function*({lifetime:n,...r}){let i=yield*(yield*W0(e)).request(e=>e.gitActions.generateCommitDraft({params:{worktreeId:t.worktreeId},payload:r}),n);return yield*Y0(e),i}),{concurrent:!0})),mme=X(({connection:e,scope:t})=>K0(e).fn(Jp(`GitActions.dismissInterrupted`)(function*(n){yield*(yield*W0(e)).request(e=>e.gitActions.dismissInterruptedGitAction({params:{worktreeId:t.worktreeId,requestId:n}})),yield*Y0(e),yield*CT([f2.reviewSurface(e.environmentId,t,[`changes`])])}))),hme=X(e=>EE(V(function*(){let t=yield*qT,n=e6(e);return Jp(`CommitDraft.submit`)(function*(e,r){return t.set(n,{...e,lifetime:r}),yield*YT(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=>B(()=>{Kl(t)||e.setError(Ul(t))}),gme=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(()=>B(()=>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)))),_me=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(()=>B(()=>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(()=>B(()=>p(!1)));for(let e of v){if(!e.message.trim()||s!==`amend`&&l.inProgress!==`merge`&&!e.paths.length)return yield*H(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*H(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)))),vme=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(()=>B(()=>r(!1))),yield*t,yield*a.startNew(),o(null))},bp,(e,t)=>e.pipe(tp(o6(t)))),yme=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 bme(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 xme(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 Sme(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 Cme(e,t){let n=c6(t);return e.kind!==`run`||n==null?null:e.action===`pull`?n.behind:n.ahead}function wme(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=>z(a6(e))));r(a===null?{title:i.restored,type:`success`}:{title:i.failed,description:a,type:`error`})}),Tme=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=>B(()=>(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 Eme(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(Tme(e,a,o,s))}}:{}});return null}var Dme=Jp(`Discard.finish`)(function*(e,t){return Eme(t,yield*e)});function Ome(e){return e===`fetch`||e===`pull`||e===`push`}function kme(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 Ame(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 jme=e=>e===`fetch`?`Fetching`:e===`pull`?`Pulling`:`Pushing`,p6=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Mme(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 Nme=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=rS(i.result)?i.result.value:void 0,c=!s;c&&e.enableDetails();let l=kme(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=Ame(n,u.branch,e.pull.kind===`ready`?e.pull.strategy:`merge`);a(f6(n,yield*Sp(B(()=>e.onProgress(!0)),()=>t.run(d,t6(u,[],u.branch?.upstreamOid??null)),()=>B(()=>e.onProgress(!1)))))},(e,t,n,r)=>e.pipe($f(e=>B(()=>t.onResult({title:`${d6(r)} outcome not confirmed`,description:a6(e),type:`error`}))))),Pme=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=>B(()=>t.onResult({title:`${d6(r)} outcome not confirmed`,description:a6(e),type:`error`}))))),Fme=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=Gn(fS(r.result));(!o||aS(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=>B(()=>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}),Lme=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 Rme=kr(`@effect/platform-browser/Crypto/WebCrypto`,{defaultValue:()=>globalThis.crypto}),h6=Ku(hW,V(function*(){let e=yield*Rme;return e?gW({randomBytes:t=>{let n=new Uint8Array(t);for(let t=0;t<n.length;t+=65536)e.getRandomValues(n.subarray(t,t+65536));return n},digest:(t,n)=>typeof e.subtle?.digest==`function`?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)):H(Jw({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`crypto.subtle.digest is not available`}))}):yield*zf(Error(`Web Crypto API is not available`))}));function zme(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 Bme(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=Ij(void 0);function Vme({inventory:e,principal:t}){_6.set(t.kind===`device`?t.deviceId:void 0);let n=t.kind===`owner`?`owner`:t.deviceId,r=Bme(e.environmentId,{address:window.location.href,transport:L2(fetch),liveUpdates:Hpe(H3),operationsKey:`porcelain-git-requests:${JSON.stringify([e.environmentId,t.kind,n])}`});return r.atoms.addGlobalLayer(Vu(g2,zn(e))),r}function Hme(e){return Vpe({...e,send:fetch,...g6.statusActivity?{activity:g6.statusActivity}:{},socket:K3,onStatusChange:()=>B0(g6,e),timeoutMs:t3},Qu(h6,Vu(P4,m6(o0(e)?`porcelain-git-requests:${o0(e)}`:void 0))),y6.memoMap)}var Ume=Zu(Qu(b0.layer,D2.layer).pipe(ed(Vu(VW,jpe))),Vu(HW,g6),T2.layer,Vu(x0,{local:e=>xp(B(()=>Vme(e)),e=>kf(()=>e.close()))}),Vu(S0,{open:e=>xp(B(()=>Hme(e)),e=>kf(()=>e.close()))}),Vu(O2,{forgetEnvironment:()=>Nf})),v6=T0.pipe(td(Zu(k2.layer,C0.layer,w0.layer).pipe(td(Ume)))),y6=AW(v6),b6=PE({memoMap:y6.memoMap})(v6),Wme=y6.runSync(b0),x6=y6.runSync(C0),S6=y6.runSync(w0),C6=S6.state,Gme=b6.atom(V(function*(){yield*(yield*k2).read()}));function Kme(){vN(Gme)}function w6(){return EN(Wme.state)}function T6(){return EN(x6.state).connection}function qme(){return EN(S6.state)}function E6(e){let t=(0,QB.c)(5),n=EN(S6.state),r;if(t[0]!==e||t[1]!==n){let i;t[3]===e?i=t[4]:(i=t=>t.remote.environmentId===e,t[3]=e,t[4]=i),r=n.find(i),t[0]=e,t[1]=n,t[2]=r}else r=t[2];return r}function D6(e){let t=(0,QB.c)(6),n=T6();if(e){let n;return t[0]===e?n=t[1]:(n={connection:e},t[0]=e,t[1]=n),n}let r;t[2]===n?r=t[3]:(r=zme(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 Jme=tle({transport:L2(fetch),platform:g6});function Yme(e,t,n){return y6.runPromise(zle(e,Jme,t,t3),{signal:n})}var Xme=X(e=>EE(t=>{let n=()=>{window.location.hash&&e()};window.addEventListener(`hashchange`,n),t.addFinalizer(()=>window.removeEventListener(`hashchange`,n))})),Zme=Fle(L2(fetch,{reportUnauthorized:!1}));function Qme(e){return y6.runPromise(Ble(e,Zme))}var $me=EE(e=>{e.addFinalizer(Yle(()=>{y6.runFork(x6.clear())}))});function ehe(){return xN($me),I2}function O6(e){let t=(0,QB.c)(3),n=E6(e.environmentId)?.connection,r;return t[0]!==e||t[1]!==n?(r=H0(g6,e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],vN(r)}function the(e){let t=(0,QB.c)(7),{className:n}=e,r;t[0]===n?r=t[1]:(r=HV(`shrink-0`,n),t[0]=n,t[1]=r);let i,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`rect`,{x:`1.5`,y:`1.5`,width:`21`,height:`21`,rx:`4.5`}),a=(0,Q.jsx)(`path`,{d:`M12 3v5.5q0 .5-.5 .5h-2q-.5 0-.5 .5V11q0 .5.5 .5H12v2q0 .5.5 .5h2q.5 0 .5 .5V16q0 .5-.5 .5H12V21`}),t[2]=i,t[3]=a):(i=t[2],a=t[3]);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`g`,{fill:`currentColor`,stroke:`none`,children:[(0,Q.jsx)(`circle`,{cx:`12`,cy:`6.5`,r:`1.25`}),(0,Q.jsx)(`circle`,{cx:`12`,cy:`11.5`,r:`1.25`}),(0,Q.jsx)(`circle`,{cx:`12`,cy:`16.5`,r:`1.25`})]}),t[4]=o):o=t[4];let s;return t[5]===r?s=t[6]:(s=(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.25,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:r,children:[i,a,o]}),t[5]=r,t[6]=s),s}function k6(e){let t=(0,QB.c)(5),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(the,{className:`size-6`}),i=(0,Q.jsx)(`h1`,{className:`text-lg font-medium tracking-tight`,children:`Porcelain`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-2 px-6 md:px-8`,children:[r,i,(0,Q.jsxs)(`a`,{href:`https://porcelain.fabiofiorita.com/install`,target:`_blank`,rel:`noreferrer`,className:`ml-auto inline-flex items-center gap-1 rounded-md p-1 text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[`Install guide`,` `,(0,Q.jsx)(fH,{"aria-hidden":`true`,className:`size-3.5`})]})]}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,Q.jsxs)(`div`,{className:`pairing-page flex min-h-svh flex-col bg-background`,children:[a,(0,Q.jsx)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col px-6 pb-7 pt-10 md:px-14 md:pt-14`,children:n})]}),t[3]=n,t[4]=o),o}var nhe=[`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 rhe(e,t){if(t===1)return e.scrollWidth>e.clientWidth;let n=e.clientHeight,r=e.style.webkitLineClamp;try{return e.style.webkitLineClamp=`unset`,e.clientHeight>n}finally{e.style.webkitLineClamp=r}}function j6(e){let t=(0,QB.c)(39),{text:n,children:r,className:i,render:a,renderTrigger:o,propagateEscape:s,lines:c,disclose:l,cut:u}=e,d=s!==void 0&&s,f=c===void 0?1:c,p=l===void 0?`clipped`:l,m=u===void 0?`end`:u,h=(0,Z.useId)(),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(!1),w;t[0]!==g||t[1]!==p||t[2]!==n?(w=n.trim()!==``&&(g||p===`always`),t[0]=g,t[1]=p,t[2]=n,t[3]=w):w=t[3];let T=w,E=o!==void 0,D;t[4]!==h||t[5]!==f||t[6]!==d||t[7]!==E?(D=()=>e=>{if(!e)return;let t=()=>[e,...e.querySelectorAll(`[data-truncated]`)].filter(e=>e.getAttribute(`data-truncated`)===h),n=E?null:e.parentElement?.closest(nhe)??null,r=!0,i=()=>{r&&_(t().some(e=>rhe(e,f)))},a=()=>{n?.matches(`:focus-visible`)&&!n.hasAttribute(`data-clipped`)&&n.querySelector(`[data-clipped]`)===e&&C(!0)},o=()=>C(!1),s=t=>{t.key===`Escape`&&e.hasAttribute(`data-popup-open`)&&(C(!1),x(!1),d||t.stopPropagation())};y(n!==null),i();let c=new ResizeObserver(i);for(let e of t())c.observe(e);let l=new MutationObserver(i);return l.observe(e,{characterData:!0,childList:!0,subtree:!0}),document.fonts.ready.then(i),n?.addEventListener(`focus`,a),n?.addEventListener(`blur`,o),n?.addEventListener(`keydown`,s),()=>{r=!1,c.disconnect(),l.disconnect(),n?.removeEventListener(`focus`,a),n?.removeEventListener(`blur`,o),n?.removeEventListener(`keydown`,s)}},t[4]=h,t[5]=f,t[6]=d,t[7]=E,t[8]=D):D=t[8];let[O]=(0,Z.useState)(D),k=!E&&!v,A;t[9]===h?A=t[10]:(A=(e,t,n)=>{let r=n===void 0?`end`:n;return(0,Q.jsx)(`span`,{dir:r===`start`?`rtl`:void 0,className:HV(`min-w-0 truncate`,r===`start`&&`text-left`,t),"data-truncated":h,children:A6(r,e)})},t[9]=h,t[10]=A);let j=A,M;t[11]===a?M=t[12]:(M=a??(0,Q.jsx)(`span`,{}),t[11]=a,t[12]=M);let N=M,P;if(t[13]!==r||t[14]!==i||t[15]!==j||t[16]!==m||t[17]!==T||t[18]!==N||t[19]!==h||t[20]!==f||t[21]!==a?.props.className||t[22]!==o||t[23]!==k||t[24]!==n||t[25]!==E){let e=(0,Z.cloneElement)(N,{tabIndex:k&&T?0:void 0,dir:m===`start`?`rtl`:void 0,"aria-label":k?n:void 0,"data-truncated":h,"data-clipped":!E&&T?``:void 0,className:HV(`relative min-w-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,f===3?`line-clamp-3 whitespace-normal`:`truncate`,m===`start`&&`text-left`,a?.props.className,i)},A6(m,r??n));P=o?.(e,j)??e,t[13]=r,t[14]=i,t[15]=j,t[16]=m,t[17]=T,t[18]=N,t[19]=h,t[20]=f,t[21]=a?.props.className,t[22]=o,t[23]=k,t[24]=n,t[25]=E,t[26]=P}else P=t[26];let F=P,I=!T,ee=T&&(b||S),L;t[27]===d?L=t[28]:(L=(e,t)=>{x(e),e||C(!1),d&&t.reason===`escape-key`&&t.allowPropagation()},t[27]=d,t[28]=L);let te;t[29]===F?te=t[30]:(te=(0,Q.jsx)(LU,{ref:O,render:F,children:F.props.children}),t[29]=F,t[30]=te);let R;t[31]===n?R=t[32]:(R=(0,Q.jsx)(RU,{role:`tooltip`,className:`wrap-anywhere`,children:n}),t[31]=n,t[32]=R);let ne;return t[33]!==I||t[34]!==ee||t[35]!==L||t[36]!==te||t[37]!==R?(ne=(0,Q.jsxs)(IU,{disabled:I,disableHoverablePopup:!0,open:ee,onOpenChange:L,children:[te,R]}),t[33]=I,t[34]=ee,t[35]=L,t[36]=te,t[37]=R,t[38]=ne):ne=t[38],ne}function M6({className:e,...t}){return(0,Q.jsx)(BH,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:HV(`size-4 animate-spin`,e),...t})}function N6(){return typeof window>`u`?`http://127.0.0.1:3000`:window.location.origin}function P6(e){let t=(0,QB.c)(56),{reason:n,pending:r}=e,i=r!==void 0&&r,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=N6(),t[0]=a):a=t[0];let o=`porcelain pair "This browser" --address ${a}`,s=`This browser cannot open your worktrees yet`,c=`On your computer, run this`;n&&(s=`That link did not let this browser in`,c=`On your computer, run it again`),i&&(s=`Checking the link with your computer`,c=`Ran porcelain pair on your computer`);let l=i?`bg-brand-soft text-brand`:`bg-foreground text-background`,u;t[1]===l?u=t[2]:(u=HV(`inline-flex items-center gap-1 rounded-full px-2 py-1 text-xs font-medium`,l),t[1]=l,t[2]=u);let d;t[3]===i?d=t[4]:(d=i&&(0,Q.jsx)(M6,{className:`size-3`}),t[3]=i,t[4]=d);let f=i?`Pairing`:`Not paired`,p;t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,Q.jsxs)(`span`,{className:u,children:[d,f]}),t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==p?(m=(0,Q.jsxs)(`p`,{role:`status`,className:`flex w-fit max-w-full flex-wrap items-center gap-2 rounded-full border bg-background p-1 pr-3 text-ui text-muted-foreground`,children:[p,s]}),t[9]=s,t[10]=p,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`text-4xl font-semibold leading-none tracking-tighter md:text-6xl`,children:[(0,Q.jsx)(`h2`,{"aria-label":`This browser is not paired`,className:`text-title-dim`,children:`This browser is not paired.`}),(0,Q.jsx)(`p`,{children:`Pair it from your computer.`})]}),(0,Q.jsx)(`p`,{className:`max-w-xl text-lg leading-relaxed text-muted-foreground`,children:`Porcelain runs on the computer where your agents work, and this browser reads from it. That computer prints a link to let it in.`})]}),t[12]=h):h=t[12];let g=!i,_;t[13]===c?_=t[14]:(_=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:c}),t[13]=c,t[14]=_);let v;t[15]!==i||t[16]!==n?(v=!i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`my-3 flex min-w-0 items-center gap-3 rounded-full border bg-muted py-1 pl-4 pr-1 text-ui`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`$`}),(0,Q.jsx)(j6,{text:o,render:(0,Q.jsx)(`code`,{}),className:`flex-1`}),(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{variant:`ghost`,size:`icon-sm`,"aria-label":`Copy the command`,onClick:()=>HU(o,`the command`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{children:`Copy the command`})]})]}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[n?`Same command, a new link. `:``,`It prints a link that works once, for 15 minutes.`]})]}),t[15]=i,t[16]=n,t[17]=v):v=t[17];let y;t[18]!==i||t[19]!==g||t[20]!==_||t[21]!==v?(y=(0,Q.jsxs)(F6,{number:1,current:g,done:i,children:[_,v]}),t[18]=i,t[19]=g,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b=!!n,x=i?`Checking the link`:`Open the link it prints, here`,S;t[23]===x?S=t[24]:(S=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:x}),t[23]=x,t[24]=S);let C=n?`alert`:void 0,w=n?`text-destructive`:`text-muted-foreground`,T;t[25]===w?T=t[26]:(T=HV(`mt-1 text-ui leading-relaxed [overflow-wrap:anywhere]`,w),t[25]=w,t[26]=T);let E;t[27]!==i||t[28]!==n?(E=n??(i?`Checking that the link belongs to this Porcelain installation.`:(0,Q.jsxs)(Q.Fragment,{children:[`Its Porcelain page continues here, at`,` `,(0,Q.jsxs)(`code`,{children:[N6(),`/pair`]}),`. On a phone, scan the QR code it prints.`]})),t[27]=i,t[28]=n,t[29]=E):E=t[29];let D;t[30]!==C||t[31]!==T||t[32]!==E?(D=(0,Q.jsx)(`p`,{role:C,className:T,children:E}),t[30]=C,t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==i||t[35]!==b||t[36]!==S||t[37]!==D?(O=(0,Q.jsxs)(F6,{number:2,current:i,failed:b,children:[S,D]}),t[34]=i,t[35]=b,t[36]=S,t[37]=D,t[38]=O):O=t[38];let k;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:`Read what your agents changed`}),t[39]=k):k=t[39];let A;t[40]===i?A=t[41]:(A=!i&&(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:`This browser stays paired until you revoke it.`}),t[40]=i,t[41]=A);let j;t[42]===A?j=t[43]:(j=(0,Q.jsxs)(F6,{number:3,children:[k,A]}),t[42]=A,t[43]=j);let M;t[44]!==y||t[45]!==O||t[46]!==j?(M=(0,Q.jsxs)(`ol`,{"aria-label":`How pairing works`,className:`flex max-w-3xl flex-col`,children:[y,O,j]}),t[44]=y,t[45]=O,t[46]=j,t[47]=M):M=t[47];let N;t[48]===i?N=t[49]:(N=!1,t[48]=i,t[49]=N);let P;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`code`,{children:`porcelain devices`}),t[50]=P):P=t[50];let F;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(`p`,{className:`mt-auto border-t pt-4 text-ui text-muted-foreground`,children:[`Revoke this browser at any time with `,P,` and`,` `,(0,Q.jsx)(`code`,{children:`porcelain revoke`}),`.`]}),t[51]=F):F=t[51];let I;return t[52]!==M||t[53]!==N||t[54]!==m?(I=(0,Q.jsxs)(`section`,{className:`flex w-full min-w-0 flex-1 flex-col gap-8`,children:[m,h,M,N,F]}),t[52]=M,t[53]=N,t[54]=m,t[55]=I):I=t[55],I}function F6(e){let t=(0,QB.c)(19),{number:n,current:r,done:i,failed:a,children:o}=e,s=r!==void 0&&r,c=i!==void 0&&i,l=a!==void 0&&a,u=``,d=n;if(l){u=`, failed`;let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(cU,{className:`size-3`}),t[0]=e):e=t[0],d=e}if(c){u=`, done`;let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(mH,{className:`size-3`}),t[1]=e):e=t[1],d=e}s&&(u=`, current`);let f;t[2]===n?f=t[3]:(f=n!==3&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-1 left-3 top-8 border-l`}),t[2]=n,t[3]=f);let p=s?`step`:void 0,m=`Step ${n}${u}`,h=s&&`border-brand text-brand ring-4 ring-brand-soft`,g=c&&`border-brand bg-brand text-brand-foreground`,_=l&&`border-destructive text-destructive`,v;t[4]!==h||t[5]!==g||t[6]!==_?(v=HV(`relative flex size-6 shrink-0 items-center justify-center rounded-full border bg-background text-xs tabular-nums text-muted-foreground`,h,g,_),t[4]=h,t[5]=g,t[6]=_,t[7]=v):v=t[7];let y;t[8]!==d||t[9]!==v||t[10]!==p||t[11]!==m?(y=(0,Q.jsx)(`span`,{"aria-current":p,"aria-label":m,className:v,children:d}),t[8]=d,t[9]=v,t[10]=p,t[11]=m,t[12]=y):y=t[12];let b;t[13]===o?b=t[14]:(b=(0,Q.jsx)(`div`,{className:`min-w-0`,children:o}),t[13]=o,t[14]=b);let x;return t[15]!==y||t[16]!==b||t[17]!==f?(x=(0,Q.jsxs)(`li`,{className:`relative grid grid-cols-[auto_minmax(0,1fr)] gap-4 pb-8 last:pb-0`,children:[f,y,b]}),t[15]=y,t[16]=b,t[17]=f,t[18]=x):x=t[18],x}function ihe(e){let t=(0,QB.c)(3),{reason:n}=e,r=!n,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(k6,{children:(0,Q.jsx)(P6,{reason:n,pending:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function I6({className:e,...t}){return(0,Q.jsx)(`label`,{"data-slot":`label`,className:HV(`flex items-center gap-2 text-xs/relaxed leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var L6=Z.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return TI(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function ahe({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(L6,{"data-slot":`separator`,orientation:t,className:HV(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function R6({className:e,...t}){return(0,Q.jsx)(`fieldset`,{"data-slot":`field-set`,className:HV(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function z6({className:e,variant:t=`legend`,...n}){return(0,Q.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:HV(`mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm`,e),...n})}function ohe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`field-group`,className:HV(`group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var she=JV(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function B6({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:HV(she({orientation:t}),e),...n})}function che({className:e,...t}){return(0,Q.jsx)(I6,{"data-slot":`field-label`,className:HV(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-input/40 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-2 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/30 *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function V6({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`field-description`,className:HV(`text-left text-xs/relaxed leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function lhe({className:e,children:t,errors:n,...r}){let i=(0,Z.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,Q.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,Q.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,Q.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:HV(`text-xs/relaxed font-normal text-destructive`,e),...r,children:i}):null}function H6(e){return TI(e.defaultTagName??`div`,e,e)}function U6({className:e,...t}){return(0,Q.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:HV(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var uhe=JV(`group/item flex w-full flex-wrap items-center rounded-md border text-xs/relaxed transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2.5 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function W6({className:e,variant:t=`default`,size:n=`default`,render:r,...i}){return H6({defaultTagName:`div`,props:dI({className:HV(uhe({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var dhe=JV(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-8 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function G6({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:HV(dhe({variant:t,className:e})),...n})}function K6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-content`,className:HV(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none`,e),...t})}function q6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-title`,className:HV(`line-clamp-1 flex w-fit items-center gap-2 text-xs/relaxed leading-snug font-medium underline-offset-4`,e),...t})}function J6({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`item-description`,className:HV(`line-clamp-2 text-left text-xs/relaxed font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Y6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-actions`,className:HV(`flex items-center gap-2`,e),...t})}function X6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-footer`,className:HV(`flex basis-full items-center justify-between gap-2`,e),...t})}var fhe=JV(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2 py-1.5 text-left text-xs/relaxed has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-1.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function Z6({className:e,variant:t,...n}){return(0,Q.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:HV(fhe({variant:t}),e),...n})}function Q6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-title`,className:HV(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function $6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-description`,className:HV(`text-xs/relaxed text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function phe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-action`,className:HV(`absolute top-1.5 right-2`,e),...t})}var mhe=JV(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-2.5!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border bg-input/20 text-foreground dark:bg-input/30 [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,warn:`border-warn-border bg-warn-soft text-warn [a]:hover:bg-warn-soft/80`,brand:`bg-brand text-brand-foreground [a]:hover:bg-brand/80`,"brand-soft":`bg-brand-soft text-brand [a]:hover:bg-brand-soft/80`,open:`bg-add-bg text-add-fg [a]:hover:bg-add-bg/80`,draft:`bg-muted text-muted-foreground [a]:hover:bg-muted/80`,merged:`bg-brand-soft text-brand [a]:hover:bg-brand-soft/80`,closed:`bg-del-bg text-del-fg [a]:hover:bg-del-bg/80`}},defaultVariants:{variant:`default`}});function e8({className:e,variant:t=`default`,render:n,...r}){return H6({defaultTagName:`span`,props:dI({className:HV(mhe({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function t8(e){let t=(0,QB.c)(17),{section:n,title:r,lead:i,status:a,action:o,children:s}=e,c;t[0]===a?c=t[1]:(c=a&&(0,Q.jsx)(`div`,{className:`mb-1.5 flex h-5.5 min-w-0 items-center gap-2 text-ui leading-4.5`,children:a}),t[0]=a,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Q.jsxs)(`span`,{className:`text-title-dim`,children:[n,`.`]}),t[2]=n,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,Q.jsxs)(`h1`,{className:`min-w-0 text-4xl font-semibold tracking-title wrap-anywhere`,children:[l,` `,r]}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[u,o]}),t[7]=o,t[8]=u,t[9]=d):d=t[9];let f;t[10]===i?f=t[11]:(f=(0,Q.jsx)(`p`,{className:`mt-3 max-w-160 text-base tracking-lead text-foreground-2`,children:i}),t[10]=i,t[11]=f);let p;return t[12]!==s||t[13]!==c||t[14]!==d||t[15]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[c,d,f,s]}),t[12]=s,t[13]=c,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function n8(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=s2(e),t[0]=e,t[1]=n),vN(n)}function r8(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=c2(e),t[0]=e,t[1]=n),vN(n)}function hhe(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=l2(e),t[0]=e,t[1]=n),vN(n)}var ghe=X(e=>b6.fn((t,n)=>V(function*(){yield*n.setResult(Rle(e),void 0),yield*(yield*C0).clear()})));function _he(e){let t=(0,QB.c)(8),n;t[0]===e?n=t[1]:(n=ghe(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]=wN(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 vhe(e){let t=(0,QB.c)(17),{computer:n}=e,{connection:r}=D6(),{result:i,submit:a}=_he(r),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`p`,{className:`text-sm leading-5 font-medium`,children:`Disconnect this browser`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,(0,Q.jsxs)(`p`,{className:`mt-0.5 text-ui leading-4.5 text-muted-foreground`,children:[`Ends its session on `,n,`. Pair it again with a new link.`]})]}),t[1]=n,t[2]=s);let c;t[3]===i.waiting?c=t[4]:(c=i.waiting?(0,Q.jsx)(M6,{}):(0,Q.jsx)(oU,{}),t[3]=i.waiting,t[4]=c);let l;t[5]!==i.waiting||t[6]!==a||t[7]!==c?(l=(0,Q.jsxs)(XV,{variant:`outline`,size:`sm`,className:`shrink-0 self-start sm:self-auto`,"aria-label":`Disconnect this browser`,disabled:i.waiting,onClick:a,children:[c,`Disconnect`]}),t[5]=i.waiting,t[6]=a,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==s||t[10]!==l?(u=(0,Q.jsxs)(`div`,{className:`settings-danger flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;t[12]===i?d=t[13]:(d=aS(i)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(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=FE(V3.layer),a8=i8.atom(V(function*(){let e=yield*V3;return{isDesktopShell:e.isDesktopShell,hasAppUpdateFeed:e.hasAppUpdateFeed}})),o8=i8.atom(V(function*(){return yield*(yield*V3).checkUpdate})).pipe(XE),s8=i8.atom(cT(V(function*(){return(yield*V3).updateStates}))).pipe(gE(0));function c8(){let e=(0,QB.c)(2),t=vN(s8),n;return e[0]===t?n=e[1]:(n=Un(fS(t),yhe),e[0]=t,e[1]=n),n}function yhe(){return{status:`idle`}}function bhe(){return vN(a8)}var xhe=`data-valid`,She=`data-invalid`,Che={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},whe={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},l8={valid(e){return e===null?null:e?{[xhe]:``}:{[She]:``}}},The={invalid:void 0,name:void 0,validityData:{state:Che,errors:[],error:``,value:``,initialValue:null},setValidityData:ON,disabled:void 0,setTouched:ON,setDirty:ON,setFilled:ON,setFocused:ON,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:whe,registerFieldControl:ON,validation:{getValidationProps:(e,t=AN)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:ON,getInputControl:()=>null,commit:async()=>{},change:ON}},Ehe=Z.createContext(The);function u8(e=!0){let t=Z.useContext(Ehe);if(t.setValidityData===ON&&!e)throw Error(IN(28));return t}var Dhe=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:ON,validationMode:`onSubmit`,submitCountRef:{current:0}});function d8(){return Z.useContext(Dhe)}var Ohe=Z.createContext({controlId:void 0,registerControlId:ON,resetControlId:ON,labelId:void 0,setLabelId:ON,messageIds:[],setMessageIds:ON,getDescriptionProps:e=>e});function f8(){return Z.useContext(Ohe)}function p8(e,t,n,r=!0,i){let[a,o]=Z.useState(),s=vU(i?`${i}-label`:void 0),c=e??t??a;return PN(()=>{let i=e||t||!r?void 0:khe(n.current,s);a!==i&&o(i)}),c}function khe(e,t){let n=Ahe(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Ahe(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function m8(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=f8(),o=vU(),s=NN(()=>Symbol()),c=Z.useRef(!1),l=Z.useRef(!1),u=GN(()=>{c.current&&i!==ON&&(c.current=!1,i(s.current,void 0))});return PN(()=>{if(!n||i===ON){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]),PN(()=>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=NN(()=>Symbol());PN(()=>{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]),PN(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}function _8(e,t){let n=Z.useRef(e),r=GN(t);PN(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var jhe=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=GN(()=>S.inputRef.current?.value);g8(S.inputRef,A,P,F,!E,a),PN(()=>{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),ee=CP();return PN(()=>{u&&I.current===MP(hP(I.current))&&y(!0)},[u,y]),TI(`input`,e,{ref:[t,I],state:O,props:[{id:A,disabled:E,name:D,ref:S.inputRef,"aria-labelledby":k,autoFocus:u,...M?{value:N}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=SL(aL,e.nativeEvent);c?.(t,n),!M&&(_(t!==(v.initialValue??``)),b(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(C(D),S.change(t)))},onFocus(){y(!0)},onBlur(e){if(g(!0),y(!1),x===`onBlur`){let t=e.currentTarget.value;S.commit(t),M&&queueMicrotask(()=>{let e=S.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&S.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===w.current&&!e.defaultPrevented){let t=e.currentTarget,n=T.current;ee.start(0,()=>{T.current===n&&S.commit(t.value)})}else S.commit(t)}}},f,e=>S.getValidationProps(E,e)],stateAttributesMapping:l8})}),Mhe=Z.forwardRef(function(e,t){return(0,Q.jsx)(jhe,{ref:t,...e})});function v8({className:e,type:t,...n}){return(0,Q.jsx)(Mhe,{type:t,"data-slot":`input`,className:HV(`h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function y8(e){e.catch(()=>void 0)}function b8(e,t){e.preventDefault(),y8(t())}function Nhe(e){let t=(0,QB.c)(3),n;t[0]===e?n=t[1]:(n=Tle(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],wN(n,r)}function Phe(e,t){let n=(0,QB.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],wN(r)}function Fhe(e,t){let n=(0,QB.c)(3),r;return n[0]!==e||n[1]!==t?(r=Dle({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],wN(r)}function Ihe(e,t){let n=(0,QB.c)(3),r;return n[0]!==e||n[1]!==t?(r=Ole({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],wN(r)}function Lhe(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=kle(e),t[0]=e,t[1]=n),wN(n)}function Rhe(e){let t=(0,QB.c)(3),n;t[0]===e?n=t[1]:(n=Mle(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],wN(n,r)}function zhe(e){let t=(0,QB.c)(2),n;return t[0]===e?n=t[1]:(n=Nle(e),t[0]=e,t[1]=n),wN(n)}function Bhe(e,t){let n=(0,QB.c)(3),r;return n[0]!==e||n[1]!==t?(r=jle({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],wN(r)}function Vhe(e){let t=(0,QB.c)(31),{connection:n,environment:r,onCancel:i}=e,[a,o]=(0,Z.useState)(null),[s]=(0,Z.useState)(Hhe),[c,l]=Rhe(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:kde,value:u,onChange:v}),t[9]=g,t[10]=_,t[11]=u,t[12]=y):y=t[12];let b=p||c.waiting,x=c.waiting?`Saving…`:`Save`,S;t[13]!==b||t[14]!==x?(S=(0,Q.jsx)(XV,{type:`submit`,variant:`outline`,disabled:b,children:x}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===i?C=t[17]:(C=(0,Q.jsx)(XV,{type:`button`,variant:`ghost`,onClick:i,children:`Cancel`}),t[16]=i,t[17]=C);let w;t[18]!==S||t[19]!==C||t[20]!==y?(w=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[y,S,C]}),t[18]=S,t[19]=C,t[20]=y,t[21]=w):w=t[21];let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(V6,{children:`Paired devices show it so you know where they are connected. Leave it empty to use the host name.`}),t[22]=T):T=t[22];let E;t[23]===w?E=t[24]:(E=(0,Q.jsxs)(B6,{children:[h,w,T]}),t[23]=w,t[24]=E);let D;t[25]===c?D=t[26]:(D=aS(c)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(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 Hhe(){return Uhe}function Uhe(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(IN(33));return t}var C8=Z.createContext(void 0);function w8(e){let t=Z.useContext(C8);if(t===void 0&&!e)throw Error(IN(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(IN(25));return t}var D8=Z.createContext(void 0);function Whe(){let e=Z.useContext(D8);if(e===void 0)throw Error(IN(30));return e}function Ghe(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=E8(!0),f=d!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:uL})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!kP&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&tL(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var O8={type:`regular-item`};function k8(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Z.useRef(null),{getButtonProps:d,buttonRef:f}=nL({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Ghe({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>dI(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=$F(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var A8=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Khe(){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}=Khe(),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 PN(()=>{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 qhe=`data-checked`,Jhe=`data-unchecked`,M8={checked(e){return e?{[qhe]:``}:{[Jhe]:``}},...zP},Yhe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=j8({guess:!0,label:a}),h=S8(!0),g=vU(i),{store:_}=w8(),v=_.useState(`disabled`),y=s||v,b=_.useState(`isActive`,m.index),x=_.useState(`itemProps`),[S,C]=h8({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:w,itemRef:T}=k8({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:O8}),E=Z.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=SL(uL,e.nativeEvent,void 0,{preventUnmountOnClose:ON});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=TI(`div`,e,{state:E,stateAttributesMapping:M8,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,Q.jsx)(D8.Provider,{value:E,children:O})}),Xhe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Whe(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Mz(s.checked);return LI({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),TI(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:M8,props:{"aria-hidden":!0,...o},enabled:a||u})}),N8=Z.createContext(void 0);function Zhe(){let e=Z.useContext(N8);if(e===void 0)throw Error(IN(31));return e}var P8=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(void 0),c=TI(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Q.jsx)(N8.Provider,{value:s,children:c})}),Qhe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=vU(a),c=Zhe();return PN(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),TI(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),F8=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=j8({guess:!0,label:a}),f=S8(!0),p=vU(i),{store:m}=w8(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=k8({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:O8});return TI(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),$he=Z.createContext(void 0);function I8(e){let t=Z.useContext($he);if(t===void 0&&!e)throw Error(IN(69));return t}var L8=`ArrowUp`,R8=`ArrowDown`,z8=`ArrowLeft`,B8=`ArrowRight`,V8=new Set([L8,R8,z8,B8,`Home`,`End`]),ege=[`Shift`,`Control`,`Alt`,`Meta`];function tge(e){return $N(e)&&e.tagName===`INPUT`}function H8(e){return!!(tge(e)&&e.selectionStart!=null||$N(e)&&e.tagName===`TEXTAREA`)}function U8(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=W8(e,t,`left`),a=G8(e),o=G8(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=W8(e,t,`top`),r=G8(e),i=G8(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function W8(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function G8(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var K8=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=w8(),{side:c,align:l}=S8(),u=I8(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;LI({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,SL(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),fB(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=TI(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:WP,props:[p,{onKeyDown(e){u&&V8.has(e.key)&&e.stopPropagation()}},XB(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,Q.jsx)(vR,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),q8=Z.createContext(void 0);function nge(){let e=Z.useContext(q8);if(e===void 0)throw Error(IN(32));return e}var J8=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=w8();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,Q.jsx)(q8.Provider,{value:n,children:(0,Q.jsx)(OL,{ref:t,...r,portalOwnerRole:o})})});function Y8(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=GN(i),[,o]=Z.useState(!1),s=NN(ige).current,c=NN(rge).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=GN(()=>{u.current||(u.current=!0,o(e=>!e))}),m=GN((e,t)=>{c.set(e,t),p()}),h=GN(e=>{c.delete(e),p()}),g=GN(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(!sge(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=oge(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=GN(()=>{let[e,t]=age(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))});PN(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),PN(()=>{u.current&&v()}),PN(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=GN(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 rge(){return new Map}function ige(){return new Set}function age(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 oge(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function sge(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 tP(e)?e:t}function n5(e,t,n){return/hidden|clip/.test(e.getComputedStyle(t5(t,n)).overflowY)}function cge(e){if(typeof document>`u`)return!1;let t=hP(e);return YN(t).innerWidth-t.documentElement.clientWidth>0}function lge(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=hP(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 uge(e){let t=hP(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 dge(e){let t=hP(e),n=t.documentElement,r=t.body,i=YN(n),a=0,o=0,s=!1,c=yP.create();if(AP&&(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=lge(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=gP(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var fge=new class{lockCount=0;restore=null;timeoutLock=SP.create();timeoutUnlock=SP.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=hP(e),n=t.documentElement,r=t.body,i=YN(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=EP||!cge(e);this.restore=a?uge(e):dge(e)}};function r5(e=!0,t=null){PN(()=>{if(e)return fge.acquire(t)},[e,t])}var pge=20;function i5(e,t,n,r){let[i,a]=Z.useState(!1);PN(()=>{if(!e||!t||n==null){a(!1);return}let r=hP(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-pge)},[e,t,n]),r5(e&&(!t||i),r)}var a5=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=WI,style:g,..._}=e,{store:v}=w8(),y=nge(),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`),ee=Z.useRef(null),L=II(A),te=n,R=c,ne=l,re=s,ie=h;x.type===`context-menu`&&(te=n??x.context?.anchor,re??=`start`,!o&&re!==`center`&&(ne=e.alignOffset??2,R=e.sideOffset??-5));let ae=o,oe=re;x.type===`menu`?(ae??=`inline-end`,oe??=`start`,ie=e.collisionAvoidance??GI):x.type===`menubar`&&(ae??=x.context.orientation===`vertical`?`inline-end`:`bottom`,oe??=`start`);let se=x.type===`context-menu`,ce=qB({anchor:te,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:ae,sideOffset:R,align:oe,alignOffset:ne,arrowPadding:se?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:ie,shift:se?{crossAxis:!(`side`in ie&&ie.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,SL(gL)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Z.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,SL(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let le=CP();Z.useEffect(()=>{T||le.clear()},[T,le]),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?le.isStarted()||le.start(e,()=>{v.setOpen(!1,SL(gL))}):v.setOpen(!1,SL(gL))}else le.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,le]),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]),PN(()=>{let e=I,t=ee.current;if(e&&(ee.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return L(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,L,v]);let ue={open:T,side:ce.side,align:ce.align,anchorHidden:ce.anchorHidden,nested:x.type===`menu`,instant:j},de=x.type===`menubar`&&x.context.modal;i5(T&&(de||E&&N!==`trigger-hover`),D===`touch`,A,O);let fe=ZB(e,ue,{styles:ce.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),pe=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),me=null;return x.type===`menubar`?me=x.context.contentElement:x.type===void 0&&(me=O),(0,Q.jsxs)(x8.Provider,{value:ce,children:[pe&&(0,Q.jsx)(Z8,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:MI(!T),cutout:me}),(0,Q.jsx)(cR,{id:P,children:(0,Q.jsx)(Y8,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:fe})})]})}),o5=Z.createContext(void 0);function mge(){let e=Z.useContext(o5);if(e===void 0)throw Error(IN(34));return e}var hge=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=GN((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=TI(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Z.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,Q.jsx)(N8.Provider,{value:f,children:(0,Q.jsx)(o5.Provider,{value:_,children:g})})})),s5=Z.createContext(void 0);function gge(){let e=Z.useContext(s5);if(e===void 0)throw Error(IN(35));return e}var _ge=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=j8({guess:!0,label:a}),p=S8(!0),m=vU(i),{store:h}=w8(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=mge(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=k8({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:O8}),E=Z.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=SL(uL,e.nativeEvent,void 0,{preventUnmountOnClose:ON});y(l,t)}let O=TI(`div`,e,{state:E,stateAttributesMapping:M8,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,Q.jsx)(s5.Provider,{value:E,children:O})}),vge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=gge(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Mz(s.checked);return LI({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),TI(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:M8,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),yge=Z.createContext(null);function c5(e){let t=Z.useContext(yge);if(t===null&&!e)throw Error(IN(5));return t}function bge(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}=bge(GN((n,r)=>{(typeof e==`function`?e():e)||t(r||(EP?`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 xge={...eB,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},Sge=class extends KN{constructor(e,t,n=!1){let r=new qz,i=wge(r,t,n,e);super(i,Cge(r),xge),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 Cge(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 wge(e,t,n=!1,r){return{...Jz(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new nR,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:AN,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var Tge=Z.createContext(void 0);function Ege(){return Z.useContext(Tge)}var d5=BN(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=Ege(),b=Z.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=ZI(),S=ZI(),C=aR(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=NN(()=>T?w?.state.instantType:void 0).current,D=Dge({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b,disabled:o,highlightItemOnHover:h,modal:b.type===void 0?s:void 0,rootId:x,instantType:E},S,C!=null);D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,p),D.useContextCallback(`onOpenChangeComplete`,i);let O=D.useState(`floatingTreeRoot`),k=sR(O),A=D.useState(`open`),j=D.useState(`activeTriggerElement`),M=D.useState(`positionerElement`),N=D.useState(`hoverEnabled`),P=D.useState(`disabled`),F=D.useState(`lastOpenChangeReason`),I=D.useState(`parent`),ee=D.useState(`activeIndex`),L=D.useState(`payload`),te=D.useState(`floatingParentNodeId`),R=Z.useRef(null),ne=Z.useRef(I.type!==`context-menu`),re=CP(),ie=Z.useRef(!0),ae=CP(),oe=te!=null,{openMethod:se,triggerProps:ce}=u5(A);D.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:I.type===void 0?s:void 0,openMethod:se,rootId:x}),Uz(D);let{forceUnmount:le,transitionStatus:ue}=Wz(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),de=II(D.context.popupRef);Z.useEffect(()=>{if(E===void 0)return;let e=()=>{D.state.instantType===E&&D.set(`instantType`,void 0)};if(!A){e();return}if(ue!==void 0)return;if(D.context.popupRef.current==null){e();return}let t=new AbortController;return de(e,t.signal),()=>{t.abort()}},[E,A,ue,de,D]),PN(()=>{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||(R.current=null),I.type===`context-menu`){if(!A){re.clear(),ne.current=!1;return}re.start(500,()=>{ne.current=!0})}},[re,A,I.type]),PN(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let fe=GN((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=Bz(t);if(!e&&t.trigger==null&&(t.trigger=j??void 0),r?.(e,t),t.isCanceled)return;D.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!ie.current)return;e&&n===`trigger-focus`?(ie.current=!1,ae.start(300,()=>{ie.current=!0})):(ie.current=!0,ae.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);R.current=t.event;let c=zz(D.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=I.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,D.update(c)}),pe=jz({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:fe}),me=pe.context.events;PN(()=>{let e=({open:e,eventDetails:t})=>fe(e,t);return me.on(`setOpen`,e),()=>{me?.off(`setOpen`,e)}},[me,fe]);let he=Z.useCallback(()=>{D.setOpen(!1,SL(bL))},[D]);Z.useImperativeHandle(u,()=>({unmount:le,close:he}),[le,he]);let ge;I.type===`context-menu`&&(ge=I.context),Z.useImperativeHandle(ge?.positionerRef,()=>M,[M]),Z.useImperativeHandle(ge?.actionsRef,()=>({setOpen:fe}),[fe]);let _e=TR(pe,{enabled:!P,bubbles:{escapeKey:d&&I.type===`menu`},outsidePress(){return I.type!==`context-menu`||R.current?.type===`contextmenu`||ne.current},externalTree:oe?O:void 0}),ve=NB(),ye=Z.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),be=SB(pe,{enabled:!P,listRef:D.context.itemDomElements,activeIndex:ee,nested:I.type!==void 0,loopFocus:c,orientation:l,parentOrientation:I.type===`menubar`?I.context.orientation:void 0,rtl:ve===`rtl`,disabledIndices:kN,onNavigate:ye,openOnArrowKeyDown:I.type!==`context-menu`,externalTree:oe?O:void 0,focusItemOnHover:h}),xe=Z.useCallback(e=>{D.context.typingRef.current=e},[D]),Se=CB(pe,{enabled:!P,listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:ee,resetMs:500,onMatch:e=>{A&&e!==ee&&D.set(`activeIndex`,e)},onTyping:xe}),Ce=Z.useMemo(()=>{let e=dI(Se.reference,be.reference,_e.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},ce);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[D,Se.reference,be.reference,_e.reference,ce,A]),we=Z.useMemo(()=>{let e=dI(be.trigger,_e.trigger,ce);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[be.trigger,_e.trigger,ce]);NN(()=>(D.update({inactiveTriggerProps:we}),null)),Gz(D,{floatingRootContext:pe,activeTriggerProps:Ce,inactiveTriggerProps:we,popupProps:Z.useMemo(()=>dI(Nz,{id:S,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":j?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),I.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Se.floating,be.floating,_e.floating),[j,S,l,I.type,D,Se.floating,be.floating,_e.floating]),itemProps:be.item??AN});let Te=Z.useMemo(()=>({store:D,parent:b}),[D,b]),Ee=(0,Q.jsxs)(C8.Provider,{value:Te,children:[f&&(0,Q.jsx)(Iz,{handle:f,store:D}),typeof t==`function`?t({payload:L}):t]});return I.type===void 0||I.type===`context-menu`?(0,Q.jsx)(lR,{externalTree:O,children:Ee}):Ee});function Dge(e,t,n){return NN(()=>new Sge(e,t,n)).current}var f5=5;function p5(e,t){let n=Oge(t);return e.clientX>=n.left-f5&&e.clientX<=n.right+f5&&e.clientY>=n.top-f5&&e.clientY<=n.bottom+f5}function Oge(e){let t=e.getBoundingClientRect(),n=YN(e);if(jP)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function m5(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=$I(),{ref:i,index:a}=j8(e),o=n===a,s=Z.useRef(null),c=$F(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function kge(e){let{render:t,className:n,style:r,state:i=AN,props:a=kN,refs:o=kN,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=m5({metadata:s});return TI(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function h5(e){if($N(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!sP(e))return h5(uP(e))}function g5(e,t){let n=Z.useRef(null);function r(t){FN.flushSync(()=>{e.setOpen(!1,SL(fL,t.nativeEvent,t.currentTarget))}),GF(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&KF(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{FN.flushSync(()=>{e.setOpen(!1,SL(fL,n.nativeEvent,n.currentTarget))});let i=WF(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&NP(r,i);){let e=i;if(i=VF(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Age(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,hP(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:AN,[t,n,r])}var jge=VN(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=w8(!0),h=tB(d)??m?.store;if(!h)throw Error(IN(85));let g=vU(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),S=Nge(),C=$I(!0),w=oR(),T=Z.useMemo(()=>w??new nR,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Hz(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:sR(T),floatingParentNodeId:aR(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=nL({disabled:A,native:o});Z.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=Z.useRef(null),P=CP(),F=GN(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;NP(N.current,t)||NP(h.select(`positionerElement`),t)||t===N.current||(t==null||h5(t)!==h.select(`rootId`))&&(p5(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:hL}))});Z.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&hP(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,ee=mB(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:jB({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),L=Mge(y,h.select(`lastOpenChangeReason`)),te=yR(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&L}),R=oB(v,{enabled:!A&&I}),ne=Age({open:y,enabled:O,mouseDownAction:`open`}),re=Z.useMemo(()=>dI(R.reference,te.reference),[R.reference,te.reference]),ie=h.useState(`triggerProps`,D),{preFocusGuardRef:ae,handlePreFocusGuardFocus:oe,handleFocusTargetFocus:se}=g5(h,x),ce={disabled:A,open:y},le=[N,t,M,E,x],ue=[re,ee??AN,ie,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),hP(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},ne,p,j],de=TI(`button`,e,{enabled:!O,stateAttributesMapping:HP,state:ce,ref:le,props:ue});return O?(0,Q.jsx)(kge,{tag:`button`,render:n,className:r,style:i,state:ce,refs:le,props:ue,stateAttributesMapping:HP}):y?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(QF,{ref:ae,onFocus:oe},`${g}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:de},g),(0,Q.jsx)(QF,{ref:h.context.triggerFocusTargetRef,onFocus:se},`${g}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:de},g)});function Mge(e,t){let n=CP(),[r,i]=Z.useState(!1);return PN(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Nge(){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)(jge,{"data-slot":`dropdown-menu-trigger`,...e})}function b5({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,Q.jsx)(J8,{children:(0,Q.jsx)(a5,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Q.jsx)(K8,{"data-slot":`dropdown-menu-content`,className:HV(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,i),...a})})})}function x5({...e}){return(0,Q.jsx)(P8,{"data-slot":`dropdown-menu-group`,...e})}function S5({className:e,inset:t,...n}){return(0,Q.jsx)(Qhe,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:HV(`px-2 py-1.5 text-xs text-muted-foreground data-inset:pl-7.5`,e),...n})}function Pge({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(F8,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:HV(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Fge({className:e,children:t,checked:n,inset:r,...i}){return(0,Q.jsxs)(Yhe,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:HV(`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),checked:n,...i,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,Q.jsx)(Xhe,{children:(0,Q.jsx)(mH,{})})}),t]})}function Ige({...e}){return(0,Q.jsx)(hge,{"data-slot":`dropdown-menu-radio-group`,...e})}function Lge({className:e,children:t,inset:n,...r}){return(0,Q.jsxs)(_ge,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:HV(`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),...r,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Q.jsx)(vge,{children:(0,Q.jsx)(mH,{})})}),t]})}function Rge({className:e,...t}){return(0,Q.jsx)(L6,{"data-slot":`dropdown-menu-separator`,className:HV(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var zge={desktop:WH,laptop:IH,server:QH,cloud:EH};function C5(e){let t=(0,QB.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=zge[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 Bge(e){let t=(0,QB.c)(18),{icon:n,pending:r,onChange:i}=e,a=`Icon: ${E4[n]}`,o;t[0]!==r||t[1]!==a?(o=(0,Q.jsx)(XV,{variant:`ghost`,size:`sm`,disabled:r,"aria-label":a}),t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Q.jsx)(C5,{icon:n}),t[3]=n,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,Q.jsxs)(y5,{render:o,children:[s,`Icon`]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(S5,{children:`Icon of this computer`}),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=e=>i(e),t[9]=i,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=ade.map(Vge),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 Vge(e){return(0,Q.jsxs)(Lge,{value:e,className:`cursor-pointer`,children:[(0,Q.jsx)(C5,{icon:e}),E4[e]]},e)}function w5(e){switch(e.status){case`checking`:return`Checking for a new version…`;case`downloading`:return`Downloading ${e.version}…`;case`ready`:return`${e.version} is ready; the app restarts to finish.`;case`installing`:return`Installing ${e.version}; the app restarts in a moment.`;default:return}}function Hge(e){return e.status===`unavailable`?`This build updates by reinstalling; there is no update feed yet.`:`Up to date`}var Uge=FE(V3.layer).atom(Yf(V3,e=>t=>e.installUpdate.pipe(np(e=>new N2({message:e.message}))))),Wge=EE(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=Gn(fS(e(a8)));if(i&&a){if(a.isDesktopShell){let i=e(o8),a=Gn(Qn(fS(i))),o=Gn(fS(e(s8)));r||=i.waiting;let s=D5(o,i);s&&n.push({id:`mac-app`,name:`Mac app`,message:s});let c=Gn(fS(e(Uge)));a&&c&&t.push({current:a.current,checking:i.waiting,error:D5(o,i),note:o?Hge(o):void 0,target:{kind:`mac-app`,id:`mac-app`,name:`Mac app`,available:rS(i)&&o?.status===`available`&&!i.waiting,latest:o&&`version`in o?o.version:void 0,update:c}})}else{let a=e(l2(i));r||=a.waiting,aS(a)&&n.push({id:i.environmentId,name:`This computer`,message:x2(Ul(a.cause))});let o=r2(a),s=Gn(fS(e(R2(i))));o&&t.push({current:o.version,target:{kind:`service`,id:i.environmentId,name:s?.environment.name??`This computer`,connection:i,state:o,deviceId:_6.value}})}}for(let{remote:i,connection:a}of C6.value){a.activeRoute&&e.addFinalizer(a.activeRoute.subscribe(()=>e.refreshSelf()));let o=e(H0(g6,i,a));if(o.kind!==`online`)continue;let s=e(l2(a));r||=s.waiting,aS(s)&&n.push({id:i.environmentId,name:o.name,message:x2(Ul(s.cause))});let c=r2(s);c&&t.push({current:c.version,target:{kind:`service`,id:i.environmentId,name:o.name,connection:a,state:c,deviceId:a.activeRoute?.value?.deviceId??i.deviceId}})}return{rows:t,failures:n,checking:r}}),T5=BE((e,t)=>{let n=x6.state.value.connection,r=Gn(fS(t(a8)));e===`retry`&&r?.isDesktopShell&&!t(o8).waiting&&t.refresh(o8);let i=new Set([...n&&!r?.isDesktopShell?[n]:[],...C6.value.map(({connection:e})=>e)]);for(let e of i){let n=l2(e);t(n).waiting||t.refresh(n)}}),Gge=EE(e=>{rS(e(a8))&&e.set(T5,`entry`)}).pipe(gE(0));function Kge(){xN(Gge)}function E5(){let e=(0,QB.c)(11),{rows:t,failures:n,checking:r}=vN(Wge),i=SN(T5),a=vN(M2),[o,s]=wN(qle),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(qge),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:Wle(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 qge(e){return e.target}function D5(e,t){if(e?.status===`error`)return e.message;if(!t.waiting&&aS(t))return x2(Ul(t.cause))}function Jge(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=h8({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=Mz(a,!0,!0),u=vU(),[d,f]=Z.useState(),p=d===null?void 0:d??u,m=GN(e=>{let t=!a,n=SL(oL,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return Z.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var O5=Z.createContext(void 0);function k5(){let e=Z.useContext(O5);if(e===void 0)throw Error(IN(15));return e}var Yge=`data-open`,Xge=`data-closed`,Zge=LP,Qge=`data-panel-open`,$ge={[Yge]:``},e_e={[Xge]:``},t_e={open(e){return e?{[Qge]:``}:null}},A5={open(e){return e?$ge:e_e},...zP},n_e=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=GN(o),d=Jge({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=Z.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=Z.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=TI(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:A5});return(0,Q.jsx)(O5.Provider,{value:p,children:m})}),r_e={...t_e,...zP},i_e=Z.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=k5(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=nL({disabled:c,focusableWhenDisabled:!0,native:u});return TI(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:r_e})}),j5={height:void 0,width:void 0};function a_e(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=Z.useRef(null),f=Z.useRef(null),[p,m]=Z.useState(j5),h=Z.useRef(j5),g=Z.useRef(!1),_=Z.useRef(s),v=Z.useRef(!1),[y,b]=Z.useState(!1),x=Z.useRef(null),S=$F(t,d),C=AL(s),w=II(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=GN((e,t=!0)=>{t&&(h.current=e),m(e)}),j=GN(()=>{x.current?.(),x.current=null}),M=GN(e=>{j(),x.current=()=>{x.current=null,e()}}),N=GN(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});PN(()=>{y&&u!==`starting`&&b(!1)},[y,u]),Z.useEffect(()=>()=>{N(),j()},[N,j]),PN(()=>{let e=d.current;if(!e)return;!s&&x.current&&j();let t=o_e(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=s_e(e);if(A(M5(e)),!n)return t;let r=P5(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(M5(e));let r=P5(e,`animation-name`,`none`);if(!n){r();return}let i=P5(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(_.current=!1,v.current=!1,t===`none`){A(j5,!1),c(!1);return}A(M5(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=M5(e);if(!(n.height>0||n.width>0)){c(!1);return}A(n),t===`css-animation`&&P5(e,`animation-name`,`none`)()},[a,s,j,A,c,M,D,u]),LI({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(j5,!1)}}),Z.useEffect(()=>{if(s||!a||E!==`ending`||!d.current)return;let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(j5,!1))}return t=yP.request(()=>{w(n,e.signal)}),()=>{yP.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),PN(()=>{let e=d.current;e&&n&&T&&e.setAttribute(`hidden`,`until-found`)},[T,n]),Z.useEffect(function(){let e=d.current;if(!e)return;function t(e){let t=SL(aL,e);o(!0,t),!t.isCanceled&&(g.current=!0,l(!0))}return gP(e,`beforematch`,t)},[o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[Zge]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function M5(e){return{height:e.scrollHeight,width:e.scrollWidth}}function o_e(e,t){let n=YN(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 s_e(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=yP.request(n);return()=>{yP.cancel(r),n()}}var c_e=`--collapsible-panel-height`,l_e=`--collapsible-panel-width`,u_e=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;PN(()=>(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}=a_e({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=lI(s,k),j=TI(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[c_e]:S===void 0?`auto`:`${S}px`,[l_e]: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)(n_e,{"data-slot":`collapsible`,...e})}function I5({...e}){return(0,Q.jsx)(i_e,{"data-slot":`collapsible-trigger`,...e})}function L5({...e}){return(0,Q.jsx)(u_e,{"data-slot":`collapsible-content`,...e})}function R5(e){let t=(0,QB.c)(86),{row:n,showName:r,prominent:i}=e,a=r!==void 0&&r,o=i!==void 0&&i,{target:s,current:c}=n,{batch:l,run:u}=E5(),d=c8(),f=T6(),p;if(t[0]!==l.entries||t[1]!==s.id||t[2]!==s.kind){let e;t[4]!==s.id||t[5]!==s.kind?(e=e=>e.id===s.id&&e.kind===s.kind,t[4]=s.id,t[5]=s.kind,t[6]=e):e=t[6],p=l.entries.find(e),t[0]=l.entries,t[1]=s.id,t[2]=s.kind,t[3]=p}else p=t[3];let m=p,h=j2(s),g;t[7]===s?g=t[8]:(g=s.kind===`service`?Ule(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`?Nde(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`?Pde(s.state):void 0,t[13]=s.kind,t[14]=s.state,t[15]=b):b=t[15];let x=b,S=s.kind===`service`?s.state.latest:s.latest,C=l.running&&(m?.status===`updating`||m?.status===`queued`),w;if(C||y){let e;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(M6,{}),t[16]=e):e=t[16];let n=y??(m?.status===`queued`?`Queued`:`Updating…`),r;t[17]===n?r=t[18]:(r=(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs leading-4`,children:[e,n]}),t[17]=n,t[18]=r),w=r}else if(h){let e=s.kind===`mac-app`?`Restart to update`:`Update ${s.name}`,n;t[19]!==u||t[20]!==s?(n=()=>u([s]),t[19]=u,t[20]=s,t[21]=n):n=t[21];let r=s.kind===`mac-app`?`Restart to update`:`Update`,i;t[22]!==l.running||t[23]!==e||t[24]!==n||t[25]!==r?(i=(0,Q.jsx)(XV,{size:`sm`,"aria-label":e,disabled:l.running,onClick:n,children:r}),t[22]=l.running,t[23]=e,t[24]=n,t[25]=r,t[26]=i):i=t[26],w=i}else if(_&&s.kind===`service`&&s.state.available){let e;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(I5,{render:(0,Q.jsx)(XV,{size:`sm`,variant:`ghost`}),children:[(0,Q.jsx)(HH,{}),`Needs trust`]}),t[27]=e):e=t[27],w=e}else{let e=n.note??(S?`Up to date`:`Latest version unavailable`);s.kind===`service`&&!s.state.managed&&(e=`Managed on that computer`);let r;t[28]!==e||t[29]!==n.error?(r=!n.error&&(0,Q.jsx)(`span`,{className:`text-xs leading-4 text-muted-foreground`,children:e}),t[28]=e,t[29]=n.error,t[30]=r):r=t[30],w=r}let T=`${s.name} update`,E=o?`gap-x-6 gap-y-3`:`gap-3`,D;t[31]===E?D=t[32]:(D=HV(`flex flex-wrap items-center justify-between`,E),t[31]=E,t[32]=D);let O;t[33]!==a||t[34]!==s.name?(O=a&&(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:s.name}),t[33]=a,t[34]=s.name,t[35]=O):O=t[35];let k=o?`text-sm leading-5 font-medium`:`text-xs leading-4 text-muted-foreground`,A;t[36]===k?A=t[37]:(A=HV(`tabular-nums`,k),t[36]=k,t[37]=A);let j=c??`Development build`,M;t[38]===j?M=t[39]:(M=(0,Q.jsx)(`span`,{children:j}),t[38]=j,t[39]=M);let N;t[40]!==S||t[41]!==s?(N=A2(s)&&S&&(0,Q.jsxs)(Q.Fragment,{children:[` → `,S]}),t[40]=S,t[41]=s,t[42]=N):N=t[42];let P;t[43]!==A||t[44]!==M||t[45]!==N?(P=(0,Q.jsxs)(`p`,{className:A,children:[M,N]}),t[43]=A,t[44]=M,t[45]=N,t[46]=P):P=t[46];let F;t[47]!==O||t[48]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[O,P]}),t[47]=O,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==w||t[51]!==F||t[52]!==D?(I=(0,Q.jsxs)(`div`,{className:D,children:[F,w]}),t[50]=w,t[51]=F,t[52]=D,t[53]=I):I=t[53];let ee;t[54]!==s.kind||t[55]!==s.state||t[56]!==_?(ee=_&&s.kind===`service`&&s.state.available&&(0,Q.jsx)(L5,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:_.hint}),_.deviceId&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`code`,{className:`break-all`,children:_.deviceId}),(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy device ID`,onClick:()=>HU(_.deviceId??``,`device ID`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{role:`tooltip`,className:`break-all`,children:`Copy device ID`})]})]})]})}),t[54]=s.kind,t[55]=s.state,t[56]=_,t[57]=ee):ee=t[57];let L;t[58]===n.error?L=t[59]:(L=n.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:n.error}),t[58]=n.error,t[59]=L);let te;t[60]===m?te=t[61]:(te=m?.status===`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:m.message}),t[60]=m,t[61]=te);let R;t[62]!==m?.status||t[63]!==x||t[64]!==C?(R=!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]=R):R=t[65];let ne;t[66]===m?ne=t[67]:(ne=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]=ne);let re;t[68]!==m?.status||t[69]!==f?.environmentId||t[70]!==s.id||t[71]!==s.kind?(re=m?.status===`updated`&&s.kind===`service`&&f?.environmentId===s.id&&(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,className:`self-start`,onClick:d_e,children:`Reload`}),t[68]=m?.status,t[69]=f?.environmentId,t[70]=s.id,t[71]=s.kind,t[72]=re):re=t[72];let ie;t[73]!==s.kind||t[74]!==s.state?(ie=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]=ie):ie=t[75];let ae;return t[76]!==I||t[77]!==ee||t[78]!==L||t[79]!==te||t[80]!==R||t[81]!==ne||t[82]!==re||t[83]!==ie||t[84]!==T?(ae=(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,ee,L,te,R,ne,re,ie]})}),t[76]=I,t[77]=ee,t[78]=L,t[79]=te,t[80]=R,t[81]=ne,t[82]=re,t[83]=ie,t[84]=T,t[85]=ae):ae=t[85],ae}function d_e(){return window.location.reload()}function z5(e){let t=(0,QB.c)(19),{connection:n,prominent:r}=e,{rows:i}=E5(),a;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>{let{target:t}=e;return t.kind===`service`&&t.id===n.environmentId},t[3]=n,t[4]=e),a=i.find(e),t[0]=n,t[1]=i,t[2]=a}else a=t[2];let o=a,s=hhe(n),c;t[5]===n?c=t[6]:(c=l2(n),t[5]=n,t[6]=c);let l=CN(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(aS(s)){let e;t[10]===s.cause?e=t[11]:(e=x2(Ul(s.cause)),t[10]=s.cause,t[11]=e);let n;t[12]!==l||t[13]!==s.waiting?(n=(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,disabled:s.waiting,onClick:l,children:`Try again`}),t[12]=l,t[13]=s.waiting,t[14]=n):n=t[14];let r;return t[15]!==e||t[16]!==n?(r=(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsxs)($6,{children:[e,n]})}),t[15]=e,t[16]=n,t[17]=r):r=t[17],r}let u;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(M6,{}),t[18]=u):u=t[18],u}function f_e(e){let t=(0,QB.c)(3),{prominent:n}=e,r=n!==void 0&&n,i=T6(),a;return t[0]!==i||t[1]!==r?(a=i&&(0,Q.jsx)(z5,{connection:i,prominent:r}),t[0]=i,t[1]=r,t[2]=a):a=t[2],a}function p_e(e){let t=(0,QB.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(z5,{connection:n,prominent:!0}),t[0]=n,t[1]=r),r}function m_e(e){let t=(0,QB.c)(7),{prominent:n}=e,r=n!==void 0&&n,{rows:i,checking:a}=E5(),o;t[0]===i?o=t[1]:(o=i.find(h_e),t[0]=i,t[1]=o);let s=o;if(s){let e;return t[2]!==r||t[3]!==s?(e=(0,Q.jsx)(R5,{row:s,prominent:r}),t[2]=r,t[3]=s,t[4]=e):e=t[4],e}let c;return t[5]===a?c=t[6]:(c=a?(0,Q.jsx)(M6,{}):null,t[5]=a,t[6]=c),c}function h_e(e){let{target:t}=e;return t.kind===`mac-app`}var B5=Z.createContext(void 0);function g_e(){let e=Z.useContext(B5);if(e===void 0)throw Error(IN(63));return e}var __e=`data-checked`,v_e=`data-unchecked`,V5={...l8,checked(e){return e?{[__e]:``}:{[v_e]:``}}},y_e=Z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=d8(),{state:x,setTouched:S,setDirty:C,validityData:w,setFilled:T,setFocused:E,validationMode:D,disabled:O,name:k,validation:A}=u8(),{labelId:j}=f8(),M=O||m,N=k??l,P=Z.useRef(null),F=$F(P,c,A.inputRef),I=Z.useRef(null),ee=vU(),L=m8({id:s}),te=u?void 0:L,[R,ne]=h8({controlled:n,default:!!i,name:`Switch`,state:`checked`});g8(I,ee,R,void 0,!M,l),PN(()=>{T(R)},[R,T]),_8(R,()=>{b(N),C(R!==w.initialValue),A.change(R)});let{getButtonProps:re,buttonRef:ie}=nL({disabled:M,native:u}),ae=p8(a,j,P,!u,te),oe={id:u?L:ee,role:`switch`,"aria-checked":R,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ae,onFocus(){M||E(!0)},onBlur(){let e=P.current;e&&!M&&(S(!0),E(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){if(f||M)return;e.preventDefault();let t=P.current;t&&tL(t,e)}},se={...A.getValidationProps(M),checked:R,disabled:M,form:o,id:te,name:N,required:p,style:N?ZF:XF,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=SL(aL,e.nativeEvent);d?.(t,n),!n.isCanceled&&ne(t)},onClick(e){e.stopPropagation()},onFocus(){I.current?.focus()},..._===void 0?AN:{value:_}},ce=Z.useMemo(()=>({...x,checked:R,disabled:M,readOnly:f,required:p}),[x,R,M,f,p]),le=TI(`span`,e,{state:ce,ref:[t,I,ie],props:[oe,y,re,e=>A.getValidationProps(M,e)],stateAttributesMapping:V5});return(0,Q.jsxs)(B5.Provider,{value:ce,children:[le,!R&&N&&g!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:o,name:N,value:g,disabled:M}),(0,Q.jsx)(`input`,{...se,suppressHydrationWarning:!0})]})}),b_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return TI(`span`,e,{state:g_e(),ref:t,stateAttributesMapping:V5,props:a})});function H5({className:e,size:t=`default`,...n}){return(0,Q.jsx)(y_e,{"data-slot":`switch`,"data-size":t,className:HV(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,Q.jsx)(b_e,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function x_e(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}var U5=Z.createContext(void 0),W5=Z.createContext(void 0),G5=Z.createContext(void 0);function K5(){let e=Z.useContext(U5);if(e===void 0)throw Error(IN(60));return e}function q5(){let e=Z.useContext(W5);if(e===void 0)throw Error(IN(101));return e}function J5(){let e=Z.useContext(G5);if(e===void 0)throw Error(IN(61));return e}function S_e(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var Y5=(e,t)=>Object.is(e,t);function X5(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function C_e(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!S_e(e,t,(e,t)=>X5(e,t,n)):e!==t}function Z5(e,t,n){return e?e.some(e=>e!==void 0&&X5(t,e,n)):!1}function Q5(e,t,n){return e?e.findIndex(e=>e!==void 0&&X5(e,t,n)):-1}function w_e(e,t){if(t!==Y5)return n=>Z5(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function $5(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(w_e(t,n)):Q5(e,t,n);return i===-1?null:i}function T_e(e,t,n,r,i,a){return Z5(r,t,i)?a!=null&&e>a&&Z5(r,n[a],i)?a:e:e===a?$5(n,r,i,!0):a}function E_e(e,t,n){return e.filter(e=>!X5(t,e,n))}function e7(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function D_e(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function t7(e){return D_e(e?.[0])}function O_e(e){return t7(e)?e.flatMap(e=>e.items):e}function k_e(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(t7(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function n7(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return e7(e)}function r7(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?e7(e.value):e7(e)}function i7(e,t,n){function r(){return n7(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=O_e(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function A_e(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:i7(r,t,n)},i)),e),[])}var j_e={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:r7(t,r)!==``},hasNullItemLabel:(e,t)=>t?k_e(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>X5(t,e,n)):X5(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function a7(e,t){return Math.max(0,e-t)}function o7(e,t){if(t<=0)return 0;let n=qI(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function M_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,ee=j??c,[L,te]=h8({controlled:n,default:y?r??kN:r,name:`Select`,state:`value`}),[R,ne]=h8({controlled:a,default:o,name:`Select`,state:`open`}),re=Z.useRef([]),ie=Z.useRef([]),ae=Z.useRef(null),oe=Z.useRef(null),se=Z.useRef(0),ce=Z.useRef(null),le=Z.useRef([]),ue=Z.useRef(!1),de=Z.useRef(null),fe=Z.useRef(null),pe=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),me=Z.useRef(!1),he=Z.useRef(L),{mounted:ge,setMounted:_e,transitionStatus:ve}=Mz(R),{openMethod:ye,triggerProps:be}=u5(R),xe=NN(()=>new KN({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:L,open:R,mounted:ge,transitionStatus:ve,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:AN,triggerProps:AN,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:ON,setOpen:ON,handleScrollArrowVisibility:ON,onOpenChangeComplete:ON,listRef:re,popupRef:ae,scrollHandlerRef:oe,scrollArrowsMountedCountRef:se,valueRef:ce,valuesRef:le,labelsRef:ie,typingRef:ue,selectionRef:pe,firstItemTextRef:de,selectedItemTextRef:fe,alignItemWithTriggerActiveRef:me,initialValueRef:he},j_e)).current,Se=xe.useState(`activeIndex`),Ce=xe.useState(`selectedIndex`),we=xe.useState(`triggerElement`),Te=xe.useState(`positionerElement`),Ee=PU(ye),De=ye??Ee,Oe=Z.useMemo(()=>y?``:r7(L,x),[y,L,x]),ke=Z.useMemo(()=>y&&Array.isArray(L)?L.map(e=>r7(e,x)):r7(L,x),[y,L,x]);g8(AL(we),F,L,GN(()=>ke),!I,c);let Ae=y?Array.isArray(L)&&L.length>0:L!=null&&Oe!==``;PN(()=>{A(Ae)},[Ae,A]),PN(function(){let e=$5(le.current,L,S,y);e===null&&(fe.current=null),!R&&xe.set(`selectedIndex`,e)},[y,R,L,S,xe]),_8(L,()=>{T(ee),E(C_e(L,k.initialValue,S)),N.change(L)});let je=GN((e,t)=>{s?.(e,t),!t.isCanceled&&(ne(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(L)))}),Me=GN(()=>{_e(!1),xe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});LI({enabled:!h,open:R,ref:ae,onComplete(){R||Me()}}),Z.useImperativeHandle(h,()=>({unmount:Me}),[Me]);let Ne=GN((e,t)=>{i?.(e,t),!t.isCanceled&&te(e)}),Pe=GN(e=>{let t=a7(e.scrollHeight,e.clientHeight),n=o7(e.scrollTop,t),r=n>0,i=n<t;xe.set(`scrollUpArrowVisible`,r),xe.set(`scrollDownArrowVisible`,i)}),Fe=nB({open:R,onOpenChange:je,elements:{reference:we,floating:Te}}),Ie=yR(Fe,{enabled:!I,event:`mousedown`}),Le=TR(Fe),Re=SB(Fe,{enabled:!I,listRef:re,activeIndex:Se,selectedIndex:Ce,disabledIndices:kN,onNavigate(e){(e!==null||R)&&xe.set(`activeIndex`,e)},focusItemOnHover:C}),ze=CB(Fe,{enabled:!I&&(R||!f&&!y),listRef:ie,activeIndex:Se,selectedIndex:Ce,disabledIndices:e=>_5(re.current[e]),onMatch(e){R?xe.set(`activeIndex`,e):Ne(le.current[e],SL(aL))},onTyping(e){ue.current=e}}),Be=Z.useMemo(()=>dI(ze.reference,Re.reference,Le.reference,Ie.reference,be),[Ie.reference,ze.reference,Re.reference,Le.reference,be]),Ve=Z.useMemo(()=>dI(Nz,ze.floating,Re.floating,Le.floating),[ze.floating,Re.floating,Le.floating]),He=Re.item??AN;xe.useContextCallback(`setValue`,Ne),xe.useContextCallback(`setOpen`,je),xe.useContextCallback(`handleScrollArrowVisibility`,Pe),xe.useContextCallback(`onOpenChangeComplete`,_),x_e(()=>{xe.update({popupProps:Ve,triggerProps:Be})}),xe.useSyncedValues({id:F,modal:m,multiple:y,value:L,open:R,mounted:ge,transitionStatus:ve,popupProps:Ve,triggerProps:Be,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:De});let Ue=Z.useMemo(()=>({disabled:I,readOnly:f,required:p,multiple:y,highlightItemOnHover:C,itemProps:He}),[I,f,p,y,C,He]),We=$F(g,N.inputRef),Ge=y?void 0:ee,Ke=Z.useMemo(()=>!y||!Array.isArray(L)||!ee?null:L.map(e=>{let t=r7(e,x);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:ee,value:t,disabled:I},t)}),[y,L,l,ee,x,I]);return(0,Q.jsxs)(U5.Provider,{value:xe,children:[(0,Q.jsx)(W5.Provider,{value:Ue,children:(0,Q.jsx)(G5.Provider,{value:Fe,children:w})}),(0,Q.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){xe.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=SL(aL,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=le.current.findIndex(t=>r7(t,x).toLowerCase()===e||n7(t,b).toLowerCase()===e);r===-1&&(r=le.current.findIndex((t,n)=>{let r=ie.current[n];return r!=null&&r.toLowerCase()===e}));let i=le.current[r];i!=null&&Ne(i,n)}xe.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ge==null?`${F}-hidden-input`:void 0,form:l,name:Ge,autoComplete:u,value:Oe,disabled:I,required:p&&!(y&&Ae),readOnly:f,ref:We,style:ee?ZF:XF,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ke]})}function N_e(e,t){return e??t}var P_e=`data-popup-side`,F_e=400,I_e={...HP,...l8,popupSide:e=>e?{[P_e]:e}:null,value:()=>null},L_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=N_e(h,k);m8({id:i});let P=AL(T),F=Z.useRef(null),{getButtonProps:I,buttonRef:ee}=nL({disabled:b,native:o}),L=g.useStateSetter(`triggerElement`),te=CP(),R=CP(),ne=CP();Z.useEffect(()=>{if(x)return ne.start(F_e,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},R.clear()},[x,g,R,ne]);let re=dI(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??ZP(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":_||void 0,"aria-required":v||void 0,tabIndex:b?-1:0,onFocus(e){u(!0),x&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,SL(aL,e.nativeEvent)),te.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){NP(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=hP(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;NP(F.current,t)||NP(P.current,t)||p5(e,F.current)||g.context.setOpen(!1,SL(hL,e))}R.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),ie=f.getValidationProps(b,re);ie.role=`combobox`;let ae={...p,open:x,disabled:b,value:C,readOnly:_,popupSide:j,placeholder:!A};return TI(`button`,e,{ref:[t,F,ee,L],state:ae,stateAttributesMapping:I_e,props:ie})}),R_e={value:()=>null},z_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)?A_e(l,u,d):i7(l,u,d)),TI(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:R_e})}),B_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return TI(`span`,e,{state:{open:K5().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:VP})}),V_e=Z.forwardRef(function(e,t){let n=K5(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Q.jsx)(OL,{ref:t,...e}):null}),s7=Z.createContext(void 0);function c7(){let e=Z.useContext(s7);if(!e)throw Error(IN(59));return e}function l7(e,t){e&&Object.assign(e.style,t)}var u7={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},H_e={position:`fixed`},U_e=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=WI,style:_,...v}=e,y=K5(),b=J5(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=Z.useRef(null),j=Z.useRef(null),[M,N]=Z.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),Z.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),i5((P||C)&&x,T===`touch`,E,D);let F=qB({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,ee=P?H_e:F.positionerStyles,L={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};PN(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let te=ZB(e,L,{styles:ee,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),R=Z.useRef(0),ne=GN(e=>{if(y.context.valuesRef.current.length===0)return;let t=R.current;R.current=e.size;let n=SL(aL);if(t!==0&&!y.state.multiple&&w!==null&&Q5(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&Q5(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>Q5(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};l7(E,e),l7(y.context.popupRef.current,e)}}),re=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:ne,children:(0,Q.jsxs)(s7.Provider,{value:re,children:[S&&C&&(0,Q.jsx)(Z8,{inert:MI(!x),cutout:D}),te]})})}),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}`})}},W_e=Z.createContext(void 0),G_e={disableStyleElements:!1};function p7(){return Z.useContext(W_e)??G_e}var m7=`--transform-origin`,K_e={...UP,...zP},q_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=K5(),{multiple:c,readOnly:l,highlightItemOnHover:u}=q5(),d=J5(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=c7(),_=I8(!0)!=null,v=NB(),{nonce:y,disableStyleElements:b}=p7(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef({}),N=bP(),P=GN(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=hP(O),o=YN(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=h7(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=g7(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=qI(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=qI(g,0,g7(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});Z.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),LI({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};PN(()=>{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]),PN(()=>{S||m||(j.current=!1,A.current=!1,l7(O,M.current))},[S,m,O]),PN(()=>{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=J_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=YN(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=hP(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,ee=C-5;O.style.left=`${qI(E,5,ee-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 L=g7(p),te=I>=L-1;te&&(P=Math.min(S,d.height)-(I-L));let R=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),ne=(r.visualViewport?.scale??1)!==1&&AP;if(R||ne){l7(O,M.current),g(!1);return}let re=Math.max(b,P);if(te){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=g7(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=qI(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(m7,`50% ${i}%`)}(re===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=YN(O);function t(e){s.context.setOpen(!1,SL(xL,e))}return gP(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},ee=TI(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:K_e,props:[T,I,XB(E),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!b&&f7.getElement(y),(0,Q.jsx)(vR,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:ee})]})});function h7(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function g7(e){return a7(e.scrollHeight,e.clientHeight)}function _7(e){return cz.getScale(e)}function v7(e,t,n){return e/n[t]}function y7(e,t){return SF({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 J_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 Y_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K5(),{multiple:s,readOnly:c}=q5(),{alignItemWithTriggerActive:l}=c7(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:u7},className:u&&d!==`touch`?f7.className:void 0};return TI(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),x7=Z.createContext(void 0);function S7(){let e=Z.useContext(x7);if(!e)throw Error(IN(57));return e}var X_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);PN(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),PN(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=T_e(C,a,f.context.valuesRef.current,e,S,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&X5(a,e,S),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,S,f,a]);let T=Z.useRef(`mouse`),E=Z.useRef(!1),{getButtonProps:D,buttonRef:O}=nL({disabled:_,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:_,selected:b,highlighted:v};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=b?E_e(n,a,S):[...n,a];f.context.setValue(r,SL(uL,e))}else f.context.setValue(a,SL(uL,e)),f.context.setOpen(!1,SL(uL,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":b,tabIndex:y&&v?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&tF(e.nativeEvent)&&(n!==void 0||v),i=t&&!r&&!E.current;E.current=!1,!(_||i)&&A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),_||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&b,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!b;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=TI(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=Z.useMemo(()=>({selected:b,index:C,textRef:u,selectedByFocus:x}),[b,C,u,x]);return(0,Q.jsx)(x7.Provider,{value:P,children:N})})),Z_e=Z.forwardRef(function(e,t){let{selected:n}=S7();return e.keepMounted||n?(0,Q.jsx)(Q_e,{...e,ref:t}):null}),Q_e=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=S7(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=Mz(s),d=TI(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:zP});return LI({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),$_e=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=S7(),a=K5(),{render:o,className:s,style:c,...l}=e;return TI(`div`,e,{ref:[Z.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),C7=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=K5(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=c7(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=CP(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=Mz(g);PN(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),LI({open:g,ref:v,onComplete(){g||x(!1)}});let S=TI(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=a7(e.scrollHeight,e.clientHeight),r=o7(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){_.clear();return}if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=eve(a,c,r,e.clientHeight,t,n)}_.start(40,t)}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:zP});return y||o?S:null});function eve(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 tve=Z.forwardRef(function(e,t){return(0,Q.jsx)(C7,{...e,ref:t,direction:`down`})}),nve=Z.forwardRef(function(e,t){return(0,Q.jsx)(C7,{...e,ref:t,direction:`up`})}),w7=Z.createContext(void 0);function rve(){let e=Z.useContext(w7);if(e===void 0)throw Error(IN(56));return e}var ive=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(),c=Z.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=TI(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(w7.Provider,{value:c,children:l})}),ave=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=rve(),c=vU(a);return PN(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),TI(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),T7=M_e;function ove({className:e,...t}){return(0,Q.jsx)(ive,{"data-slot":`select-group`,className:HV(`scroll-my-1 p-1`,e),...t})}function E7({className:e,...t}){return(0,Q.jsx)(z_e,{"data-slot":`select-value`,className:HV(`flex flex-1 text-left`,e),...t})}function D7({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(L_e,{"data-slot":`select-trigger`,"data-size":t,className:HV(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed whitespace-nowrap transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),...r,children:[n,(0,Q.jsx)(B_e,{render:(0,Q.jsx)(gH,{className:`pointer-events-none size-3.5 text-muted-foreground`})})]})}function O7({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,Q.jsx)(V_e,{children:(0,Q.jsx)(U_e,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Q.jsxs)(q_e,{"data-slot":`select-content`,"data-align-trigger":o,className:HV(`isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,e),...s,children:[(0,Q.jsx)(cve,{}),(0,Q.jsx)(Y_e,{children:t}),(0,Q.jsx)(lve,{})]})})})}function sve({className:e,...t}){return(0,Q.jsx)(ave,{"data-slot":`select-label`,className:HV(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function k7({className:e,children:t,...n}){return(0,Q.jsxs)(X_e,{"data-slot":`select-item`,className:HV(`relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,Q.jsx)($_e,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(Z_e,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`}),children:(0,Q.jsx)(mH,{className:`pointer-events-none`})})]})}function cve({className:e,...t}){return(0,Q.jsx)(nve,{"data-slot":`select-scroll-up-button`,className:HV(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5`,e),...t,children:(0,Q.jsx)(vH,{})})}function lve({className:e,...t}){return(0,Q.jsx)(tve,{"data-slot":`select-scroll-down-button`,className:HV(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5`,e),...t,children:(0,Q.jsx)(gH,{})})}var A7=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(A7||{}),uve=[0,1],j7=[1,0],M7=[2,3],N7=[3,2],dve={L:uve,M:j7,Q:M7,H:N7},fve=/^\d*$/,pve=/^[A-Z0-9 $%*+./:-]*$/,P7=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,F7=1,I7=40,L7=3,mve=3,R7=40,hve=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]],gve=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=Tve(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=Eve(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+=mve)}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*hve,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()}},_ve=[1,10,12,14],vve=[2,9,11,13],yve=[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(yve,e.length,t)}function bve(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(_ve,e.length,t)}function xve(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(vve,e.length,t)}function Sve(e){return e===``?[]:K7(e)?[bve(e)]:q7(e)?[xve(e)]:[G7(wve(e))]}function K7(e){return fve.test(e)}function q7(e){return pve.test(e)}function Cve(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 wve(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 Tve(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 Eve(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 Dve(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=Cve(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 gve(o,t,u,i)}function Ove(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`?Sve(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=Dve(c,dve[n],i,a,o,r),u=kve({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 kve(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 Ave(e){let t=(0,QB.c)(9),{link:n}=e,r,i;if(t[0]!==n){let{size:e,data:a}=Ove(n,{ecc:`M`,border:2});r=e,i=a.flatMap(jve).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 jve(e,t){return e.flatMap((e,n)=>e?[`M${n} ${t}h1v1h-1z`]:[])}function Mve(e){let t=(0,QB.c)(50),{connection:n,remote:r,disabled:i}=e,a=i!==void 0&&i,o=ple(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]=Nhe(n),_=n8(n),v;t[0]!==_||t[1]!==h?(v=rS(h)&&rS(_)&&_.value?.grants.some(e=>e.id===h.value?.id)===!0?h.value:null,t[0]=_,t[1]=h,t[2]=v):v=t[2];let y=v,b=o.find(e=>{let{url:t}=e;return t===l})??o[0],x=y&&o.find(e=>{let{url:t}=e;return t===y.address})?.route;if(b===void 0){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on a way in above to pair a device.`}),t[3]=e):e=t[3],e}let S=e=>b8(e,async()=>g({label:s.trim(),addresses:[b.url],trusted:d,canManageSharing:p})),C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(I6,{htmlFor:`pairing-label`,children:`Device name`}),t[4]=C):C=t[4];let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>c(e.target.value),t[5]=w):w=t[5];let T;t[6]===s?T=t[7]:(T=(0,Q.jsxs)(B6,{className:`min-w-0 flex-1`,children:[C,(0,Q.jsx)(v8,{id:`pairing-label`,placeholder:`My phone`,maxLength:Ode,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(Pve),disabled:a,value:b.url,onValueChange:e=>{e&&u(e)},children:[(0,Q.jsx)(D7,{id:`pairing-address`,"aria-describedby":`pairing-address-url`,className:`w-full`,children:(0,Q.jsx)(E7,{children:Q0[b.route]})}),(0,Q.jsx)(O7,{children:o.map(Nve)})]}),(0,Q.jsx)(`p`,{id:`pairing-address-url`,className:`text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:b.url})]}),D;t[8]!==a||t[9]!==h.waiting||t[10]!==s?(D=a||h.waiting||s.trim()===``,t[8]=a,t[9]=h.waiting,t[10]=s,t[11]=D):D=t[11];let O;t[12]===h.waiting?O=t[13]:(O=h.waiting?(0,Q.jsx)(M6,{}):(0,Q.jsx)(RH,{}),t[12]=h.waiting,t[13]=O);let k;t[14]!==D||t[15]!==O?(k=(0,Q.jsxs)(XV,{type:`submit`,size:`sm`,className:`shrink-0`,disabled:D,children:[O,`Create pairing link`]}),t[14]=D,t[15]=O,t[16]=k):k=t[16];let A;t[17]!==T||t[18]!==E||t[19]!==k||t[20]!==S?(A=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:S,children:[T,E,k]}),t[17]=T,t[18]=E,t[19]=k,t[20]=S,t[21]=A):A=t[21];let j;t[22]!==a||t[23]!==p||t[24]!==m?(j=(0,Q.jsx)(H5,{id:`pairing-management`,checked:p,disabled:a,onCheckedChange:m}),t[22]=a,t[23]=p,t[24]=m,t[25]=j):j=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(I6,{htmlFor:`pairing-management`,children:`Can manage sharing`}),t[26]=M):M=t[26];let N;t[27]===j?N=t[28]:(N=(0,Q.jsxs)(B6,{orientation:`horizontal`,children:[j,M]}),t[27]=j,t[28]=N);let P;t[29]!==a||t[30]!==f||t[31]!==d?(P=(0,Q.jsx)(H5,{id:`pairing-trusted`,checked:d,disabled:a,onCheckedChange:f}),t[29]=a,t[30]=f,t[31]=d,t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(I6,{htmlFor:`pairing-trusted`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`The paired device can update Porcelain`}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`Can update Porcelain`})]}),t[33]=F):F=t[33];let I;t[34]===P?I=t[35]:(I=(0,Q.jsxs)(B6,{orientation:`horizontal`,children:[P,F]}),t[34]=P,t[35]=I);let ee=Q0[b.route],L;t[36]===ee?L=t[37]:(L=(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Uses `,ee,`. Pair again to add another way in.`]}),t[36]=ee,t[37]=L);let te;t[38]===h?te=t[39]:(te=aS(h)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Ul(h.cause))})}),t[38]=h,t[39]=te);let R;t[40]!==y||t[41]!==x?(R=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)(Ave,{link:y.link})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-20 flex-col gap-1 pt-0.5`,children:[(0,Q.jsxs)(`p`,{className:`text-ui leading-4.5 font-medium`,children:[`Scan on `,y.label]}),(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Works once, until`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:new Date(y.expiresAt).toLocaleTimeString()}),x&&(0,Q.jsxs)(Q.Fragment,{children:[`, through `,Q0[x]]}),`.`]})]})]}),(0,Q.jsx)(`p`,{"aria-label":`Pairing link`,className:`font-mono text-2xs leading-4 break-all text-muted-foreground`,children:y.link}),(0,Q.jsxs)(XV,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>HU(y?.link??``,`pairing link`),children:[(0,Q.jsx)(OH,{}),`Copy link`]})]}),t[40]=y,t[41]=x,t[42]=R):R=t[42];let ne;return t[43]!==A||t[44]!==N||t[45]!==I||t[46]!==L||t[47]!==te||t[48]!==R?(ne=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[A,N,I,L,te,R]}),t[43]=A,t[44]=N,t[45]=I,t[46]=L,t[47]=te,t[48]=R,t[49]=ne):ne=t[49],ne}function Nve(e){let{route:t,url:n}=e;return(0,Q.jsx)(k7,{value:n,children:(0,Q.jsx)(`span`,{className:`mr-4 min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:`${Q0[t]} · ${n}`})},n)}function Pve(e){let{route:t,url:n}=e;return{value:n,label:`${Q0[t]} · ${n}`}}var Z7=Z.createContext(void 0);function Q7(){let e=Z.useContext(Z7);if(e===void 0)throw Error(IN(64));return e}var Fve=`data-activation-direction`,$7={tabActivationDirection:e=>({[Fve]: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;PN(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=GN((e,t)=>{t.activationDirection=t9(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),A=GN((e,t)=>{i?.(e,SL(t,void 0,void 0,{activationDirection:`none`}))}),j=GN((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},[_]),ee=Z.useRef(!u),L=Z.useRef(r),te=Z.useRef(u),R=Z.useRef(!1);PN(()=>{if(g)return;function e(e,t){h(e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),ee.current=!1}if(_.size===0){R.current&&m!==null&&!y.current?.isConnected&&e(null,vL);return}R.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===L.current&&(te.current=!1),te.current&&t&&m===L.current)return;let r=ee.current;if(t||n){let n=I??null;if(m===n){ee.current=!1;return}let i=vL;r?i=yL:t&&(i=_L),e(n,i);return}r&&F!=null&&(A(m,yL),ee.current=!1)},[I,g,A,F,h,_,m]);let ne=TI(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:$7});return(0,Q.jsx)(Z7.Provider,{value:P,children:(0,Q.jsx)(Y8,{elementsRef:d,children:ne})})});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 Lve=`data-composite-item-active`,n9=Z.createContext(void 0);function Rve(){let e=Z.useContext(n9);if(e===void 0)throw Error(IN(65));return e}var zve=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:_}=Rve(),{highlightedIndex:v,onHighlightedIndexChange:y}=$I(),b=vU(o),{compositeProps:x,compositeRef:S,index:C}=m5({metadata:Z.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),w=a===u,T=Z.useRef(!1),E=Z.useRef(null),D=GN(e=>{E.current?.(),E.current=e?g(e):null});PN(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=MP(hP(e));if(t&&NP(e,t))return}r||y(C)},[w,C,v,y,r,_]);let{getButtonProps:O,buttonRef:k}=nL({disabled:r,native:s,focusableWhenDisabled:!0}),A=d(a),j=Z.useRef(!1),M=Z.useRef(!1);function N(e){f(a,SL(aL,e.nativeEvent,void 0,{activationDirection:`none`}))}function P(e){w||r||N(e)}function F(e){w||r||h&&(!j.current||M.current)&&N(e)}function I(e){if(w||r)return;j.current=!0,M.current=e.button===0;let t=hP(e.currentTarget);function n(){j.current=!1,M.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return TI(`button`,e,{state:{disabled:r,active:w,orientation:p,tabActivationDirection:m},ref:[t,k,S,D],props:[x,{role:`tab`,"aria-controls":A,"aria-selected":w,id:b,onClick:P,onFocus:F,onPointerDown:I,[Lve]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,O],stateAttributesMapping:$7})}),Bve=`data-index`,Vve={...$7,...zP},Hve=Z.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=Q7(),p=vU(),{ref:m,index:h}=j8(),g=r===c,{mounted:_,transitionStatus:v,setMounted:y}=Mz(g),b=!_,x=l(r),S={hidden:b,orientation:u,tabActivationDirection:d,transitionStatus:v},C=Z.useRef(null),w=TI(`div`,e,{state:S,ref:[t,m,C],props:[{"aria-labelledby":x,hidden:b,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:MI(!g),[Bve]:h},s],stateAttributesMapping:Vve});return LI({open:g,ref:C,onComplete(){g||y(!1)}}),PN(()=>{if(!(p==null||b&&!a))return f(r,p)},[b,a,r,p,f]),a||_?w:null});function Uve(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=kN}=e,[p,m]=Z.useState(0),h=r!=null,g=Z.useRef(null),_=$F(g,c),v=Z.useRef([]),y=Z.useRef(!1),b=Z.useRef(null),x=o??p,S=GN((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=GN(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||DF(e,x,d)?S(Wve(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(DF(t,x,d)){let e=EF(t,{disabledIndices:d});CF(t,e)||S(e)}U8(g.current,r,a,n)});PN(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(DF(e,x,d)){let t=EF(e,{disabledIndices:d});CF(e,t)||S(t)}},[d,o,x,v,S]);let w=GN((e,t,n)=>i?i(e,t,n,v):n),T=GN(e=>{let o=e.key===`Home`||e.key===`End`;if(!V8.has(e.key)||!l&&o||Gve(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=PP(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=wF(v,d),T=TF(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=EF(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!CF(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=PP(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 Wve(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!DF(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function Gve(e,t){for(let n of ege)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Kve(e){let{render:t,className:n,style:r,refs:i=kN,props:a=kN,state:o=AN,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}=Uve({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:NB(),disabledIndices:v,modifierKeys:y}),k=TI(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Z.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,Q.jsx)(QI.Provider,{value:A,children:(0,Q.jsx)(Y8,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var qve=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);PN(()=>{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=GN(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=GN(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)(Kve,{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:kN})})});function r9({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(Ive,{"data-slot":`tabs`,"data-orientation":t,className:HV(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Jve=JV(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function i9({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(qve,{"data-slot":`tabs-list`,"data-variant":t,className:HV(Jve({variant:t}),e),...n})}function a9({className:e,...t}){return(0,Q.jsx)(zve,{"data-slot":`tabs-trigger`,className:HV(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Yve({className:e,...t}){return(0,Q.jsx)(Hve,{"data-slot":`tabs-content`,className:HV(`flex-1 text-xs/relaxed outline-none`,e),...t})}var o9=FE(V3.layer).atom(V(function*(){return Rn()}));function Xve(){let e=(0,QB.c)(8),t=vN(o9),n;e[0]===t?n=e[1]:(n=Gn(Qn(fS(t))),e[0]=t,e[1]=n);let r;e[2]===t?r=e[3]:(r=aS(t),e[2]=t,e[3]=r);let i=CN(o9),a;return e[4]!==n||e[5]!==r||e[6]!==i?(a={configuration:n,failed:r,retry:i},e[4]=n,e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function Zve(){let e=(0,QB.c)(36),[t,n]=(0,Z.useState)(`claude`),{configuration:r,failed:i,retry:a}=Xve(),o=`claude mcp add porcelain -- porcelain mcp`,s;e[0]!==t||e[1]!==o?(s=vpe(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)(Qve,{command:c,failed:i})}),e[8]=c,e[9]=i,e[10]=p):p=e[10];let m=c===void 0,h;e[11]===c?h=e[12]:(h=()=>{c!==void 0&&HU(c,`MCP configuration`)},e[11]=c,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Q.jsx)(XV,{size:`icon-sm`,variant:`ghost`,className:`absolute top-1.5 right-1.5`,"aria-label":`Copy MCP configuration`,disabled:m,onClick:h}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(OH,{}),e[16]=_):_=e[16];let v;e[17]===g?v=e[18]:(v=(0,Q.jsx)(LU,{render:g,children:_}),e[17]=g,e[18]=v);let y;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(RU,{role:`tooltip`,children:`Copy MCP configuration`}),e[19]=y):y=e[19];let b;e[20]===v?b=e[21]:(b=(0,Q.jsxs)(IU,{children:[v,y]}),e[20]=v,e[21]=b);let x;e[22]!==b||e[23]!==p?(x=(0,Q.jsxs)(`div`,{className:`relative rounded-lg bg-muted py-2.25 pr-11 pl-3 inset-ring inset-ring-border`,children:[p,b]}),e[22]=b,e[23]=p,e[24]=x):x=e[24];let S;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:[`Run it once on the computer hosting your Porcelain server.`,` `,`Agents publish reviews, answer comments and read your reviewed marks through the Porcelain MCP server. It needs no credential.`,!1]}),e[25]=S):S=e[25];let C;e[26]===r?C=e[27]:(C=!1,e[26]=r,e[27]=C);let w;e[28]!==i||e[29]!==a?(w=!1,e[28]=i,e[29]=a,e[30]=w):w=e[30];let T;return e[31]!==x||e[32]!==C||e[33]!==w||e[34]!==f?(T=(0,Q.jsxs)(`section`,{"aria-labelledby":`agents-heading`,className:`flex min-w-0 flex-col gap-2`,children:[f,x,S,C,w]}),e[31]=x,e[32]=C,e[33]=w,e[34]=f,e[35]=T):T=e[35],T}function Qve({command:e,failed:t}){return e===void 0?t?`MCP configuration is unavailable.`:`Loading MCP configuration…`:Spe(e).map((e,t)=>(0,Q.jsx)(`span`,{className:$ve[e.kind],children:e.text},t))}var $ve={program:`text-(--syn-fn)`,quoted:`text-(--syn-str)`,plain:void 0},eye=new Intl.RelativeTimeFormat(`en`,{numeric:`always`});function s9(e,t=$ne()){let n=dm(e),r=rre(n,t),[i,a]=r?[t,n]:[n,t],o=nre(i,a),s=Bi(o),c=tre(),l=(s+pm(fm(a,c))-pm(fm(i,c)))/Bi(zi(1)),u,d;return s<Bi(Li(1))?(u=`second`,d=Math.round(jee(o))):s<Bi(Ri(1))?(u=`minute`,d=Math.round(Mee(o))):s<Bi(zi(1))?(u=`hour`,d=Math.round(Nee(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)),eye.format(r?d:-d,u)}var tye={phone:(0,Q.jsx)(nU,{"aria-hidden":!0}),tablet:(0,Q.jsx)(iU,{"aria-hidden":!0}),browser:(0,Q.jsx)(AH,{"aria-hidden":!0})};function nye(e){let t=(0,QB.c)(22),{connection:n,access:r,disabled:i}=e,a=i!==void 0&&i,o=r,s;if(t[0]!==o.devices||t[1]!==n||t[2]!==a){let e;t[4]!==n||t[5]!==a?(e=e=>(0,Q.jsxs)(W6,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsx)(G6,{variant:`icon`,children:tye[ype(e.platform)]}),(0,Q.jsxs)(K6,{className:`basis-48`,children:[(0,Q.jsxs)(q6,{className:`flex-wrap`,children:[e.label,e.current&&(0,Q.jsx)(e8,{variant:`secondary`,children:`This device`}),(0,Q.jsx)(e8,{variant:`outline`,children:$0[e.route]})]}),(0,Q.jsxs)(J6,{children:[`Last seen `,s9(e.lastSeenAt),` ·`,` `,B3(e.platform)]}),e.routeInferred&&(0,Q.jsxs)(J6,{children:[`Paired before each device was tied to one way in, so it now works only through `,$0[e.route],`, where it was last seen. Pair it again to use another way in.`]})]}),(0,Q.jsxs)(Y6,{className:`flex-wrap`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[auto_auto] items-center gap-x-2 gap-y-1.5`,children:[(0,Q.jsx)(aye,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canManageSharing===!0}),(0,Q.jsx)(rye,{disabled:a,connection:n,id:e.id,label:e.label,trusted:e.trusted}),!e.canManageSharing&&ule(e)&&(0,Q.jsx)(iye,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canEditWaysIn})]}),!e.current&&(0,Q.jsx)(l9,{disabled:a,connection:n,id:e.id,label:e.label,cancelLink:!1})]})]},e.id),t[4]=n,t[5]=a,t[6]=e):e=t[6],s=o.devices.map(e),t[0]=o.devices,t[1]=n,t[2]=a,t[3]=s}else s=t[3];let c;if(t[7]!==o.grants||t[8]!==n||t[9]!==a){let e;t[11]!==n||t[12]!==a?(e=e=>(0,Q.jsxs)(W6,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsx)(G6,{variant:`icon`,children:(0,Q.jsx)(RH,{"aria-hidden":!0})}),(0,Q.jsxs)(K6,{className:`min-w-0`,children:[(0,Q.jsxs)(q6,{children:[e.label,(0,Q.jsx)(e8,{variant:`outline`,children:`Pending link`})]}),(0,Q.jsxs)(J6,{children:[`Works once, until`,` `,new Date(e.expiresAt).toLocaleTimeString()]})]}),(0,Q.jsx)(Y6,{children:(0,Q.jsx)(l9,{disabled:a,connection:n,id:e.id,label:e.label,cancelLink:!0})})]},e.id),t[11]=n,t[12]=a,t[13]=e):e=t[13],c=o.grants.map(e),t[7]=o.grants,t[8]=n,t[9]=a,t[10]=c}else c=t[10];let l;t[14]!==s||t[15]!==c?(l=(0,Q.jsxs)(U6,{role:`list`,"aria-label":`Paired devices and links`,children:[s,c]}),t[14]=s,t[15]=c,t[16]=l):l=t[16];let u;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:`Each device has separate access. Revoking signs it out.`}),t[17]=u):u=t[17];let d;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(I5,{render:(0,Q.jsx)(XV,{size:`sm`,variant:`ghost`}),children:`About device permissions`}),t[18]=d):d=t[18];let f;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(F5,{children:[d,(0,Q.jsx)(L5,{children:(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:`Sharing managers can pair devices, revoke access and configure ways in. Update permission is separate. Each credential works only through the way in it paired over. Pair again to add another way in.`})})]}),t[19]=f):f=t[19];let p;return t[20]===l?p=t[21]:(p=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l,u,f]}),t[20]=l,t[21]=p),p}function rye(e){let t=(0,QB.c)(6),{connection:n,id:r,label:i,trusted:a,disabled:o}=e,[s,c]=Fhe(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 iye(e){let t=(0,QB.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,QB.c)(13),{caption:n,name:r,checked:i,result:a,disabled:o,onChange:s}=e,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-xs text-muted-foreground`,children:n}),t[0]=n,t[1]=c);let l=o||a.waiting,u;t[2]!==i||t[3]!==r||t[4]!==s||t[5]!==l?(u=(0,Q.jsx)(H5,{"aria-label":r,checked:i,disabled:l,onCheckedChange:s}),t[2]=i,t[3]=r,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]===a?d=t[8]:(d=aS(a)&&(0,Q.jsx)(Z6,{variant:`destructive`,className:`col-span-2`,children:(0,Q.jsx)($6,{children:x2(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,QB.c)(12),{connection:n,id:r,label:i,cancelLink:a,disabled:o}=e,s=o!==void 0&&o,[c,l]=Phe(n,r),u=a?`Cancel the link for ${i}`:`Revoke ${i}`,d=s||c.waiting,f;t[0]===l?f=t[1]:(f=()=>l(),t[0]=l,t[1]=f);let p=a?`Cancel`:`Revoke`,m;t[2]!==u||t[3]!==d||t[4]!==f||t[5]!==p?(m=(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,className:`ml-1`,"aria-label":u,disabled:d,onClick:f,children:p}),t[2]=u,t[3]=d,t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]===c?h=t[8]:(h=aS(c)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(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 aye(e){let t=(0,QB.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=Bhe(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 oye(e){let t=(0,QB.c)(13),{name:n,route:r}=e,{status:i}=r,a;t[0]!==n||t[1]!==r?(a=_le(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 sye(e){let t=(0,QB.c)(14),{name:n,route:r,note:i}=e,{status:a}=r;if(a.kind===`failed`){let e;t[0]!==n||t[1]!==a.reason?(e=Sle(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=ile[n],r;return t[5]===e?r=t[6]:(r=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:e}),t[5]=e,t[6]=r),r}let o;if(t[7]!==n||t[8]!==i||t[9]!==a.urls){let e;t[11]!==n||t[12]!==i?(e=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs leading-4.5 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-1`,children:[(0,Q.jsx)(j6,{className:`font-mono text-foreground-2`,text:e}),(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{size:`icon-xs`,variant:`ghost`,className:`size-5`,"aria-label":`Copy ${e}`,onClick:()=>HU(e,`address`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{role:`tooltip`,className:`break-all`,children:`Copy ${e}`})]})]}),(i??u9[n])&&(0,Q.jsx)(`span`,{children:i??u9[n]})]},e),t[11]=n,t[12]=i,t[13]=e):e=t[13],o=a.urls.map(e),t[7]=n,t[8]=i,t[9]=a.urls,t[10]=o}else o=t[10];return o}function d9(e){let t=(0,QB.c)(40),{name:n,route:r,disabled:i,connectedThrough:a,onChange:o,setup:s,note:c,children:l}=e,u=Q0[n],[d,f]=(0,Z.useState)(!1),p=n!==`lan`||r.status.kind!==`on`,m=d||(s?.open??!1),h;t[0]!==n||t[1]!==r?(h=(0,Q.jsx)(oye,{name:n,route:r}),t[0]=n,t[1]=r,t[2]=h):h=t[2];let g;t[3]===p?g=t[4]:(g=!p&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-xs leading-4 font-medium text-warn`,children:[(0,Q.jsx)(eU,{"aria-hidden":!0,className:`size-3.5`}),`Not encrypted`]}),t[3]=p,t[4]=g);let _;t[5]!==h||t[6]!==g||t[7]!==u?(_=(0,Q.jsxs)(q6,{className:`flex-wrap`,children:[u,h,g]}),t[5]=h,t[6]=g,t[7]=u,t[8]=_):_=t[8];let v;t[9]!==n||t[10]!==c||t[11]!==r?(v=(0,Q.jsx)(sye,{name:n,route:r,note:c}),t[9]=n,t[10]=c,t[11]=r,t[12]=v):v=t[12];let y;t[13]!==_||t[14]!==v?(y=(0,Q.jsxs)(K6,{children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]!==a||t[17]!==s||t[18]!==u?(b=s&&!a&&(0,Q.jsxs)(I5,{render:(0,Q.jsx)(XV,{size:`sm`,variant:s.configured?`ghost`:`outline`,"aria-label":s.configured?`${u} setup`:`Set up ${u}`,className:`group/setup`}),children:[s.configured?`Setup`:`Set up`,s.configured&&(0,Q.jsx)(gH,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground transition-transform group-data-panel-open/setup:rotate-180`})]}),t[16]=a,t[17]=s,t[18]=u,t[19]=b):b=t[19];let x=i||a,S;t[20]===o?S=t[21]:(S=e=>o(e),t[20]=o,t[21]=S);let C;t[22]!==r.enabled||t[23]!==x||t[24]!==S||t[25]!==u?(C=(0,Q.jsx)(H5,{"aria-label":u,checked:r.enabled,disabled:x,onCheckedChange:S}),t[22]=r.enabled,t[23]=x,t[24]=S,t[25]=u,t[26]=C):C=t[26];let w;t[27]!==C||t[28]!==b?(w=(0,Q.jsxs)(Y6,{children:[b,C]}),t[27]=C,t[28]=b,t[29]=w):w=t[29];let T;t[30]!==l||t[31]!==a||t[32]!==n||t[33]!==s?(T=a?(0,Q.jsx)(X6,{children:(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:ale(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 cye(e){let t=(0,QB.c)(26),{remote:n,disabled:r,onTurnOn:i}=e,{lan:a}=n.routes,o=n.localNetwork,s=a.enabled&&a.status.kind===`paused`,c;t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==s?(c=s&&o&&(0,Q.jsxs)(XV,{variant:`outline`,size:`sm`,className:`self-start`,disabled:r,onClick:i,children:[`Turn on for `,e2(o)]}),t[0]=r,t[1]=o,t[2]=i,t[3]=s,t[4]=c):c=t[4];let l;t[5]!==o||t[6]!==a.status.kind||t[7]!==s||t[8]!==n?(l=a.status.kind!==`on`&&(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:s||!o?t2(n):`Uses ${e2(o)}.`}),t[5]=o,t[6]=a.status.kind,t[7]=s,t[8]=n,t[9]=l):l=t[9];let u,d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-6.5 -left-6.5 hidden size-1.5 rounded-full bg-warn lg:block`}),d=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-7.25 -left-5 hidden h-px w-5 bg-warn-border lg:block`}),t[10]=u,t[11]=d):(u=t[10],d=t[11]);let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(Q6,{children:[(0,Q.jsx)(eU,{"aria-hidden":!0}),`Not encrypted`]}),t[12]=f):f=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{children:`Devices on this network can read the connection.`}),t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(I5,{render:(0,Q.jsx)(XV,{size:`sm`,variant:`ghost`}),children:`Details`}),t[14]=m):m=t[14];let h;t[15]===n?h=t[16]:(h=t2(n),t[15]=n,t[16]=h);let g;t[17]===h?g=t[18]:(g=(0,Q.jsx)(`p`,{children:h}),t[17]=h,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`p`,{children:ole}),t[19]=_):_=t[19];let v;t[20]===g?v=t[21]:(v=(0,Q.jsxs)(`div`,{className:`settings-margin-note lg:absolute lg:top-0 lg:left-full lg:ml-8 lg:w-62`,children:[u,d,(0,Q.jsxs)(Z6,{role:`note`,"aria-label":`Local network warning`,children:[f,(0,Q.jsxs)($6,{children:[p,(0,Q.jsxs)(F5,{children:[m,(0,Q.jsxs)(L5,{children:[g,_]})]})]})]})]}),t[20]=g,t[21]=v);let y;return t[22]!==c||t[23]!==v||t[24]!==l?(y=(0,Q.jsxs)(Q.Fragment,{children:[c,l,v]}),t[22]=c,t[23]=v,t[24]=l,t[25]=y):y=t[25],y}function f9(e){let t=(0,QB.c)(26),{route:n,remote:r,disabled:i,onChange:a}=e,[o,s]=(0,Z.useState)(null),c;t[0]!==o||t[1]!==r||t[2]!==n?(c=xle(r,n,o),t[0]=o,t[1]=r,t[2]=n,t[3]=c):c=t[3];let l=c,u;t[4]!==l.save||t[5]!==a?(u=e=>b8(e,async()=>{a(l.save),s(null)}),t[4]=l.save,t[5]=a,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>s(e.target.value),t[7]=d):d=t[7];let f;t[8]!==i||t[9]!==l.label||t[10]!==l.placeholder||t[11]!==l.value?(f=(0,Q.jsx)(v8,{"aria-label":l.label,placeholder:l.placeholder,value:l.value,disabled:i,onChange:d}),t[8]=i,t[9]=l.label,t[10]=l.placeholder,t[11]=l.value,t[12]=f):f=t[12];let p=i||!l.canSave,m;t[13]!==l.saveLabel||t[14]!==p?(m=(0,Q.jsx)(XV,{type:`submit`,variant:`outline`,className:`shrink-0`,disabled:p,children:l.saveLabel}),t[13]=l.saveLabel,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==i||t[17]!==l.check||t[18]!==l.failed||t[19]!==a?(h=l.failed&&(0,Q.jsx)(XV,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:i,onClick:()=>a(l.check),children:`Check again`}),t[16]=i,t[17]=l.check,t[18]=l.failed,t[19]=a,t[20]=h):h=t[20];let g;return t[21]!==u||t[22]!==f||t[23]!==m||t[24]!==h?(g=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:u,children:[f,m,h]}),t[21]=u,t[22]=f,t[23]=m,t[24]=h,t[25]=g):g=t[25],g}function lye(e){let t=(0,QB.c)(18),{remote:n,disabled:r,onChange:i}=e,a=n.routes.tailnet,o;t[0]===n.tailnetTarget?o=t[1]:(o=n.tailnetTarget===void 0?void 0:hle(n.tailnetTarget),t[0]=n.tailnetTarget,t[1]=o);let s=o,c;t[2]!==r||t[3]!==i||t[4]!==n?(c=(0,Q.jsx)(f9,{route:`tailnet`,remote:n,disabled:r,onChange:i}),t[2]=r,t[3]=i,t[4]=n,t[5]=c):c=t[5];let l;t[6]===n.tailnetHostname?l=t[7]:(l=n.tailnetHostname===void 0&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this computer’s name on your tailnet, as tailscale status or the Tailscale admin console shows it, to turn this on. Porcelain then names the one command to run.`}),t[6]=n.tailnetHostname,t[7]=l);let u;t[8]!==n.tailnetHostname||t[9]!==a?(u=n.tailnetHostname!==void 0&&!a.enabled&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`If you set up tailscale serve for Porcelain, remove it with tailscale serve --https=443 off, or Tailscale keeps forwarding to a port Porcelain no longer holds.`}),t[8]=n.tailnetHostname,t[9]=a,t[10]=u):u=t[10];let d;t[11]===s?d=t[12]:(d=s!==void 0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Run this once on this computer. Tailscale keeps it across restarts; remove it with tailscale serve --https=443 off.`}),(0,Q.jsxs)(`div`,{className:`flex max-w-full items-center gap-1`,children:[(0,Q.jsx)(j6,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,render:(0,Q.jsx)(`code`,{}),text:s}),(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy the tailscale serve command`,onClick:()=>HU(s,`command`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{role:`tooltip`,className:`break-all`,children:`Copy the tailscale serve command`})]})]})]}),t[11]=s,t[12]=d);let f;return t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,l,u,d]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function uye(e){let t=(0,QB.c)(9),{remote:n,disabled:r,onChange:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(f9,{route:`cloudflare`,remote:n,disabled:r,onChange:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===n.serviceUrl?o=t[5]:(o=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`In Cloudflare, publish this hostname from your tunnel to`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.serviceUrl}),`, and run cloudflared on this computer as a service. Porcelain answers to the hostname only while this is on.`]}),t[4]=n.serviceUrl,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function dye(e){let t=(0,QB.c)(63),{connection:n,remote:r}=e,[i,a]=Lhe(n),o=i.waiting,s;t[0]===r.editing.protectedRoute?s=t[1]:(s=e=>r.editing.protectedRoute===e,t[0]=r.editing.protectedRoute,t[1]=s);let c=s,l;t[2]!==r.editing.fingerprint||t[3]!==a?(l=e=>a({expected:r.editing.fingerprint,change:e}),t[2]=r.editing.fingerprint,t[3]=a,t[4]=l):l=t[4];let u=l,d=r.routes.lan,f;t[5]===r?f=t[6]:(f=t2(r),t[5]=r,t[6]=f);let p=c(`lan`),m=o||!r.routes.lan.enabled&&r.localNetwork===void 0,h;t[7]===u?h=t[8]:(h=e=>u({lan:e}),t[7]=u,t[8]=h);let g;t[9]===u?g=t[10]:(g=()=>u({lan:!0}),t[9]=u,t[10]=g);let _;t[11]!==o||t[12]!==r||t[13]!==g?(_=(0,Q.jsx)(cye,{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)(lye,{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)(uye,{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 ee;t[54]!==v||t[55]!==D||t[56]!==I?(ee=(0,Q.jsxs)(U6,{children:[v,D,I]}),t[54]=v,t[55]=D,t[56]=I,t[57]=ee):ee=t[57];let L;t[58]===i?L=t[59]:(L=aS(i)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Ul(i.cause))})}),t[58]=i,t[59]=L);let te;return t[60]!==ee||t[61]!==L?(te=(0,Q.jsxs)(Q.Fragment,{children:[ee,L]}),t[60]=ee,t[61]=L,t[62]=te):te=t[62],te}function p9(e){let t=(0,QB.c)(14),{connection:n,children:r}=e,i=r8(n),a,o;if(t[0]!==r||t[1]!==n||t[2]!==i){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Gn(fS(i));if(e===null){let e;t[5]===n.address?e=t[6]:(e=dle(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(aS(i)){let e;t[9]===i.cause?e=t[10]:(e=x2(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,QB.c)(6),{connection:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(z6,{variant:`label`,children:`Ways in`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=e=>(0,Q.jsx)(dye,{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 fye(e){let t=(0,QB.c)(5),{connection:n,children:r}=e,i=n8(n),a,o;if(t[0]!==i||t[1]!==r){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Gn(fS(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=aS(i)?x2(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,QB.c)(5),{prominent:n}=e,r=n!==void 0&&n,i=Gn(fS(bhe()))?.isDesktopShell;if(i===!0){let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(m_e,{prominent:r}),t[0]=r,t[1]=e),e}if(i===!1){let e;return t[2]===r?e=t[3]:(e=(0,Q.jsx)(f_e,{prominent:r}),t[2]=r,t[3]=e),e}let a;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(M6,{}),t[4]=a):a=t[4],a}function pye(e){let t=(0,QB.c)(46),{environment:n}=e,{connection:r}=D6(),i=Gn(fS(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]=zhe(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)(Bge,{icon:O4(n),pending:p.waiting,onChange:e=>m(ode(e))}),(0,Q.jsxs)(XV,{variant:`ghost`,size:`sm`,ref:c?e=>{e&&(e.focus(),l(!1))}:void 0,onClick:()=>{l(!0),s(a)},children:[(0,Q.jsx)(JH,{}),`Rename`]})]}),t[10]=i,t[11]=n,t[12]=p,t[13]=a,t[14]=f,t[15]=c,t[16]=m,t[17]=x):x=t[17];let S;t[18]!==i||t[19]!==p?(S=i&&aS(p)&&(0,Q.jsx)(Z6,{variant:`destructive`,className:`mt-4 max-w-160`,children:(0,Q.jsx)($6,{children:x2(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)(Vhe,{connection:r,environment:n,onCancel:()=>s(null)})}),t[21]=i,t[22]=r,t[23]=n,t[24]=f,t[25]=C):C=t[25];let w;t[26]!==n.name||t[27]!==C||t[28]!==b||t[29]!==x||t[30]!==S?(w=(0,Q.jsxs)(t8,{section:`Computers`,title:n.name,lead:`Manage connections and device access.`,status:b,action:x,children:[S,C]}),t[26]=n.name,t[27]=C,t[28]=b,t[29]=x,t[30]=S,t[31]=w):w=t[31];let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(U6,{"aria-label":`Version`,children:(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsx)(K6,{children:(0,Q.jsx)(h9,{prominent:!0})})})}),t[32]=T):T=t[32];let E,D;t[33]===r?(E=t[34],D=t[35]):(E=(0,Q.jsx)(m9,{connection:r}),D=(0,Q.jsx)(g9,{connection:r}),t[33]=r,t[34]=E,t[35]=D);let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(Zve,{}),t[36]=O):O=t[36];let k;t[37]===n.name?k=t[38]:(k=(0,Q.jsxs)(R6,{children:[(0,Q.jsx)(z6,{variant:`label`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:`This browser`}),(0,Q.jsx)(e8,{variant:`outline`,children:`Shown in a browser tab`})]})}),(0,Q.jsx)(U6,{children:(0,Q.jsx)(W6,{children:(0,Q.jsx)(K6,{children:(0,Q.jsx)(vhe,{computer:n.name})})})})]}),t[37]=n.name,t[38]=k);let A;t[39]!==E||t[40]!==D||t[41]!==k?(A=(0,Q.jsxs)(`div`,{className:`settings-computer grid min-w-0 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_--spacing(62)]`,children:[T,E,D,O,k]}),t[39]=E,t[40]=D,t[41]=k,t[42]=A):A=t[42];let j;return t[43]!==w||t[44]!==A?(j=(0,Q.jsxs)(Q.Fragment,{children:[w,A]}),t[43]=w,t[44]=A,t[45]=j):j=t[45],j}function g9(e){let t=(0,QB.c)(6),{connection:n}=e,r=Gn(fS(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)(nye,{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)(Mve,{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)(fye,{connection:n,children:i}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}var mye=X(e=>b6.fn(e=>V(function*(){let t=yield*(yield*k2).pair({value:e,localEnvironmentId:x6.state.value.connection?.environmentId}).pipe(op(t3));return B0(g6,t),t}))),hye=X(e=>b6.fn(t=>V(function*(){yield*(yield*k2).forget(e.environmentId)}))),gye=b6.fn(e=>V(function*(){yield*(yield*k2).read()}));function _ye(e){let t=(0,QB.c)(12),[n]=(0,Z.useState)(Symbol),r;t[0]===n?r=t[1]:(r=mye(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]=wN(i,a),c=SN(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(HE),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 vye(e,t){let n=(0,QB.c)(9),r;n[0]===e?r=n[1]:(r=hye(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]=wN(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 yye(){let e=(0,QB.c)(5),[t,n]=wN(gye),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 bye(e){let t=(0,QB.c)(31),{remote:n,onOpen:r,showUpdates:i}=e,a=O6(n),o=a.kind===`online`?a.name:n.name,{rows:s}=E5(),c;if(t[0]!==n.environmentId||t[1]!==s){let e;t[3]===n.environmentId?e=t[4]:(e=e=>{let{target:t}=e;return t.kind===`service`&&t.id===n.environmentId},t[3]=n.environmentId,t[4]=e),c=s.find(e),t[0]=n.environmentId,t[1]=s,t[2]=c}else c=t[2];let l=c,u=`Open ${o}`,d;t[5]!==r||t[6]!==n.environmentId?(d=()=>r(n.environmentId),t[5]=r,t[6]=n.environmentId,t[7]=d):d=t[7];let f=a.kind,p;t[8]===a?p=t[9]:(p=v0(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 xye(){let e=(0,QB.c)(27),[t,n]=(0,Z.useState)(``),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>n(``),e[0]=r):r=e[0];let i=_ye(r),{status:a}=w6(),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`p`,{className:`text-ui leading-5 text-foreground-2`,children:[`On the other computer, run`,` `,(0,Q.jsx)(`code`,{className:`rounded-sm bg-muted px-1.5 py-px font-mono text-xs leading-4.5 font-medium text-foreground inset-ring inset-ring-border`,children:`porcelain pair`}),` `,`and paste the link it prints. This device keeps its own credential for that computer.`]}),e[1]=o):o=e[1];let s;e[2]!==i||e[3]!==t?(s=e=>b8(e,()=>i.submit(t)),e[2]=i,e[3]=t,e[4]=s):s=e[4];let c=i.result.waiting||a!==`ready`,l;e[5]===i?l=e[6]:(l=e=>{i.reset(),n(e.target.value)},e[5]=i,e[6]=l);let u;e[7]!==t||e[8]!==c||e[9]!==l?(u=(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 font-mono`,children:(0,Q.jsx)(v8,{"aria-label":`Pairing link`,placeholder:`https://porcelain.fabiofiorita.com/open/pair#c=…`,value:t,disabled:c,onChange:l})}),e[7]=t,e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;e[11]!==i.result.waiting||e[12]!==t||e[13]!==a?(d=i.result.waiting||a!==`ready`||t.trim()===``,e[11]=i.result.waiting,e[12]=t,e[13]=a,e[14]=d):d=e[14];let f=i.result.waiting?`Pairing…`:`Add`,p;e[15]!==d||e[16]!==f?(p=(0,Q.jsx)(XV,{type:`submit`,className:`shrink-0`,disabled:d,children:f}),e[15]=d,e[16]=f,e[17]=p):p=e[17];let m;e[18]!==s||e[19]!==u||e[20]!==p?(m=(0,Q.jsxs)(`form`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,onSubmit:s,children:[u,p]}),e[18]=s,e[19]=u,e[20]=p,e[21]=m):m=e[21];let h;e[22]===i.result?h=e[23]:(h=aS(i.result)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(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 Sye(e){let{connection:t}=e,n=Gn(fS(r8(t))),r=Gn(fS(n8(t)));return n&&r?`Online · ${xpe(n,r.devices.length)}`:`Online · Connected computer`}function Cye(e){let t=(0,QB.c)(60),{environment:n,onOpen:r,showUpdates:i}=e,{connection:a}=D6(),{remotes:o,error:s}=w6(),c=yye();Kge();let{targets:l,count:u,batch:d,run:f,retry:p,checking:m}=E5(),h=c8(),g;t[0]===h?g=t[1]:(g=w5(h),t[0]=h,t[1]=g);let _=g!==void 0,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(t8,{section:`Settings`,title:`Computers`,lead:`Manage your paired computers.`,children:(0,Q.jsxs)(`p`,{className:`mt-3.5 flex max-w-160 items-start gap-2 text-ui leading-5 text-muted-foreground`,children:[(0,Q.jsx)(AH,{"aria-hidden":!0,className:`mt-0.75 size-3.5 shrink-0`}),`Browser tabs each connect to one computer.`]})}),t[2]=v):v=t[2];let y;t[3]!==c||t[4]!==s?(y=s!==void 0&&(0,Q.jsxs)(Z6,{variant:`destructive`,children:[(0,Q.jsx)(PH,{}),(0,Q.jsx)(Q6,{children:`Saved computers could not be read`}),(0,Q.jsxs)($6,{children:[`Porcelain keeps them as they are and saves no change over them. Allow Porcelain to read its saved credentials, then try again.`,` `,s,(0,Q.jsx)(XV,{variant:`outline`,disabled:c.result.waiting,onClick:()=>c.read(),children:`Read saved computers`})]})]}),t[3]=c,t[4]=s,t[5]=y):y=t[5];let b=o.length+1,x;t[6]===b?x=t[7]:(x=(0,Q.jsxs)(`h2`,{id:`computers-heading`,className:`flex items-center gap-1 text-xs leading-4 font-medium text-muted-foreground`,children:[`Computers`,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:b})]}),t[6]=b,t[7]=x);let S=d.running||m||_,C;t[8]!==p||t[9]!==S?(C=(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,disabled:S,onClick:p,children:`Check for updates`}),t[8]=p,t[9]=S,t[10]=C):C=t[10];let w=d.running||u===0,T;t[11]!==f||t[12]!==l?(T=()=>f(l),t[11]=f,t[12]=l,t[13]=T):T=t[13];let E;t[14]!==u||t[15]!==T||t[16]!==w?(E=(0,Q.jsxs)(XV,{size:`sm`,disabled:w,onClick:T,children:[`Update all (`,u,`)`]}),t[14]=u,t[15]=T,t[16]=w,t[17]=E):E=t[17];let D;t[18]!==E||t[19]!==C?(D=(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[C,E]}),t[18]=E,t[19]=C,t[20]=D):D=t[20];let O;t[21]!==D||t[22]!==x?(O=(0,Q.jsxs)(`div`,{className:`mb-1.5 flex min-h-7 items-center justify-between gap-2`,children:[x,D]}),t[21]=D,t[22]=x,t[23]=O):O=t[23];let k=`This computer: ${n.name}`,A=`Open This computer: ${n.name}`,j;t[24]===r?j=t[25]:(j=()=>r(`this-computer`),t[24]=r,t[25]=j);let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(e8,{variant:`secondary`,children:`This computer`}),t[26]=M):M=t[26];let N;t[27]===a?N=t[28]:(N=(0,Q.jsx)(Sye,{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)(bye,{remote:e,showUpdates:i,onOpen:r},e.environmentId),t[42]=r,t[43]=i,t[44]=e):e=t[44],I=[...o].sort(wye).map(e),t[38]=r,t[39]=o,t[40]=i,t[41]=I}else I=t[41];let ee;t[45]!==F||t[46]!==I?(ee=(0,Q.jsxs)(U6,{"aria-label":`Computers`,children:[F,I]}),t[45]=F,t[46]=I,t[47]=ee):ee=t[47];let L;t[48]!==O||t[49]!==ee?(L=(0,Q.jsxs)(`section`,{"aria-labelledby":`computers-heading`,className:`@container flex min-w-0 flex-col gap-2`,children:[O,ee]}),t[48]=O,t[49]=ee,t[50]=L):L=t[50];let te;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(z6,{variant:`label`,children:`Add computer`}),t[51]=te):te=t[51];let R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsxs)(R6,{children:[te,(0,Q.jsx)(U6,{children:(0,Q.jsx)(xye,{})})]}),t[52]=R):R=t[52];let ne;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ne={section:`computers`,environmentId:`this-computer`},t[53]=ne):ne=t[53];let re;t[54]===n.name?re=t[55]:(re=(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)(uN,{to:`/settings/$section/$environmentId`,params:ne,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]=re);let ie;return t[56]!==L||t[57]!==re||t[58]!==y?(ie=(0,Q.jsxs)(Q.Fragment,{children:[v,y,L,R,re]}),t[56]=L,t[57]=re,t[58]=y,t[59]=ie):ie=t[59],ie}function wye(e,t){return e.name.localeCompare(t.name)||e.environmentId.localeCompare(t.environmentId)}var _9=(0,Q.jsx)(SH,{"aria-hidden":!0,strokeWidth:3.5,className:`size-2.5 text-border-strong`});function v9(e){return(0,Q.jsx)(`span`,{"aria-hidden":!0,className:HV(`size-2 rounded-full`,e)})}var Tye={online:v9(`bg-add-fg`),checking:_9,reconnecting:_9,offline:_9,"needs-pairing":v9(`bg-destructive`),"other-server":v9(`bg-destructive`),incompatible:v9(`bg-warn`)};function y9(e){let t=(0,QB.c)(24),{name:n,label:r,openLabel:i,status:a,badge:o,description:s,update:c,onOpen:l}=e,u=Tye[a],d;t[0]===u?d=t[1]:(d=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex h-5 w-4 items-center justify-center self-start`,children:u}),t[0]=u,t[1]=d);let f;t[2]!==l||t[3]!==i?(f=e=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":i,onClick:l,className:`flex min-w-0 rounded-sm text-left outline-none after:absolute after:inset-0 focus-visible:ring-3 focus-visible:ring-ring/30`,children:e}),t[2]=l,t[3]=i,t[4]=f):f=t[4];let p;t[5]!==n||t[6]!==f?(p=(0,Q.jsx)(j6,{text:n,className:`text-sm leading-5 font-medium`,renderTrigger:f}),t[5]=n,t[6]=f,t[7]=p):p=t[7];let m;t[8]!==o||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[p,o]}),t[8]=o,t[9]=p,t[10]=m):m=t[10];let h;t[11]===s?h=t[12]:(h=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs leading-4.5 text-muted-foreground`,children:s}),t[11]=s,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`min-w-0 self-start`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===c?_=t[17]:(_=c&&(0,Q.jsx)(`div`,{className:`relative col-span-2 col-start-2 row-start-2 min-w-0 @2xl:col-span-1 @2xl:col-start-3 @2xl:row-start-1 @2xl:max-w-80`,children:c}),t[16]=c,t[17]=_);let v;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(bH,{"aria-hidden":!0,className:`col-start-3 row-start-1 size-4 justify-self-center text-muted-foreground @2xl:col-start-4`}),t[18]=v):v=t[18];let y;return t[19]!==r||t[20]!==d||t[21]!==g||t[22]!==_?(y=(0,Q.jsxs)(W6,{role:`listitem`,"aria-label":r,className:`relative grid grid-cols-[--spacing(4)_minmax(0,1fr)_--spacing(7)] @2xl:grid-cols-[--spacing(4)_minmax(0,1fr)_auto_--spacing(7)]`,children:[d,g,_,v]}),t[19]=r,t[20]=d,t[21]=g,t[22]=_,t[23]=y):y=t[23],y}function b9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:HV(`animate-pulse rounded-md bg-muted`,e),...t})}function Eye(e){let t=(0,QB.c)(10),{navigation:n,title:r,children:i}=e;if(!n)return i;let a;t[0]===r?a=t[1]:(a=(0,Q.jsx)(`span`,{className:`text-ui font-medium`,children:r}),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-b px-3`,children:[n,a]}),t[2]=n,t[3]=a,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-paper border bg-background`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function x9(e){let t=(0,QB.c)(18),{title:n,description:r,icon:i,children:a,role:o}=e,s;t[0]===i?s=t[1]:(s=i??(0,Q.jsx)(MH,{}),t[0]=i,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground [&>svg]:size-4`,children:s}),t[2]=s,t[3]=c);let l;t[4]===n?l=t[5]:(l=(0,Q.jsx)(`h2`,{className:`min-w-0 text-base font-semibold wrap-anywhere`,children:n}),t[4]=n,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=r&&(0,Q.jsx)(`div`,{className:`text-ui leading-relaxed text-muted-foreground [overflow-wrap:anywhere]`,children:r}),t[9]=r,t[10]=d);let f;t[11]===a?f=t[12]:(f=a&&(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:a}),t[11]=a,t[12]=f);let p;return t[13]!==o||t[14]!==u||t[15]!==d||t[16]!==f?(p=(0,Q.jsxs)(`section`,{"data-slot":`state-notice`,role:o,className:`flex w-full min-w-0 max-w-xl flex-col gap-3 p-6 text-left`,children:[u,d,f]}),t[13]=o,t[14]=u,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function Dye(e){let t=(0,QB.c)(14),{label:n,caption:r}=e,i=r===void 0||r,a;t[0]!==i||t[1]!==n?(a=i&&(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Q.jsx)(M6,{"aria-hidden":`true`,className:`size-3.5`}),` `,n,`…`]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o,s,c,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(b9,{className:`h-5 w-2/3`}),s=(0,Q.jsx)(b9,{className:`h-4 w-full`}),c=(0,Q.jsx)(b9,{className:`h-4 w-4/5`}),l=(0,Q.jsx)(b9,{className:`h-4 w-1/2`}),t[3]=o,t[4]=s,t[5]=c,t[6]=l):(o=t[3],s=t[4],c=t[5],l=t[6]);let u;t[7]!==i||t[8]!==n?(u=!i&&(0,Q.jsxs)(`span`,{className:`sr-only`,children:[n,`…`]}),t[7]=i,t[8]=n,t[9]=u):u=t[9];let d;return t[10]!==n||t[11]!==a||t[12]!==u?(d=(0,Q.jsxs)(`div`,{role:`status`,"aria-label":n,className:`flex w-full min-w-0 flex-1 flex-col gap-3 bg-background p-6`,children:[a,o,s,c,l,u]}),t[10]=n,t[11]=a,t[12]=u,t[13]=d):d=t[13],d}function Oye(e){let t=(0,QB.c)(10),{description:n,onRetry:r,onBack:i,title:a}=e,o=a===void 0?`Could not display`:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(wH,{}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=(0,Q.jsx)(XV,{variant:`outline`,onClick:r,children:`Try again`}),t[1]=r,t[2]=c);let l;t[3]===i?l=t[4]:(l=i&&(0,Q.jsx)(XV,{variant:`ghost`,onClick:i,children:`Back to workspace`}),t[3]=i,t[4]=l);let u;return t[5]!==n||t[6]!==c||t[7]!==l||t[8]!==o?(u=(0,Q.jsxs)(x9,{role:`alert`,title:o,description:n,icon:s,children:[c,l]}),t[5]=n,t[6]=c,t[7]=l,t[8]=o,t[9]=u):u=t[9],u}function kye(e){let t=(0,QB.c)(16),{name:n,status:r,onOpenRemotes:i}=e;if(r.kind===`online`)return null;let a=r.kind===`checking`||r.kind===`reconnecting`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(XH,{}),t[0]=o):o=t[0];let s=o;if(r.kind===`needs-pairing`){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(RH,{}),t[1]=e):e=t[1],s=e}if(a){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(M6,{}),t[2]=e):e=t[2],s=e}let c=s,l;t[3]!==n||t[4]!==r?(l=r.kind===`offline`?`${n} is offline`:`${n}: ${v0(r)}`,t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=y0(r),t[6]=r,t[7]=u);let d;t[8]!==i||t[9]!==a?(d=!a&&(0,Q.jsx)(XV,{variant:`outline`,onClick:i,children:`Computer settings`}),t[8]=i,t[9]=a,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Q.jsx)(x9,{role:`status`,icon:c,title:l,description:u,children:d}),t[11]=s,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function Aye(e){let t=(0,QB.c)(14),{remote:n}=e,r,i,a,o;if(t[0]!==n){let e=a0(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(jye),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 jye(e){let{address:t}=e;return(0,Q.jsxs)(W6,{children:[(0,Q.jsxs)(K6,{children:[(0,Q.jsx)(q6,{children:c0(t)}),(0,Q.jsx)(J6,{className:`break-all`,children:t})]}),(0,Q.jsx)(Y6,{children:(0,Q.jsxs)(IU,{children:[(0,Q.jsx)(LU,{render:(0,Q.jsx)(XV,{size:`icon-sm`,variant:`ghost`,"aria-label":`Copy ${t}`,onClick:()=>HU(t,`address`),children:(0,Q.jsx)(OH,{})})}),(0,Q.jsx)(RU,{role:`tooltip`,className:`break-all`,children:`Copy ${t}`})]})})]},t)}function Mye(e){let t=(0,QB.c)(2),{remote:n}=e,r=O6(n),i=r.kind===`online`?r.name:n.name,a;return t[0]===i?a=t[1]:(a=(0,Q.jsx)(j6,{text:i,className:`block min-w-0`}),t[0]=i,t[1]=a),a}function Nye(e){let t=(0,QB.c)(13),{environmentId:n,onForgotten:r}=e,{remotes:i,status:a,error:o}=w6(),s;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),s=i.find(e),t[0]=n,t[1]=i,t[2]=s}else s=t[2];let c=s;if(!c){let e=a===`ready`?`Computer unavailable`:void 0,n=a===`ready`?`This computer is no longer saved on this app. Return to Computers to add it again.`:o??`Reading saved remote computers…`,r;t[5]===n?r=t[6]:(r=(0,Q.jsx)($6,{children:n}),t[5]=n,t[6]=r);let i;return t[7]!==e||t[8]!==r?(i=(0,Q.jsx)(Z6,{"data-unavailable-page":e,children:r}),t[7]=e,t[8]=r,t[9]=i):i=t[9],i}let l;return t[10]!==r||t[11]!==c?(l=(0,Q.jsx)(Pye,{remote:c,onForgotten:r}),t[10]=r,t[11]=c,t[12]=l):l=t[12],l}function Pye(e){let t=(0,QB.c)(76),{remote:n,onForgotten:r}=e,i=O6(n),a=E6(n.environmentId),o=vye(n,r),s=i.kind===`online`,c=s?i.name:n.name,l;t[0]===i?l=t[1]:(l=y0(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=v0(i),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,Q.jsx)(e8,{variant:p,children:m}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==f||t[13]!==h?(g=(0,Q.jsxs)(q6,{className:`min-w-0 flex-wrap`,children:[f,` `,h]}),t[12]=f,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=u&&(0,Q.jsx)(J6,{children:u}),t[15]=u,t[16]=_);let v;t[17]===s?v=t[18]:(v=!s&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Saved details · Stale. This computer has not been verified online.`}),t[17]=s,t[18]=v);let y;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(I5,{render:(0,Q.jsx)(XV,{variant:`ghost`,size:`sm`}),children:`Details`}),t[19]=y):y=t[19];let b;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Address`}),t[20]=b):b=t[20];let x;t[21]===n.address?x=t[22]:(x=(0,Q.jsxs)(`div`,{children:[b,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.address})]}),t[21]=n.address,t[22]=x);let S;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Computer ID`}),t[23]=S):S=t[23];let C;t[24]===n.environmentId?C=t[25]:(C=(0,Q.jsxs)(`div`,{children:[S,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.environmentId})]}),t[24]=n.environmentId,t[25]=C);let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Porcelain version`}),t[26]=w):w=t[26];let T=s?i.version??`Not reported`:`Unavailable while this computer is not online`,E;t[27]===T?E=t[28]:(E=(0,Q.jsxs)(`div`,{children:[w,(0,Q.jsx)(`dd`,{children:T})]}),t[27]=T,t[28]=E);let D;t[29]===n.deviceId?D=t[30]:(D=n.deviceId&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`This app’s device ID`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.deviceId})]}),t[29]=n.deviceId,t[30]=D);let O;t[31]!==x||t[32]!==C||t[33]!==E||t[34]!==D?(O=(0,Q.jsxs)(F5,{children:[y,(0,Q.jsx)(L5,{children:(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[x,C,E,D]})})]}),t[31]=x,t[32]=C,t[33]=E,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==O||t[37]!==g||t[38]!==_||t[39]!==v?(k=(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsxs)(K6,{children:[g,_,v,O]})}),t[36]=O,t[37]=g,t[38]=_,t[39]=v,t[40]=k):k=t[40];let A;t[41]!==a||t[42]!==s?(A=s&&a&&(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsx)(K6,{children:(0,Q.jsx)(p_e,{connection:a.connection})})}),t[41]=a,t[42]=s,t[43]=A):A=t[43];let j;t[44]!==k||t[45]!==A?(j=(0,Q.jsxs)(R6,{className:`lg:col-span-2`,children:[d,(0,Q.jsxs)(U6,{children:[k,A]})]}),t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==a||t[48]!==s?(M=s&&a&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(m9,{connection:a.connection}),(0,Q.jsx)(g9,{connection:a.connection})]}),t[47]=a,t[48]=s,t[49]=M):M=t[49];let N;t[50]===n?N=t[51]:(N=(0,Q.jsx)(Aye,{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 ee;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removes this computer from this app. Other devices keep their access.`}),t[57]=ee):ee=t[57];let L;t[58]===o?L=t[59]:(L=()=>void o.submit(),t[58]=o,t[59]=L);let te=o.result.waiting?`Forgetting…`:`Forget on this app`,R;t[60]!==o.result.waiting||t[61]!==L||t[62]!==te?(R=(0,Q.jsx)(XV,{variant:`destructive`,className:`w-fit`,disabled:o.result.waiting,onClick:L,children:te}),t[60]=o.result.waiting,t[61]=L,t[62]=te,t[63]=R):R=t[63];let ne;t[64]===o.result?ne=t[65]:(ne=aS(o.result)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:x2(Ul(o.result.cause))})}),t[64]=o.result,t[65]=ne);let re;t[66]!==I||t[67]!==R||t[68]!==ne?(re=(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,ee,R,ne]})})})})]}),t[66]=I,t[67]=R,t[68]=ne,t[69]=re):re=t[69];let ie;return t[70]!==j||t[71]!==M||t[72]!==N||t[73]!==P||t[74]!==re?(ie=(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,re]}),t[70]=j,t[71]=M,t[72]=N,t[73]=P,t[74]=re,t[75]=ie):ie=t[75],ie}var Fye=EE(e=>e.registry),S9=X(e=>EE(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=EE(()=>{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}}}),Lye=X(e=>EE(t=>{t.addFinalizer(t(Iye)(e))}));function C9(){let e=(0,QB.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=S9(`(max-width: 767px)`),e[0]=t):t=e[0],vN(t)}var w9=Z.createContext(void 0);function T9(e){let t=Z.useContext(w9);if(!e&&t===void 0)throw Error(IN(27));return t}var E9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=T9(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return TI(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:WP,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),D9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=T9(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=nL({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,SL(dL,e.nativeEvent))}return TI(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),O9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=T9(),c=vU(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),TI(`p`,e,{ref:t,props:[{id:c},o]})}),k9=Z.createContext(void 0);function Rye(){let e=Z.useContext(k9);if(e===void 0)throw Error(IN(26));return e}var zye=`--nested-dialogs`,Bye=`data-nested-dialog-open`,Vye={...UP,...zP,nestedDialogOpen(e){return e?{[Bye]:``}: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`);Rye(),LI({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?Pz(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=TI(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...Nz,hidden:!m,onKeyDown(e){V8.has(e.key)&&e.stopPropagation()},style:{[zye]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Vye});return(0,Q.jsx)(vR,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),j9=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=T9(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(k9.Provider,{value:n,children:(0,Q.jsxs)(OL,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(Z8,{ref:i.context.internalBackdropRef,inert:MI(!s)}),e.children]})}):null});function Hye({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Z.useState(0),[u,d]=Z.useState(0),f=c===0,p=TR(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=PP(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||NP(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)}),PN(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),Gz(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var M9={...eB,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Uye=class extends KN{constructor(e,t,n){let r=new qz,i=N9(e,r,t,n);super(i,P9(r),M9)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(zz(this.state,e,t.trigger)))}};function Wye(){let e=new qz;return new dU(Object.freeze(N9(void 0,e)),Object.freeze(P9(e)),M9)}function N9(e,t,n,r=!1){return{...Jz(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function P9(e){return{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function F9(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=T9(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=Fz((e,t)=>new Uye({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Kz(b,x),Uz(b);let{forceUnmount:w}=Wz(x,b);Z.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,SL(bL))}),[w,b]);let T=x||S;return(0,Q.jsxs)(w9.Provider,{value:b,children:[u&&(0,Q.jsx)(Iz,{handle:u,store:b}),T&&(0,Q.jsx)(Hye,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var I9=BN(function(e){return F9(`dialog`,e)}),L9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=T9(),c=vU(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),TI(`h2`,e,{ref:t,props:[{id:c},o]})});function R9({...e}){return(0,Q.jsx)(I9,{"data-slot":`sheet`,...e})}function Gye({...e}){return(0,Q.jsx)(j9,{"data-slot":`sheet-portal`,...e})}function Kye({className:e,...t}){return(0,Q.jsx)(E9,{"data-slot":`sheet-overlay`,className:HV(`fixed inset-0 z-50 bg-black/80 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function z9({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,Q.jsxs)(Gye,{children:[(0,Q.jsx)(Kye,{}),(0,Q.jsxs)(A9,{"data-slot":`sheet-content`,"data-side":n,className:HV(`fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,Q.jsxs)(D9,{"data-slot":`sheet-close`,render:(0,Q.jsx)(XV,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,Q.jsx)(cU,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function B9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:HV(`flex flex-col gap-1.5 p-6`,e),...t})}function V9({className:e,...t}){return(0,Q.jsx)(L9,{"data-slot":`sheet-title`,className:HV(`font-heading text-sm font-medium text-foreground`,e),...t})}function H9({className:e,...t}){return(0,Q.jsx)(O9,{"data-slot":`sheet-description`,className:HV(`text-xs/relaxed text-muted-foreground`,e),...t})}var qye=`sidebar_state`,Jye=604800,Yye=`16rem`,Xye=`18rem`,Zye=`3rem`,Qye=`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 $ye({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=`${qye}=${t}; path=/; max-age=${Jye}`},[n,f]),m=Z.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);Z.useEffect(()=>{let e=e=>{e.key===Qye&&(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":Yye,"--sidebar-width-icon":Zye,...i},className:HV(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function ebe({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=W9();return n===`none`?(0,Q.jsx)(`div`,{"data-slot":`sidebar`,className:HV(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,Q.jsx)(R9,{open:l,onOpenChange:u,...o,children:(0,Q.jsxs)(z9,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Xye},side:e,children:[(0,Q.jsxs)(B9,{className:`sr-only`,children:[(0,Q.jsx)(V9,{children:`Sidebar`}),(0,Q.jsx)(H9,{children:`Displays the mobile sidebar.`})]}),(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,Q.jsx)(`div`,{"data-slot":`sidebar-gap`,className:HV(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,Q.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:HV(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,Q.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function tbe({className:e,onClick:t,...n}){let{toggleSidebar:r}=W9();return(0,Q.jsxs)(XV,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:HV(e),onClick:e=>{t?.(e),r()},...n,children:[(0,Q.jsx)(KH,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function nbe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:HV(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function rbe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:HV(`relative flex w-full min-w-0 flex-col px-2 py-1`,e),...t})}function ibe({className:e,render:t,...n}){return H6({defaultTagName:`div`,props:dI({className:HV(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-label`,sidebar:`group-label`}})}function abe({className:e,render:t,...n}){return H6({defaultTagName:`button`,props:dI({className:HV(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-action`,sidebar:`group-action`}})}function obe({className:e,...t}){return(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:HV(`flex w-full min-w-0 flex-col gap-px`,e),...t})}function sbe({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:HV(`group/menu-item relative`,e),...t})}var G9=Z.createContext(void 0);function K9(e){let t=Z.useContext(G9);if(t===void 0&&!e)throw Error(IN(47));return t}var cbe={...eB,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},lbe=class extends KN{constructor(e,t,n){let r=new qz;super(ube(e,r,t,n),dbe(r),cbe)}setOpen=(e,t)=>{let n=t.reason===sL,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=Bz(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=zz(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),FN.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function ube(e,t,n,r=!1){let i={...Jz(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function dbe(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new SP,triggerElements:e}}var q9=BN(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=pbe(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),Kz(u,d),Uz(u);let{forceUnmount:m}=Wz(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),Z.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,SL(bL))}),[m,u]);let h=d||f;return(0,Q.jsxs)(G9.Provider,{value:u,children:[s&&(0,Q.jsx)(Iz,{handle:s,store:u}),h&&(0,Q.jsx)(mbe,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function fbe(e){return K9(!0)?(0,Q.jsx)(q9,{props:e}):(0,Q.jsx)(lR,{children:(0,Q.jsx)(q9,{props:e})})}function pbe(e,t){let n=Fz((e,n)=>new lbe(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function mbe({store:e,modal:t}){let n=TR(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return Gz(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var hbe=VN(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=K9(!0),h=tB(s)??m;if(!h)throw Error(IN(74));let g=vU(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Hz(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=mB(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:jB(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=yR(v,{stickIfOpen:T}),A=l5(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=nL({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?HP.open(e):VP.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:ee}=g5(h,x),L=TI(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[zI]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),te=(0,Q.jsx)(Z.Fragment,{children:L},g);return C&&!D?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(QF,{ref:F,onFocus:I}),te,(0,Q.jsx)(QF,{ref:h.context.triggerFocusTargetRef,onFocus:ee})]}):te}),J9=Z.createContext(void 0);function gbe(){let e=Z.useContext(J9);if(e===void 0)throw Error(IN(45));return e}var _be=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return K9().useState(`mounted`)||n?(0,Q.jsx)(J9.Provider,{value:n,children:(0,Q.jsx)(OL,{ref:t,...r})}):null}),Y9=Z.createContext(void 0);function vbe(){let e=Z.useContext(Y9);if(!e)throw Error(IN(46));return e}var ybe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=GI,..._}=e,v=K9(),y=gbe(),b=sR(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=Z.useRef(null),N=II(O),P=qB({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),F=x.useState(`domReferenceElement`);PN(()=>{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 ee=v.useStateSetter(`positionerElement`),L=ZB(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,ee],hidden:!S,inert:!C});return(0,Q.jsxs)(Y9.Provider,{value:P,children:[S&&I&&(0,Q.jsx)(Z8,{inert:MI(!C),cutout:T}),(0,Q.jsx)(cR,{id:b,children:L})]})}),bbe=Z.createContext(void 0);function xbe(){let[e,t]=Z.useState(0),n=GN(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var Sbe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=K9(),l=vbe(),u=I8(!0)!=null,{context:d,hasClosePart:f}=xbe(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);LI({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),fB(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?Pz(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=TI(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...Nz,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&V8.has(e.key)&&e.stopPropagation()}},XB(g),s],stateAttributesMapping:WP});return(0,Q.jsx)(vR,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:$N(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(bbe.Provider,{value:d,children:M})})}),Cbe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=vU(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),TI(`h2`,e,{ref:t,props:[{id:s},a]})}),wbe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=vU(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),TI(`p`,e,{ref:t,props:[{id:s},a]})});function X9({...e}){return(0,Q.jsx)(fbe,{"data-slot":`popover`,...e})}function Z9({...e}){return(0,Q.jsx)(hbe,{"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)(_be,{children:(0,Q.jsx)(ybe,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,Q.jsx)(Sbe,{"data-slot":`popover-content`,className:HV(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}function Tbe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`popover-header`,className:HV(`flex flex-col gap-1 text-xs`,e),...t})}function $9({className:e,...t}){return(0,Q.jsx)(Cbe,{"data-slot":`popover-title`,className:HV(`text-sm font-medium`,e),...t})}function Ebe({className:e,...t}){return(0,Q.jsx)(wbe,{"data-slot":`popover-description`,className:HV(`text-muted-foreground`,e),...t})}function Dbe(e){let t=(0,QB.c)(84),{fallbackFocus:n}=e,{rows:r,targets:i,count:a,batch:o,run:s,failures:c,checking:l,refresh:u,retry:d}=E5(),f=iN(),{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(jbe),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=Gle(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=HV(N),t[31]=N,t[32]=P);let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(e8,{render:(0,Q.jsx)(`button`,{type:`button`})}),t[33]=F):F=t[33];let I=o.running?`Updating…`:`Update`;t[34]!==P||t[35]!==I?(x=(0,Q.jsx)(`span`,{className:`inline-flex [--primary:var(--brand-soft)] [--primary-foreground:var(--brand)]`,children:(0,Q.jsx)(Z9,{className:P,render:F,children:I})}),t[34]=P,t[35]=I,t[36]=x):x=t[36],g=Q9,w=`top`,T=`end`,E=`max-h-(--available-height) w-88 max-w-[calc(100vw-1rem)] overflow-y-auto`,t[37]!==n||t[38]!==j?(D=j?!0:()=>n.element,t[37]=n,t[38]=j,t[39]=D):D=t[39],t[40]===M?O=t[41]:(O=(0,Q.jsx)($9,{children:M}),t[40]=M,t[41]=O),t[42]!==l||t[43]!==c||t[44]!==d?(k=c.length>0&&(0,Q.jsxs)(Z6,{variant:`destructive`,children:[(0,Q.jsx)(Q6,{children:`The update check failed`}),(0,Q.jsxs)($6,{children:[c.map(Abe),(0,Q.jsx)(XV,{size:`sm`,variant:`outline`,disabled:l,onClick:d,children:`Try again`})]})]}),t[42]=l,t[43]=c,t[44]=d,t[45]=k):k=t[45],y=`flex max-h-[60svh] flex-col divide-y overflow-y-auto`,C=a.map(kbe)}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(Obe),t[46]=o.entries,t[47]=r,t[48]=j}else j=t[48];let M;t[51]!==y||t[52]!==j||t[53]!==C?(M=(0,Q.jsxs)(`div`,{className:y,children:[C,j]}),t[51]=y,t[52]=j,t[53]=C,t[54]=M):M=t[54];let N;t[55]!==f||t[56]!==p?(N=(0,Q.jsx)(XV,{size:`sm`,variant:`ghost`,onClick:()=>{h(!1),p(!1),f({to:`/settings/$section`,params:{section:`computers`}})},children:`Manage computers`}),t[55]=f,t[56]=p,t[57]=N):N=t[57];let P=o.running||a===0,F;t[58]!==s||t[59]!==i?(F=()=>s(i),t[58]=s,t[59]=i,t[60]=F):F=t[60];let I=o.running?v:`Update all (${a})`,ee;t[61]!==P||t[62]!==F||t[63]!==I?(ee=(0,Q.jsx)(XV,{size:`sm`,disabled:P,"aria-live":`polite`,onClick:F,children:I}),t[61]=P,t[62]=F,t[63]=I,t[64]=ee):ee=t[64];let L;t[65]!==N||t[66]!==ee?(L=(0,Q.jsxs)(`footer`,{className:`flex items-center justify-between gap-2 border-t pt-3`,children:[N,ee]}),t[65]=N,t[66]=ee,t[67]=L):L=t[67];let te;t[68]!==g||t[69]!==M||t[70]!==L||t[71]!==w||t[72]!==T||t[73]!==E||t[74]!==D||t[75]!==O||t[76]!==k?(te=(0,Q.jsxs)(g,{side:w,align:T,className:E,finalFocus:D,children:[O,k,M,L]}),t[68]=g,t[69]=M,t[70]=L,t[71]=w,t[72]=T,t[73]=E,t[74]=D,t[75]=O,t[76]=k,t[77]=te):te=t[77];let R;return t[78]!==_||t[79]!==b||t[80]!==x||t[81]!==te||t[82]!==A?(R=(0,Q.jsxs)(_,{open:A,onOpenChange:b,children:[x,te]}),t[78]=_,t[79]=b,t[80]=x,t[81]=te,t[82]=A,t[83]=R):R=t[83],R}function Obe(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:Mbe(e)})]},`${e.kind}:${e.id}`)}function kbe(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 Abe(e){return(0,Q.jsxs)(`p`,{className:`wrap-anywhere`,children:[e.name,`: `,e.message]},e.id)}function jbe(e){let{target:t}=e;return A2(t)}function Mbe(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 $,W2 as $a,koe as $c,Gue as $i,mie as $l,mme as $n,vH as $o,Bfe as $r,VN as $s,K6 as $t,D9 as A,Tue as Aa,Xoe as Ac,Mde as Ai,lT as Al,Lme as An,ZW as Ao,kpe as Ar,$F as As,E8 as At,Mp as Au,Oye as B,i4 as Ba,jM as Bc,X4 as Bi,hS as Bl,Sme as Bn,LU as Bo,$fe as Br,LP as Bs,p8 as Bt,Ul as Bu,L9 as C,Oue as Ca,$M as Cc,Hde as Ci,RT as Cl,Xme as Cn,y0 as Co,Wpe as Cr,HI as Cs,l5 as Ct,zp as Cu,j9 as D,Cue as Da,Zoe as Dc,r3 as Di,UT as Dl,qme as Dn,rq as Do,V3 as Dr,MI as Ds,F8 as Dt,B as Du,Wye as E,xue as Ea,XM as Ec,n3 as Ei,VT as El,E6 as En,hZ as Eo,U3 as Er,LI as Es,K8 as Et,z as Eu,Lye as F,yue as Fa,zoe as Fc,Dde as Fi,nS as Fl,jme as Fn,HU as Fo,dpe as Fr,XP as Fs,v8 as Ft,lne as Fu,Cye as G,$2 as Ga,DM as Gc,L4 as Gi,Yb as Gl,_me as Gn,WH as Go,ipe as Gr,SP as Gs,t8 as Gt,Jn as Gu,x9 as H,hue as Ha,Noe as Hc,dde as Hi,fS as Hl,bme as Hn,cU as Ho,tpe as Hr,NP as Hs,d8 as Ht,rr as Hu,S9 as I,c4 as Ia,Voe as Ic,xde as Ii,aS as Il,Mme as In,BU as Io,Xfe as Ir,HP as Is,_8 as It,du as Iu,r9 as J,t4 as Ja,Doe as Jc,tde as Ji,G as Jl,yme as Jn,RH as Jo,ope as Jr,hP as Js,phe as Jt,Vn as Ju,pye as K,fue as Ka,Foe as Kc,M4 as Ki,Xb as Kl,gme as Kn,HH as Ko,rpe as Kr,CP as Ks,e8 as Kt,Gn as Ku,Mye as L,vue as La,Boe as Lc,Cde as Li,eS as Ll,Dme as Ln,IU as Lo,spe as Lr,VP as Ls,g8 as Lt,uu as Lu,T9 as M,Eue as Ma,GM as Mc,Ade as Mi,cT as Ml,Fme as Mn,qW as Mo,wpe as Mr,XF as Ms,w8 as Mt,td as Mu,C9 as N,l4 as Na,KM as Nc,Tde as Ni,Xae as Nl,Nme as Nn,KW as No,_pe as Nr,ZF as Ns,y8 as Nt,Vu as Nu,A9 as O,g4 as Oa,Qoe as Oc,Ude as Oi,uoe as Ol,Kme as On,IK as Oo,Ope as Or,TI as Os,P8 as Ot,Kf as Ou,Fye as P,s4 as Pa,BM as Pc,wde as Pi,gS as Pl,Ome as Pn,GU as Po,fpe as Pr,eF as Ps,b8 as Pt,Ou as Pu,T7 as Q,cue as Qa,yM as Qc,Yue as Qi,Qb as Ql,n6 as Qn,bH as Qo,Vfe as Qr,GN as Qs,Y6 as Qt,$n as Qu,Nye as R,r4 as Ra,Roe as Rc,Sde as Ri,rS as Rl,c6 as Rn,RU as Ro,Zfe as Rr,zP as Rs,h8 as Rt,lu as Ru,V9 as S,kue as Sa,tN as Sc,Fde as Si,KT as Sl,Yme as Sn,O0 as So,Kpe as Sr,qI as Ss,d5 as St,hp as Su,F9 as T,m4 as Ta,tse as Tc,i3 as Ti,LT as Tl,T6 as Tn,e0 as To,Fpe as Tr,UI as Ts,J8 as Tt,bp as Tu,Dye as U,pue as Ua,Ioe as Uc,ude as Ui,q as Ul,s6 as Un,QH as Uo,Qfe as Ur,PP as Us,u8 as Ut,tr as Uu,Eye as V,_ue as Va,AM as Vc,Y4 as Vi,iS as Vl,wme as Vn,vU as Vo,F3 as Vr,MP as Vs,f8 as Vt,Fi as Vu,b9 as W,n4 as Wa,Poe as Wc,I4 as Wi,Bb as Wl,Cme as Wn,JH as Wo,npe as Wr,AP as Ws,l8 as Wt,Un as Wu,i9 as X,uue as Xa,kM as Xc,Que as Xi,Lb as Xl,t6 as Xn,OH as Xo,Wfe as Xr,YN as Xs,Q6 as Xt,Rn as Xu,Yve as Y,due as Ya,vM as Yc,nde as Yi,K as Yl,i6 as Yn,MH as Yo,I3 as Yr,mP as Ys,$6 as Yt,Yn as Yu,a9 as Z,lue as Za,Aoe as Zc,T4 as Zi,xie as Zl,a6 as Zn,SH as Zo,Hfe as Zr,KN as Zs,W6 as Zt,zn as Zu,W9 as _,Pue as _a,uN as _c,Lde as _i,FE as _l,j6 as _n,W0 as _o,eme as _r,aL as _s,Pge as _t,V as _u,Tbe as a,Kue as aa,ON as ac,Zde as ai,oj as al,V6 as an,U2 as ao,$3 as ar,YV as as,p7 as at,m_ as au,H9 as b,Fue as ba,iN as bc,Jde as bi,eD as bl,ehe as bn,N0 as bo,Gpe as br,tL as bs,y5 as bt,np as bu,ebe as c,C4 as ca,EN as cc,Qde as ci,WE as cl,che as cn,R2 as co,rme as cr,NB as cs,H5 as ct,mm as cu,abe as d,que as da,Tse as dc,efe as di,cD as dl,ahe as dn,h2 as do,Qpe as dr,Mz as ds,I5 as dt,tp as du,Xue as ea,IN as ec,Ufe as ei,SM as el,J6 as en,G2 as eo,e6 as er,gH as es,ove as et,Eb as eu,ibe as f,b4 as fa,vN as fc,Rde as fi,EE as fl,L6 as fn,f2 as fo,$pe as fr,yR as fs,C5 as ft,wp as fu,tbe as g,Rue as ga,dN as gc,Gde as gi,sD as gl,M6 as gn,K0 as go,Ype as gr,bL as gs,x5 as gt,Df as gu,$ye as h,Lue as ha,fN as hc,Bde as hi,lD as hl,P6 as hn,rle as ho,nme as hr,hL as hs,b5 as ht,Jp as hu,Ebe as i,zue as ia,AN as ic,Kfe as ii,Ij as il,B6 as in,eue as io,lme as ir,XV as is,E7 as it,U as iu,E9 as j,wue as ja,Joe as jc,Ede as ji,Uae as jl,Pme as jn,$W as jo,Dpe as jr,QF as js,C8 as jt,Ku as ju,O9 as k,Due as ka,qoe as kc,jde as ki,CT as kl,Ime as kn,sG as ko,Ape as kr,dI as ks,T8 as kt,Af as ku,nbe as l,x4 as la,CN as lc,Xde as li,BE as ll,z6 as ln,Lle as lo,ame as lr,tB as ls,F5 as lt,Qne as lu,sbe as m,v4 as ma,pN as mc,zde as mi,CE as ml,ihe as mn,Y0 as mo,Y3 as mr,SL as ms,Fge as mt,Uf as mu,X9 as n,Uue as na,NN as nc,Yfe as ni,_M as nl,q6 as nn,$le as no,pme as nr,fH as ns,sve as nt,J as nu,$9 as o,w4 as oa,wN as oc,$de as oi,HE as ol,lhe as on,tue as oo,sme as or,JV as os,f7 as ot,qg as ou,obe as p,y4 as pa,hN as pc,Vde as pi,$E as pl,I6 as pn,l2 as po,Xpe as pr,kL as ps,v5 as pt,H as pu,s9 as q,Q2 as qa,bM as qc,ede as qi,Ub as ql,vme as qn,BH as qo,ape as qr,gP as qs,Z6 as qt,Bn as qu,Q9 as r,Zue as ra,jN as rc,Jfe as ri,gM as rl,H6 as rn,H2 as ro,dme as rr,uH as rs,D7 as rt,cx as ru,Z9 as s,Jue as sa,xN as sc,Yde as si,X as sl,ohe as sn,nue as so,ome as sr,HV as ss,o7 as st,Jg as su,Dbe as t,Wue as ta,PN as tc,Gfe as ti,Coe as tl,U6 as tn,B2 as to,hme as tr,mH as ts,k7 as tt,pie as tu,rbe as u,Vue as ua,SN as uc,o3 as ui,XE as ul,R6 as un,x2 as uo,ime as ur,Hz as us,L5 as ut,xp as uu,R9 as v,Nue as va,gse as vc,qde as vi,gE as vl,k6 as vn,G0 as vo,Jpe as vr,oL as vs,S5 as vt,ap as vu,I9 as w,h4 as wa,QM as wc,Kde as wi,zT as wl,D6 as wn,v0 as wo,Ipe as wr,zI as ws,a5 as wt,Hp as wu,B9 as x,Aue as xa,rN as xc,Wde as xi,wE as xl,Qme as xn,k0 as xo,q3 as xr,ZI as xs,h5 as xt,dp as xu,z9 as y,jue as ya,ose as yc,Ide as yi,ZE as yl,O6 as yn,Hce as yo,qpe as yr,nL as ys,Rge as yt,Yf as yu,kye as z,a4 as za,Uoe as zc,Z4 as zi,Zx as zl,xme as zn,FU as zo,P3 as zr,RP as zs,m8 as zt,tu as zu};