@fabiofiorita/porcelain 0.76.0 → 0.78.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 (56) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/server/src/cli/main.mjs +8291 -7641
  4. package/web/dist/assets/_-CSJHpFdT.js +1 -0
  5. package/web/dist/assets/_layerId-DODyO-4v.js +1 -0
  6. package/web/dist/assets/_paired-BQ0y29Xb.js +1 -0
  7. package/web/dist/assets/_paired-Bse7nsmg.js +1 -0
  8. package/web/dist/assets/_paired-CmZDjtRz.js +1 -0
  9. package/web/dist/assets/_paired-CrNFab02.js +1 -0
  10. package/web/dist/assets/_reviewId-CBVBAvNp.js +1 -0
  11. package/web/dist/assets/{_revision-1wivYK0j.js → _revision-BMXAJq_Z.js} +1 -1
  12. package/web/dist/assets/{_section-BQ20AKhJ.js → _section-DdvA8EEA.js} +1 -1
  13. package/web/dist/assets/_worktreeId-B27bXYEK.js +1 -0
  14. package/web/dist/assets/_worktreeId-Bse7nsmg.js +1 -0
  15. package/web/dist/assets/_worktreeId-C8Q6GcvL.js +1 -0
  16. package/web/dist/assets/_worktreeId-CmZDjtRz.js +1 -0
  17. package/web/dist/assets/access-E2mYEqnl.js +19 -0
  18. package/web/dist/assets/connected-workspace-8ch85vkt.js +1 -0
  19. package/web/dist/assets/desktop-actions-BPv0J8RL.js +1 -0
  20. package/web/dist/assets/{edit-file-rWLFkawP.js → edit-file-Bcu9LCmp.js} +20 -20
  21. package/web/dist/assets/{file-editor-CmaAI7mD.js → file-editor-B_jE48tv.js} +11 -11
  22. package/web/dist/assets/index-BHlOFndd.js +10 -0
  23. package/web/dist/assets/index-Bg-CecA5.css +2 -0
  24. package/web/dist/assets/{lazyRouteComponent-DF1peoaD.js → lazyRouteComponent-C0NLdQ95.js} +1 -1
  25. package/web/dist/assets/pair-Bse7nsmg.js +1 -0
  26. package/web/dist/assets/pair-CbpILDh2.js +1 -0
  27. package/web/dist/assets/review-route-CZyVDwAY.js +1 -0
  28. package/web/dist/assets/reviews-DCiXZMLG.js +1404 -0
  29. package/web/dist/assets/useMatch-CPSFM0JI.js +1 -0
  30. package/web/dist/assets/useRouterState-DtsAJKLm.js +1 -0
  31. package/web/dist/assets/workspace-error-DIuDMViV.js +1 -0
  32. package/web/dist/assets/{workspace-pending-DnmDeSe-.js → workspace-pending-DgQgV-cu.js} +1 -1
  33. package/web/dist/index.html +8 -8
  34. package/web/dist/assets/_-mTAQQLxa.js +0 -1
  35. package/web/dist/assets/_layerId-D-Ld4zoA.js +0 -1
  36. package/web/dist/assets/_paired-DQq2L_lM.js +0 -1
  37. package/web/dist/assets/_paired-DwQfzpPo.js +0 -1
  38. package/web/dist/assets/_paired-P-FUnX-y.js +0 -1
  39. package/web/dist/assets/_paired-VrOGlA1G.js +0 -1
  40. package/web/dist/assets/_reviewId-CR5Y2cjT.js +0 -1
  41. package/web/dist/assets/_worktreeId-BPp_s24t.js +0 -1
  42. package/web/dist/assets/_worktreeId-DQq2L_lM.js +0 -1
  43. package/web/dist/assets/_worktreeId-Dfp8EiPX.js +0 -1
  44. package/web/dist/assets/_worktreeId-P-FUnX-y.js +0 -1
  45. package/web/dist/assets/access-CPhumIOz.js +0 -19
  46. package/web/dist/assets/connected-workspace-Cqk_MV5h.js +0 -1
  47. package/web/dist/assets/desktop-actions-DEpOe60L.js +0 -1
  48. package/web/dist/assets/index-DbOyN2aI.js +0 -10
  49. package/web/dist/assets/index-Dz_rBtGK.css +0 -2
  50. package/web/dist/assets/pair-CwRRIQuD.js +0 -1
  51. package/web/dist/assets/pair-DQq2L_lM.js +0 -1
  52. package/web/dist/assets/review-route-CilLpBvt.js +0 -1
  53. package/web/dist/assets/reviews-Knu80SJM.js +0 -1396
  54. package/web/dist/assets/useMatch-CmjLPEeI.js +0 -1
  55. package/web/dist/assets/useRouterState-CFV0Nv_N.js +0 -1
  56. package/web/dist/assets/workspace-error-B0KK7kzA.js +0 -1
@@ -1,19 +0,0 @@
1
- import{r as e,t}from"./rolldown-runtime-hePW80VL.js";var n=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},r={pipe(){return n(this,arguments)}},i=function(){function e(){}return e.prototype=r,e}(),a=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},o=e=>e,s=e=>()=>e,c=s(!0),l=s(!1),u=s(void 0),d=u;function f(e,...t){return n(e,t)}function p(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function m(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function h(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i!==n&&t.set(i,i),i}}var g=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},_=new WeakSet,v=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),y=0,b=()=>{y++};function x(e){return typeof e==`string`}function S(e){return typeof e==`number`}function C(e){return typeof e==`boolean`}function w(e){return typeof e==`bigint`}function T(e){return typeof e==`symbol`}function E(e){return x(e)||S(e)||T(e)}function D(e){return typeof e==`function`}function O(e){return e===void 0}function k(e){return e!==void 0}function A(e){return e!=null}function j(e){return!1}function M(e){return!0}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){return typeof e==`object`&&!!e||D(e)}var F=a(2,(e,t)=>P(e)&&t in e),I=a(2,(e,t)=>F(e,`_tag`)&&e._tag===t);function L(e){return e instanceof Error}function R(e){return F(e,Symbol.iterator)||x(e)}var ee=`~effect/Hash`,z=e=>{switch(typeof e){case`number`:return oe(e);case`bigint`:return se(e.toString(10));case`string`:return se(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?se(`Invalid Date`):se(e.toISOString());if(e instanceof RegExp)return se(e.toString());{if(_.has(e))return te(e);let t=ge.get(e);if(t!==void 0)return t;if(_e.has(e))return b(),se(`[Circular]`);_e.add(e);let n=y,r;try{r=`~effect/Hash`in e?e[ee]():typeof e==`function`?te(e):e instanceof DataView?de(v(e)):Array.isArray(e)||ArrayBuffer.isView(e)?de(e):e instanceof Map?fe(e):e instanceof Set?me(e):le(e)}finally{_e.delete(e)}return n===y&&ge.set(e,r),r}}return ie(ne(se(String(e))))},te=e=>(he.has(e)||he.set(e,ie(Math.random()*4294967296|0)),he.get(e)),ne=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),re=a(2,(e,t)=>ne(Math.imul(e,2654435761)+Math.imul(t,2246822507))),ie=e=>e&3221225471|e>>>1&1073741824,ae=new DataView(new ArrayBuffer(8)),oe=e=>{let t=e|0;return t===e?ie(t):(ae.setFloat64(0,e===e?e:NaN),ie(re(ae.getInt32(0),ae.getInt32(4))))},se=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return ie(t)},ce=(e,t)=>{let n=12289;for(let r of t)n^=re(z(r),z(e[r]));return ie(n)},le=e=>ce(e,g(e)),ue=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return ie(r)},de=e=>{let t=6151;for(let n of e)t=re(t,z(n));return ie(t)},fe=ue(se(`Map`),([e,t])=>re(z(e),z(t))),pe=se(`Set`),me=ue(pe,e=>re(pe,z(e))),he=new WeakMap,ge=new WeakMap,_e=new WeakSet,ve=`~effect/Equal`;function ye(){return arguments.length===1?e=>be(e,arguments[0]):be(arguments[0],arguments[1])}function be(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||_.has(e)||_.has(t)?!1:xe(e,t):!1}function xe(e,t){let n=Ce.length;for(let r=n;r-->0;)if(Ce[r]===e&&we[r]===t)return!0;if(n)return Se(e,t);let r=Te.get(e);r||Te.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=Se(e,t)),i}function Se(e,t){Ce.push(e),we.push(t);try{return Ee(e,t)}finally{Ce.pop(),we.pop()}}var Ce=[],we=[],Te=new WeakMap;function Ee(e,t){if(z(e)!==z(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=Ne(e);if(n!==Ne(t)||typeof e==`function`&&!n)return!1;if(n)return e[ve](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:De(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?Oe(v(e),v(t)):Oe(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:Ae(e,t,je,Me):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Ae(e,t,z,be):ke(e,t)}function De(e,t){for(let n=0;n<e.length;n++)if(!be(e[n],t[n]))return!1;return!0}function Oe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ke(e,t){let n=g(e),r=g(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!be(e[i],t[i]))return!1;return!0}function Ae(e,t,n,r){let i=new Map;for(let e of t){let t=n(e),r=i.get(t);r?r.push(e):i.set(t,[e])}outer:for(let t of e){let e=i.get(n(t));if(e){for(let n=0;n<e.length;n++)if(r(t,e[n])){e[n]=e[e.length-1],e.pop();continue outer}}return!1}return!0}var je=e=>z(e[0]),Me=(e,t)=>be(e[0],t[0])&&be(e[1],t[1]),Ne=e=>F(e,ve),Pe=e=>Fe(new Proxy(e,{})),Fe=e=>(_.add(e),e),Ie=Symbol.for(`~effect/Redactable`),Le=e=>F(e,Ie);function Re(e){return Le(e)?ze(e):e}function ze(e){return e[Ie](globalThis[`~effect/Fiber/currentFiber`]?.context??He)}var Be=`~effect/Fiber/currentFiber`,Ve=new Map,He={"~effect/Context":{},base:Ve,depth:0,mapUnsafe:Ve,pipe(){return n(this,arguments)}};function Ue(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,t=0){try{return l(e,t)}catch{return(typeof e==`object`&&e||typeof e==`function`)&&r.delete(e),`[inspection threw]`}}function l(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return We;r.add(e);let l;if(Ie in e)l=c(ze(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
2
- `+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=qe(e);else if(!t?.ignoreToString&&F(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Je(e);l=e instanceof Error&&e.cause!==void 0?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Ge(t)}:${c(Ye(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Ge(t)}: ${c(Ye(e,t),n+1)}`).join(`,
3
- `)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var We=`[Circular]`;function Ge(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Ke(e){return e.map(e=>`[${Ge(e)}]`).join(``)}function qe(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Je(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Ye(e,t){try{return e[t]}catch{return`[property access threw]`}}function Xe(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=F(r,Ie)?Re(r):Re(t);if(typeof i==`bigint`)return Ue(i);if(typeof i!=`object`||!i)return i;let a=i instanceof Error&&!F(i,`toJSON`)?{...i,name:i.name,message:i.message}:i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(i))return n.push(i),a!==i&&n.push(a),a},t?.space)??`null`}var Ze=Symbol.for(`nodejs.util.inspect.custom`),Qe=e=>{try{return e=Re(e),F(e,`toJSON`)&&D(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Qe):e}catch{return`[toJSON threw]`}},$e=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?Xe(e,{space:t}):Ue(e,{space:t})}catch{return String(e)}},et={toJSON(){return Qe(this)},[Ze](){return this.toJSON()},toString(){return Ue(this.toJSON())}},tt=class{[Ze](){return this.toJSON()}toString(){return Ue(this.toJSON())}},nt=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),rt=()=>Error.stackTraceLimit,it=e=>{nt&&(Error.stackTraceLimit=e)},at=class{constructor(e){this.value=e,this.done=!1}next(e){return this.done?(this.value=e,this):(this.done=!0,{value:this.value,done:!1})}},ot=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return rt()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})();function st(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function ct(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&st(e,n,t[n])}var lt=`~effect/Effect`,ut=`~effect/Exit`,dt={_A:o,_E:o,_R:o},ft=`${lt}/identifier`,pt=`${lt}/args`,mt=`${lt}/evaluate`,ht=`${lt}/successCont`,gt=`${lt}/failureCont`,_t=`${lt}/ensureCont`,vt=Symbol.for(`effect/Effect/Yield`),yt={pipe(){return n(this,arguments)},toJSON(){return{...this}},toString(){return Ue(this.toJSON(),{ignoreToString:!0,space:2})},[Ze](){return this.toJSON()}},bt={[lt]:dt,...yt,[Symbol.iterator](){return new at(this)},toJSON(){return{_id:`Effect`,op:this[ft],...pt in this?{args:this[pt]}:void 0}}},xt=e=>F(e,lt),St=e=>F(e,ut),Ct=`~effect/Cause`,wt=`~effect/Cause/Reason`,Tt=e=>F(e,Ct),Et=e=>F(e,wt),Dt=class{constructor(e){this[Ct]=Ct,this.reasons=e}pipe(){return n(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${Ue(this.reasons)})`}[Ze](){return this.toJSON()}[ve](e){return Tt(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>ye(t,e.reasons[n]))}[ee](){return de(this.reasons)}},Ot=new WeakMap,kt=class{[wt];annotations;_tag;constructor(e,t,n){if(this[wt]=wt,this._tag=e,t!==At&&typeof n==`object`&&n&&t.size>0){let e=Ot.get(n);e&&(t=new Map([...e,...t])),Ot.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return n(this,arguments)}toString(){return Ue(this)}[Ze](){return this.toString()}},At=new Map,jt=class extends kt{constructor(e,t=At){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${Ue(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[ve](e){return Rt(e)&&ye(this.error,e.error)&&ye(this.annotations,e.annotations)}[ee](){return re(se(this._tag))(re(z(this.error))(z(this.annotations)))}},Mt=e=>new Dt(e),eee=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=z(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>ye(e,i)))continue;else t.push(i);r.push(i)}return r},Nt=a(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Dt(eee(e.reasons,t.reasons));return ye(e,n)?e:n}),tee=new Dt([]),Pt=e=>new Dt([new jt(e)]),Ft=class extends kt{constructor(e,t=At){super(`Die`,t,e),this.defect=e}toString(){return`Die(${Ue(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[ve](e){return nee(e)&&ye(this.defect,e.defect)&&ye(this.annotations,e.annotations)}[ee](){return re(se(this._tag))(re(z(this.defect))(z(this.annotations)))}},It=e=>new Dt([new Ft(e)]),Lt=a(e=>Tt(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Dt(e.reasons.map(e=>e.annotate(t,n)))),Rt=e=>e._tag===`Fail`,nee=e=>e._tag===`Die`,zt=e=>e._tag===`Interrupt`;function Bt(e){return Yt(`Effect.evaluate: Not implemented`)}var Vt=e=>({...bt,[ft]:e.op,[mt]:e[mt]??Bt,[ht]:e[ht],[gt]:e[gt],[_t]:e[_t]}),Ht=e=>{let t=Vt(e),n=function(e){this[pt]=e};return n.prototype=t,function(e){return new n(e)}},Ut=e=>{let t={[ut]:ut,_tag:e.op,get[e.prop](){return this[pt]},...Vt(e),toString(){return`${e.op}(${Ue(this[pt])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[pt]}},[ve](e){return St(e)&&e._tag===this._tag&&ye(this[pt],e[pt])},[ee](){return re(se(e.op),z(this[pt]))}},n=function(e){this[pt]=e};return n.prototype=t,function(e){return new n(e)}},Wt=Ut({op:`Success`,prop:`value`,[mt](e){let t=e.getCont(ht);return t?t[ht](this[pt],e,this):e.yieldWith(this)}}),Gt={key:`effect/Cause/StackTrace`},Kt={key:`effect/Cause/InterruptorStackTrace`},qt=Ut({op:`Failure`,prop:`cause`,[mt](e){let t=this[pt],n=!1;e.cache.stackFrame&&(t=Lt(t,{mapUnsafe:new Map([[Gt.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(gt),i=e._interruptedCause;if(i&&e.interruptible){let a=!1;for(;r&&e.interruptible;)a||=ft in r,r=e.getCont(gt);a&&(t=Mt(t.reasons.filter(e=>e._tag!==`Fail`))),t=Nt(t,i),n=!0}return r?r[gt](t,e,n?void 0:this):e.yieldWith(n?qt(t):this)}}),Jt=e=>qt(Pt(e)),Yt=e=>qt(It(e)),Xt=Ht({op:`WithFiber`,[mt](e){return this[pt](e)}}),Zt=function(){class e extends globalThis.Error{}let t=Vt({op:`YieldableError`,[mt](){return Jt(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Qt=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Zt{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(ct(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),$t=e=>{class t extends Qt{_tag=e}return t.prototype.name=e,t},en=`~effect/Cause/NoSuchElementError`,ree=class extends $t(`NoSuchElementError`){[en]=en;constructor(e){super({message:e})}},tn=`~effect/Cause/Done`,nn=e=>F(e,tn),rn={[tn]:tn,_tag:`Done`,value:void 0},an=e=>e===void 0?rn:{[tn]:tn,_tag:`Done`,value:e},iee=Jt(rn),aee=e=>e===void 0?iee:Jt(an(e)),on=e=>Vt({op:e.label,[mt]:e.evaluate}),sn=e=>(t,n)=>t===n||e(t,n),oee=(e,t)=>e===t,cn=()=>oee;function see(e){return sn((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function cee(e){return sn((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var ln=`~effect/Option`,un={[ln]:{_A:e=>e},...yt,[Symbol.iterator](){return new at(this)}},dn=Object.defineProperty(Object.assign(Object.create(un),{_tag:`Some`,_op:`Some`,[ve](e){return mn(e)&&gn(e)&&ye(this.value,e.value)},[ee](){return re(z(this._tag))(z(this.value))},toString(){return`some(${Ue(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:Qe(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),fn=z(`None`),pn=Object.assign(Object.create(un),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[ve](e){return mn(e)&&hn(e)},[ee](){return fn},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),mn=e=>F(e,ln),hn=e=>e._tag===`None`,gn=e=>e._tag===`Some`,_n=Object.create(pn),vn=function(e){this.value=e};vn.prototype=dn;var yn=e=>new vn(e),bn=`~effect/Result`,xn={[bn]:{_A:e=>e,_E:e=>e},...yt,[Symbol.iterator](){return new at(this)}},Sn=Object.assign(Object.create(xn),{_tag:`Success`,_op:`Success`,[ve](e){return wn(e)&&En(e)&&ye(this.success,e.success)},[ee](){return re(z(this._tag))(z(this.success))},toString(){return`success(${Ue(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:Qe(this.success)}}}),Cn=Object.assign(Object.create(xn),{_tag:`Failure`,_op:`Failure`,[ve](e){return wn(e)&&Tn(e)&&ye(this.failure,e.failure)},[ee](){return re(z(this._tag))(z(this.failure))},toString(){return`failure(${Ue(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:Qe(this.failure)}}}),wn=e=>F(e,bn),Tn=e=>e._tag===`Failure`,En=e=>e._tag===`Success`,Dn=function(e){this.failure=e};Dn.prototype=Cn;var lee=e=>new Dn(e),On=function(e){this.success=e};On.prototype=Sn;var uee=e=>new On(e);function kn(e){return(t,n)=>t===n?0:e(t,n)}var dee=kn((e,t)=>e<t?-1:1),An=kn((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),fee=a(2,(e,t)=>kn((n,r)=>e(t(n),t(r)))),jn=e=>a(2,(t,n)=>e(t,n)===-1),Mn=e=>a(2,(t,n)=>e(t,n)===1),Nn=e=>a(2,(t,n)=>e(t,n)!==1),Pn=e=>a(2,(t,n)=>e(t,n)!==-1),Fn=e=>a(2,(t,n)=>t===n||e(t,n)<1?t:n),In=()=>_n,Ln=yn,Rn=hn,zn=gn,Bn=a(2,(e,{onNone:t,onSome:n})=>Rn(e)?t():n(e.value)),Vn=a(2,(e,t)=>Rn(e)?t():e.value),pee=a(2,(e,t)=>Rn(e)?t():e),Hn=e=>e==null?In():Ln(e),Un=Vn(u),Wn=e=>(...t)=>{try{return Ln(e(...t))}catch{return In()}},Gn=a(2,(e,t)=>{if(zn(e))return e.value;throw t()}),Kn=Gn(()=>Error(`getOrThrow called on a None`)),qn=a(2,(e,t)=>Rn(e)?In():Ln(t(e.value))),Jn=a(2,(e,t)=>Rn(e)?In():t(e.value)),Yn=a(2,(e,t)=>Rn(e)?In():Hn(t(e.value))),Xn=Jn(o),Zn=e=>Rn(e)?[]:[e.value],Qn=a(2,(e,t)=>Rn(e)?In():t(e.value)?Ln(e.value):In()),$n=a(2,(e,t)=>!Rn(e)&&t(e.value)),er=`~effect/Context/Service`,tr=function(){function e(){}let t=e;Object.setPrototypeOf(t,mee);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[rr]=rr,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&nr.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},mee={[er]:er,...on({label:`Service`,evaluate(e){return Wt(yr(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return mr(this,e)},use(e){return Xt(t=>e(yr(t.context,this)))},useSync(e){return Xt(t=>Wt(e(yr(t.context,this))))}},nr=new Set,rr=`~effect/Context/Reference`,ir=`~effect/Context`,hee=8,gee=8,ar=(e,t,n,r)=>{let i=Object.create(vee);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},or=(e,t)=>{t&&(or(e,t.parent),e.set(t.key,t.value))},sr=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return or(t,e.overlay),e._flat=t},_ee=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),ur(n)},cr=Symbol(),lr=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?cr:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=gee&&(n.base=sr(n),n.overlay=void 0,n.depth=0),r)},ur=e=>ar(void 0,e,void 0,0),vee={get mapUnsafe(){return sr(this)},...yt,[ir]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ve](e){if(!dr(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!ye(r,n.get(e)))return!1;return!0},[ee](){return oe(this.mapUnsafe.size)}},yee=(e,t)=>e.cacheRoot===t.cacheRoot,dr=e=>F(e,ir),fr=e=>!!e[rr],pr=()=>bee,bee=ur(new Map),mr=(e,t)=>ur(new Map([[e.key,t]])),hr=a(3,(e,t,n)=>xee(e,t.key,n)),xee=(e,t,n)=>{let r=e,i=nr.has(t)?void 0:r.cacheRoot;if(r.depth>=hee){let e=new Map(r.mapUnsafe);return e.set(t,n),ar(i,e,void 0,0)}return ar(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},gr=a(2,(e,t)=>_r(e,t.key)),_r=(e,t)=>{let n=lr(e,t);return n===cr?void 0:n},vr=a(2,(e,t)=>{let n=lr(e,t.key);if(n===cr){if(fr(t))return xr(t);throw Sr(t)}return n}),yr=vr,br=`~effect/Context/defaultValue`,xr=e=>br in e?e[br]:e[br]=e.defaultValue(),Sr=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
4
- `);e.splice(1,3),t.stack=e.join(`
5
- `)}return t},Cr=a(2,(e,t)=>{let n=lr(e,t.key);return n===cr?fr(t)?Ln(xr(t)):In():Ln(n)}),wr=a(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:_ee(e,e=>t.mapUnsafe.forEach((t,n)=>e.set(n,t)))),Tr=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return ur(t)},Er=tr,Dr=e=>e.length>0,Or=e=>e>0?Math.floor(e):0,kr=uee,Ar=lee,jr=e=>{if(D(e))try{return kr(e())}catch(e){return Ar(e)}try{return kr(e.try())}catch(t){return Ar(e.catch(t))}},Mr=Tn,Nr=En,Pr=a(2,(e,t)=>Mr(e)?Ar(t(e.failure)):e),Fr=a(2,(e,{onFailure:t,onSuccess:n})=>Mr(e)?t(e.failure):n(e.success)),Ir=see,Lr=e=>{let t=e[Symbol.iterator]().next();if(t.done)throw Error(`headUnsafe: empty iterable`);return t.value},Rr={[Symbol.iterator](){return zr}},zr={next(){return{done:!0,value:void 0}}},Br=()=>Rr,Vr=a(2,(e,t)=>Object.hasOwn(e,t)),Hr=a(2,(e,t)=>{let n={...e};for(let r of Ur(e))st(n,r,t(e[r],r));return n}),Ur=e=>Object.keys(e),Wr=e=>a(2,(t,n)=>{for(let r of Ur(t))if(!Vr(n,r)||!e(t[r],n[r]))return!1;return!0}),Gr=e=>{let t=Wr(e);return(e,n)=>t(e,n)&&t(n,e)},Kr=globalThis.Array,qr=e=>Kr.isArray(e)?e:Kr.from(e),Jr=e=>Kr.isArray(e)?e:[e],Yr=a(2,(e,t)=>[...e,t]),Xr=a(2,(e,t)=>qr(e).concat(qr(t)));Kr.isArray;var Zr=Dr,Qr=Dr;function $r(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var ei=a(2,(e,t)=>{let n=Math.floor(t);if($r(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]}),See=e=>e[e.length-1],ti=()=>[],ni=e=>[e],ri=a(2,(e,t)=>e.map(t)),Cee=cee,ii=`~effect/Duration`,ai=BigInt(0),oi=BigInt(1),wee=BigInt(2),Tee=BigInt(10),si=BigInt(24),ci=BigInt(60),li=BigInt(1e3),ui=BigInt(1e6),di=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),fi=e=>di(e*1e6),pi=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=Tee**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*wee>=a?oi:ai);return r?-s:s},Eee=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,mi=e=>{switch(typeof e){case`number`:return ki(e);case`bigint`:return Oi(e);case`string`:{if(e===`Infinity`)return Ei;if(e===`-Infinity`)return Di;let t=Eee.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return Oi(pi(r,oi));if(i===`micro`||i===`micros`)return Oi(pi(r,li));let a=Number(r);switch(i){case`milli`:case`millis`:return ki(a);case`second`:case`seconds`:return Ai(a);case`minute`:case`minutes`:return ji(a);case`hour`:case`hours`:return Mi(a);case`day`:case`days`:return Ni(a);case`week`:case`weeks`:return Pi(a)}break}case`object`:{if(e===null)break;if(ii in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(S)?hi(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ti:e[0]===-1/0||e[1]===-1/0?Di:e[0]===1/0||e[1]===1/0?Ei:yi(di(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?yi(n):yi(di(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return hi(e)},hi=e=>{throw Error(`Invalid Input: ${e}`)},gi={_tag:`Millis`,millis:0},Dee={_tag:`Infinity`},_i={_tag:`NegativeInfinity`},vi={[ii]:ii,[ee](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?z(di(e)):oe(this.value.millis)}case`Nanos`:return z(this.value.nanos);default:return le(this.value)}},[ve](e){return bi(e)&&Pee(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[Ze](){return this.toJSON()},pipe(){return n(this,arguments)}},yi=e=>{let t=Object.create(vi);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?gi:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:fi(e)}:e>0?Dee:_i:e===ai?gi:{_tag:`Nanos`,nanos:e},t},bi=e=>F(e,ii),xi=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,Si=e=>{switch(e.value._tag){case`Millis`:return e.value.millis===0;case`Nanos`:return e.value.nanos===ai;case`Infinity`:case`NegativeInfinity`:return!1}},Ci=e=>{switch(e.value._tag){case`Millis`:return e.value.millis<0;case`Nanos`:return e.value.nanos<ai;case`NegativeInfinity`:return!0;case`Infinity`:return!1}},wi=e=>{switch(e.value._tag){case`Infinity`:case`NegativeInfinity`:return Ei;case`Millis`:return e.value.millis<0?yi(-e.value.millis):e;case`Nanos`:return e.value.nanos<ai?yi(-e.value.nanos):e}},Ti=yi(0),Ei=yi(1/0),Di=yi(-1/0),Oi=e=>yi(e),ki=e=>yi(e),Ai=e=>yi(e*1e3),ji=e=>yi(e*6e4),Mi=e=>yi(e*36e5),Ni=e=>yi(e*864e5),Pi=e=>yi(e*6048e5),Fi=e=>Li(mi(e),{onMillis:o,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Oee=e=>Li(mi(e),{onMillis:e=>e/1e3,onNanos:e=>Number(e)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),kee=e=>Li(mi(e),{onMillis:e=>e/6e4,onNanos:e=>Number(e)/6e10,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Aee=e=>Li(mi(e),{onMillis:e=>e/36e5,onNanos:e=>Number(e)/36e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ii=e=>{let t=mi(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return fi(t.value.millis)}},Li=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)()}}),Ri=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(Ii(e),t.value.nanos):n.onNanos(e.value.nanos,Ii(t))),zi=kn((e,t)=>Ri(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})),jee=(e,t)=>Ri(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Mee=Fn(zi),Nee=Nn(zi),Pee=a(2,(e,t)=>jee(e,t)),Bi=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=Ii(e),n=t<ai,r=n?-t:t,i=r/ui,a=i/li,o=a/ci,s=o/ci,c=s/si,l=n?-1:1;return{days:l*Number(c),hours:l*Number(s%si),minutes:l*Number(o%ci),seconds:l*Number(a%ci),millis:l*Number(i%li),nanos:l*Number(r%ui)}},Vi=e=>{if(e.value._tag===`Infinity`)return`Infinity`;if(e.value._tag===`NegativeInfinity`)return`-Infinity`;if(Si(e))return`0`;if(Ci(e))return`-`+Vi(wi(e));let t=Bi(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(` `)},Hi=e=>t=>!Mr(e(t)),Ui=e=>t=>t.has(e)?kr(t):Ar(t),Wi=a(2,(e,t)=>n=>{let r=e(n);return Mr(r)?r:t(r.success)}),Gi=e=>t=>{let n=e(t);return Mr(n)?In():Ln(n.success)},Ki=Er(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new Zi}),qi=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Ji=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Yi=e=>{try{return Ji(e)}catch{return qi(e)}},Xi=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},Zi=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?qi:Yi)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new Qi(this.setImmediate)}},Qi=class{tasks=new Xi;running=void 0;setImmediate;constructor(e=Yi){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},$i=Er(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),ea=Er(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),ta=class extends i{constructor(e){super(),e&&ct(this,e)}},na=e=>class extends ta{_tag=e},ra=Qt,ia=$t,aa=`~effect/encoding/EncodingError`,oa=class extends ia(`EncodingError`){[aa]=aa},sa=e=>{switch(e){case 16:return da();case 32:return fa();default:{let t=``;for(let n=e>>>3;n>0;n--)t+=ua();return t}}},ca=Uint8Array.from(`0123456789abcdef`,e=>e.charCodeAt(0)),la=()=>Math.random()*4294967296>>>0,ua=()=>{let e=la();return String.fromCharCode(ca[e>>>28],ca[e>>>24&15],ca[e>>>20&15],ca[e>>>16&15],ca[e>>>12&15],ca[e>>>8&15],ca[e>>>4&15],ca[e&15])},da=()=>{let e=la(),t=la();return String.fromCharCode(ca[e>>>28],ca[e>>>24&15],ca[e>>>20&15],ca[e>>>16&15],ca[e>>>12&15],ca[e>>>8&15],ca[e>>>4&15],ca[e&15],ca[t>>>28],ca[t>>>24&15],ca[t>>>20&15],ca[t>>>16&15],ca[t>>>12&15],ca[t>>>8&15],ca[t>>>4&15],ca[t&15])},fa=()=>{let e=la(),t=la(),n=la(),r=la();return String.fromCharCode(ca[e>>>28],ca[e>>>24&15],ca[e>>>20&15],ca[e>>>16&15],ca[e>>>12&15],ca[e>>>8&15],ca[e>>>4&15],ca[e&15],ca[t>>>28],ca[t>>>24&15],ca[t>>>20&15],ca[t>>>16&15],ca[t>>>12&15],ca[t>>>8&15],ca[t>>>4&15],ca[t&15],ca[n>>>28],ca[n>>>24&15],ca[n>>>20&15],ca[n>>>16&15],ca[n>>>12&15],ca[n>>>8&15],ca[n>>>4&15],ca[n&15],ca[r>>>28],ca[r>>>24&15],ca[r>>>20&15],ca[r>>>16&15],ca[r>>>12&15],ca[r>>>8&15],ca[r>>>4&15],ca[r&15])},pa=`effect/Tracer/ParentSpan`,ma=class extends tr()(pa,{fiberCached:!0}){},ha=e=>e,ga=Er(`effect/Tracer/DisablePropagation`,{defaultValue:l}),_a=Er(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),va=Er(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),ya=`effect/Tracer`,ba=ha({span:e=>new xa(e)}),xa=class{_tag=`Span`;sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(e){this.name=e.name,this.parent=e.parent,this.annotations=e.annotations,this.links=e.links,this.startTime=e.startTime,this.kind=e.kind,this.sampled=e.sampled,this.status={_tag:`Started`,startTime:e.startTime}}get traceId(){return this._traceId??=Un(this.parent)?.traceId??sa(32)}get spanId(){return this._spanId??=sa(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(e,t){this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}},Sa=`effect/Metric/FiberRuntimeMetrics`,Ca=Er(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:u}),wa=Er(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:c}),Ta=Er(`effect/References/TracerTimingEnabled`,{defaultValue:c}),Ea=Er(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),Da=Er(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),Oa=Er(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),ka=Er(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Aa=Er(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),ja=Er(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),Ma=e=>{if(e?.captureStackTrace===!1||e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=`boolean`)return e;let t=rt();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};it(3);let n=Error();return it(t),{...e,captureStackTrace:Pa(()=>n.stack)}},Na=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let i=r.split(`
6
- `);if(i[e]!==void 0)return n=i[e].trim(),n}},Pa=Na(3),Fa=class extends kt{constructor(e,t=At){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[ve](e){return zt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[ee](){return re(se(`${this._tag}:${this.fiberId}`))(te(this.annotations))}},Fee=e=>new Fa(e),Ia=e=>new Dt([new Fa(e)]),Iee=e=>{let t=e.reasons.find(Rt);return t?kr(t):Ar(e)},La=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return kr(n.error)}return Ar(e)},Lee=Gi(La),Ra=e=>e.reasons.some(zt),za=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?kr(t):Ar(e)},Ree=e=>{let t=za(e);return Mr(t)?zee:t.success},zee=new Set,Bee=e=>e.reasons.length>0&&e.reasons.every(zt),Vee=a(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>Rt(e)?(n=!0,new jt(t(e.error),e.annotations)):e);return n?Mt(r):e}),Ba=e=>{let t;for(let n of e.reasons){if(n._tag===`Fail`)return n.error;n._tag===`Die`&&(t??=n)}return t===void 0?e.reasons.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`):t.defect},Hee=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=rt();i!==0&&it(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(Va(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=Kee(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(Va(i,r[0].annotations,t))}}finally{i!==0&&it(i)}return n},Va=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(Uee(e),{cause:e.cause?Va(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=Gee(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?Ha(e,t):e}n?.includeCauseInStack&&(i.stack=Ga(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else i=new globalThis.Error(e?r===`string`?e:Xe(e):`Unknown error: ${e}`);return i},Uee=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Xe(e)},Wee=/\((.*)\)/g,Gee=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
7
- `),a=[r];for(let e=1;e<i.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(i[e]);e++)a.push(i[e]);return n?Ha(a.join(`
8
- `),n):a.join(`
9
- `)},Ha=(e,t)=>{let n=t?.get(Gt.key);return n&&(e=`${e}\n${Ua(n)}`),e},Kee=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(Kt.key);n.push(` at fiber (${t})`),r&&n.push(Ua(r))}return n.join(`
10
- `)},Ua=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(Wee),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
11
- `)},Wa=e=>Hee(e).map(Ga).join(`
12
- `),Ga=e=>e.cause?`${e.stack} {\n${Ka(e.cause,` `)}\n}`:e.stack,Ka=(e,t)=>{let n=e.stack.split(`
13
- `),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${Ka(e.cause,`${t} `)}\n${t}}`),r},qa=`~effect/Fiber`,qee={_A:o,_E:o},Jee={id:0},Ja=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),Ya=()=>Ja===void 0?void 0:new Ja(`effect/Fiber`),Xa=()=>globalThis[Be],Za=class{constructor(e,t=!0){this.setContext(e),this.id=++Jee.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[qa](){return qee}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return yr(this.context,e)}addObserver(e){return this._exit?(e(this._exit),d):(this._observers===void 0?this._observers=[e]:this._observers.push(e),()=>this.removeObserver(e))}removeObserver(e){if(this._exit||this._observers===void 0)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)}interruptUnsafe(e,t){if(this._exit)return;let n=Ia(e);this.cache.stackFrame&&(n=Lt(n,mr(Gt,this.cache.stackFrame))),t&&(n=Lt(n,t)),this._interruptedCause=this._interruptedCause?Nt(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(oo(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._asyncContext!==void 0){let t=this._asyncContext;return this._asyncContext=void 0,t.runInAsyncScope(this.evaluate,this,e)}if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===vt){this._asyncContext=Ya();return}let n=Qa.interruptChildren&&Qa.interruptChildren(this);if(n!==void 0)return this.evaluate(Go(n,()=>t));if(this._exit=t,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&=(this._parent._children?.delete(this),void 0),this._observers!==void 0){let e=this._observers;this._observers=void 0;for(let n=0;n<e.length;n++)e[n](t)}this._stack.length=0,this._children=void 0,this.context=pr()}runLoop(e){let t=globalThis[Be];globalThis[Be]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;){this._deferredInterrupt&&(this._deferredInterrupt=!1,i=oo(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=Go(uo,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[mt](this),i===vt){let e=this._yielded;if(ut in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return vt}}}catch(e){return F(i,mt)?this.runLoop(Yt(e)):Yt(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{this._running=n,globalThis[Be]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,Xee;for(;;){let t=this._stack.pop();if(!t)return;let n=t[_t];if(n!==void 0){let r=n.call(t,this);if(r)return r[e]=r,r}if(t[e])return t}}succeedWith(e){if(!(++this.currentOpCount&Zee-1))return Wt(e);let t=this.getCont(ht);return t?t[ht](e,this):this.yieldWith(Wt(e))}yieldWith(e){return this._yielded=e,vt}children(){return this._children??=new Set}pipe(){return n(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&yee(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=Yee(e);this.cache?.scheduler!==r.scheduler&&(this._dispatcher=void 0),this.cache=r}get currentSpanLocal(){let e=this.cache.span;return e?._tag===`Span`?e:void 0}},Yee=e=>{let t=_r(e,ya);return{scheduler:yr(e,Ki),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:yr(e,wa),span:_r(e,pa),logLevel:yr(e,ka),minimumLogLevel:yr(e,Aa),stackFrame:yr(e,Ca),runtimeMetrics:_r(e,Sa),maxOpsBeforeYield:yr(e,$i),preventYield:yr(e,ea)}},Xee={[ht](e,t){return oo(t._interruptedCause)},[gt](e,t){return oo(t._interruptedCause)}},Zee=32,Qa={interruptChildren:void 0},$a=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Kt.key,e.cache.stackFrame),ur(t)},Qee=e=>{if(e._children!==void 0&&e._children.size!==0)return io(e._children)},eo=e=>{let t=e;return t._exit?ao(t._exit):_o(n=>t._exit?n(ao(t._exit)):co(e.addObserver(e=>n(ao(e)))))},to=e=>_o(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(ao(r))}return a(),co(()=>i?.())}),no=e=>{let t=e;return t._exit?t._exit:_o(n=>t._exit?n(t._exit):co(e.addObserver(n)))},$ee=e=>_o(t=>{let n=Array.from(e);if(n.length===0)return t(ao(ti()));let r=Array(n.length),i=ti(),a=()=>{for(let e=0;e<i.length;e++)n[e].removeObserver(i[e])},o=0,s=!1;for(let e=0;e<n.length&&!s;e++){let c=i=>{if(o++,i._tag===`Failure`)return s=!0,a(),t(i);r[e]=i.value,o===n.length&&t(ao(r))};i.push(c),n[e].addObserver(c)}return co(()=>{s=!0,a()})}),ro=e=>Xt(t=>ete(e,t.id)),ete=a(e=>F(e[0],qa),(e,t,n)=>Xt(r=>{let i=$a(r);return i=i&&n?wr(i,n):i??n,e.interruptUnsafe(t,i),Ho(eo(e))})),io=e=>Xt(t=>{let n=$a(t),r=ti();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return Ho(to(r))}),ao=Wt,oo=qt,so=Jt,co=Ht({op:`Sync`,[mt](e){let t=this[pt](),n=e.getCont(ht);return n?n[ht](t,e):e.yieldWith(Wt(t))}}),lo=Ht({op:`Suspend`,[mt](e){return this[pt]()}}),tte=Fr({onFailure:so,onSuccess:ao}),uo=Ht({op:`Yield`,[mt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(as)},this[pt]??0),e.yieldWith(()=>{t=!0})}})(0),fo=ao(In()),nte=e=>lo(()=>oo(e())),po=e=>Yt(e),mo=e=>lo(()=>so(e())),ho=ao(void 0),rte=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new hl(e,`An error occurred in Effect.try`):e.catch;return lo(()=>{try{return ao(t())}catch(e){return so(n(e))}})},ite=e=>go(function(t,n){e(n).then(e=>t(ao(e)),e=>t(po(e)))},e.length!==0),ate=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new hl(e,`An error occurred in Effect.tryPromise`):e.catch;return go(function(e,r){let i=e=>lo(()=>{try{return so(ot(()=>n(e)))}catch(e){return po(e)}});try{t(r).then(t=>e(ao(t)),t=>e(i(t)))}catch(t){e(i(t))}},t.length!==0)},ote=e=>Xt(t=>e(t.id)),go=function(){let e=Vt({op:`Async`,[mt](e){let t=!1,n=!1,r=this.withSignal?new AbortController:void 0,i=this.register.call(e.cache.scheduler,r=>{t||(t=!0,n?e.evaluate(r):n=r)},r?.signal);return n===!1?(n=!0,e._yielded=()=>{t=!0},r===void 0&&i===void 0||e._stack.push(ste(()=>(t=!0,r?.abort(),i??as))),vt):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),ste=Ht({op:`AsyncFinalizer`,[_t](e){e.interruptible&&(e.interruptible=!1,e._stack.push(kc))},[gt](e,t){return Ra(e)?Go(cc(qt(e),this[pt]()),()=>oo(e)):oo(e)}}),_o=e=>go(e,e.length>=2),vo=_o(d),yo=(...e)=>{if(e.length===1){let t=e[0];return lo(()=>Do(t()))}let[t,n]=e;return lo(()=>Do(n.call(t.self)))},bo=(e,...t)=>{let n=t.length===0?function(){return lo(()=>Do(e.apply(this,arguments)))}:function(){let n=lo(()=>Do(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return xo(e.length,n)},xo=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),So=Na(2),Co=function(){let e=typeof arguments[0]==`string`,t=e?arguments[0]:`Effect.fn`,n=e?arguments[1]:void 0,r=rt(),i;return r!==0&&(it(2),i=new globalThis.Error,it(r)),e?(r,...a)=>wo(t,r,i,a,e,n):wo(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},wo=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.shift().bind(t.self),s=`${e} (definition)`,c=n?So(()=>n.stack):u;return xo(o.length,function(...t){let n=lo(()=>{let e=o.apply(this,arguments);return xt(e)?e:Do(e)});for(let e=0;e<r.length;e++)n=r[e](n,...t);if(!xt(n))return n;let l=rt(),d;return l!==0&&(it(2),d=new globalThis.Error,it(l)),ps(i?el(e,a,e=>tl(n,e)):n,Ca,t=>({name:e,stack:d?So(()=>d.stack):u,parent:{name:s,stack:c,parent:t}}))})},To=(e,...t)=>xo(e.length,t.length===0?function(){return Eo(()=>e.apply(this,arguments))}:function(){let n=Eo(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),Eo=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return ao(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return lo(()=>n?(n=!1,Go(r.value,e=>Do(t,e))):lo(()=>Do(e())))}}}catch(e){return po(e)}},Do=function(){let e=Vt({op:`Iterator`,[ht](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return ao(r.value);if(!Ko(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[mt](e){return this[ht](this.initial,e)}}),t=function(e,t){this.iterator=e,this.initial=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),Oo=a(2,(e,t)=>new jo(e,Mo,ao(t))),ko=function(e){return e._stack.push(this),this[pt]},Ao=Vt({op:`OnSuccess`,[mt]:ko}),jo=function(e,t,n){this[pt]=e,this[ht]=t,this.payload=n};jo.prototype=Ao;var Mo=function(){return this.payload},No=function(e,t){return t.succeedWith(this.payload)},Po=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),Fo=function(e,t){let n=this.payload;return t.succeedWith(Po?n(e):ot(()=>n(e)))},Io=function(e){let t=this.payload;return t(e)},Lo=function(e){let t=this.payload;return new jo(t(e),No,e)},Ro=function(e){return new jo(this.payload,No,e)},zo=e=>Yo(e,Ln),Bo=a(2,(e,t)=>new jo(e,xt(t)?Mo:Io,t)),Vo=a(2,(e,t)=>new jo(e,xt(t)?Ro:Lo,t)),Ho=e=>new jo(e,Mo,as),Uo=(e,t)=>Xt(n=>{let r=new Set;return Tc(n,()=>r.size===0?void 0:io(r)),_o(i=>{let a=!1,o=0;for(let s of e){if(a)break;let e=o++,c=zc(n,s,!0,!0,!1);r.add(c),c.addObserver(o=>{r.delete(c);let s=!a;a=!0,i(o),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}})}),Wo=a(e=>xt(e[1]),(e,t,n)=>Uo([e,t],n)),Go=a(2,(e,t)=>new jo(e,Io,t)),Ko=e=>e[ut]!==void 0,qo=a(2,(e,t)=>Ko(e)?e._tag===`Success`?t(e.value):e:Go(e,t)),Jo=e=>Go(e,o),Yo=a(2,(e,t)=>new jo(e,Fo,t)),Xo=a(2,(e,t)=>Ko(e)?os(e,t):Yo(e,t)),Zo=a(2,(e,t)=>Ko(e)?ss(e,t):Ns(e,t)),Qo=a(2,(e,t)=>Ko(e)?cs(e,t):Ps(e,t)),$o=a(2,(e,t)=>{if(Ko(e)){if(e._tag===`Success`)return e;let n=La(e.cause);return Mr(n)?e:t(n.success)}return Ds(e,t)}),es=e=>qt(Ia(e)),ts=e=>e._tag===`Success`,ns=e=>e._tag===`Failure`,rs=e=>e._tag===`Failure`?kr(e.cause):Ar(e),is=e=>e._tag===`Failure`&&Ra(e.cause),as=Wt(void 0),os=a(2,(e,t)=>e._tag===`Success`?Wt(t(e.value)):e),ss=a(2,(e,t)=>{if(e._tag===`Success`)return e;let n=La(e.cause);return Mr(n)?e:Jt(t(n.success))}),cs=a(2,(e,t)=>{if(e._tag===`Success`)return Wt(t.onSuccess(e.value));let n=La(e.cause);return Mr(n)?e:Jt(t.onFailure(n.success))}),ls=a(2,(e,t)=>ts(e)?t:e),us=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?as:qt(Mt(t))},ds=e=>Xt(t=>ao(Cr(t.context,e))),fs=a(2,(e,t)=>Xt(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),Tc(n,()=>{n.setContext(r)}),e)})),ps=a(3,(e,t,n)=>fs(e,e=>{let r=vr(e,t),i=n(r);return r===i?e:hr(e,t,i)})),ms=()=>hs,hs=Xt(e=>ao(e.context)),gs=e=>Xt(t=>e(t.context)),_s=a(2,(e,t)=>Ko(e)?e:fs(e,wr(t))),vs=function(){return arguments.length===1?a(2,(e,t)=>ys(e,arguments[0],t)):a(3,(e,t,n)=>ys(e,t,n)).apply(this,arguments)},ys=(e,t,n)=>fs(e,hr(t,n)),bs=a(2,(e,t)=>Go(t,t=>t?zo(e):fo)),xs=a(e=>xt(e[0]),(e,t)=>Nc({while:c,body:s(t?.disableYield?e:Go(e,e=>uo)),step:d})),Ss=a(2,(e,t)=>new ws(e,t.length===1?t:e=>t(e))),Cs=Vt({op:`OnFailure`,[mt]:ko}),ws=function(e,t){this[pt]=e,this[gt]=t};ws.prototype=Cs;var Ts=a(3,(e,t,n)=>Ss(e,e=>t(e)?n(e):oo(e))),Es=a(3,(e,t,n)=>Ss(e,e=>{let r=t(e);return Mr(r)?oo(r.failure):n(r.success,e)})),Ds=a(2,(e,t)=>Es(e,La,e=>t(e))),Os=a(2,(e,t)=>Ss(e,e=>Bo(t(e),oo(e)))),ks=a(3,(e,t,n)=>Ss(e,e=>{let r=t(e);return Mr(r)?oo(e):Bo(n(r.success,e),oo(e))})),As=a(2,(e,t)=>ks(e,La,e=>t(e))),js=a(e=>xt(e[0]),(e,t,n,r)=>Ss(e,e=>{let i=La(e);return Mr(i)?oo(i.failure):t(i.success)?n(i.success):r?r(i.success):oo(e)})),Ms=a(e=>xt(e[0]),(e,t,n,r)=>js(e,Array.isArray(t)?e=>F(e,`_tag`)&&t.includes(e._tag):I(t),n,r)),Ns=a(2,(e,t)=>Ds(e,e=>mo(()=>t(e)))),Ps=a(2,(e,t)=>Ks(e,{onFailure:e=>mo(()=>t.onFailure(e)),onSuccess:e=>co(()=>t.onSuccess(e))})),Fs=e=>Ds(e,po),Is=a(2,(e,t)=>Ds(e,e=>co(()=>t(e)))),Ls=a(e=>xt(e[0]),(e,t)=>{if(!t?.log)return Ks(e,{onFailure:e=>ho,onSuccess:e=>ho});let n=Cl(t.log===!0?void 0:t.log);return Vs(e,{onFailure(e){let r=Iee(e);return Mr(r)?oo(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>ho})}),Rs=a(e=>xt(e[0]),(e,t)=>{if(!t?.log)return Vs(e,{onFailure:e=>ho,onSuccess:e=>ho});let n=Cl(t.log===!0?void 0:t.log);return Vs(e,{onFailure:e=>t.message===void 0?n(e):n(t.message,e),onSuccess:e=>ho})}),zs=e=>qs(e,{onFailure:In,onSuccess:Ln}),Bs=e=>Js(e,{onFailure:Ar,onSuccess:kr}),Vs=a(2,(e,t)=>new Us(e,t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),t.onFailure.length===1?t.onFailure:e=>t.onFailure(e))),Hs=Vt({op:`OnSuccessAndFailure`,[mt]:ko}),Us=function(e,t,n){this[pt]=e,this[ht]=t,this[gt]=n};Us.prototype=Hs;var Ws=function(e,t){let n=this.payload;return t.succeedWith(Po?n.onSuccess(e):ot(()=>n.onSuccess(e)))},Gs=((e,t)=>{let n=Vt({op:e,[mt]:ko,[ht]:Ws,[gt]:t}),r=function(e,t){this[pt]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(Rt);if(n===void 0)return oo(e);let r=this.payload;return t.succeedWith(Po?r.onFailure(n.error):ot(()=>r.onFailure(n.error)))}),Ks=a(2,(e,t)=>Vs(e,{onFailure:e=>{let n=e.reasons.find(Rt);return n?t.onFailure(n.error):oo(e)},onSuccess:t.onSuccess})),qs=a(2,(e,t)=>new Gs(e,t)),Js=a(2,(e,t)=>{if(Ko(e)){if(e._tag===`Success`)return Wt(t.onSuccess(e.value));let n=La(e.cause);return Mr(n)?e:Wt(t.onFailure(n.success))}return qs(e,t)}),Ys=e=>Ko(e)?Wt(e):Xs(e),Xs=Ht({op:`Exit`,[mt](e){return e._stack.push(this),this[pt]},[ht](e,t,n){return t.succeedWith(n??Wt(e))},[gt](e,t,n){return t.succeedWith(n??qt(e))}}),Zs=a(2,(e,t)=>Bo(sl(t),e)),Qs=a(2,(e,t)=>Go(tc(e,t.duration),e=>Rn(e)?t.orElse():ao(e.value))),$s=e=>new qte(`Operation timed out after '${Vi(e)}'`),ec=a(2,(e,t)=>{let n=mi(t);return Qs(e,{duration:n,orElse:()=>so($s(n))})}),tc=a(2,(e,t)=>Wo(zo(e),Oo(sl(t),In()))),nc=`~effect/Scope`,rc=`~effect/Scope/Closeable`,ic=tr(`effect/Scope`),ac=(e,t)=>Xt(n=>{let r=oc(e,t);return r===void 0?ho:(Cte(n),r)}),oc=(e,t)=>{let n=e.state;if(n._tag===`Closed`||(e.state={_tag:`Closed`,exit:t},e.parent!==void 0&&hc(e.parent,e),n._tag===`Empty`))return;if(n.finalizer!==void 0)return sc(n.finalizer,t);let r=n.finalizers;return r.size===1?sc(r.values().next().value,t):lc(e,r,t)},sc=(e,t)=>{try{return e(t)}catch(e){return Yt(e)}},cc=(e,t)=>ts(e)?t:Ss(t,t=>oo(Nt(e.cause,t))),lc=bo(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=Xa();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*Ys(sc(s,n))):i.push(zc(o,sc(s,n),!0,!0,`inherit`))}return i.length>0&&(r=yield*to(i)),yield*us(r)}),uc=(e,t)=>co(()=>dc(e,t)),dc=(e,t)=>{let n=_c(t,e);return e.state._tag===`Closed`?(n.state=e.state,n):(mc(e,n,e=>ac(n,e)),n)},fc=(e,t)=>lo(()=>e.state._tag===`Closed`?t(e.state.exit):(mc(e,{},t),ho)),pc=(e,t)=>fc(e,s(t)),mc=(e,t,n)=>{if(e.state._tag===`Empty`)e.state={_tag:`Open`,finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag===`Open`){let r=e.state;r.finalizer===void 0?r.finalizers.set(t,n):(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n))}},hc=(e,t)=>{if(e.state._tag!==`Open`)return;let n=e.state;n.finalizerKey===t?e.state=vc:n.finalizers!==void 0&&(n.finalizers.delete(t),n.finalizers.size===0&&(e.state=vc))},gc=e=>_c(e,void 0),_c=(e=`sequential`,t)=>({[rc]:rc,[nc]:nc,strategy:e,parent:t,state:vc}),vc={_tag:`Empty`},yc=e=>co(()=>gc(e)),bc=ic,xc=vs(ic),cte=e=>Xt(t=>{let n=t.context,r=gc();return t.setContext(hr(t.context,ic,r)),Tc(t,e=>(t.setContext(n),oc(r,e))),e}),Sc=e=>lo(()=>{let t=gc();return Ec(e(t),e=>lo(()=>oc(t,e)??ho))}),lte=(e,t,n)=>gs(r=>jc(i=>Go(bc,a=>Vo(n?.interruptible?i(e):e,e=>fc(a,n=>_s(t(e,n),r)))))),ute=e=>Go(bc,t=>gs(n=>fc(t,t=>_s(e(t),n)))),Cc=function(){let e=Vt({op:`OnExit`,[mt](e){return e._stack.push(this),this.effect},[_t](e){e.interruptible&&this.interruptible!==!0&&(e._stack.push(kc),e.interruptible=!1)},[ht](e,t,n){n??=Wt(e);let r;try{r=this.onExit(n)}catch(e){r=Yt(e)}return r?Go(r,e=>n):n},[gt](e,t,n){n??=qt(e);let r;try{r=this.onExit(n)}catch(e){r=Yt(e)}return r?Go(cc(n,r),e=>n):n}}),t=function(e,t,n){this.effect=e,this.onExit=t,this.interruptible=n};return t.prototype=e,t}(),wc=(e,t,n)=>new Cc(e,t,n),Tc=(e,t)=>{e._stack.push(new Cc(void 0,t,void 0))},Ec=a(2,wc),dte=a(2,(e,t)=>Ec(e,e=>t)),fte=a(3,(e,t,n)=>Ec(e,e=>{let r=t(e);return Mr(r)?ho:n(r.success,e)})),pte=a(2,(e,t)=>fte(e,rs,t)),mte=a(3,(e,t,n)=>Ec(e,e=>{if(e._tag!==`Failure`)return ho;let r=t(e.cause);return Mr(r)?ho:n(r.success,e.cause)})),hte=a(2,(e,t)=>mte(za,t)(e)),gte=(e,t,n)=>jc(r=>Go(e,e=>wc(lo(()=>r(t(e))),t=>n(e,t),!0))),_te=s(1/0),vte=(e,t)=>{let n=0,r,i,a=(e,t)=>(t.awaiters++,Tc(e,()=>{if(!(--t.awaiters>0||i!==t))return i=void 0,ro(t.fiber)}),no(t.fiber));return[Xt(o=>{if(i!==void 0)return a(o,i);if(r!==void 0&&(n===1/0||o.getRef(nl).currentTimeMillisUnsafe()<n))return r;r=void 0;let s=o.getRef(nl),c={fiber:void 0,awaiters:0};return i=c,c.fiber=zc(o,wc(e,e=>{if(i!==c||(i=void 0,is(e)))return;let a=t(e);n=a===1/0?1/0:s.currentTimeMillisUnsafe()+a,r=e}),!0,!0),c.fiber._exit??a(o,c)}),co(()=>{r=void 0})]},yte=e=>co(()=>vte(e,_te)[0]),bte=Xt(e=>oo(Ia(e.id))),Dc=e=>Xt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(kc),e):e),Oc=Ht({op:`SetInterruptible`,[_t](e){if(e.interruptible=this[pt],e._interruptedCause&&e.interruptible)return()=>oo(e._interruptedCause)}}),kc=Oc(!0),xte=Oc(!1),Ste=e=>{if(e.interruptible=!0,e._stack.push(xte),e._interruptedCause)return oo(e._interruptedCause)},Cte=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(kc))},Ac=e=>Xt(t=>t.interruptible?e:Ste(t)??e),jc=e=>Xt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(kc),e(Ac)):e(o)),Mc=(e,t)=>R(e)?t?.mode===`result`?Pc(e,Bs,t):Pc(e,o,t):t?.discard?t.mode===`result`?Pc(Object.values(e),Bs,t):Pc(Object.values(e),o,t):lo(()=>{let n={};return Oo(Pc(Object.entries(e),([e,r])=>Yo(t?.mode===`result`?Bs(r):r,t=>{st(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),Nc=Ht({op:`While`,[ht](e,t){return this[pt].step(e),this[pt].while()?(t._stack.push(this),this[pt].body()):as},[mt](e){return this[pt].while()?(e._stack.push(this),this[pt].body()):as}}),Pc=a(e=>typeof e[1]==`function`,(e,t,n)=>lo(()=>{let r=Fc(n?.concurrency);if(r===1)return wte(e,t,n);let i=qr(e),a=i.length;if(a===0)return n?.discard?ho:ao([]);let o=n?.discard?void 0:Array(a),s=Tte({f:t,out:o},i,{concurrency:r});return s?Oo(s,o):ao(o)})),wte=(e,t,n)=>lo(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return Oo(Nc({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),Fc=e=>e===`unbounded`?1/0:Math.max(1,e??1),Ic=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>Go(Ys(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??ho),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!Ko(c))return r(e,i,a,o,c);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return i},Lc=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=Yt(e);return f=t,c=!0,u&&u.size>0?Go(Dc(io(Array.from(u))),()=>f??t):t},h=()=>{let i=!1;for(;!f&&a<o;a++){let o=r[a],g=p??t(e,o,a);if(Ko(g)){if(f=n(e,o,g,a),f)break}else if(l){p=void 0;let t=zc(l,g,!0,!0,`inherit`);if(t._exit){if(f=n(e,o,t._exit,a),f)break;continue}u.add(t);let r=a;if(t.addObserver(a=>{u.delete(t);try{if(f){if(a._tag===`Failure`){let e=a.cause.reasons.filter(e=>e._tag!==`Interrupt`);if(e.length>0){let t=Mt(e);f=qt(f._tag===`Failure`?Nt(f.cause,t):t)}}}else{let t=n(e,o,a,r);t&&(f=t,h())}if(i){let e=h();e&&d(e)}else c&&u.size===0&&d(f??ho)}catch(e){d(m(e))}}),u.size<s)continue;i=!0,a++;return}else return _o(e=>{l=Xa(),u=new Set,p=g,d=e;let t;try{t=h()}catch(t){return e(m(t))}return t?e(t):lo(()=>(f??=as,Go(u?io(u):ho,()=>f?._tag===`Failure`?f:ho)))})}if(c=!0,f){if(u&&u.size>0){let e=$a(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||f._tag===`Failure`)return f}else if(d){if(u)u.size===0&&d(ho);else return as}};return h()}},Rc=()=>e=>Lc(e),Tte=Lc({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)}}),Ete=a(e=>xt(e[0]),(e,t)=>Xt(n=>(Ol(),ao(zc(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),zc=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new Za(a.context,o);return n?s.evaluate(t):(s._asyncContext=Ya(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),!r&&!s._exit&&(a.children().add(s),s._parent=a),s},Dte=a(e=>xt(e[0]),(e,t)=>Xt(n=>ao(zc(n,e,t?.startImmediately,!0,t?.uninterruptible)))),Bc=a(e=>xt(e[0]),(e,t,n)=>Xt(r=>{let i=zc(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit){if(t.state._tag!==`Closed`){let e={};mc(t,e,()=>ote(e=>e===i.id?ho:ro(i))),i.addObserver(()=>hc(t,e))}else i.interruptUnsafe(r.id,$a(r))}return ao(i)})),Ote=a(e=>xt(e[0]),(e,t)=>Go(bc,n=>Bc(e,n,t))),Vc=e=>(t,n)=>{let r=new Za(n?.scheduler?hr(e,Ki,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},kte=a(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return mc(t,n,()=>ro(e)),e.addObserver(()=>hc(t,n)),e}),Ate=Vc(pr()),Hc=e=>{let t=Vc(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},jte=Hc(pr()),Uc=e=>{let t=Vc(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Mte=Uc(pr()),Wc=e=>{let t=Uc(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw Ba(e.cause);return e.value})},Nte=Wc(pr()),Gc=e=>{let t=Vc(e);return e=>{if(Ko(e))return e;let n=new Zi(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Yt(new Jte(r))}},Pte=Gc(pr()),Kc=e=>{let t=Gc(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw Ba(n.cause);return n.value}},Fte=Kc(pr()),qc=ao(!0),Jc=ao(!1),Ite=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return qc;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=[],qc}flushScheduled=()=>{if(this.scheduled===void 0)return;let e=this.scheduled;this.scheduled=void 0;for(let t=0;t<e.length;t++)e[t](as)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](as)}open=Xt(e=>this._isOpen?Jc:(this._isOpen=!0,this.scheduleUnsafe(e)));release=Xt(e=>this._isOpen?Jc:this.scheduleUnsafe(e));openUnsafe(){return!this._isOpen&&(this._isOpen=!0,this.flushWaiters(),!0)}await=_o(e=>this._isOpen?e(ho):(this.waiters.push(e),co(()=>{let t=this.waiters.indexOf(e);t===-1?this.scheduled!==void 0&&(t=this.scheduled.indexOf(e),t!==-1&&this.scheduled.splice(t,1)):this.waiters.splice(t,1)})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=co(()=>this.closeUnsafe());whenOpen=e=>Go(this.await,()=>e);isOpen(){return this._isOpen}},Yc=e=>new Ite(e??!1),Lte=e=>co(()=>Yc(e)),Xc=BigInt(0),Rte={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Xc,endTime:Xc,exit:as},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},zte=e=>Object.assign(Object.create(Rte),e),Zc=e=>e?yr(e.annotations,ga)?e._tag===`Span`?Zc(Un(e.parent)):In():Ln(e):In(),Qc=(e,t,n)=>{let r=!e.cache.tracerEnabled||n?.annotations&&yr(n.annotations,ga),i=n?.parent===void 0?n?.root?In():Zc(e.cache.span):Ln(n.parent),a;if(r)a=zte({name:t,parent:i,annotations:hr(n?.annotations??pr(),ga,!0)});else{let r=e.cache.tracer??ba,o=e.getRef(nl),s=e.getRef(Ta),c=e.getRef(Ea),l=e.getRef(Da),u=n?.level??e.getRef(_a),d=n?.links===void 0?l.length===0?[]:l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??pr(),links:d,startTime:s?o.currentTimeNanosUnsafe():Xc,kind:n?.kind??`internal`,root:n?.root??Rn(i),sampled:n?.sampled??(zn(i)&&i.value.sampled===!1?!1:!gl(e.getRef(va),u))});for(let e in c)a.attribute(e,c[e]);if(n?.attributes!==void 0)for(let e in n.attributes)a.attribute(e,n.attributes[e])}return a},Bte=(e,t)=>Dc(Xt(n=>{let r=vr(n.context,ic),i=Qc(n,e,t??{}),a=n.getRef(nl),o=n.getRef(Ta);return Oo(fc(r,e=>$c(i,e,a,o)),i)})),Vte=(e,t)=>(t=typeof t==`function`?t:u,ps(Ca,n=>({name:e,stack:t,parent:n}))),$c=(e,t,n,r)=>co(()=>{e.status._tag!==`Ended`&&e.end(r?n.currentTimeNanosUnsafe():Xc,t)}),el=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return Xt(t=>{let i=Qc(t,e,n),a=t.getRef(nl),o=t.getRef(Ta);return Tc(t,e=>$c(i,e,a,o)),r(i)})},tl=vs(ma),Hte=function(){let e=xt(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=o;return t._tag===`Span`&&(n=Ma(n),r=Vte(t.name,n?.captureStackTrace)),e?tl(r(arguments[0]),t):e=>tl(r(e),t)},Ute=(...e)=>Xt(t=>{let n=t.currentSpanLocal;if(n){if(e.length===1)for(let[t,r]of Object.entries(e[0]))n.attribute(t,r);else n.attribute(e[0],e[1])}return ho}),nl=Er(`effect/Clock`,{defaultValue:()=>new Wte}),rl=2**31-1,Wte=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=co(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Gte()}currentTimeNanos=co(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return al()}monotonicTimeNanos=co(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(Fi(e))}sleepMillis(e){return e<=0?uo:Number.isFinite(e)?_o(t=>{let n=e>rl?this.sleepMillis(e-rl):ho,r=setTimeout(()=>t(n),Math.min(e,rl));return co(()=>clearTimeout(r))}):vo}},il=BigInt(1e6),al=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())*il;return e>t&&(t=e),t}}(),Gte=function(){let e=BigInt(1e9),t;return()=>{let n=al(),r=BigInt(Date.now())*il;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}}(),ol=e=>Xt(t=>e(t.getRef(nl))),sl=e=>ol(t=>t.sleep(mi(e))),Kte=ol(e=>e.currentTimeMillis),cl=`~effect/Cause/TimeoutError`,qte=class extends $t(`TimeoutError`){[cl]=cl;constructor(e){super({message:e})}},ll=`~effect/Cause/IllegalArgumentError`,ul=class extends $t(`IllegalArgumentError`){[ll]=ll;constructor(e){super({message:e})}},dl=`~effect/Cause/ExceededCapacityError`,fl=class extends $t(`ExceededCapacityError`){[dl]=dl;constructor(e){super({message:e})}},pl=`~effect/Cause/AsyncFiberError`,Jte=class extends $t(`AsyncFiberError`){[pl]=pl;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},ml=`~effect/Cause/UnknownError`,hl=class extends $t(`UnknownError`){[ml]=ml;constructor(e,t){super({message:t,cause:e})}},Yte=Er(`effect/Console`,{defaultValue:()=>globalThis.console}),gl=Mn(fee(An,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),_l=Er(`effect/Logger/CurrentLoggers`,{defaultValue:()=>new Set([El,Dl])}),vl=Er(`effect/Logger/LogToStderr`,{defaultValue:l}),yl={"~effect/Logger":{_Message:o,_Output:o},pipe(){return n(this,arguments)}},bl=e=>{let t=Object.create(yl);return t.log=e,t},xl=e=>e.replace(/[\s="]/g,`_`),Sl=(e,t)=>`${xl(e[0])}=${t-e[1]}ms`,Cl=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];Tt(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?Mt(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=tee),Xt(r=>{let i=e??r.cache.logLevel;if(gl(r.cache.minimumLogLevel,i))return ho;let a=r.getRef(nl),o=r.getRef(_l);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return ho})},wl={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};wl.gray,wl.blue,wl.green,wl.yellow,wl.red,wl.bgBrightRed,wl.black;var Tl=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,El=bl(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(Wa(e));let o=t.getTime(),s=n.getRef(ja),c=``;for(let e of s)c+=` ${Sl(e,o)}`;let l=n.getRef(Oa);Object.keys(l).length>0&&a.push(l);let u=n.getRef(Yte);(n.getRef(vl)?u.error:u.log)(`[${Tl(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),Dl=bl(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(nl),a=t.getRef(Oa),o=t.cache.span;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))st(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=Wa(e)),o.event($e(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)});function Ol(){Qa.interruptChildren??=Qee}var kl=ao(void 0),Al=Tt,jl=Et,Ml=Rt,Nl=Mt,Pl=Pt,Fl=It,Il=Ia,Ll=e=>new jt(e),Rl=e=>new Ft(e),Xte=Fee,Zte=Bee,zl=Vee,Qte=Nt,Bl=Ba,Vl=La,Hl=Lee,Ul=Ra,Wl=Ree,Gl=za,Kl=Wa,ql=ree,Jl=nn,Yl=aee,Xl=ul,Zl=fl,Ql=hl,$l=Lt,eu=St,tu=Wt,nu=qt,ru=Jt,iu=Yt,au=es,ou=as,su=ts,cu=ns,lu=is,uu={"~effect/Deferred":{_A:o,_E:o},pipe(){return n(this,arguments)}},du=function(){this.resumes=void 0,this.effect=void 0};du.prototype=uu;var fu=()=>new du,pu=()=>co(()=>fu()),mu=e=>_o(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),co(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)}))),hu=a(2,(e,t)=>co(()=>_u(e,t))),$te=a(2,(e,t)=>hu(e,Jt(t))),ene=a(2,(e,t)=>hu(e,qt(t))),tne=a(2,(e,t)=>ene(e,Ia(t))),gu=a(2,(e,t)=>hu(e,Wt(t))),_u=(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},nne=a(2,(e,t)=>jc(n=>Go(Ys(n(e)),e=>hu(t,e)))),rne=Oa,vu=ic,ine=yc,yu=gc,bu=xc,xu=fc,Su=pc,Cu=uc,wu=dc,Tu=ac,ane=`~effect/Layer`,Eu=`~effect/Layer/MemoMap`,one=(e,t)=>{let n={observers:0,deferred:fu(),scope:yu(),finalizer:r=>lo(()=>--n.observers>0?ho:(e.map.delete(t),Tu(n.scope,r)))};return n},Du=(e,t)=>t.state._tag!==`Closed`&&(e.observers++,mc(t,{},e.finalizer),!0),sne={[ane]:{_ROut:o,_E:o,_RIn:o},pipe(){return n(this,arguments)}},Ou=e=>{let t=Object.create(sne);return t.build=e,t},ku=e=>Ou((t,n)=>{let r=wu(n);return Ec(e(t,r),e=>e._tag===`Failure`?Tu(r,e):ho)}),Au=e=>{let t=ku((n,r)=>n.getOrElseMemoize(t,r,e));return t},ju=class{get[Eu](){return Eu}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);return n?(Du(n,t),n.deferred.effect??mu(n.deferred)):this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return lo(()=>{let r;return wc(lo(()=>{let i=this.get(e,t);if(i)return i;let a=one(this,e);return Du(a,t)?(r=a.deferred,this.map.set(e,a),n(this,a.scope)):n(this,t)}),e=>{r&&_u(r,e)})})}},Mu=()=>new ju,Nu=e=>new ju(e),Pu=class e extends tr()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=gr(t,e);return n?Nu(n):Mu()}},Fu=a(3,(e,t,n)=>vs(Yo(e.build(t,n),hr(Pu,t)),Pu,t)),Iu=e=>Xt(t=>Fu(e,Pu.forkOrCreate(t.context),vr(t.context,vu))),Lu=a(2,(e,t)=>Xt(n=>Fu(e,Pu.forkOrCreate(n.context),t))),Ru=function(){return arguments.length===1?e=>zu(mr(arguments[0],e)):zu(mr(arguments[0],arguments[1]))},zu=e=>Ou(s(ao(e))),Bu=zu(pr()),Vu=function(){return arguments.length===1?e=>Hu(()=>mr(arguments[0],e())):Hu(()=>mr(arguments[0],arguments[1]()))},Hu=e=>Au(s(co(e))),Uu=function(){return arguments.length===1?e=>Wu(arguments[0],e):Wu(arguments[0],arguments[1])},Wu=(e,t)=>Gu(Yo(t,t=>mr(e,t))),Gu=e=>Au((t,n)=>bu(e,n)),Ku=e=>Gu(Oo(e,pr())),qu=(e,t,n)=>{let r=wu(n,`parallel`);return Pc(e,e=>e.build(t,wu(r,`sequential`)),{concurrency:e.length}).pipe(Yo(e=>Tr(...e)))},Ju=(...e)=>ku((t,n)=>qu(e,t,n)),Yu=a(2,(e,t)=>Ju(e,...Array.isArray(t)?t:[t])),Xu=(e,t,n)=>ku((r,i)=>Go(Array.isArray(t)?qu(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(_s(t),Yo(e=>n(e,t))))),Zu=a(2,(e,t)=>Xu(e,t,o)),Qu=a(2,(e,t)=>Xu(e,t,(e,t)=>wr(t,e))),$u=e=>Ou((t,n)=>e.build(Mu(),n)),ed=nl,td=Kte,nd=`~effect/DateTime`,rd=`~effect/DateTime/TimeZone`,id={[nd]:nd,pipe(){return n(this,arguments)},[Ze](){return this.toString()},toJSON(){return Ad(this).toJSON()}},ad={...id,_tag:`Utc`,[ee](){return oe(this.epochMilliseconds)},[ve](e){return ud(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Ad(this).toJSON()})`}},od={...id,_tag:`Zoned`,[ee](){return re(oe(this.epochMilliseconds))(z(this.zone))},[ve](e){return ud(e)&&e._tag===`Zoned`&&this.epochMilliseconds===e.epochMilliseconds&&ye(this.zone,e.zone)},toString(){return`DateTime.Zoned(${Gd(this)})`}},sd={[rd]:rd,[Ze](){return this.toString()}},cd={...sd,_tag:`Named`,[ee](){return se(`Named:${this.id}`)},[ve](e){return fd(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}};({...sd});var ld=(e,t,n)=>{let r=Object.create(od);return r.epochMilliseconds=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},ud=e=>F(e,nd),dd=e=>ud(e[0]),fd=e=>F(e,rd),pd=e=>e._tag===`Utc`,md=kn((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:+(e.epochMilliseconds>t.epochMilliseconds)),hd=e=>{let t=Object.create(ad);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},gd=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Xl(`Invalid date`);return hd(t)},_d=e=>{if(ud(e))return e;if(e instanceof Date)return gd(e);if(typeof e==`object`){if(`epochMilliseconds`in e)return gd(new Date(e.epochMilliseconds));let t=new Date(0);return Id(t,e),gd(t)}return typeof e==`string`&&!vd(e)?gd(new Date(e+`Z`)):gd(new Date(e))},vd=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),yd=Wn(_d),bd=Yo(td,hd),xd=()=>hd(Date.now()),Sd=e=>hd(e.epochMilliseconds),Cd=a(dd,(e,t,n)=>n?.adjustForTimeZone===!0?Rd(e.epochMilliseconds,t,n?.disambiguation??`compatible`):ld(e.epochMilliseconds,t,e.partsUtc)),wd=new Map,Td={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},Ed=e=>{let t=e.resolvedOptions().timeZone,n=wd.get(t);if(n!==void 0)return n;let r=Object.create(cd);return r.id=t,r.format=e,wd.set(t,r),r},Dd=()=>Ed(new Intl.DateTimeFormat(`en-US`,Td)),Od=a(2,(e,t)=>ki(Fd(t)-Fd(e))),kd=Mn(md),Ad=e=>new Date(e.epochMilliseconds),jd=e=>{if(e._tag===`Utc`)return new Date(e.epochMilliseconds);if(e.zone._tag===`Offset`)return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type===`fractionalSecond`?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=n.getTime(),n},Md=e=>jd(e).getTime()-Fd(e),Nd=e=>{let t=Math.abs(e),n=Math.floor(t/36e5),r=Math.round(t%36e5/6e4);return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},Pd=e=>Nd(Md(e)),Fd=e=>e.epochMilliseconds,Id=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month===void 0?e.getUTCMonth():t.month-1,t.day??e.getUTCDate()),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)},Ld=864e5,Rd=(e,t,n)=>{if(t._tag===`Offset`)return ld(e-t.offset,t);let r=Vd(e-Ld,e,t),i=Vd(e+Ld,e,t);if(r===i)return ld(e-r,t);let a=r<i,o=r-i;if(a){if(Vd(e-i,e,t)===i)return ld(e-i,t);let a=ld(e-r,t);if(e!==jd(a).getTime())switch(n){case`reject`:{let n=new Date(e).toISOString();throw RangeError(`Gap time: ${n} does not exist in time zone ${t.id}`)}case`earlier`:return ld(e-i,t);case`compatible`:case`later`:return a}return a}if(Vd(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||Vd(e-r+o,e+o,t)===r)return ld(e-r,t);if(n===`reject`){let n=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${n} occurs twice in time zone ${t.id}`)}}return ld(e-i,t)},zd=/([+-])(\d{2}):(\d{2})$/,Bd=e=>{let t=zd.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},Vd=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=Bd(r);return i===null?Md(ld(t,n)):i},Hd=e=>Ad(e).toISOString(),Ud=e=>jd(e).toISOString().slice(0,10),Wd=e=>{let t=jd(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${Pd(e)}`},Gd=e=>e.zone._tag===`Offset`?Wd(e):`${Wd(e)}[${e.zone.id}]`;globalThis.String;var Kd=e=>e.trim(),qd=(e,t,n)=>{let r=n*(t-e)+e;if(r!==t||e>=t||!Number.isFinite(t))return r;if(t===0)return-Number.MIN_VALUE;let i=new DataView(new ArrayBuffer(8));i.setFloat64(0,t);let a=i.getBigUint64(0);return i.setBigUint64(0,t>0?a-BigInt(1):a+BigInt(1)),i.getFloat64(0)},Jd=a(2,(e,t)=>Es(e,Qd,e=>t(e))),Yd=e=>e.reasons.some(Xd),Xd=e=>e._tag===`Fail`&&Jl(e.error),Zd=e=>{let t,n=!1;for(let r of e.reasons)Xd(r)?t??=r.error:r._tag!==`Interrupt`&&(n=!0);return t===void 0?Ar(e):n?Ar(Nl(e.reasons.filter(e=>!Xd(e)))):kr(t)},Qd=e=>{let t=Zd(e);return Mr(t)?t:kr(t.success.value)},$d=e=>{let t=Zd(e);return Mr(t)?nu(t.failure):tu(t.success.value)},ef=a(2,(e,t)=>Vs(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=Zd(e);return Mr(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),tf=`~effect/Schedule`,nf=Er(`effect/Schedule/CurrentMetadata`,{defaultValue:s({input:void 0,output:void 0,duration:Ti,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),rf={[tf]:{_Out:o,_In:o,_Env:o},pipe(){return n(this,arguments)}},af=e=>{let t=Object.create(rf);return t.step=e,t},of=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},sf=e=>af(Yo(e,e=>{let t=of();return(n,r)=>e(t(n,r))})),cf=e=>Ss(e.step,e=>ao(()=>oo(e))),lf=e=>ol(t=>Yo(cf(e),e=>{let n=of();return r=>lo(()=>{let i=t.currentTimeMillisUnsafe();return Go(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,Oo(sl(t),a)})})})),uf=e=>af(Yo(Mc(e.map(cf)),e=>(t,n)=>Go(Pc(e,e=>ef(e(t,n),{onSuccess:e=>ao(e[1]),onDone:()=>kl,onFailure:oo})),e=>{let t=df(e);return t===void 0?Yl(Ti):ao([t,t])}))),df=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t=t===void 0?r:Mee(t,r))}return t},ff=(e,t=2)=>{let n=Fi(mi(e));return sf(ao(e=>{let r=ki(n*t**(e.attempt-1));return ao([r,r])}))},pf=e=>{let t=mi(e);return sf(ao(e=>ao([e.attempt-1,t])))},mf=a(2,(e,t)=>af(Yo(cf(e),e=>{let n=of();return(r,i)=>Vo(e(r,i),([e,a])=>t({...n(r,i),output:e,duration:a}))}))),hf=a(2,(e,t)=>{let n=t.duration===void 0?void 0:mi(t.duration);return gf(e,({attempt:e,elapsed:r})=>ao((t.times===void 0||e<=t.times)&&(n===void 0||Nee(ki(r),n))))}),gf=a(2,(e,t)=>af(Yo(cf(e),e=>{let n=of();return(r,i)=>Go(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return Go(xt(s)?s:ao(s),t=>t?ao(e):Yl(a))})}))),_f=pf(Ti),vf=()=>e=>e,yf=(e,t,n)=>Sc(r=>Go(n?.local?Fu(t,Mu(),r):Lu(t,r),t=>_s(e,t))),bf=a(e=>xt(e[0]),(e,t,n)=>dr(t)?_s(e,t):yf(e,Array.isArray(t)?Ju(...t):t,n)),xf=a(3,(e,t,n)=>Go(lf(t),t=>{let r=nf.defaultValue(),i,a=Ds(lo(()=>vs(e,nf,r)),e=>(i=e,Go(t(e),e=>(r=e,a))));return Jd(a,e=>ot(()=>n(i,e)))})),Sf=xt,Cf=Mc,wf=Pc,Tf=Nc,Ef=ite,Df=ate,B=ao,Of=fo,kf=lo,V=co,Af=ho,jf=kl,Mf=_o,Nf=vo,H=yo,U=so,Pf=oo,Ff=nte,If=po,Lf=rte,Rf=uo,zf=Xt,cne=tte,Bf=Go,Vf=Jo,Hf=Bo,Uf=Vo,Wf=Bs,lne=zs,Gf=Ys,Kf=Yo,qf=Oo,Jf=zo,Yf=Ho,Xf=Ds,Zf=Ms,Qf=Ss,une=Ts,$f=Ns,ep=Fs,tp=As,dne=Os,fne=xf,np=Ls,pne=Rs,mne=Is,rp=ec,ip=tc,ap=Qs,hne=Zs,op=sl,sp=Wo,gne=bs,cp=qs,lp=Vs,_ne=Ks,up=ms,dp=gs,fp=bf,pp=_s,vne=ds,mp=fs,hp=vs,gp=bc,_p=cte,yne=Sc,vp=lte,yp=gte,bp=ute,xp=dte,Sp=pte,Cp=Ec,wp=yte,Tp=bte,Ep=Ac,Dp=hte,Op=Dc,kp=jc,Ap=xs,bne=Ute,xne=Bte,jp=el,Mp=Hte,Np=Ete,Pp=Bc,Fp=Ote,Sne=Dte,Ip=Ate,Lp=Vc,Rp=Hc,Cne=jte,zp=Nte,wne=Wc,Bp=Mte,Tne=Uc,Vp=Fte,Hp=Kc,Up=Pte,Ene=Gc,Wp=bo,Gp=Co,Kp=ol,qp=Cl(`Error`),Dne=a(e=>Sf(e[0]),(e,...t)=>ps(e,rne,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||st(n,t[0],t[1]),n})),Jp=Xo,Yp=Zo,Xp=Qo,Zp=qo,One=$o,kne=To,Qp=`~effect/BigDecimal`,Ane={[Qp]:Qp,[ee](){let e=tm(this);return re(se(String(e.value)),oe(e.scale))},[ve](e){return jne(e)&&Rne(this,e)===0},toString(){return`BigDecimal(${zne(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Ze](){return this.toJSON()},pipe(){return n(this,arguments)}},jne=e=>F(e,Qp),Mne=(e,t)=>{if(!Number.isSafeInteger(t))throw RangeError(`Scale must be a safe integer, got ${t}`);let n=Object.create(Ane);return n.value=e,n.scale=t,n},$p=(e,t)=>{let n=Mne(e,t);return n.normalized=n,n},em=BigInt(0),Nne=BigInt(1),Pne=BigInt(10),Fne=$p(em,0),tm=e=>{if(e.normalized===void 0){if(e.value===em)e.normalized=Fne;else{let t=`${e.value}`,n=t.length;for(;t[n-1]===`0`;)n--;e.normalized=$p(BigInt(t.slice(0,n)),e.scale-(t.length-n))}}return e.normalized},Ine=100,Lne=[Nne],nm=(e,t)=>e===t?0:e<t?-1:1,rm=(e,t)=>{let n=`${e.value<em?-e.value:e.value}`,r=`${t.value<em?-t.value:t.value}`,i=BigInt(n.length-r.length)-BigInt(e.scale)+BigInt(t.scale);if(i!==em)return i<em?-1:1;let a=Math.max(n.length,r.length);return dee(n.padEnd(a,`0`),r.padEnd(a,`0`))},Rne=(e,t)=>{if(e.scale===t.scale)return nm(e.value,t.value);let n=im(e),r=im(t);if(n!==r)return n<r?-1:1;if(n===0)return 0;let i=e.scale-t.scale,a=Math.abs(i);if(a>Ine)return n===-1?rm(t,e):rm(e,t);let o=Lne[a]??=Pne**BigInt(a);return i>0?nm(e.value,t.value*o):nm(e.value*o,t.value)},im=e=>e.value===em?0:e.value<em?-1:1,zne=e=>{let t=tm(e);if(Math.abs(t.scale)>=16)return Bne(t);let n=t.value<em,r=`${n?-t.value:t.value}`,i=t.scale>0?r.padStart(t.scale+1,`0`):r.padEnd(r.length-t.scale,`0`),a=i.length-t.scale,o=t.scale>0?`${i.slice(0,a)}.${i.slice(a)}`:i;return n?`-${o}`:o},Bne=e=>{if(Vne(e))return`0e+0`;let t=tm(e),n=`${t.value}`,r=t.value<em?2:1,i=n.slice(0,r),a=n.slice(r),o=a.length-t.scale;return`${i}${a===``?``:`.${a}`}e${o>=0?`+`:``}${o}`},Vne=e=>e.value===em,Hne=BigInt(1),am=BigInt(1e3),om=BigInt(1024),sm=[{symbol:`B`,factor:Hne,names:[`B`,`byte`,`bytes`]},{symbol:`kB`,factor:am,names:[`kB`,`kilobyte`,`kilobytes`]},{symbol:`MB`,factor:am**BigInt(2),names:[`MB`,`megabyte`,`megabytes`]},{symbol:`GB`,factor:am**BigInt(3),names:[`GB`,`gigabyte`,`gigabytes`]},{symbol:`TB`,factor:am**BigInt(4),names:[`TB`,`terabyte`,`terabytes`]},{symbol:`PB`,factor:am**BigInt(5),names:[`PB`,`petabyte`,`petabytes`]},{symbol:`EB`,factor:am**BigInt(6),names:[`EB`,`exabyte`,`exabytes`]},{symbol:`ZB`,factor:am**BigInt(7),names:[`ZB`,`zettabyte`,`zettabytes`]},{symbol:`YB`,factor:am**BigInt(8),names:[`YB`,`yottabyte`,`yottabytes`]},{symbol:`RB`,factor:am**BigInt(9),names:[`RB`,`ronnabyte`,`ronnabytes`]},{symbol:`QB`,factor:am**BigInt(10),names:[`QB`,`quettabyte`,`quettabytes`]}],Une=[sm[0],{symbol:`KiB`,factor:om,names:[`KiB`,`kibibyte`,`kibibytes`]},{symbol:`MiB`,factor:om**BigInt(2),names:[`MiB`,`mebibyte`,`mebibytes`]},{symbol:`GiB`,factor:om**BigInt(3),names:[`GiB`,`gibibyte`,`gibibytes`]},{symbol:`TiB`,factor:om**BigInt(4),names:[`TiB`,`tebibyte`,`tebibytes`]},{symbol:`PiB`,factor:om**BigInt(5),names:[`PiB`,`pebibyte`,`pebibytes`]},{symbol:`EiB`,factor:om**BigInt(6),names:[`EiB`,`exbibyte`,`exbibytes`]},{symbol:`ZiB`,factor:om**BigInt(7),names:[`ZiB`,`zebibyte`,`zebibytes`]},{symbol:`YiB`,factor:om**BigInt(8),names:[`YiB`,`yobibyte`,`yobibytes`]}];[...sm,...Une.slice(1)];var Wne=ud,Gne=pd,cm=_d,Kne=yd,qne=bd,Jne=xd,Yne=Sd,lm=Cd,Xne=Dd,Zne=Od,Qne=kd,um=Md,dm=Hd,$ne=Ud,fm=e=>ere(typeof e==`string`?tre.encode(e):e),pm=e=>{let t=mm(e),n=t.length;if(n%4!=0)return Ar(new oa({kind:`Decode`,module:`Base64`,input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf(`=`);if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!==`=`))return Ar(new oa({kind:`Decode`,module:`Base64`,input:t,message:`Found a '=' character, but it is not at the end`}));try{let e=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=new Uint8Array(n/4*3-e);for(let e=0,i=0;e<n;e+=4,i+=3){let n=_m(t.charCodeAt(e))<<18|_m(t.charCodeAt(e+1))<<12|_m(t.charCodeAt(e+2))<<6|_m(t.charCodeAt(e+3));r[i]=n>>16,r[i+1]=n>>8&255,r[i+2]=n&255}return kr(r)}catch(e){return Ar(new oa({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},ere=e=>{let t=e.length,n=``,r=2;for(;r<t;r+=3)n+=hm[e[r-2]>>2],n+=hm[(e[r-2]&3)<<4|e[r-1]>>4],n+=hm[(e[r-1]&15)<<2|e[r]>>6],n+=hm[e[r]&63];return r===t+1&&(n+=hm[e[r-2]>>2],n+=hm[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=hm[e[r-2]>>2],n+=hm[(e[r-2]&3)<<4|e[r-1]>>4],n+=hm[(e[r-1]&15)<<2],n+=`=`),n},tre=new TextEncoder,mm=e=>e.replace(/[\n\r]/g,``),hm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,gm=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)gm[hm.charCodeAt(e)]=e;gm[61]=0;var _m=e=>{if(e>=gm.length||gm[e]===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return gm[e]},vm=`~effect/HashMap`,ym=5,bm=32,xm=bm/4,Sm=bm/2,Cm=31,wm=e=>(e-=e>>>1&1431655765,e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),Tm=(e,t)=>e>>>t&Cm,Em=(e,t)=>1<<Tm(e,t),Dm=(e,t)=>wm(e&t-1);function Om(e,t,n,r,i,a){if(t>32)throw Error(`HashMap: max depth exceeded`);let o=Em(n,t),s=Em(i,t);return o===s?new Im(e,o,[Om(e,t+ym,n,r,i,a)]):new Im(e,o|s,o>>>0<s>>>0?[r,a]:[a,r])}var km=se(`HashMap`),Am=(e,t)=>re(z(e),z(t)),jm=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e[n];r&&(t^=r.subtreeHash())}return t},Mm=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}},Nm=class extends Mm{_tag=`EmptyNode`;edit=0;get size(){return 0}get(e,t,n){return In()}has(e,t,n){return!1}set(e,t,n,r,i,a){return a.value=!0,new Pm(e,n,r,i)}remove(e,t,n,r,i){return this}canEdit(e){return!1}computeHash(){return 0}},Pm=class e extends Mm{_tag=`LeafNode`;edit;hash;key;value;constructor(e,t,n,r){super(),this.edit=e,this.hash=t,this.key=n,this.value=r}get size(){return 1}get(e,t,n){return this.hash===t&&ye(this.key,n)?Ln(this.value):In()}has(e,t,n){return this.hash===t&&ye(this.key,n)}set(t,n,r,i,a,o){if(this.canEdit(t)&&(this._hash=void 0),this.hash===r&&ye(this.key,i))return ye(this.value,a)?this:this.canEdit(t)?(this.value=a,this):new e(t,r,i,a);if(o.value=!0,this.hash===r)return new Fm(t,r,[[this.key,this.value],[i,a]]);let s=Em(r,n),c=Em(this.hash,n);return s===c?new Im(t,s,[this.set(t,n+ym,r,i,a,o)]):new Im(t,s|c,s>>>0<c>>>0?[new e(t,r,i,a),this]:[this,new e(t,r,i,a)])}remove(e,t,n,r,i){if(this.hash===n&&ye(this.key,r)){i.value=!0;return}return this}computeHash(){return Am(this.key,this.value)}},Fm=class e extends Mm{_tag=`CollisionNode`;edit;hash;entries;constructor(e,t,n){super(),this.edit=e,this.hash=t,this.entries=n}get size(){return this.entries.length}get(e,t,n){if(this.hash!==t)return In();for(let[e,t]of this.entries)if(ye(e,n))return Ln(t);return In()}has(e,t,n){if(this.hash!==t)return!1;for(let[e]of this.entries)if(ye(e,n))return!0;return!1}set(t,n,r,i,a,o){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==r)return o.value=!0,Om(t,n,this.hash,this,r,new Pm(t,r,i,a));for(let n=0;n<this.entries.length;n++)if(ye(this.entries[n][0],i)){if(ye(this.entries[n][1],a))return this;if(this.canEdit(t))return this.entries[n]=[i,a],this;let r=[...this.entries];return r[n]=[i,a],new e(t,this.hash,r)}return o.value=!0,this.canEdit(t)?(this.entries.push([i,a]),this):new e(t,this.hash,[...this.entries,[i,a]])}remove(t,n,r,i,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==r)return this;let o=this.entries.findIndex(([e])=>ye(e,i));if(o===-1)return this;if(a.value=!0,this.entries.length===1)return;if(this.entries.length===2){let e=this.entries[+(o===0)];return new Pm(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^=Am(t[n][0],t[n][1]);return e}},Im=class e extends Mm{_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=Em(t,e);if((this.bitmap&r)===0)return In();let i=Dm(this.bitmap,r);return this.children[i].get(e+ym,t,n)}has(e,t,n){let r=Em(t,e);if((this.bitmap&r)===0)return!1;let i=Dm(this.bitmap,r);return this.children[i].has(e+ym,t,n)}set(t,n,r,i,a,o){this.canEdit(t)&&(this._hash=void 0);let s=Em(r,n),c=Dm(this.bitmap,s);if((this.bitmap&s)!==0){let s=this.children[c],l=s.set(t,n+ym,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 Pm(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>Sm?this.expand(t,l,this.children):this;let u=[...this.children];return u.splice(c,0,n),u.length>Sm?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=Em(r,n);if((this.bitmap&o)===0)return this;let s=Dm(this.bitmap,o),c=this.children[s],l=c.remove(t,n+ym,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(bm),i=0;for(let e=0;e<bm;e++)t&1<<e&&(r[e]=n[i++]);return new Lm(e,n.length,r)}computeHash(){return jm(this.children)}},Lm=class e extends Mm{_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=Tm(t,e),i=this.children[r];return i?i.get(e+ym,t,n):In()}has(e,t,n){let r=Tm(t,e),i=this.children[r];return i?i.has(e+ym,t,n):!1}set(t,n,r,i,a,o){this.canEdit(t)&&(this._hash=void 0);let s=Tm(r,n),c=this.children[s];if(c){let l=c.set(t,n+ym,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 Pm(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=Tm(r,n),s=this.children[o];if(!s)return this;let c=s.remove(t,n+ym,r,i,a);if(!a.value)return this;let l=this.count-+!c;if(l<xm)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 Im(e,i,r)}computeHash(){return jm(this.children)}},Rm=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}},zm=(e,t)=>[e,t],Bm=(e,t)=>t,Vm=class{[vm]=vm;_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 Rm(this._root,zm)}[ve](e){if(Um(e)){let t=e;if(this.size!==t.size)return!1;for(let[t,n]of this){let r=f(e,Gm(t));if(Rn(r)||!ye(n,r.value))return!1}return!0}return!1}[ee](){return ie(km^this._root.subtreeHash())}[Ze](){return Qe(this)}toString(){return`HashMap(${Ue(Array.from(this))})`}toJSON(){return{_id:`HashMap`,values:Array.from(this).map(([e,t])=>[Qe(e),Qe(t)])}}pipe(){return n(this,arguments)}},Hm=new Nm,Um=e=>F(e,vm),Wm=()=>new Vm(!1,0,Hm,0),Gm=a(2,(e,t)=>e._root.get(0,z(t),t)),Km=(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 Vm(!1,i._edit,s,i._size+ +!!a.value)},qm=a(3,(e,t,n)=>Km(e,t,z(t),n)),Jm=e=>new Rm(e._root,Bm),Ym=(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??Hm,r._size--,e):o===void 0?Wm():new Vm(!1,r._edit,o,r._size-1):e},Xm=a(2,(e,t)=>Ym(e,t,z(t))),Zm=Wm,Qm=qm,$m=Jm,eh=Xm,th=`~effect/http/Cookies`,nh=`~effect/http/Cookies/Cookie`,rh={[th]:th,...et,toJSON(){return{_id:`effect/Cookies`,cookies:Hr(this.cookies,e=>e.toJSON())}},pipe(){return n(this,arguments)}},ih=e=>{let t=Object.create(rh);return t.cookies=e,t},ah=e=>{let t={};for(let n of e)st(t,n.name,n);return ih(t)},oh=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=sh(e.trim());t&&n.push(t)}return ah(n)};function sh(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(!ch.test(r))return;let i=t[0].slice(n+1),a=uh(i);if(t.length===1)return Object.assign(Object.create(lh),{name:r,value:a,valueEncoded:i});let o={};for(let e=1;e<t.length;e++){let n=t[e],r=n.indexOf(`=`),i=r===-1?n:n.slice(0,r).trim(),a=r===-1?void 0:n.slice(r+1).trim();switch(i.toLowerCase()){case`domain`:{if(a===void 0)break;let e=a.trim().replace(/^\./,``);e&&(o.domain=e);break}case`expires`:{if(a===void 0)break;let e=new Date(a);isNaN(e.getTime())||(o.expires=e);break}case`max-age`:{if(a===void 0)break;let e=parseInt(a,10);isNaN(e)||(o.maxAge=Ai(e));break}case`path`:if(a===void 0)break;a[0]===`/`&&(o.path=a);break;case`priority`:if(a===void 0)break;switch(a.toLowerCase()){case`low`:o.priority=`low`;break;case`medium`:o.priority=`medium`;break;case`high`:o.priority=`high`}break;case`httponly`:o.httpOnly=!0;break;case`secure`:o.secure=!0;break;case`partitioned`:o.partitioned=!0;break;case`samesite`:if(a===void 0)break;switch(a.toLowerCase()){case`lax`:o.sameSite=`lax`;break;case`strict`:o.sameSite=`strict`;break;case`none`:o.sameSite=`none`}}}return Object.assign(Object.create(lh),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var ch=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,lh={[nh]:nh,...et,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},uh=e=>{try{return decodeURIComponent(e)}catch{return e}},dh=new WeakMap,fh=e=>{if(dh.has(e))return dh.get(e);throw Error(`Unable to get redacted value`+(e.label?` with label: "${e.label}"`:``))},ph=`~effect/Redacted`,mh=e=>F(e,ph),hh=(e,t)=>{let n=Object.create(gh);return t?.label&&(n.label=t.label),dh.set(n,e),n},gh={[ph]:{_A:e=>e},label:void 0,...yt,toJSON(){return this.toString()},toString(){return`<redacted${x(this.label)?`:`+this.label:``}>`},[ee](){return z(dh.get(this))},[ve](e){return mh(e)&&ye(dh.get(this),dh.get(e))}},_h=fh,vh=e=>sn((t,n)=>e(_h(t),_h(n))),yh=Symbol.for(`~effect/http/Headers`),bh=Object.defineProperties(Object.create(null),{[yh]:{value:yh},[Ie]:{value(e){return Ah(this,yr(e,Mh))}},toJSON:{value(){return Re(this)}},[ve]:{value(e){return Sh(this,e)}},[ee]:{value(){return le(this)}},toString:{value:et.toString},[Ze]:{value:et[Ze]}}),xh=e=>Object.assign(Object.create(bh),e),Sh=Gr(cn()),Ch=Object.create(bh),wh=e=>{if(e===void 0)return Ch;if(Symbol.iterator in e){let t=Object.create(bh);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(bh);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},Th=e=>Object.setPrototypeOf(e,bh),Eh=a(3,(e,t,n)=>{let r=xh(e);return r[t.toLowerCase()]=n,r}),Dh=a(2,(e,t)=>xh({...e,...wh(t)})),Oh=a(2,(e,t)=>{let n=xh(e);return Object.assign(n,t),n}),kh=a(2,(e,t)=>{let n=xh(e);return delete n[t.toLowerCase()],n}),Ah=a(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=hh(e[r]))}else for(let r in e)r.search(t)!==-1&&(n[r]=hh(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),jh=(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},Mh=Er(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),Nh=`~effect/http/UrlParams`,Ph=e=>F(e,Nh),Fh={...yt,[Nh]:Nh,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[ve](e){return zh(this,e)},[ee](){return de(this.params.flat())}},Ih=e=>{let t=Object.create(Fh);return t.params=e,t},Lh=e=>{if(Ph(e))return e;let t=Rh(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 Ih(n)},Rh=e=>{let t=typeof e[Symbol.iterator]==`function`?qr(e):Object.entries(e),n=[];for(let[e,r]of t)if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]!==void 0&&n.push([e,String(r[t])]);else if(typeof r==`object`&&r){let t=Rh(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},zh=sn((e,t)=>Bh(e.params,t.params)),Bh=Cee(Ir([cn(),cn()])),Vh=Ih([]),Hh=a(2,(e,t)=>Ih(t(e.params))),Uh=a(2,(e,t)=>{let n=Lh(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 Ih(n)}),Wh=a(2,(e,t)=>Hh(e,Xr(Lh(t).params))),Gh=e=>new URLSearchParams(Lh(e).params).toString(),Kh=e=>{let t={};for(let[n,r]of e.params)if(!Object.hasOwn(t,n))st(t,n,r);else{let e=t[n];typeof e==`string`?st(t,n,[e,r]):e.push(r)}return t};function qh(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Jh(e){return t=>qh(t)?.[e]}var Yh=`~structural`,Xh=`~sentinels`,Zh=`~constructor`,Qh=m(e=>{let t=qh(e)?.identifier;return typeof t==`string`?t:e.getExpected(Qh)}),$h=Symbol(),eg=tu,tg=eg($h),ng=eg($h),rg=e=>e===$h?In():Ln(e),ig=e=>e._tag===`None`?tg:eg(e.value),ag=`~effect/SchemaIssue/Issue`;function og(e){return F(e,ag)&&e[ag]===ag}function sg(e){return Object.hasOwn(e,`input`)}var cg=class{[ag]=ag;constructor(e,t){t?.reportInput===!0&&e!==$h&&(this.input=e)}},lg=class extends cg{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},ug=class extends cg{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},dg=class extends cg{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},fg=class extends cg{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},pg=class extends cg{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},mg=class extends cg{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},hg=class extends cg{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},gg=class extends cg{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}};function _g(e,t,n,r,i){return new mg(e,[new dg([t],n)],r,i)}var vg=class extends cg{_tag=`Forbidden`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},yg=class extends cg{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},bg=class extends cg{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function xg(e,t,n){if(og(e))return e;if(typeof e==`string`)return new gg({message:e},t,n);let r=typeof e.issue==`string`?new gg({message:e.issue},t,n):e.issue;return new dg(e.path,r)}function Sg(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new gg(void 0,t,n):xg(e,t,n)}function Cg(e,t,n,r){return Array.isArray(t)?Qr(t)?t.length===1?xg(t[0],n,r):new mg(e,ri(t,e=>xg(e,n,r)),n,r):void 0:Sg(t,n,r)}var wg=e=>{let t=Fg(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return kg(Qh(e.ast),e);case`InvalidValue`:{let t=Og(e);if(t!==void 0)return kg(t,e);let n=Dg(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Dg(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Dg(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},Tg=e=>Fg(e.issue)??Fg(e);function Eg(e){return t=>({issues:Ag(t,[],e?.leafHook??wg,e?.checkHook??Tg)})}function Dg(e){return sg(e)?Ue(e.input):void 0}function Og(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function kg(e,t){let n=Dg(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Ag(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 Ag(e.issue,t,n,r);let a=Og(e.issue);return[{path:t,message:a===void 0?kg(jg(e.filter),e):kg(a,e.issue)}]}case`Encoding`:return Ag(e.issue,t,n,r);case`Pointer`:return Ag(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Ag(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:Fg(e)??kg(Qh(e.ast),e)}]:e.issues.flatMap(e=>Ag(e,t,n,r));default:return[{path:t,message:n(e)}]}}function jg(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=>jg(e)).join(` & `)}}function Mg(){return e=>Pg(e,``)}var Ng=Mg();function Pg(e,t){let n;switch(e._tag){case`Filter`:{let r=Tg(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Pg(e.issue,t);let r=Og(e.issue);n=r===void 0?kg(jg(e.filter),e):kg(r,e.issue)}break}case`Encoding`:return Pg(e.issue,t);case`Pointer`:return Pg(e.issue,t+Ke(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Pg(e,t)).join(`
14
- `);n=Fg(e)??kg(Qh(e.ast),e);break;default:n=wg(e)}return t?`${n}\n at ${t}`:n}function Fg(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Fg(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 Ig(e){let t;for(let n of e.reasons){if(!Ml(n)||!og(n.error))return;t??=n.error}return t}function Lg(e,t){let n=Ig(e);if(n===void 0)throw Error(t,{cause:e});return n}var Rg=e=>Object.assign(Object.create(r),e);function zg(e){return qg((t,n)=>U(e(t,n)))}function Bg(e){return zg((t,n)=>{let r={message:e(t)};return zn(t)?new vg(r,t.value,n):new vg(r)})}var Vg=Bg(()=>`Encoding is not supported`),Hg=Rg({_tag:`Passthrough`});function Ug(){return Hg}function Wg(e){return Rg({_tag:`Transform`,transform:e})}function Gg(e){return Rg({_tag:`TransformEffect`,transform:e})}function Kg(e){return Rg({_tag:`TransformOptional`,transform:e})}function qg(e){return Rg({_tag:`TransformOptionalEffect`,transform:e})}function Jg(){return Kg(()=>In())}function Yg(e){return qg(t=>{let n=Qn(t,k);return zn(n)?B(n):Jp(e,Ln)})}function Xg(){return Wg(globalThis.String)}function Zg(){return Wg(globalThis.Number)}function Qg(){return Wg(globalThis.BigInt)}function $g(){return Wg(Kd)}function e_(e){return Gg((t,n)=>Lf({try:()=>JSON.parse(t,e?.reviver),catch:()=>new gg({expected:`a valid JSON string`},t,n)}))}function t_(e){return Gg((t,n)=>Lf({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw TypeError(`Value cannot be represented as JSON`);return n},catch:()=>new gg({expected:`a JSON-serializable value`},t,n)}))}function n_(){return Wg(fm)}function r_(){return Gg((e,t)=>Yp(cne(pm(e)),()=>new gg({expected:`a valid Base64 string`},e,t)))}var i_=class extends i{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new i_(this.encode,this.decode)}},a_=`~effect/SchemaTransformation/Transformation`,o_=class extends i{[a_]=a_;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new o_(this.encode,this.decode)}};function s_(e){return F(e,a_)&&e[a_]===a_}var c_=e=>s_(e)?e:new o_(e.decode,e.encode);function l_(e){return new o_(Gg(e.decode),Gg(e.encode))}function u_(e){return new o_(Wg(e.decode),Wg(e.encode))}function d_(){return new o_($g(),Ug())}var f_=new o_(Ug(),Ug());function p_(){return f_}var m_=new o_(Zg(),Xg()),h_=new o_(Qg(),Xg()),g_=e=>N(e)&&typeof e.message==`string`,__=e=>{let t=Object.hasOwn(e,`cause`)?Error(e.message,{cause:x_(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},v_=e=>{try{let t=Xe(e);return t===void 0?Ue(e):JSON.parse(t)}catch{return Ue(e)}},y_=(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},b_=e=>{let t=new WeakSet,n=r=>{if(L(r)){if(t.has(r))return`[Circular]`;t.add(r);let i=y_(r,e,n);return t.delete(r),i}return v_(r)};return n},x_=e=>g_(e)?__(e):e,S_=e=>u_({decode:x_,encode:b_(e)}),C_=l_({decode:(e,t)=>URL.canParse(e)?B(new URL(e)):U(new gg({expected:`a valid URL string`},e,t)),encode:e=>B(e.href)}),w_=new o_(r_(),n_());function T_(e){return new o_(e_(e??{}),t_(e))}function E_(e){return t=>t._tag===e}var D_=E_(`Declaration`),O_=E_(`Null`),k_=E_(`Void`),A_=E_(`Never`),j_=E_(`Literal`),M_=E_(`UniqueSymbol`),N_=E_(`Arrays`),P_=E_(`Objects`),F_=E_(`Union`),I_=E_(`Suspend`),L_=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},R_={},z_=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}},B_=`~effect/Schema`,V_=class{[B_]=B_;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}>`}},H_=class extends V_{_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===$h?tg:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=py(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new H_(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>`}},U_=new class extends V_{_tag=`Null`;getParser(){return Cy(this,null)}getExpected(){return`null`}},W_=class extends V_{_tag=`Undefined`;getParser(){return Cy(this,void 0)}toCodecJson(){return ey(this,[G_])}getExpected(){return`undefined`}},G_=new L_(U_,new o_(Wg(()=>void 0),Wg(()=>null))),K_=new W_,q_=new class extends V_{_tag=`Void`;getParser(){let e=eg(void 0);return t=>t===$h?tg:e}toCodecJson(){return ey(this,[G_])}getExpected(){return`void`}},J_=new class extends V_{_tag=`Never`;getParser(){return wy(this,j)}getExpected(){return`never`}},Y_=new class extends V_{_tag=`Unknown`;getParser(){return wy(this,M)}getExpected(){return`unknown`}},X_=class extends V_{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${Ue(e)}`);this.literal=e}getParser(){return Cy(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Z_(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Z_(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Z_(e){let t=globalThis.String(e.literal);return ey(e,[new L_(new X_(t),new o_(Wg(()=>e.literal),Wg(()=>t)))])}var Q_=new class extends V_{_tag=`String`;getParser(){return wy(this,x)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&Ay(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},$_=class extends V_{_tag=`Number`;getParser(){return wy(this,S)}matchKey(e,t){return this._match(fre,e,t)}matchPart(e,t){return this._match(Dy,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:Ay(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(ev(this.checks,`effect/schema/isFinite`)||ev(this.checks,`effect/schema/isInt`))?this:ey(this,[Yv])}toCodecStringTree(){return this.toCodecJson()===this?ey(this,[mre]):ey(this,[hre])}getExpected(){return`number`}};function ev(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&ev(e.checks,t))}var tv=new $_,nv=new class extends V_{_tag=`Boolean`;getParser(){return wy(this,C)}getExpected(){return`boolean`}},rv=new class extends V_{_tag=`BigInt`;getParser(){return wy(this,w)}matchPart(e,t){if(!ky.test(e))return;let n=globalThis.BigInt(e);return t.disableChecks||!this.checks?n:Ay(this.checks,n,void 0,this,t)?void 0:n}toCodecStringTree(){return ey(this,[_re])}getExpected(){return`bigint`}},iv=class extends V_{_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(_y(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(_y(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 pg(n,t[o],i),a=new dg([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return U(new mg(n,[a],t,i))}return e.issues?U(new mg(n,e.issues,t,i)):eg(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:Fc(t.concurrency),f=d===1?sv(i,e,0,u):cv(i,e,{concurrency:d,end:u});if(!f)return c(i);if(Ko(f))return Zp(f,()=>c(i));let p=!0;return kf(()=>p?(p=!1,Bf(f,()=>c(i))):l(e,t))};return(e,a)=>{if(e===$h)return tg;try{return Array.isArray(e)?(r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)}))),l(e,a)):U(new hg(n,e,a))}catch(e){return If(e)}}}_rebuild(e,t,n){let r=py(this.elements,e),i=py(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new iv(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 av(e,t,n,r){if(n._tag===`Failure`)return lv(e,e.ast,r,n);let i=n===ng?t:n[pt];if(i!==$h)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(_y(t.ast))return;let n=new dg([r],new fg(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return ru(new mg(e.ast,[n],e.input,e.options))}}var ov={onItem(e,t,n){let r=n<e.len?t:$h;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:av},sv=Ic()(ov),cv=Rc()(ov),lv=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Ig(r.cause);if(i===void 0)return nu(zl(r.cause,r=>new mg(t,[new dg([n],r)],e.input,e.options)));let a=new dg([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return ru(new mg(t,[a],e.input,e.options))},uv=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function dv(e,t,n=R_){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(Ty(by(t)))}var fv=class{name;type;constructor(e,t){this.name=e,this.type=t}};function pv(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(pv);default:return!1}}function mv(e){let t=ny(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(mv);default:return!1}}function hv(e){return pv(e)&&mv(e)}var gv=class{parameter;type;constructor(e,t){if(!hv(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,_y(t)&&!Sy(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},_v=class extends V_{_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 wy(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(Ty(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 lv(t,n,i,s)??ou;let c=s===ng?o:s[pt];if(a!==$h&&c!==$h){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return ou;st(t.out,a,c)}return ou},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!Ko(t))return Bf(Gf(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return lv(e,n,r,a)??ou;let o=a===ng?r:a[pt],s=e.input[r],l=i.parserValue(s,e.options);return Ko(l)?t(e,r,o,s,l):Bf(Gf(l),n=>t(e,r,o,s,n))},l=(e,n,r)=>{let i=e.input[n],a=r.parserValue(i,e.options);return Ko(a)?t(e,n,n,i,a):Bf(Gf(a),r=>t(e,n,n,i,r))},u=i?Rc()({onItem:(e,[t,n])=>n.is.parameter===Q_?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return kne(function*(t,d){if(t===$h)return $h;if(typeof t!=`object`||!t||Array.isArray(t))return yield*U(new hg(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:Fc(d.concurrency),v=i&&g?n.indexSignatures.map(e=>dv(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 pg(n,f[a],d),r=new dg([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*U(new mg(n,[r],t,d))}}}if(r){let e=_===1?bv(m,a):xv(m,a,{concurrency:_});e&&(yield*e)}if(i&&_===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===Q_?l:c,r=v?.[e]??(t.is.parameter===Q_?Object.keys(f):dv(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!Ko(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=ti();for(let t=0;t<i;t++){let n=o[t],r=v?.[t]??(n.is.parameter===Q_?Object.keys(f):dv(f,n.is.parameter,d));for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=u(m,e,{concurrency:_});t&&(yield*t)}return m.issues?yield*U(new mg(n,m.issues,t,d)):p})};if(i)return c();let l,u=(e,t,n)=>{let r=a[t];return Bf(Gf(n),n=>{let i=vv(e,r,n);if(i)return i;let o=()=>eg(e.out),s=bv(e,a.slice(t+1));return s?Zp(s,o):o()})};return(e,t)=>{if(e===$h)return tg;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&Fc(t.concurrency)!==1)return(l??=c())(e,t);if(typeof e!=`object`||!e||Array.isArray(e))return U(new hg(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=Nv(i,s),l=c?i[s]:$h,d=n.parser(l,t);if(!Ko(d))return u(o,e,d);if(d===ng){c&&st(a,s,l);continue}let f=vv(o,n,d);if(f)return f}}catch(e){return If(e)}return eg(a)}}_rebuild(e,t,n,r){let i=py(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new fv(t.name,n)}),a=py(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new gv(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new _v(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 vv(e,t,n){if(n._tag===`Failure`)return lv(e,e.ast,t.name,n);if(n===ng)return;let r=n[pt];if(r!==$h){st(e.out,t.name,r);return}if(delete e.out[t.name],!_y(t.type)){let n=new dg([t.name],new fg(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return ru(new mg(e.ast,[n],e.input,e.options))}}var yv={onItem(e,t){if(!Nv(e.input,t.name))return t.parser($h,e.options);let n=e.input[t.name];return st(e.out,t.name,n),t.parser(n,e.options)},step:vv},bv=Ic()(yv),xv=Rc()(yv);function Sv(e,t){return e?t?[...e,...t]:e:t}function Cv(e,t,n){return new _v(Reflect.ownKeys(e).map(t=>new fv(t,e[t].ast)),[],n,t)}function wv(e){return e.ast}function Tv(e,t=void 0){return new iv(!1,e.map(e=>e.ast),[],void 0,t)}function Ev(e,t,n){return new Fv(e.map(wv),t,void 0,n)}var Dv=h(e=>{for(;;){if(I_(e))return Y_;let t=e.encoding;if(!t)return e.recur?.(Dv,o)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==o))return Y_;e=t[t.length-1].to}});function Ov(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(Ov)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function kv(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[Xh];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!_y(t)){if(j_(t))return[{key:e.name,literal:t.literal}];if(M_(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!_y(e)){if(j_(e))return[{key:t,literal:e.literal}];if(M_(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>kv(Dv(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return kv(e.thunk())}}var Av=new WeakMap,jv=Object.freeze([]),Mv=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Nv=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Pv(e){let t=Av.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=Dv(c);if(A_(l))continue;if(j_(l)||M_(l)){a??=new Map;let e=j_(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=kv(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=Ov(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??jv);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??jv;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=Nv(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??jv;if(t)return o}return jv}}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=Mv(t);if(!P(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=Nv(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=Nv(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=Nv(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(Mv(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return Av.set(e,t),t}var Fv=class extends V_{_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===$h)return tg;let i=(o??=Pv(n.types))(e,r);if(i.length===0)return U(new yg(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:Ko(r)?Iv(n,r.cause,e,t):Lv(n,r,e,t)}return Rv(n,a,i,e,t)}}_rebuild(e,t,n){let r=py(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Fv(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=by(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(j_);if(t.length>0)return`${Hv(n.isMutable)}[ ${t.map(t=>e(t)+Uv(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>j_(e.type));if(t.length>0)return`{ ${t.map(t=>`${Hv(t.type.context?.isMutable)}${Ge(t.name)}${Uv(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function Iv(e,t,n,r){let i=Ig(t);return i?ru(new yg(e,[i],n,r)):nu(t)}function Lv(e,t,n,r){return Qf(t,t=>Iv(e,t,n,r))}function Rv(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=Bv(a,n);return o?zv(o,a):a.out?a.out:U(new yg(e,a.issues??[],r,i))}function zv(e,t){return Zp(e,e=>t.out===ng?B(t.input):t.out?t.out:U(new yg(t.ast,t.issues??[],t.input,t.options)))}var Bv=Ic()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Ig(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]),ru(new bg(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return ou}}}),Vv=new Fv([new X_(`Infinity`),new X_(`-Infinity`),new X_(`NaN`)]);function Hv(e){return e?``:`readonly `}function Uv(e){return e?`?`:``}var Wv=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 Wv(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Wv(this.run,this.annotations,!0)}and(e,t){return new Gv([this,e],t)}},Gv=class extends i{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Gv(this.checks,{...this.annotations,...e})}and(e,t){return new Gv([this,e],t)}};function Kv(e,t,n=!1){return new Wv((t,n,r)=>Cg(n,e(t,n,r),t,r),t,n)}function qv(e){return Kv(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 Jv=ay(tv,[qv()]),Yv=new L_(new Fv([Jv,Vv]),new o_(Zg(),Wg(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Xv(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Kv(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 Zv=new WeakMap;function Qv(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&Zv.set(n,$v(e)),n}function $v(e){let t=Zv.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 Zv.set(e,n),n}function ey(e,t){return e.encoding===t?e:Qv(e,{encoding:t})}function ty(e,t){if(e.context===t)return e;let n=$v(e);return n.context===t&&n.encoding===e.encoding?n:Qv(e,{context:t})}function ny(e){return e.encoding?ny(e.encoding[e.encoding.length-1].to):e}function ry(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return iy(e,Yr(e.checks.slice(0,-1),n.annotate(t)))}return Qv(e,{annotations:{...e.annotations,...t}})}function iy(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Qv(e,{checks:t})}function ay(e,t){return iy(e,Sv(e.checks,t))}function oy(e,t){let n=t(e.to);return n===e.to?e:new L_(n,e.transformation)}function sy(e,t){let n=e,r=n[n.length-1],i=oy(r,t);return i===r?e:Yr(e.slice(0,e.length-1),i)}function cy(e){return t=>t.encoding?ey(t,sy(t.encoding,e)):t}function ly(e,t){return cy(e=>ty(e,t))(e)}function uy(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:ey(r,sy(r.encoding,n))}return e(r)}return h(n)}function dy(e,t){return fy(e,t,yy(e))}function fy(e,t,n){let r=new L_(e,t);return ey(n,n.encoding?[...n.encoding,r]:[r])}function py(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 my(e,t){return ty(e,e.context?new z_(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new z_(!1,!1,void 0,t))}var hy=h(e=>nre(ty(e,e.context?e.context.isOptional===!1?new z_(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new z_(!0,!1)))),nre=cy(hy),rre=m(e=>hy(new Fv([e,K_]))),gy=h(e=>ire(ty(e,e.context?e.context.isMutable===!1?new z_(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new z_(!1,!0)))),ire=cy(gy);function are(e,t){return ty(e,e.context?new z_(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new z_(!1,!1,t))}function ore(e,t,n){return fy(e,n,t)}function sre(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 cre(e,t){let{literals:n,parameters:r}=sre(e);return new _v(n.map(e=>new fv(e,t)),r.map(e=>new gv(e,t)))}function _y(e){return e.context?.isOptional??!1}function vy(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(vy)}function lre(e){function t(e){return vy(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return Zr(n)?n:void 0}function ure(e){let t=!0;function n(e){return t=t&&!e.encoding&&!I_(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var yy=h(e=>{let t=$v(e);if(t!==e){let n=yy(t);return n===t&&e.encoding===void 0?e:ty(n,e.context)}let n=`recur`in e?e.recur(yy):e;if(`encodingChecks`in n&&n.encodingChecks){let t=ure(e)?n.encodingChecks:N_(n)||P_(n)||D_(n)&&n.typeParameters.length>0?lre(n.encodingChecks):void 0;return Qv(n,{encodingChecks:void 0,checks:Sv(n.checks,t)})}return n}),by=h(e=>yy(xy(e)));function dre(e,t){let n=t,r=n.length,i=n[r-1],a=[new L_(xy(ey(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new L_(xy(n[e-1].to),n[e].transformation.flip()));let o=xy(i.to);return o.encoding?ey(o,[...o.encoding,...a]):ey(o,a)}var xy=m(e=>{if(e.encoding)return dre(e,e.encoding);let t=$v(e);if(t!==e){let n=xy(t);return n===t?e:ty(n,e.context)}return`flip`in e?e.flip(xy):`recur`in e?e.recur(xy):e});function Sy(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(Sy);default:return!1}}function Cy(e,t){let n=t===0?ng:eg(t);return(r,i)=>r===$h?tg:r===t?n:U(new hg(e,r,i))}function wy(e,t){return(n,r)=>n===$h?tg:t(n)?ng:U(new hg(e,n,r))}var Ty=uy(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(Ty)}}),Ey=uy(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(Ey)}}),Dy=new globalThis.RegExp(`^${uv}$`),fre=new globalThis.RegExp(`^(?:${uv}|Infinity|-Infinity|NaN)$`);function pre(e){return Xv(Dy,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:Dy.source}),...e})}var Oy=ay(Q_,[pre()]),mre=new L_(Oy,m_),hre=new L_(new Fv([Oy,Vv]),m_),ky=new globalThis.RegExp(`^-?\\d+$`);function gre(e){return Xv(ky,{expected:`a string representing a bigint`,representation:{id:`effect/schema/isStringBigInt`,payload:null},toJsonSchema:()=>({pattern:ky.source}),...e})}var _re=new L_(ay(Q_,[gre({expected:`a string representing a bigint`})]),h_);function Ay(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=Ay(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 lg(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function vre(e){if(!D_(e))return;let t=e.annotations?.[Zh];return D(t)?t(e.typeParameters):void 0}var jy=Jh;function yre(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function bre(e){return e===void 0||typeof e==`string`}function My(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 xre(e){return My(e,yre)}var Ny=new H_([],()=>(e,t,n)=>xre(e)?ng:U(new hg(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>Fy}),Sre=ry(Ny,{representation:{id:`effect/schema/MutableJson`,payload:null}}),Py=new L_(Ny,p_()),Cre=new L_(new Fv([new iv(!1,[],[Ny]),new _v([],[new gv(Q_,Ny)])]),p_());function wre(e){return My(e,bre)}var Fy=new L_(new H_([],()=>(e,t,n)=>wre(e)?ng:U(new hg(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),p_()),Iy=(e,t,n)=>e===ng?n(t):Zp(e,n);function Ly(e){if(e._tag===`Middleware`)return(t,n,r)=>Ry(t===ng?e.decode(eg(rg(n)),r):e.decode(Jp(t,rg),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===ng?eg(t):e;case`Transform`:{let e=e=>e===$h?tg:eg(t.transform(e));return(t,n)=>Iy(t,n,e)}case`TransformOptional`:{let e=e=>ig(t.transform(rg(e)));return(t,n)=>Iy(t,n,e)}case`TransformEffect`:return(e,n,r)=>Iy(e,n,e=>e===$h?tg:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>Iy(e,n,e=>Ry(t.transform(rg(e),r)))}}var Ry=e=>Zp(e,ig),zy=(e,t,n,r)=>Qf(r,r=>Ff(()=>zl(r,r=>new ug(e,r,t,n))));function Tre(e,t){let n=Ly(e.link.transformation),r;return(i,a)=>{if(i===$h)return tg;if(e.isConstructed(i))return ng;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function Ere(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==$h&&r!==void 0)return t(r,i);let a=n;if(Ko(a)&&a._tag===`Success`){let e=t(a[pt],i);return e===ng?a:e}return Zp(zy(e,r,i,a),e=>{let n=t(e,i);return n===ng?eg(e):n})}}function Dre(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:Ere(e,n)}function By(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?vre(e):void 0,o=a?Tre(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>Ly(e.transformation)),u=e.encodingChecks;if(!c&&!s&&!u)return o;let d,f=(t,n)=>{let r=o(t,n);if(u&&!n.disableChecks){if(Ko(r)){if(r._tag===`Success`){let i=r===ng?t:r[pt];if(t!==$h&&i!==$h){let i=Ay(u,t,void 0,e,n);i&&(r=U(new mg(e,i,t,n)))}}}else r=Bf(r,r=>{if(t!==$h&&r!==$h){let r=Ay(u,t,void 0,e,n);if(r)return U(new mg(e,r,t,n))}return B(r)})}if(s&&!n.disableChecks){if(Ko(r)){if(r._tag===`Success`){let i=r===ng?t:r[pt];if(i===$h)return r;let a=Ay(s,i,void 0,e,n);a&&(r=U(new mg(e,a,i,n)))}}else r=Bf(r,t=>{if(t!==$h){let r=Ay(s,t,void 0,e,n);if(r)return U(new mg(e,r,t,n))}return B(t)})}return r},p=i===void 0?f:i(f);return c?(n,r)=>{let i=d??=c.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=c.length-1;e>=0;e--)if(o=l[e](o,a,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[pt],o=t(a,r)):o=Zp(o,e=>{let n=t(e,r);return n===ng?eg(e):n})}if(o._tag===`Success`){let e=o[pt],t=p(e,r);return t===ng?o:t}return o=zy(e,n,r,o),Zp(o,e=>{let t=p(e,r);return t===ng?eg(e):t})}:p}var Ore=Symbol(),Vy=new WeakMap,kre=e=>Uy(e).parser,Hy=e=>Uy(e).makeEffect,Are=e=>Dre(e,Hy),jre=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=By(this.ast,kre)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=By(this.ast,Hy,Are)}};function Uy(e){let t=Vy.get(e);if(t!==void 0)return t;let n=new jre(e);return Vy.set(e,n),n}function Wy(e){let t=e.ast,n;return(e,r)=>(n??=Zy(Gre,yy(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Gy(e){let t=Wy(e);return(e,n)=>{let r=Up(t(e,n));return su(r)?Ln(r.value):(Lg(r.cause,`Option adapter can only return none for schema issues`),In())}}function Ky(e){return Ure(yy(e.ast))}function Mre(e){return Pre(e.ast)}function Nre(e){{let t=Qy(Xy(e));return e=>{let n=t(e,R_);return su(n)?!0:(Lg(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}}function Pre(e){let t=yy(e),n=e=>(n=Nre(t),n(e));return e=>n(e)}function Fre(e){let t=Xy(e);return(e,n)=>{let r=Up(t(e,n));if(!su(r))return Lg(r.cause,`Issue adapter can only return schema issues`)}}function qy(e,t){let n=Xy(e.ast);return t===void 0?n:(e,r)=>n(e,Jy(t,r))}function Ire(e,t){return Bre(qy(e,t))}function Lre(e,t){return Vre(qy(e,t))}function Rre(e,t){let n=Xy(xy(e.ast));return t===void 0?n:(e,r)=>n(e,Jy(t,r))}var Jy=(e,t)=>t?{...e,...t}:e,Yy=e=>e===$h?U(new gg):B(e);function Xy(e){return Zy(Wre,e)}function zre(e,t){return e===ng?B(t):Ko(e)?e[pt]===$h?Yy($h):e:Zp(e,Yy)}function Zy(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??R_);return a===ng?B(r):Ko(a)?a[pt]===$h?Yy($h):a:Zp(a,Yy)}}function Qy(e){return(t,n)=>Up(e(t,n))}function Bre(e){let t=Qy(e);return(e,n)=>{let r=t(e,n);return su(r)?Ln(r.value):(Lg(r.cause,`Option adapter can only return none for schema issues`),In())}}function Vre(e){let t=Qy(e);return(e,n)=>{let r=t(e,n);return su(r)?kr(r.value):Ar(Lg(r.cause,`Result adapter can only return schema issues`))}}function Hre(e,t){let n=Up(e);if(su(n))return n.value;let r=Lg(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}function Ure(e){let t,n;return(r,i)=>{t??=Uy(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??R_,o=t.make;if(o!==void 0&&r!==$h){let e;try{e=o(r,a)}catch(e){throw Lg(Fl(e),`Constructor adapter can only throw schema issues`),e}if(e!==Ore&&e!==$h)return e}return Hre(zre((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var Wre=e=>Uy(e).parser,Gre=e=>Uy(e).makeEffect,$y=`~effect/Schema/Schema`,eb=Symbol(),Kre={[$y]:$y,get make(){let e=Ky(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Wy(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=Gy(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return n(this,arguments)},annotate(e){return this.rebuild(ry(this.ast,e))},annotateKey(e){return this.rebuild(my(this.ast,e))},check(...e){return this.rebuild(ay(this.ast,e))},rebuild(e){return tb(e,this[eb])}};function tb(e,t){function n(){}let r=Object.setPrototypeOf(n,Kre);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[eb]=t,r.ast=e,r}function qre(e){return tb(nb(e.ast),{schema:e})}var nb=uy(e=>{let t=Yre(e,nb),n=e.context;return t===e||n===void 0?t:ly(t,rb(n))});function rb(e){return e.constructorDefault===void 0?e:new z_(e.isOptional,e.isMutable,void 0,e.annotations)}function ib(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function ab(e){return t=>{let n=[...t].sort((t,n)=>e(by(t))-e(by(n)));return n.some((e,n)=>e!==t[n])?n:t}}var Jre=ab(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function Yre(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!D(n))return ey(e,[Py]);let r=n(e.typeParameters.map(e=>tb(by(e))));return r===void 0?e:ey(e,[oy(r,t)])}case`Unknown`:return ey(e,[Py]);case`ObjectKeyword`:return ey(e,[Cre]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return ib(e),e.recur(t,Ey);case`Union`:{let n=Jre(e.types);return n===e.types?e.recur(t):new Fv(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 Xre(e){return tb(ob(e.ast),{schema:e})}var Zre=ab(e=>{switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function Qre(e,t,n){switch(e._tag){case`Declaration`:{let r=e.typeParameters.map(e=>tb(t(by(e)))),i=e.annotations?.toCodecStringTree;if(D(i)){let n=i(r);return n===void 0?e:ey(e,[oy(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):ey(e,[oy(c,t)])}case`Null`:return ey(e,[$re]);case`Boolean`:return ey(e,[eie]);case`Unknown`:case`ObjectKeyword`:return ey(e,[Fy]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return ib(e),e.recur(t,Ey);case`Union`:{let n=Zre(e.types);return n===e.types?e.recur(t):new Fv(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 $re=new L_(new X_(`null`),new o_(Wg(()=>null),Wg(()=>`null`))),eie=new L_(new Fv([new X_(`true`),new X_(`false`)]),new o_(Wg(e=>e===`true`),Xg())),tie=new o_(Wg(e=>typeof e==`string`?[e]:e),Ug()),ob=uy(e=>{let t=Qre(e,ob,e=>{throw new globalThis.Error(`Missing structural codec for StringTree`,{cause:e})});return t!==e&&e.context!==void 0?ly(t,rb(e.context)):t},{stopAt:e=>e.transformation===tie});function sb(e){return su(e)?e.value:{issues:[{message:Kl(e.cause)}]}}function nie(e,t){let n=qy(e),r={errors:`all`,...t?.parseOptions},i=Eg(t),a=e=>{let t=new Zi(`sync`),a=Ip(cp(n(e,r),{onFailure:i,onSuccess:e=>({value:e})}),{scheduler:t});a.currentDispatcher?.flush();let o=a.pollUnsafe();return o?sb(o):new Promise(e=>{a.addObserver(t=>{e(sb(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 rie=a(2,(e,t)=>lb(e,(e,n)=>aie(t,e)?void 0:[e,n])),cb=e=>e,iie=a(2,(e,t)=>lb(e,(e,n)=>[e,t(n)]));function aie(e,t){return e.some(e=>e===t||typeof e==`number`&&String(e)===t)}function lb(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let i=t(r,e[r]);if(i){let[e,t]=i;st(n,e,t)}}return n}var ub=`~effect/Schema/SchemaError`;function oie(e){return F(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}var db=$y;function fb(){return(e,t,n)=>Eb(new H_(e.map(wv),e=>t(e.map(e=>Eb(e))),n))}function pb(e,t){return fb()([],()=>(t,n,r)=>e(t)?B(t):U(new hg(n,t,r)),t)}var mb=class extends ia(`SchemaError`){[ub]=ub;constructor(e){let t=rt();it(0);try{super({issue:e})}finally{it(t)}}get message(){return Ng(this.issue)}toString(){return`SchemaError(${this.message})`}};function hb(e){return oie(e)}function gb(e){return Ko(e)?sie(e):Qf(e,e=>Ff(()=>zl(e,e=>new mb(e))))}function sie(e){return su(e)?e:nu(zl(e.cause,e=>new mb(e)))}function cie(e,t){let n;for(let r of e.reasons){if(!Ml(r)||!hb(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 _b(e){let t=Up(e);if(su(t))return t.value;throw cie(t.cause,`Sync adapter can only throw schema errors`)}function vb(e,t){return nie(e,t)}var lie=Mre;function yb(e,t){let n=qy(e,t);return(e,t)=>gb(n(e,t))}var bb=yb,uie=Ire;function xb(e,t){let n=Lre(e,t);return(e,t)=>Pr(n(e,t),e=>new mb(e))}function Sb(e,t){let n=yb(e,t);return(e,t)=>_b(n(e,t))}var die=Sb;function Cb(e,t){let n=Rre(e,t);return(e,t)=>gb(n(e,t))}var wb=Cb;function fie(e,t){let n=Cb(e,t);return(e,t)=>_b(n(e,t))}var Tb=fie,Eb=tb;function Db(e){return F(e,db)&&e[db]===db}var Ob=cb(e=>Eb(hy(e.ast),{schema:e})),W=cb(e=>{let t=qb(e);return Eb(rre(e.ast),{schema:t})}),kb=cb(e=>Eb(gy(e.ast),{schema:e})),Ab=cb(e=>Eb(yy(e.ast),{schema:e})),jb=cb(e=>Eb(by(e.ast),{schema:e}));function G(e){let t=Eb(new X_(e),{literal:e,transform(n){return t.pipe(Jb(G(n),{decode:Wg(()=>n),encode:Wg(()=>e)}))}});return t}var Mb=Eb(J_),Nb=Eb(Y_),pie=Eb(U_),Pb=Eb(K_),K=Eb(Q_),Fb=Eb(tv),Ib=Eb(nv),mie=Eb(rv),Lb=Eb(q_);function Rb(e,t){return Eb(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Rb(Cv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function q(e){return Rb(Cv(e,void 0),e)}function zb(e,t){return Eb(cre(e.ast,t.ast),{key:e,value:t})}function Bb(e,t){return Eb(e,{elements:t,mapElements(e,t){let n=e(this.elements);return Bb(Tv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Vb(e){return Bb(Tv(e),e)}var J=cb(e=>Eb(new iv(!1,[],[e.ast]),{value:e})),Hb=cb(e=>Eb(new iv(!1,[e.ast],[e.ast]),{value:e}));function Ub(e,t){return Eb(e,{members:t,mapMembers(e,t){let n=e(this.members);return Ub(Ev(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Wb(e,t){return Ub(Ev(e,t,void 0),e)}function Gb(e){let t=e.map(G);return Eb(Ev(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return Wb(e(this.members))},pick(e){return Gb(e)},transform(e){return Wb(t.map((t,n)=>t.transform(e[n])))}})}var Kb=cb(e=>Wb([e,pie])),qb=cb(e=>Wb([e,Pb]));function hie(e){return t=>Eb(t.ast,{schema:t,identifier:e})}function gie(e){return t=>Eb(dy(t.ast,new i_(e,o)),{schema:t})}function _ie(e){return vie(e)}function vie(e){return t=>gie(One(e))(t)}function Jb(e,t){return n=>Eb(ore(n.ast,e.ast,t?c_(t):p_()),{from:n,to:e})}function yie(){return(e,t)=>tx()(e,{decode:t,encode:Vg})}function Yb(e){return t=>Jb(Ab(t),e)(t)}function Xb(e){return t=>Eb(are(t.ast,e),{schema:t})}function Zb(e){return Qf(e,e=>Ff(()=>zl(e,e=>e.issue)))}function Qb(e,t){let n=t?.encodingStrategy===`omit`?Jg():Ug();return t=>Ob(jb(t)).pipe(Jb(t,{decode:Yg(Zb(e)),encode:n}))}function bie(e,t){let n=t?.encodingStrategy===`omit`?Jg():Ug();return t=>W(jb(t)).pipe(Jb(t,{decode:Yg(Zb(e)),encode:n}))}function $b(e){return G(e).pipe(Xb(B(e)))}function xie(e,t){return q({_tag:$b(e),...t})}function ex(e,t){return pb(t=>t instanceof e,t)}function tx(){return(e,t)=>new L_(e.ast,c_(t))}var nx=Kv;function rx(e,t){let n=e.source,r=e.flags,i=/^[dg]*uy?$/.test(r),a=r===``?`new RegExp(${Ue(n)})`:`new RegExp(${Ue(n)}, ${Ue(r)})`;return Xv(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}var Sie=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 ix(e,t){let n=Sie(e);return rx(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 ax=Eb(Jv);function Cie(e){let t=Mn(e.order),n=e.formatter??Ue;return(r,i)=>nx(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function wie(e){let t=Pn(e.order),n=e.formatter??Ue;return(r,i)=>nx(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 Tie(e){let t=Nn(e.order),n=e.formatter??Ue;return(r,i)=>nx(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 Eie(e){let t=Pn(e.order),n=Mn(e.order),r=Nn(e.order),i=jn(e.order),a=e.formatter??Ue;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return nx(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 ox(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Ue(e)}`);return e}var sx=Cie({order:An,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:ox(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Ue(e)})`})})}),cx=wie({order:An,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:ox(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Ue(e)})`})})}),lx=Tie({order:An,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:ox(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Ue(e)})`})})}),ux=Eie({order:An,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:ox(e.minimum),maximum:ox(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Ue(e.minimum)}, maximum: ${Ue(e.maximum)}, exclusiveMinimum: ${Ue(t)}, exclusiveMaximum: ${Ue(n)} })`})}}});function dx(e){return nx(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 fx=Fb.check(dx());function px(e,t){return e=gx(e),mx(e,Math.ceil(e/2),t)}function mx(e,t,n){return nx(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})`}),[Yh]:!0,arbitraryConstraint:{minLength:e},...n})}function Die(e){return mx(1,1,e)}function hx(e,t){return e=gx(e),nx(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})`}),[Yh]:!0,arbitraryConstraint:{maxLength:e},...t})}function gx(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function Oie(e,t){return e=gx(e),nx(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})`}),[Yh]:!0,arbitraryConstraint:{minProperties:e},...t})}function kie(e,t){let n=jb(e),r=Fre(n.ast);return nx((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 dg([e],t)),n.errors===`first`))break}return!Zr(a)||new mg(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})`}),[Yh]:!0,...t})}var _x=K.check(Die()),Aie=e=>+(e?.includeStack===!0)|(e?.excludeCause===!0?2:0),jie=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},vx=[];function yx(e){let t=Aie(e),n=vx[t];if(n!==void 0)return n;let r=Kx.pipe(Jb(Nb,S_(jie(t))));return vx[t]=r,r}globalThis.RegExp;var bx=K.annotate({expected:`a string that will be decoded as a URL`}),Mie=ex(globalThis.URL,{representation:{id:`effect/schema/URL`,payload:null},toCode:()=>({runtime:`Schema.URL`,Type:`globalThis.URL`}),expected:`URL`,toCodecJson:()=>tx()(bx,C_)}),xx=bx.pipe(Jb(Mie,C_)),Nie=K.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function Sx(e,t){return Nie.pipe(Jb(e,T_(t)))}var Pie=Sx(Nb);globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var Cx=K.annotate({expected:`a string that will be decoded as a number`}).pipe(Jb(Fb,m_)),wx=K.annotate({expected:`a string that will be decoded as a finite number`}).pipe(Jb(ax,m_)),Fie=K.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),Tx=ex(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>tx()(Fie,w_)});function Ex(e,t){return Eb(fb()([e,t],([e,t])=>(n,r,i)=>{if(!jl(n))return U(new hg(r,n,i));switch(n._tag){case`Fail`:return Xp(qy(e)(n.error,i),{onSuccess:Ll,onFailure:e=>_g(r,`error`,e,n,i)});case`Die`:return Xp(qy(t)(n.defect,i),{onSuccess:Rl,onFailure:e=>_g(r,`defect`,e,n,i)});case`Interrupt`:return B(n)}},{representation:{id:`effect/schema/CauseReason`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.CauseReason(${e[0].runtime}, ${e[1].runtime})`,Type:`Cause.Failure<${e[0].Type}, ${e[1].Type}>`,importDeclarations:[`import * as Cause from "effect/Cause"`]}),expected:`Cause.Failure`,toCodec:([e,t])=>tx()(Wb([q({_tag:G(`Fail`),error:e}),q({_tag:G(`Die`),defect:t}),q({_tag:G(`Interrupt`),fiberId:qb(ax)})]),u_({decode:e=>{switch(e._tag){case`Fail`:return Ll(e.error);case`Die`:return Rl(e.defect);case`Interrupt`:return Xte(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 Dx(e,t){return Eb(fb()([e,t],([e,t])=>{let n=J(Ex(e,t));return(e,t,r)=>Al(e)?Xp(qy(n)(e.reasons,r),{onSuccess:Nl,onFailure:n=>_g(t,`failures`,n,e,r)}):U(new hg(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])=>tx()(J(Ex(e,t)),u_({decode:Nl,encode:({reasons:e})=>e}))}).ast,{error:e,defect:t})}var Ox=l_({decode:(e,t)=>Bn(Kne(e),{onNone:()=>U(new gg({expected:`a valid UTC DateTime string`},e,t)),onSome:e=>B(Yne(e))}),encode:e=>B(dm(e))}),Iie=-864e13,kx=864e13;function Lie(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 Rie(e,t){return fx.check(ux({minimum:e,maximum:t}))}var Ax=pb(e=>Wne(e)&&Gne(e),{representation:{id:`effect/schema/DateTimeUtc`,payload:null},toCode:()=>({runtime:`Schema.DateTimeUtc`,Type:`DateTime.Utc`,importDeclarations:[`import * as DateTime from "effect/DateTime"`]}),expected:`DateTime.Utc`,toCodecArbitrary:({constraint:e})=>{let[t,n]=Lie(e,Iie,kx);return yie()(Rie(t,n),Wg(cm))},toCodecJson:()=>tx()(K,Ox),toFormatter:()=>e=>e.toString()}),jx=K.annotate({expected:`a string that will be decoded as a DateTime.Utc`}).pipe(Jb(Ax,Ox)),Mx=pb(bi,{representation:{id:`effect/schema/Duration`,payload:null},toCode:()=>({runtime:`Schema.Duration`,Type:`Duration.Duration`,importDeclarations:[`import * as Duration from "effect/Duration"`]}),expected:`Duration`,toCodecJson:()=>tx()(Wb([q({_tag:G(`Infinity`)}),q({_tag:G(`NegativeInfinity`)}),q({_tag:G(`Nanos`),value:mie}),q({_tag:G(`Millis`),value:fx})]),u_({decode:e=>{switch(e._tag){case`Infinity`:return Ei;case`NegativeInfinity`:return Di;case`Nanos`:return Oi(e.value);case`Millis`:return ki(e.value)}},encode:e=>{switch(e.value._tag){case`Infinity`:return{_tag:`Infinity`};case`NegativeInfinity`:return{_tag:`NegativeInfinity`};case`Nanos`:return{_tag:`Nanos`,value:e.value.nanos};case`Millis`:return{_tag:`Millis`,value:e.value.millis}}}}))});function Nx(e,t,n){return Eb(fb()([e,t,n],([e,t,n])=>{let r=Dx(t,n);return(t,n,i)=>{if(!eu(t))return U(new hg(n,t,i));switch(t._tag){case`Success`:return Xp(qy(e)(t.value,i),{onSuccess:tu,onFailure:e=>_g(n,`value`,e,t,i)});case`Failure`:return Xp(qy(r)(t.cause,i),{onSuccess:nu,onFailure:e=>_g(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])=>tx()(Wb([q({_tag:G(`Success`),value:e}),q({_tag:G(`Failure`),cause:Dx(t,n)})]),u_({decode:e=>e._tag===`Success`?tu(e.value):nu(e.cause),encode:e=>su(e)?{_tag:`Success`,value:e.value}:{_tag:`Failure`,cause:e.cause}}))}).ast,{value:e,error:t,defect:n})}var Px=pb(Ph,{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:()=>zh,toCodec:()=>tx()(J(Vb([K,K])),u_({decode:Ih,encode:e=>e.params}))}).pipe(Jb(zb(K,Wb([K,Hb(K)])),u_({decode:Kh,encode:Lh})));function Fx(e,t){let n=typeof t?.label==`string`?t.label:void 0,r=t?.disallowJsonEncode===!0,i=n===void 0?r?{disallowJsonEncode:!0}:void 0:r?{label:n,disallowJsonEncode:!0}:{label:n},a=n===void 0?void 0:qy(G(n));return Eb(fb()([e],([e])=>(t,n,r)=>mh(t)?Zp(a===void 0?Af:Yp(a(t.label,r),e=>new dg([`label`],e)),()=>Xp(qy(e)(_h(t),r),{onSuccess:e=>hh(e,{label:t.label}),onFailure:()=>new mg(n,[new dg([`value`],new gg(void 0,t,r))],t,r)})):U(new hg(n,t,r)),{representation:{id:`effect/schema/Redacted`,payload:i??null},toCode:({typeParameters:e})=>({runtime:i===void 0?`Schema.Redacted(${e[0].runtime})`:`Schema.Redacted(${e[0].runtime}, ${Ue(i)})`,Type:`Redacted.Redacted<${e[0].Type}>`,importDeclarations:[`import * as Redacted from "effect/Redacted"`]}),expected:`Redacted`,toCodecJson:([e])=>tx()(e,{decode:Wg(e=>hh(e,{label:n})),encode:r?Bg(e=>`Cannot serialize Redacted`+(zn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):Wg(_h)}),toEquivalence:([e])=>vh(e)}).ast,{value:e})}function Ix(e,t){return Jb(Fx(Ab(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Wg(e=>hh(e,{label:t?.label})),encode:t?.disallowEncode?Bg(e=>`Cannot encode Redacted`+(zn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):Wg(_h)})(e)}var Lx=globalThis.Symbol.for(`immer-draftable`),Rx={};function zx(e,t,r,i,a){let o=zie(r,t,i),s=Vx(t),c=class extends e{constructor(...[e,t]){let n=t?.[`~payload`],i=n?.token===Rx?n.value:r.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:Rx,value:i}})}static[db]=db;get[s](){return s}static[Lx]=!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 Ky(o(this))(e??{},t)}static makeOption(e,t){return Gy(o(this))(e??{},t)}static makeEffect(e,t){return o(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(ry(this.ast,e))}static annotateKey(e){return this.rebuild(my(this.ast,e))}static check(...e){return this.rebuild(ay(this.ast,e))}static extend(e){return(t,n)=>{let i=Hx(t)?t:q(t),o={...r.fields,...i.fields},s=Cv(o,r.ast.checks,{identifier:e});return zx(this,e,Rb(ay(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 Bx(e){return new o_(Wg(t=>new e(t,{"~payload":{token:Rx,value:t}})),Ug())}function Vx(e){return`~effect/Schema/Class/${e}`}function zie(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=Vx(t),o=e=>e instanceof i||F(e,a),s=Bx(i);return r=Jb(Eb(new H_([e.ast],()=>(e,t,n)=>o(e)?B(e):U(new hg(t,e,n)),{identifier:t,[Zh]:([e])=>({isConstructed:o,link:new L_(e,s)}),toCodec:([e])=>new L_(e.ast,s),toEquivalence:([e])=>e,toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[Xh]:kv(e.ast),...n})),s)(e)}}function Hx(e){return Db(e)}var Bie=e=>(t,n)=>zx(ta,e,Hx(t)?t:q(t),n,e=>({toString(){return`${e}(${Ue({...this})})`}})),Ux=e=>(t,n)=>zx(Qt,e,Hx(t)?t:q(t),n,e=>({name:e})),Y=e=>(t,n,r)=>{let i=Hx(n)?n.mapFields(e=>({_tag:$b(t),...e}),{unsafePreserveChecks:!0}):xie(t,n);return Ux(e??t)(i,r)},Wx=qre,Gx=Xre,Kx=Eb(ry(Ny,{toCode:()=>({runtime:`Schema.Json`,Type:`Schema.Json`})})),qx=Eb(ry(Sre,{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)},[ve](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return ye(this.value,e.value);case`Failure`:return ye(this.cause,e.cause)}},[ee](){let e=se(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:re(e)(this._tag===`Success`?z(this.value):z(this.cause))}},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??In(),n.waiting=t?.waiting??!1,n},sS=(e,t)=>oS(e,{previousSuccess:Jn(t.previous,e=>rS(e)?Ln(e):aS(e)?e.previousSuccess:In()),waiting:t.waiting}),cS=(e,t)=>sS(Pl(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`?Ln(e.value):e._tag===`Failure`?qn(e.previousSuccess,e=>e.value):In(),pS=e=>Gn(fS(e),()=>new ql(`AsyncResult.getOrThrow: no value found`)),mS=e=>{switch(e._tag){case`Success`:return tu(e.value);case`Failure`:return nu(e.cause);default:return ru(new ql)}},hS=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return oS(e.cause,{previousSuccess:qn(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:Jn(e.previousSuccess,e=>{let n=t(e.value,e);return rS(n)?Ln(n):In()}),waiting:e.waiting});case`Success`:return t(e.value,e)}}),_S=eo,vS=no,yS=$ee,bS=ro,xS=io,SS=Xa,CS=kte,wS=Yc,Vie=Lte,TS=`~effect/MutableRef`,Hie={[TS]:TS,...yt,toJSON(){return{_id:`MutableRef`,current:Qe(this.current)}}},ES=e=>{let t=Object.create(Hie);return t.current=e,t},DS=a(2,(e,t)=>(e.current=t,e)),OS=Symbol.for(`effect/MutableList/Empty`),kS=()=>({head:void 0,tail:void 0,length:0}),AS=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})},jS=()=>({array:[],mutable:!0,offset:0,next:void 0}),MS=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=jS(),e.tail=e.tail.next):e.head=e.tail=jS(),e.tail.array.push(t),e.length++},Uie=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||=e.head,e.length++},Wie=(e,t)=>Gie(e,qr(t),!Array.isArray(t)),Gie=(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},NS=e=>{e.head=e.tail=void 0,e.length=0},PS=(e,t)=>{if(t=Or(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return NS(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?NS(e):AS(e),n;i=i.next}return NS(e),n},Kie=e=>PS(e,e.length),FS=e=>{if(!e.head)return OS;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:NS(e):AS(e),t},qie=(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){NS(e);return}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length},Jie=(e,t)=>qie(e,e=>e!==t),Yie=`~effect/PubSub`,Xie=`~effect/PubSub/Subscription`,Zie=e=>V(()=>GS(e.atomicPubSub(),new Map,yu(),wS(!1),ES(!1),e.strategy(),ES(In()))),Qie=e=>Zie({atomicPubSub:()=>$ie(e),strategy:()=>new KS}),$ie=e=>{let t=e?.replay;return new VS(t&&t>0?new YS(Math.ceil(t)):void 0)},IS=a(2,(e,t)=>e.shutdownFlag.current||zn(e.ended.current)?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),eae=e=>Op(dp(t=>{let n=yr(t,vu),r=wu(e.scope),i=BS(e.pubsub,e.subscribers,e.strategy,e.ended);return Su(r,tae(i)).pipe(Hf(xu(n,e=>Tu(r,e))),qf(i))})),tae=e=>Op(zf(t=>(DS(e.shutdownFlag,!0),wf(Kie(e.pollers),e=>tne(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(Uf(()=>V(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),gne(e.shutdownHook.open),Yf)))),nae=e=>kf(function t(n){if(e.shutdownFlag.current)return Tp;let r=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?B(e.replayWindow.takeAll().concat(r)):Zr(r)?B(r):Bf(rae(e),e=>t([e]))}),rae=e=>Mf(t=>{if(e.shutdownFlag.current)return t(Tp);if(zn(e.ended.current))return t(B(e.ended.current.value));let n=fu(),r=e.subscribers.get(e.subscription);return r||(r=new Set,e.subscribers.set(e.subscription,r)),r.add(e.pollers),MS(e.pollers,n),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),n.effect?t(n.effect):(n.resumes=[t],V(()=>Jie(e.pollers,n)))}),LS=Symbol.for(`effect/PubSub/AbsentValue`),RS=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},zS=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},BS=(e,t,n,r)=>new US(e,t,e.subscribe(),kS(),wS(!1),ES(!1),n,e.replayWindow(),r),VS=class{publisherHead={value:LS,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 XS(this.replayBuffer):ZS}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=LS,this.subscribersIndex+=1,this.replayBuffer?.slide(t,e.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new HS(this,this.publisherTail,this.publisherIndex,!1)}},HS=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===LS?(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 OS;let e=!0,t=OS;for(;e;)if(this.subscriberHead===this.self.publisherTail)e=!1;else{let n=this.subscriberHead.next.value;n!==LS&&(t=n,--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=LS,this.self.subscribersIndex+=1),e=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return t}pollUpTo(e){e=Or(e);let t=[],n=0;for(;n!==e;){let r=this.poll();r===OS?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!==LS&&(--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=LS,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},US=class{[Xie]={_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)}},WS=class{[Yie]={_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)}},GS=(e,t,n,r,i,a,o)=>new WS(e,t,n,r,i,a,o),KS=class{get shutdown(){return Af}handleSurplus(e,t,n,r){return B(!1)}onPubSubEmptySpaceUnsafe(e,t){}completePollersUnsafe(e,t,n,r){return qS(this,e,t,n,r)}completeSubscribersUnsafe(e,t){return JS(this,e,t)}},qS=(e,t,n,r,i)=>{let a=!0;for(;a&&!r.isEmpty();){let o=FS(i);if(o===OS)zS(n,r,i),i.length===0?a=!1:RS(n,r,i);else{let a=r.poll();a===OS?Uie(i,o):(_u(o,tu(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},JS=(e,t,n)=>{for(let[r,i]of n)for(let a of i)e.completePollersUnsafe(t,n,r,a)},YS=class{capacity;head={value:LS,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:LS,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)}},XS=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]=LS,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),e}takeN(e){e=Or(e);let t=Math.min(e,this.remaining),n=Array(t);for(let e=0;e<t;e++)n[e]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},ZS={remaining:0,take:()=>void 0,takeN:()=>[],takeAll:()=>[],close:()=>void 0},QS=`~effect/Queue`,$S=`~effect/Queue/Enqueue`,eC=`~effect/Queue/Dequeue`,tC={_A:o,_E:o},nC={[QS]:tC,[$S]:tC,[eC]:tC,...yt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:yC(this)}}},rC=e=>Xt(t=>{let n=Object.create(nC);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=kS(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},ao(n)}),iC=e=>rC({capacity:e}),aC=e=>rC({capacity:e,strategy:`sliding`}),oC=a(2,(e,t)=>lo(()=>sC(e,t)?xC:e.state._tag===`Open`&&e.strategy===`suspend`?kC(e,t):bC)),sC=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(FS(e.messages),MS(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0&&(MS(e.messages,t),wC(e),!0):(MS(e.messages,t),TC(e),!0):!1,cC=a(2,(e,t)=>_o(n=>{let r=lC(e,t);return r.length===0||e.strategy===`dropping`?n(Wt(r)):AC(e,{_tag:`Array`,remaining:r,offset:0,resume:n})})),lC=(e,t)=>{if(e.state._tag!==`Open`)return qr(t);if(e.capacity===1/0||e.strategy===`sliding`)return Wie(e.messages,t),e.strategy===`sliding`&&PS(e.messages,e.messages.length-e.capacity),TC(e),[];let n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return qr(t);let r=[],i=0;for(let a of t)i<n?MS(e.messages,a):r.push(a),i++;return TC(e),r},uC=a(2,(e,t)=>co(()=>dC(e,t))),dC=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=ls(qt(t),SC);return e.state.offers.size===0&&e.messages.length===0?(PC(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},TC(e),!0)},fC=e=>uC(e,Pt(an())),pC=e=>co(()=>mC(e)),mC=e=>{if(e.state._tag===`Done`)return!1;NS(e.messages);let t=e.state.offers;PC(e,e.state._tag===`Open`?CC:e.state.exit);for(let e of t)jC(e);return!0},hC=e=>gC(e,1,1/0),gC=a(3,(e,t,n)=>(t=Or(t),n=Or(n),lo(()=>EC(e,t,n)??Bo(OC(e,()=>DC(e,t)),gC(e,t,n))))),_C=e=>lo(()=>vC(e)??Bo(OC(e,()=>DC(e,1)),_C(e))),vC=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=FS(e.messages);return NC(e),Wt(t)}if(e.capacity<=0&&e.state.offers.size>0){let t=MC(e.state.offers);return NC(e),Wt(t)}},yC=e=>e.state._tag===`Done`?0:e.messages.length,bC=Wt(!1),xC=Wt(!0),SC=Jt(an()),CC=es(),wC=e=>{if(e.state._tag!==`Done`&&e.state.takers.size!==0){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(as),e.messages.length===0))break}},TC=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,wC(e)},0))},EC=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return Wt([]);if(!DC(e,t))return;let r=e.messages.length>0?PS(e.messages,n):[MC(e.state.offers)];return NC(e),Wt(r)},DC=(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,OC=(e,t)=>_o(n=>{if(e.state._tag===`Done`)return n(e.state.exit);if(t())return n(as);let r={ready:t,resume:n};return e.state.takers.add(r),co(()=>{e.state._tag!==`Done`&&e.state.takers.delete(r)})}),kC=(e,t)=>_o(n=>sC(e,t)?n(xC):AC(e,{_tag:`Single`,message:t,resume:n})),AC=(e,t)=>{if(e.state._tag!==`Open`)return jC(t);let n=e.state.offers;return n.add(t),co(()=>{e.state._tag!==`Done`&&(n.delete(t),e.state._tag===`Closing`&&n.size===0&&e.messages.length===0&&PC(e,e.state.exit))})},jC=e=>e._tag===`Single`?e.resume(bC):e.resume(Wt(e.remaining.slice(e.offset))),MC=e=>{let t=e.values().next().value;if(t._tag===`Single`)return e.delete(t),t.resume(xC),t.message;let n=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Wt([]))),n},NC=e=>{if(e.state._tag===`Done`)return Yd(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0&&(PC(e,e.state.exit),Yd(e.state.exit.cause));for(let t of e.state.offers){let n=e.capacity-e.messages.length;if(n<=0)break;if(t._tag===`Single`)MS(e.messages,t.message),e.state.offers.delete(t),t.resume(xC);else{for(;t.offset<t.remaining.length;t.offset++){if(n===0)return!1;MS(e.messages,t.remaining[t.offset]),n--}e.state.offers.delete(t),t.resume(Wt([]))}}return!1},PC=(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()},FC=e=>new LC(e),IC=(e,t,n)=>_o(r=>{if(e.free>=t)return r(n);let i=()=>{e.free<t||(e.waiters.delete(i),r(n))};return e.waiters.add(i),co(()=>{e.waiters.delete(i)})}),LC=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=lo(()=>this.free<e?IC(this,e,t):(this.taken+=e,ao(e)));return t}takeIfAvailable(e){return lo(()=>this.free<e?ao(!1):(this.taken+=e,ao(!0)))}releaseUnsafe(e,t){return this.taken-=t,this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{for(let e of this.waiters){if(this.free<=0)break;e()}},0),this.free}resize(e){return Xt(t=>(this.permits=e,this.free<0||this.releaseUnsafe(t,0),ho))}release(e){return Xt(t=>ao(this.releaseUnsafe(t,e)))}get releaseAll(){return Xt(e=>ao(this.releaseUnsafe(e,this.taken)))}withPermits(e){return t=>jc(n=>{let r=lo(()=>this.free<e?Go(n(IC(this,e,ho)),()=>r):(this.taken+=e,wc(n(t),()=>{this.releaseUnsafe(Xa(),e)},!0)));return r})}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>jc(n=>this.free<e?fo:(this.taken+=e,wc(n(zo(t)),()=>{this.releaseUnsafe(Xa(),e)},!0)))}},RC=e=>co(()=>new LC(e)),zC=(e,t)=>t?e.withPermit(t):e.withPermit,BC=`~effect/Channel`,VC=e=>F(e,BC),HC={[BC]:{_Env:o,_InErr:o,_InElem:o,_OutErr:o,_OutElem:o},pipe(){return n(this,arguments)}},UC=e=>{let t=Object.create(HC);return t.transform=(t,n)=>Qf(e(t,n),e=>B(Pf(e))),t},WC=(e,t)=>UC((n,r)=>Bf(qC(e)(n,r),e=>t(e,r))),GC=e=>UC((t,n)=>e),KC=e=>UC(Wp(function*(t,n){let r=wu(n),i=e=>Tu(r,$d(e));return Sp(yield*Sp(e(t,n,r),i),i)})),qC=e=>e.transform,JC=(e,t,n)=>rC({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Uf(t=>Su(e,pC(t))),Uf(n=>Pp(bu(t(n),e),e))),YC=(e,t)=>UC((n,r)=>Kf(JC(r,e,t),hC)),XC=e=>UC((t,n)=>kf(()=>qC(e())(t,n))),ZC=e=>GC(V(()=>{let t=e();return kf(()=>{let e=t.next();return e.done?Yl(e.value):B(e.value)})})),QC=e=>GC(V(()=>{let t=0;return kf(()=>t>=e.length?Yl():B(e[t++]))})),$C=e=>iw(B(e)),ew=GC(B(Yl())),tw=GC(B(Nf)),nw=e=>GC(B(U(e))),rw=e=>GC(Pf(e)),iw=e=>GC(V(()=>{let t=!1;return kf(()=>t?Yl():(t=!0,e))})),aw=e=>GC(B(hC(e))),ow=e=>GC(B(Dp(nae(e),()=>Yl()))),sw=e=>Mw(Kf(eae(e),ow)),cw=e=>UC((t,n)=>lw({scope:n,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd})),lw=e=>{let t=e.readable.getReader(),n=e.exit??ES(void 0),r=kf(()=>n.current?n.current:lp(Df({try:()=>t.read(),catch:e.onError}),{onFailure:e=>n.current??Pf(e),onSuccess:({done:e,value:t})=>n.current?n.current:e?Yl():B(ni(t))}));return qf(Su(e.scope,e.releaseLockOnEnd?V(()=>t.releaseLock()):Ef(()=>t.cancel().catch(d))),r)},uw=a(2,(e,t)=>WC(e,e=>V(()=>{let n=0;return Kf(e,e=>t(e,n++))}))),dw=e=>e===void 0||e!==`unbounded`&&e<=1,fw=a(e=>VC(e[0]),(e,t,n)=>dw(n?.concurrency)?pw(e,t):mw(e,t,n)),pw=(e,t)=>UC((n,r)=>{let i=0;return Kf(qC(e)(n,r),Bf(e=>t(e,i++)))}),mw=(e,t,n)=>KC(Wp(function*(r,i,a){let o=0,c=yield*qC(e)(r,i),l=n.concurrency===`unbounded`?2**53-1:n.concurrency,u=yield*iC(0);yield*Su(a,pC(u));let d=Lp(yield*up()),f=CS(a);if(n.unordered){let e=FC(l),n=s(e.release(1)),r=lp({onFailure:e=>Bf(uC(u,e),n),onSuccess:e=>Bf(oC(u,e),n)});yield*e.take(1).pipe(Bf(()=>c),Bf(e=>{let n=o++;return f(d(r(kf(()=>t(e,n))))),Af}),Ap({disableYield:!0}),Qf(t=>e.withPermits(l-1)(uC(u,t))),Pp(a))}else{let e=yield*iC(l-2);yield*Su(a,pC(e)),yield*_C(e).pipe(Vf,Bf(e=>oC(u,e)),Ap({disableYield:!0}),Qf(e=>uC(u,e)),Pp(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,dC(u,e.cause))};yield*c.pipe(Bf(i=>{if(n)return Pf(n);let a=o++,s=d(kf(()=>t(i,a)));return f(s),s.addObserver(r),oC(e,vS(s))}),Ap({disableYield:!0}),Qf(t=>oC(e,nu(t)).pipe(Hf(uC(e,t)))),Pp(a))}return _C(u)})),hw=a(e=>VC(e[0]),(e,t,n)=>dw(n?.concurrency)?gw(e,t):_w(e,t,n)),gw=(e,t)=>UC((n,r)=>Kf(qC(e)(n,r),e=>{let i,a,o=Bf(e,e=>(a??=wu(r),Zp(qC(t(e))(n,a),e=>(i=s(e),i)))),s=Jd(e=>{if(i=void 0,a.state._tag===`Empty`)return o;let t=Tu(a,ou);return a=void 0,Bf(t,()=>o)});return kf(()=>i??o)})),_w=(e,t,n)=>e.pipe(uw(t),kw(n)),vw=e=>hw(e,o),yw=e=>WC(e,e=>{let t,n=0;return B(kf(function r(){if(t===void 0)return Bf(e,e=>{switch(e.length){case 0:return r();case 1:return B(e[0]);default:return t=e,B(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),B(i)}))}),bw=e=>WC(e,e=>B(Ap(e,{disableYield:!0}))),xw=a(2,(e,t)=>lf(typeof t==`function`?t(o):t).pipe(Kf(t=>{let n=nf.defaultValue();return Sw(zw(e,nf,V(()=>n)),e=>t(e).pipe(Kf(e=>{n=e}),Jd(()=>Yl(e))))}),Mw)),Sw=(e,t)=>UC((n,r)=>V(()=>{let i,a=()=>{let o=wu(r);return Bf(qC(e)(n,o),e=>(i=Jd(e,e=>Tu(o,ou).pipe(Bf(()=>t(e)),Bf(a))),i))};return kf(()=>i??a())})),Cw=a(2,(e,t)=>UC((n,r)=>Kf(qC(e)(n,r),e=>Bf(e,function n(r){return t(r)?B(r):Bf(e,n)})))),ww=a(2,(e,t)=>WC(e,e=>B(Bf(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return Qr(i)?B(i):Bf(e,n)})))),Tw=a(2,(e,t)=>UC((n,r)=>{let i=wu(r);return Kf(qC(e)(n,i),e=>{let a=e.pipe(Qf(e=>{if(Yd(e))return Pf(e);let o=i;return i=wu(r),Tu(o,nu(e)).pipe(Hf(qC(t(e))(n,i)),Bf(e=>(a=e,e)))}));return kf(()=>a)})})),Ew=a(3,(e,t,n)=>Tw(e,e=>{let r=t(e);return Mr(r)?rw(r.failure):n(r.success,e)})),Dw=a(2,(e,t)=>Ew(e,Vl,e=>t(e))),Ow=a(e=>VC(e[0]),(e,t,n)=>e.pipe(uw(t),kw({...n,concurrency:n?.concurrency??1,switch:!0}))),kw=a(2,(e,{bufferSize:t=16,concurrency:n,switch:r=!1})=>KC(Wp(function*(i,a,o){let s=n===`unbounded`?2**53-1:Math.max(1,n),c=r?void 0:FC(s),l=yield*Vie(!0),u=new Set,d=yield*iC(t);yield*Su(o,pC(d));let f=yield*qC(e)(i,a);return yield*H(function*(){for(;;){let e;c&&(u.size<s?yield*c.take(1):(e=yield*Np(f),yield*sp(c.take(1),Hf(vS(e),Nf))));let t=e===void 0?yield*f:yield*vS(e),n=wu(o),r=yield*qC(t)(i,n);for(;u.size>=s;){let e=Lr(u);u.delete(e),u.size===0&&(yield*l.open),yield*bS(e)}let a=yield*r.pipe(Uf(()=>Rf),Bf(e=>oC(d,e)),Ap({disableYield:!0}),Sp(Wp(function*(e){let t=Zd(e);if(yield*Gf(Tu(n,Mr(t)?nu(t.failure):tu(t.success.value))),u.has(a)&&(u.delete(a),c&&(yield*c.release(1)),u.size===0&&(yield*l.open),!Nr(t)))return yield*uC(d,e)})),Np);l.closeUnsafe(),u.add(a)}}).pipe(Qf(e=>Nr(Zd(e))?l.whenOpen(uC(d,e)):uC(d,e)),Pp(o)),_C(d)}))),Aw=a(e=>VC(e[0])&&VC(e[1]),(e,t,n)=>KC(Wp(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*iC(0);yield*Su(a,pC(s));let c=0;function l(e,t){if(c++,!Yd(t))return uC(s,t);switch(o){case`both`:return c===2?uC(s,t):Af;case`left`:case`right`:return e===o?uC(s,t):Af;case`either`:return uC(s,t)}}let u=(e,t,n)=>qC(t)(r,n).pipe(Bf(e=>e.pipe(Bf(e=>oC(s,e)),Ap)),Sp(t=>Hf(Tu(n,$d(t)),l(e,t))),Pp(a));return yield*u(`left`,e,wu(a)),yield*u(`right`,t,wu(a)),_C(s)}))),jw=a(2,(e,t)=>UC((n,r)=>Bf(qC(e)(n,r),e=>qC(t)(e,r)))),Mw=e=>UC((t,n)=>{let r;return B(kf(()=>r||e.pipe(bu(n),Bf(e=>qC(e)(t,n)),Bf(e=>r=e))))}),Nw=a(2,(e,t)=>KC((n,r,i)=>xu(i,t).pipe(Hf(qC(e)(n,r))))),Pw=a(2,(e,t)=>WC(e,e=>B(Jd(e,e=>Bf(t,()=>Yl(e)))))),Fw=a(2,(e,t)=>Nw(e,e=>t)),Iw=(e,t,n)=>kf(()=>{let r=yu();return Jd(Bf(qC(e)(Yl(),r),t),n||B).pipe(Cp(e=>Tu(r,e)))}),Lw=a(2,(e,t)=>UC((n,r)=>Kf(pp(qC(e)(n,r),t),pp(t)))),Rw=a(3,(e,t,n)=>UC((r,i)=>Kf(hp(qC(e)(r,i),t,n),hp(t,n)))),zw=a(3,(e,t,n)=>UC((r,i)=>Bf(n,n=>qC(Rw(e,t,n))(r,i)))),Bw=a(2,(e,t)=>Iw(e,e=>Ap(Bf(e,t),{disableYield:!0}))),iae=e=>kf(()=>{let t=In();return Iw(e,e=>e.pipe(Jf,Bf(e=>(t=e,Yl()))),()=>B(t))}),aae=Wp(function*(e){let t=FC(1),n=yield*up(),r=yr(n,vu);return(yield*qC(e)(Yl(),r)).pipe(pp(n),t.withPermits(1))},Qf(e=>B(Pf(e)))),Vw=(e,t)=>qC(e)(Yl(),t),Hw=`~effect/MutableHashMap`,oae={[Hw]:Hw,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${Ue(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:Qe(Array.from(this))}},[Ze](){return this.toJSON()},pipe(){return n(this,arguments)}},Uw=()=>{let e=Object.create(oae);return e.backing=new Map,e.buckets=new Map,e},sae=(...e)=>cae(e),cae=e=>{let t=Uw();for(let[n,r]of e)Kw(t,n,r);return t},Ww=a(2,(e,t)=>{if(e.backing.has(t))return Ln(e.backing.get(t));if(Gw(t))return In();let n=z(t),r=e.buckets.get(n);return r===void 0?In():uae(e,r,t)}),Gw=e=>typeof e!=`object`&&typeof e!=`function`,lae=e=>e.backing.values(),uae=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(ye(n,t[r])){let n=t[r];return Ln(e.backing.get(n))}return In()},dae=a(2,(e,t)=>zn(Ww(e,t))),Kw=a(3,(e,t,n)=>{if(e.backing.has(t)||Gw(t))return e.backing.set(t,n),e;let r=z(t),i=e.buckets.get(r);if(i===void 0)return e.buckets.set(r,[t]),e.backing.set(t,n),e;let a=fae(i,t);return a===void 0&&(i.push(t),a=t),e.backing.set(a,n),e}),fae=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(ye(t,e[n]))return e[n]},qw=a(2,(e,t)=>{if(Gw(t))return e.backing.delete(t),e;let n=z(t),r=e.buckets.get(n);if(r===void 0)return e;for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i===t||ye(t,i)){e.backing.delete(i),r.splice(n,1);break}}return r.length===0&&e.buckets.delete(n),e}),pae=e=>(e.backing.clear(),e.buckets.clear(),e),Jw=e=>e.backing.size,Yw=`~effect/PlatformError`,mae=class extends ia(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},hae=class extends ra{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}},Xw=class extends ia(`PlatformError`){constructor(e){`cause`in e?super({reason:e,cause:e.cause}):super({reason:e})}[Yw]=Yw;get message(){return this.reason.message}},Zw=e=>new Xw(new hae(e)),gae=e=>new Xw(new mae(e)),_ae=`~effect/Stream`,vae={_R:o,_E:o,_A:o},Qw=function(e){this.channel=e};Qw.prototype={[_ae]:vae,pipe(){return n(this,arguments)}};var yae=e=>new Qw(e),$w=`~effect/RcMap`,bae=e=>({[$w]:$w,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:`Open`,map:Uw()},pipe(){return n(this,arguments)}}),xae=e=>zf(t=>{let n=t.context,r=yr(n,vu),i=bae({lookup:e.lookup,context:n,scope:r,idleTimeToLive:typeof e.idleTimeToLive==`function`?p(e.idleTimeToLive,mi):s(mi(e.idleTimeToLive??Ti)),capacity:Math.max(e.capacity??1/0,0)});return qf(xu(r,()=>{if(i.state._tag===`Closed`)return Af;let e=i.state.map;return i.state={_tag:`Closed`},wf(e,([,e])=>Gf(eT(e))).pipe(Uf(()=>V(()=>{pae(e)})))}),i)}),Sae=a(2,(e,t)=>kp(n=>{if(e.state._tag===`Closed`)return Tp;let r=e.state,i=SS(),a=Ww(r.map,t),o;if(a._tag===`Some`)o=a.value,o.refCount++;else if(Number.isFinite(e.capacity)&&Jw(e.state.map)>=e.capacity)return U(new Zl(`RcMap attempted to exceed capacity of ${e.capacity}`));else{o={deferred:fu(),scope:yu(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},o.finalizer=wae(e,t,o),Kw(r.map,t,o);let n=new Map(e.context.mapUnsafe);i.context.mapUnsafe.forEach((e,t)=>{n.set(t,e)}),n.set(vu.key,o.scope);let a=ur(n);kf(()=>e.lookup(t)).pipe(Lp(a),CS(o.scope)).addObserver(n=>{lu(n)&&Cae(e,t,o,a),_u(o.deferred,n)})}return Su(vr(i.context,vu),o.finalizer).pipe(Hf(n(mu(o.deferred))))})),Cae=(e,t,n,r)=>{if(e.state._tag===`Closed`)return;let i=Ww(e.state.map,t);i._tag!==`None`&&i.value===n&&(qw(e.state.map,t),!(n.refCount>0)&&eT(n).pipe(Lp(r),CS(e.scope)))},eT=e=>e.fiber?bS(e.fiber).pipe(Hf(Tu(e.scope,ou))):Tu(e.scope,ou),wae=(e,t,n)=>zf(r=>{if(n.refCount--,n.refCount>0)return Af;if(e.state._tag===`Closed`)return eT(n);let i=Ww(e.state.map,t);if(i._tag===`None`||i.value!==n)return eT(n);if(Si(n.idleTimeToLive))return qw(e.state.map,t),eT(n);if(!xi(n.idleTimeToLive))return Af;let a=r.getRef(ed);return n.expiresAt=a.currentTimeMillisUnsafe()+Fi(n.idleTimeToLive),n.fiber||=kp(function r(i){let o=a.currentTimeMillisUnsafe(),s=n.expiresAt-o;if(s<=0){if(e.state._tag===`Closed`||n.refCount>0)return Af;let r=Ww(e.state.map,t);return r._tag===`None`||r.value!==n?Af:(qw(e.state.map,t),Tu(n.scope,ou))}return Bf(i(a.sleep(ki(s))),()=>r(i))}).pipe(xp(V(()=>{n.fiber=void 0})),Lp(r.context),CS(e.scope)),Af}),Tae=`~effect/Stream`,tT=e=>F(e,Tae),nT=yae,rT=e=>nT(iw(Kf(e,ni))),Eae=e=>nT(GC(e)),iT=(e,t)=>nT(UC((n,r)=>Bf(Vw(e.channel,r),e=>t(e,r)))),aT=e=>e.channel,oT=(e,t)=>nT(YC(e,t)),sT=nT(ew),cT=e=>nT($C(ni(e))),Dae=(...e)=>Aae(e),lT=e=>nT(XC(()=>e().channel)),Oae=e=>nT(nw(e)),kae=e=>nT(rw(e)),Aae=e=>Qr(e)?nT($C(e)):sT,uT=e=>nT(aw(e)),jae=e=>nT(sw(e)),Mae=e=>nT(cw(e)),Nae=(e,t)=>Eae(V(()=>{let n=e,r=!1;return kf(function e(){return r?Yl():Bf(t(n),([t,i])=>(Rn(i)?r=!0:n=i.value,Qr(t)?B(t):e()))})})),Pae=nT(tw),dT=e=>nT(Mw(Kf(e,aT))),fT=a(2,(e,t)=>lT(()=>{let n=0;return nT(uw(e.channel,ri(e=>t(e,n++))))})),pT=a(e=>tT(e[0]),(e,t,n)=>e.channel.pipe(yw,fw(t,n),uw(ni),nT)),Fae=a(e=>tT(e[0]),(e,t,n)=>e.channel.pipe(yw,Ow(e=>t(e).channel,n),nT)),Iae=e=>nT(bw(e.channel)),mT=a(2,(e,t)=>nT(xw(e.channel,t))),hT=a(2,(e,t)=>{let n=nT(vw(ZC(()=>Lae(e,t))));return gT.set(n,[e,t]),n}),gT=new WeakMap;function*Lae(e,t){let n=[t,e];for(;n.length>0;){let e=n.pop(),t=gT.get(e);t===void 0?yield e.channel:n.push(t[1],t[0])}}var Rae=a(e=>tT(e[0])&&tT(e[1]),(e,t,n)=>nT(Aw(aT(e),aT(t),n))),zae=(...e)=>nT(XC(()=>{let t=[],n=new Set,r=wS();return kw(QC(e.map((i,a)=>i.channel.pipe(yw,fw(i=>(t[a]=i,n.has(a)?B(ni(t.slice())):(n.add(a),n.size<e.length?r.await:qf(r.open,ni(t.slice()))))),Cw(k)))),{concurrency:`unbounded`,bufferSize:0})})),Bae=a(3,(e,t,n)=>fT(zae(e,t),([e,t])=>n(e,t))),_T=a(2,(e,t)=>nT(ww(aT(e),t))),Vae=a(2,(e,t)=>nT(Dw(e.channel,e=>t(e).channel))),Hae=a(e=>tT(e[0]),(e,t,n)=>iT(e,(e,r)=>V(()=>{let r=0,i=!1;return Bf(kf(()=>i?Yl():e),e=>{let a=e.findIndex(e=>t(e,r++));if(a>=0){i=!0;let t=e.slice(0,n?.excludeLast?a:a+1);return Qr(t)?B(t):Yl()}return B(e)})}))),Uae=a(2,(e,t)=>nT(jw(e.channel,t))),Wae=a(e=>tT(e[0]),(e,t)=>lT(()=>{let n=new TextDecoder(t?.encoding);return fT(e,e=>n.decode(e,{stream:!0}))})),Gae=a(2,(e,t)=>nT(Pw(e.channel,t))),vT=a(2,(e,t)=>nT(Fw(e.channel,t))),yT=a(2,(e,t)=>nT(Lw(e.channel,t))),bT=e=>Kf(iae(e.channel),qn(ei(0))),xT=a(2,(e,t)=>Bw(e.channel,e=>{let n=0;return Tf({while:()=>n<e.length,body:()=>t(e[n++]),step:d})})),ST=a(2,(e,t)=>Bw(e.channel,t)),Kae=e=>aae(e.channel),qae=a(e=>tT(e[0]),(e,t,n)=>{let r,i,a=wS(!1);return new ReadableStream({start(n){i=Ip(pp(ST(e,e=>a.whenOpen(V(()=>{a.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0}))),t)),i.addObserver(e=>{e._tag===`Failure`?n.error(Bl(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return zp(Yf(bS(i)))}},n?.strategy)}),Jae=a(e=>tT(e[0]),(e,t)=>Kf(up(),n=>qae(e,n,t))),CT=`~effect/reactivity/Reactivity`,wT=tr(`effect/reactivity/Reactivity`),Yae=V(()=>{let e=new Map,t=t=>{kT(t,t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})},n=e=>dp(n=>{let r=gr(n,TT);return r?kT(e,e=>{r.add(e)}):t(e),Af}),r=(e,t)=>Uf(t,n(e)),i=(t,n)=>{let r=[];return kT(t,t=>{r.push(t);let i=e.get(t);i===void 0&&(i=new Set,e.set(t,i)),i.add(n)}),()=>{for(let t=0;t<r.length;t++){let i=e.get(r[t]);i!==void 0&&(i.delete(n),i.size===0&&e.delete(r[t]))}}},a=(e,t)=>H(function*(){let n=yield*up(),r=yr(n,vu),a=yield*rC(),o=p(Lp(n),CS(r)),s=!1,c=!1,l=e=>{e._tag===`Failure`?dC(a,e.cause):sC(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*Su(r,V(i(e,u))),u(),a}),o=(e,t)=>a(e,t).pipe(Kf(uT),dT),s=t=>kf(()=>{let n=new Set;return t.pipe(hp(TT,n),Cp(t=>V(()=>{n.forEach(t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})})))});return wT.of({[CT]:CT,mutation:r,query:a,stream:o,invalidateUnsafe:t,invalidate:n,registerUnsafe:i,withBatch:s})}),TT=class extends tr()(`effect/reactivity/Reactivity/PendingInvalidation`){},Xae=a(2,(e,t)=>wT.use(n=>n.mutation(t,e))),ET=e=>wT.use(t=>t.invalidate(e)),DT=Uu(wT)(Yae);function OT(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return z(e)}}var kT=(e,t)=>{if(Array.isArray(e)){for(let n=0;n<e.length;n++)t(OT(e[n]));return}for(let n in e){t(n);let r=e[n];for(let e=0;e<r.length;e++)t(`${n}:${OT(r[e])}`)}},AT=a(2,(e,t)=>e===void 0?void 0:t(e)),Zae=a(2,(e,{onDefined:t,onUndefined:n})=>e===void 0?n():t(e)),jT=`~effect/persistence/KeyValueStore`,MT=`~effect/persistence/KeyValueStore/KeyValueStoreError`,NT=class extends ia(`KeyValueStoreError`){[MT]=MT},PT=tr(`effect/persistence/KeyValueStore`),FT=e=>PT.of({[jT]:jT,has:t=>Kf(e.get(t),k),isEmpty:Kf(e.size,e=>e===0),modify:(t,n)=>Bf(e.get(t),r=>{if(r===void 0)return jf;let i=n(r);return qf(e.set(t,i),i)}),modifyUint8Array:(t,n)=>Bf(e.getUint8Array(t),r=>{if(r===void 0)return jf;let i=n(r);return qf(e.set(t,i),i)}),...e}),IT=e=>{let t=new TextEncoder;return FT({...e,getUint8Array:n=>e.get(n).pipe(Kf(AT(e=>Fr(pm(e),{onFailure:()=>t.encode(e),onSuccess:o})))),set:(t,n)=>typeof n==`string`?e.set(t,n):kf(()=>e.set(t,fm(n)))})},LT=`~effect/persistence/KeyValueStore/SchemaStore`,RT=(e,t)=>{let n=Sx(Wx(t)),r=bb(n),i=wb(n),a=t=>Bf(e.get(t),Zae({onUndefined:()=>Of,onDefined:e=>Jf(r(e))})),o=(t,n)=>Bf(i(n),n=>e.set(t,n)),s=(e,t)=>Bf(a(e),n=>{if(Rn(n))return Of;let r=t(n.value);return qf(o(e,r),Ln(r))});return{[LT]:LT,get:a,set:o,modify:s,remove:e.remove,clear:e.clear,size:e.size,has:e.has,isEmpty:e.isEmpty}},zT=e=>Vu(PT)(()=>{let t=e();return IT({get:e=>Lf({try:()=>t.getItem(e)??void 0,catch:t=>new NT({key:e,method:`get`,message:`Unable to get item with key ${e}`,cause:t})}),set:(e,n)=>Lf({try:()=>t.setItem(e,n),catch:t=>new NT({key:e,method:`set`,message:`Unable to set item with key ${e}`,cause:t})}),remove:e=>Lf({try:()=>t.removeItem(e),catch:t=>new NT({key:e,method:`remove`,message:`Unable to remove item with key ${e}`,cause:t})}),clear:Lf({try:()=>t.clear(),catch:e=>new NT({method:`clear`,message:`Unable to clear storage`,cause:e})}),size:Lf({try:()=>t.length,catch:e=>new NT({method:`size`,message:`Unable to get size`,cause:e})})})}),BT=`~effect/SubscriptionRef`,VT=e=>F(e,BT),HT={...yt,[BT]:{_A:o},toJSON(){return{_id:`SubscriptionRef`,value:this.value}}},UT=e=>Kf(Qie({replay:1}),t=>{let n=Object.create(HT);return n.semaphore=FC(1),n.value=e,n.pubsub=t,IS(n.pubsub,e),n}),WT=e=>jae(e.pubsub),GT=e=>V(()=>e.value),KT=(e,t)=>{e.value=t,IS(e.pubsub,t)},qT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>{let[n,r]=t(e.value);return KT(e,r),n}))),JT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>KT(e,t)))),YT=a(2,(e,t)=>e.semaphore.withPermit(V(()=>KT(e,t(e.value))))),XT=`~effect/reactivity/AtomRegistry`,ZT=e=>F(e,XT),QT=e=>new cE(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),$T=tr(XT),eE=a(2,(e,t)=>oT(n=>kf(()=>Su(vr(SS().context,vu),V(e.subscribe(t,e=>sC(n,e),{immediate:!0})))))),tE=a(e=>ZT(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return Mf(n=>{let i=e.get(t);if(i._tag!==`Initial`&&!(r&&i.waiting))return n(mS(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n(mS(e)),a())});return V(a)})}),nE={immediate:!0},rE=e=>{e()},iE={};function aE(e,t){let n=iE;for(let r of e)try{t(r)}catch(e){n===iE&&(n=e)}if(n!==iE)throw n}var oE=`~effect-atom/atom/Atom/Serializable`,sE=e=>oE in e?e[oE].key:e,cE=class{[XT];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[XT]=XT,this.scheduler=new Zi(`sync`,t),this.schedulerAsync=new Zi(`async`,t),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=r,this.timeoutResolution=n===void 0&&r!==void 0?Math.round(r/2):n??1e3,e!==void 0)for(let[t,n]of e){let e=t;for(;e.initialValueTarget;)e=e.initialValueTarget;this.ensureNode(e).setInitialValue(n)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(e){return this.ensureNode(e).value()}set(e,t){e.write(this.ensureNode(e).writeContext,t)}setSerializable(e,t){this.preloadedSerializable.set(e,t)}modify(e,t){let n=this.ensureNode(e),r=t(n.value());return e.write(n.writeContext,r[1]),r[0]}update(e,t){let n=this.ensureNode(e);e.write(n.writeContext,t(n.value()))}refresh=e=>{e.refresh===void 0?this.invalidateAtom(e):e.refresh(this.refresh)};subscribe(e,t,n){let r=this.ensureNode(e);n?.immediate?t(r.value()):r.state===uE.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,nE)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=sE(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[oE].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 dE(this,e)}invalidateAtom=e=>{this.ensureNode(e).invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get(sE(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(sE(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(sE(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),aE(t,this.removeIdleNode)}removeIdleNode=e=>{if(this.nodeTimeoutBucket.delete(e),e.canBeRemoved){this.nodes.delete(sE(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=uE.removed;aE(e,this.destroyNode)}destroyNode=e=>{e.remove(),this.onNodeRemoved?.(e)};dispose(){this.disposed=!0,this.reset()}},lE={alive:1,initialized:2,waitingForValue:4},uE={uninitialized:lE.alive|lE.waitingForValue,stale:lE.alive|lE.initialized|lE.waitingForValue,valid:lE.alive|lE.initialized,removed:0},dE=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new mE(e,this)}registry;atom;state=uE.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 uE.uninitialized:return`uninitialized`;case uE.stale:return`stale`;case uE.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&lE.waitingForValue)!==0;)this.build();return this._value}build(){this.disposeLifetime(),this.invalidatedDuringBuild=!1;let e=pE(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&lE.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.failed=!1,this.state=uE.valid):this.setValue(t)),e.failure!==iE)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!==uE.valid)throw e;return t.failure===iE&&(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&lE.initialized)===0?In():Ln(this._value)}setInitialValue(e){if((this.state&lE.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=uE.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&lE.initialized)!==0;if(this.state=uE.valid,n&&this.atom.equals(this._value,e)){t&&this.invalidateChildren();return}this._value=e;let r=iE;try{this.invalidateChildren()}catch(e){r=e}if(this.listeners.size>0)try{this.announce()}catch(e){r===iE&&(r=e)}if(r!==iE)throw r}announce(){gE.phase===hE.collect?gE.notify.add(this):this.notify()}invalidate(){if(this.state===uE.valid){this.state=uE.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&gE.phase!==hE.collect?this.build():this.propagate()}propagate(){gE.phase===hE.collect?(this.building&&(this.invalidatedDuringBuild=!0),gE.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let e=iE;for(let t of Array.from(this.children))if(t.affectedBy(this))try{t.invalidate()}catch(t){e===iE&&(e=t)}if(e!==iE)throw e}affectedBy(e){if(this.state===uE.valid)return!0;let t=this.lifetime?.reads;return t===void 0?this.isObserved&&e.state===uE.valid:t.has(e)}notify(){gE.phase===hE.commit&&gE.notify.delete(this),aE(this.listeners,rE)}disposeLifetime(){let e=this.lifetime;e!==void 0&&(this.lifetime=void 0,e.dispose())}remove(){let e=this.isObserved;this.state=uE.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let t=Array.from(this.parents);this.parents.clear(),aE(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)}}},fE={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){return this.disposed?this.node.registry.get(e):this.node.readTracked(e,this)},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return Nf;switch(n._tag){case`Initial`:return Nf;case`Failure`:return nu(n.cause);case`Success`:return B(n.value)}},resultOnce(e,t){return Mf(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n(mS(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n(mS(e)))},{immediate:!1});return V(i)})},setResult(e,t){return this.disposed?Nf:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag===`None`?Nf:B(t.value)},someOnce(e){return Mf(t=>{let n=this.once(e);if(zn(n))return t(B(n.value));let r=this.node.registry.subscribe(e,e=>{Rn(e)||(r(),t(B(e.value)))},{immediate:!1});return V(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?In():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?sT:oT(n=>V(()=>{this.subscribe(e,e=>sC(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(_T(tS),pT(e=>e._tag===`Success`?B(e.value):Pf(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,aE(e.reverse(),rE)}},pE=e=>{function t(n){return t.disposed||t.isFn?e.registry.get(n):e.readTracked(n,t)}return Object.setPrototypeOf(t,fE),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=iE,t},mE=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()}},hE={disabled:0,collect:1,commit:2},gE={phase:hE.disabled,depth:0,stale:[],notify:new Set};function _E(e){let t=gE.phase;gE.phase=hE.collect,gE.depth++;let n=iE;try{e()}catch(e){n=e}if(gE.depth===1){let{notify:e,stale:t}=gE,r=0;do{for(gE.phase=hE.collect;r<t.length;r++)try{vE(t[r])}catch(e){n===iE&&(n=e)}gE.phase=hE.commit;for(let t of e)try{t.notify()}catch(e){n===iE&&(n=e)}}while(r<t.length);gE.stale=[],e.clear()}if(gE.depth--,gE.phase=t,n!==iE)throw n}function vE(e){if(e.state===uE.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=uE.stale,e.disposeLifetime()}e.value()}var yE=`~effect/reactivity/Atom`,bE=e=>F(e,yE),xE=`~effect/reactivity/Atom/Writable`,SE=a(2,(e,t)=>{let n=mi(t),r=xi(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Fi(n):void 0})}),CE=SE(0),wE={[yE]:yE,equals:Object.is,...yt,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},TE={...wE,atom(e,t){let n=NE(e,t);return kE(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)=>EE(this,e,t):EE(this,e,t)},pull(e,t){let n=CE(IE(0));return eD(n,kE(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?RE(r,$E(r,n,e,t),nS(!0),a.value):dS(a,i)}))},subscriptionRef(e){return GE(CE(kE(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 VT(i)?i:RE(t,i,nS(!0),r.value)})),(e,t)=>WE(e,t,pS(e(this))))}},EE=(e,t,n)=>{let[r,i,a]=QE(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return Sf(i)?Xae(i,n.reactivityKeys):vT(i,ET(n.reactivityKeys))}:t,n);return AE(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):dS(i,n)},i)},DE={...wE,[xE]:xE},OE=e=>xE in e,kE=(e,t)=>{let n=Object.create(wE);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},AE=(e,t,n)=>{let r=Object.create(DE);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function jE(e,t){e.setSelf(t)}var ME=(e,t)=>{let n=NE(e,t);return`~effect/reactivity/Atom`in n?n:kE(n)},NE=(e,t)=>{if(typeof e==`function`&&!Sf(e)&&!tT(e)){let n=e;return function(e,r){let i=n(e);switch(typeof i){case`function`:case`object`:return i===null?i:PE in i?LE(e,i,t,r):FE in i?HE(e,i,t,r):i;default:return i}}}return Sf(e)?function(n,r){return LE(n,e,t,r)}:tT(e)?function(n,r){return HE(n,e,t,r)}:IE(e)},PE=`~effect/Effect`,FE=`~effect/Stream`,IE=e=>AE(function(t){return e},jE),LE=(e,t,n,r)=>RE(e,t,n?.initialValue===void 0?nS():iS(n.initialValue),r,n?.uninterruptible);function RE(e,t,n,r=pr(),i=!1){let a=e.self(),o=yu();e.addFinalizer(()=>{Lp(r)(Tu(o,ou))});let s,c=!1,l=zE(r.pipe(hr(vu,o),hr($T,e.registry),hr(Ki,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 zE(e,t,n,r=!1){if(eu(t)){n(t);return}let i=Lp(e)(t);i.currentDispatcher?.flush();let a=i.pollUnsafe();if(a){n(a);return}let o=i.addObserver(n);function s(){o(),r||i.interruptUnsafe()}return s}function BE(e){let t=e?.memoMap??CE(ME(()=>Mu())),n=e=>bE(t)?e(t):t,r=DT;function i(e){let t=Object.create(TE);t.keepAlive=!1,t.lazy=!0,t.refresh=void 0,t.factory=i;let a=nD(kE(typeof e==`function`?t=>Qu(e(t),r):()=>Qu(e,r)));return t.layer=a,t.read=function(e){let t=e(a);return LE(e,Bf(gp,r=>Fu(t,n(e),r)),{uninterruptible:!0})},t}i.memoMap=t,i.addGlobalLayer=e=>{r=Qu(r,Zu(e,DT))};let a=CE(ME(e=>dp(t=>Fu(DT,n(e),yr(t,vu))).pipe(Kf(yr(wT)))));return i.withReactivity=e=>t=>rD(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 VE=BE();VE.withReactivity;var HE=(e,t,n,r)=>UE(e,t,n?.initialValue===void 0?nS():iS(n.initialValue),r);function UE(e,t,n,r=pr()){let i=e.self();r=hr(r,$T,e.registry);let a=yne(n=>Bf(Vw(t.channel,n),t=>Tf({while:c,body:()=>t,step(t){e.setSelf(iS(See(t),{waiting:!0}))}}))).pipe(Qf(t=>(Yd(t)?f(e.self(),Jn(fS),Bn({onNone:()=>e.setSelf(cS(new ql,{previous:e.self()})),onSome:t=>e.setSelf(iS(t))})):e.setSelf(sS(t,{previous:e.self()})),Af))),o=zE(r.pipe(hr($T,e.registry),hr(Ki,e.registry.scheduler)),a,d,!1);return o!==void 0&&e.addFinalizer(o),i._tag===`Some`?$x(i):lS(n)}var WE=(e,t,n=pr())=>VT(t)?(e.addFinalizer(WT(t).pipe(ST(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return Af}),Rp(n))),Hp(n)(GT(t))):t._tag===`Success`?UE(e,WT(t.value),nS(!0),n):t,GE=(e,t)=>{function n(t,n){let r=t.get(e);VT(r)?Vp(JT(r,n)):rS(r)&&Vp(JT(r.value,n))}return AE(n=>{let r=n(e);return VT(r)||rS(r)?t(n,r):r},n)},KE=function(...e){return e.length===0?qE:qE(...e)},qE=(e,t)=>{let n=CE(IE([0,void 0])),r=t?.initialValue!==void 0;return AE(function(i){i.isFn=!0;let[a,o]=i.get(n);return a===0?r?t.initialValue:In():r?e(o,i):Ln(e(o,i))},function(e,t){fD(()=>{e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})})},JE=Symbol.for(`effect/reactivity/atom/Atom/Reset`),YE=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`),XE=function(...e){return e.length===0?ZE:ZE(...e)},ZE=(e,t)=>{let[n,r]=QE(e,t);return AE(n,r)};function QE(e,t){let n=CE(IE([0,void 0])),r=t?.initialValue===void 0?nS():iS(t.initialValue),i=t?.concurrent?CE(kE(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===YE)return sS(Il(),{previous:t.self()});let l=e(c,t);return PE in l?(o&&(l=Bf(Sne(l,{startImmediately:!0}),e=>{o.add(e);let t=Array.from(o);return e.addObserver(()=>o.delete(e)),Kf(yS(t),e=>e[0])})),RE(t,l,r,a,!1)):UE(t,l,r,a)}function o(e,t){fD(()=>{t===JE?e.set(n,[0,void 0]):t===YE?e.set(n,[e.get(n)[0]+1,YE]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var $E=(e,t,n,r)=>Bf(Kae(typeof n==`function`?n(e):n),n=>{let i=SS().context,a=ti(),o=lp(n,{onFailure(e){return Yd(e)?Qr(a)?B({done:!0,items:a}):U(new ql(`Atom.pull: no items`)):Pf(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=Xr(a,e),a=t),B({done:!1,items:t})}}),s=new Set;return e.addFinalizer(()=>{for(let e of s)e()}),e.once(t),e.subscribe(t,()=>{e.setSelf($x(e.self()));let t;t=zE(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}),eD=(e,t)=>AE(t.read,function(t,n){t.set(e,t.get(e)+1)}),X=typeof WeakRef>`u`||typeof FinalizationRegistry>`u`?e=>{let t=Uw();return function(n){let r=Ww(t,n);if(r._tag===`Some`)return r.value;let i=e(n);return Kw(t,n,i),i}}:e=>{let t=Uw(),n=new FinalizationRegistry(e=>{let n=Ww(t,e);n._tag===`Some`&&n.value.deref()===void 0&&qw(t,e)});return function(r){let i=Ww(t,r).pipe(Yn(e=>e.deref()));if(i._tag===`Some`)return i.value;let a=e(r);return Kw(t,r,new WeakRef(a)),n.register(a,r),a}},tD=a(2,(e,t)=>{function n(n){let r=n(e);return r._tag===`Initial`?lS(n(t)):r}return OE(e)?AE(n,function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):kE(n,e.refresh??function(t){t(e)})}),nD=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),rD=a(e=>bE(e[0]),(e,t,n)=>{let r=CE(OE(e)?AE(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):kE(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=iD(n.initialValueTarget)),r}),iD=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},aD=a(2,(e,t)=>rD(e,n=>t(n(e)))),oD=a(2,(e,t)=>{let n=Fi(mi(t));return rD(e,function(t){let r=setTimeout(()=>t.refresh(e),n);return t.addFinalizer(()=>clearTimeout(r)),t(e)},{initialValueTarget:e})}),sD=a(2,(e,t)=>{let n=Fi(mi(t.staleTime));return rD(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):()=>{uD(r.once(e),n)&&r.refresh(e)})),Rn(r.self())&&t.revalidateOnMount===!1)return i;if(uD(i,n)){let t=!0;r.addFinalizer(()=>{t=!1}),r.registry.schedulerAsync.makeDispatcher().scheduleTask(()=>{t&&uD(r.once(e),n)&&r.refresh(e)},0)}return i},{initialValueTarget:e})}),cD=e=>e._tag===`Success`?Ln(e.timestamp):e._tag===`Failure`?qn(e.previousSuccess,e=>e.timestamp):In(),lD=(e,t,n)=>n-e<t,uD=(e,t)=>{if(e.waiting)return!1;let n=Un(cD(e));return n===void 0?e._tag!==`Initial`:!lD(n,t,Date.now())},dD=e=>{let t=0,n=CE(IE([t,void 0]));return AE(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=Un(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))},fD=_E,pD=(e=>t=>rD(t,n=>(n.once(e),n.subscribe(e,e=>n.refresh(t)),n.subscribe(t,e=>n.setSelf(e)),n.once(t)),{initialValueTarget:t}))(kE(e=>{let t=0;function n(){document.visibilityState===`visible`&&e.setSelf(++t)}return window.addEventListener(`visibilitychange`,n),e.addFinalizer(()=>{window.removeEventListener(`visibilitychange`,n)}),t})),mD=e=>{let t=e.runtime.fn(t=>PT.use(n=>RT(n,e.schema).set(e.key,t))),n=e.runtime.atom(PT.use(t=>RT(t,e.schema).get(e.key)));return AE(e.mode===`async`?r=>{r.mount(t);let i=hS(Vn(()=>{let n=e.defaultValue();return r.set(t,n),n}));return r.subscribe(n,e=>r.setSelf(i(e))),i(r.once(n))}:r=>(r.mount(t),r.subscribe(n,n=>{if(rS(n)){if(zn(n.value))r.setSelf(n.value.value);else{let n=Vn(r.self(),e.defaultValue);r.setSelf(n),r.set(t,n)}}},{immediate:!0}),Vn(r.self(),e.defaultValue)),(n,r)=>{n.set(t,r),n.setSelf(e.mode===`async`?iS(r):r)})},hD=`~effect-atom/atom/Atom/ServerValue`,gD=a(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[hD](e=>t.get(e)):t.get(e)),_D=(e,t)=>()=>{let n=bb(Hb(e),t);return UC((e,t)=>B(Bf(e,e=>n(e))))},vD=`~effect/encoding/Sse/SseError`,yD=class extends ia(`EventTooLarge`){get message(){return`Pending SSE event exceeded the maximum size of ${this.maxEventSize}`}},bD=class extends ia(`SseError`){[vD]=vD;get message(){return this.reason.message}},xD=10485760,SD=e=>UC((t,n)=>V(()=>{let n=[],r,i=wD(e=>{e._tag===`Retry`?r=e:n.push(e)},e),a=Bf(t,e=>{for(let t=0;t<e.length;t++){let n=i.feed(e[t]);if(n!==void 0)return U(n)}return Af});return kf(function e(){if(Zr(n)){let e=n;return n=[],B(e)}return r?U(r):Bf(a,e)})})),CD=(e,t,n)=>jw(SD(t),_D(ED.pipe(Jb(e,DD)),n)());function wD(e,t){let n=t?.maxEventSize??xD,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(TD)&&(i=i.slice(TD.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 bD({reason:new yD({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 kD({duration:ki(parseInt(p,10)),lastEventId:c}))}}var TD=``,ED=q({_tag:$b(`Event`),id:qb(K),event:K,data:K}),DD=u_({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})}),OD=`~effect/encoding/Sse/Retry`,kD=class e extends na(`Retry`){[OD]=OD;static is(e){return F(e,OD)}static filter(t){return e.is(t)?kr(t):Ar(t)}},AD=`~effect/http/HttpBody`,jD=e=>F(e,AD),MD=class{[AD];constructor(){this[AD]=AD}[Ze](){return this.toJSON()}toString(){return Ue(this,{ignoreToString:!0})}},ND=new class extends MD{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},PD=class extends MD{_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??=RD(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}}},FD=(e,t)=>new PD(e,t??`application/octet-stream`,e.length),ID=new TextEncoder,LD=globalThis.Buffer,RD=LD===void 0?e=>ID.encode(e):e=>LD.from(e,`utf8`),zD=(e,t)=>{if(typeof e!=`string`&&(e=e===void 0?``:String(e)),LD!==void 0)return new PD(void 0,t??`text/plain`,LD.byteLength(e,`utf8`),e);let n=ID.encode(e);return new PD(n,t??`text/plain`,n.length,e)},BD=(e,t)=>zD(Gh(Lh(e)),t??`application/x-www-form-urlencoded`),VD=class extends MD{_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}}},HD=e=>new VD(e),UD={"~effect/Ref":{_A:o},...yt,toJSON(){return{_id:`Ref`,ref:this.ref}}},WD=e=>{let t=Object.create(UD);return t.ref=ES(e),t},GD=e=>V(()=>WD(e)),KD=e=>V(()=>e.ref.current),qD=a(2,(e,t)=>V(()=>DS(e.ref,t))),JD=a(2,(e,t)=>V(()=>{let n=e.ref.current;return e.ref.current=t,n})),YD=a(2,(e,t)=>V(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),XD=a(2,(e,t)=>V(()=>{e.ref.current=t(e.ref.current)})),ZD=`~effect/http/HttpClientError`,QD=e=>F(e,ZD),$D=class extends ia(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[ZD]=ZD;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},eO=e=>e.endsWith(`Error`)?e.slice(0,-5):e,tO=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,nO=class extends ia(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return tO(eO(this._tag),this.description,this.methodAndUrl)}},rO=class extends ia(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return tO(eO(this._tag),this.description,this.methodAndUrl)}},iO=class extends ia(`StatusCodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return tO(eO(this._tag),this.description,e)}},aO=class extends ia(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return tO(eO(this._tag),this.description,e)}},oO=class extends ia(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return tO(eO(this._tag),this.description,e)}},sO=class e extends Ux(ZD)({_tag:$b(`HttpError`),kind:Gb([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:W(yx())}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}},cO=e=>e!==`GET`&&e!==`HEAD`&&e!==`OPTIONS`&&e!==`TRACE`,lO=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],uO=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?kh(kh(e,`content-type`),`content-length`):(e=t.contentType===void 0?kh(e,`content-type`):Eh(e,`content-type`,t.contentType),t.contentLength===void 0?kh(e,`content-length`):Eh(e,`content-length`,t.contentLength.toString())),dO=class extends ia(`UrlError`){},fO=(e,t,n)=>jr({try:()=>{let r=new URL(e,pO());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 dO({cause:e})}),pO=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},mO=`~effect/http/HttpClientRequest`,hO={[mO]:mO,...et,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:Re(this.headers),body:this.body.toJSON()}},pipe(){return n(this,arguments)}};function gO(e,t,n,r,i,a){let o=Object.create(hO);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var _O=gO(`GET`,``,Vh,In(),Ch,ND),vO=e=>(t,n)=>bO(_O,{method:e,url:t,...n??void 0}),yO=vO(`GET`),bO=a(2,(e,t)=>{let n=e;return t.method&&(n=xO(n,t.method)),t.url&&(n=EO(n,t.url)),t.headers&&(n=CO(n,t.headers)),t.urlParams&&(n=kO(n,t.urlParams)),t.hash&&(n=jO(n,t.hash)),t.body&&(n=MO(n,t.body)),t.accept&&(n=wO(n,t.accept)),t.acceptJson&&(n=TO(n)),n}),xO=a(2,(e,t)=>gO(t,e.url,e.urlParams,e.hash,e.headers,e.body)),SO=a(3,(e,t,n)=>gO(e.method,e.url,e.urlParams,e.hash,Eh(e.headers,t,n),e.body)),CO=a(2,(e,t)=>gO(e.method,e.url,e.urlParams,e.hash,Dh(e.headers,t),e.body)),wO=a(2,(e,t)=>SO(e,`Accept`,t)),TO=wO(`application/json`),EO=a(2,(e,t)=>{if(typeof t==`string`)return gO(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=Lh(n.searchParams),i=Hn(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,gO(e.method,n.toString(),r,i,e.headers,e.body)}),DO=a(2,(e,t)=>t===``?e:gO(e.method,OO(t,e.url),e.urlParams,e.hash,e.headers,e.body)),OO=(e,t)=>{let n=e.endsWith(`/`),r=t.startsWith(`/`);return n&&r?e+t.slice(1):!n&&!r?e+`/`+t:e+t},kO=a(2,(e,t)=>gO(e.method,e.url,Uh(e.urlParams,t),e.hash,e.headers,e.body)),AO=a(2,(e,t)=>gO(e.method,e.url,Wh(e.urlParams,t),e.hash,e.headers,e.body)),jO=a(2,(e,t)=>gO(e.method,e.url,e.urlParams,Ln(t),e.headers,e.body)),MO=a(2,(e,t)=>gO(e.method,e.url,e.urlParams,e.hash,uO(e.headers,t),t)),NO=a(2,(e,t)=>MO(e,HD(t)));function PO(e){let t=fO(e.url,e.urlParams,Un(e.hash));return Nr(t)?Ln(t.success):In()}var FO=`~effect/http/HttpIncomingMessage`,IO=(e,t)=>{let n=e.headers[`content-type`]??``,r;if(n.includes(`application/json`))try{r=Vp(e.json)}catch{}else if(n.includes(`text/`)||n.includes(`urlencoded`))try{r=Vp(e.text)}catch{}let i={...t,headers:Re(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(i.body=r),i},LO=`~effect/http/HttpClientResponse`,RO=(e,t)=>new zO(e,t),zO=class extends tt{[FO];[LO];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[FO]=FO,this[LO]=LO}toJSON(){return IO(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=PO(this.request);return Rn(e)?``:(e.value.hash=``,e.value.href)}get headers(){return wh(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=oh(this.source.headers.getSetCookie())}get remoteAddress(){return In()}get stream(){return this.source.body?Mae({evaluate:()=>this.source.body,onError:e=>new $D({reason:new aO({request:this.request,response:this,cause:e})})}):Oae(new $D({reason:new oO({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return Bf(this.text,e=>Lf({try:()=>e===``?null:JSON.parse(e),catch:e=>new $D({reason:new aO({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody??=Kf(this.arrayBuffer,e=>new TextDecoder().decode(e))}get urlParamsBody(){return Bf(this.text,e=>Lf({try:()=>Lh(new URLSearchParams(e)),catch:e=>new $D({reason:new aO({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=Df({try:()=>this.source.formData(),catch:e=>new $D({reason:new aO({request:this.request,response:this,cause:e})})}).pipe(wp,Vp)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=Df({try:()=>this.source.arrayBuffer(),catch:e=>new $D({reason:new aO({request:this.request,response:this,cause:e})})}).pipe(wp,Vp),this.arrayBufferBody}pipe(){return n(this,arguments)}},BO=e=>Th({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${Bn(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),VO=`~effect/http/HttpClient`,HO=tr(`effect/HttpClient`),UO=a(2,(e,t)=>WO(n=>t(e.postprocess(n)),e.preprocess)),WO=(e,t)=>{let n=Object.create(GO);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},GO={[VO]:VO,pipe(){return n(this,arguments)},...et,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(lO.map(([e,t])=>[t,function(t,n){return this.execute(vO(e)(t,n))}]))},KO=e=>WO(t=>Bf(t,t=>zf(n=>{let r=ek.get(t),i=r??new AbortController,a=fO(t.url,t.urlParams,Un(t.hash));if(Mr(a))return U(new $D({reason:new rO({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(ga)||n.getRef(JO)(t)){let a=e(t,o,i.signal,n);return r?a:kp(e=>lp(e(a),{onSuccess(e){return $O.register(e,i),B(new tk(e,i))},onFailure(e){return Ul(e)&&i.abort(),Pf(e)}}))}return jp(n.getRef(ZO)(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(Mh),l=n.getRef(YO);for(let e in t.headers)l(e,`request`)&&a.attribute(`http.request.header.${e}`,jh(e,c)?`<redacted>`:t.headers[e]);return t=n.getRef(XO)?CO(t,BO(a)):t,kp(s=>s(e(t,o,i.signal,n)).pipe(Mp(a,{captureStackTrace:!1}),lp({onSuccess:e=>{a.attribute(`http.response.status_code`,e.status);for(let t in e.headers)l(t,`response`)&&a.attribute(`http.response.header.${t}`,jh(t,c)?`<redacted>`:e.headers[t]);return r?B(e):($O.register(e,i),B(new tk(e,i)))},onFailure(e){return!r&&Ul(e)&&i.abort(),Pf(e)}})))})})),B),qO=a(2,(e,t)=>WO(e.postprocess,n=>Kf(e.preprocess(n),t))),JO=Er(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>l}),YO=Er(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>c}),XO=Er(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:c}),ZO=Er(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),QO=e=>Uu(HO)(dp(t=>Kf(e,e=>UO(e,mp(e=>wr(t,e)))))),$O=(()=>{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))}}})(),ek=new WeakMap,tk=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[LO]=LO;[FO]=FO;applyInterrupt(e){return kf(()=>($O.unregister(this.original),Dp(e,()=>V(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return lT(()=>($O.unregister(this.original),vT(this.original.stream,V(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Ze](){return this.original[Ze]()}pipe(){return n(this,arguments)}};({...yt});var nk=`~effect/socket/Socket`,rk=tr(`effect/socket/Socket`),ik=e=>rk.of({[nk]:nk,reader:e.reader,writer:e.writer}),ak=new TextEncoder,ok=`~effect/socket/Socket/CloseEvent`,sk=e=>F(e,ok),ck=`~effect/socket/Socket/SocketError`,lk=e=>F(e,ck),uk=class extends Ux(`effect/socket/Socket/SocketReadError`)({_tag:$b(`SocketReadError`),cause:yx()}){message=`An error occurred during Read`},dk=class extends Ux(`effect/socket/Socket/SocketWriteError`)({_tag:$b(`SocketWriteError`),cause:yx()}){message=`An error occurred during Write`},fk=class extends Ux(`effect/socket/Socket/SocketOpenError`)({_tag:$b(`SocketOpenError`),kind:Gb([`Unknown`,`Timeout`]),cause:yx()}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},pk=class e extends Ux(`effect/socket/Socket/SocketUpgradeError`)({_tag:$b(`SocketUpgradeError`),cause:W(yx())}){static unsupported=()=>U(new gk({reason:new e({})}));get message(){return this.cause===void 0?`Socket does not support TLS upgrade`:`An error occurred during TLS upgrade`}},mk=class extends Ux(`effect/socket/Socket/SocketCloseError`)({_tag:$b(`SocketCloseError`),code:fx,closeReason:W(K)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},hk=Wb([uk,dk,fk,pk,mk]),gk=class extends Y(ck)(`SocketError`,{_tag:$b(`SocketError`),reason:hk}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[ck]=ck;static is(e){return lk(e)}message=this.reason.message},_k=(e,t)=>new gk({reason:new mk({code:e,closeReason:t})}),vk=class extends tr()(`@effect/platform/Socket/WebSocketConstructor`){},yk=(e,t)=>vk.use(n=>xk(vp((typeof e==`string`?B(e):e).pipe(Kf(e=>n(e,t?.protocols))),e=>V(()=>e.close(1e3))),t)),bk=e=>`pause`in e&&typeof e.pause==`function`,xk=(e,t)=>zf(n=>{let r,i=wS(!1),a=n.context,o=H(function*(){let n=yield*gp,a=yield*bu(e,n);`binaryType`in a&&(a.binaryType=`arraybuffer`);let o=bk(a),s=t?.highWaterMark??(o?Sk:void 0),c=a.readyState===1,l=o&&`isPaused`in a&&a.isPaused===!0,u=[],d=0,f,p,m;function h(){o&&!l&&(a.pause(),l=!0)}function g(){o&&l&&(a.resume(),l=!1)}function _(){let e=u;return u=[],d=0,f===void 0&&g(),e}function v(){if(p===void 0||u.length===0)return;let e=p;p=void 0,e(B(_()))}function y(e){u.push(e),s!==void 0&&(d+=typeof e==`string`?ak.encode(e).byteLength:e.byteLength),p!==void 0&&v(),o&&d>=s?h():!o&&!p&&s!==void 0&&d>s&&b(new gk({reason:new uk({cause:Error(`Socket highWaterMark of ${s} bytes exceeded`)})}))}function b(e){if(f===void 0&&(f=e),m!==void 0){let{cleanup:e,resume:t}=m;m=void 0,e(),t(U(f))}if(p!==void 0){let e=p;p=void 0,e(u.length>0?B(_()):U(f))}}function x(e){let t=e.data;if(typeof Blob<`u`&&t instanceof Blob){t.arrayBuffer().then(e=>y(new Uint8Array(e)),e=>{b(new gk({reason:new uk({cause:e})}))});return}y(t instanceof ArrayBuffer?new Uint8Array(t):t)}function S(e){b(new gk({reason:c?new uk({cause:e}):new fk({kind:`Unknown`,cause:e})}))}function C(e){b(_k(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*Su(n,V(()=>{if(b(_k(1006)),a.removeEventListener(`message`,x),a.removeEventListener(`error`,S),a.removeEventListener(`close`,C),o)try{g()}catch{}i.closeUnsafe(),r=void 0})),a.readyState>=2?yield*U(f??_k(1006)):(c||=(yield*Mf(e=>{let t=()=>{m?.resume===e&&(m=void 0,a.removeEventListener(`open`,t),e(Af))},n=()=>a.removeEventListener(`open`,t);return m={resume:e,cleanup:n},a.addEventListener(`open`,t,{once:!0}),V(()=>{m?.resume===e&&(m=void 0),n()})}).pipe(ap({duration:t?.openTimeout??1e4,orElse:()=>U(new gk({reason:new fk({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))})),!0),f===void 0&&d<s&&g(),r=a,i.openUnsafe(),{pull:Mf(e=>u.length>0?e(B(_())):f===void 0?(p=e,V(()=>{p===e&&(p=void 0)})):e(U(f))),upgrade:pk.unsupported})}).pipe(mp(e=>wr(a,e))),s=e=>kf(()=>{let t=r;if(t===void 0)return i.whenOpen(s(e));try{return sk(e)?t.close(e.code,e.reason):t.send(e),Af}catch(e){return U(new gk({reason:new dk({cause:e})}))}}),c=e=>kf(()=>{let t=r;if(t===void 0)return i.whenOpen(c(e));try{for(let n=0;n<e.length;n++)t.send(e[n]);return Af}catch(e){return U(new gk({reason:new dk({cause:e})}))}});return B(ik({reader:o,writer:B({write:s,writeAll:c})}))}),Sk=65536,Ck=new Uint8Array(256);for(let e of"!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")Ck[e.charCodeAt(0)]=1;var wk=new Uint8Array(256);wk[9]=1;for(let e=32;e<=126;e++)wk[e]=1;for(let e=128;e<=255;e++)wk[e]=1;var Tk=tr(`effect/http/HttpServerRequest`),Ek=new WeakSet,Dk=e=>zf(t=>{let n=vr(t.context,Tk);return Ek.add(n.source),e}),Ok=tr(`effect/http/HttpRouter`),kk=e=>e.endsWith(`/`)?e.slice(0,-1):e,Ak=a(2,(e,t)=>(t=kk(t),e===`*`?`${t}/*`:e===`/`?t:t+e)),jk=`~effect/http/HttpRouter/Middleware`,Mk=function(){return arguments.length===0?Nk:Nk(arguments[0],arguments[1])},Nk=(e,t)=>t?.global?Ku(H(function*(){let t=yield*Ok,n=Sf(e)?yield*e:e;yield*t.addGlobalMiddleware(n)})):new Ik(Sf(e)?Gu(Kf(e,e=>ur(new Map([[Fk,e]])))):zu(ur(new Map([[Fk,e]])))),Pk=0,Fk=`effect/http/HttpRouter/MiddlewareFn`,Ik=class e{[jk]={};layerFn;dependencies;constructor(e,t){this.layerFn=e,this.dependencies=t;let n=`effect/http/HttpRouter/Middleware-${++Pk}`;this.layer=Gu(H({self:this},function*(){let e=yield*up(),t=[_r(e,Fk)];if(this.dependencies){let n=yield*Pu,r=yr(e,vu),i=yield*Fu(this.dependencies,n,r);t.push(...Rk(i))}return ur(new Map([[n,t]]))})).pipe(Zu(this.layerFn))}layer;combine(t){return new e(this.layerFn,this.dependencies?Qu(this.dependencies,t.layer):t.layer)}},Lk=new WeakMap,Rk=e=>{let t=Lk.get(e);if(t)return t;let n=ti(),r=0;for(let[t,i]of e.mapUnsafe)t.startsWith(`effect/http/HttpRouter/Middleware-`)&&(n.push(i),i.length>r&&(r=i.length));if(n.length===0)t=[];else{let e=new Set;for(let t=r-1;t>=0;t--)for(let r of n)t<r.length&&e.add(r[t]);t=qr(e).reverse()}return Lk.set(e,t),t};Mk(Dk).layer;var zk={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},Bk=e=>zk[e],Vk=`~effect/http-api/HttpApiSchema/Stream`;function Hk(e){let t=typeof e==`string`?Bk(e):e;return e=>e.annotate({httpApiStatus:t})}var Uk=(e=>Lb.pipe(Hk(e)))(204);function Wk(e){return t=>Lb.pipe(Jb(Ab(t),u_({decode:e.decode,encode:d})))}var Gk=e=>Db(e)&&F(e,Vk),Kk=e=>Gk(e)&&e._tag===`StreamSse`,qk=e=>Gk(e)&&e._tag===`StreamUint8Array`,Jk=`~effect/http-api/HttpApiSchema/WithHeaders`,Yk=`~effect/http-api/HttpApiSchema/WithHeadersValue`,Xk=e=>({[Yk]:Yk,body:e.body,headers:e.headers}),Zk=e=>Db(e)&&F(e,`~effect/http-api/HttpApiSchema/WithHeaders`);function Qk(e,t,n){return Eb(e.ast,{[Jk]:Jk,schema:t,headers:n})}function $k(e,t){return e.annotate({"~httpApiEncoding":{_tag:t._tag,contentType:t.contentType??eA(t._tag)}})}function eA(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 tA(e){return t=>$k(t,{_tag:`FormUrlEncoded`,...e})}function nA(e){return t=>$k(t,{_tag:`Text`,...e})}var rA=e=>{if(k_(e)||k_(by(e)))return!0;let t=e.encoding?.[0].to;return t!==void 0&&k_(t)},iA=jy(`~httpApiEncoding`),aA=jy(`~httpApiWithHeaders`),oA=jy(`httpApiStatus`),sA={_tag:`Json`,contentType:`application/json`},cA={_tag:`FormUrlEncoded`,contentType:`application/x-www-form-urlencoded`};function lA(e){return iA(e)??sA}function uA(e,t){return iA(e)||(cO(t)?sA:cA)}function dA(e){let t=lA(e);if(t._tag===`Multipart`)throw Error(`Multipart is not supported in response`);return t}function fA(e){return oA(e)??200}function pA(e){return Zk(e)?oA(e.ast)??fA(e.schema.ast):fA(e.ast)}function mA(e){return Zk(e)&&iA(e.ast)===void 0?dA(e.schema.ast):dA(e.ast)}function hA(e){return oA(e)??500}function gA(e){return Zk(e)?oA(e.ast)??hA(e.schema.ast):hA(e.ast)}function _A(e){let t=e.toLowerCase().trim(),n=t.indexOf(`;`);return n===-1?t:t.slice(0,n).trim()}var vA=`~effect/http-api/HttpApiEndpoint`;function yA(e){let t=[];for(let{schemas:n}of e.payload.values())t.push(...n);return t}function bA(e){let t=Array.from(e.success);return Zr(t)?t:[Uk]}function xA(e){let t=new Set(e.error),n=e.disableCodecs?o:AA;for(let r of e.middlewares){let e=r;for(let r of e.error)t.add(n(r))}return Array.from(t)}var SA={[vA]:vA,pipe(){return n(this,arguments)},prefix(e){return wA({...CA(this),path:Ak(this.path,e)})},middleware(e){return wA({...CA(this),middlewares:new Set([...this.middlewares,e])})},annotate(e,t){return wA({...CA(this),annotations:hr(this.annotations,e,t)})},annotateMerge(e){return wA({...CA(this),annotations:wr(this.annotations,e)})}},CA=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 wA(e){function t(){}return Object.setPrototypeOf(t,SA),Object.assign(t,e)}var TA=e=>(t,n,r)=>{let i=r?.disableCodecs??!1,a=i?o:Gx;return wA({identifier:t,path:n,method:e,params:EA(r?.params,a),query:EA(r?.query,a),headers:EA(r?.headers,a),payload:DA(r?.payload,e,i),success:kA(r?.success,e,i),error:jA(r?.error,i),annotations:pr(),middlewares:new Set,disableCodecs:i})};function EA(e,t){if(e!==void 0)return Db(e)?t(e):t(q(e))}function DA(e,t,n){let r=new Map;if(e===void 0)return r;let i=Array.isArray(e)?e:Db(e)?[e]:[q(e).pipe(tA())],a=n?o:VA;for(let e of i){let n=uA(e.ast,t),i=_A(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 OA=`effect/http-api/stream/failure`;function kA(e,t,n){if(e===void 0)return new Set;let r=Jr(e);return MA(r,t),new Set(n?r:r.map(AA))}var AA=m(e=>Gk(e)?e:Zk(e)?Qk(e,Gk(e.schema)?e.schema:BA(e.schema,mA(e)),Gx(e.headers)):zA(e));function jA(e,t){if(e===void 0)return new Set;let n=Jr(e);for(let e of n)if(Gk(Zk(e)?e.schema:e))throw Error(`Streaming schemas are not supported in error responses`);return PA(n,gA),new Set(t?n:n.map(AA))}function MA(e,t){let n=!1,r=new Map;for(let i of e){let e=Zk(i)?i.schema:i,a=pA(i);if(Gk(e)){if(FA(e,t),n)throw Error(`Multiple streaming success responses are not supported`);n=!0;let i=NA(r,a);if(i.noContent)throw Error(`Cannot combine no-content and streaming success responses for status: ${a}`);if(i.bufferedContentTypes.has(_A(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=NA(r,a),n=rA(e.ast);if(t.stream!==void 0){if(n)throw Error(`Cannot combine no-content and streaming success responses for status: ${a}`);let e=mA(i);if(_A(e.contentType)===_A(t.stream.contentType))throw Error(`Cannot combine buffered and streaming success responses for status ${a} and content-type: ${e.contentType}`)}n||t.bufferedContentTypes.add(_A(mA(i).contentType)),t.noContent=t.noContent||n}}PA(e,pA)}function NA(e,t){let n=e.get(t);return n===void 0&&(n={bufferedContentTypes:new Set,noContent:!1},e.set(t,n)),n}function PA(e,t){let n=new Map;for(let r of e){let e=t(r),i=aA(r.ast),a=Zk(r)?r.schema:i?.body??r,o=rA(a.ast)?``:_A(Gk(a)?a.contentType:mA(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(Zk(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 FA(e,t){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare streaming success responses`);if(Kk(e)&&IA(e.events.ast))throw Error(`SSE event name is reserved: ${OA}`)}function IA(e){return LA(by(e),new Set)}function LA(e,t){if(t.has(e))return!1;if(t.add(e),F_(e))return e.types.some(e=>LA(e,t));if(I_(e))return LA(e.thunk(),t);if(!P_(e))return!1;let n=e.propertySignatures.find(e=>e.name===`event`);return n!==void 0&&RA(n.type,t)}function RA(e,t){if(t.has(e))return!1;t.add(e);let n=by(e);return n===e?j_(e)?e.literal===OA:F_(e)?e.types.some(e=>RA(e,t)):I_(e)?RA(e.thunk(),t):!1:RA(n,t)}function zA(e){let t=dA(e.ast),n=aA(e.ast);return n===void 0?BA(e,t):e.annotate({"~httpApiWithHeaders":{...n,bodyCodec:BA(n.body,t),headersCodec:Gx(n.headers)}})}function BA(e,t){switch(t._tag){case`Json`:return Wx(e);case`FormUrlEncoded`:return Gx(e);case`Text`:case`Uint8Array`:return e}}function VA(e,t){switch(uA(e.ast,t)._tag){case`Json`:return Wx(e);case`FormUrlEncoded`:return Gx(e);case`Text`:case`Uint8Array`:case`Multipart`:return e}}var HA=TA(`GET`),UA=TA(`POST`),WA=TA(`PUT`),GA=TA(`PATCH`),KA=TA(`DELETE`),qA=`~effect/http-api/HttpApi`,JA={[qA]:qA,pipe(){return n(this,arguments)},add(...e){let t={...this.groups};for(let n of e)st(t,n.identifier,n);return XA({...YA(this),groups:t})},addHttpApi(e){let t={...this.groups};for(let n of Object.keys(e.groups)){let r=e.groups[n];st(t,n,r.annotateMerge(wr(e.annotations,r.annotations)))}return XA({...YA(this),groups:t})},prefix(e){return XA({...YA(this),groups:Hr(this.groups,t=>t.prefix(e))})},middleware(e){return XA({...YA(this),groups:Hr(this.groups,t=>t.middleware(e))})},annotate(e,t){return XA({...YA(this),annotations:hr(this.annotations,e,t)})},annotateMerge(e){return XA({...YA(this),annotations:wr(this.annotations,e)})}},YA=e=>({identifier:e.identifier,groups:e.groups,annotations:e.annotations}),XA=e=>{function t(){}return Object.setPrototypeOf(t,JA),Object.assign(t,e)},ZA=e=>XA({identifier:e,groups:{},annotations:pr()}),QA=(e,t)=>{let n=Object.values(e.groups);for(let r of n){let n=wr(e.annotations,r.annotations);t.onGroup({group:r,mergedAnnotations:n});let i=Object.values(r.endpoints);for(let e of i)(!t.predicate||t.predicate({endpoint:e,group:r}))&&t.onEndpoint({group:r,endpoint:e,middleware:e.middlewares,mergedAnnotations:wr(n,e.annotations),successes:$A(bA(e),pA),errors:$A(xA(e),gA)})}},$A=(e,t)=>{let n=new Map;return e.forEach(r),n;function r(e){if(Gk(Zk(e)?e.schema:e))return;let r=t(e),i=n.get(r);i===void 0?n.set(r,[e]):i.push(e)}},ej=class extends tr()(`effect/http-api/HttpApi/ParseOptions`){},tj=class extends tr()(`effect/http-api/HttpApi/ParamsParseOptions`){},nj=class extends tr()(`effect/http-api/HttpApi/QueryParseOptions`){},rj=class extends tr()(`effect/http-api/HttpApi/HeadersParseOptions`){},ij=class extends tr()(`effect/http-api/HttpApi/PayloadParseOptions`){},aj=class extends tr()(`effect/http-api/HttpApi/SuccessParseOptions`){},oj=class extends tr()(`effect/http-api/HttpApi/ErrorParseOptions`){},sj=e=>{let t=gr(e,ej);return{params:gr(e,tj)??t,query:gr(e,nj)??t,headers:gr(e,rj)??t,payload:gr(e,ij)??t,success:gr(e,aj)??t,error:gr(e,oj)??t}},cj=new Set;function lj(e){if(e===void 0)return cj;let t=ny(e.ast);return P_(t)&&t.indexSignatures.length===0?new Set(t.propertySignatures.map(e=>String(e.name))):void 0}var uj=(e,t)=>H(function*(){let n=yield*up(),r=t.httpClient.pipe(t?.baseUrl===void 0?o:qO(DO(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=sj(s),l=hj(r.path,r.params),u={orElse:Fj},d=new Map;for(let[e,t]of a.entries()){let n=xj(t);for(let[t,r]of n.entries())yj(d,e,t,gj(r,c.error,c.headers))}for(let[e,t]of d.entries()){let n=bj(t);u[e]=e=>Bf(Qf(n(e),t=>Pf(Qte(Pl(new $D({reason:new iO({request:e.request,response:e})})),t))),U)}let f=new Map;for(let[e,t]of o.entries()){let n=xj(t);for(let[t,r]of n.entries())yj(f,e,t,gj(r,c.success,c.headers))}for(let e of Tj(r)){let t=wj(e)?e.schema:e;yj(f,pA(e),t.contentType,Ej(e,c.success,c.headers))}for(let[e,t]of f.entries())u[e]=bj(t);let p=AT(r.params,e=>Cb(e,c.params)),m=yA(r),h=Zr(m)?Cb(cO(r.method)?Lj(m,r.method):Wb(m),c.payload):void 0,g=AT(r.headers,e=>Cb(e,c.headers)),_=AT(r.query,e=>Cb(e,c.query)),v=Array.from(e.middleware,e=>`${e.key}/Client`),y=Wp(function*(e){let a=vO(r.method)(r.path);if(e!==void 0){if(p!==void 0){let t=yield*p(e.params);a=EO(a,l(t))}if(h!==void 0){if(cO(r.method)){if(e.payload instanceof FormData)a=NO(a,e.payload);else{let t=yield*h(e.payload);a=MO(a,t)}}else{let t=yield*h(e.payload);a=AO(a,t)}}if(g!==void 0){let t=yield*g(e.headers);a=CO(a,t)}if(_!==void 0){let t=yield*_(e.query);a=AO(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})}})}),dj=(e,t)=>Bf(HO,n=>fj(e,{...t,httpClient:t?.transformClient?t.transformClient(n):n})),fj=(e,t)=>{let n={};return uj(e,{...t,onGroup({group:e}){e.topLevel||st(n,e.identifier,{})},onEndpoint({endpoint:e,endpointFn:t,group:r}){st(r.topLevel?n:n[r.identifier],e.identifier,t)}}).pipe(qf(n))},pj=(e,t)=>{let n={};return QA(e,{onGroup({group:e}){e.topLevel||st(n,e.identifier,{})},onEndpoint({group:e,endpoint:r,mergedAnnotations:i}){let a=sj(i),o=hj(r.path,r.params),s=r.params===void 0?void 0:Tb(r.params,a.params),c=r.query===void 0?void 0:Tb(r.query,a.query);st(e.topLevel?n:n[e.identifier],r.identifier,e=>{let n=e?.params,i=n===void 0?r.path:o(s===void 0?n:s(n)),a=e?.query===void 0?void 0:c===void 0?e.query:c(e.query),l=a===void 0?Vh:Lh(a);if(t?.baseUrl===void 0){let e=Gh(l);return e===``?i:`${i}?${e}`}let u=new URL(DO(yO(i),t.baseUrl.toString()).url);for(let[e,t]of l.params)t!==void 0&&u.searchParams.append(e,t);return u.toString()})}}),n},mj=/(\/?):(\w+)(\?)?/g,hj=(e,t)=>{if(t===void 0||!e.includes(`:`))return t=>e;let n=lj(t);return t=>e.replace(mj,(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 gj(e,t,n){let r=e.some(e=>Zk(e)||aA(e.ast)!==void 0),i=yb(r?Wb(e.map(e=>vj(e,t,n))):Nj(e),t);return e=>Bf(e.arrayBuffer,r?t=>i({body:t,headers:e.headers}):i)}var _j=q({body:Nb,headers:Nb});function vj(e,t,n){let r=aA(e.ast),i=r===void 0?Zk(e)?{body:e.schema,headers:e.headers,toValue:Xk}:{body:e,headers:Nb,toValue:e=>e.body}:{body:r.bodyCodec,headers:r.headersCodec,toValue:r.transformation.decode},a=yb(Pj(i.body).pipe(Jb(i.body)),t),o=yb(i.headers,n);return _j.pipe(Jb(Zk(e)?e:Ab(e),l_({decode:e=>Cf({body:a(e.body),headers:o(e.headers)}).pipe(Kf(i.toValue),$f(e=>e.issue)),encode:(e,t)=>U(new vg({message:`Decode only schema`},e,t))})))}function yj(e,t,n,r){let i=_A(n),a=e.get(t);a===void 0?e.set(t,[{contentType:i,decode:r}]):a.push({contentType:i,decode:r})}function bj(e){let t=e[0];return e.length===1&&t!==void 0?t.decode:(t,n)=>{let r=_A(t.headers[`content-type`]??``),i=e.find(e=>e.contentType===r);return i===void 0?Sj(t,r,e):i.decode(t,n)}}function xj(e){let t=new Map;for(let n of e){let e=rA((Zk(n)?n.schema:n).ast)?``:_A(mA(n).contentType),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return t}function Sj(e,t,n){let r=Array.from(new Set(n.map(e=>e.contentType))).join(`, `);return U(new $D({reason:new aO({request:e.request,response:e,description:`Unsupported response content-type for status ${e.status}: ${t||`<missing>`}. Expected one of: ${r}`})}))}var Cj=`effect/http-api/stream/failure`,wj=e=>Zk(e);function Tj(e){let t=[];for(let n of e.success)Gk(Zk(n)?n.schema:n)&&t.push(n);return t}function Ej(e,t,n){let r=wj(e),i=r?e.schema:e,a=qk(i)?void 0:{declaration:i,decoder:Dj(i,t)},o=(e,t)=>Kf(up(),n=>yT(a===void 0?e.stream:Oj(e.stream,a.declaration,a.decoder(t)),n));if(!r)return o;let s=yb(e.headers,n);return(e,t)=>Bf(s(e.headers),n=>Kf(o(e,t),e=>Xk({body:e,headers:n})))}function Dj(e,t){let n=Wb([q({id:W(K),event:G(Cj),data:Sx(Wx(Dx(e.error,yx())))}),e.events]),r=CD(n,void 0,t);return e=>e===void 0?r:CD(n,e,t)}function Oj(e,t,n){let r=iT(e.pipe(Wae,Uae(n)),e=>V(()=>{let t;return kf(()=>t===void 0?Bf(e,e=>{for(let n=0;n<e.length;n++){let r=e[n];if(r.event===Cj&&Al(r.data)){if(n===0)return Pf(r.data);t=r.data,e=e.slice(0,n);break}}return B(e)}):Pf(t))}));return t.sseMode===`data`?fT(r,e=>e.data):r}var kj=ex(globalThis.ArrayBuffer,{expected:`ArrayBuffer`}),Aj=kj.pipe(Jb(Tx,u_({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)}}))),jj=kj.pipe(Jb(K,u_({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)}}))),Mj=jj.pipe(Jb(Wb([G(``).pipe(Jb(Pb,u_({decode:()=>void 0,encode:()=>``}))),Pie])));function Nj(e){return Wb(e.map(t));function t(e){return Pj(e).pipe(Jb(e))}}function Pj(e){switch(dA(e.ast)._tag){case`Json`:return O_(by(e.ast))?Mj.pipe(Jb(Nb,u_({decode:e=>e===void 0?null:e,encode:e=>e===null?void 0:e}))):Mj;case`FormUrlEncoded`:return jj.pipe(Jb(Px,u_({decode:e=>Lh(new URLSearchParams(e)),encode:Gh})));case`Uint8Array`:return Aj;case`Text`:return jj}}var Fj=e=>U(new $D({reason:new aO({request:e.request,response:e})})),Ij=pb(jD);function Lj(e,t){return Wb(e.map(e=>zj(e,t)))}var Rj=new WeakMap;function zj(e,t){let n=e.ast,r=Rj.get(n);if(r!==void 0)return r;let i=uA(n,t),a=Ij.pipe(Jb(e,l_({decode(e,t){return U(new vg({message:`Encode only schema`},e,t))},encode(e,t){switch(i._tag){case`Multipart`:return U(new vg({message:`Payload must be a FormData`},e,t));case`Json`:try{return B(zD(JSON.stringify(e),i.contentType))}catch{return U(new gg({expected:`a JSON-serializable request body`},e,t))}case`Text`:return typeof e==`string`?B(zD(e,i.contentType)):U(new gg({message:`Expected a string`},e,t));case`FormUrlEncoded`:return N(e)?B(BD(Lh(e),i.contentType)):U(new gg({message:`Expected a record`},e,t));case`Uint8Array`:return e instanceof Uint8Array?B(FD(e,i.contentType)):U(new gg({message:`Expected a Uint8Array`},e,t))}}})));return Rj.set(n,a),a}var Bj=`~effect/reactivity/AtomRef`,Vj=e=>new Wj(e),Hj={count:0,generate(){return`AtomRef-${this.count++}`}},Uj=class{[Bj];key=Hj.generate();value;constructor(e){this[Bj]=Bj,this.value=e}[ve](e){return ye(this.value,e.value)}[ee](){return z(this.value)}listeners=null;notify(e){let t=this.listeners;for(;t!==null;)t.f(e),t=t.next}subscribe(e){let t={f:e,prev:null,next:this.listeners};return this.listeners&&(this.listeners.prev=t),this.listeners=t,()=>{this.listeners===t&&(this.listeners=t.next),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev)}}map(e){return new Gj(this,e)}},Wj=class extends Uj{prop(e){return new Kj(this,e)}set(e){return ye(e,this.value)?this:(this.value=e,this.notify(e),this)}update(e){return this.set(e(this.value))}},Gj=class e{[Bj];key=Hj.generate();parent;transform;constructor(e,t){this[Bj]=Bj,this.parent=e,this.transform=t}[ve](e){return ye(this.value,e.value)}[ee](){return z(this.value)}get value(){return this.transform(this.parent.value)}subscribe(e){let t=this.transform(this.parent.value);return this.parent.subscribe(n=>{let r=this.transform(n);ye(r,t)||(t=r,e(r))})}map(t){return new e(this,t)}},Kj=class e{[Bj];key=Hj.generate();previous;parent;_prop;constructor(e,t){this[Bj]=Bj,this.parent=e,this._prop=t,this.previous=e.value[t]}[ve](e){return ye(this.value,e.value)}[ee](){return z(this.value)}get value(){return this.parent.value&&this._prop in this.parent.value&&(this.previous=this.parent.value[this._prop]),this.previous}subscribe(e){let t=this.value;return this.parent.subscribe(n=>{if(!n||!(this._prop in n))return;let r=n[this._prop];ye(r,t)||(t=r,e(r))})}map(e){return new Gj(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}},qj=class extends tr()(`effect/workers/Transferable/Collector`){},Jj=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return qj.of({addAllUnsafe:t,addAll:e=>V(()=>t(e)),readUnsafe:n,read:V(n),clearUnsafe:r,clear:V(r)})},Yj=Wb([class extends Ux(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:$b(`WorkerSpawnError`),message:K,cause:W(yx())}){},class extends Ux(`effect/workers/WorkerError/WorkerSendError`)({_tag:$b(`WorkerSendError`),message:K,cause:W(yx())}){},class extends Ux(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:$b(`WorkerReceiveError`),message:K,cause:W(yx())}){},class extends Ux(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:$b(`WorkerUnknownError`),message:K,cause:W(yx())}){}]),Xj=`~effect/PrimaryKey`,Zj=`~effect/rpc/RpcSchema/StreamSchema`;function Qj(e){return F(e,Zj)}function $j(e){return Qj(e)?Ln({success:e.success,error:e.error}):In()}var eM=pb(tT);function tM(e,t){return Eb(eM.ast,{[Zj]:Zj,success:e,error:t})}var nM=`~effect/rpc/Rpc`,rM={[nM]:nM,pipe(){return n(this,arguments)},setSuccess(e){return iM({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return iM({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return iM({_tag:this._tag,payloadSchema:Db(e)?e:q(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return iM({_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 iM({_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 iM({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:hr(this.annotations,e,t)})},annotateMerge(e){return iM({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:wr(this.annotations,e)})}},iM=e=>{function t(){}return Object.setPrototypeOf(t,rM),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},aM=(e,t)=>{let n=t?.success??Lb,r=t?.error??Mb,i=t?.defect??yx(),a;return a=t?.primaryKey?class extends Bie(`effect/rpc/Rpc/${e}`)(t.payload){[Xj](){return t.primaryKey(this)}}:Db(t?.payload)?t?.payload:t?.payload?q(t?.payload):Lb,iM({_tag:e,payloadSchema:a,successSchema:t?.stream?tM(n,r):n,errorSchema:t?.stream?Mb:r,defectSchema:i,annotations:pr(),middlewares:new Set})},oM=new WeakMap,sM=e=>{if(oM.has(e))return oM.get(e);let t=e,n=new Set([t.errorSchema]),r=$j(t.successSchema);zn(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=Nx(zn(r)?Lb:t.successSchema,Wb([...n]),t.defectSchema);return oM.set(e,i),i},cM=`~effect/rpc/Rpc/Wrapper`,lM=e=>cM in e,uM=`~effect/rpc/RpcClientError`,dM=class extends Ux(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:$b(`RpcClientDefect`),message:K,cause:yx()}){},fM=class extends Ux(uM)({_tag:$b(`RpcClientError`),reason:Wb([Yj,hk,sO,dM])}){[uM]=uM;get message(){return`${this.reason._tag}: ${this.reason.message}`}},pM=e=>e,mM={_tag:`Ping`},hM=Wx,gM,_M=e=>(gM??=new TextDecoder).decode(e),vM=class extends tr()(`effect/rpc/RpcSerialization`){},yM=vM.of({contentType:`application/json`,includesFraming:!1,codecFor:hM,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e==`string`?e:_M(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),bM=e=>kf(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>dp(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),Af});return Kf(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return H(function*(){t.add(e),r.set(e,i);let a=n.get(e);if(a){n.delete(e);for(let[e,t]of a)yield*pp(kf(()=>i(e)),t)}return yield*Cp(Nf,()=>(t.delete(e),r.delete(e),Af))})}}))}),xM=0,SM=Wp(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>xM++),s=yield*up(),c=yr(s,vu),l=new Map,u=!1;yield*Su(c,zf(e=>(u=!0,d(au(e.id)))));let d=Wp(function*(e){for(let[t,n]of l)l.delete(t),n._tag===`Queue`?yield*e._tag===`Success`?fC(n.queue):uC(n.queue,e.cause):n.resume(e)}),f=e=>{let r=Qj(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?wh(s.headers):Ch,l=s?.context??pr();if(!r){let r=t=>p(e,a,t,e.payloadSchema.make(o),c,l,s?.discard??!1);return i?r(void 0):jp(`${n}.${e._tag}`,{attributes:t.spanAttributes},r)}let u=m(e,a,e.payloadSchema.make(o),c,s?.streamBufferSize??16,l);return s?.asQueue?u:dT(Kf(u,uT))}},p=(e,n,r,i,s,c,d)=>zf(f=>{if(u)return Tp;let p=a(),m=n(e=>t.onFromClient({message:e,context:c,discard:d}),{_tag:`Request`,id:p,tag:e._tag,payload:i,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:Oh(f.getRef(wM),s)});if(d)return m;let h;return Dp(Mf(t=>{let n={_tag:`Effect`,rpc:e,context:c,resume(e){t(e),h&&!h.pollUnsafe()&&f.currentDispatcher.scheduleTask(()=>{h.interruptUnsafe(f.id)},0)}};l.set(p,n),h=m.pipe(r?Mp(r,{captureStackTrace:!1}):o,Lp(f.context)),h.addObserver(e=>{if(e._tag===`Failure`)return t(e)})}),e=>(l.delete(p),Hf(bS(h),g(p,Array.from(e),c))))}),m=Wp(function*(e,r,s,c,d,f){if(u)return yield*Tp;let p=i?void 0:yield*xne(`${n}.${e._tag}`,{attributes:t.spanAttributes}),m=SS(),h=a(),_=vr(m.context,vu),v=yield*iC(d);return yield*xu(_,e=>(mC(v),l.has(h)?(l.delete(h),g(h,cu(e)?Array.from(Wl(e.cause)):[],f)):Af)),l.set(h,{_tag:`Queue`,rpc:e,queue:v,scope:_,context:f}),yield*r(e=>t.onFromClient({message:e,context:f,discard:!1}),{_tag:`Request`,id:h,tag:e._tag,payload:s,...p?{traceId:p.traceId,spanId:p.spanId,sampled:p.sampled}:{},headers:Oh(m.getRef(wM),c)}).pipe(p?Mp(p,{captureStackTrace:!1}):o,Sp(e=>uC(v,e)),Ep,Pp(_,{startImmediately:!0})),v}),h=e=>{let t=[];for(let n of e.middlewares.values()){let e=_r(s,`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},g=(e,n,r)=>Mf(i=>{let a=SS();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r,discard:!1}).pipe(rp(1e3),Lp(a.context)).addObserver(()=>{i(Af)})}),_=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=l.get(n);return!i||i._tag!==`Queue`?Af:cC(i.queue,e.values).pipe(r?Bf(()=>t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context,discard:!1})):o,Qf(e=>uC(i.queue,e)))}case`Exit`:{let t=e.requestId,n=l.get(t);return n?(l.delete(t),n._tag===`Effect`?(n.resume(e.exit),Af):e.exit._tag===`Success`?fC(n.queue):uC(n.queue,e.exit.cause)):Af}case`Defect`:return d(iu(e.defect));case`ClientEnd`:return Af}},v;if(t.flatten){let t=new Map;v=function(n,r,i){let a=t.get(n);return a||(a=f(e.requests.get(n)),t.set(n,a)),a(r,i)}}else v={},e.requests.forEach(e=>{st(v,e._tag,f(e))});return{client:v,write:_}}),CM=0,Qae=Wp(function*(e,t){let n=CM++,{codecFor:r,run:i,send:a,supportsAck:o,supportsTransferables:s}=yield*TM,c=$ae(r),l=die(r(yx())),u=new Map,d=e=>u.has(e)?(u.delete(e),a(n,{_tag:`Interrupt`,requestId:e})):Af,{client:f,write:p}=yield*SM(e,{...t,supportsAck:o,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),i=s?Jj():void 0,o=SS(),l={rpc:r,context:i?hr(o.context,qj,i):o.context,schemas:c(r)};return u.set(t.id,l),l.schemas.encodePayload(t.payload).pipe(pp(l.context),ep,Bf(e=>a(n,{...t,id:t.id,payload:e,headers:Object.entries(t.headers)},i&&i.readUnsafe())))}case`Ack`:return u.get(t.requestId)?a(n,{_tag:`Ack`,requestId:t.requestId}):Af;case`Interrupt`:return d(t.requestId);case`Eof`:return Af}}});return yield*i(n,e=>{switch(e._tag){case`Chunk`:{let t=pM(e.requestId),n=u.get(t);if(!n||Rn(n.schemas.decodeChunk))return Af;let r=n.schemas.decodeChunk.value;return kp(i=>i(r(e.values).pipe(pp(n.context),ep,Bf(e=>p({_tag:`Chunk`,clientId:0,requestId:t,values:e})))).pipe(Sp(e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:nu(e)}).pipe(Hf(Ul(e)?Af:np(d(t))))),une(e=>!Ul(e),()=>Af)))}case`Exit`:{let t=pM(e.requestId),n=u.get(t);return n?(u.delete(t),n.schemas.decodeExit(e.exit).pipe(pp(n.context),ep,lp({onSuccess:e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:nu(e)})}))):Af}case`Defect`:return p({_tag:`Defect`,clientId:0,defect:l(e.defect)});case`ClientProtocolError`:{let t=ru(e.error);return wf(Array.from(u.keys()),e=>p({_tag:`Exit`,clientId:0,requestId:e,exit:t}))}default:return Af}}).pipe(Qf(qp),Ep,Fp),f}),$ae=e=>{let t=new WeakMap;return n=>{let r=t.get(n);return r===void 0?(r={decodeChunk:qn($j(n.successSchema),t=>yb(e(Hb(t.success)))),encodePayload:wb(e(n.payloadSchema)),decodeExit:yb(e(sM(n)))},t.set(n,r),r):r}},wM=Er(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>Ch}),TM=class extends tr()(`effect/rpc/RpcClient/Protocol`){static make=bM},eoe=e=>TM.make(Wp(function*(t,n){let r=yield*rk,i=yield*vM,a=yield*vne(roe),s=new Map,c=yield*r.writer,l=i.makeUnsafe(),u=yield*noe(kf(()=>c.write(l.encode(mM)))),f,p=e=>wf(n,n=>t(n,e)),m=e=>(f=e,p({_tag:`ClientProtocolError`,error:e})),h=e=>{try{let n=l.decode(e);if(n.length===0)return Af;let r=0;return Tf({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return u.onPong(),Af;if(Object.hasOwn(e,`requestId`)){let n=e.requestId,r=s.get(n);if(r!==void 0)return e._tag===`Exit`&&s.delete(n),t(r,e)}return p(e)},step:d})}catch(e){return p({_tag:`ClientProtocolError`,error:new fM({reason:new dM({message:`Error decoding message`,cause:e})})})}};return yield*kf(()=>(l=i.makeUnsafe(),u.reset(),H(function*(){let{pull:e}=yield*r.reader;for(f=void 0,zn(a)&&(yield*a.value.onConnect);;){let t=yield*e;for(let e=0;e<t.length;e++)yield*h(t[e])}}).pipe(_p,sp(Bf(u.timeout,()=>U(new gk({reason:new uk({cause:Error(`ping timeout`)})}))))))).pipe(zn(a)?xp(a.value.onDisconnect):o,dne(t=>{let n=Vl(t),r=Nr(n),i=new fM({reason:r?n.success.reason:new dM({message:`Unknown socket error`,cause:Bl(t)})});return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?(e.onTransientError?.(i)??Af).pipe(pne({log:!0,message:`RpcClient onTransientError hook failed`})):m(i)}),fne(e?.retryPolicy??toe,e=>m(new fM({reason:e.reason}))),Dne({module:`RpcClient`,method:`makeProtocolSocket`}),Fp),{send(e,t){if(f)return U(f);t._tag===`Request`&&s.set(t.id,e);let n=l.encode(t);return n===void 0?Af:ep(c.write(n))},supportsAck:!0,supportsTransferables:!1,codecFor:i.codecFor}})),toe=uf([ff(500,1.5),pf(5e3)]),noe=Wp(function*(e){let t=!0,n=wS();return yield*kf(()=>t?(t=!1,e):n.open).pipe(hne(`5 seconds`),np,Ap,Ep,Fp),{timeout:n.await,reset:()=>{t=!0,n.closeUnsafe()},onPong:()=>{t=!0}}}),roe=class extends tr()(`effect/rpc/RpcClient/ConnectionHooks`){},ioe=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),EM=t(((e,t)=>{t.exports=ioe()})),Z=e(EM(),1),aoe=Z.use,DM=Z.useLayoutEffect;function ooe(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 soe(e){let t=Z.useRef(null);return Z.useImperativeHandle(e,()=>t.current,[]),t}function OM(e){if(URL.canParse)return URL.canParse(e);try{return new URL(e),!0}catch{return!1}}function kM(e){return e[e.length-1]}function AM(e,t){return typeof e==`function`?e(t):e}var jM=Object.prototype.hasOwnProperty,coe=Object.prototype.propertyIsEnumerable;function loe(e){for(let t in e)if(jM.call(e,t))return!0;return!1}var uoe=()=>Object.create(null),doe=(e,t)=>MM(e,t,uoe);function MM(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=IM(e)&&IM(i);if(!a&&!(PM(e)&&PM(i)))return i;let o=a?e:NM(e);if(!o)return i;let s=a?i:NM(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:jM.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=MM(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function NM(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(!coe.call(e,r))return!1;t.push(r)}return t}function PM(e){if(!FM(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!FM(n)||!n.hasOwnProperty(`isPrototypeOf`))}function FM(e){return Object.prototype.toString.call(e)===`[object Object]`}function IM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function LM(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(!LM(e[r],t[r],n))return!1;return!0}if(PM(e)&&PM(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!LM(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||!LM(e[o],t[o],n)))return!1;return i===a}return!1}function foe(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 poe=/[\x00-\x1f\x7f"<>`{}]/g;function moe(e){return e.replace(poe,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function RM(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 hoe=[`http:`,`https:`,`mailto:`,`tel:`];function zM(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function goe(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+=RM(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=RM(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function _oe(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function voe(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 BM(){throw Error(`Invariant failed`)}function VM(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 HM=4,UM=5;function WM(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 GM(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=WM(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=qM(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=yoe(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=qM(r);e.kind=UM,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=qM(r);e.kind=HM,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)GM(e,t,r,c,i,a,o,s)}function KM(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 qM(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 yoe(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 boe(e,t){let n=qM(`/`),r=new Uint16Array(6),i=[];for(let t of e)GM(!1,r,t,1,n,0,i);for(let e of i)e.sort(KM);t.masksTree=n,t.flatCache=VM(1e3)}function xoe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=JM(e,t.masksTree);return t.flatCache.set(e,r),r}function Soe(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=qM(`/`),GM(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),JM(r,o,n)}function Coe(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=JM(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=XM(a.route)),t.matchCache.set(r,a),a}function woe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Toe(e,t=!1,n){let r=qM(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;GM(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&BM(),o[e.id]=e,c!==0&&e.path){let t=woe(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(KM);return{processedTree:{segmentTree:r,singleCache:VM(1e3),matchCache:VM(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function JM(e,t,n=!1){let r=e.split(`/`),i=Doe(e,r,t,n);if(!i)return null;let[a]=YM(e,r,i);return{route:i.node.route,rawParams:a}}function YM(e,t,n){let r=Eoe(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===HM)break;if(u.kind===UM){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 XM(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Eoe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Doe(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!kM(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&&!$M(l,n))continue;if(i.parse){if(!QM(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==HM&&$M(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===HM||i.kind===2)&&$M(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&&(QM(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Ooe(f,o))return n;$M(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+ZM(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+ZM(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+ZM(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+ZM(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 ZM(e,t){return 2**(e-t-1)}function Ooe(e,t){return e===2**(t-1)-1}function QM(e,t,n){let r,i;try{[r,i]=YM(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 $M(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===HM)>(e.node.kind===HM)||t.node.kind===HM==(e.node.kind===HM)&&t.node.depth>e.node.depth)))}function koe(e){return eN(e.filter(e=>e!==void 0).join(`/`))}function eN(e){return e.replace(/\/{2,}/g,`/`)}function tN(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function nN(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Aoe(e){return nN(tN(e))}function rN(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function joe(e,t,n){return rN(e,n)===rN(t,n)}function Moe({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=eN(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=eN(e)),o=e.split(`/`);o.length>1&&kM(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&&(kM(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?eN(s):s)||`/`;return a&&r&&r.set(a,c),c}function Noe(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 iN(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>aN(e,n)).join(`/`):aN(r,n):r}function Poe({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=WM(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=iN(`_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=iN(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=iN(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function aN(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Foe=`Error preloading route! ☝️`,Ioe=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})),oN=t(((e,t)=>{t.exports=Ioe()})),Q=oN();function Loe({children:e,fallback:t=null}){return(0,Q.jsx)(Z.Fragment,{children:sN()?e:t})}function sN(){return Z.useSyncExternalStore(Roe,()=>!0,()=>!1)}function Roe(){return()=>{}}var cN=Z.createContext(null);function lN(e){return Z.useContext(cN)}var zoe=t((e=>{var t=EM();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})),uN=t(((e,t)=>{t.exports=zoe()})),Boe=t((e=>{var t=EM(),n=uN();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}})),dN=t(((e,t)=>{t.exports=Boe()})),fN=dN();function Voe(e,t){return e===t}function pN(e,t,n=Voe){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,fN.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function mN(e){let t=lN();return Z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Hoe(e){let t=lN(),n=mN(),r=Z.useRef(null);return DM(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function hN(e){let t=Z.useRef(e);return LM(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Uoe(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Woe(e,t,n){if(e?.external)return zM(e.href,n)?void 0:e.href;if(!Zoe(t)&&OM(t))return zM(t,n)?void 0:t}function Goe(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!joe(e.pathname,t.pathname,r))return!1}else{let n=rN(e.pathname,r),i=rN(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!LM(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function Koe(e,t){let n=lN(),r=soe(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:I,...L}=e,R=s,ee=sN(),z=hN(e.search),te=hN(e.params),ne=hN(o),re=Z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,z,te,e.state,e.mask,e.unsafeRelative]),ie=Z.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...re}),r=Xoe(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=Woe(r,R,n.protocolAllowlist);return[r?.href,i,Goe(e,t,ne,n.basepath,ee,i!==void 0)]},[ne,v,ee,re,n,R]),[ae,oe,se]=pN(n.stores.location,ie,Uoe),ce=se?AM(i,{})??qoe:gN,le=se?gN:AM(a,{})??gN,ue=[b,ce.className,le.className].filter(Boolean).join(` `),de=(y||ce.style||le.style)&&{...y,...ce.style,...le.style},fe=Z.useRef(!1),pe=e.reloadDocument||oe||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,he=Z.useCallback(()=>{n.preloadRoute(re).catch(e=>{console.warn(e),console.warn(Foe)})},[n,re]),ge=Z.useCallback(e=>{if(!e){vN(r);return}if(!(e.isIntersecting??pe===`intent`)){e.isIntersecting===!1&&vN(r);return}if(!me){he();return}_N.has(r)||_N.set(r,setTimeout(()=>{_N.delete(r),he()},me))},[he,r,pe,me]);ooe(r,ge,pe!==`viewport`),Z.useEffect(()=>{fe.current||pe===`render`&&(he(),fe.current=!0)},[he,pe]);let _e=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...re,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(oe)return{...L,ref:r,href:oe,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ve=()=>{pe===`intent`&&he()},ye=()=>{pe===`intent`&&vN(r)};return{...L,...ce,...le,href:ae,ref:r,onClick:yN([x,_e]),onBlur:yN([S,ye]),onFocus:yN([C,ge]),onMouseEnter:yN([w,ge]),onMouseLeave:yN([T,ye]),onTouchStart:yN([E,ve]),disabled:!!v,target:_,...de&&{style:de},...ue&&{className:ue},...v&&Joe,...se&&Yoe}}var gN={},qoe={className:`active`},Joe={role:`link`,"aria-disabled":!0},Yoe={"data-status":`active`,"aria-current":`page`},_N=new WeakMap,vN=e=>{clearTimeout(_N.get(e)),_N.delete(e)},yN=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Xoe(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Zoe(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var bN=Z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Koe(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)}),Qoe=e=>e,$oe=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}}}})),xN=t(((e,t)=>{t.exports=$oe()})),ese=t((e=>{var t=EM();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`})),SN=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=ese()})),tse=t((e=>{var t=EM().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}})),CN=t(((e,t)=>{t.exports=tse()})),wN=e(xN(),1);function nse(e){let t=wN.unstable_scheduleCallback(4,e);return()=>wN.unstable_cancelCallback(t)}var TN=Z.createContext(QT({scheduleTask:nse,defaultIdleTTL:400})),EN=new WeakMap;function rse(e,t){let n=EN.get(e);n===void 0&&(n=new WeakMap,EN.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 gD(t,e)}};return n.set(t,i),i}function DN(e,t){let n=rse(e,t);return Z.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}var ON=(e,t)=>{let n=Z.useContext(TN);return t?DN(n,Z.useMemo(()=>aD(e,t),[e,t])):DN(n,e)};function kN(e,t){Z.useEffect(()=>e.mount(t),[t,e])}function AN(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?Z.useCallback(r=>{e.set(t,r);let i=Bp(tE(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(ise):i},[e,t,n.mode]):Z.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var ise=e=>{if(su(e))return e.value;throw Bl(e.cause)},jN=e=>{kN(Z.useContext(TN),e)},MN=(e,t)=>{let n=Z.useContext(TN);return kN(n,e),AN(n,e,t)},NN=e=>{let t=Z.useContext(TN);return kN(t,e),Z.useCallback(()=>{t.refresh(e)},[t,e])},PN=(e,t)=>{let n=Z.useContext(TN);return[DN(n,e),AN(n,e,t)]},FN={suspendOnWaiting:new WeakMap,default:new WeakMap};function ase(e,t,n){let r=n?FN.suspendOnWaiting:FN.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 ose(e,t,n){let r=DN(e,t);if(r._tag===`Initial`||n&&r.waiting)throw ase(e,t,n);return r}var sse=(e,t)=>{let n=ose(Z.useContext(TN),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw Bl(n.cause);return n},IN=e=>{let[,t]=Z.useReducer(e=>e+1,0);return Z.useEffect(()=>e.subscribe(t),[e]),e.value},LN=uN();function RN(){}var zN=Object.freeze([]),BN=Object.freeze({});function VN(e){Z.useEffect(e,zN)}var HN={};function UN(e,t){let n=Z.useRef(HN);return n.current===HN&&(n.current=e(t)),n}var WN=typeof document<`u`?Z.useLayoutEffect:()=>{},GN=e(SN(),1);function cse(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 KN=cse(`https://base-ui.com/production-error`,`Base UI`),lse=19;function qN(e){return lse>=e}var JN=[],YN=void 0;function use(){return YN}function dse(e){JN.push(e)}function XN(e){let t=(t,n)=>{let r=UN(fse).current,i;try{YN=r;for(let e of JN)e.before(r);i=e(t,n);for(let e of JN)e.after(r);r.didInitialize=!0}finally{YN=void 0}return i};return t.displayName=e.displayName||e.name,t}function ZN(e){return Z.forwardRef(XN(e))}function fse(){return{didInitialize:!1}}var pse=qN(19)?hse:gse;function QN(e,t,n,r,i){return pse(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,LN.useSyncExternalStore)(e.subscribe,a,a)}dse({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,LN.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function hse(e,t,n,r,i){let a=use();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 gse(e,t,n,r,i){return(0,fN.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var _se=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 QN(this,e,t,n,r)}},$N={...Z},eP=$N.useInsertionEffect,vse=eP&&eP!==$N.useLayoutEffect?eP:e=>e();function tP(e){let t=UN(yse).current;return t.next=e,vse(t.effect),t.trampoline}function yse(){let e={next:void 0,callback:bse,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function bse(){}var nP=class extends _se{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Z.useDebugValue(e);let n=this;WN(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;WN(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;WN(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){Z.useDebugValue(e);let n=this,r=t!==void 0;WN(()=>{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),QN(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Z.useDebugValue(e);let n=tP(t??RN);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 rP(){return typeof window<`u`}function iP(e){return sP(e)?(e.nodeName||``).toLowerCase():`#document`}function aP(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oP(e){return((sP(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function sP(e){return rP()?e instanceof Node||e instanceof aP(e).Node:!1}function cP(e){return rP()?e instanceof Element||e instanceof aP(e).Element:!1}function lP(e){return rP()?e instanceof HTMLElement||e instanceof aP(e).HTMLElement:!1}function uP(e){return!rP()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof aP(e).ShadowRoot}function dP(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=vP(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function xse(e){return/^(table|td|th)$/.test(iP(e))}function fP(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Sse=/transform|translate|scale|rotate|perspective|filter/,Cse=/paint|layout|strict|content/,pP=e=>!!e&&e!==`none`,mP;function hP(e){let t=cP(e)?vP(e):e;return pP(t.transform)||pP(t.translate)||pP(t.scale)||pP(t.rotate)||pP(t.perspective)||!gP()&&(pP(t.backdropFilter)||pP(t.filter))||Sse.test(t.willChange||``)||Cse.test(t.contain||``)}function wse(e){let t=bP(e);for(;lP(t)&&!_P(t);){if(hP(t))return t;if(fP(t))return null;t=bP(t)}return null}function gP(){return mP??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),mP}function _P(e){return/^(html|body|#document)$/.test(iP(e))}function vP(e){return aP(e).getComputedStyle(e)}function yP(e){return cP(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bP(e){if(iP(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||uP(e)&&e.host||oP(e);return uP(t)?t.host:t}function xP(e){let t=bP(e);return _P(t)?(e.ownerDocument||e).body:lP(t)&&dP(t)?t:xP(t)}function SP(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=xP(e),i=r===e.ownerDocument?.body,a=aP(r);if(i){let e=CP(a);return t.concat(a,a.visualViewport||[],dP(r)?r:[],e&&n?SP(e):[])}return t.concat(r,SP(r,[],n))}function CP(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wP(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function TP(e){return e?.ownerDocument||document}function EP(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var DP=null;globalThis.requestAnimationFrame;var OP=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)}},kP=class e{static create(){return new e}static request(e){return OP.request(e)}static cancel(e){return OP.cancel(e)}currentId=DP;request(e){this.cancel(),this.currentId=OP.request(()=>{this.currentId=DP,e()})}cancel=()=>{this.currentId!==DP&&(OP.cancel(this.currentId),this.currentId=DP)};disposeEffect=()=>this.cancel};function AP(){let e=UN(kP.create).current;return VN(e.disposeEffect),e}var jP=0,MP=class e{static create(){return new e}currentId=jP;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=jP,t()},e)}isStarted(){return this.currentId!==jP}clear=()=>{this.currentId!==jP&&(clearTimeout(this.currentId),this.currentId=jP)};disposeEffect=()=>this.clear};function NP(){let e=UN(MP.create).current;return VN(e.disposeEffect),e}function Tse(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Ese,platform:Dse,maxTouchPoints:Ose}=Tse(),PP=Ese.toLowerCase(),FP=Dse.toLowerCase(),IP=/^i(os$|p)/.test(FP)||FP===`macintel`&&Ose>1,LP=`android`,RP=FP===LP||PP.includes(LP),zP=!IP&&FP.startsWith(`mac`);FP.startsWith(`win`),!RP&&/^(linux|chrome os)/.test(FP);var kse=zP||IP,BP=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!BP&&PP.includes(`firefox`),!BP&&PP.includes(`chrom`);var Ase=kse,VP=/jsdom|happydom/.test(PP);function HP(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function UP(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&uP(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function WP(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var jse=`data-base-ui-focusable`,Mse=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,GP=`ArrowLeft`,KP=`ArrowRight`,Nse=`ArrowUp`,Pse=`ArrowDown`,qP=`data-starting-style`,JP=`data-ending-style`,Fse={[qP]:``},Ise={[JP]:``},YP={transitionStatus(e){return e===`starting`?Fse:e===`ending`?Ise:null}},Lse=`data-open`,Rse=`data-closed`,zse=`data-anchor-hidden`,XP=`data-popup-open`,Bse=`data-pressed`,Vse={[XP]:``},Hse={[XP]:``,[Bse]:``},Use={[Lse]:``},Wse={[Rse]:``},Gse={[zse]:``},ZP={open(e){return e?Vse:null}},QP={open(e){return e?Hse:null}},$P={open(e){return e?Use:Wse},anchorHidden(e){return e?Gse:null}},eF={...$P,...YP},tF=`data-trigger-disabled`;function nF(e,t){if(!cP(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(tF);for(let[,e]of t.entries())if(UP(e,n))return!e.hasAttribute(tF);return!1}function rF(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 Kse(e){return e.matches(`html,body`)}function iF(e){return lP(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function qse(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Mse}`)!=null}function aF(e){return e?e.getAttribute(`role`)===`combobox`&&iF(e):!1}function oF(e){if(!e||VP)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function sF(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function cF(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...cF(e,t.id,n)])}function lF(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 uF(e){e.preventDefault(),e.stopPropagation()}function Jse(e){return`nativeEvent`in e}function dF(e){return e.pointerType===``&&e.isTrusted?!0:RP&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function fF(e){return VP?!1:!RP&&e.width===0&&e.height===0||RP&&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 pF(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Yse(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var mF=Math.min,hF=Math.max,gF=Math.round,_F=Math.floor,vF=e=>({x:e,y:e}),Xse={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function yF(e,t,n){return hF(e,mF(t,n))}function bF(e,t){return typeof e==`function`?e(t):e}function xF(e){return e.split(`-`)[0]}function SF(e){return e.split(`-`)[1]}function CF(e){return e===`x`?`y`:`x`}function wF(e){return e===`y`?`height`:`width`}function TF(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function EF(e){return CF(TF(e))}function Zse(e,t,n){n===void 0&&(n=!1);let r=SF(e),i=EF(e),a=wF(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=AF(o)),[o,AF(o)]}function Qse(e){let t=AF(e);return[DF(e),t,DF(t)]}function DF(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var OF=[`left`,`right`],kF=[`right`,`left`],$se=[`top`,`bottom`],ece=[`bottom`,`top`];function tce(e,t,n){switch(e){case`top`:case`bottom`:return n?t?kF:OF:t?OF:kF;case`left`:case`right`:return t?$se:ece;default:return[]}}function nce(e,t,n,r){let i=SF(e),a=tce(xF(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(DF)))),a}function AF(e){let t=xF(e);return Xse[t]+e.slice(t.length)}function rce(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function jF(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:rce(e)}function MF(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 NF(e,t){return t<0||t>=e.length}function PF(e,t){return IF(e.current,{disabledIndices:t})}function FF(e,t){return IF(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function IF(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&&LF(e,a,r));return a}function LF(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!RF(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function ice(e){return e.visibility===`hidden`||e.visibility===`collapse`}function RF(e,t=e?vP(e):null){return!e||!e.isConnected||!t||ice(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var ace=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function oce(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return uP(n)?n.host:null}function zF(e){for(let t of Array.from(e.children))if(iP(t)===`summary`)return t;return null}function sce(e,t){let n=zF(t);return!!n&&(e===n||UP(n,e))}function BF(e){let t=e?iP(e):``;return e!=null&&e.matches(ace)&&(t!==`summary`||e.parentElement!=null&&iP(e.parentElement)===`details`&&zF(e.parentElement)===e)&&(t!==`details`||zF(e)==null)&&(t!==`input`||e.type!==`hidden`)}function VF(e){if(!BF(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=oce(t)){let n=t!==e,r=iP(t)===`slot`;if(t.hasAttribute(`inert`)||n&&iP(t)===`details`&&!t.open&&!sce(e,t)||t.hasAttribute(`hidden`)||!r&&!cce(t,n))return!1}return!0}function cce(e,t){let n=vP(e);return t?n.display!==`none`:RF(e,n)}function HF(e){let t=e.tabIndex;if(t<0){let t=iP(e);if(t===`details`||t===`audio`||t===`video`||lP(e)&&e.isContentEditable)return 0}return t}function UF(e){if(iP(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function WF(e,t){let n=UF(e);if(!n)return!0;let r=t.find(e=>{let t=UF(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=UF(e);return t?.name===n.name&&t.form===n.form})===n}function GF(e){if(lP(e)&&iP(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return lP(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function KF(e,t){GF(e).forEach(e=>{BF(e)&&t.push(e),KF(e,t)})}function qF(e,t,n){GF(e).forEach(e=>{lP(e)&&e.matches(t)&&n.push(e),qF(e,t,n)})}function JF(e){return VF(e)&&HF(e)>=0}function YF(e){let t=[];return KF(e,t),t.filter(VF)}function XF(e){let t=YF(e);return t.filter(e=>HF(e)>=0&&WF(e,t))}function ZF(e,t){let n=XF(e),r=n.length;if(r===0)return;let i=HP(TP(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function QF(e){return ZF(TP(e).body,1)||e}function $F(e){return ZF(TP(e).body,-1)||e}function eI(e,t){if(!e)return null;let n=XF(TP(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 tI(e){return eI(e,1)}function nI(e){return eI(e,-1)}function rI(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!UP(n,r)}function iI(e){XF(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function aI(e){let t=[];qF(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 oI={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},sI={...oI,position:`fixed`,top:0,left:0},cI={...oI,position:`absolute`},lI=Z.forwardRef(function(e,t){let[n,r]=Z.useState();WN(()=>{Ase&&BP&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Q.jsx)(`span`,{...e,ref:t,style:sI,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function uI(e,t,n,r){let i=UN(fI).current;return pI(i,e,t,n,r)&&hI(i,[e,t,n,r]),i.callback}function dI(e){let t=UN(fI).current;return mI(t,e)&&hI(t,e),t.callback}function fI(){return{callback:null,cleanup:null,refs:[]}}function pI(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function mI(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function hI(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 gI(e){if(!Z.isValidElement(e))return null;let t=e,n=t.props;return(qN(19)?n?.ref:t.ref)??null}function _I(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function vI(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 yI(e,t){return typeof e==`function`?e(t):e}function bI(e,t){return typeof e==`function`?e(t):e}var xI={};function SI(e,t,n,r,i){if(!n&&!r&&!i&&!e)return wI(t);let a=wI(e);return t&&(a=TI(a,t)),n&&(a=TI(a,n)),r&&(a=TI(a,r)),i&&(a=TI(a,i)),a}function CI(e){if(e.length===0)return xI;if(e.length===1)return wI(e[0]);let t=wI(e[0]);for(let n=1;n<e.length;n+=1)t=TI(t,e[n]);return t}function wI(e){return kI(e)?{...AI(e,xI)}:EI(e)}function TI(e,t){return kI(t)?AI(t,e):DI(e,t)}function EI(e){let t={...e};for(let e in t){let n=t[e];OI(e,n)&&(t[e]=MI(n))}return t}function DI(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=_I(e.style,r);break;case`className`:e[n]=PI(e.className,r);break;default:e[n]=OI(n,r)?jI(e[n],r):r}}return e}function OI(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 kI(e){return typeof e==`function`}function AI(e,t){return kI(e)?e(t):e??xI}function jI(e,t){return t?e?(...n)=>{let r=n[0];if(FI(r)){let i=r;NI(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:MI(t):e}function MI(e){return e&&((...t)=>{let n=t[0];return FI(n)&&NI(n),e(...t)})}function NI(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function PI(e,t){return t?e?t+` `+e:t:e}function FI(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function II(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=BI(r));let i=LI(t,n,r);if(n.enabled===!1)return null;let a=n.state??BN;return VI(e,r,i,a)}function LI(e,t,n){let{className:r,style:i}=e,{state:a=BN,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?yI(r,a):void 0,d=l?bI(i,a):void 0,f=l?vI(a,c):BN,p=l&&s?RI(s):void 0,m=l?_I(f,p)??{}:BN;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?dI([m.ref,gI(n),...o]):uI(m.ref,gI(n),o):uI(null,null)),l?(u!==void 0&&(m.className=PI(m.className,u)),d!==void 0&&(m.style=_I(m.style,d)),m):BN}function RI(e){return Array.isArray(e)?CI(e):SI(void 0,e)}var zI=Symbol.for(`react.lazy`);function BI(e){if(e?.$$typeof!==zI)return e;let t=Z.Children.toArray(e)[0];return Z.isValidElement(t)?t:e}function VI(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=SI(n,t.props);return e.ref=n.ref,Z.cloneElement(t,e)}if(e&&typeof e==`string`)return HI(e,n);throw Error(KN(8))}function HI(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 UI(e){return qN(19)?e:e?`true`:void 0}function WI(e){return e==null?e:`current`in e?e.current:e}var GI=null;function KI(e){if(!GI){let e=[];GI=e,queueMicrotask(()=>{GI=null,GN.flushSync(()=>{for(let t of e)t()})})}GI.push(e)}function qI(e,t=!1,n=!1){let r=AP();return tP((i,a=null)=>{r.cancel();let o=WI(e);if(o==null)return;let s=o,c=()=>{if(!n){GN.flushSync(i);return}KI(()=>{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=qP;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 JI(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=tP(a),s=qI(r,n,i);Z.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var YI={style:{transition:`none`}},XI=`data-base-ui-click-trigger`,ZI=`data-base-ui-swipe-ignore`,QI=`data-swipe-ignore`,$I=`[${ZI}]`,eL=`[${QI}]`,tL={fallbackAxisSide:`none`},nL={fallbackAxisSide:`end`},rL={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function iL(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var aL=0;function oL(e,t=`mui`){let[n,r]=Z.useState(e),i=e||n;return Z.useEffect(()=>{n??(aL+=1,r(`${t}-${aL}`))},[n,t]),i}var sL=$N.useId;function cL(e,t){if(sL!==void 0){let n=sL();return e??(t?`${t}-${n}`:n)}return oL(e,t)}var lL=Z.createContext(void 0);function uL(e=!1){let t=Z.useContext(lL);if(t===void 0&&!e)throw Error(KN(16));return t}function dL(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 fL(e,t,{detail:n=0}={}){e.dispatchEvent(new(aP(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function pL(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),s=uL(!0),c=a??s!==void 0,{props:l}=dL({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=Z.useCallback(()=>{let e=o.current;mL(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return WN(u,[u]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return SI({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(NI(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=mL(r),s=!i&&hL(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(),fL(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),fL(r,e)))},onKeyUp(e){if(!t){if(NI(e),a?.(e),e.target===e.currentTarget&&i&&c&&mL(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),fL(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:tP(e=>{o.current=e,u()})}}function mL(e){return lP(e)&&e.tagName===`BUTTON`}function hL(e){return lP(e)&&e.tagName===`A`&&!!e.href}var gL=`none`,_L=`trigger-press`,vL=`trigger-hover`,yL=`trigger-focus`,bL=`outside-press`,xL=`item-press`,SL=`close-press`,CL=`focus-out`,wL=`escape-key`,TL=`list-navigation`,EL=`cancel-open`,DL=`sibling-open`,OL=`disabled`,kL=`missing`,AL=`initial`,jL=`imperative-action`,ML=`window-resize`;function NL(e,t,n,r){let i=!1,a=!1,o=r??BN;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 PL(e){return`data-base-ui-${e}`}var FL=Z.createContext(null),IL=()=>Z.useContext(FL),LL=PL(`portal`);function RL(e={}){let{ref:t,container:n,componentProps:r=BN,elementProps:i}=e,a=cL(),o=IL()?.portalNode,[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=tP(e=>{e!==null&&u(e)}),f=Z.useRef(null);WN(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(sP(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=II(`div`,r,{ref:[t,d],props:[{id:a,[LL]:``},i]}),m=s&&p?GN.createPortal(p,s):null;return{node:l,nodeId:Z.isValidElement(p)?p.props.id:void 0,subtree:m}}var zL=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}=RL({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&&rI(e)&&(e.type===`focusin`?v.current&&=(aI(l),!1):(iI(l),v.current=!0))}return wP(EP(l,`focusin`,e,!0),EP(l,`focusout`,e,!0))},[l,y]),WN(()=>{l&&b===!0&&v.current&&(aI(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)(FL.Provider,{value:S,children:[x&&l&&(0,Q.jsx)(lI,{"data-type":`outside`,ref:f,onFocus:e=>{rI(e,l)?m.current?.focus():$F(g?g.domReference:null)?.focus()}}),x&&l&&(0,Q.jsx)(`span`,{role:s,"aria-owns":u,style:rL}),l&&GN.createPortal(a,l),x&&l&&(0,Q.jsx)(lI,{"data-type":`outside`,ref:p,onFocus:e=>{rI(e,l)?h.current?.focus():(QF(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,NL(`focus-out`,e.nativeEvent)))}})]})]})}),BL=Z.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=RL({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Q.jsxs)(Z.Fragment,{children:[l,c&&GN.createPortal(n,c)]})});function VL(e){let t=UN(HL,e).current;return t.next=e,WN(t.effect),t}function HL(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function UL(e,t){return t!=null&&!pF(t)?0:typeof e==`function`?e():e}function WL(e,t,n){let r=UL(e,n);return typeof r==`number`?r:r?.[t]}function GL(e){return typeof e==`function`?e():e}function KL(e,t){return t||e===`click`||e===`mousedown`}function qL(e){return e?.includes(`mouse`)&&e!==`mousedown`}var JL=Z.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new MP,currentIdRef:{current:null},currentContextRef:{current:null}});function YL(e,t){e.current=t.current}function XL(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=NP();return WN(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:WL(i.current,`open`),close:WL(n,`close`)}},[n,o,i,a]),(0,Q.jsx)(JL.Provider,{value:Z.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function ZL(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(JL),[f,p]=Z.useState(!1),m=Z.useRef(n);return WN(()=>{m.current=n},[n]),WN(()=>{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]),WN(()=>{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:WL(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,NL(gL))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),WN(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,YL(o,c),d.clear()}},[l,a,o,i,c,d]),Z.useMemo(()=>({activeIdRef:a,hasProvider:u,delayRef:o,isInstantPhase:f}),[a,u,o,f])}var QL=0;function $L(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(QL);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),RN;let o=requestAnimationFrame(a);return QL=o,()=>{QL===o&&(cancelAnimationFrame(o),QL=0)}}var eR={inert:new WeakMap,"aria-hidden":new WeakMap},tR=`data-base-ui-inert`,nR={inert:new WeakSet,"aria-hidden":new WeakSet},rR=new WeakMap,iR=0;function aR(e){return nR[e]}function oR(e){return e?uP(e)?e.host:oR(e.parentNode):null}var sR=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=oR(t);return e.contains(n)?n:null}).filter(e=>e!=null),cR=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},lR=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{iP(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function uR(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=sR(t,e),l=i?lR(t,cR(c),new Set(c)):[],u=[],d=[];if(a){let e=eR[a],n=aR(a);s=n,o=e;let r=sR(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);lR(t,cR(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=(rR.get(e)||0)+1;rR.set(e,t),d.push(e),t===1&&e.setAttribute(tR,``)}),iR+=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=(rR.get(e)||0)-1;rR.set(e,t),t||e.removeAttribute(tR)}),--iR,iR||(eR.inert=new WeakMap,eR[`aria-hidden`]=new WeakMap,nR.inert=new WeakSet,nR[`aria-hidden`]=new WeakSet,rR=new WeakMap)}}function dR(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=TP(e[0]).body;return uR(e,a,n,r,{mark:i})}function fR(){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 pR=class{nodesRef={current:[]};events=fR();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)}},mR=Z.createContext(null),hR=Z.createContext(null),gR=()=>Z.useContext(mR)?.id||null,_R=e=>{let t=Z.useContext(hR);return e??t};function vR(e){let t=cL(),n=_R(e),r=gR();return WN(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function yR(e){let{children:t,id:n}=e,r=gR();return(0,Q.jsx)(mR.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function bR(e){let{children:t,externalTree:n}=e,r=UN(()=>n??new pR).current;return(0,Q.jsx)(hR.Provider,{value:r,children:t})}function xR(e,t){let n=aP(WP(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 SR=20,CR=[];function wR(){CR=CR.filter(e=>e.deref()?.isConnected)}function TR(e){wR(),e&&iP(e)!==`body`&&(CR.push(new WeakRef(e)),CR.length>SR&&(CR=CR.slice(-20)))}function ER(){return wR(),CR[CR.length-1]?.deref()}function DR(e){return e?JF(e)?e:XF(e)[0]||e:null}function OR(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=YF(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return JF(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 kR(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=tP(()=>b.current.floatingContext?.nodeId),S=i===!1,C=aF(_)&&S,w=VL(i),T=VL(a),E=VL(l),D=VL(g),O=_R(p),k=IL(),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef(!1),N=Z.useRef(null),P=Z.useRef(``),F=Z.useRef(``),I=Z.useRef(null),L=Z.useRef(null),R=uI(I,f,k?.beforeInsideRef),ee=uI(L,k?.afterInsideRef),z=NP(),te=NP(),ne=AP(),re=k!=null,ie=sF(v),ae=tP((e=ie)=>e?XF(e):[]),oe=tP(()=>m?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&UP(ie,HP(TP(ie)))&&ae().length===0&&!C&&uF(e)}return EP(TP(ie),`keydown`,e)},[r,ie,s,C,ae]),Z.useEffect(()=>{if(r||!g)return;let e=TP(ie);function t(){M.current=!1}function n(e){let t=WP(e),n=oe(),r=UP(v,t)||UP(_,t)||UP(k?.portalNode,t)||n.some(e=>e===t||UP(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,te.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return wP(EP(e,`pointerdown`,n,!0),EP(e,`pointerup`,t,!0),EP(e,`pointercancel`,t,!0),EP(e,`keydown`,i,!0),t)},[r,v,_,ie,g,k,te,oe]),Z.useEffect(()=>{if(r||!c)return;let e=TP(ie);function t(){j.current=!0,te.start(0,()=>{j.current=!1})}function n(e){let t=WP(e);JF(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=WP(t);s&&n==null&&i!=null&&UP(v,i)&&TR(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=oe(),f=n?.hasAttribute(PL(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,WI(d),WI(u)].includes(n),p=!(UP(_,n)||UP(v,n)||UP(n,v)||UP(k?.portalNode,n)||l.some(e=>e===n||UP(e,n))||c.hasMatchingElement(e=>UP(e,n))||f||O&&(cF(O.nodesRef.current,a).find(e=>UP(e.context?.elements.floating,n)||UP(e.context?.elements.domReference,n))||lF(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,sF(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&ie&&OR(ie),o&&r!==_&&!RF(i)&&HP(e)===e.body){if(lP(ie)&&(ie.focus(),o===`popup`)){ne.request(()=>{ie.focus()});return}let e=ae(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ie;lP(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!j.current&&(C||n!==ER())&&(A.current=!0,h.setOpen(!1,NL(CL,t)))})}function a(){M.current||(b.current.insideReactTree=!0,z.start(0,()=>{b.current.insideReactTree=!1}))}let l=lP(_)?_:null;if(v||l)return wP(l&&EP(l,`focusout`,i),l&&EP(l,`pointerdown`,t),v&&EP(v,`focusin`,n),v&&EP(v,`focusout`,i),v&&k&&EP(v,`focusout`,a,!0))},[r,_,v,ie,s,O,k,h,c,o,ae,C,x,b,z,te,ne,u,d,oe]),Z.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${PL(`portal`)}]`)||[]),t=(O?lF(O.nodesRef.current,x()):[]).find(e=>aF(e.context?.elements.domReference||null))?.context?.elements.domReference,n=dR([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...oe(),t,WI(d),WI(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=dR([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,oe]),WN(()=>{if(!g||r||!lP(ie))return;P.current=``,F.current=``;let e=TP(ie),t=HP(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||UP(ie,t))return;let i=null,a=()=>(i??=ae(ie),i[0]||ie),o;o=r===!0||r===null?a():WI(r),o||=a();let s=UP(ie,HP(e));$L(o,{preventScroll:o===ie,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=HP(e);return!(t!==o&&UP(ie,t))}})})},[r,g,ie,ae,w,E,D]),WN(()=>{if(r||!ie)return;let e=TP(ie),t=HP(e),n=E.current==null;TR(t);function i(e){if(e.open||(P.current=xR(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(dF(e.nativeEvent)||fF(e.nativeEvent))A.current=!1;else{let e=!1;TP(ie).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&iP(t)!==`body`?t:null,s=n?o||a:a||o;return s||=ER()||null,typeof i==`boolean`?s:WI(i)||s||null}return()=>{y.off(`openchange`,i);let t=HP(e),n=oe(),r=UP(v,t)||n.some(e=>e===t||UP(e,t))||O&&cF(O.nodesRef.current,x(),!1).some(e=>UP(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=DR(c),i=typeof o!=`boolean`;if(o&&!A.current&&lP(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,ie,T,E,y,O,_,x,oe]),WN(()=>{if(!BP||g||!v)return;let e=HP(TP(v));lP(e)&&iF(e)&&UP(v,e)&&e.blur()},[g,v]),WN(()=>{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,_]),WN(()=>{if(!r&&ie)return OR(ie),()=>{queueMicrotask(wR)}},[r,ie]);let se=!r&&(!s||!C)&&(re||s);return(0,Q.jsxs)(Z.Fragment,{children:[se&&(0,Q.jsx)(lI,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=ae();$L(e[e.length-1])}else k?.portalNode&&(A.current=!1,rI(e,k.portalNode)?QF(_)?.focus():WI(d??k.beforeOutsideRef)?.focus())}}),n,se&&(0,Q.jsx)(lI,{"data-type":`inside`,ref:ee,onFocus:e=>{s?$L(ae()[0]):k?.portalNode&&(c&&(A.current=!0),rI(e,k.portalNode)?$F(_)?.focus():WI(u??k.afterOutsideRef)?.focus())}})]})}function AR(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=_L}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),f=AP(),p=NP(),m=Z.useMemo(()=>{function e(e,t,n,r){let i=NL(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=pF(e.pointerType,!0)&&fF(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||pF(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=WP(o);if(iF(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}pF(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}:BN,[n,m])}function jR(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 MR(e){return e!=null&&e.clientX!=null}function NR(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=tP(e=>{i.set(`positionReference`,e)}),g=tP((e,t,n)=>{l.current||(!c.current.openEvent||MR(c.current.openEvent))&&i.set(`positionReference`,jR(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=tP(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=pF(d)?o:a;Z.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=aP(o);function r(t){let n=WP(t);UP(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||MR(c.current.openEvent)?u.current=EP(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 PR(){return!1}function FR(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function IR(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=PR,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=_R(c),h=tP(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=tP(()=>a),{escapeKey:y,outsidePress:b}=FR(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=NP(),k=NP(),A=tP(()=>{k.clear(),f.current.insideReactTree=!1}),j=tP(e=>{let t=f.current.floatingContext?.nodeId;return(m?cF(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=tP(e=>rF(e,l.select(`floatingElement`))||rF(e,l.select(`domReferenceElement`))),N=tP(e=>{o()&&l.setOpen(!1,NL(_L,e.nativeEvent))}),P=tP(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=NL(wL,Jse(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),F=tP(()=>{f.current.insideReactTree=!0,k.start(0,A)}),I=tP(e=>{if(!u||!n||e.button!==0)return;let t=WP(e.nativeEvent);UP(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),L=tP(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 MP,t=new MP,i=TP(d);function a(){e.clear(),T.current=!0}function o(){e.start(BP?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&&cF(m.nodesRef.current,t).some(t=>rF(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=WP(e),r=`[${PL(`inert`)}]`,i=cP(n)?n.getRootNode():null,a=Array.from((uP(i)?i:TP(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>UP(e,n))))return;let s=cP(n)?n:null;for(;s&&!_P(s);){let e=bP(s);if(_P(e)||!cP(e))break;s=e}if(!(a.length&&cP(n)&&!Kse(n)&&!UP(n,l.select(`floatingElement`))&&a.every(e=>!UP(s,e)))){if(lP(n)&&!(`touches`in e)){let t=_P(n),r=vP(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&&!dF(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}(typeof g!=`function`||g(e))&&(j(`__outsidePressBubbles`)||(l.setOpen(!1,NL(bL,e)),A()))}}}function F(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!M(e)&&N(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=WP(e);if(!n)return;let r=EP(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,I)}function ee(e){O.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!D.current||D.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function z(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;if(c(),p()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!k(e)){if(n){s();return}(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,A())}}}function te(e){if(p()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(N(e),O.clear(),D.current=null)}function ne(e){L(e,te)}function re(e){p()===`sloppy`&&D.current&&!M(e)&&(D.current.dismissOnTouchEnd&&N(e),O.clear(),D.current=null)}function ie(e){L(e,re)}let ae=wP(r&&wP(EP(i,`keydown`,P),EP(i,`compositionstart`,a),EP(i,`compositionend`,o)),_&&wP(EP(i,`click`,ee,!0),EP(i,`pointerdown`,ee,!0),EP(i,`pointerup`,z,!0),EP(i,`pointercancel`,z,!0),EP(i,`mousedown`,ee,!0),EP(i,`mouseup`,z,!0),EP(i,`touchstart`,R,{capture:!0,passive:!0}),EP(i,`touchmove`,ne,{capture:!0,passive:!0}),EP(i,`touchend`,ie,{capture:!0,passive:!0})));return()=>{ae(),e.clear(),t.clear(),c(),C.current=!1,A()}},[f,d,r,_,g,u,n,y,b,P,A,v,j,M,m,l,O]);let R=Z.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ee=Z.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return Z.useMemo(()=>n?{reference:R,floating:ee,trigger:R}:{},[n,R,ee])}function LR(e,t,n){let{reference:r,floating:i}=e,a=TF(t),o=EF(t),s=wF(o),c=xF(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=SF(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function RR(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}=bF(t,e),p=jF(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=MF(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=MF(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 zR=50,BR=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:RR},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=LR(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<zR&&(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}=LR(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},VR=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}=bF(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=xF(r),_=TF(o),v=xF(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[AF(o)]:Qse(o)),x=p!==`none`;!d&&x&&b.push(...nce(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=Zse(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`||_===TF(t)||T.every(e=>TF(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=TF(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{}}}},HR=new Set([`left`,`top`]);async function UR(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xF(n),s=SF(n),c=TF(n)===`y`,l=HR.has(o)?-1:1,u=a&&c?-1:1,d=bF(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 WR=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 UR(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}}}}},GR=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}=bF(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=TF(i),p=CF(f),m=u[p],h=u[f],g=(e,t)=>yF(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}}}}}},KR=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}=bF(e,t),u={x:n,y:r},d=TF(i),f=CF(d),p=u[f],m=u[d],h=bF(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=HR.has(xF(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}}}},qR=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}=bF(e,t),c=await i.detectOverflow(t,s),l=xF(n),u=SF(n),d=TF(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=mF(p-c[m],g),y=mF(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*hF(c.left,c.right):S=p-2*hF(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 JR(e){let t=vP(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=lP(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=gF(n)!==a||gF(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function YR(e){return cP(e)?e:e.contextElement}function XR(e){let t=YR(e);if(!lP(t))return vF(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=JR(t),o=(a?gF(n.width):n.width)/r,s=(a?gF(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ZR=vF(0);function QR(e){let t=aP(e);return!gP()||!t.visualViewport?ZR:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $R(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===aP(e)}function ez(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=YR(e),o=vF(1);t&&(r?cP(r)&&(o=XR(r)):o=XR(e));let s=$R(a,n,r)?QR(a):vF(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=aP(a),t=cP(r)?aP(r):r,n=e,i=CP(n);for(;i&&t!==n;){let e=XR(i),t=i.getBoundingClientRect(),r=vP(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=aP(i),i=CP(n)}}return MF({width:u,height:d,x:c,y:l})}function tz(e,t){let n=yP(e).scrollLeft;return t?t.left+n:ez(oP(e)).left+n}function nz(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-tz(e,n),y:n.top+t.scrollTop}}function rz(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=oP(r),s=t?fP(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=vF(1),u=vF(0),d=lP(r);if((d||!a)&&((iP(r)!==`body`||dP(o))&&(c=yP(r)),d)){let e=ez(r);l=XR(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?nz(o,c):vF(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 iz(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function az(e){let t=yP(e),n=e.ownerDocument.body,r=hF(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=hF(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+tz(e),o=-t.scrollTop;return vP(n).direction===`rtl`&&(a+=hF(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var oz=25;function sz(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=aP(e),a=oP(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!gP()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(tz(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<=oz&&(s-=o)}return{width:s,height:c,x:l,y:u}}function cz(e,t){let n=ez(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=XR(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function lz(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=sz(e,n,t);else if(t===`document`)r=az(oP(e));else if(cP(t))r=cz(t,n);else{let n=QR(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return MF(r)}function uz(e,t){let n=t.get(e);if(n)return n;let r=SP(e,[],!1).filter(e=>cP(e)&&iP(e)!==`body`),i=null,a=vP(e).position===`fixed`,o=a?bP(e):e;for(;cP(o)&&!_P(o);){let e=vP(o),t=hP(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=bP(o)}return t.set(e,r),r}function dz(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fP(t)?[]:uz(t,this._c):[].concat(n),r],o=lz(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=lz(t,a[e],i);s=hF(n.top,s),c=mF(n.right,c),l=mF(n.bottom,l),u=hF(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function fz(e){let{width:t,height:n}=JR(e);return{width:t,height:n}}function pz(e,t,n){let r=lP(t),i=oP(t),a=n===`fixed`,o=ez(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=vF(0);if((r||!a)&&((iP(t)!==`body`||dP(i))&&(s=yP(t)),r)){let e=ez(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=tz(i));let l=i&&!r&&!a?nz(i,s):vF(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 mz(e){return vP(e).position===`static`}function hz(e,t){if(!lP(e)||vP(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return oP(e)===n&&(n=n.ownerDocument.body),n}function gz(e,t){let n=aP(e);if(fP(e))return n;if(!lP(e)){let t=bP(e);for(;t&&!_P(t);){if(cP(t)&&!mz(t))return t;t=bP(t)}return n}let r=hz(e,t);for(;r&&xse(r)&&mz(r);)r=hz(r,t);return r&&_P(r)&&mz(r)&&!hP(r)?n:r||wse(e)||n}var _z=async function(e){let t=this.getOffsetParent||gz,n=this.getDimensions,r=await n(e.floating);return{reference:pz(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vz(e){return vP(e).direction===`rtl`}var yz={convertOffsetParentRelativeRectToViewportRelativeRect:rz,getDocumentElement:oP,getClippingRect:dz,getOffsetParent:gz,getElementRects:_z,getClientRects:iz,getDimensions:fz,getScale:XR,isElement:cP,isRTL:vz};function bz(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xz(e,t,n){let r=null,i,a=oP(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=_F(d),h=_F(a.clientWidth-(u+f)),g=_F(a.clientHeight-(d+p)),_=_F(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:hF(0,mF(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!bz(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=aP(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Sz(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=YR(e),u=i||a?[...l?SP(l):[],...t?SP(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?xz(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?ez(e):null;c&&g();function g(){let t=ez(e);h&&!bz(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 Cz=WR,wz=GR,Tz=VR,Ez=qR,Dz=KR,Oz=(e,t,n)=>{let r=new Map,i=n??{},a={...yz,...i.platform,_c:r};return BR(e,t,{...i,platform:a})},kz=typeof document<`u`?Z.useLayoutEffect:function(){};function Az(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(!Az(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)&&!Az(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function jz(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mz(e,t){let n=jz(e);return Math.round(t*n)/n}function Nz(e){let t=Z.useRef(e);return kz(()=>{t.current=e}),t}function Pz(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);Az(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=Nz(c),D=Nz(i),O=Nz(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Oz(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Az(w.current,t)&&(w.current=t,GN.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);kz(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);kz(()=>(A.current=!0,()=>{A.current=!1}),[]),kz(()=>{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=Mz(M.floating,u.x),r=Mz(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...jz(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 Fz=(e,t)=>{let n=Cz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iz=(e,t)=>{let n=wz(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lz=(e,t)=>({fn:Dz(e).fn,options:[e,t]}),Rz=(e,t)=>{let n=Tz(e);return{name:n.name,fn:n.fn,options:[e,t]}},zz=(e,t)=>{let n=Ez(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bz={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},Vz=class extends nP{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:fR(),nested:n,triggerElements:i},Bz),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&Yse(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 Hz(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 Vz({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),WN(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};cP(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 Uz(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),WN(()=>{if(!e&&o&&i!==`ending`&&n){let e=kP.request(()=>{a(`ending`)});return()=>{kP.cancel(e)}}},[e,o,i,n]),WN(()=>{if(!e||t)return;let n=kP.request(()=>{a(void 0)});return()=>{kP.cancel(n)}},[t,e]),WN(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=kP.request(()=>{a(`idle`)});return()=>{kP.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var Wz={tabIndex:-1,[jse]:``};function Gz(e){return t=>t!==`touch`||e.current}function Kz(e,t=!1){let n=cL(),r=gR()!=null,i=UN(()=>e(n,r)).current;return Hz({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function qz({handle:e,store:t}){return WN(()=>e.attachStore(t),[e,t]),null}function Jz(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function Yz(e,t){let n=Z.useRef(null);return tP(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),Jz(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Jz(t))})}function Xz(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 Zz(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Qz(e,t,n,r={}){let i=n.reason,a=i===vL,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Zz(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=Xz(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?GN.flushSync(l):l()}function $z(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Yz(e,n),o=tP(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=tP(e=>{a(e),e&&o(e)});return WN(()=>(s(t.current),()=>s(null)),[s,t,n,e]),WN(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function eB(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Z.useRef(null),i=e.useState(`open`);WN(()=>{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=NL(gL);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 tB(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=Uz(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=tP(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return JI({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function nB(e,t){e.useSyncedValues(t),WN(()=>()=>{e.update({activeTriggerProps:BN,inactiveTriggerProps:BN,popupProps:BN})},[e])}function rB(e,t){WN(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),WN(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var iB=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 aB(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Vz({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:BN,inactiveTriggerProps:BN,popupProps:BN}}var oB=e=>e.triggerIdProp??e.activeTriggerId,sB=e=>e.openProp??e.open,cB=e=>(e.popupElement?.id??e.floatingId)||void 0;function lB(e,t){return t!==void 0&&sB(e)&&oB(e)===t}function uB(e,t){return lB(e,t)?!0:t!==void 0&&sB(e)&&oB(e)==null&&e.triggerCount===1}var dB={open:sB,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:oB,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:cB,isTriggerActive:(e,t)=>t!==void 0&&oB(e)===t,isOpenedByTrigger:(e,t)=>lB(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&oB(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>uB(e,t)?cB(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function fB(e){let t=Z.useCallback(t=>e===void 0?RN:e.subscribeStore(t),[e]),n=Z.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,LN.useSyncExternalStore)(t,n,()=>e?.serverStore)}function pB(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=cL(),a=gR()!=null,o=UN(()=>new Vz({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new iB,floatingId:i,syncOnly:!1,nested:a})).current;return WN(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=cP(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 mB(e){return hB(e,e.rootContext)}function hB(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=_R(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=Pz({...e,elements:{..._,...l&&{reference:l}}}),y=cP(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=cP(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(cP(e)||e===null)&&(h.current=e,f(e)),(cP(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!cP(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 WN(()=>{o&&(h.current=o)},[o]),WN(()=>{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 gB=zP&&BP;function _B(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=NP();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=aP(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&lP(e)&&e===HP(TP(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return wP(EP(t,`blur`,r),gB&&EP(t,`keydown`,a,!0),gB&&EP(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`);cP(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=WP(t.nativeEvent);if(cP(a)){if(gB&&!t.relatedTarget){if(!l.current&&!iF(a))return}else if(!oF(a))return}let o=nF(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,NL(yL,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,NL(yL,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=cP(n)&&n.hasAttribute(PL(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=HP(TP(e));(n||t!==e)&&(UP(o.current.floatingContext?.refs.floating.current,t)||UP(e,t)||a||nF(n??t,i.context.triggerElements)||i.setOpen(!1,NL(yL,r)))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var vB=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 MP,this.restTimeout=new MP,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},yB=new WeakMap;function bB(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&yB.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),yB.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function xB(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=yB.get(n);a&&a!==e&&bB(a),bB(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,yB.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function SB(e){let t=e.context.dataRef.current,n=UN(()=>t.hoverInteractionState??vB.create()).current;return t.hoverInteractionState||=n,VN(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function CB(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=_R(),d=gR(),f=SB(a),p=NP(),m=tP(()=>KL(l.current.openEvent?.type,f.interactedInside)),h=tP(()=>qL(l.current.openEvent?.type)),g=tP(()=>{bB(f)});WN(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Z.useEffect(()=>g,[g]),WN(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&cP(c)&&s){let e=c,t=s,n=TP(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 xB(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&&cF(u.nodesRef.current,d).length>0)}function t(e){let t=WL(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,NL(vL,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=WP(e);if(!qse(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(nF(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&cP(o)&&cF(u.nodesRef.current,r,!1).some(e=>UP(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,NL(vL,t)),u.events.emit(`floating.closed`,t)})}let y=s;return wP(y&&EP(y,`mouseenter`,c),y&&EP(y,`mouseleave`,_),y&&EP(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var wB={current:null};function TB(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=wB,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=_R(l),y=SB(h),b=Z.useRef(!1),x=VL(i),S=VL(r),C=VL(o),w=VL(n),T=VL(p),E=VL(f),D=tP(()=>KL(g.current.openEvent?.type,y.interactedInside)),O=tP(()=>T.current?.()!==!1),k=tP((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!UP(e,t);if(!cP(n))return!1;let i=n;return r.hasMatchingElement(e=>UP(e,i))&&(!e||!UP(e,i))}),A=tP(()=>{y.handler&&=(TP(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=tP(()=>{bB(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===vL,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=WL(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,NL(vL,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,NL(vL,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!cP(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!pF(y.pointerType))return;let t=GL(C.current),n=WL(S.current,`open`,y.pointerType),r=WP(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(cP(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(UP(e,r)){s=e;break}}cP(i)&&cP(o)&&!h.context.triggerElements.hasElement(i)&&UP(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&&cP(s)&&cP(o)&&UP(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,NL(vL,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,NL(vL,e,s))}):g&&O()&&h.setOpen(!0,NL(vL,e,s)))}function i(t){if(D()){j();return}A();let n=TP(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!nF(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`||!UP(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){UP(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?EP(t,`mouseout`,o):void 0;return s?wP(EP(t,`mousemove`,r,{once:!0}),EP(t,`mouseenter`,r),EP(t,`mouseleave`,i),l):wP(EP(t,`mouseenter`,r),EP(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&&!pF(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;xB(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=GL(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,NL(vL,t,n))}y.pointerType===`touch`?GN.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var EB=`Escape`;function DB(e){return BP&&e.movementX===0&&e.movementY===0}function OB(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function kB(e,t){return OB(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function AB(e,t,n){return OB(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function jB(e,t,n){return OB(t,n?e===GP:e===KP,e===Pse)}function MB(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===EB:OB(t,n?e===KP:e===GP,e===Nse)}function NB(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=sF(T),k=aF(E),A=VL(O),j=gR(),M=_R(b),N=Z.useRef(f),P=Z.useRef(o??-1),F=Z.useRef(null),I=Z.useRef(!0),L=tP(e=>{i(P.current===-1?null:P.current,e)}),R=Z.useRef(!!T),ee=Z.useRef(w),z=Z.useRef(!1),te=Z.useRef(!1),ne=Z.useRef(null),re=VL(h),ie=VL(w),ae=VL(o),oe=VL(y),se=AP(),ce=AP(),le=tP(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):ne.current=$L(e,{sync:z.current,preventScroll:!0})}let t=n.current[P.current],r=te.current;t&&e(t),(z.current?e=>e():e=>se.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),he&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});WN(()=>{D.current.orientation=g},[D,g]),WN(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(te.current=!0,L())):R.current&&(P.current=-1,L()))},[a,w,T,o,L]),WN(()=>{if(a){if(!w){z.current=!1;return}if(T){if(r==null){if(z.current=!1,ae.current!=null)return;if(R.current&&(P.current=-1,le()),(!ee.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ce.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||AB(F.current,g,u)||l?PF(n):FF(n),F.current=null,L())};t()}}else NF(n.current,r)||(P.current=r,le(),te.current=!1)}}},[a,w,T,r,ae,l,n,g,u,L,le,ce]),WN(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=HP(TP(E??t??null)),r=e.some(e=>e.context&&UP(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),WN(()=>{ee.current=w,R.current=!!T}),WN(()=>{w||(F.current=null,N.current=f)},[w,f]);let ue=r!=null,de=tP(e=>{if(!ie.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),fe=tP(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),pe=tP(()=>PF(n,re.current)),me=tP(e=>{if(I.current=!1,z.current=!0,e.which===229||!ie.current&&e.currentTarget===A.current)return;if(l&&MB(e.key,g,u,S)){kB(e.key,fe())||uF(e),C.setOpen(!1,NL(TL,e.nativeEvent)),lP(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=PF(n,h),i=FF(n,h);if(k||(e.key===`Home`&&(uF(e),P.current=r,L(e)),e.key===`End`&&(uF(e),P.current=i,L(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,L(e)),g===`both`)return}if(kB(e.key,g)){if(uF(e),w&&!d&&HP(e.currentTarget.ownerDocument)===e.currentTarget){P.current=AB(e.key,g,u)?r:i,L(e);return}AB(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(z.current=!1,P.current=r):P.current=IF(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,IF(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(z.current=!1,P.current=i):P.current=IF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,IF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),NF(n.current,P.current)&&(P.current=-1),L(e)}}),he=Z.useMemo(()=>({onFocus(e){z.current=!0,de(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){DB(e)||(z.current=!0,te.current=!1,p&&de(e))},onPointerLeave(e){if(!ie.current||!I.current||e.pointerType===`touch`)return;z.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&oe.current&&(ne.current?.(),ne.current=null,P.current=-1,L(e),!d)){let e=A.current,t=HP(TP(e));e&&UP(e,t)&&e.focus({preventScroll:!0})}}}),[de,ie,A,p,n,L,oe,d]),ge=Z.useMemo(()=>d&&w&&ue&&{"aria-activedescendant":`${v}-${r}`},[d,w,ue,v,r]),_e=Z.useMemo(()=>({...k?{}:ge,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=WP(e.nativeEvent);if(t&&!UP(A.current,t))return;uF(e),C.setOpen(!1,NL(CL,e.nativeEvent)),lP(E)&&E.focus();return}me(e)},onPointerMove(e){DB(e)||(I.current=!0)}}),[ge,me,A,k,C,w,d,E]),ve=Z.useMemo(()=>{function e(e){C.setOpen(!0,NL(TL,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&dF(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&fF(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=jB(t.key,fe(),u),a=kB(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return me(t);if(n||m||!r){if(o){let e=kB(t.key,fe());F.current=l&&e?null:t.key}if(l){i&&(uF(t),n?(P.current=pe(),L(t)):e(t));return}a&&(ae.current!=null&&(P.current=ae.current),uF(t),!n&&m?e(t):me(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[me,f,pe,l,L,C,m,g,fe,u,ae,d]),ye=Z.useMemo(()=>({...ge,...ve}),[ge,ve]);return Z.useMemo(()=>a?{reference:ye,floating:_e,item:he,trigger:ve}:{},[a,ye,_e,ve,he])}function PB(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=NP(),m=Z.useRef(``),h=Z.useRef(u??i??-1),g=Z.useRef(null),_=tP(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!RF(n)||n?.matches(`:disabled`)?!1:o==null||!LF(zN,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===` `&&(uF(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!==` `&&(uF(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=tP(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);UP(n,t)||UP(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});WN(()=>{(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 FB=.1,IB=FB*FB,LB=.5;function RB(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function zB(e,t,n,r,i,a,o,s,c,l){let u=!1;return RB(e,t,n,r,i,a)&&(u=!u),RB(e,t,i,a,o,s)&&(u=!u),RB(e,t,o,s,c,l)&&(u=!u),RB(e,t,c,l,n,r)&&(u=!u),u}function BB(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function VB(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 HB(e={}){let{blockPointerEvents:t=!1}=e,n=new MP,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*IB;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=WP(r),g=r.type===`mouseleave`,_=UP(u,h),v=UP(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&cP(r.relatedTarget)&&UP(u,r.relatedTarget))return;function y(){return!!(s&&cF(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=VB(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=VB(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=VB(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=VB(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!BB(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?LB/2:LB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+LB+1,o=C||T?S.bottom-LB:S.top,s=C?T?S.bottom-LB:S.top:S.bottom-LB;M=zB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?LB/2:LB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-LB,o=C||T?S.top+LB:S.bottom,s=C?T?S.top+LB:S.bottom:S.top+LB;M=zB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?LB/2:LB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+LB+1,o=w||E?S.right-LB:S.left,s=w?E?S.right-LB:S.left:S.right-LB;M=zB(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?LB/2:LB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-LB,o=w||E?S.left+LB:S.right,s=w?E?S.left+LB:S.right:S.left+LB;M=zB(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 UB=Z.createContext(void 0);function WB(){return Z.useContext(UB)?.direction??`ltr`}var GB=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`}=bF(e,t)||{};if(l==null)return{};let f=jF(u),p={x:n,y:r},m=EF(i),h=wF(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=yF(k,j,A),N=!c.arrow&&SF(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}}}),KB=(e,t)=>{let{name:n,fn:r}=GB(e);return{name:n,fn:r,options:[e,t]}},qB={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}}}},JB={sideX:`left`,sideY:`top`},YB=`--available-width`,XB=`--available-height`,ZB=`--anchor-width`,QB=`--anchor-height`,$B=`--transform-origin`,eV=YB,tV=XB;function nV(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 rV(e,t,n){let{rects:r,placement:i}=e;return{side:nV(t,xF(i),n),align:SF(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function iV(e){return aV(e,mB)}function aV(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=tP(A),M=A?j:n,N=VL(n),P=VL(g),F=WB()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let ee=+(i===`bottom`),z=+(i===`top`),te=+(i===`right`),ne=+(i===`left`),re={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},ie=Z.useRef(null),ae=VL(a),oe=VL(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(Fz(e=>{let t=rV(e,i,F),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,F,i]));let ue=E===`none`&&T!==`shift`,de=!ue&&(u||O||T===`shift`),fe=T===`none`?null:Rz({...re,padding:{top:R.top+1+ee,right:R.right+1+ne,bottom:R.bottom+1+z,left:R.left+1+te},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),pe=ue?null:Iz({...re,rootBoundary:k,mainAxis:E!==`none`,crossAxis:de,limiter:u||O?void 0:Lz(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=TF(xF(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[re,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?le.push(pe,fe):le.push(fe,pe),le.push(zz({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(eV,`${t}px`),i.setProperty(tV,`${n}px`);let a=aP(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(ZB,`${u}px`),i.setProperty(QB,`${d}px`)}}),KB(e=>({element:ie.current||TP(e.elements.floating).createElement(`div`),padding:ie.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=xF(r),u=SF(r),d=TF(l)===`y`,f=ie.current,p=typeof a==`function`?a(rV(e,i,F)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return de&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty($B,d?`${m} ${h}`:`${h} ${m}`),{}}},qB,b),WN(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let me=Z.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:Se,isPositioned:Ce,floatingStyles:we}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>Sz(...e,me),nodeId:y,externalTree:S}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||JB,De=Ce?r:`fixed`,Oe=Z.useMemo(()=>{let e;return e=Ce?b?{position:De,[Te]:_e,[Ee]:ve}:{...we,position:De}:{position:De,top:0,left:0},e[eV]=`100vw`,e[tV]=`100vh`,Ce||(e.opacity=0),e},[b,De,Te,_e,Ee,ve,we,Ce]),ke=Z.useRef(null);WN(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(oV(t)?t.current:t)||null;n!==ke.current&&(he.setPositionReference(n),ke.current=n)},[g,he,M,N]),Z.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&oV(e)&&e.current!==ke.current&&(he.setPositionReference(e.current),ke.current=e.current)},[g,he,M,N]),Z.useEffect(()=>{if(m&&g&&ge.reference&&ge.floating)return Sz(ge.reference,ge.floating,be,me)},[m,g,ge,be,me]);let Ae=xF(xe),je=nV(i,Ae,F),Me=SF(xe)||`center`,Ne=!!ye.hide?.referenceHidden;WN(()=>{x&&g&&Ce&&Ae!==I&&w(Ae)},[x,g,Ce,Ae,I]);let Pe=Z.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Fe=ye.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Oe,arrowStyles:Pe,arrowRef:ie,arrowUncentered:Fe,side:je,align:Me,physicalSide:Ae,anchorHidden:Ne,refs:he,context:Se,isPositioned:Ce,update:be}),[Oe,Pe,ie,Fe,je,Me,Ae,Ne,he,Se,Ce,be])}function oV(e){return e!=null&&`current`in e}function sV(e){return e===`starting`?YI:BN}function cV(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),II(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},sV(r),i],stateAttributesMapping:$P})}var lV=CN(),uV=48,dV=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-uV-t;return n},fV=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},pV=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-uV;n+=i>>>1^-(i&1),t[r]=n}return t},mV=384,hV=[],gV=fV(dV(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),_V=fV(dV(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),vV=`@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`,yV=(()=>{let e=gV.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=gV[n];i<gV[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(gV[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=gV[i];a<gV[i+1];a++)n[r++]=e,e+=t[e]}return n})(),bV=dV(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000…ŏ000ˆ0000ŏ0000000000—0000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),xV=fV(dV(`123333359346463635126536711576`)),SV=dV(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),CV=dV(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),wV=pV(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),TV=(()=>{let e=new Int32Array(319).fill(-1),t=pV(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=pV(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),EV=`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}),DV=pV(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),OV=pV(`ɠ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`),kV=pV(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~‚22…ˆ‡:22|22222222222G000q†OVI00000}š2›>40000ŒB00000I¨©000¬00000000000000021M®­00°“000000000000000000000–222›HGHa1º222¿2À2222ÉÌ000­°2±`),AV=new Int32Array(995),jV=new Int32Array(995),MV=new Int32Array(995),NV=``,PV=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<DV.length;r++)for(let i of EV[kV[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),PV[a*2]=NV.length,PV[a*2+1]=i.length,NV+=i),AV[n]=DV[r],jV[n]=OV[r],MV[n]=a,n++}}var FV=pV(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),IV=fV(dV(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),LV=pV(`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`),RV=dV(`ij`),zV=dV(`—`),BV=dV(`1`),VV={GROUP_COUNT:mV,customValidatorNames:hV,edgeStart:gV,labelStart:_V,labelText:vV,edgeTarget:yV,nodeGroup:bV,nodeVlist:TV,vlistPat:xV,vlistOps:SV,vlistRef:CV,vlistGroup:wV,litAnchor:AV,litGroup:jV,litPool:MV,poolOffsets:PV,poolText:NV,adjGid:FV,adjStart:IV,adjTgt:LV,patGid:RV,patTgt:zV,postfixLookupGroups:BV,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},HV=`line`in Error(),UV=-1,WV=-1,GV=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},KV=(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},qV=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let L=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(GV(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;L[n]!==-1;)n=n+1&I-1;L[n]=e}let R=(e,t,n,r)=>{let i=(GV(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=L[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},ee=n.cacheSize??8192,z=n.prefix??e.prefix??``,te=z===``?``:z+`:`,ne=te.length,re=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ae=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,se=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ce=0,le=-1,ue=-1,de=-1,fe=-1,pe=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,me=e=>/\s/.test(String.fromCharCode(e)),he=(e,t,n)=>{if(ce=0,le=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)ce=1;else if(r===40&&i===41)ce=2;else return;de=t+1,fe=n-1;let a=t+1;if(pe(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!pe(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(le=t+1,ue=a,de=a+1)}},ge=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},_e=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ve=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ye=e=>!!e&&!Number.isNaN(Number(e)),be=(e,t,n)=>{if(n-t<11||!ge(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&ge(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&ge(e,t+10,t+18,`-normal/`)},xe=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Se=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),Ce=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],we=(e,t,n,r)=>{if(e>=10){if(e>=25)return re[e-25](t.slice(n,r));let i=e-10;if(ce!==xe[i])return!1;if(le>=0){for(let e of Se[i])if(ge(t,le,ue,e))return!0;return!1}switch(Ce[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(de,fe);return ie.test(e)&&!ae.test(e)}case 3:return ye(t.slice(de,fe));case 4:return se.test(t.slice(de,fe));default:return oe.test(t.slice(de,fe))}}switch(e){case 0:return!0;case 1:return ce===0;case 2:return ce===1;case 3:return ce===2;case 4:return _e.test(t.slice(n,r));case 5:return ye(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&ye(t.slice(n,r-1));case 8:return ve.test(t.slice(n,r));default:return be(t,n,r)}},Te=new Set(typeof E==`string`?E.split(` `):E),Ee=(e,t,n,r,i,a)=>{let o=GV(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},De=new Map,Oe=new Map,ke=2,Ae=4096,je=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Te.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=Oe.get(s);return c===void 0&&Oe.set(s,c=ke++),c},Me=new Map,Ne=r,Pe=r+4096,Fe=()=>Ne++,Ie=2097152,Le=8192,Re=new Int32Array(Le),ze=Array(Le).fill(null),Be=new Int32Array(Le),Ve=new Int32Array(Le),He=new Uint8Array(Le),Ue=0,We=(e,t,n,r,i,a,o,s)=>{let c=e;if(ze[e]!==null){if(ze[e|1]===null)c=e|1;else if(!(Ue++&3))c=e|Ue>>2&1;else return}ze[c]=t.slice(n,r),Re[c]=i,Be[c]=a,Ve[c]=o,He[c]=s},Ge=()=>ze.fill(null),Ke=256,qe=[new Int32Array(Ke),new Int32Array(Ke),new Int32Array(Ke),new Int32Array(Ke)],[Je,Ye,Xe,Ze]=qe,Qe=new Uint8Array(Ke),$e=new Uint8Array(Ke),et=()=>{Ke*=2,qe=qe.map(e=>{let t=new Int32Array(Ke);return t.set(e),t}),[Je,Ye,Xe,Ze]=qe;let e=new Uint8Array(Ke);e.set(Qe),Qe=e,$e=new Uint8Array(Ke)},tt=64,nt=new Int32Array(tt),rt=new Int32Array(tt),it=new Int32Array(r),at=2048,ot=21,st=new Float64Array(at),ct=new Int32Array(at),lt=0,ut=(e,t)=>{if(e===0&&t<r)return it[t]===lt?1:(it[t]=lt,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>ot;for(;ct[i]===lt;){if(st[i]===n)return 1;i=i+1&at-1}return st[i]=n,ct[i]=lt,0},dt=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?UV:Ee(Me,e,t+1,r,0,Fe)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=rt[t];if(r>n)continue;let i=nt[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=R(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;he(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(we(d[t],e,r,n))return p[h+t]}return UV},ft=e=>{let t=e.length,n=0,c=0,u=!1;(ke>Ae||De.size>Ae)&&(De=new Map,Oe=new Map,ke=2,Ge()),Ne>Pe&&(Me=new Map,Ne=r,Ge());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&me(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&me(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===Ke&&et();let _=n++;Je[_]=p,Ye[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(Re[y]===v&&ze[y]!==null&&ze[y].length===g?t=y:Re[y|1]===v&&ze[y|1]!==null&&ze[y|1].length===g&&(t=y|1),t>=0){let n=ze[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Xe[_]=Be[t],Ze[_]=Ve[t],Qe[_]=He[t];continue}}}let b=p;if(ne!==0){if(h-p<=ne||!e.startsWith(te,p)){Xe[_]=UV,We(y,e,p,h,v,UV,0,0);continue}b=p+ne}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,L=-1,R=0;(l[0]>=0||N[0]===1)&&(nt[0]=0,rt[0]=M,R=1);let ee=WV,z=0;for(let t=M;t<D;t++)if(t===A&&(ee=F<I?WV:P,z=R),P!==WV){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=WV;else{let e=i[P],t=i[P+1],c=WV;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],L=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(R===tt){tt*=2;let e=new Int32Array(tt);e.set(nt),nt=e;let t=new Int32Array(tt);t.set(rt),rt=t}nt[R]=r,rt[R]=t+2,R++}}A===D&&(ee=F<I?WV:P,z=R);let re=F<I?WV:P,ie,ae=!1;if(A>=0){if(ae=!0,ie=dt(e,E,A,ee,z),ie!==UV&&ie<r&&j[ie]){let t=dt(e,E,D,re,R);t!==UV&&t!==ie&&(ie=t,ae=!1)}else ie===UV&&(ie=dt(e,E,D,re,R),ae=!1)}else ie=dt(e,E,D,re,R);let oe=0,se=0;ie===UV?Xe[_]=UV:(se=+!!ae,oe=b>=C?+!!O:Ee(De,e,b,C,+!!O,e=>je(e,O)),Xe[_]=ie,Qe[_]=se,Ze[_]=oe),We(y,e,p,h,v,ie,oe,se)}if(n===0)return``;if(n===1)return Je[0]===0&&Ye[0]===t?e:e.slice(Je[0],Ye[0]);if(n*k>at){for(;n*k>at;)at<<=1,ot--;st=new Float64Array(at),ct=new Int32Array(at)}if(ke>=Ie||Ne>=Ie)throw Error(`cn: too many distinct classes in one merge`);lt=lt+1|0,lt===0&&(it.fill(0),ct.fill(0),lt=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Xe[e];if(t===UV){$e[e]=1;continue}let n=Ze[e];if(ut(n,t)===1){$e[e]=0,f=!0;continue}if($e[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)ut(n,x[e]);if(Qe[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&ut(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!$e[m]){m++;continue}let t=Je[m],r=Ye[m],i=m+1;for(;i<n&&$e[i]&&Je[i]===r+1&&e.charCodeAt(r)===32;)r=Ye[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},pt=16384,mt=new Int32Array(pt*2),ht=0,gt=1,_t=Object.create(null),vt=Object.create(null),yt=new Map,bt=new Map,xt=0,St=0,Ct=()=>{ht^=pt,gt=gt+1|0,St=0},wt=e=>{let t=_t[e];if(t!==void 0)return t;let n=KV(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=vt[e],t!==void 0)?(_t[e]=t,t):(t=ft(e),i?(_t[e]=t,++xt>ee&&(xt=0,vt=_t,_t=Object.create(null),Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Tt=e=>{let t=yt.get(e);if(t!==void 0)return t;let n=KV(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=bt.get(e),t!==void 0)?(yt.set(e,t),t):(t=ft(e),i?(yt.set(e,t),++xt>ee&&(xt=0,bt=yt,yt=new Map,Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Et=e=>{let t=KV(e,0,e.length),n=(t&16383)+ht;return mt[n]===(t^gt)||mt[n^pt]===(t^gt-1)||(mt[n]=t^gt,++St>pt&&Ct(),!1)},Dt=ee===0?ft:HV?e=>{let t=yt.get(e);return t===void 0?Tt(e):t}:wt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?Dt(arguments[0]):Dt(XV.apply(null,arguments))},mergeString:Dt,seenBefore:ee===0?()=>!1:Et,mergeUncached:ft}},JV=(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:JV(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},YV=(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:JV(i,t);a&&(n&&(n+=` `),n+=a)}return n},XV=function(){return YV(arguments,!1)},ZV=(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]=JV(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(JV(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},QV=qV(VV),$V=ZV(QV.mergeString,QV);QV.merge;var eH=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}=pL({disabled:i,focusableWhenDisabled:a,native:o});return II(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function tH(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=tH(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function nH(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=tH(e))&&(r&&(r+=` `),r+=t);return r}var rH=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,iH=nH,aH=(e,t)=>n=>{if(t?.variants==null)return iH(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=rH(t)||rH(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 iH(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)},oH=aH(`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 sH({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Q.jsx)(eH,{"data-slot":`button`,className:$V(oH({variant:t,size:n,className:e})),...r})}var cH=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function lH(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:cH(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var uH=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},dH=e=>{let t=uH(e);return t.charAt(0).toUpperCase()+t.slice(1)},fH=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),pH={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 mH(e){return e!=null}function hH(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??pH.width,a=e.size??e.height??pH.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?fH(...c):fH(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??pH[`stroke-width`])*Number(e.size??e.width??pH.width)/Number(t.size??t.width??pH.width):t.strokeWidth??pH[`stroke-width`];return[`svg`,{...Object.entries(pH).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&mH(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&mH(t.width)&&{[r(`width`)]:t.width},...`height`in t&&mH(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 gH(e,t={}){return hH(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var _H=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},vH=(0,Z.createContext)({}),yH=()=>(0,Z.useContext)(vH),bH=(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=``}=yH()??{},y=!!c||_H(d),[b,x,S=[]]=gH(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:fH(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 xH(e,t=[],n=[]){let r=typeof e==`string`?lH(e,t,n):e,i=(0,Z.forwardRef)(({className:e,...t},n)=>(0,Z.createElement)(bH,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=dH(r.name)),i}var SH={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};SH.node;var CH=xH(SH),wH={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};wH.node;var TH=xH(wH),EH={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};EH.node;var DH=xH(EH),OH={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};OH.node;var kH=xH(OH),AH={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};AH.node;var jH=xH(AH),MH={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};MH.node;var NH=xH(MH),PH={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`}]]};PH.node;var FH=xH(PH),IH={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`}]]};IH.node;var LH=xH(IH),RH={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`}]]};RH.node;var zH=xH(RH),BH={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`}]]};BH.node;var VH=xH(BH),HH={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`}]]};HH.node;var UH=xH(HH),WH={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`}]]};WH.node;var GH=xH(WH),KH={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`}]]};KH.node;var qH=xH(KH),JH={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`}]]};JH.node;var YH=xH(JH),XH={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};XH.node;var ZH=xH(XH),QH={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};QH.node;var $H=xH(QH),eU={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`}]]};eU.node;var tU=xH(eU),nU={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`]};nU.node;var rU=xH(nU),iU={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`}]]};iU.node;var aU=xH(iU),oU={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`}]]};oU.node;var sU=xH(oU),cU={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`}]]};cU.node;var lU=xH(cU),uU={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`}]]};uU.node;var dU=xH(uU),fU={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`}]]};fU.node;var pU=xH(fU),mU={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`}]]};mU.node;var hU=xH(mU),gU={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`}]]};gU.node;var _U=xH(gU),vU={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};vU.node;var yU=xH(vU),bU=Z.createContext(void 0);function xU(e){let t=Z.useContext(bU);if(t===void 0&&!e)throw Error(KN(72));return t}var SU=class extends nP{setState(e){}update(e){}set(e,t){}notifyAll(){}},CU={...dB,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},wU=class extends nP{constructor(e,t,n){let r=new iB;super(TU(e,r,t,n),EU(r),CU)}setOpen=(e,t)=>{Qz(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,NL(_L,e))}};function TU(e,t,n,r=!1){return{...aB(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 EU(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var DU=XN(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=Kz((e,t)=>new wU({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}),eB(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=tB(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Z.useRef(null);WN(()=>{m&&t&&p.setOpen(!1,NL(OL))},[m,t,p]),WN(()=>{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]),WN(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Z.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,NL(jL))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,Q.jsxs)(bU.Provider,{value:p,children:[l&&(0,Q.jsx)(qz,{handle:l,store:p}),T&&(0,Q.jsx)(OU,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function OU({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=IR(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=NR(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Z.useMemo(()=>SI(a.reference,i.reference),[a.reference,i.reference]);return nB(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??BN}),null}function kU(e){return cL(e,`base-ui`)}var AU=Z.createContext(void 0);function jU(){return Z.useContext(AU)}var MU=`data-base-ui-tooltip-trigger`;function NU(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(cP(n))return n}}let t=e.target;return cP(t)?t:null}function PU(e){let t=e;for(;t;){let e=t.closest(`[${MU}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&cP(n.host)?n.host:null}return null}var FU=ZN(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=xU(!0),m=fB(a)??p;if(!m)throw Error(KN(82));let h=kU(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}=$z(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=jU(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=ZL(v,{open:_}),O=SB(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=VL(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Z.useRef(!1),F=NP(),I=Z.useRef(void 0);function L(){return D&&w.current!=null?0:c??C??600}function R(e){let t=y.current;if(!t||!e)return!1;let n=PU(e);return n!==null&&n!==t&&UP(t,n)}function ee(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let z=TB(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?HB():null,restMs:L,delay(){return u==null&&D?{close:WL(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),te=_B(v,{enabled:!A}).reference,ne=e=>{let t=P.current,n=NU(e),r=ee(n),i=y.current,a=i&&n&&UP(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,NL(vL,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&pF(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,NL(vL,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},re=m.useState(`triggerProps`,S);return II(`button`,e,{state:{open:_},ref:[t,x,y],props:[z,te,S||M!==`none`?re:void 0,{onMouseOver(e){ne(e.nativeEvent)},onFocus(e){R(NU(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,[tF]:A?``:void 0,[MU]:A?void 0:``},f],stateAttributesMapping:ZP})}),IU=Z.createContext(void 0);function LU(){let e=Z.useContext(IU);if(e===void 0)throw Error(KN(70));return e}var RU=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return xU().useState(`mounted`)||n?(0,Q.jsx)(IU.Provider,{value:n,children:(0,Q.jsx)(BL,{ref:t,...r})}):null}),zU=Z.createContext(void 0);function BU(){let e=Z.useContext(zU);if(e===void 0)throw Error(KN(71));return e}var VU=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=nL,style:g,..._}=e,v=xU(),y=LU(),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=iV({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=cV(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)(zU.Provider,{value:D,children:O})}),HU=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=xU(),{side:s,align:c}=BU(),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`);JI({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),CB(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return II(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[Wz,f,sV(d),a],stateAttributesMapping:eF})}),UU=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=xU(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=BU();return II(`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:$P})}),WU=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Z.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Q.jsx)(AU.Provider,{value:t,children:(0,Q.jsx)(XL,{delay:i,timeoutMs:r,children:e.children})})};function GU(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 KU({delay:e=0,...t}){return(0,Q.jsx)(WU,{"data-slot":`tooltip-provider`,delay:e,...t})}function qU({...e}){return(0,Q.jsx)(DU,{"data-slot":`tooltip`,...e})}function JU({...e}){return(0,Q.jsx)(FU,{"data-slot":`tooltip-trigger`,...e})}function YU({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,Q.jsx)(RU,{children:(0,Q.jsx)(VU,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,Q.jsxs)(HU,{"data-slot":`tooltip-content`,className:$V(`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)(UU,{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 XU=new Set;function ZU(e){return XU.add(e),()=>XU.delete(e)}function QU(e){for(let t of[...XU])t(e)}function $U(e,t){let n=()=>QU({title:`Copied ${t}`,description:e,type:`success`}),r=()=>QU({title:`Could not copy ${t}`,description:e,type:`error`});if(window.isSecureContext&&navigator.clipboard!==null&&navigator.clipboard!==void 0){navigator.clipboard.writeText(e).then(n,()=>{eW(e)?n():r()});return}eW(e)?n():r()}function eW(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 tW=X(e=>ME(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 nW(e){let t=(0,lV.c)(2),n;t[0]===e?n=t[1]:(n=tW(e),t[0]=e,t[1]=n),jN(n)}var rW=`~effect/Cache`,iW=(e,t)=>gs(n=>{let r=Object.create(oW);return r.lookup=t=>fs(e(t),e=>wr(n,e)),r.map=sae(),r.capacity=t.capacity,r.timeToLive=t.timeToLive?(e,n)=>mi(t.timeToLive(e,n)):sW,ao(r)}),aW=e=>iW(e.lookup,{...e,timeToLive:e.timeToLive===void 0?sW:()=>e.timeToLive}),oW={...yt,[rW]:rW,toJSON(){return{_id:`Cache`,capacity:this.capacity,map:this.map}}},sW=(e,t)=>Ei,cW=a(2,(e,t)=>Xt(n=>{let r=Ww(e.map,t);if(zn(r)&&(qw(e.map,t),!dW(r.value,n)))return Kw(e.map,t,r.value),r.value.await();let i=new lW(n,e.lookup(t));i.onInterrupt=()=>uW(e,t,i);let a=!1;i.fiber.addObserver(r=>{if(i.onInterrupt=void 0,is(r)){uW(e,t,i);return}let o=e.timeToLive(r,t);Si(o)?(a=!0,uW(e,t,i)):xi(o)&&(i.expiresAt=n.getRef(nl).currentTimeMillisUnsafe()+Fi(o))});let o=i.fiber.pollUnsafe();return!a&&(o===void 0||!is(o))&&Kw(e.map,t,i),Number.isFinite(e.capacity)&&fW(e),i.await()})),lW=class{expiresAt;awaiters;fiber;onInterrupt;constructor(e,t){this.fiber=zc(e,t,!0,!0),this.awaiters=0,this.expiresAt=void 0}await(){return this.fiber.pollUnsafe()||(this.awaiters++,Ec(no(this.fiber),()=>(this.awaiters--,this.awaiters>0||this.fiber.pollUnsafe()?ho:(this.onInterrupt?.(),ro(this.fiber)))))}},uW=(e,t,n)=>{let r=Ww(e.map,t);zn(r)&&r.value===n&&qw(e.map,t)},dW=(e,t)=>e.expiresAt!==void 0&&t.getRef(nl).currentTimeMillisUnsafe()>=e.expiresAt,fW=e=>{let t=Jw(e.map)-e.capacity;if(!(t<=0)){for(let[n]of e.map)if(qw(e.map,n),t--,t===0)return}},pW=a(2,(e,t)=>co(()=>{qw(e.map,t)})),mW=2**48-1,hW=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,gW=(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)),mW),r=``;for(let e=45;e>=0;e-=5)r+=hW[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+=hW[i>>>a&31];i&=(1<<a)-1}return r},_W=e=>e.toString(16).padStart(2,`0`),vW=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,_W).join(``)).join(`-`),yW=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function bW(e=yW()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var xW=e=>vW(e===void 0?bW():bW(e)),SW=2**48-1;function CW(e,t=yW()){let n=Math.min(Math.max(0,Math.trunc(e)),SW);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 wW=(e,t)=>vW(t===void 0?CW(e):CW(e,t)),TW=`~effect/Crypto`,EW=tr(`effect/Crypto`),DW=e=>{let t=e.randomBytes,n=e=>Kf(OW(`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 EW.of({[TW]:TW,randomBytes:n,nextDoubleUnsafe:i,nextIntUnsafe:a,digest:e.digest,random:V(()=>i()),randomBoolean:V(()=>i()>.5),randomInt:V(()=>a()),randomBetween:(e,t)=>V(()=>qd(e,t,i())),randomIntBetween(e,t,n){let r=n?.halfOpen===!0?0:1;return V(()=>{let n=Math.ceil(e),a=Math.floor(t);return Math.floor(i()*(a-n+r))+n})},randomShuffle:e=>V(()=>{let t=Array.from(e);for(let e=t.length-1;e>=1;--e){let n=Math.min(e,Math.floor(i()*(e+1))),r=t[e];t[e]=t[n],t[n]=r}return t}),randomUUIDv4:V(()=>xW(t(16))),randomUUIDv7:Kp(e=>B(wW(e.currentTimeMillisUnsafe(),t(16)))),randomULID:Kp(e=>B(gW(e.currentTimeMillisUnsafe(),t(10))))})},OW=(e,t)=>Number.isSafeInteger(t)&&t>=0?B(t):U(gae({module:`Crypto`,method:e,description:`size must be a non-negative safe integer`})),kW=`~effect/FiberMap`,AW=e=>F(e,kW),jW={[kW]:kW,[Symbol.iterator](){return this.state._tag===`Closed`?Br():this.state.backing[Symbol.iterator]()},...yt,toJSON(){return{_id:`FiberMap`,state:this.state}}},MW=(e,t)=>{let n=Object.create(jW);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},NW=()=>vp(V(()=>MW(Uw(),fu())),e=>kf(()=>{let t=e.state;return t._tag===`Closed`?Af:(e.state={_tag:`Closed`},xS(lae(t.backing)).pipe(nne(e.deferred)))})),PW=-1,FW=Hi(Wi(Gl,Ui(PW))),IW=a(e=>AW(e[0]),(e,t,n,r)=>{if(e.state._tag===`Closed`){n.interruptUnsafe(PW);return}let i=Ww(e.state.backing,t);if(i._tag===`Some`){if(i.value===n)return;if(r?.onlyIfMissing===!0){n.interruptUnsafe(PW);return}}Kw(e.state.backing,t,n),i._tag===`Some`&&i.value.interruptUnsafe(PW),n.addObserver(i=>{if(e.state._tag===`Closed`)return;let a=Ww(e.state.backing,t);zn(a)&&n===a.value&&qw(e.state.backing,t),cu(i)&&(r?.propagateInterruption===!0?!FW(i.cause):!Zte(i.cause))&&_u(e.deferred,i)})}),LW=a(2,(e,t)=>e.state._tag!==`Closed`&&dae(e.state.backing,t)),RW=function(){let e;return()=>(e===void 0&&(e=Ip(Tp)),e)}(),zW=e=>()=>Kf(up(),t=>{let n=Lp(t);return(t,r,i)=>{if(e.state._tag===`Closed`||i?.onlyIfMissing===!0&&LW(e,t))return RW();let a=n(r,i);return IW(e,t,a,i),a}}),BW=`~effect/ManagedRuntime`,VW=(e,t)=>{let n=t?.memoMap??Mu(),r=yu(`sequential`),i=wu(r,`sequential`),a={onFiberStart:CS(wu(r,`parallel`))},o=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,s,c=zf(t=>(s||=Ip(Uf(Fu(e,n,i),e=>V(()=>{l.cachedContext=e})),{...a,scheduler:t.cache.scheduler}),Vf(_S(s)))),l={[BW]:BW,memoMap:n,scope:r,contextEffect:c,cachedContext:void 0,context(){return l.cachedContext===void 0?zp(l.contextEffect):Promise.resolve(l.cachedContext)},dispose(){return zp(l.disposeEffect)},[Symbol.asyncDispose](){return l.dispose()},disposeEffect:kf(()=>(l.contextEffect=If(`ManagedRuntime disposed`),l.cachedContext=void 0,Tu(l.scope,ou))),runFork(e,t){return l.cachedContext===void 0?Ip(HW(l,e),o(t)):Lp(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?Cne(HW(l,e),o(t)):Rp(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Up(HW(l,e)):Ene(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?Vp(HW(l,e)):Hp(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Bp(HW(l,e),o(t)):Tne(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?zp(HW(l,e),o(t)):wne(l.cachedContext)(e,o(t))}};return l};function HW(e,t){return Bf(e.contextEffect,e=>pp(t,e))}var UW=`~effect/SynchronizedRef`,WW={...yt,[UW]:UW,toJSON(){return{_id:`SynchronizedRef`,value:this.backing.ref.current}}},GW=e=>{let t=Object.create(WW);return t.semaphore=FC(1),t.backing=WD(e),t},KW=e=>V(()=>GW(e)),qW=e=>e.backing.ref.current,JW=a(2,(e,t)=>e.semaphore.withPermit(YD(e.backing,t))),YW=a(2,(e,t)=>e.semaphore.withPermit(kf(()=>Kf(t(qW(e)),([t,n])=>(e.backing.ref.current=n,t))))),XW=a(2,(e,t)=>e.semaphore.withPermit(qD(e.backing,t))),ZW=a(2,(e,t)=>e.semaphore.withPermit(XD(e.backing,t))),QW=class extends tr()(`@porcelain/client/EnvironmentStorage`){},$W=class extends tr()(`@porcelain/client/AccessPlatform`){},eG=class extends Y()(`WriteNotSentError`,{cause:Nb}){get message(){return`An earlier change failed, so this one was not sent.`}},tG=class extends tr()(`@porcelain/client/WriteQueue`){static make=H(function*(){let e=yield*RC(1),t=yield*GD({pending:0,failure:In()});return{enqueue:n=>kp(r=>H(function*(){return yield*XD(t,e=>({...e,pending:e.pending+1})),yield*Rf,yield*e.withPermit(H(function*(){let e=yield*KD(t),i=yield*Gf(r(zn(e.failure)?U(new eG({cause:e.failure.value})):n));return yield*XD(t,e=>{let t=e.pending-1,n=cu(i)?Bl(i.cause):void 0;return{pending:t,failure:t===0?In():pee(e.failure,()=>cu(i)?Ln(n instanceof eG?n.cause:n):In())}}),yield*su(i)?B(i.value):Pf(i.cause)}))}))}})},nG=class e extends tr()(`@porcelain/client/WriteQueues`){static layer=Uu(e,H(function*(){let e=yield*xae({lookup:e=>H(function*(){return{scope:yield*Cu(yield*vu,`parallel`),queue:yield*tG.make}}),idleTimeToLive:0});return{run:(t,n)=>_p(H(function*(){let{scope:r,queue:i}=yield*Sae(e,JSON.stringify(t)),a=yield*Pp(i.enqueue(n),r,{startImmediately:!0});return yield*vS(a).pipe(xp(bS(a)))}))}}))},rG=class extends Y()(`ConnectionError`,{message:K,cause:Ob(Nb)}){},iG=Gp(`persistedState`)(function*(e){let t=Vj({...e.initial,status:`loading`,error:void 0}),n=yield*tG.make;return{state:t,load:()=>n.enqueue(H(function*(){t.update(e=>({...e,status:`loading`,error:void 0})),yield*e.read().pipe(_ne({onSuccess:e=>V(()=>t.set({...e,status:`ready`,error:void 0})),onFailure:()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.readFailed})))}),Op)})),write:r=>n.enqueue(H(function*(){if(t.value.status!==`ready`)return yield*U(new rG({message:e.messages.beforeRead}));let n=yield*r(t.value);yield*e.write(n).pipe($f(({cause:t})=>new rG({message:e.messages.writeFailed,cause:t})),tp(()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.writeFailed})))),Uf(()=>V(()=>t.update(e=>({...e,...n})))),Op)}))}}),aG=1024,oG=1024*aG,sG=10*oG,cG=16*aG,lG=2e3,uG=2e3,dG=4096,fG=2147483647,pG=1e3,mG=1e4,hG=mG,gG=1024,_G=5e4,vG=16e3,yG=4e3,bG=2e3,xG=1e3,SG=4e3,CG=2048;8*oG,32*oG;var wG=Gb([`content_changed`,`file_too_large`,`unsupported_text`,`worktree_changed`]),TG=q({statusCode:Fb.check(dx()).check(cx(400)).check(lx(599)),error:K,message:K,code:W(wG)}),EG=K.check(nx(e=>Nr(xb(xx)(e)),{expected:`an absolute URL`})),DG=K.check(rx(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z$/),nx(e=>{let t=xb(jx)(e);return Nr(t)&&$ne(t.success)===e.split(`T`)[0]},{expected:`a valid UTC timestamp`})),OG=K.check(ix()),kG=K.check(rx(RegExp(`^[0-9a-f]{32}$`)));function AG(e){return Kb(e).pipe(Jb(qb(Ab(e)),u_({decode:e=>e===null?void 0:e,encode:e=>e===void 0?null:e})))}var jG=q({worktreeId:kG}),MG=`~effect/http-api/HttpApiMiddleware`,NG=`~effect/http-api/HttpApiMiddleware/Security`,PG=()=>(e,t)=>{let n=rt(),r;n!==0&&(it(2),r=new globalThis.Error,it(n));class i extends tr()(e){}let a=i;if(Object.defineProperty(i,"stack",{get(){return r?.stack}}),a[MG]=MG,a.error=FG(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[NG]=NG,a.security=t.security}return a};function FG(e){return e===void 0?new Set:new Set(Array.isArray(e)?e:[e])}var IG=`~effect/http-api/HttpApiGroup`,LG={[IG]:IG,add(...e){let t={...this.endpoints};for(let n of e)st(t,n.identifier,n);return zG({...RG(this),endpoints:t})},prefix(e){return zG({...RG(this),endpoints:Hr(this.endpoints,t=>t.prefix(e))})},middleware(e){return zG({...RG(this),endpoints:Hr(this.endpoints,t=>t.middleware(e))})},annotateMerge(e){return zG({...RG(this),annotations:wr(this.annotations,e)})},annotate(e,t){return zG({...RG(this),annotations:hr(this.annotations,e,t)})},annotateEndpointsMerge(e){return zG({...RG(this),endpoints:Hr(this.endpoints,t=>t.annotateMerge(e))})},annotateEndpoints(e,t){return zG({...RG(this),endpoints:Hr(this.endpoints,n=>n.annotate(e,t))})},pipe(){return n(this,arguments)}},RG=e=>({identifier:e.identifier,topLevel:e.topLevel,endpoints:e.endpoints,annotations:e.annotations}),zG=e=>{function t(){}return Object.setPrototypeOf(t,LG),t.key=`effect/http-api/HttpApiGroup/${e.identifier}`,Object.assign(t,e)},BG=(e,t)=>zG({identifier:e,topLevel:t?.topLevel??!1,endpoints:{},annotations:pr()}),VG=Wb([q({kind:G(`owner`)}),q({kind:G(`device`),deviceId:K.check(ix())})]);function HG(e){let t=[`c=${encodeURIComponent(e.code)}`,`e=${encodeURIComponent(e.environmentId)}`,...e.addresses.length>1?[`a=${encodeURIComponent(e.addresses.join(`,`))}`]:[]].join(`&`);return`${e.addresses[0]??``}/pair#${t}`}function UG(e){let[t=``,n=``]=e.split(`/pair#`),r=new Map(n.split(`&`).map(e=>{let[t=``,n=``]=e.split(`=`);return[t,decodeURIComponent(n)]})),i=r.get(`a`);return{addresses:i===void 0?[t]:i.split(`,`),code:r.get(`c`)??``,environmentId:r.get(`e`)??``}}var WG=K,GG=q({addresses:J(K),code:K,environmentId:K}),KG=WG.pipe(Jb(GG,u_({decode:UG,encode:HG}))),qG=q({code:K.check(px(1)).check(hx(200)),platform:K.check(px(1)).check(hx(120)),label:W(K.check(px(1)).check(hx(80)))}),JG=q({device:q({id:K,label:K,platform:K,createdAt:K}),credential:W(K)}),YG=q({id:K,label:K,addresses:J(K),createdAt:K,expiresAt:K,trusted:Ib,canManageSharing:W(Ib)}),XG=Gb([`loopback`,`lan`,`tailnet`,`tunnel`]),ZG=q({id:K,label:K,platform:K,createdAt:K,lastSeenAt:K,lastSeenAddress:W(K),route:XG,routeInferred:W(Ib),trusted:Ib,canManageSharing:W(Ib),canEditWaysIn:Ib,current:W(Ib)}),QG=q({canEditIdentity:W(Ib),grants:J(YG),devices:J(ZG)}),$G=q({labels:J(K.check(px(1)).check(hx(80))).check(px(1)).check(hx(20)),addresses:J(EG).check(px(1)).check(hx(10)),trusted:W(Ib),canManageSharing:W(Ib)}),eK=q({grants:J(q({grant:YG,code:K,link:KG}))}),tK=q({id:K.check(px(1))}),nK=q({revoked:Ib,kind:W(Gb([`grant`,`device`]))}),rK=q({id:K.check(px(1)),trusted:Ib}),iK=q({id:K,trusted:Ib}),aK=q({id:K.check(px(1)),allowed:Ib}),oK=q({id:K,allowed:Ib}),sK=q({id:K.check(px(1)),allowed:Ib}),cK=q({id:K,allowed:Ib}),lK=Pb;q({route:XG,local:Ib}),tr()(`@porcelain/http/RequestConnection`);var uK=class extends PG()(`@porcelain/http/ClientRequest`){};tr()(`@porcelain/http/RequestCaller`);var dK=class extends PG()(`@porcelain/http/PairedRequest`){},fK=class extends Y()(`InvalidDeviceDetailsError`,{}){get message(){return`The device name or platform is missing, too long, or contains control characters.`}},pK=class extends Y()(`InvalidPairingAddressError`,{}){get message(){return`This server does not answer at that address, so a link aimed there would not reach it.`}},mK=class extends Y()(`InvalidPairingError`,{}){get message(){return`This pairing link is not valid.`}},hK=class extends Y()(`MissingEnvironmentIdentityError`,{}){get message(){return`This server has no environment identity.`}};Y()(`TooManyPairingAttemptsError`,{});var gK=class extends Y()(`InvalidTunnelHostnameError`,{}){get message(){return`Enter the public hostname your Cloudflare tunnel serves, such as porcelain.example.com.`}},_K=class extends Y()(`MissingTunnelHostnameError`,{}){get message(){return`Cloudflare needs the public hostname your tunnel serves.`}},vK=class extends Y()(`InvalidTailnetHostnameError`,{}){get message(){return`Enter this computer's Tailscale name, such as laptop.tail1234.ts.net.`}},yK=class extends Y()(`MissingTailnetHostnameError`,{}){get message(){return`Tailscale needs this computer's Tailscale name.`}},bK=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.`}},xK=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.`}},SK=class extends Y()(`ServiceNotManagedError`,{}){get message(){return`Porcelain is not running as the installed service, so it cannot update itself`}},CK=class extends Y()(`ServiceUpdateNotOfferedError`,{}){get message(){return`That version is not the newer version this server offers`}},wK=class extends Y()(`ServiceUpdateRunningError`,{}){get message(){return`An update is already running`}},TK=class extends Y()(`DeviceViewerRequiredError`,{}){get message(){return`A live ticket is issued to a paired device`}},EK=class extends Y()(`TooManyLiveTicketsError`,{}){get message(){return`Too many live tickets are waiting to be used. Try again shortly.`}},DK=class extends Y()(`DeviceNotFoundError`,{}){get message(){return`Device not found`}},OK=class extends Y()(`UntrustedDeviceError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can update Porcelain`}},kK=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`}},AK=class extends Y()(`WaysInChangedError`,{}){get message(){return`The ways in changed since you last looked. Check them again, then save your change.`}},jK=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.`}},MK=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`}},NK=class extends Y()(`ReviewGitSettingsNotConfiguredError`,{}){get message(){return`Choose Reviews & Git settings for this computer before changing one of them`}},PK=class extends Y()(`SharingManagementRequiredError`,{}){get message(){return`This device cannot manage sharing. Allow it from a device with sharing access.`}},FK=Er(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),IK=class extends tr()(`effect/http/FetchHttpClient/RequestInit`){},LK=QO(B(KO((e,t,n,r)=>{let i=r.getRef(FK),a=gr(r.context,IK)??{},o=a.headers?Oh(wh(a.headers),e.headers):e.headers;o[`content-length`]&&(o=kh(o,`content-length`));let s=r=>Kf(Df({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:typeof ReadableStream<`u`&&r instanceof ReadableStream?`half`:void 0,signal:n}),catch:t=>new $D({reason:new nO({request:e,cause:t})})}),t=>RO(e,t));switch(e.body._tag){case`Raw`:case`Uint8Array`:return s(e.body.body);case`FormData`:return s(e.body.formData);case`Stream`:return Bf(Jae(e.body.stream),s)}return s(void 0)}))),RK={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`},zK=class extends Y()(`HttpFailureMessage`,{name:K,message:K}){};function $(e,t,n={}){let r=typeof n.message==`object`?void 0:n.message??new e().message,i={statusCode:Bk(t),error:RK[t],...n.code===void 0?{}:{code:n.code}};return q({statusCode:G(i.statusCode),error:G(i.error),message:r===void 0?K:G(r),code:Ob(n.code===void 0?Mb:G(n.code))}).pipe(Jb(pb(t=>t instanceof e||t instanceof zK&&t.name===e.name),u_({decode:t=>r===void 0?new zK({name:e.name,message:t.message}):new e,encode:e=>({...i,message:r??e.message})})),Hk(t))}var BK=$(hK,`ServiceUnavailable`,{message:`Operation unavailable`}),VK={onExcessProperty:`error`},HK=ZA(`porcelain`).annotate(tj,VK).annotate(nj,VK).annotate(ij,VK),UK=q({pullStrategy:Gb([`merge`,`rebase`]),collapseSpecs:Ib,archiveDeleteWorktree:Ib,archiveDeleteLocalBranch:Ib,archiveDeleteRemoteBranch:Ib}),WK=Gb([`desktop`,`laptop`,`server`,`cloud`]),GK=q({name:K,custom:Ib,icon:Ob(WK)}),KK=q({environmentId:K,name:K,version:AG(K),protocol:Fb.check(dx()).check(sx(0))}),qK=q({name:Kb(K.pipe(Yb(d_())).check(px(1)).check(hx(64)).check(nx(e=>!/\p{Cc}/u.test(e))))}),JK=GK,YK=q({icon:Kb(WK)}),XK=GK,ZK=q({status:G(`ok`),environmentId:K}),QK={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return $K({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 $K({requests:t,annotations:ur(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return $K({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 $K({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return H(function*(){let n=yield*up(),r=Sf(e)?yield*e:e,i=new Map;return t.requests.forEach((e,t)=>{i.set(e.key,{tag:e._tag,handler:r[t],context:n})}),ur(i)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return $K({requests:t,annotations:this.annotations})},toLayer(e){return Gu(this.toHandlers(e))},of:o,toLayerHandler(e,t){let n=this;return Gu(H(function*(){let r=yield*up(),i=Sf(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),ur(a)}))},accessHandler(e){return dp(t=>{let n=this.requests.get(e),{handler:r,context:i}=_r(t,n.key);return B((e,t)=>{t.rpc=n;let a=r(e,t),o=lM(a)?a.value:a;return Sf(o)?fp(o,i):yT(o,i)})})},annotate(e,t){return $K({requests:this.requests,annotations:hr(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(mr(e,t))},annotateMerge(e){return $K({requests:this.requests,annotations:wr(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(wr(e,r.annotations)));return $K({requests:t,annotations:this.annotations})}},$K=e=>Object.assign(function(){},QK,{requests:e.requests,annotations:e.annotations}),eq=(...e)=>$K({requests:new Map(e.map(e=>[e._tag,e])),annotations:pr()}),tq=`(?:[0-9a-f]{40}|[0-9a-f]{64})`,nq=K.check(rx(RegExp(`^${tq}$`))),rq=K.check(rx(RegExp(`^${tq}(?:,${tq})*$`))),iq=Gb([`switch`,`fetch`,`pull`,`push`,`commit`,`amend`,`stash-create`,`stash-apply`,`stash-pop`,`discard`]),aq=q({requestId:K.check(ix()),projectId:K.check(ix()),worktreeId:kG,action:iq,state:Gb([`running`,`succeeded`,`no-change`,`rejected`,`conflicted`,`interrupted`]),reason:W(Gb([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`])),message:W(K),progress:J(K),result:W(q({headOid:W(nq),trackingOid:W(nq),sourceOid:W(nq),destinationRef:W(K),stashOid:W(nq),stashRetained:W(Ib),restoreStashOid:W(nq),restoreIndex:W(Ib),branch:W(K)})),acceptedAt:DG,finishedAt:W(DG)}),oq=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;function sq(e,t){return e.length>0&&e.length<=t&&!e.includes(`\0`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)&&!oq.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e.toLowerCase()!==`.git`)}var cq=K.check(px(1)).check(hx(dG)).check(nx(e=>sq(e,dG),{expected:`Expected a normalized relative path`})),lq=q({projects:J(K.check(ix())).check(hx(128)),worktrees:J(q({projectId:K.check(ix()),worktreeId:kG,paths:J(cq).check(hx(64))})).check(hx(32))}).annotate({parseOptions:{onExcessProperty:`error`}}),uq=eq(aM(`notices`,{success:Wb([q({type:G(`ready`)}),q({type:G(`subscribed`)}),q({type:G(`heartbeat`)}),q({type:G(`inventory`)}),q({type:G(`git-action`),projectId:K.check(ix()),worktreeId:kG,receipt:aq}),q({type:G(`project`),projectId:K.check(ix()),change:Gb([`files`,`preferences`])}),q({type:G(`worktree`),projectId:K.check(ix()),worktreeId:kG,change:Gb([`files`,`git`,`reviewed`,`comments`,`review`])})]),stream:!0}),aM(`follow`,{payload:lq})),dq=q({ticket:K,expiresAt:K}),fq=q({ticket:W(K)}),pq=Pb,mq=q({address:K,dataDirectory:K,pid:Fb.check(dx()).check(sx(0))}),hq=Wb([q({kind:G(`off`)}),q({kind:G(`starting`)}),q({kind:G(`on`),urls:J(K)}),q({kind:G(`paused`)}),q({kind:G(`failed`),reason:Gb([`address-in-use`,`address-unavailable`,`unreachable`,`other-server`])})]),gq=q({interfaceName:K,subnet:K,gateway:K,gatewayHardware:W(K)}),_q=q({enabled:Ib,status:hq}),vq=K.check(rx(/^[a-f0-9]{64}$/)).pipe(hie(`WaysInFingerprint`)),yq=Gb([`lan`,`tailnet`,`cloudflare`]),bq=q({routes:q({lan:_q,tailnet:_q,cloudflare:_q}),lanNetwork:W(gq),localNetwork:W(gq),tailnetHostname:W(K),tailnetTarget:W(K),cloudflareHostname:W(K),serviceUrl:K,editing:q({fingerprint:vq,protectedRoute:W(yq)})}),xq=q({expected:vq,change:q({lan:W(Ib),tailnet:W(Ib),tailnetHostname:W(K.check(px(1)).check(hx(253))),cloudflare:W(Ib),cloudflareHostname:W(K.check(px(1)).check(hx(253)))}).check(nx(e=>Object.keys(e).length>0))}),Sq=bq,Cq=fx.check(sx(0)).check(lx(2**53-1)),wq=q({kind:G(`configured`),revision:Cq,settings:UK}),Tq=Wb([q({kind:G(`unconfigured`)}),wq]),Eq=Wb([q({kind:G(`initialize`),settings:UK}),q({kind:G(`change`),change:UK.mapFields(iie(Ob)).check(Oie(1))})]),Dq=wq,Oq=q({from:K,target:K,stage:Gb([`downloading`,`installing`,`restarting`,`updated`,`failed`]),reason:AG(K)}),kq=q({managed:Ib,version:AG(K),latest:AG(K),available:Ib,running:Ib,last:AG(Oq),canUpdate:Ib}),Aq=q({version:K.check(px(1)).check(hx(128))}),jq=kq,Mq=$(fK,`BadRequest`),Nq=BG(`publicAccess`).add(HA(`readHealth`,`/health`,{disableCodecs:!0,success:ZK,error:BK}),HA(`readEnvironment`,`/environment`,{disableCodecs:!0,success:KK,error:BK})),Pq=BG(`browserAccess`).add(KA(`clearBrowserSession`,`/session`,{disableCodecs:!0,success:lK.pipe(Wk({decode:()=>void 0}),Hk(`NoContent`))})),Fq=BG(`pairing`).add(UA(`redeemPairing`,`/pair`,{disableCodecs:!0,payload:qG,success:JG,error:[Mq,$(mK,`Unauthorized`)]})).middleware(uK),Iq=BG(`session`).add(HA(`readSession`,`/session`,{disableCodecs:!0,success:VG}),UA(`issueLiveTicket`,`/live/tickets`,{disableCodecs:!0,success:dq,error:[$(TK,`Forbidden`),$(EK,`TooManyRequests`)]})).middleware(dK).middleware(uK),Lq=BG(`serviceUpdates`).add(HA(`readServiceUpdate`,`/service/update`,{disableCodecs:!0,success:kq}),UA(`startServiceUpdate`,`/service/update`,{disableCodecs:!0,payload:Aq,success:jq.pipe(Hk(`Accepted`)),error:[$(OK,`Forbidden`),$(SK,`Conflict`),$(wK,`Conflict`),$(CK,`Conflict`)]})).middleware(dK).middleware(uK),Rq=BG(`reviewGitSettings`).add(HA(`readReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,success:Tq}),GA(`saveReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,payload:Eq,success:Dq,error:[$(MK,`Forbidden`),$(NK,`Conflict`)]})).middleware(dK).middleware(uK),zq=$(PK,`Forbidden`),Bq=BG(`administration`).add(HA(`listAccess`,`/access`,{disableCodecs:!0,success:QG,error:zq}),UA(`issuePairing`,`/pairings`,{disableCodecs:!0,payload:$G,success:eK,error:[zq,BK,Mq,$(pK,`BadRequest`)]}),UA(`revokeAccess`,`/access/revoke`,{disableCodecs:!0,payload:tK,success:nK,error:zq}),UA(`setDeviceTrust`,`/access/trust`,{disableCodecs:!0,payload:rK,success:iK,error:[zq,$(DK,`NotFound`)]}),UA(`setManagementPermission`,`/access/management-permission`,{disableCodecs:!0,payload:sK,success:cK,error:[zq,$(DK,`NotFound`)]}),UA(`setWaysInPermission`,`/access/ways-in-permission`,{disableCodecs:!0,payload:aK,success:oK,error:[zq,$(DK,`NotFound`)]})).middleware(dK).middleware(uK),Vq=$(kK,`Forbidden`),Hq=BG(`remoteAccess`).add(HA(`readRemoteAccess`,`/remote-access`,{disableCodecs:!0,success:bq,error:Vq}),GA(`setRemoteAccess`,`/remote-access`,{disableCodecs:!0,payload:xq,success:Sq,error:[Vq,$(AK,`Conflict`),$(jK,`Conflict`),$(vK,`BadRequest`),$(gK,`BadRequest`),$(yK,`BadRequest`),$(_K,`BadRequest`),$(bK,`Conflict`),$(xK,`Conflict`)]})).middleware(dK).middleware(uK),Uq=BG(`environmentLabel`).add(WA(`renameEnvironment`,`/environment/name`,{disableCodecs:!0,payload:qK,success:JK})).add(WA(`setEnvironmentIcon`,`/environment/icon`,{disableCodecs:!0,payload:YK,success:XK})).middleware(dK),Wq=BG(`ownerStatus`).add(HA(`readOwnerStatus`,`/status`,{disableCodecs:!0,success:mq})).middleware(dK);HK.add(Nq).prefix(`/api`),HK.add(Pq).prefix(`/api`);var Gq=class extends HK.add(Fq).prefix(`/api`){};HK.add(Iq).prefix(`/api`),HK.add(Lq).prefix(`/api`),HK.add(Hq).prefix(`/api`),HK.add(Rq).prefix(`/api`),HK.add(Bq).prefix(`/api`),HK.add(Uq).prefix(`/api`),HK.add(Bq,Hq,Wq);var Kq=class extends HK.add(Nq,Pq,Fq,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:Gb([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`]),detail:W(K),cause:W(Nb)}),Y()(`RepositoryIdentityMismatchError`,{});var iJ=class extends Error{name=`GitError`},aJ=class extends iJ{name=`HistorySnapshotUnavailableError`;constructor(e){super(`History snapshot is unavailable`,e)}},oJ=class extends iJ{name=`HistoryWorktreeUnavailableError`;constructor(e){super(`Worktree is unavailable`,e)}},sJ=class extends iJ{name=`InvalidHistoryRequestError`;constructor(e){super(`Invalid history request`,e)}},cJ=class extends iJ{name=`ReadLimitExceededError`;constructor(e){super(`History read exceeds its limit`,e)}},lJ=class extends iJ{name=`UnsupportedHistoryDataError`;constructor(e){super(`History contains unsupported data`,e)}},uJ=class extends Y()(`GitTimeoutError`,{}){get message(){return`Git command exceeded its deadline`}},dJ=class extends iJ{name=`InspectionLimitError`;constructor(e){super(`Git inspection exceeds its limit`,e)}},fJ=class extends iJ{name=`InvalidGitDiffError`;constructor(){super(`Invalid Git diff output`)}},pJ=class extends iJ{name=`InvalidGitStatusError`;constructor(){super(`Invalid Git status output`)}},mJ=class extends iJ{name=`UnsupportedGitFiltersError`;constructor(){super(`Git conversion filters are unsupported for worktree inspection`)}},hJ=class extends iJ{name=`UnsupportedPathEncodingError`;constructor(e){super(`Git paths require valid UTF-8`,e)}};Y()(`GitCommandError`,{checkout:K,args:J(K),exitCode:qb(Fb),stderr:K,cause:W(Nb)}),Y()(`GitFilesystemError`,{cause:Nb}),Y()(`UnsupportedFilesystemIdentityError`,{}),Y()(`UnsupportedRepositoryError`,{});var gJ=[$(aJ,`UnprocessableEntity`,{message:`History snapshot is unavailable; start a new listing`}),$(oJ,`UnprocessableEntity`,{message:`Worktree is unavailable`}),$(sJ,`BadRequest`),$(cJ,`UnprocessableEntity`,{message:`History read exceeds its limit`}),$(lJ,`UnprocessableEntity`,{message:`History contains unsupported data`}),$(uJ,`ServiceUnavailable`,{message:`Operation unavailable`}),$(dJ,`PayloadTooLarge`,{message:`Git inspection exceeds its limit`}),$(fJ,`BadGateway`,{message:`Git produced output that could not be read`}),$(pJ,`BadGateway`,{message:`Git produced output that could not be read`}),$(mJ,`UnprocessableEntity`,{message:`Git conversion filters are unsupported for worktree inspection`}),$(hJ,`UnprocessableEntity`,{message:`Git paths require valid UTF-8`}),$(Xq,`UnprocessableEntity`,{message:`Repository could not be inspected`})],_J=class extends Y()(`ContentChangedError`,{}){get message(){return`Content changed; retry the operation`}},vJ=class extends Y()(`CrossDeviceMoveError`,{}){get message(){return`Destination is on another filesystem; nothing was moved`}},yJ=class extends Y()(`DiskFullError`,{}){get message(){return`There is not enough space on the disk`}},bJ=class extends Y()(`DirectoryTooLargeError`,{}){get message(){return`Directory exceeds the listing limit`}},xJ=class extends Y()(`EntryExistsError`,{}){get message(){return`An entry already exists at that path`}},SJ=class extends Y()(`FileTooLargeError`,{}){get message(){return`File exceeds the read limit`}},CJ=class extends Y()(`InvalidMoveError`,{}){get message(){return`An entry cannot be moved onto or into itself`}},wJ=class extends Y()(`PathNotFoundError`,{}){get message(){return`Path not found`}},TJ=class extends Y()(`PathNotReadableError`,{}){get message(){return`Path could not be read`}},EJ=class extends Y()(`TrashUnavailableError`,{}){get message(){return`This machine has no trash; nothing was deleted`}},DJ=class extends Y()(`UnsupportedAssetTypeError`,{}){get message(){return`File type cannot be previewed`}},OJ=class extends Y()(`UnsupportedEntryNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},kJ=class extends Y()(`UnsupportedTextError`,{}){get message(){return`File is not supported UTF-8 text`}},AJ=$(CJ,`BadRequest`,{message:`Invalid request`}),jJ=$(wJ,`NotFound`),MJ=$(_J,`Conflict`,{code:`content_changed`}),NJ=$(xJ,`Conflict`),PJ=$(TJ,`UnprocessableEntity`),FJ=$(OJ,`UnprocessableEntity`),IJ=$(bJ,`UnprocessableEntity`),LJ=$(vJ,`UnprocessableEntity`),RJ=$(EJ,`UnprocessableEntity`),zJ=$(DJ,`UnprocessableEntity`),BJ=$(kJ,`UnprocessableEntity`,{code:`unsupported_text`}),VJ=$(SJ,`UnprocessableEntity`,{code:`file_too_large`}),HJ=$(yJ,`UnprocessableEntity`),UJ=[...rJ,jJ,PJ,MJ],WJ=[...UJ,BJ,VJ],GJ=class extends Y()(`BranchBaseNotFoundError`,{}){get message(){return`Base branch not found`}},KJ=class extends Y()(`CommitNotFoundError`,{}){get message(){return`Commit not found`}},qJ=class extends Y()(`IncompleteDiffReadError`,{}){get message(){return`Diff read returned fewer results than requested`}},JJ=class extends Y()(`SelectionMismatchError`,{}){get message(){return`Selections must cover exactly the expected files`}},YJ=class extends Y()(`UnnamedDiffSelectionError`,{}){get message(){return`A diff selection names neither an old nor a new path`}},XJ=class extends Y()(`UnbornBranchError`,{}){get message(){return`The branch has no commits yet`}},ZJ=class extends Y()(`UnrelatedBranchError`,{}){get message(){return`The branch shares no history with its base`}},QJ=K.check(px(1)).check(hx(gG)).check(rx(/^refs\/(?:heads|remotes)\/\S+$/u)),$J=K.check(rx(/^[a-f0-9]{64}$/)),eY=Wb([q({kind:G(`text`),patch:K}),q({kind:G(`binary`)}),q({kind:G(`metadata-only`),patch:K}),q({kind:G(`omitted`),reason:Gb([`size-limit`,`unsupported-encoding`,`unsupported-submodule`])})]),tY=q({ref:K,oid:nq}),nY=q({path:K,oldPath:AG(K),newPath:AG(K),status:Gb([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldOid:W(nq),newOid:W(nq),oldMode:K,newMode:K,fingerprint:$J}),rY=q({base:W(QJ)}),iY=q({worktreeId:kG,head:q({oid:nq,branch:AG(K)}),base:AG(tY),mergeBaseOid:AG(nq),commits:Fb.check(dx()).check(cx(0)),files:J(nY).check(hx(mG))}),aY=q({baseOid:nq,headOid:nq,paths:J(J(K).check(px(1)).check(hx(2))).check(px(1)).check(hx(200))}),oY=q({diffs:J(q({paths:J(K),content:eY}))}),sY=q({defaultRef:AG(K),bases:J(q({ref:K,name:K,remote:Ib})).check(hx(500))}),cY=q({additions:fx,deletions:fx,binaryFiles:fx}),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=Gb([`DD`,`AU`,`UD`,`UA`,`DU`,`AA`,`UU`]),fY=Gb([`both-deleted`,`added-by-us`,`deleted-by-them`,`added-by-them`,`deleted-by-us`,`both-added`,`both-modified`]),pY=dY.pipe(Jb(fY,u_({decode:e=>lY[e],encode:e=>uY[e]}))),mY=q({scope:Gb([`staged`,`unstaged`]),oldPath:AG(cq),newPath:AG(cq)}),hY=Wb([q({scope:Gb([`staged`,`unstaged`]),kind:Gb([`added`,`modified`,`deleted`,`renamed`,`type-changed`]),oldPath:AG(cq),newPath:AG(cq),oldMode:K.check(rx(/^[0-7]{6}$/)),newMode:K.check(rx(/^[0-7]{6}$/)),oldOid:AG(nq),newOid:AG(nq),supported:Ib}),q({scope:G(`untracked`),path:cq}),q({scope:G(`unmerged`),path:cq,conflict:pY})]),gY=q({environmentId:K.check(ix()),worktreeId:kG,statusToken:$J,branch:W(q({name:AG(K),upstream:AG(K),ahead:Fb.check(dx()).check(cx(0)),behind:Fb.check(dx()).check(cx(0)),remoteName:AG(K),sourceRef:AG(K),upstreamOid:AG(nq),stashes:J(q({oid:nq,message:K})),discarded:J(q({oid:nq,path:cq,kind:Gb([`hunk`,`rename`])})).check(hx(50))})),consistency:G(`best-effort`),headOid:AG(nq),inProgress:AG(Gb([`merge`,`rebase`])),mergeHeadOid:AG(nq),headCommit:AG(q({subject:K,body:W(K)})),changes:J(hY).check(hx(lG))}),_Y=q({environmentId:K.check(ix()),worktreeId:kG,...cY.fields,additions:cY.fields.additions.check(cx(0)),deletions:cY.fields.deletions.check(cx(0)),binaryFiles:cY.fields.binaryFiles.check(cx(0))}),vY=q({path:cq,fingerprint:AG($J),comparisons:J(hY).check(px(1))}),yY=q({name:AG(K),upstream:AG(K),ahead:Fb.check(dx()).check(cx(0)),behind:Fb.check(dx()).check(cx(0))}),bY=q({environmentId:K.check(ix()),worktreeId:kG,statusToken:$J,headOid:AG(nq),inProgress:AG(Gb([`merge`,`rebase`])),mergeHeadOid:AG(nq),branch:AG(yY),interrupted:W(q({requestId:K.check(ix()),action:iq})),changes:J(vY).check(hx(lG))}),xY=q({expectedStatusToken:$J,expectedFiles:J(q({path:cq,fingerprint:AG($J)})).check(px(1)).check(hx(200)),selections:J(mY).check(px(1)).check(hx(200))}),SY=q({environmentId:K.check(ix()),worktreeId:kG,statusToken:$J,diffs:J(q({selection:mY,content:eY}))}),CY=q({path:cq,from:Cx.check(dx()).check(cx(1)),to:Cx.check(dx()).check(cx(1)),at:Gb([`head`,`worktree`])}),wY=q({environmentId:K.check(ix()),worktreeId:kG,at:Gb([`head`,`worktree`]),path:cq,from:Fb.check(dx()).check(cx(0)),to:Fb.check(dx()).check(cx(0)),lines:J(K)}),TY=rq,EY=J(nq),DY=TY.pipe(Jb(EY,u_({decode:e=>e.split(`,`),encode:e=>e.join(`,`)}))),OY=q({limit:W(Cx.check(dx()).check(cx(1)).check(lx(100))),after:W(DY),tip:W(nq)}),kY=Wb([q({kind:G(`attached`),ref:K}),q({kind:G(`detached`)}),q({kind:G(`unborn`),ref:K})]),AY=Wb([q({kind:Gb([`local-branch`,`remote-branch`,`tag`]),name:K}),q({kind:G(`head`),name:G(`HEAD`)})]),jY=q({oid:nq,parentOids:J(nq),author:q({name:K,timestamp:K}),subject:K,subjectTruncated:Ib,body:AG(K),bodyTruncated:Ib,refs:J(AY)}),MY=q({snapshot:AG(q({tipOid:AG(nq),head:kY})),commits:J(jY).check(hx(100)),nextAfter:AG(J(nq).check(hx(100))),tip:AG(nq),boundary:AG(Gb([`shallow`,`wide`])),restarted:Ib}),NY=q({tip:nq,offset:fx.check(cx(1)).check(lx(2**53-1-100-1))}),PY=q({path:cq,after:W(Sx(NY)),limit:W(Cx.check(dx()).check(cx(1)).check(lx(100)))}),FY=q({commits:J(q({commit:jY,path:K,previousPath:AG(K),status:Gb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})).check(hx(100)),nextAfter:AG(NY),tip:AG(nq),boundary:AG(G(`shallow`)),restarted:Ib}),IY=Wb([q({kind:G(`parent`),parentNumber:Fb.check(dx()).check(sx(0)),baseOid:nq}),q({kind:G(`empty-tree`)})]),LY=q({oldPath:AG(K),newPath:AG(K),status:Gb([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldMode:K,newMode:K}),RY=q({worktreeId:kG,oid:nq}),zY=q({parent:W(Cx.check(dx()).check(cx(1)).check(lx(pG)))}),BY=q({commit:jY,comparison:IY,files:J(LY).check(hx(mG))}),VY=q({worktreeId:kG,oid:nq}),HY=q({parent:W(Fb.check(dx()).check(cx(1)).check(lx(pG))),paths:J(J(K).check(px(1)).check(hx(2))).check(px(1)).check(hx(200))}),UY=q({commitOid:nq,diffs:J(q({paths:J(K),content:eY}))}),WY=class extends HK.add(BG(`changes`).add(HA(`readWorktreeSummary`,`/api/worktrees/:worktreeId/summary`,{disableCodecs:!0,params:jG,success:_Y,error:[BK,...rJ,...gJ]}),HA(`listBranchBases`,`/api/worktrees/:worktreeId/branch-bases`,{disableCodecs:!0,params:jG,success:sY,error:[...rJ,...gJ]}),HA(`listCommits`,`/api/worktrees/:worktreeId/commits`,{disableCodecs:!0,params:jG,query:OY.fields,success:MY,error:[...rJ,...gJ]}),HA(`listFileCommits`,`/api/worktrees/:worktreeId/file-commits`,{disableCodecs:!0,params:jG,query:PY.fields,success:FY,error:[...rJ,...gJ]}),HA(`readBranchChanges`,`/api/worktrees/:worktreeId/branch-changes`,{disableCodecs:!0,params:jG,query:rY.fields,success:iY,error:[...rJ,...gJ,$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),UA(`readBranchDiffs`,`/api/worktrees/:worktreeId/branch-changes/diffs`,{disableCodecs:!0,params:jG,payload:aY,success:oY,error:[...rJ,...gJ,$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),UA(`readChangeDiffs`,`/api/worktrees/:worktreeId/changes/diffs`,{disableCodecs:!0,params:jG,payload:xY,success:SY,error:[BK,...rJ,...gJ,$(JJ,`BadRequest`,{message:`Invalid request`}),$(YJ,`BadRequest`,{message:`Invalid request`}),$(qJ,`UnprocessableEntity`)]}),HA(`readChangeLines`,`/api/worktrees/:worktreeId/changes/lines`,{disableCodecs:!0,params:jG,query:CY.fields,success:wY,error:[BK,...WJ,$(qq,`BadRequest`,{message:`Invalid request`})]}),HA(`readChanges`,`/api/worktrees/:worktreeId/changes`,{disableCodecs:!0,params:jG,success:bY,error:[BK,...rJ,...gJ]}),UA(`readCommitDiffs`,`/api/worktrees/:worktreeId/commits/:oid/diffs`,{disableCodecs:!0,params:VY,payload:HY,success:UY,error:[...rJ,...gJ,$(KJ,`NotFound`)]}),HA(`readCommitFiles`,`/api/worktrees/:worktreeId/commits/:oid/files`,{disableCodecs:!0,params:RY,query:zY.fields,success:BY,error:[...rJ,...gJ,$(KJ,`NotFound`)]}),HA(`readGitStatus`,`/api/worktrees/:worktreeId/git/status`,{disableCodecs:!0,params:jG,success:gY,error:[BK,...rJ,...gJ]})).middleware(dK)){};function GY(e){return new TextEncoder().encode(e).byteLength}var KY=Wb([G(``),cq]),qY=K.check(nx(e=>e.length<=1048576&&!e.includes(`\0`)&&GY(e)<=1048576,{expected:`UTF-8 text without NUL within the write limit`})),JY=q({path:KY}),YY=vb(q({worktreeId:kG,path:K,entries:J(q({name:K,kind:Gb([`file`,`directory`,`symlink`,`submodule`,`other`]),ignored:W(Ib),target:W(K)}))})),XY=vb(q({worktreeId:kG,paths:J(K).check(hx(_G))})),ZY=q({path:cq}),QY=vb(q({worktreeId:kG,path:K,encoding:G(`utf-8`),byteLength:fx.check(cx(0)),text:K,contentFingerprint:W($J)})),$Y=Wb([q({kind:G(`write`),path:cq,text:qY,expectedFingerprint:$J}),q({kind:G(`create`),path:cq,entryKind:Gb([`file`,`directory`])}),q({kind:G(`move`),path:cq,destination:cq}),q({kind:G(`trash`),path:cq}),q({kind:G(`copy`),path:cq,destination:cq})]),eX=vb(q({path:K,contentFingerprint:W($J)})),tX=q({path:cq}),nX=vb(q({path:K,mediaType:K,base64:K})),rX=q({document:cq,paths:J(K.check(hx(dG))).check(px(1),hx(64))}),iX=vb(q({assets:J(Wb([q({kind:G(`asset`),path:K,mediaType:K,base64:K}),q({kind:G(`unavailable`),path:K})]))})),aX=class extends HK.add(BG(`files`).add(HA(`listDirectory`,`/api/worktrees/:worktreeId/directory`,{disableCodecs:!0,params:jG,query:JY.fields,success:YY,error:[...UJ,FJ,IJ]}),HA(`listWorktreePaths`,`/api/worktrees/:worktreeId/paths`,{disableCodecs:!0,params:jG,success:XY,error:[...rJ,IJ]}),HA(`readTextFile`,`/api/worktrees/:worktreeId/text`,{disableCodecs:!0,params:jG,query:ZY.fields,success:QY,error:[...UJ,BJ,VJ]}),HA(`readFileAsset`,`/api/worktrees/:worktreeId/asset`,{disableCodecs:!0,params:jG,query:tX.fields,success:nX,error:[...UJ,zJ,VJ]}),UA(`readPreviewAssets`,`/api/worktrees/:worktreeId/preview-assets`,{disableCodecs:!0,params:jG,payload:rX,success:iX,error:rJ}),UA(`editFile`,`/api/worktrees/:worktreeId/files`,{disableCodecs:!0,params:jG,payload:$Y,success:eX,error:[...UJ,BJ,NJ,LJ,RJ,VJ,HJ,AJ]})).middleware(dK)){},oX=class extends Y()(`CommitDraftSelectionError`,{}){get message(){return`Select readable changed files to generate a commit draft.`}},sX=class extends Y()(`CommitDraftTooLargeError`,{}){get message(){return`Select fewer files to generate a commit draft.`}},cX=class extends Y()(`CommitGenerationFailedError`,{}){get message(){return`Commit generation failed.`}},lX=class extends Y()(`CommitGroupsMismatchError`,{}){get message(){return`The generated draft did not cover the selected files. Generate again or write the message manually.`}},uX=class extends Y()(`CommitToolFailedError`,{}){get message(){return`Commit generation failed. Check that the selected CLI is up to date and signed in.`}},dX=class extends Y()(`CommitToolMissingError`,{}){get message(){return`The selected coding CLI is not installed.`}},fX=class extends Y()(`DiscardExpectationMismatchError`,{}){get message(){return`A discard expects exactly the discarded path`}},pX=class extends Y()(`DuplicateExpectedFileError`,{}){get message(){return`Each expected file may appear only once`}},mX=class extends Y()(`EmptyCommitSelectionError`,{}){get message(){return`Select at least one path to commit`}},hX=class extends Y()(`ExpectedFilesMismatchError`,{}){get message(){return`The expected files do not match the selected paths`}},gX=class extends Y()(`GitActionNotFoundError`,{}){get message(){return`Git action receipt not found`}},_X=class extends Y()(`GitActionReceiptMismatchError`,{}){get message(){return`Git action receipt does not match this request`}},vX=class extends Y()(`InvalidHunkRangeError`,{}){get message(){return`The hunk ends before it starts`}},yX=class extends Y()(`MergeExpectationMismatchError`,{}){get message(){return`A merge in progress and its merge head must be expected together`}},bX=class extends Y()(`MissingExpectedFilesError`,{}){get message(){return`This action needs the files the client expects`}},xX=class extends Y()(`MissingUpstreamExpectationError`,{}){get message(){return`This action needs the upstream the client expects`}},SX=class extends Y()(`UnsupportedCommitModelError`,{}){get message(){return`Unsupported commit model.`}},CX=class extends Y()(`WorktreeCleanupRefusedError`,{message:K}){},wX=J(q({id:K,label:K})),TX=q({mode:Gb([`message`,`groups`]),model:K.check(px(1)).check(hx(160)),expectedStatusToken:$J,paths:J(cq).check(px(1)).check(hx(lG))}),EX=q({groups:J(q({message:K.check(px(1)).check(hx(cG)),paths:J(cq).check(px(1)).check(hx(lG))})).check(px(1)).check(hx(20)),expectedFiles:J(q({path:cq,fingerprint:$J})).check(hx(lG))}),DX=K.check(px(1)).check(hx(cG)).check(nx(e=>e.trim().length>0&&!e.includes(`\0`)&&GY(e)<=16384)),OX=K.check(hx(gG)).check(rx(/^refs\/heads\/[\s\S]/u)).check(nx(e=>!e.includes(`\0`))),kX=K.check(rx(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/)),AX=q({path:cq,fingerprint:$J}),jX=q({worktreeId:kG,requestId:K.check(ix())}),MX=Wb([q({action:G(`switch`),targetRef:OX}),q({action:G(`fetch`),remoteName:kX,sourceRef:OX}),q({action:G(`pull`),remoteName:kX,sourceRef:OX,strategy:W(Gb([`ff-only`,`merge`,`rebase`]))}),q({action:G(`push`),remoteName:kX,destinationRef:OX,allowCreate:Ib}),q({action:G(`commit`),message:DX,paths:J(cq).check(hx(lG))}),q({action:G(`amend`),message:DX,paths:J(cq).check(hx(lG))}),q({action:G(`stash-create`),message:DX,includeUntracked:Ib}),q({action:Gb([`stash-apply`,`stash-pop`]),stashOid:nq,restoreIndex:Ib.pipe(Qb(B(!1)))}),q({action:G(`discard`),path:cq,hunk:W(q({scope:Gb([`staged`,`unstaged`]),startLine:Fb.check(dx()).check(sx(0)),endLine:Fb.check(dx()).check(sx(0))}))})]),NX=q({headOid:AG(nq),branch:AG(K),inProgress:AG(Gb([`merge`,`rebase`])),mergeHeadOid:AG(nq),upstreamOid:W(Kb(nq)),files:W(J(AX).check(hx(lG)))}),PX=q({requestId:K.check(ix()),input:MX,expected:NX}),FX=aq,IX=Wb([aq,TG]),LX=jX,RX=aq,zX=jX,BX=q({dismissed:G(!0)}),VX=$(_X,`Conflict`,{message:`Git action request does not match its receipt`}),HX=$(gX,`NotFound`),UX=[$(vX,`BadRequest`,{message:`Invalid request`}),$(pX,`BadRequest`,{message:`Invalid request`}),$(yX,`BadRequest`,{message:`Invalid request`}),$(mX,`BadRequest`,{message:`Invalid request`}),$(hX,`BadRequest`,{message:`Invalid request`}),$(fX,`BadRequest`,{message:`Invalid request`}),$(bX,`BadRequest`,{message:`Invalid request`}),$(xX,`BadRequest`,{message:`Invalid request`})],WX=[$(oX,`UnprocessableEntity`),$(sX,`UnprocessableEntity`),$(cX,`UnprocessableEntity`),$(lX,`UnprocessableEntity`),$(uX,`UnprocessableEntity`),$(dX,`UnprocessableEntity`),$(SX,`UnprocessableEntity`)],GX=class extends HK.add(BG(`gitActions`).add(KA(`dismissInterruptedGitAction`,`/api/worktrees/:worktreeId/git/interrupted/:requestId`,{disableCodecs:!0,params:zX,success:BX,error:[...rJ,HX,VX]}),UA(`generateCommitDraft`,`/api/worktrees/:worktreeId/git/commit-draft`,{disableCodecs:!0,params:jG,payload:TX,success:EX,error:[...rJ,...gJ,...WX]}),HA(`listCommitModels`,`/api/git/commit-models`,{disableCodecs:!0,success:wX}),HA(`readGitActionReceipt`,`/api/worktrees/:worktreeId/git/receipts/:requestId`,{disableCodecs:!0,params:LX,success:RX,error:[...rJ,HX]}),UA(`runGitAction`,`/api/worktrees/:worktreeId/git/actions`,{disableCodecs:!0,params:jG,payload:PX,success:[FX,FX.pipe(Hk(202)),IX.pipe(Hk(409)),IX.pipe(Hk(503))],error:[...rJ,VX,...UX]})).middleware(dK)){};q({address:K,dataDirectory:K,pid:fx}),q({path:kb(K),fingerprint:kb(Wb([K,Pb]))});var KX=q({deleteWorktree:Ib,deleteLocalBranch:Ib,deleteRemoteBranch:Ib}),qX=q({worktreePath:W(K),detachWorktreePath:W(K),localBranch:W(K),remoteBranch:W(K),remoteBranchNote:W(K),mainCheckout:Ib,dirty:Ib,unpushed:Ib,fingerprint:K}),JX=q({options:KX,confirmation:W(q({plan:qX,discardChanges:Ib}))}),YX=JX,XX=q({deleted:Ib,plan:qX}),ZX=K.check(nx(e=>sq(e,dG),{expected:`a normalized relative path`})),QX=vb(q({preferences:J(q({path:ZX,pinned:Ib,hidden:Ib}))})),$X=q({path:ZX,flag:Gb([`pinned`,`hidden`]),value:Ib}),eZ=QX,tZ=Gb([`moved`,`missing`,`permission`,`git-failed`]),nZ=K.check(px(1),hx(dG),nx(e=>e.startsWith(`/`)&&!e.includes(`\0`),{expected:`an absolute path without NUL`})),rZ={id:OG,name:K,worktrees:J(q({id:kG,path:K,main:Ib,branch:AG(K),headCommittedAt:Ob(DG),available:Ib,status:AG(Gb([`pending`,`reviewed`,`replied`]))}))},iZ=Wb([q({...rZ,available:G(!0),unavailableReason:Ob(Mb)}),q({...rZ,available:G(!1),unavailableReason:Ob(tZ)})]),aZ=q({projectId:OG}),oZ=aZ,sZ=aZ,cZ=aZ,lZ=vb(q({environmentId:OG,environment:GK,projects:J(iZ)})),uZ=q({path:nZ}),dZ=vb(iZ),fZ=q({deleted:Ib}),pZ=q({path:Ob(nZ)}),mZ=vb(q({path:K,parent:AG(K),directories:J(q({name:K,path:K})),repository:Ib,truncated:Ib})),hZ=vb(q({name:K.pipe(Jb(K.check(px(1),hx(100),nx(e=>!/[\p{Cc}\p{Cf}]/u.test(e),{expected:`a name without control characters`})),u_({decode:e=>e.trim(),encode:e=>e})))}),{parseOptions:VK}),gZ=q({id:OG,name:K}),_Z=$(eJ,`NotFound`),vZ=class extends HK.add(BG(`projects`).add(UA(`deleteWorktree`,`/api/worktrees/:worktreeId/delete`,{disableCodecs:!0,params:jG,payload:YX,success:XX,error:[...rJ,$(CX,`Conflict`,{message:{fromError:!0}})]}),HA(`browseProjectFolders`,`/api/projects/folders`,{disableCodecs:!0,query:pZ.fields,success:mZ,error:[$(Qq,`NotFound`),$($q,`UnprocessableEntity`),$(tJ,`UnprocessableEntity`)]}),HA(`readInventory`,`/api/inventory`,{disableCodecs:!0,success:lZ,error:BK}),UA(`refreshInventory`,`/api/inventory/refresh`,{disableCodecs:!0,success:lZ,error:BK}),HA(`listFilePreferences`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:sZ,success:QX,error:_Z}),UA(`registerProject`,`/api/projects`,{disableCodecs:!0,payload:uZ,success:dZ,error:[_Z,$(Xq,`UnprocessableEntity`,{message:`Repository could not be inspected`})]}),KA(`removeProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:oZ,success:fZ,error:_Z}),GA(`renameProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:aZ,payload:hZ,success:gZ,error:_Z}),WA(`setFilePreference`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:cZ,payload:$X,success:eZ,error:[_Z,$(Zq,`Conflict`,{message:`File preference limit reached`})]})).middleware(dK)){},yZ=q({path:kb(K),startLine:kb(Fb),endLine:kb(Fb),symbol:kb(W(Wb([K,Pb])))}),bZ=q({id:kb(K),lane:kb(Fb),title:kb(K),text:kb(K),kind:kb(Wb([G(`changed`),G(`context`)])),pointer:kb(yZ)}),xZ=q({id:kb(K),title:kb(K),summary:kb(K),lanes:kb(J(K)),steps:kb(J(bZ))}),SZ=q({...bZ.fields,published:kb(J(K))});q({...rie(xZ.fields,[`steps`]),steps:kb(J(SZ)),fingerprint:kb(K)});var CZ=q({id:kb(K),label:kb(K),detail:kb(W(Wb([K,Pb]))),change:kb(W(Wb([G(`new`),G(`changed`),G(`removed`),Pb]))),problem:kb(W(Wb([K,Pb]))),layerId:kb(W(Wb([K,Pb]))),decision:kb(W(G(!0)))}),wZ=q({from:kb(K),to:kb(K),label:kb(W(Wb([K,Pb])))});q({after:kb(q({boxes:kb(J(CZ)),arrows:kb(J(wZ))}))});var TZ=Gb([`merge`,`hold`]),EZ=q({what:K,why:K}),DZ=q({behavior:K,why:K,paths:J(K)});q({asked:q({text:K,links:W(J(q({title:K,url:K})))}),recommendation:TZ,reasons:J(K),notProven:J(EZ),removed:J(DZ)}),q({reviewId:K,projectId:K,commonDirectory:K,branch:K,pullRequest:W(K),state:Gb([`open`,`closed`]),archived:W(Ib),latestRevision:fx,lastSeenRevision:fx}),q({path:K,oldPath:W(K),newPath:W(K),oldOid:W(K),newOid:W(K),oldMode:K,newMode:K,status:Gb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])}),q({path:K,ranges:J(q({startLine:Fb,endLine:Fb})),deleted:W(Ib),binary:W(Ib)});var OZ=q({layerId:kb(W(Wb([K,Pb]))),stepId:kb(W(Wb([K,Pb])))}),kZ=q({...OZ.fields,name:kb(K),result:kb(Wb([G(`pass`),G(`fail`)])),output:kb(W(Wb([K,Pb])))}),AZ=Wb([G(`image`),G(`video`)]),jZ=Wb([G(`image/png`),G(`image/jpeg`),G(`image/gif`),G(`image/webp`),G(`video/mp4`),G(`video/webm`)]),MZ=Wb([q({...OZ.fields,id:kb(K),kind:kb(AZ),title:kb(K),mediaType:kb(jZ),byteLength:kb(Fb)}),q({...q({...OZ.fields,kind:kb(G(`link`)),title:kb(K),url:kb(K)}).fields,id:kb(K)})]);q({paths:W(J(K)),checks:kb(J(kZ)),assets:kb(J(MZ))});var NZ=Wb([q({kind:kb(G(`worktree`)),scope:kb(Wb([G(`staged`),G(`unstaged`),G(`untracked`)]))}),q({kind:kb(G(`file`))}),q({kind:kb(G(`commit`)),parent:kb(Fb)}),q({kind:kb(G(`branch`)),base:kb(K)})]);Wb([q({comparison:kb(W(Wb([NZ,Pb]))),revision:kb(W(Wb([K,Pb]))),contentFingerprint:kb(W(Wb([K,Pb]))),kind:kb(G(`change`))}),q({comparison:kb(W(Wb([NZ,Pb]))),revision:kb(W(Wb([K,Pb]))),contentFingerprint:kb(W(Wb([K,Pb]))),kind:kb(G(`file`)),filePath:kb(K)}),q({comparison:kb(W(Wb([NZ,Pb]))),revision:kb(W(Wb([K,Pb]))),contentFingerprint:kb(W(Wb([K,Pb]))),kind:kb(G(`codeRange`)),filePath:kb(K),startLine:kb(Fb),endLine:kb(Fb),side:kb(W(Wb([G(`additions`),G(`deletions`),Pb])))})]),Wb([G(`reviewer`),G(`agent`)]);var PZ=J(K),FZ=q({path:K,headBlobOid:K}),IZ=q({layerId:K,fingerprint:K}),LZ=q({area:Gb([`baseline`,`file-marks`,`conversation`,`proof`]),reason:K,ids:PZ}),RZ=q({files:J(Wb([q({path:K,change:Gb([`entered`,`left`])}),q({path:K,change:Gb([`changed`,`unchanged`]),headChanged:Ib,baseChanged:Ib})])),decisions:q({affected:PZ,new:PZ,gone:PZ,resetMarks:J(IZ)}),fileMarks:q({carriedCount:fx,carried:J(FZ),reset:J(FZ)}),verdict:q({recommendation:q({from:TZ,to:TZ}),removed:q({added:J(DZ),dropped:J(DZ)}),deletedFiles:q({added:PZ,dropped:PZ}),notProven:q({added:J(EZ),dropped:J(EZ)})}),conversation:q({agentMessageCount:fx,agentThreadIds:PZ,agentMessages:J(q({threadId:K,messageId:K,body:K,createdAt:K})),resolvedThreadCount:fx,resolvedThreadIds:PZ}),proof:q({publishedChecks:J(kZ),changedResults:J(q({from:kZ,to:kZ}))}),unknown:J(LZ)}),zZ=Gb([`gh-not-installed`,`no-accounts`,`no-access`,`not-github`,`rate-limited`,`offline`,`invalid-response`,`pull-request-not-found`]),BZ=q({kind:G(`unavailable`),reason:zZ}),VZ=q({account:K,source:Gb([`detected`,`overridden`])}),HZ=q({repository:W(K),accounts:J(K),choice:W(VZ),override:W(K),unavailable:W(BZ)}),UZ=Kb(q({login:K,avatarUrl:W(K)})),WZ=q({hasNextPage:Ib}),GZ=Wb([q({__typename:G(`CheckRun`),name:K,status:K,conclusion:Kb(K),detailsUrl:Kb(K),startedAt:W(Kb(K)),completedAt:W(Kb(K))}),q({__typename:G(`StatusContext`),context:K,state:K,targetUrl:Kb(K)})]),KZ=q({number:fx,title:K,url:K,state:Gb([`OPEN`,`CLOSED`,`MERGED`]),isDraft:Ib,author:UZ,headRefName:K,updatedAt:K,commits:q({nodes:J(q({commit:q({statusCheckRollup:Kb(q({state:K}))})}))})}),qZ=q({id:K,author:UZ,createdAt:K,body:K,url:K});q({...KZ.fields,commits:q({nodes:J(q({commit:q({statusCheckRollup:Kb(q({state:K,contexts:q({nodes:J(GZ),pageInfo:WZ})}))})}))}),body:K,createdAt:W(K),baseRefName:K,headRefOid:K,mergeable:K,labels:q({nodes:J(q({name:K,color:K})),pageInfo:WZ}),comments:q({nodes:J(qZ),pageInfo:WZ}),reviews:q({nodes:J(q({id:K,author:UZ,submittedAt:Kb(K),createdAt:W(K),body:K,url:K,state:K,comments:q({nodes:J(q({...qZ.fields,path:K,diffHunk:W(K),line:Kb(fx),originalLine:Kb(fx)})),pageInfo:WZ})})),pageInfo:WZ})});var JZ=q({name:K,status:K,conclusion:W(K),detailsUrl:W(K),durationMs:W(fx)}),YZ=q({number:fx,title:K,url:K,state:Gb([`open`,`closed`,`merged`]),draft:Ib,author:W(K),headBranch:K,updatedAt:K,checksSummary:W(K),checksTruncated:Ib}),XZ=q({id:K,kind:Gb([`comment`,`review`,`review-comment`]),author:W(K),time:K,body:K,url:K,reviewState:W(K),authorAvatarUrl:W(K),reviewId:W(K),diffHunk:W(K),path:W(K),line:W(fx),originalLine:W(fx)}),ZZ=q({...YZ.fields,description:K,createdAt:W(K),authorAvatarUrl:W(K),baseBranch:K,headSha:K,matchesReviewHead:Ib,mergeable:K,labels:J(q({name:K,color:K})),checks:J(JZ),timeline:J(XZ),truncated:Ib});q({number:fx,commits:q({nodes:J(q({commit:q({statusCheckRollup:Kb(q({state:Gb([`SUCCESS`,`PENDING`,`EXPECTED`,`FAILURE`,`ERROR`])}))})}))})});var QZ=Gb([`passed`,`running`,`failed`,`none`]),$Z=JX,eQ=q({archived:Ib,plan:qX}),tQ=class extends Y()(`UnknownBoxLayerError`,{}){get message(){return`A diagram box names a layer the review does not have`}},nQ=class extends Y()(`CommentAuthorMismatchError`,{}){get message(){return`Only the author of a comment may change it`}},rQ=class extends Y()(`CommentIdentityConflictError`,{}){get message(){return`Comment ID belongs to a different write`}},iQ=class extends Y()(`CommentLimitExceededError`,{}){get message(){return`Comment capacity exceeded`}},aQ=class extends Y()(`CommentRevisionMismatchError`,{}){get message(){return`The comparison must identify the revision it belongs to`}},oQ=class extends Y()(`CommentTargetNotFoundError`,{}){get message(){return`Comment target not found`}},sQ=class extends Y()(`DuplicateLayerIdError`,{}){get message(){return`Layer IDs repeat within the review`}},cQ=class extends Y()(`DuplicateStepIdError`,{}){get message(){return`Step IDs repeat within a layer`}},lQ=class extends Y()(`ReviewConflictError`,{}){get message(){return`The review changed; reload before retrying`}},uQ=class extends Y()(`ReviewLayerNotFoundError`,{}){get message(){return`Review layer not found`}},dQ=class extends Y()(`ReviewSummaryNotFoundError`,{}){get message(){return`Review summary not found`}},fQ=class extends Y()(`ReviewedMarkConflictError`,{}){get message(){return`The reviewed mark is based on a version that has changed`}},pQ=class extends Y()(`StepLaneOutOfRangeError`,{}){get message(){return`A step names a lane its layer does not have`}},mQ=class extends Y()(`UnsupportedCommentComparisonError`,{}){get message(){return`A comment on the whole change compares only against a branch`}},hQ=class extends Y()(`UnknownArrowBoxError`,{}){get message(){return`A diagram arrow joins a box its diagram does not have`}},gQ=class extends Y()(`InvalidDecisionBoxError`,{}){get message(){return`A decision box must name a layer and be the only decision box for that layer`}},_Q=class extends Y()(`ProofFileNotFoundError`,{}){get message(){return`Proof file not found`}},vQ=class extends Y()(`ProofFileUnreadableError`,{}){get message(){return`A proof file is missing from the worktree or is not a readable file`}},yQ=class extends Y()(`ProofTooLargeError`,{}){get message(){return`A proof file, or the proof files together, are over their size limit`}},bQ=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`}},xQ=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`}},SQ=class extends Y()(`UnknownProofFileError`,{}){get message(){return`A proofId names no image or video of the current review`}},CQ=class extends Y()(`InvalidReviewPointerError`,{layerId:K,stepId:K,path:K,startLine:Fb,endLine:Fb,reason:Gb([`missing`,`unreadable`,`out-of-range`]),lineCount:Ob(Fb)}){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}}},wQ=class extends Y()(`ReviewPublishRefusedError`,{message:K}){},TQ=class extends Y()(`ReviewNotFoundError`,{}){get message(){return`Review or revision not found`}},EQ=class extends Y()(`InvalidReviewComparisonError`,{}){get message(){return`The from revision must not be newer than the to revision`}};Y()(`GitHubReadError`,{reason:zZ}),Y()(`GitHubPullRequestNotFoundError`,{});var DQ=class extends Y()(`ReviewArchiveRefusedError`,{message:K}){},OQ=class extends Y()(`ReviewPullRequestRefusedError`,{message:K}){},kQ=wx.check(dx()).check(sx(0)),AQ=q({from:W(kQ),to:W(kQ)}),jQ=q({reviewId:K.check(ix()),from:AG(fx),to:fx,comparison:AG(RZ),unknown:J(LZ)}),MQ=q({...AQ.fields,path:cq}),NQ=Wb([q({kind:G(`diff`),from:fx,to:fx,path:cq,...oY.fields}),q({kind:G(`unavailable`),reason:Gb([`no-baseline`,`path-not-reviewed`,`not-changed`])})]),PQ=Wb([q({kind:G(`available`),account:K,pullRequest:ZZ}),q({kind:G(`not-linked`)}),BZ]),FQ=Wb([q({kind:G(`available`),account:K,pullRequests:J(q({...YZ.fields,reviewId:W(K)})),truncated:Ib,recentlyClosedSince:K}),BZ]),IQ=q({account:AG(K.check(rx(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/)))});q({override:Ob(IQ)});var LQ=q({pullRequest:AG(K.check(rx(/^https:\/\/github\.com\/[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+\/pull\/[1-9][0-9]*$/)))}),RQ=Wb([q({kind:G(`updated`)}),BZ]),zQ=Wb([q({kind:G(`available`),number:fx,checks:QZ}),q({kind:G(`not-linked`)}),BZ]),BQ={comparison:W(Wb([q({kind:G(`worktree`),scope:Gb([`staged`,`unstaged`,`untracked`])}),q({kind:G(`file`)}),q({kind:G(`commit`),parent:Fb.check(dx()).check(cx(1)).check(lx(pG))}),q({kind:G(`branch`),base:QJ})])),revision:W(K.check(px(1)).check(hx(256))),contentFingerprint:W(K.check(px(1)).check(hx(256)))},VQ=K.check(px(1)).check(hx(vG)).check(nx(e=>e.trim().length>0&&!e.includes(`\0`))),HQ=Gb([`reviewer`,`agent`]),UQ=Wb([q({kind:G(`change`),filePath:W(Mb),...BQ}),q({kind:G(`file`),filePath:cq,...BQ}),q({kind:G(`codeRange`),filePath:cq,startLine:Fb.check(dx()).check(cx(1)).check(lx(fG)),endLine:Fb.check(dx()).check(cx(1)).check(lx(fG)),side:W(Gb([`additions`,`deletions`])),...BQ})]),WQ=q({id:K.check(ix()),body:VQ,author:HQ,createdAt:W(DG),editedAt:W(DG)}),GQ=q({review:W(q({reviewId:K.check(ix()),revision:fx.check(sx(0)),headOid:K})),id:K.check(ix()),worktreeId:kG,anchor:UQ,resolved:Ib,messages:J(WQ).check(px(1)),revision:Fb.check(dx()).check(cx(0))}),KQ=q({threadId:K.check(ix())}),qQ=q({worktreeId:kG,...KQ.fields}),JQ=Gb([`waiting`,`all`]);q({reviewId:W(K.check(ix())),scope:W(JQ)}),q({kind:Gb([`owner`,`device`,`agent`])});var YQ=J(GQ),XQ=q({reviewRevision:W(fx.check(sx(0))),reviewId:W(K.check(ix())),threadId:W(K.check(ix())),messageId:W(K.check(ix())),anchor:UQ,body:VQ}),ZQ=GQ,QQ=q({reviewId:W(K.check(ix())),messageId:W(K.check(ix())),body:VQ}),$Q=GQ,e$=q({reviewId:W(K.check(ix())),resolved:Ib}),t$=GQ,n$=q({reviewId:W(K.check(ix())),messageId:K.check(ix()),body:VQ}),r$=q({reviewId:W(K.check(ix())),messageId:K.check(ix())}),i$=GQ,a$=q({threadId:K.check(ix()),thread:AG(GQ)}),o$=q({reviewId:W(K.check(ix())),threads:J(q({threadId:K.check(ix()),revision:Fb.check(dx()).check(cx(0))})).check(px(1)).check(hx(100))}),s$=q({deleted:J(K.check(ix())),skipped:J(K.check(ix()))}),c$=q({throughRevision:Fb.check(dx()).check(cx(0))}),l$=q({worktreeId:kG,seenThrough:Fb.check(dx()).check(cx(0))}),u$=K.check(ix()),d$=K.pipe(Yb(d_())).check(px(1)).check(hx(200)),f$={layerId:W(u$),stepId:W(u$)},p$=Gb([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/webm`]),m$=q({name:d$,result:Gb([`pass`,`fail`]),output:W(K.check(px(1)).check(hx(SG))),...f$}),h$=EG.check(nx(e=>{let t=xb(xx)(e);return Nr(t)&&/^https?:$/.test(t.success.protocol)})).check(hx(CG)),g$=e=>q({kind:G(e),title:d$,path:W(cq),proofId:W(u$),...f$}).check(nx(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`})),_$=Wb([g$(`image`),g$(`video`),q({kind:G(`link`),title:d$,url:h$,...f$})]),v$=q({checks:W(J(m$).check(hx(100))),assets:W(J(_$).check(hx(20)))}),y$=Wb([q({id:u$,kind:Gb([`image`,`video`]),title:d$,mediaType:p$,byteLength:Fb.check(dx()).check(sx(0)),...f$}),q({id:u$,kind:G(`link`),title:d$,url:h$,...f$})]),b$=q({checks:J(m$).check(hx(100)),assets:J(y$).check(hx(20)),current:Ib}),x$=q({proofId:u$}),S$=q({id:u$,mediaType:p$,base64:K}),C$=/^\/review-summaries\/(?<token>[^?]*)\?expires=(?<expires>[^&]*)&signature=(?<signature>.*)$/,w$=Fb.check(dx()).check(sx(0)),T$=q({url:K.check(px(1)),byteLength:w$}),E$=q({token:K,expires:K,signature:K,byteLength:w$}),D$=T$.pipe(Jb(E$,u_({decode:e=>{let t=C$.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})}))),O$=K.check(ix()),k$=Fb.check(dx()).check(cx(1)).check(lx(fG)),A$=q({path:cq,startLine:k$,endLine:k$,symbol:W(K.pipe(Yb(d_())).check(px(1)).check(hx(500)))}),j$=q({...A$.fields,textFingerprint:$J}),M$=Wb([q({state:G(`changed`)}),q({state:G(`broken`)}),q({state:G(`current`),startLine:k$,endLine:k$}),q({state:G(`committed`),startLine:k$,endLine:k$})]),N$=q({id:O$,lane:Fb.check(dx()).check(cx(0)).check(lx(99)),title:K.pipe(Yb(d_())).check(px(1)).check(hx(200)),text:K.pipe(Yb(d_())).check(px(1)).check(hx(yG)),kind:Gb([`changed`,`context`]),pointer:A$}),P$=q({published:W(J(K)),...N$.fields,pointer:j$,location:M$}),F$=q({id:O$,title:K.pipe(Yb(d_())).check(px(1)).check(hx(200)),summary:K.pipe(Yb(d_())).check(px(1)).check(hx(bG)),lanes:J(K.pipe(Yb(d_())).check(px(1)).check(hx(100))).check(px(1)).check(hx(100)),steps:J(N$).check(px(1)).check(hx(500))}),I$=q({...F$.fields,steps:J(P$).check(px(1)).check(hx(500)),fingerprint:$J,codeMoved:W(Ib)}),L$=q({from:O$,to:O$,label:W(K.pipe(Yb(d_())).check(px(1)).check(hx(200)))}),R$=q({after:q({boxes:J(q({id:O$,label:K.pipe(Yb(d_())).check(px(1)).check(hx(200)),detail:W(K.pipe(Yb(d_())).check(px(1)).check(hx(bG))),change:W(Gb([`new`,`changed`,`removed`])),problem:W(K.pipe(Yb(d_())).check(px(1)).check(hx(bG))),layerId:W(O$),decision:W(G(!0))})).check(hx(500)),arrows:J(L$).check(hx(xG))})}),z$=K.check(px(1)).check(hx(sG)).check(nx(e=>e.isWellFormed(),{expected:`Expected valid Unicode text`})).check(nx(e=>GY(e)<=sG,{expected:`Summary exceeds 10 MiB`})),B$=q({path:cq,ranges:J(q({startLine:k$,endLine:k$})),deleted:W(Ib),binary:W(Ib)}),V$=K.check(ix()),H$=fx.check(sx(0)),U$=K.check(px(1)).check(hx(bG)),W$=q({asked:q({text:U$,links:W(J(q({title:U$,url:K.check(rx(/^https?:\/\//))})))}),recommendation:Gb([`merge`,`hold`]),reasons:J(U$).check(px(1)).check(hx(5)),notProven:J(q({what:U$,why:U$})),removed:J(q({behavior:U$,why:U$,paths:J(cq).check(px(1))}))}),G$=Wb([q({kind:G(`available`).pipe(Qb(B(`available`))),web:K,app:K,revision:q({web:K,app:K}),decisions:J(q({layerId:O$,web:K,app:K}))}),q({kind:G(`unavailable`),reason:G(`no-reachable-route`)})]),K$=Gb([`http`,`https`]),q$=q({reviewId:V$,projectId:K,revision:H$,headOid:K,base:K,baseOid:K,mergeBaseOid:K,publishedAt:DG,branch:K,worktreePath:K,worktreeName:K}),J$=q({reviewId:W(V$),headOid:W(K),baseOid:W(K),base:W(K),mergeBaseOid:W(K),verdict:W(W$),links:W(G$),environmentId:K.check(ix()),worktreeId:kG,revision:Fb.check(dx()).check(sx(0)),publishedAt:DG,active:Ib,diagnostics:Gb([`current`,`unavailable`]),summary:D$,diagram:W(R$),layers:J(I$).check(hx(100)),notExplained:J(B$).check(hx(lG)),proof:b$}),Y$=q({expectedRevision:Fb.check(dx()).check(cx(0)).check(lx(2**53-1-1)),summaryHtml:W(z$),verdict:W$,base:W(K.check(px(1))),pullRequest:W(K.check(rx(/^https:\/\/github\.com\/[^/]+\/[^/]+\/pull\/[1-9][0-9]*\/?$/))),reviewId:W(V$),diagram:W(R$),layers:J(F$).check(px(1)).check(hx(100)),proof:W(v$)}),X$=q({review:AG(J$)}),Z$=q({...X$.fields,reviewId:V$,revision:H$,headOid:K,baseOid:K,links:G$}),Q$=q({projectId:K}),$$=q({revision:W(H$)}),e1=q({paths:aY.fields.paths}),t1=q({reviewId:V$}),n1=q({...t1.fields,revision:wx.check(dx()).check(sx(0))}),r1=q({reviewId:V$,projectId:K,branch:K,pullRequest:W(K),state:Gb([`open`,`closed`]),archived:W(Ib),latestRevision:H$,lastSeenRevision:fx}),i1=q({review:AG(r1),revisions:J(q$),revision:AG(q({...q$.fields,files:J(q({path:cq,oldPath:W(cq),newPath:W(cq),oldOid:W(K),newOid:W(K),oldMode:K,newMode:K,status:Gb([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})),verdict:W$,content:J$}))}),a1=J(r1),o1=q({revision:H$}),s1=q({state:G(`closed`)}),c1=q({deleted:Ib}),l1=q({updated:Ib}),u1=q({path:cq}),d1=Wb([q({kind:G(`text`),text:K,blobOid:K}),q({kind:G(`missing`)}),q({kind:Gb([`too-large`,`unsupported`]),blobOid:K})]),f1=q({path:cq,fingerprint:K,reviewedAt:DG,stale:Ib}),p1=q({layerId:O$,fingerprint:$J,reviewedAt:DG}),m1=q({files:J(f1),decisions:J(p1)}),h1=Wb([q({kind:G(`file`),revision:H$,path:cq,headBlobOid:K}),q({kind:G(`decision`),revision:H$,layerId:O$,fingerprint:$J})]),g1=Wb([q({kind:G(`file`),path:cq,headBlobOid:K}),q({kind:G(`decision`),layerId:O$,fingerprint:$J})]);Wb([q({worktreeId:kG,reviewId:W(V$)}),q({reviewId:V$,worktreeId:W(kG)})]);var _1=q({path:cq,fingerprint:$J,reviewedAt:DG}),v1=Gb([`worktree`,`branch`]),y1={scope:G(`branch`),base:QJ},b1=q({scope:W(v1),branch:W(QJ)}),x1=q({worktreeId:kG,marks:J(_1).check(hx(hG))}),S1={path:cq,reviewed:G(!0),fingerprint:$J},C1=Wb([q({...S1,scope:W(G(`worktree`))}),q({...S1,...y1})]),w1=x1,T1={files:J(q({path:cq,fingerprint:$J})).check(px(1)).check(hx(uG))},E1=Wb([q({...T1,scope:W(G(`worktree`))}),q({...T1,...y1})]),D1=q({...x1.fields,marked:J(cq).check(hx(uG)),conflicts:J(q({path:cq,reason:Gb([`stale`,`missing`])})).check(hx(uG))}),O1=q({path:cq,scope:W(v1),branch:W(QJ)}),k1=x1,A1=q({paths:J(cq).check(px(1)).check(hx(uG)),scope:W(v1),branch:W(QJ)}),j1=x1,M1=q({worktreeId:kG,marks:J(q({layerId:K.check(ix()),fingerprint:$J,reviewedAt:DG,stale:Ib})).check(hx(100))}),N1=q({layerId:K.check(ix()),reviewed:G(!0),fingerprint:$J}),P1=M1,F1=q({layerId:K.check(ix())}),I1=M1,L1=class extends HK.add(BG(`reviews`).add(UA(`archiveReview`,`/api/reviews/:reviewId/archive`,{disableCodecs:!0,params:t1,payload:$Z,success:eQ,error:[$(TQ,`NotFound`),$(eJ,`NotFound`),$(DQ,`Conflict`,{message:{fromError:!0}})]}),HA(`compareReview`,`/api/reviews/:reviewId/compare`,{disableCodecs:!0,params:t1,query:AQ.fields,success:jQ,error:[$(TQ,`NotFound`),$(EQ,`BadRequest`,{message:{fromError:!0}})]}),HA(`readReviewInterdiff`,`/api/reviews/:reviewId/interdiff`,{disableCodecs:!0,params:t1,query:MQ.fields,success:NQ,error:[...rJ,...gJ,$(TQ,`NotFound`),$(EQ,`BadRequest`,{message:{fromError:!0}}),$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),WA(`setReviewPullRequest`,`/api/reviews/:reviewId/pull-request`,{disableCodecs:!0,params:t1,payload:LQ,success:RQ,error:[$(TQ,`NotFound`),$(eJ,`NotFound`),$(OQ,`Conflict`,{message:{fromError:!0}})]}),HA(`readReviewPullChecks`,`/api/reviews/:reviewId/pull-request/checks`,{disableCodecs:!0,params:t1,success:zQ,error:[$(TQ,`NotFound`),$(eJ,`NotFound`)]}),HA(`readReviewPullRequest`,`/api/reviews/:reviewId/pull-request`,{disableCodecs:!0,params:t1,success:PQ,error:[$(TQ,`NotFound`),$(eJ,`NotFound`)]}),HA(`listProjectPullRequests`,`/api/projects/:projectId/pull-requests`,{disableCodecs:!0,params:Q$,success:FQ,error:[$(eJ,`NotFound`)]}),HA(`readProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:Q$,success:HZ,error:[$(eJ,`NotFound`)]}),WA(`setProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:Q$,payload:IQ,success:HZ,error:[$(eJ,`NotFound`)]})).add(KA(`deleteReviewCommentMessage`,`/api/reviews/:reviewId/comments/:threadId/messages`,{disableCodecs:!0,params:q({...t1.fields,...KQ.fields}),query:r$.fields,success:a$,error:[...rJ,$(TQ,`NotFound`),$(oQ,`NotFound`,{message:`Comment target not found`}),$(nQ,`Forbidden`)]}),UA(`deleteResolvedReviewComments`,`/api/reviews/:reviewId/comments/resolved/deletion`,{disableCodecs:!0,params:t1,payload:o$,success:s$,error:[...rJ,$(TQ,`NotFound`)]}),GA(`editReviewCommentMessage`,`/api/reviews/:reviewId/comments/:threadId/messages`,{disableCodecs:!0,params:q({...t1.fields,...KQ.fields}),payload:n$,success:i$,error:[...rJ,$(TQ,`NotFound`),$(oQ,`NotFound`,{message:`Comment target not found`}),$(nQ,`Forbidden`),$(iQ,`Conflict`)]}),HA(`listReviewMarks`,`/api/reviews/:reviewId/marks`,{disableCodecs:!0,params:t1,success:m1,error:[$(TQ,`NotFound`)]}),WA(`setReviewMark`,`/api/reviews/:reviewId/marks`,{disableCodecs:!0,params:t1,payload:h1,success:l1,error:[$(TQ,`NotFound`),$(fQ,`Conflict`)]}),UA(`removeReviewMark`,`/api/reviews/:reviewId/marks/removal`,{disableCodecs:!0,params:t1,payload:g1,success:l1,error:[$(TQ,`NotFound`)]}),UA(`createReviewCommentThread`,`/api/reviews/:reviewId/comments`,{disableCodecs:!0,params:t1,payload:XQ,success:ZQ,error:[...rJ,$(TQ,`NotFound`),$(rQ,`Conflict`),$(iQ,`Conflict`),$(qq,`BadRequest`,{message:`Invalid request`}),$(aQ,`BadRequest`,{message:`Invalid request`}),$(mQ,`BadRequest`,{message:`Invalid request`})]}),HA(`listReviewCommentThreads`,`/api/reviews/:reviewId/comments`,{disableCodecs:!0,params:t1,success:YQ,error:[...rJ,$(TQ,`NotFound`)]}),UA(`replyToReviewComment`,`/api/reviews/:reviewId/comments/:threadId/replies`,{disableCodecs:!0,params:q({...t1.fields,...KQ.fields}),payload:QQ,success:$Q,error:[...rJ,$(TQ,`NotFound`),$(rQ,`Conflict`),$(oQ,`NotFound`,{message:`Comment target not found`}),$(iQ,`Conflict`)]}),WA(`updateReviewCommentThread`,`/api/reviews/:reviewId/comments/:threadId`,{disableCodecs:!0,params:q({...t1.fields,...KQ.fields}),payload:e$,success:t$,error:[...rJ,$(TQ,`NotFound`),$(oQ,`NotFound`,{message:`Comment target not found`})]}),HA(`readReview`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:t1,success:i1,error:[BK,...rJ,$(TQ,`NotFound`)]}),HA(`readReviewRevision`,`/api/reviews/:reviewId/revisions/:revision`,{disableCodecs:!0,params:n1,success:i1,error:[BK,...rJ,$(TQ,`NotFound`)]}),HA(`listProjectReviews`,`/api/projects/:projectId/reviews`,{disableCodecs:!0,params:Q$,success:a1}),WA(`setReviewSeen`,`/api/reviews/:reviewId/seen`,{disableCodecs:!0,params:t1,payload:o1,success:l1,error:[$(TQ,`NotFound`)]}),GA(`setReviewState`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:t1,payload:s1,success:l1,error:[$(TQ,`NotFound`)]}),KA(`deleteProjectReview`,`/api/reviews/:reviewId`,{disableCodecs:!0,params:t1,success:c1,error:[...rJ,$(TQ,`NotFound`)]}),HA(`readReviewProofFile`,`/api/reviews/:reviewId/revisions/:revision/proof`,{disableCodecs:!0,params:n1,query:x$.fields,success:S$,error:[...rJ,$(_Q,`NotFound`)]}),HA(`readReviewFile`,`/api/reviews/:reviewId/revisions/:revision/file`,{disableCodecs:!0,params:n1,query:u1.fields,success:d1,error:[$(TQ,`NotFound`)]}),UA(`readReviewDiffs`,`/api/reviews/:reviewId/revisions/:revision/diffs`,{disableCodecs:!0,params:n1,payload:e1,success:oY,error:[...rJ,...gJ,$(TQ,`NotFound`),$(KJ,`NotFound`),$(qJ,`UnprocessableEntity`)]}),UA(`createCommentThread`,`/api/worktrees/:worktreeId/comments`,{disableCodecs:!0,params:jG,payload:XQ,success:ZQ,error:[...rJ,$(TQ,`NotFound`),$(rQ,`Conflict`),$(iQ,`Conflict`),$(qq,`BadRequest`,{message:`Invalid request`}),$(aQ,`BadRequest`,{message:`Invalid request`}),$(mQ,`BadRequest`,{message:`Invalid request`})]}),KA(`deleteCommentMessage`,`/api/worktrees/:worktreeId/comments/:threadId/messages`,{disableCodecs:!0,params:qQ,query:r$.fields,success:a$,error:[...rJ,$(TQ,`NotFound`),$(oQ,`NotFound`,{message:`Comment target not found`}),$(nQ,`Forbidden`)]}),UA(`deleteResolvedComments`,`/api/worktrees/:worktreeId/comments/resolved/deletion`,{disableCodecs:!0,params:jG,payload:o$,success:s$,error:[...rJ,$(TQ,`NotFound`)]}),GA(`editCommentMessage`,`/api/worktrees/:worktreeId/comments/:threadId/messages`,{disableCodecs:!0,params:qQ,payload:n$,success:i$,error:[...rJ,$(TQ,`NotFound`),$(oQ,`NotFound`,{message:`Comment target not found`}),$(nQ,`Forbidden`),$(iQ,`Conflict`)]}),HA(`listCommentThreads`,`/api/worktrees/:worktreeId/comments`,{disableCodecs:!0,params:jG,success:YQ,error:[...rJ,$(TQ,`NotFound`)]}),HA(`listReviewedFiles`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:jG,query:b1.fields,success:x1,error:[...rJ,$(TQ,`NotFound`)]}),HA(`listReviewedLayers`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:jG,success:M1,error:[...rJ,$(TQ,`NotFound`)]}),UA(`markCommentsSeen`,`/api/worktrees/:worktreeId/comments/seen`,{disableCodecs:!0,params:jG,payload:c$,success:l$,error:[...rJ,$(TQ,`NotFound`)]}),KA(`deleteReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:jG,success:c1,error:[...rJ,$(TQ,`NotFound`)]}),WA(`publishReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:jG,payload:Y$,success:Z$,error:[BK,...rJ,...gJ,$(sQ,`BadRequest`,{message:`Invalid request`}),$(cQ,`BadRequest`,{message:`Invalid request`}),$(qq,`BadRequest`,{message:`Invalid request`}),$(pQ,`BadRequest`,{message:`Invalid request`}),$(gQ,`BadRequest`,{message:`Invalid request`}),$(tQ,`BadRequest`,{message:`Invalid request`}),$(hQ,`BadRequest`,{message:`Invalid request`}),$(bQ,`BadRequest`),$(CQ,`BadRequest`,{message:{fromError:!0}}),$(lQ,`Conflict`),$(wQ,`Conflict`,{message:{fromError:!0}}),$(KJ,`NotFound`),$(yQ,`PayloadTooLarge`),$(SQ,`BadRequest`),$(xQ,`UnprocessableEntity`),$(vQ,`UnprocessableEntity`),$(qJ,`UnprocessableEntity`)]}),HA(`readProofFile`,`/api/worktrees/:worktreeId/review/proof`,{disableCodecs:!0,params:jG,query:x$.fields,success:S$,error:[...rJ,$(_Q,`NotFound`)]}),HA(`readPublishedReview`,`/api/worktrees/:worktreeId/review`,{disableCodecs:!0,params:jG,success:X$,error:[BK,...rJ,...gJ,$(qJ,`UnprocessableEntity`)]}),KA(`removeReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:jG,query:O1.fields,success:k1,error:rJ}),KA(`removeReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:jG,payload:A1,success:j1,error:rJ}),KA(`removeReviewedLayer`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:jG,query:F1.fields,success:I1,error:[...rJ,$(TQ,`NotFound`)]}),UA(`replyToComment`,`/api/worktrees/:worktreeId/comments/:threadId/replies`,{disableCodecs:!0,params:qQ,payload:QQ,success:$Q,error:[...rJ,$(TQ,`NotFound`),$(rQ,`Conflict`),$(oQ,`NotFound`,{message:`Comment target not found`}),$(iQ,`Conflict`)]}),WA(`setReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:jG,payload:C1,success:w1,error:[...rJ,...gJ,$(fQ,`Conflict`),$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),WA(`setReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:jG,payload:E1,success:D1,error:[...rJ,...gJ,$(fQ,`Conflict`),$(GJ,`NotFound`),$(XJ,`Conflict`),$(ZJ,`Conflict`)]}),WA(`setReviewedLayer`,`/api/worktrees/:worktreeId/reviewed-layers`,{disableCodecs:!0,params:jG,payload:N1,success:P1,error:[...rJ,$(uQ,`NotFound`),$(fQ,`Conflict`)]}),WA(`updateCommentThread`,`/api/worktrees/:worktreeId/comments/:threadId/resolution`,{disableCodecs:!0,params:qQ,payload:e$,success:t$,error:[...rJ,$(TQ,`NotFound`),$(oQ,`NotFound`,{message:`Comment target not found`})]})).middleware(dK)){},R1=q({token:K.check(ix())}),z1=q({expires:DG,signature:K.check(rx(/^[A-Za-z0-9_-]{43}$/))}),B1=K,V1=class extends HK.add(BG(`reviewSummary`).add(HA(`readReviewSummary`,`/review-summaries/:token`,{disableCodecs:!0,params:R1,query:z1.fields,success:B1.pipe(nA({contentType:`text/html; charset=utf-8`})),error:dQ.pipe(Wk({decode:()=>new dQ}),Hk(`NotFound`))}))){},H1=class extends HK.addHttpApi(Kq).addHttpApi(vZ).addHttpApi(aX).addHttpApi(WY).addHttpApi(L1).addHttpApi(V1).addHttpApi(GX){},U1=q({address:K,credential:Ix(K),deviceId:W(K)}),W1=q({...U1.fields,environmentId:K,name:K,alternateRoutes:W(J(U1)),operationIdentity:W(K)});function G1({address:e,credential:t,deviceId:n}){return{address:e,credential:t,...n?{deviceId:n}:{}}}function K1(e){return[G1(e),...(e.alternateRoutes??[]).map(G1)]}function q1(e){return e.operationIdentity??(e.deviceId?JSON.stringify([e.environmentId,e.address,e.deviceId]):void 0)}function J1(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,...G1(n),...q1(e)?{operationIdentity:q1(e)}:{},...r.length?{alternateRoutes:r.map(G1)}:{}}}function Y1(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 X1(e){return JSON.stringify(Tb(J(W1))(e))}function Z1(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 Q1(e,t){let n=Reflect.get(e,t);return typeof n==`string`?n:void 0}function $1(e){if(!e||typeof e!=`object`)return;let t=Q1(e,`address`),n=Q1(e,`credential`),r=Q1(e,`deviceId`);return t&&n?{address:t,credential:hh(n),...r?{deviceId:r}:{}}:void 0}function e0(e){if(!e||typeof e!=`object`)return[];let t=Q1(e,`environmentId`),n=Q1(e,`name`),r=$1(e),i=Reflect.get(e,`alternateRoutes`);return t&&n!==void 0&&r?[{environmentId:t,name:n,...r,...Q1(e,`operationIdentity`)?{operationIdentity:Q1(e,`operationIdentity`)}:{},...Array.isArray(i)?{alternateRoutes:i.flatMap(e=>{let t=$1(e);return t?[t]:[]})}:{}}]:[]}function t0(e){return Array.isArray(e)?e.flatMap(e0):[]}function n0(e,t){let n=e.find(e=>e.environmentId===t.environmentId);if(!n)return[...e,t];let r=K1(t),i=K1(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),J1({...n,name:t.name},i)]}var r0=vh((e,t)=>e===t);function i0(e,t){return e.environmentId===t.environmentId&&e.address===t.address&&r0(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&&r0(e.credential,r.credential)})}function a0(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 o0(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 s0=class e extends tr()(`@porcelain/client/AccessStore`){static layer=Uu(e,H(function*(){let e=yield*QW,t=yield*iG({initial:{remotes:[],missingCredentials:[]},read:e.read,write:e.write,messages:{beforeRead:`Saved environments must be read before changing them.`,readFailed:`Saved environments could not be read. Try reading them again.`,writeFailed:`The saved environments could not be updated. Read them again before making changes.`}});return{state:t.state,load:t.load,save:Gp(`AccessStore.save`)(e=>t.write(t=>{let n=t.missingCredentials.find(t=>t.environmentId===e.environmentId),r=K1(e),i=n?.operationIdentity?{...e,operationIdentity:n.operationIdentity}:e;return B({remotes:n0(t.remotes,i),missingCredentials:t.missingCredentials.flatMap(t=>{if(t.environmentId!==e.environmentId)return[t];let n=t.routes.filter(e=>!r.some(t=>t.address===e.address));return n.length?[{...t,routes:n}]:[]})})})),route:Gp(`AccessStore.route`)(e=>t.write(({remotes:t,missingCredentials:n})=>H(function*(){let r=t.find(t=>t.environmentId===e.environmentId);if(!r)return yield*U(new rG({message:`That environment is no longer saved.`}));let i=K1(r),a=i.find(t=>t.address===e.address);if(!a)return yield*U(new rG({message:`That connection is no longer saved.`}));let o=i.filter(t=>t.address!==e.address);if(e.kind===`remove`&&!o.length)return yield*U(new rG({message:`Forget the environment to remove its last connection.`}));let s=J1(r,e.kind===`prefer`?[a,...o]:o);return{missingCredentials:n,remotes:t.map(t=>t.environmentId===e.environmentId?s:t)}}))),forget:Gp(`AccessStore.forget`)(e=>t.write(t=>B({remotes:t.remotes.filter(t=>t.environmentId!==e),missingCredentials:t.missingCredentials.filter(t=>t.environmentId!==e)})))}}))},c0=class extends tr()(`@porcelain/client/ConnectionFactory`){},l0=class extends tr()(`@porcelain/client/RemoteConnectionFactory`){},u0=class e extends tr()(`@porcelain/client/AccessSession`){static layer=Uu(e,H(function*(){let e=yield*c0,t=yield*vu,n,r=Vj({connection:null,generation:0,writerIdentity:void 0});return{state:r,beginConnection:Gp(`AccessSession.beginConnection`)((i=!1)=>V(()=>{if(i&&r.value.generation!==0)return null;let a=r.value.generation;return Gp(`AccessSession.completeConnection`)(function*(i){if(a!==r.value.generation)return!1;let o=JSON.stringify(i.principal),s=r.value.connection?.environmentId===i.inventory.environmentId&&r.value.writerIdentity===o,c=n,l=r.value.connection;if(s||(c=yield*Cu(t,`sequential`),l=yield*e.local(i).pipe(hp(vu,c))),a!==r.value.generation)return!s&&c&&(yield*Tu(c,ou)),!1;let u=n;return n=c,r.update(e=>({...e,connection:l,writerIdentity:o,generation:a+1})),u&&u!==n&&(yield*Tu(u,ou)),!0},Op)})),clear:Gp(`AccessSession.clear`)(function*(){let e=n;n=void 0,r.update(e=>({...e,connection:null,writerIdentity:void 0,generation:e.generation+1})),e&&(yield*Tu(e,ou))},Op)}}))},d0=class e extends tr()(`@porcelain/client/RemoteConnections`){static layer=Uu(e,H(function*(){let e=yield*l0,t=yield*vu,n=yield*RC(1),r=[],i=Vj([]);return{state:i,synchronize:Gp(`RemoteConnections.synchronize`)(a=>H(function*(){let n=yield*wf(a,n=>H(function*(){let i=r.find(e=>i0(e.remote,n));if(i)return{...i,remote:n};let a=yield*Cu(t,`sequential`);return{remote:n,connection:yield*e.open(n).pipe(hp(vu,a)),scope:a}})),o=r.filter(e=>!n.some(t=>t.scope===e.scope));r=n,i.set(n.map(({remote:e,connection:t})=>({remote:e,connection:t}))),yield*wf(o,e=>Tu(e.scope,ou),{discard:!0})}).pipe(zC(n),Op))}}))},f0=Ku(H(function*(){let e=yield*s0,t=yield*d0;yield*t.synchronize(e.state.value.remotes),yield*oT(Gp(`RemoteConnections.subscribe`)(function*(t){yield*vp(V(()=>e.state.subscribe(({remotes:e})=>{sC(t,e)})),e=>V(e))})).pipe(xT(t.synchronize),Fp({startImmediately:!0}))}));function p0(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 ${_h(t)}`),n(a,{...i,headers:o,mode:`cors`,credentials:`omit`,redirect:`error`,cache:`no-store`})}}var m0=class extends Y()(`RequestError`,{status:Fb,message:K,code:TG.fields.code}){};function h0(e){return Uu(HO,Kf(HO,e=>e.pipe(qO(DO(`http://porcelain.invalid`)),UO(hp(XO,!1))))).pipe(Zu($u(LK).pipe(Zu(Yu(Ru(FK,(t,n)=>t instanceof URL?e(`${t.pathname}${t.search}`,n):Promise.reject(TypeError(`FetchHttpClient sends every request as a parsed URL.`))),Ru(IK,{redirect:`error`,cache:`no-store`}))))))}function g0(e){let t=e.response;return t===void 0?B(new rG({message:`Could not reach Porcelain. Try again.`,cause:e.reason._tag===`TransportError`?e.reason.cause:e})):Kf(mne(t.json,()=>void 0),e=>{let n=xb(TG)(e);return new m0({status:t.status,message:Nr(n)?n.success.message:`Request failed (${t.status})`,code:void 0})})}function _0(e){return Xf(e,e=>QD(e)?Bf(g0(e),U):U(e))}function v0(e,t){return t(_0(e))}var y0=class extends tr()(`@porcelain/client/PairingPlatform`){};function b0(e){let t;try{t=new URL(e.trim())}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`||t.pathname!==`/pair`)return;let n=x0(t.hash);return n?{address:t.origin,...n}:void 0}function x0(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`c`),r=t.get(`e`);return n&&r?{code:n,environmentId:r}:null}var S0=3e3,C0=8e3,w0=1e4,T0=1e4,E0=1e4,D0=1e3,O0=1e3,k0=1e3,A0=3e4,j0=2500,M0=5e3,N0=6e4,P0=18e5,F0=6e4,I0=X(e=>Vj(void 0)),L0=X(e=>BE()),R0=dj(H1),z0=class e extends tr()(`@porcelain/client/BootstrapClient`){static layer=X(t=>Zu(Uu(e,R0),h0(t)))},B0=X(e=>VE(z0.layer(e)));function V0(e,t){return aS(t)?{kind:`offline`}:Z1(e,Un(fS(t)))}function H0(e,t){return H(function*(){let e=yield*z0,n=yield*_0(e.publicAccess.readEnvironment()).pipe(Zf(`ConnectionError`,t=>_0(e.session.readSession()).pipe(Hf(U(t)))));return n.environmentId===t&&n.protocol===3&&(yield*_0(e.session.readSession())),{kind:`described`,environment:n}}).pipe(fp(z0.layer(e)),Xf(e=>B(e instanceof m0&&e.status===401?{kind:`unauthorized`}:{kind:`unreachable`})),ip(M0),Kf(e=>Vn(e,()=>({kind:`unreachable`}))))}function U0(e,t){I0(e.send).set({remote:t,revision:Symbol()})}var W0=Gp(`Environments.readVerifiedRoute`)(function*(e,t,n){let r=p0(e.address,e.credential,n);return yield*H(function*(){return(yield*_0((yield*z0).publicAccess.readHealth())).environmentId===t?yield*H0(r,t):{kind:`foreign`}}).pipe(fp(z0.layer(r)),Xf(()=>B({kind:`unreachable`})))}),G0=Gp(`Environments.readRoutes`)(function*(e,t){let n={kind:`unreachable`};for(let r of K1(t)){let i=yield*W0(r,t.environmentId,e.send).pipe(ip(j0),Kf(e=>Vn(e,()=>({kind:`unreachable`}))));if(Z1(t,i).kind===`online`)return i;i.kind!==`unreachable`&&(n=i)}return n}),lce=X(({platform:e,remote:t})=>{let{send:n,statusActivity:r}=e;return L0(e)(Bu).atom(()=>{let i=!1,a=!1,o=!1,s,c=oT(e=>H(function*(){let s=t=>{t&&(o=t===`suspend`);let n=!o&&(r?.isActive()??!0),s=n&&!a;a=n,(!n||s||!i)&&sC(e,n)};yield*vp(V(()=>{let e=r?.subscribe(s),i=I0(n).subscribe(()=>{let e=I0(n).value;e&&i0(e.remote,t)&&s()});return()=>{e?.(),i?.()}}),e=>V(e)),s()}),{bufferSize:1,strategy:`sliding`}),l=H(function*(){i=!0;let n=yield*G0(e,t);return s=n,n}).pipe(xp(V(()=>{i=!1})));return c.pipe(Fae(e=>e?lT(()=>s?.kind===`unreachable`?hT(Dae({kind:`reconnecting`}),rT(l)):rT(l)).pipe(mT(pf(A0))):Pae))}).pipe(SE(0))});function uce(e,t){return lce({platform:e,remote:t})}var dce=X(({platform:e,remote:t,connection:n})=>kE(r=>{let i=n?.liveUpdates.state;i&&r.addFinalizer(i.subscribe(()=>r.refreshSelf()));let a=V0(t,r(uce(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 K0(e,t,n){return dce({platform:e,remote:t,connection:n})}function q0(e){return e instanceof m0?!0:e instanceof rG?!1:e._tag===`InvalidPairingError`||e._tag===`InvalidDeviceDetailsError`}function fce(e,t,n){return H(function*(){let r=b0(t);if(!r)return yield*U(new rG({message:`Paste the whole link porcelain pair printed, starting with http.`}));if(n&&r.environmentId!==n)return yield*U(new rG({message:`That pairing link belongs to another computer. Add it as a separate environment.`}));let i=p0(r.address,void 0,e.send);if((yield*_0(H(function*(){return yield*(yield*z0).publicAccess.readHealth()}).pipe(fp(z0.layer(i))))).environmentId!==r.environmentId)return yield*U(new rG({message:`Another Porcelain answered at that address than the one that made the link.`}));let a=yield*_0(H(function*(){return yield*(yield*z0).pairing.redeemPairing({payload:{code:r.code,platform:e.name()}})}).pipe(fp(z0.layer(i)))).pipe($f(e=>q0(e)?new rG({message:`That link was not accepted. It works once, for a few minutes; run porcelain pair again.`}):e instanceof rG?new rG({message:`Could not reach ${r.address}. Check that Porcelain runs there and that this device reaches it.`,cause:e.cause}):e));if(!a.credential)return yield*U(new rG({message:`The remote paired but sent no credential.`}));let o=hh(a.credential),s=Z1(r,yield*H0(p0(r.address,o,e.send),r.environmentId));return s.kind===`online`?{environmentId:r.environmentId,address:r.address,name:s.name,credential:o,deviceId:a.device.id}:yield*U(new rG({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 pce=Gp(`Environments.pairAndSave`)(function*(e,t){let n=yield*s0,r=yield*$W;if(n.state.value.status!==`ready`)return yield*U(new rG({message:`Read saved environments before pairing.`}));let i=n.state.value.missingCredentials.find(t=>t.environmentId===b0(e)?.environmentId);if(i&&!i.routes.some(t=>t.address===b0(e)?.address))return yield*U(new rG({message:`Use a pairing link for the connection whose credential is missing.`}));let a=yield*fce(r,e,t);return yield*n.save(a),a}),mce=Gp(`BrowserSession.pair`)(function*(e){let t=yield*y0,n=yield*z0;if((yield*_0(n.publicAccess.readHealth()).pipe($f(e=>!(e instanceof rG)&&!(e instanceof m0)&&e._tag!==`MissingEnvironmentIdentityError`?new rG({message:`That address answered, but it is not a Porcelain server.`}):new rG({message:`Could not reach Porcelain. Check that the server is running, then open the link again.`,cause:e})))).environmentId!==e.environmentId)return yield*U(new rG({message:`This link was made for a different Porcelain installation.`}));let r=yield*_0(n.pairing.redeemPairing({payload:{code:e.code,platform:t.name()}})).pipe($f(e=>q0(e)?new rG({message:`This pairing link is not usable. Ask for a new one.`}):e));return{inventory:yield*_0(n.projects.readInventory()).pipe($f(e=>e instanceof m0?new rG({message:`Pairing succeeded but the workspace could not be loaded. Reload the page.`}):e)),principal:{kind:`device`,deviceId:r.device.id}}}),hce=X(({transport:e,platform:t})=>VE(Yu(z0.layer(e),Ru(y0,t))).fn(e=>mce(e))),J0=X(e=>{class t extends tr()(`@porcelain/client/HttpClient`){static runtime=e.atoms(Uu(t,Kf(dj(H1),t=>({request:(n,r)=>v0(n(t),t=>e.request(t,r))}))).pipe(Zu(h0(e.transport))))}return t}),Y0=Gp(`Client.requestApi`)(function*(e,t){return yield*(yield*J0(e)).request(t)}),X0=X(e=>e.atoms(t=>Yu(t(J0(e).runtime.layer),Gu(e.runtime.contextEffect)))),Z0=class e extends tr()(`@porcelain/client/AccessSnapshots`){static layer=Uu(e,H(function*(){return{sharing:yield*GD(In()),remote:yield*GD(In()),update:yield*GD(In())}}))},Q0=X(e=>e.atoms(t=>Qu(Z0.layer,t(X0(e).layer))));function gce(){return new rG({message:`The connected context changed. Reopen Porcelain to continue safely.`})}function $0(e,t=!0){return kf(()=>e.isClosed()?Tp:e2(t))}function e2(e=!0){return e?Af:U(gce())}function _ce(e){return e instanceof Jq}var t2=Nb,vce=Pb,yce=class extends HK.add(BG(`live`).add(HA(`liveUpdates`,`/api/live`,{disableCodecs:!0,query:fq.fields,success:pq.pipe(Wk({decode:()=>void 0}),Hk(`SwitchingProtocols`))})).middleware(dK)){};HK.add(BG(`reviewMcp`).add(UA(`reviewMcp`,`/mcp`,{disableCodecs:!0,payload:t2,success:[t2,vce.pipe(Wk({decode:()=>void 0}),Hk(`Accepted`))]})).middleware(dK));var n2=[`lan`,`tailnet`,`cloudflare`],r2={lan:`Local network`,tailnet:`Tailscale`,cloudflare:`Cloudflare tunnel`},bce={lan:`Devices on this network.`,tailnet:`Encrypted access through your Tailscale network.`,cloudflare:`HTTPS through your existing tunnel.`},i2={loopback:`This computer`,lan:`Local network`,tailnet:`Tailscale`,tunnel:`Cloudflare tunnel`};function xce(e){return`This device is connected through ${r2[e]}, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}var Sce=`Anyone on the same network can read what Porcelain shows and the device credentials it sends. For an encrypted connection, use Tailscale.`,Cce=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/,wce=/^::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}$/;function Tce(e,t){let n=new URL(e).hostname.replace(/^\[|\]$/g,``).replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n===`::1`||t.includes(n)||Cce.test(n)||wce.test(n)}function Ece(e){return e.route!==`loopback`||e.canEditWaysIn}function Dce(e,t=[]){return Tce(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 a2(e){return`${e.subnet} on ${e.interfaceName}`}function o2(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?a2(r)===a2(n)?`Paused on this network. It looks like ${a2(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 ${a2(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 ${a2(r)}.`:`Paused: this computer is not on a local network.`:r?`Listening on ${a2(r)} only.`:`Listening on this network only.`:n?n.gatewayHardware?`Turning it on listens on ${a2(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 Oce(e){return e?n2.some(t=>{let n=e.routes[t];return n.enabled?n.status.kind===`starting`||n.status.kind===`off`:n.status.kind!==`off`}):!1}function kce(e){return e===void 0?[]:n2.flatMap(t=>{let{status:n}=e.routes[t];return n.kind===`on`?n.urls.map(e=>({route:t,url:e})):[]})}function Ace(e){let[t]=e.grants;return t?{id:t.grant.id,label:t.grant.label,link:HG(t.link),expiresAt:t.grant.expiresAt}:null}function jce(e){return`tailscale serve --bg --https=443 ${e}`}var Mce={lan:`Starting`,tailnet:`Checking the Tailscale name`,cloudflare:`Checking the tunnel`};function Nce(e,t){switch(t.status.kind){case`off`:return t.enabled?`Starting`:null;case`starting`:return Mce[e];case`paused`:return`Paused on this network`;case`failed`:return`Failed`;case`on`:return t.enabled?`On`:`Stopping`}}var Pce={tailnet:{label:`Tailscale name`,saveLabel:`Save name`,placeholder:`laptop.tail1234.ts.net`},cloudflare:{label:`Public hostname`,saveLabel:`Save hostname`,placeholder:`porcelain.example.com`}};function s2(e,t){return(t===`tailnet`?e.tailnetHostname:e.cloudflareHostname)??``}function Fce(e,t){let{enabled:n,status:r}=e.routes[t];return n&&r.kind===`failed`}function Ice(e,t,n){let r=s2(e,t)===``;return t===`tailnet`?{tailnetHostname:n,...r?{tailnet:!0}:{}}:{cloudflareHostname:n,...r?{cloudflare:!0}:{}}}function Lce(e,t,n){let r=s2(e,t),i=n??r,a=i.trim();return{...Pce[t],value:i,canSave:a!==``&&a!==r,save:Ice(e,t,a),failed:Fce(e,t),check:t===`tailnet`?{tailnet:!0}:{cloudflare:!0}}}function Rce(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 c2(e){return rS(e)?e.value:void 0}function zce(e,t,n){return H(function*(){let r=yield*Gf(n.pipe(Uf(()=>$0(e))));if(cu(r)&&Ul(r.cause))return yield*Tp;if(su(r))yield*qD(t,Ln(r.value));else{let e=Un(Hl(r.cause));e instanceof m0&&e.status===401&&(yield*qD(t,In()))}return Qx(r,qn(yield*KD(t),iS))})}function l2(e,t,n,r){let i=e.atom(e=>{let i=Jn(e.self(),fS);return dT(Kf(r,e=>hT(cT($x(i)),rT(t).pipe(mT(pf(n)),Hae(t=>!e(Un(fS(t))))))))}).pipe(aD(e=>gS(e,e=>e)));return dD(i).pipe(rD((e,t)=>{let n=e(t);return e(i).waiting?$x(Ln(n)):n}),SE(0))}function u2(e,t,n){return Bf(Z0,r=>zce(e,t(r),n))}function d2(e){return e.pipe(Xf(e=>e instanceof m0&&e.status===403||I(e,`WaysInPermissionRequiredError`)||I(e,`SharingManagementRequiredError`)?B(null):U(e)))}var f2=X(e=>l2(Q0(e),u2(e,e=>e.sharing,d2(Y0(e,e=>e.administration.listAccess()))),k0,B(()=>!0))),p2=X(e=>l2(Q0(e),u2(e,e=>e.remote,d2(Y0(e,e=>e.remoteAccess.readRemoteAccess()))),D0,B(Oce))),m2=X(e=>l2(Q0(e),u2(e,e=>e.update,Y0(e,e=>e.serviceUpdates.readServiceUpdate())),O0,H(function*(){let e=Un(yield*KD((yield*Z0).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 Bce(e){return H(function*(){let t=yield*J0(e),n=yield*nG,r=yield*Z0,i=yield*$T;function a(t,r){return n.run([t],H(function*(){yield*$0(e);let t=yield*r;return yield*$0(e),t}))}function o(t){return V(()=>{e.isClosed()||i.refresh(t)})}function s(e,t,n){return yp(V(()=>{let t=i.mount(e),n=ME(iS(i.get(e),{waiting:!0}));return i.set(e,n),{transition:n,unmount:t}}),({transition:e})=>n.pipe(Uf(n=>H(function*(){yield*qD(t,Ln(n)),i.set(e,iS(iS(n),{waiting:!0}))}))),({transition:e,unmount:t},n)=>V(()=>{i.set(e,su(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(Uf(()=>o(f2(e))))),revoke:n=>a(`paired-access`,t.request(e=>e.administration.revokeAccess({payload:{id:n}})).pipe(xp(o(f2(e))))),trust:n=>a(`paired-access`,t.request(e=>e.administration.setDeviceTrust({payload:n})).pipe(xp(o(f2(e))))),allowManagement:n=>a(`paired-access`,t.request(e=>e.administration.setManagementPermission({payload:n})).pipe(xp(o(f2(e))))),allowWaysIn:n=>a(`paired-access`,t.request(e=>e.administration.setWaysInPermission({payload:n})).pipe(xp(o(f2(e))))),setRemote:n=>a(`remote-access`,s(p2(e),r.remote,t.request(e=>e.remoteAccess.setRemoteAccess({payload:n})).pipe(Uf(()=>$0(e)),tp(()=>o(p2(e)))))),startUpdate:n=>a(`service-update`,s(m2(e),r.update,t.request(e=>e.serviceUpdates.startServiceUpdate({payload:{version:n}})).pipe(Uf(()=>$0(e)),tp(()=>o(m2(e))))))}})}var h2=class e extends tr()(`@porcelain/client/AccessCommands`){static layer(t){return Uu(e,Bce(t))}},g2=X(e=>e.atoms(t=>Qu(h2.layer(e),t(Q0(e).layer)))),Vce=X(e=>g2(e).fn(e=>h2.use(t=>t.issue(e)).pipe(Kf(Ace)),{concurrent:!0})),Hce=X(({connection:e,id:t})=>g2(e).fn(()=>h2.use(e=>e.revoke(t)),{concurrent:!0})),Uce=X(({connection:e,id:t})=>g2(e).fn(e=>h2.use(n=>n.trust({id:t,trusted:e})),{concurrent:!0})),Wce=X(({connection:e,id:t})=>g2(e).fn(e=>h2.use(n=>n.allowWaysIn({id:t,allowed:e})),{concurrent:!0})),Gce=X(e=>g2(e).fn(e=>h2.use(t=>t.setRemote(e)),{concurrent:!0})),Kce=X(e=>g2(e).fn(e=>h2.use(t=>t.startUpdate(e)),{concurrent:!0})),qce=X(({connection:e,id:t})=>g2(e).fn(e=>h2.use(n=>n.allowManagement({id:t,allowed:e})),{concurrent:!0})),_2={withIdentity:(e,t)=>[...e,...t.cacheIdentity??[]],worktreeSurface:(e,t,n)=>_2.withIdentity(_2.reviewSurface(e.environmentId,t,n),e),worktreeReads:(e,t,n)=>[_2.environment(e.environmentId),_2.review(e.environmentId,t),_2.reviewSurface(e.environmentId,t,n.slice(0,1)),_2.reviewSurface(e.environmentId,t,n)],connectedInventory:e=>_2.withIdentity(_2.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)=>[..._2.reviewProject(e,t.projectId),t.worktreeId],reviewSurface:(e,t,n)=>[..._2.review(e,t),...n]},v2=new Set([`changes`,`directory`,`text`,`paths`,`git-status`,`asset`,`html-preview`,`step-lines`]),y2=new Set([`changes`,`git-status`,`paths`,`step-lines`]);function b2(e,t,n,r=In(),i=[t,_2.environment(e.environmentId)]){return H(function*(){let a=yield*nG,o=yield*wT,s=yield*UT({epoch:0,result:Bn(r,{onNone:()=>nS(),onSome:e=>iS(e)})}),c=(t=n,r=!1)=>H(function*(){let n=(yield*GT(s)).epoch;yield*YT(s,e=>({...e,result:lS(e.result)}));let i=yield*Gf(t.pipe(Uf(()=>$0(e))));yield*YT(s,e=>e.epoch===n?{...e,epoch:e.epoch+ +!!r,result:Qx(i,Ln(e.result))}:e)});function l(n,r){return a.run(_2.withIdentity(t,e),H(function*(){yield*$0(e),yield*YT(s,e=>({...e,epoch:e.epoch+1}));let t=yield*n;return yield*$0(e),yield*YT(s,e=>({epoch:e.epoch+1,result:Bn(r(fS(e.result),t),{onNone:()=>e.result,onSome:e=>iS(e)})})),t}).pipe(xp(o.invalidate([t]))))}return{confirm:l,refresh:e=>H(function*(){yield*YT(s,e=>({...e,epoch:e.epoch+1})),yield*c(e,!0)}),stream:Rae(WT(s).pipe(fT(e=>e.result)),o.stream(i,c()).pipe(Iae))}})}var x2=Er(`@porcelain/client/InventorySeed`,{defaultValue:()=>In()}),S2=class e extends tr()(`@porcelain/client/InventoryState`){static layer(t){return Uu(e,H(function*(){let e=yield*x2,n=yield*J0(t),r=e=>$0(t,e.environmentId===t.environmentId),i=n.request(e=>e.projects.readInventory()),a=yield*b2(t,_2.inventory(t.environmentId),i.pipe(Uf(r)),e,[_2.inventory(t.environmentId),_2.environment(t.environmentId),_2.worktreeInventory(t.environmentId)]);function o(e,t){return a.confirm(e,(e,n)=>qn(e,e=>t(e,n)))}return{stream:a.stream,confirm:o,refresh:()=>a.refresh(n.request(e=>e.projects.refreshInventory()).pipe(Zf(`RequestError`,e=>e.status===404?i:U(e)),Uf(r)))}}))}},C2=X(e=>e.atoms(t=>Qu(S2.layer(e),t(X0(e).layer))));function w2(e){return X(t=>C2(t).fn(n=>H(function*(){let r=yield*J0(t);return yield*(yield*S2).confirm(r.request(t=>e(t.environmentLabel,n)),(e,t)=>({...e,environment:t}))}),{concurrent:!0}))}var Jce=w2((e,t)=>e.renameEnvironment({payload:{name:t}})),Yce=w2((e,t)=>e.setEnvironmentIcon({payload:{icon:t}})),Xce=Gp(`BrowserSession.restore`)(function*(){let e=yield*z0;return{principal:yield*_0(e.session.readSession()),inventory:yield*_0(e.projects.readInventory())}},Xf(e=>e instanceof m0&&e.status===401?B(null):U(e instanceof m0||hb(e)?new rG({message:`Could not reach Porcelain to restore this browser session.`,cause:e}):e))),Zce=X(e=>B0(e).atom(Xce())),T2=`Save or discard unsaved file drafts before disconnecting.`;function E2(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 D2=class extends tr()(`@porcelain/client/FileDraftWriter`){},Qce=Er(`@porcelain/client/FileDraftTiming`,{defaultValue:()=>({autosave:ki(S0),diskNotice:ki(C0)})}),O2=class e extends tr()(`@porcelain/client/FileDraft`){static layer(t,n){return Uu(e,H(function*(){let e=yield*D2,r=yield*Qce,i=Vj({text:t.text,savedText:t.text,fingerprint:t.fingerprint,saving:!1,owner:null,error:null,diskChanged:new Set}),a=Vj(!1),o=Vj(null),s=yield*KW(void 0),c=yield*RC(1),l=yield*GD(void 0),u=yield*KW(new Map),d=Vj(new Map),f=e=>i.update(t=>({...t,...e})),p=()=>e.isBlockedError?e.isBlockedError(i.value.error):i.value.error instanceof _J,m=H(function*(){let e=yield*JD(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})},_=Gp(`FileDraft.forgetDiskChange`)(function*(e){let t=yield*JW(u,t=>{let n=new Map(t);return n.delete(e),[t.get(e),n]});t&&(yield*bS(t)),g(e)}),v=Gp(`FileDraft.save`)(function*(){return yield*c.withPermit(m),yield*yield*YW(s,t=>t?B([vS(t),t]):a.value||p()?B([B(!1),void 0]):i.value.text===i.value.savedText?B([B(!0),void 0]):(f({saving:!0,error:null}),Kf(Pp(H(function*(){for(;i.value.text!==i.value.savedText;){let t=i.value.text,n=yield*e.write(t,i.value.fingerprint);o.set(n),f({savedText:t,fingerprint:n})}return!0}).pipe(Qf(e=>V(()=>(f({error:Bl(e)}),!1))),xp(Rf.pipe(Hf(XW(s,void 0)),Hf(V(()=>f({saving:!1})))))),n,{startImmediately:!0}),e=>[vS(e),e])))});return yield*Su(n,V(()=>{a.set(!0),d.set(new Map)})),{state:i,get blocked(){return p()},claim(e){return a.value||i.value.owner!==null&&i.value.owner!==e?!1:(f({owner:e}),!0)},release:h,attachEditor:e=>{a.value||d.update(t=>new Map(t).set(e,Symbol(e)))},finishEditing:Gp(`FileDraft.finishEditing`)(function*(e,t,n=()=>{}){let r=d.value.get(e);r&&(yield*Rf,!(a.value||d.value.get(e)!==r)&&(d.update(t=>{let n=new Map(t);return n.delete(e),n}),n(),h(e),(i.value.saving||!i.value.error)&&(yield*v()),i.value.text!==i.value.savedText&&t()))}),noticeDiskChange:Gp(`FileDraft.noticeDiskChange`)(function*(e,t){yield*YW(u,s=>{if(a.value||i.value.saving||i.value.owner!==null||s.has(e)||o.value===t)return B([void 0,s]);f({diskChanged:new Set([...i.value.diskChanged,e])});let c;return Kf(Pp(op(r.diskNotice).pipe(Hf(ZW(u,t=>{if(t.get(e)!==c)return t;let n=new Map(t);return n.delete(e),g(e),n}))),n,{startImmediately:!0}),t=>(c=t,[void 0,new Map(s).set(e,t)]))})}),forgetDiskChange:_,change:Gp(`FileDraft.change`)(function*(e){a.value||i.value.text===e||(f({text:e}),yield*c.withPermit(H(function*(){if(yield*m,a.value)return;let e=yield*Pp(op(r.autosave).pipe(Hf(qD(l,void 0)),Hf(v()),Yf),n,{startImmediately:!0});yield*qD(l,e)})))}),reset:Gp(`FileDraft.reset`)(function*(e,t){yield*c.withPermit(H(function*(){a.value||i.value.saving||(yield*m,f({text:e,savedText:e,fingerprint:t,error:null}))}))}),refresh:Gp(`FileDraft.refresh`)(function*(e,t){yield*c.withPermit(V(()=>{let n=i.value;a.value||!t||n.saving||n.text!==n.savedText||n.fingerprint===t||f({text:e,savedText:e,fingerprint:t,error:null})}))}),save:v,dispose:()=>kf(()=>(a.set(!0),Tu(n,ou)))}}))}},k2=(e,t)=>`${JSON.stringify([e.projectId,e.worktreeId])}/${t}`,A2=class e extends tr()(`@porcelain/client/FileDrafts`){static layer=Uu(e,H(function*(){let e=yield*gp,t=Vj(new Map),n=Vj(new Map),r=e=>t.value.get(e)??new Map,i=(e,n)=>t.update(t=>{let r=new Map(t);return n.size?r.set(e,n):r.delete(e),r});return{entries:e=>new Map([...r(e.environmentId)].map(([e,t])=>[e,t.draft])),retain:Gp(`FileDrafts.retain`)(function*(t){let n=k2(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*Cu(e),s=Vj(t.path),c=yr(yield*Iu(O2.layer(t,o).pipe(Zu(Ru(D2,{...t.writer,write:(e,n)=>t.writer.write({path:s.value,text:e,expectedFingerprint:n})})))).pipe(hp(vu,o)),O2);return i(t.environmentId,new Map(r(t.environmentId)).set(n,{scope:o,draft:c,path:s})),yield*Su(o,V(()=>i(t.environmentId,new Map([...r(t.environmentId)].filter(([,e])=>e.scope!==o))))),c}),adopt:e=>{n.update(t=>new Map(t).set(e.environmentId,e))},connection:e=>n.value.get(e.environmentId)??e,hasUnsaved:e=>e.some(e=>[...r(e).values()].some(({draft:e})=>e.state.value.saving||e.state.value.text!==e.state.value.savedText)),hasUnsavedWorktree:(e,t)=>[...r(e)].some(([e,{draft:n}])=>e.startsWith(k2(t,``))&&(n.state.value.saving||n.state.value.text!==n.state.value.savedText||n.blocked)),save:Gp(`FileDrafts.save`)(function*(e){for(let{draft:t}of r(e).values())if(!(yield*t.save()))return!1;return!0}),drop:Gp(`FileDrafts.drop`)(function*(e){let t=[...r(e).values()];i(e,new Map),n.update(t=>{let n=new Map(t);return n.delete(e),n}),yield*wf(t,e=>Tu(e.scope,ou),{concurrency:`unbounded`,discard:!0})}),relocate:Gp(`FileDrafts.relocate`)(function*(e,t,n,a){let o=r(e),s=new Map(o),c=[],l=k2(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(k2(a,r),t)}else c.push(t)}}i(e,s),yield*wf(c,e=>Tu(e.scope,ou),{concurrency:`unbounded`,discard:!0})})}}))},j2=X(e=>e.atoms(A2.layer)),$ce=X(e=>j2(e).atom(A2)),ele=X(e=>e.atoms(t=>Yu(t(J0(e).runtime.layer),A2.layer)).fn(Gp(`BrowserSession.disconnect`)(function*(){let t=yield*A2,n=yield*J0(e);if(!(yield*t.save(e.environmentId)))return yield*U(new rG({message:T2}));yield*n.request(e=>e.browserAccess.clearBrowserSession())},$f(e=>e instanceof rG?e:new rG({message:`Could not disconnect. Check the connection and try again.`,cause:e}))))),tle=Gp(`BrowserSession.connect`)(function*(e,t,n,r){let i=yield*u0,a=yield*i.beginConnection(),o=yield*yp(V(()=>e.set(t,n)),()=>tE(e,t,{suspendOnWaiting:!0}),()=>V(()=>e.set(t,YE))).pipe(ap({duration:r,orElse:()=>Tp}),Qf(e=>U(new rG({message:E2(Bl(e)),cause:Bl(e)}))));if(a&&(yield*a(o)),i.state.value.connection?.environmentId!==o.inventory.environmentId)return yield*U(new rG({message:`Could not connect to the environment. Try again.`}))}),nle=Gp(`BrowserSession.restoreConnection`)(function*(e,t){let n=yield*u0;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*tE(e,t,{suspendOnWaiting:!0});return a!==null&&(yield*r(a),n.state.value.connection!==null)}),M2=class e extends tr()(`@porcelain/client/EnvironmentMutations`){static layer=Uu(e,H(function*(){let e=yield*RC(1),t=Vj(0);return{pendingSelections:t,run:(n,r)=>yp(V(()=>{n===`selection`&&t.update(e=>e+1)}),()=>e.withPermit(r),()=>V(()=>{n===`selection`&&t.update(e=>e-1)}))}}))},N2=class extends tr()(`@porcelain/client/WorkspaceSelectionCleanup`){},rle=H(function*(){let e=yield*s0,t=yield*$W,n=yield*M2,r=yield*A2,i=yield*N2;return{read:Gp(`Environments.read`)(()=>n.run(`access`,e.load())),pair:Gp(`Environments.pair`)(r=>n.run(`access`,H(function*(){return r.localEnvironmentId&&b0(r.value)?.environmentId===r.localEnvironmentId?yield*U(new rG({message:`That link is for this computer.`})):yield*pce(r.value,r.environmentId).pipe(hp(s0,e),hp($W,t))}))),route:Gp(`Environments.route`)(t=>n.run(`access`,H(function*(){if(!(yield*r.save(t.environmentId)))return yield*U(new rG({message:T2}));yield*e.route(t)}))),forget:Gp(`Environments.forget`)(t=>n.run(`selection`,H(function*(){if(!(yield*r.save(t)))return yield*U(new rG({message:T2}));yield*H(function*(){yield*e.forget(t),yield*i.forgetEnvironment(t),yield*r.drop(t)}).pipe(Op)})))}}),P2=class e extends tr()(`@porcelain/client/EnvironmentCommands`){static layer=Uu(e,rle)};function F2(e){return e.kind===`service`?e.state.managed&&e.state.available&&e.state.latest!==void 0:e.available&&e.latest!==void 0}function ile(e,t){return t.running||e.some(F2)}function I2(e){if(e.kind===`mac-app`)return F2(e)?e.latest:void 0;let{state:t}=e;return F2(e)&&t.managed&&t.canUpdate&&!t.running?t.latest:void 0}function ale(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 ole(e){let t=new Set;for(let n of e)I2(n)!==void 0&&t.add(`${n.kind}:${n.id}`);return t.size}function sle(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 L2=ME({running:!1,entries:[]}).pipe(nD),R2=class extends Y()(`SettingsUpdateError`,{message:K}){},cle=Gp(`updateSettingsTarget`)(function*(e,t,n){if(e.kind===`mac-app`)return yield*e.update(t);let r=Kce(e.connection),i=n.mount(r);yield*bp(()=>V(i)),n.set(r,t),yield*tE(n,r,{suspendOnWaiting:!0});let a=yield*eE(n,m2(e.connection)).pipe(fT(e=>{if(aS(e)){let t=Bl(e.cause);return t instanceof m0&&(t.status===401||t.status===403)?Ln({status:`failed`,message:`Could not confirm the update: access to this computer was denied (${t.status}). Pair or trust this device again.`}):In()}if(!rS(e))return In();let n=e.value;return n.managed?n.running?In():n.version===t?Ln({status:`updated`}):n.last?.target===t&&n.last.stage===`failed`?Ln({status:`failed`,message:n.last.reason??`The updater gave no reason.`}):In():Ln({status:`failed`,message:`This computer no longer runs the managed service.`})}),_T(zn),fT(e=>e.value),bT);if(Rn(a))return yield*new R2({message:`The update stopped before completion.`});if(a.value.status===`failed`)return yield*new R2({message:a.value.message})}),lle=XE((e,t)=>H(function*(){let n=t.registry;if(n.get(L2).running)return;let r=[],i=new Set;for(let t of e){let e=I2(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(L2,{running:e,entries:a});o(!0),yield*H(function*(){for(let[e,{target:t,version:i}]of r.entries()){a=a.map((t,n)=>n===e?{...t,status:`updating`}:t),o(!0);let r=yield*Gf(cle(t,i,n).pipe(_p)),s=cu(r)?Bl(r.cause):void 0;a=a.map((t,n)=>n===e?su(r)?{...t,status:`updated`}:{...t,status:`failed`,message:s instanceof Error?s.message:`The update failed.`}:t),o(!0)}}).pipe(xp(V(()=>{a=a.map(e=>e.status===`queued`||e.status===`updating`?{...e,status:`failed`,message:`The update was interrupted.`}:e),o(!1)})))}),{concurrent:!0}).pipe(nD),z2=pj(yce).live.liveUpdates,ule=pj(Gq).pairing.redeemPairing,B2=new Set;function dle(e){return B2.add(e),()=>B2.delete(e)}function V2(){for(let e of[...B2])e()}function H2(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!==ule()&&t.reportUnauthorized!==!1&&V2(),a}}var U2=X(e=>C2(e).atom(dT(Kf(S2,e=>e.stream))).pipe(aD(e=>gS(e,e=>e)),SE(0)));X(e=>kE(t=>e.map(e=>({connection:e,result:t(U2(e))}))));var fle=class extends tr()(`@porcelain/client/ProjectSelectionStorage`){},W2=class e extends tr()(`@porcelain/client/ProjectSelectionStore`){static layer=Uu(e,H(function*(){let e=yield*fle,t=yield*iG({initial:{currentEnvironmentId:void 0,selections:{}},read:e.read,write:e.write,messages:{beforeRead:`Saved workspace selections must be read before changing them.`,readFailed:`Saved workspace selections could not be read. Try reading them again.`,writeFailed:`Saved workspace selections could not be updated. Read them again before making changes.`}}),n=t.write;return{state:t.state,load:t.load,selectEnvironment:Gp(`ProjectSelectionStore.selectEnvironment`)(e=>n(({selections:t})=>B({currentEnvironmentId:e,selections:t}))),selectWorkspace:Gp(`ProjectSelectionStore.selectWorkspace`)((e,t,r)=>n(({selections:n})=>B({currentEnvironmentId:e,selections:{...n,[e]:{projectId:t,worktreeId:r}}}))),forgetEnvironment:Gp(`ProjectSelectionStore.forgetEnvironment`)(e=>n(({currentEnvironmentId:t,selections:n})=>B({currentEnvironmentId:t===e?void 0:t,selections:Object.fromEntries(Object.entries(n).filter(([t])=>t!==e))})))}}))},G2={projects:void 0,environments:void 0,reviews:void 0,older:!1};function ple(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 K2(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 mle(e){return e.state===`loading`?`Reading changes…`:e.state===`unavailable`?`Working tree unavailable`:e.count===0?`Working tree clean`:`${e.count} ${e.count===1?`file`:`files`} changed`}function hle(e){return e.review.state===`none`?``:K2(e.review).replace(`Review · `,``)}function q2(e){if(e.state!==`available`)return;let t=e.summary;return t?.state===`available`&&(t.additions||t.deletions||t.binaryFiles)?t:void 0}function gle(e){if(e.state===`loading`)return`Reading changes…`;if(e.state===`unavailable`)return`Changes unavailable`;let t=q2(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 _le(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 vle(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,K2(e.review),e.kind===`worktree`?mle(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 yle(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 ble(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 xle(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]}))}})}var J2=ME({query:``,filter:G2,expanded:{}}).pipe(nD);function Sle(e){return H(function*(){let t=yield*J0(e),n=yield*S2,r=yield*A2;return{register:e=>n.confirm(t.request(t=>t.projects.registerProject({payload:{path:e}})),(e,t)=>({...e,projects:e.projects.some(e=>e.id===t.id)?e.projects.map(e=>e.id===t.id?t:e):[...e.projects,t]})),rename:e=>n.confirm(t.request(t=>t.projects.renameProject({params:{projectId:e.projectId},payload:{name:e.name}})),(e,t)=>({...e,projects:e.projects.map(e=>e.id===t.id?{...e,name:t.name}:e)})),remove:i=>n.confirm(H(function*(){let n=`[${JSON.stringify(i)},`;for(let[t,i]of r.entries(e))if(t.startsWith(n)&&!(yield*i.save()))return yield*U(new rG({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 Y2=class extends tr()(`@porcelain/client/ProjectCommands`){},X2=X(e=>e.atoms(t=>Qu(Uu(Y2,Sle(e)),Yu(t(C2(e).layer),A2.layer)))),Cle=X(e=>X2(e).fn(e=>Y2.use(t=>t.register(e)),{concurrent:!0})),wle=X(e=>X2(e).fn(e=>Y2.use(t=>t.rename(e)),{concurrent:!0})),Tle=X(e=>X2(e).fn(e=>Y2.use(t=>t.remove(e)),{concurrent:!0})),Z2=X(e=>C2(e).fn(e=>S2.use(e=>e.refresh()),{concurrent:!0})),Ele=X(e=>AE(t=>e.map(e=>t(Z2(e))),(t,n)=>{for(let n of e)t.set(Z2(n),void 0)})),Q2=class e extends tr()(`@porcelain/client/FilePreferencesState`){static layer(t,n){return Uu(e,H(function*(){let e=yield*J0(t);return yield*b2(t,_2.filePreferences(t.environmentId,n),e.request(e=>e.projects.listFilePreferences({params:{projectId:n}})))}))}},$2=X(({connection:e,projectId:t})=>e.atoms(n=>Qu(Q2.layer(e,t),n(X0(e).layer)))),Dle=X(({connection:e,projectId:t})=>$2({connection:e,projectId:t}).fn(n=>H(function*(){let r=yield*J0(e);return yield*(yield*Q2).confirm(r.request(e=>e.projects.setFilePreference({params:{projectId:t},payload:n})),(e,t)=>Ln(t))}),{concurrent:!0})),e4=class e extends tr()(`@porcelain/client/ReadSubscriptions`){static layer=Uu(e,H(function*(){let e=yield*UT(Zm());return{snapshot:GT(e),changes:WT(e),reviewsFor:Gp(`ReadSubscriptions.reviewsFor`)(function*(t){let n=yield*GT(e);return[...new Set([...$m(n)].flatMap(e=>e.reviewId&&(e.projectId===void 0||e.projectId===t.projectId&&e.worktreeId===t.worktreeId)?[e.reviewId]:[]))]}),retain:Gp(`ReadSubscriptions.retain`)(function*(t){yield*vp(H(function*(){let n=Symbol();return yield*YT(e,Qm(n,t)),n}),t=>YT(e,eh(t)))})}}))};function t4(e,t,n,r,i,a=[]){let o=r4(e,t,n,i.atom(i=>H(function*(){yield*(yield*e4).retain({...t,paths:a,surface:String(n[0]),settled:tE(i.registry,o,{suspendOnWaiting:!0}).pipe(np,Yf)});let s=yield*r;return yield*$0(e),s})));return o}function n4(e){let t=ME(nS()).pipe(nD),n=e.pipe(tD(t));return rD(n,r=>{let i=r(e);return rS(i)&&r.once(t)!==i&&r.set(t,i),r(n)}).pipe(SE(0))}function Ole(e,t,n,r,i){let a=r4(e,t,n,i.pull(e=>dT(H(function*(){return yield*(yield*e4).retain({...t,paths:[],surface:String(n[0]),settled:tE(e.registry,a,{suspendOnWaiting:!0}).pipe(np,Yf)}),typeof r==`function`?r(e):r}))));return a}function r4(e,t,n,r){return r.pipe(e.atoms.withReactivity(_2.worktreeReads(e,t,n)),SE(0))}function i4(e,t,n,r){let i=r.atom(r=>dT(H(function*(){return yield*(yield*e4).retain({...e,paths:[],surface:t,settled:tE(r.registry,i,{suspendOnWaiting:!0}).pipe(np,Yf)}),(yield*n).stream}))).pipe(aD(e=>gS(e,e=>e)),SE(0));return i}function a4(e,t,n,r=()=>!0,i=[]){return t4(e.connection,e.scope,t,Y0(e.connection,n).pipe(Uf(t=>$0(e.connection,r(t)))),X0(e.connection),i)}var kle=X(e=>$2(e).atom(dT(Kf(Q2,e=>e.stream))).pipe(aD(e=>gS(e,e=>e)),SE(0),n4)),Ale=X(({connection:e,path:t})=>X0(e).atom(H(function*(){return yield*(yield*J0(e)).request(e=>e.projects.browseProjectFolders({query:t===void 0?{}:{path:t}}))})));function jle(e,t){return Ale({connection:e,path:t})}q({currentEnvironmentId:W(OG),selections:zb(K,q({projectId:OG,worktreeId:kG})).check(kie(OG))});var Mle=H(function*(){let e=yield*s0,t=yield*W2,n=yield*M2;return{pending:n.pendingSelections,execute:Gp(`WorkspaceSelection.execute`)(r=>n.run(`selection`,H(function*(){if(r.kind===`read`){if(yield*t.load(),e.state.value.status!==`ready`||t.state.value.status!==`ready`)return;let n=new Set(e.state.value.remotes.map(e=>e.environmentId)),r=new Set(Object.keys(t.state.value.selections));t.state.value.currentEnvironmentId&&r.add(t.state.value.currentEnvironmentId);for(let e of r)n.has(e)||(yield*t.forgetEnvironment(e));return}if(e.state.value.status!==`ready`||!e.state.value.remotes.some(e=>e.environmentId===r.environmentId))return yield*U(new rG({message:`That environment is no longer paired. Open the workspace picker again.`}));if(r.kind===`environment`){yield*t.selectEnvironment(r.environmentId);return}yield*t.selectWorkspace(r.environmentId,r.projectId,r.worktreeId)})))}});(class e extends tr()(`@porcelain/client/ProjectSelectionCommands`){static layer=Uu(e,Mle)});var Nle=X(e=>XE((t,n)=>H(function*(){let r=yield*n.setResult(Cle(e),t.path.trim()),i=r.worktrees.find(e=>e.available);t.complete(),i&&(yield*t.select({remote:t.remote,projectId:r.id,worktreeId:i.id}))})));Uu(N2,Kf(W2,e=>({forgetEnvironment:e.forgetEnvironment})));var o4=Gp(`Changes.readSnapshot`)(function*({connection:e,scope:t}){let n=yield*Y0(e,e=>e.changes.readChanges({params:{worktreeId:t.worktreeId}}));return yield*$0(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),Ple=X(e=>t4(e.connection,e.scope,[`changes`],o4(e),X0(e.connection)).pipe(n4)),s4=Gp(`Changes.readGitStatusSnapshot`)(function*({connection:e,scope:t}){let n=yield*Y0(e,e=>e.changes.readGitStatus({params:{worktreeId:t.worktreeId}}));return yield*$0(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),c4=X(e=>t4(e.connection,e.scope,[`git-status`],s4(e),X0(e.connection)).pipe(n4)),l4=X(e=>t4(e.connection,e.scope,[`git-status`],H(function*(){let t=yield*Y0(e.connection,t=>t.changes.readWorktreeSummary({params:{worktreeId:e.scope.worktreeId}}));return yield*$0(e.connection,t.environmentId===e.connection.environmentId&&t.worktreeId===e.scope.worktreeId),t}),X0(e.connection)).pipe(n4)),u4=class e extends tr()(`@porcelain/client/CommentThreadsState`){static layer(t,n){return Uu(e,H(function*(){let e=yield*J0(t);return yield*b2(t,_2.reviewSurface(t.environmentId,n,[`comments`]),H(function*(){let r=yield*e.request(e=>e.reviews.listCommentThreads({params:{worktreeId:n.worktreeId}}));if(yield*$0(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*$0(t,i?.environmentId===t.environmentId&&i.worktreeId===n.worktreeId&&r.every(e=>e.worktreeId===n.worktreeId||e.review?.reviewId===i.reviewId))}return yield*$0(t),r}),In(),_2.worktreeReads(t,n,[`comments`]))}))}},d4=X(({connection:e,scope:t})=>e.atoms(n=>Qu(u4.layer(e,t),n(X0(e).layer)))),Fle=X(e=>ME({snapshot:``,filters:new Set,through:0})),Ile=X(e=>i4(e.scope,`comments`,u4,d4(e)).pipe(n4));function f4({connection:e,scope:t}){return Ile({connection:e,scope:t})}function p4(e,t,n=()=>!0,r={}){return X0(e).atom(r=>{let i=Jn(r.self(),fS);return H(function*(){let r=yield*Y0(e,e=>t(e,i));return yield*$0(e,n(r)),r})}).pipe(e.atoms.withReactivity([_2.environment(e.environmentId),...r.inventory===!1?[]:[_2.inventory(e.environmentId)]]),SE(0))}function m4(e,t=!1){return n=>{let r=n.pipe(e.connection.atoms.withReactivity([_2.durableReview(e.connection.environmentId,e.reviewId)]));return rD(r,n=>(t&&n.mount(_4(e)),n(r)))}}function h4(e,t){return(e.revision===void 0?t.reviews.readReview({params:{reviewId:e.reviewId}}):t.reviews.readReviewRevision({params:{reviewId:e.reviewId,revision:e.revision}})).pipe(Zf(`ReviewNotFoundError`,()=>B({review:void 0,revisions:[],revision:void 0})))}function g4(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 _4=X(e=>{let t=ME(In()).pipe(nD),n=p4(e.connection,(n,r)=>H(function*(){let i=yield*$T,a=Un(i.get(t));if(Rn(r)&&a?.review&&a.revision){let n=(yield*tE(i,v4({connection:e.connection,projectId:a.review.projectId}),{suspendOnWaiting:!0})).find(t=>t.reviewId===e.reviewId);if(n&&n.latestRevision===a.review.latestRevision){let e={...a,review:n};return i.set(t,Ln(e)),e}}let o=yield*h4(e,n);return yield*$0(e.connection,g4(e,o)),i.set(t,Ln(o)),o}),t=>g4(e,t)).pipe(e.connection.atoms.withReactivity([_2.durableReview(e.connection.environmentId,e.reviewId)]),SE(0)),r=X0(e.connection).atom(t=>H(function*(){let r=t(n),i=Un(fS(r)),a=yield*e4,o={reviewId:e.reviewId,surface:`review`,settled:tE(t.registry,n,{suspendOnWaiting:!0}).pipe(np,Yf)};return i||(yield*a.retain(o)),i?.review?.state===`open`&&!i.review.archived&&i.revision&&(yield*a.retain({...o,projectId:i.review.projectId,worktreeId:i.revision.content.worktreeId,paths:[]})),r})).pipe(aD(e=>gS(e,e=>e)),SE(0)),i=aD(t,e=>zn(e)?iS(e.value):nS());return rD(n,e=>e(r)).pipe(tD(i),SE(0))}),v4=X(e=>{let t=p4(e.connection,t=>t.reviews.listProjectReviews({params:{projectId:e.projectId}}),t=>t.every(t=>t.projectId===e.projectId)).pipe(e.connection.atoms.withReactivity([_2.projectReviews(e.connection.environmentId,e.projectId)]));return rD(t,n=>{let r=n(t),i=Un(fS(r)),a=e.connection.runtime.runSync(wT);return n.addFinalizer(a.registerUnsafe(i?i.map(t=>_2.durableReview(e.connection.environmentId,t.reviewId)):[_2.projectReviews(e.connection.environmentId)],()=>n.refresh(t))),r}).pipe(n4)}),y4=X(e=>p4(e.connection,t=>t.reviews.listReviewMarks({params:{reviewId:e.reviewId}})).pipe(m4(e,!0),n4)),Lle=X(e=>p4(e.connection,t=>t.reviews.listReviewCommentThreads({params:{reviewId:e.reviewId}}),t=>t.every(t=>t.review?.reviewId===e.reviewId)).pipe(m4(e,!0))),Rle=X(e=>{let t=Lle({connection:e.connection,reviewId:e.reviewId});if(!e.worktree)return t;let n=f4({connection:e.connection,scope:e.worktree});return kE(e=>{let r=e(t),i=e(n),a=aS(i)?Un(Hl(i.cause)):void 0,o=a&&`_tag`in a&&(a._tag===`WorktreeUnavailableError`||a._tag===`WorktreeNotFoundError`||a._tag===`ProjectNotFoundError`)?iS(Vn(fS(i),()=>[])):i;return gS(r,e=>hS(o,t=>[...e,...t.filter(e=>e.review===void 0)]))}).pipe(SE(0))}),zle=X(e=>p4(e.connection,t=>t.reviews.readReviewFile({params:{reviewId:e.reviewId,revision:e.revision},query:{path:e.path}}))),Ble=X(e=>p4(e.connection,t=>t.reviews.readReviewDiffs({params:{reviewId:e.reviewId,revision:e.revision},payload:{paths:e.paths}}))),Vle=X(e=>p4(e.connection,t=>t.reviews.readReviewProofFile({params:{reviewId:e.reviewId,revision:e.revision},query:{proofId:e.proofId}}),t=>t.id===e.proofId));X(e=>p4(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(m4(e))),X(e=>p4(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(m4(e)));var Hle=X(e=>p4(e.connection,t=>t.reviews.readReviewPullRequest({params:{reviewId:e.reviewId}})).pipe(m4(e,!0))),Ule=X(e=>p4(e.connection,t=>t.reviews.listProjectPullRequests({params:{projectId:e.projectId}})).pipe(e.connection.atoms.withReactivity([_2.projectReviews(e.connection.environmentId),_2.projectReviews(e.connection.environmentId,e.projectId)]))),Wle=X(e=>p4(e.connection,t=>t.reviews.readProjectGitHubAccount({params:{projectId:e.projectId}})).pipe(n4)),Gle=X(e=>X0(e.connection).atom(H(function*(){let t={connection:e.connection,reviewId:e.reviewId},n=yield*Y0(e.connection,e=>h4(t,e));return yield*$0(e.connection,g4(t,n)),!n.review||n.review.lastSeenRevision>=e.revision?{updated:!1}:yield*Y0(e.connection,t=>t.reviews.setReviewSeen({params:{reviewId:e.reviewId},payload:{revision:e.revision}}))})).pipe(e.connection.atoms.withReactivity([_2.environment(e.connection.environmentId)]),nD)),b4=X(e=>p4(e.connection,t=>t.reviews.readReviewPullChecks({params:{reviewId:e.reviewId}}),void 0,{inventory:!1}).pipe(m4(e),n4));function x4(e,t){return e?.some(e=>e.layerId===t.id&&e.fingerprint===t.fingerprint)===!0}function Kle({revision:e,marks:t,status:n,pull:r}){let i=e?.content.layers??[],a=i.filter(e=>x4(t?.decisions,e)).length,o=i.length,s=t!==void 0&&o>0&&a===o,c=n===`replied`,l=qle(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 qle(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 Jle(e,t){return e.archived===!0||e.state===`closed`||t?.kind===`available`&&t.pullRequest!==void 0&&t.pullRequest.state!==`open`}function Yle(e,t){return e.archived!==!0&&t?.kind===`available`&&t.pullRequest!==void 0&&t.pullRequest.state!==`open`}function Xle(e,t,n){return n?.trim()||t?.verdict.asked.text.trim()||e.branch}function Zle(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 Qle(e,t){return e===void 0&&t?.kind===`unavailable`&&t.reason===`not-github`}function $le(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 S4(e,t,n=`${t}s`){return e===1?t:n}function C4(e,t,n=`${t}s`){return`${e} ${S4(e,t,n)}`}function eue(e){return e.matchesReviewHead?`Same head as the review`:`Different head from the review`}function w4(e){return e.state===`open`&&e.draft?`draft`:e.state}var tue={open:`Open`,draft:`Draft`,merged:`Merged`,closed:`Closed`};function nue(e){return tue[w4(e)]}var rue=new Set([`FAILURE`,`ERROR`,`CANCELLED`,`TIMED_OUT`,`ACTION_REQUIRED`,`STARTUP_FAILURE`,`STALE`]);function T4(e){return e.status!==`COMPLETED`||e.conclusion===`EXPECTED`?`running`:rue.has(e.conclusion??``)?`failed`:`passed`}function iue(e,t,n){let r=`${e.length}${t?`+`:``}`;if(t){let e=E4(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=C4(e.length,`check`),a=e.filter(e=>T4(e)===`failed`);if(a.length>0)return{tone:`failed`,label:`${a.length} of ${i} failed`,short:`${a.length} failed`};let o=e.filter(e=>T4(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 aue(e){return T4(e)}function E4(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 oue(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 sue(e){return e===`MERGEABLE`?{label:`No conflicts`,tone:`passed`}:e===`CONFLICTING`?{label:`Conflicts`,tone:`failed`}:{label:`Not known yet`,tone:`none`}}function cue(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 D4(e){let t=/\/pull\/([1-9][0-9]*)$/.exec(e);return t?Number(t[1]):void 0}function lue(e){return/^https:\/\/github\.com\/([^/]+\/[^/]+)\/pull\//.exec(e)?.[1]}function uue(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 due(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 fue(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 O4(e){return e??`Detached HEAD`}function pue(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 mue(e){let t=e.projects.flatMap(e=>e.worktrees);return t.find(e=>e.available&&!e.main)??t.find(e=>e.available)}function hue(e){return e.projects.flatMap(e=>e.worktrees).find(e=>e.available&&(e.status===`replied`||e.status===`pending`))??mue(e)}function gue(e){return e.worktrees.find(e=>e.main)?.path??e.worktrees[0]?.path??``}function _ue(e){switch(e.unavailableReason){case`moved`:return`Porcelain doesn't recognise this repository as the one it registered. Remove the project and add it again.`;case`missing`:return`The repository folder is missing.`;case`permission`:return`Porcelain cannot read this repository because access is denied.`;case`git-failed`:return`Git could not read this repository.`;default:return`Porcelain can't reach this repository right now.`}}var vue=WK.literals,k4={desktop:`Desktop`,laptop:`Laptop`,server:`Server`,cloud:`Cloud`},A4=`desktop`;function j4(e){return e.icon??A4}function yue(e){return e===A4?null:e}function M4(e){return{state:`available`,reviewId:e.reviewId,closed:e.state===`closed`||e.archived===!0,archived:e.archived===!0,pullRequestNumber:e.pullRequest?D4(e.pullRequest):void 0,progress:void 0}}function bue(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??Zle(e.path).name,branch:O4(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(ple)}var xue=X(e=>kE(t=>{let n=t(U2(e.connection)),r=Un(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=bue({...e,project:a,environmentName:o}),c=t(v4({connection:e.connection,projectId:a.id})),l=Un(fS(c)),u=[],d=(l??[]).filter(e=>e.state===`open`&&!e.archived),f=new Set(s.map(e=>e.branch)),p=d.filter(e=>f.has(e.branch)).map(n=>{let r=t(_4({connection:e.connection,reviewId:n.reviewId}));return{record:n,result:r,revision:Un(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(n.available&&n.worktreeId){let r=t(c4({connection:e.connection,scope:{projectId:n.projectId,worktreeId:n.worktreeId}})),i=Un(fS(r));aS(r)&&u.push(`Working tree status for ${n.name} on ${o} could not be read.`),n.changes=aS(r)?{state:`unavailable`}:i?{state:`available`,count:new Set(i.changes.map(e=>e.scope===`untracked`||e.scope===`unmerged`?e.path:e.newPath??e.oldPath)).size}:{state:`loading`}}if(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(y4({connection:e.connection,reviewId:r.record.reviewId})),a=Un(fS(i));aS(i)&&u.push(`Progress for ${n.name} on ${o} could not be read.`);let s=r.revision?.content.layers;n.review={...M4(r.record),...a&&s&&!aS(i)?{progress:{reviewed:s.filter(e=>x4(a.decisions,e)).length,total:s.length}}:{},progressUnavailable:aS(i)}}if(e.older)for(let t of l??[]){if(_.has(t.reviewId))continue;let n=p.find(e=>e.record.reviewId===t.reviewId)?.revision;s.push({key:`${e.connection.environmentId}/${t.reviewId}`,kind:`review`,environmentId:e.connection.environmentId,environmentName:o,projectId:a.id,projectName:a.name,worktreeId:s.find(e=>n?.worktreePath===e.path)?.worktreeId,path:n?.worktreePath,name:t.branch,branch:t.branch,main:!1,detached:t.branch===`Detached HEAD`,available:!0,review:{...M4(t),retained:!0},changes:{state:`unavailable`}})}return{entries:s,messages:u}}).pipe(SE(0))),N4=X(e=>kE(t=>{let n=t(J2),r=[],i=[],a=!1;for(let o of e){let e=t(U2(o)),s=Un(fS(e));eS(e)&&(a=!0),aS(e)&&i.push(`${s?.environment.name??`Computer`}: projects could not be read.`);for(let t of s?.projects??[]){let i=aS(e)?{...t,available:!1}:t,a=`${o.environmentId}/${i.id}`;r.push({key:a,connection:o,project:i,environmentName:s.environment.name,environmentIcon:j4(s.environment),expanded:n.query.trim().length>0||n.expanded[a]!==!1,entries:[]})}}r.sort((e,t)=>e.project.name.localeCompare(t.project.name)||e.environmentName.localeCompare(t.environmentName)||e.key.localeCompare(t.key));let o=xle(r.map(e=>({key:e.key,name:e.project.name,environmentId:e.connection.environmentId,environmentName:e.environmentName,environmentIcon:e.environmentIcon})),n.filter),s=[];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){s.push(e);continue}let r=t(xue({connection:e.connection,projectId:e.project.id,older:n.filter.older}));i.push(...r.messages);let a=r.entries.filter(e=>ble(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(l4({connection:e.connection,scope:{projectId:n.projectId,worktreeId:n.worktreeId}})),i=Un(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(b4({connection:e.connection,reviewId:n.review.reviewId})),i=Un(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)&&s.push({...e,entries:a})}return{projects:s,allProjects:r,filters:o,loading:a,messages:[...new Set(i)]}})),P4=class extends tr()(`@porcelain/client/OperationStore`){},F4=class extends tr()(`@porcelain/client/OperationStorage`){},I4=Sx(J(q({requestId:PX.fields.requestId,projectId:K.check(px(1)),worktreeId:jG.fields.worktreeId,request:PX}).check(nx(e=>e.requestId===e.request.requestId))));function L4(e){return e.state!==`running`}var R4=(e,t)=>JSON.stringify([e.projectId,e.worktreeId,t]),Sue=Uu(P4,H(function*(){let e=yield*F4,t=yield*RC(1),n=yield*UT(0),r=yield*e.read().pipe(Bf(e=>yb(I4)(e??`[]`)),Wf),i=Vj({operations:Nr(r)?new Map(r.success.map(e=>[R4(e,e.request.input.action),e])):new Map,closed:!1,restorationError:Mr(r)?new rG({message:`Could not restore pending Git operations. Check the previous operation before starting another.`,cause:r.failure}):void 0}),a=Gp(`OperationStore.publish`)(function*(e){i.set(e),yield*YT(n,e=>e+1)});yield*bp(()=>t.withPermit(a({...i.value,operations:new Map,closed:!0})));let o=Gp(`OperationStore.persist`)(function*(t){if(i.value.restorationError)return yield*U(i.value.restorationError);let n=[...t.values()].filter(e=>!e.receipt||!L4(e.receipt)).map(({receipt:e,...t})=>t),r=yield*wb(I4)(n).pipe($f(e=>new rG({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e})));yield*(n.length?e.write(r):e.clear()).pipe($f(({cause:e})=>new rG({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e}))),yield*a({...i.value,operations:t})}),s=e=>t.withPermit(H(function*(){return i.value.closed?yield*Tp:yield*e().pipe(Op)}));return{state:i,set:Gp(`OperationStore.set`)((e,t)=>s(()=>H(function*(){let n=new Map(i.value.operations);t?n.set(e,t):n.delete(e),yield*o(n)}))),accept:Gp(`OperationStore.accept`)(e=>s(()=>H(function*(){let t=R4(e,e.action),n=i.value.operations.get(t);if(!n||n.requestId!==e.requestId||n.receipt&&L4(n.receipt))return!1;let r=new Map(i.value.operations);return r.set(t,{...n,receipt:e}),yield*o(r),!0}))),wait:Gp(`OperationStore.wait`)(function*(e,t){return yield*Bn(yield*WT(n).pipe(pT(()=>H(function*(){let n=i.value.operations.get(e);return yield*e2(!i.value.closed&&n?.requestId===t),n?.receipt&&L4(n.receipt)?Ln(n.receipt):In()})),_T(zn),fT(e=>e.value),bT),{onSome:B,onNone:()=>e2(!1).pipe(Hf(Nf))})})}})),Cue=X(({connection:e,scope:t})=>e.operations.state.map(({operations:e})=>{let n=e.get(R4(t,`switch`));return{unresolved:!(!n||n.receipt&&L4(n.receipt))}})),wue=X(e=>XE(Gp(`WorktreeNavigator.refresh`)(function*(t,n){yield*wf(e,e=>n.setResult(Z2(e),void 0),{concurrency:`unbounded`});let r=n(N4(e));for(let e of r.projects){if(!e.expanded)continue;let t=v4({connection:e.connection,projectId:e.project.id}),r=Un(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(_4({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(l4({connection:e.connection,scope:{projectId:t.projectId,worktreeId:t.worktreeId}})),n.refresh(c4({connection:e.connection,scope:{projectId:t.projectId,worktreeId:t.worktreeId}}))),t.review.state===`available`&&t.review.pullRequestNumber&&n.refresh(b4({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(y4(r))}}}))),z4=[`review`,`reviewed-layers`],Tue={files:z4,git:z4,review:z4,reviewed:[`reviewed`,`reviewed-layers`],comments:[`comments`]};function Eue(e){return e.type===`worktree`?{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(Tue[e.change])}:null}function Due(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 Oue(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(Eue(e)?.surfaces);if(e.change===`files`)for(let e of v2)t.add(e);if(e.change===`git`)for(let e of[...y2,...B4])t.add(e);return{scope:e,surfaces:t}}function V4(e,t){let n=Oue(t);return n?[...n.surfaces].map(t=>_2.reviewSurface(e,n.scope,[t])):[]}function kue(e){if(e.state!==`running`&&e.state!==`rejected`&&e.state!==`no-change`)return new Set([...e.action===`fetch`||e.action===`push`?[`git-status`,`changes`]:[...y2,...v2],...B4,...Due(e)?.surfaces??[]])}function H4(e,t){let n=kue(t);return n?[...n].map(n=>_2.reviewSurface(e,t,[n])):[]}var Aue=class extends ta{},U4=class e extends tr()(`@porcelain/client/GitReceiptRefresh`){static layer(t){return Uu(e,H(function*(){let e=yield*gp,n=yield*wT,r=yield*e4,i=yield*aW({capacity:1/0,timeToLive:Ei,lookup:a=>H(function*(){let o=new Set(H4(t.environmentId,a).map(e=>String(e[4]))),s=[...$m(yield*r.snapshot)],c=yield*r.reviewsFor(a),l=s.filter(e=>e.projectId===a.projectId&&e.worktreeId===a.worktreeId).filter(e=>o.has(e.surface)),u=yield*Pp(H(function*(){n.invalidateUnsafe([_2.worktreeInventory(t.environmentId),_2.projectReviews(t.environmentId,a.projectId),...c.map(e=>_2.durableReview(t.environmentId,e)),...H4(t.environmentId,a)]),yield*wf(l,e=>e.settled,{concurrency:`unbounded`,discard:!0})}),e);return yield*Pp(_S(u).pipe(Hf(pW(i,a))),e),u})});return{refresh:Gp(`GitReceiptRefresh.refresh`)(function*(e){if(e.state===`running`||e.state===`rejected`||e.state===`no-change`)return;let t=new Aue({projectId:e.projectId,worktreeId:e.worktreeId,requestId:e.requestId,action:e.action,state:e.state}),n=yield*cW(i,t);n.pollUnsafe()&&(yield*pW(i,t)),yield*vS(n)})}}))}},W4=X(e=>e.atoms(t=>Qu(U4.layer(e),t(X0(e).layer))));function G4(e,t){return H(function*(){let n=yield*(yield*J0(e)).request(e=>e.gitActions.readGitActionReceipt({params:{worktreeId:t.worktreeId,requestId:t.requestId}}));return yield*$0(e,n.projectId===t.projectId&&n.worktreeId===t.worktreeId&&n.requestId===t.requestId),n})}var K4=class extends Y()(`GitOperationStateError`,{reason:Gb([`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.`}}},jue=Gp(`GitActionController.make`)(function*({connection:e,scope:t,action:n}){let r=yield*J0(e),i=yield*P4,a=yield*EW,o=yield*U4,s=yield*RC(1),c=R4(t,n),l=Gp(`GitActionController.accept`)(function*(t){yield*$0(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*o.refresh(t),yield*$0(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*i.accept(t)}),u=Gp(`GitActionController.send`)(function*(a){let o=yield*r.request(e=>e.gitActions.runGitAction({params:{worktreeId:t.worktreeId},payload:a}));return`requestId`in o?(yield*$0(e,o.projectId===t.projectId&&o.worktreeId===t.worktreeId&&o.requestId===a.requestId&&o.action===n),yield*l(o),yield*i.wait(c,a.requestId)):yield*U(new m0({status:o.statusCode,message:o.message}))});return{execute:Gp(`GitActionController.execute`)(function*(r){return yield*e.request(H(function*(){let o=yield*s.withPermit(H(function*(){yield*$0(e);let o=i.state.value.operations.get(c);if(o&&(!o.receipt||!L4(o.receipt)))return yield*U(new K4({reason:`pending`}));if(r.input.action!==n)return yield*U(new K4({reason:`mismatch`}));let s={...r,requestId:yield*a.randomUUIDv4.pipe($f(e=>new rG({message:`Could not create a Git recovery identity.`,cause:e})))};return yield*i.set(c,{...t,requestId:s.requestId,request:s}),s}));return yield*u(o)}))}),recover:Gp(`GitActionController.recover`)(function*(){return yield*e.request(H(function*(){yield*$0(e);let t=i.state.value.operations.get(c);if(!t)return yield*U(new K4({reason:`missing`}));let r=yield*G4(e,t).pipe(Zf(`GitActionNotFoundError`,()=>U(new K4({reason:`receipt-unavailable`}))),$f(e=>e instanceof m0&&e.status===404?new K4({reason:`receipt-unavailable`}):e));return yield*$0(e,r.action===n),yield*l(r),yield*i.wait(c,t.requestId)}))}),startNew:Gp(`GitActionController.startNew`)(function*(){return yield*s.withPermit(H(function*(){let e=i.state.value.operations.get(c)?.receipt;return!e||!L4(e)?!1:(yield*i.set(c,null),!0)}))})}}),q4=class e extends tr()(`@porcelain/client/GitActionController`){static layer(t){return Uu(e,jue(t))}},J4=X(e=>e.connection.atoms(t=>Qu(q4.layer(e),Ju(t(W4(e.connection).layer),Gu(e.connection.runtime.contextEffect))))),Y4=X(e=>J4(e).fn(e=>q4.use(t=>t.execute(e)),{concurrent:!0})),X4=X(e=>J4(e).fn(e=>q4.use(e=>e.recover()),{concurrent:!0})),Mue=X(e=>J4(e).fn(e=>q4.use(e=>e.startNew())));function Nue(e,t){let n=Y4(e),r=X4(e),i=Mue(e),a=()=>{t.set(n,JE),t.set(r,JE)};return{run:Gp(`GitActions.run`)(function*(e,r){return t.set(n,{input:e,expected:r}),yield*tE(t,n,{suspendOnWaiting:!0})}),recover:Gp(`GitActions.recover`)(function*(){return t.set(r,void 0),yield*tE(t,r,{suspendOnWaiting:!0})}),startNew:Gp(`GitActions.startNew`)(function*(){t.set(i,void 0),(yield*tE(t,i,{suspendOnWaiting:!0}))&&a()}),reset:a}}var Z4=X(e=>ME(H(function*(){return Nue(e,yield*$T)}))),Q4=Gp(`Projects.branchSwitchCommands`)(function*(e){return yield*tE(yield*$T,Z4({...e,action:`switch`}),{suspendOnWaiting:!0})}),$4=X(e=>e.atoms(t=>Yu(t(X0(e).layer),A2.layer))),e3=Gp(`Projects.requireSavedWorktreeDrafts`)(function*(e){if((yield*A2).hasUnsavedWorktree(e.connection.environmentId,e.scope))return yield*new rG({message:`Save or discard unsaved file drafts before changing this worktree.`})}),Pue=X(e=>$4(e.connection).fn(Gp(`Projects.deleteWorktree`)(function*(t){t.confirmation&&(yield*e3(e));let n=yield*Y0(e.connection,n=>n.projects.deleteWorktree({params:{worktreeId:e.scope.worktreeId},payload:t}));return yield*$0(e.connection),n.deleted&&(yield*ET([_2.inventory(e.connection.environmentId),_2.worktreeInventory(e.connection.environmentId),_2.projectReviews(e.connection.environmentId)])),n}))),Fue=X(e=>$4(e.connection).fn(Gp(`Projects.switchWorktreeBranch`)(function*(t){yield*e3(e);let n=yield*Q4(e),r=yield*s4(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})}))),Iue=X(e=>$4(e.connection).fn(Gp(`Projects.recoverWorktreeBranchSwitch`)(function*(t){return yield*e3(e),yield*(yield*Q4(e)).recover()}))),Lue=1.5,Rue=29360128,zue=1e4,Bue=8192,Vue=80,Hue=64,Uue=1e4,t3=15e3,Wue=2166136261,Gue=16777619;function Kue(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 que(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 Jue(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 Yue(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 Xue(e,t){return e.contentFingerprint!==null&&e.contentFingerprint!==void 0&&e.contentFingerprint!==t.contentFingerprint}function Zue(e){return e.comparison?.kind===`branch`?e.comparison.base:void 0}function Que(e){return e.kind===`change`?void 0:e.filePath}function $ue(e){return e?{kind:`change`,comparison:{kind:`branch`,base:e.base},revision:e.tip}:{kind:`change`}}function ede(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 tde(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 nde(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 rde(e,t){return`${e.split(`
18
- `).map(e=>`> ${e}`).join(`
19
- `)}\n\n${t}`}function ide(e){return e.trim().length>0&&!e.includes(`\0`)&&e.length<=16e3}function ade(e,t,n){return e?.body===t?e:n()}function ode(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 sde(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 cde(e){return[...e].sort((e,t)=>a3.indexOf(e.result)-a3.indexOf(t.result))}function lde(e,t){let n=e=>e.layerId===t;return{checks:(e?.checks??[]).filter(n),assets:(e?.assets??[]).filter(n),current:e?.current??!0}}function ude(e){switch(e){case`fail`:return`Failed`;case`pass`:return`Passed`}}function dde(e){return Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0))}function fde(e){return URL.parse(e)?.host??e}function pde(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}var s3=q({method:Gb([`GET`,`POST`,`PATCH`,`PUT`,`DELETE`,`HEAD`,`OPTIONS`,`TRACE`,`QUERY`]),url:K,urlParams:J(Vb([K,K])),hash:W(K),headers:zb(K,Wb([K,Fx(K)]))}).annotate({identifier:`HttpRequestDetails`}),mde=q({status:fx,headers:zb(K,Wb([K,Fx(K)]))}).annotate({identifier:`HttpResponseDetails`}),c3=`~effect/ai/AiError/Reason`,l3=()=>_de.pipe(Xb(B({})),bie(B({}))),hde=e=>{let t=Re(e),n={};for(let e in t){let r=t[e];st(n,e,mh(r)?r.toString():r)}return n},gde=class e extends Ux(`effect/ai/AiError/NetworkError`)({_tag:$b(`NetworkError`),reason:Gb([`TransportError`,`EncodeError`,`InvalidUrlError`]),request:s3,description:W(K)}){[c3]=c3;get isRetryable(){return this.reason===`TransportError`}static fromRequestError(t){return new e({description:t.description,reason:t._tag,request:{hash:Un(t.request.hash),headers:hde(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}},_de=zb(K,Kb(qx)),u3=q({promptTokens:W(fx),completionTokens:W(fx),totalTokens:W(fx)}).annotate({identifier:`UsageInfo`}),d3=q({request:s3,response:W(mde),body:W(K)}).annotate({identifier:`HttpContext`}),vde=class extends Ux(`effect/ai/AiError/RateLimitError`)({_tag:$b(`RateLimitError`),retryAfter:W(Mx),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!0}get message(){let e=`Rate limit exceeded`;return this.retryAfter&&(e+=`. Retry after ${Vi(this.retryAfter)}`),e}},yde=class extends Ux(`effect/ai/AiError/QuotaExhaustedError`)({_tag:$b(`QuotaExhaustedError`),resetAt:W(Ax),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){let e=`Quota exhausted`;return this.resetAt&&(e+=`. Resets at ${this.resetAt}`),`${e}. Check your account billing and usage limits.`}},bde=class extends Ux(`effect/ai/AiError/AuthenticationError`)({_tag:$b(`AuthenticationError`),kind:Gb([`InvalidKey`,`ExpiredKey`,`MissingKey`,`InsufficientPermissions`,`Unknown`]),description:W(K),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){let e=`${this.kind}: ${{InvalidKey:`Verify your API key is correct`,ExpiredKey:`Your API key has expired. Generate a new one`,MissingKey:`No API key provided. Set the appropriate environment variable`,InsufficientPermissions:`Your API key lacks required permissions`,Unknown:`Authentication failed. Check your credentials`}[this.kind]}`;return this.description&&(e+=`. ${this.description}`),e}},xde=class extends Ux(`effect/ai/AiError/ContentPolicyError`)({_tag:$b(`ContentPolicyError`),description:K,metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){return`Content policy violation: ${this.description}`}},Sde=class extends Ux(`effect/ai/AiError/InvalidRequestError`)({_tag:$b(`InvalidRequestError`),parameter:W(K),constraint:W(K),description:W(K),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){let e=`Invalid request`;return this.parameter&&(e+=`: parameter '${this.parameter}'`),this.constraint&&(e+=` ${this.constraint}`),this.description&&(e+=`. ${this.description}`),e}},Cde=class extends Ux(`effect/ai/AiError/InternalProviderError`)({_tag:$b(`InternalProviderError`),description:K,metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!0}get message(){return`Internal provider error: ${this.description}`}},wde=class e extends Ux(`effect/ai/AiError/InvalidOutputError`)({_tag:$b(`InvalidOutputError`),description:K,metadata:l3(),usage:W(u3)}){[c3]=c3;get isRetryable(){return!0}static fromSchemaError(t){return new e({description:t.message})}get message(){return`Invalid output: ${this.description}`}},Tde=class e extends Ux(`effect/ai/AiError/StructuredOutputError`)({_tag:$b(`StructuredOutputError`),description:K,responseText:K,metadata:l3(),usage:W(u3)}){[c3]=c3;get isRetryable(){return!0}static fromSchemaError(t,n){return new e({description:t.message,responseText:n})}get message(){return`Structured output validation failed: ${this.description}`}},Ede=class extends Ux(`effect/ai/AiError/UnsupportedSchemaError`)({_tag:$b(`UnsupportedSchemaError`),description:K,metadata:l3()}){[c3]=c3;get isRetryable(){return!1}get message(){return`Unsupported schema: ${this.description}`}},Dde=class extends Ux(`effect/ai/AiError/UnknownError`)({_tag:$b(`UnknownError`),description:W(K),metadata:l3(),http:W(d3)}){[c3]=c3;get isRetryable(){return!1}get message(){return this.description??`Unknown error`}},f3=class extends Ux(`effect/ai/AiError/ToolNotFoundError`)({_tag:$b(`ToolNotFoundError`),toolName:K,availableTools:J(K)}){[c3]=c3;get isRetryable(){return!0}get message(){let e=this.availableTools.length>0?this.availableTools.join(`, `):`none`;return`Tool '${this.toolName}' not found. Available tools: ${e}`}},p3=class extends Ux(`effect/ai/AiError/ToolParameterValidationError`)({_tag:$b(`ToolParameterValidationError`),toolName:K,description:K}){[c3]=c3;get isRetryable(){return!0}get message(){return`Invalid parameters for tool '${this.toolName}': ${this.description}`}},m3=class extends Ux(`effect/ai/AiError/InvalidToolResultError`)({_tag:$b(`InvalidToolResultError`),toolName:K,description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Tool '${this.toolName}' returned invalid result: ${this.description}`}},h3=class extends Ux(`effect/ai/AiError/ToolResultEncodingError`)({_tag:$b(`ToolResultEncodingError`),toolName:K,toolResult:Nb,description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Failed to encode result for tool '${this.toolName}': ${this.description}`}},Ode=Wb([vde,yde,bde,xde,Sde,Cde,gde,wde,Tde,Ede,Dde,f3,p3,m3,h3,class extends Ux(`effect/ai/AiError/ToolConfigurationError`)({_tag:$b(`ToolConfigurationError`),toolName:K,description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Invalid configuration for tool '${this.toolName}': ${this.description}`}},class extends Ux(`effect/ai/AiError/ToolkitRequiredError`)({_tag:$b(`ToolkitRequiredError`),pendingApprovals:J(K),description:W(K)}){[c3]=c3;get isRetryable(){return!1}get message(){return`Toolkit required to resolve pending tool approvals: ${this.pendingApprovals.join(`, `)}`}},class extends Ux(`effect/ai/AiError/InvalidUserInputError`)({_tag:$b(`InvalidUserInputError`),description:K}){[c3]=c3;get isRetryable(){return!1}get message(){return`Invalid user input: ${this.description}`}}]),g3=`~effect/ai/AiError`,_3=class extends Ux(`effect/ai/AiError/AiError`)({_tag:$b(`AiError`),module:K,method:K,reason:Ode}){[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}`}},kde=e=>F(e,c3),v3=e=>new _3(e),Ade=`~effect/ai/Tool`,y3=(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),e,t),b3={[Ade]:{_Requirements:o},pipe(){return n(this,arguments)},addDependency(){return y3(this)},setParameters(e){return y3(this,{parametersSchema:e,jsonSchema:void 0})},setSuccess(e){return y3(this,{successSchema:e})},setFailure(e){return y3(this,{failureSchema:e})},setNeedsApproval(e){return y3(this,{needsApproval:e})},annotate(e,t){return y3(this,{annotations:hr(this.annotations,e,t)})},annotateMerge(e){return y3(this,{annotations:wr(this.annotations,e)})}};({...b3}),{...b3};var jde=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??Lb,r=t?.failure??Mb;return jde({name:e,description:t?.description,parametersSchema:t?.parameters??Pde,successSchema:n,failureSchema:r,failureMode:t?.failureMode??`error`,annotations:pr(),needsApproval:t?.needsApproval})},S3=Er(`effect/ai/Tool/Readonly`,{defaultValue:l}),C3=Er(`effect/ai/Tool/Destructive`,{defaultValue:c}),w3=Er(`effect/ai/Tool/Idempotent`,{defaultValue:l}),T3=Er(`effect/ai/Tool/OpenWorld`,{defaultValue:c}),E3=Er(`effect/ai/Tool/Strict`,{defaultValue:()=>void 0}),Mde=q({type:Gb([`execution-denied`,`execution-interrupted`]),reason:K}).annotate({identifier:`ToolExecutionFailure`}),Nde=e=>Wb([_3,e.failureSchema,Mde]),Pde=zb(K,Mb),D3=`~effect/ai/Toolkit`,Fde=Er(`effect/ai/Toolkit/FailureOrigin`,{defaultValue:()=>`result`}),O3=(e,t)=>$l(Pl(e),mr(Fde,t)),Ide={...on({label:`Toolkit`,evaluate:Wp(function*(e){let t=this.tools,n=e.context,r=new WeakMap,i=e=>{let t=r.get(e);if(O(t)){let i=n.mapUnsafe.get(e.id),a=Db(e.parametersSchema)?yb(e.parametersSchema):e=>B(e),o=Cb(e.successSchema),s=Cb(Nde(e));t={context:i.context,handler:i.handler,decodeParameters:a,encodeResult:(e,t)=>t?s(e):o(e)},r.set(e,t)}return t};return{tools:t,handle:Wp(function*(e,n,r,a){let o=Object.hasOwn(t,e)?t[e]:void 0;if(yield*bne({tool:e,parameters:n}),O(o))return yield*v3({module:`Toolkit`,method:`${e}.handle`,reason:new f3({toolName:e,availableTools:Object.keys(t)})});let s=i(o),c=(t,n)=>s.encodeResult(t,n).pipe($f(n=>v3({module:`Toolkit`,method:`${e}.handle`,reason:new h3({toolName:e,toolResult:t,description:n.message})}))),l=yield*Wf(s.decodeParameters(n,a));if(Mr(l)){let t=v3({module:`Toolkit`,method:`${e}.handle`,reason:new p3({toolName:e,description:l.failure.message})});return o.failureMode===`error`?yield*Pf(O3(t,`parameters`)):rT(Kf(c(t,!0),e=>({result:t,isFailure:!0,failureOrigin:`parameters`,preliminary:!1,encodedResult:e})))}let u=l.success,d=yield*rC(),f={toolCallId:r,preliminary:e=>Yf(oC(d,{result:e,isFailure:!1,preliminary:!0}))},p=yield*s.handler(u,f).pipe(Bf(e=>oC(d,{result:e,isFailure:!1,preliminary:!1})),mp(e=>wr(s.context,e)),lp({onFailure:e=>uC(d,e),onSuccess:()=>fC(d)}),Np),m=t=>hb(t)?v3({module:`Toolkit`,method:`${e}.handle`,reason:new m3({toolName:e,description:`Tool handler returned invalid result: ${t.message}`})}):kde(t)?v3({module:`Toolkit`,method:`${e}.handle`,reason:t}):t;return uT(d).pipe(Vae(e=>{let t=m(e),n=hb(e)?`result`:`handler`;return o.failureMode===`error`?kae(O3(t,n)):cT({result:t,isFailure:!0,failureOrigin:n,preliminary:!1})}),pT(Wp(function*(e){let t=yield*c(e.result,e.isFailure);return{...e,encodedResult:t}})),Gae(bS(p)))})}})}),[D3]:D3,of:o,toHandlers(e){return H({self:this},function*(){let t=yield*up(),n=Sf(e)?yield*e:e,r=new Map;for(let[e,i]of Object.entries(n)){let n=Object.hasOwn(this.tools,e)?this.tools[e]:void 0;n!==void 0&&r.set(n.id,{name:e,handler:i,context:t})}return ur(r)})},toLayer(e){return Gu(this.toHandlers(e))},toJSON(){return{_id:`effect/ai/Toolkit`,tools:Array.from(Object.values(this.tools)).map(e=>e.name)}}},Lde=e=>Object.assign(function(){},Ide,{tools:e}),Rde=(...e)=>{let t={};for(let n of e)st(t,n.name,n);return t},zde=(...e)=>Lde(Rde(...e)),k3=q({cwd:Ob(K.check(px(1)).check(hx(dG)))}),Bde=q({...k3.fields,...Y$.fields}),Vde=q({...Z$.fields,warnings:J(K)}),Hde=q({...k3.fields,reviewId:W(K.check(ix())),...$$.fields}),Ude=q({reviewId:W(K.check(ix())),...k3.fields,scope:JQ.pipe(Qb(B(`waiting`)))}),Wde=q({...k3.fields,...XQ.fields}),Gde=q({...k3.fields,...KQ.fields,...QQ.fields}),Kde=q({...k3.fields,...KQ.fields,...e$.fields});zde(x3(`publish_review`,{parameters:Bde,success:Vde,failure:TG,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),x3(`read_review`,{parameters:Hde,success:i1,failure:TG,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),x3(`list_comments`,{parameters:Ude,success:q({threads:YQ}),failure:TG,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),x3(`create_comment`,{parameters:Wde,success:ZQ,failure:TG,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),x3(`reply_to_comment`,{parameters:Gde,success:$Q,failure:TG,failureMode:`return`,description:`Reply to a review thread. Stable optional messageId makes retries idempotent.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1),x3(`resolve_comment`,{parameters:Kde,success:t$,failure:TG,failureMode:`return`,description:`Resolve or reopen a review thread.`}).annotate(E3,!0).annotate(T3,!1).annotate(C3,!1).annotate(w3,!0));function qde(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 Jde(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 Yde(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 Xde(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 Zde(e){return e.split(`/`).at(-1)??e}function Qde(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 $de(e,t){return!(Date.parse(e.expires)-t>F0)}function efe(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?[`${C4(i,`line`)} in ${C4(t.length,`file`)}`]:[],...n>0?[C4(n,`binary file`)]:[],...r>0?[C4(r,`removed file`)]:[]],o=a.at(-1);return o===void 0?null:a.length===1?o:`${a.slice(0,-1).join(`, `)} and ${o}`}function tfe(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 nfe(e){let t=[...e.matchAll(/\shref\s*=\s*(["'])#layer-(\d+)\1/gi)].map(e=>Number(e[2]));return[...new Set(t)].filter(e=>e>0)}var rfe={kind:`worktree`};function ife(e){return{kind:`branch`,base:e?.base?.ref??``,branch:e?.head.branch}}function afe(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 ofe(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 ${C4(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 ${S4(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 sfe(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 cfe(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 lfe(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 ${C4(r.length,`file`)} reviewed`,text:n.length===0?`No reviewable files`:c??`Mark all reviewed`}}function ufe(e,t){return t===`reviewed`?`Unmark ${e} as unreviewed`:t===`stale`?`Mark changed ${e} as reviewed`:`Mark ${e} as reviewed`}function dfe(e,t){return!e?.fingerprint||t?null:e.reviewed?{kind:`unmark`,path:e.path}:{kind:`mark`,input:{path:e.path,fingerprint:e.fingerprint}}}function ffe(e){return e.kind===`branch`?{kind:`branch`,branch:e.branch}:{kind:`worktree`}}function pfe(e){return[`reviewed`,...e.kind===`branch`?[`branch`,e.branch??``]:[]]}function mfe(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 hfe(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 ${C4(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:`${C4(n,`check`)} passed`,value:`${n} passed`,tone:`ok`}}function gfe(e){if(e===null)return{key:`unexplained`,label:`No review published`,value:`No review`,tone:`attention`};let t=efe(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 _fe(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:`${C4(e,`comment`)} waiting on the agent`,value:`${e} awaiting agent`,tone:`attention`}),t>0&&n.push({key:`replies`,label:`${C4(t,`comment`)} waiting on you`,value:`${t} awaiting you`,tone:`attention`}),n}function vfe(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?gfe(e.review):null;return[t===0?{key:`files`,label:`No changed files`,value:`None changed`,tone:`ok`}:{key:`files`,label:`${n} of ${C4(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:`${C4(r,`mark`)} changed since reviewed`,value:`${r} changed`,tone:`attention`},...a===null?[]:[a],..._fe(i.awaitingAgent,i.awaitingYou),hfe(e.review?.proof)]}function R3(e,t){return e?`Unmark as reviewed`:t?`Mark as reviewed again`:`Mark as reviewed`}function yfe(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=sfe(e.files);return[{id:`open`,label:`Open`},{id:`review`,label:e.reviewed?R3(!0,e.stale):t.action??R3(!1,e.stale),disabled:!e.settled||e.pending||t.blocked}]}case`section`:return[{id:`open`,label:`Open`}];case`group`:return[{id:`expand-all`,label:`Expand all`},{id:`collapse-all`,label:`Collapse all`}];case`thread`:return[...e.canReveal?[{id:`reveal`,label:`Show in the code`}]:[],...e.resolved?[]:[{id:`reply`,label:`Reply`,disabled:e.pending}],{id:`resolution`,label:e.resolved?`Reopen`:`Resolve`,disabled:e.pending}];default:return e}}var z3=K.check(ix()),bfe=wx.check(dx()).check(ux({minimum:1,maximum:2**53-1}));q({reviewId:z3,environmentId:_x,host:_x,protocol:W(K$),revision:W(bfe),decision:W(z3)});function xfe(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 Sfe(e){let t=B3(e);return t.startsWith(`iPadOS`)?`tablet`:/^(?:iOS|Android|Mobile)\b/.test(t)?`phone`:`browser`}var Cfe=new Intl.ListFormat(`en-GB`,{type:`conjunction`});function wfe(e,t){let n=n2.filter(t=>e.routes[t].status.kind===`on`).map(e=>r2[e]);return[n.length===0?`No way in on`:Cfe.format(n),C4(t,`device`)].join(` · `)}function Tfe(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 Efe(e,t,n){let r=yu(),{timeoutMs:i,...a}=e,o=VW(Ju($u(nG.layer),DT,$u(e4.layer),n),{memoMap:t}),s=BE({memoMap:o.memoMap}),c=!1,l=Vp(wp(kf(()=>(c=!0,Tu(r,ou).pipe(xp(o.disposeEffect)))).pipe(Op))),u=()=>(c=!0,zp(l));return{connection:Pe({runtime:o,atoms:s,scope:r,isClosed:()=>c||r.state._tag===`Closed`,close:u,...a,request:Gp(`Connection.request`)(function*(e,t){if(c)return yield*Tp;let n=yield*(t?yp(Pp(e,t),vS,bS):e).pipe(ap({duration:i,orElse:()=>Tp}),Pp(r));return yield*vS(n).pipe(xp(bS(n)),Bf(e=>c?Tp:B(e)))})}),close:u,closeEffect:l}}var Dfe=X(e=>e.atoms(Bu).fn(t=>H(function*(){(yield*wT).invalidateUnsafe([_2.review(e.environmentId,t)])})));function Ofe(e){return()=>void 0}function kfe(e){return()=>void 0}function Afe(e){}function jfe(){return()=>void 0}var V3=class e extends tr()(`@porcelain/web/DesktopHost`){static layer=Vu(e,()=>({isDesktopShell:!1,hasAppUpdateFeed:!1,canPickProject:e=>!1,pickProject:Gp(`Desktop.pickProject`)(function*(e){return yield*U(new rG({message:`The native project picker is unavailable for this computer.`}))}),mcpConfiguration:kf(()=>U(new rG({message:`The desktop bridge is unavailable.`}))),checkUpdate:H(function*(){return In()}),installUpdate:kf(()=>U(new rG({message:`The native app updater is unavailable.`}))),updateStates:cT({status:`idle`})}))};function Mfe(){}var Nfe=X(e=>ME(t=>{t.addFinalizer(kfe(e))})),H3={isActive:()=>document.visibilityState!==`hidden`&&!0,subscribe:e=>{let t=Ofe(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 Pfe=QW.of({read:()=>Df({try:async()=>{{let e=localStorage.getItem(`porcelain.remotes`);return{remotes:e===null?[]:t0(JSON.parse(e)),missingCredentials:[]}}},catch:e=>new Ql(e)}),write:({remotes:e})=>Df({try:async()=>{let t=X1(e);localStorage.setItem(`porcelain.remotes`,t)},catch:e=>new Ql(e)})});function Ffe(e,t,n){let r=new Map;for(let t of[...e.state.value.operations.values()])t.receipt&&L4(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 Ife=Gp(`Live.connect`)(function*(e,t){let n=yield*$T,r=yield*e4,i=yield*P4,a=yield*U4,o=yield*wT,s=yield*vp(Cu(e.scope,`sequential`),e=>Tu(e,ou)),c=yield*zW(yield*NW().pipe(hp(vu,s)))(),l=yield*up(),u=Gp(`Live.applyNotice`)(function*(t){if(t.type===`git-action`)return yield*a.refresh(t.receipt);if(t.type===`inventory`&&(yield*o.invalidate([_2.inventory(e.environmentId),_2.reviewGitSettings(e.environmentId)])),t.type===`worktree`){let n=yield*r.reviewsFor(t);yield*o.invalidate([_2.worktreeInventory(e.environmentId),_2.projectReviews(e.environmentId,t.projectId),...n.map(t=>_2.durableReview(e.environmentId,t))])}t.type===`project`&&t.change===`preferences`&&(yield*o.invalidate([_2.filePreferences(e.environmentId,t.projectId)])),yield*o.invalidate(V4(e.environmentId,t))}),d=()=>{for(let t of i.state.value.operations.values())t.receipt&&L4(t.receipt)||c(Symbol(),H(function*(){let n=yield*G4(e,{...t}).pipe(pp(l));yield*$0(e),yield*a.refresh(n),yield*i.accept(n)}).pipe(np,Yf))},f=yield*e.liveUpdates.connect({onNotice:t=>{e.isClosed()||s.state._tag===`Closed`||(t.type===`inventory`&&e.onStatusChange?.(),t.type===`ready`&&d(),c(Symbol(),H(function*(){yield*u(t),t.type===`git-action`&&!e.isClosed()&&s.state._tag!==`Closed`&&(yield*i.accept(t.receipt))}).pipe(Qf(()=>V(()=>{!e.isClosed()&&s.state._tag!==`Closed`&&d()})),Yf)))},onReconnect:()=>{!e.isClosed()&&s.state._tag!==`Closed`&&(e.onStatusChange?.(),c(Symbol(),o.invalidate([_2.environment(e.environmentId)])))},onUnauthorized:()=>{e.isClosed()||s.state._tag===`Closed`||(e.onStatusChange?.(),t?t():c(Symbol(),o.invalidate([_2.inventory(e.environmentId)])))}}).pipe(hp(vu,s)),p=``,m=H(function*(){if(e.isClosed()||s.state._tag===`Closed`)return;let t=Ffe(i,Un(fS(n.get(U2(e)))),$m(yield*r.snapshot)),a=JSON.stringify(t);a!==p&&(p=a,f.subscribe(t))}),h=()=>{!e.isClosed()&&s.state._tag!==`Closed`&&c(`subscription`,Hf(Rf,m),{onlyIfMissing:!0})};yield*vp(V(()=>n.subscribe(U2(e),h)),e=>V(e)).pipe(hp(vu,s)),yield*vp(V(()=>i.state.subscribe(h)),e=>V(()=>e?.())).pipe(hp(vu,s)),c(Symbol(),xT(r.changes,()=>V(h))),h()}),Lfe=X(e=>e.atoms(t=>Ju(t(C2(e).layer),t(W4(e).layer),Gu(e.runtime.contextEffect)))),Rfe=X(({connection:e,onUnauthorized:t})=>Lfe(e).atom(Ife(e,t)).pipe(SE(0))),zfe=ME(iS(void 0)),Bfe=()=>Vj(`idle`);function Vfe(e){return e instanceof m0?e.status===401:e instanceof fM||lk(e)?e.reason._tag===`SocketCloseError`&&e.reason.code===4001:!1}function W3(e,t=pr(),n){let r=Bfe();return{state:r,connect:Gp(`LiveUpdates.connect`)(function*({onNotice:i,onReconnect:a,onUnauthorized:o}){let s=yield*GD({projects:[],worktrees:[]}),c=yield*ed,l=yield*aC(1),u=!1,d=_C(l);if(n?.activity){let e=n.activity,t=e.isActive(),r=!1,i=c.monotonicTimeNanosUnsafe();yield*vp(V(()=>e.subscribe(n=>{n&&(r=n===`suspend`);let a=!r&&e.isActive(),o=c.monotonicTimeNanosUnsafe();!a&&t&&(i=o),u||=n===`resume`,a&&(u||=!t&&o-i>=BigInt(3e4)*1000000n,sC(l,void 0)),t=a})),e=>V(e))}let f=yield*aC(1),p=0,m=500,h=_p(H(function*(){r.set(p===0?`connecting`:`reconnecting`);let t=yield*e,n=yield*pu(),o=yield*pu(),c=yield*pu(),l=yield*eoe({retryPolicy:_f.pipe(vf(),mf(({input:e})=>$te(c,e)),hf({times:0}))}).pipe(hp(rk,t),hp(vM,yM)),h=yield*Qae(uq,{disableTracing:!0}).pipe(hp(TM,l)),g=(yield*RC(1)).withPermit(Bf(KD(s),e=>h.follow(e))),_=h.notices(void 0).pipe(xT(e=>H(function*(){if(e.type===`ready`){yield*gu(o,void 0);return}i(e)}))),v=H(function*(){yield*mu(o),yield*g,p>0&&a(),p+=1,m=500,r.set(`connected`),yield*gu(n,void 0),i({type:`ready`})}).pipe(rp(T0),Hf(Nf));yield*Cf([_,mu(n).pipe(Hf(Ap(_C(f).pipe(Hf(g))))),Ap(H(function*(){yield*d,yield*mu(n);let e=u;u=!1,yield*g.pipe(rp(E0)),e&&(a(),i({type:`ready`}))})),v],{concurrency:`unbounded`}).pipe(sp(mu(c)))})),g=_p(H(function*(){for(yield*bp(()=>V(()=>r.set(`idle`)).pipe(Hf(pC(f)),Hf(pC(l))));;){let e=yield*Gf(h);if(cu(e)&&Vfe(Bl(e.cause))&&!(yield*n?.recoverUnauthorized?.()??B(!1)))return r.set(`unauthorized`),o(),yield*Nf;r.set(p===0?`connecting`:`reconnecting`),yield*op(m).pipe(sp(d)),m=Math.min(m*2,w0)}}));return yield*Rf.pipe(Hf(g),pp(t),Qf(e=>Ul(e)?Af:qp(`Live updates stopped unexpectedly`)),Fp),{subscribe(e){f.state._tag!==`Done`&&(Vp(qD(s,e)),sC(f,void 0))}}})}}function Hfe(e,t){let n=Vj(void 0),r=K1(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=FC(1),c=Gp(`RemoteRoute.select`)((o=!1)=>H(function*(){if(o&&a(),n.value)return n.value;r.every(e=>i.has(e.address))&&i.clear();let s=0;for(let a of r){if(i.has(a.address))continue;let r=yield*W0(a,e.environmentId,t).pipe(ip(j0));if(zn(r)&&Z1(e,r.value).kind===`online`)return n.set(a),a;zn(r)&&r.value.kind===`unauthorized`&&s++}return i.clear(),s===r.length?yield*U(new m0({status:401,message:`This computer no longer accepts the saved connections. Pair it again.`})):yield*U(new rG({message:`None of this computer’s saved connections could be reached and authorized.`}))}).pipe(zC(s))),l=e=>p0(e.address,e.credential,t);return{active:n,reset:a,failed:o,select:c,transport:async(e,t)=>{let n={...t?.signal?{signal:t.signal}:{}},i=await zp(c(),n),a=t?.method===void 0||t.method===`GET`||t.method===`HEAD`,s=async n=>{try{let r=await l(n)(e,t);return r.status===401&&o(n),r}catch(e){throw t?.signal?.aborted||o(n),e}},u;try{u=await s(i)}catch(e){if(!a||t?.signal?.aborted||r.length===1)throw e;let o=await zp(c(),n);if(o.address===i.address)throw e;return s(o)}if(u.status!==401||!a||r.length===1)return u;let d=await zp(c().pipe(lne),n);return zn(d)&&d.value.address!==i.address?s(d.value):u},transportFor:l}}function Ufe(e,t,n,r,i){return W3(H(function*(){let i=r?yield*r.select():void 0;return i&&r&&(yield*bp(e=>V(()=>{cu(e)&&!Ul(e.cause)&&r.failed(i)}))),yield*H(function*(){let{ticket:a}=yield*H(function*(){return yield*_0((yield*z0).session.issueLiveTicket())}).pipe(fp(z0.layer(i&&r?r.transportFor(i):t))),o=new URL(i?.address??e);return yield*n(`${o.protocol===`https:`?`wss:`:`ws:`}//${o.host}${z2({query:{ticket:a}})}`)}).pipe(rp(T0))}),void 0,{...i?{activity:i}:{},...r?{recoverUnauthorized:()=>r.select().pipe(cp({onSuccess:()=>!0,onFailure:e=>!(e instanceof m0&&e.status===401)}))}:{}})}function G3(e,t,n){let{connection:r}=Efe(e,n,Yu($u(Sue),A2.layer).pipe(Qu(t))),i=Pe({...r,get address(){return e.activeRoute?.value?.address??e.address},...e.activeRoute?{activeRoute:e.activeRoute}:{},liveUpdates:e.liveUpdates,...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},operations:r.runtime.runSync(P4)});return r.runtime.runSync(A2).adopt(i),i}function Wfe(e,t,n){let r=Hfe({...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:Ufe(e.address,i,e.socket,r,e.activity),...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},timeoutMs:e.timeoutMs},t,n)}function K3(e){return yk(e).pipe(hp(vk,e=>new WebSocket(e)))}function Gfe(e){return W3(K3(`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${z2({query:{}})}`),void 0,{activity:e})}function Kfe(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 qfe=X(({connection:e,scope:t,path:n})=>a4({connection:e,scope:t},[`text`,n],e=>e.files.readTextFile({params:{worktreeId:t.worktreeId},query:{path:n}}).pipe(Xf(e=>{let t=Kfe(e);return t?B({kind:`unreadable`,reason:t}):U(e)})),e=>`reason`in e||e.worktreeId===t.worktreeId&&e.path===n,[n])),q3=X(({connection:e,scope:t,path:n})=>a4({connection:e,scope:t},[`directory`,n],e=>e.files.listDirectory({params:{worktreeId:t.worktreeId},query:{path:n}}),e=>e.worktreeId===t.worktreeId,[n]).pipe(n4));function J3({connection:e,scope:t,paths:n}){return n.map(n=>q3({connection:e,scope:t,path:n}))}var Jfe=X(e=>ME(t=>J3(e).map(e=>t(e)))),Yfe=X(e=>KE((t,n)=>{for(let t of J3(e))n.refresh(t)})),Xfe=X(e=>a4(e,[`paths`],t=>t.files.listWorktreePaths({params:{worktreeId:e.scope.worktreeId}}),t=>t.worktreeId===e.scope.worktreeId)),Zfe=X(({connection:e,scope:t,path:n})=>t4(e,t,[`asset`,n],H(function*(){return yield*(yield*J0(e)).request(e=>e.files.readFileAsset({params:{worktreeId:t.worktreeId},query:{path:n}}))}),X0(e),[n]));function Qfe(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 $fe(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 epe(e){return e.filter(t=>!e.some(e=>e!==t&&e.endsWith(`/`)&&t.startsWith(e)))}function tpe(e,t){return!e.some(e=>e.endsWith(`/`)&&t.startsWith(e))}function Y3(e){return e.replace(/\/$/,``).split(`/`).at(-1)??e}function npe(e){return e.filter(e=>e.endsWith(`/`))}function rpe(e){return e.split(`/`).slice(0,-1).map((e,t,n)=>`${n.slice(0,t+1).join(`/`)}/`)}function ipe(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 ape(e,t){return ipe({...t,folder:e?.kind===`directory`,link:e?.kind===`symlink`||e?.kind===`submodule`,openable:e?.kind===`file`})}var X3=class e extends tr()(`@porcelain/client/FileEdits`){static layer(t,n){return Uu(e,H(function*(){let e=yield*J0(t),r=yield*A2,i=yield*wT;return{execute:Gp(`Files.edit`)(function*(a){let o=`${JSON.stringify([n.projectId,n.worktreeId])}/`,s=a.kind===`move`||a.kind===`trash`?[...r.entries(t)].filter(([e])=>e===`${o}${a.path}`||e.startsWith(`${o}${a.path}/`)):[];return yield*t.request(yp(V(Symbol),i=>kp(o=>H(function*(){if(yield*o($0(t)),s.some(([,e])=>e.state.value.owner!==null))return yield*U(new rG({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!e.claim(i))return yield*U(new rG({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!(yield*o(e.save())))return yield*U(new rG({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*$0(t,l.path===(a.kind===`move`||a.kind===`copy`?a.destination:a.path)),(a.kind===`move`||a.kind===`trash`)&&(yield*r.relocate(t.environmentId,s.map(([e])=>e),a,n)),l})),e=>H(function*(){for(let[,t]of s)t.release(e);t.isClosed()||(yield*i.invalidate(V4(t.environmentId,{type:`worktree`,...n,change:`files`})))})))})}}))}},Z3=X(({connection:e,scope:t})=>e.atoms(n=>Qu(X3.layer(e,t),Yu(n(X0(e).layer),A2.layer)))),ope=X(e=>Z3(e).fn(e=>X3.use(t=>t.execute(e)),{concurrent:!0})),spe=X(e=>j2(e.connection).atom(H(function*(){let t=yield*A2,n=yield*$T;return yield*t.retain({...e,environmentId:e.connection.environmentId,writer:{write:({path:r,text:i,expectedFingerprint:a})=>{let o=Z3({connection:t.connection(e.connection),scope:e.scope});return yp(V(()=>n.mount(o)),()=>H(function*(){let e=yield*yr(yield*tE(n,o),X3).execute({kind:`write`,path:r,text:i,expectedFingerprint:a});return e.contentFingerprint?e.contentFingerprint:yield*U(new rG({message:`The server did not confirm the saved version.`}))}),e=>V(e))}}})}))),cpe=Gp(`Files.moveEntries`)(function*(e,t,n){for(let r of epe(e)){let e=`${t}${Y3(r)}`;r.replace(/\/$/,``)!==e.replace(/\/$/,``)&&(yield*n(r,e))}}),lpe=Gp(`Files.completeDraft`)(function*(e,t){(yield*e.save())&&t()}),Q3=X(e=>{class t extends tr()(`@porcelain/client/PreviewAssets`){static layer=Uu(t,H(function*(){let t=yield*J0(e);return{read:Gp(`PreviewAssets.read`)(function*(n,r,i){let a=yield*t.request(e=>e.files.readPreviewAssets({params:{worktreeId:n.worktreeId},payload:{document:r,paths:[...i]}}));return yield*$0(e),new Map(a.assets.map(e=>[e.path,e.kind===`asset`?e:null]))})}}))}return t}),upe=class extends Y()(`HtmlPreviewUnavailable`,{}){get message(){return`Could not prepare the HTML preview. Try again.`}},$3=class extends tr()(`@porcelain/client/HtmlPreviewPlatform`){},dpe=X(({connection:e,platform:t})=>e.atoms(n=>Qu(Yu(Q3(e).layer,t),n(X0(e).layer)))),fpe=X(({connection:e,scope:t,path:n,html:r,platform:i})=>t4(e,t,[`html-preview`,n,r],H(function*(){let i=yield*$3,a=yield*Q3(e);return yield*i.render(r,n,e=>a.read(t,n,e))}),dpe({connection:e,platform:i}),[n]));function ppe(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}var mpe=Gp(`HtmlPreview.collectAssets`)(function*(e,t,n){let r=new Map,i=0,a=e;for(let e=0;e<8;e+=1){let e=[...new Set(a)].filter(e=>!r.has(e));if(e.length===0)return r;let o=64-r.size;if(o<=0){for(let t of e)r.set(t,null);return r}let s=e.slice(0,o);for(let t of e.slice(o))r.set(t,null);let c=yield*t(s),l=[];for(let e of s){let t=c.get(e)??null;if(t===null){r.set(e,null);continue}if(i+=t.base64.length,i>29360128){r.set(e,null);continue}r.set(e,t),t.mediaType===`text/css`&&l.push(...n(ppe(t),e))}a=l}return r}),hpe=X(e=>X0(e).atom(Y0(e,e=>e.gitActions.listCommitModels())).pipe(SE(N0),sD({staleTime:N0,revalidateOnFocus:!1})));function gpe(e){return hpe(e)}var e6=X(({connection:e,scope:t})=>X0(e).fn(Gp(`GitActions.generateCommitDraft`)(function*({lifetime:n,...r}){let i=yield*(yield*J0(e)).request(e=>e.gitActions.generateCommitDraft({params:{worktreeId:t.worktreeId},payload:r}),n);return yield*$0(e),i}),{concurrent:!0})),_pe=X(({connection:e,scope:t})=>X0(e).fn(Gp(`GitActions.dismissInterrupted`)(function*(n){yield*(yield*J0(e)).request(e=>e.gitActions.dismissInterruptedGitAction({params:{worktreeId:t.worktreeId,requestId:n}})),yield*$0(e),yield*ET([_2.reviewSurface(e.environmentId,t,[`changes`])])}))),vpe=X(e=>ME(H(function*(){let t=yield*$T,n=e6(e);return Gp(`CommitDraft.submit`)(function*(e,r){return t.set(n,{...e,lifetime:r}),yield*tE(t,n,{suspendOnWaiting:!0})})})));function t6(e,t=[],n,r=t.length>0){let i=new Set(t);return{headOid:e.headOid??void 0,inProgress:e.inProgress??void 0,mergeHeadOid:e.mergeHeadOid??void 0,branch:e.branch?.name??void 0,...n===void 0?{}:{upstreamOid:n},...r?{files:(e.files??[]).flatMap(e=>i.has(e.path)&&e.fingerprint!==null&&e.fingerprint!==void 0?[{path:e.path,fingerprint:e.fingerprint}]:[])}:{}}}var n6=e=>![`succeeded`,`no-change`].includes(e.state),r6=e=>e.message??(e.reason?e.reason.replaceAll(`_`,` `).toLowerCase():`Git ${e.state}`),i6=e=>e.state===`rejected`&&e.reason===`CHANGED_SINCE_LOOKED`;function a6(e){return e instanceof Error?e.message:`Git could not complete this action. Check the current state and try again.`}var o6=e=>t=>V(()=>{Ul(t)||e.setError(Bl(t))}),ype=Gp(`CommitForm.generate`)(function*(e,t,n=e.paths){let{model:r,working:i,setBusy:a,setError:o,generator:s,status:c,setDrafted:l,setDone:u,setActiveGroup:d,setMessage:f,setGroups:p}=e;if(!r||!n.length||i)return;a(!0),o(null),yield*bp(()=>V(()=>a(!1)));let m=yield*s.submit({mode:t,model:r,paths:n,expectedStatusToken:c.statusToken});l(t,m.expectedFiles),u(new Set),d(null),t===`message`?(f(m.groups[0]?.message??``),p(null)):p(m.groups.map(t=>({...t,id:e.createId()})))},_p,(e,t)=>e.pipe(Qf(o6(t)))),bpe=Gp(`CommitForm.commit`)(function*(e){let{working:t,uncertain:n,setBusy:r,setError:i,currentMessage:a,mode:o,commitAction:s,paths:c,status:l,groups:u,done:d,ownHead:f,onBusy:p,setActiveGroup:m,git:h,setOwnHead:g,setDone:_}=e;if(t||n||(r(!0),i(null),yield*bp(()=>V(()=>r(!1))),o===`groups`&&!u?.length))return;let v=s===`amend`?[{id:`single`,message:a,paths:c}]:o===`groups`&&u?u.filter(e=>!d.has(e.id)):[{id:`single`,message:a,paths:c}],y=f??l.headOid??null;p(!0),yield*bp(()=>V(()=>p(!1)));for(let e of v){if(!e.message.trim()||s!==`amend`&&l.inProgress!==`merge`&&!e.paths.length)return yield*U(new Ql(void 0,`Give every commit a message and at least one file.`));m(e.id);let t=yield*h.run({action:s,message:e.message,paths:e.paths},t6({...l,headOid:y},l.inProgress===`merge`?l.files?.map(e=>e.path)??[]:e.paths,void 0,!0));if(n6(t))return yield*U(new Ql(void 0,r6(t)));t.result?.headOid&&(y=t.result.headOid,g(y)),_(t=>new Set([...t,e.id])),m(null)}},_p,(e,t)=>e.pipe(Qf(o6(t)))),xpe=Gp(`CommitForm.lookAgain`)(function*(e){let{onLookAgain:t,working:n,setBusy:r,setError:i,git:a,setOwnHead:o}=e;t&&!n&&(r(!0),i(null),yield*bp(()=>V(()=>r(!1))),yield*t,yield*a.startNew(),o(null))},_p,(e,t)=>e.pipe(Qf(o6(t)))),Spe=Gp(`CommitForm.recover`)(function*(e){let{setError:t,git:n,activeGroup:r,setDone:i,setActiveGroup:a,setOwnHead:o}=e;t(null);let s=yield*n.recover();r&&[`succeeded`,`no-change`].includes(s.state)&&(s.result?.headOid&&o(s.result.headOid),i(e=>new Set([...e,r])),a(null))},(e,t)=>e.pipe(Qf(o6(t))));function s6(e){return{statusToken:e.statusToken,inProgress:e.inProgress,mergeHeadOid:e.mergeHeadOid,headOid:e.headOid,branch:e.branch,changes:e.changes.flatMap(e=>e.comparisons),files:e.changes.map(({path:e,fingerprint:t})=>({path:e,fingerprint:t}))}}function Cpe(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 wpe(e,t){let n=c6(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;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 Tpe(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 Epe(e,t){let n=c6(t);return e.kind!==`run`||n==null?null:e.action===`pull`?n.behind:n.ahead}function Dpe(e){if(e.inProgress===`rebase`||e.inProgress===`merge`&&!e.mergeHeadOid)return{kind:`hint`,label:`Git recovery`,hint:`Finish or abort this operation in a terminal.`};if(e.inProgress===`merge`||e.changes.length>0)return{kind:`commit`,label:`Commit`};let t=c6(e);return t==null?{kind:`hint`,label:`Commit`,hint:`Nothing to commit. Choose a Git action to continue.`}:t.name===null||t.name===void 0?{kind:`hint`,label:`Commit`,hint:`Detached HEAD: check out a branch before pushing.`}:t.behind>0?{kind:`run`,action:`pull`,label:`Pull`}:t.ahead>0?{kind:`run`,action:`push`,label:`Push`}:(t.stashes?.length??0)>0?{kind:`stash`,label:`Apply stash`}:{kind:`hint`,label:`Commit`,hint:`Nothing to commit, pull or push.`}}var u6=Gp(`GitActions.restoreStash`)(function*(e,t,n,r,i){let a=yield*e.run({action:`stash-apply`,...t},n).pipe(Kf(e=>n6(e)?r6(e):null),Xf(e=>B(a6(e))));r(a===null?{title:i.restored,type:`success`}:{title:i.failed,description:a,type:`error`})}),Ope=Gp(`Discard.restore`)(function*({what:e,readChanges:t,notify:n,dismissNotice:r,restore:i},a,o,s){let c=yield*t().pipe(Kf(s6),Xf(t=>V(()=>(n({title:`Could not restore ${e}`,description:a6(t),type:`error`}),null))));if(!c)return;let l=c.files?.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0).map(e=>e.path)??[];r(s),yield*u6(i,{stashOid:a,restoreIndex:o},t6(c,l,void 0,!0),n,{restored:`Restored ${e}`,failed:`Could not restore ${e}`})});function kpe(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(Ope(e,a,o,s))}}:{}});return null}var Ape=Gp(`Discard.finish`)(function*(e,t){return kpe(t,yield*e)});function jpe(e){return e===`fetch`||e===`pull`||e===`push`}function Mpe(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 Npe(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 Ppe=e=>e===`fetch`?`Fetching`:e===`pull`?`Pulling`:`Pushing`,p6=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Fpe(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 Ipe=Gp(`GitMenu.runNetwork`)(function*(e,t,n,r){let{details:i}=e,a=e.onResult,o=d6(n);if(n===`pull`&&e.pull.kind===`blocked`){a({title:`${o} did not run`,description:e.pull.reason,type:`error`});return}let s=rS(i.result)?i.result.value:void 0,c=!s;c&&e.enableDetails();let l=Mpe(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=Npe(n,u.branch,e.pull.kind===`ready`?e.pull.strategy:`merge`);a(f6(n,yield*yp(V(()=>e.onProgress(!0)),()=>t.run(d,t6(u,[],u.branch?.upstreamOid??null)),()=>V(()=>e.onProgress(!1)))))},(e,t,n,r)=>e.pipe(Xf(e=>V(()=>t.onResult({title:`${d6(r)} outcome not confirmed`,description:a6(e),type:`error`}))))),Lpe=Gp(`GitMenu.recoverNetwork`)(function*(e,t,n){let r=yield*t.recover();e.onResult(f6(n,r))},(e,t,n,r)=>e.pipe(Xf(e=>V(()=>t.onResult({title:`${d6(r)} outcome not confirmed`,description:a6(e),type:`error`}))))),Rpe=Gp(`GitMenu.restoreDiscarded`)(function*(e,t,n){let{details:r,notify:i}=e,a=n.kind===`rename`?`rename of ${n.path}`:`hunk of ${n.path}`,o=Un(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(Xf(e=>V(()=>t.notify({title:`Could not restore the discarded ${r.kind===`rename`?`rename of ${r.path}`:`hunk of ${r.path}`}`,description:a6(e),type:`error`}))))),zpe=Gp(`GitActions.lookAgain`)(function*(e,t){yield*e,yield*t}),Bpe=Gp(`GitActions.refreshLook`)(function*(e,t){t(s6(yield*e))});function m6(e){return F4.of({read:()=>Lf(()=>{if(!e)throw Error(`Pair this environment again to identify its pending Git operations.`);return window.sessionStorage.getItem(e)}),write:t=>Lf(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.setItem(e,t)}),clear:()=>Lf(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.removeItem(e)})})}var Vpe=Er(`@effect/platform-browser/Crypto/WebCrypto`,{defaultValue:()=>globalThis.crypto}),h6=Uu(EW,H(function*(){let e=yield*Vpe;return e?DW({randomBytes:t=>{let n=new Uint8Array(t);for(let t=0;t<n.length;t+=65536)e.getRandomValues(n.subarray(t,t+65536));return n},digest:(t,n)=>typeof e.subtle?.digest==`function`?Kf(Df({try:()=>e.subtle.digest(t,new Uint8Array(n)),catch:e=>Zw({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`Could not compute digest`,cause:e})}),e=>new Uint8Array(e)):U(Zw({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`crypto.subtle.digest is not available`}))}):yield*If(Error(`Web Crypto API is not available`))}));function Hpe(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 Upe(e,t){return G3({environmentId:e,address:t.address,transport:t.transport,liveUpdates:t.liveUpdates,timeoutMs:t3},Yu(h6,Ru(F4,m6(t.operationsKey))),y6.memoMap)}var _6=Vj(void 0);function Wpe({inventory:e,principal:t}){_6.set(t.kind===`device`?t.deviceId:void 0);let n=t.kind===`owner`?`owner`:t.deviceId,r=Upe(e.environmentId,{address:window.location.href,transport:H2(fetch),liveUpdates:Gfe(H3),operationsKey:`porcelain-git-requests:${JSON.stringify([e.environmentId,t.kind,n])}`});return r.atoms.addGlobalLayer(Ru(x2,Ln(e))),r}function Gpe(e){return Wfe({...e,send:fetch,...g6.statusActivity?{activity:g6.statusActivity}:{},socket:K3,onStatusChange:()=>U0(g6,e),timeoutMs:t3},Yu(h6,Ru(F4,m6(q1(e)?`porcelain-git-requests:${q1(e)}`:void 0))),y6.memoMap)}var Kpe=Ju(Yu(s0.layer,M2.layer).pipe(Zu(Ru(QW,Pfe))),Ru($W,g6),A2.layer,Ru(c0,{local:e=>vp(V(()=>Wpe(e)),e=>Ef(()=>e.close()))}),Ru(l0,{open:e=>vp(V(()=>Gpe(e)),e=>Ef(()=>e.close()))}),Ru(N2,{forgetEnvironment:()=>Af})),v6=f0.pipe(Qu(Ju(P2.layer,u0.layer,d0.layer).pipe(Qu(Kpe)))),y6=VW(v6),b6=BE({memoMap:y6.memoMap})(v6),qpe=y6.runSync(s0),x6=y6.runSync(u0),S6=y6.runSync(d0),C6=S6.state,Jpe=b6.atom(H(function*(){yield*(yield*P2).read()}));function Ype(){ON(Jpe)}function w6(){return IN(qpe.state)}function T6(){return IN(x6.state).connection}function Xpe(){return IN(S6.state)}function E6(e){let t=(0,lV.c)(5),n=IN(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,lV.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=Hpe(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 Zpe=hce({transport:H2(fetch),platform:g6});function Qpe(e,t,n){return y6.runPromise(tle(e,Zpe,t,t3),{signal:n})}var $pe=X(e=>ME(t=>{let n=()=>{window.location.hash&&e()};window.addEventListener(`hashchange`,n),t.addFinalizer(()=>window.removeEventListener(`hashchange`,n))})),eme=Zce(H2(fetch,{reportUnauthorized:!1}));function tme(e){return y6.runPromise(nle(e,eme))}var nme=ME(e=>{e.addFinalizer(dle(()=>{y6.runFork(x6.clear())}))});function rme(){return jN(nme),V2}function O6(e){let t=(0,lV.c)(3),n=E6(e.environmentId)?.connection,r;return t[0]!==e||t[1]!==n?(r=K0(g6,e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],ON(r)}function ime(e){let t=(0,lV.c)(7),{className:n}=e,r;t[0]===n?r=t[1]:(r=$V(`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,lV.c)(5),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(ime,{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)(CH,{"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 ame=[`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 ome(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,lV.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(ame)??null,r=!0,i=()=>{r&&_(t().some(e=>ome(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:$V(`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:$V(`relative min-w-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,f===3?`line-clamp-3 whitespace-normal`:`truncate`,m===`start`&&`text-left`,a?.props.className,i)},A6(m,r??n));P=o?.(e,j)??e,t[13]=r,t[14]=i,t[15]=j,t[16]=m,t[17]=T,t[18]=N,t[19]=h,t[20]=f,t[21]=a?.props.className,t[22]=o,t[23]=k,t[24]=n,t[25]=E,t[26]=P}else P=t[26];let F=P,I=!T,L=T&&(b||S),R;t[27]===d?R=t[28]:(R=(e,t)=>{x(e),e||C(!1),d&&t.reason===`escape-key`&&t.allowPropagation()},t[27]=d,t[28]=R);let ee;t[29]===F?ee=t[30]:(ee=(0,Q.jsx)(JU,{ref:O,render:F,children:F.props.children}),t[29]=F,t[30]=ee);let z;t[31]===n?z=t[32]:(z=(0,Q.jsx)(YU,{role:`tooltip`,className:`wrap-anywhere`,children:n}),t[31]=n,t[32]=z);let te;return t[33]!==I||t[34]!==L||t[35]!==R||t[36]!==ee||t[37]!==z?(te=(0,Q.jsxs)(qU,{disabled:I,disableHoverablePopup:!0,open:L,onOpenChange:R,children:[ee,z]}),t[33]=I,t[34]=L,t[35]=R,t[36]=ee,t[37]=z,t[38]=te):te=t[38],te}function M6({className:e,...t}){return(0,Q.jsx)(ZH,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:$V(`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,lV.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=$V(`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)(qU,{children:[(0,Q.jsx)(JU,{render:(0,Q.jsx)(sH,{variant:`ghost`,size:`icon-sm`,"aria-label":`Copy the command`,onClick:()=>$U(o,`the command`),children:(0,Q.jsx)(zH,{})})}),(0,Q.jsx)(YU,{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=$V(`mt-1 text-ui leading-relaxed [overflow-wrap:anywhere]`,w),t[25]=w,t[26]=T);let E;t[27]!==i||t[28]!==n?(E=n??(i?`Checking that the link belongs to this Porcelain installation.`:(0,Q.jsxs)(Q.Fragment,{children:[`It starts with `,(0,Q.jsxs)(`code`,{children:[N6(),`/pair#`]}),`. On a phone, scan the QR code it prints.`]})),t[27]=i,t[28]=n,t[29]=E):E=t[29];let D;t[30]!==C||t[31]!==T||t[32]!==E?(D=(0,Q.jsx)(`p`,{role:C,className:T,children:E}),t[30]=C,t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==i||t[35]!==b||t[36]!==S||t[37]!==D?(O=(0,Q.jsxs)(F6,{number:2,current:i,failed:b,children:[S,D]}),t[34]=i,t[35]=b,t[36]=S,t[37]=D,t[38]=O):O=t[38];let k;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:`Read what your agents changed`}),t[39]=k):k=t[39];let A;t[40]===i?A=t[41]:(A=!i&&(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:`This browser stays paired until you revoke it.`}),t[40]=i,t[41]=A);let j;t[42]===A?j=t[43]:(j=(0,Q.jsxs)(F6,{number:3,children:[k,A]}),t[42]=A,t[43]=j);let M;t[44]!==y||t[45]!==O||t[46]!==j?(M=(0,Q.jsxs)(`ol`,{"aria-label":`How pairing works`,className:`flex max-w-3xl flex-col`,children:[y,O,j]}),t[44]=y,t[45]=O,t[46]=j,t[47]=M):M=t[47];let N;t[48]===i?N=t[49]:(N=!1,t[48]=i,t[49]=N);let P;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`code`,{children:`porcelain devices`}),t[50]=P):P=t[50];let F;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(`p`,{className:`mt-auto border-t pt-4 text-ui text-muted-foreground`,children:[`Revoke this browser at any time with `,P,` and`,` `,(0,Q.jsx)(`code`,{children:`porcelain revoke`}),`.`]}),t[51]=F):F=t[51];let I;return t[52]!==M||t[53]!==N||t[54]!==m?(I=(0,Q.jsxs)(`section`,{className:`flex w-full min-w-0 flex-1 flex-col gap-8`,children:[m,h,M,N,F]}),t[52]=M,t[53]=N,t[54]=m,t[55]=I):I=t[55],I}function F6(e){let t=(0,lV.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)(yU,{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)(TH,{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=$V(`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 sme(e){let t=(0,lV.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:$V(`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 II(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function cme({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(L6,{"data-slot":`separator`,orientation:t,className:$V(`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:$V(`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:$V(`mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm`,e),...n})}function lme({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`field-group`,className:$V(`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 ume=aH(`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:$V(ume({orientation:t}),e),...n})}function dme({className:e,...t}){return(0,Q.jsx)(I6,{"data-slot":`field-label`,className:$V(`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:$V(`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 fme({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:$V(`text-xs/relaxed font-normal text-destructive`,e),...r,children:i}):null}function H6(e){return II(e.defaultTagName??`div`,e,e)}function U6({className:e,...t}){return(0,Q.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:$V(`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 pme=aH(`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:SI({className:$V(pme({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var mme=aH(`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:$V(mme({variant:t,className:e})),...n})}function K6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-content`,className:$V(`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:$V(`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:$V(`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:$V(`flex items-center gap-2`,e),...t})}function X6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-footer`,className:$V(`flex basis-full items-center justify-between gap-2`,e),...t})}var hme=aH(`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:$V(hme({variant:t}),e),...n})}function Q6({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-title`,className:$V(`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:$V(`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 gme({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-action`,className:$V(`absolute top-1.5 right-2`,e),...t})}var _me=aH(`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:SI({className:$V(_me({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function t8(e){let t=(0,lV.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,lV.c)(2),n;return t[0]===e?n=t[1]:(n=f2(e),t[0]=e,t[1]=n),ON(n)}function r8(e){let t=(0,lV.c)(2),n;return t[0]===e?n=t[1]:(n=p2(e),t[0]=e,t[1]=n),ON(n)}function vme(e){let t=(0,lV.c)(2),n;return t[0]===e?n=t[1]:(n=m2(e),t[0]=e,t[1]=n),ON(n)}var yme=X(e=>b6.fn((t,n)=>H(function*(){yield*n.setResult(ele(e),void 0),yield*(yield*u0).clear()})));function bme(e){let t=(0,lV.c)(8),n;t[0]===e?n=t[1]:(n=yme(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]=PN(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 xme(e){let t=(0,lV.c)(17),{computer:n}=e,{connection:r}=D6(),{result:i,submit:a}=bme(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)(_U,{}),t[3]=i.waiting,t[4]=c);let l;t[5]!==i.waiting||t[6]!==a||t[7]!==c?(l=(0,Q.jsxs)(sH,{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:E2(Bl(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=VE(V3.layer),a8=i8.atom(H(function*(){let e=yield*V3;return{isDesktopShell:e.isDesktopShell,hasAppUpdateFeed:e.hasAppUpdateFeed}})),o8=i8.atom(H(function*(){return yield*(yield*V3).checkUpdate})).pipe(nD),s8=i8.atom(dT(H(function*(){return(yield*V3).updateStates}))).pipe(SE(0));function c8(){let e=(0,lV.c)(2),t=ON(s8),n;return e[0]===t?n=e[1]:(n=Vn(fS(t),Sme),e[0]=t,e[1]=n),n}function Sme(){return{status:`idle`}}function Cme(){return ON(a8)}var wme=`data-valid`,Tme=`data-invalid`,Eme={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Dme={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},l8={valid(e){return e===null?null:e?{[wme]:``}:{[Tme]:``}}},Ome={invalid:void 0,name:void 0,validityData:{state:Eme,errors:[],error:``,value:``,initialValue:null},setValidityData:RN,disabled:void 0,setTouched:RN,setDirty:RN,setFilled:RN,setFocused:RN,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Dme,registerFieldControl:RN,validation:{getValidationProps:(e,t=BN)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:RN,getInputControl:()=>null,commit:async()=>{},change:RN}},kme=Z.createContext(Ome);function u8(e=!0){let t=Z.useContext(kme);if(t.setValidityData===RN&&!e)throw Error(KN(28));return t}var Ame=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:RN,validationMode:`onSubmit`,submitCountRef:{current:0}});function d8(){return Z.useContext(Ame)}var jme=Z.createContext({controlId:void 0,registerControlId:RN,resetControlId:RN,labelId:void 0,setLabelId:RN,messageIds:[],setMessageIds:RN,getDescriptionProps:e=>e});function f8(){return Z.useContext(jme)}function p8(e,t,n,r=!0,i){let[a,o]=Z.useState(),s=kU(i?`${i}-label`:void 0),c=e??t??a;return WN(()=>{let i=e||t||!r?void 0:Mme(n.current,s);a!==i&&o(i)}),c}function Mme(e,t){let n=Nme(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Nme(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=kU(),s=UN(()=>Symbol()),c=Z.useRef(!1),l=Z.useRef(!1),u=tP(()=>{c.current&&i!==RN&&(c.current=!1,i(s.current,void 0))});return WN(()=>{if(!n||i===RN){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]),WN(()=>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=UN(()=>Symbol());WN(()=>{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]),WN(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}function _8(e,t){let n=Z.useRef(e),r=tP(t);WN(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var Pme=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=tP(()=>S.inputRef.current?.value);g8(S.inputRef,A,P,F,!E,a),WN(()=>{let e=P??S.inputRef.current?.value;e!==void 0&&b(e!==``)},[P,S.inputRef,b]),_8(P,()=>{P!==void 0&&(C(D),_(P!==(v.initialValue??``)),S.change(P))});let I=Z.useRef(null),L=NP();return WN(()=>{u&&I.current===HP(TP(I.current))&&y(!0)},[u,y]),II(`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=NL(gL,e.nativeEvent);c?.(t,n),!M&&(_(t!==(v.initialValue??``)),b(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(C(D),S.change(t)))},onFocus(){y(!0)},onBlur(e){if(g(!0),y(!1),x===`onBlur`){let t=e.currentTarget.value;S.commit(t),M&&queueMicrotask(()=>{let e=S.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&S.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===w.current&&!e.defaultPrevented){let t=e.currentTarget,n=T.current;L.start(0,()=>{T.current===n&&S.commit(t.value)})}else S.commit(t)}}},f,e=>S.getValidationProps(E,e)],stateAttributesMapping:l8})}),Fme=Z.forwardRef(function(e,t){return(0,Q.jsx)(Pme,{ref:t,...e})});function v8({className:e,type:t,...n}){return(0,Q.jsx)(Fme,{type:t,"data-slot":`input`,className:$V(`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 Ime(e){let t=(0,lV.c)(3),n;t[0]===e?n=t[1]:(n=Vce(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],PN(n,r)}function Lme(e,t){let n=(0,lV.c)(3),r;return n[0]!==e||n[1]!==t?(r=Hce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],PN(r)}function Rme(e,t){let n=(0,lV.c)(3),r;return n[0]!==e||n[1]!==t?(r=Uce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],PN(r)}function zme(e,t){let n=(0,lV.c)(3),r;return n[0]!==e||n[1]!==t?(r=Wce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],PN(r)}function Bme(e){let t=(0,lV.c)(2),n;return t[0]===e?n=t[1]:(n=Gce(e),t[0]=e,t[1]=n),PN(n)}function Vme(e){let t=(0,lV.c)(3),n;t[0]===e?n=t[1]:(n=Jce(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],PN(n,r)}function Hme(e){let t=(0,lV.c)(2),n;return t[0]===e?n=t[1]:(n=Yce(e),t[0]=e,t[1]=n),PN(n)}function Ume(e,t){let n=(0,lV.c)(3),r;return n[0]!==e||n[1]!==t?(r=qce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],PN(r)}function Wme(e){let t=(0,lV.c)(31),{connection:n,environment:r,onCancel:i}=e,[a,o]=(0,Z.useState)(null),[s]=(0,Z.useState)(Gme),[c,l]=Vme(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:Hue,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)(sH,{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)(sH,{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:E2(Bl(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 Gme(){return Kme}function Kme(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(KN(33));return t}var C8=Z.createContext(void 0);function w8(e){let t=Z.useContext(C8);if(t===void 0&&!e)throw Error(KN(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(KN(25));return t}var D8=Z.createContext(void 0);function qme(){let e=Z.useContext(D8);if(e===void 0)throw Error(KN(30));return e}function Jme(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:xL})},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&&!zP&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&fL(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}=pL({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Jme({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>SI(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=uI(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var A8=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Yme(){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}=Yme(),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 WN(()=>{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 Xme=`data-checked`,Zme=`data-unchecked`,M8={checked(e){return e?{[Xme]:``}:{[Zme]:``}},...YP},Qme=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=kU(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=NL(xL,e.nativeEvent,void 0,{preventUnmountOnClose:RN});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=II(`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})}),$me=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=qme(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Uz(s.checked);return JI({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),II(`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 ehe(){let e=Z.useContext(N8);if(e===void 0)throw Error(KN(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=II(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Q.jsx)(N8.Provider,{value:s,children:c})}),the=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=kU(a),c=ehe();return WN(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),II(`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=kU(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 II(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),nhe=Z.createContext(void 0);function I8(e){let t=Z.useContext(nhe);if(t===void 0&&!e)throw Error(KN(69));return t}var L8=`ArrowUp`,R8=`ArrowDown`,z8=`ArrowLeft`,B8=`ArrowRight`,V8=new Set([L8,R8,z8,B8,`Home`,`End`]),rhe=[`Shift`,`Control`,`Alt`,`Meta`];function ihe(e){return lP(e)&&e.tagName===`INPUT`}function H8(e){return!!(ihe(e)&&e.selectionStart!=null||lP(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`;JI({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,NL(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),CB(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=II(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:eF,props:[p,{onKeyDown(e){u&&V8.has(e.key)&&e.stopPropagation()}},sV(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,Q.jsx)(kR,{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 ahe(){let e=Z.useContext(q8);if(e===void 0)throw Error(KN(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)(zL,{ref:t,...r,portalOwnerRole:o})})});function Y8(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=tP(i),[,o]=Z.useState(!1),s=UN(she).current,c=UN(ohe).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=tP(()=>{u.current||(u.current=!0,o(e=>!e))}),m=tP((e,t)=>{c.set(e,t),p()}),h=tP(e=>{c.delete(e),p()}),g=tP(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(!uhe(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=lhe(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=tP(()=>{let[e,t]=che(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))});WN(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),WN(()=>{u.current&&v()}),WN(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=tP(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 ohe(){return new Map}function she(){return new Set}function che(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 lhe(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function uhe(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 dP(e)?e:t}function n5(e,t,n){return/hidden|clip/.test(e.getComputedStyle(t5(t,n)).overflowY)}function dhe(e){if(typeof document>`u`)return!1;let t=TP(e);return aP(t).innerWidth-t.documentElement.clientWidth>0}function fhe(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=TP(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 phe(e){let t=TP(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 mhe(e){let t=TP(e),n=t.documentElement,r=t.body,i=aP(n),a=0,o=0,s=!1,c=kP.create();if(BP&&(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=fhe(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=EP(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var hhe=new class{lockCount=0;restore=null;timeoutLock=MP.create();timeoutUnlock=MP.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=TP(e),n=t.documentElement,r=t.body,i=aP(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=IP||!dhe(e);this.restore=a?phe(e):mhe(e)}};function r5(e=!0,t=null){WN(()=>{if(e)return hhe.acquire(t)},[e,t])}var ghe=20;function i5(e,t,n,r){let[i,a]=Z.useState(!1);WN(()=>{if(!e||!t||n==null){a(!1);return}let r=TP(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-ghe)},[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=tL,style:g,..._}=e,{store:v}=w8(),y=ahe(),b=E8(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=Z.useRef(null),R=qI(A),ee=n,z=c,te=l,ne=s,re=h;x.type===`context-menu`&&(ee=n??x.context?.anchor,ne??=`start`,!o&&ne!==`center`&&(te=e.alignOffset??2,z=e.sideOffset??-5));let ie=o,ae=ne;x.type===`menu`?(ie??=`inline-end`,ae??=`start`,re=e.collisionAvoidance??nL):x.type===`menubar`&&(ie??=x.context.orientation===`vertical`?`inline-end`:`bottom`,ae??=`start`);let oe=x.type===`context-menu`,se=iV({anchor:ee,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:ie,sideOffset:z,align:ae,alignOffset:te,arrowPadding:oe?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:re,shift:oe?{crossAxis:!(`side`in re&&re.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,NL(DL)))}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,NL(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ce=NP();Z.useEffect(()=>{T||ce.clear()},[T,ce]),Z.useEffect(()=>{function e(e){if(T&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ce.isStarted()||ce.start(e,()=>{v.setOpen(!1,NL(DL))}):v.setOpen(!1,NL(DL))}else ce.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ce]),Z.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),WN(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let le={open:T,side:se.side,align:se.align,anchorHidden:se.anchorHidden,nested:x.type===`menu`,instant:j},ue=x.type===`menubar`&&x.context.modal;i5(T&&(ue||E&&N!==`trigger-hover`),D===`touch`,A,O);let de=cV(e,le,{styles:se.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),fe=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),pe=null;return x.type===`menubar`?pe=x.context.contentElement:x.type===void 0&&(pe=O),(0,Q.jsxs)(x8.Provider,{value:se,children:[fe&&(0,Q.jsx)(Z8,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:UI(!T),cutout:pe}),(0,Q.jsx)(yR,{id:P,children:(0,Q.jsx)(Y8,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:de})})]})}),o5=Z.createContext(void 0);function _he(){let e=Z.useContext(o5);if(e===void 0)throw Error(KN(34));return e}var vhe=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=tP((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=II(`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 yhe(){let e=Z.useContext(s5);if(e===void 0)throw Error(KN(35));return e}var bhe=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=kU(i),{store:h}=w8(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=_he(),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=NL(xL,e.nativeEvent,void 0,{preventUnmountOnClose:RN});y(l,t)}let O=II(`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})}),xhe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=yhe(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Uz(s.checked);return JI({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),II(`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})}),She=Z.createContext(null);function c5(e){let t=Z.useContext(She);if(t===null&&!e)throw Error(KN(5));return t}function Che(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}=Che(tP((n,r)=>{(typeof e==`function`?e():e)||t(r||(IP?`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 whe={...dB,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`)}},The=class extends nP{constructor(e,t,n=!1){let r=new iB,i=Dhe(r,t,n,e);super(i,Ehe(r),whe),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 Ehe(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 Dhe(e,t,n=!1,r){return{...aB(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 pR,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:BN,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var Ohe=Z.createContext(void 0);function khe(){return Z.useContext(Ohe)}var d5=XN(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=khe(),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=cL(),S=cL(),C=gR(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=UN(()=>T?w?.state.instantType:void 0).current,D=Ahe({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=vR(O),A=D.useState(`open`),j=D.useState(`activeTriggerElement`),M=D.useState(`positionerElement`),N=D.useState(`hoverEnabled`),P=D.useState(`disabled`),F=D.useState(`lastOpenChangeReason`),I=D.useState(`parent`),L=D.useState(`activeIndex`),R=D.useState(`payload`),ee=D.useState(`floatingParentNodeId`),z=Z.useRef(null),te=Z.useRef(I.type!==`context-menu`),ne=NP(),re=Z.useRef(!0),ie=NP(),ae=ee!=null,{openMethod:oe,triggerProps:se}=u5(A);D.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:I.type===void 0?s:void 0,openMethod:oe,rootId:x}),eB(D);let{forceUnmount:ce,transitionStatus:le}=tB(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),ue=qI(D.context.popupRef);Z.useEffect(()=>{if(E===void 0)return;let e=()=>{D.state.instantType===E&&D.set(`instantType`,void 0)};if(!A){e();return}if(le!==void 0)return;if(D.context.popupRef.current==null){e();return}let t=new AbortController;return ue(e,t.signal),()=>{t.abort()}},[E,A,le,ue,D]),WN(()=>{g&&!_?D.update({parent:{type:`context-menu`,context:g},floatingNodeId:k,floatingParentNodeId:C}):_&&D.update({floatingNodeId:k,floatingParentNodeId:C})},[g,_,k,C,D]),Z.useEffect(()=>{if(A||(z.current=null),I.type===`context-menu`){if(!A){ne.clear(),te.current=!1;return}ne.start(500,()=>{te.current=!0})}},[ne,A,I.type]),WN(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let de=tP((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=Zz(t);if(!e&&t.trigger==null&&(t.trigger=j??void 0),r?.(e,t),t.isCanceled)return;D.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!re.current)return;e&&n===`trigger-focus`?(re.current=!1,ie.start(300,()=>{re.current=!0})):(re.current=!0,ie.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);z.current=t.event;let c=Xz(D.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=I.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,D.update(c)}),fe=Hz({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:de}),pe=fe.context.events;WN(()=>{let e=({open:e,eventDetails:t})=>de(e,t);return pe.on(`setOpen`,e),()=>{pe?.off(`setOpen`,e)}},[pe,de]);let me=Z.useCallback(()=>{D.setOpen(!1,NL(jL))},[D]);Z.useImperativeHandle(u,()=>({unmount:ce,close:me}),[ce,me]);let he;I.type===`context-menu`&&(he=I.context),Z.useImperativeHandle(he?.positionerRef,()=>M,[M]),Z.useImperativeHandle(he?.actionsRef,()=>({setOpen:de}),[de]);let ge=IR(fe,{enabled:!P,bubbles:{escapeKey:d&&I.type===`menu`},outsidePress(){return I.type!==`context-menu`||z.current?.type===`contextmenu`||te.current},externalTree:ae?O:void 0}),_e=WB(),ve=Z.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),ye=NB(fe,{enabled:!P,listRef:D.context.itemDomElements,activeIndex:L,nested:I.type!==void 0,loopFocus:c,orientation:l,parentOrientation:I.type===`menubar`?I.context.orientation:void 0,rtl:_e===`rtl`,disabledIndices:zN,onNavigate:ve,openOnArrowKeyDown:I.type!==`context-menu`,externalTree:ae?O:void 0,focusItemOnHover:h}),be=Z.useCallback(e=>{D.context.typingRef.current=e},[D]),xe=PB(fe,{enabled:!P,listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:L,resetMs:500,onMatch:e=>{A&&e!==L&&D.set(`activeIndex`,e)},onTyping:be}),Se=Z.useMemo(()=>{let e=SI(xe.reference,ye.reference,ge.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[D,xe.reference,ye.reference,ge.reference,se,A]),Ce=Z.useMemo(()=>{let e=SI(ye.trigger,ge.trigger,se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ye.trigger,ge.trigger,se]);UN(()=>(D.update({inactiveTriggerProps:Ce}),null)),nB(D,{floatingRootContext:fe,activeTriggerProps:Se,inactiveTriggerProps:Ce,popupProps:Z.useMemo(()=>SI(Wz,{id:S,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":j?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),I.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},xe.floating,ye.floating,ge.floating),[j,S,l,I.type,D,xe.floating,ye.floating,ge.floating]),itemProps:ye.item??BN});let we=Z.useMemo(()=>({store:D,parent:b}),[D,b]),Te=(0,Q.jsxs)(C8.Provider,{value:we,children:[f&&(0,Q.jsx)(qz,{handle:f,store:D}),typeof t==`function`?t({payload:R}):t]});return I.type===void 0||I.type===`context-menu`?(0,Q.jsx)(bR,{externalTree:O,children:Te}):Te});function Ahe(e,t,n){return UN(()=>new The(e,t,n)).current}var f5=5;function p5(e,t){let n=jhe(t);return e.clientX>=n.left-f5&&e.clientX<=n.right+f5&&e.clientY>=n.top-f5&&e.clientY<=n.bottom+f5}function jhe(e){let t=e.getBoundingClientRect(),n=aP(e);if(VP)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}=uL(),{ref:i,index:a}=j8(e),o=n===a,s=Z.useRef(null),c=uI(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 Mhe(e){let{render:t,className:n,style:r,state:i=BN,props:a=zN,refs:o=zN,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=m5({metadata:s});return II(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function h5(e){if(lP(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!_P(e))return h5(bP(e))}function g5(e,t){let n=Z.useRef(null);function r(t){GN.flushSync(()=>{e.setOpen(!1,NL(CL,t.nativeEvent,t.currentTarget))}),nI(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&rI(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{GN.flushSync(()=>{e.setOpen(!1,NL(CL,n.nativeEvent,n.currentTarget))});let i=tI(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&UP(r,i);){let e=i;if(i=QF(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Nhe(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,TP(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:BN,[t,n,r])}var Phe=ZN(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=fB(d)??m?.store;if(!h)throw Error(KN(85));let g=kU(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),S=Ihe(),C=uL(!0),w=_R(),T=Z.useMemo(()=>w??new pR,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=$z(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:vR(T),floatingParentNodeId:gR(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=pL({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=NP(),F=tP(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;UP(N.current,t)||UP(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:EL}))});Z.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&TP(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=TB(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:HB({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=Fhe(y,h.select(`lastOpenChangeReason`)),ee=AR(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),z=_B(v,{enabled:!A&&I}),te=Nhe({open:y,enabled:O,mouseDownAction:`open`}),ne=Z.useMemo(()=>SI(z.reference,ee.reference),[z.reference,ee.reference]),re=h.useState(`triggerProps`,D),{preFocusGuardRef:ie,handlePreFocusGuardFocus:ae,handleFocusTargetFocus:oe}=g5(h,x),se={disabled:A,open:y},ce=[N,t,M,E,x],le=[ne,L??BN,re,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),TP(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},te,p,j],ue=II(`button`,e,{enabled:!O,stateAttributesMapping:QP,state:se,ref:ce,props:le});return O?(0,Q.jsx)(Mhe,{tag:`button`,render:n,className:r,style:i,state:se,refs:ce,props:le,stateAttributesMapping:QP}):y?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(lI,{ref:ie,onFocus:ae},`${g}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:ue},g),(0,Q.jsx)(lI,{ref:h.context.triggerFocusTargetRef,onFocus:oe},`${g}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:ue},g)});function Fhe(e,t){let n=NP(),[r,i]=Z.useState(!1);return WN(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Ihe(){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)(Phe,{"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:$V(`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)(the,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:$V(`px-2 py-1.5 text-xs text-muted-foreground data-inset:pl-7.5`,e),...n})}function Lhe({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:$V(`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 Rhe({className:e,children:t,checked:n,inset:r,...i}){return(0,Q.jsxs)(Qme,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:$V(`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)($me,{children:(0,Q.jsx)(TH,{})})}),t]})}function zhe({...e}){return(0,Q.jsx)(vhe,{"data-slot":`dropdown-menu-radio-group`,...e})}function Bhe({className:e,children:t,inset:n,...r}){return(0,Q.jsxs)(bhe,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:$V(`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)(xhe,{children:(0,Q.jsx)(TH,{})})}),t]})}function Vhe({className:e,...t}){return(0,Q.jsx)(L6,{"data-slot":`dropdown-menu-separator`,className:$V(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var Hhe={desktop:tU,laptop:qH,server:lU,cloud:LH};function C5(e){let t=(0,lV.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=Hhe[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 Uhe(e){let t=(0,lV.c)(18),{icon:n,pending:r,onChange:i}=e,a=`Icon: ${k4[n]}`,o;t[0]!==r||t[1]!==a?(o=(0,Q.jsx)(sH,{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=vue.map(Whe),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)(zhe,{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 Whe(e){return(0,Q.jsxs)(Bhe,{value:e,className:`cursor-pointer`,children:[(0,Q.jsx)(C5,{icon:e}),k4[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 Ghe(e){return e.status===`unavailable`?`This build updates by reinstalling; there is no update feed yet.`:`Up to date`}var Khe=VE(V3.layer).atom(Kf(V3,e=>t=>e.installUpdate.pipe($f(e=>new R2({message:e.message}))))),qhe=ME(e=>{e.addFinalizer(x6.state.subscribe(()=>e.refreshSelf())),e.addFinalizer(C6.subscribe(()=>e.refreshSelf()));let t=[],n=[],r=!1,i=x6.state.value.connection,a=Un(fS(e(a8)));if(i&&a){if(a.isDesktopShell){let i=e(o8),a=Un(Xn(fS(i))),o=Un(fS(e(s8)));r||=i.waiting;let s=D5(o,i);s&&n.push({id:`mac-app`,name:`Mac app`,message:s});let c=Un(fS(e(Khe)));a&&c&&t.push({current:a.current,checking:i.waiting,error:D5(o,i),note:o?Ghe(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(m2(i));r||=a.waiting,aS(a)&&n.push({id:i.environmentId,name:`This computer`,message:E2(Bl(a.cause))});let o=c2(a),s=Un(fS(e(U2(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(K0(g6,i,a));if(o.kind!==`online`)continue;let s=e(m2(a));r||=s.waiting,aS(s)&&n.push({id:i.environmentId,name:o.name,message:E2(Bl(s.cause))});let c=c2(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=KE((e,t)=>{let n=x6.state.value.connection,r=Un(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=m2(e);t(n).waiting||t.refresh(n)}}),Jhe=ME(e=>{rS(e(a8))&&e.set(T5,`entry`)}).pipe(SE(0));function Yhe(){jN(Jhe)}function E5(){let e=(0,lV.c)(11),{rows:t,failures:n,checking:r}=ON(qhe),i=MN(T5),a=ON(L2),[o,s]=PN(lle),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(Xhe),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:ole(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 Xhe(e){return e.target}function D5(e,t){if(e?.status===`error`)return e.message;if(!t.waiting&&aS(t))return E2(Bl(t.cause))}function Zhe(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}=Uz(a,!0,!0),u=kU(),[d,f]=Z.useState(),p=d===null?void 0:d??u,m=tP(e=>{let t=!a,n=NL(_L,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(KN(15));return e}var Qhe=`data-open`,$he=`data-closed`,ege=qP,tge=`data-panel-open`,nge={[Qhe]:``},rge={[$he]:``},ige={open(e){return e?{[tge]:``}:null}},A5={open(e){return e?nge:rge},...YP},age=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=tP(o),d=Zhe({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=II(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:A5});return(0,Q.jsx)(O5.Provider,{value:p,children:m})}),oge={...ige,...YP},sge=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}=pL({disabled:c,focusableWhenDisabled:!0,native:u});return II(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:oge})}),j5={height:void 0,width:void 0};function cge(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=uI(t,d),C=VL(s),w=qI(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=tP((e,t=!0)=>{t&&(h.current=e),m(e)}),j=tP(()=>{x.current?.(),x.current=null}),M=tP(e=>{j(),x.current=()=>{x.current=null,e()}}),N=tP(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});WN(()=>{y&&u!==`starting`&&b(!1)},[y,u]),Z.useEffect(()=>()=>{N(),j()},[N,j]),WN(()=>{let e=d.current;if(!e)return;!s&&x.current&&j();let t=lge(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=uge(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]),JI({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=kP.request(()=>{w(n,e.signal)}),()=>{kP.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),WN(()=>{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=NL(gL,e);o(!0,t),!t.isCanceled&&(g.current=!0,l(!0))}return EP(e,`beforematch`,t)},[o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[ege]:``}: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 lge(e,t){let n=aP(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 uge(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=kP.request(n);return()=>{kP.cancel(r),n()}}var dge=`--collapsible-panel-height`,fge=`--collapsible-panel-width`,pge=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;WN(()=>(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}=cge({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=bI(s,k),j=II(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[dge]:S===void 0?`auto`:`${S}px`,[fge]: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)(age,{"data-slot":`collapsible`,...e})}function I5({...e}){return(0,Q.jsx)(sge,{"data-slot":`collapsible-trigger`,...e})}function L5({...e}){return(0,Q.jsx)(pge,{"data-slot":`collapsible-content`,...e})}function R5(e){let t=(0,lV.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=I2(s),g;t[7]===s?g=t[8]:(g=s.kind===`service`?ale(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`?Kue(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`?que(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)(sH,{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)(sH,{size:`sm`,variant:`ghost`}),children:[(0,Q.jsx)($H,{}),`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=$V(`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=$V(`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=F2(s)&&S&&(0,Q.jsxs)(Q.Fragment,{children:[` → `,S]}),t[40]=S,t[41]=s,t[42]=N):N=t[42];let P;t[43]!==A||t[44]!==M||t[45]!==N?(P=(0,Q.jsxs)(`p`,{className:A,children:[M,N]}),t[43]=A,t[44]=M,t[45]=N,t[46]=P):P=t[46];let F;t[47]!==O||t[48]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[O,P]}),t[47]=O,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==w||t[51]!==F||t[52]!==D?(I=(0,Q.jsxs)(`div`,{className:D,children:[F,w]}),t[50]=w,t[51]=F,t[52]=D,t[53]=I):I=t[53];let L;t[54]!==s.kind||t[55]!==s.state||t[56]!==_?(L=_&&s.kind===`service`&&s.state.available&&(0,Q.jsx)(L5,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:_.hint}),_.deviceId&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`code`,{className:`break-all`,children:_.deviceId}),(0,Q.jsxs)(qU,{children:[(0,Q.jsx)(JU,{render:(0,Q.jsx)(sH,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy device ID`,onClick:()=>$U(_.deviceId??``,`device ID`),children:(0,Q.jsx)(zH,{})})}),(0,Q.jsx)(YU,{role:`tooltip`,className:`break-all`,children:`Copy device ID`})]})]})]})}),t[54]=s.kind,t[55]=s.state,t[56]=_,t[57]=L):L=t[57];let R;t[58]===n.error?R=t[59]:(R=n.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:n.error}),t[58]=n.error,t[59]=R);let ee;t[60]===m?ee=t[61]:(ee=m?.status===`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:m.message}),t[60]=m,t[61]=ee);let z;t[62]!==m?.status||t[63]!==x||t[64]!==C?(z=!C&&x?.kind===`failed`&&m?.status!==`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:x.reason}),t[62]=m?.status,t[63]=x,t[64]=C,t[65]=z):z=t[65];let te;t[66]===m?te=t[67]:(te=m?.status===`updated`&&(0,Q.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Updated to `,m.version,`.`]}),t[66]=m,t[67]=te);let ne;t[68]!==m?.status||t[69]!==f?.environmentId||t[70]!==s.id||t[71]!==s.kind?(ne=m?.status===`updated`&&s.kind===`service`&&f?.environmentId===s.id&&(0,Q.jsx)(sH,{size:`sm`,variant:`outline`,className:`self-start`,onClick:mge,children:`Reload`}),t[68]=m?.status,t[69]=f?.environmentId,t[70]=s.id,t[71]=s.kind,t[72]=ne):ne=t[72];let re;t[73]!==s.kind||t[74]!==s.state?(re=s.kind===`service`&&!s.state.managed&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This computer runs outside the installed service. Update it with npm, then run porcelain service update.`}),t[73]=s.kind,t[74]=s.state,t[75]=re):re=t[75];let ie;return t[76]!==I||t[77]!==L||t[78]!==R||t[79]!==ee||t[80]!==z||t[81]!==te||t[82]!==ne||t[83]!==re||t[84]!==T?(ie=(0,Q.jsx)(F5,{children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,role:`group`,"aria-label":T,children:[I,L,R,ee,z,te,ne,re]})}),t[76]=I,t[77]=L,t[78]=R,t[79]=ee,t[80]=z,t[81]=te,t[82]=ne,t[83]=re,t[84]=T,t[85]=ie):ie=t[85],ie}function mge(){return window.location.reload()}function z5(e){let t=(0,lV.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=vme(n),c;t[5]===n?c=t[6]:(c=m2(n),t[5]=n,t[6]=c);let l=NN(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=E2(Bl(s.cause)),t[10]=s.cause,t[11]=e);let n;t[12]!==l||t[13]!==s.waiting?(n=(0,Q.jsx)(sH,{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 hge(e){let t=(0,lV.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 gge(e){let t=(0,lV.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 _ge(e){let t=(0,lV.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(vge),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 vge(e){let{target:t}=e;return t.kind===`mac-app`}var B5=Z.createContext(void 0);function yge(){let e=Z.useContext(B5);if(e===void 0)throw Error(KN(63));return e}var bge=`data-checked`,xge=`data-unchecked`,V5={...l8,checked(e){return e?{[bge]:``}:{[xge]:``}}},Sge=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=uI(P,c,A.inputRef),I=Z.useRef(null),L=kU(),R=m8({id:s}),ee=u?void 0:R,[z,te]=h8({controlled:n,default:!!i,name:`Switch`,state:`checked`});g8(I,L,z,void 0,!M,l),WN(()=>{T(z)},[z,T]),_8(z,()=>{b(N),C(z!==w.initialValue),A.change(z)});let{getButtonProps:ne,buttonRef:re}=pL({disabled:M,native:u}),ie=p8(a,j,P,!u,ee),ae={id:u?R:L,role:`switch`,"aria-checked":z,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ie,onFocus(){M||E(!0)},onBlur(){let e=P.current;e&&!M&&(S(!0),E(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){if(f||M)return;e.preventDefault();let t=P.current;t&&fL(t,e)}},oe={...A.getValidationProps(M),checked:z,disabled:M,form:o,id:ee,name:N,required:p,style:N?cI:sI,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=NL(gL,e.nativeEvent);d?.(t,n),!n.isCanceled&&te(t)},onClick(e){e.stopPropagation()},onFocus(){I.current?.focus()},..._===void 0?BN:{value:_}},se=Z.useMemo(()=>({...x,checked:z,disabled:M,readOnly:f,required:p}),[x,z,M,f,p]),ce=II(`span`,e,{state:se,ref:[t,I,re],props:[ae,y,ne,e=>A.getValidationProps(M,e)],stateAttributesMapping:V5});return(0,Q.jsxs)(B5.Provider,{value:se,children:[ce,!z&&N&&g!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:o,name:N,value:g,disabled:M}),(0,Q.jsx)(`input`,{...oe,suppressHydrationWarning:!0})]})}),Cge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return II(`span`,e,{state:yge(),ref:t,stateAttributesMapping:V5,props:a})});function H5({className:e,size:t=`default`,...n}){return(0,Q.jsx)(Sge,{"data-slot":`switch`,"data-size":t,className:$V(`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)(Cge,{"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 wge(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(KN(60));return e}function q5(){let e=Z.useContext(W5);if(e===void 0)throw Error(KN(101));return e}function J5(){let e=Z.useContext(G5);if(e===void 0)throw Error(KN(61));return e}function Tge(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 Ege(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Tge(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 Dge(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(Dge(t,n)):Q5(e,t,n);return i===-1?null:i}function Oge(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 kge(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 Age(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function t7(e){return Age(e?.[0])}function jge(e){return t7(e)?e.flatMap(e=>e.items):e}function Mge(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=jge(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 Nge(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 Pge={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?Mge(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=iL(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 Fge(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=Y5,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=d8(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=u8(),F=m8({id:t}),I=M||d,L=j??c,[R,ee]=h8({controlled:n,default:y?r??zN:r,name:`Select`,state:`value`}),[z,te]=h8({controlled:a,default:o,name:`Select`,state:`open`}),ne=Z.useRef([]),re=Z.useRef([]),ie=Z.useRef(null),ae=Z.useRef(null),oe=Z.useRef(0),se=Z.useRef(null),ce=Z.useRef([]),le=Z.useRef(!1),ue=Z.useRef(null),de=Z.useRef(null),fe=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=Z.useRef(!1),me=Z.useRef(R),{mounted:he,setMounted:ge,transitionStatus:_e}=Uz(z),{openMethod:ve,triggerProps:ye}=u5(z),be=UN(()=>new nP({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:z,mounted:he,transitionStatus:_e,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:BN,triggerProps:BN,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:RN,setOpen:RN,handleScrollArrowVisibility:RN,onOpenChangeComplete:RN,listRef:ne,popupRef:ie,scrollHandlerRef:ae,scrollArrowsMountedCountRef:oe,valueRef:se,valuesRef:ce,labelsRef:re,typingRef:le,selectionRef:fe,firstItemTextRef:ue,selectedItemTextRef:de,alignItemWithTriggerActiveRef:pe,initialValueRef:me},Pge)).current,xe=be.useState(`activeIndex`),Se=be.useState(`selectedIndex`),Ce=be.useState(`triggerElement`),we=be.useState(`positionerElement`),Te=GU(ve),Ee=ve??Te,De=Z.useMemo(()=>y?``:r7(R,x),[y,R,x]),Oe=Z.useMemo(()=>y&&Array.isArray(R)?R.map(e=>r7(e,x)):r7(R,x),[y,R,x]);g8(VL(Ce),F,R,tP(()=>Oe),!I,c);let ke=y?Array.isArray(R)&&R.length>0:R!=null&&De!==``;WN(()=>{A(ke)},[ke,A]),WN(function(){let e=$5(ce.current,R,S,y);e===null&&(de.current=null),!z&&be.set(`selectedIndex`,e)},[y,z,R,S,be]),_8(R,()=>{T(L),E(Ege(R,k.initialValue,S)),N.change(R)});let Ae=tP((e,t)=>{s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),je=tP(()=>{ge(!1),be.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});JI({enabled:!h,open:z,ref:ie,onComplete(){z||je()}}),Z.useImperativeHandle(h,()=>({unmount:je}),[je]);let Me=tP((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ne=tP(e=>{let t=a7(e.scrollHeight,e.clientHeight),n=o7(e.scrollTop,t),r=n>0,i=n<t;be.set(`scrollUpArrowVisible`,r),be.set(`scrollDownArrowVisible`,i)}),Pe=pB({open:z,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Fe=AR(Pe,{enabled:!I,event:`mousedown`}),Ie=IR(Pe),Le=NB(Pe,{enabled:!I,listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:zN,onNavigate(e){(e!==null||z)&&be.set(`activeIndex`,e)},focusItemOnHover:C}),Re=PB(Pe,{enabled:!I&&(z||!f&&!y),listRef:re,activeIndex:xe,selectedIndex:Se,disabledIndices:e=>_5(ne.current[e]),onMatch(e){z?be.set(`activeIndex`,e):Me(ce.current[e],NL(gL))},onTyping(e){le.current=e}}),ze=Z.useMemo(()=>SI(Re.reference,Le.reference,Ie.reference,Fe.reference,ye),[Fe.reference,Re.reference,Le.reference,Ie.reference,ye]),Be=Z.useMemo(()=>SI(Wz,Re.floating,Le.floating,Ie.floating),[Re.floating,Le.floating,Ie.floating]),Ve=Le.item??BN;be.useContextCallback(`setValue`,Me),be.useContextCallback(`setOpen`,Ae),be.useContextCallback(`handleScrollArrowVisibility`,Ne),be.useContextCallback(`onOpenChangeComplete`,_),wge(()=>{be.update({popupProps:Be,triggerProps:ze})}),be.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:z,mounted:he,transitionStatus:_e,popupProps:Be,triggerProps:ze,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:Ee});let He=Z.useMemo(()=>({disabled:I,readOnly:f,required:p,multiple:y,highlightItemOnHover:C,itemProps:Ve}),[I,f,p,y,C,Ve]),Ue=uI(g,N.inputRef),We=y?void 0:L,Ge=Z.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=r7(e,x);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,Q.jsxs)(U5.Provider,{value:be,children:[(0,Q.jsx)(W5.Provider,{value:He,children:(0,Q.jsx)(G5.Provider,{value:Pe,children:w})}),(0,Q.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){be.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=NL(gL,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ce.current.findIndex(t=>r7(t,x).toLowerCase()===e||n7(t,b).toLowerCase()===e);r===-1&&(r=ce.current.findIndex((t,n)=>{let r=re.current[n];return r!=null&&r.toLowerCase()===e}));let i=ce.current[r];i!=null&&Me(i,n)}be.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&We==null?`${F}-hidden-input`:void 0,form:l,name:We,autoComplete:u,value:De,disabled:I,required:p&&!(y&&ke),readOnly:f,ref:Ue,style:L?cI:sI,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ge]})}function Ige(e,t){return e??t}var Lge=`data-popup-side`,Rge=400,zge={...QP,...l8,popupSide:e=>e?{[Lge]:e}:null,value:()=>null},Bge=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=Ige(h,k);m8({id:i});let P=VL(T),F=Z.useRef(null),{getButtonProps:I,buttonRef:L}=pL({disabled:b,native:o}),R=g.useStateSetter(`triggerElement`),ee=NP(),z=NP(),te=NP();Z.useEffect(()=>{if(x)return te.start(Rge,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},z.clear()},[x,g,z,te]);let ne=SI(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??sF(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,NL(gL,e.nativeEvent)),ee.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){UP(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=TP(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;UP(F.current,t)||UP(P.current,t)||p5(e,F.current)||g.context.setOpen(!1,NL(EL,e))}z.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),re=f.getValidationProps(b,ne);re.role=`combobox`;let ie={...p,open:x,disabled:b,value:C,readOnly:_,popupSide:j,placeholder:!A};return II(`button`,e,{ref:[t,F,L,R],state:ie,stateAttributesMapping:zge,props:re})}),Vge={value:()=>null},Hge=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)?Nge(l,u,d):i7(l,u,d)),II(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:Vge})}),Uge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return II(`span`,e,{state:{open:K5().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:ZP})}),Wge=Z.forwardRef(function(e,t){let n=K5(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Q.jsx)(zL,{ref:t,...e}):null}),s7=Z.createContext(void 0);function c7(){let e=Z.useContext(s7);if(!e)throw Error(KN(59));return e}function l7(e,t){e&&Object.assign(e.style,t)}var u7={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},Gge={position:`fixed`},Kge=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=tL,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=iV({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?Gge:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};WN(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=cV(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),z=Z.useRef(0),te=tP(e=>{if(y.context.valuesRef.current.length===0)return;let t=z.current;z.current=e.size;let n=NL(gL);if(t!==0&&!y.state.multiple&&w!==null&&Q5(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&Q5(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>Q5(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};l7(E,e),l7(y.context.popupRef.current,e)}}),ne=Z.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,Q.jsx)(Y8,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:te,children:(0,Q.jsxs)(s7.Provider,{value:ne,children:[S&&C&&(0,Q.jsx)(Z8,{inert:UI(!x),cutout:D}),ee]})})}),d7=`base-ui-disable-scrollbar`,f7={className:d7,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:d7,precedence:`base-ui:low`,children:`.${d7}{scrollbar-width:none}.${d7}::-webkit-scrollbar{display:none}`})}},qge=Z.createContext(void 0),Jge={disableStyleElements:!1};function p7(){return Z.useContext(qge)??Jge}var m7=`--transform-origin`,Yge={...$P,...YP},Xge=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=WB(),{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=AP(),P=tP(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=TP(O),o=aP(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=iL(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=iL(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]),JI({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};WN(()=>{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]),WN(()=>{S||m||(j.current=!1,A.current=!1,l7(O,M.current))},[S,m,O]),WN(()=>{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=Zge(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=aP(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=TP(D),c=_7(D),l=y7(D.getBoundingClientRect(),c),d=y7(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=h7(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=y7(n.getBoundingClientRect(),c);T=y7(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${iL(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=g7(p),ee=I>=R-1;ee&&(P=Math.min(S,d.height)-(I-R));let z=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),te=(r.visualViewport?.scale??1)!==1&&BP;if(z||te){l7(O,M.current),g(!1);return}let ne=Math.max(b,P);if(ee){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=g7(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=iL(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(m7,`50% ${i}%`)}(ne===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),Z.useEffect(()=>{if(!m||!O||!S)return;let e=aP(O);function t(e){s.context.setOpen(!1,NL(ML,e))}return EP(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&V8.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:u7},className:!k&&m?f7.className:void 0},L=II(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:Yge,props:[T,I,sV(E),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!b&&f7.getElement(y),(0,Q.jsx)(kR,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})});function h7(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function g7(e){return a7(e.scrollHeight,e.clientHeight)}function _7(e){return yz.getScale(e)}function v7(e,t,n){return e/n[t]}function y7(e,t){return MF({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 Zge(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 Qge=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 II(`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(KN(57));return e}var $ge=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);WN(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),WN(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=Oge(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}=pL({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?kge(n,a,S):[...n,a];f.context.setValue(r,NL(xL,e))}else f.context.setValue(a,NL(xL,e)),f.context.setOpen(!1,NL(xL,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&&dF(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=II(`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})})),e_e=Z.forwardRef(function(e,t){let{selected:n}=S7();return e.keepMounted||n?(0,Q.jsx)(t_e,{...e,ref:t}):null}),t_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}=Uz(s),d=II(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:YP});return JI({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),n_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 II(`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`,_=NP(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=Uz(g);WN(()=>(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]),JI({open:g,ref:v,onComplete(){g||x(!1)}});let S=II(`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=r_e(a,c,r,e.clientHeight,t,n)}_.start(40,t)}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:YP});return y||o?S:null});function r_e(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?o7(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?o7(l.offsetTop+l.offsetHeight-r+i,a):a}var i_e=Z.forwardRef(function(e,t){return(0,Q.jsx)(C7,{...e,ref:t,direction:`down`})}),a_e=Z.forwardRef(function(e,t){return(0,Q.jsx)(C7,{...e,ref:t,direction:`up`})}),w7=Z.createContext(void 0);function o_e(){let e=Z.useContext(w7);if(e===void 0)throw Error(KN(56));return e}var s_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(),c=Z.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=II(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(w7.Provider,{value:c,children:l})}),c_e=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=o_e(),c=kU(a);return WN(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),II(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),T7=Fge;function l_e({className:e,...t}){return(0,Q.jsx)(s_e,{"data-slot":`select-group`,className:$V(`scroll-my-1 p-1`,e),...t})}function E7({className:e,...t}){return(0,Q.jsx)(Hge,{"data-slot":`select-value`,className:$V(`flex flex-1 text-left`,e),...t})}function D7({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(Bge,{"data-slot":`select-trigger`,"data-size":t,className:$V(`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)(Uge,{render:(0,Q.jsx)(DH,{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)(Wge,{children:(0,Q.jsx)(Kge,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Q.jsxs)(Xge,{"data-slot":`select-content`,"data-align-trigger":o,className:$V(`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)(d_e,{}),(0,Q.jsx)(Qge,{children:t}),(0,Q.jsx)(f_e,{})]})})})}function u_e({className:e,...t}){return(0,Q.jsx)(c_e,{"data-slot":`select-label`,className:$V(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function k7({className:e,children:t,...n}){return(0,Q.jsxs)($ge,{"data-slot":`select-item`,className:$V(`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)(n_e,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(e_e,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`}),children:(0,Q.jsx)(TH,{className:`pointer-events-none`})})]})}function d_e({className:e,...t}){return(0,Q.jsx)(a_e,{"data-slot":`select-scroll-up-button`,className:$V(`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)(kH,{})})}function f_e({className:e,...t}){return(0,Q.jsx)(i_e,{"data-slot":`select-scroll-down-button`,className:$V(`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)(DH,{})})}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||{}),p_e=[0,1],j7=[1,0],M7=[2,3],N7=[3,2],m_e={L:p_e,M:j7,Q:M7,H:N7},h_e=/^\d*$/,g_e=/^[A-Z0-9 $%*+./:-]*$/,P7=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,F7=1,I7=40,L7=3,__e=3,R7=40,v_e=10,z7=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],B7=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],y_e=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<F7||e>I7)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,A7.Timing),this.setFunctionModule(e,6,e%2==0,A7.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,H7(r,e));this.setFunctionModule(8,7,H7(r,6)),this.setFunctionModule(8,8,H7(r,7)),this.setFunctionModule(7,8,H7(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,H7(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,H7(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,H7(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=H7(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,A7.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,A7.Alignment)}setFunctionModule(e,t,n,r=A7.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Y7(t,n))throw RangeError(`Invalid argument`);let r=B7[n[0]][t],i=z7[n[0]][t],a=Math.floor(J7(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=O_e(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=k_e(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(J7(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=H7(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=L7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*R7),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*R7}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=L7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*R7),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*R7}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=__e)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*v_e,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function V7(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function H7(e,t){return!!(e>>>t&1)}var U7=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},b_e=[1,10,12,14],x_e=[2,9,11,13],S_e=[4,8,16,16];function W7(e,t){return e[Math.floor((t+7)/17)+1]}function G7(e){let t=[];for(let n of e)V7(n,8,t);return new U7(S_e,e.length,t)}function C_e(e){if(!K7(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);V7(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new U7(b_e,e.length,t)}function w_e(e){if(!q7(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=P7.indexOf(e.charAt(n))*45;r+=P7.indexOf(e.charAt(n+1)),V7(r,11,t)}return n<e.length&&V7(P7.indexOf(e.charAt(n)),6,t),new U7(x_e,e.length,t)}function T_e(e){return e===``?[]:K7(e)?[C_e(e)]:q7(e)?[w_e(e)]:[G7(D_e(e))]}function K7(e){return h_e.test(e)}function q7(e){return g_e.test(e)}function E_e(e,t){let n=0;for(let r of e){let e=W7(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function D_e(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function J7(e){if(e<F7||e>I7)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function Y7(e,t){return Math.floor(J7(e)/8)-z7[t[0]][e]*B7[t[0]][e]}function O_e(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=X7(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=X7(n,2)}return t}function k_e(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=X7(t,e))}return n}function X7(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function A_e(e,t,n=1,r=40,i=-1,a=!0){if(!(F7<=n&&n<=r&&r<=I7)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=Y7(o,t)*8,i=E_e(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[j7,M7,N7])a&&s<=Y7(o,e)*8&&(t=e);let c=[];for(let t of e){V7(t.mode[0],4,c),V7(t.numChars,W7(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Y7(o,t)*8;V7(0,Math.min(4,l-c.length),c),V7(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)V7(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new y_e(o,t,u,i)}function j_e(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?T_e(e):Array.isArray(e)?[G7(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=A_e(c,m_e[n],i,a,o,r),u=M_e({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function M_e(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=A7.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function N_e(e){let t=(0,lV.c)(9),{link:n}=e,r,i;if(t[0]!==n){let{size:e,data:a}=j_e(n,{ecc:`M`,border:2});r=e,i=a.flatMap(P_e).join(``),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a=i,o=r*2,s=`0 0 ${r} ${r}`,c;t[3]===a?c=t[4]:(c=(0,Q.jsx)(`path`,{d:a,fill:`currentColor`}),t[3]=a,t[4]=c);let l;return t[5]!==o||t[6]!==s||t[7]!==c?(l=(0,Q.jsx)(`svg`,{role:`img`,"aria-label":`Pairing QR code`,width:o,height:o,viewBox:s,shapeRendering:`crispEdges`,className:`shrink-0 rounded-sm bg-white text-black`,children:c}),t[5]=o,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function P_e(e,t){return e.flatMap((e,n)=>e?[`M${n} ${t}h1v1h-1z`]:[])}function F_e(e){let t=(0,lV.c)(50),{connection:n,remote:r,disabled:i}=e,a=i!==void 0&&i,o=kce(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]=Ime(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 y.link.startsWith(`${t}/pair#`)})?.route;if(b===void 0){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on a way in above to pair a device.`}),t[3]=e):e=t[3],e}let S=e=>b8(e,async()=>g({label:s.trim(),addresses:[b.url],trusted:d,canManageSharing:p})),C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(I6,{htmlFor:`pairing-label`,children:`Device name`}),t[4]=C):C=t[4];let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>c(e.target.value),t[5]=w):w=t[5];let T;t[6]===s?T=t[7]:(T=(0,Q.jsxs)(B6,{className:`min-w-0 flex-1`,children:[C,(0,Q.jsx)(v8,{id:`pairing-label`,placeholder:`My phone`,maxLength:Vue,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(L_e),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:r2[b.route]})}),(0,Q.jsx)(O7,{children:o.map(I_e)})]}),(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)(YH,{}),t[12]=h.waiting,t[13]=O);let k;t[14]!==D||t[15]!==O?(k=(0,Q.jsxs)(sH,{type:`submit`,size:`sm`,className:`shrink-0`,disabled:D,children:[O,`Create pairing link`]}),t[14]=D,t[15]=O,t[16]=k):k=t[16];let A;t[17]!==T||t[18]!==E||t[19]!==k||t[20]!==S?(A=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:S,children:[T,E,k]}),t[17]=T,t[18]=E,t[19]=k,t[20]=S,t[21]=A):A=t[21];let j;t[22]!==a||t[23]!==p||t[24]!==m?(j=(0,Q.jsx)(H5,{id:`pairing-management`,checked:p,disabled:a,onCheckedChange:m}),t[22]=a,t[23]=p,t[24]=m,t[25]=j):j=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(I6,{htmlFor:`pairing-management`,children:`Can manage sharing`}),t[26]=M):M=t[26];let N;t[27]===j?N=t[28]:(N=(0,Q.jsxs)(B6,{orientation:`horizontal`,children:[j,M]}),t[27]=j,t[28]=N);let P;t[29]!==a||t[30]!==f||t[31]!==d?(P=(0,Q.jsx)(H5,{id:`pairing-trusted`,checked:d,disabled:a,onCheckedChange:f}),t[29]=a,t[30]=f,t[31]=d,t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(I6,{htmlFor:`pairing-trusted`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`The paired device can update Porcelain`}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`Can update Porcelain`})]}),t[33]=F):F=t[33];let I;t[34]===P?I=t[35]:(I=(0,Q.jsxs)(B6,{orientation:`horizontal`,children:[P,F]}),t[34]=P,t[35]=I);let L=r2[b.route],R;t[36]===L?R=t[37]:(R=(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Uses `,L,`. Pair again to add another way in.`]}),t[36]=L,t[37]=R);let ee;t[38]===h?ee=t[39]:(ee=aS(h)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:E2(Bl(h.cause))})}),t[38]=h,t[39]=ee);let z;t[40]!==y||t[41]!==x?(z=y&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg bg-white p-1 inset-ring inset-ring-border`,children:(0,Q.jsx)(N_e,{link:y.link})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-20 flex-col gap-1 pt-0.5`,children:[(0,Q.jsxs)(`p`,{className:`text-ui leading-4.5 font-medium`,children:[`Scan on `,y.label]}),(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Works once, until`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:new Date(y.expiresAt).toLocaleTimeString()}),x&&(0,Q.jsxs)(Q.Fragment,{children:[`, through `,r2[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)(sH,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>$U(y?.link??``,`pairing link`),children:[(0,Q.jsx)(zH,{}),`Copy link`]})]}),t[40]=y,t[41]=x,t[42]=z):z=t[42];let te;return t[43]!==A||t[44]!==N||t[45]!==I||t[46]!==R||t[47]!==ee||t[48]!==z?(te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[A,N,I,R,ee,z]}),t[43]=A,t[44]=N,t[45]=I,t[46]=R,t[47]=ee,t[48]=z,t[49]=te):te=t[49],te}function I_e(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:`${r2[t]} · ${n}`})},n)}function L_e(e){let{route:t,url:n}=e;return{value:n,label:`${r2[t]} · ${n}`}}var Z7=Z.createContext(void 0);function Q7(){let e=Z.useContext(Z7);if(e===void 0)throw Error(KN(64));return e}var R_e=`data-activation-direction`,$7={tabActivationDirection:e=>({[R_e]:e})},z_e=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;WN(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=tP((e,t)=>{t.activationDirection=t9(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),A=tP((e,t)=>{i?.(e,NL(t,void 0,void 0,{activationDirection:`none`}))}),j=tP((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),M=Z.useCallback(e=>f.get(e),[f]),N=Z.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),P=Z.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:T,value:m}),[b,N,M,k,a,j,v,T,m]),F=Z.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=Z.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=Z.useRef(!u),R=Z.useRef(r),ee=Z.useRef(u),z=Z.useRef(!1);WN(()=>{if(g)return;function e(e,t){h(e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),L.current=!1}if(_.size===0){z.current&&m!==null&&!y.current?.isConnected&&e(null,kL);return}z.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(ee.current=!1),ee.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=kL;r?i=AL:t&&(i=OL),e(n,i);return}r&&F!=null&&(A(m,AL),L.current=!1)},[I,g,A,F,h,_,m]);let te=II(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:$7});return(0,Q.jsx)(Z7.Provider,{value:P,children:(0,Q.jsx)(Y8,{elementsRef:d,children:te})})});function e9(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function t9(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=e9(r,e),c=e9(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var B_e=`data-composite-item-active`,n9=Z.createContext(void 0);function V_e(){let e=Z.useContext(n9);if(e===void 0)throw Error(KN(65));return e}var H_e=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:_}=V_e(),{highlightedIndex:v,onHighlightedIndexChange:y}=uL(),b=kU(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=tP(e=>{E.current?.(),E.current=e?g(e):null});WN(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=HP(TP(e));if(t&&UP(e,t))return}r||y(C)},[w,C,v,y,r,_]);let{getButtonProps:O,buttonRef:k}=pL({disabled:r,native:s,focusableWhenDisabled:!0}),A=d(a),j=Z.useRef(!1),M=Z.useRef(!1);function N(e){f(a,NL(gL,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=TP(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 II(`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,[B_e]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,O],stateAttributesMapping:$7})}),U_e=`data-index`,W_e={...$7,...YP},G_e=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=kU(),{ref:m,index:h}=j8(),g=r===c,{mounted:_,transitionStatus:v,setMounted:y}=Uz(g),b=!_,x=l(r),S={hidden:b,orientation:u,tabActivationDirection:d,transitionStatus:v},C=Z.useRef(null),w=II(`div`,e,{state:S,ref:[t,m,C],props:[{"aria-labelledby":x,hidden:b,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:UI(!g),[U_e]:h},s],stateAttributesMapping:W_e});return JI({open:g,ref:C,onComplete(){g||y(!1)}}),WN(()=>{if(!(p==null||b&&!a))return f(r,p)},[b,a,r,p,f]),a||_?w:null});function K_e(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=zN}=e,[p,m]=Z.useState(0),h=r!=null,g=Z.useRef(null),_=uI(g,c),v=Z.useRef([]),y=Z.useRef(!1),b=Z.useRef(null),x=o??p,S=tP((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=tP(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||LF(e,x,d)?S(q_e(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(LF(t,x,d)){let e=IF(t,{disabledIndices:d});NF(t,e)||S(e)}U8(g.current,r,a,n)});WN(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(LF(e,x,d)){let t=IF(e,{disabledIndices:d});NF(e,t)||S(t)}},[d,o,x,v,S]);let w=tP((e,t,n)=>i?i(e,t,n,v):n),T=tP(e=>{let o=e.key===`Home`||e.key===`End`;if(!V8.has(e.key)||!l&&o||J_e(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=WP(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=PF(v,d),T=FF(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=IF(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!NF(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=WP(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 q_e(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!LF(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function J_e(e,t){for(let n of rhe)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Y_e(e){let{render:t,className:n,style:r,refs:i=zN,props:a=zN,state:o=BN,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}=K_e({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:WB(),disabledIndices:v,modifierKeys:y}),k=II(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)(lL.Provider,{value:A,children:(0,Q.jsx)(Y8,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var X_e=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);WN(()=>{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=tP(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=tP(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)(Y_e,{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:zN})})});function r9({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(z_e,{"data-slot":`tabs`,"data-orientation":t,className:$V(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Z_e=aH(`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)(X_e,{"data-slot":`tabs-list`,"data-variant":t,className:$V(Z_e({variant:t}),e),...n})}function a9({className:e,...t}){return(0,Q.jsx)(H_e,{"data-slot":`tabs-trigger`,className:$V(`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 Q_e({className:e,...t}){return(0,Q.jsx)(G_e,{"data-slot":`tabs-content`,className:$V(`flex-1 text-xs/relaxed outline-none`,e),...t})}var o9=VE(V3.layer).atom(H(function*(){return In()}));function $_e(){let e=(0,lV.c)(8),t=ON(o9),n;e[0]===t?n=e[1]:(n=Un(Xn(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=NN(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 eve(){let e=(0,lV.c)(36),[t,n]=(0,Z.useState)(`claude`),{configuration:r,failed:i,retry:a}=$_e(),o=`claude mcp add porcelain -- porcelain mcp`,s;e[0]!==t||e[1]!==o?(s=xfe(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)(tve,{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&&$U(c,`MCP configuration`)},e[11]=c,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Q.jsx)(sH,{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)(zH,{}),e[16]=_):_=e[16];let v;e[17]===g?v=e[18]:(v=(0,Q.jsx)(JU,{render:g,children:_}),e[17]=g,e[18]=v);let y;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(YU,{role:`tooltip`,children:`Copy MCP configuration`}),e[19]=y):y=e[19];let b;e[20]===v?b=e[21]:(b=(0,Q.jsxs)(qU,{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 tve({command:e,failed:t}){return e===void 0?t?`MCP configuration is unavailable.`:`Loading MCP configuration…`:Tfe(e).map((e,t)=>(0,Q.jsx)(`span`,{className:nve[e.kind],children:e.text},t))}var nve={program:`text-(--syn-fn)`,quoted:`text-(--syn-str)`,plain:void 0},rve=new Intl.RelativeTimeFormat(`en`,{numeric:`always`});function s9(e,t=Jne()){let n=cm(e),r=Qne(n,t),[i,a]=r?[t,n]:[n,t],o=Zne(i,a),s=Fi(o),c=Xne(),l=(s+um(lm(a,c))-um(lm(i,c)))/Fi(Ni(1)),u,d;return s<Fi(ji(1))?(u=`second`,d=Math.round(Oee(o))):s<Fi(Mi(1))?(u=`minute`,d=Math.round(kee(o))):s<Fi(Ni(1))?(u=`hour`,d=Math.round(Aee(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)),rve.format(r?d:-d,u)}var ive={phone:(0,Q.jsx)(pU,{"aria-hidden":!0}),tablet:(0,Q.jsx)(hU,{"aria-hidden":!0}),browser:(0,Q.jsx)(VH,{"aria-hidden":!0})};function ave(e){let t=(0,lV.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:ive[Sfe(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:i2[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 `,i2[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)(cve,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canManageSharing===!0}),(0,Q.jsx)(ove,{disabled:a,connection:n,id:e.id,label:e.label,trusted:e.trusted}),!e.canManageSharing&&Ece(e)&&(0,Q.jsx)(sve,{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)(YH,{"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)(sH,{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 ove(e){let t=(0,lV.c)(6),{connection:n,id:r,label:i,trusted:a,disabled:o}=e,[s,c]=Rme(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 sve(e){let t=(0,lV.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=zme(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,lV.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:E2(Bl(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,lV.c)(12),{connection:n,id:r,label:i,cancelLink:a,disabled:o}=e,s=o!==void 0&&o,[c,l]=Lme(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)(sH,{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:E2(Bl(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 cve(e){let t=(0,lV.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=Ume(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 lve(e){let t=(0,lV.c)(13),{name:n,route:r}=e,{status:i}=r,a;t[0]!==n||t[1]!==r?(a=Nce(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 uve(e){let t=(0,lV.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=Rce(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=bce[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)(qU,{children:[(0,Q.jsx)(JU,{render:(0,Q.jsx)(sH,{size:`icon-xs`,variant:`ghost`,className:`size-5`,"aria-label":`Copy ${e}`,onClick:()=>$U(e,`address`),children:(0,Q.jsx)(zH,{})})}),(0,Q.jsx)(YU,{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,lV.c)(40),{name:n,route:r,disabled:i,connectedThrough:a,onChange:o,setup:s,note:c,children:l}=e,u=r2[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)(lve,{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)(dU,{"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)(uve,{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)(sH,{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)(DH,{"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:xce(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 dve(e){let t=(0,lV.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)(sH,{variant:`outline`,size:`sm`,className:`self-start`,disabled:r,onClick:i,children:[`Turn on for `,a2(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?o2(n):`Uses ${a2(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)(dU,{"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)(sH,{size:`sm`,variant:`ghost`}),children:`Details`}),t[14]=m):m=t[14];let h;t[15]===n?h=t[16]:(h=o2(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:Sce}),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,lV.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=Lce(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)(sH,{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)(sH,{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 fve(e){let t=(0,lV.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:jce(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)(qU,{children:[(0,Q.jsx)(JU,{render:(0,Q.jsx)(sH,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy the tailscale serve command`,onClick:()=>$U(s,`command`),children:(0,Q.jsx)(zH,{})})}),(0,Q.jsx)(YU,{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 pve(e){let t=(0,lV.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 mve(e){let t=(0,lV.c)(63),{connection:n,remote:r}=e,[i,a]=Bme(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=o2(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)(dve,{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)(fve,{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)(pve,{remote:r,disabled:o,onChange:u}),t[43]=o,t[44]=r,t[45]=u,t[46]=F):F=t[46];let I;t[47]!==r.routes.cloudflare||t[48]!==j||t[49]!==M||t[50]!==N||t[51]!==P||t[52]!==F?(I=(0,Q.jsx)(d9,{name:`cloudflare`,route:O,setup:j,connectedThrough:M,disabled:N,onChange:P,children:F}),t[47]=r.routes.cloudflare,t[48]=j,t[49]=M,t[50]=N,t[51]=P,t[52]=F,t[53]=I):I=t[53];let L;t[54]!==v||t[55]!==D||t[56]!==I?(L=(0,Q.jsxs)(U6,{children:[v,D,I]}),t[54]=v,t[55]=D,t[56]=I,t[57]=L):L=t[57];let R;t[58]===i?R=t[59]:(R=aS(i)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:E2(Bl(i.cause))})}),t[58]=i,t[59]=R);let ee;return t[60]!==L||t[61]!==R?(ee=(0,Q.jsxs)(Q.Fragment,{children:[L,R]}),t[60]=L,t[61]=R,t[62]=ee):ee=t[62],ee}function p9(e){let t=(0,lV.c)(14),{connection:n,children:r}=e,i=r8(n),a,o;if(t[0]!==r||t[1]!==n||t[2]!==i){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Un(fS(i));if(e===null){let e;t[5]===n.address?e=t[6]:(e=Dce(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=E2(Bl(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,lV.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)(mve,{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 hve(e){let t=(0,lV.c)(5),{connection:n,children:r}=e,i=n8(n),a,o;if(t[0]!==i||t[1]!==r){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Un(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)?E2(Bl(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,lV.c)(5),{prominent:n}=e,r=n!==void 0&&n,i=Un(fS(Cme()))?.isDesktopShell;if(i===!0){let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(_ge,{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)(hge,{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 gve(e){let t=(0,lV.c)(46),{environment:n}=e,{connection:r}=D6(),i=Un(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]=Hme(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)(Uhe,{icon:j4(n),pending:p.waiting,onChange:e=>m(yue(e))}),(0,Q.jsxs)(sH,{variant:`ghost`,size:`sm`,ref:c?e=>{e&&(e.focus(),l(!1))}:void 0,onClick:()=>{l(!0),s(a)},children:[(0,Q.jsx)(aU,{}),`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:E2(Bl(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)(Wme,{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)(eve,{}),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)(xme,{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,lV.c)(6),{connection:n}=e,r=Un(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)(ave,{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)(F_e,{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)(hve,{connection:n,children:i}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}var _ve=X(e=>b6.fn(e=>H(function*(){let t=yield*(yield*P2).pair({value:e,localEnvironmentId:x6.state.value.connection?.environmentId}).pipe(rp(t3));return U0(g6,t),t}))),vve=X(e=>b6.fn(t=>H(function*(){yield*(yield*P2).forget(e.environmentId)}))),yve=b6.fn(e=>H(function*(){yield*(yield*P2).read()}));function bve(e){let t=(0,lV.c)(12),[n]=(0,Z.useState)(Symbol),r;t[0]===n?r=t[1]:(r=_ve(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]=PN(i,a),c=MN(i),l;t[3]!==e||t[4]!==s?(l=async t=>{su(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(JE),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 xve(e,t){let n=(0,lV.c)(9),r;n[0]===e?r=n[1]:(r=vve(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]=PN(r,i),s;n[3]!==t||n[4]!==o?(s=async()=>{su(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 Sve(){let e=(0,lV.c)(5),[t,n]=PN(yve),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 Cve(e){let t=(0,lV.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=a0(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 wve(){let e=(0,lV.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=bve(r),{status:a}=w6(),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`p`,{className:`text-ui leading-5 text-foreground-2`,children:[`On the other computer, run`,` `,(0,Q.jsx)(`code`,{className:`rounded-sm bg-muted px-1.5 py-px font-mono text-xs leading-4.5 font-medium text-foreground inset-ring inset-ring-border`,children:`porcelain pair`}),` `,`and paste the link it prints. This device keeps its own credential for that computer.`]}),e[1]=o):o=e[1];let s;e[2]!==i||e[3]!==t?(s=e=>b8(e,()=>i.submit(t)),e[2]=i,e[3]=t,e[4]=s):s=e[4];let c=i.result.waiting||a!==`ready`,l;e[5]===i?l=e[6]:(l=e=>{i.reset(),n(e.target.value)},e[5]=i,e[6]=l);let u;e[7]!==t||e[8]!==c||e[9]!==l?(u=(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 font-mono`,children:(0,Q.jsx)(v8,{"aria-label":`Pairing link`,placeholder:`http://192.168.1.20:4738/pair#c=…`,value:t,disabled:c,onChange:l})}),e[7]=t,e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;e[11]!==i.result.waiting||e[12]!==t||e[13]!==a?(d=i.result.waiting||a!==`ready`||t.trim()===``,e[11]=i.result.waiting,e[12]=t,e[13]=a,e[14]=d):d=e[14];let f=i.result.waiting?`Pairing…`:`Add`,p;e[15]!==d||e[16]!==f?(p=(0,Q.jsx)(sH,{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:E2(Bl(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 Tve(e){let{connection:t}=e,n=Un(fS(r8(t))),r=Un(fS(n8(t)));return n&&r?`Online · ${wfe(n,r.devices.length)}`:`Online · Connected computer`}function Eve(e){let t=(0,lV.c)(60),{environment:n,onOpen:r,showUpdates:i}=e,{connection:a}=D6(),{remotes:o,error:s}=w6(),c=Sve();Yhe();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)(VH,{"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)(GH,{}),(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)(sH,{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)(sH,{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)(sH,{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)(Tve,{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)(Cve,{remote:e,showUpdates:i,onOpen:r},e.environmentId),t[42]=r,t[43]=i,t[44]=e):e=t[44],I=[...o].sort(Dve).map(e),t[38]=r,t[39]=o,t[40]=i,t[41]=I}else I=t[41];let L;t[45]!==F||t[46]!==I?(L=(0,Q.jsxs)(U6,{"aria-label":`Computers`,children:[F,I]}),t[45]=F,t[46]=I,t[47]=L):L=t[47];let R;t[48]!==O||t[49]!==L?(R=(0,Q.jsxs)(`section`,{"aria-labelledby":`computers-heading`,className:`@container flex min-w-0 flex-col gap-2`,children:[O,L]}),t[48]=O,t[49]=L,t[50]=R):R=t[50];let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(z6,{variant:`label`,children:`Add computer`}),t[51]=ee):ee=t[51];let z;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsxs)(R6,{children:[ee,(0,Q.jsx)(U6,{children:(0,Q.jsx)(wve,{})})]}),t[52]=z):z=t[52];let te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(te={section:`computers`,environmentId:`this-computer`},t[53]=te):te=t[53];let ne;t[54]===n.name?ne=t[55]:(ne=(0,Q.jsxs)(`p`,{className:`-mt-3.5 text-ui leading-5 text-muted-foreground`,children:[`To pair a phone, tablet or browser with this computer, open`,` `,(0,Q.jsxs)(bN,{to:`/settings/$section/$environmentId`,params:te,hash:`devices`,className:`rounded-sm font-medium text-foreground underline underline-offset-3 outline-none focus-visible:ring-3 focus-visible:ring-ring/30`,children:[n.name,` › Devices`]}),`.`]}),t[54]=n.name,t[55]=ne);let re;return t[56]!==R||t[57]!==ne||t[58]!==y?(re=(0,Q.jsxs)(Q.Fragment,{children:[v,y,R,z,ne]}),t[56]=R,t[57]=ne,t[58]=y,t[59]=re):re=t[59],re}function Dve(e,t){return e.name.localeCompare(t.name)||e.environmentId.localeCompare(t.environmentId)}var _9=(0,Q.jsx)(NH,{"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:$V(`size-2 rounded-full`,e)})}var Ove={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,lV.c)(24),{name:n,label:r,openLabel:i,status:a,badge:o,description:s,update:c,onOpen:l}=e,u=Ove[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)(jH,{"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:$V(`animate-pulse rounded-md bg-muted`,e),...t})}function kve(e){let t=(0,lV.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,lV.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)(UH,{}),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 Ave(e){let t=(0,lV.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 jve(e){let t=(0,lV.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)(FH,{}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=(0,Q.jsx)(sH,{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)(sH,{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 Mve(e){let t=(0,lV.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)(sU,{}),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)(YH,{}),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}: ${a0(r)}`,t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=o0(r),t[6]=r,t[7]=u);let d;t[8]!==i||t[9]!==a?(d=!a&&(0,Q.jsx)(sH,{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 Nve(e){let t=(0,lV.c)(14),{remote:n}=e,r,i,a,o;if(t[0]!==n){let e=K1(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(Pve),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 Pve(e){let{address:t}=e;return(0,Q.jsxs)(W6,{children:[(0,Q.jsxs)(K6,{children:[(0,Q.jsx)(q6,{children:Y1(t)}),(0,Q.jsx)(J6,{className:`break-all`,children:t})]}),(0,Q.jsx)(Y6,{children:(0,Q.jsxs)(qU,{children:[(0,Q.jsx)(JU,{render:(0,Q.jsx)(sH,{size:`icon-sm`,variant:`ghost`,"aria-label":`Copy ${t}`,onClick:()=>$U(t,`address`),children:(0,Q.jsx)(zH,{})})}),(0,Q.jsx)(YU,{role:`tooltip`,className:`break-all`,children:`Copy ${t}`})]})})]},t)}function Fve(e){let t=(0,lV.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 Ive(e){let t=(0,lV.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)(Lve,{remote:c,onForgotten:r}),t[10]=r,t[11]=c,t[12]=l):l=t[12],l}function Lve(e){let t=(0,lV.c)(76),{remote:n,onForgotten:r}=e,i=O6(n),a=E6(n.environmentId),o=xve(n,r),s=i.kind===`online`,c=s?i.name:n.name,l;t[0]===i?l=t[1]:(l=o0(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=a0(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)(sH,{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)(gge,{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)(Nve,{remote:n}),t[50]=n,t[51]=N);let P;t[52]===s?P=t[53]:(P=!s&&(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsxs)(K6,{children:[(0,Q.jsx)(q6,{children:`Pair again`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`On this computer, run porcelain pair. Return to Computers and add the new link to replace this app’s saved connection.`})]})}),t[52]=s,t[53]=P);let F;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(z6,{variant:`label`,children:`Danger zone`}),t[54]=F):F=t[54];let I;t[55]===c?I=t[56]:(I=(0,Q.jsxs)(q6,{children:[`Forget `,c]}),t[55]=c,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removes this computer from this app. Other devices keep their access.`}),t[57]=L):L=t[57];let R;t[58]===o?R=t[59]:(R=()=>void o.submit(),t[58]=o,t[59]=R);let ee=o.result.waiting?`Forgetting…`:`Forget on this app`,z;t[60]!==o.result.waiting||t[61]!==R||t[62]!==ee?(z=(0,Q.jsx)(sH,{variant:`destructive`,className:`w-fit`,disabled:o.result.waiting,onClick:R,children:ee}),t[60]=o.result.waiting,t[61]=R,t[62]=ee,t[63]=z):z=t[63];let te;t[64]===o.result?te=t[65]:(te=aS(o.result)&&(0,Q.jsx)(Z6,{variant:`destructive`,children:(0,Q.jsx)($6,{children:E2(Bl(o.result.cause))})}),t[64]=o.result,t[65]=te);let ne;t[66]!==I||t[67]!==z||t[68]!==te?(ne=(0,Q.jsxs)(R6,{children:[F,(0,Q.jsx)(`div`,{className:`rounded-2xl border border-destructive/30`,children:(0,Q.jsx)(U6,{children:(0,Q.jsx)(W6,{variant:`outline`,children:(0,Q.jsxs)(K6,{children:[I,L,z,te]})})})})]}),t[66]=I,t[67]=z,t[68]=te,t[69]=ne):ne=t[69];let re;return t[70]!==j||t[71]!==M||t[72]!==N||t[73]!==P||t[74]!==ne?(re=(0,Q.jsxs)(`div`,{className:`settings-computer grid min-w-0 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_--spacing(62)]`,children:[j,M,N,P,ne]}),t[70]=j,t[71]=M,t[72]=N,t[73]=P,t[74]=ne,t[75]=re):re=t[75],re}var Rve=ME(e=>e.registry),S9=X(e=>ME(t=>{let n=window.matchMedia(e),r=()=>t.setSelf(n.matches);return n.addEventListener(`change`,r),t.addFinalizer(()=>n.removeEventListener(`change`,r)),n.matches})),zve=ME(()=>{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}}}),Bve=X(e=>ME(t=>{t.addFinalizer(t(zve)(e))}));function C9(){let e=(0,lV.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=S9(`(max-width: 767px)`),e[0]=t):t=e[0],ON(t)}var w9=Z.createContext(void 0);function T9(e){let t=Z.useContext(w9);if(!e&&t===void 0)throw Error(KN(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 II(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:eF,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}=pL({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,NL(SL,e.nativeEvent))}return II(`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=kU(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),II(`p`,e,{ref:t,props:[{id:c},o]})}),k9=Z.createContext(void 0);function Vve(){let e=Z.useContext(k9);if(e===void 0)throw Error(KN(26));return e}var Hve=`--nested-dialogs`,Uve=`data-nested-dialog-open`,Wve={...$P,...YP,nestedDialogOpen(e){return e?{[Uve]:``}: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`);Vve(),JI({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?Gz(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=II(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...Wz,hidden:!m,onKeyDown(e){V8.has(e.key)&&e.stopPropagation()},style:{[Hve]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Wve});return(0,Q.jsx)(kR,{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)(zL,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(Z8,{ref:i.context.internalBackdropRef,inert:UI(!s)}),e.children]})}):null});function Gve({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=IR(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=WP(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||UP(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)}),WN(()=>(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]),nB(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var M9={...dB,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},Kve=class extends nP{constructor(e,t,n){let r=new iB,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(Xz(this.state,e,t.trigger)))}};function qve(){let e=new iB;return new SU(Object.freeze(N9(void 0,e)),Object.freeze(P9(e)),M9)}function N9(e,t,n,r=!1){return{...aB(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=Kz((e,t)=>new Kve({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`);rB(b,x),eB(b);let{forceUnmount:w}=tB(x,b);Z.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,NL(jL))}),[w,b]);let T=x||S;return(0,Q.jsxs)(w9.Provider,{value:b,children:[u&&(0,Q.jsx)(qz,{handle:u,store:b}),T&&(0,Q.jsx)(Gve,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var I9=XN(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=kU(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),II(`h2`,e,{ref:t,props:[{id:c},o]})});function R9({...e}){return(0,Q.jsx)(I9,{"data-slot":`sheet`,...e})}function Jve({...e}){return(0,Q.jsx)(j9,{"data-slot":`sheet-portal`,...e})}function Yve({className:e,...t}){return(0,Q.jsx)(E9,{"data-slot":`sheet-overlay`,className:$V(`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)(Jve,{children:[(0,Q.jsx)(Yve,{}),(0,Q.jsxs)(A9,{"data-slot":`sheet-content`,"data-side":n,className:$V(`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)(sH,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,Q.jsx)(yU,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function B9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:$V(`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:$V(`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:$V(`text-xs/relaxed text-muted-foreground`,e),...t})}var Xve=`sidebar_state`,Zve=604800,Qve=`16rem`,$ve=`18rem`,eye=`3rem`,tye=`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 nye({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=`${Xve}=${t}; path=/; max-age=${Zve}`},[n,f]),m=Z.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);Z.useEffect(()=>{let e=e=>{e.key===tye&&(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":Qve,"--sidebar-width-icon":eye,...i},className:$V(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function rye({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:$V(`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":$ve},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:$V(`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:$V(`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 iye({className:e,onClick:t,...n}){let{toggleSidebar:r}=W9();return(0,Q.jsxs)(sH,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:$V(e),onClick:e=>{t?.(e),r()},...n,children:[(0,Q.jsx)(rU,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function aye({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:$V(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function oye({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:$V(`relative flex w-full min-w-0 flex-col px-2 py-1`,e),...t})}function sye({className:e,render:t,...n}){return H6({defaultTagName:`div`,props:SI({className:$V(`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 cye({className:e,render:t,...n}){return H6({defaultTagName:`button`,props:SI({className:$V(`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 lye({className:e,...t}){return(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:$V(`flex w-full min-w-0 flex-col gap-px`,e),...t})}function uye({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:$V(`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(KN(47));return t}var dye={...dB,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},fye=class extends nP{constructor(e,t,n){let r=new iB;super(pye(e,r,t,n),mye(r),dye)}setOpen=(e,t)=>{let n=t.reason===vL,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=Zz(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=Xz(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)}),GN.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function pye(e,t,n,r=!1){let i={...aB(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 mye(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new MP,triggerElements:e}}var q9=XN(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=gye(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),rB(u,d),eB(u);let{forceUnmount:m}=tB(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,NL(jL))}),[m,u]);let h=d||f;return(0,Q.jsxs)(G9.Provider,{value:u,children:[s&&(0,Q.jsx)(qz,{handle:s,store:u}),h&&(0,Q.jsx)(_ye,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function hye(e){return K9(!0)?(0,Q.jsx)(q9,{props:e}):(0,Q.jsx)(bR,{children:(0,Q.jsx)(q9,{props:e})})}function gye(e,t){let n=Kz((e,n)=>new fye(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function _ye({store:e,modal:t}){let n=IR(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return nB(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var vye=ZN(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=fB(s)??m;if(!h)throw Error(KN(74));let g=kU(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}=$z(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=TB(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:HB(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=AR(v,{stickIfOpen:T}),A=l5(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=pL({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?QP.open(e):ZP.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=g5(h,x),R=II(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[XI]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),ee=(0,Q.jsx)(Z.Fragment,{children:R},g);return C&&!D?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(lI,{ref:F,onFocus:I}),ee,(0,Q.jsx)(lI,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):ee}),J9=Z.createContext(void 0);function yye(){let e=Z.useContext(J9);if(e===void 0)throw Error(KN(45));return e}var bye=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)(zL,{ref:t,...r})}):null}),Y9=Z.createContext(void 0);function xye(){let e=Z.useContext(Y9);if(!e)throw Error(KN(46));return e}var Sye=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=nL,..._}=e,v=K9(),y=yye(),b=vR(),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=qI(O),P=iV({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`);WN(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I=E===!0&&w!==`trigger-hover`;i5(C&&I,D===`touch`,O,T);let L=v.useStateSetter(`positionerElement`),R=cV(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,Q.jsxs)(Y9.Provider,{value:P,children:[S&&I&&(0,Q.jsx)(Z8,{inert:UI(!C),cutout:T}),(0,Q.jsx)(yR,{id:b,children:R})]})}),Cye=Z.createContext(void 0);function wye(){let[e,t]=Z.useState(0),n=tP(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var Tye=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=K9(),l=xye(),u=I8(!0)!=null,{context:d,hasClosePart:f}=wye(),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`);JI({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),CB(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?Gz(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=II(`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`,...Wz,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&V8.has(e.key)&&e.stopPropagation()}},sV(g),s],stateAttributesMapping:eF});return(0,Q.jsx)(kR,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:lP(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(Cye.Provider,{value:d,children:M})})}),Eye=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=kU(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),II(`h2`,e,{ref:t,props:[{id:s},a]})}),Dye=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=kU(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),II(`p`,e,{ref:t,props:[{id:s},a]})});function X9({...e}){return(0,Q.jsx)(hye,{"data-slot":`popover`,...e})}function Z9({...e}){return(0,Q.jsx)(vye,{"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)(bye,{children:(0,Q.jsx)(Sye,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,Q.jsx)(Tye,{"data-slot":`popover-content`,className:$V(`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 Oye({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`popover-header`,className:$V(`flex flex-col gap-1 text-xs`,e),...t})}function $9({className:e,...t}){return(0,Q.jsx)(Eye,{"data-slot":`popover-title`,className:$V(`text-sm font-medium`,e),...t})}function kye({className:e,...t}){return(0,Q.jsx)(Dye,{"data-slot":`popover-description`,className:$V(`text-muted-foreground`,e),...t})}function Aye(e){let t=(0,lV.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=mN(),{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(Pye),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=sle(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=ile(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=$V(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(Nye),(0,Q.jsx)(sH,{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(Mye)}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(jye),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)(sH,{size:`sm`,variant:`ghost`,onClick:()=>{h(!1),p(!1),f({to:`/settings/$section`,params:{section:`computers`}})},children:`Manage computers`}),t[55]=f,t[56]=p,t[57]=N):N=t[57];let P=o.running||a===0,F;t[58]!==s||t[59]!==i?(F=()=>s(i),t[58]=s,t[59]=i,t[60]=F):F=t[60];let I=o.running?v:`Update all (${a})`,L;t[61]!==P||t[62]!==F||t[63]!==I?(L=(0,Q.jsx)(sH,{size:`sm`,disabled:P,"aria-live":`polite`,onClick:F,children:I}),t[61]=P,t[62]=F,t[63]=I,t[64]=L):L=t[64];let R;t[65]!==N||t[66]!==L?(R=(0,Q.jsxs)(`footer`,{className:`flex items-center justify-between gap-2 border-t pt-3`,children:[N,L]}),t[65]=N,t[66]=L,t[67]=R):R=t[67];let ee;t[68]!==g||t[69]!==M||t[70]!==R||t[71]!==w||t[72]!==T||t[73]!==E||t[74]!==D||t[75]!==O||t[76]!==k?(ee=(0,Q.jsxs)(g,{side:w,align:T,className:E,finalFocus:D,children:[O,k,M,R]}),t[68]=g,t[69]=M,t[70]=R,t[71]=w,t[72]=T,t[73]=E,t[74]=D,t[75]=O,t[76]=k,t[77]=ee):ee=t[77];let z;return t[78]!==_||t[79]!==b||t[80]!==x||t[81]!==ee||t[82]!==A?(z=(0,Q.jsxs)(_,{open:A,onOpenChange:b,children:[x,ee]}),t[78]=_,t[79]=b,t[80]=x,t[81]=ee,t[82]=A,t[83]=z):z=t[83],z}function jye(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:Fye(e)})]},`${e.kind}:${e.id}`)}function Mye(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 Nye(e){return(0,Q.jsxs)(`p`,{className:`wrap-anywhere`,children:[e.name,`: `,e.message]},e.id)}function Pye(e){let{target:t}=e;return F2(t)}function Fye(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 $,hle as $a,EM as $c,due as $i,u_ as $l,_pe as $n,xH as $o,Xde as $r,VN as $s,K6 as $t,D9 as A,f4 as Aa,XM as Ac,zue as Ai,aS as Al,Bpe as An,nW as Ao,Mfe as Ar,uF as As,E8 as At,su as Au,jve as B,kle as Ba,goe as Bc,Y4 as Bi,Kb as Bl,Tpe as Bn,aU as Bo,F3 as Br,BP as Bs,p8 as Bt,Rn as Bu,L9 as C,_4 as Ca,Noe as Cc,ade as Ci,ET as Cl,$pe as Cn,cq as Co,qfe as Cr,UI as Cs,l5 as Ct,kp as Cu,j9 as D,Ble as Da,Aoe as Dc,nde as Di,Bae as Dl,Xpe as Dn,uG as Do,V3 as Dr,lI as Ds,F8 as Dt,Tu as Du,qve as E,Hle as Ea,Moe as Ec,r3 as Ei,dT as El,E6 as En,cG as Eo,U3 as Er,uI as Es,K8 as Et,Ru as Eu,Bve as F,o4 as Fa,Toe as Fc,Pue as Fi,iS as Fl,Ppe as Fn,KU as Fo,rfe as Fr,JP as Fs,v8 as Ft,tr as Fu,Eve as G,i4 as Ga,OM as Gc,N4 as Gi,_ie as Gl,bpe as Gn,UH as Go,ufe as Gr,wP as Gs,t8 as Gt,Zn as Gu,x9 as H,n4 as Ha,_oe as Hc,Cue as Hi,K as Hl,Cpe as Hn,$H as Ho,afe as Hr,NP as Hs,d8 as Ht,qn as Hu,S9 as I,c4 as Ia,VM as Ic,Iue as Ii,fS as Il,Fpe as In,JU as Io,mfe as Ir,qP as Is,_8 as It,$n as Iu,r9 as J,Tle as Ja,kM as Jc,_ue as Ji,Sb as Jl,Spe as Jn,jH as Jo,I3 as Jr,tP as Js,gme as Jt,gve as K,Dle as Ka,zM as Kc,hue as Ki,Jb as Kl,ype as Kn,zH as Ko,ffe as Kr,aP as Ks,e8 as Kt,Fve as L,s4 as La,BM as Lc,Fue as Li,J as Ll,Ape as Ln,kU as Lo,ife as Lr,HP as Ls,g8 as Lt,Vn as Lu,T9 as M,Fle as Ma,Coe as Mc,Rue as Mi,rS as Ml,Rpe as Mn,ZU as Mo,Dfe as Mr,QP as Ms,w8 as Mt,Ql as Mu,C9 as N,d4 as Na,Soe as Nc,Lue as Ni,Zx as Nl,Ipe as Nn,qU as No,yfe as Nr,ZP as Ns,y8 as Nt,Bl as Nu,A9 as O,zle as Oa,tN as Oc,Wue as Oi,gS as Ol,Ype as On,iG as Oo,jfe as Or,sI as Os,P8 as Ot,ine as Ou,Rve as P,Ple as Pa,boe as Pc,Bue as Pi,hS as Pl,jpe as Pn,YU as Po,vfe as Pr,YP as Ps,b8 as Pt,ki as Pu,T7 as Q,gle as Qa,DM as Qc,oue as Qi,W as Ql,n6 as Qn,CH as Qo,qde as Qr,UN as Qs,Y6 as Qt,Ive as R,Nle as Ra,hoe as Rc,Z4 as Ri,Ib as Rl,c6 as Rn,yU as Ro,P3 as Rr,UP as Rs,h8 as Rt,Kn as Ru,V9 as S,Ule as Sa,oN as Sc,tde as Si,zT as Sl,Qpe as Sn,hZ as So,Yfe as Sr,JI as Ss,d5 as St,Df as Su,F9 as T,y4 as Ta,koe as Tc,n3 as Ti,Nae as Tl,T6 as Tn,vG as To,Rfe as Tr,SI as Ts,J8 as Tt,Qu as Tu,Ave as U,Ole as Ua,AM as Uc,L4 as Ui,q as Ul,s6 as Un,ZH as Uo,lfe as Ur,EP as Us,u8 as Ut,In as Uu,kve as V,a4 as Va,LM as Vc,wue as Vi,zb as Vl,Dpe as Vn,tU as Vo,cfe as Vr,MP as Vs,f8 as Vt,zn as Vu,b9 as W,t4 as Wa,loe as Wc,R4 as Wi,Nb as Wl,Epe as Wn,YH as Wo,dfe as Wr,TP as Ws,l8 as Wt,Ln as Wu,i9 as X,J2 as Xa,MM as Xc,O4 as Xi,hx as Xl,t6 as Xn,DH as Xo,Yde as Xr,KN as Xs,Q6 as Xt,Q_e as Y,wle as Ya,doe as Yc,pue as Yi,lie as Yl,i6 as Yn,kH as Yo,Zde as Yr,ZN as Ys,$6 as Yt,a9 as Z,G2 as Za,aoe as Zc,uue as Zi,ix as Zl,a6 as Zn,TH as Zo,Jde as Zr,WN as Zs,W6 as Zt,W9 as _,Jle as _a,pN as _c,ode as _i,WT as _l,j6 as _n,_0 as _o,rpe as _r,cL as _s,Lhe as _t,zp as _u,Oye as a,D4 as aa,NN as ac,fde as ai,KE as al,V6 as an,$ce as ao,$3 as ar,fB as as,p7 as at,Qf as au,H9 as b,Gle as ba,cN as bc,rde as bi,qT as bl,rme as bn,a0 as bo,Jfe as br,XI as bs,y5 as bt,V as bu,rye as c,w4 as ca,ON as cc,lde as ci,ME as cl,dme as cn,_2 as co,ope as cr,AR as cs,H5 as ct,Bf as cu,cye as d,C4 as da,SN as dc,Zue as di,pD as dl,cme as dn,_ce as do,tpe as dr,EL as ds,I5 as dt,H as du,aue as ea,BN as ec,Qde as ei,Vj as el,J6 as en,_le as eo,e6 as er,sH as es,l_e as et,Ug as eu,sye as f,S4 as fa,xN as fc,ede as fi,VE as fl,L6 as fn,X0 as fo,npe as fr,jL as fs,C5 as ft,np as fu,iye as g,Yle as ga,mN as gc,Xue as gi,QT as gl,M6 as gn,x0 as go,Qfe as gr,fL as gs,x5 as gt,Ip as gu,nye as h,$le as ha,Hoe as hc,ide as hi,oD as hl,P6 as hn,P0 as ho,ape as hr,pL as hs,b5 as ht,fp as hu,kye as i,sue as ia,IN as ic,ude as ii,XE as il,B6 as in,U2 as io,fpe as ir,WB as is,E7 as it,vp as iu,E9 as j,u4 as ja,xoe as jc,Uue as ji,eS as jl,Lpe as jn,$U as jo,Afe as jr,oF as js,C8 as jt,ou as ju,O9 as k,Vle as ka,nN as kc,Gue as ki,nS as kl,zpe as kn,rG as ko,Nfe as kr,cI as ks,T8 as kt,cu as ku,aye as l,nue as la,TN as lc,o3 as li,aD as ll,z6 as ln,m2 as lo,cpe as lr,BL as ls,F5 as lt,Gp as lu,uye as m,Qle as ma,Qoe as mc,$ue as mi,rD as ml,sme as mn,Y0 as mo,Y3 as mr,_L as ms,Rhe as mt,$f as mu,X9 as n,fue as na,PN as nc,tfe as ni,JE as nl,q6 as nn,vle as no,gpe as nr,aH as ns,u_e as nt,dm as nu,$9 as o,lue as oa,MN as oc,cde as oi,nD as ol,fme as on,E2 as oo,upe as or,$z as os,f7 as ot,xp as ou,lye as p,x4 as pa,bN as pc,Que as pi,SE as pl,I6 as pn,J0 as po,$fe as pr,gL as ps,v5 as pt,Kf as pu,s9 as q,Ele as qa,foe as qc,gue as qi,uie as ql,xpe as qn,NH as qo,pfe as qr,nP as qs,Z6 as qt,Q9 as r,eue as ra,jN as rc,$de as ri,X as rl,H6 as rn,yle as ro,mpe as rr,$V as rs,D7 as rt,qne as ru,Z9 as s,E4 as sa,sse as sc,dde as si,mD as sl,lme as sn,b2 as so,lpe as sr,Uz as ss,o7 as st,U as su,Aye as t,iue as ta,RN as tc,nfe as ti,dj as tl,U6 as tn,q2 as to,vpe as tr,oH as ts,k7 as tt,Wg as tu,oye as u,cue as ua,CN as uc,pde as ui,kE as ul,R6 as un,$0 as uo,spe as ur,NL as us,L5 as ut,wf as uu,R9 as v,Kle as va,dN as vc,Yue as vi,GT as vl,k6 as vn,h0 as vo,Zfe as vr,iL as vs,S5 as vt,_p as vu,I9 as w,Rle as wa,Poe as wc,i3 as wi,fT as wl,D6 as wn,UK as wo,zfe as wr,II as ws,a5 as wt,Uu as wu,B9 as x,Wle as xa,Loe as xc,Jue as xi,YT as xl,tme as xn,V1 as xo,q3 as xr,eL as xs,h5 as xt,Uf as xu,z9 as y,Xle as ya,lN as yc,sde as yi,UT as yl,O6 as yn,o0 as yo,Xfe as yr,$I as ys,Vhe as yt,B as yu,Mve as z,jle as za,voe as zc,X4 as zi,Gb as zl,wpe as zn,lU as zo,ofe as zr,WP as zs,m8 as zt,Un as zu};