droidsembly 0.0.0-stage → 0.4.0-beta.1

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 (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.it.md +184 -0
  3. package/README.md +184 -3
  4. package/bin/cubefarm.js +297 -0
  5. package/bin/distribution.d.ts +3 -0
  6. package/bin/distribution.js +48 -0
  7. package/dist/THIRD_PARTY_LICENSES.txt +2542 -0
  8. package/dist/assets/AccessibilitySettings-DSmFk9JC.js +30 -0
  9. package/dist/assets/AccessibilitySettings-HrzBDUTN.css +1 -0
  10. package/dist/assets/AppViewer-alNn4TBB.js +5 -0
  11. package/dist/assets/Balloon-UTs7npGo.js +1 -0
  12. package/dist/assets/Batched-BOgjreKO.js +45 -0
  13. package/dist/assets/Birds-BA2HM-AD.js +1 -0
  14. package/dist/assets/Blimp-CTykuz6B.js +1 -0
  15. package/dist/assets/BufferGeometryUtils-BsmWvcA2.js +1 -0
  16. package/dist/assets/Duck-DH63jUrP.js +1 -0
  17. package/dist/assets/Effects-CNyhhFkE.js +65 -0
  18. package/dist/assets/Fireworks-CJfDJOeb.js +33 -0
  19. package/dist/assets/Helicopter-CW_SP7xP.js +1 -0
  20. package/dist/assets/Hurricane-9WqZGyZg.js +33 -0
  21. package/dist/assets/Kaiju-SpSi_jBg.js +1 -0
  22. package/dist/assets/Meteors-DvjhLfbF.js +1 -0
  23. package/dist/assets/MissionConsole-BEP5CdC8.js +1 -0
  24. package/dist/assets/Office-BBnd6tyn.js +563 -0
  25. package/dist/assets/Office-DMOP02gg.css +1 -0
  26. package/dist/assets/PhotoPanel-DehErnsv.js +1 -0
  27. package/dist/assets/PhotoPanel-v4ANHBsO.css +1 -0
  28. package/dist/assets/PhotoScene-Ce-dzToM.js +115 -0
  29. package/dist/assets/Plane-0nfvzL_c.js +1 -0
  30. package/dist/assets/Pocket-CBoyL0ra.js +2 -0
  31. package/dist/assets/Rainbow-CdcWsmW8.js +28 -0
  32. package/dist/assets/Roof-mkMKniSZ.js +34 -0
  33. package/dist/assets/Shell-BmnZn4UL.js +13 -0
  34. package/dist/assets/Skywriting-06dZPAfg.js +1 -0
  35. package/dist/assets/TerminalView-BrP-ENHg.css +1 -0
  36. package/dist/assets/TerminalView-wlhSixSH.js +17 -0
  37. package/dist/assets/ToyWorld-Cuu9aW-K.js +1 -0
  38. package/dist/assets/Ufo-iHaoe5t1.js +1 -0
  39. package/dist/assets/Whale-DZg88zIX.js +1 -0
  40. package/dist/assets/all-CYErCTCA.js +11 -0
  41. package/dist/assets/billboardLayout-DSKGXPIM.js +1 -0
  42. package/dist/assets/bloomMarks-DariC6lY.js +4231 -0
  43. package/dist/assets/cheerRules-CZGSrxOB.js +1 -0
  44. package/dist/assets/cityLayout-7ckfe3wf.js +1 -0
  45. package/dist/assets/director-CrzFgnoP.js +1 -0
  46. package/dist/assets/dogState-DiOvoobI.js +1 -0
  47. package/dist/assets/doors-BHKj8tkO.js +1 -0
  48. package/dist/assets/gallery-ColCPQQE.js +1 -0
  49. package/dist/assets/gate-BplJKcLG.js +2 -0
  50. package/dist/assets/index-B6qvKFYN.js +10 -0
  51. package/dist/assets/index-COpmc42S.css +1 -0
  52. package/dist/assets/instantReplay-DGiLgvkQ.js +1 -0
  53. package/dist/assets/interact-0qw7BGhL.js +1 -0
  54. package/dist/assets/jsx-runtime-BFUkm7bt.js +1 -0
  55. package/dist/assets/jukeboxSongs-CjbAzAeb.js +1 -0
  56. package/dist/assets/kit-C6ByUQ-Y.js +2 -0
  57. package/dist/assets/mic-B316hcCe.js +1 -0
  58. package/dist/assets/news-CrPol-gz.js +1 -0
  59. package/dist/assets/paint.worker-D95XJ3xX.js +1 -0
  60. package/dist/assets/photoMode-CYxQfgUF.js +1 -0
  61. package/dist/assets/pipeline-BOTOZ69L.js +1215 -0
  62. package/dist/assets/rapier-CXAOW8OC.js +1 -0
  63. package/dist/assets/rig-wAyl3G1G.js +1 -0
  64. package/dist/assets/speechLanguage-BtfdhZNI.js +1 -0
  65. package/dist/assets/store-FA83kfnc.js +5 -0
  66. package/dist/assets/useDayTime-0XsqM14Q.js +1 -0
  67. package/dist/assets/useGraphics-Cif18p7Q.js +1 -0
  68. package/dist/assets/voiceMessages-DtNmUazr.js +1 -0
  69. package/dist/assets/weatherState-ExG1doW-.js +1 -0
  70. package/dist/icons/Sora-OFL.txt +93 -0
  71. package/dist/icons/apple-touch-icon.png +0 -0
  72. package/dist/icons/badge-96.png +0 -0
  73. package/dist/icons/badge.svg +1 -0
  74. package/dist/icons/droid-antenna.svg +29 -0
  75. package/dist/icons/droid-eyes.svg +29 -0
  76. package/dist/icons/droid-shell.svg +29 -0
  77. package/dist/icons/droid-spark.svg +29 -0
  78. package/dist/icons/droid-wire.svg +29 -0
  79. package/dist/icons/favicon-16.png +0 -0
  80. package/dist/icons/favicon-32.png +0 -0
  81. package/dist/icons/favicon.svg +1 -0
  82. package/dist/icons/icon-192.png +0 -0
  83. package/dist/icons/icon-512.png +0 -0
  84. package/dist/icons/icon-maskable-512.png +0 -0
  85. package/dist/icons/icon.svg +29 -0
  86. package/dist/icons/logo-dark.svg +29 -0
  87. package/dist/icons/logo-light.svg +29 -0
  88. package/dist/icons/sora-400.ttf +0 -0
  89. package/dist/icons/sora-700.ttf +0 -0
  90. package/dist/index.html +26 -0
  91. package/dist/manifest.webmanifest +19 -0
  92. package/dist/third-party-licenses.json +1106 -0
  93. package/dist-server/browser-init.js +24 -0
  94. package/dist-server/index.js +20049 -0
  95. package/dist-server/index.js.map +7 -0
  96. package/dist-server/ptyHost.js +234 -0
  97. package/dist-server/ptyHost.js.map +7 -0
  98. package/package.json +98 -6
@@ -0,0 +1,30 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/voiceMessages-DtNmUazr.js","assets/store-FA83kfnc.js","assets/jsx-runtime-BFUkm7bt.js","assets/index-B6qvKFYN.js","assets/index-COpmc42S.css","assets/mic-B316hcCe.js","assets/jukeboxSongs-CjbAzAeb.js","assets/speechLanguage-BtfdhZNI.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,c as t,l as n,s as r,t as i,u as a}from"./jsx-runtime-BFUkm7bt.js";import{As as o,Do as s,Ds as c,Es as l,Li as u,Ms as d,Os as f,Ts as p,a as m,as as h,bi as g,d as _,ea as v,fs as y,hs as b,i as x,js as S,kt as C,m as w,p as T,pt as E,qt as ee,r as D,s as te,t as ne,ts as re,zo as ie}from"./store-FA83kfnc.js";import{C as O,D as ae,E as oe,T as se,b as ce,c as k,i as le,l as ue,n as de,o as A,p as fe,r as pe,s as j,t as me,u as he,w as ge,x as _e}from"./index-B6qvKFYN.js";import{I as ve,K as ye,L as be,d as xe,i as Se,j as Ce,l as we,n as Te,o as Ee,r as De,s as Oe,t as ke,u as Ae}from"./mic-B316hcCe.js";var M=a(r(),1),N=i(),je=[`halloween`,`christmas`,`newyear`,`valentines`,`easter`,`birthday`],Me=e=>typeof e==`string`&&je.includes(e),Ne={mode:`auto`,disabled:[],birthday:null},Pe={halloween:{name:`Halloween`,emoji:`🎃`,when:`24–31 Oct`},christmas:{name:`Christmas`,emoji:`🎄`,when:`1–26 Dec`},newyear:{name:`New Year's Eve`,emoji:`🎆`,when:`31 Dec–1 Jan`},valentines:{name:`Valentine's Day`,emoji:`💘`,when:`12–14 Feb`},easter:{name:`Easter`,emoji:`🐣`,when:`Good Friday to Easter Monday`},birthday:{name:`Your birthday`,emoji:`🎂`,when:`on the day you set`}};function Fe(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function Ie(e){let t=e%19,n=Math.floor(e/100),r=e%100,i=Math.floor(n/4),a=n%4,o=Math.floor((n+8)/25),s=Math.floor((n-o+1)/3),c=(19*t+n-i-s+15)%30,l=Math.floor(r/4),u=r%4,d=(32+2*a+2*l-c-u)%7,f=Math.floor((t+11*c+22*d)/451),p=c+d-7*f+114;return{month:Math.floor(p/31),day:p%31+1}}var Le=e=>e%4==0&&e%100!=0||e%400==0,Re=(e,t,n)=>Math.floor(Date.UTC(e,t-1,n)/864e5);function ze(e,t,n=null){let r=t.getFullYear(),i=t.getMonth()+1,a=t.getDate(),o=i*100+a;switch(e){case`halloween`:return o>=1024&&o<=1031;case`christmas`:return o>=1201&&o<=1226;case`newyear`:return o===1231||o===101;case`valentines`:return o>=212&&o<=214;case`easter`:{let e=Ie(r),t=Re(r,i,a)-Re(r,e.month,e.day);return t>=-2&&t<=1}case`birthday`:{if(!n)return!1;let e=n.month===2&&n.day===29&&!Le(r)?28:n.day;return i===n.month&&a===e}}}function Be(e,t){let n=n=>!t.disabled.includes(n)&&ze(n,e,t.birthday);return n(`birthday`)?`birthday`:je.find(e=>e!==`birthday`&&n(e))??null}function Ve(e){let t=new URLSearchParams(e).get(`theme`)?.trim().toLowerCase();return t===`auto`||t===`off`||Me(t)?t:null}function He(e){let t=new URLSearchParams(e).get(`date`)?.trim();if(!t)return null;let n=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/.exec(t);if(!n)return null;let[r,i,a,o=`12`,s=`0`,c=`0`]=n.slice(1),l=new Date(Number(r),Number(i)-1,Number(a),Number(o),Number(s),Number(c));return l.getMonth()===Number(i)-1&&l.getDate()===Number(a)?l.getTime():null}function Ue(e,t,n=null){let r=n??t.mode,i=n&&n!==`auto`?`url`:r===`off`?`off`:r===`auto`?`auto`:`forced`;return r===`off`?{id:null,source:i}:r===`auto`?{id:Be(e,t),source:`auto`}:{id:r,source:i}}var We=[`crop`,`long`,`ponytail`,`bun`,`quiff`,`afro`,`sidePart`,`buzz`,`bald`,`curls`,`bob`,`mohawk`,`locs`],Ge=[`none`,`stubble`,`beard`,`moustache`],Ke=[`none`,`round`,`square`],qe=[`none`,`beanie`,`cap`],Je=[`tee`,`hoodie`,`stripe`,`sweater`,`cardigan`,`turtleneck`],Ye=[`slim`,`average`,`broad`],Xe=[`#ffffff`,`#ffd166`,`#ef476f`,`#06d6a0`,`#118ab2`,`#2b2d42`],Ze={slim:{width:.88,depth:.92},average:{width:1,depth:1},broad:{width:1.15,depth:1.1}},Qe=[`quiff`,`afro`,`bun`,`curls`,`mohawk`],$e={feminine:[[`long`,4],[`ponytail`,3],[`bun`,3],[`curls`,2],[`afro`,2],[`sidePart`,2],[`buzz`,1]],masculine:[[`crop`,2],[`quiff`,3],[`sidePart`,3],[`buzz`,2],[`bald`,2],[`curls`,2],[`afro`,2],[`long`,1],[`ponytail`,1],[`bun`,1]]},et={feminine:[[`bob`,3],[`locs`,2],[`mohawk`,1]],masculine:[[`locs`,2],[`mohawk`,2],[`bob`,1]]},tt=.22,nt=.3;function rt(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function it(e){let t=e;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function at(e,t){let n=e*t.reduce((e,[,t])=>e+t,0);for(let[e,r]of t)if((n-=r)<0)return e;return t[t.length-1][0]}function ot(e){let t=it(rt(e.id)),[n,r,i,a,o,s,c,l,u,d,f,p]=Array.from({length:12},t),m=e.role!==`ceo`,h=e.look===`masculine`,g=e.role!==`ceo`&&f<tt?at(n,et[e.look]):at(n,$e[e.look]),_=h?at(r,[[`none`,5],[`stubble`,2],[`beard`,2],[`moustache`,1]]):`none`,v=at(i,[[`none`,6],[`round`,2],[`square`,2]]),y=m&&g!==`afro`&&g!==`mohawk`&&a<.3;return{hair:g,facialHair:_,glasses:v,headphones:y,headwear:m&&!y&&!Qe.includes(g)?at(o,[[`none`,7],[`beanie`,1],[`cap`,1]]):`none`,outfit:m?p<nt?at(s,[[`cardigan`,1],[`turtleneck`,1]]):at(s,[[`tee`,1],[`hoodie`,1],[`stripe`,1],[`sweater`,1]]):`tee`,height:+(.9+c*.2).toFixed(3),shoulders:+(.95+l*.1).toFixed(3),build:at(d,[[`slim`,1],[`average`,2],[`broad`,1]]),accent:Math.floor(u*Xe.length),hairColor:e.hair??`#2b2118`,skin:e.skin??`#f1c27d`}}function st(e){let t=ot(e),n=e.style;if(!n)return t;let r=n.hair??t.hair,i=Qe.includes(r)?`none`:n.headwear??t.headwear;return{...t,hair:r,facialHair:n.facialHair??t.facialHair,glasses:n.glasses??t.glasses,headphones:t.headphones&&i===`none`&&r!==`afro`&&r!==`mohawk`,headwear:i,outfit:e.role===`ceo`?`tee`:n.outfit??t.outfit,build:n.build??t.build,accent:n.accent??t.accent,hairColor:n.hairColor??t.hairColor,skin:n.skin??t.skin}}var ct={halloween:{id:`halloween`,decor:[{slots:`desk-*`,item:`jackOLantern`},{slots:`reception-w`,item:`jackOLantern`},{slots:`reception-e`,item:`candyBowl`},{slots:`balcony-*`,item:`bigPumpkin`},{slots:`corner-*`,item:`cobweb`},{slots:`elevator-e`,item:`broom`},{slots:`lobby-feature`,item:`gravestone`},{slots:`patio`,item:`inflatablePumpkin`}],lights:[`#ff7b00`,`#9d4edd`],tint:{color:`#b48cff`,amount:.12},sky:{color:`#5a189a`,amount:.45,fog:.35},costumes:{agent:[`witchHat`,`pumpkinHead`,`vampire`,`ghost`,`catEars`,`skeleton`],ceo:[`crown`]},playlist:[`haunted-hotfix`,`monster-merge`],confetti:{colors:[`#ff7b00`,`#ff9e1f`,`#7b2cbf`,`#9d4edd`,`#1b1b1f`,`#2b2d42`],shape:`paper`}},christmas:{id:`christmas`,decor:[{slots:`lobby-feature`,item:`tree`},{slots:`reception-w`,item:`snowman`},{slots:`elevator-w`,item:`snowman`,kind:`lobby`}],lights:[`#ff3b3b`,`#2dc653`,`#ffd23f`,`#4cc9f0`],garland:!0,tint:{color:`#ffd6a0`,amount:.1},sky:{color:`#c8d7ff`,amount:.2,fog:.2},costumes:{agent:[`santaHat`,`antlers`,`uglySweater`],ceo:[`santaHat`]},playlist:[`snowed-in-standup`,`cocoa-and-code`],confetti:{colors:[`#e63946`,`#2a9d8f`,`#ffd166`,`#ffffff`,`#52b788`],shape:`paper`}},newyear:{id:`newyear`,decor:[{slots:`reception-w`,item:`champagne`},{slots:`reception-e`,item:`champagne`}],lights:[`#ffd23f`,`#f8f9fa`,`#c0c0ff`],bunting:[`#ffd23f`,`#1b1b3a`,`#f8f9fa`,`#c77dff`],tint:{color:`#ffe8b0`,amount:.08},sky:{color:`#1b1b4a`,amount:.25,fog:0},costumes:{agent:[`partyHat`],ceo:[`crown`]},playlist:[`countdown-commit`],confetti:{colors:[`#ffd23f`,`#f8f9fa`,`#c0c0c0`,`#c77dff`,`#4cc9f0`],shape:`paper`}},valentines:{id:`valentines`,decor:[{slots:`desk-*`,item:`heartBalloon`},{slots:`reception-*`,item:`heartBalloon`}],lights:[`#ff4d6d`,`#ff8fab`,`#c9184a`],tint:{color:`#ff9eb5`,amount:.12},costumes:{agent:[`heartBoppers`],ceo:[`crown`]},playlist:[`pair-programming`],confetti:{colors:[`#ff4d6d`,`#ff8fab`,`#c9184a`,`#ffccd5`,`#ffffff`],shape:`heart`}},easter:{id:`easter`,decor:[{slots:`reception-w`,item:`eggBasket`},{slots:`elevator-e`,item:`eggBasket`},{slots:`cabinet-top`,item:`goldenEgg`}],lights:null,bunting:[`#ffc8dd`,`#bde0fe`,`#caffbf`,`#fdffb6`,`#e4c1f9`],tint:{color:`#e9ffd6`,amount:.08},costumes:{agent:[`bunnyEars`],ceo:[`bunnyEars`]},playlist:[`egg-hunt-hop`],confetti:{colors:[`#ffc8dd`,`#bde0fe`,`#caffbf`,`#fdffb6`,`#e4c1f9`],shape:`paper`}},birthday:{id:`birthday`,decor:[{slots:`banner`,item:`banner`},{slots:`reception-*`,item:`balloons`},{slots:`elevator-*`,item:`balloons`},{slots:`desk-*`,item:`balloons`},{slots:`manager-desk`,item:`cake`}],lights:[`#ffd23f`,`#ff5d8f`,`#3a86ff`,`#06d6a0`],bunting:[`#ff5d8f`,`#ffd23f`,`#3bceac`,`#3a86ff`,`#9b5de5`],tint:{color:`#fff0c2`,amount:.06},costumes:{agent:[`partyHat`],ceo:[`partyHat`]},playlist:[`another-year-of-uptime`],confetti:{colors:[`#ff5d8f`,`#ffd23f`,`#3bceac`,`#3a86ff`,`#ff8c42`,`#9b5de5`],shape:`paper`}}},lt=(e,t)=>e.endsWith(`*`)?t.startsWith(e.slice(0,-1)):t===e;function ut(e,t){if(!e)return[];let n=ct[e].decor,r=[];for(let e of s(t)){let i=n.find(n=>(!n.kind||n.kind===t)&&lt(n.slots,e.id));i&&r.push({slot:e,item:i.item})}return r}var dt={bigPumpkin:{w:.55,d:.55,h:.45},broom:{w:.35,d:.3,h:1.3},gravestone:{w:1,d:.5,h:1.25},inflatablePumpkin:{w:1.7,d:1.7,h:1.6},tree:{w:2.6,d:2.6,h:3.2},snowman:{w:.7,d:.7,h:1.3},balloons:{w:.45,d:.45,h:.3},eggBasket:{w:.5,d:.5,h:.4}};function ft(e,t){return ut(e,t).flatMap(({slot:e,item:t})=>{let n=dt[t];if(!e.floor||!n)return[];let r=Math.abs(Math.sin(e.rotY))>.7;return[ie(e.x,e.z,r?n.d:n.w,r?n.w:n.d,n.h)]})}function pt(e,t){if(!e)return null;let n=ct[e].costumes[t.role];return n.length?n[rt(`${e}:${t.id}`)%n.length]:null}var mt=typeof window<`u`?window.location.search:``,ht=Ve(mt),gt=(()=>{let e=He(mt);return e===null?0:e-Date.now()})(),_t=()=>Date.now()+gt;function vt(){let e=new Date(_t());return{...Ue(e,T.getState().settings.themes??Ne,ht),day:Fe(e)}}var yt=e(()=>vt());function bt(){let e=vt(),t=yt.getState();(e.id!==t.id||e.source!==t.source||e.day!==t.day)&&yt.setState(e)}T.subscribe((e,t)=>{e.settings.themes!==t.settings.themes&&bt()}),typeof window<`u`&&setInterval(bt,5e3);var xt=()=>{let e=yt.getState().id;return e?ct[e].playlist:[]},St=()=>yt(e=>e.id?ct[e.id].confetti:void 0),Ct=e(()=>({costume:null,act:null,status:null}));function wt(e){Ct.getState().act?.(e)}var Tt=new Map;function Et(e){let t=Object.keys(e);for(let n of t)Tt.set(n,e[n]);return()=>t.forEach(t=>Tt.get(t)===e[t]&&Tt.delete(t))}var Dt=null,Ot=null,kt=e=>void(Ot=e);function At(){let e={calls:0,meshes:0,instances:0,lines:0,points:0};return Ot?.traverseVisible(t=>{let n=t;n.isInstancedMesh&&(e.instances+=n.count??0),n.isMesh&&e.meshes++,n.isLine&&e.lines++,n.isPoints&&e.points++,(n.isMesh||n.isLine||n.isPoints)&&e.calls++}),e}function jt(e){Dt=e}typeof window<`u`&&!Object.getOwnPropertyDescriptor(window,`__swarmTheme`)&&Object.defineProperty(window,"__swarmTheme",{value:{get id(){return yt.getState().id},get source(){return yt.getState().source},get day(){return yt.getState().day},get now(){return new Date(_t()).toString()},get override(){return ht},get placed(){let e=yt.getState().id;return!Dt||!e||Dt.kind===`roof`?[]:ut(e,Dt.kind).map(({slot:e,item:t})=>({slot:e.id,item:t,x:e.x,y:e.y,z:e.z}))},get floor(){return Dt},get drawn(){return At()},get confetti(){let e=yt.getState().id;return e?ct[e].confetti??null:null},get calls(){return[...Tt.keys()]},set(e){ht=e,bt()},setDate(e){let t=e?He(`?date=${encodeURIComponent(e)}`):null;return gt=t===null?0:t-Date.now(),bt(),new Date(_t()).toString()},call(e,...t){let n=Tt.get(e);if(!n)throw Error(`no theme call "${e}" (have: ${[...Tt.keys()].join(`, `)||`none`})`);return n(...t)}},enumerable:!1});function Mt(e,t){let n=e.split(`#`)[0];return n?n+(t?`#${t}`:``):``}function Nt(e,t,n=``){let r=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>(!n||e.provider===n)&&r.every(t=>`${e.id} ${e.name}`.toLowerCase().includes(t)))}function Pt({value:e,onSelect:t,agent:n,repo:r,disabled:i,inherited:a}){let[o,s]=(0,M.useState)(!1);return(0,N.jsxs)(`span`,{style:{display:`inline-block`,maxWidth:`100%`},children:[(0,N.jsx)(`button`,{type:`button`,className:`btn btn-small`,disabled:i,"aria-expanded":o,onClick:()=>s(!o),children:(0,N.jsx)(A,{children:`Browse OpenCode models`})}),(0,N.jsxs)(`span`,{className:`muted small`,style:{display:`block`,overflowWrap:`anywhere`},children:[(0,N.jsx)(A,{children:`Selected:`}),` `,e||a||(0,N.jsx)(A,{children:`OpenCode default`})]}),o&&(0,N.jsx)(Ft,{value:e,agent:n,repo:r,inherited:a,onSelect:e=>{t(e),s(!1)}},`${n}:${r}`)]})}function Ft({value:e,onSelect:t,agent:n,repo:r,inherited:i}){let a=(0,M.useId)(),o=j(),[s,c]=(0,M.useState)(null),[l,u]=(0,M.useState)(``),[d,f]=(0,M.useState)(0),[p,m]=(0,M.useState)(!0),[h,g]=(0,M.useState)(``),[_,v]=(0,M.useState)(``),[y,b]=(0,M.useState)(e.split(`#`)[0]),[x,S]=(0,M.useState)(e.split(`#`)[1]??``);(0,M.useEffect)(()=>{let e=!0;return m(!0),u(``),k.openCodeModels({...n?{agent:n}:{},...r?{repo:r}:{}},d>0).then(t=>{e&&c(t)}).catch(t=>{e&&u(t instanceof Error?t.message:`Could not load models`)}).finally(()=>{e&&m(!1)}),()=>{e=!1}},[n,r,d]);let C=(0,M.useMemo)(()=>Nt(s?.models??[],h,_),[s,h,_]),w=s?.models.find(e=>e.id===y),T=[...new Set(s?.models.map(e=>e.provider))];return(0,N.jsxs)(`span`,{className:`card`,style:{display:`block`,marginTop:8,minWidth:220},children:[(0,N.jsx)(`span`,{className:`muted small`,style:{display:`block`},children:(0,N.jsx)(A,{children:`Choose a model and variant, then press “Use model” to save. Changes apply to the next task. Manual entry remains available.`})}),s&&(0,N.jsxs)(`span`,{className:`muted small`,style:{display:`block`,overflowWrap:`anywhere`},children:[`Project: `,s.directory]}),(0,N.jsx)(`button`,{type:`button`,className:`btn btn-small`,onClick:()=>t(``),children:i?`Office default (${i})`:`OpenCode default${s?.defaultModel?` (${s.defaultModel})`:``}`}),(0,N.jsx)(`button`,{type:`button`,className:`btn btn-small`,disabled:p,onClick:()=>f(e=>e+1),children:(0,N.jsx)(A,{children:`Refresh`})}),p&&(0,N.jsx)(`span`,{role:`status`,children:(0,N.jsx)(A,{children:`Loading models…`})}),l&&(0,N.jsx)(`span`,{role:`alert`,children:l}),s&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`field`,children:(0,N.jsx)(A,{children:`Search models`})}),(0,N.jsx)(`input`,{id:`${a}-search`,"aria-label":o(`Search OpenCode models`),value:h,onChange:e=>g(e.target.value)}),(0,N.jsx)(`span`,{className:`field`,children:(0,N.jsx)(A,{children:`Provider`})}),(0,N.jsxs)(`select`,{id:`${a}-provider`,"aria-label":o(`OpenCode provider`),value:_,onChange:e=>v(e.target.value),children:[(0,N.jsx)(`option`,{value:``,children:o(`All providers`)}),T.map(e=>(0,N.jsx)(`option`,{children:e},e))]}),(0,N.jsx)(`span`,{className:`field`,children:o(`Available models ({count})`,{count:C.length})}),(0,N.jsxs)(`select`,{id:`${a}-model`,"aria-label":o(`Available OpenCode models`),value:C.some(e=>e.id===y)?y:``,onChange:e=>{b(e.target.value),S(``)},children:[(0,N.jsx)(`option`,{value:``,children:o(`Select a model`)}),C.map(e=>(0,N.jsxs)(`option`,{value:e.id,disabled:!e.tools,children:[e.name,` — `,e.id,e.tools?``:` (no tools)`]},e.id))]}),!C.length&&(0,N.jsx)(`span`,{role:`status`,children:(0,N.jsx)(A,{children:`No matching models.`})}),(0,N.jsx)(`span`,{className:`field`,children:(0,N.jsx)(A,{children:`Variant`})}),(0,N.jsxs)(`select`,{id:`${a}-variant`,"aria-label":o(`OpenCode variant`),value:x,disabled:!w?.variants.length,onChange:e=>S(e.target.value),children:[(0,N.jsx)(`option`,{value:``,children:o(`Model default`)}),w?.variants.map(e=>(0,N.jsx)(`option`,{children:e},e))]}),(0,N.jsx)(`button`,{type:`button`,className:`btn btn-small`,disabled:p||!w?.tools||!C.some(e=>e.id===y)||!!x&&!w.variants.includes(x),onClick:()=>t(y+(x?`#${x}`:``)),children:(0,N.jsx)(A,{children:`Use model`})})]})]})}function It({value:e,inherited:t,agent:n,repo:r,onSelect:i,id:a,style:o,disabled:s}){let[c,l]=(0,M.useState)(null),[u,d]=(0,M.useState)(``);(0,M.useEffect)(()=>{let e=!0;return k.openCodeModels({...n?{agent:n}:{},...r?{repo:r}:{}}).then(t=>{e&&(l(t),d(``))}).catch(()=>{e&&d(`Could not load variants; use Browse OpenCode models to refresh or enter #variant manually.`)}),()=>{e=!1}},[n,r]);let f=e||t||c?.defaultModel||``,[p,m=``]=f.split(`#`),h=c?.models.find(e=>e.id===p)?.variants??[];return(0,N.jsxs)(`select`,{id:a,"aria-label":a?void 0:`OpenCode variant`,style:o,value:m,disabled:s||!h.length,title:u||(h.length?`OpenCode reasoning variant; applies to the next task`:c?`No variants available for this model; manual #variant entry remains available`:`Loading OpenCode variants…`),onChange:e=>i(Mt(f,e.target.value)),children:[(0,N.jsx)(`option`,{value:``,children:c?`model default`:`loading variants…`}),m&&!h.includes(m)&&(0,N.jsx)(`option`,{value:m,children:m}),h.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]})}function Lt(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Rt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bt={};function Vt(e,t){return((t||Bt).jsx?zt:Rt).test(e)}var Ht=/[ \t\n\f\r]/g;function Ut(e){return typeof e==`object`?e.type===`text`&&Wt(e.value):Wt(e)}function Wt(e){return e.replace(Ht,``)===``}var Gt=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Gt.prototype.normal={},Gt.prototype.property={},Gt.prototype.space=void 0;function Kt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Gt(n,r,t)}function qt(e){return e.toLowerCase()}var P=class{constructor(e,t){this.attribute=t,this.property=e}};P.prototype.attribute=``,P.prototype.booleanish=!1,P.prototype.boolean=!1,P.prototype.commaOrSpaceSeparated=!1,P.prototype.commaSeparated=!1,P.prototype.defined=!1,P.prototype.mustUseProperty=!1,P.prototype.number=!1,P.prototype.overloadedBoolean=!1,P.prototype.property=``,P.prototype.spaceSeparated=!1,P.prototype.space=void 0;var Jt=n({boolean:()=>F,booleanish:()=>I,commaOrSpaceSeparated:()=>Qt,commaSeparated:()=>Zt,number:()=>L,overloadedBoolean:()=>Xt,spaceSeparated:()=>R}),Yt=0,F=$t(),I=$t(),Xt=$t(),L=$t(),R=$t(),Zt=$t(),Qt=$t();function $t(){return 2**++Yt}var en=Object.keys(Jt),tn=class extends P{constructor(e,t,n,r){let i=-1;if(super(e,t),nn(this,`space`,r),typeof n==`number`)for(;++i<en.length;){let e=en[i];nn(this,en[i],(n&Jt[e])===Jt[e])}}};tn.prototype.defined=!0;function nn(e,t,n){n&&(e[t]=n)}function rn(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new tn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[qt(r)]=r,n[qt(a.attribute)]=r}return new Gt(t,n,e.space)}var an=rn({properties:{ariaActiveDescendant:null,ariaAtomic:I,ariaAutoComplete:null,ariaBusy:I,ariaChecked:I,ariaColCount:L,ariaColIndex:L,ariaColSpan:L,ariaControls:R,ariaCurrent:null,ariaDescribedBy:R,ariaDetails:null,ariaDisabled:I,ariaDropEffect:R,ariaErrorMessage:null,ariaExpanded:I,ariaFlowTo:R,ariaGrabbed:I,ariaHasPopup:null,ariaHidden:I,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:R,ariaLevel:L,ariaLive:null,ariaModal:I,ariaMultiLine:I,ariaMultiSelectable:I,ariaOrientation:null,ariaOwns:R,ariaPlaceholder:null,ariaPosInSet:L,ariaPressed:I,ariaReadOnly:I,ariaRelevant:null,ariaRequired:I,ariaRoleDescription:R,ariaRowCount:L,ariaRowIndex:L,ariaRowSpan:L,ariaSelected:I,ariaSetSize:L,ariaSort:null,ariaValueMax:L,ariaValueMin:L,ariaValueNow:L,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function on(e,t){return t in e?e[t]:t}function sn(e,t){return on(e,t.toLowerCase())}var cn=rn({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Zt,acceptCharset:R,accessKey:R,action:null,allow:null,allowFullScreen:F,allowPaymentRequest:F,allowUserMedia:F,alpha:F,alt:null,as:null,async:F,autoCapitalize:null,autoComplete:R,autoFocus:F,autoPlay:F,blocking:R,capture:null,charSet:null,checked:F,cite:null,className:R,closedBy:null,colorSpace:null,cols:L,colSpan:L,command:null,commandFor:null,content:null,contentEditable:I,controls:F,controlsList:R,coords:L|Zt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:F,defer:F,dir:null,dirName:null,disabled:F,download:Xt,draggable:I,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:F,formTarget:null,headers:R,height:L,hidden:Xt,high:L,href:null,hrefLang:null,htmlFor:R,httpEquiv:R,id:null,imageSizes:null,imageSrcSet:null,inert:F,inputMode:null,integrity:null,is:null,isMap:F,itemId:null,itemProp:R,itemRef:R,itemScope:F,itemType:R,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:F,low:L,manifest:null,max:null,maxLength:L,media:null,method:null,min:null,minLength:L,multiple:F,muted:F,name:null,nonce:null,noModule:F,noValidate:F,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:F,optimum:L,pattern:null,ping:R,placeholder:null,playsInline:F,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:F,referrerPolicy:null,rel:R,required:F,reversed:F,rows:L,rowSpan:L,sandbox:R,scope:null,scoped:F,seamless:F,selected:F,shadowRootClonable:F,shadowRootCustomElementRegistry:F,shadowRootDelegatesFocus:F,shadowRootMode:null,shadowRootSerializable:F,shape:null,size:L,sizes:null,slot:null,span:L,spellCheck:I,src:null,srcDoc:null,srcLang:null,srcSet:null,start:L,step:null,style:null,tabIndex:L,target:null,title:null,translate:null,type:null,typeMustMatch:F,useMap:null,value:I,width:L,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:R,axis:null,background:null,bgColor:null,border:L,borderColor:null,bottomMargin:L,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:F,declare:F,event:null,face:null,frame:null,frameBorder:null,hSpace:L,leftMargin:L,link:null,longDesc:null,lowSrc:null,marginHeight:L,marginWidth:L,noResize:F,noHref:F,noShade:F,noWrap:F,object:null,profile:null,prompt:null,rev:null,rightMargin:L,rules:null,scheme:null,scrolling:I,standby:null,summary:null,text:null,topMargin:L,valueType:null,version:null,vAlign:null,vLink:null,vSpace:L,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:F,disablePictureInPicture:F,disableRemotePlayback:F,exportParts:Zt,part:R,prefix:null,property:null,results:L,security:null,unselectable:null},space:`html`,transform:sn}),ln=rn({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Qt,accentHeight:L,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:L,amplitude:L,arabicForm:null,ascent:L,attributeName:null,attributeType:null,azimuth:L,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:L,by:null,calcMode:null,capHeight:L,className:R,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:L,diffuseConstant:L,direction:null,display:null,dur:null,divisor:L,dominantBaseline:null,download:F,dx:null,dy:null,edgeMode:null,editable:null,elevation:L,enableBackground:null,end:null,event:null,exponent:L,externalResourcesRequired:null,fill:null,fillOpacity:L,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Zt,g2:Zt,glyphName:Zt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:L,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:L,horizOriginX:L,horizOriginY:L,id:null,ideographic:L,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:L,k:L,k1:L,k2:L,k3:L,k4:L,kernelMatrix:Qt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:L,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:L,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:L,overlineThickness:L,paintOrder:null,panose1:null,path:null,pathLength:L,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:R,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:L,pointsAtY:L,pointsAtZ:L,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qt,rev:Qt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qt,requiredFeatures:Qt,requiredFonts:Qt,requiredFormats:Qt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:L,specularExponent:L,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:L,strikethroughThickness:L,string:null,stroke:null,strokeDashArray:Qt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:L,strokeOpacity:L,strokeWidth:null,style:null,surfaceScale:L,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qt,tabIndex:L,tableValues:null,target:null,targetX:L,targetY:L,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:L,underlineThickness:L,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:L,values:null,vAlphabetic:L,vMathematical:L,vectorEffect:null,vHanging:L,vIdeographic:L,version:null,vertAdvY:L,vertOriginX:L,vertOriginY:L,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:L,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:on}),un=rn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),dn=rn({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:sn}),fn=rn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),pn={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},mn=/[A-Z]/g,hn=/-[a-z]/g,gn=/^data[-\w.:]+$/i;function _n(e,t){let n=qt(t),r=t,i=P;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&gn.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(hn,yn);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!hn.test(e)){let n=e.replace(mn,vn);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=tn}return new i(r,t)}function vn(e){return`-`+e.toLowerCase()}function yn(e){return e.charAt(1).toUpperCase()}var bn=Kt([an,cn,un,dn,fn],`html`),xn=Kt([an,ln,un,dn,fn],`svg`);function Sn(e){return e.join(` `).trim()}var Cn=t(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
3
+ `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),wn=t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Cn());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Tn=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),En=t(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(wn()),r=Tn();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Dn=kn(`end`),On=kn(`start`);function kn(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function An(e){let t=On(e),n=Dn(e);if(t&&n)return{start:t,end:n}}function jn(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Nn(e.position):`start`in e||`end`in e?Nn(e):`line`in e||`column`in e?Mn(e):``}function Mn(e){return Pn(e&&e.line)+`:`+Pn(e&&e.column)}function Nn(e){return Mn(e&&e.start)+`-`+Mn(e&&e.end)}function Pn(e){return e&&typeof e==`number`?e:1}var z=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=jn(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};z.prototype.file=``,z.prototype.name=``,z.prototype.reason=``,z.prototype.message=``,z.prototype.stack=``,z.prototype.column=void 0,z.prototype.line=void 0,z.prototype.ancestors=void 0,z.prototype.cause=void 0,z.prototype.fatal=void 0,z.prototype.place=void 0,z.prototype.ruleId=void 0,z.prototype.source=void 0;var Fn=a(En(),1),In={}.hasOwnProperty,Ln=new Map,Rn=/[A-Z]/g,zn=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Bn=new Set([`td`,`th`]),Vn=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Hn(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=$n(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Qn(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?xn:bn,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Un(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Un(e,t,n){if(t.type===`element`)return Wn(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Gn(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return qn(e,t,n);if(t.type===`mdxjsEsm`)return Kn(e,t);if(t.type===`root`)return Jn(e,t,n);if(t.type===`text`)return Yn(e,t)}function Wn(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=xn,e.schema=i),e.ancestors.push(t);let a=ar(e,t.tagName,!1),o=er(e,t),s=nr(e,t);return zn.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Ut(e)})),Xn(e,o,a,t),Zn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Gn(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}or(e,t.position)}function Kn(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);or(e,t.position)}function qn(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=xn,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:ar(e,t.name,!0),o=tr(e,t),s=nr(e,t);return Xn(e,o,a,t),Zn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Jn(e,t,n){let r={};return Zn(r,nr(e,t)),e.create(t,e.Fragment,r,n)}function Yn(e,t){return t.value}function Xn(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Zn(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Qn(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function $n(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=On(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function er(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&In.call(t.properties,i)){let a=rr(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Bn.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function tr(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else or(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else or(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function nr(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ln;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Un(e,a,o);s!==void 0&&n.push(s)}return n}function rr(e,t,n){let r=_n(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Lt(n):Sn(n)),r.property===`style`){let t=typeof n==`object`?n:ir(e,String(n));return e.stylePropertyNameCase===`css`&&(t=sr(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?pn[r.property]||r.property:r.attribute,n]}}function ir(e,t){try{return(0,Fn.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new z("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Vn+`#cannot-parse-style-attribute`,r}}function ar(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Vt(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Vt(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return In.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);or(e)}function or(e,t){let n=new z("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Vn+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function sr(e){let t={},n;for(n in e)In.call(e,n)&&(t[cr(n)]=e[n]);return t}function cr(e){let t=e.replace(Rn,lr);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function lr(e){return`-`+e.toLowerCase()}var ur={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},dr={};function fr(e,t){let n=t||dr;return pr(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function pr(e,t,n){if(hr(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return mr(e.children,t,n)}return Array.isArray(e)?mr(e,t,n):``}function mr(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=pr(e[i],t,n);return r.join(``)}function hr(e){return!!(e&&typeof e==`object`)}var gr=document.createElement(`i`);function _r(e){let t=`&`+e+`;`;gr.innerHTML=t;let n=gr.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function vr(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function yr(e,t){return e.length>0?(vr(e,e.length,0,t),e):t}var br={}.hasOwnProperty;function xr(e){let t={},n=-1;for(;++n<e.length;)Sr(t,e[n]);return t}function Sr(e,t){let n;for(n in t){let r=(br.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){br.call(r,a)||(r[a]=[]);let e=i[a];Cr(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Cr(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);vr(e,0,0,r)}function wr(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Tr(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var B=Nr(/[A-Za-z]/),V=Nr(/[\dA-Za-z]/),Er=Nr(/[#-'*+\--9=?A-Z^-~]/);function Dr(e){return e!==null&&(e<32||e===127)}var Or=Nr(/\d/),kr=Nr(/[\dA-Fa-f]/),Ar=Nr(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function U(e){return e!==null&&(e<0||e===32)}function W(e){return e===-2||e===-1||e===32}var jr=Nr(/\p{P}|\p{S}/u),Mr=Nr(/\s/);function Nr(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Pr(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&V(e.charCodeAt(n+1))&&V(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function G(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return W(r)?(e.enter(n),s(r)):t(r)}function s(r){return W(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function Fr(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&W(t)?(e.enter(r),c(t)):l(t)}function c(t){return W(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var Ir={tokenize:Lr};function Lr(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),G(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return H(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Rr=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){zr(this,e,t,n,!1)}addBefore(e,t,n){zr(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function zr(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var Br={tokenize:Hr},Vr={tokenize:Ur};function Hr(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new Rr;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Vr,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Vr,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return H(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new Rr;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ur(e,t,n){return G(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Wr(e){if(e===null||U(e)||Mr(e))return 1;if(jr(e))return 2}function Gr(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Kr={name:`attention`,resolveAll:qr,tokenize:Jr};function qr(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};Yr(o,-a),Yr(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=yr(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=yr(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=yr(r,Gr(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=yr(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=yr(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),vr(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Jr(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Wr(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Wr(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Yr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Xr={name:`autolink`,tokenize:Zr};function Zr(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return B(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||V(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||V(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Dr(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Er(t)?(e.consume(t),l):n(t)}function u(e){return V(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||V(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Qr={partial:!0,tokenize:$r};function $r(e,t,n){return r;function r(t){return W(t)?G(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||H(e)?t(e):n(e)}}var ei={continuation:{tokenize:ni},exit:ri,name:`blockQuote`,tokenize:ti};function ti(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return W(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function ni(e,t,n){let r=this;return i;function i(t){return W(t)?G(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(ei,t,n)(r)}}function ri(e){e.exit(`blockQuote`)}var ii={name:`characterEscape`,tokenize:ai};function ai(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Ar(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var oi={name:`characterReference`,tokenize:si};function si(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=V,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=kr,u):(e.enter(`characterReferenceValue`),a=7,o=Or,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===V&&!_r(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var ci={partial:!0,tokenize:li};function li(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ui={concrete:!0,name:`codeFenced`,tokenize:di};function di(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),W(t)?G(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||H(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(ci,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||H(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):W(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),G(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||H(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||H(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&W(t)?G(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||H(t)?e.check(ci,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||H(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),W(t)?G(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),W(t)?G(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||H(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var fi={name:`codeIndented`,tokenize:mi},pi={partial:!0,tokenize:hi};function mi(e,t,n){return r;function r(t){return e.enter(`codeIndented`),Fr(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):H(t)?e.attempt(pi,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||H(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function hi(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):H(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):Fr(e,t,a,`linePrefix`,4,4)(o)}function a(e){return H(e)?i(e):n(e)}}var gi={name:`codeText`,previous:vi,resolve:_i,tokenize:yi};function _i(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function vi(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function yi(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):H(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||H(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var bi=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&xi(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),xi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),xi(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);xi(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);xi(this.left,t.reverse())}}}};function xi(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Si(e){let t={},n=-1,r,i,a,o,s,c,l,u=new bi(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Ci(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return vr(e,0,1/0,u.slice(0)),!l}function Ci(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var wi={resolve:Ei,tokenize:Di},Ti={partial:!0,tokenize:Oi};function Ei(e){return Si(e),e}function Di(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):H(t)?e.check(Ti,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Oi(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),G(e,a,`linePrefix`)}function a(i){if(i===null||H(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function ki(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Dr(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||H(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||U(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Dr(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Ai(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):H(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||H(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!W(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function ji(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):H(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),G(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||H(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Mi(e,t){let n;return r;function r(i){return H(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):W(i)?G(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Ni={name:`definition`,tokenize:Fi},Pi={partial:!0,tokenize:Ii};function Fi(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Ai.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Tr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return U(t)?Mi(e,l)(t):l(t)}function l(t){return ki(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Pi,d,d)(t)}function d(t){return W(t)?G(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||H(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Ii(e,t,n){return r;function r(t){return U(t)?Mi(e,i)(t):n(t)}function i(t){return ji(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return W(t)?G(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||H(e)?t(e):n(e)}}var Li={name:`hardBreakEscape`,tokenize:Ri};function Ri(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return H(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var zi={name:`headingAtx`,resolve:Bi,tokenize:Vi};function Bi(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};vr(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function Vi(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||U(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||H(n)?(e.exit(`atxHeading`),t(n)):W(n)?G(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||U(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Hi=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Ui=[`pre`,`script`,`style`,`textarea`],Wi={concrete:!0,name:`htmlFlow`,resolveTo:Ki,tokenize:qi},Gi={partial:!0,tokenize:Ji};function Ki(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function qi(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:se):B(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):B(a)?(e.consume(a),i=4,r.interrupt?t:se):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:se):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return B(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||U(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Ui.includes(l)?(i=1,r.interrupt?t(s):D(s)):Hi.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||V(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return W(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||B(t)?(e.consume(t),b):W(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||V(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):W(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):W(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||H(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||U(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||W(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||H(t)?D(t):W(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),O):t===62&&i===4?(e.consume(t),ce):t===63&&i===3?(e.consume(t),se):t===93&&i===5?(e.consume(t),oe):H(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Gi,k,te)(t)):t===null||H(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(ci,ne,k)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||H(t)?te(t):(e.enter(`htmlFlowData`),D(t))}function ie(t){return t===45?(e.consume(t),se):D(t)}function O(t){return t===47?(e.consume(t),o=``,ae):D(t)}function ae(t){if(t===62){let n=o.toLowerCase();return Ui.includes(n)?(e.consume(t),ce):D(t)}return B(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ae):D(t)}function oe(t){return t===93?(e.consume(t),se):D(t)}function se(t){return t===62?(e.consume(t),ce):t===45&&i===2?(e.consume(t),se):D(t)}function ce(t){return t===null||H(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),ce)}function k(n){return e.exit(`htmlFlow`),t(n)}}function Ji(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Qr,t,n)}}var Yi={name:`htmlText`,tokenize:Xi};function Xi(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):B(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):B(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):H(t)?(o=d,O(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):H(t)?(o=h,O(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):H(t)?(o=v,O(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):H(t)?(o=y,O(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return B(t)?(e.consume(t),S):n(t)}function S(t){return t===45||V(t)?(e.consume(t),S):C(t)}function C(t){return H(t)?(o=C,O(t)):W(t)?(e.consume(t),C):ie(t)}function w(t){return t===45||V(t)?(e.consume(t),w):t===47||t===62||U(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ie):t===58||t===95||B(t)?(e.consume(t),E):H(t)?(o=T,O(t)):W(t)?(e.consume(t),T):ie(t)}function E(t){return t===45||t===46||t===58||t===95||V(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):H(t)?(o=ee,O(t)):W(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,te):H(t)?(o=D,O(t)):W(t)?(e.consume(t),D):(e.consume(t),ne)}function te(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):H(t)?(o=te,O(t)):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||U(t)?T(t):(e.consume(t),ne)}function re(e){return e===47||e===62||U(e)?T(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function O(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ae}function ae(t){return W(t)?G(e,oe,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):oe(t)}function oe(t){return e.enter(`htmlTextData`),o(t)}}var Zi={name:`labelEnd`,resolveAll:ta,resolveTo:na,tokenize:ra},Qi={tokenize:ia},$i={tokenize:aa},ea={tokenize:oa};function ta(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&vr(e,0,e.length,n),e}function na(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=yr(o,e.slice(i+1,i+r+3)),o=yr(o,[[`enter`,l,t]]),o=yr(o,Gr(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=yr(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=yr(o,e.slice(a+1)),o=yr(o,[[`exit`,s,t]]),vr(e,i,e.length,o),e}function ra(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Tr(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Qi,u,o?u:d)(t):t===91?e.attempt($i,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(ea,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function ia(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return U(t)?Mi(e,a)(t):a(t)}function a(t){return t===41?u(t):ki(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return U(t)?Mi(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?ji(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return U(t)?Mi(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function aa(e,t,n){let r=this;return i;function i(t){return Ai.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Tr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function oa(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var sa={name:`labelStartImage`,resolveAll:Zi.resolveAll,tokenize:ca};function ca(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var la={name:`labelStartLink`,resolveAll:Zi.resolveAll,tokenize:ua};function ua(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var da={name:`lineEnding`,tokenize:fa};function fa(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),G(e,t,`linePrefix`)}}var pa={name:`thematicBreak`,tokenize:ma};function ma(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||H(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),W(t)?G(e,s,`whitespace`)(t):s(t))}}var ha={continuation:{tokenize:ya},exit:xa,name:`list`,tokenize:va},ga={partial:!0,tokenize:Sa},_a={partial:!0,tokenize:ba};function va(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Or(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(pa,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Or(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Qr,r.interrupt?n:u,e.attempt(ga,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return W(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function ya(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Qr,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,G(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!W(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(_a,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,G(e,e.attempt(ha,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function ba(e,t,n){let r=this;return G(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function xa(e){e.exit(this.containerState.type)}function Sa(e,t,n){let r=this;return G(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!W(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Ca={name:`setextUnderline`,resolveTo:wa,tokenize:Ta};function wa(e,t){let n=new Rr,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function Ta(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),W(t)?G(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||H(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Ea={tokenize:Da};function Da(e){let t=this,n=e.attempt(Qr,r,e.attempt(this.parser.constructs.flowInitial,i,G(e,e.attempt(this.parser.constructs.flow,i,e.attempt(wi,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Oa={resolveAll:Ma()},ka=ja(`string`),Aa=ja(`text`);function ja(e){return{resolveAll:Ma(e===`text`?Na:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Ma(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Na(e,t){let n=new Rr,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var Pa=n({attentionMarkers:()=>Ha,contentInitial:()=>Ia,disable:()=>Ua,document:()=>Fa,flow:()=>Ra,flowInitial:()=>La,insideSpan:()=>Va,string:()=>za,text:()=>Ba}),Fa={42:ha,43:ha,45:ha,48:ha,49:ha,50:ha,51:ha,52:ha,53:ha,54:ha,55:ha,56:ha,57:ha,62:ei},Ia={91:Ni},La={[-2]:fi,[-1]:fi,32:fi},Ra={35:zi,42:pa,45:[Ca,pa],60:Wi,61:Ca,95:pa,96:ui,126:ui},za={38:oi,92:ii},Ba={[-5]:da,[-4]:da,[-3]:da,33:sa,38:oi,42:Kr,60:[Xr,Yi],91:la,92:[Li,ii],93:Zi,95:Kr,96:gi},Va={null:[Kr,Oa]},Ha={null:[42,95]},Ua={null:[]};function Wa(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=yr(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Gr(a,l.events,l),l.events):[]}function f(e,t){return Ka(p(e),t)}function p(e){return Ga(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){H(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&vr(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ga(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Ka(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
4
+ `;break;case-3:o=`\r
5
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function qa(e){let t={constructs:xr([Pa,...(e||{}).extensions||[]]),content:n(Ir),defined:[],document:n(Br),flow:n(Ea),lazy:{},string:n(ka),text:n(Aa)};return t;function n(e){return n;function n(n){return Wa(t,e,n)}}}function Ja(e){for(;!Si(e););return e}var Ya=/[\0\t\n\r]/g;function Xa(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){Ya.lastIndex=c;let n=Ya.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Za=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qa(e){return e.replace(Za,$a)}function $a(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return wr(n.slice(t?2:1),t?16:10)}return _r(n)||e}var eo={}.hasOwnProperty;function to(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),no(n)(Ja(qa(n).document().write(Xa()(e,t,!0))))}function no(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Ce),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ye),blockQuote:a(me),characterEscape:T,characterReference:T,codeFenced:a(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(he,o),codeText:a(ge,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(_e),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ve),hardBreakEscape:a(be),hardBreakTrailing:a(be),htmlFlow:a(xe,o),htmlFlowData:T,htmlText:a(xe,o),htmlTextData:T,image:a(Se),label:o,link:a(Ce),listItem:a(Te),listItemValue:f,listOrdered:a(we,d),listUnordered:a(we),paragraph:a(Ee),reference:le,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ye),strong:a(De),thematicBreak:a(ke)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:j,autolinkProtocol:pe,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:A,characterReference:fe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(re),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(te),htmlFlowData:E,htmlText:c(ne),htmlTextData:E,image:c(O),label:oe,labelText:ae,lineEnding:ee,link:c(ie),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ue,resourceDestinationString:se,resourceTitleString:ce,resource:k,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};io(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];eo.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||oo).call(a,void 0,e[0])}for(r.position={start:ro(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ro(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:ro(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||oo).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+jn({start:e.start,end:e.end})+`): it’s not open`);n.position.end=ro(e.end)}function u(){return fr(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Tr(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Oe(),n.position={start:ro(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ro(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=ro(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function O(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ae(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Qa(t),n.identifier=Tr(t).toLowerCase()}function oe(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function se(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function k(){this.data.inReference=void 0}function le(){this.data.referenceType=`collapsed`}function ue(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Tr(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function de(e){this.data.characterReferenceType=e.type}function A(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=wr(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=_r(t);let i=this.stack[this.stack.length-1];i.value+=r}function fe(e){let t=this.stack.pop();t.position.end=ro(e.end)}function pe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function j(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function me(){return{type:`blockquote`,children:[]}}function he(){return{type:`code`,lang:null,meta:null,value:``}}function ge(){return{type:`inlineCode`,value:``}}function _e(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ve(){return{type:`emphasis`,children:[]}}function ye(){return{type:`heading`,depth:0,children:[]}}function be(){return{type:`break`}}function xe(){return{type:`html`,value:``}}function Se(){return{type:`image`,title:null,url:``,alt:null}}function Ce(){return{type:`link`,title:null,url:``,children:[]}}function we(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Te(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Ee(){return{type:`paragraph`,children:[]}}function De(){return{type:`strong`,children:[]}}function Oe(){return{type:`text`,value:``}}function ke(){return{type:`thematicBreak`}}}function ro(e){return{line:e.line,column:e.column,offset:e.offset}}function io(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?io(e,r):ao(e,r)}}function ao(e,t){let n;for(n in t)if(eo.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function oo(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+jn({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jn({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+jn({start:t.start,end:t.end})+`) is still open`)}function so(e){let t=this;t.parser=n;function n(n){return to(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function co(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function lo(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
6
+ `}]}function uo(e,t){let n=t.value?t.value+`
7
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function fo(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function po(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mo(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Pr(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function ho(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function go(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function _o(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function vo(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _o(e,t);let i={src:Pr(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function yo(e,t){let n={src:Pr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function bo(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function xo(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _o(e,t);let i={href:Pr(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function So(e,t){let n={href:Pr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Co(e,t,n){let r=e.all(t),i=n?wo(n):To(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
8
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
9
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function wo(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=To(n[r])}return t}function To(e){return e.spread??e.children.length>1}function Eo(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Do(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Oo(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ko(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ao(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=On(t.children[1]),o=Dn(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function jo(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Mo(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var No=9,Po=32;function Fo(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Io(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Io(t.slice(i),i>0,!1)),a.join(``)}function Io(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===No||t===Po;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===No||t===Po;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Lo(e,t){let n={type:`text`,value:Fo(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Ro(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var zo={blockquote:co,break:lo,code:uo,delete:fo,emphasis:po,footnoteReference:mo,heading:ho,html:go,imageReference:vo,image:yo,inlineCode:bo,linkReference:xo,link:So,listItem:Co,list:Eo,paragraph:Do,root:Oo,strong:ko,table:Ao,tableCell:Mo,tableRow:jo,text:Lo,thematicBreak:Ro,toml:Bo,yaml:Bo,definition:Bo,footnoteDefinition:Bo};function Bo(){}var{defineProperty:Vo}=Object,Ho=typeof self==`object`?self:globalThis,Uo=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new Ho[e](t)},Wo=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?Vo(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof Ho[e]==`function`?Uo(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(Uo(a,o),i)};return r},Go=e=>Wo(new Map,e)(0),Ko=``,{toString:qo}={},{keys:Jo,is:Yo}=Object,Xo=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=qo.call(e).slice(8,-1);switch(n){case`Array`:return[1,Ko];case`Object`:return[2,Ko];case`Date`:return[3,Ko];case`RegExp`:return[4,Ko];case`Map`:return[5,Ko];case`Set`:return[6,Ko];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},Zo=([e,t])=>e===0&&(t===`function`||t===`symbol`),Qo=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=Xo(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&Yo(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of Jo(o))(e||!Zo(Xo(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?Ko:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(Zo(Xo(n))||Zo(Xo(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!Zo(Xo(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},$o=(e,{json:t,lossy:n}={})=>{let r=[];return Qo(!(t||n),!!t,new Map,r)(e),r},es=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Go($o(e,t)):structuredClone(e):(e,t)=>Go($o(e,t));function ts(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function ns(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function rs(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||ts,r=e.options.footnoteBackLabel||ns,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Pr(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...es(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
10
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
11
+ `}]}}var is=(function(e){if(e==null)return ls;if(typeof e==`function`)return cs(e);if(typeof e==`object`)return Array.isArray(e)?as(e):os(e);if(typeof e==`string`)return ss(e);throw Error(`Expected function, string, or object as test`)});function as(e){let t=[],n=-1;for(;++n<e.length;)t[n]=is(e[n]);return cs(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function os(e){let t=e;return cs(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ss(e){return cs(t);function t(t){return t&&t.type===e}}function cs(e){return t;function t(t,n,r){return!!(us(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ls(){return!0}function us(e){return typeof e==`object`&&!!e&&`type`in e}function ds(e){return e}var fs=[];function ps(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=is(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+ds(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=fs,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=ms(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function ms(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?fs:[e]}function hs(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),ps(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var gs={}.hasOwnProperty,_s={};function vs(e,t){let n=t||_s,r=new Map,i=new Map,a={all:s,applyData:bs,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...zo,...n.handlers},one:o,options:n,patch:ys,wrap:Ss};return hs(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(gs.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=es(n);return r.children=a.all(e),r}return es(e)}return(a.options.unknownHandler||xs)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=Cs(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Cs(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function ys(e,t){e.position&&(t.position=An(e))}function bs(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,es(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function xs(e,t){let n=t.data||{},r=`value`in t&&!(gs.call(n,`hProperties`)||gs.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ss(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
12
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
13
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
14
+ `}),n}function Cs(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ws(e,t){let n=vs(e,t),r=n.one(e,void 0),i=rs(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
15
+ `},i)),a}function Ts(e,t){return e&&`run`in e?async function(n,r){let i=ws(n,{file:r,...t});await e.run(i,r)}:function(n,r){return ws(n,{file:r,...e||t})}}function Es(e){if(e)throw e}var Ds=a(t(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}))(),1);function Os(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ks(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?As(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function As(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var js={basename:Ms,dirname:Ns,extname:Ps,join:Fs,sep:`/`};function Ms(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Rs(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Ns(e){if(Rs(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Ps(e){Rs(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Fs(...e){let t=-1,n;for(;++t<e.length;)Rs(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Is(n)}function Is(e){Rs(e);let t=e.codePointAt(0)===47,n=Ls(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Ls(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Rs(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var zs={cwd:Bs};function Bs(){return`/`}function Vs(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Hs(e){if(typeof e==`string`)e=new URL(e);else if(!Vs(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Us(e)}function Us(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Ws=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Gs=class{constructor(e){let t;t=e?Vs(e)?{path:e}:typeof e==`string`||Ys(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:zs.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Ws.length;){let e=Ws[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Ws.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?js.basename(this.path):void 0}set basename(e){qs(e,`basename`),Ks(e,`basename`),this.path=js.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?js.dirname(this.path):void 0}set dirname(e){Js(this.basename,`dirname`),this.path=js.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?js.extname(this.path):void 0}set extname(e){if(Ks(e,`extname`),Js(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=js.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Vs(e)&&(e=Hs(e)),qs(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?js.basename(this.path,this.extname):void 0}set stem(e){qs(e,`stem`),Ks(e,`stem`),this.path=js.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new z(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Ks(e,t){if(e&&e.includes(js.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+js.sep+"`")}function qs(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Js(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Ys(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Xs=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Zs={}.hasOwnProperty,Qs=new class e extends Xs{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ks()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Ds.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(tc(`data`,this.frozen),this.namespace[e]=t,this):Zs.call(this.namespace,e)&&this.namespace[e]||void 0:e?(tc(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=ic(e),n=this.parser||this.Parser;return $s(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),$s(`process`,this.parser||this.Parser),ec(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=ic(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);oc(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),$s(`processSync`,this.parser||this.Parser),ec(`processSync`,this.compiler||this.Compiler),this.process(e,r),rc(`processSync`,`process`,t),n;function r(e,r){t=!0,Es(e),n=r}}run(e,t,n){nc(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=ic(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),rc(`runSync`,`run`,n),r;function i(e,t){Es(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=ic(t),r=this.compiler||this.Compiler;return ec(`stringify`,r),nc(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(tc(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Ds.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Os(o)&&Os(r)&&(r=(0,Ds.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function $s(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function ec(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function tc(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function nc(e){if(!Os(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function rc(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function ic(e){return ac(e)?e:new Gs(e)}function ac(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function oc(e){return typeof e==`string`||sc(e)}function sc(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var cc=[],lc={allowDangerousHtml:!0},uc=/^(https?|ircs?|mailto|xmpp)$/i,dc=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function fc(e){let t=pc(e),n=mc(e);return hc(t.runSync(t.parse(n),n),e)}function pc(e){let t=e.rehypePlugins||cc,n=e.remarkPlugins||cc,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...lc}:lc;return Qs().use(so).use(n).use(Ts,r).use(t)}function mc(e){let t=e.children||``,n=new Gs;return typeof t==`string`?n.value=t:``+t,n}function hc(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||gc;for(let e of dc)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return hs(e,l),Hn(e,{Fragment:N.Fragment,components:i,ignoreInvalidStyle:!0,jsx:N.jsx,jsxs:N.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in ur)if(Object.hasOwn(ur,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=ur[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function gc(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||uc.test(e.slice(0,t))?e:``}function _c(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function vc(e,t,n){let r=is((n||{}).ignore||[]),i=yc(t),a=-1;for(;++a<i.length;)ps(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function yc(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([bc(e[0]),xc(e[1])])}return t}function bc(e){return typeof e==`string`?new RegExp(_c(e),`g`):e}function xc(e){return typeof e==`function`?e:function(){return e}}function Sc(e){vc(e,[/\r?\n|\r/g,Cc])}function Cc(){return{type:`break`}}function wc(){return function(e){Sc(e)}}function Tc(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var Ec=`phrasing`,Dc=[`autolink`,`link`,`image`,`label`];function Oc(){return{transforms:[Ic],enter:{literalAutolink:Ac,literalAutolinkEmail:jc,literalAutolinkHttp:jc,literalAutolinkWww:jc},exit:{literalAutolink:Fc,literalAutolinkEmail:Pc,literalAutolinkHttp:Mc,literalAutolinkWww:Nc}}}function kc(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Ec,notInConstruct:Dc},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Ec,notInConstruct:Dc},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Ec,notInConstruct:Dc}]}}function Ac(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function jc(e){this.config.enter.autolinkProtocol.call(this,e)}function Mc(e){this.config.exit.autolinkProtocol.call(this,e)}function Nc(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Pc(e){this.config.exit.autolinkEmail.call(this,e)}function Fc(e){this.exit(e)}function Ic(e){vc(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Lc],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Rc]],{ignore:[`link`,`linkReference`]})}function Lc(e,t,n,r,i){let a=``;if(!Vc(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!zc(n)))return!1;let o=Bc(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Rc(e,t,n,r){return!Vc(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function zc(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Bc(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Tc(e,`(`),a=Tc(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Vc(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Mr(n)||jr(n))&&(!t||n!==47)}Zc.peek=Xc;function Hc(){this.buffer()}function Uc(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Wc(){this.buffer()}function Gc(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Kc(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Tr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qc(e){this.exit(e)}function Jc(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Tr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Yc(e){this.exit(e)}function Xc(){return`[`}function Zc(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Qc(){return{enter:{gfmFootnoteCallString:Hc,gfmFootnoteCall:Uc,gfmFootnoteDefinitionLabelString:Wc,gfmFootnoteDefinition:Gc},exit:{gfmFootnoteCallString:Kc,gfmFootnoteCall:qc,gfmFootnoteDefinitionLabelString:Jc,gfmFootnoteDefinition:Yc}}}function $c(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Zc},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
16
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?tl:el))),s(),o}}function el(e,t,n){return t===0?e:tl(e,t,n)}function tl(e,t,n){return(n?``:` `)+e}var nl=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];sl.peek=cl;function rl(){return{canContainEols:[`delete`],enter:{strikethrough:al},exit:{strikethrough:ol}}}function il(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:nl}],handlers:{delete:sl}}}function al(e){this.enter({type:`delete`,children:[]},e)}function ol(e){this.exit(e)}function sl(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function cl(){return`~`}function ll(e){return e.length}function ul(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||ll,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=dl(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=fl(r[d]);else{let e=fl(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
17
+ `)}function dl(e){return e==null?``:String(e)}function fl(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}var pl=is([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function ml(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),hl);return i(),o}function hl(e,t,n){return`>`+(n?``:` `)+e}function gl(e,t){return _l(e,t.inConstruct,!0)&&!_l(e,t.notInConstruct,!1)}function _l(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function vl(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){let e=n.unsafe[i];if(e.character===`
18
+ `&&!e.before&&!e.after&&gl(n.stack,e))return/[\t ]/.test(r.before)?``:` `}return`\\
19
+ `}function yl(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function bl(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function xl(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Sl(e,t,n,r){let i=xl(n),a=e.value||``;if(bl(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,Cl);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(yl(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:`
20
+ `,encode:["`"],...o.current()})),t()}return u+=o.move(`
21
+ `),a&&(u+=o.move(a+`
22
+ `)),u+=o.move(s),c(),u}function Cl(e,t,n){return(n?``:` `)+e}function wl(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Tl(e,t,n,r){let i=wl(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
23
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function El(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}Dl.attention=Ol,Dl.peek=kl;function Dl(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function Ol(e,t){return{construct:`emphasis`,markers:El(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function kl(e,t,n){return n.options.emphasis||`*`}function Al(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function jl(e,t){let n=!1;return hs(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&fr(e)&&(t.options.setext||n))}function Ml(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(jl(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
24
+ `,after:`
25
+ `});return r(),t(),o+`
26
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
27
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
28
+ `,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=Al(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Nl.peek=Pl;function Nl(e){return e.value||``}function Pl(){return`<`}Fl.peek=Il;function Fl(e,t,n,r){let i=wl(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Il(){return`!`}Ll.peek=Rl;function Ll(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Rl(){return`!`}zl.peek=Bl;function zl(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Bl(){return"`"}function Vl(e,t){let n=fr(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][+\-.a-z]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}Hl.peek=Ul;function Hl(e,t,n,r){let i=wl(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(Vl(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Ul(e,t,n){return Vl(e,n)?`<`:`[`}Wl.peek=Gl;function Wl(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Gl(){return`[`}function Kl(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function ql(e){let t=Kl(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Jl(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Yl(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Xl(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Jl(n):Kl(n),s=e.ordered?o===`.`?`)`:`.`:ql(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Yl(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Zl(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Ql(e,t,n,r){let i=Zl(n),a=n.bulletCurrent||Kl(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function $l(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function eu(e,t,n,r){if(!e.children.some(function(e){return pl(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function tu(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}nu.attention=ru,nu.peek=iu;function nu(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function ru(e,t){return{construct:`strong`,markers:tu(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function iu(e,t,n){return n.options.strong||`*`}function au(e,t,n,r){return n.safe(e.value,r)}function ou(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function su(e,t,n){let r=(Yl(n)+(n.options.ruleSpaces?` `:``)).repeat(ou(n));return n.options.ruleSpaces?r.slice(0,-1):r}var cu={blockquote:ml,break:vl,code:Sl,definition:Tl,emphasis:Dl,hardBreak:vl,heading:Ml,html:Nl,image:Fl,imageReference:Ll,inlineCode:zl,link:Hl,linkReference:Wl,list:Xl,listItem:Ql,paragraph:$l,root:eu,strong:nu,text:au,thematicBreak:su};function lu(){return{enter:{table:uu,tableData:mu,tableHeader:mu,tableRow:fu},exit:{codeText:hu,table:du,tableData:pu,tableHeader:pu,tableRow:pu}}}function uu(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function du(e){this.exit(e),this.data.inTable=void 0}function fu(e){this.enter({type:`tableRow`,children:[]},e)}function pu(e){this.exit(e)}function mu(e){this.enter({type:`tableCell`,children:[]},e)}function hu(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,gu));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function gu(e,t){return t===`|`?t:e}function _u(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
29
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
30
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return ul(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=cu.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function vu(){return{exit:{taskListCheckValueChecked:bu,taskListCheckValueUnchecked:bu,paragraph:xu}}}function yu(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Su}}}function bu(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function xu(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Su(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=cu.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Cu(){return[Oc(),Qc(),rl(),lu(),vu()]}function wu(e){return{extensions:[kc(),$c(e),il(),_u(e),yu()]}}var Tu={tokenize:zu,partial:!0},Eu={tokenize:Bu,partial:!0},Du={tokenize:Vu,partial:!0},Ou={tokenize:Hu,partial:!0},ku={tokenize:Uu,partial:!0},Au={name:`wwwAutolink`,tokenize:Lu,previous:Wu},ju={name:`protocolAutolink`,tokenize:Ru,previous:Gu},Mu={name:`emailAutolink`,tokenize:Iu,previous:Ku},Nu={};function Pu(){return{text:Nu}}for(var Fu=48;Fu<123;)Nu[Fu]=Mu,Fu++,Fu===58?Fu=65:Fu===91&&(Fu=97);Nu[43]=Mu,Nu[45]=Mu,Nu[46]=Mu,Nu[95]=Mu,Nu[72]=[Mu,ju],Nu[104]=[Mu,ju],Nu[87]=[Mu,Au],Nu[119]=[Mu,Au];function Iu(e,t,n){let r=this,i,a;return o;function o(t){return!qu(t)||!Ku.call(r,r.previous)||Ju(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return qu(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(ku,u,l)(t):t===45||t===95||V(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&B(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Lu(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Wu.call(r,r.previous)||Ju(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Tu,e.attempt(Eu,e.attempt(Du,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Ru(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Gu.call(r,r.previous)&&!Ju(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(B(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Dr(t)||U(t)||Mr(t)||jr(t)?n(t):e.attempt(Eu,e.attempt(Du,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function zu(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Bu(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Ou,c,s)(t):t===null||U(t)||Mr(t)||t!==45&&jr(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Vu(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Ou,t,a)(o):o===null||U(o)||Mr(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Hu(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||U(o)||Mr(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||U(e)||Mr(e)?t(e):r(e)}function a(e){return B(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):B(t)?(e.consume(t),o):n(t)}}function Uu(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return V(e)?n(e):t(e)}}function Wu(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||U(e)}function Gu(e){return!B(e)}function Ku(e){return!(e===47||qu(e))}function qu(e){return e===43||e===45||e===46||e===95||V(e)}function Ju(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Yu={tokenize:rd,partial:!0};function Xu(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:ed,continuation:{tokenize:td},exit:nd}},text:{91:{name:`gfmFootnoteCall`,tokenize:$u},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Zu,resolveTo:Qu}}}}function Zu(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Tr(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Qu(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function $u(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||U(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Tr(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return U(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function ed(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||U(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Tr(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return U(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),G(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function td(e,t,n){return e.check(Qr,t,e.attempt(Yu,t,n))}function nd(e){e.exit(`gfmFootnoteDefinition`)}function rd(e,t,n){let r=this;return G(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function id(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&vr(o,o.length,0,Gr(s,e.slice(r+1,n),t)),vr(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),vr(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Wr(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Wr(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var ad=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){od(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function od(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function sd(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function cd(){return{flow:{null:{name:`table`,tokenize:ld,resolveAll:ud}}}}function ld(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):H(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):W(t)?G(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||U(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,W(t)?G(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return W(t)?G(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||H(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return W(t)?G(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||H(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||H(n)?(e.exit(`tableRow`),t(n)):W(n)?G(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||U(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function ud(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new ad;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(fd(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=dd(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=dd(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=dd(f,t,o,i,n,d)):(o[0]=o[1],d=dd(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&fd(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=sd(t.events,n))}return e}function dd(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},pd(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=pd(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=pd(t.events,n[2]),a=pd(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},pd(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function fd(e,t,n,r,i){let a=[],o=pd(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function pd(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var md={name:`tasklistCheck`,tokenize:gd};function hd(){return{text:{91:md}}}function gd(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return U(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return H(r)?t(r):W(r)?e.check({tokenize:_d},t,n)(r):n(r)}}function _d(e,t,n){return G(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function vd(e){return xr([Pu(),Xu(),id(e),cd(),hd()])}var yd={};function bd(e){let t=this,n=e||yd,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(vd(n)),a.push(Cu()),o.push(wu(n))}function xd(){let e=t=>{t.type===`html`&&(t.type=`text`),t.children?.forEach(e)};return e}var Sd=/^(https?:|mailto:)/i,Cd=e=>Sd.test(e.trim())?e:``,wd={a:({href:e,children:t})=>e?(0,N.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}):(0,N.jsx)(`span`,{className:`md-deadlink`,children:t}),img:({src:e,alt:t})=>typeof e==`string`&&e?(0,N.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:[`🖼 `,t||e]}):(0,N.jsxs)(`span`,{children:[`🖼 `,t]}),table:({children:e})=>(0,N.jsx)(`div`,{className:`md-table`,tabIndex:0,children:(0,N.jsx)(`table`,{children:e})}),pre:({children:e})=>(0,N.jsx)(`pre`,{tabIndex:0,children:e})},Td=[bd,xd,wc];function Ed({text:e,className:t}){return(0,N.jsx)(`div`,{className:t?`md ${t}`:`md`,children:(0,N.jsx)(fc,{remarkPlugins:Td,components:wd,urlTransform:Cd,children:e})})}function Dd({value:e,onChange:t,className:n,onKeyDown:r,...i}){let a=(0,M.useRef)(null);return(0,M.useLayoutEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[e]),(0,N.jsx)(`textarea`,{...i,ref:a,rows:1,enterKeyHint:`send`,className:`msg-box ${n??``}`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{if(r?.(e),e.defaultPrevented||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||e.keyCode===229)return;e.preventDefault();let t=e.currentTarget.form,n=t?.querySelector(`button:not([type="button"])`);t&&!n?.disabled&&t.requestSubmit()}})}function Od(e,t,n){return t?e.state===`transcribing`?`Turning your words into text…`:e.state===`listening`?e.live?e.mode===`handsfree`?`🎧 Listening… just talk`:e.mode===`tap`?`Listening… stop talking or tap 🎙️ to finish`:`Listening… let go to finish`:`Starting the mic…`:``:n?`🎧 Listening in a moment…`:``}function kd({kind:e,value:t,onChange:n,onSend:r,disabled:i}){let a=j(),o=(0,M.useId)(),s=(0,M.useRef)(null),c=(0,M.useRef)({value:t,onChange:n,onSend:r,disabled:i});c.current={value:t,onChange:n,onSend:r,disabled:i};let l=T(e=>e.settings.listen?.provider??`off`);T(e=>e.voiceKeySet);let u=xe(),d=(0,M.useRef)(null),f=be(`talk`);if((0,M.useEffect)(()=>Oe({id:o,kind:e,form:()=>s.current?.form??null,text:()=>c.current.value,setText:e=>c.current.onChange(e),send:e=>c.current.onSend(e),disabled:()=>!!c.current.disabled}),[o,e,l]),(0,M.useEffect)(()=>{let e=s.current?.form;if(!e)return;let t=()=>Ae(o);return e.addEventListener(`submit`,t,!0),()=>e.removeEventListener(`submit`,t,!0)},[o,l]),(0,M.useEffect)(()=>{i&&Ae(o)},[i,o]),l===`off`)return null;let p=Ee(),m=u.target===o,h=m?u.state:`idle`,g=h===`listening`,_=g&&!u.live,v=e===`phone`&&u.chiming,y=()=>{if(!i){if(p)return Se(o,`hold`);if(h===`listening`||h===`transcribing`)return ke(o);d.current=performance.now(),Se(o,`hold`)}},b=()=>{let e=d.current;d.current=null,e!==null&&(performance.now()-e<300?De(o):ke(o))},x=Od(u,m,v),S=p||(g?a(`Listening: Esc stops`):a(`Hold to talk (or hold {key}); tap to talk until you stop`,{key:f}));return(0,N.jsxs)(`span`,{className:`mic`,children:[x&&(0,N.jsxs)(`span`,{className:`mic-status small`,role:`status`,children:[a(x),g&&!_&&(0,N.jsxs)(N.Fragment,{children:[` `,`· `,(0,N.jsx)(`kbd`,{children:`Esc`})]})]}),(0,N.jsx)(`button`,{type:`button`,ref:s,className:`mic-btn ${g&&!_||v?`mic-on`:``} ${_||h===`transcribing`?`mic-busy`:``} ${p?`mic-cant`:``}`,"aria-label":a(g?`Stop listening`:`Talk instead of type`),"aria-pressed":g,title:S,disabled:i,onPointerDown:e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),y())},onPointerUp:b,onPointerCancel:b,onKeyDown:e=>{(e.key===` `||e.key===`Enter`)&&!e.repeat&&(e.preventDefault(),y())},onKeyUp:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),b())},children:h===`transcribing`?`⏳`:`🎙️`})]})}function Ad(){T.getState().openOverlay(null)}function jd({title:e,children:t,wide:n,accent:r,className:i,onClose:a}){let o=(0,M.useRef)(null),s=(0,M.useId)(),c=j();return fe(o),(0,M.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),a?a():Ad())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]),(0,N.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&(a?a():Ad()),children:(0,N.jsxs)(`div`,{ref:o,className:`panel ${n?`panel-wide`:``} ${i??``}`,style:{"--accent":r??`#ff8a5b`},role:`dialog`,"aria-modal":`true`,"aria-labelledby":s,tabIndex:-1,children:[(0,N.jsxs)(`div`,{className:`panel-head`,children:[(0,N.jsx)(`h2`,{className:`panel-title`,id:s,children:typeof e==`string`?c(e):e}),(0,N.jsx)(`button`,{className:`panel-x`,onClick:()=>a?a():Ad(),"aria-label":c(`Close`),children:`✕`})]}),(0,N.jsx)(`div`,{className:`panel-body`,children:t})]})})}function Md({action:e}){return(0,N.jsx)(`kbd`,{children:be(e)})}var Nd=[`forward`,`left`,`back`,`right`];function Pd({joined:e=!1}){let t=ve(e=>Nd.map(t=>e.bindings[t][0]?ye(e.bindings[t][0]):`—`).join(`\0`)).split(`\0`);return e&&t.every(e=>e.length===1)?(0,N.jsx)(`kbd`,{children:t.join(``)}):(0,N.jsx)(N.Fragment,{children:t.map((e,t)=>(0,N.jsx)(`kbd`,{children:e},t))})}function Fd({width:e,height:t,frame:n,onPointer:r,label:i}){let a=(0,M.useRef)(null),o=(0,M.useRef)(null),s=(0,M.useRef)(n),c=(0,M.useRef)(r);(0,M.useEffect)(()=>{s.current=n,c.current=r}),(0,M.useEffect)(()=>{let n=a.current,r=o.current;if(!n||!r)return;let i=1,c=()=>{let a=getComputedStyle(n),o=n.clientWidth-parseFloat(a.paddingLeft)-parseFloat(a.paddingRight),s=n.clientHeight-parseFloat(a.paddingTop)-parseFloat(a.paddingBottom),c=Math.max(.4,Math.min(o/e,s/t,1.5)),l=Math.min(2,window.devicePixelRatio||1);r.style.width=`${Math.floor(e*c)}px`,r.style.height=`${Math.floor(t*c)}px`,r.width=Math.round(e*c*l),r.height=Math.round(t*c*l),i=r.width/e};c();let l=new ResizeObserver(c);l.observe(n);let u=0,d=performance.now(),f=n=>{let a=Math.min(.1,Math.max(0,(n-d)/1e3));d=n;let o=r.getContext(`2d`);o&&(o.setTransform(i,0,0,i,0,0),o.clearRect(0,0,e,t),s.current(o,a,n)),u=requestAnimationFrame(f)};return u=requestAnimationFrame(f),()=>{cancelAnimationFrame(u),l.disconnect()}},[e,t]);let l=(n,r)=>{let i=n.currentTarget.getBoundingClientRect();c.current?.(r,(n.clientX-i.left)/i.width*e,(n.clientY-i.top)/i.height*t)};return(0,N.jsx)(`div`,{ref:a,className:`game-canvas-wrap`,children:(0,N.jsx)(`canvas`,{ref:o,className:`game-canvas`,role:`img`,"aria-label":i,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),l(e,`down`)},onPointerMove:e=>e.buttons&&l(e,`move`),onPointerUp:e=>l(e,`up`)})})}function Id(e){let t=(0,M.useRef)(e);(0,M.useEffect)(()=>{t.current=e}),(0,M.useEffect)(()=>{let e=e=>{e.ctrlKey||e.metaKey||e.altKey||he()||e.code===`Escape`||Ce(`phone`,e.code)||e.target?.closest?.(`input, textarea, select, [contenteditable="true"]`)||t.current(e)&&(e.preventDefault(),e.stopPropagation())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[])}function Ld({title:e,color:t,onBack:n,children:r}){let i=j();return(0,N.jsxs)(`div`,{className:`game-head`,style:{"--game":t},children:[(0,N.jsx)(`button`,{type:`button`,className:`game-back`,onClick:n,title:i(`Back to the games (Backspace)`),children:(0,N.jsx)(A,{children:`‹ Games`})}),(0,N.jsx)(`b`,{className:`game-title`,children:e}),(0,N.jsx)(`span`,{className:`game-head-right`,children:r})]})}function Rd(e){switch(e){case`ArrowUp`:case`KeyW`:return`up`;case`ArrowDown`:case`KeyS`:return`down`;case`ArrowLeft`:case`KeyA`:return`left`;case`ArrowRight`:case`KeyD`:return`right`}return null}var zd=e=>e===`Space`||e===`Enter`||e===`NumpadEnter`;function Bd(e){let t=(0,M.useRef)(e);(0,M.useEffect)(()=>{t.current=e}),(0,M.useEffect)(()=>{let e=()=>t.current(),n=()=>document.hidden&&e();return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,n),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,n)}},[])}function Vd({onPress:e,repeat:t,label:n,className:r,children:i}){let a=(0,M.useRef)(null),o=(0,M.useRef)(e);(0,M.useEffect)(()=>{o.current=e});let s=()=>{a.current&&clearTimeout(a.current),a.current=null};return(0,M.useEffect)(()=>s,[]),(0,N.jsx)(`button`,{type:`button`,tabIndex:-1,className:`game-pad ${r??``}`,"aria-label":n,title:n,onPointerDown:e=>{if(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),o.current(),!t)return;s();let n=e=>{a.current=setTimeout(()=>{o.current(),n(70)},e)};n(190)},onPointerUp:s,onPointerCancel:s,onLostPointerCapture:s,children:i})}var K=`#1f1d2b`,Hd=`#fffdf6`,Ud=`#6c7086`,q=[`#ff8a5b`,`#4fb3e8`,`#8fd14f`,`#c77dff`,`#ffc93c`,`#ff6fb5`,`#2ec4b6`,`#f25f5c`];function J(e,t,n,r,i,a,o=Math.min(r,i)*.24,s=2){C(e,t+s/2,n+s/2,r-s,i-s,o),e.fillStyle=a,e.fill(),e.save(),e.clip(),e.fillStyle=`rgba(255,255,255,0.38)`,e.fillRect(t,n,r,i*.26),e.fillStyle=`rgba(0,0,0,0.13)`,e.fillRect(t,n+i*.74,r,i*.26),e.restore(),e.lineWidth=s,e.strokeStyle=K,e.stroke()}function Wd(e,t,n,r,i,a=`#ffffff`,o=10){C(e,t,n+3,r,i,o),e.fillStyle=K,e.fill(),C(e,t,n,r,i,o),e.fillStyle=a,e.fill(),e.lineWidth=2.5,e.strokeStyle=K,e.stroke()}function Gd(e,t,n,r,i,a=K,o=700,s=`center`){e.font=`${o} ${i}px ${E}`,e.fillStyle=a,e.textAlign=s,e.textBaseline=`middle`,e.fillText(t,n,r)}function Kd(e,t,n,r,i,a){e.font=`700 ${i}px ${E}`,e.textAlign=`center`,e.textBaseline=`middle`,e.lineJoin=`round`,e.lineWidth=Math.max(3,i/5),e.strokeStyle=K,e.strokeText(t,n,r),e.fillStyle=a,e.fillText(t,n,r)}function qd(e,t,n,r,i,a=0,o=0,s=!1){for(let c of[-1,1]){let l=t+c*r/2;if(s){e.beginPath(),e.moveTo(l-i,n),e.quadraticCurveTo(l,n+i*.6,l+i,n),e.lineWidth=Math.max(1.5,i*.35),e.lineCap=`round`,e.strokeStyle=K,e.stroke();continue}e.beginPath(),e.ellipse(l,n,i,i*1.15,0,0,Math.PI*2),e.fillStyle=`#ffffff`,e.fill(),e.lineWidth=Math.max(1.2,i*.28),e.strokeStyle=K,e.stroke(),e.beginPath(),e.arc(l+a*i*.35,n+o*i*.35,i*.52,0,Math.PI*2),e.fillStyle=K,e.fill(),e.beginPath(),e.arc(l+a*i*.35-i*.18,n+o*i*.35-i*.2,i*.16,0,Math.PI*2),e.fillStyle=`#ffffff`,e.fill()}}function Jd(e,t){let n=parseInt(e.slice(1),16),[r,i,a]=[n>>16&255,n>>8&255,n&255].map(e=>Math.round(t>=0?e+(255-e)*t:e*(1+t)));return`#${(1<<24|r<<16|i<<8|a).toString(16).slice(1)}`}function Yd(e,t,n,r,i=12,a=120){for(let o=0;o<i;o++){let i=Math.random()*Math.PI*2,s=a*(.4+Math.random()*.8);e.push({x:t,y:n,vx:Math.cos(i)*s,vy:Math.sin(i)*s-a*.4,life:.6+Math.random()*.4,color:r[o%r.length],size:3+Math.random()*3})}}function Xd(e,t,n,r,i,a=18){e.push({x:t,y:n,vx:0,vy:-40,life:1.1,color:i,size:a,text:r})}function Zd(e,t,n){for(let r=t.length-1;r>=0;r--){let i=t[r];if(i.life-=n,i.life<=0){t.splice(r,1);continue}i.x+=i.vx*n,i.y+=i.vy*n,i.text||(i.vy+=320*n),e.globalAlpha=Math.min(1,i.life*2),i.text?Kd(e,i.text,i.x,i.y,i.size,i.color):(e.fillStyle=i.color,e.fillRect(i.x-i.size/2,i.y-i.size/2,i.size,i.size),e.lineWidth=1,e.strokeStyle=K,e.strokeRect(i.x-i.size/2,i.y-i.size/2,i.size,i.size)),e.globalAlpha=1}}function Qd(e,t,n,r,i,a){e.fillStyle=`rgba(31,29,43,0.45)`,e.fillRect(0,0,t,n);let o=Math.min(t-36,250),s=70+i.length*22,c=(t-o)/2,l=(n-s)/2;Wd(e,c,l,o,s,Hd,16),e.save(),e.clip(),e.fillStyle=a,e.fillRect(c,l,o,10),e.restore(),e.stroke();let u=(t,n,r)=>{e.font=`${r} ${n}px ${E}`;let i=e.measureText(t).width;return i>o-24?n*(o-24)/i:n};Kd(e,r,t/2,l+36,u(r,24,700),a),i.forEach((n,r)=>{let a=r===i.length-1;Gd(e,n,t/2,l+68+r*22,u(n,a?13:15,a?600:700),a?Ud:K,a?600:700)})}var $d=36e5,ef=720*$d,tf={awake:{food:-12,fun:-10,energy:-7},asleep:{food:-5,fun:-3,energy:35}},nf=[`Cubey`,`Pixel`,`Widget`,`Sprocket`,`Nugget`,`Mochi`,`Byte`,`Tofu`],rf=[`#ff8a5b`,`#4fb3e8`,`#8fd14f`,`#c77dff`,`#ffc93c`,`#ff6fb5`,`#2ec4b6`],af=[{xp:0,title:`Intern`},{xp:12,title:`Junior`},{xp:40,title:`Senior`},{xp:90,title:`Tech Lead`}],of=e=>Math.max(0,Math.min(100,e));function sf(e){let t=0;for(;t+1<af.length&&e>=af[t+1].xp;)t++;return t}function cf(e,t,n){let r=nf[Math.floor(t*nf.length)%nf.length];return{v:1,name:r,color:rf[Math.floor(n*rf.length)%rf.length],born:e,at:e,food:80,fun:80,energy:80,asleep:!1,xp:0,coffeeAt:0,pettedAt:0,say:{text:`Hi! I'm ${r}, your new desk pet. Keep me fed, busy and rested!`,at:e}}}function lf(e,t){let n=Math.min(Math.max(0,t-e.at),ef)/$d,{food:r,fun:i,energy:a,asleep:o}=e;for(let e=0;n>0&&e<1e3;e++){let e=o?tf.asleep:tf.awake,t=o?(100-a)/e.energy:a/-e.energy,s=Math.min(n,t);r=of(r+e.food*s),i=of(i+e.fun*s),a=of(a+e.energy*s),n-=s,s===t&&(o=!o)}return{...e,at:Math.max(t,e.at),food:r,fun:i,energy:a,asleep:o}}function uf(e){return e.asleep?`asleep`:[e.food,e.fun,e.energy].filter(e=>e<25).length>=2||Math.min(e.food,e.fun,e.energy)<=0?`grumpy`:e.food<25?`hungry`:e.energy<25?`tired`:e.fun<25?`bored`:e.food+e.fun+e.energy>=210?`happy`:`content`}var df={asleep:`Zzz… 💤`,happy:`Best. Job. Ever. ✨`,content:`Just vibing at my desk.`,hungry:`I'm hungry… got a donut? 🍩`,bored:`I'm bored. Play with me? 🎾`,tired:`So… sleepy… 🥱`,grumpy:`Hmph. Nobody looks after me. 😤`},ff=(e,t)=>e[Math.floor(t/1e3)%e.length];function pf(e,t,n){let r=lf(e,n),i=mf(r,t,n);return i===r?r:sf(i.xp)>sf(r.xp)?{...i,fun:of(i.fun+10),say:{text:`Promoted to ${af[sf(i.xp)].title}! 🎉`,at:n}}:i}function mf(e,t,n){let r=e=>({text:e,at:n}),i=(t,n)=>({...e,food:of(e.food+(t.food??0)),fun:of(e.fun+(t.fun??0)),energy:of(e.energy+(t.energy??0)),xp:e.xp+(t.xp??0),say:r(n)});if(t===`nap`)return e.asleep?e.energy<40?{...i({fun:-4},`Five more minutes… 😒`),asleep:!1}:{...i({},`Good morning! ☀️`),asleep:!1}:e.energy>=90?i({},`I'm not sleepy!`):{...i({xp:+(e.energy<50)},`Nap time… 💤`),asleep:!0};if(e.asleep)return t===`pet`?e:i({},`Zzz… (shh, still asleep) 💤`);switch(t){case`snack`:return e.food>=90?i({fun:-2},`I'm stuffed! No more donuts.`):i({food:30,fun:3,xp:1},ff([`Nom nom nom! 🍩`,`Sprinkles! My favourite.`,`Donut-driven development!`],n));case`coffee`:return n-e.coffeeAt<6e5?i({energy:5,fun:-6},`Too… much… coffee! 😵‍💫`):{...i({energy:25,food:3,xp:1},ff([`☕ Ready to ship!`,`Caffeine: loaded.`,`Brb, refactoring everything.`],n)),coffeeAt:n};case`play`:return e.energy<15?i({},`Too tired to play… 🥱`):i({fun:25,energy:-10,food:-6,xp:1},ff([`Wheee! 🎾`,`Again! Again!`,`Best. Break. Ever.`],n));case`pet`:return n-e.pettedAt<3e3?e:{...i({fun:3},ff([`Hehe ❤️`,`*happy wiggle*`,`You're the best manager!`],n)),pettedAt:n}}return e}function hf(e,t,n){let r=lf(e,n);return{...r,fun:of(r.fun+8),xp:r.xp+1,say:{text:t,at:n}}}function gf(e){if(!e||typeof e!=`object`)return null;let t=e,n=[t.born,t.at,t.food,t.fun,t.energy,t.xp,t.coffeeAt,t.pettedAt];if(t.v!==1||typeof t.name!=`string`||typeof t.color!=`string`||typeof t.asleep!=`boolean`||!n.every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let r=t.say&&typeof t.say.text==`string`&&typeof t.say.at==`number`?{text:t.say.text,at:t.say.at}:null;return{...t,food:of(t.food),fun:of(t.fun),energy:of(t.energy),say:r}}function _f(e){try{return JSON.parse(localStorage.getItem(e)??`null`)}catch{return null}}function vf(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}var yf=`cubefarm:games:best`;function bf(e){let t=_f(yf),n=Number(t?.[e]);return Number.isFinite(n)&&n>0?n:0}function xf(e,t){if(t<=bf(e))return!1;let n=_f(yf);return vf(yf,{...n&&typeof n==`object`?n:{},[e]:t}),!0}var Sf=`cubefarm:games:pet`,Cf=gf(_f(Sf)),wf=new Set,Tf=()=>wf.forEach(e=>e()),Ef=()=>Cf;function Df(e){Cf=e,vf(Sf,e),Tf()}function Of(e){return wf.add(e),()=>void wf.delete(e)}function kf(e){return e.task===`qa`?`Yay! ${e.name} finished testing${e.prNumber?` PR #${e.prNumber}`:` a PR`}! 🧪`:e.task===`fix`?`Yay! ${e.name} fixed${e.prNumber?` PR #${e.prNumber}`:` a PR`}! 🔧`:e.issueNumber?`Yay! ${e.name} finished issue #${e.issueNumber}! 🎉`:`Yay! ${e.name} finished a job! 🎉`}T.subscribe((e,t)=>{if(Cf&&t.loaded&&e.agents!==t.agents)for(let n of Object.values(e.agents)){let e=t.agents[n.id];n.role!==`ceo`&&n.status===`done`&&e&&e.status!==`done`&&Df(hf(Cf,kf(n),Date.now()))}}),window.addEventListener(`storage`,e=>{e.key===Sf&&(Cf=gf(_f(Sf)),Tf())});var Y={move:()=>v({freq:420,type:`square`,dur:.03,peak:.012}),rotate:()=>v({freq:560,to:700,type:`triangle`,dur:.06,peak:.04}),land:()=>{u({dur:.07,peak:.07,freq:500,q:.8}),v({freq:180,to:120,type:`triangle`,dur:.08,peak:.05})},lines:e=>[659,784,988,1318.5].slice(0,Math.max(2,e+1)).forEach((e,t)=>v({freq:e,type:`triangle`,at:t*.06,dur:.22,peak:.07})),levelUp:()=>[523,659,784,1046.5].forEach((e,t)=>v({freq:e,type:`square`,at:t*.08,dur:.14,peak:.03})),over:()=>{v({freq:392,to:370,type:`triangle`,dur:.22,peak:.1}),v({freq:311,to:156,type:`triangle`,at:.22,dur:.6,peak:.1})},best:()=>[784,988,1175,1568].forEach((e,t)=>v({freq:e,type:`triangle`,at:.5+t*.07,dur:.28,peak:.08})),chomp:()=>v({freq:300,to:620,type:`square`,dur:.07,peak:.035}),slurp:()=>{u({dur:.2,peak:.05,filter:`bandpass`,freq:400,to:2200,q:2,attack:.03}),v({freq:523,to:1046,type:`triangle`,at:.12,dur:.16,peak:.06})},start:()=>[523,784].forEach((e,t)=>v({freq:e,type:`triangle`,at:t*.08,dur:.14,peak:.07})),pause:()=>v({freq:660,to:440,type:`triangle`,dur:.12,peak:.05}),happy:()=>{v({freq:660,to:1320,type:`square`,dur:.1,peak:.03}),v({freq:1320,to:990,type:`triangle`,at:.1,dur:.12,peak:.07})},nom:()=>[0,.12,.24].forEach(e=>v({freq:250,to:180,type:`triangle`,at:e,dur:.08,peak:.06})),boing:()=>v({freq:220,to:660,type:`sine`,dur:.25,peak:.1}),snore:()=>v({freq:140,to:90,type:`sine`,dur:.6,peak:.05,attack:.2}),grumble:()=>v({freq:160,to:120,type:`sawtooth`,dur:.25,peak:.025})},Af=[...Object.values(df),`Five more minutes… 😒`,`Good morning! ☀️`,`I'm not sleepy!`,`Nap time… 💤`,`Zzz… (shh, still asleep) 💤`,`I'm stuffed! No more donuts.`,`Nom nom nom! 🍩`,`Sprinkles! My favourite.`,`Donut-driven development!`,`Too… much… coffee! 😵‍💫`,`☕ Ready to ship!`,`Caffeine: loaded.`,`Brb, refactoring everything.`,`Too tired to play… 🥱`,`Wheee! 🎾`,`Again! Again!`,`Best. Break. Ever.`,`Hehe ❤️`,`*happy wiggle*`,`You're the best manager!`];function jf(e,t,n){if(n!==`it`)return e;if(Af.some(t=>t===e))return b(n,e);if(e===`Hi! I'm ${t}, your new desk pet. Keep me fed, busy and rested!`)return b(n,`Hi! I’m {name}, your new desk pet. Keep me fed, busy and rested!`,{name:t});for(let{title:t}of af)if(e===`Promoted to ${t}! 🎉`)return b(n,`Promoted to {stage}! 🎉`,{stage:b(n,t)});return e}var Mf=`#ff6fb5`,X=320,Nf=260,Pf=212,Ff=[52,60,68,74],If=1.4,Lf=Date.now(),Rf=[{action:`snack`,icon:`🍩`,label:`Snack`,key:`1`},{action:`coffee`,icon:`☕`,label:`Coffee`,key:`2`},{action:`play`,icon:`🎾`,label:`Play`,key:`3`},{action:`nap`,icon:`💤`,label:`Nap`,key:`4`}];function zf(e,t){let n=t.size,r=-n,i=Math.max(2,n/22),a=Jd(t.color,-.3);e.lineCap=`round`,e.lineJoin=`round`,e.fillStyle=`rgba(31,29,43,0.16)`,e.beginPath(),e.ellipse(0,2,n*.46,n*.07,0,0,Math.PI*2),e.fill();for(let o of[-1,1])e.beginPath(),e.ellipse(o*n*.22,-3,n*.14,n*.08,0,0,Math.PI*2),e.fillStyle=a,e.fill(),e.lineWidth=i,e.strokeStyle=K,e.stroke(),e.beginPath(),t.arms?e.ellipse(o*n*.52,r+n*.3,n*.09,n*.15,o*.5,0,Math.PI*2):e.ellipse(o*n*.5,r+n*.62,n*.09,n*.14,-o*.35,0,Math.PI*2),e.fillStyle=t.color,e.fill(),e.stroke();J(e,-n/2,r,n,n-4,t.color,n*.3,i*1.3);let o=r+n*.4,s=n*.36,c=n*.1,l=t.mood===`asleep`;if(qd(e,0,o,s,c,0,t.mood===`hungry`?.5:.1,l||t.blink),t.mood===`tired`&&!t.blink)for(let n of[-1,1])e.beginPath(),e.ellipse(n*s/2,o,c*1.12,c*1.3,0,Math.PI,Math.PI*2),e.fillStyle=Jd(t.color,-.08),e.fill(),e.lineWidth=i*.8,e.strokeStyle=K,e.beginPath(),e.moveTo(n*s/2-c*1.1,o),e.lineTo(n*s/2+c*1.1,o),e.stroke();if(t.mood===`grumpy`){e.lineWidth=i*1.1,e.strokeStyle=K;for(let t of[-1,1])e.beginPath(),e.moveTo(t*(s/2+c*1.2),o-c*2),e.lineTo(t*(s/2-c*.9),o-c*1.3),e.stroke()}if(t.stage>=2){e.lineWidth=i*.9,e.strokeStyle=K;for(let t of[-1,1])e.beginPath(),e.roundRect(t*s/2-c*1.6,o-c*1.5,c*3.2,c*3,c*.6),e.stroke();e.beginPath(),e.moveTo(-s/2+c*1.6,o-c*.4),e.lineTo(s/2-c*1.6,o-c*.4),e.stroke()}e.fillStyle=`rgba(255,111,181,0.45)`;for(let t of[-1,1])e.beginPath(),e.ellipse(t*n*.3,r+n*.58,n*.075,n*.045,0,0,Math.PI*2),e.fill();let u=r+n*.62,d=n*.12;e.lineWidth=i,e.strokeStyle=K,e.fillStyle=K,e.beginPath(),t.open||t.mood===`hungry`?(e.ellipse(0,u+1,d*.55,d*.65,0,0,Math.PI*2),e.fill()):t.mood===`happy`?(e.arc(0,u-1,d,0,Math.PI),e.closePath(),e.fill(),e.beginPath(),e.ellipse(0,u+d*.55,d*.5,d*.3,0,0,Math.PI*2),e.fillStyle=`#ff8fa3`,e.fill()):t.mood===`content`?(e.arc(0,u-d*.6,d,Math.PI*.15,Math.PI*.85),e.stroke()):t.mood===`grumpy`?(e.arc(0,u+d*.9,d,Math.PI*1.2,Math.PI*1.8),e.stroke()):t.mood===`asleep`?(e.ellipse(0,u+1,d*.3,d*.35,0,0,Math.PI*2),e.fill()):t.mood===`tired`?(e.moveTo(-d,u+1),e.quadraticCurveTo(-d/2,u-2,0,u+1),e.quadraticCurveTo(d/2,u+4,d,u+1),e.stroke()):(e.moveTo(-d*.8,u+1),e.lineTo(d*.8,u+1),e.stroke());let f=r+n*.76;if(t.stage===0?(e.strokeStyle=`#4fb3e8`,e.lineWidth=i*.9,e.beginPath(),e.moveTo(-n*.2,r+n*.7),e.lineTo(0,f+n*.02),e.lineTo(n*.2,r+n*.7),e.stroke(),J(e,-n*.09,f,n*.18,n*.14,`#ffffff`,n*.03,i*.8),e.fillStyle=`#4fb3e8`,e.fillRect(-n*.06,f+n*.04,n*.12,n*.025)):(e.beginPath(),e.moveTo(-n*.05,f-n*.04),e.lineTo(n*.05,f-n*.04),e.lineTo(n*.035,f+n*.02),e.lineTo(n*.065,f+n*.15),e.lineTo(0,f+n*.2),e.lineTo(-n*.065,f+n*.15),e.lineTo(-n*.035,f+n*.02),e.closePath(),e.fillStyle=t.color===`#f25f5c`||t.color===`#ff6fb5`?`#2b2d42`:`#f25f5c`,e.fill(),e.lineWidth=i*.8,e.strokeStyle=K,e.stroke()),t.stage>=3){e.lineWidth=i*1.4,e.strokeStyle=K,e.beginPath(),e.arc(0,r+n*.4,n*.53,Math.PI*1.12,Math.PI*1.88),e.stroke();for(let t of[-1,1])J(e,t*n*.52-n*.08,r+n*.28,n*.16,n*.24,`#2b2d42`,n*.05,i*.8);e.lineWidth=i,e.beginPath(),e.moveTo(-n*.52,r+n*.5),e.quadraticCurveTo(-n*.4,u+n*.08,-d*1.6,u+2),e.stroke(),e.beginPath(),e.arc(-d*1.6,u+2,i*1.2,0,Math.PI*2),e.fillStyle=K,e.fill()}}function Bf(e,t,n,r,i){e.beginPath();for(let i=0;i<10;i++){let a=-Math.PI/2+i*Math.PI/5,o=i%2?r*.45:r;e.lineTo(t+Math.cos(a)*o,n+Math.sin(a)*o)}e.closePath(),e.fillStyle=i,e.fill(),e.lineWidth=2,e.strokeStyle=K,e.stroke()}function Vf(e,t,n,r,i=0){e.save(),e.translate(t,n),e.beginPath(),e.arc(0,0,r,i*Math.PI*1.5,Math.PI*2),e.arc(0,0,r*.38,Math.PI*2,i*Math.PI*1.5,!0),e.closePath(),e.fillStyle=`#e0ac69`,e.fill(),e.lineWidth=2,e.strokeStyle=K,e.stroke(),e.beginPath(),e.arc(0,0,r*.78,i*Math.PI*1.5,Math.PI*2),e.arc(0,0,r*.45,Math.PI*2,i*Math.PI*1.5,!0),e.fillStyle=`#ff8fc7`,e.fill(),[`#4fb3e8`,`#ffc93c`,`#8fd14f`,`#ffffff`].forEach((t,n)=>{let a=n*1.7+.4;a/(Math.PI*2)<i*.75||(e.fillStyle=t,e.fillRect(Math.cos(a)*r*.62-1.5,Math.sin(a)*r*.62-1,3,2))}),e.restore()}function Hf(e,t,n,r){e.lineWidth=2,e.strokeStyle=K,e.beginPath(),e.arc(t+9,n+8,5,-Math.PI/2,Math.PI/2),e.stroke(),J(e,t-9,n,18,18,`#ffffff`,4,2),e.beginPath(),e.ellipse(t,n+3,6.5,2,0,0,Math.PI*2),e.fillStyle=`#8d5524`,e.fill(),e.strokeStyle=`rgba(31,29,43,0.45)`,e.lineWidth=1.5;for(let i of[-3,3]){let a=(r/600+i/7)%1;e.globalAlpha=1-a,e.beginPath(),e.moveTo(t+i,n-3-a*10),e.quadraticCurveTo(t+i+3,n-6-a*10,t+i,n-9-a*10),e.stroke()}e.globalAlpha=1}function Uf(e,t,n,r){e.fillStyle=`#d6e2ef`,e.fillRect(0,0,X,Pf),e.fillStyle=`rgba(255,255,255,0.28)`;for(let t=6;t<X;t+=12)e.fillRect(t,12,1.5,200);e.fillStyle=`#b9c9dc`,e.fillRect(0,0,X,12),e.fillStyle=K,e.fillRect(0,12,X,2),J(e,16,58,76,52,`#d9a066`,6,2);for(let[t,n,r,i]of[[24,66,`#fff3b0`,-.08],[56,70,`#ffd6e8`,.1]]){e.save(),e.translate(t+13,n+13),e.rotate(i),e.fillStyle=r,e.fillRect(-13,-13,26,26),e.strokeStyle=K,e.lineWidth=1.5,e.strokeRect(-13,-13,26,26),e.strokeStyle=`rgba(31,29,43,0.4)`,e.lineWidth=1.2;for(let t=0;t<3;t++)e.beginPath(),e.moveTo(-8,-6+t*6),e.lineTo(8-t*4,-6+t*6),e.stroke();e.beginPath(),e.arc(0,-11,2.5,0,Math.PI*2),e.fillStyle=`#f25f5c`,e.fill(),e.restore()}J(e,232,54,66,60,`#ffffff`,5,2),Gd(e,r(`EMPLOYEE`),265,64,7.5,K,700),Gd(e,r(`OF THE MONTH`),265,73,7,K,700),Bf(e,265,93,13,n?`#ffc93c`:`#e3e7ee`);let i=new Date;e.beginPath(),e.arc(160,42,17,0,Math.PI*2),e.fillStyle=`#ffffff`,e.fill(),e.lineWidth=3,e.strokeStyle=K,e.stroke(),e.lineCap=`round`;for(let[t,n,r]of[[(i.getHours()%12+i.getMinutes()/60)/12,8,3],[(i.getMinutes()+i.getSeconds()/60)/60,12,2]]){let i=t*Math.PI*2-Math.PI/2;e.beginPath(),e.moveTo(160,42),e.lineTo(160+Math.cos(i)*n,42+Math.sin(i)*n),e.lineWidth=r,e.stroke()}e.beginPath(),e.arc(160,42,2.5,0,Math.PI*2),e.fillStyle=`#f25f5c`,e.fill(),e.fillStyle=`#d9b48a`,e.fillRect(0,224,X,36),e.fillStyle=K,e.fillRect(0,224,X,2),J(e,-6,Pf,332,14,`#f1d19b`,5,2.5),J(e,48,200,18,12,`#3d4152`,2,2),J(e,18,146,78,54,`#2b2d42`,7,2.5),e.fillStyle=`#1b1b29`,e.fillRect(25,153,64,40);let a=Math.floor(t/700);for(let t=0;t<5;t++){let n=a+t;e.fillStyle=q[n*3%q.length],e.fillRect(29+n%3*5,157+t*7,14+n*17%30,3)}e.lineWidth=2;for(let[t,n,r]of[[262,176,13],[276,168,11],[252,164,10]])e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fillStyle=`#52b788`,e.fill(),e.strokeStyle=K,e.stroke();J(e,248,186,32,26,`#e07a5f`,5,2)}function Wf(e,t=1,n=e=>e){e.save(),e.scale(t,t),J(e,-38,-56,76,56,`#d9a066`,6,2.5),e.fillStyle=`rgba(241,209,155,0.9)`,e.fillRect(-7,-55,14,54),J(e,-30,-34,38,16,`#ffffff`,3,1.5),Gd(e,n(`NEW HIRE`),-11,-26,7.5,K,700),e.restore()}function Gf(e,t,n,r){e.lineWidth=2,e.strokeStyle=K,e.fillStyle=`#ffffff`;for(let[r,i,a]of[[-16,22,3],[-10,14,5]])e.beginPath(),e.arc(t+r,n+i,a,0,Math.PI*2),e.fill(),e.stroke();e.beginPath(),e.ellipse(t+8,n-4,20,15,0,0,Math.PI*2),e.fill(),e.stroke(),e.save(),e.translate(t+8,n-4),r(),e.restore()}function Kf({onBack:e}){let t=j(),n=T(e=>e.settings.language),r=(0,M.useSyncExternalStore)(Of,Ef),[i,a]=(0,M.useState)(Date.now()),o=(0,M.useRef)(null),s=(0,M.useRef)([]),c=(0,M.useRef)(0),l=(0,M.useRef)(r?.say?.at??0),[u]=(0,M.useState)(()=>Date.now()),[d]=(0,M.useState)(()=>r?.say&&r.say.at>Lf&&u-r.say.at>5e3?r.say:null);(0,M.useEffect)(()=>{let e=setInterval(()=>a(Date.now()),1e3);return()=>{clearInterval(e),Lf=Date.now()}},[]);let f=r?.say?.at??0;(0,M.useEffect)(()=>{f!==l.current&&(l.current=f,f!==c.current&&Date.now()-f<3e3&&(o.current={kind:`cheer`,t:0},Yd(s.current,X/2,152,q,16,140),Y.happy()))},[f]);let p=()=>{if(Ef())return;let e=cf(Date.now(),Math.random(),Math.random());c.current=e.say?.at??0,o.current={kind:`hatch`,t:0},Yd(s.current,X/2,182,[`#d9a066`,`#f1d19b`,...q],22,170),Y.levelUp(),Df(e)},m=e=>{let t=Ef();if(!t)return;let n=Date.now(),r=pf(t,e,n);r.say?.at===n&&(c.current=n),Df(r),a(n);let i=r.xp>t.xp,l=Ff[sf(r.xp)];if(r.say?.text.startsWith(`Promoted`)){Y.levelUp(),Yd(s.current,X/2,Pf-l,q,22,160),o.current={kind:`cheer`,t:0};return}switch(e){case`snack`:case`play`:i?(o.current={kind:e,t:0},(e===`snack`?Y.nom:Y.boing)()):r.asleep||Y.grumble();break;case`coffee`:i?(o.current={kind:`coffee`,t:0},Y.slurp()):r.asleep||(o.current={kind:`jitter`,t:0},Y.grumble());break;case`nap`:r.asleep?Y.snore():t.asleep&&(o.current={kind:`wake`,t:0},Y.happy());break;case`pet`:if(r.pettedAt===n){o.current={kind:`pet`,t:0};for(let e=0;e<3;e++)s.current.push({x:X/2+(e-1)*16,y:Pf-l-6,vx:(e-1)*14,vy:-50-e*8,life:1.1,color:`#ff6fb5`,size:16+e*2,text:`♥`});Y.happy()}}};Id(e=>{if(e.repeat)return!1;let t=Rf.find(t=>e.code===`Digit${t.key}`||e.code===`Numpad${t.key}`);return t?(m(t.action),!0):zd(e.code)?(Ef()?m(`pet`):p(),!0):!1});let h=(e,n,r)=>{let i=Ef(),a=i?lf(i,Date.now()):null,c=a?uf(a):`content`,l=a?sf(a.xp):0;Uf(e,r,l>=2||c===`happy`,t);let u=o.current;if(u&&(u.t+=n,u.t>If&&(o.current=null)),a){let t=Ff[l],n=X/2,i=0,o=1,s=1,d=Math.sin(r/(c===`asleep`?900:450));s+=d*(c===`asleep`?.04:.025),o-=d*.015;let f=u?u.t/If:0;if((u?.kind===`play`||u?.kind===`cheer`||u?.kind===`wake`)&&(i=Math.abs(Math.sin(f*Math.PI*(u.kind===`wake`?1:4)))*(u.kind===`wake`?10:16)*(1-f*.5)),(u?.kind===`coffee`||u?.kind===`jitter`)&&(n+=Math.sin(u.t*70)*(u.kind===`jitter`?2.5:1.2)),u?.kind===`pet`){let e=Math.sin(Math.min(1,f*3)*Math.PI)*.1;s-=e,o+=e}if(u?.kind===`hatch`){let e=Math.min(1,f*3);o*=.3+e*.7,s*=.3+e*.7}e.save(),e.translate(n,214-i),e.scale(o,s);let p=u?.kind===`snack`&&f>.3&&Math.floor(u.t*8)%2==0;zf(e,{size:t,color:a.color,mood:u?.kind===`jitter`?`grumpy`:u?.kind===`cheer`||u?.kind===`play`?`happy`:c,stage:l,blink:Math.floor(r/160)%24==0,open:p,arms:u?.kind===`cheer`||u?.kind===`play`}),e.restore();let m=Pf-t-i;if(u?.kind===`snack`){let r=Math.min(1,f/.3);Vf(e,n+t*.2+60*(1-r),202+(12-t*.38)*r-Math.sin(r*Math.PI)*24,10*(1-Math.max(0,f-.3)*.6),Math.max(0,(f-.3)/.7))}if(u?.kind===`coffee`&&Hf(e,n+t/2+16,194,r),u?.kind===`play`){let t=X/2+Math.cos(f*Math.PI*2)*70,n=196-Math.abs(Math.sin(f*Math.PI*5))*60;e.beginPath(),e.arc(t,n,8,0,Math.PI*2),e.fillStyle=`#d4f25c`,e.fill(),e.lineWidth=2,e.strokeStyle=K,e.stroke(),e.beginPath(),e.arc(t-8,n,7,-.9,.9),e.strokeStyle=`#ffffff`,e.stroke()}if(!u){let i=Math.sin(r/400)*2;if(c===`asleep`){for(let i=0;i<3;i++){let a=(r/1400+i/3)%1;e.globalAlpha=Math.min(1,(1-a)*2),Kd(e,`z`,n+t*.35+a*26,m-a*34,12+a*10,`#ffffff`)}e.globalAlpha=1}else if(c===`hungry`)Gf(e,n+t*.55+18,m-8+i,()=>Vf(e,0,0,9));else if(c===`bored`)Gf(e,n+t*.55+18,m-8+i,()=>Gd(e,`…`,0,-2,20,K,700));else if(c===`tired`)Gf(e,n+t*.55+18,m-8+i,()=>Gd(e,`💤`,0,0,14,K,400));else if(c===`grumpy`){let t=n,a=m-22+i;e.fillStyle=`#8e93a8`,e.strokeStyle=K,e.lineWidth=2,e.beginPath(),e.arc(t-12,a,9,0,Math.PI*2),e.arc(t,a-5,11,0,Math.PI*2),e.arc(t+12,a,9,0,Math.PI*2),e.fill(),e.stroke(),e.fill(),Math.floor(r/250)%6==0&&(e.beginPath(),e.moveTo(t+2,a+8),e.lineTo(t-3,a+16),e.lineTo(t+2,a+16),e.lineTo(t-2,a+24),e.strokeStyle=`#ffc93c`,e.lineWidth=2.5,e.stroke())}else if(c===`happy`&&Math.floor(r/900)%3==0){let i=r%900/900;e.globalAlpha=Math.sin(i*Math.PI),Kd(e,`✦`,n-t*.6,m+10-i*8,14,`#ffc93c`),Kd(e,`✦`,n+t*.62,m+22-i*6,11,`#ffffff`),e.globalAlpha=1}}c===`asleep`&&(e.fillStyle=`rgba(28,36,82,0.32)`,e.fillRect(0,0,X,Nf))}else{let n=r%2600<450?Math.sin(r/45)*.06:0;e.save(),e.translate(X/2,213),e.rotate(n),Wf(e,1,t),e.restore(),Kd(e,`?`,194,142+Math.sin(r/300)*3,20,`#ffc93c`)}Zd(e,s.current,n)},g=(e,t,n)=>{if(e!==`down`)return;let r=Ef();if(!r){Math.abs(t-X/2)<50&&n>142&&p();return}let i=Ff[sf(r.xp)];Math.abs(t-X/2)<i/2+8&&n>Pf-i-12&&n<218&&m(`pet`)},_=r?lf(r,i):null,v=_?uf(_):null,y=_?.say&&i-_.say.at<2e4?jf(_.say.text,_.name,n):null,b=_?y??(d&&i-u<1e4?t(`While you were away: {text}`,{text:jf(d.text,_.name,n)}):t(df[v])):t(`A delivery just arrived at your desk…`),x=_?t(af[sf(_.xp)].title):``,S=_?Math.floor((i-_.born)/864e5)+1:0,C=_?[[`🍩`,`Food`,_.food,`#ffc93c`],[`🎾`,`Fun`,_.fun,`#ff6fb5`],[`⚡`,`Energy`,_.energy,`#4fb3e8`]]:[];return(0,N.jsxs)(`div`,{className:`game pet`,children:[(0,N.jsx)(Ld,{title:`Desk Pet`,color:Mf,onBack:e,children:_&&(0,N.jsxs)(`span`,{className:`game-chip`,title:t(`{count} care points`,{count:_.xp}),children:[_.name,` · `,x]})}),(0,N.jsx)(`div`,{className:`pet-say`,"aria-live":`polite`,children:b}),(0,N.jsx)(Fd,{width:X,height:Nf,frame:h,label:_?t(`{name}, your desk pet, is {mood}`,{name:_.name,mood:t(v)}):t(`A delivery box`),onPointer:g}),_?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`pet-bars`,children:C.map(([e,n,r,i])=>(0,N.jsxs)(`div`,{className:`pet-bar ${r<25?`pet-bar-low`:``}`,title:`${t(n)}: ${Math.round(r)}%`,children:[(0,N.jsxs)(`span`,{className:`pet-bar-label`,children:[e,` `,t(n)]}),(0,N.jsx)(`span`,{className:`pet-meter`,children:(0,N.jsx)(`i`,{style:{width:`${Math.max(2,r)}%`,background:i}})})]},n))}),(0,N.jsx)(`div`,{className:`pet-actions`,children:Rf.map(e=>{let n=e.action===`nap`&&_.asleep;return(0,N.jsxs)(`button`,{type:`button`,className:`btn btn-small pet-act`,tabIndex:-1,onPointerDown:e=>e.preventDefault(),onClick:()=>m(e.action),disabled:_.asleep&&!n,title:`${t(n?`Wake up`:e.action===`play`?`Play with pet`:e.label)} (${e.key})`,children:[(0,N.jsx)(`span`,{className:`pet-act-icon`,children:n?`☀️`:e.icon}),t(n?`Wake`:e.action===`play`?`Play with pet`:e.label)]},e.action)})}),(0,N.jsxs)(`div`,{className:`game-keys`,children:[(0,N.jsx)(`kbd`,{children:`1`}),`–`,(0,N.jsx)(`kbd`,{children:`4`}),` `,(0,N.jsx)(A,{children:`care · click`}),` `,_.name,` (`,(0,N.jsx)(A,{children:`or`}),` `,(0,N.jsx)(`kbd`,{children:`Space`}),`) `,t(`for a pat · day {day}`,{day:S})]})]}):(0,N.jsx)(`div`,{className:`pet-actions`,children:(0,N.jsx)(`button`,{type:`button`,className:`btn btn-good pet-unbox`,onClick:p,children:(0,N.jsx)(A,{children:`📦 Unbox your desk pet`})})})]})}function qf(e){let t=e+1831565813|0,n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,[((n^n>>>14)>>>0)/4294967296,t]}var Jf=()=>Math.floor(Math.random()*2**31),Yf={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},Xf={up:`down`,down:`up`,left:`right`,right:`left`},Zf={bug:10,coffee:50},Qf={bug:1,coffee:2},$f=(e,t)=>e.x===t.x&&e.y===t.y;function ep(e,t){let n=Math.floor(e*.2),r=e-n-2,i=Math.floor(t*.2),a=t-i-1;return[n,r].flatMap(e=>[i,a].flatMap(t=>[{x:e,y:t},{x:e+1,y:t}]))}function tp(e,t,n,r){let i=new Set(n.map(t=>t.y*e+t.x)),a=[];for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.has(n*e+t)||a.push({x:t,y:n});if(!a.length)return{at:null,seed:r};let[o,s]=qf(r);return{at:a[Math.floor(o*a.length)],seed:s}}function np(e,t=16,n=16){let r=Math.floor(n/2),i=Math.floor(t/2)-1,a=[0,1,2].map(e=>({x:i-e,y:r})),o=ep(t,n),s=tp(t,n,[...a,...o],e);return{cols:t,rows:n,body:a,dir:`right`,queue:[],desks:o,food:{...s.at??{x:0,y:0},kind:`bug`},grow:0,score:0,eaten:0,seed:s.seed,over:null,ate:null}}function rp(e,t){if(e.over)return e;let n=e.queue[e.queue.length-1]??e.dir;return t===n||t===Xf[n]||e.queue.length>=2?e:{...e,queue:[...e.queue,t]}}function ip(e){if(e.over)return e;let[t=e.dir,...n]=e.queue,r=Yf[t],i={x:e.body[0].x+r.x,y:e.body[0].y+r.y},a=r=>({...e,dir:t,queue:n,over:r,ate:null});if(i.x<0||i.y<0||i.x>=e.cols||i.y>=e.rows)return a(`wall`);if(e.desks.some(e=>$f(e,i)))return a(`desk`);let o=e.grow>0?e.body:e.body.slice(0,-1);if(o.some(e=>$f(e,i)))return a(`self`);let s=[i,...o],c=Math.max(0,e.grow-1);if(!$f(i,e.food))return{...e,body:s,dir:t,queue:n,grow:c,ate:null};let l=e.food.kind,u=e.eaten+1;c+=Qf[l];let d=tp(e.cols,e.rows,[...s,...e.desks],e.seed),f={...e,body:s,dir:t,queue:n,grow:c,eaten:u,score:e.score+Zf[l],seed:d.seed,ate:l};return d.at?{...f,food:{...d.at,kind:(u+1)%5==0?`coffee`:`bug`}}:{...f,over:`won`}}var ap=e=>Math.max(70,165-e.eaten*4),op=`#4fb3e8`,sp=20,cp=6,lp=38,up=16,dp=16,fp=332,pp=364,mp=`#4fb3e8`,hp=null,gp=()=>hp!==null,_p={wall:`Unplugged!`,self:`Tangled up!`,desk:`Desk crash!`,won:`Office wired! 🎉`},vp={right:0,down:Math.PI/2,left:Math.PI,up:-Math.PI/2},yp={right:[1,0],down:[0,1],left:[-1,0],up:[0,-1]},bp=e=>cp+e.x*sp+sp/2,xp=e=>lp+e.y*sp+sp/2;function Sp({onBack:e}){let t=j(),[n,r]=(0,M.useState)(hp?`paused`:`ready`),i=(0,M.useRef)({game:hp??np(Jf(),up,dp),status:hp?`paused`:`ready`,acc:0,best:bf(`snake`),newBest:!1,particles:[],shake:0,chomp:0,swipe:null}),a=e=>{i.current.status=e,r(e),hp=e===`over`||e===`ready`?null:i.current.game},o=e=>{let t=i.current,n=t.game;if(e!==n){if(t.game=e,t.status===`playing`&&(hp=e),e.ate){let n=e.body[0];e.ate===`coffee`?Y.slurp():Y.chomp(),t.chomp=.18,Yd(t.particles,bp(n),xp(n),e.ate===`coffee`?[`#8d5524`,`#ffffff`,`#ffc93c`]:[`#f25f5c`,`#8fd14f`,`#ffffff`],8,90),Xd(t.particles,bp(n),xp(n)-12,e.ate===`coffee`?`+50 ☕`:`+10`,e.ate===`coffee`?`#ffc93c`:`#ffffff`,15)}e.over&&!n.over&&(t.newBest=xf(`snake`,e.score),t.newBest&&(t.best=e.score),t.shake=e.over===`won`?0:.3,e.over===`won`?Y.best():Y.over(),t.newBest&&e.over!==`won`&&Y.best(),a(`over`))}},s=()=>{let e=i.current;e.status!==`playing`&&(e.status===`over`&&(e.game=np(Jf(),up,dp)),e.status!==`paused`&&(e.newBest=!1,e.particles.length=0),e.acc=0,Y.start(),a(`playing`))},c=()=>{i.current.status===`playing`&&(Y.pause(),a(`paused`))},l=e=>{if(i.current.status!==`playing`){if(i.current.status===`paused`)return s();s()}o(rp(i.current.game,e))};Id(e=>{let t=Rd(e.code);return t?(e.repeat||l(t),!0):zd(e.code)?(e.repeat||(i.current.status===`playing`?c:s)(),!0):!1}),Bd(c);let u=(e,t,n)=>{let r=i.current;if(e===`down`){r.swipe={x:t,y:n};return}if(!r.swipe)return;let a=t-r.swipe.x,o=n-r.swipe.y;e===`move`&&Math.max(Math.abs(a),Math.abs(o))>18?(l(Math.abs(a)>Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`),r.swipe={x:t,y:n}):e===`up`&&(Math.max(Math.abs(a),Math.abs(o))<8&&r.status!==`playing`&&s(),r.swipe=null)},d=(e,n,r)=>{let a=i.current;if(a.status===`playing`){a.acc+=n*1e3;let e=ap(a.game);for(;a.acc>=e&&a.status===`playing`;)a.acc-=e,o(ip(a.game)),e=ap(a.game)}let s=a.game;Wd(e,cp,4,96,26,`#ffffff`,9),Gd(e,t(`🐛 {count} eaten`,{count:s.eaten}),54,17,12,K,700),Wd(e,fp/2-50,4,100,26,`#ffffff`,9),Gd(e,t(`SCORE {score}`,{score:s.score}),fp/2,17,12,K,700),Wd(e,230,4,96,26,`#ffffff`,9);let c=Math.max(a.best,s.score);Gd(e,t(`BEST {score}`,{score:c}),278,17,12,s.score>a.best?`#e05a2b`:Ud,700),e.save(),a.shake>0&&(a.shake-=n,e.translate((Math.random()-.5)*12*a.shake,(Math.random()-.5)*12*a.shake)),Wd(e,3,35,326,326,`#e6ebf3`,8),e.save(),e.beginPath(),e.roundRect(cp,lp,320,320,6),e.clip(),e.fillStyle=`#dce3ee`;for(let t=0;t<dp;t++)for(let n=0;n<up;n++)(n+t)%2&&e.fillRect(cp+n*sp,lp+t*sp,sp,sp);e.restore();for(let t=0;t+1<s.desks.length;t+=2){let n=s.desks[t],r=cp+n.x*sp,i=lp+n.y*sp;J(e,r+1,i+2,38,17,`#f1d19b`,5),J(e,r+sp-8,i-3,16,12,`#2b2d42`,3,1.5),e.fillStyle=q[t/2%q.length],e.fillRect(r+sp-5,i,10,5)}Cp(e,s,r),wp(e,s,a.chomp,r),a.chomp=Math.max(0,a.chomp-n),e.restore(),Zd(e,a.particles,n),a.status===`ready`?Qd(e,fp,pp,`Cable Snake`,[t(`Eat bugs 🐛, sip coffee ☕`),t(`Dodge desks, walls & yourself`),t(`Arrows, swipe or tap to start`)],op):a.status===`paused`?Qd(e,fp,pp,t(`Coffee break ☕`),[t(`Score {score}`,{score:s.score}),t(`Space or tap to resume`)],op):a.status===`over`&&Qd(e,fp,pp,t(_p[s.over??`self`]),[t(`Score {score} · {length} long`,{score:s.score,length:s.body.length}),a.newBest?t(`🏆 New best!`):t(`Best {score}`,{score:a.best}),t(`Space or tap to play again`)],s.over===`won`?`#8fd14f`:`#f25f5c`)},f=(e,n,r)=>(0,N.jsx)(Vd,{label:t(r),className:`game-pad-${e}`,onPress:()=>l(e),children:n});return(0,N.jsxs)(`div`,{className:`game`,children:[(0,N.jsx)(Ld,{title:`Cable Snake`,color:op,onBack:e,children:(0,N.jsx)(`button`,{type:`button`,className:`game-mini`,tabIndex:-1,onPointerDown:e=>e.preventDefault(),onClick:()=>n===`playing`?c():s(),title:t(n===`playing`?`Pause (Space)`:`Play (Space)`),children:n===`playing`?`⏸`:`▶`})}),(0,N.jsx)(Fd,{width:fp,height:pp,frame:d,label:t(`Cable Snake board`),onPointer:u}),(0,N.jsxs)(`div`,{className:`game-dpad`,children:[f(`up`,`▲`,`Up`),f(`left`,`◀`,`Left`),f(`right`,`▶`,`Right`),f(`down`,`▼`,`Down`)]}),(0,N.jsxs)(`div`,{className:`game-keys`,children:[(0,N.jsx)(`kbd`,{children:`←`}),(0,N.jsx)(`kbd`,{children:`↑`}),(0,N.jsx)(`kbd`,{children:`→`}),(0,N.jsx)(`kbd`,{children:`↓`}),` `,(0,N.jsx)(A,{children:`or`}),` `,(0,N.jsx)(`kbd`,{children:`WASD`}),` `,(0,N.jsx)(A,{children:`steer · swipe on the board ·`}),` `,(0,N.jsx)(`kbd`,{children:`Space`}),` `,(0,N.jsx)(A,{children:`pause`})]})]})}function Cp(e,t,n){let r=bp(t.food),i=xp(t.food);if(e.save(),e.translate(r,i),t.food.kind===`coffee`){let t=.5+Math.sin(n/200)*.5;e.beginPath(),e.arc(0,0,10+t*2,0,Math.PI*2),e.fillStyle=`rgba(255,201,60,${.25+t*.2})`,e.fill(),e.lineWidth=2,e.strokeStyle=K,e.beginPath(),e.arc(5,1,3.5,-Math.PI/2,Math.PI/2),e.stroke(),e.beginPath(),e.roundRect(-7,-5,12,12,2.5),e.fillStyle=`#ffffff`,e.fill(),e.stroke(),e.beginPath(),e.ellipse(-1,-4,5,1.6,0,0,Math.PI*2),e.fillStyle=`#8d5524`,e.fill(),e.strokeStyle=`rgba(31,29,43,0.5)`,e.lineWidth=1.2;for(let t of[-3,1]){let r=(n/400+t)%1;e.globalAlpha=1-r,e.beginPath(),e.moveTo(t,-7-r*6),e.quadraticCurveTo(t+2,-9-r*6,t,-11-r*6),e.stroke()}e.globalAlpha=1}else{e.rotate(Math.sin(n/160)*.18),e.strokeStyle=K,e.lineWidth=1.4,e.lineCap=`round`;for(let t of[-1,1])for(let r of[-3,.5,4])e.beginPath(),e.moveTo(t*3,r),e.lineTo(t*8,r+Math.sin(n/90+r)*1.5-1),e.stroke();e.beginPath(),e.moveTo(-1.5,-7),e.lineTo(-4,-10),e.moveTo(1.5,-7),e.lineTo(4,-10),e.stroke(),e.beginPath(),e.arc(0,-6,3,0,Math.PI*2),e.fillStyle=K,e.fill(),e.beginPath(),e.ellipse(0,1,5.5,6.5,0,0,Math.PI*2),e.fillStyle=`#f25f5c`,e.fill(),e.lineWidth=1.8,e.stroke(),e.beginPath(),e.moveTo(0,-5),e.lineTo(0,7),e.lineWidth=1.2,e.stroke(),e.fillStyle=K;for(let[t,n]of[[-2.6,-.5],[2.6,-.5],[-2.4,3.5],[2.4,3.5]])e.beginPath(),e.arc(t,n,1.1,0,Math.PI*2),e.fill()}e.restore()}function wp(e,t,n,r){let i=t.body;e.lineCap=`round`,e.lineJoin=`round`,(()=>{e.beginPath(),e.moveTo(bp(i[i.length-1]),xp(i[i.length-1]));for(let t=i.length-2;t>=0;t--)e.lineTo(bp(i[t]),xp(i[t]))})(),e.strokeStyle=K,e.lineWidth=14,e.stroke(),e.strokeStyle=mp,e.lineWidth=10,e.stroke(),e.save(),e.translate(0,-2),e.strokeStyle=`rgba(255,255,255,0.4)`,e.lineWidth=3,e.stroke(),e.restore(),e.strokeStyle=Jd(mp,-.45),e.lineWidth=3;for(let t=3;t<i.length-1;t+=4){let n=i[t],r=i[t+1],a=(bp(n)+bp(r))/2,o=(xp(n)+xp(r))/2,s=n.x===r.x;e.beginPath(),e.moveTo(a-(s?5:0),o-(s?0:5)),e.lineTo(a+(s?5:0),o+(s?0:5)),e.stroke()}let a=i[0],o=t.queue[0]??t.dir,s=bp(a),c=xp(a);e.save(),e.translate(s,c),e.rotate(vp[t.dir]);let l=n>0?1.12:1;e.scale(l,l),e.beginPath(),e.roundRect(-8,-8,16,16,3.5),e.fillStyle=`#e4f4ff`,e.fill(),e.lineWidth=2,e.strokeStyle=K,e.stroke(),e.fillStyle=`#ffc93c`;for(let t=0;t<4;t++)e.fillRect(5,-6+t*3.3,3,1.8);e.restore();let[u,d]=yp[o],f=s-yp[t.dir][0]*2,p=c-yp[t.dir][1]*2-1;if(t.over&&t.over!==`won`){e.strokeStyle=K,e.lineWidth=2;for(let t of[-1,1]){let n=f+t*4;e.beginPath(),e.moveTo(n-2.5,p-2.5),e.lineTo(n+2.5,p+2.5),e.moveTo(n+2.5,p-2.5),e.lineTo(n-2.5,p+2.5),e.stroke()}}else qd(e,f,p,8,3.2,u,d,Math.floor(r/170)%25==0)}var Tp=[`I`,`O`,`T`,`S`,`Z`,`J`,`L`],Ep={I:[`....`,`XXXX`,`....`,`....`],O:[`XX`,`XX`],T:[`.X.`,`XXX`,`...`],S:[`.XX`,`XX.`,`...`],Z:[`XX.`,`.XX`,`...`],J:[`X..`,`XXX`,`...`],L:[`..X`,`XXX`,`...`]};function Dp(e){let t=[];return e.forEach((e,n)=>[...e].forEach((e,r)=>e===`X`&&t.push([r,n]))),t}function Op(e){let t=e.length;return e.map((n,r)=>e.map((n,i)=>e[t-1-i][r]).join(``))}var kp=Object.fromEntries(Tp.map(e=>{let t=[Ep[e]];for(let e=1;e<4;e++)t.push(Op(t[e-1]));return[e,t.map(Dp)]})),Ap=()=>Array.from({length:20},()=>Array(10).fill(null));function jp(e){return kp[e.type][e.rot].map(([t,n])=>[e.x+t,e.y+n])}var Mp=e=>kp[e][0];function Np(e,t){return jp(t).some(([t,n])=>t<0||t>=10||n>=20||n>=0&&e[n][t]!==null)}function Pp(e){let t=Ep[e].length,n=Math.min(...kp[e][0].map(([,e])=>e));return{type:e,rot:0,x:Math.floor((10-t)/2),y:-n}}function Fp(e,t){let n=[...e],r=t;for(;n.length<Tp.length;){let e=[...Tp];for(let t=e.length-1;t>0;t--){let[n,i]=qf(r);r=i;let a=Math.floor(n*(t+1));[e[t],e[a]]=[e[a],e[t]]}n.push(...e)}return{queue:n,seed:r}}function Ip(e){let t=Fp([],e),[n,...r]=t.queue,i=Fp(r,t.seed);return{board:Ap(),piece:Pp(n),queue:i.queue,seed:i.seed,score:0,lines:0,level:1,over:!1,cleared:[],locks:0}}var Lp=e=>Math.max(80,Math.round(800*.85**(e-1))),Rp=[0,100,300,500,800];function zp(e){let t=[],n=e.filter((e,n)=>{let r=e.every(e=>e!==null);return r&&t.push(n),!r});return t.length?{board:[...Array.from({length:t.length},()=>Array(10).fill(null)),...n],rows:t}:{board:e,rows:t}}function Bp(e,t,n=0){if(e.over)return e;let r={...e.piece,x:e.piece.x+t,y:e.piece.y+n};return Np(e.board,r)?e:{...e,piece:r}}var Vp=[[0,0],[-1,0],[1,0],[0,-1],[-1,-1],[1,-1]],Hp=[[0,0],[-1,0],[1,0],[-2,0],[2,0],[0,-1]];function Up(e,t=1){if(e.over||e.piece.type===`O`)return e;let n=(e.piece.rot+t+4)%4;for(let[t,r]of e.piece.type===`I`?Hp:Vp){let i={...e.piece,rot:n,x:e.piece.x+t,y:e.piece.y+r};if(!Np(e.board,i))return{...e,piece:i}}return e}function Wp(e){let t=0;for(;!Np(e.board,{...e.piece,y:e.piece.y+t+1});)t++;return t}function Gp(e){if(e.over)return e;let t=jp(e.piece),n=e.board.map(e=>[...e]),r=!1;for(let[i,a]of t)a<0?r=!0:n[a][i]=e.piece.type;let{board:i,rows:a}=zp(n),o=e.lines+a.length,s=e.score+Rp[a.length]*e.level,c=1+Math.floor(o/10),[l,...u]=e.queue,d=Fp(u,e.seed),f=Pp(l),p=r||Np(i,f);return{board:i,piece:f,queue:d.queue,seed:d.seed,score:s,lines:o,level:c,over:p,cleared:a,locks:e.locks+1}}function Kp(e){if(e.over)return e;let t=Bp(e,0,1);return t===e?Gp(e):t}function qp(e){if(e.over)return e;let t=Bp(e,0,1);return t===e?Gp(e):{...t,score:t.score+1}}function Jp(e){if(e.over)return e;let t=Wp(e);return Gp({...e,piece:{...e.piece,y:e.piece.y+t},score:e.score+t*2})}var Yp=`#c77dff`,Xp={I:q[1],O:q[4],T:q[3],S:q[2],Z:q[7],J:q[6],L:q[0]},Z=18,Q=8,$=8,Zp=10*Z,Qp=20*Z,$p=Q+Zp+12,em=$p+92+6,tm=$+Qp+8,nm=null,rm=()=>nm!==null,im=[``,`Shipped!`,`Double ship!`,`Triple ship!`,`CUBETRIS!`];function am({onBack:e}){let t=j(),[n,r]=(0,M.useState)(nm?`paused`:`ready`),i=(0,M.useRef)({game:nm??Ip(Jf()),status:nm?`paused`:`ready`,acc:0,best:bf(`tetris`),newBest:!1,flash:[],particles:[],shake:0,lastDx:0}),a=e=>{i.current.status=e,r(e),nm=e===`over`||e===`ready`?null:i.current.game},o=e=>{let n=i.current,r=n.game;if(e===r)return!1;if(n.game=e,nm=n.status===`playing`?e:nm,e.locks!==r.locks){let i=e.cleared.length;if(i){Y.lines(i);let a=e.score-r.score;for(let t of e.cleared)n.flash.push({y:t,t:.35}),Yd(n.particles,Q+Zp/2,$+t*Z+Z/2,q,10,150);let o=$+e.cleared.reduce((e,t)=>e+t,0)/i*Z;Xd(n.particles,Q+Zp/2,o-14,t(im[i]),i===4?`#ffc93c`:`#ffffff`,i===4?26:20),Xd(n.particles,Q+Zp/2,o+12,`+${a}`,`#80ed99`,16),i===4&&(n.shake=.35)}else Y.land();e.level>r.level&&(Y.levelUp(),Xd(n.particles,Q+Zp/2,$+Qp/3,t(`Level {level}!`,{level:e.level}),`#4fb3e8`,24)),e.over&&(n.newBest=xf(`tetris`,e.score),n.newBest&&(n.best=e.score),Y.over(),n.newBest&&Y.best(),a(`over`))}return!0},s=()=>{let e=i.current;e.status!==`playing`&&((e.status===`over`||e.status===`ready`)&&(e.status===`over`&&(e.game=Ip(Jf())),e.newBest=!1,e.particles.length=0),e.acc=0,Y.start(),a(`playing`))},c=()=>{i.current.status===`playing`&&(Y.pause(),a(`paused`))},l=e=>{i.current.lastDx=e,o(Bp(i.current.game,e))&&Y.move()},u=e=>o(Up(i.current.game,e))&&Y.rotate(),d=()=>{i.current.acc=0,o(qp(i.current.game))},f=()=>{i.current.acc=0,o(Jp(i.current.game))},p=e=>()=>i.current.status===`playing`?e():s();return Id(e=>{let t=i.current.status===`playing`,n=Rd(e.code);return zd(e.code)?(e.repeat||(t?e.code===`Space`?f():c():s()),!0):n?(t&&(n===`left`||n===`right`?l(n===`left`?-1:1):n===`down`?d():e.repeat||u(1)),!0):e.code===`KeyZ`||e.code===`KeyQ`||e.code===`KeyX`?(t&&!e.repeat&&u(e.code===`KeyX`?1:-1),!0):!1}),Bd(c),(0,N.jsxs)(`div`,{className:`game`,children:[(0,N.jsx)(Ld,{title:`Cubetris`,color:Yp,onBack:e,children:(0,N.jsx)(`button`,{type:`button`,className:`game-mini`,tabIndex:-1,onPointerDown:e=>e.preventDefault(),onClick:()=>n===`playing`?c():s(),title:t(n===`playing`?`Pause (Enter)`:`Play (Space)`),children:n===`playing`?`⏸`:`▶`})}),(0,N.jsx)(Fd,{width:em,height:tm,frame:(e,n,r)=>{let a=i.current;if(a.status===`playing`){a.acc+=n*1e3;let e=Lp(a.game.level);for(;a.acc>=e&&a.status===`playing`;)a.acc-=e,o(Kp(a.game))}let s=a.game;e.save(),a.shake>0&&(a.shake-=n,e.translate((Math.random()-.5)*6*a.shake*3,(Math.random()-.5)*6*a.shake*3)),Wd(e,5,5,Zp+6,Qp+6,`#e3e9f3`,8),e.strokeStyle=`rgba(80,100,140,0.12)`,e.lineWidth=1,e.beginPath();for(let t=1;t<10;t++)e.moveTo(Q+t*Z,$),e.lineTo(Q+t*Z,$+Qp);for(let t=1;t<20;t++)e.moveTo(Q,$+t*Z),e.lineTo(Q+Zp,$+t*Z);if(e.stroke(),s.board.forEach((t,n)=>t.forEach((t,r)=>t&&J(e,Q+r*Z,$+n*Z,Z,Z,Xp[t],4.5))),!s.over){let t=Wp(s);e.setLineDash([3,3]);for(let[n,r]of jp({...s.piece,y:s.piece.y+t}))r<0||(e.beginPath(),e.roundRect(Q+n*Z+2,$+r*Z+2,14,14,4),e.fillStyle=`${Xp[s.piece.type]}44`,e.fill(),e.strokeStyle=`rgba(31,29,43,0.45)`,e.lineWidth=1.5,e.stroke());e.setLineDash([]);let n=jp(s.piece);e.save(),e.beginPath(),e.rect(6,$,Zp+4,Qp+4),e.clip();for(let[t,r]of n)J(e,Q+t*Z,$+r*Z,Z,Z,Xp[s.piece.type],4.5);let i=n.reduce((e,[t])=>e+t,0)/n.length,o=n.reduce((e,[,t])=>e+t,0)/n.length,[c,l]=n.reduce((e,t)=>Math.hypot(t[0]-i,t[1]-o)<Math.hypot(e[0]-i,e[1]-o)?t:e);l>=0&&qd(e,Q+c*Z+Z/2,$+l*Z+Z/2-1,8,2.7,a.lastDx,.6,Math.floor(r/180)%22==0),e.restore()}a.flash=a.flash.filter(e=>(e.t-=n)>0);for(let t of a.flash)e.fillStyle=`rgba(255,255,255,${Math.min(1,t.t*3)})`,e.fillRect(Q,$+t.y*Z,Zp,Z);e.restore(),Wd(e,$p,$,92,110,`#ffffff`,10),Gd(e,t(`NEXT`),$p+46,21,11,Ud,700),s.queue.slice(0,3).forEach((t,n)=>{let r=n===0?14:9,i=Mp(t),a=i.map(([e])=>e),o=i.map(([,e])=>e),s=(Math.max(...a)-Math.min(...a)+1)*r,c=(Math.max(...o)-Math.min(...o)+1)*r,l=n===0?$p+46-s/2:$p+(n===1?24:68)-s/2,u=n===0?52-c/2:98-c/2;for(let[s,c]of i)J(e,l+(s-Math.min(...a))*r,u+(c-Math.min(...o))*r,r,r,Xp[t],r*.25,n===0?2:1.5)});let c=(n,r,i,a=K)=>{Wd(e,$p,i,92,46,`#ffffff`,10),Gd(e,t(n),$p+46,i+13,10,Ud,700),Gd(e,r,$p+46,i+31,17,a,700)};if(c(`SCORE`,s.score.toLocaleString(),130),c(`LINES`,String(s.lines),186),c(`LEVEL`,String(s.level),242),c(`BEST`,Math.max(a.best,s.score).toLocaleString(),298,s.score>a.best?`#e05a2b`:K),Zd(e,a.particles,n),a.status!==`playing`){let n=t(a.status===`ready`?`Space or tap to start`:a.status===`paused`?`Space or tap to resume`:`Space or tap to play again`);a.status===`ready`?Qd(e,em,tm,`Cubetris`,[t(`Stack the blocks.`),t(`Fill a row to ship it!`),n],Yp):a.status===`paused`?Qd(e,em,tm,t(`Coffee break ☕`),[t(`Score {score}`,{score:s.score.toLocaleString()}),n],Yp):Qd(e,em,tm,t(`Stack overflow!`),[t(`Score {score}`,{score:s.score.toLocaleString()}),a.newBest?t(`🏆 New best!`):t(`Best {score}`,{score:a.best.toLocaleString()}),n],`#f25f5c`)}else s.score===0&&s.locks===0&&Kd(e,t(`Go!`),Q+Zp/2,$+Qp/2,30+Math.sin(r/120)*2,`#80ed99`)},label:t(`Cubetris board`),onPointer:e=>e===`down`&&p(()=>u(1))()}),(0,N.jsxs)(`div`,{className:`game-pads`,children:[(0,N.jsx)(Vd,{label:t(`Move left`),repeat:!0,onPress:p(()=>l(-1)),children:`◀`}),(0,N.jsx)(Vd,{label:t(`Soft drop`),repeat:!0,onPress:p(d),children:`▼`}),(0,N.jsx)(Vd,{label:t(`Move right`),repeat:!0,onPress:p(()=>l(1)),children:`▶`}),(0,N.jsx)(`span`,{className:`game-pad-gap`}),(0,N.jsx)(Vd,{label:t(`Rotate`),className:`game-pad-round`,onPress:p(()=>u(1)),children:`⟳`}),(0,N.jsx)(Vd,{label:t(`Hard drop`),className:`game-pad-round game-pad-hot`,onPress:p(f),children:`⤓`})]}),(0,N.jsxs)(`div`,{className:`game-keys`,children:[(0,N.jsx)(`kbd`,{children:`←`}),(0,N.jsx)(`kbd`,{children:`→`}),` `,(0,N.jsx)(A,{children:`move`}),` · `,(0,N.jsx)(`kbd`,{children:`↑`}),` `,(0,N.jsx)(A,{children:`turn`}),` · `,(0,N.jsx)(`kbd`,{children:`↓`}),` `,(0,N.jsx)(A,{children:`down`}),` · `,(0,N.jsx)(`kbd`,{children:`Space`}),` `,(0,N.jsx)(A,{children:`hard drop`}),` · `,(0,N.jsx)(`kbd`,{children:`Enter`}),` `,(0,N.jsx)(A,{children:`pause`})]})]})}function om({draw:e}){let t=(0,M.useRef)(null);return(0,M.useEffect)(()=>{let n=t.current,r=n?.getContext(`2d`);if(!n||!r)return;let i=Math.min(2,window.devicePixelRatio||1);n.width=56*i,n.height=56*i,r.setTransform(i,0,0,i,0,0),e(r)},[e]),(0,N.jsx)(`canvas`,{ref:t,className:`game-thumb`,style:{width:56,height:56},"aria-hidden":!0})}var sm=e=>{let t=(t,n,r)=>J(e,2+t*13,2+n*13,13,13,r,3.5,1.8);for(let[e,n]of[[`#ffc93c`,[[0,2],[1,2],[0,3],[1,3]]],[`#ff8a5b`,[[3,1],[3,2],[3,3],[2,3]]],[`#c77dff`,[[0,0],[1,0],[2,0],[1,1]]]])for(let[r,i]of n)t(r,i,e);qd(e,21.5,8.5,7,2.4,0,.5)},cm=e=>{e.lineCap=`round`,e.lineJoin=`round`,e.beginPath(),e.moveTo(8,48),e.lineTo(8,34),e.lineTo(28,34),e.lineTo(28,16),e.lineTo(36,16),e.strokeStyle=K,e.lineWidth=11,e.stroke(),e.strokeStyle=`#4fb3e8`,e.lineWidth=7,e.stroke(),e.beginPath(),e.roundRect(33,9,14,14,3),e.fillStyle=`#e4f4ff`,e.fill(),e.lineWidth=2,e.strokeStyle=K,e.stroke(),e.fillStyle=`#ffc93c`;for(let t=0;t<3;t++)e.fillRect(44,11+t*3.6,2.5,1.8);qd(e,39,15,6,2.4,1,0),e.beginPath(),e.ellipse(46,44,5,6,0,0,Math.PI*2),e.fillStyle=`#f25f5c`,e.fill(),e.lineWidth=1.6,e.stroke(),e.beginPath(),e.arc(46,38,2.6,0,Math.PI*2),e.fillStyle=K,e.fill()};function lm({icon:e,name:t,what:n,status:r,color:i,onOpen:a}){let o=j();return(0,N.jsxs)(`button`,{type:`button`,className:`game-card`,style:{"--game":i},onClick:a,children:[(0,N.jsx)(om,{draw:e}),(0,N.jsxs)(`span`,{className:`game-card-text`,children:[(0,N.jsx)(`b`,{children:t}),(0,N.jsx)(`span`,{className:`game-card-what`,children:o(n)}),(0,N.jsx)(`span`,{className:`game-card-status`,children:r})]}),(0,N.jsx)(`span`,{className:`game-card-go`,children:`▶`})]})}function um({onGame:e}){let t=j(),n=(0,M.useSyncExternalStore)(Of,Ef),[r]=(0,M.useState)(Date.now),i=n?lf(n,r):null,a=e=>{e.translate(28,50),i?zf(e,{size:38,color:i.color,mood:uf(i),stage:sf(i.xp),blink:!1}):Wf(e,.6,t)},o=e=>bf(e)?t(`Best {score}`,{score:bf(e).toLocaleString()}):t(`No best score yet`);return Id(t=>{let n=[`Digit1`,`Digit2`,`Digit3`].indexOf(t.code);return n<0||t.repeat?!1:(e([`tetris`,`snake`,`pet`][n]),!0)}),(0,N.jsxs)(`div`,{className:`phone-scroll games-list`,children:[(0,N.jsx)(`h3`,{className:`phone-h`,children:(0,N.jsx)(A,{children:`🎮 Games`})}),(0,N.jsx)(`p`,{className:`muted small games-blurb`,children:(0,N.jsx)(A,{children:`Something to do while the team works. They pause when you put the phone away.`})}),(0,N.jsx)(lm,{icon:sm,name:`Cubetris`,what:`Falling blocks (a Tetris clone)`,status:rm()?t(`⏸ Game paused, tap to resume`):o(`tetris`),color:Yp,onOpen:()=>e(`tetris`)}),(0,N.jsx)(lm,{icon:cm,name:`Cable Snake`,what:`Eat the bugs (a Snake clone)`,status:gp()?t(`⏸ Game paused, tap to resume`):o(`snake`),color:op,onOpen:()=>e(`snake`)}),(0,N.jsx)(lm,{icon:a,name:`Desk Pet`,what:`Your office pet (a Tamagotchi clone)`,status:i?t(`{name} the {stage} {mood}`,{name:i.name,stage:t(af[sf(i.xp)].title).toLowerCase(),mood:t({asleep:`is napping`,happy:`is thrilled`,content:`is doing fine`,hungry:`is hungry`,bored:`is bored`,tired:`is sleepy`,grumpy:`is grumpy, needs you`}[uf(i)])}):t(`📦 A delivery is waiting for you`),color:Mf,onOpen:()=>e(`pet`)}),(0,N.jsxs)(`p`,{className:`muted small games-blurb`,children:[(0,N.jsx)(`kbd`,{children:`1`}),` `,(0,N.jsx)(`kbd`,{children:`2`}),` `,(0,N.jsx)(`kbd`,{children:`3`}),` `,(0,N.jsx)(A,{children:`open a game`}),` · `,(0,N.jsx)(`kbd`,{children:`Backspace`}),` `,(0,N.jsx)(A,{children:`comes back here`})]})]})}function dm({game:e,onGame:t}){Id(n=>!e||n.code!==`Backspace`?!1:(t(null),!0));let n=()=>t(null);return e===`tetris`?(0,N.jsx)(am,{onBack:n}):e===`snake`?(0,N.jsx)(Sp,{onBack:n}):e===`pet`?(0,N.jsx)(Kf,{onBack:n}):(0,N.jsx)(um,{onGame:t})}function fm(){let e=yt(e=>e.id),t=Ct(e=>e.status);if(!e)return null;let n=Pe[e];return(0,N.jsx)(`div`,{className:`phone-holiday`,role:`status`,style:{margin:`0 6px 6px`,padding:`5px 10px`,borderRadius:12,fontSize:13,fontWeight:600,textAlign:`center`,color:`#23263a`,background:`#ffd6a5`},children:t??`${n.emoji} Happy ${n.name.replace(/^Your /,``)}`})}var pm=e=>/^(claude|opus|sonnet|haiku|fable|default|best|opusplan)\b/i.test(e.trim());function mm(e,t,n,r){let i=e=>e.trim()!==``&&t===`claude`===pm(e);return i(e)?e.trim():t===n.defaultCli&&i(n.defaultModel)?n.defaultModel.trim():t===`claude`?r:``}var hm=[`claude-opus-5-5`,`claude-opus-5`,`claude-fable-5-1`,`claude-sonnet-5`,`claude-haiku-4-5`];function gm(e){return e===`claude`?hm:e===`codex`?[`gpt-5.5-codex`,`gpt-5.5`,`ollama/gpt-oss:20b`,`lmstudio/openai/gpt-oss-20b`]:[...hm.map(e=>`anthropic/${e}`),`ollama/qwen3-coder`,`lmstudio/qwen/qwen3-coder-30b`,`llamacpp/default`]}async function _m(e){try{return await e()}catch{return}}var vm=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});function ym({name:e,color:t,size:n=34}){return(0,N.jsx)(`span`,{className:`avatar`,style:{background:t,width:n,height:n,fontSize:n*.45},children:e[0]})}var bm=[`low`,`medium`,`high`,`xhigh`,`max`],xm=(e,t)=>e.find(e=>e.id===t)?.label??t,Sm=(e,t)=>t.runtime===`terminal`?e||t.defaultCli:`claude`,Cm=e=>({name:e.name,cli:e.cli,model:e.model,effort:e.effort,host:e.host??``}),wm=(e,t)=>({name:t.name.trim()||e.name,cli:t.cli,model:t.model.trim(),effort:t.effort,host:t.host});function Tm(e,t,n){let r=Sm(e.cli,t),i=(e,n)=>b(t.language,e,n);return`${xm(n,r)} · ${mm(e.model,r,t,hm[0])||i(`its default model`)} · ${i(`{effort} effort`,{effort:e.effort||t.defaultEffort})}`}function Em({value:e,onChange:t,disabled:n,repo:r}){let i=j(),a=T(e=>e.settings),o=T(e=>e.clis),s=(0,M.useId)(),c=T(e=>e.cloud.keySet),l=a.runtime!==`terminal`,u=Sm(e.cli,a),d=n=>t({...e,...n});return(0,N.jsxs)(`div`,{className:`hire-setup`,children:[(0,N.jsxs)(`label`,{className:`field`,htmlFor:`${s}-name`,children:[(0,N.jsx)(`span`,{children:(0,N.jsx)(A,{children:`Name`})}),(0,N.jsx)(`input`,{id:`${s}-name`,value:e.name,maxLength:24,disabled:n,onChange:e=>d({name:e.target.value})})]}),(0,N.jsxs)(`label`,{className:`field`,htmlFor:`${s}-cli`,children:[(0,N.jsx)(`span`,{children:(0,N.jsx)(A,{children:`Coding agent`})}),(0,N.jsxs)(`select`,{id:`${s}-cli`,value:l?``:e.cli,disabled:n||l,title:l?i(`The Agent SDK runs Claude Code for every agent (Settings → How agents run)`):void 0,onChange:e=>d({cli:e.target.value}),children:[(0,N.jsx)(`option`,{value:``,children:l?`Claude Code`:`${xm(o,a.defaultCli)} ${i(`(default)`)}`}),[...o].sort((e,t)=>Number(t.installed)-Number(e.installed)).map(e=>(0,N.jsxs)(`option`,{value:e.id,disabled:!e.installed||!!e.problem,title:e.problem,children:[e.label,i(e.installed?e.problem?` (incompatible version)`:``:` (not installed)`)]},e.id))]})]}),(0,N.jsxs)(`label`,{className:`field`,htmlFor:`${s}-model`,children:[(0,N.jsx)(`span`,{children:(0,N.jsx)(A,{children:`Model`})}),(0,N.jsx)(`input`,{id:`${s}-model`,list:`${s}-models`,value:e.model,disabled:n,placeholder:mm(``,u,a,hm[0])||i(`agent default`),title:i(`Empty: the default for their coding agent`),onChange:e=>d({model:e.target.value})}),(0,N.jsx)(`datalist`,{id:`${s}-models`,children:gm(u).map(e=>(0,N.jsx)(`option`,{value:e},e))})]}),u===`opencode`&&(0,N.jsx)(Pt,{value:e.model,repo:r,disabled:n,inherited:a.defaultCli===`opencode`?a.defaultModel:void 0,onSelect:e=>d({model:e})}),(0,N.jsxs)(`label`,{className:`field`,htmlFor:`${s}-effort`,children:[(0,N.jsx)(`span`,{children:i(u===`opencode`?`Variant`:`Effort`)}),u===`opencode`?(0,N.jsx)(It,{id:`${s}-effort`,value:e.model,repo:r,disabled:n,inherited:a.defaultCli===`opencode`?a.defaultModel:void 0,onSelect:e=>d({model:e})}):(0,N.jsxs)(`select`,{id:`${s}-effort`,value:e.effort,disabled:n,onChange:e=>d({effort:e.target.value}),children:[(0,N.jsx)(`option`,{value:``,children:i(`default ({effort})`,{effort:a.defaultEffort})}),bm.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]})]}),(c||e.host===`box`)&&(0,N.jsxs)(`label`,{className:`field`,htmlFor:`${s}-host`,children:[(0,N.jsx)(`span`,{children:(0,N.jsx)(A,{children:`Works on`})}),(0,N.jsxs)(`select`,{id:`${s}-host`,value:e.host,disabled:n,onChange:e=>d({host:e.target.value}),children:[(0,N.jsxs)(`option`,{value:``,children:[a.cloud.machineKind===`box`?`☁️ Upstash Box`:i(`🖥️ This computer`),` `,i(`(default)`)]}),(0,N.jsx)(`option`,{value:`local`,children:i(`🖥️ This computer`)}),(0,N.jsxs)(`option`,{value:`box`,disabled:u===`opencode`,children:[`☁️ Upstash Box`,u===`opencode`?i(` (OpenCode can’t run there)`):``]})]})]})]})}function Dm({req:e,highlight:t}){let n=j(),r=T(t=>t.repos.find(t=>t.id===e.repoId)),i=T(e=>e.settings),a=T(e=>e.clis),[o,s]=(0,M.useState)(()=>Cm(e)),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(!1),[f,p]=(0,M.useState)(``),[m,h]=(0,M.useState)(!1),g=(0,M.useRef)(null);(0,M.useEffect)(()=>{t&&g.current?.scrollIntoView({block:`center`})},[t]);let _=e.status===`pending`,v=e.kind===`hire`,y=v&&_&&o.name.trim()||e.name,b=async e=>{h(!0),await _m(e),h(!1)},x=e.status===`approved`?v?`✅ hired`:`👋 left`:v?`✋ declined`:`🤝 kept`;return(0,N.jsxs)(`div`,{ref:g,className:`resume ${v?``:`resume-letgo`} ${t?`resume-hot`:``} ${_?``:`resume-done`}`,children:[(0,N.jsxs)(`div`,{className:`resume-head`,children:[(0,N.jsx)(ym,{name:y,color:e.color,size:42}),(0,N.jsxs)(`div`,{className:`grow`,children:[(0,N.jsx)(`div`,{className:`resume-name`,children:v?y:n(`Let {name} go?`,{name:e.name})}),(0,N.jsx)(`div`,{className:`resume-title`,children:n(v?`A new agent`:`Leaving the team`)})]}),!_&&(0,N.jsx)(`span`,{className:`chip ${e.status===`approved`?`chip-good`:``}`,children:n(x)})]}),(0,N.jsxs)(`div`,{className:`resume-meta`,children:[(0,N.jsx)(`span`,{className:`chip`,style:{background:r?.color},children:n(`Floor {floor}`,{floor:r?.floor??`?`})}),(0,N.jsx)(`span`,{className:`muted small`,children:r?.fullName.split(`/`)[1]??n(`removed floor`)})]}),e.reason&&(0,N.jsx)(Ed,{className:`resume-reason`,text:e.reason}),v&&(0,N.jsxs)(`div`,{className:`resume-meta small`,children:[(0,N.jsxs)(`span`,{className:`grow`,children:[`⚙️ `,Tm(_?o:e,i,a)]}),_&&(0,N.jsx)(`button`,{className:`linkish small`,"aria-expanded":c,onClick:()=>l(!c),children:n(c?`Done`:`Change`)})]}),v&&_&&c&&(0,N.jsx)(Em,{value:o,onChange:s,disabled:m,repo:r?.id}),!_&&e.note&&(0,N.jsx)(`div`,{className:`muted small`,children:n(`Your note: “{note}”`,{note:e.note})}),_&&!u&&(0,N.jsxs)(`div`,{className:`row`,children:[(0,N.jsx)(`button`,{className:`btn btn-small btn-ghost`,disabled:m,onClick:()=>d(!0),children:n(v?`Decline`:`Keep them`)}),(0,N.jsx)(`span`,{className:`spacer`}),(0,N.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:m,onClick:()=>b(()=>k.approveRequest(e.id,v?wm(e,o):{})),children:n(v?`Hire {name}`:`Let {name} go`,{name:v?y:e.name})})]}),_&&u&&(0,N.jsxs)(`form`,{className:`row`,onSubmit:t=>{t.preventDefault(),b(()=>k.rejectRequest(e.id,f))},children:[(0,N.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:n(`Why not? (optional, the CEO reads it)`),autoFocus:!0}),(0,N.jsx)(`button`,{className:`btn btn-small btn-bad`,disabled:m,children:n(v?`Decline`:`Keep`)})]})]})}function Om(){let e=j(),t=T(e=>te(e.requests).filter(e=>e.kind===`hire`).length),n=T(e=>e.floor===0),r=T(e=>e.goToFloor);return t?(0,N.jsxs)(`div`,{className:`phone-nudge`,role:`status`,children:[(0,N.jsx)(`span`,{children:`🪑`}),(0,N.jsx)(`span`,{className:`grow`,children:e(t===1?`{count} new agent waiting in the lobby`:`{count} new agents waiting in the lobby`,{count:t})}),!n&&(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>r(0),children:(0,N.jsx)(A,{children:`Meet them`})})]}):null}function km({focusId:e}){let t=T(e=>e.requests),n=T(e=>e.demo),r=te(t),i=t.filter(e=>e.status!==`pending`).slice(-8).reverse();return(0,N.jsxs)(`div`,{className:`phone-scroll`,children:[(0,N.jsxs)(`h3`,{className:`phone-h`,children:[(0,N.jsx)(A,{children:`👥 Waiting on you`}),` `,r.length>0&&(0,N.jsx)(`span`,{className:`badge`,children:r.length})]}),r.length===0&&(0,N.jsx)(`p`,{className:`muted small phone-empty`,children:(0,N.jsx)(A,{children:`Nothing waiting. When the CEO wants a floor’s team to grow or shrink, the change shows up here for your OK.`})}),r.map(t=>(0,N.jsx)(Dm,{req:t,highlight:t.id===e},t.id)),n&&(0,N.jsxs)(`div`,{className:`row wrap`,children:[(0,N.jsx)(`span`,{className:`muted small`,children:`Demo:`}),(0,N.jsx)(`button`,{className:`btn btn-small btn-ghost`,onClick:()=>void _m(()=>k.demoPropose(`hire`)),children:(0,N.jsx)(A,{children:`👥 Grow a floor`})}),(0,N.jsx)(`button`,{className:`btn btn-small btn-ghost`,onClick:()=>void _m(()=>k.demoPropose(`let-go`)),children:(0,N.jsx)(A,{children:`✉️ Shrink a floor`})})]}),i.length>0&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`h3`,{className:`phone-h`,children:(0,N.jsx)(A,{children:`Earlier`})}),i.map(e=>(0,N.jsx)(Dm,{req:e},e.id))]})]})}function Am({m:e}){let t=j(),n=T(t=>t.voiceCache.saved.includes(e.id)),r=T(t=>t.voiceSpeaking===e.id),i=g(e,n,typeof speechSynthesis<`u`);if(!i)return null;let a=i===`gone`;return(0,N.jsx)(`button`,{type:`button`,className:`bubble-play ${r?`bubble-play-on`:``}`,disabled:a&&!r,title:a?t(`Audio no longer saved`):void 0,"aria-label":t(r?`Stop this message`:`Play this message`),onClick:()=>void w(()=>import(`./voiceMessages-DtNmUazr.js`).then(t=>r?t.stopSpeaking():i!==`gone`&&t.replayMessage(e,i)),__vite__mapDeps([0,1,2,3,4,5,6,7])),children:r?`⏹`:`▶`})}var jm=[`What's everyone working on?`,`Should a team grow?`,`Plan the next milestone for the busiest floor.`];function Mm({ceoName:e}){let t=j(),n=T(e=>e.settings.listen);if(T(e=>`${e.voiceKeySet}:${e.settings.voice.provider}`),!n||n.provider===`off`)return null;let r=n.handsFree,i=Te(e);return(0,N.jsxs)(`button`,{type:`button`,className:`hands-free ${r?`hands-free-on`:``}`,"aria-pressed":r,title:r?t(`Hands-free is on: after {name}’s spoken reply the phone listens for up to 8 s and sends what you say. Esc or M closes the mic.`,{name:e}):i||t(`Hands-free: talk with {name} without touching anything`,{name:e}),onClick:()=>void we(!r,e),children:[`🎧 `,t(r?`Hands-free on`:`Hands-free`)]})}function Nm({m:e,ceoName:t}){let n=T(t=>e.requestId?t.requests.find(t=>t.id===e.requestId):void 0);if(e.from===`office`)return(0,N.jsx)(`div`,{className:`bubble-office`,children:e.text});let r=e.from===`manager`;return(0,N.jsx)(`div`,{className:`bubble-row ${r?`bubble-row-me`:``}`,children:(0,N.jsxs)(`div`,{className:`bubble ${r?`bubble-me`:`bubble-them`}`,children:[!r&&(0,N.jsx)(`div`,{className:`bubble-from`,children:t}),r?(0,N.jsx)(`div`,{className:`bubble-text`,children:e.text}):(0,N.jsx)(Ed,{className:`bubble-md`,text:e.text}),n&&n.status===`pending`&&e.from===`ceo`&&(0,N.jsx)(Dm,{req:n}),(0,N.jsxs)(`div`,{className:`bubble-time`,children:[!r&&(0,N.jsx)(Am,{m:e}),vm(e.at)]})]})})}function Pm({autoFocus:e=!0}){let t=j(),n=T(e=>e.messages),r=T(e=>e.phoneReadAt),i=T(e=>e.agents.ceo),a=T(e=>e.ceo),o=T(e=>e.settings),s=T(e=>Object.values(e.agents).filter(x).length),[c,l]=(0,M.useState)(``),u=(0,M.useRef)(null);if((0,M.useEffect)(()=>{let e=[...n].reverse().find(e=>e.from===`ceo`);e&&e.at>r&&_m(()=>k.phoneRead(e.at))},[n,r]),(0,M.useLayoutEffect)(()=>{let e=u.current;e&&(e.scrollTop=e.scrollHeight)},[n.length,a.job?.kind]),!i)return(0,N.jsx)(`p`,{className:`muted phone-empty`,children:(0,N.jsx)(A,{children:`The corner office is empty.`})});let d=e=>{let t=e.trim();t&&(l(``),_m(()=>k.messageCeo(t)))},f=i.status===`working`&&a.job?.kind===`chat`,p=a.queue.some(e=>e.kind===`chat`),m=i.status===`working`?f?t(`typing…`):t(`busy: {job}`,{job:a.job?.label??t(`working`)}):p?o.sessionLimit&&s>=o.sessionLimit?t(`will reply when a session slot frees up ({running}/{max} busy)`,{running:s,max:o.sessionLimit}):t(`reading your message…`):a.queue.length?t(`next up: {job}`,{job:a.queue[0].label}):t(`available`);return(0,N.jsxs)(`div`,{className:`phone-chat`,children:[(0,N.jsxs)(`div`,{className:`chat-head`,children:[(0,N.jsx)(ym,{name:i.name,color:i.color}),(0,N.jsxs)(`div`,{className:`grow`,children:[(0,N.jsx)(`b`,{children:i.name}),` `,(0,N.jsx)(`span`,{className:`muted small`,children:`CEO`}),(0,N.jsx)(`div`,{className:`small ${i.status===`working`?`presence-busy`:`muted`}`,children:m})]}),(0,N.jsx)(Mm,{ceoName:i.name})]}),(0,N.jsxs)(`div`,{className:`chat-log`,ref:u,"aria-label":t(`Messages with {name}`,{name:i.name}),tabIndex:0,children:[n.length===0&&(0,N.jsx)(`p`,{className:`muted small phone-empty`,children:t(`Say hi to {name}. Ask how things are going, hand over a project brief, or ask whether a team should grow. Replies land here, and the phone buzzes when {name} needs you.`,{name:i.name})}),n.map(e=>(0,N.jsx)(Nm,{m:e,ceoName:i.name},e.id)),f&&(0,N.jsx)(`div`,{className:`bubble-row`,children:(0,N.jsxs)(`div`,{className:`bubble bubble-them bubble-typing`,children:[(0,N.jsx)(`span`,{}),(0,N.jsx)(`span`,{}),(0,N.jsx)(`span`,{})]})})]}),(0,N.jsx)(`div`,{className:`quick`,children:jm.map(e=>(0,N.jsx)(`button`,{className:`quick-chip`,onClick:()=>d(t(e)),children:t(e)},e))}),(0,N.jsxs)(`form`,{className:`chat-input`,onSubmit:e=>{e.preventDefault(),d(c)},children:[(0,N.jsx)(Dd,{value:c,onChange:l,placeholder:`${t(`Message {name}`,{name:i.name})}…`,"aria-label":t(`Message {name}`,{name:i.name}),title:t(`Enter sends · Shift+Enter adds a new line`),autoFocus:e}),(0,N.jsx)(kd,{kind:`phone`,value:c,onChange:l,onSend:d}),(0,N.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:!c.trim(),children:(0,N.jsx)(A,{children:`Send`})})]})]})}function Fm(){let e=j(),t=T(e=>e.repos),n=T(e=>e.agents),r=T(e=>e.qa),i=T(e=>e.requests),a=T(e=>e.settings),o=T(e=>e.ceo);return(0,M.useMemo)(()=>{let s=Object.values(n).filter(e=>e.role!==`ceo`),c=n.ceo,l=Object.values(n).filter(x).length,u=t.map(e=>{let t=s.filter(t=>t.repoId===e.id),n=D(e,r);return{repo:e,team:t.length,working:t.filter(x).length,idle:t.filter(e=>!x(e)).length,issues:e.issues.length,prs:e.pulls.filter(e=>e.state===`OPEN`).length,inQa:n.inQa,ready:n.ready,stuck:n.needsYou,merged:e.pulls.filter(e=>e.state===`MERGED`).length}}),d=e=>u.reduce((t,n)=>t+n[e],0),f=te(i).length,p=[],m=u.filter(e=>e.ready>0);m.length&&p.push({icon:`✅`,text:e(d(`ready`)===1?`{count} pull request passed QA and is ready for you to merge ({projects}).`:`{count} pull requests passed QA and are ready for you to merge ({projects}).`,{count:d(`ready`),projects:m.map(e=>`${e.repo.fullName.split(`/`)[1]}: ${e.ready}`).join(`, `)}),tone:`good`}),d(`stuck`)&&p.push({icon:`⚠️`,text:e(d(`stuck`)===1?`{count} pull request needs your call: the team can’t move it on alone.`:`{count} pull requests need your call: the team can’t move them on alone.`,{count:d(`stuck`)}),tone:`warn`}),f&&p.push({icon:`👥`,text:e(f===1?`{count} team change is waiting in Team.`:`{count} team changes are waiting in Team.`,{count:f}),tone:`warn`}),p.push({icon:`⚙️`,text:a.sessionLimit?l?e(`{running} of {max} session slots are busy right now.`,{running:l,max:a.sessionLimit}):e(`Nobody is working at the moment ({max} session slots free).`,{max:a.sessionLimit}):l?e(l===1?`{count} session is running right now.`:`{count} sessions are running right now.`,{count:l}):e(`Nobody is working at the moment.`)});for(let t of u)t.issues>0&&!t.repo.autoAssign&&t.working===0&&t.idle>0&&p.push({icon:`💤`,text:e(`{repo} has {count} open issues and free agents, but auto-assign is off.`,{repo:t.repo.fullName.split(`/`)[1],count:t.issues})});let h=[...u].sort((e,t)=>t.issues+t.prs-(e.issues+e.prs))[0];return h&&h.issues+h.prs>0&&u.length>1&&p.push({icon:`🔥`,text:e(`Most work in flight: {repo} ({issues} issues, {pulls} PRs).`,{repo:h.repo.fullName.split(`/`)[1],issues:h.issues,pulls:h.prs})}),c&&p.push({icon:`🧠`,text:c.status===`working`?e(`{name} is {job}.`,{name:c.name,job:(o.job?.label??e(`working`)).replace(/^\w/,e=>e.toLowerCase())}):o.nextReviewAt?e(`{name} reviews the company next at {time}.`,{name:c.name,time:vm(o.nextReviewAt)}):e(`{name}’s periodic reviews are off.`,{name:c.name})}),u.length===0&&p.splice(0,p.length,{icon:`👋`,text:e(`No projects yet. Connect a repo in the manager’s office (lobby, back left) and the CEO will staff it.`)}),{floors:u,staff:s.length,running:l,max:a.sessionLimit,issues:d(`issues`),prs:d(`prs`),report:p}},[t,n,r,i,a,o,e])}function Im(){let e=j(),t=T(e=>e.openOverlay),n=T(e=>e.repos.find(t=>t.floor===e.floor)?.id);return(0,N.jsxs)(`nav`,{className:`phone-links`,"aria-label":e(`Open a panel`),children:[(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>t({kind:`manager`}),children:(0,N.jsx)(A,{children:`🧑‍💼 Console`})}),n&&(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>t({kind:`kanban`,repoId:n}),children:(0,N.jsx)(A,{children:`📋 Kanban`})}),(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>t({kind:`floorList`}),children:(0,N.jsx)(A,{children:`👥 Floor list`})}),(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>t({kind:`help`}),children:(0,N.jsx)(A,{children:`❓ Help`})}),(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>t({kind:`manager`,tab:`access`}),children:(0,N.jsx)(A,{children:`♿ Accessibility`})})]})}function Lm(){let e=j(),t=Fm(),n=T(e=>e.goToFloor),r=[[`🏢`,t.floors.length,t.floors.length===1?`project`:`projects`],[`📋`,t.issues,`open issues`],[`🔀`,t.prs,`open PRs`],[`👥`,t.staff,`on staff`],[`⚙️`,t.max?`${t.running}/${t.max}`:`${t.running}`,`working now`]];return(0,N.jsxs)(`div`,{className:`phone-scroll`,children:[(0,N.jsx)(`div`,{className:`tiles`,children:r.map(([t,n,r])=>(0,N.jsxs)(`div`,{className:`tile`,children:[(0,N.jsxs)(`div`,{className:`tile-value`,children:[t,` `,n]}),(0,N.jsx)(`div`,{className:`tile-label`,children:e(r)})]},r))}),(0,N.jsx)(Im,{}),(0,N.jsx)(`h3`,{className:`phone-h`,children:(0,N.jsx)(A,{children:`Today’s report`})}),(0,N.jsx)(`ul`,{className:`report`,children:t.report.map((e,t)=>(0,N.jsxs)(`li`,{className:e.tone?`report-${e.tone}`:``,children:[(0,N.jsx)(`span`,{children:e.icon}),(0,N.jsx)(`span`,{children:e.text})]},t))}),t.floors.length>0&&(0,N.jsx)(`h3`,{className:`phone-h`,children:(0,N.jsx)(A,{children:`Projects`})}),t.floors.map(t=>(0,N.jsxs)(`div`,{className:`proj`,style:{"--accent":t.repo.color},children:[(0,N.jsxs)(`div`,{className:`row`,children:[(0,N.jsx)(`span`,{className:`floor-badge`,children:t.repo.floor}),(0,N.jsxs)(`div`,{className:`grow`,style:{minWidth:0},children:[(0,N.jsx)(`b`,{className:`proj-name`,children:t.repo.fullName.split(`/`)[1]}),(0,N.jsx)(`div`,{className:`muted small proj-sum`,children:t.repo.summary||t.repo.description||t.repo.fullName})]}),(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>n(t.repo.floor),children:(0,N.jsx)(A,{children:`Go`})})]}),(0,N.jsxs)(`div`,{className:`proj-stats small`,children:[(0,N.jsxs)(`span`,{children:[`👥 `,t.team,t.working?e(` ({count} busy)`,{count:t.working}):``]}),(0,N.jsxs)(`span`,{children:[`📋 `,t.issues]}),(0,N.jsxs)(`span`,{children:[`🔍 `,t.inQa]}),(0,N.jsxs)(`span`,{className:t.ready?`proj-ready`:``,children:[`✅ `,t.ready]}),(0,N.jsxs)(`span`,{children:[`🎉 `,t.merged]})]})]},t.repo.id))]})}var Rm=null,zm=()=>{let e=T.getState();return te(e.requests).length+_(e.messages,e.phoneReadAt)};function Bm({tab:e,requestId:t}){let n=j(),[r,i]=(0,M.useState)(()=>Rm&&!t&&zm()<=Rm.waiting?`games`:e??(t?`hires`:`chat`)),[a,o]=(0,M.useState)(()=>r===`games`?Rm?.game??null:null),s=(0,M.useRef)({tab:r,game:a});(0,M.useEffect)(()=>{s.current={tab:r,game:a}}),(0,M.useEffect)(()=>()=>{Rm=s.current.tab===`games`?{game:s.current.game,waiting:zm()}:null},[]);let c=T(e=>e.openOverlay),l=(0,M.useRef)(null);fe(l);let u=T(e=>e.requests),d=T(e=>e.messages),f=T(e=>e.phoneReadAt),p=T(e=>e.agents.ceo?.name??`CEO`),m=T(e=>(e.settings.listen?.provider??`off`)!==`off`),[h,g]=(0,M.useState)(Date.now());(0,M.useEffect)(()=>{let e=setInterval(()=>g(Date.now()),2e4);return()=>clearInterval(e)},[]),(0,M.useEffect)(()=>{c({kind:`phone`,tab:r,requestId:t})},[r]),(0,M.useEffect)(()=>{let e=e=>{let t=e.target,n=!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`);(e.key===`Escape`||!n&&Ce(`phone`,e.code))&&(e.preventDefault(),Ad())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let v=te(u).length,y=_(d,f),b=[[`chat`,`💬`,p,r===`chat`?0:y],[`hires`,`👥`,`Team`,v],[`company`,`📊`,`Company`,0],[`games`,`🎮`,`Games`,0]];return(0,N.jsx)(`div`,{className:`overlay phone-overlay`,onMouseDown:e=>e.target===e.currentTarget&&Ad(),children:(0,N.jsxs)(`div`,{className:`phone`,ref:l,role:`dialog`,"aria-modal":`true`,"aria-label":n(`Your phone`),tabIndex:-1,children:[(0,N.jsxs)(`div`,{className:`phone-status`,"aria-hidden":!0,children:[(0,N.jsx)(`span`,{children:vm(h)}),(0,N.jsx)(`span`,{className:`phone-notch`}),(0,N.jsx)(`span`,{children:`📶 🔋`})]}),(0,N.jsx)(fm,{}),(0,N.jsxs)(`div`,{className:`phone-screen`,children:[r!==`games`&&(0,N.jsx)(Om,{}),r===`chat`&&(0,N.jsx)(Pm,{}),r===`hires`&&(0,N.jsx)(km,{focusId:t}),r===`company`&&(0,N.jsx)(Lm,{}),r===`games`&&(0,N.jsx)(dm,{game:a,onGame:o})]}),(0,N.jsx)(`nav`,{className:`phone-tabs`,role:`tablist`,"aria-label":n(`Phone`),children:b.map(([e,t,a,s])=>(0,N.jsxs)(`button`,{role:`tab`,"aria-selected":r===e,"aria-label":s>0?`${e===`chat`?a:n(a)}, ${s}`:e===`chat`?a:n(a),className:`phone-tab ${r===e?`phone-tab-on`:``}`,onClick:()=>e===`games`&&r===`games`?o(null):i(e),children:[(0,N.jsxs)(`span`,{className:`phone-tab-icon`,"aria-hidden":!0,children:[t,s>0&&(0,N.jsx)(`span`,{className:`badge badge-dot`,children:s})]}),(0,N.jsx)(`span`,{children:e===`chat`?a:n(a)})]},e))}),(0,N.jsxs)(`div`,{className:`phone-hint`,children:[r===`chat`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`kbd`,{children:`Shift`}),`+`,(0,N.jsx)(`kbd`,{children:`Enter`}),` `,n(`new line`),` ·`,` `,m&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Md,{action:`talk`}),` `,n(`to talk`),` ·`,` `]})]}),r===`games`&&a&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`kbd`,{children:`Backspace`}),` `,n(`games`),` ·`,` `]}),(0,N.jsx)(Md,{action:`phone`}),` `,n(`or`),` `,(0,N.jsx)(`kbd`,{children:`Esc`}),` `,n(`to put it away`)]})]})})}var Vm={idle:`Idle`,preparing:`Setting up`,working:`Working`,done:`Finished`,error:`Needs help`,stopped:`Stopped`},Hm={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`},Um=(e,t)=>t.runtime===`terminal`?e.cli||(e.role===`ceo`?`claude`:t.defaultCli):`claude`;function Wm(e,t,n){if(e.role===`ceo`)return`CEO`;let r=Um(e,t);return n.find(e=>e.id===r)?.label??Hm[r]}function Gm(e,t){return e.role!==`ceo`&&e.host===`box`&&e.needsSignIn?Hm[e.cli||t.defaultCli]:null}function Km(e,t){let n=(e,n)=>b(t,e,n);if(e.role===`ceo`)return e.status===`working`?e.issueTitle??n(`Working`):n(`Free for a chat`);if(e.status===`idle`)return n(`Nothing assigned`);if(e.task===`analysis`)return n(`Read-only analysis`);let r=e.issueTitle?`: ${e.issueTitle}`:``;return e.task===`qa`?e.prNumber?n(`Testing PR #{number}`,{number:e.prNumber})+r:n(`Testing`):e.task===`fix`&&e.prNumber?n(`Fixing PR #{number}`,{number:e.prNumber})+r:e.issueNumber?n(`Issue #{number}`,{number:e.issueNumber})+r:e.issueTitle??n(`Working`)}function qm(e,t,n){return e.map(e=>{let r=Gm(e,t),i=r?`attention`:o[e.status];return{id:e.id,name:e.name,agent:Wm(e,t,n),status:b(t.language,r?`Needs you to sign in`:Vm[e.status]),kind:i,icon:p[i],doing:r?`${b(t.language,`Waiting for {provider} to be signed in`,{provider:r})}${e.status===`idle`?``:` · ${Km(e,t.language)}`}`:Km(e,t.language),signIn:r}})}function Jm(e){return e.local?`local`:e.protocol===`https:`?e.secure&&e.serviceWorker?`https`:`unsupported`:`remote-http`}var Ym=e=>[`remote-http`,`unsupported`].includes(Jm(e));function Xm(e){return Number.isInteger(e)&&e>0&&e<=65535?`tailscale serve --bg --https=443 http://127.0.0.1:${e}`:null}function Zm(e){try{let t=new URL(e.trim());return t.protocol!==`https:`||t.username||t.password||t.pathname!==`/`||t.search||t.hash?null:`${t.origin}/?pocket=1`}catch{return null}}function Qm(e,t){if(!e||typeof e!=`object`)return!1;let n=e;return n.type===`cubefarm-preview-check`&&n.nonce===t&&typeof n.worker==`boolean`&&typeof n.script==`boolean`&&typeof n.styles==`boolean`}function $m(){return{local:ee(location),protocol:location.protocol,secure:window.isSecureContext,serviceWorker:`serviceWorker`in navigator}}function eh({blocked:e=!1}){let t=j(),[n,r]=(0,M.useState)(e),[i,a]=(0,M.useState)(`tailscale`),[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(0),[f,p]=(0,M.useState)(``),[m,h]=(0,M.useState)(null),[g,_]=(0,M.useState)(`idle`),[v,y]=(0,M.useState)(!1),b=$m(),x=Jm(b),S=b.secure&&b.serviceWorker,C=Zm(f),w=o?.supportsLoopbackProxy?Xm(o.port):null;return(0,M.useEffect)(()=>{if(!n)return;let e=!1;return l(!1),k.phoneAccess().then(t=>{e||s(t)},()=>{e||l(!0)}),()=>{e=!0}},[n,u]),(0,M.useEffect)(()=>{if(!m)return;let e=e=>{let t=document.getElementById(`phone-access-${m}`);e.origin===location.origin&&e.source===t?.contentWindow&&Qm(e.data,m)&&(_(e.data.worker&&e.data.script&&e.data.styles?`passed`:`failed`),h(null))};window.addEventListener(`message`,e);let t=setTimeout(()=>{_(`failed`),h(null)},15e3);return()=>{clearTimeout(t),window.removeEventListener(`message`,e)}},[m]),(0,N.jsxs)(`section`,{className:`card phone-access ${e?`phone-access-blocked`:``}`,"aria-label":t(`Phone access`),children:[(0,N.jsx)(`h3`,{children:(0,N.jsx)(A,{children:`📱 Phone access`})}),(0,N.jsx)(`p`,{role:e?`alert`:`status`,children:t(x===`local`?`You are on the office computer. Local previews need no remote setup.`:x===`https`?`HTTPS and service workers are available in this browser. Verify the preview transport below.`:x===`remote-http`?`Remote HTTP cannot load previews reliably. CSS and scripts may go missing. Use a private HTTPS address.`:`This browser cannot use the preview service worker. Check the certificate, browser support and whether an insecure page is embedding the office.`)}),n?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{className:`term-error`,children:(0,N.jsx)(A,{children:`HTTPS encrypts the connection; it does not authorize visitors. Anyone with access to this office can control agents and run commands. Keep it private or behind authentication.`})}),(0,N.jsx)(`p`,{className:`muted small`,children:(0,N.jsx)(A,{children:`This guide never changes your network, certificates, firewall or office settings. Run commands yourself on the office computer only after reviewing them.`})}),o&&!o.loopbackOnly&&(0,N.jsx)(`p`,{className:`term-error`,children:(0,N.jsx)(A,{children:`The office currently listens beyond loopback. HTTPS will not close that existing access. Review the bind address and firewall separately.`})}),(0,N.jsxs)(`div`,{className:`seg`,role:`group`,"aria-label":t(`HTTPS setup method`),children:[(0,N.jsx)(`button`,{className:`seg-btn ${i===`tailscale`?`seg-on`:``}`,"aria-pressed":i===`tailscale`,onClick:()=>a(`tailscale`),children:`Tailscale`}),(0,N.jsx)(`button`,{className:`seg-btn ${i===`proxy`?`seg-on`:``}`,"aria-pressed":i===`proxy`,onClick:()=>a(`proxy`),children:(0,N.jsx)(A,{children:`Own HTTPS proxy`})})]}),i===`tailscale`?(0,N.jsxs)(`ol`,{children:[(0,N.jsx)(`li`,{children:(0,N.jsx)(A,{children:`Install Tailscale on the office computer and phone, sign in to your tailnet, and allow only trusted users/devices in its access rules.`})}),(0,N.jsxs)(`li`,{children:[(0,N.jsx)(A,{children:`On the office computer, inspect existing Serve routes first. Do not overwrite a route used by another service.`}),(0,N.jsx)(`pre`,{className:`term`,children:`tailscale serve status`})]}),(0,N.jsxs)(`li`,{children:[(0,N.jsx)(A,{children:`After reviewing the route and any HTTPS/certificate prompts, run the following command yourself. It persists across restarts.`}),w?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`pre`,{className:`term`,children:w}),(0,N.jsx)(`button`,{className:`btn btn-small`,disabled:!navigator.clipboard?.writeText,onClick:()=>void navigator.clipboard.writeText(w).then(()=>y(!0),()=>y(!1)),children:t(v?`Copied`:`Copy command`)})]}):(0,N.jsx)(`p`,{className:`muted small`,children:t(c?`Could not read the office port. Retry; no command has been generated.`:o?`This bind address is not confirmed reachable through 127.0.0.1. Review SWARM_HOST on the office computer before configuring a loopback proxy.`:`Reading the actual office port…`)}),c&&(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>d(e=>e+1),children:(0,N.jsx)(A,{children:`Retry port check`})})]}),(0,N.jsx)(`li`,{children:(0,N.jsx)(A,{children:`Use the HTTPS address printed by Serve on your phone. Enable HTTPS in the tailnet if Tailscale asks. Serve is private to your tailnet; do not use Funnel or open a public router port.`})})]}):(0,N.jsxs)(`ol`,{children:[(0,N.jsx)(`li`,{children:(0,N.jsx)(A,{children:`Use a trusted private proxy or an identity-aware HTTPS proxy. Put authentication/access control in front of the whole office, including API, preview and WebSocket routes; a public certificate alone is not enough.`})}),(0,N.jsxs)(`li`,{children:[(0,N.jsx)(A,{children:`Mount the office at the root of a dedicated HTTPS origin, not a subpath. Forward all paths unchanged, support WebSocket upgrades, and proxy to the office’s local listening port.`}),o&&(0,N.jsx)(`pre`,{className:`term`,children:t(`Office listening port: {port}`,{port:o.port})})]}),(0,N.jsx)(`li`,{children:(0,N.jsx)(A,{children:`Use a certificate trusted by the phone. Do not bypass browser certificate warnings or disable browser security. Follow your proxy’s authentication and TLS documentation.`})})]}),(0,N.jsx)(`p`,{className:`small`,children:(0,N.jsx)(`a`,{href:`https://tailscale.com/kb/1242/tailscale-serve`,target:`_blank`,rel:`noopener noreferrer`,children:(0,N.jsx)(A,{children:`Tailscale Serve documentation ↗`})})}),(0,N.jsxs)(`label`,{className:`field`,children:[(0,N.jsx)(`span`,{children:(0,N.jsx)(A,{children:`Your private HTTPS office address`})}),(0,N.jsx)(`input`,{type:`url`,value:f,onChange:e=>p(e.target.value),placeholder:`https://your-office.example`,autoComplete:`off`,spellCheck:!1})]}),f&&!C&&(0,N.jsx)(`p`,{className:`term-error`,children:(0,N.jsx)(A,{children:`Enter an HTTPS origin only, without a path, query, fragment or embedded credentials.`})}),C&&(0,N.jsx)(`a`,{className:`btn`,href:C,target:`_blank`,rel:`noopener noreferrer`,children:(0,N.jsx)(A,{children:`Open HTTPS office ↗`})}),(0,N.jsx)(`p`,{className:`muted small`,children:(0,N.jsx)(A,{children:`After verifying the address, you may enter it under Notifications → Office address for links. That field only changes notification links; it does not configure remote access.`})}),(0,N.jsx)(`h4`,{children:(0,N.jsx)(A,{children:`Verify on the phone`})}),(0,N.jsx)(`p`,{className:`muted small`,children:(0,N.jsx)(A,{children:`Open the private HTTPS office on your phone and run this check there. A local check does not validate the phone or your access rules.`})}),(0,N.jsx)(`button`,{className:`btn`,disabled:!S||g===`checking`,onClick:()=>{if(!S)return;let e=crypto.getRandomValues(new Uint8Array(16));_(`checking`),h(Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``))},children:t(g===`checking`?`Checking preview transport…`:`Check preview CSS and scripts`)}),!S&&(0,N.jsx)(`p`,{className:`muted small`,children:(0,N.jsx)(A,{children:`The check needs a secure browser context with service workers. Reopen the office over trusted HTTPS first.`})}),g===`passed`&&(0,N.jsx)(`p`,{role:`status`,children:(0,N.jsx)(A,{children:`✓ The preview worker loaded the test CSS and JavaScript correctly in this browser.`})}),g===`failed`&&(0,N.jsx)(`p`,{role:`alert`,children:(0,N.jsx)(A,{children:`The transport check failed or timed out. Check the certificate, browser service-worker permissions and proxy routes, then retry. No project was started.`})}),(0,N.jsx)(`p`,{className:`muted small`,children:(0,N.jsx)(A,{children:`This uses synthetic test assets only, with no AI work or dependency installs. It verifies worker/CSS/JavaScript routing, not every app’s compatibility, authentication or WebSocket connection.`})}),m&&(0,N.jsx)(`iframe`,{id:`phone-access-${m}`,hidden:!0,title:t(`Preview transport check`),sandbox:`allow-scripts allow-same-origin`,src:`/preview/0/__cubefarm_check__?nonce=${m}`},m)]}):(0,N.jsx)(`button`,{className:`btn`,onClick:()=>r(!0),children:(0,N.jsx)(A,{children:`Set up phone access`})})]})}var th=!1;function nh({animated:e=!1}){let[t]=(0,M.useState)(()=>e&&!th);return(0,M.useEffect)(()=>{t&&(th=!0)},[t]),(0,N.jsxs)(`span`,{className:`brand-icon${t?` brand-assemble`:``}`,"aria-hidden":`true`,children:[(0,N.jsx)(`img`,{className:`brand-static`,src:`/icons/icon.svg`,alt:``,width:`152`,height:`170`}),t&&(0,N.jsx)(`span`,{className:`brand-parts`,children:[`wire`,`shell`,`eyes`,`antenna`,`spark`].map(e=>(0,N.jsx)(`img`,{className:`brand-part brand-${e}`,src:`/icons/droid-${e}.svg`,alt:``,width:`152`,height:`170`},e))})]})}function rh({animated:e=!1}){return(0,N.jsxs)(`div`,{className:`brand-lockup`,children:[(0,N.jsx)(nh,{animated:e}),(0,N.jsxs)(`div`,{className:`brand-type`,children:[(0,N.jsxs)(`div`,{className:`brand-name`,"aria-label":`Droidsembly`,children:[`Droid`,(0,N.jsx)(`span`,{children:`sembly`})]}),(0,N.jsx)(`div`,{className:`brand-payoff`,lang:`en`,children:`Software, assembled by agents.`})]})]})}function ih({agent:e,card:t}){return e?(0,N.jsxs)(`span`,{className:`agent-chip`,children:[(0,N.jsx)(`span`,{className:`dot`,style:{background:e.color}}),e.name,e.task===`qa`&&t.prNumber!=null&&e.prNumber===t.prNumber&&(0,N.jsx)(`span`,{className:`chip`,children:`QA`})]}):null}function ah({repoId:e,agents:t,onDone:n}){let r=j(),[i,a]=(0,M.useState)(``),[o,s]=(0,M.useState)(``),[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(!1),f=t.filter(e=>e.role!==`ceo`&&e.status!==`working`&&e.status!==`preparing`);return(0,N.jsxs)(`form`,{className:`issue-form`,onSubmit:async t=>{if(t.preventDefault(),i.trim()){d(!0);try{await k.createIssue(e,i,o,c||void 0),a(``),s(``),l(``),n?.()}catch{}finally{d(!1)}}},children:[(0,N.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:r(`Issue title, e.g. Add a dark mode toggle`),"aria-label":r(`Issue title`),autoFocus:!0}),(0,N.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:r(`Describe what you want. Acceptance criteria help the agent who builds it and the one who tests it a lot.`),"aria-label":r(`Issue description`),rows:5}),(0,N.jsxs)(`div`,{className:`row`,children:[(0,N.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),"aria-label":r(`Who works on it`),children:[(0,N.jsx)(`option`,{value:``,children:r(`Leave in backlog (auto-assign picks it up if enabled)`)}),f.map(e=>(0,N.jsx)(`option`,{value:e.id,children:r(`Give it to {name} right away`,{name:e.name})},e.id))]}),(0,N.jsx)(`button`,{className:`btn btn-good`,disabled:u||!i.trim(),children:r(u?`Filing…`:`File issue on GitHub`)})]})]})}function oh({embedded:e,...t}){return e?(0,N.jsxs)(`section`,{className:`kanban-embedded ${t.className??``}`,style:{"--accent":t.accent},children:[(0,N.jsx)(`h2`,{className:`kanban-embedded-title`,children:t.title}),t.children]}):(0,N.jsx)(jd,{...t})}function sh({card:e}){return e.qa?.commentUrl?(0,N.jsx)(`a`,{className:`small`,href:e.qa.commentUrl,target:`_blank`,rel:`noreferrer`,title:e.qa.summary??``,children:(0,N.jsx)(A,{children:`QA report ↗`})}):null}function ch({repoId:e,embedded:t}){let n=j(),r=T(t=>t.repos.find(t=>t.id===e)),i=T(e=>e.agents),a=T(e=>e.qa),o=T(e=>e.usage.state),s=T(e=>e.settings.language),c=T(e=>e.openOverlay),l=(0,M.useMemo)(()=>ne(i,e),[i,e]),u=(0,M.useMemo)(()=>r?m(r,l,a,{state:o},s):null,[r,l,a,o,s]),[d,f]=(0,M.useState)(!1),[p,h]=(0,M.useState)(null);if(!r||!u)return(0,N.jsx)(oh,{title:`Kanban`,embedded:t,children:(0,N.jsx)(`p`,{className:`muted`,children:(0,N.jsx)(A,{children:`This floor no longer exists.`})})});let g=async(e,t)=>{h(e);try{await t()}catch{}finally{h(null)}},_=l.filter(e=>e.role!==`ceo`),v=_.filter(e=>e.status===`idle`||e.status===`done`||e.status===`stopped`||e.status===`error`),y=async e=>{let t=e.qa?.status===`passed`;await ue(t?{icon:`🎉`,title:n(`Merge PR #{number}?`,{number:e.number}),body:n(`“{title}” passed QA. It will be squash-merged into {branch}.`,{title:e.title,branch:r.defaultBranch}),confirm:n(`Squash & merge`)}:{tone:`warn`,title:n(`Merge PR #{number} without QA?`,{number:e.number}),body:n(`“{title}” has not passed QA yet. Merge it into {branch} anyway?`,{title:e.title,branch:r.defaultBranch}),confirm:n(`Merge anyway`)})&&g(e.key,()=>k.mergePull(r.id,e.number))},b=async e=>{let t=``,i=e.qa?.status===`passed`;await ue({icon:`🔧`,title:n(i?`Request changes on PR #{number}?`:`Send PR #{number} back for a fix?`,{number:e.number}),body:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{children:n(i?`QA passed. Describe the additional changes you want. The previous report is preserved and the changes must pass a new QA round. This starts agent work and may consume AI quota.`:`Its author, or any free agent, fixes it with QA’s findings, then it’s tested once more.`)}),(0,N.jsx)(`input`,{maxLength:1e3,placeholder:n(i?`Required: describe the requested changes`:`Optional note, e.g. merge main and keep both e2e tests`),"aria-label":n(i?`Required: describe the requested changes`:`Note for whoever fixes it`),"aria-required":i,ref:e=>void(e&&setTimeout(()=>e.focus(),0)),onChange:e=>t=e.target.value})]}),confirm:n(i?`Request changes`:`Send back`)})&&g(e.key,()=>k.sendBack(r.id,e.number,t.trim()||void 0))},x=async e=>{await ue({tone:`danger`,title:n(`Close PR #{number}?`,{number:e.number}),body:n(`“{title}” will be closed without merging, and any QA or fix work on it stops. Its issue stays open and waits for you to assign it again. The branch stays on GitHub.`,{title:e.title}),confirm:n(`Close PR`)})&&g(e.key,()=>k.closePull(r.id,e.number))},S=e=>(0,N.jsx)(`button`,{className:`btn btn-small btn-ghost`,disabled:p===e.key,onClick:()=>void x(e),children:(0,N.jsx)(A,{children:`Close`})}),C=e=>(0,N.jsx)(`button`,{className:`btn btn-small`,title:n(`Run PR #{number} beside {branch} and open it in the app viewer`,{number:e.number,branch:r.defaultBranch}),onClick:()=>c({kind:`app`,repoId:r.id,pr:e.number}),children:(0,N.jsx)(A,{children:`Preview`})}),w=e=>e.agent&&(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>c({kind:`terminal`,agentId:e.agent.id}),children:(0,N.jsx)(A,{children:`Terminal`})}),E=(e,t,r,i,a)=>(0,N.jsxs)(`div`,{className:`kcol ${t}`,children:[(0,N.jsxs)(`div`,{className:`kcol-head`,children:[n(e),` `,(0,N.jsx)(`span`,{className:`count`,children:r.length})]}),(0,N.jsxs)(`div`,{className:`kcol-body`,children:[r.length===0&&(0,N.jsx)(`div`,{className:`muted small kempty`,children:n(a)}),r.map(e=>(0,N.jsxs)(`div`,{className:`kcard ${e.tone?`kcard-${e.tone}`:``}`,children:[(0,N.jsxs)(`div`,{className:`kcard-title`,children:[e.url?(0,N.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[e.prNumber?`PR `:``,`#`,e.number]}):(0,N.jsxs)(`b`,{children:[`#`,e.number]}),` `,e.title]}),i(e)]},e.key))]})]});return(0,N.jsxs)(oh,{embedded:t,wide:!0,className:`cyan-panel`,accent:`#65d8ef`,title:(0,N.jsxs)(`span`,{style:{borderLeft:`4px solid ${r.color}`,paddingLeft:8},children:[`📋 `,r.fullName,` `,(0,N.jsx)(`a`,{className:`small`,href:r.url,target:`_blank`,rel:`noreferrer`,children:`GitHub ↗`})]}),children:[(0,N.jsxs)(`div`,{className:`kanban-toolbar`,children:[(0,N.jsx)(`button`,{className:`btn btn-good`,onClick:()=>f(e=>!e),children:n(d?`Cancel`:`+ New issue`)}),(0,N.jsxs)(`label`,{className:`toggle`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:r.autoAssign,onChange:e=>void k.updateRepo(r.id,{autoAssign:e.target.checked}).catch(()=>void 0)}),(0,N.jsx)(A,{children:`⚡ Auto-assign work to free agents`})]}),(0,N.jsxs)(`label`,{className:`toggle`,title:n(`Merge a PR as soon as QA has signed off on its latest commit and GitHub’s checks are green`),children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:r.autoMerge,onChange:e=>void k.updateRepo(r.id,{autoMerge:e.target.checked}).catch(()=>void 0)}),(0,N.jsx)(A,{children:`🔀 Auto-merge when QA and checks pass`})]}),(0,N.jsx)(`span`,{className:`spacer`}),(0,N.jsx)(`button`,{className:`btn`,onClick:()=>c({kind:`app`,repoId:r.id}),title:n(`Open this floor’s running app`),children:(0,N.jsx)(A,{children:`🖥️ View app`})}),(0,N.jsx)(`span`,{className:`muted small`,children:r.lastSync?n(`Synced {time}`,{time:new Date(r.lastSync).toLocaleTimeString()}):n(`Syncing…`)}),(0,N.jsx)(`button`,{className:`btn`,disabled:p===`sync`,onClick:()=>g(`sync`,()=>k.syncRepo(r.id)),children:(0,N.jsx)(A,{children:`⟳ Sync`})})]}),r.syncError&&(0,N.jsxs)(`div`,{className:`term-error`,children:[`⚠️ `,r.syncError]}),d&&(0,N.jsx)(ah,{repoId:r.id,agents:_,onDone:()=>f(!1)}),(0,N.jsxs)(`div`,{className:`kanban kanban-5`,children:[E(`📋 Backlog`,`kcol-backlog`,u.backlog,e=>(0,N.jsxs)(`div`,{className:`kcard-foot`,children:[e.note&&(0,N.jsx)(`span`,{className:`muted small`,children:e.note}),(0,N.jsxs)(`select`,{value:``,disabled:p===e.key||v.length===0,onChange:t=>t.target.value&&g(e.key,()=>k.assign(t.target.value,e.number)),"aria-label":n(`Assign issue #{number}`,{number:e.number}),children:[(0,N.jsx)(`option`,{value:``,children:n(v.length?`Assign to…`:`Everyone is busy`)}),v.map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),`No open issues. File one above!`),E(`🔨 In progress`,`kcol-progress`,u.progress,e=>(0,N.jsxs)(`div`,{className:`kcard-foot`,children:[(0,N.jsx)(ih,{agent:e.agent,card:e}),(0,N.jsx)(`span`,{className:`muted small`,children:e.note}),(0,N.jsx)(`span`,{className:`spacer`}),w(e)]}),`Nobody is coding right now.`),E(`🔍 In QA`,`kcol-qa`,u.qa,e=>{let t=e.qa?.status;return(0,N.jsxs)(`div`,{className:`kcard-foot kcard-foot-wrap`,children:[(0,N.jsx)(ih,{agent:e.agent,card:e}),(0,N.jsx)(`span`,{className:`muted small`,children:e.note}),(0,N.jsx)(`span`,{className:`spacer`}),(0,N.jsx)(sh,{card:e}),C(e),(t===`testing`||t===`fixing`)&&w(e),(!t||t===`needs-human`)&&(0,N.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:p===e.key,onClick:()=>g(e.key,()=>k.sendToQa(r.id,e.number)),children:n(t===`needs-human`?`Retry QA`:`Send to QA`)}),(t===`needs-human`||t===`failed`)&&(0,N.jsx)(`button`,{className:`btn btn-small`,disabled:p===e.key,title:n(`Hand it to its author, or any free agent, with QA’s findings and your note, without another QA round first`),onClick:()=>b(e),children:(0,N.jsx)(A,{children:`Send back for a fix`})}),t===`needs-human`&&(0,N.jsx)(`button`,{className:`btn btn-small btn-ghost`,disabled:p===e.key,onClick:()=>y(e),children:(0,N.jsx)(A,{children:`Merge anyway`})}),S(e)]})},`Nothing waiting for testing.`),E(`✅ Ready to merge`,`kcol-review`,u.ready,e=>{let t=r.pulls.find(t=>t.number===e.prNumber);return(0,N.jsxs)(`div`,{className:`kcard-foot kcard-foot-wrap`,children:[(0,N.jsx)(ih,{agent:e.agent,card:e}),(0,N.jsxs)(`span`,{className:`muted small`,children:[e.note,t?` · +${t.additions} −${t.deletions}`:``]}),(0,N.jsx)(`span`,{className:`spacer`}),(0,N.jsx)(sh,{card:e}),C(e),(0,N.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:p===e.key||t?.isDraft,onClick:()=>y(e),children:(0,N.jsx)(A,{children:`Merge`})}),(0,N.jsx)(`button`,{className:`btn btn-small`,disabled:p===e.key,onClick:()=>b(e),children:n(`Request changes`)}),S(e)]})},`No tested pull requests yet.`),E(`🎉 Merged`,`kcol-merged`,u.merged,e=>(0,N.jsx)(`div`,{className:`kcard-foot`,children:(0,N.jsx)(ih,{agent:e.agent,card:e})}),`Nothing merged yet.`)]})]})}var lh=`https://github.com/leonvanzyl/cubefarm/blob/main/docs/pocket.md`,uh=[{id:`ntfy`,label:`ntfy`,help:`Pick a long, hard-to-guess topic and subscribe to it in the ntfy app. Anyone who knows the topic can read it.`,fields:[{key:`url`,label:`Topic URL`,placeholder:`https://ntfy.sh/my-office-7f3k9q`,secret:!0},{key:`token`,label:`Access token (optional)`,placeholder:`tk_…`,secret:!0,optional:!0}]}];function dh(e){let[t,n]=(0,M.useState)({busy:!1,result:null,ok:!1}),r=async()=>{n({busy:!0,result:null,ok:!1});try{await k.testNotify(e),n({busy:!1,result:`✓ Sent`,ok:!0})}catch(e){n({busy:!1,result:e instanceof Error?e.message:String(e),ok:!1})}};return{...t,run:r}}function fh({result:e,ok:t}){let n=j();return e?(0,N.jsx)(`span`,{className:`small ${t?`notify-ok`:`term-error`}`,role:`status`,children:t?n(`✓ Sent`):e}):null}function ph({hook:e,notify:t,save:n}){let r=j(),i=T(t=>t.notifyChannels.webhooks[e.id]),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)({}),[l,u]=(0,M.useState)(``),[d,f]=(0,M.useState)(!1),p=dh(e.id),m=(0,M.useId)(),h=async t=>{f(!0),u(``);try{await k.setWebhook(e.id,t),c({}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}},g=t.channels[e.id];return(0,N.jsxs)(`div`,{className:`notify-hook`,children:[(0,N.jsxs)(`div`,{className:`row wrap`,children:[(0,N.jsx)(`b`,{className:`grow`,children:e.label}),i.set&&(0,N.jsxs)(`label`,{className:`toggle small`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:g,onChange:r=>n({channels:{...t.channels,[e.id]:r.target.checked}})}),` `,(0,N.jsx)(A,{children:`On`})]})]}),i.set&&!a?(0,N.jsxs)(`div`,{className:`row wrap`,children:[(0,N.jsxs)(`span`,{className:`grow small`,children:[(0,N.jsx)(A,{children:`🔑 Saved`}),` `,(0,N.jsx)(`code`,{children:i.hint})]}),(0,N.jsx)(`button`,{className:`btn btn-small`,disabled:p.busy,onClick:()=>void p.run(),children:r(p.busy?`Sending…`:`Test`)}),(0,N.jsx)(`button`,{className:`btn btn-small btn-ghost`,onClick:()=>o(!0),children:(0,N.jsx)(A,{children:`Replace`})}),(0,N.jsx)(`button`,{className:`btn btn-small btn-ghost`,disabled:d,onClick:()=>void ue({tone:`danger`,title:r(`Remove the {service} settings?`,{service:e.label}),body:r(`They are deleted from the office. Nothing more is sent there until you add them again.`),confirm:r(`Remove`)}).then(e=>{e&&h({})}),children:(0,N.jsx)(A,{children:`Remove`})}),(0,N.jsx)(fh,{result:p.result,ok:p.ok})]}):(0,N.jsxs)(`form`,{className:`notify-form`,onSubmit:e=>{e.preventDefault(),h(s)},children:[(0,N.jsx)(`p`,{className:`muted small`,children:r(e.help)}),e.fields.map(e=>(0,N.jsxs)(`label`,{className:`field`,children:[(0,N.jsx)(`span`,{children:r(e.label)}),(0,N.jsx)(`input`,{type:e.secret?`password`:`text`,value:s[e.key]??``,onChange:t=>c({...s,[e.key]:t.target.value}),placeholder:e.placeholder,autoComplete:`off`,spellCheck:!1,"aria-invalid":!!l,"aria-describedby":l?m:void 0})]},e.key)),l&&(0,N.jsx)(`div`,{id:m,className:`term-error small`,role:`alert`,children:l}),(0,N.jsxs)(`div`,{className:`row`,children:[(0,N.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:d||e.fields.some(e=>!e.optional&&!s[e.key]?.trim()),children:r(d?`Saving…`:`Save`)}),a&&(0,N.jsx)(`button`,{type:`button`,className:`btn btn-small btn-ghost`,onClick:()=>{o(!1),c({}),u(``)},children:(0,N.jsx)(A,{children:`Cancel`})})]})]})]})}var mh=()=>typeof Notification>`u`?`unsupported`:Notification.permission;function hh({notify:e,save:t}){let n=j(),r=T(e=>e.notifyChannels.pushDevices),[i,a]=(0,M.useState)(mh),[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(``),f=dh(`push`),p=typeof window>`u`?`unsupported`:le();(0,M.useEffect)(()=>{p===`ok`&&me().then(e=>s(!!e),()=>s(!1))},[p,r]);let m=async()=>a(await Notification.requestPermission()),h=async e=>{l(!0),d(``);try{e?await pe():await de(),s(e),a(mh())}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`notify-hook`,children:[(0,N.jsxs)(`div`,{className:`row wrap`,children:[(0,N.jsx)(`b`,{className:`grow`,children:(0,N.jsx)(A,{children:`Desktop notifications`})}),(0,N.jsxs)(`label`,{className:`toggle small`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:e.channels.desktop,onChange:n=>t({channels:{...e.channels,desktop:n.target.checked}})}),` `,(0,N.jsx)(A,{children:`On`})]})]}),(0,N.jsx)(`p`,{className:`muted small`,children:(0,N.jsx)(A,{children:`From any browser with the office open in a background tab.`})}),(0,N.jsxs)(`div`,{className:`row wrap`,children:[i===`granted`&&(0,N.jsx)(`span`,{className:`small grow`,children:(0,N.jsx)(A,{children:`✓ Allowed in this browser`})}),i===`denied`&&(0,N.jsx)(`span`,{className:`small grow term-error`,children:(0,N.jsx)(A,{children:`Blocked in this browser: allow notifications for this site in its settings.`})}),i===`unsupported`&&(0,N.jsx)(`span`,{className:`small grow muted`,children:(0,N.jsx)(A,{children:`This browser can’t show notifications.`})}),i==="default"&&(0,N.jsx)(`button`,{className:`btn btn-small btn-good`,onClick:()=>void m(),children:(0,N.jsx)(A,{children:`Allow in this browser`})}),i===`granted`&&(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>void re(),children:(0,N.jsx)(A,{children:`Test`})})]})]}),(0,N.jsxs)(`div`,{className:`notify-hook`,children:[(0,N.jsxs)(`div`,{className:`row wrap`,children:[(0,N.jsx)(`b`,{className:`grow`,children:(0,N.jsx)(A,{children:`Push to my devices`})}),(0,N.jsxs)(`label`,{className:`toggle small`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:e.channels.push,onChange:n=>t({channels:{...e.channels,push:n.target.checked}})}),` `,(0,N.jsx)(A,{children:`On`})]})]}),(0,N.jsxs)(`p`,{className:`muted small`,children:[(0,N.jsx)(A,{children:`Reaches a phone or PC even with the office closed.`}),` `,r?n(r===1?`{count} device signed up.`:`{count} devices signed up.`,{count:r}):n(`No devices signed up yet.`)]}),p===`insecure`&&(0,N.jsxs)(`p`,{className:`small term-error`,children:[(0,N.jsx)(A,{children:`Push needs HTTPS (or localhost on the office’s own PC). Open the office through an HTTPS address such as Tailscale Serve: see`}),` `,(0,N.jsx)(`a`,{href:lh,children:`docs/pocket.md`}),`.`]}),p===`unsupported`&&(0,N.jsx)(`p`,{className:`small muted`,children:(0,N.jsx)(A,{children:`This browser has no Web Push. On an iPhone, add the office to the home screen first, then turn push on from there.`})}),p===`dev`&&(0,N.jsx)(`p`,{className:`small muted`,children:(0,N.jsx)(A,{children:`Push works in a built office (npm run build), not under the dev server.`})}),p===`ok`&&(0,N.jsxs)(`div`,{className:`row wrap`,children:[o?(0,N.jsx)(`button`,{className:`btn btn-small btn-ghost`,disabled:c,onClick:()=>void h(!1),children:(0,N.jsx)(A,{children:`Stop push to this device`})}):(0,N.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:c||o===null,onClick:()=>void h(!0),children:n(c?`Signing up…`:`Push to this device`)}),(0,N.jsx)(`button`,{className:`btn btn-small`,disabled:f.busy||!r,onClick:()=>void f.run(),children:(0,N.jsx)(A,{children:`Send test`})}),(0,N.jsx)(fh,{result:f.result,ok:f.ok})]}),u&&(0,N.jsx)(`div`,{className:`term-error small`,role:`alert`,children:u})]})]})}function gh(){let e=j(),t=T(e=>e.settings.notify),[n,r]=(0,M.useState)(t.officeUrl);(0,M.useEffect)(()=>r(t.officeUrl),[t.officeUrl]);let i=e=>void k.updateSettings({notify:{...t,...e}}).catch(()=>void 0);return(0,N.jsxs)(`div`,{className:`card notify-settings`,children:[(0,N.jsx)(`h3`,{children:(0,N.jsx)(A,{children:`🔔 Notifications`})}),(0,N.jsx)(`p`,{className:`muted small`,children:(0,N.jsx)(A,{children:`What the office tells you when you’re not looking. At most one of each kind a minute; a burst arrives as one summary.`})}),(0,N.jsx)(`div`,{className:`notify-events`,role:`group`,"aria-label":e(`Tell me when`),children:h.map(n=>(0,N.jsxs)(`label`,{className:`toggle block`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:t.events[n.id],onChange:e=>i({events:{...t.events,[n.id]:e.target.checked}})}),(0,N.jsx)(`span`,{children:e(n.label)})]},n.id))}),(0,N.jsxs)(`label`,{className:`field`,children:[(0,N.jsx)(`span`,{children:(0,N.jsx)(A,{children:`Office address for links (optional)`})}),(0,N.jsx)(`input`,{type:`url`,value:n,onChange:e=>r(e.target.value),onBlur:()=>n.trim()!==t.officeUrl&&i({officeUrl:n.trim()}),placeholder:`https://office.your-tailnet.ts.net`,inputMode:`url`})]}),(0,N.jsx)(`h4`,{className:`notify-h`,children:(0,N.jsx)(A,{children:`This device`})}),(0,N.jsx)(hh,{notify:t,save:i}),(0,N.jsx)(`h4`,{className:`notify-h`,children:(0,N.jsx)(A,{children:`Phone app`})}),uh.map(e=>(0,N.jsx)(ph,{hook:e,notify:t,save:i},e.id)),(0,N.jsxs)(`p`,{className:`muted small`,children:[(0,N.jsx)(A,{children:`The topic and token stay on the office’s PC and are never shown again. Setup for each, and how to reach the office from your phone safely:`}),` `,(0,N.jsx)(`a`,{href:lh,children:`docs/pocket.md`}),`.`]})]})}function _h(e){let t={backlog:e.backlog.length,building:e.progress.length,qa:0,fixing:0,ready:e.ready.length,needsYou:0};for(let n of e.qa)y(n.qa)?t.needsYou++:n.qa?.status===`failed`||n.qa?.status===`fixing`?t.fixing++:t.qa++;return t}function vh(e){let t=e.status===`preparing`||e.status===`working`;return{stop:t,assign:!t,clear:!t&&e.status!==`idle`,message:t||e.task!==`qa`&&!!e.branch&&e.status!==`idle`}}function yh(e){if(!e)return[];let t=e.qa.filter(e=>!e.qa||e.qa.status===`needs-human`||e.qa.status===`queued`);return[...e.backlog.map(e=>({key:e.key,kind:`issue`,number:e.number,title:e.title})),...t.map(e=>({key:e.key,kind:`qa`,number:e.number,title:e.title}))]}function bh(e,t){return e.status===`idle`?b(t,`Free`):e.task===`qa`||e.task===`fix`?b(t,e.task===`qa`?`Testing PR #{number}`:`Fixing PR #{number}`,{number:e.prNumber??`?`})+(e.issueTitle?`: ${e.issueTitle}`:``):e.issueNumber==null?e.status===`done`?b(t,`Finished`):``:`#${e.issueNumber}${e.issueTitle?` ${e.issueTitle}`:``}`}function xh(e,t,n){let r=(e,t)=>e.pulls.some(e=>e.number===t.prNumber&&e.state===`OPEN`),i={requests:n.filter(e=>e.status===`pending`),stuck:[],ready:[]};for(let n of Object.values(t).sort((e,t)=>e.updatedAt-t.updatedAt)){let t=e.find(e=>e.id===n.repoId);t&&r(t,n)&&(n.status===`needs-human`?i.stuck.push({repo:t,qa:n}):n.status===`passed`&&!t.autoMerge&&i.ready.push({repo:t,qa:n}))}return i}var Sh=e=>e.requests.length+e.stuck.filter(e=>y(e.qa)).length;function Ch({k:e,children:t,hint:n,disabled:r}){let i=j(),a=O(t=>t.prefs[e]),o=(0,M.useId)();return(0,N.jsxs)(`label`,{className:`toggle block`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:a||!!r,disabled:r,onChange:t=>_e({[e]:t.target.checked}),"aria-describedby":n?o:void 0}),(0,N.jsxs)(`span`,{children:[(0,N.jsx)(`b`,{children:t}),n&&(0,N.jsxs)(`span`,{className:`muted small a11y-hint`,id:o,children:[` `,i(n)]})]})]})}function wh({k:e,label:t,unit:n,describe:r}){let i=j(),a=O(t=>t.prefs[e]),{min:o,max:s,step:c}=se[e];return(0,N.jsxs)(`label`,{className:`a11y-slider`,children:[(0,N.jsx)(`span`,{children:i(t)}),(0,N.jsx)(`input`,{type:`range`,min:o,max:s,step:c,value:a,"aria-valuetext":`${a}${n}${r?`, ${i(r(a))}`:``}`,onChange:t=>_e({[e]:Number(t.target.value)})}),(0,N.jsxs)(`b`,{children:[a,n]}),a!==ge[e]&&(0,N.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-small`,onClick:()=>_e({[e]:ge[e]}),"aria-label":i(`Reset {label}`,{label:i(t).toLowerCase()}),children:(0,N.jsx)(A,{children:`Reset`})})]})}function Th({palette:e,shapes:t}){let n=j();return(0,N.jsx)(`ul`,{className:`status-swatches`,"aria-label":n(`How statuses look`),children:S.map(r=>(0,N.jsxs)(`li`,{className:`status-kind status-kind-${r}`,style:{"--kind":d(r,e)},children:[t&&(0,N.jsx)(`span`,{"aria-hidden":!0,children:p[r]}),` `,n(l[r])]},r))})}var Eh={system:`Follow my system setting`,on:`Always reduce motion`,off:`Full motion`};function Dh({pocket:e=!1}){let t=j(),n=O(e=>e.prefs),r=O(e=>e.systemReduced),i=T(e=>e.openOverlay),a=(0,M.useId)(),o=ae(n),s=e=>_e(e);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`section`,{className:`card a11y-card`,"aria-labelledby":`${a}-cap`,children:[(0,N.jsx)(`h3`,{id:`${a}-cap`,children:(0,N.jsx)(A,{children:`💬 Captions`})}),(0,N.jsx)(Ch,{k:`captions`,hint:`The CEO’s messages written out as they’re read aloud, and short captions for important sounds (the gong, a merge cheer, alarms, the jukebox) with an arrow towards where they came from.`,children:(0,N.jsx)(A,{children:`Show captions`})}),(0,N.jsx)(wh,{k:`captionSize`,label:`Caption size`,unit:`%`}),(0,N.jsx)(wh,{k:`captionBg`,label:`Caption background`,unit:`%`}),(0,N.jsxs)(`div`,{className:`captions captions-preview`,"aria-hidden":!0,style:{"--caption-scale":n.captionSize/100,"--caption-bg":n.captionBg/100},children:[(0,N.jsx)(`div`,{className:`caption`,children:`[gong] ↗`}),(0,N.jsxs)(`div`,{className:`caption caption-speech`,children:[(0,N.jsx)(`b`,{children:`CEO:`}),` `,(0,N.jsx)(A,{children:`PR number 12 is ready to merge.`})]})]})]}),(0,N.jsxs)(`section`,{className:`card a11y-card`,"aria-labelledby":`${a}-col`,children:[(0,N.jsx)(`h3`,{id:`${a}-col`,children:(0,N.jsx)(A,{children:`🎨 Colour and status`})}),(0,N.jsxs)(`fieldset`,{className:`a11y-fieldset`,children:[(0,N.jsx)(`legend`,{children:(0,N.jsx)(A,{children:`Status colours`})}),c.map(e=>(0,N.jsxs)(`label`,{className:`toggle block`,children:[(0,N.jsx)(`input`,{type:`radio`,name:`${a}-palette`,checked:n.palette===e,onChange:()=>s({palette:e})}),` `,t(f[e])]},e))]}),(0,N.jsx)(Ch,{k:`statusShapes`,disabled:n.palette!==`standard`,hint:n.palette===`standard`?`On name tags, the whiteboard, Kanban cards, status pills and toasts.`:`Always on with a colour-blind palette.`,children:(0,N.jsx)(A,{children:`Shapes beside status colours (✓ ✕ ! ⏳)`})}),(0,N.jsx)(Th,{palette:n.palette,shapes:o})]}),!e&&(0,N.jsxs)(`section`,{className:`card a11y-card`,"aria-labelledby":`${a}-mot`,children:[(0,N.jsx)(`h3`,{id:`${a}-mot`,children:(0,N.jsx)(A,{children:`🌀 Motion`})}),(0,N.jsx)(wh,{k:`fov`,label:`Field of view`,unit:`°`,describe:e=>e<72?`narrower`:e>72?`wider`:`normal`}),(0,N.jsx)(Ch,{k:`headBob`,children:(0,N.jsx)(A,{children:`Head bob while walking`})}),(0,N.jsx)(Ch,{k:`cameraShake`,hint:`The view tipping back when you sip a coffee, and any screen shake.`,children:(0,N.jsx)(A,{children:`Camera sway and shake`})}),(0,N.jsxs)(`fieldset`,{className:`a11y-fieldset`,children:[(0,N.jsx)(`legend`,{children:(0,N.jsx)(A,{children:`Reduce motion`})}),Object.keys(Eh).map(e=>(0,N.jsxs)(`label`,{className:`toggle block`,children:[(0,N.jsx)(`input`,{type:`radio`,name:`${a}-motion`,checked:n.reduceMotion===e,onChange:()=>s({reduceMotion:e})}),` `,t(Eh[e]),e===`system`&&(0,N.jsx)(`span`,{className:`muted small`,children:t(r?`(your system asks for less motion)`:`(your system doesn’t ask for less motion)`)})]},e)),(0,N.jsxs)(`p`,{className:`muted small`,children:[(0,N.jsx)(A,{children:`Reduced motion: confetti bursts become a glow, the elevator doors cut to a fade, and panels, toasts and badges appear without moving.`}),` `,t(oe(n.reduceMotion,r)?`On now.`:`Off now.`)]})]}),(0,N.jsx)(Ch,{k:`centerDot`,hint:`A dot fixed in the middle of the view, which helps some people with motion sickness.`,children:(0,N.jsx)(A,{children:`Centre dot`})})]}),(0,N.jsxs)(`section`,{className:`card a11y-card`,"aria-labelledby":`${a}-read`,children:[(0,N.jsx)(`h3`,{id:`${a}-read`,children:(0,N.jsx)(A,{children:`🔎 Size and readability`})}),(0,N.jsx)(wh,{k:`uiScale`,label:`UI scale`,unit:`%`}),(0,N.jsx)(`p`,{className:`muted small`,children:(0,N.jsx)(A,{children:`The HUD, the phone, the console and every panel, from 80% to 150%.`})}),(0,N.jsx)(Ch,{k:`readableFont`,hint:`Verdana, with wider letter, word and line spacing, as dyslexia style guides recommend.`,children:(0,N.jsx)(A,{children:`Dyslexia-friendly font`})}),(0,N.jsx)(Ch,{k:`highContrast`,hint:`Plain white panels, darker grey text, heavier borders and focus rings.`,children:(0,N.jsx)(A,{children:`High-contrast panels`})})]}),!e&&(0,N.jsxs)(`section`,{className:`card a11y-card`,"aria-labelledby":`${a}-kb`,children:[(0,N.jsx)(`h3`,{id:`${a}-kb`,children:(0,N.jsx)(A,{children:`⌨️ Keyboard and screen readers`})}),(0,N.jsxs)(`p`,{className:`small`,children:[(0,N.jsx)(Md,{action:`phone`}),` `,(0,N.jsx)(A,{children:`opens your phone from anywhere: its`}),` `,(0,N.jsx)(`b`,{children:(0,N.jsx)(A,{children:`Company`})}),` `,(0,N.jsx)(A,{children:`tab opens the console, this floor’s Kanban, the floor list, help and these settings.`}),` `,(0,N.jsx)(Md,{action:`help`}),` `,(0,N.jsx)(A,{children:`opens help. In any panel,`}),` `,(0,N.jsx)(`kbd`,{children:`Tab`}),` `,(0,N.jsx)(A,{children:`and`}),` `,(0,N.jsx)(`kbd`,{children:`Shift`}),`+`,(0,N.jsx)(`kbd`,{children:`Tab`}),` `,(0,N.jsx)(A,{children:`move between controls,`}),` `,(0,N.jsx)(`kbd`,{children:`Enter`}),` `,(0,N.jsx)(A,{children:`or`}),` `,(0,N.jsx)(`kbd`,{children:`Space`}),` `,(0,N.jsx)(A,{children:`uses one and`}),` `,(0,N.jsx)(`kbd`,{children:`Esc`}),` `,(0,N.jsx)(A,{children:`closes it; focus goes back where it was. Screen readers hear the CEO’s messages and alarms as they happen.`})]}),(0,N.jsx)(`div`,{className:`row wrap`,children:(0,N.jsx)(`button`,{className:`btn btn-small`,onClick:()=>i({kind:`floorList`}),children:(0,N.jsx)(A,{children:`👥 List view of this floor`})})})]}),(0,N.jsx)(`div`,{className:`row`,children:(0,N.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:ce,children:(0,N.jsx)(A,{children:`Reset accessibility settings`})})})]})}export{Ze as $,gm as A,Et as B,Dm as C,Cm as D,wm as E,kd as F,xt as G,kt as H,Dd as I,Ct as J,yt as K,Ed as L,Pd as M,jd as N,hm as O,Ad as P,ut as Q,Pt as R,Bm as S,Sm as T,wt as U,jt as V,_t as W,pt as X,ct as Y,ft as Z,qm as _,bh as a,We as at,Pm as b,gh as c,Ne as ct,rh as d,st as et,nh as f,Wm as g,Ym as h,yh as i,Ke as it,Md as j,mm as k,ah as l,je as lt,$m as m,vh as n,Ye as nt,_h as o,qe as ot,eh as p,St as q,Sh as r,Ge as rt,xh as s,Je as st,Dh as t,rt as tt,ch as u,Pe as ut,Gm as v,xm as w,Em as x,Um as y,It as z};