@popmelt.com/core 0.35.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +80 -29
  2. package/THIRD_PARTY_NOTICES.md +26 -0
  3. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  4. package/claude-plugin/skills/popmelt-core/SKILL.md +1 -0
  5. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  6. package/codex-plugin/skills/popmelt-core/SKILL.md +1 -0
  7. package/dist/ExploreAttachment-IO3CNUWH.mjs +1 -0
  8. package/dist/PagePreviewLayer-KQ2FLIGX.mjs +1 -0
  9. package/dist/ParticipantRuntime-Y2BQVJSL.mjs +1 -0
  10. package/dist/PhoneHostGate-2G4BA5FP.mjs +1 -0
  11. package/dist/PopmeltTasteConnectedPane-H5QWBFD7.mjs +1 -0
  12. package/dist/PreviewRuntime-V2PZF462.mjs +1 -0
  13. package/dist/QueuedReplies-4APDDNQX.mjs +1 -0
  14. package/dist/SamplePlacementOverlay-ELSP5AHM.mjs +1 -0
  15. package/dist/ShareProjectPane-OR2LS2A3.mjs +1 -0
  16. package/dist/SuppliedContext-SAQKEDWW.mjs +1 -0
  17. package/dist/ThreadErrorCard-OSHIWSHR.mjs +1 -0
  18. package/dist/ThreadPanel-YPL2HDUC.mjs +1 -0
  19. package/dist/adapter-react-three-fiber.d.mts +6 -2
  20. package/dist/adapter-react-three-fiber.mjs +1 -1
  21. package/dist/adapter-three.d.mts +34 -0
  22. package/dist/adapter-three.mjs +45 -1
  23. package/dist/bridge-entry.mjs +1 -1
  24. package/dist/bridgeSSEStream-6OMAFDFW.mjs +1 -0
  25. package/dist/bridgeWebSocketStream-WIOGOPJW.mjs +1 -0
  26. package/dist/browser-runtime-O3EKN3FI.mjs +1 -0
  27. package/dist/browser.d.mts +4 -4
  28. package/dist/browser.mjs +1 -1
  29. package/dist/canvas-chat-note-O3USBECW.mjs +1 -0
  30. package/dist/checkFixture-SOSI7AT4.mjs +1 -0
  31. package/dist/chunk-3VOEPWRL.mjs +1 -0
  32. package/dist/chunk-4OEHQ6M7.mjs +24 -0
  33. package/dist/chunk-4YQWU5YB.mjs +1 -0
  34. package/dist/chunk-5IZHN3A7.mjs +1 -0
  35. package/dist/chunk-6EO73WJN.mjs +1 -0
  36. package/dist/{chunk-66VOM5NA.mjs → chunk-6O5QLRSA.mjs} +1 -1
  37. package/dist/chunk-76WRZ2NH.mjs +1 -0
  38. package/dist/chunk-A4GARXVQ.mjs +1 -0
  39. package/dist/chunk-AAMUU2QA.mjs +1 -0
  40. package/dist/chunk-AGCS65LT.mjs +1 -0
  41. package/dist/chunk-AGYBVMHX.mjs +1 -0
  42. package/dist/{chunk-RR4SHK7O.mjs → chunk-AOTDTBQO.mjs} +1 -1
  43. package/dist/chunk-ATLUO4G7.mjs +1 -0
  44. package/dist/chunk-AYZUOBFI.mjs +1 -0
  45. package/dist/chunk-B22WBEQC.mjs +1 -0
  46. package/dist/chunk-B2ISA6V6.mjs +1 -0
  47. package/dist/chunk-B4DYUYX4.mjs +1 -0
  48. package/dist/chunk-BVGHHT3Y.mjs +1 -0
  49. package/dist/{chunk-NDGM4DAP.mjs → chunk-BYASSHKJ.mjs} +1 -1
  50. package/dist/chunk-C2ZSNUXQ.mjs +1 -0
  51. package/dist/chunk-CIA6WVXQ.mjs +1 -0
  52. package/dist/chunk-CIKFUS7J.mjs +1 -0
  53. package/dist/chunk-CK3CDA3L.mjs +1 -0
  54. package/dist/{chunk-M5P6VHZY.mjs → chunk-DO46YJCX.mjs} +1 -1
  55. package/dist/chunk-DRPRASD6.mjs +1 -0
  56. package/dist/chunk-EBJ23A7F.mjs +1 -0
  57. package/dist/chunk-ECMLCGAM.mjs +1 -0
  58. package/dist/chunk-EILBHZDX.mjs +1 -0
  59. package/dist/{chunk-DOCRI237.mjs → chunk-ELKVFX2O.mjs} +1 -1
  60. package/dist/chunk-EUFR7R5Q.mjs +1 -0
  61. package/dist/chunk-EZVFCJEG.mjs +1 -0
  62. package/dist/chunk-FHCKFQBY.mjs +1 -0
  63. package/dist/chunk-FJWWBKCQ.mjs +1 -0
  64. package/dist/chunk-FON4QY7P.mjs +1 -0
  65. package/dist/chunk-GLF7Z5IR.mjs +1 -0
  66. package/dist/chunk-HAZXZ5TU.mjs +1 -0
  67. package/dist/chunk-HKHZBKAN.mjs +1 -0
  68. package/dist/chunk-I6FJ533W.mjs +1 -0
  69. package/dist/chunk-I7AI52RX.mjs +1 -0
  70. package/dist/chunk-IAXSC2ZN.mjs +1 -0
  71. package/dist/chunk-IGKU4YIV.mjs +1 -0
  72. package/dist/chunk-IW7V7WNL.mjs +1 -0
  73. package/dist/chunk-JCW2WY7X.mjs +1 -0
  74. package/dist/chunk-JEGBAHYK.mjs +1 -0
  75. package/dist/chunk-JLK3VRBT.mjs +1 -0
  76. package/dist/chunk-KCDHP4N3.mjs +1 -0
  77. package/dist/chunk-KF73S7MG.mjs +1 -0
  78. package/dist/chunk-L6S66APQ.mjs +1 -0
  79. package/dist/chunk-LH7HKUCK.mjs +1 -0
  80. package/dist/chunk-LOUWY55X.mjs +1 -0
  81. package/dist/chunk-LXFKOYLK.mjs +1 -0
  82. package/dist/chunk-MDPZUECK.mjs +1 -0
  83. package/dist/chunk-MHWIFSXJ.mjs +1 -0
  84. package/dist/chunk-MPEVFQ43.mjs +1 -0
  85. package/dist/{chunk-57FM7XQV.mjs → chunk-NI77Y3WC.mjs} +1 -1
  86. package/dist/chunk-NXTWB3A7.mjs +1 -0
  87. package/dist/chunk-OA63PYHZ.mjs +1 -0
  88. package/dist/chunk-OFJUTWJU.mjs +1 -0
  89. package/dist/chunk-OREALBUO.mjs +1 -0
  90. package/dist/chunk-OVZ4CQGM.mjs +1 -0
  91. package/dist/{chunk-XG2YIAJS.mjs → chunk-OZBMHEOD.mjs} +1 -1
  92. package/dist/chunk-PILMDBAX.mjs +1 -0
  93. package/dist/chunk-PLE6FFKY.mjs +1 -0
  94. package/dist/chunk-PRPXMDZ7.mjs +1 -0
  95. package/dist/chunk-PWQB3FIW.mjs +1 -0
  96. package/dist/chunk-ROKRMYFR.mjs +1 -0
  97. package/dist/chunk-SNAJBV7T.mjs +30 -0
  98. package/dist/chunk-SOGN7S54.mjs +1 -0
  99. package/dist/chunk-SOT33EQ4.mjs +1 -0
  100. package/dist/chunk-SQA27YGA.mjs +1 -0
  101. package/dist/chunk-SUAHDXJZ.mjs +1 -0
  102. package/dist/chunk-TCGXG7UA.mjs +1 -0
  103. package/dist/chunk-TMSGNHXH.mjs +1 -0
  104. package/dist/chunk-TQ3SP5TE.mjs +1 -0
  105. package/dist/chunk-UTP56NCY.mjs +1 -0
  106. package/dist/chunk-W2QQVB2H.mjs +1 -0
  107. package/dist/chunk-WC4ZNVFM.mjs +1 -0
  108. package/dist/chunk-WDSFOF2E.mjs +1 -0
  109. package/dist/chunk-WP2SHSCG.mjs +1 -0
  110. package/dist/chunk-X6I6KQDG.mjs +1 -0
  111. package/dist/chunk-XJJDBMZI.mjs +1 -0
  112. package/dist/chunk-XY7YW7SH.mjs +1 -0
  113. package/dist/chunk-YMWXWXPV.mjs +1 -0
  114. package/dist/chunk-YU3ZY76H.mjs +1 -0
  115. package/dist/chunk-YVT3J6JB.mjs +1 -0
  116. package/dist/chunk-YYFF2X3L.mjs +1 -0
  117. package/dist/cli.mjs +1 -1
  118. package/dist/codex-note-context-UI55CWRI.mjs +1 -0
  119. package/dist/codex-project-LIU27RXA.mjs +1 -0
  120. package/dist/codex-session-registry-YNU6LEVH.mjs +1 -0
  121. package/dist/codex-store-mount-EPETPOBA.mjs +1 -0
  122. package/dist/{dev-server-DtX2_HCa.d.mts → dev-server-BRrhkH5t.d.mts} +11 -1
  123. package/dist/dev-server-WYB2CRC5.mjs +1 -0
  124. package/dist/focus-inspection-42IEM45O.mjs +1 -0
  125. package/dist/guest-admission.d.mts +2 -0
  126. package/dist/guest-admission.mjs +1 -0
  127. package/dist/guest-live-canvas.d.mts +2 -0
  128. package/dist/guest-live-canvas.mjs +1 -0
  129. package/dist/index.d.mts +6 -6
  130. package/dist/index.mjs +1 -1
  131. package/dist/invitationLink-LUIIOAEZ.mjs +1 -0
  132. package/dist/inviteQr-HVHH45SN.mjs +1 -0
  133. package/dist/inviteQr-U77MLSEQ.mjs +1 -0
  134. package/dist/media.d.mts +3 -3
  135. package/dist/memory-store.d.mts +5 -1
  136. package/dist/page-interaction-TV3P6B3X.mjs +1 -0
  137. package/dist/page-planes-2ZepTpen.d.mts +817 -0
  138. package/dist/participantBootstrap-BuTrTQbo.d.mts +22 -0
  139. package/dist/{participantBootstrap-DFJlcKRI.d.mts → participantBootstrap-DuosDN9G.d.mts} +9 -3
  140. package/dist/peer-client-RSC6EGAF.mjs +1 -0
  141. package/dist/plain-html-EF7MUNRZ.mjs +1 -0
  142. package/dist/plugin-astro.d.mts +5 -2
  143. package/dist/plugin-astro.mjs +1 -1
  144. package/dist/plugin-next.mjs +1 -1
  145. package/dist/plugin-nuxt.d.mts +4 -2
  146. package/dist/plugin-nuxt.mjs +1 -1
  147. package/dist/plugin-vite.d.mts +86 -9
  148. package/dist/plugin-vite.mjs +1 -1
  149. package/dist/qr-encoder.mjs +3 -0
  150. package/dist/server.d.mts +43 -20
  151. package/dist/server.mjs +1 -1
  152. package/dist/shared-page-GO76UP7I.mjs +1 -0
  153. package/dist/{subjects-DdavjSTL.d.mts → subjects-BhO1x5tz.d.mts} +80 -1
  154. package/dist/taste-proposal-session-DBOUA54V.mjs +1 -0
  155. package/dist/toolbarFonts-GVPRHJGB.mjs +1 -0
  156. package/dist/{types-C8tjyhiF.d.mts → types-CggBG-H6.d.mts} +1 -136
  157. package/dist/{video-adapter-DB6Hex1f.d.mts → video-adapter-B8J5awc_.d.mts} +2 -2
  158. package/dist/workspace-snapshot-6LN7U2NJ.mjs +1 -0
  159. package/package.json +46 -22
  160. package/samples/README.md +32 -0
  161. package/samples/build.d.mts +16 -0
  162. package/samples/build.mjs +138 -0
  163. package/dist/ExploreAttachment-TTEKD4AU.mjs +0 -1
  164. package/dist/PagePreviewLayer-TJZOJBSD.mjs +0 -1
  165. package/dist/ParticipantRuntime-BQAOTSQZ.mjs +0 -1
  166. package/dist/PhoneHostGate-LNSDZOG2.mjs +0 -1
  167. package/dist/PopmeltTasteConnectedPane-NCCF7YUX.mjs +0 -1
  168. package/dist/PreviewRuntime-H2UOLP6T.mjs +0 -1
  169. package/dist/QueuedReplies-LQUBEZ6K.mjs +0 -1
  170. package/dist/SuppliedContext-YKQSMF3J.mjs +0 -1
  171. package/dist/ThreadErrorCard-4MOA34C4.mjs +0 -1
  172. package/dist/ThreadPanel-T6IXWFLA.mjs +0 -1
  173. package/dist/bridgeSSEStream-K3UIMBTC.mjs +0 -1
  174. package/dist/bridgeWebSocketStream-2SUZUBE3.mjs +0 -1
  175. package/dist/browser-runtime-HQM2Y6EL.mjs +0 -1
  176. package/dist/canvas-chat-note-MGAEUYJO.mjs +0 -1
  177. package/dist/checkFixture-BXILOUP5.mjs +0 -1
  178. package/dist/chunk-2P2NUZW7.mjs +0 -1
  179. package/dist/chunk-4LHTPRFY.mjs +0 -1
  180. package/dist/chunk-5D2ADU7H.mjs +0 -1
  181. package/dist/chunk-5K7SACPW.mjs +0 -1
  182. package/dist/chunk-67QNAAUC.mjs +0 -1
  183. package/dist/chunk-6LBPTCGC.mjs +0 -1
  184. package/dist/chunk-AYDREFWN.mjs +0 -1
  185. package/dist/chunk-CRJPE33X.mjs +0 -1
  186. package/dist/chunk-DC47WNPG.mjs +0 -1
  187. package/dist/chunk-DJTGR3RO.mjs +0 -1
  188. package/dist/chunk-DOJBWTT5.mjs +0 -1
  189. package/dist/chunk-EX63NVDN.mjs +0 -1
  190. package/dist/chunk-F45IVFS3.mjs +0 -1
  191. package/dist/chunk-F5XSNRGT.mjs +0 -1
  192. package/dist/chunk-G7JR5Z3P.mjs +0 -1
  193. package/dist/chunk-GKOMTSWV.mjs +0 -1
  194. package/dist/chunk-HAE5LUJX.mjs +0 -1
  195. package/dist/chunk-HU2XWUJC.mjs +0 -1
  196. package/dist/chunk-HV7HRQ2S.mjs +0 -1
  197. package/dist/chunk-J4WDYITA.mjs +0 -1
  198. package/dist/chunk-KTRMNVPZ.mjs +0 -1
  199. package/dist/chunk-LVEMYZOA.mjs +0 -1
  200. package/dist/chunk-N4737FRL.mjs +0 -1
  201. package/dist/chunk-NSCO633B.mjs +0 -1
  202. package/dist/chunk-O4HZP3RP.mjs +0 -1
  203. package/dist/chunk-OAHYSDJ4.mjs +0 -1
  204. package/dist/chunk-PQT5FYN5.mjs +0 -1
  205. package/dist/chunk-R34FOW4D.mjs +0 -1
  206. package/dist/chunk-RUTWU5W2.mjs +0 -1
  207. package/dist/chunk-S7BCEQKP.mjs +0 -1
  208. package/dist/chunk-T4CCY2EL.mjs +0 -1
  209. package/dist/chunk-TH7DML4A.mjs +0 -1
  210. package/dist/chunk-UEGDSECJ.mjs +0 -1
  211. package/dist/chunk-V2I7PSJW.mjs +0 -1
  212. package/dist/chunk-WDAXARLI.mjs +0 -1
  213. package/dist/chunk-WHJEKDNP.mjs +0 -1
  214. package/dist/chunk-XM6RE6HT.mjs +0 -1
  215. package/dist/chunk-XT6PHPPG.mjs +0 -1
  216. package/dist/chunk-Y3SF5YCR.mjs +0 -1
  217. package/dist/chunk-ZG6XHKYO.mjs +0 -1
  218. package/dist/chunk-ZG7MAEEV.mjs +0 -30
  219. package/dist/codex-note-context-OUG4S6XE.mjs +0 -1
  220. package/dist/codex-project-B5466BL6.mjs +0 -1
  221. package/dist/codex-session-registry-ONODFWFD.mjs +0 -1
  222. package/dist/focus-inspection-SZJ5KP23.mjs +0 -1
  223. package/dist/peer-client-SCSWLRCX.mjs +0 -1
  224. package/dist/taste-proposal-session-XU4N7RUV.mjs +0 -1
  225. package/dist/workspace-snapshot-RTTXNNUX.mjs +0 -1
@@ -1 +0,0 @@
1
- "use client";var e='<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n \x3c!-- fixture-policy --\x3e\n <meta name="viewport" content="width=device-width,initial-scale=1" />\n <title>Steer option styles</title>\n <style>.sp-piece,\n.sp-label-hit {\n position: relative;\n}\n.sp-piece-hit,\n.sp-label-hit {\n cursor: inherit;\n font: inherit;\n margin: 0;\n letter-spacing: inherit;\n color: inherit;\n background: transparent;\n border: 0;\n padding: 0;\n}\n.sp-piece-hit {\n position: absolute;\n /* A keyboard stop for the box, without putting a hit layer over its children. */\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n}\n[data-tagged],\n[data-badge-hover],\n[data-scratch-part]:focus,\n.sp-label-hit:focus-visible,\n.sp-piece:has(> .sp-piece-hit:focus-visible) {\n outline: 1px solid #ed1014;\n outline-offset: 1px;\n}\n\n/* Subject projections track the moving object\'s screen bounds in the sandbox. */\n[data-popmelt-subject-projection][data-scratch-part]:is(\n [data-tagged],\n [data-badge-hover]\n ) {\n opacity: 1 !important;\n z-index: 1 !important;\n}\n\n:root:has(.sp-backdrop) {\n color-scheme: light dark;\n /* The grid is painted by the card or expanded workspace behind this iframe. */\n background-color: transparent;\n}\n.sp-fit {\n color: light-dark(var(--sp-ink-light), var(--sp-ink-dark));\n}\n/* A piece with its own fill has its own backdrop for inherited page text. */\n.sp-fit [data-sp-fill]:not([data-sp-ink], [data-sp-ink] *) {\n color: var(--sp-source-ink, inherit);\n}\n</style>\n <style>\n body {\n margin: 0;\n color: #222;\n font:\n 13px/1.25 \'Popmelt Geist\',\n system-ui,\n sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n body {\n color: #ddd;\n }\n }\n html,\n body,\n #root {\n height: 100%;\n overflow: hidden;\n }\n .sp-backdrop {\n position: absolute;\n inset: 0;\n }\n .sp-fit {\n position: absolute;\n left: 50%;\n top: 50%;\n width: max-content;\n display: flex;\n transform: translate(-50%, -50%) scale(var(--sp-fit, 1));\n }\n html[data-preview-control-hovered] [data-popmelt-sticker-hud] {\n visibility: hidden !important;\n }\n @media (hover: hover) {\n [data-popmelt-sticker-hud] {\n transition: opacity 120ms ease-out;\n }\n html:not(:hover) [data-popmelt-sticker-hud] {\n visibility: hidden !important;\n opacity: 0 !important;\n }\n @starting-style {\n [data-popmelt-sticker-hud] {\n opacity: 0;\n }\n }\n }\n @media (prefers-reduced-motion: reduce) {\n [data-popmelt-sticker-hud] {\n transition: none;\n }\n }\n </style>\n </head>\n <body>\n <div id="root"></div>\n <script type="module">var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,l=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},u=(e,l,s)=>(s=null!=e?t(o(e)):{},((e,t,o,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of i(t))!a.call(e,o)&&void 0!==o&&n(e,o,{get:()=>t[o],enumerable:!(l=r(t,o))||l.enumerable});return e})(!l&&e&&e.__esModule?s:n(s,"default",{value:e,enumerable:!0}),e)),c=s(e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator,p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,m={};function g(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||p}function y(){}function x(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||p}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=g.prototype;var v=x.prototype=new y;v.constructor=x,h(v,g.prototype),v.isPureReactComponent=!0;var b=Array.isArray,w={H:null,A:null,T:null,S:null,V:null},S=Object.prototype.hasOwnProperty;function k(e,n,r,i,o,a){return r=a.ref,{$$typeof:t,type:e,key:n,ref:void 0!==r?r:null,props:a}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var E=/\\/+/g;function M(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function T(){}function R(e,r,i,o,a){var l=typeof e;("undefined"===l||"boolean"===l)&&(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case t:case n:s=!0;break;case d:return R((s=e._init)(e._payload),r,i,o,a)}}if(s)return a=a(e),s=""===o?"."+M(e,0):o,b(a)?(i="",null!=s&&(i=s.replace(E,"$&/")+"/"),R(a,r,i,"",function(e){return e})):null!=a&&(C(a)&&(a=function(e,t){return k(e.type,t,void 0,0,0,e.props)}(a,i+(null==a.key||e&&e.key===a.key?"":(""+a.key).replace(E,"$&/")+"/")+s)),r.push(a)),1;s=0;var u=""===o?".":o+":";if(b(e))for(var c=0;c<e.length;c++)s+=R(o=e[c],r,i,l=u+M(o,c),a);else if(c=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"==typeof c)for(e=c.call(e),c=0;!(o=e.next()).done;)s+=R(o=o.value,r,i,l=u+M(o,c++),a);else if("object"===l){if("function"==typeof e.then)return R(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(T,T):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),r,i,o,a);throw r=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===r?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return s}function A(e,t,n){if(null==e)return e;var r=[],i=0;return R(e,r,"","",function(e){return t.call(n,e,i++)}),r}function I(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var j="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)};function L(){}e.Children={map:A,forEach:function(e,t,n){A(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return A(e,function(){t++}),t},toArray:function(e){return A(e,function(e){return e})||[]},only:function(e){if(!C(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},e.Component=g,e.Fragment=r,e.Profiler=o,e.PureComponent=x,e.StrictMode=i,e.Suspense=u,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cloneElement=function(e,t,n){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var r=h({},e.props),i=e.key;if(null!=t)for(o in t.ref,void 0!==t.key&&(i=""+t.key),t)!S.call(t,o)||"key"===o||"__self"===o||"__source"===o||"ref"===o&&void 0===t.ref||(r[o]=t[o]);var o=arguments.length-2;if(1===o)r.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];r.children=a}return k(e.type,i,void 0,0,0,r)},e.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:a,_context:e},e},e.createElement=function(e,t,n){var r,i={},o=null;if(null!=t)for(r in void 0!==t.key&&(o=""+t.key),t)S.call(t,r)&&"key"!==r&&"__self"!==r&&"__source"!==r&&(i[r]=t[r]);var a=arguments.length-2;if(1===a)i.children=n;else if(1<a){for(var l=Array(a),s=0;s<a;s++)l[s]=arguments[s+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===i[r]&&(i[r]=a[r]);return k(e,o,void 0,0,0,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:s,render:e}},e.isValidElement=C,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:I}},e.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;null!==i&&i(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(L,j)}catch(e){j(e)}finally{w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t,n){var r=w.H;if("function"==typeof n)throw Error("useEffect CRUD overload is not enabled in this build of React.");return r.useEffect(e,t)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version="19.1.0"}),d=s((e,t)=>{t.exports=c()}),f=s(e=>{function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],u=l+1,c=e[u];if(0>i(s,n))u<o&&0>i(c,s)?(e[r]=c,e[u]=n,r=u):(e[r]=s,e[l]=n,r=l);else{if(!(u<o&&0>i(c,n)))break e;e[r]=c,e[u]=n,r=u}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now?(o=performance,e.unstable_now=function(){return o.now()}):(a=Date,l=a.now(),e.unstable_now=function(){return a.now()-l});var o,a,l,s=[],u=[],c=1,d=null,f=3,p=!1,h=!1,m=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;function b(e){for(var i=n(u);null!==i;){if(null===i.callback)r(u);else{if(!(i.startTime<=e))break;r(u),i.sortIndex=i.expirationTime,t(s,i)}i=n(u)}}function w(e){if(m=!1,b(e),!h)if(null!==n(s))h=!0,E||(E=!0,S());else{var t=n(u);null!==t&&j(w,t.startTime-e)}}var S,k,C,E=!1,M=-1,T=5,R=-1;function A(){return!(!g&&e.unstable_now()-R<T)}function I(){if(g=!1,E){var t=e.unstable_now();R=t;var i=!0;try{e:{h=!1,m&&(m=!1,x(M),M=-1),p=!0;var o=f;try{t:{for(b(t),d=n(s);null!==d&&!(d.expirationTime>t&&A());){var a=d.callback;if("function"==typeof a){d.callback=null,f=d.priorityLevel;var l=a(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof l){d.callback=l,b(t),i=!0;break t}d===n(s)&&r(s),b(t)}else r(s);d=n(s)}if(null!==d)i=!0;else{var c=n(u);null!==c&&j(w,c.startTime-t),i=!1}}break e}finally{d=null,f=o,p=!1}i=void 0}}finally{i?S():E=!1}}}function j(t,n){M=y(function(){t(e.unstable_now())},n)}"function"==typeof v?S=function(){v(I)}:typeof MessageChannel<"u"?(k=new MessageChannel,C=k.port2,k.port1.onmessage=I,S=function(){C.postMessage(null)}):S=function(){y(I,0)},e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:c++,callback:i,priorityLevel:r,startTime:o,expirationTime:l=o+l,sortIndex:-1},o>a?(r.sortIndex=o,t(u,r),null===n(s)&&r===n(u)&&(m?(x(M),M=-1):m=!0,j(w,o-a))):(r.sortIndex=l,t(s,r),h||p||(h=!0,E||(E=!0,S()))),r},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}),p=s((e,t)=>{t.exports=f()}),h=s(e=>{var t=d();function n(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal"),a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(n(299));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:o,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,r)},e.flushSync=function(e){var t=a.T,n=i.p;try{if(a.T=null,i.p=2,e)return e()}finally{a.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){"string"==typeof e&&(t=t?"string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:null,i.d.C(e,t))},e.prefetchDNS=function(e){"string"==typeof e&&i.d.D(e)},e.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var n=t.as,r=l(n,t.crossOrigin),o="string"==typeof t.integrity?t.integrity:void 0,a="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===n?i.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:r,integrity:o,fetchPriority:a}):"script"===n&&i.d.X(e,{crossOrigin:r,integrity:o,fetchPriority:a,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},e.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&i.d.M(e)},e.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},e.preloadModule=function(e,t){if("string"==typeof e)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return a.H.useFormState(e,t,n)},e.useFormStatus=function(){return a.H.useHostTransitionStatus()},e.version="19.1.0"}),m=s((e,t)=>{(function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||"function"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}})(),t.exports=h()}),g=s(e=>{var t=p(),n=d(),r=m();function i(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function a(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function l(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&null!==(e=e.alternate)&&(t=e.memoizedState),null!==t)return t.dehydrated}return null}function s(e){if(a(e)!==e)throw Error(i(188))}function u(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=u(e)))return t;e=e.sibling}return null}var c=Object.assign,f=Symbol.for("react.element"),h=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),w=Symbol.for("react.consumer"),S=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),A=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function j(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=I&&e[I]||e["@@iterator"])?e:null}var L=Symbol.for("react.client.reference");function P(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===L?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case y:return"Fragment";case v:return"Profiler";case x:return"StrictMode";case C:return"Suspense";case E:return"SuspenseList";case R:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case g:return"Portal";case S:return(e.displayName||"Context")+".Provider";case w:return(e._context.displayName||"Context")+".Consumer";case k:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case M:return null!==(t=e.displayName||null)?t:P(e.type)||"Memo";case T:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var z=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D={pending:!1,data:null,method:null,action:null},F=[],$=-1;function O(e){return{current:e}}function H(e){0>$||(e.current=F[$],F[$]=null,$--)}function W(e,t){$++,F[$]=e.current,e.current=t}var B=O(null),V=O(null),q=O(null),Y=O(null);function U(e,t){switch(W(q,t),W(V,e),W(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?od(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=ad(t=od(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}H(B),W(B,e)}function X(){H(B),H(V),H(q)}function K(e){null!==e.memoizedState&&W(Y,e);var t=B.current,n=ad(t,e.type);t!==n&&(W(V,e),W(B,n))}function Q(e){V.current===e&&(H(B),H(V)),Y.current===e&&(H(Y),Kd._currentValue=D)}var G=Object.prototype.hasOwnProperty,Z=t.unstable_scheduleCallback,J=t.unstable_cancelCallback,ee=t.unstable_shouldYield,te=t.unstable_requestPaint,ne=t.unstable_now,re=t.unstable_getCurrentPriorityLevel,ie=t.unstable_ImmediatePriority,oe=t.unstable_UserBlockingPriority,ae=t.unstable_NormalPriority,le=t.unstable_LowPriority,se=t.unstable_IdlePriority,ue=t.log,ce=t.unstable_setDisableYieldValue,de=null,fe=null;function pe(e){if("function"==typeof ue&&ce(e),fe&&"function"==typeof fe.setStrictMode)try{fe.setStrictMode(de,e)}catch{}}var he=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(me(e)/ge|0)|0},me=Math.log,ge=Math.LN2,ye=256,xe=4194304;function ve(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194048&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function be(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var i=0,o=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=134217727&r;return 0!==l?0!==(r=l&~o)?i=ve(r):0!==(a&=l)?i=ve(a):n||0!==(n=l&~e)&&(i=ve(n)):0!==(l=r&~o)?i=ve(l):0!==a?i=ve(a):n||0!==(n=r&~e)&&(i=ve(n)),0===i?0:0!==t&&t!==i&&0===(t&o)&&((o=i&-i)>=(n=t&-t)||32===o&&4194048&n)?t:i}function we(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Se(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function ke(){var e=ye;return!(4194048&(ye<<=1))&&(ye=256),e}function Ce(){var e=xe;return!(62914560&(xe<<=1))&&(xe=4194304),e}function Ee(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Me(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Te(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-he(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|4194090&n}function Re(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-he(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ae(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ie(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function je(){var e=_.p;return 0!==e?e:void 0===(e=window.event)?32:df(e.type)}var Le=Math.random().toString(36).slice(2),Pe="__reactFiber$"+Le,ze="__reactProps$"+Le,Ne="__reactContainer$"+Le,_e="__reactEvents$"+Le,De="__reactListeners$"+Le,Fe="__reactHandles$"+Le,$e="__reactResources$"+Le,Oe="__reactMarker$"+Le;function He(e){delete e[Pe],delete e[ze],delete e[_e],delete e[De],delete e[Fe]}function We(e){var t=e[Pe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ne]||n[Pe]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=bd(e);null!==e;){if(n=e[Pe])return n;e=bd(e)}return t}n=(e=n).parentNode}return null}function Be(e){if(e=e[Pe]||e[Ne]){var t=e.tag;if(5===t||6===t||13===t||26===t||27===t||3===t)return e}return null}function Ve(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(i(33))}function qe(e){var t=e[$e];return t||(t=e[$e]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ye(e){e[Oe]=!0}var Ue=new Set,Xe={};function Ke(e,t){Qe(e,t),Qe(e+"Capture",t)}function Qe(e,t){for(Xe[e]=t,e=0;e<t.length;e++)Ue.add(t[e])}var Ge,Ze,Je=RegExp("^[:A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD][:A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD\\\\-.0-9\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]*$"),et={},tt={};function nt(e,t,n){if(function(e){return!!G.call(tt,e)||!G.call(et,e)&&(Je.test(e)?tt[e]=!0:(et[e]=!0,!1))}(t))if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var r=t.toLowerCase().slice(0,5);if("data-"!==r&&"aria-"!==r)return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function rt(e,t,n){if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function it(e,t,n,r){if(null===r)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(n)}e.setAttributeNS(t,n,""+r)}}function ot(e){if(void 0===Ge)try{throw Error()}catch(e){var t=e.stack.trim().match(/\\n( *(at )?)/);Ge=t&&t[1]||"",Ze=-1<e.stack.indexOf("\\n at")?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return"\\n"+Ge+e+Ze}var at=!1;function lt(e,t){if(!e||at)return"";at=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(e){if(e&&r&&"string"==typeof e.stack)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=r.DetermineComponentFrameRoot(),a=o[0],l=o[1];if(a&&l){var s=a.split("\\n"),u=l.split("\\n");for(i=r=0;r<s.length&&!s[r].includes("DetermineComponentFrameRoot");)r++;for(;i<u.length&&!u[i].includes("DetermineComponentFrameRoot");)i++;if(r===s.length||i===u.length)for(r=s.length-1,i=u.length-1;1<=r&&0<=i&&s[r]!==u[i];)i--;for(;1<=r&&0<=i;r--,i--)if(s[r]!==u[i]){if(1!==r||1!==i)do{if(r--,0>--i||s[r]!==u[i]){var c="\\n"+s[r].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=r&&0<=i);break}}}finally{at=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ot(n):""}function st(e){switch(e.tag){case 26:case 27:case 5:return ot(e.type);case 16:return ot("Lazy");case 13:return ot("Suspense");case 19:return ot("SuspenseList");case 0:case 15:return lt(e.type,!1);case 11:return lt(e.type.render,!1);case 1:return lt(e.type,!0);case 31:return ot("Activity");default:return""}}function ut(e){try{var t="";do{t+=st(e),e=e.return}while(e);return t}catch(e){return"\\nError generating stack: "+e.message+"\\n"+e.stack}}function ct(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function dt(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ft(e){e._valueTracker||(e._valueTracker=function(e){var t=dt(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=dt(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function ht(e){if(typeof(e=e||(typeof document<"u"?document:void 0))>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var mt=/[\\n"\\\\]/g;function gt(e){return e.replace(mt,function(e){return"\\\\"+e.charCodeAt(0).toString(16)+" "})}function yt(e,t,n,r,i,o,a,l){e.name="",null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a?e.type=a:e.removeAttribute("type"),null!=t?"number"===a?(0===t&&""===e.value||e.value!=t)&&(e.value=""+ct(t)):e.value!==""+ct(t)&&(e.value=""+ct(t)):"submit"!==a&&"reset"!==a||e.removeAttribute("value"),null!=t?vt(e,a,ct(t)):null!=n?vt(e,a,ct(n)):null!=r&&e.removeAttribute("value"),null==i&&null!=o&&(e.defaultChecked=!!o),null!=i&&(e.checked=i&&"function"!=typeof i&&"symbol"!=typeof i),null!=l&&"function"!=typeof l&&"symbol"!=typeof l&&"boolean"!=typeof l?e.name=""+ct(l):e.removeAttribute("name")}function xt(e,t,n,r,i,o,a,l){if(null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.type=o),null!=t||null!=n){if(("submit"===o||"reset"===o)&&null==t)return;n=null!=n?""+ct(n):"",t=null!=t?""+ct(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=r??i)&&"symbol"!=typeof r&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.name=a)}function vt(e,t,n){"number"===t&&ht(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function bt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ct(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function wt(e,t,n){null==t||((t=""+ct(t))!==e.value&&(e.value=t),null!=n)?e.defaultValue=null!=n?""+ct(n):"":e.defaultValue!==t&&(e.defaultValue=t)}function St(e,t,n,r){if(null==t){if(null!=r){if(null!=n)throw Error(i(92));if(z(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}null==n&&(n=""),t=n}n=ct(t),e.defaultValue=n,(r=e.textContent)===n&&""!==r&&null!==r&&(e.value=r)}function kt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var Ct=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Et(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||Ct.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Mt(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(i(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var o in t)r=t[o],t.hasOwnProperty(o)&&n[o]!==r&&Et(e,o,r)}else for(var a in t)t.hasOwnProperty(a)&&Et(e,a,t[a])}function Tt(e){if(-1===e.indexOf("-"))return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Rt=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),At=/^[\\u0000-\\u001F ]*j[\\r\\n\\t]*a[\\r\\n\\t]*v[\\r\\n\\t]*a[\\r\\n\\t]*s[\\r\\n\\t]*c[\\r\\n\\t]*r[\\r\\n\\t]*i[\\r\\n\\t]*p[\\r\\n\\t]*t[\\r\\n\\t]*:/i;function It(e){return At.test(""+e)?"javascript:throw new Error(\'React has blocked a javascript: URL as a security precaution.\')":e}var jt=null;function Lt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Pt=null,zt=null;function Nt(e){var t=Be(e);if(t&&(e=t.stateNode)){var n=e[ze]||null;e:switch(e=t.stateNode,t.type){case"input":if(yt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(\'input[name="\'+gt(""+t)+\'"][type="radio"]\'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=r[ze]||null;if(!o)throw Error(i(90));yt(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)(r=n[t]).form===e.form&&pt(r)}break e;case"textarea":wt(e,n.value,n.defaultValue);break e;case"select":null!=(t=n.value)&&bt(e,!!n.multiple,t,!1)}}}var _t=!1;function Dt(e,t,n){if(_t)return e(t,n);_t=!0;try{return e(t)}finally{if(_t=!1,(null!==Pt||null!==zt)&&(Wu(),Pt&&(t=Pt,e=zt,zt=Pt=null,Nt(t),e)))for(t=0;t<e.length;t++)Nt(e[t])}}function Ft(e,t){var n=e.stateNode;if(null===n)return null;var r=n[ze]||null;if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(i(231,t,typeof n));return n}var $t=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ot=!1;if($t)try{Ht={},Object.defineProperty(Ht,"passive",{get:function(){Ot=!0}}),window.addEventListener("test",Ht,Ht),window.removeEventListener("test",Ht,Ht)}catch{Ot=!1}var Ht,Wt=null,Bt=null,Vt=null;function qt(){if(Vt)return Vt;var e,t,n=Bt,r=n.length,i="value"in Wt?Wt.value:Wt.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===i[o-t];t++);return Vt=i.slice(e,1<t?1-t:void 0)}function Yt(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Ut(){return!0}function Xt(){return!1}function Kt(e){function t(t,n,r,i,o){for(var a in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(a)&&(t=e[a],this[a]=t?t(i):i[a]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?Ut:Xt,this.isPropagationStopped=Xt,this}return c(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Ut)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Ut)},persist:function(){},isPersistent:Ut}),t}var Qt,Gt,Zt,Jt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},en=Kt(Jt),tn=c({},Jt,{view:0,detail:0}),nn=Kt(tn),rn=c({},tn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Zt&&(Zt&&"mousemove"===e.type?(Qt=e.screenX-Zt.screenX,Gt=e.screenY-Zt.screenY):Gt=Qt=0,Zt=e),Qt)},movementY:function(e){return"movementY"in e?e.movementY:Gt}}),on=Kt(rn),an=Kt(c({},rn,{dataTransfer:0})),ln=Kt(c({},tn,{relatedTarget:0})),sn=Kt(c({},Jt,{animationName:0,elapsedTime:0,pseudoElement:0})),un=Kt(c({},Jt,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),cn=Kt(c({},Jt,{data:0})),dn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},pn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=pn[e])&&!!t[e]}function mn(){return hn}var gn=Kt(c({},tn,{key:function(e){if(e.key){var t=dn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Yt(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?fn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mn,charCode:function(e){return"keypress"===e.type?Yt(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Yt(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),yn=Kt(c({},rn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),xn=Kt(c({},tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mn})),vn=Kt(c({},Jt,{propertyName:0,elapsedTime:0,pseudoElement:0})),bn=Kt(c({},rn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),wn=Kt(c({},Jt,{newState:0,oldState:0})),Sn=[9,13,27,32],kn=$t&&"CompositionEvent"in window,Cn=null;$t&&"documentMode"in document&&(Cn=document.documentMode);var En=$t&&"TextEvent"in window&&!Cn,Mn=$t&&(!kn||Cn&&8<Cn&&11>=Cn),Tn=" ",Rn=!1;function An(e,t){switch(e){case"keyup":return-1!==Sn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function In(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var jn=!1,Ln={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Pn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Ln[e.type]:"textarea"===t}function zn(e,t,n,r){Pt?zt?zt.push(r):zt=[r]:Pt=r,0<(t=qc(t,"onChange")).length&&(n=new en("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Nn=null,_n=null;function Dn(e){Dc(e,0)}function Fn(e){if(pt(Ve(e)))return e}function $n(e,t){if("change"===e)return t}var On,Hn,Wn,Bn=!1;function Vn(){Nn&&(Nn.detachEvent("onpropertychange",qn),_n=Nn=null)}function qn(e){if("value"===e.propertyName&&Fn(_n)){var t=[];zn(t,_n,e,Lt(e)),Dt(Dn,t)}}function Yn(e,t,n){"focusin"===e?(Vn(),_n=n,(Nn=t).attachEvent("onpropertychange",qn)):"focusout"===e&&Vn()}function Un(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Fn(_n)}function Xn(e,t){if("click"===e)return Fn(t)}function Kn(e,t){if("input"===e||"change"===e)return Fn(t)}$t&&($t?((Hn="oninput"in document)||((Wn=document.createElement("div")).setAttribute("oninput","return;"),Hn="function"==typeof Wn.oninput),On=Hn):On=!1,Bn=On&&(!document.documentMode||9<document.documentMode));var Qn="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Gn(e,t){if(Qn(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!G.call(t,i)||!Qn(e[i],t[i]))return!1}return!0}function Zn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jn(e,t){var n,r=Zn(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Zn(r)}}function er(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?er(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function tr(e){for(var t=ht((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch{n=!1}if(!n)break;t=ht((e=t.contentWindow).document)}return t}function nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var rr=$t&&"documentMode"in document&&11>=document.documentMode,ir=null,or=null,ar=null,lr=!1;function sr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;lr||null==ir||ir!==ht(r)||(r="selectionStart"in(r=ir)&&nr(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},ar&&Gn(ar,r)||(ar=r,0<(r=qc(or,"onSelect")).length&&(t=new en("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ir)))}function ur(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var cr={animationend:ur("Animation","AnimationEnd"),animationiteration:ur("Animation","AnimationIteration"),animationstart:ur("Animation","AnimationStart"),transitionrun:ur("Transition","TransitionRun"),transitionstart:ur("Transition","TransitionStart"),transitioncancel:ur("Transition","TransitionCancel"),transitionend:ur("Transition","TransitionEnd")},dr={},fr={};function pr(e){if(dr[e])return dr[e];if(!cr[e])return e;var t,n=cr[e];for(t in n)if(n.hasOwnProperty(t)&&t in fr)return dr[e]=n[t];return e}$t&&(fr=document.createElement("div").style,"AnimationEvent"in window||(delete cr.animationend.animation,delete cr.animationiteration.animation,delete cr.animationstart.animation),"TransitionEvent"in window||delete cr.transitionend.transition);var hr=pr("animationend"),mr=pr("animationiteration"),gr=pr("animationstart"),yr=pr("transitionrun"),xr=pr("transitionstart"),vr=pr("transitioncancel"),br=pr("transitionend"),wr=new Map,Sr="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function kr(e,t){wr.set(e,t),Ke(t,[e])}Sr.push("scrollEnd");var Cr=new WeakMap;function Er(e,t){if("object"==typeof e&&null!==e){var n=Cr.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ut(t)},Cr.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Mr=[],Tr=0,Rr=0;function Ar(){for(var e=Tr,t=Rr=Tr=0;t<e;){var n=Mr[t];Mr[t++]=null;var r=Mr[t];Mr[t++]=null;var i=Mr[t];Mr[t++]=null;var o=Mr[t];if(Mr[t++]=null,null!==r&&null!==i){var a=r.pending;null===a?i.next=i:(i.next=a.next,a.next=i),r.pending=i}0!==o&&Pr(n,i,o)}}function Ir(e,t,n,r){Mr[Tr++]=e,Mr[Tr++]=t,Mr[Tr++]=n,Mr[Tr++]=r,Rr|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function jr(e,t,n,r){return Ir(e,t,n,r),zr(e)}function Lr(e,t){return Ir(e,null,null,t),zr(e)}function Pr(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var i=!1,o=e.return;null!==o;)o.childLanes|=n,null!==(r=o.alternate)&&(r.childLanes|=n),22===o.tag&&(null===(e=o.stateNode)||1&e._visibility||(i=!0)),e=o,o=o.return;return 3===e.tag?(o=e.stateNode,i&&null!==t&&(i=31-he(n),null===(r=(e=o.hiddenUpdates)[i])?e[i]=[t]:r.push(t),t.lane=536870912|n),o):null}function zr(e){if(50<Pu)throw Pu=0,zu=null,Error(i(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var Nr={};function _r(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dr(e,t,n,r){return new _r(e,t,n,r)}function Fr(e){return!(!(e=e.prototype)||!e.isReactComponent)}function $r(e,t){var n=e.alternate;return null===n?((n=Dr(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=65011712&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Or(e,t){e.flags&=65011714;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Hr(e,t,n,r,o,a){var l=0;if(r=e,"function"==typeof e)Fr(e)&&(l=1);else if("string"==typeof e)l=function(e,t,n){if(1===n||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof t.precedence||"string"!=typeof t.href||""===t.href)break;return!0;case"link":if("string"!=typeof t.rel||"string"!=typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"==typeof t.precedence&&null==e);case"script":if(t.async&&"function"!=typeof t.async&&"symbol"!=typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"==typeof t.src)return!0}return!1}(e,n,B.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case R:return(e=Dr(31,n,t,o)).elementType=R,e.lanes=a,e;case y:return Wr(n.children,o,a,t);case x:l=8,o|=24;break;case v:return(e=Dr(12,n,t,2|o)).elementType=v,e.lanes=a,e;case C:return(e=Dr(13,n,t,o)).elementType=C,e.lanes=a,e;case E:return(e=Dr(19,n,t,o)).elementType=E,e.lanes=a,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case b:case S:l=10;break e;case w:l=9;break e;case k:l=11;break e;case M:l=14;break e;case T:l=16,r=null;break e}l=29,n=Error(i(130,null===e?"null":typeof e,"")),r=null}return(t=Dr(l,n,t,o)).elementType=e,t.type=r,t.lanes=a,t}function Wr(e,t,n,r){return(e=Dr(7,e,r,t)).lanes=n,e}function Br(e,t,n){return(e=Dr(6,e,null,t)).lanes=n,e}function Vr(e,t,n){return(t=Dr(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var qr=[],Yr=0,Ur=null,Xr=0,Kr=[],Qr=0,Gr=null,Zr=1,Jr="";function ei(e,t){qr[Yr++]=Xr,qr[Yr++]=Ur,Ur=e,Xr=t}function ti(e,t,n){Kr[Qr++]=Zr,Kr[Qr++]=Jr,Kr[Qr++]=Gr,Gr=e;var r=Zr;e=Jr;var i=32-he(r)-1;r&=~(1<<i),n+=1;var o=32-he(t)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Zr=1<<32-he(t)+i|n<<i|r,Jr=o+e}else Zr=1<<o|n<<i|r,Jr=e}function ni(e){null!==e.return&&(ei(e,1),ti(e,1,0))}function ri(e){for(;e===Ur;)Ur=qr[--Yr],qr[Yr]=null,Xr=qr[--Yr],qr[Yr]=null;for(;e===Gr;)Gr=Kr[--Qr],Kr[Qr]=null,Jr=Kr[--Qr],Kr[Qr]=null,Zr=Kr[--Qr],Kr[Qr]=null}var ii=null,oi=null,ai=!1,li=null,si=!1,ui=Error(i(519));function ci(e){throw gi(Er(Error(i(418,"")),e)),ui}function di(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Pe]=e,t[ze]=r,n){case"dialog":Fc("cancel",t),Fc("close",t);break;case"iframe":case"object":case"embed":Fc("load",t);break;case"video":case"audio":for(n=0;n<Nc.length;n++)Fc(Nc[n],t);break;case"source":Fc("error",t);break;case"img":case"image":case"link":Fc("error",t),Fc("load",t);break;case"details":Fc("toggle",t);break;case"input":Fc("invalid",t),xt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0),ft(t);break;case"select":Fc("invalid",t);break;case"textarea":Fc("invalid",t),St(t,r.value,r.defaultValue,r.children),ft(t)}"string"!=typeof(n=r.children)&&"number"!=typeof n&&"bigint"!=typeof n||t.textContent===""+n||!0===r.suppressHydrationWarning||Gc(t.textContent,n)?(null!=r.popover&&(Fc("beforetoggle",t),Fc("toggle",t)),null!=r.onScroll&&Fc("scroll",t),null!=r.onScrollEnd&&Fc("scrollend",t),null!=r.onClick&&(t.onclick=Zc),t=!0):t=!1,t||ci(e)}function fi(e){for(ii=e.return;ii;)switch(ii.tag){case 5:case 13:return void(si=!1);case 27:case 3:return void(si=!0);default:ii=ii.return}}function pi(e){if(e!==ii)return!1;if(!ai)return fi(e),ai=!0,!1;var t,n=e.tag;if((t=3!==n&&27!==n)&&((t=5===n)&&(t=!("form"!==(t=e.type)&&"button"!==t)||ld(e.type,e.memoizedProps)),t=!t),t&&oi&&ci(e),fi(e),13===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));e:{for(e=e.nextSibling,n=0;e;){if(8===e.nodeType)if("/$"===(t=e.data)){if(0===n){oi=xd(e.nextSibling);break e}n--}else"$"!==t&&"$!"!==t&&"$?"!==t||n++;e=e.nextSibling}oi=null}}else 27===n?(n=oi,hd(e.type)?(e=vd,vd=null,oi=e):oi=n):oi=ii?xd(e.stateNode.nextSibling):null;return!0}function hi(){oi=ii=null,ai=!1}function mi(){var e=li;return null!==e&&(null===bu?bu=e:bu.push.apply(bu,e),li=null),e}function gi(e){null===li?li=[e]:li.push(e)}var yi=O(null),xi=null,vi=null;function bi(e,t,n){W(yi,t._currentValue),t._currentValue=n}function wi(e){e._currentValue=yi.current,H(yi)}function Si(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ki(e,t,n,r){var o=e.child;for(null!==o&&(o.return=e);null!==o;){var a=o.dependencies;if(null!==a){var l=o.child;a=a.firstContext;e:for(;null!==a;){var s=a;a=o;for(var u=0;u<t.length;u++)if(s.context===t[u]){a.lanes|=n,null!==(s=a.alternate)&&(s.lanes|=n),Si(a.return,n,e),r||(l=null);break e}a=s.next}}else if(18===o.tag){if(null===(l=o.return))throw Error(i(341));l.lanes|=n,null!==(a=l.alternate)&&(a.lanes|=n),Si(l,n,e),l=null}else l=o.child;if(null!==l)l.return=o;else for(l=o;null!==l;){if(l===e){l=null;break}if(null!==(o=l.sibling)){o.return=l.return,l=o;break}l=l.return}o=l}}function Ci(e,t,n,r){e=null;for(var o=t,a=!1;null!==o;){if(!a)if(524288&o.flags)a=!0;else if(262144&o.flags)break;if(10===o.tag){var l=o.alternate;if(null===l)throw Error(i(387));if(null!==(l=l.memoizedProps)){var s=o.type;Qn(o.pendingProps.value,l.value)||(null!==e?e.push(s):e=[s])}}else if(o===Y.current){if(null===(l=o.alternate))throw Error(i(387));l.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(null!==e?e.push(Kd):e=[Kd])}o=o.return}null!==e&&ki(t,e,n,r),t.flags|=262144}function Ei(e){for(e=e.firstContext;null!==e;){if(!Qn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Mi(e){xi=e,vi=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Ti(e){return Ai(xi,e)}function Ri(e,t){return null===xi&&Mi(e),Ai(e,t)}function Ai(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===vi){if(null===e)throw Error(i(308));vi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else vi=vi.next=t;return n}var Ii=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ji=t.unstable_scheduleCallback,Li=t.unstable_NormalPriority,Pi={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zi(){return{controller:new Ii,data:new Map,refCount:0}}function Ni(e){e.refCount--,0===e.refCount&&ji(Li,function(){e.controller.abort()})}var _i=null,Di=0,Fi=0,$i=null;function Oi(){if(0===--Di&&null!==_i){null!==$i&&($i.status="fulfilled");var e=_i;_i=null,Fi=0,$i=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var Hi=N.S;N.S=function(e,t){"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===_i){var n=_i=[];Di=0,Fi=Lc(),$i={status:"pending",value:void 0,then:function(e){n.push(e)}}}Di++,t.then(Oi,Oi)}(0,t),null!==Hi&&Hi(e,t)};var Wi=O(null);function Bi(){var e=Wi.current;return null!==e?e:iu.pooledCache}function Vi(e,t){W(Wi,null===t?Wi.current:t.pool)}function qi(){var e=Bi();return null===e?null:{parent:Pi._currentValue,pool:e}}var Yi=Error(i(460)),Ui=Error(i(474)),Xi=Error(i(542)),Ki={then:function(){}};function Qi(e){return"fulfilled"===(e=e.status)||"rejected"===e}function Gi(){}function Zi(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(Gi,Gi),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw to(e=t.reason),e;default:if("string"==typeof t.status)t.then(Gi,Gi);else{if(null!==(e=iu)&&100<e.shellSuspendCounter)throw Error(i(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw to(e=t.reason),e}throw Ji=t,Yi}}var Ji=null;function eo(){if(null===Ji)throw Error(i(459));var e=Ji;return Ji=null,e}function to(e){if(e===Yi||e===Xi)throw Error(i(483))}var no=!1;function ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function io(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function oo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ao(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&ru){var i=r.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=zr(e),Pr(e,null,n),t}return Ir(e,r,t,n),zr(e)}function lo(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Re(e,n)}}function so(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===o?i=o=a:o=o.next=a,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,callbacks:r.callbacks},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var uo=!1;function co(){if(uo&&null!==$i)throw $i}function fo(e,t,n,r){uo=!1;var i=e.updateQueue;no=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(null!==l){i.shared.pending=null;var s=l,u=s.next;s.next=null,null===a?o=u:a.next=u,a=s;var d=e.alternate;null!==d&&(l=(d=d.updateQueue).lastBaseUpdate)!==a&&(null===l?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=s)}if(null!==o){var f=i.baseState;for(a=0,d=u=s=null,l=o;;){var p=-536870913&l.lane,h=p!==l.lane;if(h?(au&p)===p:(r&p)===p){0!==p&&p===Fi&&(uo=!0),null!==d&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,g=l;p=t;var y=n;switch(g.tag){case 1:if("function"==typeof(m=g.payload)){f=m.call(y,f,p);break e}f=m;break e;case 3:m.flags=-65537&m.flags|128;case 0:if(null==(p="function"==typeof(m=g.payload)?m.call(y,f,p):m))break e;f=c({},f,p);break e;case 2:no=!0}}null!==(p=l.callback)&&(e.flags|=64,h&&(e.flags|=8192),null===(h=i.callbacks)?i.callbacks=[p]:h.push(p))}else h={lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===d?(u=d=h,s=f):d=d.next=h,a|=p;if(null===(l=l.next)){if(null===(l=i.shared.pending))break;l=(h=l).next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}null===d&&(s=f),i.baseState=s,i.firstBaseUpdate=u,i.lastBaseUpdate=d,null===o&&(i.shared.lanes=0),hu|=a,e.lanes=a,e.memoizedState=f}}function po(e,t){if("function"!=typeof e)throw Error(i(191,e));e.call(t)}function ho(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)po(n[e],t)}var mo=O(null),go=O(0);function yo(e,t){W(go,e=fu),W(mo,t),fu=e|t.baseLanes}function xo(){W(go,fu),W(mo,mo.current)}function vo(){fu=go.current,H(mo),H(go)}var bo=0,wo=null,So=null,ko=null,Co=!1,Eo=!1,Mo=!1,To=0,Ro=0,Ao=null,Io=0;function jo(){throw Error(i(321))}function Lo(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Qn(e[n],t[n]))return!1;return!0}function Po(e,t,n,r,i,o){return bo=o,wo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=null===e||null===e.memoizedState?Ua:Xa,Mo=!1,o=n(r,i),Mo=!1,Eo&&(o=No(t,n,r,i)),zo(e),o}function zo(e){N.H=Ya;var t=null!==So&&null!==So.next;if(bo=0,ko=So=wo=null,Co=!1,Ro=0,Ao=null,t)throw Error(i(300));null===e||Rl||null!==(e=e.dependencies)&&Ei(e)&&(Rl=!0)}function No(e,t,n,r){wo=e;var o=0;do{if(Eo&&(Ao=null),Ro=0,Eo=!1,25<=o)throw Error(i(301));if(o+=1,ko=So=null,null!=e.updateQueue){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,null!=a.memoCache&&(a.memoCache.index=0)}N.H=Ka,a=t(n,r)}while(Eo);return a}function _o(){var e=N.H,t=e.useState()[0];return t="function"==typeof t.then?Wo(t):t,e=e.useState()[0],(null!==So?So.memoizedState:null)!==e&&(wo.flags|=1024),t}function Do(){var e=0!==To;return To=0,e}function Fo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function $o(e){if(Co){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}Co=!1}bo=0,ko=So=wo=null,Eo=!1,Ro=To=0,Ao=null}function Oo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ko?wo.memoizedState=ko=e:ko=ko.next=e,ko}function Ho(){if(null===So){var e=wo.alternate;e=null!==e?e.memoizedState:null}else e=So.next;var t=null===ko?wo.memoizedState:ko.next;if(null!==t)ko=t,So=e;else{if(null===e)throw null===wo.alternate?Error(i(467)):Error(i(310));e={memoizedState:(So=e).memoizedState,baseState:So.baseState,baseQueue:So.baseQueue,queue:So.queue,next:null},null===ko?wo.memoizedState=ko=e:ko=ko.next=e}return ko}function Wo(e){var t=Ro;return Ro+=1,null===Ao&&(Ao=[]),e=Zi(Ao,e,t),t=wo,null===(null===ko?t.memoizedState:ko.next)&&(t=t.alternate,N.H=null===t||null===t.memoizedState?Ua:Xa),e}function Bo(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return Wo(e);if(e.$$typeof===S)return Ti(e)}throw Error(i(438,String(e)))}function Vo(e){var t=null,n=wo.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=wo.alternate;null!==r&&null!==(r=r.updateQueue)&&null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})}if(null==t&&(t={data:[],index:0}),null===n&&(n={lastEffect:null,events:null,stores:null,memoCache:null},wo.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function qo(e,t){return"function"==typeof t?t(e):t}function Yo(e){return Uo(Ho(),So,e)}function Uo(e,t,n){var r=e.queue;if(null===r)throw Error(i(311));r.lastRenderedReducer=n;var o=e.baseQueue,a=r.pending;if(null!==a){if(null!==o){var l=o.next;o.next=a.next,a.next=l}t.baseQueue=o=a,r.pending=null}if(a=e.baseState,null===o)e.memoizedState=a;else{var s=l=null,u=null,c=t=o.next,d=!1;do{var f=-536870913&c.lane;if(f!==c.lane?(au&f)===f:(bo&f)===f){var p=c.revertLane;if(0===p)null!==u&&(u=u.next={lane:0,revertLane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),f===Fi&&(d=!0);else{if((bo&p)===p){c=c.next,p===Fi&&(d=!0);continue}f={lane:0,revertLane:c.revertLane,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(s=u=f,l=a):u=u.next=f,wo.lanes|=p,hu|=p}f=c.action,Mo&&n(a,f),a=c.hasEagerState?c.eagerState:n(a,f)}else p={lane:f,revertLane:c.revertLane,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(s=u=p,l=a):u=u.next=p,wo.lanes|=f,hu|=f;c=c.next}while(null!==c&&c!==t);if(null===u?l=a:u.next=s,!Qn(a,e.memoizedState)&&(Rl=!0,d&&null!==(n=$i)))throw n;e.memoizedState=a,e.baseState=l,e.baseQueue=u,r.lastRenderedState=a}return null===o&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Xo(e){var t=Ho(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,a=t.memoizedState;if(null!==o){n.pending=null;var l=o=o.next;do{a=e(a,l.action),l=l.next}while(l!==o);Qn(a,t.memoizedState)||(Rl=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Ko(e,t,n){var r=wo,o=Ho(),a=ai;if(a){if(void 0===n)throw Error(i(407));n=n()}else n=t();var l=!Qn((So||o).memoizedState,n);if(l&&(o.memoizedState=n,Rl=!0),o=o.queue,xa(2048,8,Zo.bind(null,r,o,e),[e]),o.getSnapshot!==t||l||null!==ko&&1&ko.memoizedState.tag){if(r.flags|=2048,ma(9,{destroy:void 0,resource:void 0},Go.bind(null,r,o,n,t),null),null===iu)throw Error(i(349));a||124&bo||Qo(r,t,n)}return n}function Qo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=wo.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},wo.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Go(e,t,n,r){t.value=n,t.getSnapshot=r,Jo(t)&&ea(e)}function Zo(e,t,n){return n(function(){Jo(t)&&ea(e)})}function Jo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Qn(e,n)}catch{return!0}}function ea(e){var t=Lr(e,2);null!==t&&Du(t,0,2)}function ta(e){var t=Oo();if("function"==typeof e){var n=e;if(e=n(),Mo){pe(!0);try{n()}finally{pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:e},t}function na(e,t,n,r){return e.baseState=n,Uo(e,So,"function"==typeof r?r:qo)}function ra(e,t,n,r,o){if(Ba(e))throw Error(i(485));if(null!==(e=t.action)){var a={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};null!==N.T?n(!0):a.isTransition=!1,r(a),null===(n=t.pending)?(a.next=t.pending=a,ia(t,a)):(a.next=n.next,t.pending=n.next=a)}}function ia(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var o=N.T,a={};N.T=a;try{var l=n(i,r),s=N.S;null!==s&&s(a,l),oa(e,t,l)}catch(n){la(e,t,n)}finally{N.T=o}}else try{oa(e,t,o=n(i,r))}catch(n){la(e,t,n)}}function oa(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){aa(e,t,n)},function(n){return la(e,t,n)}):aa(e,t,n)}function aa(e,t,n){t.status="fulfilled",t.value=n,sa(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,ia(e,n)))}function la(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do{t.status="rejected",t.reason=n,sa(t),t=t.next}while(t!==r)}e.action=null}function sa(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ua(e,t){return t}function ca(e,t){if(ai){var n=iu.formState;if(null!==n){e:{var r=wo;if(ai){if(oi){t:{for(var i=oi,o=si;8!==i.nodeType;){if(!o){i=null;break t}if(null===(i=xd(i.nextSibling))){i=null;break t}}i="F!"===(o=i.data)||"F"===o?i:null}if(i){oi=xd(i.nextSibling),r="F!"===i.data;break e}}ci(r)}r=!1}r&&(t=n[0])}}return(n=Oo()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ua,lastRenderedState:t},n.queue=r,n=Oa.bind(null,wo,r),r.dispatch=n,r=ta(!1),o=Wa.bind(null,wo,!1,r.queue),i={state:t,dispatch:null,action:e,pending:null},(r=Oo()).queue=i,n=ra.bind(null,wo,i,o,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function da(e){return fa(Ho(),So,e)}function fa(e,t,n){if(t=Uo(e,t,ua)[0],e=Yo(qo)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var r=Wo(t)}catch(e){throw e===Yi?Xi:e}else r=t;var i=(t=Ho()).queue,o=i.dispatch;return n!==t.memoizedState&&(wo.flags|=2048,ma(9,{destroy:void 0,resource:void 0},pa.bind(null,i,n),null)),[r,o,e]}function pa(e,t){e.action=t}function ha(e){var t=Ho(),n=So;if(null!==n)return fa(t,n,e);Ho(),t=t.memoizedState;var r=(n=Ho()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ma(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},null===(t=wo.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},wo.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ga(){return Ho().memoizedState}function ya(e,t,n,r){var i=Oo();r=void 0===r?null:r,wo.flags|=e,i.memoizedState=ma(1|t,{destroy:void 0,resource:void 0},n,r)}function xa(e,t,n,r){var i=Ho();r=void 0===r?null:r;var o=i.memoizedState.inst;null!==So&&null!==r&&Lo(r,So.memoizedState.deps)?i.memoizedState=ma(t,o,n,r):(wo.flags|=e,i.memoizedState=ma(1|t,o,n,r))}function va(e,t){ya(8390656,8,e,t)}function ba(e,t){xa(2048,8,e,t)}function wa(e,t){return xa(4,2,e,t)}function Sa(e,t){return xa(4,4,e,t)}function ka(e,t){if("function"==typeof t){e=e();var n=t(e);return function(){"function"==typeof n?n():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function Ca(e,t,n){n=null!=n?n.concat([e]):null,xa(4,4,ka.bind(null,t,e),n)}function Ea(){}function Ma(e,t){var n=Ho();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&Lo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ta(e,t){var n=Ho();t=void 0===t?null:t;var r=n.memoizedState;if(null!==t&&Lo(t,r[1]))return r[0];if(r=e(),Mo){pe(!0);try{e()}finally{pe(!1)}}return n.memoizedState=[r,t],r}function Ra(e,t,n){return void 0===n||1073741824&bo?e.memoizedState=t:(e.memoizedState=n,e=_u(),wo.lanes|=e,hu|=e,n)}function Aa(e,t,n,r){return Qn(n,t)?n:null!==mo.current?(e=Ra(e,n,r),Qn(e,t)||(Rl=!0),e):42&bo?(e=_u(),wo.lanes|=e,hu|=e,t):(Rl=!0,e.memoizedState=n)}function Ia(e,t,n,r,i){var o=_.p;_.p=0!==o&&8>o?o:8;var a=N.T,l={};N.T=l,Wa(e,!1,t,n);try{var s=i(),u=N.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c=function(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status="rejected",r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}(s,r);Ha(e,t,c,Nu())}else Ha(e,t,r,Nu())}catch(n){Ha(e,t,{then:function(){},status:"rejected",reason:n},Nu())}finally{_.p=o,N.T=a}}function ja(){}function La(e,t,n,r){if(5!==e.tag)throw Error(i(476));var o=Pa(e).queue;Ia(e,o,t,D,null===n?ja:function(){return za(e),n(r)})}function Pa(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:D,baseState:D,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:D},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function za(e){Ha(e,Pa(e).next.queue,{},Nu())}function Na(){return Ti(Kd)}function _a(){return Ho().memoizedState}function Da(){return Ho().memoizedState}function Fa(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=Nu(),r=ao(t,e=oo(n),n);return null!==r&&(Du(r,0,n),lo(r,t,n)),t={cache:zi()},void(e.payload=t)}t=t.return}}function $a(e,t,n){var r=Nu();n={lane:r,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Ba(e)?Va(t,n):null!==(n=jr(e,t,n,r))&&(Du(n,0,r),qa(n,t,r))}function Oa(e,t,n){Ha(e,t,n,Nu())}function Ha(e,t,n,r){var i={lane:r,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ba(e))Va(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,l=o(a,n);if(i.hasEagerState=!0,i.eagerState=l,Qn(l,a))return Ir(e,t,i,0),null===iu&&Ar(),!1}catch{}if(null!==(n=jr(e,t,i,r)))return Du(n,0,r),qa(n,t,r),!0}return!1}function Wa(e,t,n,r){if(r={lane:2,revertLane:Lc(),action:r,hasEagerState:!1,eagerState:null,next:null},Ba(e)){if(t)throw Error(i(479))}else null!==(t=jr(e,n,r,2))&&Du(t,0,2)}function Ba(e){var t=e.alternate;return e===wo||null!==t&&t===wo}function Va(e,t){Eo=Co=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qa(e,t,n){if(4194048&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Re(e,n)}}var Ya={readContext:Ti,use:Bo,useCallback:jo,useContext:jo,useEffect:jo,useImperativeHandle:jo,useLayoutEffect:jo,useInsertionEffect:jo,useMemo:jo,useReducer:jo,useRef:jo,useState:jo,useDebugValue:jo,useDeferredValue:jo,useTransition:jo,useSyncExternalStore:jo,useId:jo,useHostTransitionStatus:jo,useFormState:jo,useActionState:jo,useOptimistic:jo,useMemoCache:jo,useCacheRefresh:jo},Ua={readContext:Ti,use:Bo,useCallback:function(e,t){return Oo().memoizedState=[e,void 0===t?null:t],e},useContext:Ti,useEffect:va,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,ya(4194308,4,ka.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ya(4194308,4,e,t)},useInsertionEffect:function(e,t){ya(4,2,e,t)},useMemo:function(e,t){var n=Oo();t=void 0===t?null:t;var r=e();if(Mo){pe(!0);try{e()}finally{pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Oo();if(void 0!==n){var i=n(t);if(Mo){pe(!0);try{n(t)}finally{pe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=$a.bind(null,wo,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Oo().memoizedState=e},useState:function(e){var t=(e=ta(e)).queue,n=Oa.bind(null,wo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ea,useDeferredValue:function(e,t){return Ra(Oo(),e,t)},useTransition:function(){var e=ta(!1);return e=Ia.bind(null,wo,e.queue,!0,!1),Oo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=wo,o=Oo();if(ai){if(void 0===n)throw Error(i(407));n=n()}else{if(n=t(),null===iu)throw Error(i(349));124&au||Qo(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,va(Zo.bind(null,r,a,e),[e]),r.flags|=2048,ma(9,{destroy:void 0,resource:void 0},Go.bind(null,r,a,n,t),null),n},useId:function(){var e=Oo(),t=iu.identifierPrefix;if(ai){var n=Jr;t="«"+t+"R"+(n=(Zr&~(1<<32-he(Zr)-1)).toString(32)+n),0<(n=To++)&&(t+="H"+n.toString(32)),t+="»"}else t="«"+t+"r"+(n=Io++).toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:Na,useFormState:ca,useActionState:ca,useOptimistic:function(e){var t=Oo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Wa.bind(null,wo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Vo,useCacheRefresh:function(){return Oo().memoizedState=Fa.bind(null,wo)}},Xa={readContext:Ti,use:Bo,useCallback:Ma,useContext:Ti,useEffect:ba,useImperativeHandle:Ca,useInsertionEffect:wa,useLayoutEffect:Sa,useMemo:Ta,useReducer:Yo,useRef:ga,useState:function(){return Yo(qo)},useDebugValue:Ea,useDeferredValue:function(e,t){return Aa(Ho(),So.memoizedState,e,t)},useTransition:function(){var e=Yo(qo)[0],t=Ho().memoizedState;return["boolean"==typeof e?e:Wo(e),t]},useSyncExternalStore:Ko,useId:_a,useHostTransitionStatus:Na,useFormState:da,useActionState:da,useOptimistic:function(e,t){return na(Ho(),0,e,t)},useMemoCache:Vo,useCacheRefresh:Da},Ka={readContext:Ti,use:Bo,useCallback:Ma,useContext:Ti,useEffect:ba,useImperativeHandle:Ca,useInsertionEffect:wa,useLayoutEffect:Sa,useMemo:Ta,useReducer:Xo,useRef:ga,useState:function(){return Xo(qo)},useDebugValue:Ea,useDeferredValue:function(e,t){var n=Ho();return null===So?Ra(n,e,t):Aa(n,So.memoizedState,e,t)},useTransition:function(){var e=Xo(qo)[0],t=Ho().memoizedState;return["boolean"==typeof e?e:Wo(e),t]},useSyncExternalStore:Ko,useId:_a,useHostTransitionStatus:Na,useFormState:ha,useActionState:ha,useOptimistic:function(e,t){var n=Ho();return null!==So?na(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Vo,useCacheRefresh:Da},Qa=null,Ga=0;function Za(e){var t=Ga;return Ga+=1,null===Qa&&(Qa=[]),Zi(Qa,e,t)}function Ja(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function el(e,t){throw t.$$typeof===f?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function tl(e){return(0,e._init)(e._payload)}function nl(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function o(e,t){return(e=$r(e,t)).index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=67108866,n):r:(t.flags|=67108866,n):(t.flags|=1048576,n)}function l(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Br(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function u(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===i||"object"==typeof i&&null!==i&&i.$$typeof===T&&tl(i)===t.type)?(Ja(t=o(t,n.props),n),t.return=e,t):(Ja(t=Hr(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Vr(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function d(e,t,n,r,i){return null===t||7!==t.tag?((t=Wr(n,e.mode,r,i)).return=e,t):((t=o(t,n)).return=e,t)}function f(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Br(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case h:return Ja(n=Hr(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case g:return(t=Vr(t,e.mode,n)).return=e,t;case T:return f(e,t=(0,t._init)(t._payload),n)}if(z(t)||j(t))return(t=Wr(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return f(e,Za(t),n);if(t.$$typeof===S)return f(e,Ri(e,t),n);el(e,t)}return null}function p(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==i?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case h:return n.key===i?u(e,t,n,r):null;case g:return n.key===i?c(e,t,n,r):null;case T:return p(e,t,n=(i=n._init)(n._payload),r)}if(z(n)||j(n))return null!==i?null:d(e,t,n,r,null);if("function"==typeof n.then)return p(e,t,Za(n),r);if(n.$$typeof===S)return p(e,t,Ri(e,n),r);el(e,n)}return null}function m(e,t,n,r,i){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return s(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case h:return u(t,e=e.get(null===r.key?n:r.key)||null,r,i);case g:return c(t,e=e.get(null===r.key?n:r.key)||null,r,i);case T:return m(e,t,n,r=(0,r._init)(r._payload),i)}if(z(r)||j(r))return d(t,e=e.get(n)||null,r,i,null);if("function"==typeof r.then)return m(e,t,n,Za(r),i);if(r.$$typeof===S)return m(e,t,n,Ri(t,r),i);el(t,r)}return null}function x(s,u,c,d){if("object"==typeof c&&null!==c&&c.type===y&&null===c.key&&(c=c.props.children),"object"==typeof c&&null!==c){switch(c.$$typeof){case h:e:{for(var v=c.key;null!==u;){if(u.key===v){if((v=c.type)===y){if(7===u.tag){n(s,u.sibling),(d=o(u,c.props.children)).return=s,s=d;break e}}else if(u.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===T&&tl(v)===u.type){n(s,u.sibling),Ja(d=o(u,c.props),c),d.return=s,s=d;break e}n(s,u);break}t(s,u),u=u.sibling}c.type===y?((d=Wr(c.props.children,s.mode,d,c.key)).return=s,s=d):(Ja(d=Hr(c.type,c.key,c.props,null,s.mode,d),c),d.return=s,s=d)}return l(s);case g:e:{for(v=c.key;null!==u;){if(u.key===v){if(4===u.tag&&u.stateNode.containerInfo===c.containerInfo&&u.stateNode.implementation===c.implementation){n(s,u.sibling),(d=o(u,c.children||[])).return=s,s=d;break e}n(s,u);break}t(s,u),u=u.sibling}(d=Vr(c,s.mode,d)).return=s,s=d}return l(s);case T:return x(s,u,c=(v=c._init)(c._payload),d)}if(z(c))return function(i,o,l,s){for(var u=null,c=null,d=o,h=o=0,g=null;null!==d&&h<l.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var y=p(i,d,l[h],s);if(null===y){null===d&&(d=g);break}e&&d&&null===y.alternate&&t(i,d),o=a(y,o,h),null===c?u=y:c.sibling=y,c=y,d=g}if(h===l.length)return n(i,d),ai&&ei(i,h),u;if(null===d){for(;h<l.length;h++)null!==(d=f(i,l[h],s))&&(o=a(d,o,h),null===c?u=d:c.sibling=d,c=d);return ai&&ei(i,h),u}for(d=r(d);h<l.length;h++)null!==(g=m(d,i,h,l[h],s))&&(e&&null!==g.alternate&&d.delete(null===g.key?h:g.key),o=a(g,o,h),null===c?u=g:c.sibling=g,c=g);return e&&d.forEach(function(e){return t(i,e)}),ai&&ei(i,h),u}(s,u,c,d);if(j(c)){if("function"!=typeof(v=j(c)))throw Error(i(150));return function(o,l,s,u){if(null==s)throw Error(i(151));for(var c=null,d=null,h=l,g=l=0,y=null,x=s.next();null!==h&&!x.done;g++,x=s.next()){h.index>g?(y=h,h=null):y=h.sibling;var v=p(o,h,x.value,u);if(null===v){null===h&&(h=y);break}e&&h&&null===v.alternate&&t(o,h),l=a(v,l,g),null===d?c=v:d.sibling=v,d=v,h=y}if(x.done)return n(o,h),ai&&ei(o,g),c;if(null===h){for(;!x.done;g++,x=s.next())null!==(x=f(o,x.value,u))&&(l=a(x,l,g),null===d?c=x:d.sibling=x,d=x);return ai&&ei(o,g),c}for(h=r(h);!x.done;g++,x=s.next())null!==(x=m(h,o,g,x.value,u))&&(e&&null!==x.alternate&&h.delete(null===x.key?g:x.key),l=a(x,l,g),null===d?c=x:d.sibling=x,d=x);return e&&h.forEach(function(e){return t(o,e)}),ai&&ei(o,g),c}(s,u,c=v.call(c),d)}if("function"==typeof c.then)return x(s,u,Za(c),d);if(c.$$typeof===S)return x(s,u,Ri(s,c),d);el(s,c)}return"string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c?(c=""+c,null!==u&&6===u.tag?(n(s,u.sibling),(d=o(u,c)).return=s,s=d):(n(s,u),(d=Br(c,s.mode,d)).return=s,s=d),l(s)):n(s,u)}return function(e,t,n,r){try{Ga=0;var i=x(e,t,n,r);return Qa=null,i}catch(t){if(t===Yi||t===Xi)throw t;var o=Dr(29,t,null,e.mode);return o.lanes=r,o.return=e,o}}}var rl=nl(!0),il=nl(!1),ol=O(null),al=null;function ll(e){var t=e.alternate;W(dl,1&dl.current),W(ol,e),null===al&&(null===t||null!==mo.current||null!==t.memoizedState)&&(al=e)}function sl(e){if(22===e.tag){if(W(dl,dl.current),W(ol,e),null===al){var t=e.alternate;null!==t&&null!==t.memoizedState&&(al=e)}}else ul()}function ul(){W(dl,dl.current),W(ol,ol.current)}function cl(e){H(ol),al===e&&(al=null),H(dl)}var dl=O(0);function fl(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||yd(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function pl(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:c({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var hl={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Nu(),i=oo(r);i.payload=t,null!=n&&(i.callback=n),null!==(t=ao(e,i,r))&&(Du(t,0,r),lo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Nu(),i=oo(r);i.tag=1,i.payload=t,null!=n&&(i.callback=n),null!==(t=ao(e,i,r))&&(Du(t,0,r),lo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Nu(),r=oo(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=ao(e,r,n))&&(Du(t,0,n),lo(t,e,n))}};function ml(e,t,n,r,i,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!(t.prototype&&t.prototype.isPureReactComponent&&Gn(n,r)&&Gn(i,o))}function gl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&hl.enqueueReplaceState(t,t.state,null)}function yl(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=c({},n)),e)void 0===n[i]&&(n[i]=e[i]);return n}var xl="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)};function vl(e){xl(e)}function bl(e){console.error(e)}function wl(e){xl(e)}function Sl(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function kl(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Cl(e,t,n){return(n=oo(n)).tag=3,n.payload={element:null},n.callback=function(){Sl(e,t)},n}function El(e){return(e=oo(e)).tag=3,e}function Ml(e,t,n,r){var i=n.type.getDerivedStateFromError;if("function"==typeof i){var o=r.value;e.payload=function(){return i(o)},e.callback=function(){kl(t,n,r)}}var a=n.stateNode;null!==a&&"function"==typeof a.componentDidCatch&&(e.callback=function(){kl(t,n,r),"function"!=typeof i&&(null===Eu?Eu=new Set([this]):Eu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Tl=Error(i(461)),Rl=!1;function Al(e,t,n,r){t.child=null===e?il(t,null,n,r):rl(t,e.child,n,r)}function Il(e,t,n,r,i){n=n.render;var o=t.ref;if("ref"in r){var a={};for(var l in r)"ref"!==l&&(a[l]=r[l])}else a=r;return Mi(t),r=Po(e,t,n,a,o,i),l=Do(),null===e||Rl?(ai&&l&&ni(t),t.flags|=1,Al(e,t,r,i),t.child):(Fo(e,t,i),Ql(e,t,i))}function jl(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||Fr(o)||void 0!==o.defaultProps||null!==n.compare?((e=Hr(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Ll(e,t,o,r,i))}if(o=e.child,!Gl(e,i)){var a=o.memoizedProps;if((n=null!==(n=n.compare)?n:Gn)(a,r)&&e.ref===t.ref)return Ql(e,t,i)}return t.flags|=1,(e=$r(o,r)).ref=t.ref,e.return=t,t.child=e}function Ll(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(Gn(o,r)&&e.ref===t.ref){if(Rl=!1,t.pendingProps=r=o,!Gl(e,i))return t.lanes=e.lanes,Ql(e,t,i);131072&e.flags&&(Rl=!0)}}return _l(e,t,n,r,i)}function Pl(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(128&t.flags){if(r=null!==o?o.baseLanes|n:n,null!==e){for(i=t.child=e.child,o=0;null!==i;)o=o|i.lanes|i.childLanes,i=i.sibling;t.childLanes=o&~r}else t.childLanes=0,t.child=null;return zl(e,t,r,n)}if(!(536870912&n))return t.lanes=t.childLanes=536870912,zl(e,t,null!==o?o.baseLanes|n:n,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Vi(0,null!==o?o.cachePool:null),null!==o?yo(t,o):xo(),sl(t)}else null!==o?(Vi(0,o.cachePool),yo(t,o),ul(),t.memoizedState=null):(null!==e&&Vi(0,null),xo(),ul());return Al(e,t,i,n),t.child}function zl(e,t,n,r){var i=Bi();return i=null===i?null:{parent:Pi._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},null!==e&&Vi(0,null),xo(),sl(t),null!==e&&Ci(e,t,r,!0),null}function Nl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(i(284));(null===e||e.ref!==n)&&(t.flags|=4194816)}}function _l(e,t,n,r,i){return Mi(t),n=Po(e,t,n,r,void 0,i),r=Do(),null===e||Rl?(ai&&r&&ni(t),t.flags|=1,Al(e,t,n,i),t.child):(Fo(e,t,i),Ql(e,t,i))}function Dl(e,t,n,r,i,o){return Mi(t),t.updateQueue=null,n=No(t,r,n,i),zo(e),r=Do(),null===e||Rl?(ai&&r&&ni(t),t.flags|=1,Al(e,t,n,o),t.child):(Fo(e,t,o),Ql(e,t,o))}function Fl(e,t,n,r,i){if(Mi(t),null===t.stateNode){var o=Nr,a=n.contextType;"object"==typeof a&&null!==a&&(o=Ti(a)),o=new n(r,o),t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,o.updater=hl,t.stateNode=o,o._reactInternals=t,(o=t.stateNode).props=r,o.state=t.memoizedState,o.refs={},ro(t),a=n.contextType,o.context="object"==typeof a&&null!==a?Ti(a):Nr,o.state=t.memoizedState,"function"==typeof(a=n.getDerivedStateFromProps)&&(pl(t,n,a,r),o.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(a=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),a!==o.state&&hl.enqueueReplaceState(o,o.state,null),fo(t,r,o,i),co(),o.state=t.memoizedState),"function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){o=t.stateNode;var l=t.memoizedProps,s=yl(n,l);o.props=s;var u=o.context,c=n.contextType;a=Nr,"object"==typeof c&&null!==c&&(a=Ti(c));var d=n.getDerivedStateFromProps;c="function"==typeof d||"function"==typeof o.getSnapshotBeforeUpdate,l=t.pendingProps!==l,c||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(l||u!==a)&&gl(t,o,r,a),no=!1;var f=t.memoizedState;o.state=f,fo(t,r,o,i),co(),u=t.memoizedState,l||f!==u||no?("function"==typeof d&&(pl(t,n,d,r),u=t.memoizedState),(s=no||ml(t,n,s,r,f,u,a))?(c||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=a,r=s):("function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,io(e,t),c=yl(n,a=t.memoizedProps),o.props=c,d=t.pendingProps,f=o.context,u=n.contextType,s=Nr,"object"==typeof u&&null!==u&&(s=Ti(u)),(u="function"==typeof(l=n.getDerivedStateFromProps)||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==d||f!==s)&&gl(t,o,r,s),no=!1,f=t.memoizedState,o.state=f,fo(t,r,o,i),co();var p=t.memoizedState;a!==d||f!==p||no||null!==e&&null!==e.dependencies&&Ei(e.dependencies)?("function"==typeof l&&(pl(t,n,l,r),p=t.memoizedState),(c=no||ml(t,n,c,r,f,p,s)||null!==e&&null!==e.dependencies&&Ei(e.dependencies))?(u||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(r,p,s),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,p,s)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),o.props=r,o.state=p,o.context=s,r=c):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,Nl(e,t),r=!!(128&t.flags),o||r?(o=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:o.render(),t.flags|=1,null!==e&&r?(t.child=rl(t,e.child,null,i),t.child=rl(t,null,n,i)):Al(e,t,n,i),t.memoizedState=o.state,e=t.child):e=Ql(e,t,i),e}function $l(e,t,n,r){return hi(),t.flags|=256,Al(e,t,n,r),t.child}var Ol={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hl(e){return{baseLanes:e,cachePool:qi()}}function Wl(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=yu),e}function Bl(e,t,n){var r,o=t.pendingProps,a=!1,l=!!(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&!!(2&dl.current)),r&&(a=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(ai){if(a?ll(t):ul(),ai){var s,u=oi;if(s=u){e:{for(s=u,u=si;8!==s.nodeType;){if(!u){u=null;break e}if(null===(s=xd(s.nextSibling))){u=null;break e}}u=s}null!==u?(t.memoizedState={dehydrated:u,treeContext:null!==Gr?{id:Zr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},(s=Dr(18,null,null,0)).stateNode=u,s.return=t,t.child=s,ii=t,oi=null,s=!0):s=!1}s||ci(t)}if(null!==(u=t.memoizedState)&&null!==(u=u.dehydrated))return yd(u)?t.lanes=32:t.lanes=536870912,null;cl(t)}return u=o.children,o=o.fallback,a?(ul(),u=ql({mode:"hidden",children:u},a=t.mode),o=Wr(o,a,n,null),u.return=t,o.return=t,u.sibling=o,t.child=u,(a=t.child).memoizedState=Hl(n),a.childLanes=Wl(e,r,n),t.memoizedState=Ol,o):(ll(t),Vl(t,u))}if(null!==(s=e.memoizedState)&&null!==(u=s.dehydrated)){if(l)256&t.flags?(ll(t),t.flags&=-257,t=Yl(e,t,n)):null!==t.memoizedState?(ul(),t.child=e.child,t.flags|=128,t=null):(ul(),a=o.fallback,u=t.mode,o=ql({mode:"visible",children:o.children},u),(a=Wr(a,u,n,null)).flags|=2,o.return=t,a.return=t,o.sibling=a,t.child=o,rl(t,e.child,null,n),(o=t.child).memoizedState=Hl(n),o.childLanes=Wl(e,r,n),t.memoizedState=Ol,t=a);else if(ll(t),yd(u)){if(r=u.nextSibling&&u.nextSibling.dataset)var c=r.dgst;r=c,(o=Error(i(419))).stack="",o.digest=r,gi({value:o,source:null,stack:null}),t=Yl(e,t,n)}else if(Rl||Ci(e,t,n,!1),r=0!==(n&e.childLanes),Rl||r){if(null!==(r=iu)&&0!==(o=0!==((o=42&(o=n&-n)?1:Ae(o))&(r.suspendedLanes|n))?0:o)&&o!==s.retryLane)throw s.retryLane=o,Lr(e,o),Du(r,0,o),Tl;"$?"===u.data||Xu(),t=Yl(e,t,n)}else"$?"===u.data?(t.flags|=192,t.child=e.child,t=null):(e=s.treeContext,oi=xd(u.nextSibling),ii=t,ai=!0,li=null,si=!1,null!==e&&(Kr[Qr++]=Zr,Kr[Qr++]=Jr,Kr[Qr++]=Gr,Zr=e.id,Jr=e.overflow,Gr=t),(t=Vl(t,o.children)).flags|=4096);return t}return a?(ul(),a=o.fallback,u=t.mode,c=(s=e.child).sibling,(o=$r(s,{mode:"hidden",children:o.children})).subtreeFlags=65011712&s.subtreeFlags,null!==c?a=$r(c,a):(a=Wr(a,u,n,null)).flags|=2,a.return=t,o.return=t,o.sibling=a,t.child=o,o=a,a=t.child,null===(u=e.child.memoizedState)?u=Hl(n):(null!==(s=u.cachePool)?(c=Pi._currentValue,s=s.parent!==c?{parent:c,pool:c}:s):s=qi(),u={baseLanes:u.baseLanes|n,cachePool:s}),a.memoizedState=u,a.childLanes=Wl(e,r,n),t.memoizedState=Ol,o):(ll(t),e=(n=e.child).sibling,(n=$r(n,{mode:"visible",children:o.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function Vl(e,t){return(t=ql({mode:"visible",children:t},e.mode)).return=e,e.child=t}function ql(e,t){return(e=Dr(22,e,null,t)).lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Yl(e,t,n){return rl(t,e.child,null,n),(e=Vl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Ul(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Si(e.return,t,n)}function Xl(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function Kl(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Al(e,t,r.children,n),2&(r=dl.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Ul(e,n,t);else if(19===e.tag)Ul(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}switch(W(dl,r),i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===fl(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Xl(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===fl(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Xl(t,!0,n,null,o);break;case"together":Xl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ql(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),hu|=t.lanes,0===(n&t.childLanes)){if(null===e)return null;if(Ci(e,t,n,!1),0===(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=$r(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=$r(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Gl(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!Ei(e))}function Zl(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Rl=!0;else{if(!(Gl(e,n)||128&t.flags))return Rl=!1,function(e,t,n){switch(t.tag){case 3:U(t,t.stateNode.containerInfo),bi(0,Pi,e.memoizedState.cache),hi();break;case 27:case 5:K(t);break;case 4:U(t,t.stateNode.containerInfo);break;case 10:bi(0,t.type,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(ll(t),t.flags|=128,null):0!==(n&t.child.childLanes)?Bl(e,t,n):(ll(t),null!==(e=Ql(e,t,n))?e.sibling:null);ll(t);break;case 19:var i=!!(128&e.flags);if((r=0!==(n&t.childLanes))||(Ci(e,t,n,!1),r=0!==(n&t.childLanes)),i){if(r)return Kl(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),W(dl,dl.current),r)break;return null;case 22:case 23:return t.lanes=0,Pl(e,t,n);case 24:bi(0,Pi,e.memoizedState.cache)}return Ql(e,t,n)}(e,t,n);Rl=!!(131072&e.flags)}else Rl=!1,ai&&1048576&t.flags&&ti(t,Xr,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var r=t.elementType,o=r._init;if(r=o(r._payload),t.type=r,"function"!=typeof r){if(null!=r){if((o=r.$$typeof)===k){t.tag=11,t=Il(null,t,r,e,n);break e}if(o===M){t.tag=14,t=jl(null,t,r,e,n);break e}}throw t=P(r)||r,Error(i(306,t,""))}Fr(r)?(e=yl(r,e),t.tag=1,t=Fl(null,t,r,e,n)):(t.tag=0,t=_l(null,t,r,e,n))}return t;case 0:return _l(e,t,t.type,t.pendingProps,n);case 1:return Fl(e,t,r=t.type,o=yl(r,t.pendingProps),n);case 3:e:{if(U(t,t.stateNode.containerInfo),null===e)throw Error(i(387));r=t.pendingProps;var a=t.memoizedState;o=a.element,io(e,t),fo(t,r,null,n);var l=t.memoizedState;if(r=l.cache,bi(0,Pi,r),r!==a.cache&&ki(t,[Pi],n,!0),co(),r=l.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=$l(e,t,r,n);break e}if(r!==o){gi(o=Er(Error(i(424)),t)),t=$l(e,t,r,n);break e}for(e=9===(e=t.stateNode.containerInfo).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,oi=xd(e.firstChild),ii=t,ai=!0,li=null,si=!0,n=il(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(hi(),r===o){t=Ql(e,t,n);break e}Al(e,t,r,n)}t=t.child}return t;case 26:return Nl(e,t),null===e?(n=Ad(t.type,null,t.pendingProps,null))?t.memoizedState=n:ai||(n=t.type,e=t.pendingProps,(r=id(q.current).createElement(n))[Pe]=t,r[ze]=e,td(r,n,e),Ye(r),t.stateNode=r):t.memoizedState=Ad(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return K(t),null===e&&ai&&(r=t.stateNode=wd(t.type,t.pendingProps,q.current),ii=t,si=!0,o=oi,hd(t.type)?(vd=o,oi=xd(r.firstChild)):oi=o),Al(e,t,t.pendingProps.children,n),Nl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&ai&&((o=r=oi)&&(r=function(e,t,n,r){for(;1===e.nodeType;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[Oe])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(o=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(o!==i.rel||e.getAttribute("href")!==(null==i.href||""===i.href?null:i.href)||e.getAttribute("crossorigin")!==(null==i.crossOrigin?null:i.crossOrigin)||e.getAttribute("title")!==(null==i.title?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((o=e.getAttribute("src"))!==(null==i.src?null:i.src)||e.getAttribute("type")!==(null==i.type?null:i.type)||e.getAttribute("crossorigin")!==(null==i.crossOrigin?null:i.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var o=null==i.name?null:""+i.name;if("hidden"===i.type&&e.getAttribute("name")===o)return e}if(null===(e=xd(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,si),null!==r?(t.stateNode=r,ii=t,oi=xd(r.firstChild),si=!1,o=!0):o=!1),o||ci(t)),K(t),o=t.type,a=t.pendingProps,l=null!==e?e.memoizedProps:null,r=a.children,ld(o,a)?r=null:null!==l&&ld(o,l)&&(t.flags|=32),null!==t.memoizedState&&(o=Po(e,t,_o,null,null,n),Kd._currentValue=o),Nl(e,t),Al(e,t,r,n),t.child;case 6:return null===e&&ai&&((e=n=oi)&&(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;)if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n||null===(e=xd(e.nextSibling)))return null;return e}(n,t.pendingProps,si),null!==n?(t.stateNode=n,ii=t,oi=null,e=!0):e=!1),e||ci(t)),null;case 13:return Bl(e,t,n);case 4:return U(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=rl(t,null,r,n):Al(e,t,r,n),t.child;case 11:return Il(e,t,t.type,t.pendingProps,n);case 7:return Al(e,t,t.pendingProps,n),t.child;case 8:case 12:return Al(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,bi(0,t.type,r.value),Al(e,t,r.children,n),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,Mi(t),r=r(o=Ti(o)),t.flags|=1,Al(e,t,r,n),t.child;case 14:return jl(e,t,t.type,t.pendingProps,n);case 15:return Ll(e,t,t.type,t.pendingProps,n);case 19:return Kl(e,t,n);case 31:return r=t.pendingProps,n=t.mode,r={mode:r.mode,children:r.children},null===e?((n=ql(r,n)).ref=t.ref,t.child=n,n.return=t,t=n):((n=$r(e.child,r)).ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Pl(e,t,n);case 24:return Mi(t),r=Ti(Pi),null===e?(null===(o=Bi())&&(o=iu,a=zi(),o.pooledCache=a,a.refCount++,null!==a&&(o.pooledCacheLanes|=n),o=a),t.memoizedState={parent:r,cache:o},ro(t),bi(0,Pi,o)):(0!==(e.lanes&n)&&(io(e,t),fo(t,null,null,n),co()),o=e.memoizedState,a=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=o),bi(0,Pi,r)):(r=a.cache,bi(0,Pi,r),r!==o.cache&&ki(t,[Pi],n,!0))),Al(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Jl(e){e.flags|=4}function es(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!Wd(t)){if(null!==(t=ol.current)&&((4194048&au)===au?null!==al:(62914560&au)!==au&&!(536870912&au)||t!==al))throw Ji=Ki,Ui;e.flags|=8192}}function ts(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Ce():536870912,e.lanes|=t,xu|=t)}function ns(e,t){if(!ai)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function rs(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=65011712&i.subtreeFlags,r|=65011712&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function is(e,t,n){var r=t.pendingProps;switch(ri(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return rs(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),wi(Pi),X(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(null===e||null===e.child)&&(pi(t)?Jl(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,mi())),rs(t),null;case 26:return n=t.memoizedState,null===e?(Jl(t),null!==n?(rs(t),es(t,n)):(rs(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Jl(t),rs(t),es(t,n)):(rs(t),t.flags&=-16777217):(e.memoizedProps!==r&&Jl(t),rs(t),t.flags&=-16777217),null;case 27:Q(t),n=q.current;var o=t.type;if(null!==e&&null!=t.stateNode)e.memoizedProps!==r&&Jl(t);else{if(!r){if(null===t.stateNode)throw Error(i(166));return rs(t),null}e=B.current,pi(t)?di(t):(e=wd(o,r,n),t.stateNode=e,Jl(t))}return rs(t),null;case 5:if(Q(t),n=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&Jl(t);else{if(!r){if(null===t.stateNode)throw Error(i(166));return rs(t),null}if(e=B.current,pi(t))di(t);else{switch(o=id(q.current),e){case 1:e=o.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=o.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":(e=o.createElement("div")).innerHTML="<script><\\/script>",e=e.removeChild(e.firstChild);break;case"select":e="string"==typeof r.is?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?e.multiple=!0:r.size&&(e.size=r.size);break;default:e="string"==typeof r.is?o.createElement(n,{is:r.is}):o.createElement(n)}}e[Pe]=t,e[ze]=r;e:for(o=t.child;null!==o;){if(5===o.tag||6===o.tag)e.appendChild(o.stateNode);else if(4!==o.tag&&27!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;null===o.sibling;){if(null===o.return||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=e;e:switch(td(e,n,r),n){case"button":case"input":case"select":case"textarea":e=!!r.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&Jl(t)}}return rs(t),t.flags&=-16777217,null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&Jl(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));if(e=q.current,pi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(o=ii))switch(o.tag){case 27:case 5:r=o.memoizedProps}e[Pe]=t,(e=!!(e.nodeValue===n||null!==r&&!0===r.suppressHydrationWarning||Gc(e.nodeValue,n)))||ci(t)}else(e=id(e).createTextNode(r))[Pe]=t,t.stateNode=e}return rs(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(o=pi(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(i(318));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(i(317));o[Pe]=t}else hi(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;rs(t),o=!1}else o=mi(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return 256&t.flags?(cl(t),t):(cl(t),null)}if(cl(t),128&t.flags)return t.lanes=n,t;if(n=null!==r,e=null!==e&&null!==e.memoizedState,n){o=null,null!==(r=t.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(o=r.alternate.memoizedState.cachePool.pool);var a=null;null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==o&&(r.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),ts(t,t.updateQueue),rs(t),null;case 4:return X(),null===e&&Hc(t.stateNode.containerInfo),rs(t),null;case 10:return wi(t.type),rs(t),null;case 19:if(H(dl),null===(o=t.memoizedState))return rs(t),null;if(r=!!(128&t.flags),null===(a=o.rendering))if(r)ns(o,!1);else{if(0!==pu||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(a=fl(e))){for(t.flags|=128,ns(o,!1),e=a.updateQueue,t.updateQueue=e,ts(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)Or(n,e),n=n.sibling;return W(dl,1&dl.current|2),t.child}e=e.sibling}null!==o.tail&&ne()>ku&&(t.flags|=128,r=!0,ns(o,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=fl(a))){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,ts(t,e),ns(o,!0),null===o.tail&&"hidden"===o.tailMode&&!a.alternate&&!ai)return rs(t),null}else 2*ne()-o.renderingStartTime>ku&&536870912!==n&&(t.flags|=128,r=!0,ns(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=o.last)?e.sibling=a:t.child=a,o.last=a)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ne(),t.sibling=null,e=dl.current,W(dl,r?1&e|2:1&e),t):(rs(t),null);case 22:case 23:return cl(t),vo(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?!!(536870912&n)&&!(128&t.flags)&&(rs(t),6&t.subtreeFlags&&(t.flags|=8192)):rs(t),null!==(n=t.updateQueue)&&ts(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&H(Wi),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),wi(Pi),rs(t),null;case 25:case 30:return null}throw Error(i(156,t.tag))}function os(e,t){switch(ri(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return wi(Pi),X(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return Q(t),null;case 13:if(cl(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));hi()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return H(dl),null;case 4:return X(),null;case 10:return wi(t.type),null;case 22:case 23:return cl(t),vo(),null!==e&&H(Wi),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return wi(Pi),null;default:return null}}function as(e,t){switch(ri(t),t.tag){case 3:wi(Pi),X();break;case 26:case 27:case 5:Q(t);break;case 4:X();break;case 13:cl(t);break;case 19:H(dl);break;case 10:wi(t.type);break;case 22:case 23:cl(t),vo(),null!==e&&H(Wi);break;case 24:wi(Pi)}}function ls(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var o=n.create,a=n.inst;r=o(),a.destroy=r}n=n.next}while(n!==i)}}catch(e){dc(t,t.return,e)}}function ss(e,t,n){try{var r=t.updateQueue,i=null!==r?r.lastEffect:null;if(null!==i){var o=i.next;r=o;do{if((r.tag&e)===e){var a=r.inst,l=a.destroy;if(void 0!==l){a.destroy=void 0,i=t;var s=n,u=l;try{u()}catch(e){dc(i,s,e)}}}r=r.next}while(r!==o)}}catch(e){dc(t,t.return,e)}}function us(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{ho(t,n)}catch(t){dc(e,e.return,t)}}}function cs(e,t,n){n.props=yl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){dc(e,t,n)}}function ds(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(n){dc(e,t,n)}}function fs(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(n){dc(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){dc(e,t,n)}else n.current=null}function ps(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){dc(e,e.return,t)}}function hs(e,t,n){try{var r=e.stateNode;(function(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,a=null,l=null,s=null,u=null,c=null,d=null;for(h in n){var f=n[h];if(n.hasOwnProperty(h)&&null!=f)switch(h){case"checked":case"value":break;case"defaultValue":u=f;default:r.hasOwnProperty(h)||Jc(e,t,h,null,r,f)}}for(var p in r){var h=r[p];if(f=n[p],r.hasOwnProperty(p)&&(null!=h||null!=f))switch(p){case"type":a=h;break;case"name":o=h;break;case"checked":c=h;break;case"defaultChecked":d=h;break;case"value":l=h;break;case"defaultValue":s=h;break;case"children":case"dangerouslySetInnerHTML":if(null!=h)throw Error(i(137,t));break;default:h!==f&&Jc(e,t,p,h,r,f)}}return void yt(e,l,s,u,c,d,a,o);case"select":for(a in h=l=s=p=null,n)if(u=n[a],n.hasOwnProperty(a)&&null!=u)switch(a){case"value":break;case"multiple":h=u;default:r.hasOwnProperty(a)||Jc(e,t,a,null,r,u)}for(o in r)if(a=r[o],u=n[o],r.hasOwnProperty(o)&&(null!=a||null!=u))switch(o){case"value":p=a;break;case"defaultValue":s=a;break;case"multiple":l=a;default:a!==u&&Jc(e,t,o,a,r,u)}return t=s,n=l,r=h,void(null!=p?bt(e,!!n,p,!1):!!r!=!!n&&(null!=t?bt(e,!!n,t,!0):bt(e,!!n,n?[]:"",!1)));case"textarea":for(s in h=p=null,n)if(o=n[s],n.hasOwnProperty(s)&&null!=o&&!r.hasOwnProperty(s))switch(s){case"value":case"children":break;default:Jc(e,t,s,null,r,o)}for(l in r)if(o=r[l],a=n[l],r.hasOwnProperty(l)&&(null!=o||null!=a))switch(l){case"value":p=o;break;case"defaultValue":h=o;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=o)throw Error(i(91));break;default:o!==a&&Jc(e,t,l,o,r,a)}return void wt(e,p,h);case"option":for(var m in n)p=n[m],n.hasOwnProperty(m)&&null!=p&&!r.hasOwnProperty(m)&&("selected"===m?e.selected=!1:Jc(e,t,m,null,r,p));for(u in r)p=r[u],h=n[u],r.hasOwnProperty(u)&&p!==h&&(null!=p||null!=h)&&("selected"===u?e.selected=p&&"function"!=typeof p&&"symbol"!=typeof p:Jc(e,t,u,p,r,h));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var g in n)p=n[g],n.hasOwnProperty(g)&&null!=p&&!r.hasOwnProperty(g)&&Jc(e,t,g,null,r,p);for(c in r)if(p=r[c],h=n[c],r.hasOwnProperty(c)&&p!==h&&(null!=p||null!=h))switch(c){case"children":case"dangerouslySetInnerHTML":if(null!=p)throw Error(i(137,t));break;default:Jc(e,t,c,p,r,h)}return;default:if(Tt(t)){for(var y in n)p=n[y],n.hasOwnProperty(y)&&void 0!==p&&!r.hasOwnProperty(y)&&ed(e,t,y,void 0,r,p);for(d in r)p=r[d],h=n[d],!r.hasOwnProperty(d)||p===h||void 0===p&&void 0===h||ed(e,t,d,p,r,h);return}}for(var x in n)p=n[x],n.hasOwnProperty(x)&&null!=p&&!r.hasOwnProperty(x)&&Jc(e,t,x,null,r,p);for(f in r)p=r[f],h=n[f],!r.hasOwnProperty(f)||p===h||null==p&&null==h||Jc(e,t,f,p,r,h)})(r,e.type,n,t),r[ze]=t}catch(t){dc(e,e.return,t)}}function ms(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&hd(e.type)||4===e.tag}function gs(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||ms(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&hd(e.type)||2&e.flags||null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function ys(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?(9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).insertBefore(e,t):((t=9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Zc));else if(4!==r&&(27===r&&hd(e.type)&&(n=e.stateNode,t=null),null!==(e=e.child)))for(ys(e,t,n),e=e.sibling;null!==e;)ys(e,t,n),e=e.sibling}function xs(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(27===r&&hd(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(xs(e,t,n),e=e.sibling;null!==e;)xs(e,t,n),e=e.sibling}function vs(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);td(t,r,n),t[Pe]=e,t[ze]=n}catch(t){dc(e,e.return,t)}}var bs=!1,ws=!1,Ss=!1,ks="function"==typeof WeakSet?WeakSet:Set,Cs=null;function Es(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Fs(e,n),4&r&&ls(5,n);break;case 1:if(Fs(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){dc(n,n.return,e)}else{var i=yl(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){dc(n,n.return,e)}}64&r&&us(n),512&r&&ds(n,n.return);break;case 3:if(Fs(e,n),64&r&&null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 27:case 5:case 1:t=n.child.stateNode}try{ho(e,t)}catch(e){dc(n,n.return,e)}}break;case 27:null===t&&4&r&&vs(n);case 26:case 5:Fs(e,n),null===t&&4&r&&ps(n),512&r&&ds(n,n.return);break;case 12:Fs(e,n);break;case 13:Fs(e,n),4&r&&js(e,n),64&r&&null!==(e=n.memoizedState)&&null!==(e=e.dehydrated)&&function(e,t){var n=e.ownerDocument;if("$?"!==e.data||"complete"===n.readyState)t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}(e,n=mc.bind(null,n));break;case 22:if(!(r=null!==n.memoizedState||bs)){t=null!==t&&null!==t.memoizedState||ws,i=bs;var o=ws;bs=r,(ws=t)&&!o?Os(e,n,!!(8772&n.subtreeFlags)):Fs(e,n),bs=i,ws=o}break;case 30:break;default:Fs(e,n)}}function Ms(e){var t=e.alternate;null!==t&&(e.alternate=null,Ms(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&He(t),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ts=null,Rs=!1;function As(e,t,n){for(n=n.child;null!==n;)Is(e,t,n),n=n.sibling}function Is(e,t,n){if(fe&&"function"==typeof fe.onCommitFiberUnmount)try{fe.onCommitFiberUnmount(de,n)}catch{}switch(n.tag){case 26:ws||fs(n,t),As(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode).parentNode.removeChild(n);break;case 27:ws||fs(n,t);var r=Ts,i=Rs;hd(n.type)&&(Ts=n.stateNode,Rs=!1),As(e,t,n),Sd(n.stateNode),Ts=r,Rs=i;break;case 5:ws||fs(n,t);case 6:if(r=Ts,i=Rs,Ts=null,As(e,t,n),Rs=i,null!==(Ts=r))if(Rs)try{(9===Ts.nodeType?Ts.body:"HTML"===Ts.nodeName?Ts.ownerDocument.body:Ts).removeChild(n.stateNode)}catch(e){dc(n,t,e)}else try{Ts.removeChild(n.stateNode)}catch(e){dc(n,t,e)}break;case 18:null!==Ts&&(Rs?(md(9===(e=Ts).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,n.stateNode),Af(e)):md(Ts,n.stateNode));break;case 4:r=Ts,i=Rs,Ts=n.stateNode.containerInfo,Rs=!0,As(e,t,n),Ts=r,Rs=i;break;case 0:case 11:case 14:case 15:ws||ss(2,n,t),ws||ss(4,n,t),As(e,t,n);break;case 1:ws||(fs(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&cs(n,t,r)),As(e,t,n);break;case 21:As(e,t,n);break;case 22:ws=(r=ws)||null!==n.memoizedState,As(e,t,n),ws=r;break;default:As(e,t,n)}}function js(e,t){if(null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))try{Af(e)}catch(e){dc(t,t.return,e)}}function Ls(e,t){var n=function(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new ks),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new ks),t;default:throw Error(i(435,e.tag))}}(e);t.forEach(function(t){var r=gc.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}function Ps(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var o=n[r],a=e,l=t,s=l;e:for(;null!==s;){switch(s.tag){case 27:if(hd(s.type)){Ts=s.stateNode,Rs=!1;break e}break;case 5:Ts=s.stateNode,Rs=!1;break e;case 3:case 4:Ts=s.stateNode.containerInfo,Rs=!0;break e}s=s.return}if(null===Ts)throw Error(i(160));Is(a,l,o),Ts=null,Rs=!1,null!==(a=o.alternate)&&(a.return=null),o.return=null}if(13878&t.subtreeFlags)for(t=t.child;null!==t;)Ns(t,e),t=t.sibling}var zs=null;function Ns(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ps(t,e),_s(e),4&r&&(ss(3,e,e.return),ls(3,e),ss(5,e,e.return));break;case 1:Ps(t,e),_s(e),512&r&&(ws||null===n||fs(n,n.return)),64&r&&bs&&null!==(e=e.updateQueue)&&null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r));break;case 26:var o=zs;if(Ps(t,e),_s(e),512&r&&(ws||null===n||fs(n,n.return)),4&r){var a=null!==n?n.memoizedState:null;if(r=e.memoizedState,null===n)if(null===r)if(null===e.stateNode){e:{r=e.type,n=e.memoizedProps,o=o.ownerDocument||o;t:switch(r){case"title":(!(a=o.getElementsByTagName("title")[0])||a[Oe]||a[Pe]||"http://www.w3.org/2000/svg"===a.namespaceURI||a.hasAttribute("itemprop"))&&(a=o.createElement(r),o.head.insertBefore(a,o.querySelector("head > title"))),td(a,r,n),a[Pe]=e,Ye(a),r=a;break e;case"link":var l=Od("link","href",o).get(r+(n.href||""));if(l)for(var s=0;s<l.length;s++)if((a=l[s]).getAttribute("href")===(null==n.href||""===n.href?null:n.href)&&a.getAttribute("rel")===(null==n.rel?null:n.rel)&&a.getAttribute("title")===(null==n.title?null:n.title)&&a.getAttribute("crossorigin")===(null==n.crossOrigin?null:n.crossOrigin)){l.splice(s,1);break t}td(a=o.createElement(r),r,n),o.head.appendChild(a);break;case"meta":if(l=Od("meta","content",o).get(r+(n.content||"")))for(s=0;s<l.length;s++)if((a=l[s]).getAttribute("content")===(null==n.content?null:""+n.content)&&a.getAttribute("name")===(null==n.name?null:n.name)&&a.getAttribute("property")===(null==n.property?null:n.property)&&a.getAttribute("http-equiv")===(null==n.httpEquiv?null:n.httpEquiv)&&a.getAttribute("charset")===(null==n.charSet?null:n.charSet)){l.splice(s,1);break t}td(a=o.createElement(r),r,n),o.head.appendChild(a);break;default:throw Error(i(468,r))}a[Pe]=e,Ye(a),r=a}e.stateNode=r}else Hd(o,e.type,e.stateNode);else e.stateNode=Nd(o,r,e.memoizedProps);else a!==r?(null===a?null!==n.stateNode&&(n=n.stateNode).parentNode.removeChild(n):a.count--,null===r?Hd(o,e.type,e.stateNode):Nd(o,r,e.memoizedProps)):null===r&&null!==e.stateNode&&hs(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ps(t,e),_s(e),512&r&&(ws||null===n||fs(n,n.return)),null!==n&&4&r&&hs(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ps(t,e),_s(e),512&r&&(ws||null===n||fs(n,n.return)),32&e.flags){o=e.stateNode;try{kt(o,"")}catch(t){dc(e,e.return,t)}}4&r&&null!=e.stateNode&&hs(e,o=e.memoizedProps,null!==n?n.memoizedProps:o),1024&r&&(Ss=!0);break;case 6:if(Ps(t,e),_s(e),4&r){if(null===e.stateNode)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){dc(e,e.return,t)}}break;case 3:if($d=null,o=zs,zs=Ed(t.containerInfo),Ps(t,e),zs=o,_s(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Af(t.containerInfo)}catch(t){dc(e,e.return,t)}Ss&&(Ss=!1,Ds(e));break;case 4:r=zs,zs=Ed(e.stateNode.containerInfo),Ps(t,e),_s(e),zs=r;break;case 12:default:Ps(t,e),_s(e);break;case 13:Ps(t,e),_s(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(Su=ne()),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,Ls(e,r));break;case 22:o=null!==e.memoizedState;var u=null!==n&&null!==n.memoizedState,c=bs,d=ws;if(bs=c||o,ws=d||u,Ps(t,e),ws=d,bs=c,_s(e),8192&r)e:for(t=e.stateNode,t._visibility=o?-2&t._visibility:1|t._visibility,o&&(null===n||u||bs||ws||$s(e)),n=null,t=e;;){if(5===t.tag||26===t.tag){if(null===n){u=n=t;try{if(a=u.stateNode,o)"function"==typeof(l=a.style).setProperty?l.setProperty("display","none","important"):l.display="none";else{s=u.stateNode;var f=u.memoizedProps.style,p=null!=f&&f.hasOwnProperty("display")?f.display:null;s.style.display=null==p||"boolean"==typeof p?"":(""+p).trim()}}catch(e){dc(u,u.return,e)}}}else if(6===t.tag){if(null===n){u=t;try{u.stateNode.nodeValue=o?"":u.memoizedProps}catch(e){dc(u,u.return,e)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}4&r&&null!==(r=e.updateQueue)&&null!==(n=r.retryQueue)&&(r.retryQueue=null,Ls(e,n));break;case 19:Ps(t,e),_s(e),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,Ls(e,r));case 30:case 21:}}function _s(e){var t=e.flags;if(2&t){try{for(var n,r=e.return;null!==r;){if(ms(r)){n=r;break}r=r.return}if(null==n)throw Error(i(160));switch(n.tag){case 27:var o=n.stateNode;xs(e,gs(e),o);break;case 5:var a=n.stateNode;32&n.flags&&(kt(a,""),n.flags&=-33),xs(e,gs(e),a);break;case 3:case 4:var l=n.stateNode.containerInfo;ys(e,gs(e),l);break;default:throw Error(i(161))}}catch(t){dc(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Ds(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;Ds(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function Fs(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Es(e,t.alternate,t),t=t.sibling}function $s(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ss(4,t,t.return),$s(t);break;case 1:fs(t,t.return);var n=t.stateNode;"function"==typeof n.componentWillUnmount&&cs(t,t.return,n),$s(t);break;case 27:Sd(t.stateNode);case 26:case 5:fs(t,t.return),$s(t);break;case 22:null===t.memoizedState&&$s(t);break;default:$s(t)}e=e.sibling}}function Os(e,t,n){for(n=n&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var r=t.alternate,i=e,o=t,a=o.flags;switch(o.tag){case 0:case 11:case 15:Os(i,o,n),ls(4,o);break;case 1:if(Os(i,o,n),"function"==typeof(i=(r=o).stateNode).componentDidMount)try{i.componentDidMount()}catch(e){dc(r,r.return,e)}if(null!==(i=(r=o).updateQueue)){var l=r.stateNode;try{var s=i.shared.hiddenCallbacks;if(null!==s)for(i.shared.hiddenCallbacks=null,i=0;i<s.length;i++)po(s[i],l)}catch(e){dc(r,r.return,e)}}n&&64&a&&us(o),ds(o,o.return);break;case 27:vs(o);case 26:case 5:Os(i,o,n),n&&null===r&&4&a&&ps(o),ds(o,o.return);break;case 12:Os(i,o,n);break;case 13:Os(i,o,n),n&&4&a&&js(i,o);break;case 22:null===o.memoizedState&&Os(i,o,n),ds(o,o.return);break;case 30:break;default:Os(i,o,n)}t=t.sibling}}function Hs(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&Ni(n))}function Ws(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Ni(e))}function Bs(e,t,n,r){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)Vs(e,t,n,r),t=t.sibling}function Vs(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Bs(e,t,n,r),2048&i&&ls(9,t);break;case 1:case 13:default:Bs(e,t,n,r);break;case 3:Bs(e,t,n,r),2048&i&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Ni(e)));break;case 12:if(2048&i){Bs(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,a=o.id,l=o.onPostCommit;"function"==typeof l&&l(a,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){dc(t,t.return,e)}}else Bs(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,a=t.alternate,null!==t.memoizedState?2&o._visibility?Bs(e,t,n,r):Ys(e,t):2&o._visibility?Bs(e,t,n,r):(o._visibility|=2,qs(e,t,n,r,!!(10256&t.subtreeFlags))),2048&i&&Hs(a,t);break;case 24:Bs(e,t,n,r),2048&i&&Ws(t.alternate,t)}}function qs(e,t,n,r,i){for(i=i&&!!(10256&t.subtreeFlags),t=t.child;null!==t;){var o=e,a=t,l=n,s=r,u=a.flags;switch(a.tag){case 0:case 11:case 15:qs(o,a,l,s,i),ls(8,a);break;case 23:break;case 22:var c=a.stateNode;null!==a.memoizedState?2&c._visibility?qs(o,a,l,s,i):Ys(o,a):(c._visibility|=2,qs(o,a,l,s,i)),i&&2048&u&&Hs(a.alternate,a);break;case 24:qs(o,a,l,s,i),i&&2048&u&&Ws(a.alternate,a);break;default:qs(o,a,l,s,i)}t=t.sibling}}function Ys(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ys(n,r),2048&i&&Hs(r.alternate,r);break;case 24:Ys(n,r),2048&i&&Ws(r.alternate,r);break;default:Ys(n,r)}t=t.sibling}}var Us=8192;function Xs(e){if(e.subtreeFlags&Us)for(e=e.child;null!==e;)Ks(e),e=e.sibling}function Ks(e){switch(e.tag){case 26:Xs(e),e.flags&Us&&null!==e.memoizedState&&function(e,t,n){if(null===Bd)throw Error(i(475));var r=Bd;if(!("stylesheet"!==t.type||"string"==typeof n.media&&!1===matchMedia(n.media).matches||4&t.state.loading)){if(null===t.instance){var o=Id(n.href),a=e.querySelector(jd(o));if(a)return null!==(e=a._p)&&"object"==typeof e&&"function"==typeof e.then&&(r.count++,r=qd.bind(r),e.then(r,r)),t.state.loading|=4,t.instance=a,void Ye(a);a=e.ownerDocument||e,n=Ld(n),(o=kd.get(o))&&Dd(n,o),Ye(a=a.createElement("link"));var l=a;l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),td(a,"link",n),t.instance=a}null===r.stylesheets&&(r.stylesheets=new Map),r.stylesheets.set(t,e),(e=t.state.preload)&&!(3&t.state.loading)&&(r.count++,t=qd.bind(r),e.addEventListener("load",t),e.addEventListener("error",t))}}(zs,e.memoizedState,e.memoizedProps);break;case 5:default:Xs(e);break;case 3:case 4:var t=zs;zs=Ed(e.stateNode.containerInfo),Xs(e),zs=t;break;case 22:null===e.memoizedState&&(null!==(t=e.alternate)&&null!==t.memoizedState?(t=Us,Us=16777216,Xs(e),Us=t):Xs(e))}}function Qs(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function Gs(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Cs=r,eu(r,e)}Qs(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)Zs(e),e=e.sibling}function Zs(e){switch(e.tag){case 0:case 11:case 15:Gs(e),2048&e.flags&&ss(9,e,e.return);break;case 3:case 12:default:Gs(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,Js(e)):Gs(e)}}function Js(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Cs=r,eu(r,e)}Qs(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:ss(8,t,t.return),Js(t);break;case 22:2&(n=t.stateNode)._visibility&&(n._visibility&=-3,Js(t));break;default:Js(t)}e=e.sibling}}function eu(e,t){for(;null!==Cs;){var n=Cs;switch(n.tag){case 0:case 11:case 15:ss(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:Ni(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,Cs=r;else e:for(n=e;null!==Cs;){var i=(r=Cs).sibling,o=r.return;if(Ms(r),r===n){Cs=null;break e}if(null!==i){i.return=o,Cs=i;break e}Cs=o}}}var tu={getCacheForType:function(e){var t=Ti(Pi),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n}},nu="function"==typeof WeakMap?WeakMap:Map,ru=0,iu=null,ou=null,au=0,lu=0,su=null,uu=!1,cu=!1,du=!1,fu=0,pu=0,hu=0,mu=0,gu=0,yu=0,xu=0,vu=null,bu=null,wu=!1,Su=0,ku=1/0,Cu=null,Eu=null,Mu=0,Tu=null,Ru=null,Au=0,Iu=0,ju=null,Lu=null,Pu=0,zu=null;function Nu(){return 2&ru&&0!==au?au&-au:null!==N.T?0!==Fi?Fi:Lc():je()}function _u(){0===yu&&(yu=536870912&au&&!ai?536870912:ke());var e=ol.current;return null!==e&&(e.flags|=32),yu}function Du(e,t,n){(e===iu&&(2===lu||9===lu)||null!==e.cancelPendingCommit)&&(Vu(e,0),Hu(e,au,yu,!1)),Me(e,n),(!(2&ru)||e!==iu)&&(e===iu&&(!(2&ru)&&(mu|=n),4===pu&&Hu(e,au,yu,!1)),Ec(e))}function Fu(e,t,n){if(6&ru)throw Error(i(327));for(var r=!n&&!(124&t)&&0===(t&e.expiredLanes)||we(e,t),o=r?function(e,t){var n=ru;ru|=2;var r=Yu(),o=Uu();iu!==e||au!==t?(Cu=null,ku=ne()+500,Vu(e,t)):cu=we(e,t);e:for(;;)try{if(0!==lu&&null!==ou){t=ou;var a=su;t:switch(lu){case 1:lu=0,su=null,ec(e,t,a,1);break;case 2:case 9:if(Qi(a)){lu=0,su=null,Ju(t);break}t=function(){2!==lu&&9!==lu||iu!==e||(lu=7),Ec(e)},a.then(t,t);break e;case 3:lu=7;break e;case 4:lu=5;break e;case 7:Qi(a)?(lu=0,su=null,Ju(t)):(lu=0,su=null,ec(e,t,a,7));break;case 5:var l=null;switch(ou.tag){case 26:l=ou.memoizedState;case 5:case 27:var s=ou;if(!l||Wd(l)){lu=0,su=null;var u=s.sibling;if(null!==u)ou=u;else{var c=s.return;null!==c?(ou=c,tc(c)):ou=null}break t}}lu=0,su=null,ec(e,t,a,5);break;case 6:lu=0,su=null,ec(e,t,a,6);break;case 8:Bu(),pu=6;break e;default:throw Error(i(462))}}Gu();break}catch(t){qu(e,t)}return vi=xi=null,N.H=r,N.A=o,ru=n,null!==ou?0:(iu=null,au=0,Ar(),pu)}(e,t):Ku(e,t,!0),a=r;;){if(0===o){cu&&!r&&Hu(e,t,0,!1);break}if(n=e.current.alternate,!a||Ou(n)){if(2===o){if(a=t,e.errorRecoveryDisabledLanes&a)var l=0;else l=0!=(l=-536870913&e.pendingLanes)?l:536870912&l?536870912:0;if(0!==l){t=l;e:{var s=e;o=vu;var u=s.current.memoizedState.isDehydrated;if(u&&(Vu(s,l).flags|=256),2!==(l=Ku(s,l,!1))){if(du&&!u){s.errorRecoveryDisabledLanes|=a,mu|=a,o=4;break e}a=bu,bu=o,null!==a&&(null===bu?bu=a:bu.push.apply(bu,a))}o=l}if(a=!1,2!==o)continue}}if(1===o){Vu(e,0),Hu(e,t,0,!0);break}e:{switch(r=e,a=o){case 0:case 1:throw Error(i(345));case 4:if((4194048&t)!==t)break;case 6:Hu(r,t,yu,!uu);break e;case 2:bu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((62914560&t)===t&&10<(o=Su+300-ne())){if(Hu(r,t,yu,!uu),0!==be(r,0,!0))break e;r.timeoutHandle=ud($u.bind(null,r,n,bu,Cu,wu,t,yu,mu,xu,uu,a,2,-0,0),o)}else $u(r,n,bu,Cu,wu,t,yu,mu,xu,uu,a,0,-0,0)}break}o=Ku(e,t,!1),a=!1}Ec(e)}function $u(e,t,n,r,o,a,l,s,u,c,d,f,p,h){if(e.timeoutHandle=-1,(8192&(f=t.subtreeFlags)||!(16785408&~f))&&(Bd={stylesheets:null,count:0,unsuspend:Vd},Ks(t),f=function(){if(null===Bd)throw Error(i(475));var e=Bd;return e.stylesheets&&0===e.count&&Ud(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&Ud(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(n)}}:null}(),null!==f))return e.cancelPendingCommit=f(rc.bind(null,e,t,a,n,r,o,l,s,u,d,1,p,h)),void Hu(e,a,l,!c);rc(e,t,a,n,r,o,l,s,u)}function Ou(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&null!==(n=t.updateQueue)&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!Qn(o(),i))return!1}catch{return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Hu(e,t,n,r){t&=~gu,t&=~mu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var o=31-he(i),a=1<<o;r[o]=-1,i&=~a}0!==n&&Te(e,n,t)}function Wu(){return!!(6&ru)||(Mc(0,!1),!1)}function Bu(){if(null!==ou){if(0===lu)var e=ou.return;else vi=xi=null,$o(e=ou),Qa=null,Ga=0,e=ou;for(;null!==e;)as(e.alternate,e),e=e.return;ou=null}}function Vu(e,t){var n=e.timeoutHandle;-1!==n&&(e.timeoutHandle=-1,cd(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),Bu(),iu=e,ou=n=$r(e.current,null),au=t,lu=0,su=null,uu=!1,cu=we(e,t),du=!1,xu=yu=gu=mu=hu=pu=0,bu=vu=null,wu=!1,8&t&&(t|=32&t);var r=e.entangledLanes;if(0!==r)for(e=e.entanglements,r&=t;0<r;){var i=31-he(r),o=1<<i;t|=e[i],r&=~o}return fu=t,Ar(),n}function qu(e,t){wo=null,N.H=Ya,t===Yi||t===Xi?(t=eo(),lu=3):t===Ui?(t=eo(),lu=4):lu=t===Tl?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,su=t,null===ou&&(pu=1,Sl(e,Er(t,e.current)))}function Yu(){var e=N.H;return N.H=Ya,null===e?Ya:e}function Uu(){var e=N.A;return N.A=tu,e}function Xu(){pu=4,uu||(4194048&au)!==au&&null!==ol.current||(cu=!0),!(134217727&hu)&&!(134217727&mu)||null===iu||Hu(iu,au,yu,!1)}function Ku(e,t,n){var r=ru;ru|=2;var i=Yu(),o=Uu();(iu!==e||au!==t)&&(Cu=null,Vu(e,t)),t=!1;var a=pu;e:for(;;)try{if(0!==lu&&null!==ou){var l=ou,s=su;switch(lu){case 8:Bu(),a=6;break e;case 3:case 2:case 9:case 6:null===ol.current&&(t=!0);var u=lu;if(lu=0,su=null,ec(e,l,s,u),n&&cu){a=0;break e}break;default:u=lu,lu=0,su=null,ec(e,l,s,u)}}Qu(),a=pu;break}catch(t){qu(e,t)}return t&&e.shellSuspendCounter++,vi=xi=null,ru=r,N.H=i,N.A=o,null===ou&&(iu=null,au=0,Ar()),a}function Qu(){for(;null!==ou;)Zu(ou)}function Gu(){for(;null!==ou&&!ee();)Zu(ou)}function Zu(e){var t=Zl(e.alternate,e,fu);e.memoizedProps=e.pendingProps,null===t?tc(e):ou=t}function Ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Dl(n,t,t.pendingProps,t.type,void 0,au);break;case 11:t=Dl(n,t,t.pendingProps,t.type.render,t.ref,au);break;case 5:$o(t);default:as(n,t),t=Zl(n,t=ou=Or(t,fu),fu)}e.memoizedProps=e.pendingProps,null===t?tc(e):ou=t}function ec(e,t,n,r){vi=xi=null,$o(t),Qa=null,Ga=0;var o=t.return;try{if(function(e,t,n,r,o){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&Ci(t,n,o,!0),null!==(n=ol.current)){switch(n.tag){case 13:return null===al?Xu():null===n.alternate&&0===pu&&(pu=3),n.flags&=-257,n.flags|=65536,n.lanes=o,r===Ki?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=new Set([r]):t.add(r),fc(e,r,o)),!1;case 22:return n.flags|=65536,r===Ki?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=new Set([r]):n.add(r),fc(e,r,o)),!1}throw Error(i(435,n.tag))}return fc(e,r,o),Xu(),!1}if(ai)return null!==(t=ol.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==ui&&gi(Er(e=Error(i(422),{cause:r}),n))):(r!==ui&&gi(Er(t=Error(i(423),{cause:r}),n)),(e=e.current.alternate).flags|=65536,o&=-o,e.lanes|=o,r=Er(r,n),so(e,o=Cl(e.stateNode,r,o)),4!==pu&&(pu=2)),!1;var a=Error(i(520),{cause:r});if(a=Er(a,n),null===vu?vu=[a]:vu.push(a),4!==pu&&(pu=2),null===t)return!0;r=Er(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,so(n,e=Cl(n.stateNode,r,e)),!1;case 1:if(t=n.type,a=n.stateNode,!(128&n.flags||"function"!=typeof t.getDerivedStateFromError&&(null===a||"function"!=typeof a.componentDidCatch||null!==Eu&&Eu.has(a))))return n.flags|=65536,o&=-o,n.lanes|=o,Ml(o=El(o),e,n,r),so(n,o),!1}n=n.return}while(null!==n);return!1}(e,o,t,n,au))return pu=1,Sl(e,Er(n,e.current)),void(ou=null)}catch(t){if(null!==o)throw ou=o,t;return pu=1,Sl(e,Er(n,e.current)),void(ou=null)}32768&t.flags?(ai||1===r?e=!0:cu||536870912&au?e=!1:(uu=e=!0,(2===r||9===r||3===r||6===r)&&null!==(r=ol.current)&&13===r.tag&&(r.flags|=16384)),nc(t,e)):tc(t)}function tc(e){var t=e;do{if(32768&t.flags)return void nc(t,uu);e=t.return;var n=is(t.alternate,t,fu);if(null!==n)return void(ou=n);if(null!==(t=t.sibling))return void(ou=t);ou=t=e}while(null!==t);0===pu&&(pu=5)}function nc(e,t){do{var n=os(e.alternate,e);if(null!==n)return n.flags&=32767,void(ou=n);if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling))return void(ou=e);ou=e=n}while(null!==e);pu=6,ou=null}function rc(e,t,n,r,o,a,l,s,u){e.cancelPendingCommit=null;do{sc()}while(0!==Mu);if(6&ru)throw Error(i(327));if(null!==t){if(t===e.current)throw Error(i(177));if(a=t.lanes|t.childLanes,function(e,t,n,r,i,o){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0<n;){var c=31-he(n),d=1<<c;l[c]=0,s[c]=-1;var f=u[c];if(null!==f)for(u[c]=null,c=0;c<f.length;c++){var p=f[c];null!==p&&(p.lane&=-536870913)}n&=~d}0!==r&&Te(e,r,0),0!==o&&0===i&&0!==e.tag&&(e.suspendedLanes|=o&~(a&~t))}(e,n,a|=Rr,l,s,u),e===iu&&(ou=iu=null,au=0),Ru=t,Tu=e,Au=n,Iu=a,ju=o,Lu=r,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,function(e){Z(e,function(){return uc(),null})}(ae)):(e.callbackNode=null,e.callbackPriority=0),r=!!(13878&t.flags),13878&t.subtreeFlags||r){r=N.T,N.T=null,o=_.p,_.p=2,l=ru,ru|=4;try{!function(e,t){if(e=e.containerInfo,nd=rf,nr(e=tr(e))){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var o=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var l=0,s=-1,u=-1,c=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||0!==o&&3!==f.nodeType||(s=l+o),f!==a||0!==r&&3!==f.nodeType||(u=l+r),3===f.nodeType&&(l+=f.nodeValue.length),null!==(h=f.firstChild);)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++c===o&&(s=l),p===a&&++d===r&&(u=l),null!==(h=f.nextSibling))break;p=(f=p).parentNode}f=h}n=-1===s||-1===u?null:{start:s,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(rd={focusedElem:e,selectionRange:n},rf=!1,Cs=t;null!==Cs;)if(e=(t=Cs).child,1024&t.subtreeFlags&&null!==e)e.return=t,Cs=e;else for(;null!==Cs;){switch(a=(t=Cs).alternate,e=t.flags,t.tag){case 0:case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&e&&null!==a){e=void 0,n=t,o=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var m=yl(n.type,o,(n.elementType,n.type));e=r.getSnapshotBeforeUpdate(m,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){dc(n,n.return,e)}}break;case 3:if(1024&e)if(9===(n=(e=t.stateNode.containerInfo).nodeType))gd(e);else if(1===n)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":gd(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(i(163))}if(null!==(e=t.sibling)){e.return=t.return,Cs=e;break}Cs=t.return}}(e,t)}finally{ru=l,_.p=o,N.T=r}}Mu=1,ic(),oc(),ac()}}function ic(){if(1===Mu){Mu=0;var e=Tu,t=Ru,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=N.T,N.T=null;var r=_.p;_.p=2;var i=ru;ru|=4;try{Ns(t,e);var o=rd,a=tr(e.containerInfo),l=o.focusedElem,s=o.selectionRange;if(a!==l&&l&&l.ownerDocument&&er(l.ownerDocument.documentElement,l)){if(null!==s&&nr(l)){var u=s.start,c=s.end;if(void 0===c&&(c=u),"selectionStart"in l)l.selectionStart=u,l.selectionEnd=Math.min(c,l.value.length);else{var d=l.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),h=l.textContent.length,m=Math.min(s.start,h),g=void 0===s.end?m:Math.min(s.end,h);!p.extend&&m>g&&(a=g,g=m,m=a);var y=Jn(l,m),x=Jn(l,g);if(y&&x&&(1!==p.rangeCount||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==x.node||p.focusOffset!==x.offset)){var v=d.createRange();v.setStart(y.node,y.offset),p.removeAllRanges(),m>g?(p.addRange(v),p.extend(x.node,x.offset)):(v.setEnd(x.node,x.offset),p.addRange(v))}}}}for(d=[],p=l;p=p.parentNode;)1===p.nodeType&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof l.focus&&l.focus(),l=0;l<d.length;l++){var b=d[l];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}rf=!!nd,rd=nd=null}finally{ru=i,_.p=r,N.T=n}}e.current=t,Mu=2}}function oc(){if(2===Mu){Mu=0;var e=Tu,t=Ru,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=N.T,N.T=null;var r=_.p;_.p=2;var i=ru;ru|=4;try{Es(e,t.alternate,t)}finally{ru=i,_.p=r,N.T=n}}Mu=3}}function ac(){if(4===Mu||3===Mu){Mu=0,te();var e=Tu,t=Ru,n=Au,r=Lu;10256&t.subtreeFlags||10256&t.flags?Mu=5:(Mu=0,Ru=Tu=null,lc(e,e.pendingLanes));var i=e.pendingLanes;if(0===i&&(Eu=null),Ie(n),t=t.stateNode,fe&&"function"==typeof fe.onCommitFiberRoot)try{fe.onCommitFiberRoot(de,t,void 0,!(128&~t.current.flags))}catch{}if(null!==r){t=N.T,i=_.p,_.p=2,N.T=null;try{for(var o=e.onRecoverableError,a=0;a<r.length;a++){var l=r[a];o(l.value,{componentStack:l.stack})}}finally{N.T=t,_.p=i}}!!(3&Au)&&sc(),Ec(e),i=e.pendingLanes,4194090&n&&42&i?e===zu?Pu++:(Pu=0,zu=e):Pu=0,Mc(0,!1)}}function lc(e,t){0===(e.pooledCacheLanes&=t)&&null!=(t=e.pooledCache)&&(e.pooledCache=null,Ni(t))}function sc(e){return ic(),oc(),ac(),uc()}function uc(){if(5!==Mu)return!1;var e=Tu,t=Iu;Iu=0;var n=Ie(Au),r=N.T,o=_.p;try{_.p=32>n?32:n,N.T=null,n=ju,ju=null;var a=Tu,l=Au;if(Mu=0,Ru=Tu=null,Au=0,6&ru)throw Error(i(331));var s=ru;if(ru|=4,Zs(a.current),Vs(a,a.current,l,n),ru=s,Mc(0,!1),fe&&"function"==typeof fe.onPostCommitFiberRoot)try{fe.onPostCommitFiberRoot(de,a)}catch{}return!0}finally{_.p=o,N.T=r,lc(e,t)}}function cc(e,t,n){t=Er(n,t),null!==(e=ao(e,t=Cl(e.stateNode,t,2),2))&&(Me(e,2),Ec(e))}function dc(e,t,n){if(3===e.tag)cc(e,e,n);else for(;null!==t;){if(3===t.tag){cc(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Eu||!Eu.has(r))){e=Er(n,e),null!==(r=ao(t,n=El(2),2))&&(Ml(n,r,t,e),Me(r,2),Ec(r));break}}t=t.return}}function fc(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new nu;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(du=!0,i.add(n),e=pc.bind(null,e,t,n),t.then(e,e))}function pc(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,iu===e&&(au&n)===n&&(4===pu||3===pu&&(62914560&au)===au&&300>ne()-Su?!(2&ru)&&Vu(e,0):gu|=n,xu===au&&(xu=0)),Ec(e)}function hc(e,t){0===t&&(t=Ce()),null!==(e=Lr(e,t))&&(Me(e,t),Ec(e))}function mc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),hc(e,n)}function gc(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(n=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(t),hc(e,n)}var yc,xc,vc=null,bc=null,wc=!1,Sc=!1,kc=!1,Cc=0;function Ec(e){e!==bc&&null===e.next&&(null===bc?vc=bc=e:bc=bc.next=e),Sc=!0,wc||(wc=!0,fd(function(){6&ru?Z(ie,Tc):Rc()}))}function Mc(e,t){if(!kc&&Sc){kc=!0;do{for(var n=!1,r=vc;null!==r;){if(!t)if(0!==e){var i=r.pendingLanes;if(0===i)var o=0;else{var a=r.suspendedLanes,l=r.pingedLanes;o=(1<<31-he(42|e)+1)-1,o=201326741&(o&=i&~(a&~l))?201326741&o|1:o?2|o:0}0!==o&&(n=!0,jc(r,o))}else o=au,!(3&(o=be(r,r===iu?o:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||we(r,o)||(n=!0,jc(r,o));r=r.next}}while(n);kc=!1}}function Tc(){Rc()}function Rc(){Sc=wc=!1;var e=0;0!==Cc&&(function(){var e=window.event;return e&&"popstate"===e.type?e!==sd&&(sd=e,!0):(sd=null,!1)}()&&(e=Cc),Cc=0);for(var t=ne(),n=null,r=vc;null!==r;){var i=r.next,o=Ac(r,t);0===o?(r.next=null,null===n?vc=i:n.next=i,null===i&&(bc=n)):(n=r,(0!==e||!!(3&o))&&(Sc=!0)),r=i}Mc(e,!1)}function Ac(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=-62914561&e.pendingLanes;0<o;){var a=31-he(o),l=1<<a,s=i[a];-1===s?(0===(l&n)||0!==(l&r))&&(i[a]=Se(l,t)):s<=t&&(e.expiredLanes|=l),o&=~l}if(n=au,n=be(e,e===(t=iu)?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),r=e.callbackNode,0===n||e===t&&(2===lu||9===lu)||null!==e.cancelPendingCommit)return null!==r&&null!==r&&J(r),e.callbackNode=null,e.callbackPriority=0;if(!(3&n)||we(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&J(r),Ie(n)){case 2:case 8:n=oe;break;case 32:default:n=ae;break;case 268435456:n=se}return r=Ic.bind(null,e),n=Z(n,r),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&J(r),e.callbackPriority=2,e.callbackNode=null,2}function Ic(e,t){if(0!==Mu&&5!==Mu)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(sc()&&e.callbackNode!==n)return null;var r=au;return 0===(r=be(e,e===iu?r:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(Fu(e,r,t),Ac(e,ne()),null!=e.callbackNode&&e.callbackNode===n?Ic.bind(null,e):null)}function jc(e,t){if(sc())return null;Fu(e,t,!0)}function Lc(){return 0===Cc&&(Cc=ke()),Cc}function Pc(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:It(""+e)}function zc(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}for(xc=0;xc<Sr.length;xc++)kr((yc=Sr[xc]).toLowerCase(),"on"+(yc[0].toUpperCase()+yc.slice(1)));kr(hr,"onAnimationEnd"),kr(mr,"onAnimationIteration"),kr(gr,"onAnimationStart"),kr("dblclick","onDoubleClick"),kr("focusin","onFocus"),kr("focusout","onBlur"),kr(yr,"onTransitionRun"),kr(xr,"onTransitionStart"),kr(vr,"onTransitionCancel"),kr(br,"onTransitionEnd"),Qe("onMouseEnter",["mouseout","mouseover"]),Qe("onMouseLeave",["mouseout","mouseover"]),Qe("onPointerEnter",["pointerout","pointerover"]),Qe("onPointerLeave",["pointerout","pointerover"]),Ke("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ke("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ke("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ke("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ke("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ke("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Nc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),_c=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Nc));function Dc(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],s=l.instance,u=l.currentTarget;if(l=l.listener,s!==o&&i.isPropagationStopped())break e;o=l,i.currentTarget=u;try{o(i)}catch(e){xl(e)}i.currentTarget=null,o=s}else for(a=0;a<r.length;a++){if(s=(l=r[a]).instance,u=l.currentTarget,l=l.listener,s!==o&&i.isPropagationStopped())break e;o=l,i.currentTarget=u;try{o(i)}catch(e){xl(e)}i.currentTarget=null,o=s}}}}function Fc(e,t){var n=t[_e];void 0===n&&(n=t[_e]=new Set);var r=e+"__bubble";n.has(r)||(Wc(t,e,2,!1),n.add(r))}function $c(e,t,n){var r=0;t&&(r|=4),Wc(n,e,r,t)}var Oc="_reactListening"+Math.random().toString(36).slice(2);function Hc(e){if(!e[Oc]){e[Oc]=!0,Ue.forEach(function(t){"selectionchange"!==t&&(_c.has(t)||$c(t,!1,e),$c(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Oc]||(t[Oc]=!0,$c("selectionchange",!1,t))}}function Wc(e,t,n,r){switch(df(t)){case 2:var i=of;break;case 8:i=af;break;default:i=lf}n=i.bind(null,t,n,e),i=void 0,!Ot||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Bc(e,t,n,r,i){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var l=r.tag;if(3===l||4===l){var s=r.stateNode.containerInfo;if(s===i)break;if(4===l)for(l=r.return;null!==l;){var u=l.tag;if((3===u||4===u)&&l.stateNode.containerInfo===i)return;l=l.return}for(;null!==s;){if(null===(l=We(s)))return;if(5===(u=l.tag)||6===u||26===u||27===u){r=o=l;continue e}s=s.parentNode}}r=r.return}Dt(function(){var r=o,i=Lt(n),l=[];e:{var s=wr.get(e);if(void 0!==s){var u=en,c=e;switch(e){case"keypress":if(0===Yt(n))break e;case"keydown":case"keyup":u=gn;break;case"focusin":c="focus",u=ln;break;case"focusout":c="blur",u=ln;break;case"beforeblur":case"afterblur":u=ln;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":u=on;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":u=an;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":u=xn;break;case hr:case mr:case gr:u=sn;break;case br:u=vn;break;case"scroll":case"scrollend":u=nn;break;case"wheel":u=bn;break;case"copy":case"cut":case"paste":u=un;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":u=yn;break;case"toggle":case"beforetoggle":u=wn}var d=!!(4&t),f=!d&&("scroll"===e||"scrollend"===e),p=d?null!==s?s+"Capture":null:s;d=[];for(var h,m=r;null!==m;){var g=m;if(h=g.stateNode,5!==(g=g.tag)&&26!==g&&27!==g||null===h||null===p||null!=(g=Ft(m,p))&&d.push(Vc(m,g,h)),f)break;m=m.return}0<d.length&&(s=new u(s,c,null,n,i),l.push({event:s,listeners:d}))}}if(!(7&t)){if(u="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===jt||!(c=n.relatedTarget||n.fromElement)||!We(c)&&!c[Ne])&&(u||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,u?(u=r,null!==(c=(c=n.relatedTarget||n.toElement)?We(c):null)&&(f=a(c),d=c.tag,c!==f||5!==d&&27!==d&&6!==d)&&(c=null)):(u=null,c=r),u!==c)){if(d=on,g="onMouseLeave",p="onMouseEnter",m="mouse",("pointerout"===e||"pointerover"===e)&&(d=yn,g="onPointerLeave",p="onPointerEnter",m="pointer"),f=null==u?s:Ve(u),h=null==c?s:Ve(c),(s=new d(g,m+"leave",u,n,i)).target=f,s.relatedTarget=h,g=null,We(i)===r&&((d=new d(p,m+"enter",c,n,i)).target=h,d.relatedTarget=f,g=d),f=g,u&&c)e:{for(p=c,m=0,h=d=u;h;h=Yc(h))m++;for(h=0,g=p;g;g=Yc(g))h++;for(;0<m-h;)d=Yc(d),m--;for(;0<h-m;)p=Yc(p),h--;for(;m--;){if(d===p||null!==p&&d===p.alternate)break e;d=Yc(d),p=Yc(p)}d=null}else d=null;null!==u&&Uc(l,s,u,d,!1),null!==c&&null!==f&&Uc(l,f,c,d,!0)}if("select"===(u=(s=r?Ve(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===u&&"file"===s.type)var y=$n;else if(Pn(s))if(Bn)y=Kn;else{y=Un;var x=Yn}else!(u=s.nodeName)||"input"!==u.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?r&&Tt(r.elementType)&&(y=$n):y=Xn;switch(y&&(y=y(e,r))?zn(l,y,n,i):(x&&x(e,s,r),"focusout"===e&&r&&"number"===s.type&&null!=r.memoizedProps.value&&vt(s,"number",s.value)),x=r?Ve(r):window,e){case"focusin":(Pn(x)||"true"===x.contentEditable)&&(ir=x,or=r,ar=null);break;case"focusout":ar=or=ir=null;break;case"mousedown":lr=!0;break;case"contextmenu":case"mouseup":case"dragend":lr=!1,sr(l,n,i);break;case"selectionchange":if(rr)break;case"keydown":case"keyup":sr(l,n,i)}var v;if(kn)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else jn?An(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Mn&&"ko"!==n.locale&&(jn||"onCompositionStart"!==b?"onCompositionEnd"===b&&jn&&(v=qt()):(Bt="value"in(Wt=i)?Wt.value:Wt.textContent,jn=!0)),0<(x=qc(r,b)).length&&(b=new cn(b,e,null,n,i),l.push({event:b,listeners:x}),(v||null!==(v=In(n)))&&(b.data=v))),(v=En?function(e,t){switch(e){case"compositionend":return In(t);case"keypress":return 32!==t.which?null:(Rn=!0,Tn);case"textInput":return(e=t.data)===Tn&&Rn?null:e;default:return null}}(e,n):function(e,t){if(jn)return"compositionend"===e||!kn&&An(e,t)?(e=qt(),Vt=Bt=Wt=null,jn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Mn&&"ko"!==t.locale?null:t.data}}(e,n))&&0<(b=qc(r,"onBeforeInput")).length&&(x=new cn("onBeforeInput","beforeinput",null,n,i),l.push({event:x,listeners:b}),x.data=v),function(e,t,n,r,i){if("submit"===t&&n&&n.stateNode===i){var o=Pc((i[ze]||null).action),a=r.submitter;a&&null!==(t=(t=a[ze]||null)?Pc(t.formAction):a.getAttribute("formAction"))&&(o=t,a=null);var l=new en("action","action",null,r,i);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(0!==Cc){var e=a?zc(i,a):new FormData(i);La(n,{pending:!0,data:e,method:i.method,action:o},null,e)}}else"function"==typeof o&&(l.preventDefault(),e=a?zc(i,a):new FormData(i),La(n,{pending:!0,data:e,method:i.method,action:o},o,e))},currentTarget:i}]})}}(l,e,r,n,i)}Dc(l,t)})}function Vc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qc(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,o=i.stateNode;if(5!==(i=i.tag)&&26!==i&&27!==i||null===o||(null!=(i=Ft(e,n))&&r.unshift(Vc(e,i,o)),null!=(i=Ft(e,t))&&r.push(Vc(e,i,o))),3===e.tag)return r;e=e.return}return[]}function Yc(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function Uc(e,t,n,r,i){for(var o=t._reactName,a=[];null!==n&&n!==r;){var l=n,s=l.alternate,u=l.stateNode;if(l=l.tag,null!==s&&s===r)break;5!==l&&26!==l&&27!==l||null===u||(s=u,i?null!=(u=Ft(n,o))&&a.unshift(Vc(n,u,s)):i||null!=(u=Ft(n,o))&&a.push(Vc(n,u,s))),n=n.return}0!==a.length&&e.push({event:t,listeners:a})}var Xc=/\\r\\n?/g,Kc=/\\u0000|\\uFFFD/g;function Qc(e){return("string"==typeof e?e:""+e).replace(Xc,"\\n").replace(Kc,"")}function Gc(e,t){return t=Qc(t),Qc(e)===t}function Zc(){}function Jc(e,t,n,r,o,a){switch(n){case"children":"string"==typeof r?"body"===t||"textarea"===t&&""===r||kt(e,r):("number"==typeof r||"bigint"==typeof r)&&"body"!==t&&kt(e,""+r);break;case"className":rt(e,"class",r);break;case"tabIndex":rt(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":rt(e,n,r);break;case"style":Mt(e,r,a);break;case"data":if("object"!==t){rt(e,"data",r);break}case"src":case"href":if(""===r&&("a"!==t||"href"!==n)){e.removeAttribute(n);break}if(null==r||"function"==typeof r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=It(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if("function"==typeof r){e.setAttribute(n,"javascript:throw new Error(\'A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\\\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().\')");break}if("function"==typeof a&&("formAction"===n?("input"!==t&&Jc(e,t,"name",o.name,o,null),Jc(e,t,"formEncType",o.formEncType,o,null),Jc(e,t,"formMethod",o.formMethod,o,null),Jc(e,t,"formTarget",o.formTarget,o,null)):(Jc(e,t,"encType",o.encType,o,null),Jc(e,t,"method",o.method,o,null),Jc(e,t,"target",o.target,o,null))),null==r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=It(""+r),e.setAttribute(n,r);break;case"onClick":null!=r&&(e.onclick=Zc);break;case"onScroll":null!=r&&Fc("scroll",e);break;case"onScrollEnd":null!=r&&Fc("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(i(61));if(null!=(n=r.__html)){if(null!=o.children)throw Error(i(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"muted":e.muted=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==r||"function"==typeof r||"boolean"==typeof r||"symbol"==typeof r){e.removeAttribute("xlink:href");break}n=It(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":!0===r?e.setAttribute(n,""):!1!==r&&null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":null!=r&&"function"!=typeof r&&"symbol"!=typeof r&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":null==r||"function"==typeof r||"symbol"==typeof r||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Fc("beforetoggle",e),Fc("toggle",e),nt(e,"popover",r);break;case"xlinkActuate":it(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":it(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":it(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":it(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":it(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":it(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":it(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":it(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":it(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":nt(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])&&nt(e,n=Rt.get(n)||n,r)}}function ed(e,t,n,r,o,a){switch(n){case"style":Mt(e,r,a);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(i(61));if(null!=(n=r.__html)){if(null!=o.children)throw Error(i(60));e.innerHTML=n}}break;case"children":"string"==typeof r?kt(e,r):("number"==typeof r||"bigint"==typeof r)&&kt(e,""+r);break;case"onScroll":null!=r&&Fc("scroll",e);break;case"onScrollEnd":null!=r&&Fc("scrollend",e);break;case"onClick":null!=r&&(e.onclick=Zc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:Xe.hasOwnProperty(n)||("o"!==n[0]||"n"!==n[1]||(o=n.endsWith("Capture"),t=n.slice(2,o?n.length-7:void 0),"function"==typeof(a=null!=(a=e[ze]||null)?a[n]:null)&&e.removeEventListener(t,a,o),"function"!=typeof r)?n in e?e[n]=r:!0===r?e.setAttribute(n,""):nt(e,n,r):("function"!=typeof a&&null!==a&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,o)))}}function td(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fc("error",e),Fc("load",e);var r,o=!1,a=!1;for(r in n)if(n.hasOwnProperty(r)){var l=n[r];if(null!=l)switch(r){case"src":o=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Jc(e,t,r,l,n,null)}}return a&&Jc(e,t,"srcSet",n.srcSet,n,null),void(o&&Jc(e,t,"src",n.src,n,null));case"input":Fc("invalid",e);var s=r=l=a=null,u=null,c=null;for(o in n)if(n.hasOwnProperty(o)){var d=n[o];if(null!=d)switch(o){case"name":a=d;break;case"type":l=d;break;case"checked":u=d;break;case"defaultChecked":c=d;break;case"value":r=d;break;case"defaultValue":s=d;break;case"children":case"dangerouslySetInnerHTML":if(null!=d)throw Error(i(137,t));break;default:Jc(e,t,o,d,n,null)}}return xt(e,r,s,u,c,l,a,!1),void ft(e);case"select":for(a in Fc("invalid",e),o=l=r=null,n)if(n.hasOwnProperty(a)&&null!=(s=n[a]))switch(a){case"value":r=s;break;case"defaultValue":l=s;break;case"multiple":o=s;default:Jc(e,t,a,s,n,null)}return t=r,n=l,e.multiple=!!o,void(null!=t?bt(e,!!o,t,!1):null!=n&&bt(e,!!o,n,!0));case"textarea":for(l in Fc("invalid",e),r=a=o=null,n)if(n.hasOwnProperty(l)&&null!=(s=n[l]))switch(l){case"value":o=s;break;case"defaultValue":a=s;break;case"children":r=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(i(91));break;default:Jc(e,t,l,s,n,null)}return St(e,o,a,r),void ft(e);case"option":for(u in n)n.hasOwnProperty(u)&&null!=(o=n[u])&&("selected"===u?e.selected=o&&"function"!=typeof o&&"symbol"!=typeof o:Jc(e,t,u,o,n,null));return;case"dialog":Fc("beforetoggle",e),Fc("toggle",e),Fc("cancel",e),Fc("close",e);break;case"iframe":case"object":Fc("load",e);break;case"video":case"audio":for(o=0;o<Nc.length;o++)Fc(Nc[o],e);break;case"image":Fc("error",e),Fc("load",e);break;case"details":Fc("toggle",e);break;case"embed":case"source":case"link":Fc("error",e),Fc("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&null!=(o=n[c]))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Jc(e,t,c,o,n,null)}return;default:if(Tt(t)){for(d in n)n.hasOwnProperty(d)&&void 0!==(o=n[d])&&ed(e,t,d,o,n,void 0);return}}for(s in n)n.hasOwnProperty(s)&&null!=(o=n[s])&&Jc(e,t,s,o,n,null)}var nd=null,rd=null;function id(e){return 9===e.nodeType?e:e.ownerDocument}function od(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ad(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function ld(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"bigint"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var sd=null,ud="function"==typeof setTimeout?setTimeout:void 0,cd="function"==typeof clearTimeout?clearTimeout:void 0,dd="function"==typeof Promise?Promise:void 0,fd="function"==typeof queueMicrotask?queueMicrotask:typeof dd<"u"?function(e){return dd.resolve(null).then(e).catch(pd)}:ud;function pd(e){setTimeout(function(){throw e})}function hd(e){return"head"===e}function md(e,t){var n=t,r=0,i=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&8===o.nodeType)if("/$"===(n=o.data)){if(0<r&&8>r){n=r;var a=e.ownerDocument;if(1&n&&Sd(a.documentElement),2&n&&Sd(a.body),4&n)for(Sd(n=a.head),a=n.firstChild;a;){var l=a.nextSibling,s=a.nodeName;a[Oe]||"SCRIPT"===s||"STYLE"===s||"LINK"===s&&"stylesheet"===a.rel.toLowerCase()||n.removeChild(a),a=l}}if(0===i)return e.removeChild(o),void Af(t);i--}else"$"===n||"$?"===n||"$!"===n?i++:r=n.charCodeAt(0)-48;else r=0;n=o}while(n);Af(t)}function gd(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":gd(n),He(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function yd(e){return"$!"===e.data||"$?"===e.data&&"complete"===e.ownerDocument.readyState}function xd(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"F!"===t||"F"===t)break;if("/$"===t)return null}}return e}var vd=null;function bd(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}function wd(e,t,n){switch(t=id(n),e){case"html":if(!(e=t.documentElement))throw Error(i(452));return e;case"head":if(!(e=t.head))throw Error(i(453));return e;case"body":if(!(e=t.body))throw Error(i(454));return e;default:throw Error(i(451))}}function Sd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);He(e)}var kd=new Map,Cd=new Set;function Ed(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Md=_.d;_.d={f:function(){var e=Md.f(),t=Wu();return e||t},r:function(e){var t=Be(e);null!==t&&5===t.tag&&"form"===t.type?za(t):Md.r(e)},D:function(e){Md.D(e),Rd("dns-prefetch",e,null)},C:function(e,t){Md.C(e,t),Rd("preconnect",e,t)},L:function(e,t,n){Md.L(e,t,n);var r=Td;if(r&&e&&t){var i=\'link[rel="preload"][as="\'+gt(t)+\'"]\';"image"===t&&n&&n.imageSrcSet?(i+=\'[imagesrcset="\'+gt(n.imageSrcSet)+\'"]\',"string"==typeof n.imageSizes&&(i+=\'[imagesizes="\'+gt(n.imageSizes)+\'"]\')):i+=\'[href="\'+gt(e)+\'"]\';var o=i;switch(t){case"style":o=Id(e);break;case"script":o=Pd(e)}kd.has(o)||(e=c({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),kd.set(o,e),null!==r.querySelector(i)||"style"===t&&r.querySelector(jd(o))||"script"===t&&r.querySelector(zd(o))||(td(t=r.createElement("link"),"link",e),Ye(t),r.head.appendChild(t)))}},m:function(e,t){Md.m(e,t);var n=Td;if(n&&e){var r=t&&"string"==typeof t.as?t.as:"script",i=\'link[rel="modulepreload"][as="\'+gt(r)+\'"][href="\'+gt(e)+\'"]\',o=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Pd(e)}if(!kd.has(o)&&(e=c({rel:"modulepreload",href:e},t),kd.set(o,e),null===n.querySelector(i))){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(zd(o)))return}td(r=n.createElement("link"),"link",e),Ye(r),n.head.appendChild(r)}}},X:function(e,t){Md.X(e,t);var n=Td;if(n&&e){var r=qe(n).hoistableScripts,i=Pd(e),o=r.get(i);o||((o=n.querySelector(zd(i)))||(e=c({src:e,async:!0},t),(t=kd.get(i))&&Fd(e,t),Ye(o=n.createElement("script")),td(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(i,o))}},S:function(e,t,n){Md.S(e,t,n);var r=Td;if(r&&e){var i=qe(r).hoistableStyles,o=Id(e);t=t||"default";var a=i.get(o);if(!a){var l={loading:0,preload:null};if(a=r.querySelector(jd(o)))l.loading=5;else{e=c({rel:"stylesheet",href:e,"data-precedence":t},n),(n=kd.get(o))&&Dd(e,n);var s=a=r.createElement("link");Ye(s),td(s,"link",e),s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),s.addEventListener("load",function(){l.loading|=1}),s.addEventListener("error",function(){l.loading|=2}),l.loading|=4,_d(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(o,a)}}},M:function(e,t){Md.M(e,t);var n=Td;if(n&&e){var r=qe(n).hoistableScripts,i=Pd(e),o=r.get(i);o||((o=n.querySelector(zd(i)))||(e=c({src:e,async:!0,type:"module"},t),(t=kd.get(i))&&Fd(e,t),Ye(o=n.createElement("script")),td(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(i,o))}}};var Td=typeof document>"u"?null:document;function Rd(e,t,n){var r=Td;if(r&&"string"==typeof t&&t){var i=gt(t);i=\'link[rel="\'+e+\'"][href="\'+i+\'"]\',"string"==typeof n&&(i+=\'[crossorigin="\'+n+\'"]\'),Cd.has(i)||(Cd.add(i),e={rel:e,crossOrigin:n,href:t},null===r.querySelector(i)&&(td(t=r.createElement("link"),"link",e),Ye(t),r.head.appendChild(t)))}}function Ad(e,t,n,r){var o=(o=q.current)?Ed(o):null;if(!o)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=Id(n.href),(r=(n=qe(o).hoistableStyles).get(t))||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if("stylesheet"===n.rel&&"string"==typeof n.href&&"string"==typeof n.precedence){e=Id(n.href);var a=qe(o).hoistableStyles,l=a.get(e);if(l||(o=o.ownerDocument||o,l={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},a.set(e,l),(a=o.querySelector(jd(e)))&&!a._p&&(l.instance=a,l.state.loading=5),kd.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},kd.set(e,n),a||function(e,t,n,r){e.querySelector(\'link[rel="preload"][as="style"][\'+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),td(t,"link",n),Ye(t),e.head.appendChild(t))}(o,e,n,l.state))),t&&null===r)throw Error(i(528,""));return l}if(t&&null!==r)throw Error(i(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=Pd(n),(r=(n=qe(o).hoistableScripts).get(t))||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Id(e){return\'href="\'+gt(e)+\'"\'}function jd(e){return\'link[rel="stylesheet"][\'+e+"]"}function Ld(e){return c({},e,{"data-precedence":e.precedence,precedence:null})}function Pd(e){return\'[src="\'+gt(e)+\'"]\'}function zd(e){return"script[async]"+e}function Nd(e,t,n){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector(\'style[data-href~="\'+gt(n.href)+\'"]\');if(r)return t.instance=r,Ye(r),r;var o=c({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return Ye(r=(e.ownerDocument||e).createElement("style")),td(r,"style",o),_d(r,n.precedence,e),t.instance=r;case"stylesheet":o=Id(n.href);var a=e.querySelector(jd(o));if(a)return t.state.loading|=4,t.instance=a,Ye(a),a;r=Ld(n),(o=kd.get(o))&&Dd(r,o),Ye(a=(e.ownerDocument||e).createElement("link"));var l=a;return l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),td(a,"link",r),t.state.loading|=4,_d(a,n.precedence,e),t.instance=a;case"script":return a=Pd(n.src),(o=e.querySelector(zd(a)))?(t.instance=o,Ye(o),o):(r=n,(o=kd.get(a))&&Fd(r=c({},n),o),Ye(o=(e=e.ownerDocument||e).createElement("script")),td(o,"link",r),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(i(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,_d(r,n.precedence,e));return t.instance}function _d(e,t,n){for(var r=n.querySelectorAll(\'link[rel="stylesheet"][data-precedence],style[data-precedence]\'),i=r.length?r[r.length-1]:null,o=i,a=0;a<r.length;a++){var l=r[a];if(l.dataset.precedence===t)o=l;else if(o!==i)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=9===n.nodeType?n.head:n).insertBefore(e,t.firstChild)}function Dd(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function Fd(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var $d=null;function Od(e,t,n){if(null===$d){var r=new Map,i=$d=new Map;i.set(n,r)}else(r=(i=$d).get(n))||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var o=n[i];if(!(o[Oe]||o[Pe]||"link"===e&&"stylesheet"===o.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==o.namespaceURI){var a=o.getAttribute(t)||"";a=e+a;var l=r.get(a);l?l.push(o):r.set(a,[o])}}return r}function Hd(e,t,n){(e=e.ownerDocument||e).head.insertBefore(n,"title"===t?e.querySelector("head > title"):null)}function Wd(e){return!("stylesheet"===e.type&&!(3&e.state.loading))}var Bd=null;function Vd(){}function qd(){if(this.count--,0===this.count)if(this.stylesheets)Ud(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var Yd=null;function Ud(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,Yd=new Map,t.forEach(Xd,e),Yd=null,qd.call(e))}function Xd(e,t){if(!(4&t.state.loading)){var n=Yd.get(e);if(n)var r=n.get(null);else{n=new Map,Yd.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<i.length;o++){var a=i[o];("LINK"===a.nodeName||"not all"!==a.getAttribute("media"))&&(n.set(a.dataset.precedence,a),r=a)}r&&n.set(null,r)}a=(i=t.instance).getAttribute("data-precedence"),(o=n.get(a)||r)===r&&n.set(null,i),n.set(a,i),this.count++,r=qd.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),o?o.parentNode.insertBefore(i,o.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(i,e.firstChild),t.state.loading|=4}}var Kd={$$typeof:S,Provider:null,Consumer:null,_currentValue:D,_currentValue2:D,_threadCount:0};function Qd(e,t,n,r,i,o,a,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ee(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ee(0),this.hiddenUpdates=Ee(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=o,this.onRecoverableError=a,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function Gd(e,t,n,r,i,o,a,l,s,u,c,d){return e=new Qd(e,t,n,a,l,s,u,d),t=1,!0===o&&(t|=24),o=Dr(3,null,null,t),e.current=o,o.stateNode=e,(t=zi()).refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:r,isDehydrated:n,cache:t},ro(o),e}function Zd(e){return e?e=Nr:Nr}function Jd(e,t,n,r,i,o){i=Zd(i),null===r.context?r.context=i:r.pendingContext=i,(r=oo(t)).payload={element:n},null!==(o=void 0===o?null:o)&&(r.callback=o),null!==(n=ao(e,r,t))&&(Du(n,0,t),lo(n,e,t))}function ef(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function tf(e,t){ef(e,t),(e=e.alternate)&&ef(e,t)}function nf(e){if(13===e.tag){var t=Lr(e,67108864);null!==t&&Du(t,0,67108864),tf(e,67108864)}}var rf=!0;function of(e,t,n,r){var i=N.T;N.T=null;var o=_.p;try{_.p=2,lf(e,t,n,r)}finally{_.p=o,N.T=i}}function af(e,t,n,r){var i=N.T;N.T=null;var o=_.p;try{_.p=8,lf(e,t,n,r)}finally{_.p=o,N.T=i}}function lf(e,t,n,r){if(rf){var i=sf(r);if(null===i)Bc(e,t,r,uf,n),bf(e,r);else if(function(e,t,n,r,i){switch(t){case"focusin":return pf=wf(pf,e,t,n,r,i),!0;case"dragenter":return hf=wf(hf,e,t,n,r,i),!0;case"mouseover":return mf=wf(mf,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return gf.set(o,wf(gf.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,yf.set(o,wf(yf.get(o)||null,e,t,n,r,i)),!0}return!1}(i,e,t,n,r))r.stopPropagation();else if(bf(e,r),4&t&&-1<vf.indexOf(e)){for(;null!==i;){var o=Be(i);if(null!==o)switch(o.tag){case 3:if((o=o.stateNode).current.memoizedState.isDehydrated){var a=ve(o.pendingLanes);if(0!==a){var l=o;for(l.pendingLanes|=2,l.entangledLanes|=2;a;){var s=1<<31-he(a);l.entanglements[1]|=s,a&=~s}Ec(o),!(6&ru)&&(ku=ne()+500,Mc(0,!1))}}break;case 13:null!==(l=Lr(o,2))&&Du(l,0,2),Wu(),tf(o,2)}if(null===(o=sf(r))&&Bc(e,t,r,uf,n),o===i)break;i=o}null!==i&&r.stopPropagation()}else Bc(e,t,r,null,n)}}function sf(e){return cf(e=Lt(e))}var uf=null;function cf(e){if(uf=null,null!==(e=We(e))){var t=a(e);if(null===t)e=null;else{var n=t.tag;if(13===n){if(null!==(e=l(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return uf=e,null}function df(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(re()){case ie:return 2;case oe:return 8;case ae:case le:return 32;case se:return 268435456;default:return 32}default:return 32}}var ff=!1,pf=null,hf=null,mf=null,gf=new Map,yf=new Map,xf=[],vf="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function bf(e,t){switch(e){case"focusin":case"focusout":pf=null;break;case"dragenter":case"dragleave":hf=null;break;case"mouseover":case"mouseout":mf=null;break;case"pointerover":case"pointerout":gf.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":yf.delete(t.pointerId)}}function wf(e,t,n,r,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},null!==t&&null!==(t=Be(t))&&nf(t),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Sf(e){var t=We(e.target);if(null!==t){var n=a(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=l(n)))return e.blockedOn=t,void function(e,t){var n=_.p;try{return _.p=e,t()}finally{_.p=n}}(e.priority,function(){if(13===n.tag){var e=Nu();e=Ae(e);var t=Lr(n,e);null!==t&&Du(t,0,e),tf(n,e)}})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function kf(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=sf(e.nativeEvent);if(null!==n)return null!==(t=Be(n))&&nf(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);jt=r,n.target.dispatchEvent(r),jt=null,t.shift()}return!0}function Cf(e,t,n){kf(e)&&n.delete(t)}function Ef(){ff=!1,null!==pf&&kf(pf)&&(pf=null),null!==hf&&kf(hf)&&(hf=null),null!==mf&&kf(mf)&&(mf=null),gf.forEach(Cf),yf.forEach(Cf)}function Mf(e,n){e.blockedOn===n&&(e.blockedOn=null,ff||(ff=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ef)))}var Tf=null;function Rf(e){Tf!==e&&(Tf=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Tf===e&&(Tf=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if("function"!=typeof r){if(null===cf(r||n))continue;break}var o=Be(n);null!==o&&(e.splice(t,3),t-=3,La(o,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Af(e){function t(t){return Mf(t,e)}null!==pf&&Mf(pf,e),null!==hf&&Mf(hf,e),null!==mf&&Mf(mf,e),gf.forEach(t),yf.forEach(t);for(var n=0;n<xf.length;n++){var r=xf[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xf.length&&null===(n=xf[0]).blockedOn;)Sf(n),null===n.blockedOn&&xf.shift();if(null!=(n=(e.ownerDocument||e).$$reactFormReplay))for(r=0;r<n.length;r+=3){var i=n[r],o=n[r+1],a=i[ze]||null;if("function"==typeof o)a||Rf(n);else if(a){var l=null;if(o&&o.hasAttribute("formAction")){if(i=o,a=o[ze]||null)l=a.formAction;else if(null!==cf(i))continue}else l=a.action;"function"==typeof l?n[r+1]=l:(n.splice(r,3),r-=3),Rf(n)}}}function If(e){this._internalRoot=e}function jf(e){this._internalRoot=e}jf.prototype.render=If.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(i(409));Jd(t.current,Nu(),e,t,null,null)},jf.prototype.unmount=If.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Jd(e.current,2,null,e,null,null),Wu(),t[Ne]=null}},jf.prototype.unstable_scheduleHydration=function(e){if(e){var t=je();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xf.length&&0!==t&&t<xf[n].priority;n++);xf.splice(n,0,e),0===n&&Sf(e)}};var Lf=n.version;if("19.1.0"!==Lf)throw Error(i(527,Lf,"19.1.0"));_.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t)throw"function"==typeof e.render?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=function(e){var t=e.alternate;if(!t){if(null===(t=a(e)))throw Error(i(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(null===o)break;var l=o.alternate;if(null===l){if(null!==(r=o.return)){n=r;continue}break}if(o.child===l.child){for(l=o.child;l;){if(l===n)return s(o),e;if(l===r)return s(o),t;l=l.sibling}throw Error(i(188))}if(n.return!==r.return)n=o,r=l;else{for(var u=!1,c=o.child;c;){if(c===n){u=!0,n=o,r=l;break}if(c===r){u=!0,r=o,n=l;break}c=c.sibling}if(!u){for(c=l.child;c;){if(c===n){u=!0,n=l,r=o;break}if(c===r){u=!0,r=l,n=o;break}c=c.sibling}if(!u)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(3!==n.tag)throw Error(i(188));return n.stateNode.current===n?e:t}(t),null===(e=null!==e?u(e):null)?null:e.stateNode};var Pf,zf={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&!(Pf=__REACT_DEVTOOLS_GLOBAL_HOOK__).isDisabled&&Pf.supportsFiber)try{de=Pf.inject(zf),fe=Pf}catch{}e.createRoot=function(e,t){if(!o(e))throw Error(i(299));var n=!1,r="",a=vl,l=bl,s=wl;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onUncaughtError&&(a=t.onUncaughtError),void 0!==t.onCaughtError&&(l=t.onCaughtError),void 0!==t.onRecoverableError&&(s=t.onRecoverableError),void 0!==t.unstable_transitionCallbacks&&t.unstable_transitionCallbacks),t=Gd(e,1,!1,null,0,n,r,a,l,s,0,null),e[Ne]=t.current,Hc(e),new If(t)},e.hydrateRoot=function(e,t,n){if(!o(e))throw Error(i(299));var r=!1,a="",l=vl,s=bl,u=wl,c=null;return null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(a=n.identifierPrefix),void 0!==n.onUncaughtError&&(l=n.onUncaughtError),void 0!==n.onCaughtError&&(s=n.onCaughtError),void 0!==n.onRecoverableError&&(u=n.onRecoverableError),void 0!==n.unstable_transitionCallbacks&&n.unstable_transitionCallbacks,void 0!==n.formState&&(c=n.formState)),(t=Gd(e,1,!0,t,0,r,a,l,s,u,0,c)).context=Zd(null),n=t.current,(a=oo(r=Ae(r=Nu()))).callback=null,ao(n,a,r),n=r,t.current.lanes=n,Me(t,n),Ec(t),e[Ne]=t.current,Hc(e),new jf(t)},e.version="19.1.0"}),y=s((e,t)=>{(function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||"function"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}})(),t.exports=g()}),x=s(e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(e,n,r){var i=null;if(void 0!==r&&(i=""+r),void 0!==n.key&&(i=""+n.key),"key"in n)for(var o in r={},n)"key"!==o&&(r[o]=n[o]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:void 0!==n?n:null,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r}),v=s((e,t)=>{t.exports=x()}),b=l(()=>{e="/popmelt/phone"});function w(e){try{let t=new URL(e),n=S.get(t.origin);return n?.pathPrefix?("string"==typeof n.pathPrefix?[n.pathPrefix]:n.pathPrefix).some(e=>e.endsWith("/")?t.pathname.startsWith(e):t.pathname===e)?n:void 0:n}catch{return}}var S,k=l(()=>{b(),S=new Map}),C=s(()=>{}),E=s(()=>{}),M=u(d()),T=u(y()),R=u(d()),A=u(d()),I=u(v());function j(e,t){return(0,A.forwardRef)(function({size:n=24,width:r=n,height:i=n,color:o="currentColor",className:a,children:l,...s},u){let c=!!l||Object.keys(s).some(e=>e.startsWith("aria-")||"role"===e||"title"===e);return(0,I.jsxs)("svg",{ref:u,xmlns:"http://www.w3.org/2000/svg",width:r,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:a?`lucide ${e} ${a}`:`lucide ${e}`,"aria-hidden":!c||void 0,...s,children:[t,l]})})}var L=j("lucide-a-large-small",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),(0,I.jsx)("path",{d:"M15.697 14h5.606"}),(0,I.jsx)("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),(0,I.jsx)("path",{d:"M3.304 13h6.392"})]})),P=j("lucide-text-align-center lucide-align-center",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M21 5H3"}),(0,I.jsx)("path",{d:"M17 12H7"}),(0,I.jsx)("path",{d:"M19 19H5"})]})),z=j("lucide-align-center-vertical",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M12 2v20"}),(0,I.jsx)("path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4"}),(0,I.jsx)("path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4"}),(0,I.jsx)("path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1"}),(0,I.jsx)("path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1"})]})),N=j("lucide-align-end-vertical",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"16",height:"6",x:"2",y:"4",rx:"2"}),(0,I.jsx)("rect",{width:"9",height:"6",x:"9",y:"14",rx:"2"}),(0,I.jsx)("path",{d:"M22 22V2"})]})),_=j("lucide-align-horizontal-justify-center",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"6",height:"14",x:"2",y:"5",rx:"2"}),(0,I.jsx)("rect",{width:"6",height:"10",x:"16",y:"7",rx:"2"}),(0,I.jsx)("path",{d:"M12 2v20"})]})),D=j("lucide-align-horizontal-justify-end",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"6",height:"14",x:"2",y:"5",rx:"2"}),(0,I.jsx)("rect",{width:"6",height:"10",x:"12",y:"7",rx:"2"}),(0,I.jsx)("path",{d:"M22 2v20"})]})),F=j("lucide-align-horizontal-justify-start",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"6",height:"14",x:"6",y:"5",rx:"2"}),(0,I.jsx)("rect",{width:"6",height:"10",x:"16",y:"7",rx:"2"}),(0,I.jsx)("path",{d:"M2 2v20"})]})),$=j("lucide-align-horizontal-space-around",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"6",height:"10",x:"9",y:"7",rx:"2"}),(0,I.jsx)("path",{d:"M4 22V2"}),(0,I.jsx)("path",{d:"M20 22V2"})]})),O=j("lucide-align-horizontal-space-between",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"6",height:"14",x:"3",y:"5",rx:"2"}),(0,I.jsx)("rect",{width:"6",height:"10",x:"15",y:"7",rx:"2"}),(0,I.jsx)("path",{d:"M3 2v20"}),(0,I.jsx)("path",{d:"M21 2v20"})]})),H=j("lucide-text-align-justify lucide-align-justify",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M3 5h18"}),(0,I.jsx)("path",{d:"M3 12h18"}),(0,I.jsx)("path",{d:"M3 19h18"})]})),W=j("lucide-text-align-start lucide-text lucide-align-left",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M21 5H3"}),(0,I.jsx)("path",{d:"M15 12H3"}),(0,I.jsx)("path",{d:"M17 19H3"})]})),B=j("lucide-text-align-end lucide-align-right",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M21 5H3"}),(0,I.jsx)("path",{d:"M21 12H9"}),(0,I.jsx)("path",{d:"M21 19H7"})]})),V=j("lucide-align-start-vertical",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"9",height:"6",x:"6",y:"14",rx:"2"}),(0,I.jsx)("rect",{width:"16",height:"6",x:"6",y:"4",rx:"2"}),(0,I.jsx)("path",{d:"M2 2v20"})]})),q=j("lucide-between-horizontal-start lucide-between-horizonal-start",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"13",height:"7",x:"8",y:"3",rx:"1"}),(0,I.jsx)("path",{d:"m2 9 3 3-3 3"}),(0,I.jsx)("rect",{width:"13",height:"7",x:"8",y:"14",rx:"1"})]})),Y=j("lucide-between-vertical-end",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"7",height:"13",x:"3",y:"3",rx:"1"}),(0,I.jsx)("path",{d:"m9 22 3-3 3 3"}),(0,I.jsx)("rect",{width:"7",height:"13",x:"14",y:"3",rx:"1"})]})),U=j("lucide-blend",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("circle",{cx:"15",cy:"9",r:"7"}),(0,I.jsx)("circle",{cx:"9",cy:"15",r:"7"})]})),X=j("lucide-letter-b lucide-bold",(0,I.jsx)("path",{d:"M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8"})),K=j("lucide-check",(0,I.jsx)("path",{d:"M20 6 9 17l-5-5"})),Q=j("lucide-circle-dashed",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}),(0,I.jsx)("path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}),(0,I.jsx)("path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}),(0,I.jsx)("path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}),(0,I.jsx)("path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}),(0,I.jsx)("path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}),(0,I.jsx)("path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}),(0,I.jsx)("path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"})]})),G=j("lucide-clock",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,I.jsx)("path",{d:"M12 6v6l4 2"})]})),Z=j("lucide-command",(0,I.jsx)("path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"})),J=j("lucide-corner-down-left",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M20 4v7a4 4 0 0 1-4 4H4"}),(0,I.jsx)("path",{d:"m9 10-5 5 5 5"})]})),ee=j("lucide-eye",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,I.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})),te=j("lucide-image",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,I.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,I.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})),ne=j("lucide-message-circle-question-mark lucide-message-circle-question",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}),(0,I.jsx)("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),(0,I.jsx)("path",{d:"M12 17h.01"})]})),re=j("lucide-minimize-2",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"m14 10 7-7"}),(0,I.jsx)("path",{d:"M20 10h-6V4"}),(0,I.jsx)("path",{d:"m3 21 7-7"}),(0,I.jsx)("path",{d:"M4 14h6v6"})]})),ie=j("lucide-minus",(0,I.jsx)("path",{d:"M5 12h14"})),oe=j("lucide-move",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M12 2v20"}),(0,I.jsx)("path",{d:"m15 19-3 3-3-3"}),(0,I.jsx)("path",{d:"m19 9 3 3-3 3"}),(0,I.jsx)("path",{d:"M2 12h20"}),(0,I.jsx)("path",{d:"m5 9-3 3 3 3"}),(0,I.jsx)("path",{d:"m9 5 3-3 3 3"})]})),ae=j("lucide-move-horizontal",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"m18 8 4 4-4 4"}),(0,I.jsx)("path",{d:"M2 12h20"}),(0,I.jsx)("path",{d:"m6 8-4 4 4 4"})]})),le=j("lucide-move-vertical",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M12 2v20"}),(0,I.jsx)("path",{d:"m8 18 4 4 4-4"}),(0,I.jsx)("path",{d:"m8 6 4-4 4 4"})]})),se=j("lucide-octagon-alert lucide-alert-octagon",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M12 16h.01"}),(0,I.jsx)("path",{d:"M12 8v4"}),(0,I.jsx)("path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"})]})),ue=j("lucide-palette",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}),(0,I.jsx)("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),(0,I.jsx)("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),(0,I.jsx)("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),(0,I.jsx)("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"})]})),ce=j("lucide-plus",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M5 12h14"}),(0,I.jsx)("path",{d:"M12 5v14"})]})),de=j("lucide-reply",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"}),(0,I.jsx)("path",{d:"m9 17-5-5 5-5"})]})),fe=j("lucide-rotate-cw",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),(0,I.jsx)("path",{d:"M21 3v5h-5"})]})),pe=j("lucide-scaling",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,I.jsx)("path",{d:"M14 15H9v-5"}),(0,I.jsx)("path",{d:"M16 3h5v5"}),(0,I.jsx)("path",{d:"M21 3 9 15"})]})),he=j("lucide-send-horizontal lucide-send-horizonal",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z"}),(0,I.jsx)("path",{d:"M6 12h16"})]})),me=j("lucide-sliders-horizontal",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M10 5H3"}),(0,I.jsx)("path",{d:"M12 19H3"}),(0,I.jsx)("path",{d:"M14 3v4"}),(0,I.jsx)("path",{d:"M16 17v4"}),(0,I.jsx)("path",{d:"M21 12h-9"}),(0,I.jsx)("path",{d:"M21 19h-5"}),(0,I.jsx)("path",{d:"M21 5h-7"}),(0,I.jsx)("path",{d:"M8 10v4"}),(0,I.jsx)("path",{d:"M8 12H3"})]})),ge=j("lucide-stretch-horizontal",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("rect",{width:"20",height:"6",x:"2",y:"4",rx:"2"}),(0,I.jsx)("rect",{width:"20",height:"6",x:"2",y:"14",rx:"2"})]})),ye=j("lucide-triangle-alert lucide-alert-triangle",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),(0,I.jsx)("path",{d:"M12 9v4"}),(0,I.jsx)("path",{d:"M12 17h.01"})]})),xe=j("lucide-x",(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("path",{d:"M18 6 6 18"}),(0,I.jsx)("path",{d:"m6 6 12 12"})]})),ve=300,be={key:"z",commandOrControl:!0},we=u(d());async function Se(e,t){await ke(`${e}/draft-attachments/${encodeURIComponent(t)}`,{method:"DELETE"},5e3)}function ke(t,n={},r=15e3){let i=new AbortController;n.signal&&n.signal.addEventListener("abort",()=>i.abort());let o=setTimeout(()=>i.abort(),r);return function(t,n={}){return function(t,n){let r=function(e,t){let n=w(e);if(!n)return t;let r=new Headers(t.headers);for(let[e,t]of Object.entries(n.headers))r.set(e,t);return{...t,headers:r,redirect:"error",credentials:"omit"}}(t,n);if(w(t)?.phone){let n=new URL(t),i=new Headers(r.headers);return i.set("X-Popmelt-Phone-Route",n.pathname.slice(e.length)+n.search),fetch(n.origin+e,{...r,headers:i,cache:"no-store"})}return fetch(t,r)}(t,function(e={}){let t=typeof window<"u"?window.__POPMELT_PROJECT_ID__??null:null;if(!t)return e;let n=new Headers(e.headers);return n.set("X-Popmelt-Project-Id",t),{...e,headers:n}}(n))}(t,{...n,signal:i.signal}).finally(()=>clearTimeout(o))}async function Ce(e,t){try{let n=await ke(`${e}/ui-preferences`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:t})},5e3);return n.ok?await n.json():null}catch{return null}}k();var Ee="devtools-toolbar-theme",Me="popmelt-theme-change",Te="popmelt-theme-project-change",Re="(prefers-color-scheme: dark)",Ae={light:{surface:"#eaeaea",border:"#dddddd",control:"#dddddd",primary:"#222222",threadPrimary:"#222222",secondary:"#777777",muted:"#aaaaaa",mutedStrong:"#888888",hoverSurface:"#dddddd",hoverForeground:"#333333",raisedSurface:"#ffffff",softSurface:"#f5f5f5",actionSurface:"#222222",actionForeground:"#eeeeee",actionHover:"#000000",hairline:"rgba(0,0,0,0.1)",softHairline:"rgba(0,0,0,0.06)",scrollbarIdle:"rgba(34,34,34,0.2)",scrollbarHover:"rgba(34,34,34,0.5)",logoFilter:"none"},dark:{surface:"#111111",border:"#222222",control:"#222222",primary:"#dddddd",threadPrimary:"#aaaaaa",secondary:"#777777",muted:"#555555",mutedStrong:"#777777",hoverSurface:"#222222",hoverForeground:"#dddddd",raisedSurface:"#181818",softSurface:"#181818",actionSurface:"#dddddd",actionForeground:"#222222",actionHover:"#ffffff",hairline:"rgba(255,255,255,0.1)",softHairline:"rgba(255,255,255,0.06)",scrollbarIdle:"rgba(221,221,221,0.2)",scrollbarHover:"rgba(221,221,221,0.5)",logoFilter:"invert(1)"}};function Ie(e){return"light"===e||"dark"===e?e:"auto"}function je(){if(typeof window>"u")return{exists:!1,preference:"auto"};let e,t=De(window.__POPMELT_PROJECT_ID__);try{e=window.localStorage.getItem(t)}catch{let e=document.documentElement.style.colorScheme;return{exists:!1,preference:"dark"===e||"light"===e?e:"auto"}}if(null!==e)return{exists:!0,preference:Ie(e)};let n=window.__POPMELT_PROJECT_ID__;if(n){let e=De(void 0),r=window.localStorage.getItem(e);if(null!==r){let i=Ie(r);window.localStorage.setItem(t,i),window.localStorage.removeItem(e);let o=Fe(void 0);return null!==window.localStorage.getItem(o)&&(window.localStorage.setItem(Fe(n),i),window.localStorage.removeItem(o)),{exists:!0,preference:i}}}let r=window.localStorage.getItem(Ee);if(null!==r){let e=Ie(r);return window.__POPMELT_PROJECT_ID__&&(window.localStorage.setItem(t,e),window.localStorage.removeItem(Ee)),{exists:!0,preference:e}}return{exists:!1,preference:"auto"}}function Le(){return je().preference}function Pe(e,t,n){if(typeof window>"u")return;window.localStorage.setItem(De(t),e);let r=Fe(t);n?window.localStorage.setItem(r,e):window.localStorage.removeItem(r)}function ze(){return typeof window>"u"?"auto:light":`${Le()}:${window.matchMedia(Re).matches?"dark":"light"}`}function Ne(e){if(typeof window>"u")return()=>{};let t=t=>{let n=De(window.__POPMELT_PROJECT_ID__);(t.key===n||t.key===Ee)&&e()},n=window.matchMedia(Re),r=()=>e();return window.addEventListener("storage",t),window.addEventListener(Me,e),window.addEventListener(Te,e),n.addEventListener("change",r),()=>{window.removeEventListener("storage",t),window.removeEventListener(Me,e),window.removeEventListener(Te,e),n.removeEventListener("change",r)}}function _e(e){let t=(0,we.useSyncExternalStore)(Ne,ze,()=>"auto:light"),[n,r]=t.split(":"),i=function(e,t){return"auto"===e?t?"dark":"light":e}(n,"dark"===r),o=typeof window<"u"?window.__POPMELT_PROJECT_ID__:void 0;return(0,we.useEffect)(()=>{if(!e||!o)return;let t=!1;return(async()=>{let n=Fe(o),r=window.localStorage.getItem(n);if(null!==r){let n=Ie(r),i=await Ce(e,n);return void(!t&&i&&(Pe(i.preferences.theme,o,!1),window.dispatchEvent(new Event(Me))))}let i=await async function(e="http://localhost:1111"){try{let t=await ke(`${e}/ui-preferences`,{},5e3);return t.ok?await t.json():null}catch{return null}}(e);if(t||!i)return;let a=je();if(!i.exists&&a.exists){let n=await Ce(e,a.preference);return void(!t&&n&&(Pe(n.preferences.theme,o,!1),window.dispatchEvent(new Event(Me))))}Pe(i.preferences.theme,o,!1),window.dispatchEvent(new Event(Me))})(),()=>{t=!0}},[e,o]),[i,(0,we.useCallback)(t=>{typeof window>"u"||Le()===t||(Pe(t,o,!(!e||!o)),window.dispatchEvent(new Event(Me)),e&&o&&Ce(e,t).then(e=>{e&&(Pe(e.preferences.theme,o,!1),window.dispatchEvent(new Event(Me)))}))},[e,o]),n]}function De(e){let t=e?.trim()||"default";return`${Ee}:${t}`}function Fe(e){return`${De(e)}:pending-sync`}var $e=u(C()),Oe=u(E()),He=\'"Popmelt Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif\',We=\'"Popmelt Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace\';Oe.default,$e.default,u(v());var Be=u(d());function Ve(e){let t=()=>typeof window>"u"?void 0:window.matchMedia?.(e);return{matches:()=>!!t()?.matches,subscribe:function(e){let n=t();return n?.addEventListener?.("change",e),()=>n?.removeEventListener?.("change",e)}}}var qe=Ve("(any-pointer: coarse) and (not (any-pointer: fine))"),Ye=Ve("(max-width: 480px), (pointer: coarse)"),Ue=()=>!1,Xe=(qe.matches,{explore:"/explore"});var Ke=u(m()),Qe=[4,2],Ge=Qe.join(" "),Ze=Qe[0]+Qe[1];function Je(e){if(typeof document<"u"&&e===document)return null;try{let t=e.defaultView?.frameElement;return"iframe"===t?.localName?t:null}catch{return null}}function et(e){if("iframe"!==e.localName||e.closest("[data-devtools],[data-popmelt-peer-surface]"))return null;try{let t=e.contentDocument;return t?.documentElement?t:null}catch{return null}}function tt(e){let t=e.getBoundingClientRect(),n=e.offsetWidth?t.width/e.offsetWidth:1,r=e.offsetHeight?t.height/e.offsetHeight:1;return{x:t.left+e.clientLeft*n,y:t.top+e.clientTop*r,sx:n,sy:r}}function nt(e,t){let{left:n,top:r,width:i,height:o}=e,a=Je(t);for(;a;){let e=tt(a);n=e.x+n*e.sx,r=e.y+r*e.sy,i*=e.sx,o*=e.sy,a=Je(a.ownerDocument)}return new DOMRect(n,r,i,o)}function rt(e){return nt(e.getBoundingClientRect(),e.ownerDocument)}function it(e,t,n){let r=[],i=Je(n);for(;i;)r.unshift(i),i=Je(i.ownerDocument);for(let n of r){let r=tt(n);e=(e-r.x)/r.sx,t=(t-r.y)/r.sy}return{x:e,y:t}}function ot(e){return e.ownerDocument.defaultView??window}function at(e,t=document){if(e===t)return!0;let n=Je(e);return!(!n?.isConnected||n.contentDocument!==e||!at(n.ownerDocument,t))}function lt(e,t){if(!at(t))return new DOMRect(0,0,0,0);let n=e.left,r=e.top,i=e.right,o=e.bottom;for(let e=Je(t);e;e=Je(e.ownerDocument)){let t=nt({left:0,top:0,width:e.clientWidth,height:e.clientHeight},e.contentDocument);n=Math.max(n,t.left),r=Math.max(r,t.top),i=Math.min(i,t.right),o=Math.min(o,t.bottom)}return new DOMRect(n,r,Math.max(0,i-n),Math.max(0,o-r))}var st="@frame(";function ut(e){if(!e.startsWith(st))return null;let t=e.indexOf(") ");if(t<0)return null;try{let n=JSON.parse(decodeURIComponent(e.slice(7,t)));return"string"!=typeof n.selector||"string"!=typeof n.url?null:{...n,rest:e.slice(t+2)}}catch{return null}}var ct=" >>> ";function dt(e){return Array.from(e.querySelectorAll("*")).flatMap(e=>e.shadowRoot?[e.shadowRoot]:[])}function ft(e=document){let t=[e];for(let e of t)t.push(...dt(e));return t}function pt(e,t=document){if(e.startsWith(st)){let n=ut(e);if(!n)return null;let r=n.selector.startsWith(st)||n.selector.includes(ct)?[pt(n.selector,t)].filter(e=>!!e):ft(t).flatMap(e=>Array.from(e.querySelectorAll(n.selector))),i=1===r.length?r[0]:null,o=i&&et(i);return o&&o.URL===n.url?pt(n.rest,o):null}let n=e.split(ct);if(n.length>1){let e=t,r=null;for(let t=0;t<n.length;t+=1){if(r=e.querySelector(n[t]),!r)return null;if(t<n.length-1){if(!r.shadowRoot)return null;e=r.shadowRoot}}return r}let r=[t];for(let t of r){let n=t.querySelector(e);if(n)return n;r.push(...dt(t))}return null}function ht(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return"host"in t?t.host:null}function mt(e,t){return t.startsWith(st)||t.includes(ct)?pt(t)===e:e.matches(t)}function gt(e,t){let n=e;for(;n;){if(n.matches(t))return n;n=ht(n)}return null}function yt(e,t){let n=t;for(;n;){if(n===e)return!0;n=ht(n)}return!1}var xt=new WeakMap;function vt(e){let t=e.getAttribute("style");return e.style.setProperty("pointer-events","auto","important"),()=>{null===t?e.removeAttribute("style"):e.setAttribute("style",t)}}function bt(e,t,n,r=e=>[e],i){let o=[];for(let r of e.querySelectorAll("iframe")){if(!et(r))continue;let e=r.getBoundingClientRect();t<e.left||t>e.right||n<e.top||n>e.bottom||"none"===r.ownerDocument.defaultView?.getComputedStyle(r).pointerEvents&&o.push(vt(r))}try{let o=()=>{let r="function"==typeof e.elementsFromPoint?e.elementsFromPoint(t,n):[],i=e.elementFromPoint?.(t,n)??null;return(i&&!r.includes(i)?[i,...r]:r).filter(t=>9===e.nodeType||t.getRootNode()===e)},a=o(),l=a;if(i){let t=function(e){let t=9===e.nodeType?e:e.ownerDocument,n="* { pointer-events: auto !important; }",r=[];try{let i=t.defaultView?.CSSStyleSheet;if(i?.prototype.replaceSync&&"adoptedStyleSheets"in e){let o=xt.get(t);o||(o=new i,o.replaceSync(n),xt.set(t,o));let a=[...e.adoptedStyleSheets];e.adoptedStyleSheets=[...a,o],r.push(()=>{e.adoptedStyleSheets=a})}else{let i=t.createElement("style");i.textContent=n,(9===e.nodeType?t.head??t.documentElement:e).appendChild(i),r.push(()=>i.remove())}for(let t of e.querySelectorAll(\'[style*="pointer-events"]\'))"none"!==t.style.getPropertyValue("pointer-events")||"important"!==t.style.getPropertyPriority("pointer-events")||r.push(vt(t))}catch(e){throw r.reverse().forEach(e=>e()),e}return()=>r.reverse().forEach(e=>e())}(e);try{l=o()}finally{t()}l=l.filter(e=>a.includes(e)||i(e))}return l.flatMap(r)}finally{o.forEach(e=>e())}}function wt(e,t,n=document,r){let i=[],o=new Set,a=9===n.nodeType?n:n.ownerDocument,l=it(e,t,a);for(let a of ft(n).reverse())for(let n of bt(a,l.x,l.y,n=>{let i=et(n);return i?[...wt(e,t,i,r),n]:[n]},r))o.has(n)||(o.add(n),i.push(n));return i}function St(){return ct}var kt=u(d()),Ct=(0,u(d()).createContext)(!0),Et=u(d());function Mt(e){return function(){let e=window.__POPMELT_PATH_PATCH__;if(e)return void(e.subscribers+=1);let t=window.history.pushState,n=window.history.replaceState,r=e=>{window.dispatchEvent(new CustomEvent("popmelt:locationchange",{detail:{prevPath:e}}))},i=function(e,n,i){let o=window.location.pathname;t.call(window.history,e,n,i),r(o)},o=function(e,t,i){let o=window.location.pathname;n.call(window.history,e,t,i),r(o)};window.history.pushState=i,window.history.replaceState=o,window.__POPMELT_PATH_PATCH__={subscribers:1,originalPushState:t,originalReplaceState:n,wrappedPushState:i,wrappedReplaceState:o}}(),window.addEventListener("popstate",e),window.addEventListener("popmelt:locationchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("popmelt:locationchange",e),function(){let e=window.__POPMELT_PATH_PATCH__;e&&(e.subscribers-=1,!(e.subscribers>0)&&(window.history.pushState===e.wrappedPushState&&(window.history.pushState=e.originalPushState),window.history.replaceState===e.wrappedReplaceState&&(window.history.replaceState=e.originalReplaceState),delete window.__POPMELT_PATH_PATCH__))}()}}function Tt(){return window.location.pathname}function Rt(){return(0,Et.useSyncExternalStore)(Mt,Tt,()=>"/")}var At=["id","data-testid","data-test","data-cy","data-popmelt-media-id","aria-label","name","href"],It=e=>e.replace(/\\s+/g," ").trim();function jt(e){return"id"===e||"data-popmelt-media-id"===e||/^data-(?:testid|test|cy)(?:-[a-z0-9_-]+)?$/.test(e)}function Lt(e,t){return!(!(t&&t.length<=200)||"id"===e&&/^(radix-|:|_r_)/.test(t))}function Pt(e){let t={},n=new Set([...At,...e.getAttributeNames().filter(jt)]);for(let r of n){let n=e.getAttribute(r);n&&Lt(r,n)&&(t[r]=n)}let r=It(e.querySelector("h1,h2,h3,h4,h5,h6")?.textContent??""),i=It(Array.from(e.childNodes).filter(e=>3===e.nodeType).map(e=>e.textContent).join(" "));return{tag:e.tagName.toLowerCase(),...Object.keys(t).length?{attributes:t}:{},...r&&r.length<=200?{heading:r}:{},...i&&i.length<=200?{text:i}:{}}}function zt(e,t,n=document){let r=ft(n),i=e=>{try{return r.flatMap(t=>Array.from(t.querySelectorAll(e)))}catch{return[]}},o=!(!t||!(t.heading||t.text||Object.keys(t.attributes??{}).length)),a=e=>{if(!t||!o)return!0;let n=Pt(e);return n.tag===t.tag&&(!t.heading||n.heading===t.heading)&&(!t.text||n.text===t.text)&&Object.entries(t.attributes??{}).every(([t,n])=>e.getAttribute(t)===n)};for(let r of e){if(r.includes(" >>> ")||r.startsWith("@frame(")){try{let e=pt(r,n),i=ut(r),o=Object.entries(t?.attributes??{}).filter(([e])=>jt(e)),l=i&&e&&(i.rest.startsWith("[data-pm=")||o.length>0&&e.tagName.toLowerCase()===t?.tag&&o.every(([t,n])=>e.getAttribute(t)===n));if(e&&(l||a(e)))return{status:"matched",element:e}}catch{}continue}let e=i(r);if(1===e.length&&(/^\\[data-pm=/.test(r)||!o))return{status:"matched",element:e[0]}}if(!o||e.some(e=>e.includes(" >>> ")||e.startsWith("@frame("))||!/^[a-z][a-z0-9-]*$/.test(t.tag))return{status:"missing"};let l=i(t.tag);if(l.length>500)return{status:"ambiguous"};let s=Object.entries(t.attributes??{}).filter(([e])=>jt(e));if(s.length){let e=l.filter(e=>s.every(([t,n])=>e.getAttribute(t)===n));return 1===e.length?{status:"matched",element:e[0]}:{status:e.length?"ambiguous":"missing"}}let u=l.filter(a);return 1===u.length?{status:"matched",element:u[0]}:{status:u.length?"ambiguous":"missing"}}function Nt(e,t,n=document){let r={};if(t)for(let[e,n]of Object.entries({...t.dataAttributes,...t.id?{id:t.id}:{}}))jt(e)&&Lt(e,n)&&(r[e]=n);let i=t?.targetFingerprint?.tag??t?.tagName?.toLowerCase(),o=t&&i?{...t.targetFingerprint,tag:i,attributes:{...r,...t.targetFingerprint?.attributes}}:t?.targetFingerprint,a=zt([e,t?.selector].filter(e=>!!e),o,n);return"matched"===a.status?a.element:null}var _t=["data-popmelt-frame","data-popmelt-media-id","data-testid","data-test","data-cy"];function Dt(e){let t=e.getRootNode();if(!("querySelectorAll"in t))return null;let n=new Set([..._t,...e.getAttributeNames().filter(e=>"id"!==e&&jt(e))]);for(let r of n){let n=e.getAttribute(r);if(!n||n.length>200)continue;let i=`[${r}="${typeof CSS<"u"&&"function"==typeof CSS.escape?CSS.escape(n):Array.from(n,e=>{if(\'"\'===e||"\\\\"===e)return`\\\\${e}`;let t=e.charCodeAt(0);return t<32||127===t?`\\\\${t.toString(16)} `:e}).join("")}"]`;if(1===t.querySelectorAll(i).length)return i}return null}function Ft(e){if(Je(e.ownerDocument))return $t(e);let t=Dt(e);if(t)return t;if(e.id)return`#${e.id}`;let n=e.tagName.toLowerCase(),r=Array.from(e.classList).slice(0,3).join(".");return r?`${n}.${r}`:n}function $t(e){return Ot(Ht(e),e.ownerDocument)}function Ot(e,t){let n=Je(t);if(n){(!n.id||1!==n.ownerDocument.querySelectorAll(`#${CSS.escape(n.id)}`).length)&&!Dt(n)&&n.setAttribute("data-popmelt-frame",globalThis.crypto?.randomUUID?.()??`frame-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`);let r=n.hasAttribute("data-popmelt-frame")?`[data-popmelt-frame="${n.getAttribute("data-popmelt-frame")}"]`:Ht(n);return function(e,t){return`${st}${encodeURIComponent(JSON.stringify({selector:e,url:t.URL}))}) `}(Je(n.ownerDocument)?$t(n):r,t)+e}return e}function Ht(e){if(9===e.getRootNode().nodeType&&e.id&&!e.id.startsWith("radix-")&&!e.id.startsWith(":")&&1===e.ownerDocument.querySelectorAll(`#${CSS.escape(e.id)}`).length)return`#${CSS.escape(e.id)}`;let t=[],n=e;for(;n&&n!==e.ownerDocument.documentElement;){let e=n.tagName.toLowerCase(),r=Dt(n);if(r?e=r:n.id&&!n.id.startsWith("radix-")&&!n.id.startsWith(":")&&1===n.getRootNode().querySelectorAll(`#${CSS.escape(n.id)}`).length&&(e=`#${CSS.escape(n.id)}`),!r&&!e.startsWith("#")){let t=Array.from(n.classList).filter(e=>!e.startsWith("_")&&e.length<30).slice(0,2);t.length>0&&(e+="."+t.map(e=>CSS.escape(e)).join("."))}let i=n.parentElement;if(i&&!r&&!e.startsWith("#")){let t=Array.from(i.children).filter(e=>e.tagName===n.tagName);t.length>1&&(e+=`:nth-of-type(${t.indexOf(n)+1})`)}if(t.unshift(e),r||e.startsWith("#")){let e=n.getRootNode();if(9===e.nodeType)break;if("host"in e){t.unshift(St().trim()),n=e.host;continue}}if(i){n=i;continue}let o=n.getRootNode();if(!("host"in o))break;t.unshift(St().trim()),n=o.host}return t.join(" > ").replace(/ > >>> > /g,St())}function Wt(e){try{return pt(e)}catch{return null}}function Bt(e){if(!e)return null;try{return pt(e)}catch{return null}}function Vt(e){return(e??"").replace(/\\s+/g," ").trim()}function qt(e){let t=Vt(e.getAttribute("aria-label"));if(t)return t.slice(0,80);let n=Vt(e.getAttribute("aria-labelledby"));if(n){let e=n.split(/\\s+/).map(e=>Vt(document.getElementById(e)?.textContent)).filter(Boolean).join(" ");if(e)return e.slice(0,80)}let r=Vt(e.getAttribute("title"));return r?r.slice(0,80):Vt(e.textContent).slice(0,80)}function Yt(e){if(e instanceof HTMLDetailsElement){let t=Array.from(e.children).find(e=>"summary"===e.tagName.toLowerCase());if(!t)return null;let n=qt(t);return n?{triggerSelector:$t(t),targetSelector:$t(e),label:n}:null}let t=function(e){return e.id?Array.from(document.querySelectorAll("[aria-controls]")).find(t=>t.getAttribute("aria-controls")===e.id)??null:null}(e);if(!t)return null;let n=qt(t);return n?{triggerSelector:$t(t),targetSelector:$t(e),label:n}:null}function Ut(e){let t=[],n=new Set,r=ht(e);for(;r&&r!==document.body&&r!==document.documentElement;){let e=Yt(r);e&&!n.has(e.triggerSelector)&&(n.add(e.triggerSelector),t.push(e)),r=ht(r)}if(0===t.length)return;let i=t.reverse();return{steps:i,location:i.map(e=>e.label)}}function Xt(e){let t=e?.[0]?.revealRecipe;if(t?.steps.length)return t;let n=Bt(e?.[0]?.selector);return n?Ut(n):void 0}function Kt(e){let t=Xt(e)?.location.filter(Boolean);return t?.length?`Inside: ${t.join(" › ")}`:null}function Qt(e){if(!e?.isConnected)return!1;let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0||0===e.getClientRects().length)return!1;let n=e;for(;n;){let e=window.getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility||"collapse"===e.visibility||Number.parseFloat(e.opacity||"1")<=0)return!1;n=n.parentElement}return!0}function Gt(e,t,n){return"true"===t.getAttribute("aria-expanded")||"open"===t.getAttribute("data-state")||(n instanceof HTMLDetailsElement?n.open:Qt(n))}function Zt(e,t=900){return e?new Promise(n=>{let r=performance.now(),i=()=>{let o=Bt(e);Qt(o)?n(o):performance.now()-r>=t?n(null):requestAnimationFrame(i)};i()}):Promise.resolve(null)}function Jt(e){let t={targetFingerprint:Pt(e),selector:Ft(e),tagName:e.tagName.toLowerCase()};e.hasAttribute("data-popmelt-subject-projection")&&e.hasAttribute("data-scratch-part")&&(t.subjectLabel=e.getAttribute("data-popmelt-subject-label")||void 0,t.tagName=e.getAttribute("data-popmelt-subject-adapter")||t.tagName);let n=[],r=e.ownerDocument,i=Je(r);for(;i;)n.unshift({url:r.URL,title:r.title,label:i.title||i.getAttribute("aria-label")||i.id||void 0}),r=i.ownerDocument,i=Je(r);n.length&&(t.frameContext=n),e.id&&(t.id=e.id),e.classList.length>0&&(t.className=Array.from(e.classList).join(" "));let o=function(e){let t="";for(let n of e.childNodes)n.nodeType===Node.TEXT_NODE&&(t+=n.textContent||"");return t.trim()}(e)||e.matches(\'button, a, [role="button"], [role="tab"]\')&&(e.getAttribute("aria-label")||e.getAttribute("title")||e.textContent?.trim())||"";o&&o.length>0&&o.length<200&&(t.textContent=o);let a={};for(let t of e.attributes)t.name.startsWith("data-")&&(a[t.name]=t.value);Object.keys(a).length>0&&(t.dataAttributes=a);let l=function(e){let t=Object.keys(e).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));if(!t)return null;let n=e[t],r=[],i=n?._debugSource;for(;n;){let e=n.type,t=e?.displayName||e?.name;t&&"string"==typeof t&&/^[A-Z]/.test(t)&&!t.startsWith("_")&&"Fragment"!==t&&r.unshift(t),n=n.return}return r.length>0?{name:r[r.length-1],path:r,...i?.fileName&&Number.isFinite(i.lineNumber)?{source:i}:{}}:null}(e);l&&(t.reactComponent=l.name,t.reactComponentPath=l.path,l.source&&(t.reactSource=l.source));let s=function(e){let t=ht(e),n=["section","article","nav","aside","header","footer","main"];for(;t&&t!==e.ownerDocument.body;){let e=t.tagName.toLowerCase();if(n.includes(e)&&t.id)return Je(t.ownerDocument)?Ft(t):`${e}#${t.id}`;if(t.id&&!t.id.startsWith("radix-")&&!t.id.startsWith(":"))return Je(t.ownerDocument)?Ft(t):`${e}#${t.id}`;t=ht(t)}return null}(e);s&&(t.context=s);let u=Ut(e);return u&&(t.revealRecipe=u),t}var en=new WeakMap;function tn(e,t,n){let r,i=e[0]?.closest("[data-explore-fixture-root]");if(i){for(let o of e)if(i.contains(o)){if("svg"===o.localName){r??=o;continue}if("canvas"===o.localName)return en.get(o)?.(t,n)??r??o;if(un(o,t,n,!1,!0))return r??o}return r??e[0]}}function nn(e,t,n){let r=sn(e,t,n),i=tn(r,e,t);if(i)return i;let o=r.findIndex(e=>"canvas"===e.tagName.toLowerCase());return(o<0?r[0]:r.slice(0,o+1).find(n=>un(n,e,t)))??null}function rn(e,t,n){if("function"!=typeof document.elementsFromPoint)return!0;for(let r of sn(t,n)){if(r===e||e.contains(r))return un(r,t,n);if(un(r,t,n))return!1}return!1}var on="[data-popmelt-canvas-block]";function an(e,t){let n=wt(e,t).find(e=>"devtools-canvas"!==e.id&&"devtools-scrim"!==e.id);return!(!n||!gt(n,on))}function ln(e){return"http://www.w3.org/2000/svg"===e.namespaceURI?e.closest("svg")??e:e}function sn(e,t,n){let r=n?.within;if(!r&&an(e,t))return[];let i=new Set,o=wt(e,t,r?.ownerDocument??document,n=>{if(r&&!r.contains(n))return!1;let i=gt(n,"[data-devtools], [data-popmelt-root], [data-popmelt-shadow-host], [data-popmelt-canvas-block]");return(!i||!!r&&i.contains(r))&&un(n,e,t,!1)}),a=o.map(ln).filter(e=>{if(i.has(e))return!1;if(i.add(e),r){if(e===r||!r.contains(e))return!1;let t=gt(e,"[data-devtools], [data-popmelt-canvas-block]");return!t||t.contains(r)}return!("devtools-canvas"===e.id||"devtools-toolbar"===e.id||"devtools-scrim"===e.id||gt(e,"#devtools-toolbar")||e.hasAttribute("data-devtools")||gt(e,"[data-devtools]"))&&e!==e.ownerDocument.body&&e!==e.ownerDocument.documentElement});return a.length>0?a:!r&&n?.allowBodyFallback&&o.includes(document.body)?[document.body]:[]}function un(e,t,n,r=!0,i=!1){let o=e.ownerDocument.defaultView;if(!o)return!1;let a=o.getComputedStyle(e);if("hidden"===a.visibility||"collapse"===a.visibility)return!1;for(let t=e;t;t=ht(t))if("0"===t.ownerDocument.defaultView?.getComputedStyle(t).opacity)return!1;if(function(e,t,n){for(let r of e.childNodes){if(r.nodeType!==Node.TEXT_NODE||!r.textContent?.trim())continue;let i=e.ownerDocument.createRange();i.selectNodeContents(r);let o=i.getClientRects?.();if(o&&Array.from(o).some(r=>{let i=it(t,n,e.ownerDocument);return i.x>=r.left&&i.x<=r.right&&i.y>=r.top&&i.y<=r.bottom}))return!0}return!1}(e,t,n)||"http://www.w3.org/2000/svg"===e.namespaceURI&&(r||"svg"!==e.localName)||["button","canvas","embed","iframe","img","input","object","select","textarea","video"].includes(e.tagName.toLowerCase())&&(!i||"button"!==e.localName)||a.backgroundImage&&"none"!==a.backgroundImage)return!0;let l=a.backgroundColor.trim();if(l&&"transparent"!==l&&!/rgba\\([^)]*,\\s*0(?:\\.0+)?\\s*\\)$/.test(l))return!0;let s=rt(e),u=Number.parseFloat(a.borderTopWidth)||0,c=Number.parseFloat(a.borderRightWidth)||0,d=Number.parseFloat(a.borderBottomWidth)||0,f=Number.parseFloat(a.borderLeftWidth)||0,p=e=>{let t=a[`border${e}Color`];return"none"!==a[`border${e}Style`]&&"transparent"!==t&&!/rgba\\([^)]*,\\s*0(?:\\.0+)?\\s*\\)$/.test(t)};return u>0&&p("Top")&&n<=s.top+u||c>0&&p("Right")&&t>=s.right-c||d>0&&p("Bottom")&&n>=s.bottom-d||f>0&&p("Left")&&t<=s.left+f}var cn=new WeakMap,dn=new Set;function fn(e){let t=e?.closest("[data-popmelt-explore-original],[data-popmelt-explore-scene]");return t?cn.get(t)??null:null}var pn,hn=new Set;function mn(e){if(hn.add(e),!pn){let e=new Map,t=new Map,n="",r=!0,i=!0,o=!1,a=!0,l=0,s=()=>{let n=new Set,o=new Map,a=t=>{if(n.add(t),!e.has(t)){let n=new MutationObserver(e=>{let t=e.filter(e=>!(1===e.target.nodeType?e.target:e.target.parentElement)?.closest("[data-devtools]"));t.length&&(r=!0),t.some(e=>"childList"===e.type)&&(i=!0)});n.observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0});let o=()=>{r=!0};t.addEventListener("scroll",o,!0),t.addEventListener("load",o,!0),e.set(t,()=>{n.disconnect(),t.removeEventListener("scroll",o,!0),t.removeEventListener("load",o,!0)})}for(let e of t.querySelectorAll("*")){if(e.shadowRoot&&!e.closest("[data-devtools]")&&a(e.shadowRoot),"iframe"!==e.localName||e.closest("[data-devtools],[data-popmelt-peer-surface]"))continue;let t=et(e);o.set(e,t),t&&a(t)}};a(document);for(let[t,r]of e)n.has(t)||(r(),e.delete(t));t=o,i=!1,r=!0},u=()=>{if(!a)return;(i||[...t].some(([e,t])=>et(e)!==t))&&s();let e=[];for(let[n,r]of t){let t=n.getBoundingClientRect();e.push(r?.URL,t.x,t.y,t.width,t.height,r?.defaultView?.scrollX,r?.defaultView?.scrollY)}let c=JSON.stringify(e);if((r||c!==n)&&(r=!1,n=c,o))for(let e of hn)e();o=!0,a&&(l=requestAnimationFrame(u))};u(),pn=()=>{a=!1,cancelAnimationFrame(l);for(let t of e.values())t()}}return()=>{hn.delete(e),hn.size||(pn?.(),pn=void 0)}}var gn=u(d());function yn(e,t){let n=e.match(/^oklch\\(([^)]+)\\)$/i);if(n)return`oklch(${n[1]} / ${t})`;let r=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e);return r?`rgba(${parseInt(r[1],16)}, ${parseInt(r[2],16)}, ${parseInt(r[3],16)}, ${t})`:`color-mix(in srgb, ${e} ${Math.round(100*t)}%, transparent)`}var xn=new WeakMap,vn=new WeakMap;function bn(e,t){t&&(xn.set(e,t),vn.set(t,e))}function wn(e){return!(!e||"http://www.w3.org/1999/xhtml"!==e.namespaceURI&&"http://www.w3.org/2000/svg"!==e.namespaceURI)}function Sn(e){let t=window.getComputedStyle(e).display;return"flex"===t||"inline-flex"===t||"grid"===t||"inline-grid"===t}function kn(e){let t=window.getComputedStyle(e);return{row:parseFloat(t.rowGap)||0,column:parseFloat(t.columnGap)||0}}function Cn(e){let t=Array.from(e.children).filter(e=>{if(!(e instanceof HTMLElement))return!1;let t=window.getComputedStyle(e);return"none"!==t.display&&"absolute"!==t.position&&"fixed"!==t.position});if(t.length<2)return[];let n=[],r=e.getBoundingClientRect(),i=window.getComputedStyle(e).flexDirection,o="column"===i||"column-reverse"===i;for(let e=0;e<t.length-1;e++){let i=t[e].getBoundingClientRect(),a=t[e+1].getBoundingClientRect();if(a.left>i.right+.5&&n.push({axis:"column",x:i.right,y:r.top,w:a.left-i.right,h:r.height}),a.top>i.bottom+.5&&n.push({axis:"row",x:r.left,y:i.bottom,w:r.width,h:a.top-i.bottom}),!(a.left>i.right+.5||a.top>i.bottom+.5))if(o){let e=(i.bottom+a.top)/2;n.push({axis:"row",x:r.left,y:e-3,w:r.width,h:6})}else{let e=(i.right+a.left)/2;n.push({axis:"column",x:e-3,y:r.top,w:6,h:r.height})}}return function(e){let t=[];for(let n of e){let e=t.find(e=>e.axis===n.axis&&("row"===n.axis?Math.abs(e.y-n.y)<2&&Math.abs(e.h-n.h)<2:Math.abs(e.x-n.x)<2&&Math.abs(e.w-n.w)<2));if(e)if("row"===n.axis){let t=Math.min(e.x,n.x),r=Math.max(e.x+e.w,n.x+n.w);e.x=t,e.w=r-t}else{let t=Math.min(e.y,n.y),r=Math.max(e.y+e.h,n.y+n.h);e.y=t,e.h=r-t}else t.push({...n})}return t}(n)}function En(e,t){let n=window.getComputedStyle(e),r=n.display;if("flex"!==r&&"inline-flex"!==r)return!1;let i=n.justifyContent;if("space-between"!==i&&"space-around"!==i&&"space-evenly"!==i&&"stretch"!==i)return!1;let o=n.flexDirection;return!(t!==("column"===o||"column-reverse"===o?"row":"column")||parseFloat("row"===t?n.rowGap:n.columnGap)>0)}function Mn(e){let t=window.getComputedStyle(e);return{top:parseFloat(t.paddingTop)||0,right:parseFloat(t.paddingRight)||0,bottom:parseFloat(t.paddingBottom)||0,left:parseFloat(t.paddingLeft)||0}}function Tn(e){let t=window.getComputedStyle(e);return{top:parseFloat(t.marginTop)||0,right:parseFloat(t.marginRight)||0,bottom:parseFloat(t.marginBottom)||0,left:parseFloat(t.marginLeft)||0}}function Rn(e){let t=window.getComputedStyle(e);return{topLeft:t.borderTopLeftRadius,topRight:t.borderTopRightRadius,bottomRight:t.borderBottomRightRadius,bottomLeft:t.borderBottomLeftRadius}}function An(e){let t=window.getComputedStyle(e);return{"top-left":parseFloat(t.borderTopLeftRadius)||0,"top-right":parseFloat(t.borderTopRightRadius)||0,"bottom-right":parseFloat(t.borderBottomRightRadius)||0,"bottom-left":parseFloat(t.borderBottomLeftRadius)||0}}function In(e){for(let t of e.childNodes)if(t.nodeType===Node.TEXT_NODE&&(t.textContent||"").trim().length>0)return!0;return!1}function jn(e){let t=document.createRange(),n=!1;for(let r of e.childNodes)r.nodeType===Node.TEXT_NODE&&(r.textContent||"").trim().length>0&&(n||(t.setStart(r,0),n=!0),t.setEnd(r,r.textContent?.length??0));if(!n)return null;let r=t.getBoundingClientRect(),i=window.getComputedStyle(e),o=parseFloat(i.fontSize)||16,a=parseFloat(i.lineHeight);isNaN(a)&&(a=1.2*o);let l=Math.max(1,t.getClientRects().length),s=Math.max(r.height,l*a),u=(s-r.height)/2;return new DOMRect(r.x,r.y-u,r.width,s)}function Ln(e){let t=window.getComputedStyle(e),n=parseFloat(t.fontSize)||16,r=parseFloat(t.lineHeight);return isNaN(r)&&(r=1.2*n),{fontSize:n,lineHeight:r}}function Pn(e){return e.left+e.width}function zn(e){return e.top+e.height}function Nn(e,t){if(0===e.length)return t;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top));return{left:n,top:r,width:Math.max(...e.map(Pn))-n,height:Math.max(...e.map(zn))-r}}function _n(e){let t=[...e].sort((e,t)=>e.top-t.top||e.left-t.left),n=[];for(let e of t){let t=e.top+e.height/2,r=n.find(n=>{let r=n.top+n.height/2;return Math.abs(t-r)<=.4*Math.max(n.height,e.height)});if(!r){n.push({...e});continue}let i=Math.min(r.left,e.left),o=Math.min(r.top,e.top),a=Math.max(Pn(r),Pn(e)),l=Math.max(zn(r),zn(e));r.left=i,r.top=o,r.width=a-i,r.height=l-o}return n.sort((e,t)=>e.top-t.top||e.left-t.left)}function Dn(e){return!!e&&!!e.closest("#devtools-toolbar, #devtools-scrim, #devtools-text-input, [data-devtools], [data-popmelt-panel], [data-popmelt-shadow-host]")}function Fn(e,t,n){let r=e.caretPositionFromPoint?.(t,n);if(r?.offsetNode.nodeType===Node.TEXT_NODE)return{node:r.offsetNode,offset:r.offset};let i=e.caretRangeFromPoint?.(t,n);return i?.startContainer.nodeType===Node.TEXT_NODE?{node:i.startContainer,offset:i.startOffset}:null}function $n(e,t){let n=Hn(e),r=n.find(e=>e.textNode===t)??n[0];if(!r)return null;let i=ot(e).getComputedStyle(e),{textRect:o,...a}=Vn(n,e,i);return{...r,targetElement:e,segments:n,originalText:n.map(e=>e.originalText).join(""),styles:i,rect:o,...a,fontSize:parseFloat(i.fontSize)||12,wrapsText:"nowrap"!==i.whiteSpace&&"pre"!==i.whiteSpace}}function On(e,t){let n=[],r=t;for(;r&&r!==e;){let e=r.parentNode;if(!e)return null;n.unshift(Array.prototype.indexOf.call(e.childNodes,r)),r=e}return r===e?n:null}function Hn(e){let t=[],n=r=>{if(r.nodeType===Node.TEXT_NODE){let n=r,i=On(e,n);return void(i&&t.push({textNode:n,textNodePath:i,originalText:n.nodeValue??""}))}if(r.nodeType!==Node.ELEMENT_NODE&&r!==e)return;let i=r.tagName?.toLowerCase();"script"===i||"style"===i||r.childNodes.forEach(n)};return e.childNodes.forEach(n),t}function Wn(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}function Bn(e){let t=e.getBoundingClientRect(),n=ot(e).getComputedStyle(e),r=(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.paddingLeft)||0),i=(parseFloat(n.borderRightWidth)||0)+(parseFloat(n.paddingRight)||0),o=(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.paddingTop)||0),a=(parseFloat(n.borderBottomWidth)||0)+(parseFloat(n.paddingBottom)||0);return nt({left:t.left+r,top:t.top+o,width:Math.max(0,t.width-r-i),height:Math.max(0,t.height-o-a)},e.ownerDocument)}function Vn(e,t,n,r=!1){let i=Wn(rt(t)),o=function(e){let t=[];for(let n of e){if(!n.textNode.isConnected||!n.originalText.trim())continue;let e=n.textNode.ownerDocument.createRange();e.selectNodeContents(n.textNode),t.push(...Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>Wn(nt(e,n.textNode.ownerDocument)))),e.detach?.()}return _n(t)}(e),a=e[0]?.textNode?function(e,t){let n=e.ownerDocument.createRange();n.selectNodeContents(e);let r=nt(n.getBoundingClientRect(),e.ownerDocument);if(n.detach?.(),r.width>0&&r.height>0)return{left:r.left,top:r.top,width:r.width,height:r.height};let i=rt(t);return{left:i.left,top:i.top,width:i.width,height:i.height}}(e[0].textNode,t):i,l=o.length>0?o:[a];return function({display:e,singleTextNode:t=!1,fragmentRects:n,elementRect:r,parentContentRect:i}){let o=_n(n),a=Nn(o,r);if(!("inline"===e&&o.length>1&&i&&i.width>0))return{textRect:a,boundaryRect:t?a:r,boundaryRects:t?o:[r],firstLineIndent:0};let l=o[0],s={left:i.left,top:l.top,width:i.width,height:Math.max(a.height,zn(a)-l.top)},u=Math.max(0,Math.min(s.width,l.left-s.left));return{textRect:a,boundaryRect:Nn(o,r),boundaryRects:o,flowRect:s,firstLineIndent:u}}({display:n.display,singleTextNode:r,fragmentRects:l,elementRect:i,parentContentRect:t.parentElement?Bn(t.parentElement):void 0})}function qn(e,t,n){if(t===n||0===e.length)return[];let r=0;for(;r<t.length&&r<n.length&&t[r]===n[r];)r+=1;let i=0;for(;i<t.length-r&&i<n.length-r&&t[t.length-1-i]===n[n.length-1-i];)i+=1;let o=r,a=t.length-i,l=n.slice(r,n.length-i),s=0,u=!1;return e.flatMap((t,n)=>{let r=s,i=r+t.originalText.length;s=i;let c=o===a;if(!(c&&(o>=r&&o<i||n===e.length-1&&o===i)||!c&&i>o&&r<a))return[];let d=Math.max(0,Math.min(t.originalText.length,o-r)),f=Math.max(0,Math.min(t.originalText.length,a-r)),p=t.originalText.slice(0,d);return u||(p+=l,u=!0),p+=t.originalText.slice(f),p===t.originalText?[]:[{segment:t,modifiedText:p}]})}function Yn(e,t){return Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}var Un=new WeakMap;function Xn(e){let t=e.closest("p");return t?Un.get(t):void 0}function Kn(e){let t=Hn(e);return{root:e,rows:[e],runs:t.map(e=>[e.textNode]),paths:t.map(e=>e.textNodePath),undo:[]}}function Qn(e){let t=Un.get(e)??Kn(e),n=t.runs.map((e,n)=>({path:t.paths[n],parts:e.map(e=>e.data)}));return{group:t,layout:n}}function Gn(e,t,n){let r=t.splitText(n),i=r,o=t.parentElement;for(;;){let t=o,n=o.cloneNode(!1);for(n.removeAttribute("id"),n.removeAttribute("data-pm");i.nextSibling;)n.appendChild(i.nextSibling);if(n.insertBefore(i,n.firstChild),t.after(n),e.undo.push(()=>{for(;n.firstChild;)t.appendChild(n.firstChild);n.remove()}),"P"===o.tagName){n.dataset.popmeltParagraphContinuation="",e.rows.splice(e.rows.indexOf(t)+1,0,n),Un.set(n,e);break}i=n,o=t.parentElement}return r}function Zn(e){let t=Un.get(e);if(t&&t.root===e){for(let e of t.rows)e.querySelector("br[data-popmelt-empty-paragraph]")?.remove(),Un.delete(e);for(let e of t.undo.reverse())e()}}function Jn(e,t){if("P"!==e.tagName)return;let n=Un.get(e);if((!n||n.root===e)&&(n&&!n.runs.every((e,n)=>e.length===t[n]?.parts.length)&&(Zn(e),n=void 0),n??=Kn(e),n.paths.length===t.length&&t.every((e,t)=>e.parts.length&&e.path.join(".")===n.paths[t].join(".")))){if(!Un.has(e)){Un.set(e,n);for(let e=0;e<t.length;e++){let r=n.runs[e],i=r[0],o=i.data;n.undo.push(()=>{i.data=o;for(let e of r.slice(1))e.remove()});let a=t[e].parts;for(let e=1;e<a.length;e++){let t=r[e-1];r.push(Gn(n,t,t.length))}}}n.runs.forEach((e,n)=>e.forEach((e,r)=>{let i=t[n].parts[r];e.data!==i&&(e.data=i)}));for(let e of n.rows){let t=e.querySelector("br[data-popmelt-empty-paragraph]");if(e.textContent||t||e.querySelector("br,img,svg,input"))e.textContent&&t&&t.remove();else{let t=e.ownerDocument.createElement("br");t.dataset.popmeltEmptyParagraph="",e.appendChild(t)}}return n}}var er=new WeakMap,tr=new WeakMap;function nr(e,t){return wn(e)&&(er.get(e)?.has(t)??!1)}function rr(e){let t=e.sticker;return t?"padding"===t.family||"margin"===t.family?"all"===t.subproperty?10:"x"===t.subproperty||"y"===t.subproperty?20:30:"radius"===t.family||"border"===t.family?"all"===t.subproperty?10:20:10:0}function ir(e){return e.changes.map((e,t)=>({change:e,index:t})).sort((e,t)=>rr(e.change)-rr(t.change)||e.index-t.index).map(({change:e})=>e)}function or(e,t,n){if(wn(e)){let r=tr.get(e);r||(r=new Map,tr.set(e,r)),r.has(t)||r.set(t,{value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}),e.style.setProperty(t,n,"important")}}function ar(e,t,n,r=!1){if(wn(e)){let n=r?tr.get(e)?.get(t):void 0;n?.value?e.style.setProperty(t,n.value,n.priority):e.style.removeProperty(t),tr.get(e)?.delete(t)}}function lr(e){let t=Wt(e.selector);if(!t&&e.durableSelector&&(t=Wt(e.durableSelector),t)){let n=e.selector.match(/\\[data-pm="([^"]+)"\\]/)?.[1];n&&t.setAttribute("data-pm",n)}return t}function sr(e){for(let t of e){let e=lr(t);if(e)for(let n of ir(t))nr(e,n.property)||or(e,n.property,n.modified)}}function ur(e,t=!1){for(let n of e){let e=Wt(n.selector);if(e)for(let r of n.changes)nr(e,r.property)||ar(e,r.property,r.original,t)}}function cr(e){let t=Wt(e.selector);if(!t&&e.durableSelector&&(t=Wt(e.durableSelector),t)){let n=e.selector.match(/\\[data-pm="([^"]+)"\\]/)?.[1];n&&t.setAttribute("data-pm",n)}return t}function dr(e,t){let n=e;for(let e of t)n=n?.childNodes[e]??null;return n?.nodeType===Node.TEXT_NODE?n:null}function fr(e){for(let t of[...e].reverse()){if(t.captured)continue;let e=cr(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){Zn(e),t.paragraphs.before.some(e=>e.parts.length>1)&&Jn(e,t.paragraphs.before);continue}let n=dr(e,t.textNodePath);n&&n.nodeValue===t.modified&&n.nodeValue!==t.original&&(n.nodeValue=t.original)}}function pr(e,t,n){let r="right"===e.horizontalAlignment?e.left-t:e.left;return{left:r,top:e.top,right:r+t,bottom:e.top+n}}function hr(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function mr(e,t,n,r,i=0,o=Number.POSITIVE_INFINITY){if(e.height>=r)return{anchor:"top-left",horizontalAlignment:"left",left:e.left+8,top:e.top+8};let a=function(e,t,n){let r=Math.max(0,e.left+t-n);return Math.max(0,t-e.right)<r?"right":"left"}(e,i,o);return e.top>=t+n?{anchor:"right"===a?"top-right":"top-left",horizontalAlignment:a,left:"right"===a?e.right:e.left,top:e.top-t-n}:{anchor:"right"===a?"bottom-right":"bottom-left",horizontalAlignment:a,left:"right"===a?e.right:e.left,top:e.bottom+n}}var gr=new WeakMap,yr="popmelt:preview-viewport-change";function xr(e,t=window){let n=gr.get(t)??function(e){let t={listeners:new Set,rafId:null,schedule:()=>{null===t.rafId&&(t.rafId=e.requestAnimationFrame(()=>{t.rafId=null;for(let e of t.listeners)e()}))}};return gr.set(e,t),e.addEventListener("scroll",t.schedule,{passive:!0,capture:!0}),e.addEventListener("resize",t.schedule),t}(t);return n.listeners.add(e),()=>{n.listeners.delete(e)&&(n.listeners.size>0||(t.removeEventListener("scroll",n.schedule,!0),t.removeEventListener("resize",n.schedule),null!==n.rafId&&t.cancelAnimationFrame(n.rafId),gr.delete(t)))}}var vr=u(v()),br={topLeft:"0px",topRight:"0px",bottomRight:"0px",bottomLeft:"0px"};function wr(e,t){return e.radii.topLeft===t.radii.topLeft&&e.radii.topRight===t.radii.topRight&&e.radii.bottomRight===t.radii.bottomRight&&e.radii.bottomLeft===t.radii.bottomLeft&&e.outline===t.outline&&e.fragments.length===t.fragments.length&&e.fragments.every((e,n)=>{let r=t.fragments[n];return!!r&&e.left===r.left&&e.top===r.top&&e.width===r.width&&e.height===r.height})}function Sr(e){if(!(e=fn(e)??e).isConnected||!at(e.ownerDocument))return{fragments:[],radii:br};let t=lt(rt(e),e.ownerDocument);if(Je(e.ownerDocument)&&(!t.width||!t.height))return{fragments:[],radii:br};if("true"===e.getAttribute("data-popmelt-subject-projection"))return{fragments:[{left:t.left,top:t.top,width:t.width,height:t.height}],radii:br,outline:e.getAttribute("data-popmelt-subject-outline")??void 0};let n=Array.from(e.getClientRects()).map(t=>lt(nt(t,e.ownerDocument),e.ownerDocument)).filter(e=>e.width>0&&e.height>0).map(e=>({left:e.left,top:e.top,width:e.width,height:e.height}));return{fragments:_n(n.length>0?n:[{left:t.left,top:t.top,width:t.width,height:t.height}]),radii:Rn(e)}}function kr({element:e,projectedRect:t,isSelected:n=!1,elementInfo:r,color:i="#3b82f6",annotationNumber:o,changeCount:a,hideTooltip:l=!1,hideOutline:s=!1,hideFill:u=!1,fillOpacity:c=.05,subjectRegistry:d,railGap:f=2,railHeight:p=22,railWidth:h=0,renderRail:m,refreshKey:g,outlineZIndex:y=9996,onActivate:x,onRemove:v}){let b=(0,gn.useContext)(Ct),[w,S]=(0,gn.useState)({fragments:[],radii:br});(0,gn.useEffect)(()=>{if(!b)return;if(!e)return void S({fragments:[],radii:br});let t=null,n=()=>{let t=Sr(e);S(e=>wr(e,t)?e:t)},r=()=>{null===t&&(t=requestAnimationFrame(()=>{t=null,n()}))};n();let i=function(e){return dn.add(e),()=>{dn.delete(e)}}(n),o="true"===e.getAttribute("data-popmelt-subject-projection")&&!!d,a=o?d.subscribeFrame(n):void 0,l=o||typeof ResizeObserver>"u"?null:new ResizeObserver(r);l?.observe(e);let s=o?null:new MutationObserver(r);s?.observe(e,{attributes:!0,attributeFilter:["style","class"]});let u=xr(n,e.ownerDocument.defaultView??window),c=Je(e.ownerDocument)?mn(n):void 0;return()=>{i(),u(),c?.(),a?.(),l?.disconnect(),s?.disconnect(),null!==t&&cancelAnimationFrame(t)}},[b,e,d]),(0,gn.useLayoutEffect)(()=>{if(!b||!e||void 0===g)return;let t=Sr(e);S(e=>wr(e,t)?e:t)},[b,e,g]);let{fragments:k,radii:C}=t?{fragments:[t],radii:br}:w;if(0===k.length||!e&&!t)return null;let E=Nn(k,k[0]),M=e?.tagName.toLowerCase()??"",T=e?.id?`#${e.id}`:"",R=e&&e.classList.length>0?"."+Array.from(e.classList).slice(0,2).join("."):"",A=r?.reactComponent,I=e?.getAttribute("data-popmelt-label")?.trim(),j=e?.getAttribute("data-popmelt-subject-adapter"),L=e?.getAttribute("data-popmelt-subject-label"),P=j&&L?`<${L}>`:I||(A?`<${A}> ${M}${T}${R}`:`${M}${T}${R}`),z=mr({left:E.left,right:E.left+E.width,top:E.top,bottom:E.top+E.height,height:E.height},p,f,window.innerHeight,h,window.innerWidth),N={zIndex:9997,display:"flex",alignItems:"center",gap:6,backgroundColor:i,color:"#fff",fontSize:12,fontFamily:We,lineHeight:"14px",padding:"4px 8px",borderRadius:8,pointerEvents:"none",whiteSpace:"nowrap",maxWidth:400,position:"fixed",top:z.top,left:z.left},_=!l&&(0,vr.jsxs)("div",{ref:t=>{e&&bn(e,t)},"data-devtools":"tooltip",style:N,children:[void 0!==o&&(0,vr.jsxs)("span",{children:[o,"."]}),(0,vr.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:P}),void 0!==a&&a>0&&(0,vr.jsxs)("span",{style:{opacity:.8},children:["(",a," ",1===a?"change":"changes",")"]})]});return(0,vr.jsxs)(vr.Fragment,{children:[!s&&k.map((e,t)=>(0,vr.jsx)("div",{"data-devtools":"highlight",onContextMenu:v?e=>{e.preventDefault(),e.stopPropagation(),v()}:void 0,role:x?"button":void 0,tabIndex:x?0:void 0,"aria-label":x?"Open annotation thread":void 0,onPointerDown:x?e=>{e.preventDefault(),e.stopPropagation()}:void 0,onClick:x?e=>{e.preventDefault(),e.stopPropagation(),x()}:void 0,onKeyDown:x?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),x())}:void 0,style:{position:"fixed",top:e.top,left:e.left,width:e.width,height:e.height,pointerEvents:x||v?"auto":"none",cursor:x?"pointer":void 0,zIndex:y,overflow:"visible"},children:(0,vr.jsx)("div",{style:w.outline?{position:"absolute",inset:0,pointerEvents:"none"}:{position:"absolute",inset:0,boxSizing:"border-box",backgroundColor:u?"transparent":yn(i,c),borderColor:i,borderStyle:n?"solid":"dashed",borderWidth:1,borderTopLeftRadius:C.topLeft,borderTopRightRadius:C.topRight,borderBottomRightRadius:C.bottomRight,borderBottomLeftRadius:C.bottomLeft,pointerEvents:"none"},children:w.outline?(0,vr.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",style:{display:"block",overflow:"visible"},"aria-hidden":"true",children:(0,vr.jsx)("polygon",{points:w.outline,fill:u?"transparent":yn(i,c),stroke:i,strokeWidth:1,strokeDasharray:n?void 0:"4 3",vectorEffect:"non-scaling-stroke"})}):null})},`${e.left}:${e.top}:${t}`)),m?m(z,E):_]})}var Cr=u(v());function Er(e){let t=e.sourceElement??e.element;if(!t.isConnected)return!1;if(!e.subject||e.sourceElement){let e=getComputedStyle(t);if("none"===e.display||"hidden"===e.visibility||"collapse"===e.visibility||"0"===e.opacity||t.checkVisibility&&!t.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}))return!1}let n=rt(e.element);return n.width>0&&n.height>0&&n.bottom>0&&n.right>0&&n.top<window.innerHeight&&n.left<window.innerWidth}function Mr({entry:e,color:t,subjectRegistry:n,hasExistingOverlay:r}){let i=(0,kt.useContext)(Ct),o=Rt(),[a,l]=(0,kt.useState)(null);return(0,kt.useEffect)(()=>{if(!i)return;let t=function(e,t,n){let r=[],i=(e,t)=>{let n=zt(e.filter(e=>!e.includes("data-pm=")),t);"matched"!==n.status||r.some(e=>e.element===n.element)||r.push({element:n.element,elementInfo:Jt(n.element),subject:!1})};for(let o of(e.targets??[]).slice(0,20))if("dom"===o.type){if(o.pathname!==t)continue;i([o.structuralSelector,o.runtimeSelector,...o.legacySelectors??[]].filter(e=>!!e),o.targetFingerprint)}else{let e=n?.resolve({adapter:o.adapter,key:o.key});e&&r.push({element:e.element,elementInfo:e.elementInfo,subject:!0,sourceElement:e.subject.sourceElement})}if(!e.targets?.length)for(let n of(e.elementIdentifiers??[]).slice(0,20))n.startsWith(`${t}:`)&&i([n.slice(t.length+1)]);return r}(e,o,n),r=()=>{let n=t.filter(Er);l(t=>t?.entry===e&&t.pathname===o&&t.targets.length===n.length&&t.targets.every((e,t)=>e===n[t])?t:{entry:e,pathname:o,targets:n})};r();let a=xr(r),s=function(e){let t=new MutationObserver(t=>{let n=t.filter(e=>document.body.contains(e.target)||e.target===document.documentElement&&[...e.addedNodes,...e.removedNodes].some(e=>e instanceof Element&&"BODY"===e.tagName));n.length&&e(n)});return t.observe(document.documentElement,{childList:!0,subtree:!0}),t}(r);return()=>{a(),s.disconnect()}},[e,o,n,i]),a?.entry!==e||a.pathname!==o?null:(0,Cr.jsx)("div",{"data-devtools":"history-target-preview",style:{pointerEvents:"none"},children:a.targets.filter(e=>!r?.(e.element)).map((e,r)=>(0,Cr.jsx)(kr,{element:e.element,elementInfo:e.elementInfo,subjectRegistry:n,isSelected:!1,hideFill:!e.subject,color:t},r))})}var Tr=u(d());function Rr(e){return Array.from(e,e=>{if(\'"\'===e||"\\\\"===e)return`\\\\${e}`;let t=e.codePointAt(0);return t<32||127===t?`\\\\${t.toString(16)} `:e}).join("")}function Ar(e){return`[data-popmelt-subject-adapter="${Rr(e.adapter)}"][data-popmelt-subject-key="${Rr(e.key)}"]`}function Ir(e){let t=e?.getAttribute("data-popmelt-subject-adapter"),n=e?.getAttribute("data-popmelt-subject-key");return t&&n?{adapter:t,key:n}:void 0}function jr(e,t){let n=!1;e.dataset.popmeltSubjectLabel!==t.label&&(e.dataset.popmeltSubjectLabel=t.label,n=!0);let{left:r,top:i,width:o,height:a}=t.bounds,l=e=>Math.round(2*e)/2+"px",s={left:l(r),top:l(i),width:l(Math.max(0,o)),height:l(Math.max(0,a))};for(let[t,r]of Object.entries(s)){let i=t;e.style[i]!==r&&(e.style[i]=r,n=!0)}let u=t.surfaceBounds,c={popmeltSubjectSurfaceLeft:u?String(u.left):void 0,popmeltSubjectSurfaceTop:u?String(u.top):void 0,popmeltSubjectSurfaceWidth:u?String(u.width):void 0,popmeltSubjectSurfaceHeight:u?String(u.height):void 0};for(let[t,r]of Object.entries(c))void 0===r?t in e.dataset&&(delete e.dataset[t],n=!0):e.dataset[t]!==r&&(e.dataset[t]=r,n=!0);let d=t.outline?.map(e=>`${e.x},${e.y}`).join(" ");return d?e.dataset.popmeltSubjectOutline!==d&&(e.dataset.popmeltSubjectOutline=d,n=!0):void 0!==e.dataset.popmeltSubjectOutline&&(delete e.dataset.popmeltSubjectOutline,n=!0),n}var Lr=class{constructor(e){this.adapters=e,this.projections=new Map,this.frameListeners=new Set,this.frame=null,this.lastProjectionFrameTime=0,this.adapterUnsubscribes=e.flatMap(e=>{let t=e.subscribe?.(()=>{for(let e of this.frameListeners)e()});return t?[t]:[]})}async whenReady(){await Promise.all(this.adapters.map(e=>e.whenReady?.()))}hitTest(e){return this.hitTestAll(e)[0]??null}hitTestAll(e){let t=new Map;for(let n=this.adapters.length-1;n>=0;n-=1){let r=this.adapters[n];if(!r)continue;let i=(r.hitTestAll?.(e)??[r.hitTest(e)]).filter(e=>!!e).filter(n=>{let r=n.sourceElement;return!r||(t.has(r)||t.set(r,rn(r,e.x,e.y)),t.get(r))}).map(e=>this.project(r,e));if(i.length>0)return i}return[]}resolve(e){let t=this.adapters.find(t=>t.id===e.adapter);if(!t)return null;let n=t.resolve(e.key);return n?this.project(t,n):null}restore(e,t){let n=this.adapters.find(t=>t.id===e.adapter),r=n?.restoreSubject?.(e.key,t);return n&&r?this.project(n,r):null}async captureFeedback(e){let t=this.resolve(e);if(!t)return null;let{adapter:n,subject:r}=t,i={...t.elementInfo};if(r.sourceElement&&(i.sourceElement={...Jt(r.sourceElement),selector:$t(r.sourceElement)}),!n.captureSubject)return{elementInfo:i};try{let t=await n.captureSubject(e.key);return t?{elementInfo:i,crop:t}:{elementInfo:i,warning:"Object crop unavailable; use the page screenshot and image coordinates."}}catch{return{elementInfo:i,warning:"Object crop unavailable (the image may block canvas access via CORS); use the page screenshot and image coordinates."}}}beginCreate(e){for(let t=this.adapters.length-1;t>=0;t-=1){let n=this.adapters[t],r=n?.beginCreate?.(e);if(n&&r)return{adapter:n,session:r}}return null}rename(e,t){let n=this.adapters.find(t=>t.id===e.adapter),r=n?.renameSubject?.(e.key,t);return n&&r?this.project(n,r):null}updateBounds(e,t){let n=this.adapters.find(t=>t.id===e.adapter),r=n?.updateSubjectBounds?.(e.key,t);return n&&r?this.project(n,r):null}updateTrackingAnchors(e,t){let n=this.adapters.find(t=>t.id===e.adapter),r=n?.updateSubjectTrackingAnchors?.(e.key,t);return n&&r?this.project(n,r):null}promote(e){let t=this.adapters.find(t=>t.id===e.adapter),n=t?.promoteSubject?.(e.key);return t&&n?this.project(t,n):null}remove(e){this.adapters.find(t=>t.id===e.adapter)?.removeSubject?.(e.key)}async captureSurfaces(){return(await Promise.all(this.adapters.map(async e=>e.captureSurfaces?.()??[]))).flat()}subscribeFrame(e){return this.frameListeners.add(e),()=>this.frameListeners.delete(e)}destroy(){null!==this.frame&&cancelAnimationFrame(this.frame),this.frame=null;for(let e of this.projections.values())e.element.remove();this.projections.clear();for(let e of this.adapterUnsubscribes)e();this.frameListeners.clear()}project(e,t){let n={adapter:e.id,key:t.key},r=`${e.id}\\0${t.key}`,i=this.projections.get(r);if(i)return i.subject=t,i.elementInfo=this.elementInfo(e,t,i.selector),jr(i.element,t),i;let o=Ar(n),a=document.createElement("div");a.dataset.popmeltSubjectAdapter=e.id,a.dataset.popmeltSubjectKey=t.key,a.dataset.popmeltSubjectLabel=t.label,a.dataset.popmeltSubjectProjection="true",a.setAttribute("aria-hidden","true"),Object.assign(a.style,{position:"fixed",pointerEvents:"none",opacity:"0",zIndex:"-1"}),jr(a,t),document.body.appendChild(a);let l={adapter:e,subject:t,target:n,element:a,selector:o,elementInfo:this.elementInfo(e,t,o)};return this.projections.set(r,l),this.ensureFrame(),l}elementInfo(e,t,n){return{selector:n,tagName:e.id,subjectLabel:t.label,textContent:t.label,context:t.context,...t.imageObject?{imageObject:t.imageObject}:{},...t.videoObject?{videoObject:t.videoObject}:{},dataAttributes:{adapter:e.id,key:t.key,...t.data??{}}}}ensureFrame(){null===this.frame&&0!==this.projections.size&&(this.frame=requestAnimationFrame(e=>{if(this.frame=null,this.lastProjectionFrameTime>0&&e-this.lastProjectionFrameTime<32)return void this.ensureFrame();this.lastProjectionFrameTime=e;let t=!1;for(let[e,n]of this.projections){let r=n.adapter.resolve(n.target.key);r?(n.subject=r,t=jr(n.element,r)||t):(n.element.remove(),this.projections.delete(e),t=!0)}if(t)for(let e of this.frameListeners)e();this.projections.size>0&&this.ensureFrame()}))}},Pr=u(d()),zr="devtools-active-text";function Nr(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}var _r=u(d()),Dr=1.1666666666666667;function Fr(e){return e.length>2048?`${e.slice(0,2048)}…`:e}function $r(e=22){return{height:e,minHeight:e,maxHeight:e,boxSizing:"border-box",flexShrink:0}}function Or(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Hr(e,t){return function(e,t){return e===t||yt(e,t)||yt(t,e)}(e,t)||null!==ht(e)&&ht(e)===ht(t)}function Wr(e,t){return Nt(e,t?.[0])}function Br(e){return!(!e.linkedSelector||"body"!==e.elements?.[0]?.tagName.toLowerCase())}function Vr(e){let t=mr(e,22,2,window.innerHeight);return{x:t.left+window.scrollX+8,y:t.top+window.scrollY+4}}function qr(e,t){if(0===t.size)return null;let n=new Set,r=new Set;for(let i of e)t.has(i.id)&&(i.groupId&&n.add(i.groupId),i.threadId&&r.add(i.threadId));for(let t of e)t.groupId&&n.has(t.groupId)&&t.threadId&&r.add(t.threadId);let i=new Set(t);for(let t of e)(t.groupId&&n.has(t.groupId)||t.threadId&&r.has(t.threadId))&&i.add(t.id);return i}function Yr(e,t,n=0,r,i,o=90){let a=e.left+window.scrollX+8,l="top-left"===t?e.top+window.scrollY-4-22-22*n+4:e.bottom+window.scrollY+4+4+22*n,s=window.scrollY+4,u=window.scrollY+window.innerHeight-22-4,c=null;if(r&&void 0!==i){let t=r.getBoundingClientRect(),n=e.left;if(n+i+16+o>t.left&&n<t.right)if(t.top<window.innerHeight/2){let e=window.scrollY+t.bottom+4;e>s&&(s=e,c="top")}else{let e=window.scrollY+t.top-22-4;e<u&&(u=e,c="bottom")}}return s>u&&(u=s),l<s?l="top"===c?s:e.top+window.scrollY+4:l>u&&(l="bottom"===c?u:Math.max(e.top+window.scrollY+4,u)),{x:a,y:l}}var Ur=u(d());function Xr(e,t){return t.selectors??(t.targetBindingId?[]:[e])}function Kr(e,t,n,r){let i=[...new Set(e)];return 1!==i.length?n:Qr(i[0],t,r)?.color??n}function Qr(e,t,n){for(let[n,r]of t)if(Xr(n,r).includes(e))return r;if(!n)return;let r=n(e);if(r)for(let[e,i]of t)if(Xr(e,i).some(e=>n(e)===r))return i}function Gr(e,t){return!(!t||e!==t&&!e.contains(t))}function Zr(e){let t=new Set(["resolved","needs_review","waiting_input","failed"]);return!!("text"===e.type&&e.text&&e.linkedSelector&&e.status&&t.has(e.status)&&e.threadId)}function Jr(e){let t=e.status??"pending",n=new Set(["pending","sending","in_flight","resolved","waiting_input","failed"]);return!!("text"===e.type&&e.text&&e.linkedSelector&&n.has(t))}function ei(e){return"bottom-left"===e?[2,8,8,8]:"bottom-right"===e?[8,2,8,8]:"top-right"===e?[8,8,2,8]:[8,8,8,2]}function ti(e){return ei(e).map(e=>`${e}px`).join(" ")}var ni=We;function ri(e){let t=window.innerWidth-e-16;return Math.max(60,Math.min(400,t))}function ii(e,t,n){let r=Fr(t);if(r===t&&e.measureText(r).width<=n)return r;let i="…",o=0,a=r.endsWith(i)?r.length-1:r.length;for(;o<a;){let t=Math.ceil((o+a)/2);e.measureText(r.slice(0,t)+i).width<=n?o=t:a=t-1}return o>0?r.slice(0,o)+i:i}function oi(e,t,n,r,i){let o=0,a=typeof window<"u"?window.innerHeight:9999;n&&function(e,t,n){if(void 0===e||void 0===t||void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,o=n.avoidRight??r;return e+t>i&&e<o}(r,i,n)&&(o=n.avoidTop??o,a=n.avoidBottom??a);let l=Math.max(o,a-t);return Math.max(o,Math.min(e,l))}function ai(e,t=12,n,r){let i=t*Dr+8,o=e.y-4,a=oi(o,i,n,e.x-8,r);return a===o?e:{...e,y:a+4}}function li(e){if(e.subjectLabel)return`<${e.subjectLabel}>`;let t=e.dataAttributes?.["data-popmelt-label"]?.trim();if(t)return t;let n=e.tagName,r=e.id?`#${e.id}`:"",i=e.className?`.${e.className.split(" ").slice(0,2).join(".")}`:"";return e.reactComponent?`<${e.reactComponent}> ${n}${r}${i}`:`${n}${r}${i}`}var si=u(d());function ui(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))return[...e];let n=e[e.length-1];return n&&Math.hypot(t.x-n.x,t.y-n.y)<2?[...e]:[...e.length>=256?e.filter((e,t)=>t%2==0):e,{x:t.x,y:t.y}]}function ci(e){return{left:Math.min(...e.map(e=>e.x)),top:Math.min(...e.map(e=>e.y)),right:Math.max(...e.map(e=>e.x)),bottom:Math.max(...e.map(e=>e.y))}}function di(e,t){let n=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){let o=t[r],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function fi(e){if(e.length<3)return[];let t=ci(e),n=[];for(let r=0;r<8;r++)for(let i=0;i<8;i++){let o={x:t.left+(i+.5)*(t.right-t.left)/8,y:t.top+(r+.5)*(t.bottom-t.top)/8};di(o,e)&&n.push(o)}return n}function pi(e){if(e.length<2)return null;let t=e[0],n=e[e.length-1];return t&&n?[t,n]:null}function hi(e,t,n){return e.map(e=>({x:e.x-t,y:e.y-n}))}function mi(e,t,n,r,i,o){let a=String(r);e.font="600 11px system-ui, -apple-system, sans-serif";let l=e.measureText(a).width+8,s=t-l/2,u=n+o/2+2;e.fillStyle=i,e.fillRect(s,u,l,19),e.fillStyle="#ffffff",e.textBaseline="middle",e.fillText(a,s+4,u+9.5)}function gi(e,t){if(e.points.length<2&&"text"!==e.type)return null;switch(e.type){case"rectangle":case"freehand":{let t,n;if("freehand"===e.type)t=Math.min(...e.points.map(e=>e.x)),n=Math.max(...e.points.map(e=>e.y));else{let r=e.points[0],i=e.points[e.points.length-1];t=Math.min(r.x,i.x),n=Math.max(r.y,i.y)}return{x:t,y:n}}case"circle":{let t=e.points[0],n=e.points[e.points.length-1];return{x:Math.min(t.x,n.x),y:(Math.min(t.y,n.y)+Math.max(t.y,n.y))/2}}case"line":{let t=e.points[0],n=e.points[e.points.length-1],r=t.y>n.y?t:n;return{x:r.x,y:r.y}}default:return null}}var yi=u(d());function xi(e){if(!e.isConnected||!at(e.ownerDocument))return!1;let t=lt(rt(e),e.ownerDocument);if(t.width<=0||t.height<=0||0===e.getClientRects().length)return!1;let n=e;for(;n;){let e=window.getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility||"collapse"===e.visibility||Number.parseFloat(e.opacity||"1")<=0)return!1;n=ht(n)}return!0}function vi(e,t){if(e?.isConnected){let t=fn(e);if(t&&xi(t))return{element:t,parentPinned:!e.matches("[data-popmelt-explore-original],[data-popmelt-explore-scene]")};let n=e;for(;n&&n!==document.documentElement;){if(xi(n))return{element:n,parentPinned:n!==e};n=ht(n)}}let n=function(e){if(!e)return null;try{return pt(e)}catch{return null}}(t);return n&&xi(n)?{element:n,parentPinned:!0}:null}function bi(e,t,n){return vi(e,n)?.element===t}function wi(e,t){return`[${e}="${typeof CSS<"u"&&"function"==typeof CSS.escape?CSS.escape(t):t.replace(/["\\\\]/g,"\\\\$&")}"]`}var Si=["id","data-pm","data-popmelt-frame","data-testid","data-test","data-cy","data-popmelt-media-id","data-popmelt-see-id","data-popmelt-subject-key","aria-label","name","href"],ki=["style","class","open","hidden","aria-hidden","data-state"];function Ci(e){let t=new Set(Si);for(let n of e){/\\.[\\w\\\\-]/.test(n)&&t.add("class");for(let e of n.matchAll(/\\[\\s*([\\w:-]+)/g))t.add(e[1]);if(/:(checked|disabled|enabled|required|optional|read-only|read-write)\\b/.test(n))for(let e of["checked","selected","disabled","required","readonly","contenteditable"])t.add(e)}return{attributes:[...new Set([...t,...ki])],changesIdentity:e=>"attributes"!==e.type||t.has(e.attributeName??"")}}function Ei({annotations:e,currentPathname:t,dispatch:n,stateRef:r,styleModifications:i,subjectRegistry:o,toolbarRef:a,onTargetResolutionChange:l}){let s=(0,yi.useContext)(Ct),[u,c]=(0,yi.useState)(()=>new Set),d=(0,yi.useMemo)(()=>e.filter(e=>e.linkedSelector&&(!e.pathname||e.pathname===t)).map(e=>[e.id,e.linkedSelector,e.text,e.fontSize,e.timestamp,JSON.stringify([e.elements?.[0]?.selector,e.elements?.[0]?.context,e.elements?.[0]?.targetFingerprint,e.elements?.[0]?.dataAttributes,e.elements?.[0]?.sourceElement?.dataAttributes])].join(":")).join("|"),[e,t]),f=(0,yi.useMemo)(()=>i.filter(e=>!e.pathname||e.pathname===t).map(e=>e.selector).sort().join("|"),[t,i]);return(0,yi.useEffect)(()=>{if(!s)return;if(!d)return void c(e=>0===e.size?e:new Set);let e=null,i=!1,u=document.createElement("canvas").getContext("2d"),f=null,p=new Map,h=new Map,m=new Map,g=Ci(r.current.annotations.flatMap(e=>[e.linkedSelector,e.elements?.[0]?.selector].filter(e=>!!e))),y=()=>{f=null,p.clear()},x=()=>{let e=r.current.styleModifications.filter(e=>!e.pathname||e.pathname===t),i=[],o=(()=>{if(f)return f;let e=r.current.annotations.filter(e=>e.linkedSelector&&(!e.pathname||e.pathname===t)),n=new Map;return f=e.flatMap(e=>{h.has(e.id)||h.set(e.id,function(e){let t=e.elements?.[0],n=t?.sourceElement?.dataAttributes,r=n?.["data-popmelt-media-id"]??n?.["data-popmelt-see-id"]??t?.dataAttributes?.["data-popmelt-media-id"]??t?.dataAttributes?.["data-popmelt-see-id"];if(r&&!e.linkedSelector?.startsWith("@frame(")&&!t?.selector.startsWith("@frame(")){let e=pt(wi("data-popmelt-media-id",r));if(e)return e;let t=pt(wi("data-popmelt-see-id",r));if(t)return t}return Nt(e.linkedSelector,t)}(e));let t=h.get(e.id);n.set(e.id,t);let r=vi(t,e.elements?.[0]?.context);return r?[{annotation:e,spatialAnchor:r}]:[]}),(n.size!==m.size||[...n].some(([e,t])=>m.get(e)!==t))&&(m=n,l?.()),f})(),s=new Map(r.current.annotations.map(e=>[e.id,e])),d=new Set(o.filter(({spatialAnchor:e})=>e.parentPinned).map(({annotation:e})=>e.id));c(e=>function(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}(e,d)?e:d);let g=new Map,y=new Map,x=new Map;for(let{annotation:e,spatialAnchor:t}of o){let n=x.get(t.element)??[];n.push(e),x.set(t.element,n)}let v=new Map;for(let e of x.values()){e.sort((e,t)=>e.timestamp-t.timestamp);let t,n=0,r=0;for(let i of e)i.timestamp!==t&&(t=i.timestamp,r=n),v.set(i.id,r),n+=1}for(let{annotation:t,spatialAnchor:n}of o){let r=n.element,o=g.get(r);o||(o=rt(r),g.set(r,o));let l=y.get(r);void 0===l&&(l=e.some(e=>{if(e.captured)return!1;try{return mt(r,e.selector)}catch{return!1}}),y.set(r,l));let c=(l?1:0)+(v.get(t.id)??0),d=p.get(t.id);if(void 0===d&&t.text&&u){let e=t.fontSize||12;u.font=`${e}px ${ni}`,d=Math.max(...t.text.split("\\n").map(e=>u.measureText(e).width))+(n.parentPinned?16:0),p.set(t.id,d)}let f=o.top>=22*(1+c)+4?"top-left":"bottom-left",h=r===document.body&&Br(t)?Vr(o):Yr(o,f,c,a?.current,d),m=s.get(t.id),x=m?.points[0],b=f!==m?.linkedAnchor;x&&(b||Math.abs(h.x-x.x)>1||Math.abs(h.y-x.y)>1)&&i.push({id:t.id,point:h,linkedAnchor:b?f:void 0})}i.length>0&&n({type:"UPDATE_LINKED_POSITIONS",payload:{updates:i}})};x();let v=()=>{y(),i||null!==e||(e=requestAnimationFrame(()=>{e=null,x()}))},b=xr(x);window.addEventListener("resize",v,!0),window.addEventListener("load",v),document.addEventListener("transitionend",v,!0),document.addEventListener("animationend",v,!0),document.fonts.ready.then(v);let w=o?.subscribeFrame(x),S=new Set,k=()=>{for(let e of ft())!(e instanceof ShadowRoot)||S.has(e)||(S.add(e),C.observe(e,E))},C=new MutationObserver(e=>{let t=e.filter(e=>{let t=e.target,n=t instanceof Element?t:t.parentElement;return!n||!gt(n,\'#devtools-toolbar, #devtools-canvas, #devtools-scrim, [data-popmelt-panel], [data-devtools="panel"], [data-devtools="panel-wrapper"], [data-devtools="annotation-badge-layer"], [data-popmelt-subject-projection]\')});t.some(e=>e.addedNodes.length)&&k(),t.some(g.changesIdentity)&&h.clear(),t.length&&v()}),E={attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:g.attributes};C.observe(document.body,E),k();let M=d.includes("@frame(")?mn(()=>{h.clear(),y(),x()}):void 0;return()=>{i=!0,M?.(),b(),window.removeEventListener("resize",v,!0),window.removeEventListener("load",v),document.removeEventListener("transitionend",v,!0),document.removeEventListener("animationend",v,!0),C.disconnect(),w?.(),e&&cancelAnimationFrame(e)}},[s,t,n,d,f,r,o,a,l]),u}var Mi=u(d()),Ti=u(d());function Ri(e,t,n=new Set){let r=function(e){let t=new Map;for(let n of e)n.groupId&&n.threadId&&t.set(n.groupId,n.threadId);return t}(e);return e.filter(e=>{let i=function(e,t){return e.threadId??(e.groupId?t.get(e.groupId):void 0)}(e,r);return function(e,t){return"string"==typeof e.pathname&&e.pathname===t}(e,t)&&"dismissed"!==e.status&&(!i||!n.has(i))})}function Ai(e,t,n,r=new Set,i=new Map){let o=new Set;for(let e of Ri(t,n,r))e.linkedSelector&&o.add(e.linkedSelector);for(let[e,t]of i)if(!r.has(t.threadId))for(let n of t.selectors??[e])o.add(n);return e.filter(e=>(!e.pathname||e.pathname===n)&&(!e.captured||o.has(e.selector)||!!e.durableSelector&&o.has(e.durableSelector)))}var Ii=u(d()),ji=u(d()),Li=u(d()),Pi=Number.MAX_SAFE_INTEGER;function zi(e){return`${e.pathname??"*"}\\0${e.selector}`}function Ni(e,t){return`element:${e??"*"}\\0${t}`}var _i=u(d()),Di=u(d()),Fi=(0,u(d()).createContext)(null),$i=u(v());function Oi({threadId:e,color:t,size:n}){let r=(0,Di.useContext)(Fi);if(!e||r?.preview?.threadId!==e)return null;let i=r.preview.enabled;return(0,$i.jsx)("button",{type:"button","data-devtools":"explore-preview-badge","aria-label":"Preview option on page","aria-pressed":i,title:i?"Turn off page preview":"Preview option on page",onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:e=>e.stopPropagation(),onClick:t=>{t.preventDefault(),t.stopPropagation(),r.setPreview(t=>t&&t.threadId===e?{...t,enabled:!t.enabled,revealOnPage:!1}:t)},style:{...$r(n),appearance:"none",width:28,minWidth:28,padding:0,margin:0,border:0,display:"grid",placeItems:"center",cursor:"pointer",backgroundColor:t,color:"#fff",borderRadius:8,opacity:i?1:.5},children:(0,$i.jsx)(ee,{size:12,strokeWidth:2.25})})}function Hi(e,t){return"text"===e.type&&(e.groupId?t.filter(t=>t.groupId===e.groupId):[e]).every(e=>"pending"===(e.status??"pending")&&!e.threadId)}var Wi=(0,u(d()).createContext)(0),Bi="\\n 0%, 100% { translate: 0 0; }\\n 20% { translate: -4px 0; }\\n 45% { translate: 4px 0; }\\n 70% { translate: -2px 0; }\\n 88% { translate: 1px 0; }\\n";function Vi(e){return`\\n<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">\\n <defs>\\n <mask id="cutout">\\n <rect width="100%" height="100%" fill="white" />\\n <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="${e.radius}" fill="black" />\\n </mask>\\n </defs>\\n <rect width="100%" height="100%" fill="white" mask="url(#cutout)" />\\n</svg>`}function qi(e){return`url("data:image/svg+xml,${encodeURIComponent(e)}")`}var Yi=qi(Vi({x:-100,y:-2,width:104,height:26,radius:10})),Ui=qi(Vi({x:-100,y:-5.929,width:108,height:26,radius:10}));function Xi(e,t,n,r=.5){let i=Math.max(0,e-2*r),o=Math.max(0,t-2*r),a=function(e,t,n){let r=Math.max(0,n.topLeft),i=Math.max(0,n.topRight),o=Math.max(0,n.bottomRight),a=Math.max(0,n.bottomLeft),l=Math.min(1,e/Math.max(1,r+i),e/Math.max(1,a+o),t/Math.max(1,r+a),t/Math.max(1,i+o));return{topLeft:r*l,topRight:i*l,bottomRight:o*l,bottomLeft:a*l}}(e,t,n),l=Math.max(0,a.topLeft-r),s=Math.max(0,a.topRight-r),u=Math.max(0,a.bottomRight-r),c=Math.max(0,a.bottomLeft-r),d=r+i,f=r+o;return[`M ${r+l} ${r}`,"H "+(d-s),`A ${s} ${s} 0 0 1 ${d} ${r+s}`,"V "+(f-u),`A ${u} ${u} 0 0 1 ${d-u} ${f}`,`H ${r+c}`,`A ${c} ${c} 0 0 1 ${r} ${f-c}`,`V ${r+l}`,`A ${l} ${l} 0 0 1 ${r+l} ${r}`,"Z"].join(" ")}var Ki=u(v()),Qi=12;function Gi(e){return e>0?16+7.2*String(e).length+16:0}function Zi({stepCount:e,onClear:t,layered:n=!1,submitted:r=!1,style:i}){let[o]=_e(),a=Ae[o];if(e<1)return null;let l=`${e} recorded ${1===e?"action":"actions"}${r?", sent":""}`;return(0,Ki.jsxs)("span",{"data-devtools":"interaction-episode-badge","data-popmelt-submitted":r?"true":void 0,"aria-label":l,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t?.()},style:{height:22,display:"inline-flex",alignItems:"center",boxSizing:"border-box",backgroundColor:r?"#8c8c8c":a.surface,border:`1px solid ${r?"#8c8c8c":a.border}`,borderRadius:8,color:r?"#dddddd":a.primary,fontFamily:ni,fontSize:12,fontWeight:600,padding:n?"0 8px 0 7px":"0 8px 0 5.6px",gap:4,pointerEvents:t?"auto":"none",WebkitMaskImage:n?Yi:void 0,maskImage:n?Yi:void 0,...i},children:[(0,Ki.jsxs)("svg",{"aria-hidden":!0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ki.jsx)("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),(0,Ki.jsx)("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})]}),(0,Ki.jsx)("span",{children:e})]})}function Ji(e,t,n){return function(e,t,n){if(void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,o=n.avoidRight??r;return e+t>i&&e<o}(t,n,e)?e:{}}function eo(e,t,n){return`translate(min(0px, calc(100vw - ${e} - 100%)), min(max(0px, calc(${void 0!==n.avoidTop?`${n.avoidTop}px`:"0px"} - ${t})), calc(${void 0!==n.avoidBottom?`${n.avoidBottom}px`:"100dvh"} - ${t} - 100%)))`}function to(e,t,n){if(void 0===n.avoidTop&&void 0===n.avoidBottom)return e;let r=typeof window<"u"?window.innerHeight:9999,i=n.avoidTop??0,o=n.avoidBottom??r,a=Math.max(i,o-t);return Math.max(i,Math.min(e,a))}function no({left:e,top:t,scrollX:n,scrollY:r,avoidTop:i,avoidBottom:o,style:a,children:l,...s}){let u=`calc(${e}px - var(--popmelt-scroll-x, ${n}px))`,c=`calc(${t}px - var(--popmelt-scroll-y, ${r}px))`,d=`calc(${e+Qi}px - var(--popmelt-scroll-x, ${n}px))`,f=`calc(${t+Qi}px - var(--popmelt-scroll-y, ${r}px))`;return(0,Ki.jsx)("div",{"data-devtools":"badge-hit-area",...s,style:{position:"fixed",left:0,top:0,padding:Qi,...a,transform:`translate3d(${u}, ${c}, 0)`,willChange:"transform"},children:(0,Ki.jsx)("div",{style:{transform:eo(d,f,{avoidTop:i,avoidBottom:o})},children:l})})}function ro({bundleCount:e,style:t,layered:n=!1,compact:r=!1,description:i,replacementText:o,onHoverChange:a,onSend:l}){let[s,u]=(0,_i.useState)(!1),[c]=_e(),d=Ae[c],f=(0,_i.useContext)(Wi),p=(0,_i.useId)(),h=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl",m=Math.max(1,e),g=r&&!s,y=e=>g?(0,Ki.jsx)(he,{size:12,strokeWidth:2,"aria-hidden":!0}):e?(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)("span",{style:{color:"inherit",fontWeight:600},children:m>1?`Send all ${m}`:"Send"}),(0,Ki.jsx)(he,{size:12,strokeWidth:2,"aria-hidden":!0})]}):(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"inherit",fontWeight:600},children:[(0,Ki.jsx)("span",{children:h}),(0,Ki.jsx)("span",{children:"+"}),(0,Ki.jsx)(J,{size:12,strokeWidth:2,"aria-hidden":!0})]}),(0,Ki.jsx)("span",{style:{color:d.secondary,fontWeight:600},children:"to"}),(0,Ki.jsx)(he,{size:12,strokeWidth:2,"aria-hidden":!0}),m>1&&(0,Ki.jsx)("span",{style:{color:"inherit",fontWeight:600},children:m})]}),x=e=>(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)("span",{className:"popmelt-send-hint-desktop",style:{alignItems:"center",gap:4},children:y(e)}),(0,Ki.jsxs)("span",{className:"popmelt-send-hint-mobile",style:{alignItems:"center",gap:4},children:[!g&&(0,Ki.jsx)("span",{style:{color:"inherit",fontWeight:600},children:"Send"}),(0,Ki.jsx)(he,{size:12,strokeWidth:2,"aria-hidden":!0})]})]}),v=o?(0,Ki.jsx)("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:o}):null,b={...$r(),lineHeight:"14px",display:"flex",alignItems:"center",boxSizing:"border-box",backgroundColor:d.surface,border:`1px solid ${d.border}`,fontFamily:ni,fontSize:12,color:d.primary,userSelect:"none",padding:n?"0 8px 0 10px":"0 8px",gap:4,whiteSpace:"nowrap",borderRadius:8,letterSpacing:"0.24px",WebkitMaskImage:n?Yi:void 0,maskImage:n?Yi:void 0},w=m>1?`Send all ${m} pending annotations`:"Send pending annotation";return(0,Ki.jsxs)("div",{"data-devtools":"send-hint-hit-area","data-popmelt-send-rejection":f?f%2?"odd":"even":void 0,onMouseEnter:()=>{u(!0),a?.(!0)},onMouseLeave:()=>{u(!1),a?.(!1)},style:{display:"grid",width:"max-content",...t},children:[(0,Ki.jsx)("style",{children:`\\n@keyframes popmelt-send-rejection-odd { ${Bi} }\\n@keyframes popmelt-send-rejection-even { ${Bi} }\\n[data-popmelt-send-rejection="odd"] { animation: popmelt-send-rejection-odd 220ms ease-out; }\\n[data-popmelt-send-rejection="even"] { animation: popmelt-send-rejection-even 220ms ease-out; }\\n@media (prefers-reduced-motion: reduce) {\\n [data-popmelt-send-rejection] { animation: none; }\\n}\\n.popmelt-send-hint-desktop { display: inline-flex; }\\n.popmelt-send-hint-mobile { display: none; }\\n@media (max-width: 767px) {\\n .popmelt-send-hint-desktop { display: none; }\\n .popmelt-send-hint-mobile { display: inline-flex; }\\n}\\n `}),(0,Ki.jsx)("div",{"aria-hidden":!0,style:{...b,gridArea:"1 / 1",visibility:"hidden"},children:x(!1)}),(0,Ki.jsxs)("button",{type:"button","data-devtools":"annotation-badge","aria-label":w,"aria-describedby":i?p:void 0,disabled:!l,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),l?.()},style:{...b,gridArea:"1 / 1",justifySelf:"start",maxWidth:o?"min(320px, calc(100vw - 16px))":void 0,overflow:o?"hidden":void 0,appearance:"none",margin:0,opacity:1,cursor:l?"pointer":"default",touchAction:"manipulation"},children:[i&&(0,Ki.jsx)("span",{id:p,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:i}),v??x(s)]})]})}function io({count:e,color:t,size:n=22,onHoverChange:r}){return(0,Ki.jsxs)("div",{"data-devtools":"nested-annotation-count-badge",onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),style:{height:n,display:"flex",alignItems:"center",backgroundColor:t,color:"#8c8c8c"===t?"#dddddd":"#ffffff",fontFamily:ni,fontSize:12,fontWeight:600,lineHeight:1,padding:"0 8px",borderRadius:8,userSelect:"none",whiteSpace:"nowrap"},children:["+",e]})}function oo({annotations:e,supersededAnnotations:t,inFlightIds:n,orientationLabels:r,activeIds:i,queuePositions:o,scrollX:a,scrollY:l,annotationGroupMap:s,onViewThread:u,onSelectAnnotation:c,onDeleteDraftAnnotation:d,onClearInteractionEpisode:f,onHoverAnnotation:p,canvasRef:h,toolbarRef:m,activeBundleAnnotationIds:g,inactiveBundleOpacity:y=.5,animateBundleOpacity:x=!0,hoverRestoredAnnotationIds:v,nestedAnnotationCountById:b,nestedAnnotationIdsById:w,onHoverNestedAnnotations:S,onHoverSendBundle:k,onSend:C,sendHintAnchorId:E,pendingBundleCount:M=1,parentPinnedAnnotationIds:T,parentPinnedLocationLabels:R,parentPinnedTooltipAnnotationId:A,onActivateAnnotation:I,hiddenAnnotationIds:j,displayAnnotations:L}){let P=(0,_i.useContext)(Fi),z=(0,_i.useContext)(Ct),N=(0,_i.useRef)(null),[_,D]=(0,_i.useState)(0),F=!!(n&&n.size>0&&(void 0===i||i.size>0));(0,_i.useEffect)(()=>{if(!F||!z)return;let e=setInterval(()=>{D(e=>(e+1)%3)},250);return()=>{clearInterval(e)}},[F,z]),(0,_i.useEffect)(()=>{if(!z)return;let e=N.current;if(!e)return;let t=()=>{e.style.setProperty("--popmelt-scroll-x",`${window.scrollX}px`),e.style.setProperty("--popmelt-scroll-y",`${window.scrollY}px`)};return t(),window.addEventListener("scroll",t,{passive:!0,capture:!0}),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}},[z]);let $=[],O=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl";for(let o of e){if("text"!==o.type||!o.text||!o.points[0]||t.has(o)||j?.has(o.id))continue;let l=o.groupId?e.filter(e=>e.groupId===o.groupId):[o],u=o.status??"pending",c=M>0&&o.id===E,d=o.interactionEpisode?.steps.length??0,f=b?.get(o.id)??0,p=w?.get(o.id)??[],m=l.reduce((e,t)=>Math.max(e,t.replyCount??0),0),y="sending"===u||l.some(e=>"sending"===e.status),x="awaiting_review"===u,S=!y&&(!(!n||!n.has(o.id)&&!l.some(e=>n.has(e.id)))||"in_flight"===o.status||l.some(e=>"in_flight"===e.status)),k=l.some(e=>"resolved"===e.status&&(e.replyCount??0)>0||"needs_review"===e.status),C=l.some(e=>e.threadId),R=!g||l.some(e=>g.has(e.id)||v?.has(e.id));if(!(c||y||x||S||"resolved"===u||"failed"===u||"needs_review"===u||k||C||d>0)&&0===f)continue;let A=o.threadId||l.find(e=>e.threadId)?.threadId,I="needs_review"===u||l.some(e=>"needs_review"===e.status),P="waiting_input"===u||l.some(e=>"waiting_input"===e.status),z="failed"===u||l.some(e=>"failed"===e.status),N=c||y||x||S||I||P||z||m>0||"resolved"===u&&C||d>0;if(!N&&0===f)continue;let _=o.points[0],D=o.fontSize||12,F=D*Dr,O=s.get(o.id),H=((L?.find(e=>e.id===o.id)??o).text??o.text).replace(/\\n/g," "),W=void 0!==O?O+". "+H:H,B=h?.current?.getContext("2d")??document.createElement("canvas").getContext("2d");if(!B)continue;B.font=`${D}px ${ni}`;let V=_.x-a,q=T?.has(o.id)?16:0,Y=ii(B,W,Math.max(60,ri(V)-q)),U=B.measureText(Y).width,X=S&&!!i&&!i.has(o.id)&&!l.some(e=>i.has(e.id));$.push({id:o.id,threadId:A,linkedSelector:o.linkedSelector||l.find(e=>e.linkedSelector)?.linkedSelector,x:_.x+U+q+8+2,y:_.y-4,size:F+8,color:c?"#000000":o.color,isSending:y,isAwaitingReview:x,isInFlight:S,orientationLabel:r?.get(o.id)??l.map(e=>r?.get(e.id)).find(Boolean),isQueued:X,queuePosition:void 0,isNeedsReview:I,isQuestion:P,isFailed:z,replyCount:m>0?m:"resolved"===u&&C?1:0,isInActiveBundle:R,isSendHint:c,interactionEpisodeStepCount:d,interactionEpisodeSubmitted:"pending"!==u,nestedCount:f,nestedAnnotationIds:p,nestedColor:"pending"===u?o.color:"#8c8c8c",showActionBadge:N,canDeleteDraft:Hi(o,e)})}let H=$.filter(e=>e.isQueued);if(H.length>0&&H.forEach((e,t)=>{e.queuePosition=o?.get(e.id)??`(${t+1}/${H.length})`}),0===$.length)return null;let W=h?.current?.getContext("2d")??document.createElement("canvas").getContext("2d"),B=$.map(e=>{W&&(W.font=`12px ${ni}`);let t=e.nestedCount>0?(W?.measureText(`+${e.nestedCount}`).width??7.2*String(e.nestedCount).length+7.2)+16:0,n=Gi(e.interactionEpisodeStepCount),r=e.threadId&&P?.preview?.threadId===e.threadId?30:0;if(!e.showActionBadge)return t+n+r;let i,o=A===e.id?R?.get(e.id):void 0;i=o||(e.isSendHint?O:e.isSending?"Sending":e.isAwaitingReview?"Awaiting review":e.isInFlight?e.isQueued?"Queued"+(e.queuePosition?` ${e.queuePosition}`:""):e.orientationLabel??"Thinking":e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision");let a=e.isSendHint||o?0:12,l=7.2*i.length;W&&(l=W.measureText(i).width);let s=e.isSendHint&&W?W.measureText("to").width:e.isSendHint?14.4:0,u=e.isSendHint&&W?W.measureText("+").width:e.isSendHint?7.2:0,c=e.isSendHint&&M>1&&W?W.measureText(String(M)).width:e.isSendHint&&M>1?7.2:0;return n+t+(o?Math.min(l+16,320):e.isSendHint?l+u+s+c+16+12+12+4+4*(M>1?3:2):6+a+4+l+8)+2*(+(n>0)+ +(t>0)+1-1)+r}),V=function(e){let t=e?.current?.getBoundingClientRect();return!t||typeof window>"u"?{}:t.top<window.innerHeight/2?{avoidTop:t.bottom+8,avoidLeft:t.left-8,avoidRight:t.right+8}:{avoidBottom:t.top-8,avoidLeft:t.left-8,avoidRight:t.right+8}}(m),q=[];for(let e=0;e<$.length;e++){let t=$[e].y-l,n=$[e].x-a,r=Ji(V,n,B[e]),i=to(t,$[e].size,r),o=i+$[e].size,s=n;for(let t=0;t<e;t++){let e=$[t].y-l,n=Ji(V,q[t],B[t]),r=to(e,$[t].size,n);if(!(i<r+$[t].size&&o>r))continue;let a=q[t]+B[t];s<a+2&&(s=a+2)}q.push(s)}let Y={position:"fixed",inset:0,pointerEvents:"none",zIndex:9999,"--popmelt-scroll-x":`${a}px`,"--popmelt-scroll-y":`${l}px`};return(0,Ki.jsxs)("div",{ref:N,"data-devtools":"annotation-badge-layer",style:Y,children:[(0,Ki.jsx)("style",{dangerouslySetInnerHTML:{__html:\'\\n[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"]::selection,\\n[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"] *::selection {\\n background: #000000;\\n color: #ffffff;\\n}\\n\'}}),$.map((e,t)=>{let n=!!e.threadId,r=R?.get(e.id),i=!!r&&A===e.id,o=n||!!r,s=!!e.threadId&&P?.preview?.threadId===e.threadId,h=e.showActionBadge&&e.isSendHint||s,m=o&&!h,g=()=>{I?I(e.id,e.threadId):(c?.(e.id),e.threadId&&u?.(e.threadId))},v=Ji(V,q[t],B[t]);return(0,Ki.jsx)(no,{left:q[t]+a-Qi,top:e.y-Qi,scrollX:a,scrollY:l,avoidTop:v.avoidTop,avoidBottom:v.avoidBottom,onMouseDown:e=>e.stopPropagation(),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.canDeleteDraft&&d&&d(e.id)},onClick:o?e=>{e.stopPropagation(),g()}:void 0,onMouseEnter:()=>{p?.(e.id)},onMouseLeave:()=>{p?.(null)},onFocus:()=>p?.(e.id),onBlur:()=>p?.(null),onKeyDown:m?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g())}:void 0,role:m?"button":void 0,tabIndex:m?0:void 0,"aria-label":m&&r?`${r}. Activate to reveal the annotation source${n?" and open its thread":""}`:void 0,style:{pointerEvents:"auto",cursor:o?"pointer":void 0,zIndex:9999,minWidth:e.isSendHint?B[t]:void 0},children:(0,Ki.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:2},children:[(0,Ki.jsx)(Zi,{stepCount:e.interactionEpisodeStepCount,submitted:e.interactionEpisodeSubmitted,onClear:e.canDeleteDraft&&f?()=>f(e.id):void 0}),e.nestedCount>0&&(0,Ki.jsx)(io,{count:e.nestedCount,color:e.nestedColor,size:e.size,onHoverChange:t=>S?.(e.id,t?e.nestedAnnotationIds:null)}),(0,Ki.jsx)(Oi,{threadId:e.threadId,color:e.color,size:e.size}),e.showActionBadge&&(e.isSendHint?(0,Ki.jsx)(ro,{bundleCount:M,description:r?`${r}. Activate the annotation label to reveal its source.`:void 0,replacementText:i?r:void 0,onHoverChange:k,onSend:C}):(0,Ki.jsx)("div",{"data-devtools":"annotation-badge",style:{...$r(e.size),display:"flex",alignItems:"center",backgroundColor:e.color,fontFamily:ni,fontSize:12,color:"#ffffff",userSelect:"none",padding:"0 8px 0 6px",gap:4,whiteSpace:"nowrap",maxWidth:i?"min(320px, calc(100vw - 16px))":void 0,overflow:i?"hidden":void 0,borderRadius:8,opacity:e.isInActiveBundle?1:y,transition:x?"opacity 120ms ease-out":"none"},children:i?(0,Ki.jsx)("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:r}):e.isAwaitingReview?(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)(G,{size:12,strokeWidth:2.25}),"Awaiting review"]}):e.isQueued?(0,Ki.jsxs)("span",{style:{opacity:.6,color:"inherit",display:"inline-flex",alignItems:"center",gap:4},children:[(0,Ki.jsx)(G,{size:12,strokeWidth:2.25}),"Queued",e.queuePosition?` ${e.queuePosition}`:""]}):e.isSending||e.isInFlight?(0,Ki.jsxs)(Ki.Fragment,{children:["Approval needed"===e.orientationLabel?(0,Ki.jsx)(se,{size:12,"aria-label":"Approval needed"}):(0,Ki.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle",opacity:.6},children:1===_?(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)("circle",{cx:"7",cy:"7",r:"2"}),(0,Ki.jsx)("circle",{cx:"17",cy:"7",r:"2"}),(0,Ki.jsx)("circle",{cx:"7",cy:"17",r:"2"}),(0,Ki.jsx)("circle",{cx:"17",cy:"17",r:"2"})]}):(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)("circle",{cx:"12",cy:"6",r:"2"}),(0,Ki.jsx)("circle",{cx:"6",cy:"12",r:"2"}),(0,Ki.jsx)("circle",{cx:"18",cy:"12",r:"2"}),(0,Ki.jsx)("circle",{cx:"12",cy:"18",r:"2"})]})}),(0,Ki.jsx)("span",{style:{opacity:.6,color:"inherit"},children:e.isSending?"Sending":e.isQueued?"Queued"+(e.queuePosition?` ${e.queuePosition}`:""):e.orientationLabel??"Thinking"})]}):(0,Ki.jsxs)(Ki.Fragment,{children:[e.isQuestion?(0,Ki.jsx)(ne,{size:12,strokeWidth:2.25}):e.isFailed?(0,Ki.jsx)(ye,{size:12,strokeWidth:2.25}):e.replyCount>0?(0,Ki.jsx)(de,{size:12,strokeWidth:2.25}):(0,Ki.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ki.jsx)("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}),(0,Ki.jsx)("path",{d:"M10 21h4"})]}),(0,Ki.jsx)("span",{style:{color:"inherit"},children:e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision"})]})}))]})},e.id)})]})}function ao({d:e,color:t,animated:n}){let r=(0,_i.useRef)(null);return(0,_i.useLayoutEffect)(()=>{let e=r.current;if(!e||"function"!=typeof e.getTotalLength)return;let t=function(e){if(Number.isFinite(e)&&!(e<=0))return Math.max(1,Math.round(e/Ze))*Ze}(e.getTotalLength());void 0===t?e.removeAttribute("pathLength"):e.setAttribute("pathLength",String(t))},[e]),(0,Ki.jsx)("path",{ref:r,d:e,fill:"none",stroke:t,strokeWidth:1,strokeDasharray:n?Ge:void 0,"data-popmelt-marching-stroke":n||void 0,style:n?{animation:"popmelt-march 0.6s linear infinite"}:void 0})}function lo(){return(0,Ki.jsx)("style",{children:`\\n @keyframes popmelt-march {\\n from { stroke-dashoffset: 0; }\\n to { stroke-dashoffset: -${Ze}; }\\n }\\n @media (prefers-reduced-motion: reduce) {\\n [data-popmelt-marching-stroke="true"] { animation: none !important; }\\n }\\n `})}function so({annotations:e,activeIds:t,scrollX:n,scrollY:r,spotlightIds:i,emphasizedIds:o,hoverRestoredIds:a,inactiveOpacity:l=.5}){if(!(0,_i.useContext)(Ct))return null;let s=e.filter(e=>e.region&&e.region.points.length>=3&&t?.has(e.id));return s.length?(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)(lo,{}),(0,Ki.jsx)("svg",{"data-devtools":"marching-lasso","aria-hidden":!0,style:{position:"fixed",inset:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:9995,overflow:"visible"},children:(0,Ki.jsx)("g",{transform:`translate(${-n} ${-r})`,children:s.map(e=>{let t=i?.size?i.has(e.id)?1:.2:!o||o.has(e.id)||a?.has(e.id)?1:l;return(0,Ki.jsx)("g",{"data-popmelt-region-id":e.id,opacity:t,children:(0,Ki.jsx)(ao,{d:`${e.region.points.map((e,t)=>`${t?"L":"M"}${e.x} ${e.y}`).join(" ")} Z`,color:e.color,animated:!0})},e.id)})})})]}):null}function uo({inFlightSelectorColors:e,animated:t=!0,subjectRegistry:n,selectorElementInfo:r}){let i=(0,_i.useContext)(Ct),[o,a]=(0,_i.useState)([]);return(0,_i.useEffect)(()=>{if(!i)return;if(0===e.size)return void a([]);let t=null,o=()=>{let t=[];for(let[n,i]of e){let e=Nt(n,r?.get(n));if(!e)continue;let o=rt(e);t.push({selector:n,top:o.top,left:o.left,width:o.width,height:o.height,color:i,radius:An(e),radiusStyle:Rn(e)})}a(t)},l=()=>{t&&cancelAnimationFrame(t),t=requestAnimationFrame(o)};o(),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l,!0);let s=new MutationObserver(l);s.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class"]});let u=n?.subscribeFrame(o),c=[...e.keys()].some(e=>e.startsWith("@frame("))?mn(o):void 0;return()=>{window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l,!0),s.disconnect(),u?.(),c?.(),t&&cancelAnimationFrame(t)}},[e,n,r,i]),0===o.length?null:(0,Ki.jsxs)(Ki.Fragment,{children:[t&&(0,Ki.jsx)(lo,{}),o.map(e=>(0,Ki.jsx)("div",{"data-devtools":"marching-ants",style:{position:"fixed",top:e.top,left:e.left,width:e.width,height:e.height,pointerEvents:"none",zIndex:9995,overflow:"visible",borderTopLeftRadius:e.radiusStyle.topLeft,borderTopRightRadius:e.radiusStyle.topRight,borderBottomRightRadius:e.radiusStyle.bottomRight,borderBottomLeftRadius:e.radiusStyle.bottomLeft},children:(0,Ki.jsx)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible"},children:(0,Ki.jsx)(ao,{d:Xi(e.width,e.height,{topLeft:e.radius["top-left"],topRight:e.radius["top-right"],bottomRight:e.radius["bottom-right"],bottomLeft:e.radius["bottom-left"]}),color:e.color,animated:t})})},e.selector))]})}var co=u(v());function fo(e){return`${e} image${e>1?"s":""} attached`}function po(e){return e<=0?0:32+7.2*String(e).length}function ho({imageCount:e,color:t,layered:n=!1}){return e<=0?null:(0,co.jsxs)("div",{"data-devtools":"active-image-attachment-badge",role:"img","aria-label":fo(e),title:fo(e),style:{position:"relative",flex:"0 0 auto",display:"flex",marginRight:-2,zIndex:2},children:[(0,co.jsx)("span",{"aria-hidden":!0,style:{position:"absolute",left:-4,top:"50%",width:14.142,height:14.142,transform:"translateY(-50%)",display:"grid",placeItems:"center",pointerEvents:"none",maskImage:n?Ui:void 0,WebkitMaskImage:n?Ui:void 0},children:(0,co.jsx)("span",{style:{width:10,height:10,background:t,transform:"rotate(-45deg)"}})}),(0,co.jsxs)("span",{style:{position:"relative",display:"flex",alignItems:"center",gap:4,height:22,padding:n?"0 8px 0 10px":"0 8px",borderRadius:8,backgroundColor:t,color:"#fff",font:`12px/1.2 ${He}`,whiteSpace:"nowrap",maskImage:n?Yi:void 0,WebkitMaskImage:n?Yi:void 0},children:[(0,co.jsx)(te,{size:12,strokeWidth:2,"aria-hidden":!0}),e]})]})}function mo({point:e,scroll:t,attachments:n,showAttachments:r,onRemoveAttachment:i}){return(0,co.jsx)(co.Fragment,{children:r&&n.length>0&&(0,co.jsx)("div",{"data-devtools":!0,style:{position:"fixed",left:e.x-8-t.x,top:e.y-4-t.y-24,zIndex:10001,display:"flex",gap:4,flexWrap:"wrap",maxWidth:400},children:n.map(e=>(0,co.jsxs)("button",{type:"button",title:"Remove attachment",onMouseDown:e=>e.preventDefault(),onClick:()=>i(e.id),style:{appearance:"none",border:0,borderRadius:8,background:"rgba(0,0,0,0.72)",color:"#fff",cursor:"pointer",font:"11px/16px system-ui, sans-serif",padding:"2px 7px",whiteSpace:"nowrap"},children:[e.name," · ",Nr(e.size)," ×"]},e.id))})})}var go=u(v());function yo({rawLeft:e,width:t,top:n,scroll:r,collisionId:i,nestedAnnotationCount:o,nestedAnnotationIds:a,nestedBadgeColor:l,interactionEpisodeStepCount:s,imageCount:u=0,color:c="#f50",showSendHint:d,bundleCount:f,onHoverNestedAnnotations:p,onHoverSendHint:h,onClearInteractionEpisode:m,onSend:g}){return 0!==o||0!==s||0!==u||d?(0,go.jsx)(no,{"data-popmelt-active-annotation-surface":"true",left:e+t+r.x+2-Qi,top:n+r.y-Qi,scrollX:r.x,scrollY:r.y,onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},style:{pointerEvents:"auto",zIndex:10002},children:(0,go.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:2},children:[(0,go.jsx)(Zi,{stepCount:s,onClear:m}),o>0&&i&&(0,go.jsx)(io,{count:o,color:l,onHoverChange:e=>p(i,e?a:null)}),(0,go.jsxs)("div",{style:{display:"flex",alignItems:"center",isolation:"isolate",marginLeft:u>0?4:0},children:[(0,go.jsx)(ho,{imageCount:u,color:c}),d&&(0,go.jsx)(ro,{layered:u>0,bundleCount:Math.max(1,f),onHoverChange:h,onSend:g})]})]})}):null}var xo=u(d());function vo(e,t,n){let r=[],i=0;for(let{textNode:o}of e){let e=Math.max(0,t-i),a=Math.min(o.length,n-i);if(i+=o.length,e>a||t!==n&&e===a||!o.isConnected)continue;let l=o.ownerDocument.createRange();l.setStart(o,e),l.setEnd(o,a);for(let e of l.getClientRects())e.height&&(t===n||e.width)&&r.push(nt(e,o.ownerDocument));if(t===n&&t<i&&r.length)break}if(t===n&&!r.length&&!i){let t=e[0]?.textNode.parentElement?.closest("p")?.querySelector("br[data-popmelt-empty-paragraph]");if(t)return[nt(t.getBoundingClientRect(),t.ownerDocument)]}return t===n?r.slice(-1):r}function bo(e,t,n,r,i){let o=e[0]?.textNode.ownerDocument;if(!o)return null;let a=it(t,n,o),l=r.style.pointerEvents,s=i?.style.pointerEvents;r.style.pointerEvents="none",i&&(i.style.pointerEvents="none");try{let t=Fn(o,a.x,a.y);if(!t)return null;let n=0;for(let{textNode:r}of e){if(r===t.node)return n+t.offset;n+=r.length}return null}finally{r.style.pointerEvents=l,i&&(i.style.pointerEvents=s??"")}}var wo=u(d()),So=u(d()),ko=u(v());function Co({inputRef:e,value:t,style:n,command:r,onChange:i,onKeyDown:o,...a}){let l=(0,wo.useRef)(null),{active:s,complete:u,hintId:c,inputProps:d}=function(e,t){let n=(0,So.useId)(),[r,i]=(0,So.useState)(-1),[o,a]=(0,So.useState)(!1),l=t.some(({suffix:e})=>e);(0,So.useLayoutEffect)(()=>{let t=e.current;if(!t||!l)return;let n=()=>i(t.matches(":focus")&&t.selectionStart===t.selectionEnd?t.selectionEnd:-1),r=()=>i(-1);return n(),t.addEventListener("selectionchange",n),t.addEventListener("select",n),t.addEventListener("input",n),t.addEventListener("focus",n),t.addEventListener("blur",r),()=>{t.removeEventListener("selectionchange",n),t.removeEventListener("select",n),t.removeEventListener("input",n),t.removeEventListener("focus",n),t.removeEventListener("blur",r)}},[l,e]);let s=o?void 0:t.find(({start:e,token:t,suffix:n})=>n&&e+t.length===r);return{active:s,complete:function(e,t){let n=e.currentTarget;if(!s||"Tab"!==e.key||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||e.nativeEvent.isComposing||n.selectionStart!==r||n.selectionEnd!==r)return!1;e.preventDefault(),e.stopPropagation();let i=/\\s/.test(n.value.charAt(r)),o=s.suffix+(i?"":" ");return n.ownerDocument.execCommand?.("insertText",!1,o)||(n.setRangeText(o,r,r,"end"),t()),i&&n.setSelectionRange(r+o.length+1,r+o.length+1),!0},hintId:n,inputProps:{"aria-autocomplete":s?"inline":void 0,"aria-describedby":s?n:void 0,onCompositionStart:()=>a(!0),onCompositionEnd:()=>a(!1)}}}(e,r?[r]:[]),f=s?.suffix;function p(e){l.current&&(l.current.scrollTop=e.scrollTop,l.current.scrollLeft=e.scrollLeft)}return(0,wo.useLayoutEffect)(()=>{e.current&&r&&p(e.current)},[r,e,t]),(0,ko.jsxs)(ko.Fragment,{children:[r&&(0,ko.jsxs)("div",{ref:l,"aria-hidden":"true","data-devtools":"annotation-command-display",style:{...n,position:"relative"===n.position?"absolute":n.position,pointerEvents:"none",userSelect:"none",fontWeight:400},children:[r.leading,(0,ko.jsxs)("strong",{style:{fontWeight:700},children:[r.token,f&&(0,ko.jsx)("span",{style:{opacity:.55},children:f})]}),r.body]}),(0,ko.jsx)("textarea",{...a,ref:e,value:t,...d,onChange:e=>{let t=e.currentTarget;i(t.value,t.selectionStart)},onKeyDown:e=>{let t=e.currentTarget;u(e,()=>i(t.value,t.selectionStart))||o?.(e)},onScroll:e=>p(e.currentTarget),style:r?{...n,color:"transparent",caretColor:n.color,backgroundColor:"transparent",fontWeight:400}:n}),r&&f&&(0,ko.jsxs)("span",{hidden:!0,id:c,children:["Press Tab to complete ",r.token,f,"."]})]})}var Eo=u(v());function Mo({value:e,command:t,fontSize:n,prefix:r,inputRef:i,inputStyle:o,segments:a,canvasRef:l,selectionBackground:s,selectionColor:u,annotationBorderRadius:c,activeColor:d,boundaryRects:f,viewportClip:p,wrapsDomText:h,showEditor:m,rawLeft:g,top:y,baselineOffset:x,onChange:v,onKeyDown:b,onPaste:w,onBlur:S}){let k=function(e,t){let[n,r]=(0,xo.useState)(null),i=(0,xo.useRef)(null),o=(0,xo.useRef)(null),a=t=>{if(!e)return;let n=t.selectionStart,i=t.selectionEnd;r(e=>e?.start===n&&e.end===i?e:{start:n,end:i})};function l(n,r){if(!e||0!==n.button||!r&&!i.current)return;let l=n.currentTarget,s=bo(e,n.clientX,n.clientY,l,t.current);if(null===s)return;n.preventDefault(),l.focus({preventScroll:!0});let u=function(e,t,n){if(n>=3)return{start:0,end:e.length};if(2===n&&"function"==typeof Intl.Segmenter){let n=new Intl.Segmenter(void 0,{granularity:"word"}).segment(e).containing(Math.min(t,e.length-1));if(n)return{start:n.index,end:n.index+n.segment.length}}return{start:t,end:t}}(l.value,s,r?n.detail:i.current.clicks);if(r){o.current=null;let e="backward"===l.selectionDirection?l.selectionEnd:l.selectionStart;i.current={anchor:n.shiftKey?{start:e,end:e}:u,clicks:n.detail}}let c=i.current.anchor;l.setSelectionRange(Math.min(c.start,u.start),Math.max(c.end,u.end),u.start<c.start?"backward":"forward"),a(l)}return{rects:e&&n?vo(e,n.start,n.end):[],caret:n?.start===n?.end,events:e?{onKeyDownCapture:function(n){let r=n.currentTarget,i="ArrowUp"===n.key?-1:"ArrowDown"===n.key?1:0,l="Home"===n.key||n.metaKey&&"ArrowLeft"===n.key,s="End"===n.key||n.metaKey&&"ArrowRight"===n.key;if(i||(o.current=null),!e||!i&&!l&&!s||n.altKey||n.ctrlKey||n.metaKey&&"ArrowLeft"!==n.key&&"ArrowRight"!==n.key||n.nativeEvent.isComposing)return;let u="backward"===r.selectionDirection,c=u?r.selectionStart:r.selectionEnd,d=u?r.selectionEnd:r.selectionStart,f=vo(e,c,c)[0];if(!f)return;let p=_n(vo(e,0,r.value.length)),h=f.top+f.height/2,m=p.findIndex(e=>h>=e.top&&h<=e.top+e.height);if(m<0)return;let g,y=p[m+i];if(y){i&&null===o.current&&(o.current=f.left);let n=l?y.left:s?y.left+y.width:o.current??f.left;g=bo(e,Math.max(y.left+.1,Math.min(y.left+y.width-.1,n)),y.top+y.height/2,r,t.current)}else g=i<0?0:r.value.length;if(null===g)return;n.preventDefault();let x=n.shiftKey?d:g;r.setSelectionRange(Math.min(x,g),Math.max(x,g),g<x?"backward":"forward"),a(r)},onPointerDown:e=>{"mouse"===e.pointerType&&0===e.button&&e.currentTarget.setPointerCapture(e.pointerId)},onInput:e=>a(e.currentTarget),onSelect:e=>a(e.currentTarget),onMouseDown:e=>l(e,!0),onMouseMove:e=>{1===e.buttons?l(e,!1):i.current=null},onMouseUp:()=>{i.current=null}}:{}}}(a,l),C=void 0!==f;return(0,Eo.jsxs)("div",{"data-devtools":"text-editor-layer",style:p?{position:"fixed",inset:0,pointerEvents:"none",zIndex:10002,clipPath:`inset(${p.top}px ${Math.max(0,window.innerWidth-p.left-p.width)}px ${Math.max(0,window.innerHeight-p.top-p.height)}px ${p.left}px)`}:{display:"contents"},children:[(0,Eo.jsx)("style",{children:`\\n#devtools-text-input::placeholder { color: rgba(255, 255, 255, 0.5); }\\n#devtools-text-input::selection {\\n background: ${s};\\n color: ${u};\\n}\\n@keyframes popmeltDomCaret { 50% { opacity: 0; } }\\n@media (prefers-reduced-motion: no-preference) {\\n [data-devtools=\'text-edit-caret\'] { animation: popmeltDomCaret 1s step-end infinite; }\\n}\\n@keyframes popmeltAnnotationFieldEnter {\\n from { border-radius: 8px; }\\n to { border-radius: ${c}; }\\n}\\n@media (prefers-reduced-motion: reduce) {\\n #devtools-text-input { animation: none !important; }\\n}\\n`}),f?.map((e,t)=>(0,Eo.jsx)("div",{"data-devtools":"text-edit-active-boundary",style:{position:"fixed",left:e.left,top:e.top,width:e.width,height:e.height,pointerEvents:"none",zIndex:10002,border:`1px solid ${d}`,backgroundColor:yn(d,.08),boxSizing:"border-box"}},`${e.left}:${e.top}:${t}`)),m&&k.rects.map((e,t)=>(0,Eo.jsx)("div",{"aria-hidden":!0,"data-devtools":k.caret?"text-edit-caret":"text-edit-selection",style:{position:"fixed",left:e.left,top:e.top,width:k.caret?1:e.width,height:e.height,pointerEvents:"none",zIndex:10002,backgroundColor:k.caret?d:s}},`${e.left}:${e.top}:${t}`)),m&&(0,Eo.jsx)(Co,{id:"devtools-text-input","data-popmelt-active-annotation-surface":C?void 0:"true",inputRef:i,command:t,value:e,onChange:v,onKeyDown:b,onPaste:w,onBlur:S,placeholder:C?void 0:"Type here...",wrap:C?h?"soft":"off":void 0,spellCheck:!1,...k.events,style:{...o,pointerEvents:"auto",opacity:k.rects.length?0:o.opacity}}),m&&!C&&r&&(0,Eo.jsx)("span",{"aria-hidden":!0,"data-devtools":"annotation-number",style:{position:"fixed",left:g+8,top:y+4+x,zIndex:10002,pointerEvents:"none",color:"#ffffff",fontFamily:ni,fontSize:n,lineHeight:n*Dr+"px",whiteSpace:"pre"},children:r})]})}var To=u(v());function Ro({anchor:e,insetTopLeft:t=!1,width:n,height:r,value:i,command:o,fontSize:a,prefix:l,inputRef:s,inputStyle:u,onChange:c,onKeyDown:d,onPaste:f,onBlur:p,onContextMenu:h}){return(0,To.jsxs)("div",{"data-popmelt-active-annotation-surface":"true",onContextMenu:h,style:{position:"relative",width:n,height:r,flex:`0 0 ${n}px`},children:[(0,To.jsx)(Co,{id:"devtools-text-input","data-popmelt-active-annotation-surface":"true",inputRef:s,command:o,value:i,onChange:c,onKeyDown:d,onPaste:f,onBlur:p,onClick:e=>e.stopPropagation(),placeholder:"Type here...",spellCheck:!1,style:{...u,position:"relative",left:0,top:0,zIndex:0,paddingTop:4,paddingBottom:4,borderRadius:ti(t?"bottom-left":e),animation:void 0}}),l&&(0,To.jsx)("span",{"aria-hidden":!0,"data-devtools":"annotation-number",style:{position:"absolute",left:8,top:4,zIndex:1,pointerEvents:"none",color:"#ffffff",fontFamily:ni,fontSize:a,fontWeight:600,lineHeight:a*Dr+"px",whiteSpace:"pre"},children:l})]})}var Ao=u(d()),Io=u(v());function jo({element:e,annotationRect:t,subjectAnchor:n,color:r,subjectRegistry:i}){let o=(0,Ao.useRef)(null);return(0,Ao.useEffect)(()=>{let r=o.current;if(!r)return;let a=r.querySelector("line"),l=r.querySelector("circle");if(!a||!l)return;let s=()=>{let i=function(e,t,n){let r={x:n.left+n.width*t.x,y:n.top+n.height*t.y},i=e.left+e.width,o=e.top+e.height,a=r.x>=e.left&&r.x<=i&&r.y>=e.top&&r.y<=o,l={x:Math.max(e.left,Math.min(i,r.x)),y:Math.max(e.top,Math.min(o,r.y))};return{annotation:l,subject:r,visible:!a&&Math.hypot(r.x-l.x,r.y-l.y)>=2}}(t,n,rt(e));r.style.display=i.visible?"":"none",a.setAttribute("x1",String(i.annotation.x)),a.setAttribute("y1",String(i.annotation.y)),a.setAttribute("x2",String(i.subject.x)),a.setAttribute("y2",String(i.subject.y)),l.setAttribute("cx",String(i.subject.x)),l.setAttribute("cy",String(i.subject.y))};s();let u=i?.subscribeFrame(s),c=i?null:new MutationObserver(s);return c?.observe(e,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("resize",s),()=>{u?.(),c?.disconnect(),window.removeEventListener("resize",s)}},[t,e,n,i]),(0,Io.jsx)("svg",{"data-popmelt-subject-draft-connector":"","aria-hidden":!0,style:{position:"fixed",inset:0,width:"100dvw",height:"100dvh",zIndex:10001,pointerEvents:"none",overflow:"visible"},children:(0,Io.jsxs)("g",{ref:o,children:[(0,Io.jsx)("line",{stroke:r,strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Io.jsx)("circle",{"data-popmelt-subject-draft-point":"",r:"3",fill:r,stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]})})}var Lo=u(d()),Po=u(v());function zo({color:e,cursorRef:t,tool:n,onHandoff:r,onDone:i}){let o=(0,Lo.useRef)(null),a=(0,Lo.useRef)(r);a.current=r,(0,Lo.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let n=(t,n)=>{e.style.left=t-4+"px",e.style.top=n-4+"px"},r=t.current;r&&n(r.x,r.y);let i=e=>n(e.clientX,e.clientY);return window.addEventListener("pointermove",i,{capture:!0}),()=>window.removeEventListener("pointermove",i,{capture:!0})},[t]),(0,Lo.useEffect)(()=>{let e=window.setTimeout(()=>a.current(),120);return()=>window.clearTimeout(e)},[]);let l="inspector"===n;return(0,Po.jsxs)("div",{ref:o,"data-devtools":"cursor-switch-pulse",onAnimationEnd:i,style:{position:"fixed",left:-100,top:-100,zIndex:2147483647,width:24,height:24,pointerEvents:"none",transformOrigin:"0 0",animation:"popmeltCursorSwitchPulse 160ms ease-in-out both",filter:`drop-shadow(0 .5px .35px rgba(0,0,0,.22)) drop-shadow(0 .75px .65px ${yn(e,.42)}) drop-shadow(0 1.25px 1.1px ${yn(e,.24)})`},children:[(0,Po.jsx)("svg",{width:"24",height:"24",viewBox:"-3 -3 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{overflow:"visible"},children:l?(0,Po.jsx)("path",{transform:"scale(1.125)",d:"M1 8V2C1 1.44772 1.44772 1 2 1H8C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z",fill:e,stroke:"white",strokeWidth:"1.111"}):(0,Po.jsx)("path",{d:"M5.19194 14.2778L0.732307 2.01384C0.442115 1.21582 1.21582 0.442116 2.01384 0.732307L14.2778 5.19194C15.7506 5.72748 15.5191 7.87826 13.9661 8.08812L10.298 8.58381C9.40594 8.70436 8.70436 9.40594 8.58381 10.298L8.08812 13.9661C7.87826 15.5191 5.72748 15.7506 5.19194 14.2778Z",fill:e,stroke:"white",strokeWidth:"1.25"})}),(0,Po.jsx)("style",{children:"\\n @keyframes popmeltCursorSwitchPulse {\\n 0%, 100% { transform: scale(1); }\\n 50% { transform: scale(1.5); }\\n 0%, 75% { opacity: 1; }\\n 100% { opacity: 0; }\\n }\\n "})]})}var No=u(d()),_o=["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],Do=[50,100,200,300,400,500,600,700,800,900,950],Fo=500,$o="neutral",Oo=950,Ho={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}};function Wo(e,t){return Ho[e][t]}function Bo(e,t){let n=_o.indexOf(e);return _o[(n+t+_o.length)%_o.length]}function Vo(e){let t=e.trim().toLowerCase(),n=t.match(/^#([0-9a-f]{6})$/i)?.[1];if(n)return[Number.parseInt(n.slice(0,2),16),Number.parseInt(n.slice(2,4),16),Number.parseInt(n.slice(4,6),16)];let r=t.match(/^rgba?\\(\\s*([\\d.]+)[,\\s]+([\\d.]+)[,\\s]+([\\d.]+)/);return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function qo(e,t){let n=Vo(e),r=Vo(t);return null!==n&&null!==r&&n.every((e,t)=>e===r[t])}var Yo=["padding","margin","border","radius","stack","grid","text","color","transform","opacity"],Uo=[0,1,2,3,4,6,8,10,12,16],Xo=[-16,-12,-10,-8,-6,-4,-3,-2,-1,0,1,2,3,4,6,8,10,12,16],Ko=["vertical","horizontal"],Qo=["stretch","start","center","end","baseline"],Go=["start","center","end","between","around","evenly"],Zo=[1,2,3,4,5,6],Jo=["xs","sm","base","lg","xl","2xl","3xl","4xl"],ea=[300,400,500,600,700,800],ta=["none","tight","snug","normal","relaxed","loose"],na=["tighter","tight","normal","wide","wider","widest"],ra=["left","center","right","justify"],ia=[25,50,75,90,95,100,105,110,125,150],oa=[-180,-90,-45,-25,-12,-6,-3,-2,-1,0,1,2,3,6,12,25,45,90,180],aa=[0,5,10,20,25,30,40,50,60,70,75,80,90,95,100],la=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],sa={padding:Uo,margin:Uo,border:[0,1,2,4,8],radius:Uo},ua={padding:"p",margin:"m",border:"border",radius:"rounded",stack:"flex",grid:"grid",text:"text",color:"text",transform:"transform",opacity:"opacity"},ca={padding:"P",margin:"M",border:"B",radius:"R",stack:"F",grid:"G",text:"FO",color:"BG",transform:"T",opacity:"O"},da={padding:"Padding",margin:"Margin",border:"Borders",radius:"Radii",stack:"Flexbox",grid:"Grid",text:"Fonts",color:"Background",transform:"Transform",opacity:"Opacity"},fa={padding:["all","x","y","top","right","bottom","left"],margin:["all","x","y","top","right","bottom","left"],border:["all","top","right","bottom","left","color"],radius:["all","top-left","top-right","bottom-right","bottom-left"],stack:["direction","gap","align","justify"],grid:["gap","rows","columns"],text:["size","weight","line-height","letter-spacing","text-align","color"],color:_o,transform:["translate","scale","rotate"],opacity:["opacity","mix-blend"]},pa={all:"",x:"X",y:"Y",top:"T",right:"R",bottom:"B",left:"L","top-left":"TL","top-right":"TR","bottom-right":"BR","bottom-left":"BL",vertical:"V",horizontal:"H",direction:"D",gap:"G",align:"A",justify:"J",rows:"R",columns:"C",size:"S",weight:"W","line-height":"H","letter-spacing":"L","text-align":"A",color:"C",translate:"T",scale:"S",rotate:"R",opacity:"O","mix-blend":"B"};function ha(e){return _o.includes(e)}function ma(e,t){return"color"===e||("text"===e||"border"===e)&&("color"===t||ha(t))}var ga=e=>encodeURIComponent(e),ya=e=>`%3Cdefs%3E%3Cfilter id=\'cursor-shadow\' x=\'-35%25\' y=\'-35%25\' width=\'170%25\' height=\'180%25\'%3E%3CfeDropShadow dx=\'0\' dy=\'.5\' stdDeviation=\'.35\' flood-color=\'black\' flood-opacity=\'.22\'/%3E%3CfeDropShadow dx=\'0\' dy=\'.75\' stdDeviation=\'.65\' flood-color=\'${ga(e)}\' flood-opacity=\'.42\'/%3E%3CfeDropShadow dx=\'0\' dy=\'1.25\' stdDeviation=\'1.1\' flood-color=\'${ga(e)}\' flood-opacity=\'.24\'/%3E%3C/filter%3E%3C/defs%3E`;function xa(e="black"){return`url("data:image/svg+xml,%3Csvg width=\'24\' height=\'24\' viewBox=\'-3 -3 24 24\' fill=\'none\' xmlns=\'http://www.w3.org/2000/svg\'%3E${ya(e)}%3Cpath filter=\'url(%23cursor-shadow)\' d=\'M5.19194 14.2778L0.732307 2.01384C0.442115 1.21582 1.21582 0.442116 2.01384 0.732307L14.2778 5.19194C15.7506 5.72748 15.5191 7.87826 13.9661 8.08812L10.298 8.58381C9.40594 8.70436 8.70436 9.40594 8.58381 10.298L8.08812 13.9661C7.87826 15.5191 5.72748 15.7506 5.19194 14.2778Z\' fill=\'${ga(e)}\' stroke=\'white\' stroke-width=\'1.25\'/%3E%3C/svg%3E") 4 4, pointer`}function va(e="black"){return`url("data:image/svg+xml,%3Csvg width=\'24\' height=\'24\' viewBox=\'-3 -3 24 24\' fill=\'none\' xmlns=\'http://www.w3.org/2000/svg\'%3E${ya(e)}%3Cpath transform=\'scale(1.125)\' filter=\'url(%23cursor-shadow)\' d=\'M1 8V2C1 1.44772 1.44772 1 2 1H8C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z\' fill=\'${ga(e)}\' stroke=\'white\' stroke-width=\'1.111\'/%3E%3C/svg%3E") 4 4, pointer`}function ba(e,t="all"){let n=ka(e,t);return"color"===e||("text"===e||"border"===e)&&ma(e,n)?Do:"stack"===e?"direction"===n?Ko:"align"===n?Qo:"justify"===n?Go:Uo:"grid"===e?"gap"===n?Uo:Zo:"text"===e?"weight"===n?ea:"line-height"===n?ta:"letter-spacing"===n?na:"text-align"===n?ra:Jo:"transform"===e?"scale"===n?ia:"rotate"===n?oa:Xo:"opacity"===e?"mix-blend"===n?la:aa:sa[e]}function wa(e,t,n="all"){let r=ba(e,n);if(r.includes(t))return t;if("number"!=typeof t)return r[0];let i=r.filter(e=>"number"==typeof e);return 0===i.length?r[0]:i.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function Sa(e){return fa[e]}function ka(e,t){if("stack"===e&&("vertical"===t||"horizontal"===t))return"direction";if(("text"===e||"border"===e)&&ha(t))return t;let n=Sa(e);return n.includes(t)?t:n[0]}function Ca(e,t){return"text"===e?"size":"transform"===e?"translate":"opacity"===e?"opacity":ka(e,t)}function Ea(e,t,n){return"family"===e?"family":"text"!==t&&"border"!==t||"color"!==n?"value":"variant"}function Ma(e,t,n,r="all"){let i=ba(e,r),o=wa(e,t,r),a=i.indexOf(o);return i[(a+n+i.length)%i.length]}function Ta(e){return da[e]}function Ra(e,t){let n=ka(e,t);return"color"===e||("text"===e||"border"===e)&&ha(n)?n[0].toUpperCase()+n.slice(1):"text"===e?"size"===n?"Size":"weight"===n?"Weight":"line-height"===n?"Leading":"letter-spacing"===n?"Tracking":"text-align"===n?"Align":"Color":"border"===e&&"color"===n?"Color":"transform"===e?"translate"===n?"translate":n:"opacity"===e?"mix-blend"===n?"mix-blend-mode":"opacity":"all"===n?Ta(e):pa[n]}function Aa(e,t){let n=ka(e,t);if("color"===e)return"background-color";if("stack"===e)return"direction"===n?"flex-direction":"align"===n?"align-items":"justify"===n?"justify-content":"gap";if("grid"===e)return"rows"===n?"grid-template-rows":"columns"===n?"grid-template-columns":"gap";if("text"===e)return"color"===n||ha(n)?"color":"weight"===n?"font-weight":"line-height"===n?"line-height":"letter-spacing"===n?"letter-spacing":"text-align"===n?"text-align":"font-size";if("border"===e&&("color"===n||ha(n)))return"border-color";if("transform"===e)return n;if("opacity"===e)return"mix-blend"===n?"mix-blend-mode":"opacity";if("radius"===e)return"all"===n?"border-radius":`border-${n}-radius`;let r="border"===e?"border":e,i="border"===e?"width":"";return"all"===n?i?`${r}-${i}`:r:"padding"!==e&&"margin"!==e||"x"!==n?"padding"!==e&&"margin"!==e||"y"!==n?i?`${r}-${n}-${i}`:`${r}-${n}`:`${r}-top`:`${r}-left`}function Ia(e,t){let n=ka(e,t);return"color"===e?["background-color"]:"stack"===e||"grid"===e?"gap"===n?["row-gap","column-gap"]:[Aa(e,n)]:"text"===e?"color"===n||ha(n)?["color"]:"line-height"===n||"letter-spacing"===n?[Aa(e,n),"font-size"]:[Aa(e,n)]:"border"!==e||"color"!==n&&!ha(n)?"transform"===e||"opacity"===e?[Aa(e,n)]:"padding"!==e&&"margin"!==e||"x"!==n?"padding"!==e&&"margin"!==e||"y"!==n?"all"!==n?[Aa(e,n)]:"radius"===e?["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"]:"border"===e?["border-top-width","border-right-width","border-bottom-width","border-left-width"]:[`${e}-top`,`${e}-right`,`${e}-bottom`,`${e}-left`]:[`${e}-top`,`${e}-bottom`]:[`${e}-left`,`${e}-right`]:["border-top-color","border-right-color","border-bottom-color","border-left-color"]}function ja(e,t){let n=e.trim().toLowerCase();if(("stack"===t||"grid"===t)&&"normal"===n)return 0;let r=n.split(/[\\s/]+/).filter(Boolean);if(0===r.length)return null;let i=r.map(e=>{if(/^0(?:\\.0+)?$/.test(e))return 0;let t=e.match(/^(-?\\d+(?:\\.\\d+)?)px$/);return t?Number(t[1]):Number.NaN});return i.some(e=>!Number.isFinite(e))?null:i.every(e=>Math.abs(e-i[0])<.01)?i[0]:null}function La(e,t,n){let r=n.trim().toLowerCase();if("text"===e){if("size"===t){let t=ja(n,e);return null===t?null:qa(Jo,e=>Ha[e],t)}if("weight"===t){if("normal"===r)return 400;if("bold"===r)return 700;let e=Number(r);return Number.isFinite(e)?qa(ea,e=>e,e):null}if("text-align"===t)return"start"===r?"left":"end"===r?"right":ra.includes(r)?r:null}if("transform"===e){if("none"===r)return"scale"===t?100:0;if("translate"===t){let t=ja(n,e);return null===t?null:qa(Uo,e=>4*e,t)}if("scale"===t){let e=100*Number.parseFloat(n);return Number.isFinite(e)?qa(ia,e=>e,e):null}if("rotate"===t){let e=Number.parseFloat(n);return Number.isFinite(e)?qa(oa,e=>e,e):null}}if("opacity"===e){if("mix-blend"===t)return la.includes(r)?r:null;let e=100*Number.parseFloat(n);return Number.isFinite(e)?qa(aa,e=>e,e):null}if("stack"!==e)return null;if("direction"===t){if("column"===r||"column-reverse"===r)return"vertical";if("row"===r||"row-reverse"===r)return"horizontal"}if("align"===t){if("flex-start"===r||"start"===r)return"start";if("center"===r)return"center";if("flex-end"===r||"end"===r)return"end";if("stretch"===r)return"stretch";if("baseline"===r)return"baseline"}if("justify"===t){if("flex-start"===r||"start"===r)return"start";if("center"===r)return"center";if("flex-end"===r||"end"===r)return"end";if("space-between"===r)return"between";if("space-around"===r)return"around";if("space-evenly"===r)return"evenly"}return null}function Pa(e,t,n,r){let i=function(e,t,n,r="all"){let i=ka(e,r);if("color"===e||("text"===e||"border"===e)&&ha(i)){let e=Wo(i,t);return n.length>0&&n.every(t=>qo(t,e))}if("text"===e){if("size"===i){let r=ja(n[0]??"",e);return null!==r&&Math.abs(r-Ha[t])<.01}if("weight"===i)return La(e,i,n[0]??"")===t;if("line-height"===i){let r=(n[0]??"").trim().toLowerCase();if("normal"===r)return"normal"===t;let i=ja(r,e),o=ja(n[1]??"",e);return null!==i&&null!==o&&0!==o&&Math.abs(i/o-Ba[t])<.01}if("letter-spacing"===i){let r=(n[0]??"").trim().toLowerCase();if("normal"===r)return"normal"===t;let i=ja(r,e),o=ja(n[1]??"",e);return null!==i&&null!==o&&0!==o&&Math.abs(i/o-Va[t])<.001}return La(e,i,n[0]??"")===t}if("transform"===e||"opacity"===e||"stack"===e&&"gap"!==i)return La(e,i,n[0]??"")===t;if("grid"===e&&"gap"!==i)return(n[0]?.trim().split(/\\s+/).filter(Boolean).length??0)===t;if("number"!=typeof t)return!1;let o=Number.parseFloat(Da(e,t,i)),a=n.map(t=>ja(t,e));return a.length>0&&a.every(e=>null!==e&&Math.abs(e-o)<.01)}(e,t,Ia(e,n).map(r),n),o=Oa(e),a=Fa(e,n,t).every(e=>r(e.property).trim()===e.value),l="border"===e&&!ma(e,n)&&"number"==typeof t&&t>0?za(n):null,s=!l||!["","none"].includes(r(l).trim());return i&&(!o||r("display").trim()===o)&&a&&s}function za(e){let t=ka("border",e);return"all"===t?"border-style":`border-${t}-style`}function Na(e){return"color"===e?"background-color":"border"===e?"border-top-color":"color"}function _a(e,t,n){let r=ka(e,n);if("color"===e)return`bg-${r}-${t}`;if("stack"===e)return"direction"===r?"horizontal"===t?"flex-row":"flex-col":"gap"===r?`gap-${t}`:"align"===r?`items-${t}`:`justify-${t}`;if("grid"===e)return"gap"===r?`gap-${t}`:`${"rows"===r?"grid-rows":"grid-cols"}-${t}`;if("text"===e)return ha(r)?`text-${r}-${t}`:"size"===r?`text-${t}`:"weight"===r?Wa[t]:"line-height"===r?`leading-${t}`:"letter-spacing"===r?`tracking-${t}`:`text-${t}`;if("border"===e&&ha(r))return`border-${r}-${t}`;if("transform"===e)return`${r}-${t}`;if("opacity"===e)return"mix-blend"===r?`mix-blend-${t}`:`opacity-${t}`;let i=ua[e];if("all"===r)return`${i}-${t}`;let o="top-left"===r?"tl":"top-right"===r?"tr":"bottom-right"===r?"br":"bottom-left"===r?"bl":r[0];return"padding"===e||"margin"===e?`${i}${o}-${t}`:`${i}-${o}-${t}`}function Da(e,t,n="all"){let r=ka(e,n);if("color"===e||("text"===e||"border"===e)&&ha(r))return Wo(r,t);if("stack"===e){if("direction"===r)return"horizontal"===t?"row":"column";if("align"===r)return"start"===t?"flex-start":"end"===t?"flex-end":String(t);if("justify"===r)return"start"===t?"flex-start":"end"===t?"flex-end":"between"===t||"around"===t||"evenly"===t?`space-${t}`:String(t)}return"grid"===e&&"gap"!==r?`repeat(${t}, minmax(0, 1fr))`:"text"===e?"size"===r?`${Ha[t]}px`:"weight"===r?String(t):"line-height"===r?String(Ba[t]):"letter-spacing"===r?`${Va[t]}em`:String(t):"transform"===e?"scale"===r?String(Number(t)/100):"rotate"===r?`${t}deg`:`${4*Number(t)}px ${4*Number(t)}px`:"opacity"===e?String("mix-blend"===r?t:Number(t)/100):"number"!=typeof t?"0px":`${"border"===e?t:4*t}px`}function Fa(e,t,n){let r=ka(e,t);return"padding"!==e&&"margin"!==e||"x"!==r&&"y"!==r?[]:[{property:"x"===r?`${e}-right`:`${e}-bottom`,value:Da(e,n??0,r),token:_a(e,n??0,r)}]}function $a(e,t,n){if("text"===t&&("size"===n||"all"===n))return String(Ha[e]);if("text"===t&&"line-height"===n){let t=Ba[e];return String(Number(t.toFixed(1)))}if("text"===t&&"letter-spacing"===n){let t=Va[e];return String(Number(t.toFixed(2))).replace(/^(-?)0\\./,"$1.")}return"number"==typeof e?String(e):"vertical"===e?"V":"horizontal"===e?"H":"start"===e?"S":"center"===e?"C":"end"===e?"E":"stretch"===e?"ST":"baseline"===e?"BL":"between"===e?"BT":"around"===e?"AR":"EV"}function Oa(e){return"stack"===e?"flex":"grid"===e?"grid":null}xa(),va();var Ha={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36},Wa={300:"font-light",400:"font-normal",500:"font-medium",600:"font-semibold",700:"font-bold",800:"font-extrabold"},Ba={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Va={tighter:-.05,tight:-.025,normal:0,wide:.025,wider:.05,widest:.1};function qa(e,t,n){return e.reduce((e,r)=>Math.abs(t(r)-n)<Math.abs(t(e)-n)?r:e)}function Ya(e,t){let n=({x:e,y:n})=>{let r=nt({left:e,top:n,width:0,height:0},t);return{x:r.left,y:r.top}};return{topLeft:n(e.topLeft),topRight:n(e.topRight),bottomRight:n(e.bottomRight),bottomLeft:n(e.bottomLeft)}}var Ua=["transition","transform","translate","rotate","scale"];function Xa(e){let[t]=e.getBoxQuads?.({box:"border"})??[];if(t)return{topLeft:{x:t.p1.x,y:t.p1.y},topRight:{x:t.p2.x,y:t.p2.y},bottomRight:{x:t.p3.x,y:t.p3.y},bottomLeft:{x:t.p4.x,y:t.p4.y}};let n=e.getBoundingClientRect();return{topLeft:{x:n.left,y:n.top},topRight:{x:n.right,y:n.top},bottomRight:{x:n.right,y:n.bottom},bottomLeft:{x:n.left,y:n.bottom}}}var Ka={a:1,b:0,c:0,d:1,e:0,f:0};function Qa(e,t){return{a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,e:e.a*t.e+e.c*t.f+e.e,f:e.b*t.e+e.d*t.f+e.f}}function Ga(e,t){return{...Ka,e:e,f:t}}function Za(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return{a:n,b:r,c:-r,d:n,e:0,f:0}}function Ja(e,t){return{a:e,b:0,c:0,d:t,e:0,f:0}}function el(e,t){if(!e)return 0;let n=Number.parseFloat(e);return Number.isFinite(n)?e.endsWith("%")?n/100*t:n:0}function tl(e){if(!e)return 1;let t=Number.parseFloat(e);return Number.isFinite(t)?e.endsWith("%")?t/100:t:1}function nl(e){if(!e||"none"===e)return Ka;let t=e.match(/^matrix\\(([^)]+)\\)$/);if(t){let e=t[1].split(",").map(Number);if(6===e.length&&e.every(Number.isFinite)){let[t,n,r,i,o,a]=e;return{a:t,b:n,c:r,d:i,e:o,f:a}}}let n=e.match(/^matrix3d\\(([^)]+)\\)$/);if(n){let e=n[1].split(",").map(Number);if(16===e.length&&e.every(Number.isFinite))return{a:e[0],b:e[1],c:e[4],d:e[5],e:e[12],f:e[13]}}return Ka}function rl(e,t){return{x:e.a*t.x+e.c*t.y+e.e,y:e.b*t.x+e.d*t.y+e.f}}function il(e){let t=getComputedStyle(e),n=t.rotate.trim().split(/\\s+/).at(-1)??"0",r=Za(Number.parseFloat(n)||0),[i="1",o=i]=t.scale.trim().split(/\\s+/);return{...Qa(r,Qa(Ja(tl(i),tl(o)),nl(t.transform))),e:0,f:0}}function ol(e){let t=Ka,n=e.parentElement;for(;n;)wn(n)&&(t=Qa(il(n),t)),n=n.parentElement;return t}function al(e,t){let[n]=e.getBoxQuads?.({box:"border"})??[];if(n)return Xa(e);let r=getComputedStyle(e),{width:i,height:o}=dl(e,t);if(i<=0||o<=0)return Xa(e);let[a="0",l="0"]=r.translate.trim().split(/\\s+/),s=Ga(el(a,i),el(l,o)),u=r.rotate.trim().split(/\\s+/).at(-1)??"0",c=Za(Number.parseFloat(u)||0),[d="1",f=d]=r.scale.trim().split(/\\s+/),p=Ja(tl(d),tl(f)),h=nl(r.transform),[m="50%",g="50%"]=r.transformOrigin.trim().split(/\\s+/),y={x:el(m,i),y:el(g,o)},x=Qa(Ga(y.x,y.y),Qa(c,Qa(p,Qa(h,Ga(-y.x,-y.y))))),v=Qa(s,x),b=(t.topRight.x-t.topLeft.x)/i,w=(t.topRight.y-t.topLeft.y)/i,S=(t.bottomLeft.x-t.topLeft.x)/o,k=(t.bottomLeft.y-t.topLeft.y)/o,C=e=>{let n=rl(v,e);return{x:t.topLeft.x+b*n.x+S*n.y,y:t.topLeft.y+w*n.x+k*n.y}};return{topLeft:C({x:0,y:0}),topRight:C({x:i,y:0}),bottomRight:C({x:i,y:o}),bottomLeft:C({x:0,y:o})}}function ll(e){let t=Ua.map(t=>({property:t,value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}));try{e.style.setProperty("transition","none","important");for(let t of Ua)"transition"!==t&&e.style.setProperty(t,"none","important");let[t]=e.getBoxQuads?.({box:"border"})??[],n=Xa(e);return t?n:function(e,t){let{width:n,height:r}=dl(e,t);if(n<=0||r<=0)return t;let i=ol(e);if(0===i.b&&0===i.c&&i.a>0&&i.d>0)return t;let o=e.currentCSSZoom||1,a=rl(i,{x:n*o,y:0}),l=rl(i,{x:0,y:r*o});return function(e,t,n){let r=(r,i)=>({x:e.x+(t.x*r+n.x*i)/2,y:e.y+(t.y*r+n.y*i)/2});return{topLeft:r(-1,-1),topRight:r(1,-1),bottomRight:r(1,1),bottomLeft:r(-1,1)}}(vl(t),a,l)}(e,n)}finally{for(let{property:n,value:r,priority:i}of t.filter(({property:e})=>"transition"!==e))r?e.style.setProperty(n,r,i):e.style.removeProperty(n);let n=t.find(({property:e})=>"transition"===e);n&&(n.value?e.style.setProperty(n.property,n.value,n.priority):e.style.removeProperty(n.property))}}function sl(e,t,n){let[r="0",i=r]=e.trim().split(/\\s+/),o=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?e.endsWith("%")?n/100*t:n:0};return{x:o(r,t),y:o(i,n)}}function ul(e,t){let n=getComputedStyle(e),r=(Math.hypot(t.topRight.x-t.topLeft.x,t.topRight.y-t.topLeft.y)+Math.hypot(t.bottomRight.x-t.bottomLeft.x,t.bottomRight.y-t.bottomLeft.y))/2,i=(Math.hypot(t.bottomLeft.x-t.topLeft.x,t.bottomLeft.y-t.topLeft.y)+Math.hypot(t.bottomRight.x-t.topRight.x,t.bottomRight.y-t.topRight.y))/2;return{topLeft:sl(n.borderTopLeftRadius,r,i),topRight:sl(n.borderTopRightRadius,r,i),bottomRight:sl(n.borderBottomRightRadius,r,i),bottomLeft:sl(n.borderBottomLeftRadius,r,i)}}function cl(e){return{width:(Math.hypot(e.topRight.x-e.topLeft.x,e.topRight.y-e.topLeft.y)+Math.hypot(e.bottomRight.x-e.bottomLeft.x,e.bottomRight.y-e.bottomLeft.y))/2,height:(Math.hypot(e.bottomLeft.x-e.topLeft.x,e.bottomLeft.y-e.topLeft.y)+Math.hypot(e.bottomRight.x-e.topRight.x,e.bottomRight.y-e.topRight.y))/2}}function dl(e,t){let n=cl(t);if(e instanceof HTMLElement)return{width:e.offsetWidth||n.width,height:e.offsetHeight||n.height};let r=getComputedStyle(e),i=Number.parseFloat(r.width),o=Number.parseFloat(r.height);return{width:Number.isFinite(i)&&i>0?i:n.width,height:Number.isFinite(o)&&o>0?o:n.height}}function fl(e,t,n){let r=cl(t),i=cl(n),o=r.width>0?i.width/r.width:1,a=r.height>0?i.height/r.height:1;return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{x:t.x*o,y:t.y*a}]))}function pl(e){let t=getComputedStyle(e);return(!t.backgroundImage||"none"===t.backgroundImage)&&function(e){let t=e.trim().toLowerCase();if(!t||"transparent"===t)return 0;if(t.match(/^#(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})$/))return 5===t.length?Number.parseInt(t.at(-1).repeat(2),16)/255:9===t.length?Number.parseInt(t.slice(-2),16)/255:1;let n=t.match(/\\/\\s*([\\d.]+%?)\\s*\\)$/);if(n){let e=Number.parseFloat(n[1]);return n[1].endsWith("%")?e/100:e}let r=t.match(/^rgba\\([^,]+,[^,]+,[^,]+,\\s*([\\d.]+%?)\\s*\\)$/);if(r){let e=Number.parseFloat(r[1]);return r[1].endsWith("%")?e/100:e}return 1}(t.backgroundColor)>=.999}function hl(e,t,n){let r=t.x-e.x,i=t.y-e.y,o=Math.max(1,Math.hypot(r,i));return{x:e.x+r/o*n,y:e.y+i/o*n}}function ml(e,t){let n=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),r=[[n(e.topLeft,e.topRight),t.topLeft.x+t.topRight.x],[n(e.topRight,e.bottomRight),t.topRight.y+t.bottomRight.y],[n(e.bottomRight,e.bottomLeft),t.bottomRight.x+t.bottomLeft.x],[n(e.bottomLeft,e.topLeft),t.bottomLeft.y+t.topLeft.y]];return Math.min(1,...r.map(([e,t])=>t>0?e/t:1))}function gl(e){return{topLeft:[e.topLeft.y,e.topLeft.x],topRight:[e.topRight.x,e.topRight.y],bottomRight:[e.bottomRight.y,e.bottomRight.x],bottomLeft:[e.bottomLeft.x,e.bottomLeft.y]}}function yl(e,t){let n=["topLeft","topRight","bottomRight","bottomLeft"],r=gl(t),i=ml(e,t),o=1-Math.SQRT1_2;return Object.fromEntries(n.map((t,a)=>{let l=e[t],s=e[n[(a+n.length-1)%n.length]],u=e[n[(a+1)%n.length]],[c,d]=r[t],f=hl(l,s,c*i*o),p=hl(l,u,d*i*o);return[t,{x:f.x+p.x-l.x,y:f.y+p.y-l.y}]}))}function xl(e,t){let n=.5522847498,r=["topLeft","topRight","bottomRight","bottomLeft"],i=gl(t),o=ml(e,t),a=r.map((t,a)=>{let l=e[t],s=r[(a+r.length-1)%r.length],u=r[(a+1)%r.length],c=e[s],d=e[u],[f,p]=i[t],h=f*o,m=p*o,g=hl(l,c,h),y=hl(l,d,m);return{entry:g,exit:y,entryControl:hl(g,l,h*n),exitControl:hl(y,l,m*n)}}),l=a[0],s=[`M ${l.exit.x} ${l.exit.y}`];for(let e=1;e<=a.length;e+=1){let t=a[e%a.length];s.push(`L ${t.entry.x} ${t.entry.y}`),s.push(`C ${t.entryControl.x} ${t.entryControl.y} ${t.exitControl.x} ${t.exitControl.y} ${t.exit.x} ${t.exit.y}`)}return s.push("Z"),s.join(" ")}function vl(e){return{x:(e.topLeft.x+e.topRight.x+e.bottomRight.x+e.bottomLeft.x)/4,y:(e.topLeft.y+e.topRight.y+e.bottomRight.y+e.bottomLeft.y)/4}}function bl(e,t=28,n="top"){let[r,i]="top"===n?[e.topLeft,e.topRight]:"right"===n?[e.topRight,e.bottomRight]:"bottom"===n?[e.bottomRight,e.bottomLeft]:[e.bottomLeft,e.topLeft],o={x:(r.x+i.x)/2,y:(r.y+i.y)/2},a=i.x-r.x,l=i.y-r.y,s=Math.max(1,Math.hypot(a,l));return{edge:o,handle:{x:o.x+l/s*t,y:o.y-a/s*t}}}function wl(e,t){let n=bl(e);return n.handle.y>=t/2?{...n,side:"top"}:{...bl(e,28,"bottom"),side:"bottom"}}function Sl(e,t,n){let r=n.x-t.x,i=n.y-t.y,o=r*r+i*i;if(0===o)return Math.hypot(e.x-t.x,e.y-t.y);let a=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/o));return Math.hypot(e.x-(t.x+a*r),e.y-(t.y+a*i))}var kl=["top","right","bottom","left"];function Cl(e,t,n,r={}){let i=kl.map(n=>({...bl(e,28,n),side:n,distance:Sl(t,"top"===n?e.topLeft:"right"===n?e.topRight:"bottom"===n?e.bottomRight:e.bottomLeft,"top"===n?e.topRight:"right"===n?e.bottomRight:"bottom"===n?e.bottomLeft:e.topLeft)})),o=r.viewport?i.filter(({handle:e})=>function(e,t,n){let r=t/2;return e.x>=r&&e.x<=n.width-r&&e.y>=r&&e.y<=n.height-r}(e,n,r.viewport)):i,a=o.length>0?o:i,l=a.reduce((e,t)=>t.distance<e.distance?t:e),s=r.currentSide?a.find(({side:e})=>e===r.currentSide):void 0,u=s&&s.distance<=l.distance+(r.hysteresis??8)?s:l;return{edge:u.edge,handle:u.handle,side:u.side}}function El(e){let t=Math.max(1,Math.hypot(e.x,e.y));return{x:e.x/t,y:e.y/t}}function Ml(e){if(!e||"none"===e)return{x:0,y:0};let[t="0",n="0"]=e.trim().split(/\\s+/);return{x:Number.parseFloat(t)||0,y:Number.parseFloat(n)||0}}var Tl=Math.SQRT1_2;function Rl(e,t){return ba(e,t).filter(e=>"number"==typeof e)}function Al(e,t,n){return Rl(e,t).reduce((r,i)=>Math.abs(Number.parseFloat(Da(e,i,t))-n)<Math.abs(Number.parseFloat(Da(e,r,t))-n)?i:r)}function Il(e,t){let n=Rl("transform",e),r=t=>"translate"===e?Number.parseFloat(Da("transform",t,e)):t;return n.reduce((e,n)=>Math.abs(r(n)-t)<Math.abs(r(e)-t)?n:e)}function jl(e,t){return t?e:"left"===e||"right"===e?"x":"y"}function Ll(e,t){return t?e:"all"}function Pl(e){return{x:("top-left"===e||"bottom-left"===e?1:-1)*Tl,y:("top-left"===e||"top-right"===e?1:-1)*Tl}}function zl(e,t){let n=Math.max(1,t);return(e%n+n)%n}var Nl=u(v()),_l=["top-left","top-right","bottom-right","bottom-left"];function Dl({element:e,radius:t,accentColor:n,hoveredCorner:r,draggingCorner:i,cursorViewport:o,onHandlePointerDown:a}){let[l,s]=(0,No.useState)(null),u=t["top-left"],c=t["top-right"],d=t["bottom-right"],f=t["bottom-left"];if((0,No.useEffect)(()=>{if(!e)return void s(null);let t=()=>{s(e.getBoundingClientRect())};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,No.useLayoutEffect)(()=>{e&&s(e.getBoundingClientRect())},[e,u,c,d,f]),!l)return null;let p=l.width,h=l.height;if(!function(e,t,n){if(e<40||t<40)return!1;let r=["top-left","top-right","bottom-right","bottom-left"].map(r=>{let i=Pl(r),o=14+n[r],a=r.endsWith("left")?0:e,l=r.startsWith("top")?0:t;return{x:a+i.x*o,y:l+i.y*o}});return r.every((e,t)=>r.slice(t+1).every(t=>Math.hypot(e.x-t.x,e.y-t.y)>=20))}(p,h,t))return null;let m=function(e){let t=e.match(/^oklch\\(([^)]+)\\)$/i);return t?`oklch(${t[1]} / 0.2)`:`color-mix(in srgb, ${e} ${Math.round(20)}%, transparent)`}(n),g={"top-left":{x:0,y:0},"top-right":{x:p,y:0},"bottom-right":{x:p,y:h},"bottom-left":{x:0,y:h}},y=Object.fromEntries(_l.map(e=>{let n=Pl(e),r=14+t[e],i=g[e];return[e,{x:i.x+n.x*r,y:i.y+n.y*r}]})),x=i??r,v={position:"fixed",top:l.top,left:l.left,width:p,height:h,pointerEvents:"none",zIndex:a?9999:9996,overflow:"visible"};return(0,Nl.jsxs)("div",{"data-devtools":"border-radius-handles","data-popmelt-steer-overlay":!0,style:v,children:[(0,Nl.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${p} ${h}`,children:[(0,Nl.jsx)("rect",{x:"0.5",y:"0.5",width:Math.max(0,p-1),height:Math.max(0,h-1),fill:"none",stroke:m,strokeWidth:"1"}),_l.map(e=>{let t=y[e];return(0,Nl.jsx)("circle",{cx:t.x,cy:t.y,r:e===x?4:3,fill:n,stroke:"#ffffff",strokeWidth:2},e)}),a&&_l.map(e=>{let t=y[e],n=g[e],r="top-left"===e||"bottom-right"===e?"nwse-resize":"nesw-resize";return(0,Nl.jsxs)("g",{children:[(0,Nl.jsx)("line",{"data-radius-handle-access":e,x1:n.x,y1:n.y,x2:t.x,y2:t.y,stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{pointerEvents:"stroke",cursor:r},onPointerDown:t=>a(e,t)}),(0,Nl.jsx)("circle",{cx:t.x,cy:t.y,r:10,fill:"transparent",style:{pointerEvents:"all",cursor:r},onPointerDown:t=>a(e,t)})]},`hit-${e}`)})]}),o&&x&&(()=>{let e=Math.round(t[x]);return(0,Nl.jsx)("div",{style:{position:"fixed",left:o.x+8,top:o.y-28,background:n,color:"#fff",fontSize:11,fontWeight:600,fontFamily:\'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace\',lineHeight:1,padding:"4px 4px",borderRadius:0,whiteSpace:"nowrap",pointerEvents:"none",zIndex:9997},children:e})})()]})}var Fl=u(d()),$l=u(v());function Ol({centerX:e,centerY:t,orientation:n,accentColor:r,...i}){let o="horizontal"===n?10:6,a="horizontal"===n?6:10;return(0,$l.jsx)("rect",{...i,"data-direct-manipulation-handle":"",x:e-o/2,y:t-a/2,width:o,height:a,fill:r,stroke:"#ffffff",strokeWidth:2})}var Hl=u(v());function Wl(e,t){let n=e.match(/^oklch\\(([^)]+)\\)$/i);return n?`oklch(${n[1]} / ${t})`:`color-mix(in srgb, ${e} ${Math.round(100*t)}%, transparent)`}function Bl({element:e,gap:t,accentColor:n,hoveredAxis:r,draggingAxis:i,cursorViewport:o,isAutoGap:a=!1,refreshKey:l=0,onHandlePointerDown:s}){let[u,c]=(0,Fl.useState)(null),[d,f]=(0,Fl.useState)([]),[p,h]=(0,Fl.useState)(!1);if((0,Fl.useEffect)(()=>{let e=e=>{("Meta"===e.key||"Control"===e.key)&&h(!0)},t=e=>{("Meta"===e.key||"Control"===e.key)&&h(!1)},n=()=>h(!1);return window.addEventListener("keydown",e,!0),window.addEventListener("keyup",t,!0),window.addEventListener("blur",n),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("keyup",t,!0),window.removeEventListener("blur",n)}},[]),(0,Fl.useEffect)(()=>{if(!e)return c(null),void f([]);let t=()=>{c(e.getBoundingClientRect()),f(Cn(e))};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,Fl.useLayoutEffect)(()=>{e&&(c(e.getBoundingClientRect()),f(Cn(e)))},[e,t.row,t.column,l]),!u||0===d.length)return null;let m=u.width,g=u.height,y="pm-gap-stripe-pattern",x=Wl(n,.25),v=Wl(n,.1),b=Wl(n,.2),w={position:"fixed",top:u.top,left:u.left,width:m,height:g,pointerEvents:"none",zIndex:s?9999:9996,overflow:"visible"},S=i??r;return(0,Hl.jsxs)("div",{"data-devtools":"gap-handles","data-popmelt-steer-overlay":!0,style:w,children:[(0,Hl.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${m} ${g}`,children:[(0,Hl.jsx)("defs",{children:(0,Hl.jsx)("pattern",{id:y,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Hl.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:x,strokeWidth:"1.5"})})}),(0,Hl.jsx)("rect",{x:"0.5",y:"0.5",width:Math.max(0,m-1),height:Math.max(0,g-1),fill:"none",stroke:b,strokeWidth:"1"}),d.map((e,n)=>{let r=e.x-u.left,i=e.y-u.top,o=e.w,a=e.h,l=!p||e.axis===S;return 0===("row"===e.axis?t.row:t.column)?null:(0,Hl.jsxs)("g",{opacity:l?1:.6,children:[(0,Hl.jsx)("rect",{x:r,y:i,width:o,height:a,fill:v}),(0,Hl.jsx)("rect",{x:r,y:i,width:o,height:a,fill:`url(#${y})`})]},n)}),d.map((e,t)=>{let r=e.x-u.left+e.w/2,i=e.y-u.top+e.h/2;return a?(0,Hl.jsx)("circle",{"data-gap-handle":e.axis,cx:r,cy:i,r:3,fill:n,stroke:"#ffffff",strokeWidth:2},`gap-handle-${t}`):(0,Hl.jsx)(Ol,{"data-gap-handle":e.axis,centerX:r,centerY:i,orientation:"column"===e.axis?"vertical":"horizontal",accentColor:n},`gap-handle-${t}`)}),s&&d.map((e,t)=>{let n=e.x-u.left+e.w/2,r=e.y-u.top+e.h/2,i=Math.max(e.w,20),o=Math.max(e.h,20);return(0,Hl.jsx)("rect",{x:n-i/2,y:r-o/2,width:i,height:o,fill:"transparent",style:{pointerEvents:"all",cursor:"row"===e.axis?"ns-resize":"ew-resize"},onPointerDown:t=>s(e.axis,t)},`gap-hit-${t}`)})]}),o&&S&&(()=>{let e=a?"auto":String(Math.round("row"===S?t.row:t.column));return(0,Hl.jsx)("div",{style:{position:"fixed",left:o.x+8,top:o.y-28,background:n,color:"#fff",fontSize:11,fontWeight:600,fontFamily:\'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace\',lineHeight:1,padding:"4px 4px",borderRadius:0,whiteSpace:"nowrap",pointerEvents:"none",zIndex:9997},children:e})})()]})}var Vl=u(d()),ql=new Set(["CANVAS","EMBED","IFRAME","IMG","INPUT","OBJECT","VIDEO"]),Yl=["top","bottom"],Ul=["left","right"];var Xl=u(v());function Kl(e,t){let n=e.match(/^oklch\\(([^)]+)\\)$/i);return n?`oklch(${n[1]} / ${t})`:`color-mix(in srgb, ${e} ${Math.round(100*t)}%, transparent)`}var Ql={top:"bottom",bottom:"top",left:"right",right:"left"},Gl="#808080";function Zl({element:e,padding:t,mode:n="padding",accentColor:r,hoveredSide:i,draggingSide:o,activeSides:a,cursorViewport:l,refreshKey:s,onHandlePointerDown:u}){let[c,d]=(0,Vl.useState)(null),[f,p]=(0,Vl.useState)(!1);if((0,Vl.useEffect)(()=>{let e=e=>{("Alt"===e.key||"Control"===e.key)&&p(!0)},t=e=>{("Alt"===e.key||"Control"===e.key)&&p(!1)},n=()=>p(!1);return window.addEventListener("keydown",e,!0),window.addEventListener("keyup",t,!0),window.addEventListener("blur",n),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("keyup",t,!0),window.removeEventListener("blur",n)}},[]),(0,Vl.useEffect)(()=>{if(!e)return void d(null);let t=()=>{d(e.getBoundingClientRect())};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,Vl.useLayoutEffect)(()=>{e&&d(e.getBoundingClientRect())},[e,t.top,t.right,t.bottom,t.left,s]),!c)return null;let h=c.width,m=c.height,{top:g,right:y,bottom:x,left:v}=t,b=Math.max(0,g),w=Math.max(0,y),S=Math.max(0,x),k=Math.max(0,v),C="margin"===n,E=C?h+k+w:h,M=C?m+b+S:m,T=C?k:0,R=C?b:0,A=C?"pm-dot-pattern":"pm-stripe-pattern",I=Kl(r,.25),j=Kl(r,.1),L=Kl(r,.2),P=Kl(Gl,.55),z=Kl(Gl,.18),N=Kl(Gl,.9),_=new Set(C?[]:function(e,t=window.getComputedStyle(e)){return function({isHtmlElement:e,tagName:t,display:n,writingMode:r}){return!e||"inline"!==n||ql.has(t)?[]:r.startsWith("horizontal")?Yl:Ul}({isHtmlElement:e instanceof HTMLElement,tagName:e.tagName,display:t.display,writingMode:t.writingMode})}(e)),D=_.size>0,F="pm-neutral-stripe-pattern",$={position:"fixed",top:c.top-(C?b:0),left:c.left-(C?k:0),width:E,height:M,pointerEvents:"none",zIndex:u?9999:9996,overflow:"visible"},O=["top","right","bottom","left"],H={top:`0,0 ${E},0 ${E-w},${b} ${k},${b}`,right:`${E},0 ${E},${M} ${E-w},${M-S} ${E-w},${b}`,bottom:`0,${M} ${k},${M-S} ${E-w},${M-S} ${E},${M}`,left:`0,0 ${k},${b} ${k},${M-S} 0,${M}`},W={top:{x:E/2,y:b/2,orientation:"horizontal"},bottom:{x:E/2,y:M-S/2,orientation:"horizontal"},left:{x:k/2,y:M/2,orientation:"vertical"},right:{x:E-w/2,y:M/2,orientation:"vertical"}},B=new Set(a);return o?B.add(o):i&&(B.add(i),f||B.add(Ql[i])),(0,Xl.jsxs)("div",{"data-devtools":"padding-handles","data-popmelt-steer-overlay":!0,style:$,children:[(0,Xl.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${E} ${M}`,children:[(0,Xl.jsxs)("defs",{children:[C?(0,Xl.jsx)("pattern",{id:A,patternUnits:"userSpaceOnUse",width:"4",height:"4",children:(0,Xl.jsx)("circle",{cx:"1",cy:"1",r:"0.65",fill:I})}):(0,Xl.jsx)("pattern",{id:A,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Xl.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:I,strokeWidth:"1.5"})}),D&&(0,Xl.jsx)("pattern",{id:F,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Xl.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:P,strokeWidth:"1.5"})})]}),(0,Xl.jsx)("rect",{x:T+.5,y:R+.5,width:Math.max(0,h-1),height:Math.max(0,m-1),fill:"none",stroke:L,strokeWidth:"1"}),O.map(e=>{if(t[e]<=0)return null;let n=B.has(e),r=_.has(e);return(0,Xl.jsxs)("g",{"data-padding-flow":r?"paint-only":"layout",opacity:n?1:.6,children:[(0,Xl.jsx)("polygon",{points:H[e],fill:r?z:j}),(0,Xl.jsx)("polygon",{points:H[e],fill:`url(#${r?F:A})`})]},e)}),_.has("top")&&b>0&&(0,Xl.jsx)("line",{x1:k,y1:b,x2:E-w,y2:b,stroke:N,strokeWidth:"1"}),_.has("bottom")&&S>0&&(0,Xl.jsx)("line",{x1:k,y1:M-S,x2:E-w,y2:M-S,stroke:N,strokeWidth:"1"}),_.has("left")&&k>0&&(0,Xl.jsx)("line",{x1:k,y1:b,x2:k,y2:M-S,stroke:N,strokeWidth:"1"}),_.has("right")&&w>0&&(0,Xl.jsx)("line",{x1:E-w,y1:b,x2:E-w,y2:M-S,stroke:N,strokeWidth:"1"}),O.map(e=>{let t=W[e];return(0,Xl.jsx)(Ol,{centerX:t.x,centerY:t.y,orientation:t.orientation,accentColor:_.has(e)?Gl:r,"data-padding-flow":_.has(e)?"paint-only":"layout"},`handle-${e}`)}),u&&O.map(e=>{let t=W[e];return(0,Xl.jsx)("rect",{x:t.x-10,y:t.y-10,width:20,height:20,fill:"transparent",style:{pointerEvents:"all",cursor:"grab"},onPointerDown:t=>u(e,t)},`hit-${e}`)})]}),l&&(i||o)&&(()=>{let e=o??i,n=Math.round(t[e]),a=_.has(e);return(0,Xl.jsxs)("div",{style:{position:"fixed",left:l.x+8,top:l.y-28,background:a?Gl:r,color:"#fff",fontSize:11,fontWeight:600,fontFamily:\'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace\',lineHeight:1,padding:"4px 4px",borderRadius:0,whiteSpace:"nowrap",pointerEvents:"none",zIndex:9997},children:[n,a?" · paint only":""]})})()]})}var Jl=u(d()),es=u(v()),ts=["flex-start","center","flex-end"],ns=["flex-start","center","flex-end"];function rs(e){let t=Array.from(e.children);if(0===t.length)return null;let n=1/0,r=1/0,i=-1/0,o=-1/0;for(let e of t){let t=e.getBoundingClientRect();0===t.width&&0===t.height||(t.top<n&&(n=t.top),t.left<r&&(r=t.left),t.bottom>i&&(i=t.bottom),t.right>o&&(o=t.right))}return n===1/0?null:new DOMRect(r,n,o-r,i-n)}function is({element:e,modifier:t,accentColor:n,refreshKey:r=0}){let[i,o]=(0,Jl.useState)(null);if((0,Jl.useEffect)(()=>{if(!e)return void o(null);let t=()=>o(rs(e));return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,Jl.useLayoutEffect)(()=>{e&&o(rs(e))},[e,r]),!i)return null;let a=i,l=window.getComputedStyle(e),s=l.display;if("flex"!==s&&"inline-flex"!==s)return null;let u=l.flexDirection,c="column"===u||"column-reverse"===u?"vertical":"horizontal",d="horizontal"===c?"vertical":"horizontal",f=[];if("shift"===t){let e=function(e){return"normal"===e||"flex-start"===e||"start"===e?"flex-start":"flex-end"===e||"end"===e?"flex-end":"center"===e?"center":null}(l.justifyContent);if(e){let t=ts.indexOf(e);"horizontal"===c?(t>0&&f.push("left"),t<ts.length-1&&f.push("right")):(t>0&&f.push("up"),t<ts.length-1&&f.push("down"))}}else{let e=function(e){return"normal"===e||"stretch"===e||"flex-start"===e||"start"===e?"flex-start":"flex-end"===e||"end"===e?"flex-end":"center"===e?"center":null}(l.alignItems);if(e){let t=ns.indexOf(e);"horizontal"===d?(t>0&&f.push("left"),t<ns.length-1&&f.push("right")):(t>0&&f.push("up"),t<ns.length-1&&f.push("down"))}}return 0===f.length?null:(0,es.jsx)(es.Fragment,{children:f.map(e=>{let t,r;switch(e){case"right":t=a.right+14,r=a.top+a.height/2;break;case"left":t=a.left-14,r=a.top+a.height/2;break;case"down":t=a.left+a.width/2,r=a.bottom+14;break;case"up":t=a.left+a.width/2,r=a.top-14}let i="right"===e?0:"left"===e?180:"down"===e?90:-90,o={position:"fixed",left:t-7,top:r-7,width:14,height:14,pointerEvents:"none",zIndex:9997};return(0,es.jsx)("div",{"data-devtools":"swipe-hint",style:o,children:(0,es.jsx)("svg",{width:14,height:14,viewBox:"-7 -7 14 14",style:{overflow:"visible"},children:(0,es.jsxs)("g",{transform:`rotate(${i})`,children:[(0,es.jsx)("line",{x1:"-5",y1:"0",x2:"3",y2:"0",stroke:"#fff",strokeWidth:"4",strokeLinecap:"round"}),(0,es.jsx)("polyline",{points:"0,-4 5,0 0,4",fill:"none",stroke:"#fff",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,es.jsx)("line",{x1:"-5",y1:"0",x2:"3",y2:"0",stroke:n,strokeWidth:"1.5",strokeLinecap:"round"}),(0,es.jsx)("polyline",{points:"0,-4 5,0 0,4",fill:"none",stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})},e)})})}var os=u(d()),as=u(v());function ls({element:e,fontSize:t,lineHeight:n,accentColor:r,hoveredProperty:i,draggingProperty:o,cursorViewport:a}){let[l,s]=(0,os.useState)(null);if((0,os.useEffect)(()=>{if(!e)return void s(null);let t=()=>{s(jn(e))};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,os.useLayoutEffect)(()=>{e&&s(jn(e))},[e,t,n]),!l)return null;let u=l.width,c=l.height,d=function(e){let t=e.match(/^oklch\\(([^)]+)\\)$/i);return t?`oklch(${t[1]} / 0.2)`:`color-mix(in srgb, ${e} ${Math.round(20)}%, transparent)`}(r),f=o??i,p={position:"fixed",top:l.top,left:l.left,width:u,height:c,pointerEvents:"none",zIndex:9996,overflow:"visible"};return(0,as.jsxs)("div",{"data-devtools":"text-handles",style:p,children:[(0,as.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${u} ${c}`,children:[(0,as.jsx)("rect",{x:"0.5",y:"0.5",width:Math.max(0,u-1),height:Math.max(0,c-1),fill:"none",stroke:d,strokeWidth:"1"}),("font-size"===f||!f)&&(0,as.jsx)("rect",{x:u-1,y:c/2-4,width:2,height:8,fill:r,stroke:"#ffffff",strokeWidth:"font-size"===f?4:2,paintOrder:"stroke"}),("line-height"===f||!f)&&(0,as.jsx)("rect",{x:u/2-4,y:c-1,width:8,height:2,fill:r,stroke:"#ffffff",strokeWidth:"line-height"===f?4:2,paintOrder:"stroke"})]}),a&&f&&(()=>{let e="font-size"===f?"Aa":"Lh",i=(e=>"font-size"===e?`${Math.round(t)}`:(t>0?n/t:1.2).toFixed(2).replace(/\\.?0+$/,""))(f);return(0,as.jsxs)("div",{style:{position:"fixed",left:a.x+8,top:a.y-28,background:r,color:"#fff",fontSize:11,fontWeight:600,fontFamily:\'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace\',lineHeight:1,padding:"4px 4px",borderRadius:0,whiteSpace:"nowrap",pointerEvents:"none",zIndex:9997},children:[e," ",i]})})()]})}var ss=u(v());function us({active:e,accentColor:t,domDropPreview:n,cursorViewport:r,gapElement:i,gapDragging:o,gapHoveredAxis:a,gapIsAuto:l,gapRefreshKey:s,swipeHint:u,radiusElement:c,radiusDragging:d,radiusHoveredCorner:f,textElement:p,textDragging:h,textHoveredProperty:m,paddingElement:g,paddingDragging:y,paddingHoveredSide:x}){if(!e)return null;let v=p&&!h?Ln(p):null;return(0,ss.jsxs)(ss.Fragment,{children:[n&&(0,ss.jsx)("div",{"data-devtools":"dom-drop-preview",style:{position:"fixed",zIndex:9997,pointerEvents:"none",backgroundColor:t,boxShadow:`0 0 0 1px ${t}`,opacity:"copy"===n.mode?.72:1,...n.rect.height>=n.rect.width?{left:n.rect.left-2,top:"before"===n.placement?n.rect.top-2:n.rect.bottom,width:n.rect.width+4,height:2}:{left:"before"===n.placement?n.rect.left-2:n.rect.right,top:n.rect.top-2,width:2,height:n.rect.height+4}}}),i&&(0,ss.jsx)(Bl,{element:i,gap:o?{row:o.row,column:o.column}:kn(i),accentColor:t,hoveredAxis:a,draggingAxis:o?.axis??null,cursorViewport:r,isAutoGap:l,refreshKey:s}),u&&(0,ss.jsx)(is,{element:u.target,modifier:u.modifier,accentColor:t,refreshKey:s}),!u&&c&&(0,ss.jsx)(Dl,{element:c,radius:d?.radius??An(c),accentColor:t,hoveredCorner:f,draggingCorner:d?.corner??null,cursorViewport:r}),!u&&p&&(0,ss.jsx)(ls,{element:p,fontSize:h?.fontSize??v.fontSize,lineHeight:h?.lineHeight??v.lineHeight,accentColor:t,hoveredProperty:m,draggingProperty:h?.property??null,cursorViewport:r}),!u&&g&&(0,ss.jsx)(Zl,{element:g,padding:y?.padding??Mn(g),accentColor:t,hoveredSide:x,draggingSide:y?.side??null,cursorViewport:r,refreshKey:h?h.fontSize+1e3*h.lineHeight:0})]})}var cs=u(d()),ds=u(d()),fs=u(v());function ps({query:e,border:t,background:n,foreground:r,renderIcon:i}){return(0,fs.jsxs)("span",{"aria-hidden":"true","data-popmelt-sticker-query":!0,style:{position:"absolute",left:"50%",top:44,minWidth:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",gap:4,padding:"0 10px",boxSizing:"border-box",border:`1px solid ${t}`,borderRadius:12,background:n,color:r,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",transform:"translateX(-50%)",zIndex:4},children:[e.tokens.map((e,t)=>"icon"===e.kind?(0,fs.jsx)("span",{"aria-label":e.label,"data-popmelt-sticker-query-token":"icon",style:{display:"inline-flex",color:r,flexShrink:0},children:i(e)},`${e.label}-${t}`):(0,fs.jsx)("span",{"data-popmelt-sticker-query-token":"label",style:{color:r,opacity:.72},children:e.label},`${e.label}-${t}`)),e.typed?(0,fs.jsx)("span",{children:e.typed}):(0,fs.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:0,color:r,opacity:.58,fontWeight:500},children:[(0,fs.jsx)("span",{"data-popmelt-sticker-query-caret":!0,style:{width:1,height:11,flexShrink:0,background:r,animation:"popmeltStickerQueryCaret 900ms steps(1, end) infinite"}}),(0,fs.jsx)("span",{children:e.fallback})]}),e.completion&&(0,fs.jsx)("span",{style:{color:r,opacity:.62},children:e.completion}),e.fallback&&e.typed&&(0,fs.jsxs)("span",{style:{color:r,opacity:.68},children:["→ ",e.fallback]})]})}var hs=u(v()),ms=106,gs=32,ys="cubic-bezier(0.16, 1, 0.3, 1)",xs=[0,180,240,300];function vs(e,t,n=42,r=40,i=ms){let o=e.left+i,a=e.top+n,l=Math.min(o,t.right)-Math.max(e.left,t.left),s=Math.min(a,t.bottom)-Math.max(e.top,t.top);if(l<=0||s<=0)return 1;let u=Math.min(l,s);return Math.max(0,1-u/r)}function bs(e,t,n,r=42,i=80,o=8,a=ms){let l=Math.min(Math.max(e.x,n.left),n.right),s=Math.min(Math.max(e.y,n.top),n.bottom),u={x:l-e.x,y:s-e.y},c=Math.hypot(u.x,u.y);if(0===c)return 0;let d=u.x/c,f=u.y/c,p=[{x:t.left,y:t.top},{x:t.left+a,y:t.top},{x:t.left,y:t.top+r},{x:t.left+a,y:t.top+r}],h=Math.max(0,...p.map(t=>(t.x-e.x)*d+(t.y-e.y)*f)),m=Math.max(i,h+o);return Math.min(1,c/m)}var ws={padding:"padding",margin:"margin",border:"border",radius:"radius",stack:"stack-vertical",grid:"grid",text:"text-size",color:"palette",transform:"transform-translate",opacity:"opacity"},Ss={top:0,right:90,bottom:180,left:270},ks={"top-right":0,"bottom-right":90,"bottom-left":180,"top-left":270};function Cs({name:e}){switch(e){case"padding":return(0,hs.jsx)("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V9C1.625 9.871 2.194 10.375 2.667 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V3C10.375 2.129 9.806 1.625 9.333 1.625H2.667ZM7.375 3A0.625 0.625 0 0 1 7.375 4.25H4.625A0.625 0.625 0 0 1 4.625 3H7.375Z",fill:"currentColor"});case"padding-top":return(0,hs.jsx)("path",{d:"M9.333 1.375C10.701 1.375 11.625 2.662 11.625 4V10A0.625 0.625 0 0 1 10.375 10V4C10.375 3.129 9.806 2.625 9.333 2.625H2.667C2.194 2.625 1.625 3.129 1.625 4V10A0.625 0.625 0 0 1 0.375 10V4C0.375 2.662 1.299 1.375 2.667 1.375H9.333ZM7.375 5A0.625 0.625 0 0 1 7.375 6.25H4.625A0.625 0.625 0 0 1 4.625 5H7.375Z",fill:"currentColor"});case"padding-x":return(0,hs.jsx)("path",{d:"M2.75 0.375C3.095 0.375 3.375 0.655 3.375 1S3.095 1.625 2.75 1.625C2.344 1.625 2.073 1.759 1.904 1.929C1.733 2.101 1.625 2.354 1.625 2.667V9.333C1.625 9.646 1.733 9.899 1.904 10.071C2.073 10.241 2.344 10.375 2.75 10.375C3.095 10.375 3.375 10.655 3.375 11S3.095 11.625 2.75 11.625C2.052 11.625 1.448 11.386 1.018 10.952C0.59 10.522 0.375 9.941 0.375 9.333V2.667C0.375 2.059 0.59 1.478 1.018 1.048C1.448 0.614 2.052 0.375 2.75 0.375ZM9.25 0.375C9.948 0.375 10.552 0.614 10.982 1.048C11.41 1.478 11.625 2.059 11.625 2.667V9.333C11.625 9.941 11.41 10.522 10.982 10.952C10.552 11.386 9.948 11.625 9.25 11.625C8.905 11.625 8.625 11.345 8.625 11S8.905 10.375 9.25 10.375C9.656 10.375 9.927 10.241 10.096 10.071C10.267 9.899 10.375 9.646 10.375 9.333V2.667C10.375 2.354 10.267 2.101 10.096 1.929C9.927 1.759 9.656 1.625 9.25 1.625C8.905 1.625 8.625 1.345 8.625 1S8.905 0.375 9.25 0.375ZM8.079 5.25C8.424 5.25 8.704 5.53 8.704 5.875S8.424 6.5 8.079 6.5H3.921C3.576 6.5 3.296 6.22 3.296 5.875S3.576 5.25 3.921 5.25H8.079Z",fill:"currentColor"});case"padding-y":return(0,hs.jsx)("path",{d:"M11.625 2.75C11.625 3.095 11.346 3.375 11 3.375S10.375 3.095 10.375 2.75C10.375 2.344 10.241 2.073 10.072 1.904C9.899 1.733 9.646 1.625 9.333 1.625H2.667C2.355 1.625 2.102 1.733 1.929 1.904C1.759 2.073 1.625 2.344 1.625 2.75C1.625 3.095 1.346 3.375 1 3.375S0.375 3.095 0.375 2.75C0.375 2.052 0.615 1.448 1.048 1.018C1.479 0.59 2.06 0.375 2.667 0.375H9.333C9.941 0.375 10.522 0.59 10.953 1.018C11.386 1.448 11.625 2.052 11.625 2.75ZM11.625 9.25C11.625 9.948 11.386 10.552 10.953 10.982C10.522 11.41 9.941 11.625 9.333 11.625H2.667C2.06 11.625 1.479 11.41 1.048 10.982C0.615 10.552 0.375 9.948 0.375 9.25C0.375 8.905 0.655 8.625 1 8.625S1.625 8.905 1.625 9.25C1.625 9.656 1.759 9.927 1.929 10.096C2.102 10.267 2.355 10.375 2.667 10.375H9.333C9.646 10.375 9.899 10.267 10.072 10.096C10.241 9.927 10.375 9.656 10.375 9.25C10.375 8.905 10.655 8.625 11 8.625S11.625 8.905 11.625 9.25ZM6.75 8.079C6.75 8.424 6.471 8.704 6.125 8.704S5.5 8.424 5.5 8.079V3.921C5.5 3.576 5.78 3.296 6.125 3.296S6.75 3.576 6.75 3.921V8.079Z",fill:"currentColor"});case"margin":return(0,hs.jsx)("path",{d:"M9.333 4.525C10.701 4.525 11.625 5.812 11.625 7.15V8.15C11.625 9.488 10.701 10.775 9.333 10.775H2.667C1.299 10.775 0.375 9.488 0.375 8.15V7.15C0.375 5.812 1.299 4.525 2.667 4.525H9.333ZM2.667 5.775C2.194 5.775 1.625 6.279 1.625 7.15V8.15C1.625 9.021 2.194 9.525 2.667 9.525H9.333C9.806 9.525 10.375 9.021 10.375 8.15V7.15C10.375 6.279 9.806 5.775 9.333 5.775H2.667ZM8.375 1.2A0.625 0.625 0 0 1 8.375 2.45H3.625A0.625 0.625 0 0 1 3.625 1.2H8.375Z",fill:"currentColor"});case"margin-top":return(0,hs.jsx)("path",{d:"M9.333 4.575C10.701 4.575 11.625 5.862 11.625 7.2V10.2A0.625 0.625 0 0 1 10.375 10.2V7.2C10.375 6.329 9.806 5.825 9.333 5.825H2.667C2.194 5.825 1.625 6.329 1.625 7.2V10.2A0.625 0.625 0 0 1 0.375 10.2V7.2C0.375 5.862 1.299 4.575 2.667 4.575H9.333ZM8.375 1.25A0.625 0.625 0 0 1 8.375 2.5H3.625A0.625 0.625 0 0 1 3.625 1.25H8.375Z",fill:"currentColor"});case"margin-x":return(0,hs.jsx)("path",{d:"M11.277 2.902C11.622 2.902 11.902 3.182 11.902 3.527V8.277C11.902 8.622 11.622 8.902 11.277 8.902S10.652 8.622 10.652 8.277V3.527C10.652 3.182 10.931 2.902 11.277 2.902ZM0.724 2.901C1.069 2.901 1.349 3.181 1.349 3.526V8.276C1.349 8.621 1.069 8.901 0.724 8.901S0.099 8.621 0.099 8.276V3.527C0.099 3.182 0.379 2.901 0.724 2.901ZM7.333 3.325C8.643 3.325 9.543 4.506 9.617 5.781C9.62 5.805 9.625 5.829 9.625 5.853L9.622 5.901L9.625 5.95C9.625 5.974 9.62 5.998 9.617 6.021C9.544 7.297 8.643 8.478 7.333 8.478H4.667C3.357 8.478 2.456 7.297 2.382 6.021C2.379 5.998 2.375 5.974 2.375 5.95L2.377 5.901L2.375 5.853C2.375 5.829 2.379 5.805 2.382 5.781C2.456 4.506 3.358 3.325 4.667 3.325H7.333ZM4.667 4.575C4.203 4.575 3.647 5.06 3.626 5.901C3.647 6.742 4.203 7.228 4.667 7.228H7.333C7.798 7.228 8.352 6.742 8.372 5.901C8.351 5.06 7.798 4.575 7.333 4.575H4.667Z",fill:"currentColor"});case"margin-y":return(0,hs.jsx)("path",{d:"M8.375 10.001C8.72 10.001 9 10.281 9 10.626S8.72 11.251 8.375 11.251H3.625C3.28 11.251 3 10.971 3 10.626S3.28 10.001 3.625 10.001H8.375ZM9.333 3.325C10.642 3.325 11.543 4.506 11.617 5.781C11.62 5.805 11.625 5.829 11.625 5.853L11.622 5.901L11.625 5.95C11.625 5.974 11.619 5.998 11.617 6.021C11.543 7.297 10.643 8.478 9.333 8.478H2.667C1.357 8.478 0.455 7.297 0.381 6.021C0.379 5.998 0.375 5.974 0.375 5.95L0.377 5.901L0.375 5.853C0.375 5.829 0.379 5.805 0.381 5.781C0.456 4.506 1.357 3.325 2.667 3.325H9.333ZM2.667 4.575C2.202 4.575 1.648 5.061 1.627 5.901C1.647 6.742 2.202 7.228 2.667 7.228H9.333C9.797 7.228 10.352 6.742 10.373 5.901C10.352 5.06 9.797 4.575 9.333 4.575H2.667ZM8.376 0.751C8.721 0.751 9.001 1.031 9.001 1.376S8.72 2.001 8.376 2.001H3.626C3.28 2.001 3.001 1.72 3.001 1.375S3.281 0.751 3.626 0.751H8.376Z",fill:"currentColor"});case"border":return(0,hs.jsx)(hs.Fragment,{children:(0,hs.jsx)("path",{d:"M4 1.25H8M4 10.75H8M1.25 8V4M10.75 8V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});case"radius":return(0,hs.jsx)(hs.Fragment,{children:(0,hs.jsx)("path",{d:"M3.25 1.25C2.145 1.25 1.25 2.145 1.25 3.25M10.75 3.25C10.75 2.145 9.855 1.25 8.75 1.25M3.25 10.75C2.145 10.75 1.25 9.855 1.25 8.75M10.75 8.75C10.75 9.855 9.855 10.75 8.75 10.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});case"gap-x":return(0,hs.jsxs)(hs.Fragment,{children:[(0,hs.jsx)("path",{d:"M6.625 9.375A0.625 0.625 0 0 1 5.375 9.375V2.625A0.625 0.625 0 0 1 6.625 2.625V9.375Z",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"1.252",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"10.748",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"1.252",cy:"6",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"10.748",cy:"6",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"1.252",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"10.748",cy:"10.752",r:"0.748",fill:"currentColor"})]});case"gap-y":return(0,hs.jsxs)(hs.Fragment,{children:[(0,hs.jsx)("path",{d:"M9.375 5.375A0.625 0.625 0 0 1 9.375 6.625H2.625A0.625 0.625 0 0 1 2.625 5.375H9.375Z",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"1.248",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"1.248",cy:"1.252",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"6",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"6",cy:"1.252",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"10.752",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"10.752",cy:"1.252",r:"0.748",fill:"currentColor"})]});case"border-top":return(0,hs.jsxs)(hs.Fragment,{children:[(0,hs.jsx)("path",{d:"M3.25 0.5A0.75 0.75 0 0 1 3.25 2C2.56 2 2 2.56 2 3.25V8.75C2 9.44 2.56 10 3.25 10A0.75 0.75 0 0 1 3.25 11.5C1.731 11.5 0.5 10.269 0.5 8.75V3.25C0.5 1.731 1.731 0.5 3.25 0.5Z",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"10.748",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"6.625",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"10.748",cy:"6",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"10.748",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"6.625",cy:"1.248",r:"0.748",fill:"currentColor"})]});case"radius-top-right":return(0,hs.jsxs)(hs.Fragment,{children:[(0,hs.jsx)("path",{d:"M8.25 1.25H8.75A2 2 0 0 1 10.75 3.25V3.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,hs.jsx)("circle",{cx:"9.748",cy:"9.748",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"2.248",cy:"9.748",r:"0.748",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"2.248",cy:"2.248",r:"0.748",fill:"currentColor"})]});case"stack-vertical":case"stack-horizontal":return(0,hs.jsx)("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM1.625 6.625V9C1.625 9.871 2.194 10.375 2.667 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V6.625H1.625ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H10.375V3C10.375 2.129 9.806 1.625 9.333 1.625H2.667Z",fill:"currentColor"});case"align":return(0,hs.jsxs)(hs.Fragment,{children:[(0,hs.jsx)("path",{d:"M1 2H11M2.5 5.25H9.5M4 8.5H8",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,hs.jsx)("path",{d:"M6 0.75V10.75",stroke:"currentColor",strokeWidth:"0.75",strokeDasharray:"1 2"})]});case"justify":return(0,hs.jsxs)(hs.Fragment,{children:[(0,hs.jsx)("path",{d:"M1 1.5V10.5M11 1.5V10.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,hs.jsx)("path",{d:"M3 3H9M3 6H9M3 9H9",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]});case"grid":return(0,hs.jsx)("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM6.625 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V6.625H6.625V10.375ZM1.625 9C1.625 9.871 2.194 10.375 2.667 10.375H5.375V6.625H1.625V9ZM6.625 5.375H10.375V3C10.375 2.129 9.806 1.625 9.333 1.625H6.625V5.375ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H5.375V1.625H2.667Z",fill:"currentColor"});case"grid-rows":return(0,hs.jsx)("path",{d:"M4.512 0.385C5.781 0.491 6.625 1.721 6.625 3V9C6.625 10.279 5.78 11.508 4.511 11.614C4.477 11.62 4.443 11.625 4.408 11.625H2.666C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H4.409C4.444 0.375 4.478 0.379 4.512 0.385ZM10.748 10.004C11.161 10.004 11.497 10.339 11.497 10.752C11.497 11.165 11.161 11.5 10.748 11.5C10.335 11.5 10 11.165 10 10.752C10 10.339 10.335 10.004 10.748 10.004ZM1.625 9C1.625 9.871 2.193 10.375 2.666 10.375H4.333C4.806 10.375 5.375 9.871 5.375 9V6.625H1.625V9ZM10.748 5.252C11.161 5.252 11.497 5.587 11.497 6C11.497 6.413 11.161 6.748 10.748 6.748C10.335 6.748 10 6.413 10 6C10 5.587 10.335 5.252 10.748 5.252ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H5.375V3C5.375 2.129 4.806 1.625 4.333 1.625H2.667ZM10.748 0.5C11.161 0.5 11.497 0.835 11.497 1.248C11.497 1.661 11.161 1.997 10.748 1.997C10.335 1.997 10 1.661 10 1.248C10 0.835 10.335 0.5 10.748 0.5Z",fill:"currentColor"});case"grid-columns":return(0,hs.jsx)("path",{d:"M0.321 7.424C0.427 6.155 1.657 5.311 2.936 5.311H8.936C10.215 5.311 11.444 6.156 11.55 7.425C11.556 7.458 11.561 7.493 11.561 7.528V9.27C11.56 10.637 10.274 11.561 8.936 11.561H2.936C1.598 11.561 0.311 10.636 0.311 9.269V7.527C0.311 7.492 0.315 7.458 0.321 7.424ZM9.94 1.188C9.94 0.775 10.275 0.439 10.688 0.439C11.101 0.439 11.437 0.774 11.437 1.188C11.437 1.601 11.101 1.936 10.688 1.936C10.275 1.936 9.94 1.601 9.94 1.188ZM8.936 10.311C9.806 10.311 10.31 9.743 10.311 9.27V7.603C10.311 7.129 9.807 6.561 8.936 6.561H6.561V10.311H8.936ZM5.188 1.188C5.188 0.775 5.523 0.439 5.936 0.439C6.349 0.439 6.685 0.774 6.685 1.188C6.685 1.601 6.349 1.936 5.936 1.936C5.523 1.936 5.188 1.601 5.188 1.188ZM1.561 9.269C1.561 9.742 2.065 10.311 2.936 10.311H5.311V6.561H2.936C2.065 6.561 1.561 7.129 1.561 7.603V9.269ZM0.436 1.188C0.436 0.774 0.772 0.439 1.185 0.439C1.598 0.439 1.933 0.775 1.933 1.188C1.933 1.601 1.598 1.936 1.185 1.936C0.772 1.936 0.436 1.601 0.436 1.188Z",fill:"currentColor"})}}function Es({family:e,size:t=12,step:n,subproperty:r="all"}){let i=function(e,t="all"){return ma(e,t)?{name:"palette",rotation:0}:"stack"===e?"horizontal"===t?{name:"stack-horizontal",rotation:90}:"align"===t?{name:"align",rotation:0}:"justify"===t?{name:"justify",rotation:0}:{name:"stack-vertical",rotation:0}:"grid"===e?{name:"rows"===t?"grid-rows":"columns"===t?"grid-columns":"grid",rotation:90}:"text"===e?{name:"weight"===t?"text-weight":"line-height"===t?"text-leading":"letter-spacing"===t?"text-tracking":"text-align"===t?"text-align":"text-size",rotation:0}:"transform"===e?{name:"scale"===t?"transform-scale":"rotate"===t?"transform-rotate":"transform-translate",rotation:0}:"opacity"===e?{name:"mix-blend"===t?"mix-blend":"opacity",rotation:0}:"all"===t?{name:ws[e],rotation:0}:"radius"===e?{name:"radius-top-right",rotation:ks[t]??0}:{name:"padding"===e?"x"===t?"padding-x":"y"===t?"padding-y":"padding-top":"margin"===e?"x"===t?"margin-x":"y"===t?"margin-y":"margin-top":"border-top",rotation:("border"===e?90:0)+(Ss[t]??0)}}(e,r),o="text-size"===i.name?L:"text-weight"===i.name?X:"text-leading"===i.name?q:"text-tracking"===i.name?Y:"text-align"===i.name?W:"palette"===i.name?ue:"transform-translate"===i.name?oe:"transform-scale"===i.name?pe:"transform-rotate"===i.name?fe:"opacity"===i.name?Q:"mix-blend"===i.name?U:null;return o?(0,hs.jsx)(o,{"aria-hidden":"true","data-popmelt-sticker-icon":`${e}-${r}`,width:t,height:t,strokeWidth:2.5,style:{display:"block",transform:i.rotation?`rotate(${i.rotation}deg)`:void 0,transition:"width 250ms ease, height 250ms ease"}}):(0,hs.jsx)("svg",{"aria-hidden":"true","data-popmelt-sticker-icon":`${e}-${r}`,viewBox:"0 0 12 12",fill:"none",style:{width:t,height:t,display:"block",transform:i.rotation?`rotate(${i.rotation}deg)`:void 0,transition:"width 250ms ease, height 250ms ease"},children:(0,hs.jsx)(Cs,{name:i.name})})}function Ms({offset:e,colors:t,renderItem:n,showControl:r=!0,activeColor:i,snapActiveColor:o=!1}){let a=[e-2,e-1,e,e+1,e+2];return(0,hs.jsxs)("div",{style:{position:"relative",width:96,height:32,overflow:"hidden"},children:[r&&(0,hs.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",left:gs,top:0,width:gs,height:gs,borderRadius:16,background:t.control}}),(0,hs.jsx)("div",{"data-popmelt-sticker-rail":!0,style:{position:"absolute",inset:0,transform:`translateX(${-e*gs}px)`,transition:"transform 250ms ease",willChange:"transform"},children:a.map(r=>{let a=r===e;return(0,hs.jsx)("span",{style:{position:"absolute",left:gs+r*gs,top:0,width:gs,height:gs,display:"flex",alignItems:"center",justifyContent:"center",color:a?i??t.primary:t.mutedStrong,transition:o?"none":`color 400ms ${ys}`},children:n(r,a)},r)})})]})}function Ts({family:e,colors:t,showControl:n=!0,activeColor:r,snapActiveColor:i}){let o=(0,ds.useRef)(e),a=(0,ds.useRef)(e),[l,s]=(0,ds.useState)(0);return(0,ds.useLayoutEffect)(()=>{if(a.current===e)return;let t=function(e,t){let n=Yo.indexOf(e),r=(Yo.indexOf(t)-n+Yo.length)%Yo.length;return r<=Yo.length/2?r:r-Yo.length}(a.current,e);a.current=e,s(e=>e+t)},[e]),(0,hs.jsx)(Ms,{offset:l,colors:t,showControl:n,activeColor:r,snapActiveColor:i,renderItem:(e,t)=>{let n=function(e,t){let n=(Yo.indexOf(e)+t%Yo.length+Yo.length)%Yo.length;return Yo[n]}(o.current,e);return(0,hs.jsx)(Es,{family:n,subproperty:"all",size:t?14:12})}})}function Rs({color:e,colors:t,showControl:n=!0}){let r=(0,ds.useRef)(e),i=(0,ds.useRef)(e),[o,a]=(0,ds.useState)(0);return(0,ds.useLayoutEffect)(()=>{if(i.current===e)return;let t=function(e,t){let n=_o.indexOf(e),r=(_o.indexOf(t)-n+_o.length)%_o.length;return r<=_o.length/2?r:r-_o.length}(i.current,e);i.current=e,a(e=>e+t)},[e]),(0,hs.jsx)(Ms,{offset:o,colors:t,showControl:n,renderItem:(e,t)=>{let n=function(e,t){let n=_o.indexOf(e);return _o[(n+t%_o.length+_o.length)%_o.length]}(r.current,e),i=t?14:12;return(0,hs.jsx)("span",{"aria-label":n,"data-popmelt-sticker-color":n,style:{width:i,height:i,borderRadius:"50%",background:Wo(n,Fo),boxShadow:"inset 0 0 0 1px rgb(0 0 0 / 0.08)",transition:"width 250ms ease, height 250ms ease"}})}})}function As({name:e,size:t}){let n="align-start"===e?V:"align-center"===e?z:"align-end"===e?N:"align-stretch"===e?ge:"justify-start"===e?F:"justify-center"===e?_:"justify-end"===e?D:"justify-between"===e?O:"justify-around"===e?$:"text-align-left"===e?W:"text-align-center"===e?P:"text-align-right"===e?B:"text-align-justify"===e?H:null;return n?(0,hs.jsx)(n,{"aria-hidden":"true","data-popmelt-sticker-step-icon":e,width:t,height:t,strokeWidth:2.25,style:{display:"block"}}):(0,hs.jsx)("svg",{"aria-hidden":"true","data-popmelt-sticker-step-icon":e,width:t,height:t,viewBox:"0 0 14 14",fill:"none",style:{display:"block"},children:"align-baseline"===e?(0,hs.jsxs)(hs.Fragment,{children:[(0,hs.jsx)("path",{d:"M1.5 10.5H12.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,hs.jsx)("path",{d:"M3 8V4.75M3 4.75H6.5M6.5 4.75V8M8.5 8V6M8.5 6H11M11 6V8",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}):(0,hs.jsxs)(hs.Fragment,{children:[(0,hs.jsx)("path",{d:"M1.5 2V12M12.5 2V12",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,hs.jsx)("rect",{x:"3.25",y:"4.75",width:"2",height:"4.5",rx:"1",fill:"currentColor"}),(0,hs.jsx)("rect",{x:"8.75",y:"4.75",width:"2",height:"4.5",rx:"1",fill:"currentColor"}),(0,hs.jsx)("circle",{cx:"7",cy:"7",r:"0.75",fill:"currentColor"})]})})}function Is({family:e,step:t,subproperty:n,colors:r,showControl:i=!0,unavailable:o=!1,activeColor:a,snapActiveColor:l=!1}){let s=(0,ds.useRef)(t),u=(0,ds.useRef)(t),[c,d]=(0,ds.useState)(0);return(0,ds.useEffect)(()=>{if(u.current===t)return;let r=function(e,t,n,r="all"){let i=ba(e,r),o=i.indexOf(t),a=(i.indexOf(n)-o+i.length)%i.length;return a<=i.length/2?a:a-i.length}(e,u.current,t,n);u.current=t,d(e=>e+r)},[e,t,n]),(0,hs.jsx)(Ms,{offset:c,colors:r,showControl:i,activeColor:a??(o?r.muted:r.primary),snapActiveColor:l,renderItem:(t,r)=>{let i=function(e,t,n,r="all"){let i=ba(e,r),o=(i.indexOf(t)+n%i.length+i.length)%i.length;return i[o]}(e,s.current,t,n),a=function(e,t,n){if("stack"===e&&"align"===t){if("start"===n)return"align-start";if("center"===n)return"align-center";if("end"===n)return"align-end";if("stretch"===n)return"align-stretch";if("baseline"===n)return"align-baseline"}if("stack"===e&&"justify"===t){if("start"===n)return"justify-start";if("center"===n)return"justify-center";if("end"===n)return"justify-end";if("between"===n)return"justify-between";if("around"===n)return"justify-around";if("evenly"===n)return"justify-evenly"}if("text"===e&&"text-align"===t){if("left"===n)return"text-align-left";if("center"===n)return"text-align-center";if("right"===n)return"text-align-right";if("justify"===n)return"text-align-justify"}return null}(e,n,i);return(0,hs.jsx)("span",{"data-popmelt-sticker-step-unavailable":r&&o?"true":void 0,style:{alignItems:"center",display:"flex",fontSize:r?14:12,justifyContent:"center",transition:"font-size 250ms ease"},children:a?(0,hs.jsx)(As,{name:a,size:r?14:12}):$a(i,e,n)})}})}function js(e){return"family"===e?0:35}function Ls(e){return"family"===e?gs/24:1}function Ps(e){return"family"===e?14/(12*Ls(e)):1}function zs(e,t,n){return`${e}:${t}:${n}`}function Ns(e,t,n){return!!ha(n)&&("color"===e?"family"!==t:("text"===e||"border"===e)&&"value"===t)}function _s({family:e,step:t,subproperty:n,stage:r,accentColor:i,applyPulse:o=0,snapPulse:a=0,stepUnavailable:l=!1,colors:s}){let u=function(e,t="padding",n="all"){return ma(t,n)?"family"===e?{family:0,variant:-32,value:-64}:"variant"===e?{family:gs,variant:0,value:-32}:{family:64,variant:gs,value:0}:"family"===e?{family:0,variant:-64,value:-32}:{family:gs,variant:-32,value:0}}(r,e,n),c=(0,ds.useRef)(r),d=(0,ds.useRef)(o),f=(0,ds.useRef)(a),[p,h]=(0,ds.useState)(!1),m=f.current!==a;(0,ds.useLayoutEffect)(()=>{f.current=a},[a]),(0,ds.useLayoutEffect)(()=>{let e=c.current!==r&&"family"!==r,t="value"===r&&d.current!==o;if(c.current=r,d.current=o,!e&&!t)return;h(!0);let n=window.requestAnimationFrame(()=>h(!1));return()=>window.cancelAnimationFrame(n)},[o,r]);let g=e=>({position:"absolute",left:0,right:0,top:4,height:gs,transform:`translateY(${e}px)`,transition:m?"none":"transform 250ms ease",willChange:"transform"});return(0,hs.jsxs)("div",{"data-popmelt-sticker-depth-rail":r,style:{position:"relative",width:96,height:40,marginBlock:-4,overflow:"hidden",zIndex:2},children:[(0,hs.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-depth-control":!0,style:{position:"absolute",left:gs,top:4,width:gs,height:gs,borderRadius:16,background:p?i:s.control,transition:p?"none":`background 400ms ${ys}`}}),(0,hs.jsx)("div",{"aria-hidden":"family"!==r,"data-popmelt-sticker-depth-row":"family",style:g(u.family),children:(0,hs.jsx)(Ts,{family:e,colors:s,showControl:!1,activeColor:p?s.surface:s.primary,snapActiveColor:p})}),(0,hs.jsx)("div",{"aria-hidden":"variant"!==r,"data-popmelt-sticker-depth-row":"variant",style:g(u.variant),children:ma(e,n)&&ha(n)&&(0,hs.jsx)(Rs,{color:n,colors:s,showControl:!1})}),(0,hs.jsx)("div",{"aria-hidden":"value"!==r,"data-popmelt-sticker-depth-row":"value",style:g(u.value),children:(0,hs.jsx)(Is,{family:e,step:t,subproperty:n,colors:s,showControl:!1,unavailable:l,activeColor:p?s.surface:void 0,snapActiveColor:p},zs(r,e,n))})]})}function Ds(e,t,n=42,r=ms){let i=e.x+10,o=e.y+10;return{left:Math.min(Math.max(8,i),Math.max(8,t.width-r-8)),top:Math.min(Math.max(8,o),Math.max(8,t.height-n-8))}}function Fs(e,t,n){return n?0:Math.min(e,t)}function $s({cursor:e,family:t,step:n,subproperty:r,stage:i,accentColor:o,applyPulse:a=0,contextLabelPulse:l=0,depthSnapPulse:s=0,rejectPulse:u=0,stepUnavailable:c=!1,query:d=null,toolbarElement:f,controlBounds:p,threadElement:h,annotationRailHovered:m=!1}){let[g]=_e(),y=Ae[g],x=`color-mix(in srgb, ${y.actionForeground} 16%, ${y.actionSurface})`,v=function(e,t){let n=ka(e,t);return"color"===e||("text"===e||"border"===e)&&ha(n)?n:`${function(e){return ca[e]}(e)}${pa[n]}`}(t,r),b=(0,ds.useRef)(t),w=(0,ds.useRef)(i),S=(0,ds.useRef)(r),k=(0,ds.useRef)(i),C=(0,ds.useRef)(a),E=(0,ds.useRef)(l),M=(0,ds.useRef)(u),T=(0,ds.useRef)(null),R=(0,ds.useRef)(!1),A=(0,ds.useRef)(!1),I=(0,ds.useRef)(0),j=(0,ds.useRef)(0),L=(0,ds.useRef)(0),P=(0,ds.useRef)(0),[z,N]=(0,ds.useState)(null),[_,D]=(0,ds.useState)(!1),[F,$]=(0,ds.useState)(!1),[O,H]=(0,ds.useState)(!1),[W,B]=(0,ds.useState)(null),[V,q]=(0,ds.useState)(!1),[Y,U]=(0,ds.useState)(0),[X,K]=(0,ds.useState)(!1),[Q,G]=(0,ds.useState)(!1);(0,ds.useLayoutEffect)(()=>{if(M.current===u)return;M.current=u,G(!1);let e=window.requestAnimationFrame(()=>G(!0)),t=window.setTimeout(()=>G(!1),240);return()=>{window.cancelAnimationFrame(e),window.clearTimeout(t)}},[u]),(0,ds.useLayoutEffect)(()=>{let e=k.current!==i&&"family"!==i,t="value"===i&&C.current!==a;if(k.current=i,C.current=a,!e&&!t)return;K(!0);let n=window.requestAnimationFrame(()=>K(!1));return()=>window.cancelAnimationFrame(n)},[a,i]),(0,ds.useLayoutEffect)(()=>{let e="family"!==w.current&&"family"===i;w.current=i;let n=(e=!1)=>{I.current&&window.cancelAnimationFrame(I.current),e||window.clearTimeout(j.current),window.clearTimeout(L.current),window.clearTimeout(P.current),I.current=0,e||(j.current=0),L.current=0,P.current=0},r=e=>{let t=e?250:200;L.current=window.setTimeout(()=>{$(e),A.current=!1,D(!1)},750),P.current=window.setTimeout(()=>{R.current=!1,N(null)},750+t+34)};if("family"!==i){if(n(),b.current=t,!R.current)return;return $(!0),A.current=!1,D(!1),void(P.current=window.setTimeout(()=>{R.current=!1,N(null)},250))}if(b.current!==t||e){if(b.current=t,R.current=!0,N(t),e)return n(),$(!1),H(!0),A.current=!0,D(!0),j.current=window.setTimeout(()=>{j.current=0,H(!1)},250),void r(!1);j.current||(n(!0),H(!1),$(!1),A.current||(A.current=!0,D(!0)),r(!1))}},[t,i]),(0,ds.useEffect)(()=>()=>{window.cancelAnimationFrame(I.current),window.clearTimeout(j.current),window.clearTimeout(L.current),window.clearTimeout(P.current)},[]),(0,ds.useEffect)(()=>{let e=E.current!==l;if(E.current=l,!function(e,t,n="all"){return"value"===t||ma(e,n)&&"variant"===t}(t,i,r))return B(null),q(!1),void(S.current=r);if(b.current!==t)return S.current=r,B(null),void q(!1);if(S.current===r&&!e)return;S.current=r,q(e),B(e?function(e,t){let n=Ta(e),r=Ra(e,t);return r===n?n:`${n} ${r}`}(t,r):Ra(t,r));let n=window.setTimeout(()=>{B(null),q(!1)},750);return()=>window.clearTimeout(n)},[l,t,i,r]),(0,ds.useLayoutEffect)(()=>{W&&T.current?U(T.current.scrollWidth):U(0)},[W]);let Z=function(e,t=7.5){return null===e?24:Math.max(39,18+2*t+Math.ceil(e))}(W?Y:null,V?10:7.5),J=V?10:7.5,ee=W?0:140,te=d||"family"!==i||z?68:42,ne=(0,ds.useMemo)(()=>Ds(e,p?.viewport??{width:typeof window>"u"?ms:window.innerWidth,height:typeof window>"u"?42:window.innerHeight},te),[te,e,p?.viewport]),re=f?vs(ne,f.getBoundingClientRect(),te):1,ie=h?bs(e,ne,h.getBoundingClientRect(),te):1,oe=p?.compact?function(e,t,n,r,i){let o,a=8,l=i-r-8,s=1;for(let u of n){let n=Math.max(u.left-e.x,e.x-u.right,0),c=Math.max(u.top-e.y,e.y-u.bottom,0);if(s=Math.min(s,Math.hypot(n,c)/12),t.left+ms<=u.left||t.left>=u.right)continue;let d=(u.top+u.bottom)/2<i/2,f=d?u.bottom+1:u.top-1-r;d?a=Math.max(a,f):l=Math.min(l,f);let p=d?t.top<=f:t.top>=f,h=d?e.y-u.bottom:u.top-e.y;if(!p||h<0)continue;let m=Math.max(n/12,Math.max(0,h-1)/r);m<s&&(s=m,o=d?0:r)}let u=Math.max(a,Math.min(t.top,l));return{top:u,scale:s,originY:o??Math.min(r,Math.max(0,e.y-u))}}(e,ne,p.bounds,te,p.viewport?.height??window.innerHeight):void 0,ae=oe?.scale??p?.bounds.reduce((t,n)=>Math.min(t,bs(e,ne,n,te,40)),1)??1,le=Fs(Math.min(re,ae),ie,m),se=oe?.top??ne.top,ue={position:"fixed",left:ne.left,top:se,width:ms,height:42,display:"flex",alignItems:"center",justifyContent:"center",gap:1,boxSizing:"border-box",padding:4,border:`1px solid ${y.border}`,borderRadius:22,background:y.surface,color:y.primary,fontFamily:He,fontSize:12,fontWeight:600,lineHeight:1,pointerEvents:"none",overflow:"visible",opacity:le,transform:`scale(${le})`,transformOrigin:`${e.x-ne.left}px ${oe?.originY??e.y-se}px`,visibility:0===le?"hidden":"visible",animation:Q?"popmeltStickerReject 220ms ease-out":void 0,zIndex:2147483647,colorScheme:g},ce=d?function(e){return[...e.tokens.map(e=>e.label),`${e.typed}${e.completion||e.fallback}`].filter(Boolean).join(" ")}(d):"";return(0,hs.jsxs)("div",{role:"status","aria-label":d?`Sticker search: ${ce||"search tokens"}`:`Sticker ${i}: ${"family"===i?t:"variant"===i?v:`${n} ${v}`}`,"data-devtools":"sticker-hud","data-popmelt-sticker-hud":!0,"aria-hidden":m||void 0,style:ue,children:[(0,hs.jsx)("style",{children:`@keyframes popmeltStickerReject {\\n ${Bi}\\n }\\n @keyframes popmeltStickerFamilyLabelEnter {\\n from {\\n opacity: 0;\\n transform: translate(-50%, 10px) scale(0.9);\\n }\\n to {\\n opacity: 1;\\n transform: translate(-50%, 0) scale(1);\\n }\\n }\\n @keyframes popmeltStickerQueryCaret {\\n 0%, 45% { opacity: 1; }\\n 55%, 100% { opacity: 0; }\\n }`}),(0,hs.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-wheel-shell":!0,style:{position:"absolute",inset:1,borderRadius:21,background:y.surface,zIndex:1}}),(0,hs.jsx)(_s,{family:t,step:n,subproperty:r,stage:i,accentColor:o,applyPulse:a,snapPulse:s,stepUnavailable:c,colors:y}),!d&&(0,hs.jsxs)("span",{"aria-hidden":"true","data-popmelt-sticker-token-context":!0,"data-popmelt-sticker-token-context-stage":i,"data-popmelt-sticker-token-context-expanded":W?"true":"false",style:{position:"absolute",left:(ms-Z)/2,top:9,width:Z,height:24,display:"flex",alignItems:"center",justifyContent:"center",gap:W?4:0,padding:W?`0 ${J}px`:0,boxSizing:"border-box",border:`1px solid ${x}`,borderRadius:12,background:y.actionSurface,color:y.actionForeground,transform:`translateY(${js(i)}px) scale(${Ls(i)})`,transition:`left ${ee}ms ease-out, width ${ee}ms ease-out, gap ${ee}ms ease-out, padding ${ee}ms ease-out, transform 250ms ease`,transformOrigin:"center",willChange:"left, width, transform",overflow:"hidden",zIndex:0},children:[(0,hs.jsx)("span",{style:{display:"block",transform:`scale(${Ps(i)})`,transition:"transform 250ms ease",transformOrigin:"center"},children:Ns(t,i,r)?(0,hs.jsx)("span",{"data-popmelt-sticker-color-context":r,style:{display:"block",width:12,height:12,borderRadius:"50%",background:Wo(r,"value"===i?n:Fo),boxShadow:"inset 0 0 0 1px rgb(255 255 255 / 0.16)"}}):(0,hs.jsx)(Es,{family:t,subproperty:"text"===t&&"variant"===i&&ha(r)?"color":r})}),(0,hs.jsx)("span",{ref:T,"data-popmelt-sticker-subproperty-label":!0,style:{flexShrink:0,opacity:W&&Y>0?1:0,color:y.actionForeground,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",transition:"opacity 120ms ease"},children:W})]}),d&&(0,hs.jsx)(ps,{query:d,border:x,background:y.actionSurface,foreground:y.actionForeground,renderIcon:e=>(0,hs.jsx)(Es,{family:e.family,subproperty:e.subproperty,size:12})}),(0,hs.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-depth-burst":!0,style:{position:"absolute",left:37,top:5,width:gs,height:gs,overflow:"visible",pointerEvents:"none",zIndex:3},children:xs.map(e=>(0,hs.jsx)("span",{style:{position:"absolute",left:"50%",top:"50%",width:4,height:1.5,borderRadius:1,background:o,opacity:X?1:0,transform:`translate(-50%, -50%) rotate(${e}deg) translateX(${X?17:30}px) scaleX(${X?.7:1})`,transformOrigin:"center",transition:X?"none":"transform 180ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms ease-out",willChange:"transform, opacity"}},e))}),!d&&z&&(0,hs.jsx)("span",{"data-popmelt-sticker-family-label":!0,style:{position:"absolute",left:"50%",top:44,height:24,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 10px",boxSizing:"border-box",opacity:_?1:0,transform:`translate(-50%, ${F?-35:0}px) scale(${F?.9:1})`,transformOrigin:"center",transition:"transform 250ms ease, opacity 200ms ease",animation:_&&O?"popmeltStickerFamilyLabelEnter 250ms ease":void 0,border:`1px solid ${x}`,borderRadius:12,background:y.actionSurface,color:y.actionForeground,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",willChange:"transform, opacity",zIndex:0},children:Ta(z)})]})}function Os(e,t){let n=0===e?"Ready":`${e} action${1===e?"":"s"}`,r=16+7.2*n.length,i=t?0===e?22:45:0===e?96:89;return{label:n,accessibleShortcut:0===e?"Command Escape to exit":"Command Enter to complete",width:Math.ceil(r+4+i)}}function Hs(e,t){let n=e.get(t);return!!n&&(clearTimeout(n),e.delete(t),!0)}function Ws(e,t,n){return null!==e&&e.selector===t&&e.expandedIndices.includes(n)}function Bs(e,t){return e?.selector===t?null:e}function Vs({selector:e,label:t,tokens:n}){return JSON.stringify([e,t,n])}function qs({hasElementChanges:e=!1,hasPendingChanges:t,hasThreadState:n,isHovered:r,hasTimedReveal:i,isRevealedSticker:o}){let a=(e||t||n)&&!r;return{annotationCollapsed:a,stickerCollapsed:a&&!o,sendCompact:a&&!i}}var Ys=u(v());function Us({cursor:e,stepCount:t,accentColor:n,toolbarElement:r,threadElement:i}){let[o]=_e(),a=Ae[o],[l,s]=(0,cs.useState)(!1);(0,cs.useEffect)(()=>{s(!1);let e=window.setTimeout(()=>s(!0),1e3);return()=>window.clearTimeout(e)},[t]);let u={width:window.innerWidth,height:window.innerHeight},c=Os(t,!1),d=Ds(e,u,22,c.width),f=r?vs(d,r.getBoundingClientRect(),22,void 0,c.width):1,p=i?bs(e,d,i.getBoundingClientRect(),22,void 0,void 0,c.width):1,h=Math.min(f,p)<1||l,m=Os(t,h),g=Ds(e,u,22,m.width),y=Fs(r?vs(g,r.getBoundingClientRect(),22,void 0,m.width):1,i?bs(e,g,i.getBoundingClientRect(),22,void 0,void 0,m.width):1,!1),x={position:"fixed",left:g.left,top:g.top,width:m.width,height:22,display:"flex",alignItems:"center",gap:4,boxSizing:"border-box",padding:0,color:"#000000",fontSize:12,fontWeight:400,lineHeight:1,pointerEvents:"none",whiteSpace:"nowrap",transition:"width 180ms cubic-bezier(0.2, 0, 0, 1)",opacity:y,transform:`scale(${y})`,transformOrigin:`${e.x-g.left}px ${e.y-g.top}px`,visibility:0===y?"hidden":"visible",zIndex:2147483647,colorScheme:o};return(0,Ys.jsxs)("div",{role:"status","aria-label":`${m.label}. ${m.accessibleShortcut}`,"data-devtools":"interaction-episode-hud","data-popmelt-interaction-episode-hud":!0,style:x,children:[(0,Ys.jsx)("span",{style:{height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",padding:"4px 8px",borderRadius:"2px 8px 8px 8px",background:n,color:"#dddddd",fontFamily:We,lineHeight:1.2},children:m.label}),(0,Ys.jsx)("span",{"aria-hidden":"true",style:{height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",gap:h?0:6,padding:h?"4px 5px":0===t?"4px 6px 4px 8px":"4px 8px 4px 10px",borderRadius:8,background:a.surface,border:`1px solid ${a.border}`,color:a.primary,fontFamily:He,lineHeight:1.2,letterSpacing:"0.24px",overflow:"hidden",transition:"width 180ms cubic-bezier(0.2, 0, 0, 1), padding 180ms cubic-bezier(0.2, 0, 0, 1)"},children:h?0===t?(0,Ys.jsx)(xe,{size:12,strokeWidth:2}):(0,Ys.jsxs)("span",{"data-popmelt-interaction-episode-complete-shortcut":!0,style:{display:"inline-flex",alignItems:"center",gap:2},children:[(0,Ys.jsx)(Z,{size:12,strokeWidth:2}),(0,Ys.jsx)("span",{children:"+"}),(0,Ys.jsx)(J,{size:12,strokeWidth:2})]}):(0,Ys.jsxs)(Ys.Fragment,{children:[(0,Ys.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:[(0,Ys.jsx)(Z,{size:12,strokeWidth:2}),(0,Ys.jsx)("span",{children:"+"}),0===t?(0,Ys.jsx)("span",{children:"esc"}):(0,Ys.jsx)(J,{size:12,strokeWidth:2})]}),(0,Ys.jsx)("span",{style:{color:a.secondary},children:"to"}),0===t?(0,Ys.jsx)(xe,{size:12,strokeWidth:2,color:"red"}):(0,Ys.jsx)(K,{size:12,strokeWidth:2,color:"#02bd02"})]})})]})}var Xs=u(d()),Ks=u(d()),Qs=["reviewing","considering","thinking","zhuzhing","iterating","tweaking","reflecting","noodling","pondering","finessing","polishing","riffing"];function Gs(e){return{...$r(),display:"flex",alignItems:"center",gap:4,backgroundColor:e,color:"#fff",fontSize:12,lineHeight:"14px",fontFamily:ni,letterSpacing:"0.24px",padding:"0 8px",borderRadius:8,whiteSpace:"nowrap",maxWidth:400}}var Zs={overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0};function Js(e){return e.isInFlight?"#888888":e.comment?!1===e.comment.pending?"#888888":e.threadAccentColor:e.isInFlight||e.hasThreadState||e.hasStickers?"#888888":e.accentColor}function eu(e,t,n){if(t)return e?t.jobId===n?t:void 0:t}function tu(e){if(e.awaitingReview)return{jobId:`suggestion:${e.awaitingReview.submissionId}`,threadId:e.awaitingReview.threadId,status:"awaiting_review",selectors:[e.selector],annotationNumber:e.annotationNumber}}function nu(e){return e.selection?`${e.selection.family}:${e.selection.subproperty}`:`custom:${e.custom.property}`}function ru(e,t){return!e||!!t}function iu(e){return e.sticker?{token:e.sticker.axisSteps?`translate-x-${e.sticker.axisSteps.x}-y-${e.sticker.axisSteps.y}`:_a(e.sticker.family,e.sticker.step,e.sticker.subproperty),selection:e.sticker}:{token:e.modified,custom:{property:e.property,value:e.modified}}}function ou(e){let t=[];for(let n of e){let e=iu(n);t.some(t=>nu(t)===nu(e))||t.push(e)}return t}var au=u(v());function lu({property:e}){let t,n=/^(padding|margin)(?:-(top|right|bottom|left))?$/.exec(e);n&&(t={family:n[1],subproperty:n[2]??"all"});let r=/^border-(top|right|bottom|left)-width$/.exec(e);r&&(t={family:"border",subproperty:r[1]});let i=/^border-(top-left|top-right|bottom-right|bottom-left)-radius$/.exec(e);i&&(t={family:"radius",subproperty:i[1]});let o={"border-width":["border","all"],"border-radius":["radius","all"],"font-size":["text","size"],"font-weight":["text","weight"],"line-height":["text","line-height"],"letter-spacing":["text","letter-spacing"],"text-align":["text","text-align"],"flex-direction":["stack","direction"],"align-items":["stack","align"],"justify-content":["stack","justify"],gap:["stack","gap"],"grid-template-columns":["grid","columns"],"grid-template-rows":["grid","rows"],translate:["transform","translate"],scale:["transform","scale"],rotate:["transform","rotate"],opacity:["opacity","opacity"],"mix-blend-mode":["opacity","mix-blend"]}[e];if(o&&(t={family:o[0],subproperty:o[1]}),t)return(0,au.jsx)(Es,{...t});let a=/(^|-)color$|^(fill|stroke)$/.test(e)?ue:/(^|-)(width|inline-size)$/.test(e)?ae:/(^|-)(height|block-size)$/.test(e)?le:me;return(0,au.jsx)(a,{"aria-hidden":"true","data-popmelt-property-icon":e,size:12,strokeWidth:2.5,style:{display:"block"}})}function su({chip:e}){return e.selection?(0,au.jsx)(Es,{...e.selection}):(0,au.jsx)(lu,{property:e.custom.property})}var uu=u(v());function cu(e){return e.comment?.threadState??e.threadState}function du(e){return li(e.element)}function fu(e){let t=e.stickers.map(e=>e.token).join(""),n=e.comment?.text??e.label;return Math.min(720,44+7.2*n.length+7.2*t.length)}function pu(e,t){return t||!1===e?.pending?0:e?.imageCount??0}function hu(e,t,n,r,i,o){return`translate(${"right"===n?`max(calc(-100% + ${r}px), calc(0px - max(0px, ${e}px)))`:`min(0px, calc(100vw - max(0px, ${e}px) - 100%))`}, min(max(0px, calc(${void 0!==i?`${i}px`:"0px"} - max(0px, ${t}px))), calc(${void 0!==o?`${o}px`:"100dvh"} - max(0px, ${t}px) - 100%)))`}function mu({left:e,top:t,avoidTop:n,avoidBottom:r,anchor:i,horizontalAlignment:o="left",visualRef:a,style:l,children:s,...u}){let c=function(e){let t=e.startsWith("top-");return{top:t?4:12,right:4,bottom:t?12:4,left:4}}(i),d=e-c.left,f=t-c.top;return(0,uu.jsx)("div",{"data-devtools":"badge-hit-area",...u,style:{position:"fixed",left:`max(0px, ${d}px)`,top:`max(0px, ${f}px)`,padding:`${c.top}px ${c.right}px ${c.bottom}px ${c.left}px`,transform:hu(d,f,o,c.left+c.right,n,r),...l},children:(0,uu.jsx)("div",{ref:a,children:s})})}function gu({targetDocument:e,subjectRegistry:t,projectedTargets:n,readOnly:r=!1,focusedSelector:i,threadAccessory:o,styleModifications:a,textModifications:l,stagedComments:s,accentColor:u,annotationNumberBySelector:c,inFlightSelectors:d,inFlightAnnotationIds:f,activeAnnotationIds:p,inFlightSelectorJobIds:h,waitingApprovalJobIds:m,inFlightSelectorColors:g,toolbarRef:y,onHoverSelector:x,sendHintSelector:v,pendingBundleCount:b=1,onHoverSendBundle:w,onSend:S,onSelectSticker:k,onDeleteSticker:C,threadStates:E,onViewThread:M,hoveredElement:T,hoveredElementInfo:R,showHoverIdentifier:A=!1,onEditComment:I,onDeleteComment:j,onDeletePeerComment:L,onDeletePeerStyles:P,onDiscardTextChanges:z,onArchiveThread:N,onClearInteractionEpisode:_,onEditSubject:D,onDeleteSubject:F,onHoverSubjectLabel:$,activeCommentEntry:O,refreshKey:H}){let W=(0,Xs.useContext)(Ct),B=(0,Xs.useContext)(Fi),[V,q]=(0,Xs.useState)([]),[Y,U]=(0,Xs.useState)(null),[X,K]=(0,Xs.useState)(null),[Q,Z]=(0,Xs.useState)(()=>new Map),J=(0,Xs.useRef)(new Map),ee=(0,Xs.useRef)(new Map),te=(0,Xs.useRef)(new Map),re=(0,Xs.useRef)(new Map),ie=(0,Xs.useRef)(new Map),oe=(0,Xs.useRef)(new Map),ae=(0,Xs.useCallback)(e=>{Hs(ie.current,e)},[]),le=(0,Xs.useCallback)(e=>{!function(e,t,n,r=1e3){Hs(e,t),e.set(t,setTimeout(()=>{e.delete(t),n()},r))}(ie.current,e,()=>{K(t=>t===e?null:t),U(t=>t?.selector===e?null:t)})},[]),ue=(0,Xs.useCallback)((e,t,n)=>{U(r=>function(e,t){return e&&e.selector===t.selector?t.index===e.index?e:{...t,expandedIndices:t.index>e.index?[...new Set([...e.expandedIndices,t.index])]:[...new Set([...e.expandedIndices.filter(e=>e<=t.index),t.index])]}:{...t,expandedIndices:[t.index]}}(r,{selector:e,target:t,index:n}))},[]),ce=(0,Xs.useCallback)(e=>!!d?.has(e.selector)||!!e.comment&&!!p?.has(e.comment.id),[p,d]),fe=(0,Xs.useCallback)((e,t)=>!ce(e)&&(!!e.comment&&!!f?.has(e.comment.id)||"in_flight"===t?.status),[ce,f]),pe=(0,Xs.useCallback)(e=>{let t=eu(e.hasPendingChanges,cu(e),h?.get(e.selector));return function({isInFlight:e,isQueued:t=!1,threadStatus:n}){return e?"working":t||"in_flight"===n?"queued":"waiting_input"===n?"question":"failed"===n?"failed":"resolved"===n?"replied":"draft"}({isInFlight:ce(e),isQueued:fe(e,t),threadStatus:t?.status})},[ce,fe,h]),he=V.filter(e=>e.hasPendingChanges||!!cu(e)).map(e=>Vs({selector:e.selector,label:e.label,tokens:[...e.stickers.map(e=>e.token),..."draft"===pe(e)?[]:[`status:${pe(e)}`]]})).join("|");(0,Xs.useLayoutEffect)(()=>{let e=new Set,t=new Map,n=new Set,r=new Set;for(let i of V){let o=cu(i);if(!i.hasPendingChanges&&!o)continue;e.add(i.selector);let a=pe(i),l=Vs({selector:i.selector,label:i.label,tokens:[...i.stickers.map(e=>e.token),..."draft"===a?[]:[`status:${a}`]]});if(J.current.get(i.selector)===l)continue;J.current.set(i.selector,l);let s=te.current.get(i.selector);te.current.set(i.selector,a),"working"===a&&"working"!==s&&r.add(i.selector);let u=ee.current.get(i.selector),c=new Map,d=null;for(let e of i.stickers){let t=nu(e);c.set(t,e.token),u?.get(t)!==e.token&&(d=t)}if(ee.current.set(i.selector,c),!i.hasPendingChanges&&(void 0===s||"draft"===s&&"queued"!==a&&"working"!==a)){let e=re.current.get(i.selector);e&&clearTimeout(e),re.current.delete(i.selector),n.add(i.selector);continue}t.set(i.selector,d);let f=re.current.get(i.selector);f&&clearTimeout(f),re.current.set(i.selector,setTimeout(()=>{Z(e=>{if(!e.has(i.selector))return e;let t=new Map(e);return t.delete(i.selector),t}),re.current.delete(i.selector)},1e3))}for(let[t,n]of re.current)e.has(t)||(clearTimeout(n),re.current.delete(t),J.current.delete(t),ee.current.delete(t),te.current.delete(t));r.size>0&&U(e=>e&&r.has(e.selector)?null:e),Z(r=>{let i=new Map([...r].filter(([t])=>e.has(t)));for(let[e,n]of t)i.set(e,n);for(let e of n)i.delete(e);return i.size===r.size&&[...i].every(([e,t])=>r.get(e)===t)?r:i})},[V,he,pe]),(0,Xs.useEffect)(()=>()=>{for(let e of re.current.values())clearTimeout(e);re.current.clear();for(let e of ie.current.values())clearTimeout(e);ie.current.clear(),J.current.clear(),ee.current.clear(),te.current.clear()},[]);let me=d&&d.size>0||p&&p.size>0,{charIndex:ge,word:xe}=function(e){let t=(0,Ks.useContext)(Ct),[n,r]=(0,Ks.useState)(0),[i,o]=(0,Ks.useState)(()=>Math.floor(Math.random()*Qs.length));return(0,Ks.useEffect)(()=>{if(!e||!t)return;let n=setInterval(()=>r(e=>(e+1)%3),250),i=setInterval(()=>o(e=>(e+1)%Qs.length),3e3);return()=>{clearInterval(n),clearInterval(i)}},[e,t]),{charIndex:n,word:Qs[i]}}(!!me);(0,Xs.useEffect)(()=>{if(!W)return;let t=null,r=!1,i=e??document,o=Ci([...s.flatMap(e=>[e.selector,e.element.selector]),...a.flatMap(e=>[e.selector,e.element.selector]),...l.flatMap(e=>[e.selector,e.element.selector]),...Array.from(E??[]).flatMap(([e,t])=>t.selectors??[e])]),u=(e,t)=>n?null:Nt(e,t,i),d=()=>{let t=[],r=new Map,o=t=>(r.has(t)||r.set(t,n?null:e?(e=>{try{let t=i.querySelectorAll(e);return 1===t.length?t[0]:null}catch{return null}})(t):Wt(t)),r.get(t)),d=new Map;for(let e of s)d.set(e.selector,{selector:e.selector,element:e.element,styleChangeCount:0,textChangeCount:0,hasPendingChanges:!1!==e.pending,stickers:[],comment:e});for(let e of a){let t=d.get(e.selector),n=[...t?.stickers??[]];if(ru(e.captured,h?.get(e.selector)))for(let t of ou(e.changes)){let e=nu(t);n.some(t=>nu(t)===e)||n.push(t)}d.set(e.selector,{selector:e.selector,element:e.element,styleChangeCount:(t?.styleChangeCount??0)+e.changes.length,textChangeCount:t?.textChangeCount??0,modifiedText:t?.modifiedText,hasPendingChanges:(t?.hasPendingChanges??!1)||!e.captured&&!e.awaitingReview,threadState:tu(e)??t?.threadState,stickers:n,comment:t?.comment})}for(let e of l){let t=d.get(e.selector);d.set(e.selector,{selector:e.selector,element:t?.element??e.element,styleChangeCount:t?.styleChangeCount??0,textChangeCount:1,modifiedText:e.modified,hasPendingChanges:(t?.hasPendingChanges??!1)||!e.captured,stickers:t?.stickers??[],threadState:t?.threadState,comment:t?.comment})}let f=new Set,p=new Set,m=new Set;for(let e of d.values()){let t=e.comment?.threadState;t?.threadId&&p.add(t.threadId),t?.targetBindingId&&m.add(t.targetBindingId)}for(let[e,t]of d){let n=u(e,t.element);n&&(t.resolvedElement=n),n&&f.add(n)}for(let[e,t]of E??[]){if(n||p.has(t.threadId)||t.targetBindingId&&m.has(t.targetBindingId))continue;let r=zt(t.selectors??[e],t.targetFingerprint,i);if("matched"!==r.status)continue;let{element:o}=r,a=t.selectors?.[0]??e;!o||f.has(o)||(f.add(o),d.set(a,{selector:a,element:{...Jt(o),selector:a},styleChangeCount:0,textChangeCount:0,hasPendingChanges:!1,stickers:[],resolvedElement:o,threadState:t}))}Array.from(d.values()).forEach(e=>{let r=e.transientElement??e.resolvedElement??u(e.selector,e.element),i=n?.get(e.selector);if(!r&&!i)return;let a=function(e){return e.textChangeCount>0&&0===e.styleChangeCount?{label:`Text changed: ${e.modifiedText?.replace(/\\s+/g," ").trim()||"Empty text"}`}:{label:e.elementLabel}}({elementLabel:du(e),styleChangeCount:e.styleChangeCount,textChangeCount:e.textChangeCount,modifiedText:e.modifiedText}),l=e.comment?.threadState??e.threadState??(E?Qr(e.selector,E,o):void 0);t.push({threadState:l,selector:e.selector,label:e.threadState?.title?.trim()||a.label,annotationNumber:e.transientElement?void 0:e.comment?.annotationNumber??l?.annotationNumber??c.get(e.selector),domElement:r,projectedRect:i,hasPendingChanges:e.hasPendingChanges,hasElementChanges:e.styleChangeCount>0||e.textChangeCount>0,stickers:e.stickers,transient:!!e.transientElement,comment:e.comment})}),q(e=>function(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.selector===r.selector&&e.label===r.label&&e.annotationNumber===r.annotationNumber&&e.domElement===r.domElement&&e.projectedRect===r.projectedRect&&e.threadState===r.threadState&&e.comment===r.comment&&e.hasPendingChanges===r.hasPendingChanges&&e.hasElementChanges===r.hasElementChanges&&e.transient===r.transient&&e.stickers.length===r.stickers.length&&e.stickers.every((e,t)=>{let n=r.stickers[t];return e.token===n.token&&e.selection===n.selection&&nu(e)===nu(n)})})}(e,t)?e:t)},f=()=>{r||null!==t||(t=requestAnimationFrame(()=>{t=null,d()}))};if(d(),n)return;window.addEventListener("resize",f,!0);let p=new MutationObserver(e=>{e.some(o.changesIdentity)&&f()});p.observe(i.body,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:o.attributes}),window.addEventListener("load",f),i.fonts?.ready?.then(f);let m=[...a,...l].some(e=>e.selector.startsWith("@frame("))||s.some(e=>e.selector.startsWith("@frame("))?mn(f):void 0;return()=>{r=!0,m?.(),window.removeEventListener("resize",f,!0),window.removeEventListener("load",f),p.disconnect(),t&&cancelAnimationFrame(t)}},[W,c,s,a,l,E,h,e,n]);let ve=A&&!X&&T&&R?.selector&&!V.some(e=>e.domElement===T)?{selector:R.selector,label:du({element:R}),annotationNumber:void 0,domElement:T,hasPendingChanges:!1,hasElementChanges:!1,stickers:[],transient:!0}:null,be=ve?[...V,ve]:V;if(0===be.length)return null;let we=W?y?.current?.getBoundingClientRect():void 0,Se=!!we&&we.top<window.innerHeight/2,ke=we?{avoidTop:Se?we.bottom+8:void 0,avoidBottom:Se?void 0:we.top-8,avoidLeft:we.left-8,avoidRight:we.right+8}:{},Ce=e=>o?.threadId&&o.threadId===(e.comment?.threadId??cu(e)?.threadId)?o:void 0,Ee=e=>B?.preview&&B.preview.threadId===(e.comment?.threadId??cu(e)?.threadId),Me=e=>{let t=O?.element===e.domElement,n=eu(e.hasPendingChanges,cu(e),h?.get(e.selector)),r=ce(e),i=fe(e,n),o=m?.has(h?.get(e.selector)??n?.jobId??""),a=e.comment?.awaitingReview?"Awaiting review":o?"Approval needed":r?xe||"Thinking":i?"Queued":"in_flight"===n?.status?"Thinking":"waiting_input"===n?.status?"Question":"failed"===n?.status?"Failed":n?.label??"Replied";return(t?O.width+(O.trailingWidth??0)+fu(e):fu(e)+po(pu(e.comment,r||!!n))+Gi(e.comment?.interactionEpisodeStepCount??0))+(Ce(e)?.width??(n||e.comment?.awaitingReview?28+7.2*a.length:0))+(Ee(e)?30:0)},Te=be.find(e=>e.transient)??be.find(e=>e.domElement&&Gr(e.domElement,T)||X===e.selector||Y?.selector===e.selector)??(r?be.find(e=>e.selector===i):void 0),Re=(()=>{if(!Te)return null;let e=Te.projectedRect,t=e?{...e,right:e.left+e.width,bottom:e.top+e.height}:Te.domElement?rt(Te.domElement):void 0;if(!t)return null;let n=Me(Te);return pr(mr(t,22,2,window.innerHeight,n,window.innerWidth),n,22)})(),Ae=Gs(u),Ie=Zs;return(0,uu.jsxs)(uu.Fragment,{children:[(0,uu.jsx)("style",{dangerouslySetInnerHTML:{__html:\'\\n[data-devtools="badge"]::selection,\\n[data-devtools="badge"] *::selection {\\n background: #000000;\\n color: #ffffff;\\n}\\n.popmelt-staged-sticker-group {\\n display: flex;\\n align-items: center;\\n isolation: isolate;\\n}\\n.popmelt-staged-sticker-layer {\\n position: relative;\\n align-self: stretch;\\n display: flex;\\n align-items: center;\\n margin-right: -2px;\\n}\\n.popmelt-staged-sticker-pointer {\\n position: absolute;\\n left: -4px;\\n top: 50%;\\n width: 14.142px;\\n height: 14.142px;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n transform: translateY(-50%);\\n pointer-events: none;\\n}\\n.popmelt-staged-sticker-pointer::before {\\n content: \\\'\\\';\\n width: 10px;\\n height: 10px;\\n background: var(--popmelt-staged-accent);\\n transform: rotate(-45deg);\\n}\\n.popmelt-collapsible-badge-detail {\\n max-width: 400px;\\n opacity: 1;\\n overflow: hidden;\\n transition: max-width 180ms cubic-bezier(0.2, 0, 0, 1), opacity 100ms linear;\\n}\\n.popmelt-collapsible-badge-detail-inner {\\n display: block;\\n min-width: 0;\\n overflow: hidden;\\n padding-left: 4px;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n[data-popmelt-collapsed="true"] .popmelt-collapsible-badge-detail {\\n max-width: 0;\\n opacity: 0;\\n}\\n@supports (interpolate-size: allow-keywords) {\\n .popmelt-collapsible-badge-detail {\\n width: max-content;\\n interpolate-size: allow-keywords;\\n transition: width 180ms cubic-bezier(0.2, 0, 0, 1), opacity 100ms linear;\\n }\\n [data-popmelt-collapsed="true"] .popmelt-collapsible-badge-detail {\\n width: 0;\\n max-width: 400px;\\n }\\n}\\n[data-popmelt-snap-collapse="true"] .popmelt-collapsible-badge-detail {\\n transition: none;\\n}\\n@media (prefers-reduced-motion: reduce) {\\n .popmelt-collapsible-badge-detail {\\n transition: none;\\n }\\n}\\n\'}}),be.map(e=>{let n=Ce(e),o=O?.element===e.domElement,s=eu(e.hasPendingChanges,cu(e),h?.get(e.selector)),c=ce(e),d=fe(e,s),f=function(e,t,n,r){return t?r?.get(e)??n:n}(e.selector,c,u,g),p=function(e,t,n){return n?.color?n.color:!1===t?.pending&&(t.threadState||t.awaitingReview)?t.color:e}(f,e.comment,cu(e)),y=c||"in_flight"===s?.status,E=function(e,t){return t?"#888888":e}(p,y),R=m?.has(h?.get(e.selector)??s?.jobId??""),A=e.comment?.awaitingReview||"awaiting_review"===s?.status,W=A?"Awaiting review":R?"Approval needed":c?xe||"Thinking":d?"Queued":"in_flight"===s?.status?"Thinking":"waiting_input"===s?.status?"Question":"failed"===s?.status?"Failed":s?.label??"Replied",B=!(!e.domElement||!Gr(e.domElement,T)),V=X===e.selector,q=Q.has(e.selector),Z=Q.get(e.selector),J=!!s||!1===e.comment?.pending,ee=qs({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:c,hasThreadState:J,isHovered:r&&i===e.selector||B||V||Ws(Y,e.selector,0),hasTimedReveal:q,isRevealedSticker:!1}),te=e.stickers.length+1,re=qs({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:c,hasThreadState:J,isHovered:Ws(Y,e.selector,te),hasTimedReveal:q,isRevealedSticker:!1}),ie=qs({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:y,hasThreadState:J,isHovered:r&&i===e.selector||B||V||Ws(Y,e.selector,te),hasTimedReveal:q,isRevealedSticker:q}),pe=Me(e),he=(o?O.imageCount:pu(e.comment,c||!!s))??0,me=e.stickers.length>0||he>0,ve=function({hasCommentEntry:e,stagedChangeCount:t}){return e&&0===t?2:6}({hasCommentEntry:o||!!e.comment,stagedChangeCount:e.stickers.length+ +(he>0)}),be=c||!!s||!!e.comment?.awaitingReview,we=!be&&e.selector===v,Se=!o&&ee.annotationCollapsed&&ie.stickerCollapsed&&re.sendCompact&&!q&&Y?.selector!==e.selector,je=Se?function({annotationNumber:e,stickerCount:t,interactionEpisodeStepCount:n,hasStatus:r,hasSend:i,controlGap:o}){let a=16+7.2*Math.max(1,void 0===e?0:String(e).length),l=28*t-2*Math.max(0,t-1),s=n>0?32+7.2*String(n).length:0,u=[t>0&&t>0?l+(s>0?s-2:0)+(i?26:0):0,0===t?s:0,0===t&&i?28:0,r?28:0].filter(e=>e>0);return a+u.reduce((e,t)=>e+t,0)+u.length*o}({annotationNumber:e.annotationNumber,stickerCount:e.stickers.length,interactionEpisodeStepCount:e.comment?.interactionEpisodeStepCount??0,hasStatus:be,hasSend:we,controlGap:ve})+po(he)+(Ee(e)?28+ve:0):pe;return(0,uu.jsx)(kr,{element:e.domElement,projectedRect:e.projectedRect,onRemove:e.comment&&L?()=>L(e.comment.id):P&&a.some(t=>t.selector===e.selector)?()=>P(a.filter(t=>t.selector===e.selector)):void 0,onActivate:e.comment?.threadId||s?.threadId?()=>M?.(e.comment?.threadId??s?.threadId):void 0,hideOutline:!(r&&Te===e),color:p,fillOpacity:.1,outlineZIndex:10002,subjectRegistry:t,hideTooltip:!0,railGap:2,railWidth:pe,refreshKey:H,renderRail:t=>{let i=oe.current.get(e.selector)?.getBoundingClientRect(),f=i?.width?i:pr(t,pe,22),h=!!(Se&&Te!==e&&Re&&hr(f,Re));if(Te!==e&&Re&&hr(pr(t,je,22),Re))return null;let m="right"===t.horizontalAlignment?t.left-pe:t.left,g=function(e,t,n){return function(e,t,n){if(void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,o=n.avoidRight??r;return e+t>i&&e<o}(t,n,e)?e:{}}(ke,m,pe);if(e.transient){let n=e.domElement?Ir(e.domElement):null;return(0,uu.jsx)(mu,{"data-popmelt-rail-priority":"intent","data-popmelt-subject-label-action":n?"true":void 0,"data-popmelt-subject-adapter":n?.adapter,"data-popmelt-subject-key":n?.key,left:t.left,top:t.top,avoidTop:g.avoidTop,avoidBottom:g.avoidBottom,anchor:t.anchor,horizontalAlignment:t.horizontalAlignment,style:{zIndex:10001,pointerEvents:n?"auto":"none",cursor:n?"pointer":void 0},onPointerDown:e=>{n&&e.stopPropagation()},onClick:e=>{n&&(e.preventDefault(),e.stopPropagation(),D?.(n))},onContextMenu:e=>{n&&(e.preventDefault(),e.stopPropagation(),F?.(n))},onMouseEnter:()=>{n&&$?.(n)},onMouseLeave:()=>$?.(null),children:(0,uu.jsx)("div",{"data-devtools":"steer-element-identifier",ref:t=>{e.domElement&&bn(e.domElement,t)},"data-popmelt-subject-label-action":n?"true":void 0,style:{...Ae,borderRadius:e.domElement===document.body?ti("bottom-left"):ti(t.anchor)},children:(0,uu.jsx)("span",{style:Ie,children:e.label})})})}return(0,uu.jsx)(mu,{"data-popmelt-rail-priority":"history","data-popmelt-snap-collapse":h||void 0,visualRef:t=>{t?oe.current.set(e.selector,t):oe.current.delete(e.selector)},left:t.left,top:t.top,avoidTop:g.avoidTop,avoidBottom:g.avoidBottom,anchor:t.anchor,horizontalAlignment:t.horizontalAlignment,onClick:()=>{if(o)return;let t=function(e,t){if(e){if(e.threadId)return{type:"open-thread",threadId:e.threadId};if(!1!==e.pending)return{type:"edit-comment",annotationId:e.id};if(e.threadState?.threadId)return{type:"open-thread",threadId:e.threadState.threadId}}return t?{type:"open-thread",threadId:t}:{type:"none"}}(e.comment,e.comment?.threadId??s?.threadId);"edit-comment"===t.type?I?.(t.annotationId):"open-thread"===t.type&&M?.(t.threadId)},onContextMenu:t=>{if(t.preventDefault(),t.stopPropagation(),e.comment&&L)L(e.comment.id);else{if(P){let t=a.filter(t=>t.selector===e.selector);if(t.length)return void P(t)}e.comment&&!1!==e.comment.pending&&j?(ae(e.selector),U(t=>Bs(t,e.selector)),K(t=>t===e.selector?null:t),x?.(null),j(e.comment.id)):l.some(t=>t.selector===e.selector&&!t.captured)?z?.(e.selector):!e.hasPendingChanges&&!c&&"resolved"===s?.status&&N?.(s.threadId)}},onMouseEnter:()=>{ae(e.selector),K(e.selector),x?.(e.selector)},onMouseLeave:()=>{le(e.selector),x?.(null)},style:{zIndex:o?10002:1e4,cursor:o?"text":"pointer",pointerEvents:"auto"},children:(0,uu.jsxs)("div",{ref:t=>{e.domElement&&bn(e.domElement,t)},style:{display:"flex",alignItems:"center",gap:ve},children:[o?O.render(t.anchor):(0,uu.jsxs)("div",{"data-devtools":"badge","data-popmelt-collapsed":ee.annotationCollapsed,onMouseEnter:()=>ue(e.selector,"annotation",0),style:{...Ae,...n&&{maxWidth:`min(400px, calc(100vw - ${n.width+24}px))`},backgroundColor:Js({accentColor:u,threadAccentColor:p,comment:e.comment,isInFlight:c,hasThreadState:!!s,hasStickers:e.stickers.length>0}),gap:0,letterSpacing:e.comment?0:Ae.letterSpacing,borderRadius:e.domElement===document.body?ti("bottom-left"):ti(t.anchor)},children:[(0,uu.jsx)("span",{style:{fontWeight:600},children:e.annotationNumber}),(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",style:{...Ie,paddingLeft:e.comment?0:void 0},children:e.comment?(0,uu.jsxs)(uu.Fragment,{children:[".",(0,uu.jsx)("span",{style:{marginLeft:2},children:n?n.formatText(e.comment.text):e.comment.text})]}):(0,uu.jsxs)(uu.Fragment,{children:[". ",e.label]})})})]}),!me&&(0,uu.jsx)(Zi,{stepCount:o?0:e.comment?.interactionEpisodeStepCount??0,onClear:!1!==e.comment?.pending&&_?()=>_(e.comment.id):void 0,submitted:!1===e.comment?.pending}),me&&(0,uu.jsxs)("div",{className:"popmelt-staged-sticker-group",children:[e.stickers.map((t,n)=>{let i=nu(t),o=qs({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:c,hasThreadState:!!s,isHovered:Ws(Y,e.selector,n+1),hasTimedReveal:q,isRevealedSticker:q&&i===Z}),a=function(e,t){return{paddingLeft:0===e?8:10,paddingRight:8,zIndex:t-e+1}}(n,e.stickers.length+ +(he>0)),l=0===n?void 0:Yi;return(0,uu.jsxs)("div",{className:"popmelt-staged-sticker-layer",style:{zIndex:a.zIndex},children:[(0,uu.jsx)("span",{"aria-hidden":!0,className:"popmelt-staged-sticker-pointer",style:{"--popmelt-staged-accent":E,WebkitMaskImage:0===n?void 0:Ui,maskImage:0===n?void 0:Ui}}),(0,uu.jsxs)("button",{type:"button","data-devtools":"staged-sticker","data-popmelt-style-property":t.custom?.property,title:t.custom?`${t.custom.property}: ${t.custom.value}`:void 0,"data-popmelt-collapsed":o.stickerCollapsed,onMouseEnter:()=>ue(e.selector,i,n+1),"aria-label":t.custom?`Custom ${t.custom.property}: ${t.custom.value}`:`${r?"Staged":"Edit staged"} ${t.token} sticker`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:n=>{n.preventDefault(),n.stopPropagation(),t.selection&&k?.(e.selector,t.selection)},onContextMenu:n=>{n.preventDefault(),n.stopPropagation(),ae(e.selector),U(t=>Bs(t,e.selector)),x?.(null),t.selection&&C?.(e.selector,t.selection)},style:{...Ae,position:"relative",height:"100%",minHeight:22,appearance:"none",border:0,margin:0,paddingLeft:a.paddingLeft,paddingRight:a.paddingRight,gap:0,cursor:t.selection&&(k||C)?"pointer":"default",backgroundColor:E,WebkitMaskImage:l,maskImage:l},children:[(0,uu.jsx)(su,{chip:t}),(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:t.token})})]})]},i)}),(0,uu.jsx)(ho,{imageCount:he,color:E,layered:e.stickers.length>0}),!o&&(e.comment?.interactionEpisodeStepCount??0)>0&&(0,uu.jsx)("div",{className:"popmelt-staged-sticker-layer",style:{zIndex:1},children:(0,uu.jsx)(Zi,{stepCount:e.comment.interactionEpisodeStepCount,layered:!0,onClear:!1!==e.comment?.pending&&_?()=>_(e.comment.id):void 0,submitted:!1===e.comment?.pending})}),we&&(0,uu.jsx)(ro,{bundleCount:b,compact:re.sendCompact,layered:!0,onHoverChange:t=>{t&&ue(e.selector,"send",te),w?.(t)},onSend:S,style:{position:"relative",zIndex:(e.comment?.interactionEpisodeStepCount??0)>0?0:1}})]}),n?.controls,(0,uu.jsx)(Oi,{threadId:e.comment?.threadId??s?.threadId,color:p}),!n&&be&&(0,uu.jsx)("button",{type:"button","data-devtools":"annotation-badge","data-popmelt-collapsed":ie.stickerCollapsed,onMouseEnter:()=>ue(e.selector,"thread-status",te),"aria-label":s?`${W}. Open thread`:W,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>{t.preventDefault(),t.stopPropagation();let n=e.comment?.threadId??s?.threadId;n&&M?.(n)},style:{...Ae,appearance:"none",border:0,margin:0,cursor:s&&M?"pointer":"default",backgroundColor:p,gap:0},children:A?(0,uu.jsxs)(uu.Fragment,{children:[(0,uu.jsx)(G,{size:12,strokeWidth:2.25}),(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:W})})]}):c?(0,uu.jsxs)(uu.Fragment,{children:[R?(0,uu.jsx)(se,{size:12,"aria-label":"Approval needed"}):(0,uu.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle"},children:1===ge?(0,uu.jsxs)(uu.Fragment,{children:[(0,uu.jsx)("circle",{cx:"7",cy:"7",r:"2"}),(0,uu.jsx)("circle",{cx:"17",cy:"7",r:"2"}),(0,uu.jsx)("circle",{cx:"7",cy:"17",r:"2"}),(0,uu.jsx)("circle",{cx:"17",cy:"17",r:"2"})]}):(0,uu.jsxs)(uu.Fragment,{children:[(0,uu.jsx)("circle",{cx:"12",cy:"6",r:"2"}),(0,uu.jsx)("circle",{cx:"6",cy:"12",r:"2"}),(0,uu.jsx)("circle",{cx:"18",cy:"12",r:"2"}),(0,uu.jsx)("circle",{cx:"12",cy:"18",r:"2"})]})}),(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",style:{opacity:.8},children:W})})]}):(0,uu.jsxs)(uu.Fragment,{children:[d?(0,uu.jsx)(G,{"data-devtools":"queued-status-icon",size:12,strokeWidth:2.25,style:{verticalAlign:"middle",opacity:.6}}):"waiting_input"===s?.status?(0,uu.jsx)(ne,{"data-devtools":"question-status-icon",size:12,strokeWidth:2.25,style:{transform:"translateY(-0.5px)",flexShrink:0}}):"failed"===s?.status?(0,uu.jsx)(ye,{size:12,strokeWidth:2.25}):(0,uu.jsx)(de,{size:12,strokeWidth:2.25}),(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,uu.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:W})})]})}),we&&!me&&(0,uu.jsx)(ro,{bundleCount:b,compact:re.sendCompact,onHoverChange:t=>{t&&ue(e.selector,"send",te),w?.(t)},onSend:S})]})})}},`${e.transient?"intent":"history"}:${e.selector}`)})]})}var yu=u(d()),xu=u(v());function vu({styleModifications:e,textModifications:t=[],accentColor:n}){let[r,i]=(0,yu.useState)([]);if((0,yu.useEffect)(()=>{let n=null,r=()=>{let n=[],r=[...e,...t],o=new Set;for(let e of r){if(o.has(e.selector))continue;let t=Wt(e.selector);if(!t)continue;o.add(e.selector);let r=rt(t);if(0===r.width&&0===r.height)continue;let i=An(t);n.push({selector:e.selector,top:r.top,left:r.left,width:r.width,height:r.height,borderRadius:`${i["top-left"]}px ${i["top-right"]}px ${i["bottom-right"]}px ${i["bottom-left"]}px`})}i(n)},o=()=>{n&&cancelAnimationFrame(n),n=requestAnimationFrame(r)};r(),window.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",o,{passive:!0});let a=new MutationObserver(o);return a.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class"]}),()=>{window.removeEventListener("scroll",o),window.removeEventListener("resize",o),a.disconnect(),n&&cancelAnimationFrame(n)}},[e,t]),0===r.length)return null;let o=function(e){let t=e.match(/^oklch\\(([^)]+)\\)$/i);return t?`oklch(${t[1]} / 0.2)`:`color-mix(in srgb, ${e} ${Math.round(20)}%, transparent)`}(n);return(0,xu.jsx)(xu.Fragment,{children:r.map(e=>{let t={position:"fixed",top:e.top,left:e.left,width:e.width,height:e.height,pointerEvents:"none",zIndex:9995,border:`1px solid ${o}`,borderRadius:e.borderRadius,boxSizing:"border-box"};return(0,xu.jsx)("div",{"data-devtools":"mod-border",style:t},e.selector)})})}var bu=u(d()),wu=u(v()),Su=["topLeft","topRight","bottomRight","bottomLeft"],ku=[["topLeft","topRight"],["topRight","bottomRight"],["bottomRight","bottomLeft"],["bottomLeft","topLeft"]],Cu="#000000";function Eu(e){let t=e.match(/^rgba?\\(\\s*([\\d.]+)[,\\s]+([\\d.]+)[,\\s]+([\\d.]+)(?:\\s*[,/]\\s*([\\d.]+%?))?\\s*\\)$/i);if(!t)return null;let n=t[4],r=n?n.endsWith("%")?Number.parseFloat(n)/100:Number.parseFloat(n):1,i={red:Number.parseFloat(t[1]),green:Number.parseFloat(t[2]),blue:Number.parseFloat(t[3]),alpha:r};return Object.values(i).every(Number.isFinite)?i:null}function Mu(e){let t=e.parentElement;for(;t;){let e=Eu(getComputedStyle(t).backgroundColor);if(e&&e.alpha>=.95)return(.299*e.red+.587*e.green+.114*e.blue)/255>=.55?Cu:"#ffffff";t=t.parentElement}return Cu}function Tu(e){return Su.map(t=>`${e[t].x},${e[t].y}`).join(" ")}function Ru({element:e,activeFacet:t,accentColor:n,showHandles:r=!0,outlineStyle:i="solid",showRotateHandle:o=!0,scrimOpacity:a=.05,cursorViewport:l,draggingKind:s,draggingCorner:u,ghostQuad:c,refreshKey:d,onHandlePointerDown:f}){let[p,h]=(0,bu.useState)(null),[m,g]=(0,bu.useState)(null),[y,x]=(0,bu.useState)(null),[v,b]=(0,bu.useState)(null),[w,S]=(0,bu.useState)(!1),[k,C]=(0,bu.useState)(Cu),E=(0,bu.useRef)("top"),M=(0,bu.useRef)(null),T=`transform-occlusion-${(0,bu.useId)().replace(/:/g,"")}`;if((0,bu.useEffect)(()=>{let t=()=>{if(!at(e.ownerDocument))return void h(null);let t=wn(e)?ll(e):Xa(e);M.current=t;let n=Ya(t,e.ownerDocument);g(n),b(fl(ul(e,t),t,n)),S(pl(e)),C(Mu(e));let r=Ya(wn(e)?al(e,t):Xa(e),e.ownerDocument);x(r),h(r)};t(),window.addEventListener(yr,t),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0});let n=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>t());n?.observe(e);let r="",i=Je(e.ownerDocument)?mn(()=>{let n=rt(e),i=JSON.stringify([at(e.ownerDocument),n.x,n.y,n.width,n.height]);i!==r&&(r=i,t())}):void 0;return()=>{i?.(),window.removeEventListener(yr,t),window.removeEventListener("scroll",t),window.removeEventListener("resize",t),n?.disconnect()}},[e]),(0,bu.useLayoutEffect)(()=>{let t=s&&M.current?M.current:wn(e)?ll(e):Xa(e);M.current=t;let n=Ya(t,e.ownerDocument);g(n),b(fl(ul(e,t),t,n)),S(pl(e)),C(Mu(e));let r=Ya(wn(e)?al(e,t):Xa(e),e.ownerDocument);x(r),h(r)},[s,e,d]),!p)return null;let R=l?Cl(p,l,20,{currentSide:E.current,hysteresis:8,viewport:{width:window.innerWidth,height:window.innerHeight}}):wl(p,20);"rotate"!==s&&(E.current=R.side);let A="rotate"===s?{...bl(p,void 0,E.current),side:E.current}:R,I={position:"fixed",inset:0,pointerEvents:"none",zIndex:f?9999:9996},j=s?.95:.72,L=!!(r&&m&&function(e,t,n=1){return["topLeft","topRight","bottomRight","bottomLeft"].some(r=>Math.hypot(e[r].x-t[r].x,e[r].y-t[r].y)>n)}(m,p)),P=m&&y&&v?fl(v,m,y):v,z=P?yl(p,P):p,N=c&&m&&v?fl(v,m,c):v,_=c&&N?yl(c,N):c,D=vl(p),F=c?vl(c):null,$=c?bl(c,void 0,A.side):null,O=$&&F?function(e,t,n,r){let i=Math.atan2(n.y-t.y,n.x-t.x),o=Math.atan2(r.y-e.y,r.x-e.x),a=Math.atan2(Math.sin(o-i),Math.cos(o-i));if(Math.abs(a)<.001)return null;let l=Math.hypot(r.x-e.x,r.y-e.y),s=e.x+Math.cos(i)*l,u=e.y+Math.sin(i)*l,c=Math.cos(i),d=Math.sin(i);return{path:`M ${s} ${u} A ${l} ${l} 0 0 ${a>0?1:0} ${r.x} ${r.y}`,startTick:{start:{x:s-4*c,y:u-4*d},end:{x:s+4*c,y:u+4*d}}}}(D,F,$.handle,A.handle):null,H=w&&y&&P?xl(y,P):null,W=H?`url(#${T})`:void 0;return(0,wu.jsx)("div",{"data-devtools":r?"transform-handles":"element-boundary","data-popmelt-steer-overlay":!0,"data-transform-facet":t,style:I,children:(0,wu.jsxs)("svg",{width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[H&&(0,wu.jsx)("defs",{children:(0,wu.jsxs)("mask",{id:T,maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100%",height:"100%",children:[(0,wu.jsx)("rect",{width:"100%",height:"100%",fill:"#ffffff"}),(0,wu.jsx)("path",{"data-transform-occlusion-mask":"",d:H,fill:"#000000"})]})}),L&&m&&v&&(0,wu.jsx)("path",{"data-transform-layout-plate":"",d:xl(m,v),fill:k,fillOpacity:"0.07",stroke:"none",mask:W}),(0,wu.jsx)("path",{"data-transform-effective-outline":"","data-transform-effective-scrim":"",d:P?xl(p,P):`M ${Tu(p)} Z`,fill:n,fillOpacity:a,stroke:n,strokeWidth:1,strokeOpacity:j,strokeDasharray:"dashed"===i?Ge:void 0}),"translate"===s&&F&&(0,wu.jsxs)("g",{"data-transform-origin-trace":"translate",children:[(0,wu.jsx)("line",{x1:F.x,y1:F.y,x2:D.x,y2:D.y,stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,wu.jsx)("circle",{"data-transform-origin-point":"",cx:F.x,cy:F.y,r:"3",fill:"#808080",stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]}),"scale"===s&&u&&_&&(0,wu.jsxs)("g",{"data-transform-origin-trace":"scale",children:[(0,wu.jsx)("line",{x1:_[u].x,y1:_[u].y,x2:z[u].x,y2:z[u].y,stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,wu.jsx)("circle",{"data-transform-origin-point":"",cx:_[u].x,cy:_[u].y,r:"3",fill:"#808080",stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]}),"rotate"===s&&O&&(0,wu.jsxs)("g",{"data-transform-origin-trace":"rotate",children:[(0,wu.jsx)("path",{"data-transform-rotation-arc":"",d:O.path,fill:"none",stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,wu.jsx)("line",{"data-transform-rotation-arc-start":"",x1:O.startTick.start.x,y1:O.startTick.start.y,x2:O.startTick.end.x,y2:O.startTick.end.y,stroke:"#808080",strokeWidth:"1",strokeLinecap:"round",opacity:"0.85"})]}),f&&ku.map(([e,t])=>(0,wu.jsx)("line",{"data-transform-handle":"translate",x1:p[e].x,y1:p[e].y,x2:p[t].x,y2:p[t].y,stroke:"transparent",strokeWidth:12,style:{pointerEvents:"stroke",cursor:"move"},onPointerDown:e=>f("translate",null,e)},`${e}-${t}`)),r&&(0,wu.jsxs)("g",{"data-transform-affordances":"",children:[Su.map(e=>(0,wu.jsxs)("g",{children:[(0,wu.jsx)("rect",{x:z[e].x-3,y:z[e].y-3,width:6,height:6,fill:n,stroke:"#ffffff",strokeWidth:2}),f&&(0,wu.jsx)("circle",{"data-transform-handle":"scale","data-transform-corner":e,cx:z[e].x,cy:z[e].y,r:10,fill:"transparent",style:{pointerEvents:"all",cursor:"topLeft"===e||"bottomRight"===e?"nwse-resize":"nesw-resize"},onPointerDown:t=>f("scale",e,t)})]},e)),o&&(0,wu.jsxs)(wu.Fragment,{children:[(0,wu.jsx)("line",{x1:A.edge.x,y1:A.edge.y,x2:A.handle.x,y2:A.handle.y,stroke:n,strokeWidth:"1",opacity:j}),(0,wu.jsx)("circle",{cx:A.handle.x,cy:A.handle.y,r:3,fill:n,stroke:"#ffffff",strokeWidth:2}),f&&(0,wu.jsx)("line",{"data-transform-handle":"rotate",x1:A.edge.x,y1:A.edge.y,x2:A.handle.x,y2:A.handle.y,stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{pointerEvents:"stroke",cursor:"grab"},onPointerDown:e=>{E.current=A.side,f("rotate",null,e,A.side)}})]})]})]})})}var Au=u(v()),Iu=["top","right","bottom","left"];function ju(e){return"all"===e?Iu:"x"===e?["left","right"]:"y"===e?["top","bottom"]:"top"===e||"right"===e||"bottom"===e||"left"===e?[e]:[]}function Lu(e){return"top-left"===e||"top-right"===e||"bottom-right"===e||"bottom-left"===e?e:null}function Pu(e,t,n,r){return e&&"value"===n&&"transform"===t&&("translate"===r||"scale"===r||"rotate"===r)}function zu({active:e,accentColor:t,family:n,stage:r,subproperty:i,hoveredElement:o,previewElement:a,transformPreviewElement:l,previewRevision:s,cursorViewport:u,drag:c,onGapPointerDown:d,onRadiusPointerDown:f,onSpacingPointerDown:p,onTransformPointerDown:h}){let m=e&&"value"===r,g=o instanceof HTMLElement&&a===o,y=o instanceof HTMLElement&&(En(o,"row")||En(o,"column")),x="transform"===c?.family?c.element:o,v=Pu(e,n,r,i)?i:null,b=null!==v&&wn(x)&&(a===x||l===x||"transform"===c?.family);return(0,Au.jsxs)(Au.Fragment,{children:[m&&("padding"===n||"margin"===n)&&g&&(0,Au.jsx)(Zl,{element:o,padding:"margin"===n?Tn(o):Mn(o),mode:n,accentColor:t,hoveredSide:c?.family===n?c.side??null:null,draggingSide:c?.family===n?c.side??null:null,activeSides:ju(i),refreshKey:s,cursorViewport:c?.cursor,onHandlePointerDown:(e,t)=>p(n,e,t)}),m&&("stack"===n||"grid"===n)&&"gap"===i&&g&&(0,Au.jsx)(Bl,{element:o,gap:kn(o),accentColor:t,hoveredAxis:c?.gapAxis??null,draggingAxis:c?.gapAxis??null,refreshKey:s,cursorViewport:c?.cursor,isAutoGap:y,onHandlePointerDown:y?void 0:d}),m&&"radius"===n&&g&&(0,Au.jsx)(Dl,{element:o,radius:An(o),accentColor:t,hoveredCorner:Lu(i),draggingCorner:c?.corner??null,cursorViewport:c?.cursor,onHandlePointerDown:f}),b&&(0,Au.jsx)(Ru,{element:x,activeFacet:v,accentColor:t,draggingKind:"transform"===c?.family?c.transformKind??null:null,draggingCorner:"transform"===c?.family?c.transformCorner??null:null,ghostQuad:"transform"===c?.family?c.ghostQuad??null:null,cursorViewport:c?.cursor??u,refreshKey:s,onHandlePointerDown:h})]})}var Nu=u(d()),_u=u(v());function Du(){let e=Math.random()*Math.PI*2,t=5+8*Math.random();return{x:Math.cos(e)*t,y:Math.sin(e)*t}}function Fu({onSave:e}){let[t,n]=(0,Nu.useState)(!1),[r]=_e(),i=Ae[r];return(0,_u.jsxs)("button",{type:"button","data-popmelt-subject-label-save":!0,"data-hovered":t?"true":"false","aria-label":"Save object label",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},style:{appearance:"none",boxSizing:"border-box",height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,margin:0,padding:"0 8px",border:`1px solid ${i.border}`,borderRadius:8,backgroundColor:i.surface,color:i.primary,fontFamily:ni,fontSize:12,fontWeight:600,letterSpacing:"0.24px",lineHeight:1,whiteSpace:"nowrap",cursor:"pointer",pointerEvents:"auto",userSelect:"none",touchAction:"manipulation"},children:[(0,_u.jsxs)("span",{className:"popmelt-subject-save-default",children:[(0,_u.jsx)(J,{size:12,strokeWidth:2,"aria-hidden":!0}),(0,_u.jsx)("span",{style:{color:i.secondary},children:"to"}),(0,_u.jsx)(K,{size:12,strokeWidth:2,"aria-hidden":!0})]}),(0,_u.jsxs)("span",{className:"popmelt-subject-save-hovered",children:[(0,_u.jsx)("span",{children:"Save"}),(0,_u.jsx)(K,{size:12,strokeWidth:2,"aria-hidden":!0})]})]})}function $u({accentColor:e,created:t,registry:n,target:r,onCommit:i,onClose:o,onCancelCreated:a}){let l=n.resolve(r),s=(0,Nu.useRef)(l?.subject.label??"object"),[u,c]=(0,Nu.useState)(s.current),d=l?.subject.trackingAnchors?.map(e=>({...e}))??[],f=(0,Nu.useRef)(d),[p,h]=(0,Nu.useState)(d),[m,g]=(0,Nu.useState)(0),[y,x]=(0,Nu.useState)(0),v=(0,Nu.useRef)(null),b=(0,Nu.useRef)(null),w=(0,Nu.useRef)(null),S=(0,Nu.useRef)(!1),k=n.resolve(r),C=(0,Nu.useMemo)(()=>{let e=typeof document>"u"?null:document.createElement("canvas").getContext("2d");e&&(e.font=`12px ${ni}`);let t=t=>(e?.measureText(t).width??7.2*t.length)+.24*Math.max(0,t.length-1);return{label:Math.max(8,t(u||" ")),full:t(`<${u||" "}>`)+16}},[u]);if((0,Nu.useLayoutEffect)(()=>{w.current?.focus(),w.current?.select()},[]),(0,Nu.useLayoutEffect)(()=>{if(m)for(let e of b.current?.querySelectorAll("[data-popmelt-tracking-anchor]")??[]){let t=Du();e.animate?.([{transform:"translate(-50%, -50%)"},{transform:`translate(calc(-50% + ${t.x}px), calc(-50% + ${t.y}px))`},{transform:`translate(calc(-50% - ${.55*t.x}px), calc(-50% - ${.55*t.y}px))`},{transform:"translate(-50%, -50%)"}],{duration:220,easing:"ease-out"})}},[m]),(0,Nu.useEffect)(()=>n.subscribeFrame(()=>x(e=>e+1)),[n]),(0,Nu.useEffect)(()=>{let e=e=>{let t=v.current;t&&(n.updateBounds(r,function(e,t){let n=t.x-e.start.x,r=t.y-e.start.y;if("translate"===e.kind)return{...e.bounds,left:e.bounds.left+n,top:e.bounds.top+r};let i=e.bounds.left+e.bounds.width,o=e.bounds.top+e.bounds.height;switch(e.corner){case"topLeft":{let t=Math.min(i-8,e.bounds.left+n),a=Math.min(o-8,e.bounds.top+r);return{left:t,top:a,width:i-t,height:o-a}}case"topRight":{let t=Math.max(e.bounds.left+8,i+n),a=Math.min(o-8,e.bounds.top+r);return{left:e.bounds.left,top:a,width:t-e.bounds.left,height:o-a}}case"bottomLeft":{let t=Math.min(i-8,e.bounds.left+n),a=Math.max(e.bounds.top+8,o+r);return{left:t,top:e.bounds.top,width:i-t,height:a-e.bounds.top}}default:{let t=Math.max(e.bounds.left+8,i+n),a=Math.max(e.bounds.top+8,o+r);return{left:e.bounds.left,top:e.bounds.top,width:t-e.bounds.left,height:a-e.bounds.top}}}}(t,{x:e.clientX,y:e.clientY})),x(e=>e+1))},t=()=>{v.current=null,x(e=>e+1)};return window.addEventListener("pointermove",e,!0),window.addEventListener("pointerup",t,!0),window.addEventListener("pointercancel",t,!0),()=>{window.removeEventListener("pointermove",e,!0),window.removeEventListener("pointerup",t,!0),window.removeEventListener("pointercancel",t,!0)}},[n,r]),!k)return null;let E=()=>{if(S.current)return;let e=u.trim();if(!e)return void(t&&a());let l=f.current,s=1===l.length?[]:l,c=k.adapter.updateSubjectTrackingAnchors?n.updateTrackingAnchors(r,s):null,d=n.rename(r,e)??c;d&&i(d),o()},{bounds:M}=k.subject,T=!!k.adapter.updateSubjectTrackingAnchors,R=Math.min(400,C.full),A=R+2+66,I=mr({left:M.left,right:M.left+M.width,top:M.top,bottom:M.top+M.height,height:M.height},22,2,window.innerHeight,A,window.innerWidth),j="right"===I.horizontalAlignment?I.left-A:I.left;return(0,_u.jsxs)(_u.Fragment,{children:[(0,_u.jsx)(Ru,{element:k.element,activeFacet:"translate",accentColor:e,showRotateHandle:!1,refreshKey:y,draggingKind:v.current?.kind??null,draggingCorner:v.current?.corner??null,onHandlePointerDown:(e,t,n)=>{"rotate"!==e&&(n.preventDefault(),n.stopPropagation(),v.current={kind:e,corner:t,start:{x:n.clientX,y:n.clientY},bounds:{...k.subject.bounds}},x(e=>e+1))}}),T&&(0,_u.jsx)("div",{ref:b,"data-popmelt-tracking-anchor-surface":!0,"aria-label":"Add tracking anchor",onPointerDown:e=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();let t=f.current;if(t.length>=3)return void g(e=>e+1);let n=[...t,{x:Math.max(0,Math.min(1,(e.clientX-M.left)/M.width)),y:Math.max(0,Math.min(1,(e.clientY-M.top)/M.height))}];f.current=n,h(n)},style:{position:"fixed",left:M.left,top:M.top,width:M.width,height:M.height,pointerEvents:"auto",cursor:"crosshair",zIndex:9998},children:p.map((t,n)=>(0,_u.jsx)("span",{"data-popmelt-tracking-anchor":!0,"data-popmelt-tracking-anchor-reject":m?"true":void 0,style:{position:"absolute",left:100*t.x+"%",top:100*t.y+"%",width:10,height:10,boxSizing:"border-box",border:"2px solid #ffffff",borderRadius:"50%",background:e,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.35)",pointerEvents:"none",transform:"translate(-50%, -50%)"}},n))}),(0,_u.jsx)("style",{children:\'\\n[data-popmelt-subject-label-editor]::selection {\\n background: #000000;\\n color: #ffffff;\\n}\\n.popmelt-subject-save-default {\\n display: inline-flex;\\n align-items: center;\\n gap: 4px;\\n}\\n.popmelt-subject-save-hovered {\\n display: none;\\n align-items: center;\\n gap: 4px;\\n}\\n[data-popmelt-subject-label-save][data-hovered="true"] .popmelt-subject-save-default {\\n display: none;\\n}\\n[data-popmelt-subject-label-save][data-hovered="true"] .popmelt-subject-save-hovered {\\n display: inline-flex;\\n}\\n@media (max-width: 767px) {\\n .popmelt-subject-save-default { display: none; }\\n .popmelt-subject-save-hovered { display: inline-flex; }\\n}\\n\'}),(0,_u.jsxs)("div",{style:{position:"fixed",left:j,top:I.top,display:"flex",alignItems:"center",gap:2,pointerEvents:"auto",zIndex:1e4},children:[(0,_u.jsxs)("div",{"data-popmelt-subject-label-editor":!0,style:{...Gs(e),width:R,gap:0,borderRadius:ti(I.anchor)},children:[(0,_u.jsx)("span",{"aria-hidden":!0,children:"<"}),(0,_u.jsx)("input",{ref:w,"data-popmelt-subject-label-input":!0,value:u,"aria-label":"Object label",spellCheck:!1,onChange:e=>c(e.target.value),onBlur:E,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),S.current=!0,t?a():o()):"Enter"===e.key&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),E())},style:{appearance:"none",boxSizing:"content-box",width:Math.min(C.label,368),minWidth:0,height:12*1.2+"px",margin:0,padding:0,border:0,outline:0,background:"transparent",color:"inherit",font:"inherit",letterSpacing:"inherit",lineHeight:"inherit"}}),(0,_u.jsx)("span",{"aria-hidden":!0,children:">"})]}),(0,_u.jsx)(Fu,{onSave:E})]})]})}var Ou=u(d());function Hu(e,t,n,r,i){let o={...e},a=(o.right-o.left||1)/(o.bottom-o.top||1),l={...e};switch(t){case"topLeft":l.left=n.x,l.top=n.y;break;case"topRight":l.right=n.x,l.top=n.y;break;case"bottomLeft":l.left=n.x,l.bottom=n.y;break;case"bottomRight":l.right=n.x,l.bottom=n.y}if(r)switch(t){case"topLeft":l.right=o.right+(o.left-l.left),l.bottom=o.bottom+(o.top-l.top);break;case"topRight":l.left=o.left-(l.right-o.right),l.bottom=o.bottom+(o.top-l.top);break;case"bottomLeft":l.right=o.right+(o.left-l.left),l.top=o.top-(l.bottom-o.bottom);break;case"bottomRight":l.left=o.left-(l.right-o.right),l.top=o.top-(l.bottom-o.bottom)}if(i){let e=l.right-l.left,n=l.bottom-l.top;if(Math.abs(e/n)>a){let r=Math.abs(n)*a*Math.sign(e);"topLeft"===t||"bottomLeft"===t?l.left=l.right-r:l.right=l.left+r}else{let r=Math.abs(e)/a*Math.sign(n);"topLeft"===t||"topRight"===t?l.top=l.bottom-r:l.bottom=l.top+r}}return l}var Wu=u(d());function Bu(e){return Math.random().toString(36).substring(2,e+2)}function Vu(e){return nt({left:0,top:0,width:1,height:1},e.ownerDocument).height*function(e){let t=Qa(ol(e),il(e));return(e.currentCSSZoom||1)*Math.hypot(t.c,t.d)}(e)}function qu(e,t,n,r={}){let{textNode:i,targetElement:o,textNodePath:a,segments:l,originalText:s,rect:u,boundaryRect:c,boundaryRects:d,flowRect:f,firstLineIndent:p,styles:h,fontSize:m,wrapsText:g}=e,y=o.getAttribute("data-pm");y||(y=r.createPmId?.()??Bu(6),o.setAttribute("data-pm",y));let x=Ot(`[data-pm="${y}"]`,o.ownerDocument),v=Vu(o),b=e=>e?.endsWith("px")?parseFloat(e)*v+"px":e;return{id:r.createEditId?.()??Bu(7),point:{x:u.left+n.x,y:u.top+n.y},text:s,fontSize:m*v,isNew:!0,clickPoint:t,domEdit:{selector:x,durableSelector:$t(o),element:{...Jt(o),selector:x},textNodePath:a,originalText:s,textNode:i,targetElement:o,segments:l,rect:u,boundaryRect:c,boundaryRects:d,flowRect:f,firstLineIndent:p,fontFamily:h.fontFamily,fontWeight:h.fontWeight,fontStyle:h.fontStyle,lineHeight:"normal"===h.lineHeight?Math.round(m*v*1.2*10)/10+"px":b(h.lineHeight),letterSpacing:b(h.letterSpacing),color:h.color,textTransform:h.textTransform,textAlign:h.textAlign,wordSpacing:b(h.wordSpacing),textDecoration:h.textDecoration,textShadow:h.textShadow,whiteSpace:h.whiteSpace,wordBreak:h.wordBreak,overflowWrap:h.overflowWrap,wrapsText:g,singleTextNode:e.singleTextNode}}}function Yu(e){if(!e||e===document.body||e===document.documentElement||Dn(e))return!1;let t=e.tagName.toLowerCase();return!["script","style","link","meta","head","html","body","input","textarea","select","option","button"].includes(t)&&!!e.parentElement}function Uu(e){let t=e.getAttribute("data-pm");return t||(t=Math.random().toString(36).substring(2,8),e.setAttribute("data-pm",t)),`[data-pm="${t}"]`}function Xu(e){return e.parentElement?Array.from(e.parentElement.children).indexOf(e):-1}function Ku(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(e=>e.removeAttribute("data-pm"))}function Qu(e,t,n,r,i=nn){let o=n.parentElement;if(!o)return null;let a=i(e,t);for(;a&&a!==document.body;)if(a===n||n.contains(a))a=a.parentElement;else{if(a.parentElement===o&&Yu(a))break;a=a.parentElement}if(!a||a===document.body||a.parentElement!==o||a===r)return null;let l=a.getBoundingClientRect(),s=l.height>=l.width?t<l.top+l.height/2?"before":"after":e<l.left+l.width/2?"before":"after",u=Xu(a);return{parent:o,reference:a,placement:s,index:"before"===s?u:u+1}}function Gu(e,t,n){let r=Array.from(e.children).filter(e=>e!==t),i=Math.max(0,Math.min(n,r.length));e.insertBefore(t,r[i]??null)}function Zu(e){let t=[""];for(let{parts:n}of e)t[t.length-1]=t[t.length-1]+n[0],t.push(...n.slice(1));return t}function Ju(e,t,n,r){let i=e.targetElement;if("P"!==i.tagName)return;let o=Xn(i);if(!o&&void 0===r)return;let a=o?.root??i,{group:l,layout:s}=Qn(a),u=l.rows.indexOf(i),c=Ot(Uu(a),a.ownerDocument),d=n.find(e=>e.paragraphs&&!e.captured&&e.selector===c),f=d??(a===i?e:function(){let e=$n(a);return e&&qu(e,{x:e.rect.left,y:e.rect.top},{x:window.scrollX,y:window.scrollY})}()?.domEdit);if(!f)return;let p=d?.paragraphs?.before??structuredClone(s),h=e.segments.map(e=>({...e,originalText:e.textNode.data})),m=new Map(qn(h,h.map(e=>e.originalText).join(""),t).map(({segment:e,modifiedText:t})=>[e.textNode,t])),g=new Map;l.runs.forEach((e,t)=>e.forEach((e,n)=>g.set(e,[t,n])));let y,x=r;for(let[n,{textNode:r,originalText:i}]of e.segments.entries()){let o=g.get(r);if(!o)return;let[a,l]=o,u=t===e.originalText?i:m.get(r)??r.data,c=s[a].parts;c[l]=u,void 0!==x&&(x<u.length||n===e.segments.length-1?(y={parts:c,index:l,offset:Math.min(x,u.length)},x=void 0):x-=u.length)}if(y){let{parts:e,index:t,offset:n}=y,r=e[t];e.splice(t,1,r.slice(0,n),r.slice(n))}let v=Jn(a,s);if(!v)return;let b={selector:f.selector,durableSelector:f.durableSelector,element:f.element,textNodePath:[],original:Zu(p).join("\\n\\n"),modified:Zu(s).join("\\n\\n"),paragraphs:{before:p,after:s}},w=y&&v.rows[u+1],S=w&&$n(w);if(!S)return{change:b};let k=qu(S,{x:S.rect.left,y:S.rect.top},{x:window.scrollX,y:window.scrollY});return k.initialCaret=0,{change:b,next:k}}function ec(e,t,n=!0){let r=new Map(qn(e.segments,e.originalText,t).map(({segment:e,modifiedText:t})=>[e,t]));return{type:"MODIFY_TEXT_CONTENTS",...n?{}:{saveUndo:!1},payload:e.segments.map(t=>({selector:e.selector,durableSelector:e.durableSelector,element:e.element,textNodePath:t.textNodePath,original:t.originalText,modified:r.get(t)??t.originalText}))}}function tc({anchorLeftX:e,anchorRightX:t,editorWidth:n,trailingWidth:r,viewportWidth:i}){let o=Math.max(0,i-0),a=Math.max(0,Math.min(t,o)),l=r>0?r+2:0,s=n+l,u=Math.max(0,e-8),c=a-s,d=Math.max(0,0-u)+Math.max(0,u+s-o),f=Math.max(0,0-c)<d?"right":"left",p=Math.max(60,"right"===f?a-0-l:o-u-l),h=Math.min(n,p);return{horizontalAlignment:f,editorLeft:"right"===f?a-l-h:u,maxEditorWidth:p}}function nc({text:e,fontSize:t,effectiveMaxWidth:n,annotationPrefixWidth:r,isModifiedRail:i,fitToContent:o=i,context:a}){let l=a.measureText("Type here...").width,s=o&&e.length>0?a.measureText(" ").width:l,u=Fr(e).split("\\n"),c=Math.max(s,...u.map(e=>a.measureText(e||" ").width)),d=Math.max(s,n-r-(i?16:0));if(c>d){let e=function(e,t,n){return t.flatMap(t=>function(e,t,n){let r=Fr(t);if(!r||e.measureText(r).width<=n)return[r];let i=r.split(/\\s+/),o=[],a="";for(let t of i){let r=a?`${a} ${t}`:t;a&&e.measureText(r).width>n?(o.push(a),a=t):a=r}return a&&o.push(a),o.length>0?o:[r]}(e,t,n))}(a,u,d);return{width:Math.min(d,Math.max(s,...e.map(e=>a.measureText(e).width))),height:Math.max(1,e.length)*t*Dr,isWrapped:!0}}return{width:c,height:Math.max(1,u.length)*t*Dr,isWrapped:!1}}function rc(e,t,n,r=6){return e.moved?e:{...e,moved:Math.hypot(t-e.startX,n-e.startY)>r}}function ic(e){return!(!e||e.moved)}var oc=new Set(["text","transform","opacity"]),ac=new Set(["padding","margin","border","radius","color"]);function lc(e,t,n){return!!wn(e)&&(e instanceof HTMLElement||!("text"===t&&!function(e){return"text-align"!==e}(n))&&(oc.has(t)||function(e){return e instanceof SVGSVGElement&&!(e.parentElement instanceof SVGElement)}(e)&&ac.has(t)))}var sc={"active-edit":100,"direct-manipulation":90,"in-flight":80,"bundle-preview":70,"nested-preview":65,"annotation-hover":60,"badge-hover":60,"thread-focus":50,selected:45,"pending-change":40,"inspector-hover":30};var uc=u(d());function cc(e,t){return e.frames&&0!==t?{...e,frames:e.frames.map(e=>({...e,imageIndex:e.imageIndex+t}))}:e}function dc(e){let t=e?.replace(/\\s+/g," ").trim();if(t)return t.slice(0,180)}function fc(e){try{return $t(e)}catch{return}}function pc(e){if(e instanceof HTMLVideoElement){let t=Number.isFinite(e.duration)?e.duration:void 0;return{kind:"video",currentTime:e.currentTime,...void 0===t?{}:{duration:t},paused:e.paused}}}function hc(e){if(!e||Dn(e))return;let t=e instanceof HTMLElement?e:null,n=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e:null,r=e.getBoundingClientRect(),i=e.getAttribute("role")??void 0,o=dc(e.getAttribute("class")),a=dc(e.getAttribute("aria-label")),l=dc(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?void 0:e.textContent),s=pc(e);return{selector:fc(e),tagName:e.tagName.toLowerCase(),...o?{className:o}:{},...i?{role:i}:{},...a?{ariaLabel:a}:{},...l?{text:l}:{},...!n||n instanceof HTMLInputElement&&"password"===n.type?{}:{value:n.value.slice(0,180)},...e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)?{checked:e.checked}:{},...t&&"disabled"in t&&"boolean"==typeof t.disabled?{disabled:t.disabled}:{},...e.hasAttribute("aria-expanded")?{expanded:"true"===e.getAttribute("aria-expanded")}:{},...e.hasAttribute("aria-pressed")?{pressed:"true"===e.getAttribute("aria-pressed")}:{},...e.hasAttribute("aria-selected")?{selected:"true"===e.getAttribute("aria-selected")}:{},rect:{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)},...s?{media:s}:{}}}function mc(e){let{subject:t,target:n,adapter:r}=e,{left:i,top:o,width:a,height:l}=t.bounds,s=pc(t.sourceElement??null);return{tagName:r.id,rect:{x:Math.round(i),y:Math.round(o),width:Math.round(a),height:Math.round(l)},subject:{adapter:n.adapter,key:n.key,label:t.label,...t.context?{context:t.context}:{},...t.data?{data:{...t.data}}:{}},...s?{media:s}:{}}}function gc(e,t,n){if("scroll"===e)return"Scrolled the page";let r=n??hc(t),i=r?.subject?.label??r?.ariaLabel??r?.text??r?.tagName??"element";return"click"===e?`Clicked ${i}`:"drag"===e?`Dragged ${i}`:"input"===e?`Entered text in ${i}`:"change"===e?`Changed ${i}`:"submit"===e?`Submitted ${i}`:"play"===e?`Played ${i}`:"pause"===e?`Paused ${i}`:"seek"===e?`Sought in ${i}`:`Pressed a key on ${i}`}function yc(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function xc(e){return e instanceof Element?e:e.parentElement}function vc(e){return!(!e||e.domEdit||!e.linkedSelector&&!e.target)}function bc(e){return!(!e||"text"!==e.type||"pending"!==(e.status??"pending")||!e.linkedSelector&&!e.target)}var wc={kind:"root"};function Sc(e,t){let n=Ta(e),r=Ra(e,t),i="border"===e&&"all"===t?`${n} Width`:r===n?n:`${n} ${r}`,o=("text"===e||"border"===e)&&"color"===t;return{id:`subproperty:${e}:${t}`,label:i,searchPath:i,destination:{family:e,subproperty:t,stage:o?"family":"value"},nextScope:o?{kind:"colors",family:e}:{kind:"values",family:e,subproperty:t}}}function kc(e){return"root"===e.kind?Yo.flatMap(e=>{let t=function(e){let t=Ta(e),n=function(e){return"color"===e?"slate":Sa(e)[0]}(e),r="color"===e;return{id:`family:${e}`,label:t,searchPath:t,destination:{family:e,subproperty:n,stage:r?"family":"value"},nextScope:r?{kind:"colors",family:e}:{kind:"values",family:e,subproperty:n}}}(e);return"color"===e?[t]:[t,...Sa(e).filter(e=>!ha(e)).map(t=>Sc(e,t))]}):"family"===e.kind?Sa(e.family).filter(e=>!ha(e)).map(t=>Sc(e.family,t)):"colors"===e.kind?_o.map(t=>function(e,t){let n=t[0].toUpperCase()+t.slice(1);return{id:`color:${e}:${t}`,label:n,searchPath:n,destination:{family:e,subproperty:t,stage:"variant"},nextScope:{kind:"values",family:e,subproperty:t}}}(e.family,t)):ba(e.family,e.subproperty).map(t=>function(e,t,n){return{id:`value:${e}:${t}:${n}`,label:String(n),searchPath:String(n),destination:{family:e,subproperty:t,step:n,stage:"value"}}}(e.family,e.subproperty,t))}function Cc(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ")}function Ec(e){return Cc(e).replace(/\\s+/g,"")}function Mc(e,t){let n=Cc(e);if(!n)return 0;let r=Cc(t.searchPath),i=Cc(t.label),o=Ec(e),a=Ec(t.searchPath),l=function(e){return Cc(e).split(/\\s+/).filter(Boolean).map(e=>e[0]).join("")}(t.searchPath);if(i===n)return 1e3;if(r===n)return 980;if(i.startsWith(n))return 940;if(r.startsWith(n))return 920;if(r.split(" ").some(e=>e.startsWith(n)))return 880;if(l.startsWith(o))return 850;if(a.startsWith(o))return 820;let s=0;for(let e of o){if(s=a.indexOf(e,s),-1===s)return-1;s+=1}let u=t.id.startsWith("family:")?20:0;return 500-Math.max(0,a.length-o.length)+u}function Tc(e,t){if(!t.trim())return null;let n=e=>kc(e).map((e,n)=>({candidate:e,index:n,score:Mc(t,e)})).filter(e=>e.score>=0).sort((e,t)=>t.score-e.score||e.index-t.index)[0]?.candidate??null,r=n(e);if(r||"root"===e.kind)return r;if("values"===e.kind||"colors"===e.kind){let t=n({kind:"family",family:e.family});if(t)return t}return n(wc)}function Rc(e,t){return t.trim().length<2?null:Tc(e,t)}function Ac(e){return e.id.startsWith("family:")?{kind:"icon",label:e.label,family:e.destination.family,subproperty:"all"}:e.id.startsWith("subproperty:")?{kind:"icon",label:e.label,family:e.destination.family,subproperty:e.destination.subproperty??"all"}:{kind:"label",label:e.label}}function Ic(e,t){return e?t?t.label.toLowerCase().startsWith(e.toLowerCase())?{typed:t.label.slice(0,e.length),completion:t.label.slice(e.length),fallback:""}:{typed:e,completion:"",fallback:t.label}:{typed:e,completion:"",fallback:""}:{typed:"",completion:"",fallback:"Steer a property"}}function jc(e,t){wn(e)&&(t.forEach(t=>e.style.removeProperty(t)),e.style.removeProperty("transition"))}function Lc(e,t,n){return{property:e,original:`${t}px`,modified:`${n}px`}}var Pc=["space-between","space-around","stretch","normal"],zc={"top-left":"border-top-left-radius","top-right":"border-top-right-radius","bottom-right":"border-bottom-right-radius","bottom-left":"border-bottom-left-radius"};function Nc(e,t){return e.selector&&e.elementInfo&&0!==t.length?{selector:e.selector,durableSelector:e.durableSelector??void 0,element:e.elementInfo,changes:t}:null}function _c(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Dc(e){return"string"==typeof e&&Yo.includes(e)}function Fc(e,t){return"string"==typeof t&&ka(e,t)===t}function $c(e){if(!_c(e)||!Dc(e.family))return null;let t=e.family;if(!Fc(t,e.subproperty))return null;let n=e.subproperty;return function(e){return"family"===e||"variant"===e||"value"===e}(e.stage)&&function(e,t,n){return ba(e,t).includes(n)}(t,n,e.step)?{family:t,subproperty:n,stage:e.stage,step:e.step}:null}function Oc(e){if(!_c(e)||"string"!=typeof e.kind)return null;if("root"===e.kind)return{kind:"root"};if("family"===e.kind&&Dc(e.family))return{kind:"family",family:e.family};if("colors"===e.kind&&("border"===e.family||"color"===e.family||"text"===e.family))return{kind:"colors",family:e.family};if("values"===e.kind&&Dc(e.family)){let t=e.family;return Fc(t,e.subproperty)?{kind:"values",family:t,subproperty:e.subproperty}:null}return null}function Hc(e,t){return"sticker"!==e||!t}var Wc=new Set(["display","border-top-style","border-right-style","border-bottom-style","border-left-style"]);function Bc(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function Vc(e,t){t.value?e.style.setProperty(t.property,t.value,t.priority):e.style.removeProperty(t.property)}function qc(e,t){return{property:t,value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}}function Yc(e){if(e){!function(e){er.delete(e)}(e.element);for(let t of e.declarations)Vc(e.element,t)}}var Uc="[data-popmelt-subject-label-action]";function Xc(e,t,n){let r=function(e){let t=Number(e.dataset.popmeltSubjectSurfaceLeft),n=Number(e.dataset.popmeltSubjectSurfaceTop),r=Number(e.dataset.popmeltSubjectSurfaceWidth),i=Number(e.dataset.popmeltSubjectSurfaceHeight);return[t,n,r,i].every(Number.isFinite)?{left:t,top:n,right:t+Math.max(0,r),bottom:n+Math.max(0,i)}:null}(e);return!r||t>=r.left&&t<=r.right&&n>=r.top&&n<=r.bottom}function Kc(e,t){let{popmeltSubjectAdapter:n,popmeltSubjectKey:r}=t.dataset;return n&&r?Array.from(e.querySelectorAll("[data-popmelt-subject-adapter][data-popmelt-subject-key]")).find(e=>!e.hasAttribute("data-popmelt-subject-label-action")&&e.dataset.popmeltSubjectAdapter===n&&e.dataset.popmeltSubjectKey===r)??null:null}function Qc(e,t,n){for(let r of e.querySelectorAll(Uc)){let i=r.getBoundingClientRect();if(t>=i.left&&t<=i.right&&n>=i.top&&n<=i.bottom){let i=Kc(e,r);if(i&&!Xc(i,t,n))continue;return r}}return null}var Gc=u(d()),Zc=u(d()),Jc={isAnnotating:!1,activeTool:"inspector",activeColor:"oklch(0.628 0.258 29)",strokeWidth:3,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,styleModifications:[],textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]},ed=(0,Zc.createContext)(null),td=()=>()=>{},nd=()=>null;function rd(){return Math.random().toString(36).substring(2,9)}function id(e){return"text"===e.type&&"lasso"===e.region?.kind&&(e={...e,fontSize:12,linkedAnchor:e.linkedAnchor??"bottom-left"}),e.status?e:e.captured?{...e,status:"in_flight"}:{...e,status:"pending"}}function od(e){return{annotations:e.annotations,styleModifications:e.styleModifications,textModifications:e.textModifications,domModifications:e.domModifications,spacingTokenChanges:e.spacingTokenChanges,spacingTokenMods:e.spacingTokenMods}}function ad(e,t){return{...e,undoStack:[...e.undoStack,{...od(e),...t&&{textEditSessionId:t}}],redoStack:[]}}function ld(e,t,n,r){return e.selector===t&&(!e.pathname||e.pathname===r)&&e.textNodePath.length===n.length&&e.textNodePath.every((e,t)=>e===n[t])}function sd(e,t,n=!0){let{selector:r,durableSelector:i,element:o,textNodePath:a,original:l,modified:s}=t,u=typeof window<"u"?window.location.pathname:"/",c=e.textModifications.findIndex(e=>ld(e,r,a,u)),d=t.paragraphs?JSON.stringify(t.paragraphs.before)===JSON.stringify(t.paragraphs.after):l===s;if(d&&c<0)return e;if(c>=0){let r=e.textModifications[c],a=r.captured&&n?ad(e):e,f=r.captured?l:r.original;return(t.paragraphs?d:s===f)?{...a,textModifications:a.textModifications.filter((e,t)=>t!==c)}:{...a,textModifications:a.textModifications.map((e,n)=>n===c?{...e,durableSelector:i,element:o,...t.paragraphs&&{paragraphs:t.paragraphs},original:f,modified:s,createdAt:e.createdAt??Date.now(),captured:!1,pathname:u}:e)}}let f=n?ad(e):e;return{...f,textModifications:[...f.textModifications,{selector:r,durableSelector:i,element:o,textNodePath:a,...t.paragraphs&&{paragraphs:t.paragraphs},original:l,modified:s,createdAt:Date.now(),pathname:u}]}}function ud(e,t){switch(t.type){case"SET_ANNOTATING":return function(e,t){return{...e,isAnnotating:t}}(e,t.payload);case"SET_TOOL":return function(e,t){return{...e,activeTool:t}}(e,t.payload);case"SET_COLOR":return function(e,t){return{...e,activeColor:t}}(e,t.payload);case"SET_STROKE_WIDTH":return function(e,t){return{...e,strokeWidth:t}}(e,t.payload);case"ADD_TEXT":return function(e,t){let n={id:t.id??rd(),type:"text",points:[t.point],text:t.text,fontSize:t.fontSize||12,color:e.activeColor,strokeWidth:e.strokeWidth,timestamp:Date.now(),status:"pending",pathname:typeof window<"u"?window.location.pathname:"/",groupId:t.groupId,linkedSelector:t.linkedSelector,target:t.target,linkedAnchor:t.linkedAnchor,elements:t.elements,...t.region?{region:t.region}:{},...t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?.length?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}};return{...t.groupId?e:ad(e),annotations:[...e.annotations,n]}}(e,t.payload);case"UPDATE_TEXT":return function(e,t){return{...ad(e),annotations:e.annotations.map(e=>e.id===t.id?{...e,text:t.text,...null!=t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}}:e)}}(e,t.payload);case"CLEAR_INTERACTION_EPISODE":return function(e,t){return{...ad(e),annotations:e.annotations.map(e=>{if(e.id!==t.id)return e;let n=e.interactionEpisode?.frames?.length??0,{interactionEpisode:r,...i}=e;if(0===n)return i;let o=Math.max(0,(e.imageCount??0)-n);if(0===o){let{imageCount:e,...t}=i;return t}return{...i,imageCount:o}})}}(e,t.payload);case"DELETE_ANNOTATION":return function(e,t){let n=ad(e),r=e.annotations.find(e=>e.id===t.id)?.groupId,i=new Set(e.annotations.filter(e=>e.id===t.id||r&&e.groupId===r).map(e=>e.id));return{...n,annotations:e.annotations.filter(e=>e.id!==t.id&&!(r&&e.groupId===r)),selectedAnnotationIds:e.selectedAnnotationIds.filter(e=>!i.has(e)),lastSelectedId:e.lastSelectedId&&i.has(e.lastSelectedId)?null:e.lastSelectedId}}(e,t.payload);case"MOVE_ANNOTATION":return function(e,t){let n=t.saveUndo?ad(e):e,r=e.annotations.find(e=>e.id===t.id)?.groupId;return{...n,annotations:e.annotations.map(e=>{if(!(e.id===t.id||r&&e.groupId===r))return e;let n=t.delta.x,i=t.delta.y;return{...e,points:e.points.map(e=>({x:e.x+n,y:e.y+i}))}})}}(e,t.payload);case"RESIZE_ANNOTATION":return function(e,t){let n=t.saveUndo?ad(e):e,r=e.annotations.find(e=>e.id===t.id);if(!r||"text"===r.type||r.points.length<2)return e;let i=0,o=0;if("rectangle"===r.type&&r.groupId){let e=t.points,n=Math.min(e[0].x,e[1].x),a=Math.max(e[0].y,e[1].y),l=r.points[0],s=r.points[r.points.length-1],u=Math.min(l.x,s.x),c=Math.max(l.y,s.y);i=n-u,o=a-c}return{...n,annotations:e.annotations.map(e=>e.id===t.id?{...e,points:t.points}:r.groupId&&e.groupId===r.groupId&&"text"===e.type?{...e,points:e.points.map(e=>({x:e.x+i,y:e.y+o}))}:e)}}(e,t.payload);case"PASTE_ANNOTATIONS":return function(e,t){return{...ad(e),annotations:[...e.annotations,...t.annotations.map(id)]}}(e,t.payload);case"RESTORE_ANNOTATIONS":return function(e,t){let n=new Set,r=[];for(let e of t.annotations)n.has(e.id)||(n.add(e.id),r.push(id(e)));return{...e,annotations:r}}(e,t.payload);case"SYNC_ANNOTATIONS":return function(e,t){let n=new Map(e.annotations.map(e=>[e.id,e])),r=t.annotations.map(e=>{let t=id(e),r=n.get(t.id);return r&&t.linkedSelector&&r.linkedSelector===t.linkedSelector?{...t,points:r.points,linkedAnchor:r.linkedAnchor}:t});return{...e,annotations:r}}(e,t.payload);case"MERGE_ANNOTATIONS":return function(e,t){let n=new Set(e.annotations.map(e=>e.id)),r=t.annotations.filter(e=>!n.has(e.id)).map(id);return r.length>0?{...e,annotations:[...e.annotations,...r]}:e}(e,t.payload);case"UNDO":return function(e){if(0===e.undoStack.length)return e;let t=e.undoStack[e.undoStack.length-1];return{...e,annotations:t?.annotations||[],styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],undoStack:e.undoStack.slice(0,-1),redoStack:[...e.redoStack,od(e)]}}(e);case"REDO":return function(e){if(0===e.redoStack.length)return e;let t=e.redoStack[e.redoStack.length-1];return{...e,annotations:t?.annotations||[],styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],redoStack:e.redoStack.slice(0,-1),undoStack:[...e.undoStack,od(e)]}}(e);case"SELECT_ANNOTATION":return function(e,t){let{id:n,addToSelection:r}=t;if(null===n)return{...e,selectedAnnotationIds:[],lastSelectedId:null};if(r){if(e.selectedAnnotationIds.includes(n)){let t=e.selectedAnnotationIds.filter(e=>e!==n);return{...e,selectedAnnotationIds:t,lastSelectedId:t.length>0?t[t.length-1]:null}}return{...e,selectedAnnotationIds:[...e.selectedAnnotationIds,n],lastSelectedId:n}}return{...e,selectedAnnotationIds:[n],lastSelectedId:n}}(e,t.payload);case"UPDATE_ANNOTATION_COLOR":return function(e,t){let n=e.annotations.find(e=>e.id===t.id)?.groupId,r=new Set;for(let t of e.selectedAnnotationIds){let n=e.annotations.find(e=>e.id===t);n?.groupId&&r.add(n.groupId)}return{...e,annotations:e.annotations.map(i=>i.id===t.id||e.selectedAnnotationIds.includes(i.id)||i.groupId&&(i.groupId===n||r.has(i.groupId))?{...i,color:t.color}:i)}}(e,t.payload);case"MARK_CAPTURED":return function(e,t,n){let r=typeof window<"u"?window.location.pathname:"/",i=t?new Set(t):void 0,o=n??e.textModifications.filter(e=>!e.pathname||e.pathname===r),a=e=>e.filter(e=>!o.some(t=>e.pathname===t.pathname&&ld(e,t.selector,t.textNodePath,t.pathname??"")&&e.createdAt===t.createdAt&&e.original===t.original&&e.modified===t.modified)),l=e=>({...e,textModifications:a(e.textModifications)});return{...e,undoStack:e.undoStack.map(l),redoStack:e.redoStack.map(l),annotations:e.annotations.map(e=>i&&!i.has(e.id)?e:{...e,captured:!0,status:"pending"!==e.status&&"sending"!==e.status&&e.status?e.status:"in_flight"}),styleModifications:e.styleModifications.map(e=>e.pathname&&e.pathname!==r?e:{...e,captured:!0}),textModifications:a(e.textModifications),domModifications:e.domModifications.map(e=>e.pathname&&e.pathname!==r?e:{...e,captured:!0}),spacingTokenChanges:e.spacingTokenChanges.map(e=>({...e,captured:!0})),spacingTokenMods:e.spacingTokenMods.map(e=>({...e,captured:!0}))}}(e,t.payload?.annotationIds,t.payload?.textModifications);case"CLEAR":return function(e){return{...e,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]}}(e);case"DISCARD_DRAFT":return function(e){return e.annotations.some(e=>"pending"===(e.status??"pending"))||e.styleModifications.some(e=>!e.captured)||e.textModifications.some(e=>!e.captured)||e.domModifications.some(e=>!e.captured)||e.spacingTokenChanges.some(e=>!e.captured)||e.spacingTokenMods.some(e=>!e.captured)?{...ad(e),annotations:e.annotations.filter(e=>"pending"!==(e.status??"pending")),styleModifications:e.styleModifications.filter(e=>e.captured),textModifications:e.textModifications.filter(e=>e.captured),domModifications:e.domModifications.filter(e=>e.captured),spacingTokenChanges:e.spacingTokenChanges.filter(e=>e.captured),spacingTokenMods:e.spacingTokenMods.filter(e=>e.captured),selectedAnnotationIds:[],lastSelectedId:null}:e}(e);case"MODIFY_STYLE":return function(e,t){let{selector:n,element:r,property:i,original:o,modified:a}=t,l=typeof window<"u"?window.location.pathname:"/",s=e.styleModifications.findIndex(e=>e.selector===n&&(!e.pathname||e.pathname===l));if(o===a&&s<0)return e;if(s>=0){let t=e.styleModifications[s];if(t.captured){let t=ad(e),n=t.styleModifications.map((e,t)=>t===s?{...e,changes:[{property:i,original:o,modified:a}],createdAt:e.createdAt??Date.now(),captured:!1,pathname:l}:e);return{...t,styleModifications:n}}let n,r=t.changes.findIndex(e=>e.property===i),u=e;if(r>=0){let e=t.changes[r];n=a===e.original?t.changes.filter((e,t)=>t!==r):t.changes.map((e,t)=>t===r?{...e,modified:a}:e)}else{if(o===a)return e;u=ad(e),n=[...t.changes,{property:i,original:o,modified:a}]}if(0===n.length)return{...u,styleModifications:u.styleModifications.filter((e,t)=>t!==s)};let c=u.styleModifications.map((e,t)=>t===s?{...e,changes:n,createdAt:e.createdAt??Date.now()}:e);return{...u,styleModifications:c}}{let t=ad(e),s={selector:n,element:r,changes:[{property:i,original:o,modified:a}],createdAt:Date.now(),pathname:l};return{...t,styleModifications:[...t.styleModifications,s]}}}(e,t.payload);case"MODIFY_STYLES_BATCH":return function(e,t){let{selector:n,durableSelector:r,element:i,changes:o}=t,a=typeof window<"u"?window.location.pathname:"/",l=o.filter(e=>e.original!==e.modified);if(0===l.length)return e;let s=ad(e),u=s.styleModifications.findIndex(e=>e.selector===n&&(!e.pathname||e.pathname===a));if(u>=0){let e=s.styleModifications[u],t=e.captured?[]:[...e.changes];for(let e of l){let n=t.findIndex(t=>t.property===e.property);n>=0?t=e.modified===t[n].original?t.filter((e,t)=>t!==n):t.map((t,r)=>r===n?{...t,modified:e.modified,token:e.token,sticker:e.sticker}:t):t.push(e)}return 0===t.length?{...s,styleModifications:s.styleModifications.filter((e,t)=>t!==u)}:{...s,styleModifications:s.styleModifications.map((e,n)=>n===u?{...e,changes:t,createdAt:e.createdAt??Date.now(),captured:!1,pathname:a}:e)}}return{...s,styleModifications:[...s.styleModifications,{selector:n,durableSelector:r,element:i,changes:l,createdAt:Date.now(),pathname:a}]}}(e,t.payload);case"CLEAR_STYLE":return function(e,t){let{selector:n,property:r}=t,i=typeof window<"u"?window.location.pathname:"/",o=ad(e),a=o.styleModifications.map(e=>e.selector!==n||e.pathname&&e.pathname!==i?e:{...e,changes:e.changes.filter(e=>e.property!==r)}).filter(e=>e.changes.length>0);return{...o,styleModifications:a}}(e,t.payload);case"CLEAR_STICKER":return function(e,t){let{selector:n,sticker:r}=t,i=typeof window<"u"?window.location.pathname:"/";if(!e.styleModifications.find(e=>e.selector===n&&(!e.pathname||e.pathname===i)&&!e.captured&&e.changes.some(e=>e.sticker?.family===r.family&&e.sticker.subproperty===r.subproperty)))return e;let o=ad(e),a=o.styleModifications.map(e=>e.selector!==n||e.pathname&&e.pathname!==i||e.captured?e:{...e,changes:e.changes.filter(e=>e.sticker?.family!==r.family||e.sticker.subproperty!==r.subproperty)}).filter(e=>e.changes.length>0);return{...o,styleModifications:a}}(e,t.payload);case"CLEAR_ALL_STYLES":return function(e){return 0===e.styleModifications.length?e:{...ad(e),styleModifications:[]}}(e);case"SETTLE_CAPTURED_STYLES":return function(e,t){let n=new Set(t.selectors);if(0===n.size)return e;let r=e.styleModifications.filter(e=>!(e.captured&&(n.has(e.selector)||e.durableSelector&&n.has(e.durableSelector))));return r.length===e.styleModifications.length?e:{...e,styleModifications:r}}(e,t.payload);case"RESTORE_STYLE_MODIFICATIONS":return function(e,t){let n=Date.now();return{...e,styleModifications:t.map((e,t)=>({...e,createdAt:e.createdAt??n+t}))}}(e,t.payload);case"MODIFY_TEXT_CONTENT":return sd(e,t.payload);case"MODIFY_TEXT_CONTENTS":return function(e,t,n=!0,r){return 0===t.length?e:t.reduce((e,t)=>sd(e,t,!1),n?ad(e,r):e)}(e,t.payload,t.saveUndo??!0,t.textEditSessionId);case"CANCEL_PARAGRAPH_EDIT":{let{id:n,selector:r,pathname:i,originalDrafts:o}=t.payload,a=e.undoStack.findIndex(e=>e.textEditSessionId===n);if(a<0)return e;let l=e=>[...e.filter(e=>e.selector!==r||e.pathname&&e.pathname!==i),...o],s=e.undoStack.slice(a).filter(e=>e.textEditSessionId!==n);return{...e,textModifications:l(e.textModifications),undoStack:[...e.undoStack.slice(0,a),...s.map(e=>({...e,textModifications:l(e.textModifications)}))]}}case"RESTORE_TEXT_MODIFICATIONS":return function(e,t){let n=Date.now();return{...e,textModifications:t.filter(e=>!e.captured).map((e,t)=>({...e,createdAt:e.createdAt??n+t}))}}(e,t.payload);case"MODIFY_DOM_STRUCTURE":return function(e,t){let n=ad(e),r=n.domModifications.findIndex(e=>e.id===t.id);return r>=0?{...n,domModifications:n.domModifications.map((e,n)=>n===r?{...t,captured:!1}:e)}:{...n,domModifications:[...n.domModifications,t]}}(e,t.payload);case"RESTORE_DOM_MODIFICATIONS":return function(e,t){return{...e,domModifications:t}}(e,t.payload);case"UPDATE_LINKED_POSITIONS":return function(e,t){let{updates:n}=t,r=new Map(n.map(e=>[e.id,e]));return{...e,annotations:e.annotations.map(e=>{let t=r.get(e.id);return t?{...e,points:[t.point,...e.points.slice(1)],...t.linkedAnchor?{linkedAnchor:t.linkedAnchor}:{}}:e})}}(e,t.payload);case"CLEANUP_ORPHANED":return function(e,t){let{linkedSelectors:n,styleSelectors:r}=t,i=new Set(n),o=new Set(r),a=typeof window<"u"?window.location.pathname:"/",l=new Set,s=new Set;for(let t of e.annotations)t.linkedSelector&&i.has(t.linkedSelector)&&(l.add(t.id),t.groupId&&s.add(t.groupId));for(let t of e.annotations)t.groupId&&s.has(t.groupId)&&l.add(t.id);let u=e.annotations.filter(e=>!l.has(e.id)),c=e.styleModifications.filter(e=>!o.has(e.selector)||e.pathname&&e.pathname!==a),d=e.domModifications.filter(e=>!o.has(e.selector)||e.pathname&&e.pathname!==a);if(u.length===e.annotations.length&&c.length===e.styleModifications.length&&d.length===e.domModifications.length)return e;let f=e.selectedAnnotationIds.filter(e=>!l.has(e));return{...e,annotations:u,styleModifications:c,domModifications:d,selectedAnnotationIds:f,lastSelectedId:f.length>0?f[f.length-1]:null}}(e,t.payload);case"SET_ANNOTATION_STATUS":return function(e,t){let n=new Set(t.ids);return{...e,annotations:e.annotations.map(e=>n.has(e.id)?{...e,status:t.status}:e)}}(e,t.payload);case"MARK_ANNOTATIONS_REPLIED":return function(e,t){let n=new Set(t.ids),r=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&r.add(t.groupId);return{...e,annotations:e.annotations.map(e=>{if(!(n.has(e.id)||e.groupId&&r.has(e.groupId)))return e;let i=!!t.jobId&&e.replyJobIds?.includes(t.jobId),o="waiting_input"===e.status;return{...e,status:o?"waiting_input":"resolved",replyCount:(e.replyCount??0)+(i?0:1),replyJobIds:t.jobId&&!i?[...e.replyJobIds??[],t.jobId]:e.replyJobIds,threadId:e.threadId||t.threadId,question:o?e.question:void 0}})}}(e,t.payload);case"MARK_ANNOTATIONS_FAILED":return function(e,t){let n=new Set(t.ids),r=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&r.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&r.has(e.groupId)?{...e,status:"failed",threadId:e.threadId||t.threadId,question:void 0}:e)}}(e,t.payload);case"SET_ANNOTATION_THREAD":return function(e,t){let n=new Set(t.ids),r=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&r.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&r.has(e.groupId)?{...e,threadId:t.threadId,targetBindingId:t.targetBindingId}:e)}}(e,t.payload);case"SET_ANNOTATION_QUESTION":return function(e,t){let n=new Set(t.ids),r=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&r.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&r.has(e.groupId)?{...e,status:"waiting_input",question:t.question,threadId:t.threadId}:e)}}(e,t.payload);case"APPLY_RESOLUTIONS":return function(e,t){let n=new Map(t.resolutions.map(e=>[e.annotationId,e])),r=new Map;for(let t of e.annotations){let e=n.get(t.id);e&&t.groupId&&r.set(t.groupId,e)}return{...e,annotations:e.annotations.map(e=>{let i=n.get(e.id)||(e.groupId?r.get(e.groupId):void 0);if(!i)return e;let o=!!t.jobId&&e.replyJobIds?.includes(t.jobId);return{...e,status:i.status,resolutionSummary:i.summary,scope:i.finalScope??i.inferredScope??null,replyCount:(e.replyCount??0)+(o?0:1),replyJobIds:t.jobId&&!o?[...e.replyJobIds??[],t.jobId]:e.replyJobIds,question:void 0,threadId:e.threadId||t.threadId}})}}(e,t.payload);case"ADD_SPACING_TOKEN_CHANGE":return function(e,t){let n=e.spacingTokenChanges.findIndex(e=>e.tokenPath===t.tokenPath);return n>=0?{...e,spacingTokenChanges:e.spacingTokenChanges.map((e,r)=>r===n?t:e)}:{...e,spacingTokenChanges:[...e.spacingTokenChanges,t]}}(e,t.payload);case"RESTORE_SPACING_TOKEN_CHANGES":return function(e,t){return{...e,spacingTokenChanges:t}}(e,t.payload);case"MODIFY_SPACING_TOKEN":return function(e,t){let n,r=ad(e),i=e.spacingTokenMods.findIndex(e=>e.tokenPath===t.tokenPath);if(i>=0){let r=e.spacingTokenMods[i],o={...t,originalValue:r.captured?r.currentValue:r.originalValue,originalPx:r.captured?r.currentPx:r.originalPx,captured:!1};n=e.spacingTokenMods.map((e,t)=>t===i?o:e)}else n=[...e.spacingTokenMods,{...t,captured:!1}];return{...r,spacingTokenMods:n}}(e,t.payload);case"DELETE_SPACING_TOKEN":return function(e,t){let n,r=ad(e),i=e.spacingTokenMods.findIndex(e=>e.tokenPath===t.tokenPath),o=i>=0?e.spacingTokenMods[i]:null,a=i>=0?o.captured?o.currentValue:o.originalValue:t.originalValue,l=i>=0?o.captured?o.currentPx:o.originalPx:parseFloat(t.originalValue)||0,s={tokenPath:t.tokenPath,originalValue:a,currentValue:"__deleted__",targets:o?.targets??[],originalPx:l,currentPx:0,captured:!1};return n=i>=0?e.spacingTokenMods.map((e,t)=>t===i?s:e):[...e.spacingTokenMods,s],{...r,spacingTokenMods:n}}(e,t.payload);default:return t}}function cd(e){return e instanceof HTMLElement&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||!0===e.isContentEditable||"true"===e.getAttribute("contenteditable"))}function dd(e){return cd(e.composedPath?.()[0]??e.target)||cd(function(){if(typeof document>"u")return null;let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}())}function fd(e,t,n){if(n)return[n];let r=new Set(t),i=new Map;for(let t of e)t.groupId&&t.threadId&&i.set(t.groupId,t.threadId);let o=new Set;for(let t of e){if(!r.has(t.id))continue;let e=t.threadId||(t.groupId?i.get(t.groupId):void 0);e&&o.add(e)}return[...o]}var pd=u(d());function hd(e){let t=Uu(e);return{element:e,elementInfo:{...Jt(e),selector:t},selector:t,durableSelector:$t(e)}}function md(e){return{x:e.x-window.scrollX,y:e.y-window.scrollY}}function gd(e){or(e,"transition","none")}var yd=u(d());function xd(e,t,n,r){let i=n.x-t.x,o=n.y-t.y,a=i*i+o*o;if(0===a)return Math.hypot(e.x-t.x,e.y-t.y)<=r;let l=Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/a)),s=t.x+l*i,u=t.y+l*o;return Math.hypot(e.x-s,e.y-u)<=r}var vd=u(d()),bd=u(d());var wd=u(d()),Sd=[0,1,2,4,8,12,16,20,24,28,32],kd=[8,10,11,12,13,14,16,18,20,22,24,28,32,36,40,48,56,64,72,80,96];function Cd(e){for(let t=0;t<Sd.length-1;t++){let n=Sd[t],r=Sd[t+1];if(e<=(n+r)/2)return n;if(e<r)return r}return 8*Math.round(e/8)}function Ed({canvasRef:e,domDragRef:t,gapDragRef:n,gapHoveredAxis:r,gapHoveredElement:i,handCursorRef:o,handDragRef:a,handHoveredElement:l,handHoveredSide:s,modifiersRef:u,radiusDragRef:c,radiusHoveredCorner:d,radiusHoveredElement:f,setDomDropPreview:p,setGapDragging:h,setGapHoveredAxis:m,setGapHoveredElement:g,setGapIsAuto:y,setHandCursorPos:x,setHandDragging:v,setHandHoveredElement:b,setHandHoveredSide:w,setRadiusDragging:S,setRadiusHoveredCorner:k,setRadiusHoveredElement:C,setTextDragging:E,setTextHoveredElement:M,setTextHoveredProperty:T,textDragRef:R,textHoveredElement:A,textHoveredProperty:I}){return(0,wd.useCallback)(({x:j,y:L})=>{o.current={x:j,y:L},x({x:j,y:L});let P=u.current.cmd,z=u.current.shift;if(t.current.isDragging){let n=t.current,r=n.element;if(!r)return;if(!n.hasMoved){let e=Math.abs(j-n.startX),t=Math.abs(L-n.startY);if(e<=3&&t<=3)return;n.hasMoved=!0}let i=Qu(j,L,r,e.current);return i?void p({rect:i.reference.getBoundingClientRect(),placement:i.placement,mode:n.mode}):void p(null)}if(n.current.isDragging){let e=n.current,t=e.element;if(!t)return;let r=function(e,t,n){let r=e.axis;if(!r)return null;let i=!e.hasMoved;if(i){let n=Math.abs(t.x-e.startX),r=Math.abs(t.y-e.startY);if(n<=2&&r<=2)return null}let o=e.originalRow,a=e.originalColumn;if("column"===r){let r=t.x-e.startX;a+=r,n.isolate||(o+=r)}else{let r=t.y-e.startY;o+=r,n.isolate||(a+=r)}return o=Math.max(0,o),a=Math.max(0,a),n.snap&&(o=Cd(o),a=Cd(a)),{axis:r,gap:{row:Math.round(o),column:Math.round(a)},started:i,convertedAuto:i&&e.isAuto}}(e,{x:j,y:L},{isolate:P,snap:z});if(!r)return;return r.started&&(e.hasMoved=!0),r.convertedAuto&&(or(t,"justify-content","normal"),or(t,"row-gap",`${e.visualGap}px`),or(t,"column-gap",`${e.visualGap}px`),y(!1)),or(t,"row-gap",`${r.gap.row}px`),or(t,"column-gap",`${r.gap.column}px`),void h({axis:r.axis,...r.gap})}if(c.current.isDragging){let e=c.current,t=e.element;if(!t)return;let n=function(e,t,n){let r=e.corner;if(!r)return null;let i=e.original[r]+t.y-e.startY;return i=Math.max(0,Math.min(e.maxRadius,i)),n.snap&&(i=Cd(i)),i=Math.round(i),{corner:r,radius:n.isolate?{...e.original,[r]:i}:{"top-left":i,"top-right":i,"bottom-right":i,"bottom-left":i}}}(e,{x:j,y:L},{isolate:P,snap:z});if(!n)return;return or(t,"border-top-left-radius",`${n.radius["top-left"]}px`),or(t,"border-top-right-radius",`${n.radius["top-right"]}px`),or(t,"border-bottom-right-radius",`${n.radius["bottom-right"]}px`),or(t,"border-bottom-left-radius",`${n.radius["bottom-left"]}px`),void S(n)}if(R.current.isDragging){let e=R.current,t=e.element;if(!t)return;let n=function(e,t,n){let r=e.property;if(!r)return null;let i=e.originalFontSize,o=e.originalLineHeight;if("font-size"===r)i=Math.max(1,e.originalFontSize+t.x-e.startX),n&&(i=function(e){return kd.reduce((t,n)=>Math.abs(e-n)<Math.abs(e-t)?n:t)}(i));else if(o=Math.max(i,e.originalLineHeight+t.y-e.startY),n){let e=i>0?o/i:1.2;o=i*Math.max(1,Math.round(2*e)/2)}return{property:r,text:{fontSize:Math.round(i),lineHeight:Math.round(10*o)/10}}}(e,{x:j,y:L},z);if(!n)return;return or(t,"font-size",`${n.text.fontSize}px`),or(t,"line-height",""+(n.text.fontSize>0?Math.round(n.text.lineHeight/n.text.fontSize*1e3)/1e3:1.2)),void E({property:n.property,...n.text})}if(a.current.isDragging){let e=a.current,t=e.element;if(!t)return;let n=function(e,t,n){let r=e.side;if(!r)return null;let i={...e.original};if("top"===r){let r=e.startY-t.y;i.top+=r,n.isolate||(i.bottom+=r)}else if("bottom"===r){let r=t.y-e.startY;i.bottom+=r,n.isolate||(i.top+=r)}else if("left"===r){let r=e.startX-t.x;i.left+=r,n.isolate||(i.right+=r)}else{let r=t.x-e.startX;i.right+=r,n.isolate||(i.left+=r)}return Object.keys(i).forEach(e=>{let t=Math.max(0,i[e]);n.snap&&(t=Cd(t)),i[e]=Math.round(t)}),{side:r,padding:i}}(e,{x:j,y:L},{isolate:P,snap:z});if(!n)return;return or(t,"padding",`${n.padding.top}px ${n.padding.right}px ${n.padding.bottom}px ${n.padding.left}px`),void v(n)}let N=nn(j,L);for(;N&&"A"===N.tagName;)N=N.parentElement;let _=function({element:e,stickyElement:t,point:n,hitRadius:r=16}){let i=[];e&&i.push(e),t&&t!==e&&i.push(t);let o=null,a=r,l=null;for(let e of i){let t=e.getBoundingClientRect(),r=An(e),i=[["top-left",t.left,t.top+r["top-left"]],["top-right",t.right,t.top+r["top-right"]],["bottom-right",t.right,t.bottom-r["bottom-right"]],["bottom-left",t.left,t.bottom-r["bottom-left"]]];for(let[t,r,s]of i){let i=Math.hypot(n.x-r,n.y-s);i<a&&(a=i,o=t,l=e)}}return o&&l?{element:l,corner:o}:null}({element:N,stickyElement:f,point:{x:j,y:L}});if(_)return C(_.element),k(_.corner),l&&b(null),s&&w(null),i&&g(null),r&&m(null),y(!1),A&&M(null),void(I&&T(null));f&&C(null),d&&k(null);let D=function({element:e,point:t,maxCandidates:n=3}){let r=[];e&&Sn(e)&&r.push(e);let i=e?.parentElement??null;for(;i&&i!==document.body&&r.length<n;)Sn(i)&&r.push(i),i=i.parentElement;for(let e of r){let n=Cn(e).find(e=>t.x>=e.x&&t.x<=e.x+e.w&&t.y>=e.y&&t.y<=e.y+e.h);if(n)return{element:e,axis:n.axis,isAuto:En(e,n.axis)}}return null}({element:N,point:{x:j,y:L}});if(D)return g(D.element),m(D.axis),y(D.isAuto),l&&b(null),s&&w(null),A&&M(null),void(I&&T(null));i&&g(null),r&&m(null),y(!1);let F=function({element:e,stickyElement:t,point:n,hitRadius:r=12}){let i=[];e&&i.push(e),t&&t!==e&&i.push(t);let o=null,a=1/0,l=null;for(let e of i){if(!In(e))continue;let t=jn(e);if(!t)continue;let i=n.x>=t.left&&n.x<=t.right&&n.y>=t.top&&n.y<=t.bottom,s=[["font-size",t.right,t.top+t.height/2],["line-height",t.left+t.width/2,t.bottom]];for(let[t,u,c]of s){let s=Math.hypot(n.x-u,n.y-c);(i||s<r)&&s<a&&(a=s,o=t,l=e)}}return o&&l?{element:l,property:o}:null}({element:N,stickyElement:A,point:{x:j,y:L}});if(F?(M(F.element),T(F.property)):(A&&M(null),I&&T(null)),N!==l&&b(N),N){let e=Mn(N);w(function(e,t,n){let r=t.top+Math.max(n.top,4),i=t.bottom-Math.max(n.bottom,4),o=t.left+Math.max(n.left,4),a=t.right-Math.max(n.right,4);if(e.x<t.left||e.x>t.right||e.y<t.top||e.y>t.bottom)return null;let l=e.y<r,s=e.y>i,u=e.x<o,c=e.x>a;return l&&u?n.top>=n.left?"top":"left":l&&c?n.top>=n.right?"top":"right":s&&u?n.bottom>=n.left?"bottom":"left":s&&c?n.bottom>=n.right?"bottom":"right":l?"top":s?"bottom":u?"left":c?"right":null}({x:j,y:L},N.getBoundingClientRect(),e))}else w(null)},[e,t,n,r,i,o,a,l,s,u,c,d,f,p,h,m,g,y,x,v,b,w,S,k,C,E,M,T,R,A,I])}var Md=u(d()),Td=u(d());function Rd({rawElement:e,point:t,dragHandoff:n,previewTarget:r,handleHitSize:i}){let o=!(!n?.element.isConnected||e!==n.element&&!function(e,t,n=8){return Math.hypot(t.x-e.x,t.y-e.y)<=n}(n.releasePoint,t)),a=!(!n||o),l=!(a||!r?.element.isConnected||!function(e,t,n,r,i,o,a){return!!(o&&a&&function(e,t,n,r){let i={x:t,y:n},o=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],a=r/2;if(o.some(e=>Math.hypot(t-e.x,n-e.y)<=a)||[[e.topLeft,e.topRight],[e.topRight,e.bottomRight],[e.bottomRight,e.bottomLeft],[e.bottomLeft,e.topLeft]].some(([e,t])=>Sl(i,e,t)<=6))return!0;let l=Cl(e,i,r);return Sl(i,l.edge,l.handle)<=r/2}(o,r,i,a)||t===e)||(t&&t!==e&&e.contains(t)?Bc(n,r,i):!!(t&&t.contains(e)&&o&&a&&function(e,t,n,r){let i={x:t,y:n},o=Cl(e,i,r);return Sl(i,o.edge,o.handle)<=1.5*r}(o,r,i,a))||Bc(n,r,i)||!(!o||!function(e,t,n){let r=t,i=n,o=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],a=!1,l=!1;for(let e=0;e<o.length;e+=1){let t=o[e],n=o[(e+1)%o.length],s=(n.x-t.x)*(i-t.y)-(n.y-t.y)*(r-t.x);if(s>.001&&(a=!0),s<-.001&&(l=!0),a&&l)return!1}return!0}(o,r,i)))}(r.element,e,r.bounds,t.x,t.y,r.renderedQuad,i));return{candidate:o?n.element:l?r.element:e,clearDragHandoff:a,clearPreviewTarget:!(!r||l)}}function Ad({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n}){return t&&!n&&("inspector"===e||"sticker"===e)}function Id({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n,hoveredElement:r,hoveredElementInfo:i,subjectRegistry:o,stickerFamily:a,stickerStage:l,stickerSubproperty:s,steerDragRef:u,transformDragHandoffRef:c,transformPreviewSuppressionRef:d,transformPreviewTargetRef:f,clearStickerPreview:p,isElementInFlight:h,setHoveredElement:m,setHoveredElementInfo:g,setStickerCursor:y,setStickerStep:x}){return(0,Td.useCallback)(({viewportPoint:v,passThrough:b,stopPropagation:w})=>{if(!Ad({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n}))return!!n;if("sticker"===e&&(w(),y(v)),u.current)return!0;if(an(v.x,v.y))return"sticker"===e&&p(),r&&m(null),i&&g(null),y(null),!0;let S={allowBodyFallback:"inspector"===e},k=b?function(e,t,n){let r=sn(e,t,n);return tn(r,e,t)??r.find(n=>un(n,e,t))??r.at(-1)??null}(v.x,v.y,S):nn(v.x,v.y,S),C="inspector"===e?o?.hitTest(v):null,E=function(e,t,n,r=16){if(!(e instanceof HTMLImageElement||e instanceof HTMLVideoElement)||t)return!1;let i=rt(e);return!(n.x<i.left||n.x>i.right||n.y<i.top||n.y>i.bottom)&&Math.min(n.x-i.left,i.right-n.x,n.y-i.top,i.bottom-n.y)<=r}(k,!!C,v),M=Ir(r),T=function(e,t){return!(!e||!t||e.adapter===t.adapter&&e.key===t.key)}(M,C?.target),R=!C&&M?o?.resolve(M)?.subject.sourceElement:void 0,A=R&&!rn(R,v.x,v.y);if(!E&&!T&&!A&&"inspector"===e&&function(e,t,n,r){if(!(t instanceof HTMLElement))return!1;let{popmeltSubjectAdapter:i,popmeltSubjectKey:o}=t.dataset;if(!i||!o)return!1;let a=Array.from(e.querySelectorAll(`${Uc}[data-popmelt-subject-adapter][data-popmelt-subject-key]`)).find(e=>e.dataset.popmeltSubjectAdapter===i&&e.dataset.popmeltSubjectKey===o);return!(!a||!Xc(t,n,r))&&function(e,t,n,r){let i=rt(e),o=t.getBoundingClientRect();return n>=Math.min(i.left,o.left)&&n<=Math.max(i.right,o.right)&&r>=Math.min(i.top,o.top)&&r<=Math.max(i.bottom,o.bottom)}(t,a,n,r)}(document,r,v.x,v.y))return!0;let I=C?.element??k,j="sticker"===e&&"value"===l&&"transform"===a?f.current:null,L=b?{candidate:I,clearDragHandoff:!!c.current,clearPreviewTarget:!!j}:Rd({rawElement:I,point:v,dragHandoff:c.current,previewTarget:j,handleHitSize:20});L.clearDragHandoff&&(c.current=null),L.clearPreviewTarget&&(f.current=null);let P=L.candidate,z=function(e,t,n){return t?"sticker"!==e&&n(t)?null:t:null}(e,P,h);if(z===r)return C?.element===z&&function(e,t){return e?.subjectLabel!==t.subjectLabel||e?.textContent!==t.textContent||e?.context!==t.context}(i,C.elementInfo)&&g(C.elementInfo),!0;if("sticker"===e&&p(),"sticker"!==e||!wn(z)||"transform"!==a||"translate"!==s&&"scale"!==s&&"rotate"!==s)"transform"===a&&(d.current=null);else{let e=function(e,t){return function(e,t){if("translate"===t)return Il(t,Ml(e).x);if("scale"===t){let n=Number.parseFloat(e);return Il(t,Number.isFinite(n)?100*n:100)}let n=Number.parseFloat(e);return Il(t,Number.isFinite(n)?n:0)}(window.getComputedStyle(e).getPropertyValue(t).trim(),t)}(z,s);d.current={element:z,subproperty:s,step:e},x(e)}return m(z),g(C?.element===z?C.elementInfo:z?Jt(z):null),!0},[e,p,r,i,t,h,m,g,y,x,u,a,l,s,o,n,c,d,f])}function jd(e){let t=Ed(e),n=function({annotations:e,dragState:t,resizeState:n,dispatch:r,setDragState:i,setResizeState:o}){return(0,bd.useCallback)(({point:a,centerOrigin:l,lockAspect:s})=>{if(n){let t=e.find(e=>e.id===n.annotationId);if(!t)return!0;let i=function({annotation:e,session:t,point:n,centerOrigin:r,lockAspect:i}){let{handle:o,originalPoints:a}=t;if("line"===e.type){let e=a[0],t=a[a.length-1];return"start"===o?[n,t]:[e,n]}if("freehand"===e.type){let e={left:Math.min(...a.map(e=>e.x)),right:Math.max(...a.map(e=>e.x)),top:Math.min(...a.map(e=>e.y)),bottom:Math.max(...a.map(e=>e.y))},t=e.right-e.left||1,l=e.bottom-e.top||1,s=Hu(e,o,n,r,i),u=s.right-s.left||1,c=s.bottom-s.top||1;return a.map(n=>({x:s.left+(n.x-e.left)/t*u,y:s.top+(n.y-e.top)/l*c}))}let l=a[0],s=a[a.length-1],u={left:Math.min(l.x,s.x),right:Math.max(l.x,s.x),top:Math.min(l.y,s.y),bottom:Math.max(l.y,s.y)};if("circle"===e.type){let e=(u.left+u.right)/2,t=(u.top+u.bottom)/2,a=u.right-u.left,l=u.bottom-u.top,s={...u};switch(o){case"top":if(s.top=n.y,r&&(s.bottom=t+(t-n.y)),i){let t=(s.bottom-s.top)*(a/l)/2;s.left=e-t,s.right=e+t}break;case"bottom":if(s.bottom=n.y,r&&(s.top=t-(n.y-t)),i){let t=(s.bottom-s.top)*(a/l)/2;s.left=e-t,s.right=e+t}break;case"left":if(s.left=n.x,r&&(s.right=e+(e-n.x)),i){let e=(s.right-s.left)*(l/a)/2;s.top=t-e,s.bottom=t+e}break;case"right":if(s.right=n.x,r&&(s.left=e-(n.x-e)),i){let e=(s.right-s.left)*(l/a)/2;s.top=t-e,s.bottom=t+e}}return[{x:s.left,y:s.top},{x:s.right,y:s.bottom}]}let c=Hu(u,o,n,r,i);return[{x:c.left,y:c.top},{x:c.right,y:c.bottom}]}({annotation:t,session:n,point:a,centerOrigin:l,lockAspect:s});return r({type:"RESIZE_ANNOTATION",payload:{id:n.annotationId,points:i,saveUndo:!n.hasMoved}}),n.hasMoved||o({...n,hasMoved:!0}),!0}if(t&&"pending"===(t.annotation.status??"pending")){let e=function(e,t){if("pending"!==(e.annotation.status??"pending"))return null;let n={x:t.x-e.startPoint.x,y:t.y-e.startPoint.y};return e.hasMoved?{session:{...e,startPoint:t},move:{delta:n,saveUndo:!1}}:Math.abs(n.x)>2||Math.abs(n.y)>2?{session:{...e,hasMoved:!0,startPoint:t},move:{delta:n,saveUndo:!0}}:null}(t,a);return e&&(i(e.session),r({type:"MOVE_ANNOTATION",payload:{id:t.annotation.id,delta:e.move.delta,...e.move.saveUndo?{saveUndo:!0}:{}}})),!0}return!1},[e,r,t,n,i,o])}(e),r=Id(e),i=(0,vd.useRef)(r),o=(0,vd.useRef)(e.clearPageElementHover),a=(0,vd.useRef)(!1),l=Ad({activeTool:e.activeTool,isAnnotating:e.isAnnotating,suspendTargetDiscovery:e.suspendTargetDiscovery});(0,vd.useLayoutEffect)(()=>{i.current=r,o.current=e.clearPageElementHover},[r,e.clearPageElementHover]),(0,vd.useEffect)(()=>{if(l)return function({onSuspend:e,onRestore:t,suspendedRef:n}){let r,i=()=>{n.current||(n.current=!0,e()),clearTimeout(r),r=setTimeout(()=>{n.current=!1,t()},96)};return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",i,!0),clearTimeout(r),n.current=!1}}({onSuspend:()=>o.current(),onRestore:()=>{let t=e.lastCanvasCursorRef.current;t&&i.current({viewportPoint:t,passThrough:!1,stopPropagation:()=>{}})},suspendedRef:a})},[e.lastCanvasCursorRef,l]);let s=(0,vd.useCallback)(e=>!!a.current||i.current(e),[]);(0,vd.useEffect)(()=>{let t=t=>{t.repeat||"Meta"!==t.key&&"Control"!==t.key||!e.lastCanvasCursorRef.current||s({viewportPoint:e.lastCanvasCursorRef.current,passThrough:!0,stopPropagation:()=>{}})};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[s,e.lastCanvasCursorRef]),(0,vd.useEffect)(()=>{let t=t=>{let n=e.canvasRef.current;if(n&&t.composedPath().includes(n))return;let r={x:t.clientX,y:t.clientY};e.lastCanvasCursorRef.current=r,s({viewportPoint:r,passThrough:t.metaKey||t.ctrlKey,stopPropagation:()=>{}})};return window.addEventListener("mousemove",t,!0),()=>window.removeEventListener("mousemove",t,!0)},[s,e.canvasRef,e.lastCanvasCursorRef]),(0,vd.useEffect)(()=>{if(e.subjectRegistry)return e.subjectRegistry.subscribeFrame(()=>{let t=e.lastCanvasCursorRef.current;t&&s({viewportPoint:t,passThrough:!1,stopPropagation:()=>{}})})},[s,e.lastCanvasCursorRef,e.subjectRegistry]);let u=(0,vd.useCallback)(()=>!!e.dragState||!!e.resizeState||e.domDragRef.current.isDragging||e.handDragRef.current.isDragging||e.gapDragRef.current.isDragging||e.radiusDragRef.current.isDragging||e.textDragRef.current.isDragging,[e.domDragRef,e.dragState,e.gapDragRef,e.handDragRef,e.radiusDragRef,e.resizeState,e.textDragRef]);return(0,vd.useEffect)(()=>{if(!l)return;let t=t=>{let n=e.lastCanvasCursorRef.current,r=t.target;!n||u()||!(r instanceof HTMLElement)||!r.contains(e.canvasRef.current)||!r.matches(":hover")||s({viewportPoint:n,passThrough:!1,stopPropagation:()=>{}})};return window.addEventListener(yr,t),()=>window.removeEventListener(yr,t)},[s,u,e.canvasRef,e.lastCanvasCursorRef,l]),function({activeTool:e,isAnnotating:t,lastCanvasCursorRef:n,getPoint:r,isManipulating:i,findTextAtPoint:o,clearPageElementHover:a,handleShakePointerMove:l,handleTargetPointerMove:s,handleHandPointerMove:u,handleAnnotationPointerMove:c}){return(0,Md.useCallback)(d=>{let f=r(d),p={x:f.x-window.scrollX,y:f.y-window.scrollY},h="metaKey"in d&&(!("pointerType"in d)||"mouse"===d.pointerType);n.current=p;let m=i();if(!l({isManipulating:m,isTouchEvent:"touches"in d||"pointerType"in d&&"mouse"!==d.pointerType,viewportPoint:p})){if(!m&&o(f))return void a();if(!s({viewportPoint:p,passThrough:h&&(d.metaKey||d.ctrlKey),stopPropagation:()=>d.stopPropagation()})){if("hand"===e&&t)return void u(p);c({point:f,centerOrigin:h&&(d.metaKey||d.ctrlKey),lockAspect:h&&d.shiftKey})}}},[e,a,o,r,c,u,l,s,t,i,n])}({...e,isManipulating:u,handleAnnotationPointerMove:n,handleHandPointerMove:t,handleTargetPointerMove:s})}var Ld=u(d());function Pd({annotationGroupMap:e,canvasRef:t,currentPathname:n,cursorPosRef:r,dispatch:i,domDragRef:o,dragState:a,gapDragRef:l,gapDragging:s,getPoint:u,handDragRef:c,handDragging:d,lastPositionedTextId:f,radiusDragRef:p,radiusDragging:h,resizeState:m,setActiveText:g,setDomDropPreview:y,setDragState:x,setGapDragging:v,setHandDragging:b,setRadiusDragging:w,setResizeState:S,setSendHintAnchorId:k,setTextDragging:C,textDragRef:E,textDragging:M}){return(0,Ld.useCallback)(T=>{if(o.current.isDragging){let e=o.current,r=u(T),a=function({drag:e,clientX:t,clientY:n,pathname:r,createId:i,rootElement:o,elementAtPoint:a}){let l=e.element;if(!(l&&e.selector&&e.durableSelector&&e.elementInfo))return null;let s=Qu(t,n,l,o,a);if(!s)return null;let u=e.originalParent===s.parent&&s.index>e.originalIndex?s.index-1:s.index;if("move"===e.mode&&e.originalParent===s.parent&&(u===e.originalIndex||u===e.originalIndex+1))return null;let c=$t(s.parent),d=Uu(s.parent),f=$t(s.reference),p=Uu(s.reference),h=e.selector,m=e.durableSelector,g=e.elementInfo;if("copy"===e.mode){let e=l.cloneNode(!0);if(!(e instanceof Element))return null;Ku(e),Gu(s.parent,e,u),h=Uu(e),m=$t(e),g={...Jt(e),selector:h}}else Gu(s.parent,l,u);let y=e.originalParent;return{id:i(),operation:e.mode,selector:h,durableSelector:m,element:g,sourceSelector:"copy"===e.mode?e.selector:void 0,sourceDurableSelector:"copy"===e.mode?e.durableSelector:void 0,sourceElement:"copy"===e.mode?e.elementInfo:void 0,originalParentSelector:y?Uu(y):void 0,originalParentDurableSelector:y?$t(y):void 0,originalIndex:e.originalIndex,targetParentSelector:d,targetParentDurableSelector:c,targetIndex:u,referenceSelector:p,referenceDurableSelector:f,placement:s.placement,pathname:r}}({drag:e,clientX:r.x-window.scrollX,clientY:r.y-window.scrollY,pathname:n,createId:rd,rootElement:t.current});return a&&i({type:"MODIFY_DOM_STRUCTURE",payload:a}),o.current={isDragging:!1,hasMoved:!1,mode:"move",startX:0,startY:0,element:null,originalParent:null,originalIndex:-1,selector:null,durableSelector:null,elementInfo:null},void y(null)}if(E.current.isDragging){let e=function(e,t){return e.element&&t?Nc(e,function(e,t,n){jc(e,["font-size","line-height"]);let r=[];if(t.fontSize!==n.fontSize&&(or(e,"font-size",`${n.fontSize}px`),r.push(Lc("font-size",t.fontSize,n.fontSize))),t.lineHeight!==n.lineHeight){let i=t.fontSize>0?Math.round(t.lineHeight/t.fontSize*1e3)/1e3:1.2,o=n.fontSize>0?Math.round(n.lineHeight/n.fontSize*1e3)/1e3:1.2;or(e,"line-height",`${o}`),r.push({property:"line-height",original:`${i}`,modified:`${o}`})}return r}(e.element,{fontSize:e.originalFontSize,lineHeight:e.originalLineHeight},t)):null}(E.current,M);return e&&i({type:"MODIFY_STYLES_BATCH",payload:e}),E.current={isDragging:!1,property:null,startX:0,startY:0,originalFontSize:0,originalLineHeight:0,originalRatio:1.2,element:null,elementInfo:null,selector:null,durableSelector:null},void C(null)}if(l.current.isDragging){let e="button"in T&&2===T.button,t=function(e,t,n){return e.element?Nc(e,function(e,t,n,r){if(!t.hasMoved){if(r)return[];jc(e,[]);let n=t.justifyContent||"normal",i=Pc.indexOf(n),o=Pc[(i+1)%Pc.length],a=[];return"normal"===o?(or(e,"justify-content","normal"),a.push({property:"justify-content",original:t.justifyContent,modified:"normal"})):"stretch"===o?(or(e,"justify-content",o),or(e,"row-gap","8px"),or(e,"column-gap","8px"),a.push({property:"justify-content",original:t.justifyContent||"normal",modified:o}),8!==t.row&&a.push(Lc("row-gap",t.row,8)),8!==t.column&&a.push(Lc("column-gap",t.column,8))):(jc(e,["row-gap","column-gap"]),or(e,"justify-content",o),a.push({property:"justify-content",original:t.justifyContent||"normal",modified:o}),t.row>0&&a.push(Lc("row-gap",t.row,0)),t.column>0&&a.push(Lc("column-gap",t.column,0))),a}if(!n)return[];jc(e,["row-gap","column-gap"]);let i=[];return t.isAuto?(jc(e,["justify-content"]),or(e,"justify-content","normal"),or(e,"row-gap",`${n.row}px`),or(e,"column-gap",`${n.column}px`),i.push({property:"justify-content",original:t.justifyContent,modified:"normal"}),i.push(Lc("row-gap",0,n.row)),i.push(Lc("column-gap",0,n.column)),i):(t.row!==n.row&&(or(e,"row-gap",`${n.row}px`),i.push(Lc("row-gap",t.row,n.row))),t.column!==n.column&&(or(e,"column-gap",`${n.column}px`),i.push(Lc("column-gap",t.column,n.column))),i)}(e.element,{hasMoved:e.hasMoved,isAuto:e.isAuto,row:e.originalRow,column:e.originalColumn,justifyContent:e.originalJustifyContent},t,n)):null}(l.current,s,e);return t&&i({type:"MODIFY_STYLES_BATCH",payload:t}),l.current={isDragging:!1,hasMoved:!1,axis:null,startX:0,startY:0,originalRow:0,originalColumn:0,element:null,elementInfo:null,selector:null,durableSelector:null,isAuto:!1,originalJustifyContent:"",visualGap:0},void v(null)}if(p.current.isDragging){let e=function(e,t){return e.element&&t?Nc(e,function(e,t,n){let r=Object.values(zc);jc(e,r);let i=[];return Object.keys(zc).forEach(r=>{if(t[r]===n[r])return;let o=zc[r];or(e,o,`${n[r]}px`),i.push(Lc(o,t[r],n[r]))}),i}(e.element,e.original,t.radius)):null}(p.current,h);return e&&i({type:"MODIFY_STYLES_BATCH",payload:e}),p.current={isDragging:!1,corner:null,startY:0,original:{"top-left":0,"top-right":0,"bottom-right":0,"bottom-left":0},maxRadius:0,element:null,elementInfo:null,selector:null,durableSelector:null},void w(null)}if(c.current.isDragging){let e=function(e,t){return e.element&&t?Nc(e,function(e,t,n){jc(e,["padding"]);let r=[];return Object.keys(t).forEach(i=>{if(t[i]===n[i])return;let o=`padding-${i}`;or(e,o,`${n[i]}px`),r.push(Lc(o,t[i],n[i]))}),r}(e.element,e.original,t.padding)):null}(c.current,d);return e&&i({type:"MODIFY_STYLES_BATCH",payload:e}),c.current={isDragging:!1,side:null,startX:0,startY:0,original:{top:0,right:0,bottom:0,left:0},element:null,elementInfo:null,selector:null,durableSelector:null},void b(null)}if(m)return void S(null);if(!a)return;let R=e.get(a.annotation.id),A=t.current?.getContext("2d"),I=0;void 0!==R&&A&&(A.font=`${a.annotation.fontSize||12}px ${ni}`,I=A.measureText(`${R}. `).width);let j=function({session:e,clickPoint:t,groupLabelWidth:n=0}){let{annotation:r}=e;return e.hasMoved||"text"!==r.type||"pending"!==(r.status??"pending")?null:{activeText:{id:r.id,point:r.points[0],text:r.text||"",fontSize:r.fontSize||12,isNew:!1,clickPoint:{x:t.x-n,y:t.y},groupId:r.groupId,linkedSelector:r.linkedSelector,linkedAnchor:r.linkedAnchor,elements:r.elements,...r.region?{region:r.region}:{},attachments:r.attachments,interactionEpisode:r.interactionEpisode},color:r.color}}({session:a,clickPoint:u(T),groupLabelWidth:I});j&&(f.current=null,r.current=null,k(a.annotation.id),j.color&&i({type:"SET_COLOR",payload:j.color}),g(j.activeText)),x(null)},[e,t,n,r,i,o,a,l,s,u,c,d,f,p,h,m,g,y,x,v,b,w,S,k,C,E,M])}var zd=u(d()),Nd=class{constructor(){this.anchor=null,this.axis=null,this.direction=0,this.reversals=0,this.sequenceStartedAt=0,this.lastTriggerAt=Number.NEGATIVE_INFINITY}push(e){if(e.time-this.lastTriggerAt<700)return this.anchor=e,!1;if(!this.anchor||this.sequenceStartedAt&&e.time-this.sequenceStartedAt>520)return this.reset(e),!1;let t=e.x-this.anchor.x,n=e.y-this.anchor.y,r=Math.hypot(t,n);if(!this.axis)return r<16||(this.axis={x:t/r,y:n/r},this.direction=1,this.sequenceStartedAt=e.time,this.anchor=e),!1;let i=t*this.axis.x+n*this.axis.y,o=t*-this.axis.y+n*this.axis.x;if(Math.abs(i)<16)return!1;if(Math.abs(o)>.7*Math.abs(i))return this.reset(e),!1;let a=Math.sign(i);return a===this.direction?(this.anchor=e,!1):(this.direction=a,this.reversals+=1,this.anchor=e,!(this.reversals<3||(this.lastTriggerAt=e.time,this.reset(e,!0),0)))}reset(e=null,t=!1){this.anchor=e,this.axis=null,this.direction=0,this.reversals=0,this.sequenceStartedAt=0,t||(this.lastTriggerAt=Number.NEGATIVE_INFINITY)}},_d=u(d());function Dd({activeText:e,activeTextRef:t,canvasRef:n,clearPageElementHover:r,clearSelection:i,clearSignal:o,commentTextEditCandidateRef:a,cursorPosRef:l,dispatch:s,findTextAtPoint:u,lastPositionedTextId:c,onAttachImages:d,onCloseThread:f,onSend:p,pendingLinkedText:h,releaseActiveTextAttachments:m,setActiveText:g,setDragState:y,setHoveredTextId:x,setPendingLinkedText:v,setSendHintAnchorId:b,state:w,stateRef:S}){(0,_d.useLayoutEffect)(()=>{h&&(g({id:Math.random().toString(36).substring(2,9),point:h.point,subjectAnchor:h.subjectAnchor,text:"",fontSize:12,isNew:!0,linkedSelector:h.linkedSelector,target:h.target,linkedAnchor:h.linkedAnchor,elements:h.elements}),v(null))},[h,g,v]),(0,_d.useEffect)(()=>{let t=t=>{if(e)return;let n=u({x:t.clientX+window.scrollX,y:t.clientY+window.scrollY});x(n?.id??null)};return window.addEventListener("mousemove",t),()=>window.removeEventListener("mousemove",t)},[e,u,x]);let k=(0,_d.useCallback)(()=>{if(!e)return;if(e.domEdit)return void g(null);let t=function(e){if(e.domEdit){let t=e.domEdit;return e.text===t.originalText?{action:null,sendHintAnchorId:null,attachedImages:null}:{action:ec(t,e.text),sendHintAnchorId:null,attachedImages:null}}let t=e.images??[],n=t.length,r=e.attachments??[];if(!(e.text.trim()||n>0||r.length>0||e.interactionEpisode?.steps.length))return{action:e.isNew?null:{type:"DELETE_ANNOTATION",payload:{id:e.id}},sendHintAnchorId:null,attachedImages:null};let i=function(e,t,n){return e||(t>0?`[${t} image${t>1?"s":""}]`:n[0]?.name??"")}(e.text,n,r)||`[Interaction episode: ${e.interactionEpisode?.steps.length??0} steps]`;return{action:e.isNew?{type:"ADD_TEXT",payload:{point:e.point,text:i,fontSize:e.fontSize,id:e.id,groupId:e.groupId,linkedSelector:e.linkedSelector,target:e.target,linkedAnchor:e.linkedAnchor,elements:e.elements,...e.region?{region:e.region}:{},...n>0?{imageCount:n}:{},...r.length>0?{attachments:r}:{},...e.interactionEpisode?{interactionEpisode:e.interactionEpisode}:{}}}:{type:"UPDATE_TEXT",payload:{id:e.id,text:i,...n>0?{imageCount:n}:{},attachments:r,interactionEpisode:e.interactionEpisode}},sendHintAnchorId:e.id,attachedImages:n>0?{annotationId:e.id,images:t}:null}}(e);t.sendHintAnchorId&&b(t.sendHintAnchorId),t.action&&s(t.action),t.attachedImages&&d&&d(t.attachedImages.annotationId,t.attachedImages.images),g(null)},[e,s,d,g,b]),C=(0,_d.useCallback)(e=>{let n=S.current.annotations.find(t=>t.id===e);if(!n||"text"!==n.type||!n.points[0]||"pending"!==(n.status??"pending"))return;let o=t.current;o&&o.id!==n.id&&k(),i(),r(),c.current=null,l.current=n.text?.length??0,b(n.id),n.color&&s({type:"SET_COLOR",payload:n.color}),g({id:n.id,point:n.points[0],text:n.text||"",fontSize:n.fontSize||12,isNew:!1,groupId:n.groupId,linkedSelector:n.linkedSelector,target:n.target,linkedAnchor:n.linkedAnchor,elements:n.elements,...n.region?{region:n.region}:{},attachments:n.attachments,interactionEpisode:n.interactionEpisode})},[t,r,i,k,l,s,c,g,b,S]),E=(0,_d.useRef)(!1),M=(0,_d.useCallback)(()=>{if(!p)return;let e=t.current;if(function(e){return!!e&&(void 0!==e.originalText?e.text!==e.originalText:e.text.trim().length>0||!!e.hasInteractionEpisode)}(e?{text:e.text,originalText:e.domEdit?.originalText,hasInteractionEpisode:!!e.interactionEpisode?.steps.length}:null))return E.current=!0,void k();p()},[t,k,p]);(0,_d.useEffect)(()=>{e||!E.current||(E.current=!1,p?.())},[e,p,w.annotations,w.textModifications]);let T=(0,_d.useRef)(o);(0,_d.useEffect)(()=>{if(o===T.current)return;T.current=o;let e=t.current;e?.domEdit&&e.domEdit.segments.forEach(e=>{e.textNode.nodeValue=e.originalText});let n=e?.isNew?e.attachments??[]:[];m(n),E.current=!1,g(null),v(null),b(null),y(null),l.current=null,c.current=null,localStorage.removeItem(zr)},[t,o,l,c,m,g,y,v,b]);let R=(0,_d.useCallback)((e,t,r,i=!1)=>function(e){let t=function(e,t,n,r=!1){return function(e,t){if(!e)return t();let n=e.style.pointerEvents;e.style.pointerEvents="none";try{return t()}finally{e.style.pointerEvents=n}}(n,()=>{let n=nn(e,t);if(!n||Dn(n))return null;let i=n?.ownerDocument??document,o=it(e,t,i),a=Fn(i,o.x,o.y)?.node??null;if(a&&!n.contains(a)&&(a=null),!a){let e=n;e&&!Dn(e)&&(a=function(e,t,n){let r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.textContent?.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),i=r.nextNode();for(;i;){let o=i,a=e.ownerDocument.createRange();a.selectNodeContents(o);let l=Array.from(a.getClientRects());if(a.detach?.(),l.some(e=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom))return o;i=r.nextNode()}return null}(e,o.x,o.y))}if(!a&&n?.closest("p")?.querySelector("[data-popmelt-empty-paragraph]"))return $n(n.closest("p"));if(!a||!function(e){return!(!e||"http://www.w3.org/1999/xhtml"!==e.namespaceURI)}(a.parentElement))return null;let l=a.parentElement;if(Dn(l))return null;for(;!r&&l.parentElement&&l!==i.body;){let e=ot(l).getComputedStyle(l).display,t="inline-block"===e&&1===l.childNodes.length&&l.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==e&&"contents"!==e&&!t)break;let n=l.parentElement;if(Dn(n))break;if(Array.from(n.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.nodeValue?.trim())){l=n;continue}let r=ot(n).getComputedStyle(n).display,i="inline-block"===r&&1===n.childNodes.length&&n.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==r&&"contents"!==r&&!i)break;l=n}let s=a.parentElement?.closest("p"),u=a.parentElement?.closest(\'button, input, textarea, select, [role="button"]\');if(s&&(!u||!s.contains(u)))return $n(s,a);let c=l.tagName.toLowerCase();if("script"===c||"style"===c||"textarea"===c||"input"===c)return null;let d=Hn(l).filter(e=>!r||e.textNode===a),f=d.map(e=>e.originalText).join("");if(!f.trim())return null;let p=On(l,a);if(!p)return null;let h=ot(l).getComputedStyle(l),m=Vn(d,l,h,r),{textRect:g,boundaryRect:y,boundaryRects:x,flowRect:v,firstLineIndent:b}=m;if(g.width<=0||g.height<=0)return null;let w=parseFloat(h.fontSize)||12,S="nowrap"!==h.whiteSpace&&"pre"!==h.whiteSpace&&(r?x.length>1:function(e){let t=e.ownerDocument.createRange();t.selectNodeContents(e);let n=Array.from(t.getClientRects()).filter(e=>e.width>0&&e.height>0).length;return t.detach?.(),n>1}(a)||"inline"!==h.display);return{textNode:a,targetElement:l,textNodePath:p,segments:d,originalText:f,rect:g,boundaryRect:y,boundaryRects:x,flowRect:v,firstLineIndent:b,styles:h,fontSize:w,wrapsText:S,singleTextNode:r}})}(e.clientX,e.clientY,e.canvas,e.singleTextNode);return t?qu(t,e.clickPoint,e.scroll):null}({singleTextNode:i,clientX:e,clientY:t,clickPoint:r,canvas:n.current,scroll:{x:window.scrollX,y:window.scrollY}}),[n]),A=(0,_d.useCallback)(e=>{f?.(),v(null),y(null),b(null),i(),r(),c.current=null;let t=e.domEdit?.targetElement;if("P"===t?.tagName){let n=Xn(t)?.root??t,r=Ot(Uu(n),n.ownerDocument),i=window.location.pathname;e.paragraphSession={id:e.id,selector:r,pathname:i,originalDrafts:S.current.textModifications.filter(e=>e.selector===r&&(!e.pathname||e.pathname===i))}}g(e)},[r,i,c,S,f,g,y,v,b]);return(0,_d.useEffect)(()=>{let e=e=>{if(0!==e.button)return;let t=S.current,n=a.current;if(!t.isAnnotating||"inspector"!==t.activeTool||!n)return;let r=Date.now()>n.expiresAt,i=Math.hypot(e.clientX-n.clientX,e.clientY-n.clientY)>12,o=n.edit.domEdit;!r&&!i&&o?.textNode.isConnected&&o.targetElement.isConnected?(e.preventDefault(),e.stopPropagation(),a.current=null,A(n.edit)):a.current=null},t=t=>{2===t.detail&&e(t)},n=t=>{e(t)};return window.addEventListener("mousedown",t,!0),window.addEventListener("dblclick",n,!0),()=>{window.removeEventListener("mousedown",t,!0),window.removeEventListener("dblclick",n,!0)}},[a,A,S]),{commitActiveText:k,createInlineTextEdit:R,enterDomTextEdit:A,editPendingLinkedComment:C,handleSendPendingBundle:M}}var Fd=u(d());var $d=u(d());var Od=u(d()),Hd=new Set(["resolved","needs_review","waiting_input","failed"]);function Wd(e){return e.linkedSelector??(e.target?Ar(e.target):void 0)}function Bd(e,t){let n=e.groupId?t.filter(t=>t.groupId===e.groupId):[e],r=n.find(e=>void 0!==e.status&&Hd.has(e.status)),i=n.find(e=>e.threadId),o=n.find(e=>Wd(e)),a=o?Wd(o):void 0;if(!r?.status||!i?.threadId||!a)return;let l=n.find(e=>e.targetBindingId),s=n.find(e=>e.replyJobIds?.length);return{status:r.status,threadId:i.threadId,targetBindingId:l?.targetBindingId,replyJobIds:s?.replyJobIds,linkedSelector:a,elements:o?.elements}}var Vd=u(d()),qd=["flex-start","center","flex-end"],Yd=["flex-start","center","flex-end"];var Ud=u(d());function Xd(e){return"colors"===e.kind?"variant":"values"===e.kind?"value":void 0}function Kd(e){return"variant"!==e.stage||!ma(e.family,e.subproperty)||"border"!==e.family&&"color"!==e.family&&"text"!==e.family?"value"===e.stage?{kind:"values",family:e.family,subproperty:e.subproperty}:wc:{kind:"colors",family:e.family}}function Qd({active:e,family:t,step:n,subproperty:r,stage:i,query:o,setFamily:a,setStep:l,setSubproperty:s,setStage:u,setQuery:c,setCursor:d,setContextLabelPulse:f,setDepthSnapPulse:p,setRejectPulse:h,lastCursorRef:m,toolbarRef:g,previewRef:y,applyStickerRef:x,readColor:v,readStep:b}){(0,Ud.useEffect)(()=>{if(!e)return;m.current&&d(m.current);let w=e=>{let d=e.composedPath?.()[0]??e.target;if("INPUT"===d?.tagName||"TEXTAREA"===d?.tagName||d?.isContentEditable||d&&g?.current?.contains(d)||e.metaKey||e.ctrlKey||e.altKey)return;let m={family:t,step:n,subproperty:r,stage:i},w=e=>{a(e.family),l(e.step),s(e.subproperty),u(e.stage)},S=function(e,t,n,r=!1){if(!e)return" "!==n?{handled:!1,session:e}:r?{handled:!0,session:e}:{handled:!0,session:{query:"",segments:[],scope:Kd(t),origin:t,history:[]}};if("Escape"===n)return{handled:!0,session:null};if("Backspace"===n){if(e.query){let t=e.query.slice(0,-1),n=Rc(e.scope,t);return{handled:!0,session:{...e,query:t},restore:n?void 0:e.segmentOrigin,destination:n?{mode:"preview",scope:e.scope,value:n.destination}:void 0}}let t=e.history.at(-1);return t?{handled:!0,restore:t.snapshot,session:{...e,query:"",segmentOrigin:void 0,segments:e.segments.slice(0,-1),scope:t.scope,history:e.history.slice(0,-1)}}:{handled:!0,session:null,restore:e.origin}}if(" "===n){if(!e.query.trim())return{handled:!0,session:e};let n=Tc(e.scope,e.query);return n?.nextScope?{handled:!0,destination:{mode:"navigate",scope:e.scope,value:n.destination},stage:Xd(n.nextScope),session:{...e,query:"",segmentOrigin:void 0,segments:[...e.segments,e.query.trim()],scope:n.nextScope,history:[...e.history,{scope:e.scope,snapshot:t}]}}:{handled:!0,session:e,command:"reject"}}if("Enter"===n){if("values"===e.scope.kind){let n=e.query.trim()?Tc(e.scope,e.query):null;return e.query.trim()&&!n?{handled:!0,session:e,command:"reject"}:n?.nextScope?{handled:!0,destination:{mode:"navigate",scope:e.scope,value:n.destination},stage:Xd(n.nextScope),session:{...e,query:"",segmentOrigin:void 0,segments:[...e.segments,e.query.trim()],scope:n.nextScope,history:[...e.history,{scope:e.scope,snapshot:t}]}}:{handled:!0,session:e,destination:n?{mode:"navigate",scope:e.scope,value:n.destination}:void 0,command:"apply"}}let n=Tc(e.scope,e.query);return n?n.nextScope?{handled:!0,destination:{mode:"navigate",scope:e.scope,value:n.destination},stage:Xd(n.nextScope),session:{...e,query:"",segmentOrigin:void 0,segments:[...e.segments,e.query.trim()],scope:n.nextScope,history:[...e.history,{scope:e.scope,snapshot:t}]}}:{handled:!0,session:null,destination:{mode:"navigate",scope:e.scope,value:n.destination}}:{handled:!0,session:e,command:"reject"}}let i=n.toLowerCase();if(!r&&("w"===i||"a"===i||"s"===i||"d"===i)&&e.query.at(-1)===i)return{handled:!1,session:null,replayAsSteering:!0,restore:e.segmentOrigin??e.origin};if(1===n.length){let r=`${e.query}${n.toLowerCase()}`,i=Rc(e.scope,r);return{handled:!0,session:{...e,query:r,segmentOrigin:e.query?e.segmentOrigin:t},destination:i?{mode:"preview",scope:e.scope,value:i.destination}:void 0}}return{handled:!1,session:e}}(o,m,e.key,e.repeat);if(S.replayAsSteering&&(c(null),p(e=>e+1)),S.handled){e.preventDefault(),e.stopPropagation(),S.restore&&w(S.restore);let t=S.destination?(e=>{let t=function(e,t,n){let{destination:r,mode:i,scope:o}=t;if("preview"===i&&"values"!==o.kind){let t=r.family,n=r.subproperty??Ca(t,e.subproperty);return{next:{family:t,subproperty:n,step:wa(t,e.step,n),stage:"colors"===o.kind?"variant":"family"},pulseContextLabel:!1}}let a=r.family,l=void 0!==r.step,s=Na(a),u=!l&&ma(a,r.subproperty??"all")?n.readColor(s):null,c=r.subproperty??Ca(a,e.subproperty);"color"===a&&"family"===r.stage&&(c=u?.name??$o),("border"===a||"text"===a)&&"color"===r.subproperty&&(c=u?.name??$o);let d=l?null:u?u.name===c?u.step:Fo:n.readStep(a,c);return{next:{family:a,subproperty:c,step:r.step??d??wa(a,e.step,c),stage:r.stage},pulseContextLabel:"family"!==r.stage}}(m,e,{readColor:v,readStep:b});return w(t.next),t.pulseContextLabel&&f(e=>e+1),t.next})({mode:S.destination.mode,scope:S.destination.scope,destination:S.destination.value}):void 0;if(S.stage&&u(S.stage),"reject"===S.command&&h(e=>e+1),"apply"===S.command){let e=y.current?.element,n=t?{family:t.family,step:t.step,subproperty:t.subproperty}:void 0;return void(e&&x.current(e,n)?c(null):(c(S.session),e||h(e=>e+1)))}return void c(S.session)}let k=function(e,t,n){let r=t.toLowerCase(),i=()=>({handled:!0,next:e});if("a"===r||"d"===r||"ArrowLeft"===t||"ArrowRight"===t){let n="a"===r||"ArrowLeft"===t?-1:1;if("family"===e.stage){let t=function(e,t){let n=Yo.indexOf(e);return Yo[(n+t+Yo.length)%Yo.length]}(e.family,n),r="color"===t?$o:Ca(t,e.subproperty);return{handled:!0,next:{family:t,subproperty:r,step:"color"===t?Oo:wa(t,e.step,r),stage:e.stage}}}return"variant"===e.stage&&ma(e.family,e.subproperty)?{handled:!0,next:{...e,subproperty:Bo(e.subproperty,n),step:Fo}}:{handled:!0,next:{...e,step:Ma(e.family,e.step,n,e.subproperty)}}}if("q"===r||"e"===r){if("color"===e.family)return i();let t="q"===r?-1:1,o=function(e,t,n){let r=Sa(e),i="text"!==e&&"border"!==e||!ha(t)?ka(e,t):"color",o=r.indexOf(i);return r[(o+n+r.length)%r.length]}(e.family,e.subproperty,t);if(("text"===e.family||"border"===e.family)&&"color"===o){if("family"===e.stage)return{handled:!0,next:{...e,subproperty:"color",step:Fo}};let t=n.readColor(Na(e.family));return{handled:!0,next:{...e,subproperty:t?.name??$o,step:t?.step??Oo,stage:Ea(e.stage,e.family,o)}}}return{handled:!0,next:{...e,subproperty:o,step:n.readStep(e.family,o)??wa(e.family,e.step,o),stage:Ea(e.stage,e.family,o)}}}if("w"===r||"Enter"===t){if("family"===e.stage){if("color"===e.family){let t=n.readColor("background-color");return{handled:!0,next:{...e,subproperty:t?.name??$o,step:t?.step??Oo,stage:"variant"}}}if(("text"===e.family||"border"===e.family)&&"color"===e.subproperty){let t=n.readColor(Na(e.family));return{handled:!0,next:{...e,subproperty:t?.name??$o,step:t?.step??Oo,stage:"variant"}}}return{handled:!0,next:{...e,step:n.readStep(e.family,e.subproperty)??e.step,stage:"value"}}}return"variant"===e.stage?{handled:!0,next:{...e,step:wa(e.family,e.step,e.subproperty),stage:"value"}}:{handled:!0,next:e,command:"apply"}}return"s"===r?"value"===e.stage?{handled:!0,next:{...e,stage:ma(e.family,e.subproperty)?"variant":"family"}}:"variant"===e.stage?{handled:!0,next:{...e,subproperty:"text"===e.family?"color":e.subproperty,stage:"family"}}:i():"Escape"===t&&"family"!==e.stage?{handled:!0,stopPropagation:!0,next:{...e,subproperty:"variant"===e.stage&&"text"===e.family?"color":e.subproperty,stage:"value"===e.stage&&ma(e.family,e.subproperty)?"variant":"family"}}:{handled:!1,next:e}}(S.replayAsSteering&&S.restore?S.restore:m,e.key,{readColor:v,readStep:b});if(k.handled&&(e.preventDefault(),k.stopPropagation&&e.stopPropagation(),a(k.next.family),l(k.next.step),s(k.next.subproperty),u(k.next.stage),"apply"===k.command)){let e=y.current?.element;e?x.current(e):h(e=>e+1)}};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[e,x,t,m,y,o,v,b,f,d,p,a,c,h,u,l,s,i,n,r,g])}var Gd=u(d()),Zd=u(d());function Jd(e,t){let n=(0,Zd.useRef)(t);n.current=t;let{dragRef:r,pointerLockElementRef:i,replaceDrag:o,clearDrag:a,releasePointerLock:l}=e;(0,Zd.useEffect)(()=>{let e=(e,t)=>{let a=r.current;if(!a)return;let l=i.current,s=null!==l&&document.pointerLockElement===l?function(e,t,n){return{cursor:{x:zl(e.cursor.x+t.x,n.width),y:zl(e.cursor.y+t.y,n.height)},deltaX:e.deltaX+t.x,deltaY:e.deltaY+t.y}}(a,{x:e.movementX,y:e.movementY},{width:window.innerWidth,height:window.innerHeight}):{cursor:{x:e.clientX,y:e.clientY},deltaX:e.clientX-a.startX,deltaY:e.clientY-a.startY},u=function(e,t,n,r){let{deltaX:i,deltaY:o}=t;if("translate"===e.transformKind&&e.startTranslate){let n=function(e,t){if(!t||0===e.x&&0===e.y)return e;let n=Math.PI/4,r=Math.atan2(e.y,e.x),i=Math.round(r/n)*n,o=Math.hypot(e.x,e.y);return{x:Math.cos(i)*o,y:Math.sin(i)*o}}({x:i,y:o},r),a=Il("translate",e.startTranslate.x+n.x),l=Il("translate",e.startTranslate.y+n.y),s=Math.abs(n.x)>=Math.abs(n.y)?a:l;return{subproperty:"translate",step:s,drag:{...e,subproperty:"translate",step:s,translateSteps:{x:a,y:l},translateValue:`${4*Number(a)}px ${4*Number(l)}px`,hasMoved:e.hasMoved||Math.abs(i)>2||Math.abs(o)>2,cursor:t.cursor,deltaX:i,deltaY:o}}}let a=e.vector?function(e,t,n){return e*n.x+t*n.y}(i,o,e.vector):"x"===e.axis?i:o,l=e.startPixels+a*(e.direction??1),s="rotate"===e.transformKind?l:Math.max(0,l),u=e.side?jl(e.side,n):e.corner?Ll(e.corner,n):e.subproperty,c=e.transformKind?Il(e.transformKind,s):Al(e.family,u,s);return{subproperty:u,step:c,drag:{...e,subproperty:u,step:c,hasMoved:e.hasMoved||Math.abs(i)>2||Math.abs(o)>2,cursor:t.cursor,deltaX:i,deltaY:o}}}(a,s,t,e.shiftKey);n.current.onSelectionChange(u.subproperty,u.step),o(u.drag),n.current.onCursorChange(s.cursor)},t=()=>{n.current.onCancel(),a(),l()},s=t=>{r.current&&(t.preventDefault(),e(t,t.altKey||t.ctrlKey))},u=e=>{r.current&&(e.preventDefault(),((e,t)=>{let i=r.current;if(!i)return;let o=i.side?jl(i.side,e):i.corner?Ll(i.corner,e):i.subproperty;i.hasMoved&&n.current.onCommit(i,o,t),a(),l()})(e.altKey||e.ctrlKey,{x:e.clientX,y:e.clientY}))},c=e=>{"Escape"!==e.key||!r.current||(e.preventDefault(),e.stopPropagation(),t())},d=()=>{let e=i.current;e&&document.pointerLockElement!==e&&r.current&&t()};return window.addEventListener("pointermove",s,{passive:!1}),window.addEventListener("pointerup",u),window.addEventListener("pointercancel",t),window.addEventListener("keydown",c,!0),document.addEventListener("pointerlockchange",d),()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",t),window.removeEventListener("keydown",c,!0),document.removeEventListener("pointerlockchange",d),l()}},[a,r,i,l,o])}var ef=u(d()),tf=u(v());function nf(e){return e instanceof Element&&null!==e.closest("[data-popmelt-subject-label-action]")}var rf="__active_text_send_hint__";function of({historyPreview:e,bridgeUrl:t,steeringContextStorageKey:n,state:r,dispatch:i,onScreenshot:o,inFlightAnnotationIds:a,inFlightOrientationLabels:l,waitingApprovalJobIds:s,activeAnnotationIds:u,queuePositionMap:c,inFlightStyleSelectors:d,inFlightStyleSelectorJobIds:f,inFlightSelectorColors:p,modifiedElementThreadStates:h,dismissedThreadIds:m,onAttachImages:g,onRemoveImages:y,onCaptureInteractionFrame:x,onSend:v,onViewThread:b,onCloseThread:w,onArchiveThread:S,onDeleteSubmittedAnnotation:k,highlightedAnnotationIds:C,cycleFocusedAnnotationIds:E,onCanvasInteraction:M,focusedThreadAnnotationId:T,openThreadId:R,hasOpenThread:A=!1,externalCanvasRef:I,toolbarRef:j,threadPanelElement:L,clearSignal:P=0,subjectRegistry:z,subjectRegistryReady:N=!0,onFocusTargetChange:_,onFocusActivity:D,showSteerChangeBadges:F=!0,onSteerPreviewChange:$,onSteerTargetClick:O,nativeFixtureInput:H=!1,steerControlBounds:W,canEditSteerText:B}){let V=(0,Tr.useContext)(Ct),{canvasRef:q,redrawAll:Y,resizeCanvas:U}=function(){let e=(0,si.useRef)(null),t=(0,si.useCallback)(()=>{let t=e.current;if(!t)return;let n=t.getContext("2d");n&&n.clearRect(0,0,t.width,t.height)},[]),n=(0,si.useCallback)((t,n,r,i=1,o=!1,a=!1)=>{let l=e.current;if(!l)return;let s=l.getContext("2d");if(!s)return;let u=t.status??(t.captured?"in_flight":"pending"),c="pending"===u?t.color:"#8c8c8c";switch(s.save(),s.globalAlpha=i,t.region&&function(e,t,n,r=!0){t.length<3||(e.save(),e.beginPath(),t.forEach((t,n)=>0===n?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)),e.closePath(),e.fillStyle=n,e.globalAlpha*=.07,e.fill("evenodd"),e.restore(),r&&(e.save(),e.strokeStyle=n,e.lineWidth=1,e.setLineDash([...Qe]),e.stroke(),e.restore()))}(s,t.region.points,c,!a),t.type){case"freehand":((e,t,n,r)=>{let i=pi(t);if(!i)return;let[o,a]=i;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.lineJoin="round",e.moveTo(o.x,o.y);for(let n=1;n<t.length-1;n++){let r=t[n],i=t[n+1];!r||!i||e.quadraticCurveTo(r.x,r.y,(r.x+i.x)/2,(r.y+i.y)/2)}e.lineTo(a.x,a.y),e.stroke()})(s,t.points,c,t.strokeWidth);break;case"line":((e,t,n,r)=>{let i=pi(t);if(!i)return;let[o,a]=i;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.moveTo(o.x,o.y),e.lineTo(a.x,a.y),e.stroke()})(s,t.points,c,t.strokeWidth);break;case"rectangle":((e,t,n,r)=>{let i=pi(t);if(!i)return;let[o,a]=i;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.lineJoin="round",e.strokeRect(Math.min(o.x,a.x),Math.min(o.y,a.y),Math.abs(a.x-o.x),Math.abs(a.y-o.y))})(s,t.points,c,t.strokeWidth);break;case"circle":((e,t,n,r)=>{let i=pi(t);if(!i)return;let[o,a]=i,l=(o.x+a.x)/2,s=(o.y+a.y)/2,u=Math.abs(a.x-o.x)/2,c=Math.abs(a.y-o.y)/2;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.ellipse(l,s,u,c,0,0,2*Math.PI),e.stroke()})(s,t.points,c,t.strokeWidth);break;case"text":if(t.text&&t.points[0]){let e="pending"===u?"#ffffff":"#dddddd";!function(e,t,n,r,i=12,o,a,l,s="#dddddd",u,c=!1){if(!n)return;let d=i*Dr,f=n.replace(/\\n/g," "),p=void 0!==o?o+". "+f:f;e.font=`${i}px ${ni}`,e.textBaseline="middle";let h=void 0!==a?Math.min(400,Math.max(60,window.innerWidth-a-16)):400,m=c?16:0,g=ii(e,p,Math.max(60,h-m)),y=m+e.measureText(g).width,x=ai(t,i,l,y+16);e.fillStyle=r;let v=x.x-8,b=x.y-4,w=y+16,S=d+8;e.beginPath(),e.roundRect(v,b,w,S,ei(u)),e.fill();let k=x.y+d/2;if(c){let t=x.x,n=k-6;e.strokeStyle=s,e.lineWidth=1.5,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(t+7.5,n+4),e.lineTo(t+10.5,n+6.5),e.lineTo(t+7.5,n+9),e.moveTo(t+1.5,n+1.5),e.lineTo(t+1.5,n+4.5),e.quadraticCurveTo(t+1.5,n+6.5,t+3.5,n+6.5),e.lineTo(t+10.5,n+6.5),e.stroke()}e.fillStyle=s,e.fillText(g,x.x+m,k)}(s,t.points[0],t.text,c,t.fontSize,n,t.points[0].x,r,e,Br(t)?"bottom-left":t.linkedAnchor,o)}}s.restore()},[]),r=(0,si.useCallback)((t,n)=>{let r=e.current;if(!r||t.points.length<2)return;let i=r.getContext("2d");if(i){if(i.fillStyle="#ffffff",i.strokeStyle=t.color,i.lineWidth=1.5,"line"===t.type)return void[t.points[0],t.points[t.points.length-1]].forEach(e=>{i.beginPath(),i.arc(e.x,e.y,n/2,0,2*Math.PI),i.fill(),i.stroke()});if("circle"===t.type){let e=t.points[0],r=t.points[t.points.length-1],o=Math.min(e.x,r.x),a=Math.max(e.x,r.x),l=Math.min(e.y,r.y),s=Math.max(e.y,r.y),u=(o+a)/2,c=(l+s)/2;return void[{x:u,y:l},{x:u,y:s},{x:o,y:c},{x:a,y:c}].forEach(e=>{i.beginPath(),i.rect(e.x-n/2,e.y-n/2,n,n),i.fill(),i.stroke()})}if("rectangle"===t.type||"freehand"===t.type){let e,r,o,a;if("freehand"===t.type)e=Math.min(...t.points.map(e=>e.x)),r=Math.max(...t.points.map(e=>e.x)),o=Math.min(...t.points.map(e=>e.y)),a=Math.max(...t.points.map(e=>e.y));else{let n=t.points[0],i=t.points[t.points.length-1];e=Math.min(n.x,i.x),r=Math.max(n.x,i.x),o=Math.min(n.y,i.y),a=Math.max(n.y,i.y)}[{x:e,y:o},{x:r,y:o},{x:e,y:a},{x:r,y:a}].forEach(e=>{i.beginPath(),i.rect(e.x-n/2,e.y-n/2,n,n),i.fill(),i.stroke()})}}},[]),i=(0,si.useCallback)((i,o,a,l=0,s=0,u,c,d,f,p,h=.5,m,g)=>{if(t(),i.forEach(e=>{let t={...e,points:hi(e.points,l,s),...e.region?{region:{...e.region,points:hi(e.region.points,l,s)}}:{}},r=u?.get(e.id),i=p?.has(e.id)??!1,o=!!c?.size,a=c?.has(e.id)??!1,y=o?a?1:.2:!f||f.has(e.id)||i?1:h;n(t,r,d,y,m?.has(e.id),g?.has(e.id))}),o&&o.length>0&&a){let t=e.current?.getContext("2d");for(let e of o){let n=i.find(t=>t.id===e);if(n){let e=p?.has(n.id)??!1,o=!!c?.size,d=c?.has(n.id)??!1,m=o?d?1:.2:!f||f.has(n.id)||e?1:h,g={...n,points:hi(n.points,l,s)};if(t?.save(),t&&(t.globalAlpha=m),r(g,a),t&&"text"!==n.type&&u&&(!n.groupId||!i.some(e=>e.groupId===n.groupId&&"text"===e.type))){let e=u.get(n.id);if(void 0!==e){let r=gi(g);if(r){let i="pending"===(n.status??(n.captured?"in_flight":"pending"))?n.color:"#999999";mi(t,r.x,r.y,e,i,a)}}}t?.restore()}}}},[t,n,r]),o=(0,si.useCallback)(()=>{let t=e.current;if(!t)return;let n=window.devicePixelRatio||1,r=window.visualViewport?.width??window.innerWidth,i=window.visualViewport?.height??window.innerHeight;t.width=r*n,t.height=i*n;let o=t.getContext("2d");o&&o.scale(n,n)},[]);return{canvasRef:e,clearCanvas:t,drawAnnotation:n,redrawAll:i,resizeCanvas:o}}(),[X,K]=(0,Tr.useState)(null),[Q,G]=(0,Tr.useState)(0),[Z,J]=(0,Tr.useState)(0),ee=(0,Tr.useCallback)(()=>J(e=>e+1),[]),te=Rt(),ne=(0,Tr.useCallback)(e=>{q.current=e,I&&(I.current=e),K(t=>t===e?t:e)},[I,q]);(0,Tr.useLayoutEffect)(()=>{if(!z||!N)return;let e=!1;for(let t of r.annotations)t.target&&(e=!0,!z.resolve(t.target)&&t.elements?.[0]&&z.restore(t.target,t.elements[0]));e&&G(e=>e+1)},[r.annotations,z,N]);let re=(0,Tr.useRef)(null),ie=(0,Tr.useRef)(0),[oe,ae]=(0,Tr.useState)(null),le=(0,Tr.useCallback)(()=>{let e=re.current;re.current=null,ae(null),e&&(e.session.cancel(),e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId))},[]),se=(0,Tr.useRef)(!1),[ue,ce]=(0,Tr.useState)(!1),de=(0,Tr.useRef)(null),fe=(0,Tr.useRef)(null),[pe,he]=(0,Tr.useState)(!1),me=(0,Tr.useRef)(Promise.resolve()),[ge,ye]=(0,Tr.useState)(0),[xe,ve]=(0,Tr.useState)(null),be=(0,Tr.useCallback)(()=>{if(!x)return Promise.resolve(null);let e=me.current.then(async()=>(await new Promise(e=>window.requestAnimationFrame(()=>e())),x()));return me.current=e.catch(()=>null),e},[x]),we=(0,Tr.useRef)(r.activeTool),Ce=(0,Tr.useRef)(void 0);(0,Tr.useEffect)(()=>()=>clearTimeout(Ce.current),[]);let Ee=(0,Tr.useRef)(null),Me=(0,Tr.useRef)(null),Te=(0,Tr.useRef)(null),Re=(0,Tr.useCallback)(()=>{de.current?.cancel(),de.current=null,fe.current=null,se.current=!1,Me.current=null,Te.current=null,ce(!1),he(!1),ye(0),ve(null)},[]),Ae=(0,Tr.useCallback)(()=>{le(),se.current=!0,we.current=r.activeTool,ce(!0)},[le,r.activeTool]);(0,Tr.useEffect)(()=>{se.current&&r.activeTool!==we.current&&Re()},[Re,r.activeTool]),(0,Tr.useEffect)(()=>{(!r.isAnnotating||"inspector"!==r.activeTool)&&le()},[le,r.activeTool,r.isAnnotating]),(0,Tr.useEffect)(()=>()=>{let e=re.current;re.current=null,e?.session.cancel()},[]);let{activeText:Ie,setActiveText:je,handleTextPaste:Le,removeActiveTextAttachment:Pe,releaseActiveTextAttachments:ze}=function({bridgeUrl:e,annotations:t,persist:n=!0}){let[r,i]=(0,Pr.useState)(()=>n?function(){if(typeof window>"u")return null;try{let e=window.localStorage.getItem(zr),t=e?JSON.parse(e):null;return"lasso"!==t?.region?.kind||t.domEdit?t:{...t,fontSize:12,linkedAnchor:t.linkedAnchor??"bottom-left"}}catch{return null}}():null);(0,Pr.useEffect)(()=>{if(!r||r.domEdit)return;let e=t.find(e=>e.id===r.id&&"pending"!==(e.status??(e.captured?"in_flight":"pending")));!e||e.text!==r.text||r.images?.length||JSON.stringify(e.attachments??[])!==JSON.stringify(r.attachments??[])||JSON.stringify(e.interactionEpisode??null)!==JSON.stringify(r.interactionEpisode??null)||i(e=>e===r?null:e)},[r,t]),(0,Pr.useEffect)(()=>{n&&(r&&!r.domEdit?window.localStorage.setItem(zr,JSON.stringify(r)):window.localStorage.removeItem(zr))},[r,n]),(0,Pr.useEffect)(()=>{let t=r?.attachments?.map(e=>e.id)??[];!e||0===t.length||async function(e,t){0!==t.length&&await ke(`${e}/draft-attachments/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:t})},5e3)}(e,t).catch(()=>{})},[r?.attachments,e]);let o=(0,Pr.useCallback)(t=>{!e||!t?.length||Promise.all(t.map(t=>Se(e,t.id).catch(()=>{})))},[e]),a=(0,Pr.useCallback)(async n=>{if(!r||r.domEdit)return;let o=function(e){return function(e){let t=e.replace(/^\\uFEFF/,"").trim().replace(/^<\\?xml[\\s\\S]*?\\?>\\s*/i,"").replace(/^(?:\x3c!--[\\s\\S]*?--\x3e\\s*)+/i,"").replace(/^<!doctype\\s+svg[\\s\\S]*?>\\s*/i,"");return/^<svg(?:\\s|>)[\\s\\S]*<\\/svg>\\s*$/i.test(t)}(e)?{blob:new Blob([e],{type:"image/svg+xml"}),kind:"svg",name:"figma-selection.svg"}:e.length>=8192?{blob:new Blob([e],{type:"text/plain"}),kind:"text",name:"pasted-context.txt"}:null}(n.clipboardData.getData("text/plain"));if(o){if(n.preventDefault(),!e)return;if(o.blob.size>2097152)return void console.warn("[Popmelt] Pasted attachment exceeds the 2 MB draft limit.");try{let n=r.groupId?t.find(e=>e.groupId===r.groupId&&"text"!==e.type)?.id??r.id:r.id,a=await async function(e,t,n){let r=new URLSearchParams({annotationId:t,kind:n.kind,name:n.name}),i=await ke(`${e}/draft-attachments?${r}`,{method:"POST",headers:{"Content-Type":n.blob.type},body:n.blob},15e3);if(!i.ok)throw new Error((await i.json().catch(()=>null))?.error||`Bridge returned ${i.status}`);return(await i.json()).attachment}(e,n,o);i(e=>e?.id===r.id?{...e,attachments:[...e.attachments??[],a]}:e)}catch(e){console.error("[Popmelt] Failed to stage pasted attachment:",e)}return}let a=n.clipboardData.items,l=[];for(let e=0;e<a.length;e+=1){let t=a[e];if(!t.type.startsWith("image/"))continue;let n=t.getAsFile();n&&l.push(n)}0!==l.length&&(n.preventDefault(),i(e=>e?{...e,images:[...e.images??[],...l]}:null))},[r,t,e]),l=(0,Pr.useCallback)(t=>{i(e=>e&&{...e,attachments:e.attachments?.filter(e=>e.id!==t)}),e&&Se(e,t).catch(()=>{})},[e]);return{activeText:r,setActiveText:i,handleTextPaste:a,removeActiveTextAttachment:l,releaseActiveTextAttachments:o}}({persist:!H,bridgeUrl:t,annotations:r.annotations}),[Ne,_e]=(0,Tr.useState)(null),[De,Fe]=(0,Tr.useState)(null),[$e,Oe]=(0,Tr.useState)(null),[He,We]=(0,Tr.useState)(0),Be=(0,Tr.useRef)(null),Ve=(0,Tr.useRef)(null),qe=(0,Tr.useRef)(null),[Ye,Ue]=(0,Tr.useState)(null),[Ze,et]=(0,Tr.useState)(null),tt=(0,Tr.useRef)(void 0);void 0===tt.current&&(tt.current=n&&typeof window<"u"?function(e,t){try{let n=e.getItem(t);if(!n)return null;let r=JSON.parse(n);return _c(r)&&1===r.version?function(e){let t=$c(e);if(!t||!_c(e))return null;if(null===e.query)return{...t,query:null};let n=function(e){if(!_c(e)||"string"!=typeof e.query||!Array.isArray(e.segments)||!e.segments.every(e=>"string"==typeof e))return null;let t=Oc(e.scope),n=$c(e.origin);if(!t||!n||!Array.isArray(e.history))return null;let r,i=[];for(let t of e.history){if(!_c(t))return null;let e=Oc(t.scope),n=$c(t.snapshot);if(!e||!n)return null;i.push({scope:e,snapshot:n})}if(void 0!==e.segmentOrigin){let t=$c(e.segmentOrigin);if(!t)return null;r=t}return{query:e.query,segments:e.segments,scope:t,origin:n,...r?{segmentOrigin:r}:{},history:i}}(e.query);return n?{...t,query:n}:null}(r.context):null}catch{return null}}(window.localStorage,n):null);let nt=tt.current,[it,st]=(0,Tr.useState)(()=>nt?.family??"padding"),[ut,ct]=(0,Tr.useState)(()=>nt?.step??4),[dt,ft]=(0,Tr.useState)(()=>nt?.subproperty??"all"),[pt,gt]=(0,Tr.useState)(()=>nt?.stage??"family"),[yt,xt]=(0,Tr.useState)(null);!function(e,t){(0,ef.useEffect)(()=>{let n=n=>{if("touch"===n.pointerType)return;let r={x:n.clientX,y:n.clientY};e.current=r,t?.(r)};return window.addEventListener("pointermove",n,{capture:!0,passive:!0}),()=>window.removeEventListener("pointermove",n,{capture:!0})},[e,t])}(Ve,pe?ve:r.isAnnotating&&"sticker"===r.activeTool?xt:void 0);let[vt,bt]=(0,Tr.useState)(null),wt=(0,Tr.useCallback)(e=>{bt({id:performance.now(),nativeReady:!1,tool:e})},[]),[St,kt]=(0,Tr.useState)(0),[Et,Mt]=(0,Tr.useState)(0),[Tt,At]=(0,Tr.useState)(0),[It,jt]=(0,Tr.useState)(0),[Lt,Pt]=(0,Tr.useState)(!1),[_t,Dt]=(0,Tr.useState)(0),[Ft,Ht]=(0,Tr.useState)(()=>nt?.query??null);(0,Tr.useEffect)(()=>{!n||typeof window>"u"||function(e,t,n){try{e.setItem(t,JSON.stringify({version:1,context:n}))}catch{}}(window.localStorage,n,{family:it,step:ut,subproperty:dt,stage:pt,query:Ft})},[n,it,Ft,pt,ut,dt]);let Vt=(0,Tr.useRef)(r.activeTool),qt=(0,Tr.useRef)(!1),Yt=(0,Tr.useRef)(()=>!1),en=(0,Tr.useRef)(null),tn=(0,Tr.useRef)(null);(0,Tr.useLayoutEffect)(()=>{let e=en.current;$&&tn.current!==e&&(tn.current=e,$(e))},[_t,$]);let rn=(0,Tr.useRef)(null),on=(0,Tr.useRef)(r.styleModifications),an=(0,Tr.useRef)(null),ln=(0,Tr.useRef)(null),sn=(0,Tr.useRef)(null),un=(0,Tr.useRef)(null),cn=(0,Tr.useCallback)(()=>{null!==un.current&&(cancelAnimationFrame(un.current),un.current=null)},[]),dn=(0,Tr.useCallback)(()=>{if(cn(),!V)return;let e=performance.now()+100,t=()=>{!function(e){if(e)for(let t of e.activeDeclarations)Vc(e.element,t)}(en.current);let n=an.current;n&&en.current?.element===n.element&&(n.renderedQuad=al(n.element,n.layoutQuad)),Dt(e=>e+1),performance.now()<e?un.current=requestAnimationFrame(t):un.current=null};un.current=requestAnimationFrame(t)},[cn,V]);(0,Tr.useEffect)(()=>(V?en.current&&dn():cn(),cn),[V,dn,cn]);let fn=(0,Tr.useCallback)(()=>{cn();let e=en.current;e&&(Yc(e),en.current=null,rn.current=null,Dt(e=>e+1))},[cn]),{handleShakePointerMove:pn,pendingShakeToolTransitionRef:hn}=function({activeTool:e,isAnnotating:t,clearStickerPreview:n,dispatch:r,setStickerCursor:i,startCursorSwitchPulse:o}){let a=(0,zd.useRef)(new Nd),l=(0,zd.useRef)(null);return{handleShakePointerMove:(0,zd.useCallback)(({isManipulating:s,isTouchEvent:u,viewportPoint:c})=>{if(u||s||!t||"inspector"!==e&&"sticker"!==e||!a.current.push({...c,time:performance.now()}))return!1;let d="sticker"===e?"inspector":"sticker";return l.current={from:e,to:d},o(d),"sticker"===d?i(c):n(),r({type:"SET_TOOL",payload:d}),!0},[e,n,r,t,i,o]),pendingShakeToolTransitionRef:l}}({activeTool:r.activeTool,isAnnotating:r.isAnnotating,clearStickerPreview:fn,dispatch:i,setStickerCursor:xt,startCursorSwitchPulse:wt});(0,Tr.useLayoutEffect)(()=>{let e=on.current,t=r.styleModifications;on.current=t,e!==t&&en.current&&(cn(),function(e,t,n){e&&(Yc(e),ur(t),sr(n))}(en.current,e,t),en.current=null,rn.current=null,an.current=null,Dt(e=>e+1))},[r.styleModifications,cn]),(0,Tr.useLayoutEffect)(()=>{Hc(r.activeTool,r.isAnnotating)&&(fn(),ln.current=null,sn.current=null)},[fn,r.activeTool,r.isAnnotating]);let mn=(0,Tr.useCallback)(()=>{gt("family"),xt(null),Ht(null)},[]);(0,Tr.useLayoutEffect)(()=>{let e=Vt.current,t=r.activeTool,n=hn.current,i=n?.from===e&&n.to===t;hn.current=null,Vt.current=t;let o=function(e,t,n,r){return e===t?{preservedAway:r,shouldReset:!1}:n&&("sticker"===e&&"inspector"===t||"inspector"===e&&"sticker"===t)?{preservedAway:"inspector"===t,shouldReset:!1}:{preservedAway:!1,shouldReset:r||"sticker"===e||"sticker"===t}}(e,t,i,qt.current);qt.current=o.preservedAway,o.shouldReset&&mn()},[hn,mn,r.activeTool]),(0,Tr.useLayoutEffect)(()=>{r.isAnnotating||(qt.current=!1,mn())},[mn,r.isAnnotating]);let gn=(0,Tr.useCallback)((e,t)=>{if(fn(),!Ye)return null;let n=window.getComputedStyle(Ye);return function(e,t,n="all"){let r=ka(e,n);if("color"===e||("text"===e||"border"===e)&&ha(r)){let e=function(e,t){let n=Vo(t);return n?Do.reduce((t,r)=>{let i=Vo(Ho[e][t]),o=Vo(Ho[e][r]),a=i.reduce((e,t,r)=>e+(t-n[r])**2,0);return o.reduce((e,t,r)=>e+(t-n[r])**2,0)<a?r:t}):null}(r,t[0]??"");if(null===e)return null;let n=Wo(r,e);return t.every(e=>qo(e,n))?e:null}if("text"===e){if("line-height"===r&&"normal"===(t[0]??"").trim().toLowerCase())return"normal";if("line-height"===r){let n=ja(t[0]??"",e),r=ja(t[1]??"",e);return null===n||null===r||0===r?null:qa(ta,e=>Ba[e],n/r)}if("letter-spacing"===r){let n=(t[0]??"").trim().toLowerCase();if("normal"===n)return"normal";let r=ja(n,e),i=ja(t[1]??"",e);return null===r||null===i||0===i?null:qa(na,e=>Va[e],r/i)}return La(e,r,t[0]??"")}if("transform"===e||"opacity"===e||"stack"===e&&"gap"!==r)return La(e,r,t[0]??"");if("grid"===e&&"gap"!==r){let e=t[0]?.trim().split(/\\s+/).filter(Boolean).length??0;return ba("grid",r).includes(e)?e:null}let i=t.map(t=>ja(t,e));if(0===i.length||i.some(e=>null===e))return null;let o=i[0];if(!i.every(e=>Math.abs(e-o)<.01))return null;let a=ba(e,r).filter(e=>"number"==typeof e);return 0===a.length?null:a.reduce((t,n)=>Math.abs(Number.parseFloat(Da(e,n,r))-o)<Math.abs(Number.parseFloat(Da(e,t,r))-o)?n:t)}(e,Ia(e,t).map(e=>n.getPropertyValue(e)),t)},[fn,Ye]),xn=(0,Tr.useCallback)(e=>(fn(),Ye?function(e){let t=Vo(e);if(!t)return null;let n=null;for(let e of _o)for(let r of Do){let i=Vo(Ho[e][r]).reduce((e,n,r)=>e+(n-t[r])**2,0);(!n||i<n.distance)&&(n={name:e,step:r,distance:i})}return n&&{name:n.name,step:n.step}}(window.getComputedStyle(Ye).getPropertyValue(e)):null),[fn,Ye]);Qd({active:"sticker"===r.activeTool&&r.isAnnotating,family:it,step:ut,subproperty:dt,stage:pt,query:Ft,setFamily:st,setStep:ct,setSubproperty:ft,setStage:gt,setQuery:Ht,setCursor:xt,setContextLabelPulse:Mt,setDepthSnapPulse:At,setRejectPulse:jt,lastCursorRef:Ve,toolbarRef:j,previewRef:en,applyStickerRef:Yt,readColor:xn,readStep:gn});let[vn,bn]=(0,Tr.useState)(null),[Sn,En]=(0,Tr.useState)(null),[Rn,In]=(0,Tr.useState)(null),[jn,Pn]=(0,Tr.useState)(!1),zn=(0,Tr.useRef)({isDragging:!1,side:null,startX:0,startY:0,original:{top:0,right:0,bottom:0,left:0},element:null,elementInfo:null,selector:null,durableSelector:null}),Nn=(0,Tr.useRef)({isDragging:!1,hasMoved:!1,mode:"move",startX:0,startY:0,element:null,originalParent:null,originalIndex:-1,selector:null,durableSelector:null,elementInfo:null}),[_n,Fn]=(0,Tr.useState)(null),[$n,On]=(0,Tr.useState)(null),[Hn,Wn]=(0,Tr.useState)(null),[Bn,qn]=(0,Tr.useState)(null),Un=(0,Tr.useRef)({x:0,y:0}),[Kn,Qn]=(0,Tr.useState)({x:0,y:0}),Gn=(0,Tr.useRef)({isDragging:!1,hasMoved:!1,axis:null,startX:0,startY:0,originalRow:0,originalColumn:0,element:null,elementInfo:null,selector:null,durableSelector:null,isAuto:!1,originalJustifyContent:"",visualGap:0}),[Zn,Jn]=(0,Tr.useState)(null),[tr,nr]=(0,Tr.useState)(null),[rr,ir]=(0,Tr.useState)(null),[ar,lr]=(0,Tr.useState)(!1),[cr,dr]=(0,Tr.useState)(0),{swipeHint:fr,clearSwipeHint:pr}=function({enabled:e,dispatch:t,handCursorRef:n,setGapRefreshKey:r}){let[i,o]=(0,Vd.useState)(null),a=(0,Vd.useCallback)(()=>o(null),[]);return(0,Vd.useEffect)(()=>{let i=null,a=!1,l=null,s=null,u=null,c=null,d=0,f=(e,t)=>{let n=nn(e,t);for(;n&&n!==document.documentElement;){let e=window.getComputedStyle(n).display;if("flex"===e||"inline-flex"===e)return n;n=n.parentElement}return null},p=e=>{let t=window.getComputedStyle(e).flexDirection;return"column"===t||"column-reverse"===t?"vertical":"horizontal"},h=e=>{let t=e.getAttribute("data-pm");return t||(t=Math.random().toString(36).substring(2,8),e.setAttribute("data-pm",t)),{selector:`[data-pm="${t}"]`,durableSelector:$t(e)}},m=(e,t,n)=>{let r=f(t,n);o(r?{modifier:e,target:r}:null)},g=()=>{u=null,c=null,d=0,l=null,s=null,o(null)},y=t=>{if(!e)return;let r=n.current;"Shift"!==t.key||t.altKey?"Alt"===t.key&&!t.shiftKey&&m("alt",r.x,r.y):m("shift",r.x,r.y)},x=n=>{if(!e)return;let o=n.shiftKey&&!n.altKey,y=n.altKey&&!n.shiftKey;if(!o&&!y||0!==n.buttons)return void g();if(null===l&&(l=n.clientX,s=n.clientY,m(o?"shift":"alt",n.clientX,n.clientY)),a)return;null===u&&(u=n.clientX,c=n.clientY,d=0);let x=n.clientX-u,v=n.clientY-c,b=Math.abs(x)>=Math.abs(v)?x:v;if(Math.abs(b)>3){let e=b>0?1:-1;if(0!==d&&e!==d)return u=n.clientX,c=n.clientY,void(d=0);d=e}if(Math.abs(x)<20&&Math.abs(v)<20)return;let w=f(l,s);if(!w)return;let S=Math.abs(x)>=Math.abs(v)?"horizontal":"vertical",k=("horizontal"===S?x:v)>0?1:-1;u=null,c=null,d=0,o?((e,n,i)=>{let o=p(e);if(n===o){let n=window.getComputedStyle(e).justifyContent,r="normal"===n||"flex-start"===n||"start"===n?"flex-start":"flex-end"===n||"end"===n?"flex-end":"center"===n?"center":null;if(!r)return;let o=qd.indexOf(r)+i;if(o<0||o>=qd.length)return;let a=qd[o],{selector:l,durableSelector:s}=h(e);or(e,"justify-content",a),t({type:"MODIFY_STYLES_BATCH",payload:{selector:l,durableSelector:s,element:Jt(e),changes:[{property:"justify-content",original:n,modified:a}]}})}else{let n=window.getComputedStyle(e).flexDirection,r="horizontal"===o?"column":"row",{selector:i,durableSelector:a}=h(e);or(e,"flex-direction",r),t({type:"MODIFY_STYLES_BATCH",payload:{selector:i,durableSelector:a,element:Jt(e),changes:[{property:"flex-direction",original:n,modified:r}]}})}r(e=>e+1)})(w,S,k):((e,n,i)=>{if(n!==("horizontal"===p(e)?"vertical":"horizontal"))return;let o=window.getComputedStyle(e).alignItems,a="normal"===o||"stretch"===o||"flex-start"===o||"start"===o?"flex-start":"flex-end"===o||"end"===o?"flex-end":"center"===o?"center":null;if(!a)return;let l=Yd.indexOf(a)+i;if(l<0||l>=Yd.length)return;let s=Yd[l],{selector:u,durableSelector:c}=h(e);or(e,"align-items",s),t({type:"MODIFY_STYLES_BATCH",payload:{selector:u,durableSelector:c,element:Jt(e),changes:[{property:"align-items",original:o,modified:s}]}}),r(e=>e+1)})(w,S,k),a=!0,i&&clearTimeout(i),i=setTimeout(()=>{a=!1,i=null},300)},v=e=>{("Shift"===e.key||"Alt"===e.key)&&g()};return window.addEventListener("keydown",y),window.addEventListener("mousemove",x),window.addEventListener("mousedown",g),window.addEventListener("keyup",v),()=>{window.removeEventListener("keydown",y),window.removeEventListener("mousemove",x),window.removeEventListener("mousedown",g),window.removeEventListener("keyup",v),i&&clearTimeout(i)}},[t,e,n,r]),{swipeHint:i,clearSwipeHint:a}}({enabled:"hand"===r.activeTool&&r.isAnnotating,dispatch:i,handCursorRef:Un,setGapRefreshKey:dr}),hr=(0,Tr.useRef)({isDragging:!1,corner:null,startY:0,original:{"top-left":0,"top-right":0,"bottom-right":0,"bottom-left":0},maxRadius:0,element:null,elementInfo:null,selector:null,durableSelector:null}),[gr,yr]=(0,Tr.useState)(null),[xr,vr]=(0,Tr.useState)(null),[br,wr]=(0,Tr.useState)(null),Sr=(0,Tr.useRef)({isDragging:!1,property:null,startX:0,startY:0,originalFontSize:0,originalLineHeight:0,originalRatio:1.2,element:null,elementInfo:null,selector:null,durableSelector:null}),[Cr,Er]=(0,Tr.useState)(null),[Rr,jr]=(0,Tr.useState)(null),[Lr,Nr]=(0,Tr.useState)(null),Fr=function(){let e=(0,Mi.useRef)({shift:!1,cmd:!1});return(0,Mi.useEffect)(()=>{let t=t=>{"Shift"===t.key&&(e.current.shift=!0),("Meta"===t.key||"Control"===t.key)&&(e.current.cmd=!0)},n=t=>{"Shift"===t.key&&(e.current.shift=!1),("Meta"===t.key||"Control"===t.key)&&(e.current.cmd=!1)},r=()=>{e.current={shift:!1,cmd:!1}};return window.addEventListener("keydown",t,!0),window.addEventListener("keyup",n,!0),window.addEventListener("blur",r),()=>{window.removeEventListener("keydown",t,!0),window.removeEventListener("keyup",n,!0),window.removeEventListener("blur",r)}},[]),e}(),$r=(0,Tr.useRef)(p);$r.current=p;let Xr=(0,Tr.useCallback)(e=>{let t=$r.current;if(!t||0===t.size)return!1;for(let n of t.keys())try{if(mt(e,n))return!0}catch{}return!1},[]),{applySticker:Qr,beginSteerGapDrag:Gr,beginSteerRadiusDrag:di,beginSteerSpacingDrag:yi,beginSteerTransformDrag:xi,steerDrag:vi,steerDragRef:wi}=function({applyStickerRef:e,clearStickerPreview:t,dispatch:n,hoveredElement:r,lastCanvasCursorRef:i,setHoveredElement:o,setHoveredElementInfo:a,setStickerApplyPulse:l,setStickerCursor:s,setStickerRejectPulse:u,setStickerStep:c,setStickerSubproperty:d,stickerFamily:f,stickerStep:p,stickerSubproperty:h,transformDragHandoffRef:m,transformPreviewSuppressionRef:g,transformPreviewTargetRef:y}){let x=function(){let[e,t]=(0,Zd.useState)(null),n=(0,Zd.useRef)(e);n.current=e;let r=(0,Zd.useRef)(null),i=(0,Zd.useCallback)(e=>{let t=e.requestPointerLock;if("function"==typeof t){r.current=e;try{let n=t.call(e);n&&n.catch(()=>{r.current===e&&(r.current=null)})}catch{r.current=null}}},[]),o=(0,Zd.useCallback)((e,r)=>{n.current=e,t(e),i(r)},[i]),a=(0,Zd.useCallback)(e=>{n.current=e,t(e)},[]),l=(0,Zd.useCallback)(()=>{n.current=null,t(null)},[]),s=(0,Zd.useCallback)(()=>{let e=r.current;r.current=null,e&&document.pointerLockElement===e&&document.exitPointerLock()},[]);return{drag:e,dragRef:n,pointerLockElementRef:r,startDrag:o,replaceDrag:a,clearDrag:l,releasePointerLock:s}}(),{drag:v,dragRef:b,startDrag:w}=x,S=(0,Gd.useCallback)((e,r)=>{if(Dn(e))return u(e=>e+1),!1;t();let i=r?.family??f,o=r?.step??p,a=r?.subproperty??h;if(!lc(e,i,a))return u(e=>e+1),!1;let s="transform"===i&&"translate"===a&&r?.axisSteps?function(e,t,n){let r=e.ownerDocument.defaultView.getComputedStyle(e),i="translate",o=`${4*Number(t)}px ${4*Number(n)}px`,a={family:"transform",subproperty:"translate",step:t,axisSteps:{x:t,y:n}};return{alreadyApplied:r.getPropertyValue(i).trim()===o,changes:[{property:i,original:r.getPropertyValue(i).trim()||"none",modified:o,token:`translate-x-${t}-y-${n}`,sticker:a}]}}(e,r.axisSteps.x,r.axisSteps.y):function(e,t,n,r){let i=e.ownerDocument.defaultView.getComputedStyle(e),o=Aa(t,r),a=Da(t,n,r),l=Oa(t),s=Fa(t,r,n),u="border"===t&&!ma(t,r)&&"number"==typeof n&&n>0?za(r):null,c={family:t,subproperty:ka(t,r),step:n},d=[{property:o,original:i.getPropertyValue(o).trim()||"0px",modified:a,token:_a(t,n,r),sticker:c}];l&&d.unshift({property:"display",original:i.getPropertyValue("display").trim()||"block",modified:l,token:l,sticker:c});for(let e of s)d.push({property:e.property,original:i.getPropertyValue(e.property).trim(),modified:e.value,token:e.token,sticker:c});if(u){let e=i.getPropertyValue(u).trim();(!e||"none"===e)&&d.push({property:u,original:e||"none",modified:"solid",token:_a(t,n,r),sticker:c})}return{alreadyApplied:Pa(t,n,r,e=>i.getPropertyValue(e)),changes:d}}(e,i,o,a);if(s.alreadyApplied)return u(e=>e+1),!1;let c=Uu(e),d=$t(e);return function(e,t){for(let n of t.changes)or(e,n.property,n.modified)}(e,s),n({type:"MODIFY_STYLES_BATCH",payload:{selector:c,durableSelector:d,element:{...Jt(e),selector:d},changes:s.changes}}),l(e=>e+1),!0},[t,n,l,u,f,p,h]);e.current=S;let k=(0,Gd.useCallback)((e,n,i)=>{if(!(r instanceof HTMLElement))return;i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId),t();let o="margin"===e?Tn(r):Mn(r),a="left"===n||"right"===n?"x":"y",l=jl(n,i.altKey||i.ctrlKey),s="margin"===e,u="top"===n||"left"===n?s?-1:1:s?1:-1,f=Al(e,l,o[n]);d(l),c(f),w({element:r,family:e,subproperty:l,startX:i.clientX,startY:i.clientY,startPixels:o[n],deltaX:0,deltaY:0,direction:u,axis:a,step:f,hasMoved:!1,side:n,cursor:{x:i.clientX,y:i.clientY}},i.currentTarget)},[t,r,c,d,w]),C=(0,Gd.useCallback)((e,n)=>{if(!(r instanceof HTMLElement)||"stack"!==f&&"grid"!==f)return;n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),t();let i=kn(r),o="row"===e?i.row:i.column,a=Al(f,"gap",o);d("gap"),c(a),w({element:r,family:f,subproperty:"gap",startX:n.clientX,startY:n.clientY,startPixels:o,deltaX:0,deltaY:0,direction:1,axis:"row"===e?"y":"x",step:a,hasMoved:!1,gapAxis:e,cursor:{x:n.clientX,y:n.clientY}},n.currentTarget)},[t,r,c,d,w,f]),E=(0,Gd.useCallback)((e,n)=>{if(!(r instanceof HTMLElement))return;n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),t();let i=Ll(e,n.altKey||n.ctrlKey),o=An(r)[e],a=Al("radius",i,o);d(i),c(a),w({element:r,family:"radius",subproperty:i,startX:n.clientX,startY:n.clientY,startPixels:o,deltaX:0,deltaY:0,vector:Pl(e),step:a,hasMoved:!1,corner:e,cursor:{x:n.clientX,y:n.clientY}},n.currentTarget)},[t,r,c,d,w]),M=(0,Gd.useCallback)((e,n,i,o)=>{if(!wn(r))return;i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId);let a=window.getComputedStyle(r).getPropertyValue(e).trim(),l="translate"===e?Ml(a):void 0,s="scale"===e?100*(Number.parseFloat(a)||1):"translate"===e?l.x:Number.parseFloat(a)||0,u=Il(e,s),f=ll(r),p=al(r,f),h="scale"===e&&n?function(e,t){let n=vl(e);return El({x:e[t].x-n.x,y:e[t].y-n.y})}(p,n):"rotate"===e?function(e,t){let n=vl(e),{handle:r}=bl(e,28,t),i=El({x:r.x-n.x,y:r.y-n.y});return{x:-i.y,y:i.x}}(p,o??wl(p,20).side):void 0,y=l?{x:Il("translate",l.x),y:Il("translate",l.y)}:void 0;g.current=null,m.current=null,t(),d(e),c(u),w({element:r,family:"transform",subproperty:e,startX:i.clientX,startY:i.clientY,startPixels:s,deltaX:0,deltaY:0,direction:1,vector:h,step:u,hasMoved:!1,transformKind:e,transformCorner:n??void 0,startTranslate:l,translateSteps:y,translateValue:l?`${l.x}px ${l.y}px`:void 0,ghostQuad:p,cursor:{x:i.clientX,y:i.clientY}},i.currentTarget)},[t,r,c,d,w,m,g]);return Jd(x,{onSelectionChange:(0,Gd.useCallback)((e,t)=>{d(e),c(t)},[c,d]),onCursorChange:(0,Gd.useCallback)(e=>{i.current=e,s(e)},[i,s]),onCommit:(0,Gd.useCallback)((t,n,r)=>{e.current(t.element,{family:t.family,step:t.step,subproperty:n,axisSteps:t.translateSteps}),"transform"===t.family&&(g.current={element:t.element,subproperty:t.subproperty,step:t.step},m.current={element:t.element,releasePoint:r},y.current=null,o(t.element),a(Jt(t.element)))},[e,o,a,m,g,y]),onCancel:(0,Gd.useCallback)(()=>{t(),g.current=null,m.current=null},[t,m,g])}),{applySticker:S,beginSteerGapDrag:C,beginSteerRadiusDrag:E,beginSteerSpacingDrag:k,beginSteerTransformDrag:M,steerDrag:v,steerDragRef:b}}({applyStickerRef:Yt,clearStickerPreview:fn,dispatch:i,hoveredElement:Ye,lastCanvasCursorRef:Ve,setHoveredElement:Ue,setHoveredElementInfo:et,setStickerApplyPulse:kt,setStickerCursor:xt,setStickerRejectPulse:jt,setStickerStep:ct,setStickerSubproperty:ft,stickerFamily:it,stickerStep:ut,stickerSubproperty:dt,transformDragHandoffRef:sn,transformPreviewSuppressionRef:ln,transformPreviewTargetRef:an});(0,Tr.useEffect)(()=>{Pt(!1);let e="transform"===vi?.family?vi.element:Ye;if(Hc(r.activeTool,r.isAnnotating)||"value"!==pt||!lc(e,it,dt)||Dn(e))return an.current=null,void fn();let t={element:e,family:it,step:ut,subproperty:dt,valueOverride:"translate"===vi?.transformKind?vi.translateValue:void 0},n=ln.current,i="transform"===it&&n?.element===e&&n.subproperty===dt&&n.step===ut;if(n&&!i&&(ln.current=null),i){if(fn(),an.current?.element!==e){let{top:t,right:n,bottom:r,left:i}=e.getBoundingClientRect(),o=ll(e);an.current={element:e,bounds:{top:t,right:n,bottom:r,left:i},layoutQuad:o,renderedQuad:al(e,o)},Dt(e=>e+1)}return}if(en.current&&function(e,t){return e?.element===t.element&&e.family===t.family&&e.step===t.step&&e.subproperty===t.subproperty&&e.valueOverride===t.valueOverride}(rn.current,t))return;if("transform"===it){if(an.current?.element!==e){Yc(en.current),en.current=null,rn.current=null;let{top:t,right:n,bottom:r,left:i}=e.getBoundingClientRect(),o=ll(e);an.current={element:e,bounds:{top:t,right:n,bottom:r,left:i},layoutQuad:o,renderedQuad:al(e,o)}}}else an.current=null;let o=function(e,t,n,r,i=null,o){i&&i.element!==e&&(Yc(i),i=null);let a=window.getComputedStyle(e),l=Aa(t,r),s=o?a.getPropertyValue(l).trim()===o:Pa(t,n,r,e=>a.getPropertyValue(e)),u=Oa(t),c=Fa(t,r,n),d="border"===t&&!ma(t,r)&&"number"==typeof n&&n>0?za(r):null,f=[l,...u?["display"]:[],...c.map(e=>e.property),...d?[d]:[]],p=[...new Set(f)],h=new Set([...p,"transition"]),m=new Map(i?.declarations.map(e=>[e.property,e])??[]);for(let t of m.values())h.has(t.property)||Vc(e,t);let g=[...h].map(t=>m.get(t)??qc(e,t)),y=p.filter(e=>!Wc.has(e));(function(e,t){er.set(e,new Set(t))})(e,function(e){let t=new Set(e);for(let n of e){if("padding"===n||n.startsWith("padding-")){t.add("padding");for(let e of["top","right","bottom","left"])t.add(`padding-${e}`)}if("margin"===n||n.startsWith("margin-")){t.add("margin");for(let e of["top","right","bottom","left"])t.add(`margin-${e}`)}if("border-radius"===n||/border-.+-radius/.test(n)){t.add("border-radius");for(let e of["top-left","top-right","bottom-right","bottom-left"])t.add(`border-${e}-radius`)}if("border-width"===n||/border-.+-width/.test(n)){t.add("border-width");for(let e of["top","right","bottom","left"])t.add(`border-${e}-width`)}if("border-color"===n||/border-.+-color/.test(n)){t.add("border-color");for(let e of["top","right","bottom","left"])t.add(`border-${e}-color`)}("gap"===n||"row-gap"===n||"column-gap"===n)&&(t.add("gap"),t.add("row-gap"),t.add("column-gap"))}return t}(p)),y.length>0&&or(e,"transition",y.map(e=>`${e} 100ms ease-out`).join(", ")),u&&or(e,"display",u);for(let t of c)or(e,t.property,t.value);if(or(e,l,o??Da(t,n,r)),d){let t=window.getComputedStyle(e).getPropertyValue(d).trim();(!t||"none"===t)&&or(e,d,"solid")}return{preview:{element:e,declarations:g,activeDeclarations:[...h].map(t=>qc(e,t))},stepUnavailable:s}}(e,it,ut,dt,en.current,t.valueOverride);en.current=o.preview,rn.current=t,Pt(o.stepUnavailable),Dt(e=>e+1),dn()},[fn,Ye,r.activeTool,r.isAnnotating,vi?.element,vi?.family,vi?.transformKind,vi?.translateValue,it,pt,ut,dt,dn]),(0,Tr.useEffect)(()=>()=>{cn(),Yc(en.current),en.current=null,rn.current=null,an.current=null,ln.current=null,sn.current=null},[cn]);let Si=(0,Tr.useCallback)(()=>{ln.current=null,sn.current=null,Ue(null),et(null),Fn(null),On(null),Wn(null),Jn(null),nr(null),lr(!1),yr(null),vr(null),Er(null),jr(null),pr()},[pr]),ki=Ie&&!Ie.domEdit?Ie?.id:null,Ci=$e?`${$e.target.adapter}:${$e.target.key}`:null,_i=ki??Ci;(0,Tr.useEffect)(()=>{_i&&Si()},[_i,Si]);let Di=(0,Tr.useCallback)(e=>{bn(e),e&&Si()},[Si]),Fi=(0,Tr.useCallback)(e=>{En(e),e&&Si()},[Si]),$i=(0,Tr.useCallback)((e,t)=>{In(t?.length?{ownerId:e,annotationIds:t}:null),t?.length&&Si()},[Si]),Oi=(0,Tr.useCallback)(e=>{Pn(e),e&&Si()},[Si]),Wi=(0,Tr.useCallback)((e,t)=>{fn();let n=Wt(e);lc(n,t.family,t.subproperty)&&(i({type:"SELECT_ANNOTATION",payload:{id:null}}),i({type:"SET_TOOL",payload:"sticker"}),st(t.family),ft(t.subproperty),ct(t.step),gt("value"),Ue(n),et(Jt(n)),Ve.current&&xt(Ve.current))},[fn,i]),Bi=(0,Tr.useCallback)((e,t)=>{fn(),Si(),En(null),i({type:"CLEAR_STICKER",payload:{selector:e,sticker:t}})},[Si,fn,i]),Vi=(0,Tr.useCallback)(e=>{if(!b)return;b(e);let t=0,n=()=>{let e=document.querySelector("[data-popmelt-shadow-host]")?.shadowRoot?.querySelector("[data-popmelt-reply]");if(e)return e.focus(),void e.setSelectionRange(e.value.length,e.value.length);t+=1,t<6&&requestAnimationFrame(n)};requestAnimationFrame(n)},[b]),qi=(0,Tr.useRef)(r);qi.current=r;let Yi=Ei({annotations:r.annotations,currentPathname:te,dispatch:i,stateRef:qi,styleModifications:r.styleModifications,subjectRegistry:z,toolbarRef:j,onTargetResolutionChange:ee}),Ui=(0,Tr.useRef)(Ie);Ui.current=Ie;let Xi=(0,Tr.useRef)(Ie);(0,Tr.useEffect)(()=>{let e=!1,t=t=>{if(e=2===t.button&&t.composedPath().some(e=>e instanceof Element&&e.hasAttribute("data-popmelt-shadow-host")),Xi.current=null,2!==t.button||e)return;let n=Ui.current;Xi.current=vc(n)?n:null},n=t=>{e&&2===t.button&&t.composedPath()[0]===q.current&&(t.preventDefault(),t.stopPropagation()),e=!1};return window.addEventListener("pointerdown",t,!0),window.addEventListener("contextmenu",n,!0),()=>{window.removeEventListener("pointerdown",t,!0),window.removeEventListener("contextmenu",n,!0)}},[q]),function(e,t){let n=(0,Fd.useContext)(Ct),r=e?.domEdit?.textNode;(0,Fd.useEffect)(()=>{if(!n||!r)return;let e=null,i=()=>{t(e=>{if(!e?.domEdit)return e;let{textNode:t,targetElement:n,segments:r,singleTextNode:i,rect:o,boundaryRect:a,boundaryRects:l,flowRect:s,firstLineIndent:u}=e.domEdit;if(!t.isConnected||!n.isConnected||!at(n.ownerDocument))return null;let c=ot(n).getComputedStyle(n),d=Vn(r,n,c,i),{textRect:f,boundaryRect:p,boundaryRects:h,flowRect:m,firstLineIndent:g}=d;if(Yn(o,f)&&Yn(a,p)&&function(e,t){return e.length===t.length&&e.every((e,n)=>Yn(e,t[n]))}(l,h)&&function(e,t){return e&&t?Yn(e,t):e===t}(s,m)&&Math.abs(u-g)<.5)return e;let y=Vu(n),x=(parseFloat(c.fontSize)||12)*y,v=e=>e?.endsWith("px")?parseFloat(e)*y+"px":e;return{...e,fontSize:x,point:{x:f.left+window.scrollX,y:f.top+window.scrollY},domEdit:{...e.domEdit,wrapsText:i?h.length>1:e.domEdit.wrapsText,rect:f,boundaryRect:p,boundaryRects:h,flowRect:m,firstLineIndent:g,lineHeight:"normal"===c.lineHeight?1.2*x+"px":v(c.lineHeight),letterSpacing:v(c.letterSpacing),wordSpacing:v(c.wordSpacing)}}}),e=window.requestAnimationFrame(i)};return e=window.requestAnimationFrame(i),()=>{null!==e&&window.cancelAnimationFrame(e)}},[n,r,t])}(Ie,je);let{cursorPosRef:Ki,inputRef:Qi,lastPositionedTextId:Ji}=function({activeText:e,activeTextRef:t,canvasRef:n,visible:r}){let i=(0,$d.useContext)(Ct),o=(0,$d.useRef)(null),a=(0,$d.useRef)(null),l=(0,$d.useRef)(null),s=e?.id??null,u=e?.initialCaret;return(0,$d.useLayoutEffect)(()=>{if(!r||!i||void 0===u||!s||a.current===s)return;let e=o.current;e&&(e.focus({preventScroll:!0}),e.setSelectionRange(u,u),a.current=s)},[s,u,r,i]),(0,$d.useEffect)(()=>{if(!i)return;if(!s)return a.current=null,void(l.current=null);if(!r||!o.current)return void(a.current=null);let e=requestAnimationFrame(()=>{let e=o.current;if(!e||(e.focus(),a.current===s))return;a.current=s;let r=t.current;if(r){if(r.domEdit)return void e.setSelectionRange(r.initialCaret??0,r.initialCaret??e.value.length);if(null!==l.current){let t=Math.min(l.current,e.value.length);return void e.setSelectionRange(t,t)}if(!r.isNew&&r.clickPoint){let t=n.current?.getContext("2d");if(!t)return;t.font=`${r.fontSize}px ${ni}`;let i=function({text:e,fontSize:t,point:n,clickPoint:r,context:i}){let o=e.split("\\n"),a=t*Dr,l=Math.max(0,Math.min(o.length-1,Math.floor((r.y-n.y)/a))),s=o[l]??"",u=r.x-n.x,c=s.length;for(let e=0;e<=s.length;e+=1){let t=i.measureText(s.slice(0,e)).width;if(t<=u)continue;let n=e>0?i.measureText(s.slice(0,e-1)).width:0;c=Math.max(0,u-n<t-u?e-1:e);break}let d=c;for(let e=0;e<l;e+=1)d+=(o[e]?.length??0)+1;return d}({text:r.text,fontSize:r.fontSize,point:r.point,clickPoint:r.clickPoint,context:t});e.setSelectionRange(i,i)}}});return()=>cancelAnimationFrame(e)},[s,t,n,r,i]),{cursorPosRef:l,inputRef:o,lastPositionedTextId:a}}({activeText:Ie,activeTextRef:Ui,canvasRef:q,visible:r.isAnnotating}),eo=(0,Tr.useCallback)(()=>{window.requestAnimationFrame(()=>{Qi.current?.focus();let e=Qi.current?.value.length??0;Qi.current?.setSelectionRange(e,e)})},[Qi]),to=(0,Tr.useCallback)((e,t=Xi.current)=>{let n=Ui.current,r=z?.hitTest(e)??null,i=r?.element??nn(e.x,e.y,{allowBodyFallback:!0}),o=r?.target,a=[...qi.current.annotations].reverse().find(e=>"text"===e.type&&"pending"===(e.status??"pending")&&(o&&e.target?e.target.adapter===o.adapter&&e.target.key===o.key:!(!e.linkedSelector||!i||!Wr(e.linkedSelector,e.elements)?.contains(i)))),l=function(e){let t=e.activationDraft??e.activeDraft;if(vc(t))return{kind:"draft",value:t};let n=function(e,t,n){let r=[...n?[n]:[],...[...t].reverse()],i=new Set,o=[];for(let t of r){if(i.has(t))continue;i.add(t);let n=e.find(e=>e.id===t);n&&(o.push(n),n.groupId&&o.push(...e.filter(e=>e.id!==n.id&&e.groupId===n.groupId)))}return o}(e.annotations,e.selectedAnnotationIds,e.lastSelectedId).find(bc);return n?{kind:"annotation",value:n}:bc(e.annotationAtCursor)?{kind:"annotation",value:e.annotationAtCursor}:null}({activationDraft:t,activeDraft:n,annotations:qi.current.annotations,selectedAnnotationIds:qi.current.selectedAnnotationIds,lastSelectedId:qi.current.lastSelectedId,annotationAtCursor:a});if(Xi.current=null,!l||"inspector"!==qi.current.activeTool)return!1;let s=l.value;de.current?.cancel();let u=s.target&&z?z.resolve(s.target):null,c=u?.subject.sourceElement??(s.linkedSelector?Wt(s.linkedSelector):null);return fe.current={id:s.id,draft:"draft"===l.kind},de.current=function(e){let t=e.now??(()=>Date.now()),n=t(),r=[],i=null,o=0,a=!1,l=e.captureFrame?.().catch(()=>null)??Promise.resolve(null),s=[],u=null,c=()=>{if(window.clearTimeout(o),o=0,!i)return;let n=t(),a=i.captureResult?.()??hc(i.targetElement),u="input"===i.kind||"change"===i.kind||"submit"===i.kind||"scroll"===i.kind||"play"===i.kind||"pause"===i.kind||"seek"===i.kind,c={id:i.id,action:{kind:i.kind,label:i.label,...i.key?{key:i.key}:{},...i.target?{target:i.target}:{}},startedAt:i.startedAt,completedAt:n,outcome:u||i.changes.length>0||yc(i.target,a)?"changed":"no-observable-change",changes:i.changes,...a?{result:a}:{}};if(i=null,r.length<50&&(r.push(c),e.onStep?.(c),e.captureFrame)){let t=l,n=e.captureFrame().catch(()=>null);l=n,s.push(Promise.all([t,n]).then(([e,t])=>({step:c,before:e,after:t})))}},d=()=>{window.clearTimeout(o),o=window.setTimeout(c,180)},f=(o,a,l)=>{let{element:s,state:u}=a,f="input"===i?.kind&&"input"===o&&i.targetElement===s,p="click"===i?.kind&&("input"===o||"change"===o||"play"===o||"pause"===o||"seek"===o)&&i.targetElement===s;f||p||(c(),i={id:`episode-step-${n}-${r.length+1}`,kind:o,label:gc(o,s,u),...l?{key:l}:{},targetElement:s,target:u,captureResult:a.captureResult,startedAt:t(),changes:[]},e.onActionCountChange?.(r.length+1)),d()},p=new MutationObserver(e=>{if(i&&!a){for(let t of e){if(i.changes.length>=16)break;let e=(e,t)=>{if(!i||i.changes.length>=16)return;let n=hc(xc(t));!n||i.changes.some(t=>t.kind===e&&t.element.selector===n.selector&&t.element.tagName===n.tagName&&t.element.text===n.text)||i.changes.push({kind:e,element:n})};t.addedNodes.forEach(t=>e("added",t)),t.removedNodes.forEach(t=>e("removed",t)),("attributes"===t.type||"characterData"===t.type)&&e("updated",t.target)}d()}});return p.observe(document.documentElement,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["aria-expanded","aria-pressed","aria-selected","checked","class","disabled","hidden","open","poster","src","value"]}),{recordEvent(t){if(a)return;if("pointerdown"===t.type||"pointerup"===t.type){let n=t;if("pointerdown"===t.type&&0===n.button){let r=e.resolveEventTarget?.(t),i=r?.element??(t.target instanceof Element&&!Dn(t.target)?t.target:null),o=r?.state??hc(i);if(!o)return;return void(u={x:n.clientX,y:n.clientY,targetElement:i,target:o,captureResult:r?.captureResult})}if("pointerup"===t.type){let e=u;return u=null,void(e?.targetElement&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>4&&f("drag",{element:e.targetElement,state:e.target,captureResult:e.captureResult}))}}let n=function(e){return"click"===e.type?"click":"input"===e.type?"input":"change"===e.type?"change":"submit"===e.type?"submit":"keydown"===e.type?"keydown":"play"===e.type?"play":"pause"===e.type?"pause":"seeked"===e.type?"seek":null}(t);if(!n||t instanceof KeyboardEvent&&!function(e){return!(e.metaKey||e.ctrlKey||e.altKey)&&["Enter"," ","Escape","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key)}(t))return;let r=e.resolveEventTarget?.(t),i=r?.element??(t.target instanceof Element&&!Dn(t.target)?t.target:null);if(!i)return;let o=r?.state??hc(i);o&&f(n,{element:i,state:o,captureResult:r?.captureResult},t instanceof KeyboardEvent?t.key:void 0)},recordScroll(){if(!a){if("scroll"===i?.kind)return void d();f("scroll",{element:null,state:{tagName:"document",text:"page"}})}},hasActions:()=>null!==i||r.length>0,async finish(){a||c(),a=!0,p.disconnect(),window.clearTimeout(o);let i={version:1,startedAt:n,completedAt:t(),subject:e.subjectState??hc(e.subjectElement),steps:[...r]};if(0===r.length||0===s.length)return{episode:i,frames:[]};let l=await Promise.all(s),u=[],d=new Map,f=[],h=async e=>{if(!e)return;let t=await async function(e){let t=new Uint8Array(await e.arrayBuffer()),n=2166136261;for(let e of t)n^=e,n=Math.imul(n,16777619);return`${e.size.toString(36)}-${(n>>>0).toString(36)}`}(e),r=d.get(t);if(r)return r;let i=`episode-frame-${n}-${u.length+1}`;return d.set(t,i),f.push({id:i,imageIndex:u.length,fingerprint:t}),u.push(e),i};for(let e of l){let t=await h(e.before),n=await h(e.after);(t||n)&&(e.step.visuals={...t?{beforeFrameId:t}:{},...n?{afterFrameId:n}:{}})}return f.length>0&&(i.frames=f),{episode:i,frames:u}},cancel(){a=!0,i=null,u=null,p.disconnect(),window.clearTimeout(o)}}}({subjectElement:c,...u?{subjectState:mc(u)}:{},resolveEventTarget:e=>{if(!(e instanceof MouseEvent&&z))return;let t=z.hitTest({x:e.clientX,y:e.clientY});if(!t)return;let n=t.target;return{element:t.subject.sourceElement??null,state:mc(t),captureResult:()=>{let e=z.resolve(n);return e?mc(e):void 0}}},onActionCountChange:ye,captureFrame:x?be:void 0}),Si(),_e(null),bn(null),En(null),ye(0),ve(e),he(!0),Ae(),!0},[Si,be,Ae,x,z]),no=(0,Tr.useCallback)(async()=>{let e=de.current,t=fe.current;if(!e||!t||!e.hasActions())return;let{episode:n,frames:r}=await e.finish();if(de.current=null,t.draft)je(e=>{if(e?.id!==t.id)return e;let i=e.images?.length??0;return{...e,images:[...e.images??[],...r],interactionEpisode:cc(n,i)}});else{let e=qi.current.annotations.find(e=>e.id===t.id);if(e){let t=e.imageCount??0,o=cc(n,t);r.length>0&&g?.(e.id,r),i({type:"UPDATE_TEXT",payload:{id:e.id,text:e.text??"",imageCount:t+r.length,interactionEpisode:o}})}}Re(),t.draft&&eo()},[i,Re,eo,g,je]),ro=(0,Tr.useCallback)(e=>{let t=Ui.current;if(t?.id===e&&(je(t=>{if(t?.id!==e)return t;let n=new Set(t.interactionEpisode?.frames?.map(e=>e.imageIndex)??[]),r={...t};return delete r.interactionEpisode,n.size>0&&t.images&&(r.images=t.images.filter((e,t)=>!n.has(t))),r}),t.isNew))return;let n=qi.current.annotations.find(t=>t.id===e)?.interactionEpisode?.frames?.map(e=>e.imageIndex)??[];n.length>0&&y?.(e,n),i({type:"CLEAR_INTERACTION_EPISODE",payload:{id:e}})},[i,y,je]),io=(0,Tr.useCallback)(()=>{let e=fe.current?.draft;Re(),e&&eo()},[Re,eo]);(0,Tr.useEffect)(()=>{let e=e=>{if(!se.current)return;let t=e.metaKey||e.ctrlKey;if("Escape"===e.key&&t)return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),void(de.current?io():Re());"Enter"===e.key&&t&&de.current&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),no())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[io,Re,no]),(0,Tr.useEffect)(()=>{if(!pe)return;let e=e=>de.current?.recordEvent(e),t=()=>de.current?.recordScroll();return window.addEventListener("click",e,!0),window.addEventListener("pointerdown",e,!0),window.addEventListener("pointerup",e,!0),window.addEventListener("input",e,!0),window.addEventListener("change",e,!0),window.addEventListener("submit",e,!0),window.addEventListener("keydown",e,!0),window.addEventListener("play",e,!0),window.addEventListener("pause",e,!0),window.addEventListener("seeked",e,!0),window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("click",e,!0),window.removeEventListener("pointerdown",e,!0),window.removeEventListener("pointerup",e,!0),window.removeEventListener("input",e,!0),window.removeEventListener("change",e,!0),window.removeEventListener("submit",e,!0),window.removeEventListener("keydown",e,!0),window.removeEventListener("play",e,!0),window.removeEventListener("pause",e,!0),window.removeEventListener("seeked",e,!0),window.removeEventListener("scroll",t,!0)}},[pe]);let ao=(0,Tr.useRef)([]);(0,Tr.useRef)(o).current=o;let{dragState:lo,resizeState:co,setDragState:fo,setResizeState:ho}=function(){let[e,t]=(0,Ou.useState)(null),[n,r]=(0,Ou.useState)(null);return{dragState:e,resizeState:n,setDragState:t,setResizeState:r}}(),go=r.selectedAnnotationIds;ao.current=go;let xo=(0,Tr.useCallback)((e,t=!1)=>{i({type:"SELECT_ANNOTATION",payload:{id:e,addToSelection:t}})},[i]),vo=(0,Tr.useCallback)(()=>{i({type:"SELECT_ANNOTATION",payload:{id:null}})},[i]),bo=(0,Tr.useCallback)(e=>{let t=qi.current.annotations.find(t=>t.id===e);!t||!Hi(t,qi.current.annotations)||(i({type:"DELETE_ANNOTATION",payload:{id:e}}),Ui.current?.id===e&&(ze(Ui.current.attachments),je(null)),Si(),bn(null),En(null),In(null),Pn(!1),vo())},[Si,vo,i,ze,je]),wo=(0,Tr.useCallback)(e=>{let t=function(e,t,n){let r=e.filter(e=>!(e.captured||e.selector!==t||e.pathname&&e.pathname!==n));return r.length?{type:"MODIFY_TEXT_CONTENTS",payload:r.map(e=>({...e,modified:e.original}))}:null}(qi.current.textModifications,e,te);t&&(i(t),Si(),En(null),In(null),Pn(!1))},[te,i,Si]),So=(0,Tr.useRef)({x:window.scrollX,y:window.scrollY}),ko=(0,Tr.useRef)(null),[Co,Eo]=(0,Tr.useState)(So.current);(0,Tr.useEffect)(()=>{if(V)return U(),window.addEventListener("resize",U),window.visualViewport?.addEventListener("resize",U),()=>{window.removeEventListener("resize",U),window.visualViewport?.removeEventListener("resize",U)}},[U,V]),function({state:e,stateRef:t,activeTextRef:n,selectedIdsRef:r,dispatch:i,clearSelection:o,selectAnnotation:a,handHoveredElement:l,onArchiveThread:s,openThreadId:u,currentPathname:c,hasOpenThread:d}){let f=(0,Gc.useRef)([]),p=(0,Gc.useRef)(0),h=(0,Gc.useRef)(null);(0,Gc.useEffect)(()=>{let m=m=>{if("Escape"===m.key){if(m.defaultPrevented||m.repeat||n.current||d||dd(m))return;if(r.current.length>0)return m.preventDefault(),void o();let e=t.current;if(e.annotations.some(e=>"pending"===(e.status??"pending"))||e.styleModifications.some(e=>!e.captured)||e.textModifications.some(e=>!e.captured)||e.domModifications.some(e=>!e.captured)||e.spacingTokenChanges.some(e=>!e.captured)||e.spacingTokenMods.some(e=>!e.captured))return m.preventDefault(),void i({type:"DISCARD_DRAFT"})}if((m.metaKey||m.ctrlKey)&&"c"===m.key.toLowerCase()&&"hand"===e.activeTool&&l&&!n.current){if(Yu(l)){m.preventDefault();let e=Uu(l);h.current={source:l,sourceSelector:e,sourceDurableSelector:$t(l),sourceElement:{...Jt(l),selector:e}}}return}if((m.metaKey||m.ctrlKey)&&"v"===m.key.toLowerCase()&&"hand"===e.activeTool&&h.current&&!n.current){let e=h.current,t=l&&Yu(l)?l:e.source,n=t.parentElement;if(n){m.preventDefault();let r=$t(n),o=Uu(n),a=$t(t),l=Uu(t),s=Xu(t)+1,u=e.source.cloneNode(!0);if(u instanceof Element){Ku(u),Gu(n,u,s);let t=Uu(u),d=$t(u),f={...Jt(u),selector:t};i({type:"MODIFY_DOM_STRUCTURE",payload:{id:rd(),operation:"copy",selector:t,durableSelector:d,element:f,sourceSelector:e.sourceSelector,sourceDurableSelector:e.sourceDurableSelector,sourceElement:e.sourceElement,targetParentSelector:o,targetParentDurableSelector:r,targetIndex:s,referenceSelector:l,referenceDurableSelector:a,placement:"after",pathname:c}})}}return}if((m.metaKey||m.ctrlKey)&&"v"===m.key&&f.current.length>0&&!n.current){m.preventDefault(),p.current+=1;let e=20*p.current,t=f.current[0]?.groupId?Math.random().toString(36).substring(2,9):void 0,n=f.current.map(n=>({...n,id:Math.random().toString(36).substring(2,9),groupId:n.groupId?t:void 0,timestamp:Date.now(),points:n.points.map(t=>({x:t.x+e,y:t.y+e}))}));i({type:"PASTE_ANNOTATIONS",payload:{annotations:n}});let r=n.find(e=>"text"!==e.type)??n[0];return void(r&&a(r.id))}let g=r.current;if(!(n.current||dd(m)||"Delete"!==m.key&&"Backspace"!==m.key||m.metaKey||m.ctrlKey||m.altKey)){if(0===g.length&&!u)return;let e=fd(t.current.annotations,g,u);if(!s||0===e.length)return;m.preventDefault();for(let t of e)s(t);o()}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n,o,c,i,l,d,s,u,a,r,e.activeTool,t])}({state:r,stateRef:qi,activeTextRef:Ui,selectedIdsRef:ao,dispatch:i,clearSelection:vo,selectAnnotation:xo,handHoveredElement:_n,onArchiveThread:S,openThreadId:R,currentPathname:te,hasOpenThread:A});let{pageAnnotations:To,pageStyleModifications:Ao,pageTextModifications:Io,pendingBundleCount:Lo,pendingTextAnnotations:Po}=function({state:e,activeText:t,currentPathname:n,dismissedThreadIds:r,modifiedElementThreadStates:i}){let o=(0,Ti.useMemo)(()=>Ri(e.annotations,n,r),[e.annotations,n,r]),a=(0,Ti.useMemo)(()=>Ai(e.styleModifications,e.annotations,n,r,i),[e.annotations,e.styleModifications,n,r,i]),l=(0,Ti.useMemo)(()=>Ai(e.textModifications,e.annotations,n,r,i),[e.annotations,e.textModifications,n,r,i]),s=(0,Ti.useMemo)(()=>{let t=new Set,r=e=>!(e.captured||e.pathname&&e.pathname!==n);for(let n of e.styleModifications)r(n)&&!n.awaitingReview&&t.add(`element:${n.selector}`);for(let n of e.textModifications)r(n)&&t.add(`element:${n.selector}`);for(let n of e.domModifications)r(n)&&t.add(`element:${n.selector}`);for(let n of e.spacingTokenChanges)n.captured||t.add(`spacing:${n.tokenPath}`);for(let n of e.spacingTokenMods)n.captured||t.add(`spacing:${n.tokenPath}`);return t},[n,e.domModifications,e.spacingTokenChanges,e.spacingTokenMods,e.styleModifications,e.textModifications]),u=(0,Ti.useMemo)(()=>function(e,t,n=[]){let r=new Set(e.filter(e=>"pending"===(e.status??"pending")).map(e=>`annotation:${e.groupId||e.id}`));t?.isNew&&!t.domEdit&&(t.text.trim()||t.interactionEpisode?.steps.length)&&r.add(`annotation:${t.groupId||t.id}`);for(let e of n)r.add(`edit:${e}`);return r.size}(e.annotations,t,s),[e.annotations,t,s]);return{pageAnnotations:o,pageStyleModifications:a,pageTextModifications:l,pendingBundleCount:u,pendingTextAnnotations:(0,Ti.useMemo)(()=>e.annotations.filter(e=>"text"===e.type&&e.text&&"pending"===(e.status??"pending")).sort((e,t)=>t.timestamp-e.timestamp),[e.annotations])}}({state:r,activeText:Ie,currentPathname:te,dismissedThreadIds:m,modifiedElementThreadStates:h}),{sendHintAnchorId:No,setSendHintAnchorId:Fo}=function({activeText:e,activeTextAnchorId:t,hoveredElement:n,hoveredTextId:r,pendingTextAnnotations:i}){let[o,a]=(0,ji.useState)(null);return(0,ji.useEffect)(()=>{e&&!e.domEdit&&e.text.trim()?a(t):a(e=>e&&i.some(t=>t.id===e)?e:i[0]?.id??null)},[e,t,i]),(0,ji.useEffect)(()=>{if(!r)return;let e=i.find(e=>e.id===r);e&&a(e.id)},[r,i]),(0,ji.useEffect)(()=>{if(!n)return;let e=i.find(e=>{if(!e.linkedSelector)return!1;try{return mt(n,e.linkedSelector)}catch{return!1}});e&&a(e.id)},[n,i]),{sendHintAnchorId:o,setSendHintAnchorId:a}}({activeText:Ie,activeTextAnchorId:rf,hoveredElement:Ye,hoveredTextId:Ne,pendingTextAnnotations:Po}),{locationLabels:$o,tooltipAnnotationId:Oo,revealAnnotation:Bo}=function({annotations:e,annotationIds:t,badgeHoveredAnnotationId:n,hoveredTextId:r}){let i=(0,Ii.useMemo)(()=>{let n=new Map;for(let r of e){if(!t.has(r.id))continue;let e=Kt(r.elements);e&&n.set(r.id,e)}return n},[e,t]),o=[n,r].find(e=>e&&i.has(e))??null,[a,l]=(0,Ii.useState)(null);(0,Ii.useEffect)(()=>{if(l(null),!o)return;let e=window.setTimeout(()=>{l(o)},500);return()=>window.clearTimeout(e)},[o]);let s=(0,Ii.useCallback)(async e=>{let t=await async function(e,t){let n=function(e,t){return Bt(e)??Bt(t?.[0]?.selector)}(e,t);if(Qt(n))return n;let r=Xt(t)??(n?Ut(n):void 0);if(!r)return null;for(let e of r.steps){let t=Bt(e.triggerSelector);if(!(t instanceof HTMLElement))return null;if(!Gt(0,t,Bt(e.targetSelector))&&(t.click(),!await Zt(e.targetSelector)))return null}return Zt(e&&Bt(e)?e:t?.[0]?.selector)}(e.linkedSelector,e.elements);if(!t)return;let n=rt(t);(n.bottom<0||n.top>window.innerHeight)&&t.scrollIntoView({behavior:"smooth",block:"center"})},[]);return{locationLabels:i,tooltipAnnotationId:a,revealAnnotation:s}}({annotations:To,annotationIds:Yi,badgeHoveredAnnotationId:vn,hoveredTextId:Ne}),Yo=(0,Tr.useCallback)((e,t)=>{let n=qi.current.annotations.find(t=>t.id===e);n&&(xo(e),t&&Vi(t),Yi.has(e)&&Bo(n))},[Vi,Yi,Bo,xo]),{cycleSpotlightAnnotationIds:Uo,emphasizedAnnotationIds:Xo,hoverRestoredAnnotationIds:Ko,inactiveEmphasisOpacity:Qo,statusSpotlightAnnotationIds:Go}=function({annotations:e,isCreatingAnnotation:t,hoveredTextId:n,badgeHoveredAnnotationId:r,highlightedAnnotationIds:i,cycleFocusedAnnotationIds:o,hoveredElement:a}){let l=(0,_r.useMemo)(()=>{let n=e.filter(e=>"pending"===(e.status??"pending"));if(0===n.length&&!t)return null;let r=new Set(n.map(e=>e.id)),i=new Set(n.flatMap(e=>e.groupId?[e.groupId]:[])),o=new Set(n.flatMap(e=>e.threadId?[e.threadId]:[]));for(let t of e)(t.groupId&&i.has(t.groupId)||t.threadId&&o.has(t.threadId))&&r.add(t.id);return r},[e,t]),s=(0,_r.useMemo)(()=>{let t=new Set;if(n&&t.add(n),r&&t.add(r),i?.forEach(e=>t.add(e)),a)for(let n of e)if(n.linkedSelector)try{mt(a,n.linkedSelector)&&t.add(n.id)}catch{}return qr(e,t)},[e,n,r,i,a]),u=(0,_r.useMemo)(()=>i?qr(e,i):null,[e,i]),c=(0,_r.useMemo)(()=>o?qr(e,o):null,[e,o]);return{cycleSpotlightAnnotationIds:c,emphasizedAnnotationIds:u??c??l,hoverRestoredAnnotationIds:s,inactiveEmphasisOpacity:u||c?.2:.5,statusSpotlightAnnotationIds:u}}({annotations:To,isCreatingAnnotation:!(!Ie?.isNew||Ie.domEdit),hoveredTextId:Ne,badgeHoveredAnnotationId:vn,highlightedAnnotationIds:C,cycleFocusedAnnotationIds:E,hoveredElement:Ye}),Zo=function(e){let t=e?.getBoundingClientRect();return!t||typeof window>"u"?{}:t.top<window.innerHeight/2?{avoidTop:t.bottom+8,avoidLeft:t.left-8,avoidRight:t.right+8}:{avoidBottom:t.top-8,avoidLeft:t.left-8,avoidRight:t.right+8}}(V?j?.current:null),Jo=Zo.avoidTop,ea=Zo.avoidBottom,ra=Zo.avoidLeft,ia=Zo.avoidRight,oa=(0,Tr.useMemo)(()=>({avoidTop:Jo,avoidBottom:ea,avoidLeft:ra,avoidRight:ia}),[Jo,ea,ra,ia]),{supersededAnnotations:aa,stagedArtifactOrder:la,annotationGroupMap:sa,pageModificationNumberBySelector:ua}=function({state:e,pageAnnotations:t,pageStyleModifications:n,pageTextModifications:r}){let i=(0,Li.useMemo)(()=>function(e){let t=new Set,n=new Map;for(let t of e){if(!t.linkedSelector)continue;let e=n.get(t.linkedSelector)||[];e.push(t),n.set(t.linkedSelector,e)}let r=new Set,i=new Set;for(let e of n.values()){if(e.length<=1){e[0]?.groupId&&i.add(e[0].groupId);continue}e.sort((e,t)=>t.timestamp-e.timestamp);let n=e[0];n.groupId&&i.add(n.groupId);for(let n=1;n<e.length;n++){let i=e[n];t.add(i),i.groupId&&r.add(i.groupId)}}for(let n of e)n.groupId&&r.has(n.groupId)&&!i.has(n.groupId)&&t.add(n);return t}(e.annotations),[e.annotations]),o=(0,Li.useMemo)(()=>function({annotations:e,styleModifications:t,textModifications:n}){let r=new Map,i=0,o=new Map;for(let t of e)t.groupId&&t.linkedSelector&&o.set(t.groupId,{selector:t.linkedSelector,pathname:t.pathname});for(let t of e){let e=t.groupId?o.get(t.groupId):t.linkedSelector?{selector:t.linkedSelector,pathname:t.pathname}:void 0,n=e?Ni(e.pathname,e.selector):`annotation:${t.groupId??t.id}`,a=r.get(n);a?(a.createdAt=Math.min(a.createdAt,t.timestamp),a.annotationIds.push(t.id)):r.set(n,{key:n,createdAt:t.timestamp,stableIndex:i++,annotationIds:[t.id]})}let a=e=>{let t=zi(e),n=`element:${t}`,o=e.createdAt??Pi,a=r.get(n);if(a)return a.createdAt=Math.min(a.createdAt,o),void(a.modificationKey=t);r.set(n,{key:n,createdAt:o,stableIndex:i++,annotationIds:[],modificationKey:t})};t.forEach(a),n.forEach(a);let l=new Map,s=new Map,u=[...r.values()].sort((e,t)=>e.createdAt-t.createdAt||e.stableIndex-t.stableIndex);return u.forEach((e,t)=>{let n=t+1;e.annotationIds.forEach(e=>l.set(e,n)),e.modificationKey&&s.set(e.modificationKey,n)}),{annotationNumberById:l,modificationNumberByKey:s,count:u.length}}({annotations:t.filter(e=>!i.has(e)),styleModifications:n,textModifications:r}),[t,n,r,i]),a=(0,Li.useMemo)(()=>{let e=new Map,t=t=>{let n=o.modificationNumberByKey.get(zi(t));if(void 0===n)return;let r=e.get(t.selector);(void 0===r||n<r)&&e.set(t.selector,n)};return n.forEach(t),r.forEach(t),e},[n,r,o.modificationNumberByKey]);return{supersededAnnotations:i,stagedArtifactOrder:o,annotationGroupMap:o.annotationNumberById,pageModificationNumberBySelector:a}}({state:r,pageAnnotations:To,pageStyleModifications:Ao,pageTextModifications:Io}),ca=Ir(Ye),da=!(!$e||ca?.adapter!==$e.target.adapter||ca.key!==$e.target.key),fa=!(!Ye||!Ze||da||Ne||vn||Ie?.linkedSelector||De?.linkedSelector),{hiddenCollidingAnnotationIds:pa,nestedCollidingAnnotationCountById:ga,nestedCollidingAnnotationIdsById:ya,visibleCollisionRepresentativeByAnnotationId:wa}=function({activeText:e,activeTextSendHintId:t,annotationNumberById:n,badgeHoveredAnnotationId:r,canvasRef:i,focusedThreadAnnotationId:o,hoveredElement:a,hoveredElementInfo:l,hoveredTextId:s,showHoverElementIdentifier:u,layoutReady:c,layoutRevision:d,pageAnnotations:f,parentPinnedAnnotationIds:p,pendingLinkedText:h,scroll:m,supersededAnnotations:g,textSafeBounds:y}){let x=(0,Ur.useRef)(new Map);return(0,Ur.useMemo)(()=>{let d=new Set,v=new Map,b=new Map,w=new Map,S=()=>({hiddenCollidingAnnotationIds:d,nestedCollidingAnnotationCountById:v,nestedCollidingAnnotationIdsById:b,visibleCollisionRepresentativeByAnnotationId:w});if(!c)return S();let k=i.current?.getContext("2d");if(!k)return S();let C=(e,t,n,r,i)=>{k.font=`${r}px ${ni}`;let o=(n||"Type here...").replace(/\\n/g," "),a=void 0!==i?`${i}. ${o}`:o,l={x:t.x-m.x,y:t.y-m.y},s=p.has(e)?16:0,u=Math.max(60,ri(l.x)-s),c=ii(k,a,u),d=k.measureText(c).width,f=ai(l,r,y,s+d+16);return{left:f.x-8,top:f.y-4,right:f.x+s+d+8,bottom:f.y+r*Dr+4}},E=new Set,M=f.flatMap(e=>{if("text"!==e.type||!e.text||!e.points[0]||!e.linkedSelector||g.has(e))return[];let t=e.elements?.[0]?.selector,r=x.current.get(e.id),i=r?.selector===e.linkedSelector&&r.fallbackSelector===t&&r.element.isConnected,o=i?r.element:Wr(e.linkedSelector,e.elements);if(!o)return[];let a=i?r.depth:function(e){let t=0,n=ht(e);for(;n;)t+=1,n=ht(n);return t}(o);return x.current.set(e.id,{selector:e.linkedSelector,fallbackSelector:t,element:o,depth:a}),E.add(e.id),[{id:e.id,annotation:e,element:o,bounds:C(e.id,e.points[0],e.text,e.fontSize||12,n.get(e.id)),depth:a}]});for(let e of x.current.keys())E.has(e)||x.current.delete(e);if(0===M.length)return S();let T=M.map((e,t)=>t),R=e=>{let t=e;for(;T[t]!==t;)t=T[t];for(;T[e]!==e;){let n=T[e];T[e]=t,e=n}return t},A=(e,t)=>{let n=R(e),r=R(t);n!==r&&(T[r]=n)};for(let e=0;e<M.length;e+=1)for(let t=e+1;t<M.length;t+=1){let n=M[e],r=M[t];Hr(n.element,r.element)&&Or(n.bounds,r.bounds)&&A(e,t)}let I=new Map;M.forEach((e,t)=>{let n=R(t),r=I.get(n)??[];r.push(e),I.set(n,r)});for(let e of I.values())for(let t of e){let n=new Set,r=e.flatMap(e=>e.id===t.id||e.element===t.element||!t.element.contains(e.element)||n.has(e.element)?[]:(n.add(e.element),[e.id]));r.length>0&&(v.set(t.id,r.length),b.set(t.id,r))}let j=e?.linkedSelector?{id:e.id,element:Wr(e.linkedSelector,e.elements),bounds:C(e.id,e.point,e.text,e.fontSize,n.get(e.id))}:h?.linkedSelector?{id:t,element:Wr(h.linkedSelector,h.elements),bounds:C(t,h.point,"",12)}:null,L=null;if(a&&u){let e=rt(a),t=22,n=e.height>=window.innerHeight,r=n?e.top+8:e.top>=t+4?e.top-t-4:e.bottom+4,i=n?e.left+8:e.left,o=l?li(l):a.tagName.toLowerCase();k.font=`12px ${ni}`;let s=Math.min(400,k.measureText(o).width+16);L={left:i,top:r,right:i+s,bottom:r+t}}let P=(e,t)=>{e.forEach(e=>{e.id!==t&&d.add(e.id),t&&w.set(e.id,t)})};for(let e of I.values()){if(j?.element&&e.some(e=>Hr(j.element,e.element)&&Or(j.bounds,e.bounds))){let t=new Set,n=e.flatMap(e=>e.element===j.element||!j.element.contains(e.element)||t.has(e.element)?[]:(t.add(e.element),[e.id]));n.length>0&&(v.set(j.id,n.length),b.set(j.id,n)),P(e,e.find(e=>e.id===j.id)?.id);continue}let t=[s,r].find(t=>t&&e.some(e=>e.id===t)),n=e.find(e=>e.id===t);if(n){P(e,n.id);continue}if(a){let t=e.find(e=>e.element===a);if(t){P(e,t.id);continue}if(L&&e.some(e=>!Jr(e.annotation)&&!Zr(e.annotation)&&"awaiting_review"!==e.annotation.status&&Hr(a,e.element)&&Or(L,e.bounds))){P(e);continue}}let i=[o].find(t=>t&&e.some(e=>e.id===t));if(i)P(e,i);else if(e.length>1){let t=e.reduce((e,t)=>t.depth<e.depth||t.depth===e.depth&&(t.bounds.top<e.bounds.top||t.bounds.top===e.bounds.top&&t.annotation.timestamp<e.annotation.timestamp)?t:e);P(e,t.id)}}return S()},[e,t,n,r,i,o,a,l,s,u,c,f,p,h,m.x,m.y,g,y,d])}({activeText:Ie,activeTextSendHintId:rf,annotationNumberById:sa,badgeHoveredAnnotationId:vn,canvasRef:q,focusedThreadAnnotationId:T,hoveredElement:Ye,hoveredElementInfo:Ze,hoveredTextId:Ne,layoutReady:V&&null!==X,showHoverElementIdentifier:fa,layoutRevision:Q+Z,pageAnnotations:To,parentPinnedAnnotationIds:Yi,pendingLinkedText:De,scroll:Co,supersededAnnotations:aa,textSafeBounds:oa}),{activeTextAnnotation:Sa,activeTextCollisionId:Ca,activeTextModifiedRail:Ea,activeTextNestedAnnotationCount:Ma,activeTextNestedAnnotationIds:Ta,activeTextNestedBadgeColor:Ra,elementRailColorBySelector:Na,elementRailComments:$a,hiddenAnnotationBadgeIds:Ha,modifiedElementSendHintSelector:Wa,stagedElementComments:Ya,visibleCanvasAnnotations:Ua,visibleSendHintAnchorId:Xa}=function({resolveElement:e,projectedSelectors:t,activeText:n,activeColor:r,annotations:i,annotationNumberById:o,focusedThreadAnnotationId:a,hiddenCollidingAnnotationIds:l,modifiedElementThreadStates:s,nestedCollidingAnnotationCountById:u,nestedCollidingAnnotationIdsById:c,pageAnnotations:d,pageStyleModifications:f,pageTextModifications:p,sendHintAnchorId:h,supersededAnnotations:m,visibleCollisionRepresentativeByAnnotationId:g,activeTextSendHintId:y,targetResolutionRevision:x}){let v=(0,Od.useCallback)((n,r)=>t?null:e?e(n,r):Wr(n,r),[x,e,t]),b=(0,Od.useMemo)(()=>{let e=[],n=new Set,r=[...d].sort((e,t)=>t.timestamp-e.timestamp);for(let i of r){if("text"!==i.type||!i.text||!i.linkedSelector||m.has(i)||l.has(i.id))continue;let r=i.status??(i.captured?"in_flight":"pending");if(!["pending","sending","in_flight","awaiting_review"].includes(r))continue;let a=o.get(i.id);if(void 0===a||n.has(i.linkedSelector))continue;let s=v(i.linkedSelector,i.elements),u=i.elements?.[0];!s&&(!t?.has(i.linkedSelector)||!u)||(n.add(i.linkedSelector),e.push({id:i.id,selector:i.linkedSelector,text:i.text.replace(/\\n/g," "),annotationNumber:a,color:i.color,element:u??Jt(s),pending:"pending"===r,awaitingReview:"awaiting_review"===r,threadId:i.threadId,imageCount:i.imageCount??0,interactionEpisodeStepCount:i.interactionEpisode?.steps.length}))}return e},[o,l,d,m,v,t]),w=(0,Od.useMemo)(()=>new Set(b.map(e=>e.id)),[b]),S=(0,Od.useMemo)(()=>{let e=new Map;for(let t of d){if("text"!==t.type)continue;let n=Bd(t,d);n&&e.set(t.id,n)}return e},[d]),k=(0,Od.useMemo)(()=>{let e=[],n=new Set,r=[...d].sort((e,t)=>+(t.id===a)-+(e.id===a)||t.timestamp-e.timestamp);for(let i of r){let r=S.get(i.id);if(!r||!Zr({...i,status:r.status,threadId:r.threadId,linkedSelector:r.linkedSelector})||!i.text||m.has(i)||l.has(i.id)||n.has(r.linkedSelector))continue;let a=o.get(i.id);if(void 0===a)continue;let s=v(r.linkedSelector,r.elements),u=r.elements?.[0];!s&&(!t?.has(r.linkedSelector)||!u)||(n.add(r.linkedSelector),e.push({id:i.id,selector:r.linkedSelector,text:i.text.replace(/\\n/g," "),annotationNumber:a,color:i.color,element:u??Jt(s),pending:!1,imageCount:i.imageCount??0,interactionEpisodeStepCount:i.interactionEpisode?.steps.length,threadState:{jobId:r.replyJobIds?.[r.replyJobIds.length-1]??r.threadId,threadId:r.threadId,targetBindingId:r.targetBindingId,annotationNumber:a,status:"waiting_input"===r.status?"waiting_input":"failed"===r.status?"failed":"resolved",label:"waiting_input"===r.status?"Question":"failed"===r.status?"Failed":"Replied"}}))}return e},[o,a,l,d,S,m,v,t]),C=(0,Od.useMemo)(()=>[...b,...k],[k,b]),E=(0,Od.useMemo)(()=>{let e=new Set,t=new Set,n=new Set,r=new Set;for(let[e,i]of s??[])if("matched"===zt(i.selectors??[e],i.targetFingerprint).status){t.add(i.threadId),i.targetBindingId&&n.add(i.targetBindingId);for(let e of i.selectors??[])r.add(e);!i.targetBindingId&&!i.selectors?.length&&r.add(e)}for(let i of d){let o=S.get(i.id),a=i.groupId?d.filter(e=>e.groupId===i.groupId):[i],s=a.map(Wd).find(e=>!!e),u=a.find(e=>e.threadId)?.threadId,c=a.find(e=>e.targetBindingId)?.targetBindingId;"text"===i.type&&i.text&&s&&!m.has(i)&&!l.has(i.id)&&(u&&t.has(u)||c&&n.has(c)||r.has(s)||o&&Zr({...i,status:o.status,threadId:o.threadId,linkedSelector:o.linkedSelector})&&v(o.linkedSelector,o.elements))&&e.add(i.id)}return e},[l,s,d,S,m,v]),M=(0,Od.useMemo)(()=>{let e=new Set;for(let t of d)Jr(t)&&t.linkedSelector&&!m.has(t)&&!l.has(t.id)&&v(t.linkedSelector,t.elements)&&e.add(t.id);return e},[l,d,m,v]),T=(0,Od.useMemo)(()=>{let e=new Set(M);for(let t of w)e.add(t);for(let t of E)e.add(t);return e},[M,E,w]),R=(0,Od.useMemo)(()=>new Map(C.map(e=>[e.selector,e.color])),[C]),A=(0,Od.useMemo)(()=>new Set([...l,...T]),[T,l]),I=(0,Od.useMemo)(()=>{if(!n?.linkedSelector||n.domEdit)return null;let e=v(n.linkedSelector,n.elements);if(!e)return null;let t=[...f,...p].find(t=>!t.captured&&Wr(t.selector,[t.element])===e),r=d.find(e=>e.id===n.id),i=!(n.isNew||!r||!Jr(r));return t||i?{element:e,selector:t?.selector??n.linkedSelector}:null},[n,d,f,p,v]),j=h===y?h:h?g.get(h)??h:null,L=(0,Od.useMemo)(()=>{if(j===y)return n?.text.trim()?I?.selector??null:null;if(j&&j!==y)return b.find(e=>e.id===j)?.selector??null;for(let e=p.length-1;e>=0;e-=1){let t=p[e];if(t&&!t.captured)return t.selector}for(let e=f.length-1;e>=0;e-=1){let t=f[e];if(t&&!t.captured&&!t.awaitingReview)return t.selector}return null},[n,I,y,f,p,b,j]),P=n?n.isNew?y:n.id:null,z=P?u.get(P)??0:0,N=P?c.get(P)??[]:[],_=n?.isNew?void 0:i.find(e=>e.id===n?.id),D="pending"===(_?.status??(_?.captured?"in_flight":"pending"))?_?.color??r:"#8c8c8c",F=(0,Od.useMemo)(()=>d.filter(e=>!(m.has(e)||l.has(e.id)||T.has(e.id)||n&&!n.isNew&&e.id===n.id)),[n,T,l,d,m]);return{activeTextAnnotation:_,activeTextCollisionId:P,activeTextModifiedRail:I,activeTextNestedAnnotationCount:z,activeTextNestedAnnotationIds:N,activeTextNestedBadgeColor:D,elementRailColorBySelector:R,elementRailCommentIds:T,elementRailComments:C,hiddenAnnotationBadgeIds:A,modifiedElementSendHintSelector:L,stagedElementComments:b,visibleCanvasAnnotations:F,visibleSendHintAnchorId:j}}({activeText:Ie,activeColor:r.activeColor,annotations:r.annotations,annotationNumberById:sa,focusedThreadAnnotationId:T,hiddenCollidingAnnotationIds:pa,modifiedElementThreadStates:h,nestedCollidingAnnotationCountById:ga,nestedCollidingAnnotationIdsById:ya,pageAnnotations:To,pageStyleModifications:Ao,pageTextModifications:Io,sendHintAnchorId:No,supersededAnnotations:aa,visibleCollisionRepresentativeByAnnotationId:wa,activeTextSendHintId:rf,targetResolutionRevision:Q+Z}),Ka=(0,Tr.useMemo)(()=>{if(0===go.length)return null;let e=new Map;for(let t of go){let n=r.annotations.find(e=>e.id===t);if(!n)continue;let i=n.groupId?r.annotations.filter(e=>e.groupId===n.groupId):[n];for(let t of i)if(t.linkedSelector&&!p?.has(t.linkedSelector)){let n=t.color||r.activeColor;e.set(t.linkedSelector,n)}}return e.size>0?e:null},[go,r.annotations,r.activeColor,p]),Qa=(0,Tr.useCallback)((e=So.current)=>{Y(Ua,go,8,e.x,e.y,sa,Go,oa,Xo,Ko,Qo,Yi,u)},[u,Ua,go,Y,sa,Go,oa,Xo,Ko,Qo,Yi]);(0,Tr.useEffect)(()=>{V&&Qa(So.current)},[Qa,V]),(0,Tr.useEffect)(()=>{if(!V)return;let e=()=>{let e={x:window.scrollX,y:window.scrollY};So.current=e,Qa(e),null===ko.current&&(ko.current=window.requestAnimationFrame(()=>{ko.current=null;let e=So.current;Eo(t=>t.x===e.x&&t.y===e.y?t:e)}))};return e(),window.addEventListener("scroll",e,{passive:!0,capture:!0}),()=>{window.removeEventListener("scroll",e,!0),null!==ko.current&&(window.cancelAnimationFrame(ko.current),ko.current=null)}},[Qa,V]);let{findAnnotationAtPoint:Ga,findHandleAtPoint:Za,findTextAtPoint:Ja,getPoint:el}=function({annotationGroupMap:e,annotations:t,canvasRef:n,handleSize:r,hiddenCollidingAnnotationIds:i,pageAnnotations:o,parentPinnedAnnotationIds:a,scroll:l,selectedAnnotationIds:s,supersededAnnotations:u,textSafeBounds:c}){let d=(0,yd.useCallback)(e=>function(e,t,n){if(!e)return{x:0,y:0};let r=t.touches?.[0],i=r?.clientX??t.clientX,o=r?.clientY??t.clientY;if(void 0===i||void 0===o)return{x:0,y:0};let a=e.getBoundingClientRect();return{x:i-a.left+n.x,y:o-a.top+n.y}}(n.current,e,{x:window.scrollX,y:window.scrollY}),[n]),f=(0,yd.useCallback)(t=>function({point:e,annotations:t,isHidden:n=()=>!1,textContainsPoint:r=()=>!1}){for(let i=t.length-1;i>=0;i-=1){let o=t[i];if(!o||n(o))continue;if("text"===o.type){if(r(o,e))return o;continue}if(o.points.length<2)continue;let a=o.points[0],l=o.points[o.points.length-1],s=(o.strokeWidth||3)+4;if("line"===o.type){if(xd(e,a,l,s))return o;continue}if("freehand"===o.type){for(let t=0;t<o.points.length-1;t+=1)if(xd(e,o.points[t],o.points[t+1],s))return o;continue}let u=Math.min(a.x,l.x),c=Math.max(a.x,l.x),d=Math.min(a.y,l.y),f=Math.max(a.y,l.y);if("rectangle"!==o.type){if("circle"===o.type){let t=(c-u)/2,n=(f-d)/2;if(0===t||0===n)continue;let r=Math.hypot((e.x-(u+c)/2)/t,(e.y-(d+f)/2)/n);if(Math.abs(r-1)*Math.max(t,n)<=s)return o}}else if(xd(e,{x:u,y:d},{x:c,y:d},s)||xd(e,{x:u,y:f},{x:c,y:f},s)||xd(e,{x:u,y:d},{x:u,y:f},s)||xd(e,{x:c,y:d},{x:c,y:f},s))return o}return null}({point:t,annotations:o,isHidden:e=>u.has(e)||i.has(e.id),textContainsPoint:(t,r)=>function({annotation:e,point:t,context:n,groupNumber:r,scroll:i,textSafeBounds:o,parentPinned:a}){let l=e.points[0];if(!l||!e.text||!n)return!1;let s=e.fontSize||12;n.font=`${s}px ${ni}`;let u=e.text.replace(/\\n/g," "),c=void 0!==r?`${r}. ${u}`:u,d=l.x-i.x,f=a?16:0,p=ii(n,c,Math.max(60,ri(d)-f)),h=n.measureText(p).width,m=s*Dr,g=ai({x:l.x-i.x,y:l.y-i.y},s,o,f+h+16),y=g.x+i.x,x=g.y+i.y;return t.x>=y-8-4&&t.x<=y+f+h+8+4&&t.y>=x-4-4&&t.y<=x+m+4+4}({annotation:t,point:r,context:n.current?.getContext("2d")??null,groupNumber:e.get(t.id),scroll:l,textSafeBounds:c,parentPinned:a.has(t.id)})}),[e,n,i,o,a,l,u,c]),p=(0,yd.useCallback)(e=>{let t=f(e);return"text"===t?.type?t:null},[f]),h=(0,yd.useCallback)(e=>function(e,t,n,r){if(0===t.length)return null;let i=r/2+4;for(let r of t){let t=n.find(e=>e.id===r);if(!t||t.points.length<2)continue;let o,a,l,s,u=t.points[0],c=t.points[t.points.length-1];if("line"===t.type){if(Math.hypot(e.x-u.x,e.y-u.y)<=i)return{handle:"start",annotationId:r};if(Math.hypot(e.x-c.x,e.y-c.y)<=i)return{handle:"end",annotationId:r};continue}"freehand"===t.type?(o=Math.min(...t.points.map(e=>e.x)),a=Math.max(...t.points.map(e=>e.x)),l=Math.min(...t.points.map(e=>e.y)),s=Math.max(...t.points.map(e=>e.y))):(o=Math.min(u.x,c.x),a=Math.max(u.x,c.x),l=Math.min(u.y,c.y),s=Math.max(u.y,c.y));let d="circle"===t.type?[{handle:"top",x:(o+a)/2,y:l},{handle:"bottom",x:(o+a)/2,y:s},{handle:"left",x:o,y:(l+s)/2},{handle:"right",x:a,y:(l+s)/2}]:"rectangle"===t.type||"freehand"===t.type?[{handle:"topLeft",x:o,y:l},{handle:"topRight",x:a,y:l},{handle:"bottomLeft",x:o,y:s},{handle:"bottomRight",x:a,y:s}]:[];for(let t of d)if(Math.hypot(e.x-t.x,e.y-t.y)<=i)return{handle:t.handle,annotationId:r}}return null}(e,s,t,r),[t,r,s]);return{findAnnotationAtPoint:f,findHandleAtPoint:h,findTextAtPoint:p,getPoint:d}}({annotationGroupMap:sa,annotations:r.annotations,canvasRef:q,handleSize:8,hiddenCollidingAnnotationIds:pa,pageAnnotations:To,parentPinnedAnnotationIds:Yi,scroll:Co,selectedAnnotationIds:go,supersededAnnotations:aa,textSafeBounds:oa}),{commitActiveText:tl,createInlineTextEdit:nl,enterDomTextEdit:rl,editPendingLinkedComment:il,handleSendPendingBundle:ol}=Dd({activeText:Ie,activeTextRef:Ui,canvasRef:q,clearPageElementHover:Si,clearSelection:vo,clearSignal:P,commentTextEditCandidateRef:qe,cursorPosRef:Ki,dispatch:i,findTextAtPoint:Ja,lastPositionedTextId:Ji,onAttachImages:g,onCloseThread:w,onSend:v,pendingLinkedText:De,releaseActiveTextAttachments:ze,setActiveText:je,setDragState:fo,setHoveredTextId:_e,setPendingLinkedText:Fe,setSendHintAnchorId:Fo,state:r,stateRef:qi}),sl=(0,Tr.useCallback)(()=>{let e=Xi.current;(function(e,t){return!(!t||e?.id!==t.id)})(Ui.current,e)||tl()},[tl]),ul=function({activeText:e,applySticker:t,canvasRef:n,clearSelection:r,commentTextEditCandidateRef:i,commitActiveText:o,createInlineTextEdit:a,dispatch:l,domDragRef:s,editPendingLinkedComment:u,findAnnotationAtPoint:c,findHandleAtPoint:d,findTextAtPoint:f,gapDragRef:p,gapHoveredAxis:h,gapHoveredElement:m,gapIsAuto:g,getPoint:y,handleAnnotationActivation:x,handDragRef:v,handHoveredElement:b,handHoveredSide:w,hoveredElement:S,hoveredElementInfo:k,isElementInFlight:C,onCanvasInteraction:E,openThreadAndFocusReply:M,pageAnnotations:T,modifiedElementThreadStates:R,pageStyleModifications:A,parentPinnedAnnotationIds:I,pointerTargetOverrideRef:j,radiusDragRef:L,radiusHoveredCorner:P,radiusHoveredElement:z,selectAnnotation:N,setDragState:_,setGapDragging:D,setHandDragging:F,setPendingLinkedText:$,setRadiusDragging:O,setResizeState:H,setStickerRejectPulse:W,setTextDragging:B,state:V,stickerStage:q,textDragRef:Y,textHoveredElement:U,textHoveredProperty:X,toolbarRef:K}){return(0,pd.useCallback)(Q=>{if(!V.isAnnotating||!function(e){return!("button"in e)||0===e.button}(Q))return;E?.();let G=j?.current??null;j&&(j.current=null);let Z=G?.element??S,J=G?.elementInfo??k,ee=y(Q),te="shiftKey"in Q&&Q.shiftKey,ne="clientX"in Q?{x:Q.clientX,y:Q.clientY}:"touches"in Q&&Q.touches[0]?{x:Q.touches[0].clientX,y:Q.touches[0].clientY}:null;if("sticker"===V.activeTool){if("button"in Q&&0!==Q.button||"value"!==q)return;if(!ne)return void W(e=>e+1);let e=G?.element??nn(ne.x,ne.y);return e instanceof HTMLElement||e instanceof SVGElement?(Q.preventDefault(),Q.stopPropagation(),void t(e)):void W(e=>e+1)}if("inspector"!==V.activeTool||!ne||"button"in Q&&0!==Q.button)i.current=null;else{let e=a(ne.x,ne.y,ee);i.current=e?{edit:e,clientX:ne.x,clientY:ne.y,expiresAt:Date.now()+1e3}:null}let re=f(ee);if(re?.points[0]){e&&o(),te||r();let t=re.threadId||(re.groupId?V.annotations.find(e=>e.groupId===re.groupId&&e.threadId)?.threadId:void 0);return I.has(re.id)?(i.current=null,void x(re.id,t)):(t&&M(t),void _({annotation:re,startPoint:ee,hasMoved:!1}))}if("inspector"===V.activeTool){if("button"in Q&&2===Q.button)return;if(Z&&!C(Z)){let e=T.filter(e=>"text"===e.type&&e.linkedSelector).filter(e=>Nt(e.linkedSelector,e.elements?.[0])===Z).sort((e,t)=>t.timestamp-e.timestamp)[0];if(e?.points[0]){if("pending"!==(e.status??"pending")||e.threadId){let t=e.threadId||(e.groupId?V.annotations.find(t=>t.groupId===e.groupId&&t.threadId)?.threadId:void 0);t&&M(t)}else u(e.id);return}let t=Ir(Z),r=new Set;for(let[e,t]of R??[]){let n=zt(t.selectors??[e],t.targetFingerprint);"matched"===n.status&&n.element===Z&&r.add(t.threadId)}if(1===r.size)return void M([...r][0]);let i=J??Jt(Z),o=t?Ar(t):$t(Z),a=rt(Z),l=o;if(!t){let e=Z.getAttribute("data-pm");e||(e=Math.random().toString(36).substring(2,8),Z.setAttribute("data-pm",e)),l=Ot(`[data-pm="${e}"]`,Z.ownerDocument)}let s,c=(A.some(e=>{if(e.captured)return!1;try{return mt(Z,e.selector)}catch{return!1}})?1:0)+V.annotations.filter(e=>{if(!e.linkedSelector)return!1;try{return mt(Z,e.linkedSelector)}catch{return!1}}).length,d=a.top>=22*(1+c)+4?"top-left":"bottom-left",f=n.current?.getContext("2d")??document.createElement("canvas").getContext("2d");f&&(f.font=`12px ${ni}`,s=f.measureText("Type here...").width);let p=Z===document.body?Vr(a):Yr(a,d,c,K?.current,s,0);$({point:p,subjectAnchor:t?{x:.5,y:.5}:void 0,linkedSelector:l,target:t,linkedAnchor:d,elements:[{...i,selector:o}]})}return}if("hand"===V.activeTool&&b&&Yu(b)&&!m&&!z&&!U&&!w){let e=b,t=Uu(e),n=$t(e),r=Jt(e),i="altKey"in Q&&Q.altKey;return s.current={isDragging:!0,hasMoved:!1,mode:i?"copy":"move",startX:ee.x-window.scrollX,startY:ee.y-window.scrollY,element:e,originalParent:e.parentElement,originalIndex:Xu(e),selector:t,durableSelector:n,elementInfo:{...r,selector:t}},void Q.preventDefault()}if("hand"===V.activeTool&&m&&h){let e=function(e,t,n,r){let i=hd(e),o=md(n),a=kn(e),l=window.getComputedStyle(e).justifyContent,s=0;if(r){let n=Cn(e).find(e=>e.axis===t);s=n?"column"===t?n.w:n.h:0}let u=r?{row:s,column:s}:a;return gd(e),{session:{...i,isDragging:!0,hasMoved:!1,axis:t,startX:o.x,startY:o.y,originalRow:u.row,originalColumn:u.column,isAuto:r,originalJustifyContent:l,visualGap:s},dragging:{axis:t,...u}}}(m,h,ee,g);return p.current=e.session,void D(e.dragging)}if("hand"===V.activeTool&&U&&X){let e=function(e,t,n){let r=hd(e),i=md(n),o=Ln(e);return gd(e),{session:{...r,isDragging:!0,property:t,startX:i.x,startY:i.y,originalFontSize:o.fontSize,originalLineHeight:o.lineHeight,originalRatio:o.fontSize>0?o.lineHeight/o.fontSize:1.2},dragging:{property:t,...o}}}(U,X,ee);return Y.current=e.session,void B(e.dragging)}if("hand"===V.activeTool&&z&&P){let e=function(e,t,n){let r=hd(e),i=An(e);return gd(e),{session:{...r,isDragging:!0,corner:t,startY:md(n).y,original:i,maxRadius:Math.floor(e.getBoundingClientRect().height/2)},dragging:{corner:t,radius:{...i}}}}(z,P,ee);return L.current=e.session,void O(e.dragging)}if("hand"===V.activeTool&&b&&w){let e=function(e,t,n){let r=hd(e),i=md(n),o=Mn(e);return gd(e),{session:{...r,isDragging:!0,side:t,startX:i.x,startY:i.y,original:o},dragging:{side:t,padding:{...o}}}}(b,w,ee);return v.current=e.session,void F(e.dragging)}let ie=d(ee);if(ie){let e=V.annotations.find(e=>e.id===ie.annotationId);if(e&&"text"!==e.type&&"pending"===(e.status??"pending"))return void H({annotationId:ie.annotationId,handle:ie.handle,startPoint:ee,originalPoints:[...e.points],hasMoved:!1})}let oe=c(ee);if(oe?.points[0]){e&&o(),"text"!==oe.type?(N(oe.id,te),oe.color&&"pending"===(oe.status??"pending")&&l({type:"SET_COLOR",payload:oe.color})):te||r();let t=oe.threadId||(oe.groupId?V.annotations.find(e=>e.groupId===oe.groupId&&e.threadId)?.threadId:void 0);return t&&"pending"!==(oe.status??"pending")&&M(t),void _({annotation:oe,startPoint:ee,hasMoved:!1})}te||r()},[e,t,n,r,i,o,a,l,s,u,c,d,f,p,h,m,g,y,x,v,b,w,S,k,C,E,M,T,R,A,I,j,L,P,z,N,_,D,F,$,O,H,W,B,V.activeTool,V.annotations,V.isAnnotating,q,Y,U,X,K])}({activeText:Ie,applySticker:Qr,canvasRef:q,clearSelection:vo,commentTextEditCandidateRef:qe,commitActiveText:tl,createInlineTextEdit:nl,dispatch:i,domDragRef:Nn,editPendingLinkedComment:il,findAnnotationAtPoint:Ga,findHandleAtPoint:Za,findTextAtPoint:Ja,gapDragRef:Gn,gapHoveredAxis:tr,gapHoveredElement:Zn,gapIsAuto:ar,getPoint:el,handleAnnotationActivation:Yo,handDragRef:zn,handHoveredElement:_n,handHoveredSide:$n,hoveredElement:Ye,hoveredElementInfo:Ze,isElementInFlight:Xr,onCanvasInteraction:M,openThreadAndFocusReply:Vi,pageAnnotations:To,modifiedElementThreadStates:h,pageStyleModifications:Ao,parentPinnedAnnotationIds:Yi,pointerTargetOverrideRef:Te,radiusDragRef:hr,radiusHoveredCorner:xr,radiusHoveredElement:gr,selectAnnotation:xo,setDragState:fo,setGapDragging:ir,setHandDragging:qn,setPendingLinkedText:Fe,setRadiusDragging:wr,setResizeState:ho,setStickerRejectPulse:jt,setTextDragging:Nr,state:r,stickerStage:pt,textDragRef:Sr,textHoveredElement:Cr,textHoveredProperty:Rr,toolbarRef:j});(0,Tr.useEffect)(()=>{if(!ue)return;let e=e=>{if(0===e.button){if(e.target instanceof Element&&Dn(e.target))return void(Me.current=null);D?.(),Me.current={startX:e.clientX,startY:e.clientY,moved:!1}}},t=e=>{(!(e.target instanceof Element)||!Dn(e.target))&&D?.();let t=Me.current;t&&(Me.current=rc(t,e.clientX,e.clientY))},n=()=>{Me.current=null},i=e=>{let t=Me.current;if(Me.current=null,!ic(t)||0!==e.button||e.target instanceof Element&&Dn(e.target)||de.current||"inspector"!==r.activeTool&&"sticker"!==r.activeTool)return;let n="inspector"===r.activeTool?z?.hitTest({x:e.clientX,y:e.clientY}):null;n&&z?.promote(n.target);let i=n?.element??nn(e.clientX,e.clientY,{allowBodyFallback:"inspector"===r.activeTool});!i||Dn(i)||i!==document.documentElement&&("inspector"===r.activeTool&&Xr(i)||"sticker"===r.activeTool&&!(i instanceof HTMLElement)&&!(i instanceof SVGElement)||(Te.current={element:i,elementInfo:n?.elementInfo??Jt(i)},e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),ul(e)))};return window.addEventListener("pointerdown",e,!0),window.addEventListener("pointermove",t,!0),window.addEventListener("pointercancel",n,!0),window.addEventListener("click",i,!0),()=>{window.removeEventListener("pointerdown",e,!0),window.removeEventListener("pointermove",t,!0),window.removeEventListener("pointercancel",n,!0),window.removeEventListener("click",i,!0)}},[ul,ue,Xr,r.activeTool,z,D]),(0,Tr.useEffect)(()=>{!r.isAnnotating&&se.current&&Re()},[Re,r.isAnnotating]);let cl=jd({activeTool:r.activeTool,annotations:r.annotations,canvasRef:q,clearPageElementHover:Si,clearStickerPreview:fn,dispatch:i,domDragRef:Nn,dragState:lo,findTextAtPoint:Ja,gapDragRef:Gn,gapHoveredAxis:tr,gapHoveredElement:Zn,getPoint:el,handCursorRef:Un,handDragRef:zn,handHoveredElement:_n,handHoveredSide:$n,handleShakePointerMove:pn,hoveredElement:Ye,hoveredElementInfo:Ze,isAnnotating:r.isAnnotating,isElementInFlight:Xr,lastCanvasCursorRef:Ve,modifiersRef:Fr,radiusDragRef:hr,radiusHoveredCorner:xr,radiusHoveredElement:gr,resizeState:co,setDomDropPreview:Wn,setDragState:fo,setGapDragging:ir,setGapHoveredAxis:nr,setGapHoveredElement:Jn,setGapIsAuto:lr,setHandCursorPos:Qn,setHandDragging:qn,setHandHoveredElement:Fn,setHandHoveredSide:On,setHoveredElement:Ue,setHoveredElementInfo:et,setRadiusDragging:wr,setRadiusHoveredCorner:vr,setRadiusHoveredElement:yr,setResizeState:ho,setStickerCursor:xt,setStickerStep:ct,setTextDragging:Nr,setTextHoveredElement:Er,setTextHoveredProperty:jr,steerDragRef:wi,stickerFamily:it,stickerStage:pt,stickerSubproperty:dt,subjectRegistry:z,suspendTargetDiscovery:!!_i||pe,textDragRef:Sr,textHoveredElement:Cr,textHoveredProperty:Rr,transformDragHandoffRef:sn,transformPreviewSuppressionRef:ln,transformPreviewTargetRef:an}),dl=Pd({annotationGroupMap:sa,canvasRef:q,currentPathname:te,cursorPosRef:Ki,dispatch:i,domDragRef:Nn,dragState:lo,gapDragRef:Gn,gapDragging:rr,getPoint:el,handDragRef:zn,handDragging:Bn,lastPositionedTextId:Ji,radiusDragRef:hr,radiusDragging:br,resizeState:co,setActiveText:je,setDomDropPreview:Wn,setDragState:fo,setGapDragging:ir,setHandDragging:qn,setRadiusDragging:wr,setResizeState:ho,setSendHintAnchorId:Fo,setTextDragging:Nr,textDragRef:Sr,textDragging:Lr}),fl=function({enabled:e,onRegion:t,onClick:n,onStart:r}){let i=(0,Wu.useRef)(null),o=(0,Wu.useRef)(null),[a,l]=(0,Wu.useState)(null),s=(0,Wu.useCallback)(()=>{let e=i.current;i.current=null,o.current=null,l(null),e?.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)},[]);return(0,Wu.useEffect)(()=>{e||s()},[e,s]),(0,Wu.useEffect)(()=>{let e=e=>{"Escape"===e.key&&i.current&&(e.preventDefault(),e.stopImmediatePropagation(),s())};return window.addEventListener("keydown",e,!0),window.addEventListener("blur",s),window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("blur",s),window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s),s()}},[s]),{activateTouchTap:t=>{let r=o.current;o.current=null,e&&r&&!t.touches.length&&(t.preventDefault(),n(r))},begin:t=>(o.current=null,"touch"!==t.pointerType||t.isPrimary?!(!e||0!==t.button||!["mouse","pen","touch"].includes(t.pointerType)||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||i.current||(i.current={pointerId:t.pointerId,target:t.currentTarget,points:[{x:t.clientX,y:t.clientY}],moved:!1,tapOnly:"touch"===t.pointerType,scroll:{x:window.scrollX,y:window.scrollY},viewport:{width:window.innerWidth,height:window.innerHeight}},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),0)):(s(),!0)),move:e=>{let t=i.current;if(!t||e.pointerId!==t.pointerId)return!1;let n={x:e.clientX,y:e.clientY};return!t.moved&&Math.hypot(n.x-t.points[0].x,n.y-t.points[0].y)>=6&&(t.moved=!0,t.tapOnly||r()),t.tapOnly||(t.points=ui(t.points,n),t.moved&&l(t.points),e.preventDefault()),!0},end:e=>{let r=i.current;if(!r||e.pointerId!==r.pointerId)return!1;let a=ui(r.points,{x:e.clientX,y:e.clientY});if(s(),!r.moved&&Math.hypot(e.clientX-r.points[0].x,e.clientY-r.points[0].y)<6)r.tapOnly?o.current=e.nativeEvent:n(e.nativeEvent);else if(!r.tapOnly){let e=function(e,t,n,r=Date.now()){if(e.length<3)return null;let i=ci(e);return i.right-i.left<8||i.bottom-i.top<8||0===fi(e).length?null:{kind:"lasso",coordinateSpace:"document",points:e.map(e=>({x:e.x+t.x,y:e.y+t.y})),viewport:n,scroll:{...t},capturedAt:r}}(a,r.scroll,r.viewport);e&&t(e,a)}return r.tapOnly||e.preventDefault(),!0},cancel:s,preview:a,active:()=>null!==i.current}}({enabled:r.isAnnotating&&"inspector"===r.activeTool&&!$e&&!ue&&!pe,onStart:()=>{tl(),vo(),Si(),qe.current=null},onClick:e=>{let t=z?.hitTest({x:e.clientX,y:e.clientY});if(t&&z?.promote(t.target),"touch"===e.pointerType){let n=t?.element??nn(e.clientX,e.clientY,{allowBodyFallback:!0});if(!n||Dn(n))return;Te.current={element:n,elementInfo:t?.elementInfo??Jt(n)},(0,Ke.flushSync)(()=>{tl(),ul(e)}),Qi.current?.focus({preventScroll:!0})}else ul(e);dl(e)},onRegion:(e,t)=>{let n=new Map;for(let e of fi(t)){if(n.size>=16)break;let t=z?.hitTest(e),r=t?null:nn(e.x,e.y),i=t?.elementInfo??(r?Jt(r):null);i&&n.set(i.selector,i)}let r=ci(e.points);Ji.current=null,Ki.current=0,je({id:Math.random().toString(36).substring(2,9),point:{x:r.left,y:r.bottom+12},text:"",fontSize:12,isNew:!0,region:{...e,elements:[...n.values()]},linkedAnchor:"bottom-left",elements:[]}),Fo(rf)}}),pl=fl.cancel;(0,Tr.useEffect)(()=>{pl()},[P,pl]);let hl=(0,Tr.useCallback)(e=>{if(Ja(el(e))||Ga(el(e))||!fl.begin(e)){if(r.isAnnotating&&"inspector"===r.activeTool&&0===e.button&&"mouse"===e.pointerType&&z&&!$e){let t=z.beginCreate({x:e.clientX,y:e.clientY});if(t)return re.current={...t,start:{x:e.clientX,y:e.clientY},moved:!1,pointerId:e.pointerId,captureTarget:e.currentTarget},e.currentTarget.setPointerCapture(e.pointerId),void e.preventDefault()}ul(e)}},[ul,Ja,Ga,el,fl,r.activeTool,r.isAnnotating,$e,z]),ml=(0,Tr.useCallback)(e=>{if(fl.move(e))return;let t=re.current;if(!t||t.pointerId!==e.pointerId)return void cl(e);let n=Math.hypot(e.clientX-t.start.x,e.clientY-t.start.y);!t.moved&&n>=4&&(t.moved=!0),t.moved?(t.session.update({x:e.clientX,y:e.clientY}),ae({adapter:t.adapter.id,key:t.session.key}),We(e=>e+1),e.preventDefault()):cl(e)},[cl,fl]),gl=(0,Tr.useCallback)(e=>{if(fl.end(e))return;let t=re.current;if(t&&t.pointerId!==e.pointerId)return;if(re.current=null,ae(null),!t)return void dl(e);if(t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId),!t.moved){t.session.cancel();let n=z?.hitTest({x:e.clientX,y:e.clientY});return n&&z?.promote(n.target),ul(e),void dl(e)}t.session.update({x:e.clientX,y:e.clientY});let n=t.session.commit();n&&(ie.current=window.performance.now()+500,Oe({target:{adapter:t.adapter.id,key:n.key},created:!0})),e.preventDefault()},[ul,dl,z,fl]),yl=(0,Tr.useCallback)(e=>{if(!r.isAnnotating||"inspector"!==r.activeTool||!z)return!1;let t=z.resolve(e);if(!t?.adapter.renameSubject)return!1;let n=Ui.current;return n?.isNew&&n.target?.adapter===t.target.adapter&&n.target.key===t.target.key&&(ze(n.attachments),je(null),Fe(null)),Oe({target:t.target,created:!1}),!0},[Ui,ze,je,r.activeTool,r.isAnnotating,z]),xl=(0,Tr.useCallback)(e=>{if(window.performance.now()<=ie.current)return ie.current=0,e.preventDefault(),void e.stopPropagation();if(ie.current=0,B&&r.isAnnotating&&"sticker"===r.activeTool&&0===e.button){let t=nl(e.clientX,e.clientY,el(e),!!H);if(t?.domEdit&&B(t.domEdit.targetElement))return clearTimeout(Ce.current),fn(),mn(),rl(t),e.preventDefault(),void e.stopPropagation()}if(!z)return;let t=z.hitTest({x:e.clientX,y:e.clientY});!t||!yl(t.target)||(e.preventDefault(),e.stopPropagation())},[B,H,fn,nl,rl,el,yl,mn,r.activeTool,r.isAnnotating,z]),[Sl,kl]=(0,Tr.useState)(!1),Cl=H&&"sticker"===r.activeTool&&"family"===pt;(0,Tr.useEffect)(()=>{if(!Cl)return;let e=!1,t=t=>{t.altKey!==e&&(e=t.altKey,kl(e))},n=()=>{e=!1,kl(!1)};window.addEventListener("keydown",t,!0),window.addEventListener("keyup",t,!0),window.addEventListener("pointermove",t,!0),window.addEventListener("blur",n);let r=t=>{e||t.defaultPrevented||t.target===q.current||!(t.target instanceof Element)||!nn(t.clientX,t.clientY)?.closest("[data-scratch-text]")||xl(t)};return document.addEventListener("dblclick",r),()=>{document.removeEventListener("dblclick",r),window.removeEventListener("keydown",t,!0),window.removeEventListener("keyup",t,!0),window.removeEventListener("pointermove",t,!0),window.removeEventListener("blur",n),n()}},[xl,Cl,q]);let Tl=(0,Tr.useCallback)((e,t)=>{Ki.current=t;let n=Ui.current;if(n?.domEdit){let t=n.domEdit,r=Ju(t,e,qi.current.textModifications),o=r?{type:"MODIFY_TEXT_CONTENTS",payload:[r.change],saveUndo:n.text===t.originalText}:ec(t,e,n.text===t.originalText);r||o.payload.forEach(({modified:e},n)=>{let r=t.segments[n].textNode;r.data!==e&&(r.data=e)}),i({...o,textEditSessionId:n.paragraphSession?.id})}je(t=>t&&{...t,text:e})},[Ui,Ki,i,je,qi]),Rl=(0,Tr.useCallback)(e=>{if(e.nativeEvent.isComposing||229===e.nativeEvent.keyCode)return;let t=Ui.current,n=t?.domEdit;if(n&&Xn(n.targetElement)&&(e.metaKey||e.ctrlKey)&&"z"===e.key.toLowerCase())return e.preventDefault(),e.stopPropagation(),je(null),void i({type:e.shiftKey?"REDO":"UNDO"});if("Escape"===e.key)t?.paragraphSession?(e.preventDefault(),e.stopPropagation(),i({type:"CANCEL_PARAGRAPH_EDIT",payload:t.paragraphSession})):Ui.current?.domEdit&&(i(ec(Ui.current.domEdit,Ui.current.domEdit.originalText,!1)),Ui.current.domEdit.segments.forEach(e=>{e.textNode.nodeValue=e.originalText})),ze(Ui.current?.attachments),je(null);else if(function(e){return!("Enter"!==e.key||!e.metaKey&&!e.ctrlKey||(e.preventDefault(),e.stopPropagation(),0))}(e))ol();else if("Enter"===e.key&&!e.shiftKey){if(e.preventDefault(),t&&"P"===n?.targetElement.tagName&&Qi.current){let{value:e,selectionStart:r,selectionEnd:o}=Qi.current,a=Ju(n,e.slice(0,r)+e.slice(o),qi.current.textModifications,r);if(a?.next)return i({type:"MODIFY_TEXT_CONTENTS",payload:[a.change],textEditSessionId:t.paragraphSession?.id}),void je({...a.next,paragraphSession:t.paragraphSession})}tl()}},[tl,i,ol,Qi,qi,Ui,ze,je]),zl=(0,Tr.useCallback)(e=>{if(!r.isAnnotating)return;let t=Xi.current;Xi.current=null;let n=Ja(el(e));if(n&&k&&!Hi(n,qi.current.annotations))return e.preventDefault(),e.stopPropagation(),void k(n.id);if(n&&Hi(n,qi.current.annotations))return e.preventDefault(),e.stopPropagation(),void bo(n.id);if("resolved"===n?.status){let t=fd(qi.current.annotations,[n.id]);if(t.length>0)return e.preventDefault(),e.stopPropagation(),void t.forEach(e=>S?.(e))}e.preventDefault();let i=!!Ui.current,o=to({x:e.clientX,y:e.clientY},t);!i&&!o&&Ae()},[Ae,Ja,el,bo,S,k,to,r.isAnnotating]),Nl=(0,Tr.useMemo)(()=>{if(!Ye)return r.activeColor;let e=null;for(let t of To)!t.linkedSelector||aa.has(t)||Wr(t.linkedSelector,t.elements)!==Ye||(!e||t.timestamp>e.timestamp)&&(e=t);let t=e?.color??r.activeColor,n=Ze?.selector??e?.linkedSelector;return n?Kr([n],h??new Map,t,Wt):t},[Ye,Ze?.selector,h,To,r.activeColor,aa]),_l=function(e,t){return e&&"model"!==t}(r.isAnnotating,r.activeTool),Dl={position:"fixed",top:0,left:0,width:"100dvw",height:"100dvh",zIndex:9998,pointerEvents:ue||Cl&&Sl||!_l?"none":"auto",visibility:_l?"visible":"hidden",cursor:vt&&!vt.nativeReady?"none":(()=>{if(!r.isAnnotating)return"default";if(co){let{handle:e}=co;return"start"===e||"end"===e?"move":"top"===e||"bottom"===e?"ns-resize":"left"===e||"right"===e?"ew-resize":"topLeft"===e||"bottomRight"===e?"nwse-resize":"nesw-resize"}if(function(e){return"hand"===e}(r.activeTool)){let e=rr?.axis??tr;if("row"===e)return"ns-resize";if("column"===e)return"ew-resize";if(br||xr)return"ns-resize";let t=Lr?.property??Rr;if("font-size"===t)return"ew-resize";if("line-height"===t)return"ns-resize";let n=Bn?.side??$n;return"top"===n||"bottom"===n?"ns-resize":"left"===n||"right"===n?"ew-resize":"default"}return"inspector"===r.activeTool?va(Nl):"sticker"===r.activeTool?xa(Nl):"crosshair"})(),touchAction:"inspector"===r.activeTool?"pan-x pan-y pinch-zoom":"none"},Fl=(0,Tr.useMemo)(()=>{if(!Ie||Ie.domEdit)return;if(Ie.linkedSelector){let e=Ya.find(e=>e.selector===Ie.linkedSelector)?.annotationNumber??ua.get(Ea?.selector??Ie.linkedSelector);if(void 0!==e)return e}let e=sa.get(Ie.id);if(void 0!==e)return e;if(Ie.groupId){let e=r.annotations.find(e=>e.groupId===Ie.groupId),t=e?sa.get(e.id):void 0;if(void 0!==t)return t}return la.count+1},[Ie,Ea,sa,ua,Ya,la.count,r.annotations]),$l=void 0!==Fl?`${Fl}.`:"",Ol=(0,Tr.useMemo)(()=>{if(!Ie||!$l||Ie.domEdit)return 0;let e=q.current?.getContext("2d");return e&&(e.font=`${Ie.fontSize}px ${ni}`),function({prefix:e,fontSize:t,railGap:n,context:r}){if(!e)return 0;let i=.6*t;return(r?.measureText(e).width??e.length*i)+(n??(r?.measureText(" ").width??i)/2)}({prefix:$l,fontSize:Ie.fontSize,railGap:Ea?2:void 0,context:e})},[Ie,$l,Ea,q]),Hl=Ie?.images?.length??r.annotations.find(e=>e.id===Ie?.id)?.imageCount??0,Wl=!Ie||Ie.domEdit||Ea?0:function({nestedAnnotationCount:e,interactionEpisodeStepCount:t,reserveSendHint:n,imageCount:r=0}){let i=+(r>0)+ +(t>0)+ +(e>0)+Number(n);return 0===i?0:po(r)+(r>0?4:0)+(e>0?36:0)+Gi(t)+(n?86:0)+2*Math.max(0,i-1)}({nestedAnnotationCount:Ma,imageCount:Hl,interactionEpisodeStepCount:Ie.interactionEpisode?.steps.length??0,reserveSendHint:!!v&&No===rf&&!!Ie.text.trim()}),Bl=!r.isAnnotating||!Ie?.linkedSelector||Ie.target||Ie.domEdit||Ea?null:Wr(Ie.linkedSelector,Ie.elements),Vl=!(!Ie||!Br(Ie)),ql=function(e){let[t,n]=(0,uc.useState)();return(0,uc.useLayoutEffect)(()=>{if(!e)return;let t,r=()=>{if(!e.isConnected)return;let i=rt(e);n(t=>t?.element===e&&t.rect.x===i.x&&t.rect.y===i.y&&t.rect.width===i.width&&t.rect.height===i.height?t:{element:e,rect:i}),t=requestAnimationFrame(r)};return r(),()=>cancelAnimationFrame(t)},[e]),t?.element===e?t.rect:void 0}(Bl),Yl=Vl&&ql?mr(ql,22,2,window.innerHeight):null,Ul=Ie?Yl?Yl.left+8:ql?ql.left+8:Ie.point.x-Co.x:0,Xl=Ie?ql?.right??Ie.point.x-Co.x:0,Kl=(0,Tr.useMemo)(()=>Ie&&!Ie.domEdit?function(e){let t=function(e){let t=[];for(let n of e.matchAll(/(?<!\\S)\\/\\S*/g)){let e=n[0],r=e.toLowerCase(),i=Object.values(Xe).filter(e=>e.startsWith(r));if(!i.length)continue;let o=e.length>1&&1===i.length?i[0].slice(e.length):"";t.push({start:n.index,token:e,suffix:o})}return t}(e)[0];if(!t)return;let n=e.slice(0,t.start);if(n.trim())return;let r=e.slice(t.start+t.token.length);return!r||Object.values(Xe).some(e=>e===t.token.toLowerCase())?{...t,leading:n,body:r}:void 0}(Ie.text):void 0,[Ie]),Ql=(0,Tr.useCallback)(()=>{let e=q.current;if(!e||!Ie)return{width:100,height:14,isWrapped:!1};if(Ie.domEdit){let e=Ie.domEdit.flowRect??Ie.domEdit.rect;return{width:Math.max(1,Math.min(e.width,window.innerWidth-e.left)),height:Math.max(1,e.height),isWrapped:Ie.domEdit.wrapsText}}let t=e.getContext("2d");if(!t)return{width:100,height:Ie.fontSize*Dr,isWrapped:!1};t.font=`${Ie.fontSize}px ${ni}`;let n=Ie.text+(Kl?.suffix??""),r=Ie.point.x-Co.x;if(!Ea){let e=!!(Ie.linkedSelector||Ie.target||Ie.region),r=nc({text:n,fontSize:Ie.fontSize,effectiveMaxWidth:384,annotationPrefixWidth:Ol,isModifiedRail:!1,fitToContent:e,context:t}).width+Ol+16,i=tc({anchorLeftX:Ul,anchorRightX:Xl,editorWidth:r,trailingWidth:Wl,viewportWidth:window.innerWidth});return nc({text:n,fontSize:Ie.fontSize,effectiveMaxWidth:Math.max(1,i.maxEditorWidth-16),annotationPrefixWidth:Ol,isModifiedRail:!1,fitToContent:e,context:t})}return nc({text:n,fontSize:Ie.fontSize,effectiveMaxWidth:ri(r),annotationPrefixWidth:Ol,isModifiedRail:!!Ea,context:t})},[Ie,Kl,q,Co.x,Ol,Ea,Wl,Ul,Xl])(),Gl=!!Ie?.domEdit,Zl=Ie?Math.max(1,Ie.text.split("\\n").length)*Ie.fontSize*Dr+8:0,Jl=Gl?Ql.height:Ql.height+8,es=Yl??(ql?mr(ql,Jl,4,window.innerHeight):void 0),ts=ti(Vl?"bottom-left":es?.anchor??Ie?.linkedAnchor),ns=Ql.isWrapped?Jl-Zl:0,rs=Ie?Gl?(Ie.domEdit.flowRect??Ie.domEdit.rect).top:es?.top??Ie.point.y-4-Co.y-ns:0,is=Ie?Gl?(Ie.domEdit.flowRect??Ie.domEdit.rect).left:Ie.point.x-8-Co.x:0,os=Gl?Ql.width:Ql.width+Ol+16,as=!Ie||Gl||Ea?is:tc({anchorLeftX:Ul,anchorRightX:Xl,editorWidth:os,trailingWidth:Wl,viewportWidth:window.innerWidth}).editorLeft,ls=Ie?Gl?rs:oi(rs,Jl,oa,as,os):0,ss=Ie?.domEdit?{image:Ie.domEdit.boundaryRects.map(()=>"linear-gradient(#000 0 0)").join(", "),position:Ie.domEdit.boundaryRects.map(e=>`${e.left-as}px ${e.top-ls}px`).join(", "),size:Ie.domEdit.boundaryRects.map(e=>`${e.width}px ${e.height}px`).join(", ")}:void 0,cs=Ie?Ie.domEdit?{position:"fixed",left:as,top:ls,zIndex:10002,width:os,height:Jl,minHeight:0,padding:0,margin:0,boxSizing:"border-box",appearance:"none",fontSize:Ie.fontSize,fontFamily:Ie.domEdit.fontFamily,fontWeight:Ie.domEdit.fontWeight,fontStyle:Ie.domEdit.fontStyle,color:"transparent",caretColor:r.activeColor,WebkitTextFillColor:"transparent",backgroundColor:"transparent",border:"none",borderRadius:0,outline:"none",boxShadow:"none",lineHeight:Ie.domEdit.lineHeight,textIndent:Ie.domEdit.firstLineIndent,letterSpacing:Ie.domEdit.letterSpacing,textTransform:Ie.domEdit.textTransform,textAlign:Ie.domEdit.textAlign,wordSpacing:Ie.domEdit.wordSpacing,textDecoration:Ie.domEdit.textDecoration,textShadow:Ie.domEdit.textShadow,resize:"none",overflow:"hidden",whiteSpace:Ie.domEdit.wrapsText?Ie.domEdit.whiteSpace:"pre",wordBreak:Ie.domEdit.wordBreak,overflowWrap:Ie.domEdit.overflowWrap,maskImage:ss?.image,maskPosition:ss?.position,maskSize:ss?.size,maskRepeat:"no-repeat",WebkitMaskImage:ss?.image,WebkitMaskPosition:ss?.position,WebkitMaskSize:ss?.size,WebkitMaskRepeat:"no-repeat"}:{position:"fixed",left:as,top:ls,zIndex:10002,width:os,height:Jl,padding:"3.5px 8px 4.5px",paddingLeft:8+Ol,boxSizing:"border-box",fontSize:Ie.fontSize,fontFamily:ni,color:"#ffffff",backgroundColor:r.activeColor,border:"none",borderRadius:ts,animation:Ie.isNew?"popmeltAnnotationFieldEnter 150ms ease-out both":void 0,outline:"none",boxShadow:"none",lineHeight:Dr,resize:"none",overflow:"hidden",whiteSpace:Ql.isWrapped?"pre-wrap":"pre",wordBreak:Ql.isWrapped?"break-word":void 0}:{},ds=Ie?.target&&Ie.linkedSelector?Wr(Ie.linkedSelector,Ie.elements):null,{nestedBadgeOwnerSelector:fs,hasExistingOverlay:ps,hoveredLinkedAnnotationId:hs,hasSelectedHighlightForElement:ms,ownedInFlightSelectorColors:gs,ownedFocusedSelectorColors:ys,selectorElementInfo:xs,claimElementOverlay:vs}=function({activeText:e,pendingLinkedText:t,activeTextSendHintId:n,activeTool:r,isAnnotating:i,annotations:o,pageAnnotations:a,pageStyleModifications:l,pageTextModifications:s,supersededAnnotations:u,nestedBadgeHover:c,isSendBundleHovered:d,badgeHoveredAnnotationId:f,hoveredTextId:p,badgeHoveredSelector:h,focusedThreadAnnotationId:m,inFlightSelectorColors:g,focusedSelectorColors:y,hoveredElement:x}){let v=new Map;for(let e of o)e.linkedSelector&&e.elements?.[0]&&v.set(e.linkedSelector,e.elements[0]);for(let e of[...l,...s])v.set(e.selector,e.element);for(let n of[e,t])n?.linkedSelector&&n.elements?.[0]&&v.set(n.linkedSelector,n.elements[0]);let b=(e,t)=>Wr(e,t??(v.has(e)?[v.get(e)]:void 0)),w=e=>e?o.find(t=>t.id===e)?.linkedSelector??null:null,S=c?c.ownerId===n?e?.linkedSelector??null:w(c.ownerId):null,k=[e?.linkedSelector,t?.linkedSelector,w(m),w(c||d?null:f),w(c||d?null:p),h].filter(Boolean),C=c||d?null:f||p,E=[],M=(e,t)=>{e&&E.push({target:e,owner:t})},T=(e,t,n)=>{e&&M(b(e,n),t)};if(i){if("hand"===r)for(let e of l)e.captured||T(e.selector,"pending-change");for(let e of s)e.captured||T(e.selector,"pending-change");for(let e of g?.keys()??[])T(e,"in-flight");for(let e of y?.keys()??[])T(e,"selected");if(T(e?.domEdit?e.linkedSelector:null,"active-edit",e?.elements),!c&&!d&&T(e?.linkedSelector||t?.linkedSelector,"direct-manipulation",e?.elements||t?.elements),!d&&m){let e=o.find(e=>e.id===m);e?.linkedSelector&&S!==e.linkedSelector&&T(e.linkedSelector,"thread-focus",e.elements)}if(C){let e=o.find(e=>e.id===C);T(e?.linkedSelector,"annotation-hover",e?.elements)}if(c&&!d)for(let e of c.annotationIds){let t=o.find(t=>t.id===e);T(t?.linkedSelector,"nested-preview",t?.elements)}if(d){for(let e of a)"pending"===(e.status??"pending")&&T(e.linkedSelector,"bundle-preview",e.elements);e&&!e.domEdit&&e.text?.trim()&&T(e.linkedSelector,"bundle-preview",e.elements);for(let e of[...l,...s])e.captured||T(e.selector,"bundle-preview",[e.element])}T(h,"badge-hover"),("inspector"===r||"sticker"===r)&&x&&!C&&!h&&M(x,"inspector-hover")}let R=function(e){let t=new Map;for(let n of e){let e=t.get(n.target);(!e||sc[n.owner]>sc[e])&&t.set(n.target,n.owner)}return t}(E),A=(e,t)=>R.get(e)===t,I=(e,t)=>{if(!e)return null;let n=new Map,r=new Set;for(let[i,o]of e){let e=b(i);e&&A(e,t)&&!r.has(e)&&(r.add(e),n.set(i,o))}return n.size>0?n:null},j=new Set;return{selectorElementInfo:v,hasExistingOverlay:e=>R.has(e),nestedBadgeOwnerSelector:S,hoveredLinkedAnnotationId:C,hasSelectedHighlightForElement:e=>k.some(t=>((e,t)=>!!t&&b(t)===e)(e,t)),getExistingAnnotationForElement:e=>{let t=null;for(let n of a)!n.linkedSelector||u.has(n)||Wr(n.linkedSelector,n.elements)!==e||(!t||n.timestamp>t.timestamp)&&(t=n);return t},ownedInFlightSelectorColors:I(g,"in-flight"),ownedFocusedSelectorColors:I(y,"selected"),claimElementOverlay:(e,t)=>!(!A(e,t)||j.has(e)||(j.add(e),0))}}({activeText:Ie,pendingLinkedText:De,activeTextSendHintId:rf,activeTool:r.activeTool,isAnnotating:r.isAnnotating,annotations:r.annotations,pageAnnotations:To,pageStyleModifications:Ao,pageTextModifications:Io,supersededAnnotations:aa,nestedBadgeHover:Rn,isSendBundleHovered:jn,badgeHoveredAnnotationId:vn,hoveredTextId:Ne,badgeHoveredSelector:Sn,focusedThreadAnnotationId:T,inFlightSelectorColors:p,focusedSelectorColors:Ka,hoveredElement:Ye}),bs=Nl,ws=Ie?.domEdit?yn(r.activeColor,.28):"#000000",Ss=Ie?.domEdit?"transparent":"#ffffff",ks=Ie?.linkedSelector&&!Ie.domEdit?Ie:De,Cs=ks?.linkedSelector?Wr(ks.linkedSelector,ks.elements):null,Es=Cs??Ye,Ms=Cs?"selected":"hover",Ts=Cs?ks?.target??Ir(Cs):ca,Rs=Ts?.adapter,As=Ts?.key;(0,Tr.useEffect)(()=>(_?.(r.isAnnotating&&Es?{element:Es,selection:Ms,subject:Rs&&As?{adapter:Rs,key:As}:void 0}:null),()=>_?.(null)),[_,r.isAnnotating,Es,Ms,Rs,As]);let Is=e=>{Be.current=null,z?.remove(e),Ue(null),et(null),Oe(t=>t?.target.adapter===e.adapter&&t.target.key===e.key?null:t)};if(pe){let e=fe.current,t=e?.draft?r.activeColor:r.annotations.find(t=>t.id===e?.id)?.color??r.activeColor;return xe?(0,tf.jsx)(Us,{cursor:xe,stepCount:ge,accentColor:t,toolbarElement:j?.current,threadElement:L}):null}return(0,tf.jsxs)(tf.Fragment,{children:[(fl.preview||Ie?.region)&&(0,tf.jsx)("svg",{"data-popmelt-lasso":"","aria-hidden":"true",style:{position:"fixed",inset:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:9999},children:(0,tf.jsx)("polygon",{points:(fl.preview??Ie.region.points.map(e=>({x:e.x-Co.x,y:e.y-Co.y}))).map(e=>`${e.x},${e.y}`).join(" "),fill:r.activeColor,fillOpacity:.07,fillRule:"evenodd",stroke:r.activeColor,strokeWidth:1,strokeDasharray:Ge})}),(0,tf.jsx)("canvas",{ref:ne,id:"devtools-canvas",style:Dl,onPointerDown:e=>{if(D?.(),"touch"===e.pointerType&&"sticker"===r.activeTool)return;let t="sticker"===r.activeTool&&e.isPrimary&&0===e.button,n=t&&B?nn(e.clientX,e.clientY):null;if(H&&"family"!==pt&&n?.hasAttribute("data-popmelt-subject-key"))return void O?.(n);let i=n&&B?.(n);Ee.current=t&&(i||O&&"family"===pt)?{startX:e.clientX,startY:e.clientY,moved:!1}:null,(!i||(clearTimeout(Ce.current),"value"!==pt))&&hl(e)},onPointerMove:e=>{Ee.current&&(Ee.current=rc(Ee.current,e.clientX,e.clientY)),D?.(),(fl.active()||re.current||!ca||!Qc(e.currentTarget.ownerDocument,e.clientX,e.clientY))&&ml(e)},onTouchEnd:fl.activateTouchTap,onClick:e=>{let t=Ee.current;if(Ee.current=null,!ic(t))return;let n=nn(e.clientX,e.clientY);n&&(clearTimeout(Ce.current),B?.(n)?1===e.detail&&(Ce.current=setTimeout(()=>{"value"===pt&&n instanceof HTMLElement?Qr(n):"family"===pt&&O?.(n)},350)):"family"===pt&&O?.(n))},onPointerUp:gl,onPointerCancel:e=>{Ee.current=null,fl.active()?fl.cancel():re.current?le():dl(e)},onLostPointerCapture:e=>{fl.active()&&fl.cancel(),re.current?.pointerId===e.pointerId&&le()},onDoubleClick:xl,onPointerLeave:e=>{if(Ee.current=null,re.current||fl.active()||function(e){return e instanceof Element&&null!==e.closest("[data-popmelt-steer-overlay]")}(e.relatedTarget)||nf(e.relatedTarget))return;gl(e),fn(),ln.current=null,sn.current=null;let t=()=>{Ue(null),et(null)};if(Ir(Ye)){let{clientX:n,clientY:r}=e;return void window.setTimeout(()=>{nf(document.elementFromPoint(n,r))||null!==Be.current||t()},100)}t()},onContextMenu:e=>{if(ca&&Qc(e.currentTarget.ownerDocument,e.clientX,e.clientY))return e.preventDefault(),e.stopPropagation(),void Is(ca);zl(e)}}),oe&&z&&(()=>{let e=z.resolve(oe);return e?(0,tf.jsx)(Ru,{element:e.element,activeFacet:"translate",accentColor:r.activeColor,showHandles:!1,showRotateHandle:!1,refreshKey:He}):null})(),$e&&z&&(0,tf.jsx)($u,{accentColor:r.activeColor,created:$e.created,registry:z,target:$e.target,onCommit:e=>{Ue(e.element),et(e.elementInfo),We(e=>e+1)},onClose:()=>Oe(null),onCancelCreated:()=>{z.remove($e.target),Oe(null)}},`${$e.target.adapter}:${$e.target.key}`),vt&&(0,tf.jsx)(zo,{color:Nl,cursorRef:Ve,tool:vt.tool,onHandoff:()=>bt(e=>e?.id===vt.id?{...e,nativeReady:!0}:e),onDone:()=>bt(null)},vt.id),r.isAnnotating&&Ie&&(0,tf.jsxs)(tf.Fragment,{children:[ds&&Ie.subjectAnchor&&(0,tf.jsx)(jo,{element:ds,annotationRect:{left:as,top:ls,width:os,height:Jl},subjectAnchor:Ie.subjectAnchor,color:r.activeColor,subjectRegistry:z}),(0,tf.jsx)(Mo,{segments:Ie.domEdit?.segments,canvasRef:q,value:Ie.text,command:Kl,fontSize:Ie.fontSize,prefix:$l,inputRef:Qi,inputStyle:cs,selectionBackground:ws,selectionColor:Ss,annotationBorderRadius:ts,activeColor:r.activeColor,boundaryRects:Ie.domEdit?.boundaryRects,viewportClip:Ie.domEdit&&Je(Ie.domEdit.targetElement.ownerDocument)?lt(new DOMRect(0,0,window.innerWidth,window.innerHeight),Ie.domEdit.targetElement.ownerDocument):void 0,wrapsDomText:Ie.domEdit?.wrapsText,showEditor:!Ea,rawLeft:as,top:ls,baselineOffset:-.5,onChange:Tl,onKeyDown:Rl,onPaste:Le,onBlur:sl},Ie.paragraphSession?.id??Ie.id),!Ea&&!Ie.domEdit&&(0,tf.jsx)(yo,{rawLeft:as,width:os,top:ls,scroll:Co,collisionId:Ca,nestedAnnotationCount:Ma,nestedAnnotationIds:Ta,nestedBadgeColor:Ra,imageCount:Hl,color:r.activeColor,interactionEpisodeStepCount:Ie.interactionEpisode?.steps.length??0,showSendHint:No===rf&&!!Ie.text.trim(),bundleCount:Lo,onHoverNestedAnnotations:$i,onHoverSendHint:Oi,onClearInteractionEpisode:()=>ro(Ie.id),onSend:v?ol:void 0}),(0,tf.jsx)(mo,{point:Ie.point,scroll:Co,attachments:Ie.attachments??[],showAttachments:!Ie.domEdit,onRemoveAttachment:Pe})]}),r.isAnnotating&&"hand"!==r.activeTool&&(F&&(Ao.length>0||Io.length>0)||$a.length>0||(h?.size??0)>0||fa)&&(0,tf.jsx)(gu,{styleModifications:F?Ao:[],textModifications:F?Io:[],stagedComments:$a,accentColor:r.activeColor,annotationNumberBySelector:ua,inFlightSelectors:d,inFlightAnnotationIds:a,activeAnnotationIds:u,inFlightSelectorJobIds:f,waitingApprovalJobIds:s,inFlightSelectorColors:p,toolbarRef:j,onHoverSelector:Fi,sendHintSelector:Wa,pendingBundleCount:Lo,onHoverSendBundle:Oi,onSend:v?ol:void 0,onSelectSticker:Wi,onDeleteSticker:Bi,threadStates:h,onViewThread:b,hoveredElement:Ye,hoveredElementInfo:Ze,showHoverIdentifier:fa,onEditComment:il,onDeleteComment:bo,onDeletePeerComment:k?e=>{let t=qi.current.annotations.find(t=>t.id===e);t&&Hi(t,qi.current.annotations)?bo(e):k(e)}:void 0,onDiscardTextChanges:wo,onArchiveThread:S,onClearInteractionEpisode:ro,onEditSubject:yl,onDeleteSubject:Is,onHoverSubjectLabel:e=>{Be.current=e},refreshKey:_t,activeCommentEntry:Ea?{element:Ea.element,width:os,imageCount:Hl,trailingWidth:po(Hl)+Gi(Ie?.interactionEpisode?.steps.length??0),render:e=>Ie&&Ea?(0,tf.jsxs)(tf.Fragment,{children:[(0,tf.jsx)(Ro,{anchor:e,insetTopLeft:Vl,width:os,height:Jl,value:Ie.text,command:Kl,fontSize:Ie.fontSize,prefix:$l,inputRef:Qi,inputStyle:cs,onChange:Tl,onKeyDown:Rl,onPaste:Le,onBlur:sl,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),bo(Ie.id)}}),(0,tf.jsx)(Zi,{stepCount:Ie.interactionEpisode?.steps.length??0,onClear:()=>ro(Ie.id)})]}):null}:void 0}),"hand"===r.activeTool&&r.isAnnotating&&(Ao.length>0||Io.length>0)&&(0,tf.jsx)(vu,{styleModifications:Ao.filter(e=>{let t=Wt(e.selector);return!!t&&vs(t,"pending-change")}),textModifications:Io.filter(e=>{let t=Wt(e.selector);return!!t&&vs(t,"pending-change")}),accentColor:r.activeColor}),F&&r.isAnnotating&&!Ie?.domEdit&&(()=>{let e=new Set;return Io.flatMap(t=>{if(t.captured||e.has(t.selector))return[];let n=Wt(t.selector);return n&&vs(n,"pending-change")?(e.add(t.selector),[(0,tf.jsx)(kr,{element:n,isSelected:!1,color:r.activeColor,hideTooltip:!0},`pending-text-change-${t.selector}`)]):[]})})(),r.isAnnotating&&(0,tf.jsx)(oo,{annotations:To,displayAnnotations:Ua,supersededAnnotations:aa,inFlightIds:a,orientationLabels:l,activeIds:u,queuePositions:c,scrollX:Co.x,scrollY:Co.y,annotationGroupMap:sa,onViewThread:b,onSelectAnnotation:xo,onDeleteDraftAnnotation:bo,onClearInteractionEpisode:ro,onHoverAnnotation:Di,canvasRef:q,toolbarRef:j,activeBundleAnnotationIds:Xo,inactiveBundleOpacity:Qo,animateBundleOpacity:!Go&&!Uo,hoverRestoredAnnotationIds:Ko,nestedAnnotationCountById:ga,nestedAnnotationIdsById:ya,onHoverNestedAnnotations:$i,onHoverSendBundle:Oi,onSend:v?ol:void 0,sendHintAnchorId:Xa===rf?null:Xa,pendingBundleCount:Lo,parentPinnedAnnotationIds:Yi,parentPinnedLocationLabels:$o,parentPinnedTooltipAnnotationId:Oo,onActivateAnnotation:Yo,hiddenAnnotationIds:Ha}),r.isAnnotating&&(0,tf.jsx)(so,{annotations:Ua,activeIds:u,scrollX:Co.x,scrollY:Co.y,spotlightIds:Go,emphasizedIds:Xo,hoverRestoredIds:Ko,inactiveOpacity:Qo}),r.isAnnotating&&gs&&(0,tf.jsx)(uo,{inFlightSelectorColors:gs,selectorElementInfo:xs,subjectRegistry:z}),r.isAnnotating&&ys&&(0,tf.jsx)(uo,{inFlightSelectorColors:ys,selectorElementInfo:xs,animated:!1,subjectRegistry:z}),(0,tf.jsx)(us,{active:"hand"===r.activeTool&&r.isAnnotating,accentColor:r.activeColor,domDropPreview:Hn,cursorViewport:Kn,gapElement:rr?Gn.current.element:Zn,gapDragging:rr,gapHoveredAxis:tr,gapIsAuto:ar,gapRefreshKey:cr,swipeHint:fr,radiusElement:br?hr.current.element:gr,radiusDragging:br,radiusHoveredCorner:xr,textElement:Lr?Sr.current.element:Cr,textDragging:Lr,textHoveredProperty:Rr,paddingElement:Bn?zn.current.element:_n,paddingDragging:Bn,paddingHoveredSide:$n}),r.isAnnotating&&e&&!Ie&&!De&&!$e&&(0,tf.jsx)(Mr,{hasExistingOverlay:ps,entry:e,color:r.activeColor,subjectRegistry:z}),("inspector"===r.activeTool||"sticker"===r.activeTool)&&r.isAnnotating&&(0,tf.jsx)(tf.Fragment,{children:Ye&&(()=>{let e="sticker"===r.activeTool&&"value"===pt&&("padding"===it||"margin"===it)&&en.current?.element===Ye,t=Pu("sticker"===r.activeTool,it,pt,dt);if(ms(Ye)||!vs(Ye,"inspector-hover"))return null;let n=Ie?.linkedSelector?Wr(Ie.linkedSelector,Ie.elements):null,i=De?.linkedSelector?Wr(De.linkedSelector,De.elements):null,o=!!n&&bi(n,Ye,Ie?.elements?.[0]?.context)||!!i&&bi(i,Ye,De?.elements?.[0]?.context)||To.some(e=>!(!e.linkedSelector||aa.has(e))&&bi(Wr(e.linkedSelector,e.elements),Ye,e.elements?.[0]?.context)),a=!!Ne||!!vn;return(0,tf.jsxs)(tf.Fragment,{children:[!e&&(0,tf.jsx)(kr,{element:Ye,isSelected:!1,elementInfo:Ze,color:bs,hideOutline:!ca,hideFill:!ca,refreshKey:"sticker"===r.activeTool?_t:void 0,hideTooltip:da||fa||o||a}),!t&&!ca&&(0,tf.jsx)(Ru,{element:Ye,activeFacet:"translate",accentColor:bs,showHandles:!1,outlineStyle:"dashed",refreshKey:"sticker"===r.activeTool?_t:void 0})]})})()}),(0,tf.jsx)(zu,{active:"sticker"===r.activeTool&&r.isAnnotating,accentColor:bs,family:it,stage:pt,subproperty:dt,hoveredElement:Ye,previewElement:en.current?.element??null,transformPreviewElement:an.current?.element??null,previewRevision:_t,cursorViewport:yt,drag:vi,onGapPointerDown:Gr,onRadiusPointerDown:di,onSpacingPointerDown:yi,onTransformPointerDown:xi}),"sticker"===r.activeTool&&r.isAnnotating&&yt&&(0,tf.jsx)($s,{cursor:yt,family:it,step:ut,subproperty:dt,stage:pt,accentColor:r.activeColor,applyPulse:St,contextLabelPulse:Et,depthSnapPulse:Tt,rejectPulse:It,stepUnavailable:Lt,query:Ft?{tokens:Ft.segments.flatMap((e,t)=>{let n=Tc(Ft.history[t]?.scope??wc,e);return n?[Ac(n)]:[]}),...Ic(Ft.query,Rc(Ft.scope,Ft.query))}:null,controlBounds:W,toolbarElement:j?.current,threadElement:L,annotationRailHovered:null!==Sn||null!==vn||null!==Rn||jn}),!Rn&&!jn&&(Ie?.linkedSelector||De?.linkedSelector)&&(()=>{let e=Ie?.linkedSelector||De?.linkedSelector;if(!e)return null;let t=Wr(e,Ie?.elements??De?.elements);return t&&vs(t,"direct-manipulation")?(0,tf.jsx)(kr,{element:t,isSelected:!0,color:Sa?.color??r.activeColor,hideTooltip:!0}):null})(),T&&(()=>{if(jn)return null;let e=r.annotations.find(e=>e.id===T);if(!e?.linkedSelector||fs===e.linkedSelector)return null;let t=Wr(e.linkedSelector,e.elements);if(!t||!vs(t,"thread-focus"))return null;let n=!(!a||!a.has(e.id));return(0,tf.jsx)(kr,{element:t,isSelected:!n,color:e.color,onActivate:e.threadId?()=>Vi(e.threadId):void 0,hideTooltip:!0})})(),hs&&(()=>{let e=r.annotations.find(e=>e.id===hs);if(!e?.linkedSelector)return null;let t=Wr(e.linkedSelector,e.elements);return t&&vs(t,"annotation-hover")?(0,tf.jsx)(kr,{element:t,isSelected:!1,color:e.color,onActivate:e.threadId?()=>Vi(e.threadId):void 0,hideTooltip:!0}):null})(),Rn&&!jn&&(()=>{let e=new Set;return Rn.annotationIds.flatMap(t=>{let n=r.annotations.find(e=>e.id===t);if(!n?.linkedSelector||e.has(n.linkedSelector))return[];let i=Wr(n.linkedSelector,n.elements);return i&&vs(i,"nested-preview")?(e.add(n.linkedSelector),[(0,tf.jsx)(kr,{element:i,isSelected:!1,color:n.color,hideTooltip:!0},`nested-annotation-${t}`)]):[]})})(),jn&&(()=>{let e=[],t=new Set,n=(n,r,i,o)=>{if(!r||t.has(r))return;let a=Wr(r,i);a&&vs(a,"bundle-preview")&&(t.add(r),e.push({id:n,element:a,color:o}))};for(let e of To)"pending"===(e.status??"pending")&&n(e.id,e.linkedSelector,e.elements,e.color);Ie&&!Ie.domEdit&&Ie.text.trim()&&n(rf,Ie.linkedSelector,Ie.elements,r.activeColor);for(let e of Ao)e.captured||n(`style-${e.selector}`,e.selector,[e.element],r.activeColor);for(let e of Io)e.captured||n(`text-${e.selector}`,e.selector,[e.element],r.activeColor);return e.map(e=>(0,tf.jsx)(kr,{element:e.element,isSelected:!1,color:e.color,hideTooltip:!0},`send-bundle-${e.id}`))})(),Sn&&(()=>{let e=Wt(Sn);if(!e||!vs(e,"badge-hover"))return null;let t=Kr([Sn],h??new Map,Na.get(Sn)??r.activeColor,Wt);return(0,tf.jsx)(tf.Fragment,{children:(0,tf.jsx)(kr,{element:e,isSelected:!1,color:t,fillOpacity:.1,hideTooltip:!0,subjectRegistry:z})})})()]})}var af=u(d()),lf=u(d()),sf=u(m()),uf=u(v()),cf=(0,lf.forwardRef)(function({style:e,...t},n){return(0,uf.jsx)("span",{...t,ref:n,role:"tooltip",style:{background:"var(--popmelt-thread-raised, #222)",color:"var(--popmelt-thread-primary, #eee)",borderRadius:16,boxSizing:"border-box",...e}})}),df=new WeakMap;function ff(e){return e.closest("[data-popmelt-tooltip-group]")??e.parentElement}function pf({hint:e,above:t,anchorRef:n,children:r,...i}){let o=(0,lf.useId)(),a=(0,lf.useRef)(null),l=(0,lf.useRef)(null),s=(0,lf.useRef)(!1),u=(0,lf.useRef)(!1),[c,d]=(0,lf.useState)("closed"),f="entering"===c||"instant"===c,p="closed"!==c?a.current:null,h=p?.closest(\'[data-popmelt-tooltip-boundary], [data-devtools="thread-panel"]\'),m=p?.getRootNode(),g=h??(m&&"host"in m?m:p?.ownerDocument.body);function y(e,t){let n=ff(e),r=n&&df.get(n),i=!1;if(r&&r.tip!==l.current){let n=e.ownerDocument.defaultView;i=t&&!!n&&Number(n.getComputedStyle(r.tip).opacity)>0,r.close()}d(i?"instant":"entering")}return(0,lf.useLayoutEffect)(()=>{let e=l.current,r=p?.ownerDocument.defaultView;if(!p||!e||!r)return;let i=n?.current??p,o=()=>{let n=h?.getBoundingClientRect(),o=i.getBoundingClientRect(),a=Math.max(n?.left??0,0)+8,l=Math.min(n?.right??r.innerWidth,r.innerWidth)-8,s=Math.max(n?.top??0,0)+8,u=Math.min(n?.bottom??r.innerHeight,r.innerHeight)-8;e.style.maxWidth=Math.max(0,Math.min(180,l-a))+"px";let{width:c,height:d}=e.getBoundingClientRect();if(o.right<=a||o.left>=l||o.bottom<=s||o.top>=u||c>l-a||d>u-s)return void(e.style.visibility="hidden");let f=(e,t,n)=>Math.max(t,Math.min(e,n)),p=f(o.left+(o.width-c)/2,a,l-c),m=o.top-d-4,g=o.bottom+4,y=f((t?m>=s:g+d>u)?m:g,s,u-d);e.style.left=p-(n?.left??0)-(h?.clientLeft??0)+"px",e.style.top=y-(n?.top??0)-(h?.clientTop??0)+"px",e.style.visibility="visible"};o();let a=new r.ResizeObserver(o);a.observe(p),i!==p&&a.observe(i),a.observe(e),h&&a.observe(h);let s=p.getRootNode();return s.addEventListener("scroll",o,!0),r.addEventListener("resize",o),()=>{a.disconnect(),s.removeEventListener("scroll",o,!0),r.removeEventListener("resize",o)}},[p,n,h,t,e]),(0,lf.useLayoutEffect)(()=>{let e=p&&ff(p),t=l.current;if(!e||!t)return;let n={tip:t,close:()=>d("closed")};return df.set(e,n),()=>{df.get(e)===n&&df.delete(e)}},[p]),(0,lf.useLayoutEffect)(()=>{let e=l.current,t=p?.ownerDocument.defaultView;if(!e||!t)return;let n="instant"!==c&&!t.matchMedia("(prefers-reduced-motion: reduce)").matches;if(e.style.transition=n?"opacity 120ms ease-out":"none","entering"===c&&t.getComputedStyle(e).opacity,e.style.opacity=f?"1":"0",!f){if(!n)return void d("closed");let e=t.setTimeout(()=>d("closed"),120);return()=>t.clearTimeout(e)}},[p,f,c]),(0,lf.useEffect)(()=>{let e=a.current?.ownerDocument;if(!f||!e)return;let t=e=>{"Escape"===e.key&&(d("closed"),e.stopPropagation())};return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)},[f]),(0,uf.jsxs)("span",{ref:a,style:{position:"relative",display:"inline-flex",minWidth:0},onPointerEnter:e=>{"touch"!==e.pointerType&&(s.current=!0,y(e.currentTarget,!0))},onPointerLeave:()=>{s.current=!1,u.current||d(e=>"closed"===e?e:"leaving")},onFocus:e=>{u.current=e.target.matches(":focus-visible"),u.current&&y(e.currentTarget,!1)},onBlur:()=>{u.current=!1,s.current||d(e=>"closed"===e?e:"leaving")},children:[(0,uf.jsx)("button",{type:"button",...i,"aria-describedby":f?o:void 0,children:r}),g&&(0,sf.createPortal)((0,uf.jsx)(cf,{ref:l,id:o,"aria-hidden":!f||void 0,style:{position:h?"absolute":"fixed",opacity:0,visibility:"hidden",background:"var(--popmelt-thread-action, #222)",color:"var(--popmelt-thread-on-action, #eee)",whiteSpace:"normal",overflowWrap:"anywhere",zIndex:20,width:"max-content",maxWidth:180,pointerEvents:"none",fontSize:12,fontWeight:500,lineHeight:1.35,padding:"5px 8px",borderRadius:8},children:e??i["aria-label"]}),g)]})}var hf=u(v()),mf=[1,1.5,2.25,3.375,4];function gf(e=1){let t=e,n=null,r=0,i=0,o=()=>null===n?1:n/(t??1),a=e=>Math.max(Math.min(1,o()),Math.min(4/(t??1),e)),l=new Set,s=(e,t)=>t<=1?(1-t)/2:Math.max(1-t,Math.min(0,e));function u(e,o,a){let s=1===e?null:e*(t??1);if(n!==s||r!==o||i!==a){n=s,r=o,i=a;for(let e of l)e()}}return{clampScale:a,snapshot:()=>({pageScale:n,focusX:r,focusY:i}),restore(e){if(e.pageScale!==n||e.focusX!==r||e.focusY!==i){({pageScale:n,focusX:r,focusY:i}=e);for(let e of l)e()}},getFitScale:()=>t,setFitScale(e){if(t!==e){t=e;for(let e of l)e()}},getScale:o,setScale(e){let t=a(e);u(t,1===t?0:r,1===t?0:i)},getView(e,a){let l=o(),u=(1-l)/2,c=n??t??1;return{scale:l,x:s(e>0?u-r*c/e:u,l),y:s(a>0?u-i*c/a:u,l)}},setView(e,n,r,i,o){if(!i||!o)return;let l=a(e),c=(1-l)/2,d=l*(t??1);u(l,(c-s(n,l))*i/d,(c-s(r,l))*o/d)},subscribe:e=>(l.add(e),()=>{l.delete(e)})}}function yf({framing:e}){let t=(0,af.useSyncExternalStore)(e.subscribe,e.getScale,e.getScale),n=(0,af.useSyncExternalStore)(e.subscribe,e.getFitScale,e.getFitScale),r=null===n?[]:mf.map(e=>e/n),i=r.find(e=>e>t)??t,o=r.filter(e=>e<t).pop()??Math.min(1,t);function a(e,r){if(null===n)return`Zoom ${e}`;let i=Math.round(n*r*100)+"%";return r===t?"out"===e?`Fit (${i})`:`Maximum zoom (${i})`:`Zoom ${e} to ${i}`}return(0,hf.jsxs)("div",{"data-preview-zoom-controls":"",role:"group","aria-label":"Preview framing","data-popmelt-canvas-block":"",children:[(0,hf.jsx)(pf,{type:"button","aria-label":"Zoom out",hint:a("out",o),disabled:o===t,onClick:()=>e.setScale(o),children:(0,hf.jsx)(ie,{size:14})}),(0,hf.jsx)(pf,{type:"button","aria-label":"Zoom in",hint:a("in",i),disabled:i===t,onClick:()=>e.setScale(i),children:(0,hf.jsx)(ce,{size:14})})]})}function xf({children:e,overlay:t,interactive:n=!1,framing:r,parentGestureSurface:i}){let o=Ae.dark,[a]=(0,af.useState)(gf),l=r??a,s=(0,af.useRef)(null),[u,c]=(0,af.useState)(),[d,f]=(0,af.useState)({scale:1,x:0,y:0}),p=(0,af.useRef)(d);return(0,af.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=l.getView(t.width,t.height);p.current=n,f(n)},r=()=>{c({width:e.clientWidth,height:e.clientHeight}),t()},o=l.subscribe(t);r();let a=typeof ResizeObserver<"u"?new ResizeObserver(r):void 0;a?.observe(e);let u=()=>window.matchMedia("(any-hover: hover) and (any-pointer: fine)").matches,d=t=>(i&&t.currentTarget===i?e.ownerDocument.defaultView?.frameElement:e)?.getBoundingClientRect()??e.getBoundingClientRect(),h=(t,n,r,i=e.getBoundingClientRect())=>{if(!i.width||!i.height)return;let o=p.current,a=l.clampScale(t),s=Math.max(0,Math.min(1,(n-i.left)/i.width)),u=Math.max(0,Math.min(1,(r-i.top)/i.height));l.setView(a,s-(s-o.x)*a/o.scale,u-(u-o.y)*a/o.scale,i.width,i.height)},m=null,g=t=>{if(!n&&!u()||!t.ctrlKey&&1===p.current.scale)return;t.preventDefault(),t.stopPropagation();let r=d(t),i=1===t.deltaMode?16:2===t.deltaMode?e.clientHeight:1;t.ctrlKey?null===m&&h(p.current.scale*Math.exp(-t.deltaY*i*.01),t.clientX,t.clientY,r):r.width&&r.height&&l.setView(p.current.scale,p.current.x-t.deltaX*i/r.width,p.current.y-t.deltaY*i/r.height,r.width,r.height)},y=e=>{if(!n&&!u())return;e.preventDefault(),e.stopPropagation();let t=e;if("gesturestart"===e.type)m=p.current.scale;else if("gestureend"===e.type)m=null;else if(null!==m&&Number.isFinite(t.scale)){let n=d(e);h(m*t.scale,Number.isFinite(t.clientX)?t.clientX:n.left+n.width/2,Number.isFinite(t.clientY)?t.clientY:n.top+n.height/2,n)}},x=null,v=e=>{if(2!==e.touches.length)return void(x=null);let[t,n]=[e.touches[0],e.touches[1]],r=(t.clientX+n.clientX)/2,i=(t.clientY+n.clientY)/2,o=Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY);if(e.preventDefault(),"touchmove"===e.type&&null===m&&x&&x.distance>0){let t=d(e);h(p.current.scale*o/x.distance,x.x,x.y,t);let n=p.current;t.width&&t.height&&l.setView(n.scale,n.x+(r-x.x)/t.width,n.y+(i-x.y)/t.height,t.width,t.height)}x={x:r,y:i,distance:o}},b=t=>{if(p.current.scale<=1||!(t.target instanceof Element)||!t.target.closest("[data-preview-zoom-content]"))return;let n=t.target.getBoundingClientRect(),r=e.getBoundingClientRect();(n.left<r.left||n.top<r.top||n.right>r.right||n.bottom>r.bottom)&&l.setScale(1)},w=["touchstart","touchmove","touchend","touchcancel"],S=i?[e,i]:[e],k=["gesturestart","gesturechange","gestureend"];for(let e of S){if(n)for(let t of w)e.addEventListener(t,v,{passive:!1,capture:!0});e.addEventListener("wheel",g,{passive:!1,capture:n});for(let t of k)e.addEventListener(t,y,{passive:!1,capture:n})}return n&&e.addEventListener("focusin",b),()=>{for(let e of S){if(n)for(let t of w)e.removeEventListener(t,v,!0);e.removeEventListener("wheel",g,n);for(let t of k)e.removeEventListener(t,y,n)}e.removeEventListener("focusin",b),o(),a?.disconnect()}},[n,l,i]),(0,af.useLayoutEffect)(()=>{n&&s.current&&function(e){let t=e.ownerDocument.defaultView;t&&gr.get(t)?.schedule(),e.dispatchEvent(new Event(yr,{bubbles:!0}))}(s.current)},[n,d,u]),(0,hf.jsxs)("div",{ref:s,"data-preview-zoom":!0,style:{position:"relative",width:"100%",aspectRatio:n?void 0:"16 / 9",height:n?"100%":void 0,touchAction:n?"none":void 0,overflow:"hidden",borderRadius:8},children:[(0,hf.jsx)("div",{"data-preview-zoom-content":!0,style:{width:u?.width||"100%",height:u?.height||"100%",zoom:d.scale,transformOrigin:"0 0",transform:`translate(${100*d.x/d.scale}%, ${100*d.y/d.scale}%)`},children:e}),t,n&&!r&&(0,hf.jsx)(yf,{framing:l}),!n&&d.scale>1&&(0,hf.jsxs)(hf.Fragment,{children:[(0,hf.jsx)("style",{children:`\\n [data-preview-zoom-reset] span { color: ${o.primary}; }\\n [data-preview-zoom-reset] svg { color: ${o.secondary}; }\\n [data-preview-zoom-reset]:hover span, [data-preview-zoom-reset]:focus-visible span { color: ${o.secondary}; }\\n [data-preview-zoom-reset]:hover svg, [data-preview-zoom-reset]:focus-visible svg { color: ${o.primary}; }\\n [data-preview-zoom-reset] span, [data-preview-zoom-reset] svg { transition: color 120ms ease; }\\n `}),(0,hf.jsxs)("button",{"data-popmelt-canvas-block":"","data-preview-zoom-reset":!0,type:"button","aria-label":"Reset preview zoom",onClick:()=>l.setScale(1),style:{position:"absolute",right:8,bottom:8,display:"inline-flex",alignItems:"center",gap:6,border:0,borderRadius:8,padding:"4px 6px 4px 10px",background:o.control,color:o.primary,fontSize:12,cursor:"pointer"},children:[(0,hf.jsxs)("span",{children:[Math.round(100*d.scale),"%"]}),(0,hf.jsx)(re,{size:14,"aria-hidden":"true"})]})]})]})}var vf=/^(?:@[a-zA-Z][\\w-]{0,63}|~?(?:0|[1-9]\\d{0,3})(?:\\.(?:0|[1-9]\\d{0,3})){0,31}|)$/;function bf(e){if(e.matches(\'svg, img, [role="img"]\'))return!0;if(e.childElementCount||"http://www.w3.org/1999/xhtml"!==e.namespaceURI)return!1;let t=e.ownerDocument.defaultView?.getComputedStyle(e).maskImage;return!!t&&"none"!==t}function wf(e){let t=e.getAttribute("data-popmelt-subject-label")||e.getAttribute("data-explore-part");if(t)return t.slice(0,80);let n=e.closest(\'button, a[href], [role="button"], [role="link"]\');if(n===e)return e.matches(\'a[href], [role="link"]\')?"link":"button";let r=e.getAttribute("aria-label");if(bf(e)){let t=r||e.getAttribute("alt")||e.querySelector(":scope > title")?.textContent;if(t)return t.slice(0,80);if(n){let t=Array.from(n.querySelectorAll("*")).filter(bf);if(t.length>1)return"icon "+(t.indexOf(e)+1)}return"icon"}let i=Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent).join(" ").trim();return n&&i?"label":(r||i||e.localName).slice(0,80)}var Sf="[modern-screenshot]",kf=typeof window<"u",Cf=kf&&"Worker"in window,Ef=(kf&&window,kf&&window,kf?window.navigator?.userAgent:""),Mf=Ef.includes("Chrome"),Tf=Ef.includes("AppleWebKit")&&!Mf,Rf=Ef.includes("Firefox"),Af=e=>"CSSLayerBlockRule"===e.constructor.name,If=e=>1===e.nodeType,jf=e=>"object"==typeof e.className,Lf=e=>"image"===e.tagName,Pf=e=>If(e)&&typeof e.style<"u"&&!jf(e),zf=e=>8===e.nodeType,Nf=e=>"IMG"===e.tagName,_f=e=>"VIDEO"===e.tagName,Df=e=>"SLOT"===e.tagName;function Ff(e){let t=e?.createElement?.("canvas");return t&&(t.height=t.width=1),!!t&&"toDataURL"in t&&!!t.toDataURL("image/webp").includes("image/webp")}var $f=e=>e.startsWith("data:");function Of(e,t){if(e.match(/^[a-z]+:\\/\\//i))return e;if(kf&&e.match(/^\\/\\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!kf)return e;let n=Hf().implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function Hf(e){return(e&&If(e)?e?.ownerDocument:e)??window.document}var Wf="http://www.w3.org/2000/svg",Bf=e=>function(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(new Error(`Failed read blob to ${t}`)),i.readAsDataURL(e)})}(e,"dataUrl");function Vf(e,t){let n=Hf(t).createElement("img");return n.decoding="sync",n.loading="eager",n.src=e,n}function qf(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:o,onWarn:a}=t??{},l="string"==typeof e?Vf(e,Hf(i)):e,s=null,u=null;function c(){n(l),s&&clearTimeout(s),u?.()}if(r&&(s=setTimeout(c,r)),_f(l)){let e=l.currentSrc||l.src;if(!e)return l.poster?qf(l.poster,t).then(n):c();if(l.readyState>=2)return c();let r=c,i=t=>{a?.("Failed video load",e,t),o?.(t),c()};u=()=>{l.removeEventListener("loadeddata",r),l.removeEventListener("error",i)},l.addEventListener("loadeddata",r,{once:!0}),l.addEventListener("error",i,{once:!0})}else{let e=Lf(l)?l.href.baseVal:l.currentSrc||l.src;if(!e)return c();let t=async()=>{if(Nf(l)&&"decode"in l)try{await l.decode()}catch(t){a?.("Failed to decode image, trying to render anyway",l.dataset.originalSrc||e,t)}c()},n=t=>{a?.("Failed image load",l.dataset.originalSrc||e,t),c()};if(Nf(l)&&l.complete)return t();u=()=>{l.removeEventListener("load",t),l.removeEventListener("error",n)},l.addEventListener("load",t,{once:!0}),l.addEventListener("error",n,{once:!0})}})}var Yf=function(){let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)}();function Uf(e){return e?.split(",").map(e=>e.trim().replace(/"|\'/g,"").toLowerCase()).filter(Boolean)}var Xf=0;function Kf(e){let t=`${Sf}[#${Xf}]`;return Xf++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&((...e)=>console.warn(Sf,...e))(...t)}}function Qf(e){return{cache:e?"no-cache":"force-cache"}}async function Gf(e,t){return(e=>e&&"__CONTEXT__"in e)(e)?e:Zf(e,{...t,autoDestruct:!0})}async function Zf(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},o=!!t?.debug,a=t?.features??!0,l=e.ownerDocument??(kf?window.document:void 0),s=e.ownerDocument?.defaultView??(kf?window:void 0),u=new Map,c={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:o,fetch:{requestInit:Qf(t?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...t,__CONTEXT__:!0,log:Kf(o),node:e,ownerDocument:l,ownerWindow:s,dpi:1===n?null:96*n,svgStyleElement:Jf(l),svgDefsElement:l?.createElementNS(Wf,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:Cf&&r&&i?i:0})].map(()=>{try{let e=new Worker(r);return e.onmessage=async e=>{let{url:t,result:n}=e.data;n?u.get(t)?.resolve?.(n):u.get(t)?.reject?.(new Error(`Error receiving message from worker: ${t}`))},e.onmessageerror=e=>{let{url:t}=e.data;u.get(t)?.reject?.(new Error(`Error receiving message from worker: ${t}`))},e}catch(e){return c.log.warn("Failed to new Worker",e),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[Ff(l)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:u,drawImageCount:0,tasks:[],features:a,isEnable:e=>"restoreScrollPosition"===e?"boolean"!=typeof a&&(a[e]??!1):"boolean"==typeof a?a:a[e]??!0,shadowRoots:[]};c.log.time("wait until load"),await async function(e,t){Pf(e)&&(Nf(e)||_f(e)?await qf(e,t):await Promise.all(["img","video"].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>qf(e,t)))))}(e,{timeout:c.timeout,onWarn:c.log.warn}),c.log.timeEnd("wait until load");let{width:d,height:f}=function(e,t){let{width:n,height:r}=t;if(If(e)&&(!n||!r)){let t=e.getBoundingClientRect();n=n||t.width||Number(e.getAttribute("width"))||0,r=r||t.height||Number(e.getAttribute("height"))||0}return{width:n,height:r}}(e,c);return c.width=d,c.height=f,c}function Jf(e){if(!e)return;let t=e.createElement("style"),n=t.ownerDocument.createTextNode("\\n.______background-clip--text {\\n background-clip: text;\\n -webkit-background-clip: text;\\n}\\n");return t.appendChild(n),t}function ep(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if("data:,"!==t)return Vf(t,e.ownerDocument)}catch(e){t.log.warn("Failed to clone canvas",e)}let n=e.cloneNode(!1),r=e.getContext("2d"),i=n.getContext("2d");try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(e){t.log.warn("Failed to clone canvas",e)}return n}var tp=["width","height","-webkit-text-fill-color"],np=["stroke","fill"];function rp(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),o=jf(e)&&"svg"!==i,a=o?np.map(t=>[t,e.getAttribute(t)]).filter(([,e])=>null!==e):[],l=[o&&"svg",i,a.map((e,t)=>`${e}=${t}`).join(","),t].filter(Boolean).join(":");if(r.has(l))return r.get(l);let s=function(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement("iframe"),t.id=`__SANDBOX__${Yf()}`,t.width="0",t.height="0",t.style.visibility="hidden",t.style.position="fixed",n.body.appendChild(t),t.srcdoc=\'<!DOCTYPE html><meta charset="UTF-8"><title></title><body>\',e.sandbox=t)}catch(t){e.log.warn("Failed to getSandBox",t)}}return t}(n)?.contentWindow;if(!s)return new Map;let u,c,d=s?.document;o?(u=d.createElementNS(Wf,"svg"),c=u.ownerDocument.createElementNS(u.namespaceURI,i),a.forEach(([e,t])=>{c.setAttributeNS(null,e,t)}),u.appendChild(c)):u=c=d.createElement(i),c.textContent=" ",d.body.appendChild(u);let f=s.getComputedStyle(c,t),p=new Map;for(let e=f.length,t=0;t<e;t++){let e=f.item(t);tp.includes(e)||p.set(e,f.getPropertyValue(e))}return d.body.removeChild(u),r.set(l,p),p}function ip(e,t,n){let r=new Map,i=[],o=new Map;if(n)for(let e of n)a(e);else for(let t=e.length,n=0;n<t;n++)a(e.item(n));for(let e=i.length,t=0;t<e;t++)o.get(i[t])?.forEach((e,t)=>r.set(t,e));function a(n){let a=e.getPropertyValue(n),l=e.getPropertyPriority(n),s=n.lastIndexOf("-"),u=s>-1?n.substring(0,s):void 0;if(u){let e=o.get(u);e||(e=new Map,o.set(u,e)),e.set(n,[a,l])}t.get(n)===a&&!l||(u?i.push(u):r.set(n,[a,l]))}return r}var op=["::before","::after"],ap=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"],lp=new Set(["symbol"]);async function sp(e,t,n,r,i){if(If(n)&&((e=>"STYLE"===e.tagName)(n)||(e=>"SCRIPT"===e.tagName)(n))||r.filter&&!r.filter(n))return;lp.has(t.nodeName)||lp.has(n.nodeName)?r.currentParentNodeStyle=void 0:r.currentParentNodeStyle=r.currentNodeStyle;let o=await dp(n,r,!1,i);r.isEnable("restoreScrollPosition")&&function(e,t){if(!Pf(e)||!Pf(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,o=new DOMMatrix(i),{a:a,b:l,c:s,d:u}=o;o.a=1,o.b=0,o.c=0,o.d=1,o.translateSelf(-r,-n),o.a=a,o.b=l,o.c=s,o.d=u,t.style.transform=o.toString()}(e,o),t.appendChild(o)}async function up(e,t,n,r){let i=e.firstChild;If(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let o=i;o;o=o.nextSibling)if(!zf(o))if(If(o)&&Df(o)&&"function"==typeof o.assignedNodes){let i=o.assignedNodes();for(let o=0;o<i.length;o++)await sp(e,t,i[o],n,r)}else await sp(e,t,o,n,r)}var cp=/^[\\w-:]+$/;async function dp(e,t,n=!1,r){let{ownerDocument:i,ownerWindow:o,fontFamilies:a,onCloneEachNode:l}=t;if(i&&(e=>3===e.nodeType)(e))return r&&/\\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&o&&If(e)&&(Pf(e)||jf(e))){let r=await function(e,t){return(e=>"CANVAS"===e.tagName)(e)?ep(e,t):(e=>"IFRAME"===e.tagName)(e)?function(e,t){try{if(e?.contentDocument?.documentElement)return dp(e.contentDocument.documentElement,t)}catch(e){t.log.warn("Failed to clone iframe",e)}return e.cloneNode(!1)}(e,t):Nf(e)?function(e){let t=e.cloneNode(!1);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager"),t}(e):_f(e)?async function(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return Vf(e.poster,e.ownerDocument);let n=e.cloneNode(!1);n.crossOrigin="anonymous",e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=!0;if(await qf(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?Vf(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(e=>{n.addEventListener("seeked",e,{once:!0})});let o=r.createElement("canvas");o.width=e.offsetWidth,o.height=e.offsetHeight;try{let e=o.getContext("2d");e&&e.drawImage(n,0,0,o.width,o.height)}catch(r){return t.log.warn("Failed to clone video",r),e.poster?Vf(e.poster,e.ownerDocument):n}return ep(o,t)}return n}(e,t):e.cloneNode(!1)}(e,t);if(t.isEnable("removeAbnormalAttributes")){let e=r.getAttributeNames();for(let t=e.length,n=0;n<t;n++){let t=e[n];cp.test(t)||r.removeAttribute(t)}}let i=t.currentNodeStyle=function(e,t,n,r){let{ownerWindow:i,includeStyleProperties:o,currentParentNodeStyle:a}=r,l=t.style,s=i.getComputedStyle(e),u=rp(e,null,r);a?.forEach((e,t)=>{u.delete(t)});let c=ip(s,u,o);c.delete("transition-property"),c.delete("all"),c.delete("d"),c.delete("content"),n&&(c.delete("position"),c.delete("margin-top"),c.delete("margin-right"),c.delete("margin-bottom"),c.delete("margin-left"),c.delete("margin-block-start"),c.delete("margin-block-end"),c.delete("margin-inline-start"),c.delete("margin-inline-end"),c.set("box-sizing",["border-box",""])),"text"===c.get("background-clip")?.[0]&&t.classList.add("______background-clip--text"),Mf&&(c.has("font-kerning")||c.set("font-kerning",["normal",""]),("hidden"===c.get("overflow-x")?.[0]||"hidden"===c.get("overflow-y")?.[0])&&"ellipsis"===c.get("text-overflow")?.[0]&&e.scrollWidth===e.clientWidth&&c.set("text-overflow",["clip",""]));for(let e=l.length,t=0;t<e;t++)l.removeProperty(l.item(t));return c.forEach(([e,t],n)=>{l.setProperty(n,e,t)}),c}(e,r,n,t);n&&function(e,t){let{backgroundColor:n,width:r,height:i,style:o}=t,a=e.style;if(n&&a.setProperty("background-color",n,"important"),r&&a.setProperty("width",`${r}px`,"important"),i&&a.setProperty("height",`${i}px`,"important"),o)for(let e in o)a[e]=o[e]}(r,t);let o=!1;if(t.isEnable("copyScrollbar")){let t=[i.get("overflow-x")?.[0],i.get("overflow-y")?.[0]];o=t.includes("scroll")||(t.includes("auto")||t.includes("overlay"))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)}let s=i.get("text-transform")?.[0],u=Uf(i.get("font-family")?.[0]),c=u?e=>{"uppercase"===s?e=e.toUpperCase():"lowercase"===s?e=e.toLowerCase():"capitalize"===s&&(e=e[0].toUpperCase()+e.substring(1)),u.forEach(t=>{let n=a.get(t);n||a.set(t,n=new Set),e.split("").forEach(e=>n.add(e))})}:void 0;return function(e,t,n,r,i){let{ownerWindow:o,svgStyleElement:a,svgStyles:l,currentNodeStyle:s}=r;function u(n){let a=o.getComputedStyle(e,n),u=a.getPropertyValue("content");if(!u||"none"===u)return;i?.(u),u=u.replace(/(\')|(")|(counter\\(.+\\))/g,"");let c=[Yf()],d=rp(e,n,r);s?.forEach((e,t)=>{d.delete(t)});let f=ip(a,d,r.includeStyleProperties);f.delete("content"),f.delete("-webkit-locale"),"text"===f.get("background-clip")?.[0]&&t.classList.add("______background-clip--text");let p=[`content: \'${u}\';`];if(f.forEach(([e,t],n)=>{p.push(`${n}: ${e}${t?" !important":""};`)}),1===p.length)return;try{t.className=[t.className,...c].join(" ")}catch(e){return void r.log.warn("Failed to copyPseudoClass",e)}let h=p.join("\\n "),m=l.get(h);m||(m=[],l.set(h,m)),m.push(`.${c[0]}${n}`)}a&&o&&(op.forEach(u),n&&ap.forEach(u))}(e,r,o,t,c),function(e,t){((e=>"TEXTAREA"===e.tagName)(e)||(e=>"INPUT"===e.tagName)(e)||(e=>"SELECT"===e.tagName)(e))&&t.setAttribute("value",e.value)}(e,r),_f(e)||await up(e,r,t,c),await(l?.(r)),r}let s=e.cloneNode(!1);return await up(e,s,t),await(l?.(s)),s}function fp(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove()}catch(t){e.log.warn("Failed to destroyContext",t)}e.sandbox=void 0}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[]}function pp(e,t){let{url:n,requestType:r="text",responseType:i="text",imageDom:o}=t,a=n,{timeout:l,acceptOfImage:s,requests:u,fetchFn:c,fetch:{requestInit:d,bypassingCache:f,placeholderImage:p},font:h,workers:m,fontFamilies:g}=e;"image"===r&&(Tf||Rf)&&e.drawImageCount++;let y=u.get(n);if(!y){f&&f instanceof RegExp&&f.test(a)&&(a+=(/\\?/.test(a)?"&":"?")+(new Date).getTime());let t=r.startsWith("font")&&h&&h.minify,x=new Set;t&&r.split(";")[1].split(",").forEach(e=>{g.has(e)&&g.get(e).forEach(e=>x.add(e))});let v=t&&x.size,b={url:a,timeout:l,responseType:v?"arrayBuffer":i,headers:"image"===r?{accept:s}:void 0,...d};y={type:r,resolve:void 0,reject:void 0,response:null},y.response=(async()=>{if(c&&"image"===r){let e=await c(n);if(e)return e}return!Tf&&n.startsWith("http")&&m.length?new Promise((e,t)=>{m[u.size&m.length-1].postMessage({rawUrl:n,...b}),y.resolve=e,y.reject=t}):function(e){let{url:t,timeout:n,responseType:r,...i}=e,o=new AbortController,a=n?setTimeout(()=>o.abort(),n):void 0;return fetch(t,{signal:o.signal,...i}).then(e=>{if(!e.ok)throw new Error("Failed fetch, not 2xx response",{cause:e});switch(r){case"arrayBuffer":return e.arrayBuffer();case"dataUrl":return e.blob().then(Bf);default:return e.text()}}).finally(()=>clearTimeout(a))}(b)})().catch(t=>{if(u.delete(n),"image"===r&&p)return e.log.warn("Failed to fetch image base64, trying to use placeholder image",a),"string"==typeof p?p:p(o);throw t}),u.set(n,y)}return y.response}async function hp(e,t,n,r){if(!mp(e))return e;for(let[i,o]of function(e,t){let n=[];return e.replace(gp,(e,r,i)=>(n.push([i,Of(i,t)]),e)),n.filter(([e])=>!$f(e))}(e,t))try{let t=await pp(n,{url:o,requestType:r?"image":"text",responseType:"dataUrl"});e=e.replace(yp(i),`$1${t}$3`)}catch(e){n.log.warn("Failed to fetch css data url",i,e)}return e}function mp(e){return/url\\(([\'"]?)([^\'"]+?)\\1\\)/.test(e)}var gp=/url\\(([\'"]?)([^\'"]+?)\\1\\)/g;function yp(e){let t=e.replace(/([.*+?^${}()|\\[\\]\\/\\\\])/g,"\\\\$1");return new RegExp(`(url\\\\([\'"]?)(${t})([\'"]?\\\\))`,"g")}var xp=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function vp(e,t){let{tasks:n}=t;If(e)&&((Nf(e)||Lf(e))&&n.push(...function(e,t){if(Nf(e)){let n=e.currentSrc||e.src;if(!$f(n))return[pp(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(t=>{t&&(e.srcset="",e.dataset.originalSrc=n,e.src=t||"")})];(Tf||Rf)&&t.drawImageCount++}else if(jf(e)&&!$f(e.href.baseVal)){let n=e.href.baseVal;return[pp(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(t=>{t&&(e.dataset.originalSrc=n,e.href.baseVal=t||"")})]}return[]}(e,t)),(e=>"use"===e.tagName)(e)&&n.push(...function(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute("href")??e.getAttribute("xlink:href");if(!i)return[];let[o,a]=i.split("#");if(a){let i=`#${a}`,l=t.shadowRoots.reduce((e,t)=>e??t.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(o&&e.setAttribute("href",i),r?.querySelector(i))return[];if(l)return r?.appendChild(l.cloneNode(!0)),[];if(o)return[pp(t,{url:o,responseType:"text"}).then(e=>{r?.insertAdjacentHTML("beforeend",e)})]}return[]}(e,t))),Pf(e)&&n.push(...function(e,t){return xp.map(n=>{let r=e.getPropertyValue(n);return r&&"none"!==r?((Tf||Rf)&&t.drawImageCount++,hp(r,null,t,!0).then(t=>{!t||r===t||e.setProperty(n,t,e.getPropertyPriority(n))})):null}).filter(Boolean)}(e.style,t)),e.childNodes.forEach(e=>{vp(e,t)})}async function bp(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:o,tasks:a,font:l}=t;if(n&&r&&i.size)if(l&&l.cssText){let e=Ep(l.cssText,t);r.appendChild(n.createTextNode(`${e}\\n`))}else{let e=Array.from(n.styleSheets).filter(e=>{try{return"cssRules"in e&&!!e.cssRules.length}catch(n){return t.log.warn(`Error while reading CSS rules from ${e.href}`,n),!1}}),l=n.implementation.createHTMLDocument(""),s=l.createElement("style");l.head.appendChild(s);let u=s.sheet;await Promise.all(e.flatMap(e=>Array.from(e.cssRules).map(async e=>{if((e=>"CSSImportRule"===e.constructor.name)(e)){let n=e.href,r="";try{r=await pp(t,{url:n,requestType:"text",responseType:"text"})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(gp,(e,t,r)=>e.replace(r,Of(r,n)));for(let e of function(e){if(null==e)return[];let t=[],n=e.replace(wp,"");for(;;){let e=Sp.exec(n);if(!e)break;t.push(e[0])}n=n.replace(Sp,"");let r=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,i=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");for(;;){let e=r.exec(n);if(e)i.lastIndex=r.lastIndex;else{if(e=i.exec(n),!e)break;r.lastIndex=i.lastIndex}t.push(e[0])}return t}(i))try{u.insertRule(e,u.cssRules.length)}catch(n){t.log.warn("Error inserting rule from remote css import",{rule:e,error:n})}}}))),u.cssRules.length&&e.push(u);let c=[];e.forEach(e=>{Mp(e.cssRules,c)}),c.filter(e=>(e=>"CSSFontFaceRule"===e.constructor.name)(e)&&mp(e.style.getPropertyValue("src"))&&Uf(e.style.getPropertyValue("font-family"))?.some(e=>i.has(e))).forEach(e=>{let i=e,l=o.get(i.cssText);l?r.appendChild(n.createTextNode(`${l}\\n`)):a.push(hp(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=Ep(e,t),o.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}\\n`))}))})}}var wp=/(\\/\\*[\\s\\S]*?\\*\\/)/g,Sp=/((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})/gi,kp=/url\\([^)]+\\)\\s*format\\((["\']?)([^"\']+)\\1\\)/g,Cp=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function Ep(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(Cp,e=>{for(;;){let[t,,n]=kp.exec(e)||[];if(!n)return"";if(n===r)return`src: ${t};`}}):e}function Mp(e,t=[]){for(let n of Array.from(e))Af(n)?t.push(...Mp(n.cssRules)):"cssRules"in n?Mp(n.cssRules,t):t.push(n);return t}var Tp=/\\bx?link:?href\\s*=\\s*["\'](?!data:)[^"\']+["\']/i;async function Rp(e,t){let n=await Gf(e,t);if(If(n.node)&&jf(n.node)&&!function(e){return Tp.test(e.innerHTML)}(n.node))return n.node;let{ownerDocument:r,log:i,tasks:o,svgStyleElement:a,svgDefsElement:l,svgStyles:s,font:u,progress:c,autoDestruct:d,onCloneNode:f,onEmbedNode:p,onCreateForeignObjectSvg:h}=n;i.time("clone node");let m=await dp(n.node,n,!0);if(a&&r){let e="";s.forEach((t,n)=>{e+=`${t.join(",\\n")} {\\n ${n}\\n}\\n`}),a.appendChild(r.createTextNode(e))}i.timeEnd("clone node"),await(f?.(m)),!1!==u&&If(m)&&(i.time("embed web font"),await bp(0,n),i.timeEnd("embed web font")),i.time("embed node"),vp(m,n);let g=o.length,y=0;c?.(y,g),await Promise.all([...Array.from({length:4})].map(async()=>{for(;;){let e=o.pop();if(!e)break;try{await e}catch(e){n.log.warn("Failed to run task",e)}c?.(++y,g)}})),i.timeEnd("embed node"),await(p?.(m));let x=function(e,t){let{width:n,height:r}=t,i=function(e,t,n){let r=Hf(n).createElementNS(Wf,"svg");return r.setAttributeNS(null,"width",e.toString()),r.setAttributeNS(null,"height",t.toString()),r.setAttributeNS(null,"viewBox",`0 0 ${e} ${t}`),r}(n,r,e.ownerDocument),o=i.ownerDocument.createElementNS(i.namespaceURI,"foreignObject");return o.setAttributeNS(null,"x","0%"),o.setAttributeNS(null,"y","0%"),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.append(e),i.appendChild(o),i}(m,n);return l&&x.insertBefore(l,x.children[0]),a&&x.insertBefore(a,x.children[0]),d&&fp(n),await(h?.(x)),x}async function Ap(e,t){let n=await Gf(e,t),r=await Rp(n),i=function(e,t){let n=(new XMLSerializer).serializeToString(e);return t&&(n=n.replace(/[\\u0000-\\u0008\\v\\f\\u000E-\\u001F\\uD800-\\uDFFF\\uFFFE\\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}(r,n.isEnable("removeControlCharacter"));n.autoDestruct||(n.svgStyleElement=Jf(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(Wf,"defs"),n.svgStyles.clear());let o=Vf(i,r.ownerDocument);return await async function(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:o}=t;n.time("image to canvas");let a=await qf(e,{timeout:r,onWarn:t.log.warn}),{canvas:l,context2d:s}=function(e,t){let{width:n,height:r,scale:i,backgroundColor:o,maximumCanvasSize:a}=t,l=e.createElement("canvas");l.width=Math.floor(n*i),l.height=Math.floor(r*i),l.style.width=`${n}px`,l.style.height=`${r}px`,a&&(l.width>a||l.height>a)&&(l.width>a&&l.height>a?l.width>l.height?(l.height*=a/l.width,l.width=a):(l.width*=a/l.height,l.height=a):l.width>a?(l.height*=a/l.width,l.width=a):(l.width*=a/l.height,l.height=a));let s=l.getContext("2d");return s&&o&&(s.fillStyle=o,s.fillRect(0,0,l.width,l.height)),{canvas:l,context2d:s}}(e.ownerDocument,t),u=()=>{try{s?.drawImage(a,0,0,l.width,l.height)}catch(e){t.log.warn("Failed to drawImage",e)}};if(u(),t.isEnable("fixSvgXmlDecode"))for(let e=0;e<i;e++)await new Promise(t=>{setTimeout(()=>{s?.clearRect(0,0,l.width,l.height),u(),t()},e+o)});return t.drawImageCount=0,n.timeEnd("image to canvas"),l}(o,n)}var Ip=u(d()),jp=2e3;function Lp(e){let t=e[0];if("string"==typeof t&&t.startsWith("TSL:")){let t=e[1];t&&t.isStackTrace?e[0]+=" "+t.getLocation():e[1]=\'Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.\'}return e}function Pp(...e){let t="THREE."+(e=Lp(e)).shift();{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function zp(e,t,n){return Math.max(t,Math.min(n,e))}Math.PI,Math.PI;var Np=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=zp(this.x,e.x,t.x),this.y=zp(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=zp(this.x,e,t),this.y=zp(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(zp(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(zp(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},_p=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,o,a){let l=n[r+0],s=n[r+1],u=n[r+2],c=n[r+3],d=i[o+0],f=i[o+1],p=i[o+2],h=i[o+3];if(c!==h||l!==d||s!==f||u!==p){let e=l*d+s*f+u*p+c*h;e<0&&(d=-d,f=-f,p=-p,h=-h,e=-e);let t=1-a;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,l=l*t+d*(a=Math.sin(a*n)/r),s=s*t+f*a,u=u*t+p*a,c=c*t+h*a}else{l=l*t+d*a,s=s*t+f*a,u=u*t+p*a,c=c*t+h*a;let e=1/Math.sqrt(l*l+s*s+u*u+c*c);l*=e,s*=e,u*=e,c*=e}}e[t]=l,e[t+1]=s,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,o){let a=n[r],l=n[r+1],s=n[r+2],u=n[r+3],c=i[o],d=i[o+1],f=i[o+2],p=i[o+3];return e[t]=a*p+u*c+l*f-s*d,e[t+1]=l*p+u*d+s*c-a*f,e[t+2]=s*p+u*f+a*d-l*c,e[t+3]=u*p-a*c-l*d-s*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,o=e._order,a=Math.cos,l=Math.sin,s=a(n/2),u=a(r/2),c=a(i/2),d=l(n/2),f=l(r/2),p=l(i/2);switch(o){case"XYZ":this._x=d*u*c+s*f*p,this._y=s*f*c-d*u*p,this._z=s*u*p+d*f*c,this._w=s*u*c-d*f*p;break;case"YXZ":this._x=d*u*c+s*f*p,this._y=s*f*c-d*u*p,this._z=s*u*p-d*f*c,this._w=s*u*c+d*f*p;break;case"ZXY":this._x=d*u*c-s*f*p,this._y=s*f*c+d*u*p,this._z=s*u*p+d*f*c,this._w=s*u*c-d*f*p;break;case"ZYX":this._x=d*u*c-s*f*p,this._y=s*f*c+d*u*p,this._z=s*u*p-d*f*c,this._w=s*u*c+d*f*p;break;case"YZX":this._x=d*u*c+s*f*p,this._y=s*f*c+d*u*p,this._z=s*u*p-d*f*c,this._w=s*u*c-d*f*p;break;case"XZY":this._x=d*u*c-s*f*p,this._y=s*f*c-d*u*p,this._z=s*u*p+d*f*c,this._w=s*u*c+d*f*p;break;default:Pp("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],o=t[1],a=t[5],l=t[9],s=t[2],u=t[6],c=t[10],d=n+a+c;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(u-l)*e,this._y=(i-s)*e,this._z=(o-r)*e}else if(n>a&&n>c){let e=2*Math.sqrt(1+n-a-c);this._w=(u-l)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(i+s)/e}else if(a>c){let e=2*Math.sqrt(1+a-n-c);this._w=(i-s)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(l+u)/e}else{let e=2*Math.sqrt(1+c-n-a);this._w=(o-r)/e,this._x=(i+s)/e,this._y=(l+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(zp(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,o=e._w,a=t._x,l=t._y,s=t._z,u=t._w;return this._x=n*u+o*a+r*s-i*l,this._y=r*u+o*l+i*a-n*s,this._z=i*u+o*s+n*l-r*a,this._w=o*u-n*a-r*l-i*s,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,i=-i,o=-o,a=-a);let l=1-t;if(a<.9995){let e=Math.acos(a),s=Math.sin(e);l=Math.sin(l*e)/s,t=Math.sin(t*e)/s,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+i*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+i*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Dp=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion($p.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion($p.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,o=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,l=e.w,s=2*(o*r-a*n),u=2*(a*t-i*r),c=2*(i*n-o*t);return this.x=t+l*s+o*c-a*u,this.y=n+l*u+a*s-i*c,this.z=r+l*c+i*u-o*s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=zp(this.x,e.x,t.x),this.y=zp(this.y,e.y,t.y),this.z=zp(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=zp(this.x,e,t),this.y=zp(this.y,e,t),this.z=zp(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(zp(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-i*a,this.y=i*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Fp.copy(this).projectOnVector(e),this.sub(Fp)}reflect(e){return this.sub(Fp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(zp(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Fp=new Dp,$p=new _p,Op=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,o,a,l,s,u,c,d,f,p,h,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,o,a,l,s,u,c,d,f,p,h,m)}set(e,t,n,r,i,o,a,l,s,u,c,d,f,p,h,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=l,g[2]=s,g[6]=u,g[10]=c,g[14]=d,g[3]=f,g[7]=p,g[11]=h,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new e).fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 0===this.determinantAffine()?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinantAffine())return this.identity();let t=this.elements,n=e.elements,r=1/Hp.setFromMatrixColumn(e,0).length(),i=1/Hp.setFromMatrixColumn(e,1).length(),o=1/Hp.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),s=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){let e=o*u,n=o*c,r=a*u,i=a*c;t[0]=l*u,t[4]=-l*c,t[8]=s,t[1]=n+r*s,t[5]=e-i*s,t[9]=-a*l,t[2]=i-e*s,t[6]=r+n*s,t[10]=o*l}else if("YXZ"===e.order){let e=l*u,n=l*c,r=s*u,i=s*c;t[0]=e+i*a,t[4]=r*a-n,t[8]=o*s,t[1]=o*c,t[5]=o*u,t[9]=-a,t[2]=n*a-r,t[6]=i+e*a,t[10]=o*l}else if("ZXY"===e.order){let e=l*u,n=l*c,r=s*u,i=s*c;t[0]=e-i*a,t[4]=-o*c,t[8]=r+n*a,t[1]=n+r*a,t[5]=o*u,t[9]=i-e*a,t[2]=-o*s,t[6]=a,t[10]=o*l}else if("ZYX"===e.order){let e=o*u,n=o*c,r=a*u,i=a*c;t[0]=l*u,t[4]=r*s-n,t[8]=e*s+i,t[1]=l*c,t[5]=i*s+e,t[9]=n*s-r,t[2]=-s,t[6]=a*l,t[10]=o*l}else if("YZX"===e.order){let e=o*l,n=o*s,r=a*l,i=a*s;t[0]=l*u,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=o*u,t[9]=-a*u,t[2]=-s*u,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){let e=o*l,n=o*s,r=a*l,i=a*s;t[0]=l*u,t[4]=-c,t[8]=s*u,t[1]=e*c+i,t[5]=o*u,t[9]=n*c-r,t[2]=r*c-n,t[6]=a*u,t[10]=i*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Bp,e,Vp)}lookAt(e,t,n){let r=this.elements;return Up.subVectors(e,t),0===Up.lengthSq()&&(Up.z=1),Up.normalize(),qp.crossVectors(n,Up),0===qp.lengthSq()&&(1===Math.abs(n.z)?Up.x+=1e-4:Up.z+=1e-4,Up.normalize(),qp.crossVectors(n,Up)),qp.normalize(),Yp.crossVectors(Up,qp),r[0]=qp.x,r[4]=Yp.x,r[8]=Up.x,r[1]=qp.y,r[5]=Yp.y,r[9]=Up.y,r[2]=qp.z,r[6]=Yp.z,r[10]=Up.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[4],l=n[8],s=n[12],u=n[1],c=n[5],d=n[9],f=n[13],p=n[2],h=n[6],m=n[10],g=n[14],y=n[3],x=n[7],v=n[11],b=n[15],w=r[0],S=r[4],k=r[8],C=r[12],E=r[1],M=r[5],T=r[9],R=r[13],A=r[2],I=r[6],j=r[10],L=r[14],P=r[3],z=r[7],N=r[11],_=r[15];return i[0]=o*w+a*E+l*A+s*P,i[4]=o*S+a*M+l*I+s*z,i[8]=o*k+a*T+l*j+s*N,i[12]=o*C+a*R+l*L+s*_,i[1]=u*w+c*E+d*A+f*P,i[5]=u*S+c*M+d*I+f*z,i[9]=u*k+c*T+d*j+f*N,i[13]=u*C+c*R+d*L+f*_,i[2]=p*w+h*E+m*A+g*P,i[6]=p*S+h*M+m*I+g*z,i[10]=p*k+h*T+m*j+g*N,i[14]=p*C+h*R+m*L+g*_,i[3]=y*w+x*E+v*A+b*P,i[7]=y*S+x*M+v*I+b*z,i[11]=y*k+x*T+v*j+b*N,i[15]=y*C+x*R+v*L+b*_,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],a=e[5],l=e[9],s=e[13],u=e[2],c=e[6],d=e[10],f=e[14],p=e[3],h=e[7],m=e[11],g=e[15],y=l*f-s*d,x=a*f-s*c,v=a*d-l*c,b=o*f-s*u,w=o*d-l*u,S=o*c-a*u;return t*(h*y-m*x+g*v)-n*(p*y-m*b+g*w)+r*(p*x-h*b+g*S)-i*(p*v-h*w+m*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],o=e[5],a=e[9],l=e[2],s=e[6],u=e[10];return t*(o*u-a*s)-n*(i*u-a*l)+r*(i*s-o*l)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],l=e[6],s=e[7],u=e[8],c=e[9],d=e[10],f=e[11],p=e[12],h=e[13],m=e[14],g=e[15],y=t*a-n*o,x=t*l-r*o,v=t*s-i*o,b=n*l-r*a,w=n*s-i*a,S=r*s-i*l,k=u*h-c*p,C=u*m-d*p,E=u*g-f*p,M=c*m-d*h,T=c*g-f*h,R=d*g-f*m,A=y*R-x*T+v*M+b*E-w*C+S*k;if(0===A)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let I=1/A;return e[0]=(a*R-l*T+s*M)*I,e[1]=(r*T-n*R-i*M)*I,e[2]=(h*S-m*w+g*b)*I,e[3]=(d*w-c*S-f*b)*I,e[4]=(l*E-o*R-s*C)*I,e[5]=(t*R-r*E+i*C)*I,e[6]=(m*v-p*S-g*x)*I,e[7]=(u*S-d*v+f*x)*I,e[8]=(o*T-a*E+s*k)*I,e[9]=(n*E-t*T-i*k)*I,e[10]=(p*w-h*v+g*y)*I,e[11]=(c*v-u*w-f*y)*I,e[12]=(a*C-o*M-l*k)*I,e[13]=(t*M-n*C+r*k)*I,e[14]=(h*x-p*b-m*y)*I,e[15]=(u*b-c*x+d*y)*I,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,a=e.y,l=e.z,s=i*o,u=i*a;return this.set(s*o+n,s*a-r*l,s*l+r*a,0,s*a+r*l,u*a+n,u*l-r*o,0,s*l-r*a,u*l+r*o,i*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,o){return this.set(1,n,i,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,o=t._y,a=t._z,l=t._w,s=i+i,u=o+o,c=a+a,d=i*s,f=i*u,p=i*c,h=o*u,m=o*c,g=a*c,y=l*s,x=l*u,v=l*c,b=n.x,w=n.y,S=n.z;return r[0]=(1-(h+g))*b,r[1]=(f+v)*b,r[2]=(p-x)*b,r[3]=0,r[4]=(f-v)*w,r[5]=(1-(d+g))*w,r[6]=(m+y)*w,r[7]=0,r[8]=(p+x)*S,r[9]=(m-y)*S,r[10]=(1-(d+h))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(0===i)return n.set(1,1,1),t.identity(),this;let o=Hp.set(r[0],r[1],r[2]).length(),a=Hp.set(r[4],r[5],r[6]).length(),l=Hp.set(r[8],r[9],r[10]).length();i<0&&(o=-o),Wp.copy(this);let s=1/o,u=1/a,c=1/l;return Wp.elements[0]*=s,Wp.elements[1]*=s,Wp.elements[2]*=s,Wp.elements[4]*=u,Wp.elements[5]*=u,Wp.elements[6]*=u,Wp.elements[8]*=c,Wp.elements[9]*=c,Wp.elements[10]*=c,t.setFromRotationMatrix(Wp),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,i,o,a=jp,l=!1){let s,u,c=this.elements,d=2*i/(t-e),f=2*i/(n-r),p=(t+e)/(t-e),h=(n+r)/(n-r);if(l)s=i/(o-i),u=o*i/(o-i);else if(a===jp)s=-(o+i)/(o-i),u=-2*o*i/(o-i);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);s=-o/(o-i),u=-o*i/(o-i)}return c[0]=d,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=h,c[13]=0,c[2]=0,c[6]=0,c[10]=s,c[14]=u,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,o,a=jp,l=!1){let s,u,c=this.elements,d=2/(t-e),f=2/(n-r),p=-(t+e)/(t-e),h=-(n+r)/(n-r);if(l)s=1/(o-i),u=o/(o-i);else if(a===jp)s=-2/(o-i),u=-(o+i)/(o-i);else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);s=-1/(o-i),u=-i/(o-i)}return c[0]=d,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=h,c[2]=0,c[6]=0,c[10]=s,c[14]=u,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Hp=new Dp,Wp=new Op,Bp=new Dp(0,0,0),Vp=new Dp(1,1,1),qp=new Dp,Yp=new Dp,Up=new Dp,Xp=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return 0!==(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}},Kp=class{constructor(e=new Dp(1/0,1/0,1/0),t=new Dp(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Gp.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Gp.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Gp.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(void 0!==n){let r=n.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,n=r.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Gp):Gp.fromBufferAttribute(r,t),Gp.applyMatrix4(e.matrixWorld),this.expandByPoint(Gp);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Zp.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),Zp.copy(n.boundingBox)),Zp.applyMatrix4(e.matrixWorld),this.union(Zp)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Gp),Gp.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(oh),ah.subVectors(this.max,oh),Jp.subVectors(e.a,oh),eh.subVectors(e.b,oh),th.subVectors(e.c,oh),nh.subVectors(eh,Jp),rh.subVectors(th,eh),ih.subVectors(Jp,th);let t=[0,-nh.z,nh.y,0,-rh.z,rh.y,0,-ih.z,ih.y,nh.z,0,-nh.x,rh.z,0,-rh.x,ih.z,0,-ih.x,-nh.y,nh.x,0,-rh.y,rh.x,0,-ih.y,ih.x,0];return!(!uh(t,Jp,eh,th,ah)||(t=[1,0,0,0,1,0,0,0,1],!uh(t,Jp,eh,th,ah)))&&(lh.crossVectors(nh,rh),t=[lh.x,lh.y,lh.z],uh(t,Jp,eh,th,ah))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Gp).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Gp).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Qp[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Qp[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Qp[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Qp[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Qp[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Qp[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Qp[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Qp[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Qp)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Qp=[new Dp,new Dp,new Dp,new Dp,new Dp,new Dp,new Dp,new Dp],Gp=new Dp,Zp=new Kp,Jp=new Dp,eh=new Dp,th=new Dp,nh=new Dp,rh=new Dp,ih=new Dp,oh=new Dp,ah=new Dp,lh=new Dp,sh=new Dp;function uh(e,t,n,r,i){for(let o=0,a=e.length-3;o<=a;o+=3){sh.fromArray(e,o);let a=i.x*Math.abs(sh.x)+i.y*Math.abs(sh.y)+i.z*Math.abs(sh.z),l=t.dot(sh),s=n.dot(sh),u=r.dot(sh);if(Math.max(-Math.max(l,s,u),Math.min(l,s,u))>a)return!1}return!0}var ch=new Dp,dh=new Dp,fh=new Dp,ph=new Dp,hh=new Dp,mh=new Dp,gh=new Dp,yh=class{constructor(e=new Dp,t=new Dp(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ch)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ch.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ch.copy(this.origin).addScaledVector(this.direction,t),ch.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){dh.copy(e).add(t).multiplyScalar(.5),fh.copy(t).sub(e).normalize(),ph.copy(this.origin).sub(dh);let i,o,a,l,s=.5*e.distanceTo(t),u=-this.direction.dot(fh),c=ph.dot(this.direction),d=-ph.dot(fh),f=ph.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(i=u*d-c,o=u*c-d,l=s*p,i>=0)if(o>=-l)if(o<=l){let e=1/p;i*=e,o*=e,a=i*(i+u*o+2*c)+o*(u*i+o+2*d)+f}else o=s,i=Math.max(0,-(u*o+c)),a=-i*i+o*(o+2*d)+f;else o=-s,i=Math.max(0,-(u*o+c)),a=-i*i+o*(o+2*d)+f;else o<=-l?(i=Math.max(0,-(-u*s+c)),o=i>0?-s:Math.min(Math.max(-s,-d),s),a=-i*i+o*(o+2*d)+f):o<=l?(i=0,o=Math.min(Math.max(-s,-d),s),a=o*(o+2*d)+f):(i=Math.max(0,-(u*s+c)),o=i>0?s:Math.min(Math.max(-s,-d),s),a=-i*i+o*(o+2*d)+f);else o=u>0?-s:s,i=Math.max(0,-(u*o+c)),a=-i*i+o*(o+2*d)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,i),r&&r.copy(dh).addScaledVector(fh,o),a}intersectSphere(e,t){ch.subVectors(e.center,this.origin);let n=ch.dot(this.direction),r=ch.dot(ch)-n*n,i=e.radius*e.radius;if(r>i)return null;let o=Math.sqrt(i-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,o,a,l,s=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,d=this.origin;return s>=0?(n=(e.min.x-d.x)*s,r=(e.max.x-d.x)*s):(n=(e.max.x-d.x)*s,r=(e.min.x-d.x)*s),u>=0?(i=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(i=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||i>r||((i>n||isNaN(n))&&(n=i),(o<r||isNaN(r))&&(r=o),c>=0?(a=(e.min.z-d.z)*c,l=(e.max.z-d.z)*c):(a=(e.max.z-d.z)*c,l=(e.min.z-d.z)*c),n>l||a>r)||((a>n||n!=n)&&(n=a),(l<r||r!=r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return null!==this.intersectBox(e,ch)}intersectTriangle(e,t,n,r,i){hh.subVectors(t,e),mh.subVectors(n,e),gh.crossVectors(hh,mh);let o,a=this.direction.dot(gh);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}ph.subVectors(this.origin,e);let l=o*this.direction.dot(mh.crossVectors(ph,mh));if(l<0)return null;let s=o*this.direction.dot(hh.cross(ph));if(s<0||l+s>a)return null;let u=-o*ph.dot(gh);return u<0?null:this.at(u/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}},xh=new Op,vh=class{constructor(e,t,n=0,r=1/0){this.ray=new yh(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Xp,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):function(...e){let t="THREE."+(e=Lp(e)).shift();{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return xh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(xh),this}intersectObject(e,t=!0,n=[]){return wh(e,this,n,t),n.sort(bh),n}intersectObjects(e,t=!0,n=[]){for(let r=0,i=e.length;r<i;r++)wh(e[r],this,n,t);return n.sort(bh),n}};function bh(e,t){return e.distance-t.distance}function wh(e,t,n,r){let i=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,n)&&(i=!1),!0===i&&!0===r){let r=e.children;for(let e=0,i=r.length;e<i;e++)wh(r[e],t,n,!0)}}function Sh(e){return[e.x,e.y,e.z].map(e=>Number(e.toFixed(4))).join(", ")}function kh(e){let t=e.material;return t&&(Array.isArray(t)?t:[t]).map(e=>e.name?.trim()||e.type).filter(Boolean).join(", ")||void 0}function Ch(e){let t=(e.parent?.children??[]).filter(t=>t.type===e.type&&t.name===e.name),n=Math.max(0,t.indexOf(e)),r=e.name.trim()||e.type;return`${encodeURIComponent(r)}[${n}]`}function Eh(e){let t=[],n=e;for(;n?.parent;)t.push(Ch(n)),n=n.parent;return t.reverse().join("/")}function Mh(e){let t=e.userData.popmeltLabel;return"string"==typeof t&&t.trim()?t.trim():e.name.trim()||e.type}function Th(e){let t=e;for(;t.parent;){let e=t.name.trim(),n=e.match(/^(.*)_(?:alpha|normal|material)(?:_\\d+)+$/i),r=t.parent;for(;r.parent&&!r.name.trim();)r=r.parent;let i=r.name.trim();if(!i||!e.startsWith(`${i}_`)&&!n)break;t=r}return t}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}})),typeof window<"u"&&(window.__THREE__?Pp("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");var Rh=u(v());function Ah({input:e,port:t,framing:n}){let r=(0,Ip.useRef)(null);return(0,Ip.useLayoutEffect)(()=>{let i=r.current,o=document.createElement("style");o.textContent=e.bundle.css;let a=document.createElement("style");document.head.append(a,o);let l=e.reference.width,s=e.reference.slot,u=e.reference.surface,c=e.reference.intrinsic;function d(t,n){if(l=t.width,s=t.slot,u=t.surface,c=t.intrinsic,u){let e=document.getElementById("root");e.style.width=u.width+"px",e.style.height=u.height+"px",i.style.width=c?"max-content":l+"px",i.style.maxWidth=l+"px"}s&&(i.style.width=c?"max-content":s.width+"px",i.style.maxWidth=s.width+"px",e.fillScene&&(i.style.height=s.height+"px")),function(t){document.documentElement.style.colorScheme=e.mirror?"light dark":t??"light dark"}(n);for(let[e,n]of Object.entries(t.style))i.style.setProperty(e,n);i.style.color=e.mirror?t.style.color??"":"light-dark("+t.lightInk+","+t.darkInk+")",a.textContent!==t.fonts&&(a.textContent=t.fonts)}d(e.reference,e.theme);let f=new ResizeObserver(m),p=null,h="";function m(){let r=i.firstElementChild;if(!r)return;if(p!==r&&(p&&f.unobserve(p),p=r,f.observe(r)),s){if(e.fillScene)return;i.style.width="max-content";let n=i.getBoundingClientRect().width;i.style.width=c?"max-content":s.width+"px";let r=Math.max(1,i.offsetHeight,i.scrollHeight),o=c?n:s.width,a=o+"x"+r;return void(a!==h&&(t.postMessage({type:"size",width:o,height:r}),h=a))}if(!u)return void(i.style.width=getComputedStyle(r).display.startsWith("inline")?"max-content":document.documentElement.clientWidth+"px");let o=getComputedStyle(r).display.startsWith("inline");i.style.width=c||o?"max-content":l+"px";let a=i.getBoundingClientRect(),d=a.width/parseFloat(getComputedStyle(i).width);if(!(d>0&&u.width&&u.height))return;let m=Array.from(i.children,e=>e.getBoundingClientRect()).filter(e=>e.width>0&&e.height>0);m.length||m.push(a);let g=Math.min(...m.map(e=>e.left)),y=Math.max(...m.map(e=>e.right)),x=Math.min(...m.map(e=>e.top)),v=Math.max(...m.map(e=>e.bottom)),b=Math.max(.01,Math.min(1,(u.width-36)/Math.max(1,(y-g)/d),(u.height-36)/Math.max(1,(v-x)/d))),w=(a.left+a.right-g-y)/(2*d),S=(a.top+a.bottom-x-v)/(2*d);i.style.setProperty("--sp-fit",String(b)),i.style.transform=`translate(-50%, -50%) scale(var(--sp-fit)) translate(${w}px, ${S}px)`,n.setFitScale(b)}let g,y=new Map(e.initial.map(e=>[e.part+"|"+e.property,e])),x=e.parts??{},v=new WeakMap,b=new WeakMap,w=new WeakMap,S=new WeakMap,k=new WeakMap,C=e=>Array.from(e.children).filter(e=>!e.hasAttribute("data-popmelt-paragraph-continuation")&&!e.hasAttribute("data-popmelt-empty-paragraph"));function E(t,n){let r=t.getAttribute("data-explore-part"),i=r&&vf.test("@"+r)?"@"+r:n;if(t instanceof HTMLElement||t instanceof SVGElement){if(v.get(t)!==i){t.getAttribute("style")?.includes("data:image/svg+xml,")&&function(e){for(let t of Array.from(e)){if(!t.startsWith("--"))continue;let n=e.getPropertyValue(t).trim(),r=/^url\\((["\'])(data:image\\/svg\\+xml,[\\s\\S]*)\\1\\)$/i.exec(n);if(!r||CSS.supports("background-image",n))continue;let i=r[2].replace(/["\']/g,e=>\'"\'===e?"%22":"%27");e.setProperty(t,\'url("\'+i+\'")\',e.getPropertyPriority(t))}}(t.style),v.set(t,i),t.dataset.scratchPart=i;for(let e of y.values())e.part===i&&"text"!==e.property&&"paragraphs"!==e.property&&t.style.setProperty(e.property,e.to)}if(t instanceof HTMLElement&&(function(t,n){let r=0===t.childElementCount&&t.childNodes.length>1,i=!0;t.childNodes.forEach((o,a)=>{if(!(o instanceof Text))return;let l=e=>r&&void 0!==e?i?e:"":void 0,s=1===t.childNodes.length?n:n+"/text/"+a;if(w.get(o)!==s){w.set(o,s);let e=y.get(s+"|text")?.to??l(y.get(n+"|text")?.to);void 0!==e&&(o.data=e)}let u=x[s]?.text??l(x[n]?.text);i=!1,e.mirror&&(void 0!==u?(S.has(o)||S.set(o,o.data),o.data!==u&&(o.data=u)):S.has(o)&&(o.data=S.get(o),S.delete(o)))})}(t,i),t.toggleAttribute("data-scratch-text","P"===t.tagName||Array.from(t.childNodes).some(e=>e instanceof Text&&!!e.data.trim()))),e.mirror&&function(e,t){let n=b.get(e);n||(n=new Map,b.set(e,n));for(let[r,i]of n)void 0===x[t]?.[r]&&(i?e.style.setProperty(r,i):e.style.removeProperty(r),n.delete(r));for(let[r,i]of Object.entries(x[t]??{}))"text"===r||"paragraphs"===r||(n.has(r)||n.set(r,e.style.getPropertyValue(r)),e.style.setProperty(r,i))}(t,i),C(t).forEach((e,t)=>E(e,n?n+"."+t:String(t))),"P"===t.tagName&&t instanceof HTMLElement){let n=y.get(i+"|paragraphs")?.to,r=e.mirror?x[i]?.paragraphs??n:n;k.get(t)!==r&&(r?Jn(t,function(e){if(e.length>256e3)throw Error("Paragraph draft is too large.");let t=JSON.parse(e);if(!Array.isArray(t)||!t.length||t.length>4096||t.some(e=>!(e&&Array.isArray(e.path)&&e.path.length&&!(e.path.length>128)&&e.path.every(e=>"number"==typeof e&&Number.isSafeInteger(e)&&e>=0)&&Array.isArray(e.parts)&&e.parts.length&&e.parts.every(e=>"string"==typeof e)))||t.reduce((e,t)=>e+t.parts.length-1,0)>512)throw Error("Invalid paragraph draft.");return t}(r))&&k.set(t,r):(Zn(t),k.delete(t)))}}}function M(){if(!e.mirror&&i.firstElementChild){let e=!!i.querySelector("canvas");e!==g&&(g=e,t.postMessage({type:"canvas",present:e}))}C(i).forEach((e,t)=>E(e,t?"~"+t:"")),m()}let T,R,A=e.mirror||e.check||e.readOnly?void 0:function(e){let t=window,n=t.__THREE_DEVTOOLS__,r=t.__THREE_DEVTOOLS__??=new EventTarget,i=[];function o(t){let n=t.detail;if(!n?.isWebGLRenderer)return;let r,o,a,l=n.domElement,s=n.render,u=function(t,i){let u=s.call(n,t,i);if(!e.contains(l)||n.getRenderTarget()||!t.isScene||r===t&&o===i)return u;a?.destroy(),r=t,o=i;let c=function(e){let t=e.raycaster??new vh,n=new Np,r=t=>e.key?.(t)??function(e){let t=e.userData.popmeltId;return"string"==typeof t&&t.trim()?t.trim():Eh(e)}(t),i=(t,n)=>{let i=r(t);if(!i)return null;let o=function(e,t,n){let r=(new Kp).setFromObject(e,!0);if(r.isEmpty())return null;let i=n.getBoundingClientRect(),o=[];for(let e of[r.min.x,r.max.x])for(let n of[r.min.y,r.max.y])for(let i of[r.min.z,r.max.z])o.push(new Dp(e,n,i).project(t));let a=o.map(e=>i.left+(e.x+1)/2*i.width),l=o.map(e=>i.top+(1-e.y)/2*i.height),s=Math.max(i.left,Math.min(...a)),u=Math.min(i.right,Math.max(...a)),c=Math.max(i.top,Math.min(...l)),d=Math.min(i.bottom,Math.max(...l));return u<=s||d<=c?null:{left:s,top:c,width:u-s,height:d-c}}(t,e.camera,e.canvas);return o?{key:i,label:e.label?.(t)??Mh(t),sourceElement:e.canvas,bounds:o,context:Eh(t),data:{renderer:"Three.js",objectType:t.type,...t.name?{objectName:t.name}:{},scenePath:Eh(t),...n&&n!==t?{renderObjectName:n.name.trim()||n.type,renderObjectType:n.type,renderScenePath:Eh(n)}:{},position:Sh(t.position),rotation:Sh(t.rotation),scale:Sh(t.scale),visible:String(t.visible),...kh(t)?{material:kh(t)}:{},...Object.fromEntries(Object.entries(e.describe?.(t)??{}).filter(e=>"string"==typeof e[1]&&e[1].length>0))}}:null};return{id:e.id?.trim()||"three",hitTest({x:r,y:o}){let a=e.canvas.getBoundingClientRect();if(r<a.left||r>a.right||o<a.top||o>a.bottom)return null;n.set((r-a.left)/a.width*2-1,-(o-a.top)/a.height*2+1),t.setFromCamera(n,e.camera);for(let n of t.intersectObject(e.scene,!0)){let t=e.select?e.select(n.object):Th(n.object);if(!t||!t.visible)continue;let r=i(t,n.object);if(r)return r}return null},resolve(t){let n=(t=>{let n=null;return e.scene.traverse(e=>{!n&&r(e)===t&&(n=e)}),n})(t);return n?i(n):null},...e.captureFrame?{async captureSurfaces(){let t=await(e.captureFrame?.());return t?[{element:e.canvas,dataUrl:t}]:[]}}:{}}}({canvas:l,scene:t,camera:i,select(e){for(let n=e;n&&n!==t;n=n.parent)if(n.userData.popmeltId||n.name)return n;return e}}),d=new Lr([c]);return a=d,en.set(l,(e,t)=>{let n=c.hitTest({x:e,y:t});if(!n)return null;let r=d.resolve({adapter:c.id,key:n.key});if(!r)return null;let i=r.element,o=JSON.stringify([l.dataset.scratchPart,n.key]),a=2166136261;for(let e=0;e<o.length;e++)a=Math.imul(a^o.charCodeAt(e),16777619);return i.dataset.scratchPart="@three-"+(n.label.replace(/[^\\w-]/g,"-").slice(0,40)||"object")+"-"+(a>>>0).toString(36),i}),u};n.render=u,i.push(()=>{n.render===u&&(n.render=s),en.delete(l),a?.destroy()})}return r.addEventListener("observe",o),()=>{r.removeEventListener("observe",o);for(let e of i)e();!n&&t.__THREE_DEVTOOLS__===r&&delete t.__THREE_DEVTOOLS__}}(i),I=URL.createObjectURL(new Blob([e.bundle.script],{type:"text/javascript"})),j=!1;function L(){if(j)return;let e=document.createRange();e.selectNodeContents(i),T=[...e.getClientRects()].some(e=>e.width>0&&e.height>0)?setTimeout(()=>t.postMessage({type:"painted"}),400):setTimeout(L,50)}import(I).then(async n=>{if(j)return;if("function"!=typeof n.default)throw Error("The fixture must export a mount function.");let r=await n.default(i);if("function"==typeof r&&(j?r():R=r),!j){M(),e.check&&L();let n=async()=>{if(!j){if(e.mirror&&!i.firstElementChild)return void(T=setTimeout(()=>{n()},16));e.mirror&&await document.fonts.ready,!j&&(M(),t.postMessage({type:"ready"}))}};e.mirror?n():requestAnimationFrame(()=>{j||t.postMessage({type:"ready"})})}}).catch(e=>{j||t.postMessage({type:"error",message:e instanceof Error?e.message:"Fixture failed to mount."})});let P=new MutationObserver(M);P.observe(i,{childList:!0,subtree:!0}),f.observe(i),f.observe(document.documentElement);let z=n=>{let r=n.data;"capture"===r.type&&!e.mirror&&async function(e,t){let n=e.ownerDocument;await n.fonts.ready;let r=e.getBoundingClientRect(),i=e.offsetWidth,o=e.offsetHeight;if(!i||!o||!r.width)throw Error("The option is not ready to capture.");let a=r.width/i,l=Array.from(e.children,e=>e.getBoundingClientRect()).filter(e=>e.width&&e.height);l.length||l.push(r);let s,u=Math.max(0,(Math.min(r.right,...l.map(e=>e.left))-r.left)/a-12),c=Math.max(0,(Math.min(r.bottom,...l.map(e=>e.top))-r.top)/a-12),d=Math.min(i,(Math.max(r.left,...l.map(e=>e.right))-r.left)/a+12),f=Math.min(o,(Math.max(r.top,...l.map(e=>e.bottom))-r.top)/a+12),p=await Zf(e,{width:i,height:o,scale:Math.min(2,1600/Math.max(i,o)),backgroundColor:t,timeout:2500,style:{transform:"none",position:"static",margin:"0"},onCloneEachNode:e=>{if(1!==e.nodeType)return;let t=e;(t.hasAttribute("data-tagged")||t.hasAttribute("data-badge-hover")||t.hasAttribute("data-scratch-part"))&&(t.style.outline="none"),t.removeAttribute("data-tagged"),t.removeAttribute("data-badge-hover")}});p.sandbox=n.createElement("iframe");try{s=await Ap(p)}finally{fp(p)}let h=n.createElement("canvas"),m=s.width/i;return h.width=Math.max(1,Math.ceil((d-u)*m)),h.height=Math.max(1,Math.ceil((f-c)*m)),h.getContext("2d").drawImage(s,-u*m,-c*m),new Promise((e,t)=>h.toBlob(n=>n?e(n):t(Error("Could not capture the reviewed option.")),"image/png"))}(i,r.background).then(e=>{j||t.postMessage({type:"capture",id:r.id,image:e})},()=>{j||t.postMessage({type:"capture",id:r.id,error:!0})}),"reference"===r.type&&(d(r.reference,r.theme),m()),"styles"===r.type&&(x=r.parts,M())};return t.addEventListener("message",z),()=>{j=!0,A?.(),clearTimeout(T),URL.revokeObjectURL(I),P.disconnect(),f.disconnect(),t.removeEventListener("message",z),"function"==typeof R&&R(),a.remove(),o.remove()}},[e,t,n]),(0,Rh.jsx)("div",{ref:r,inert:e.readOnly||void 0,"data-explore-fixture-root":"",className:e.mirror?void 0:"sp-fit",style:{display:"flow-root",height:e.fillScene?"100%":void 0}})}function Ih(e){let t=e.map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return.2126*t[0]+.7152*t[1]+.0722*t[2]}function jh(e,t){let n=Ih(e),r=Ih(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}var Lh=u(d());function Ph(e,t){return e.computedStyleMap?.().get(t)?.toString()??("max-width"===t?getComputedStyle(e).maxWidth:function(e,t){if(wn(e)){let n=e.style.getPropertyValue(t);if(n)return n}let n=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());try{for(let r of document.styleSheets)try{let i=r.cssRules||r.rules;for(let r of i)if(r instanceof CSSStyleRule&&e.matches(r.selectorText)){let e=r.style.getPropertyValue(t);if(e)return e;let i=r.style[n];if(i)return i}}catch{}}catch{}return null}(e,t))}function zh(e,t){if(e){if(/^[\\d.]+px$/.test(e))return parseFloat(e);if(/^[\\d.]+%$/.test(e))return t*parseFloat(e)/100}}var Nh=["font-family","font-size","font-weight","font-style","font-stretch","font-variation-settings","font-feature-settings","line-height","letter-spacing","white-space","overflow-wrap","word-break","flex-wrap","color"];function _h(e){return e.trim().replace(/^([\'"])(.*)\\1$/,"$2").toLowerCase()}function Dh(e,t,n){let r=e.ownerDocument,i=function(e,t){let n=new Set([t]);for(let[t]of function*(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent?.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;let t=e;return t.matches("script,style,noscript,template,[hidden],[data-devtools],[data-popmelt-root]")?NodeFilter.FILTER_REJECT:t.matches("input,textarea,select")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),n=new Set;for(let e=t.nextNode();e;e=t.nextNode()){let t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;!t||n.has(t)||(n.add(t),yield[t,e.nodeType===Node.TEXT_NODE?e.textContent.trim():""])}}(e))t!==e&&n.add(getComputedStyle(t).fontFamily);let r=new Set;for(let e of n)for(let t of e.matchAll(/\\s*("[^"]*"|\'[^\']*\'|[^,]+)\\s*(?:,|$)/g))r.add(_h(t[1]));return r}(e,n),o=[],a=new Set;for(let e of r.fonts){let n=_h(e.family);if(i.has(n)&&!t.fonts.has(e))try{t.fonts.add(e),o.push(e)}catch{a.add(n)}}let l=()=>{for(let e of o)t.fonts.delete(e)};if(!a.size)return l;let s=function(e,t){let n=e.ownerDocument,r=[];function i(e){if(!e||e.disabled)return;let t;try{t=e.cssRules}catch{return}o(t,e.href??n.baseURI)}function o(e,n){for(let a of e)if(a.type===CSSRule.FONT_FACE_RULE){let{style:e}=a;if(!t.has(_h(e.getPropertyValue("font-family"))))continue;let i=a.cssText.replace(/url\\("([^"]*)"\\)|url\\(\'([^\']*)\'\\)|url\\(([^)]*)\\)/gi,(e,t,r,i)=>{try{return"url("+JSON.stringify(new URL(t??r??i.trim(),n).href)+")"}catch{return e}});r.push(i)}else a.type===CSSRule.IMPORT_RULE?i(a.styleSheet):"cssRules"in a&&o(a.cssRules,n)}let a=[n];for(let t=e.getRootNode();"host"in t;t=t.host.getRootNode())a.push(t);for(let e of a)for(let t of[...e.styleSheets,...e.adoptedStyleSheets??[]])i(t);return r}(e,a);if(!s.length)return l;let u=t.createElement("style");return u.textContent=s.join("\\n"),t.head.append(u),()=>{u.remove(),l()}}var Fh=u(v());function $h({target:e,children:t,onFitScale:n}){let r=(0,Lh.useRef)(null);return(0,Lh.useLayoutEffect)(()=>{let t=r.current,i=window.frameElement?.ownerDocument,o=i?.location.pathname===e.pathname?Nt(e.selector,e.element,i):null,a=o&&function(e){let t=[];for(let n=e;n;n=ht(n))t.unshift(n);return{boxes:t,measure:function(n=!1){let r=e.ownerDocument.documentElement.clientWidth;for(let i of t){let t=getComputedStyle(i);if("inline"===t.display||"contents"===t.display)continue;let o=(parseFloat(t.paddingLeft)||0)+(parseFloat(t.paddingRight)||0)+(parseFloat(t.borderLeftWidth)||0)+(parseFloat(t.borderRightWidth)||0),a="border-box"===t.boxSizing,l=zh(Ph(i,"width"),r),s=zh(Ph(i,"max-width"),r),u=void 0===l?r-o:l-(a?o:0);r=Math.max(0,Math.min(u,void 0===s?1/0:s-(a?o:0))),n&&i===e&&(r+=o)}return r}}}(o),l=o&&getComputedStyle(o),s=o&&l?Dh(o,t.ownerDocument,l.fontFamily):void 0,u=t.ownerDocument.documentElement.style,c=l&&function(){if(typeof CanvasRenderingContext2D>"u")return;let e=document.createElement("canvas");e.width=e.height=1;let t=e.getContext("2d",{willReadFrequently:!0});return t?(e,n)=>{t.fillStyle=n,t.fillRect(0,0,1,1),t.fillStyle=e,t.fillRect(0,0,1,1);let r=t.getImageData(0,0,1,1).data;return[r[0],r[1],r[2]]}:void 0}();l&&t.style.setProperty("--sp-source-ink",l.color);for(let e of["light","dark"]){let t=Ae[e],n=t.raisedSurface,r=l&&c&&jh(c(l.color,n),c(n,n))>=4.5;u.setProperty("--sp-ink-"+e,r?l.color:t.primary)}if(l)for(let e of Nh)"color"!==e&&t.style.setProperty(e,l.getPropertyValue(e));let d=()=>{let e=document.documentElement.clientWidth,r=document.documentElement.clientHeight;if(!e||!r)return;a&&(t.style.maxWidth=a.measure()+"px");let{width:i,height:o}=getComputedStyle(t),l=Math.min(1,(e-36)/Math.max(1,parseFloat(i)),(r-36)/Math.max(1,parseFloat(o))),s=Math.max(.01,l);t.style.setProperty("--sp-fit",String(s)),n(s)},f=new ResizeObserver(d);f.observe(t),f.observe(document.documentElement);for(let e of a?.boxes??[])f.observe(e);return d(),()=>{f.disconnect(),s?.()}},[e,n]),(0,Fh.jsx)("div",{ref:r,className:"sp-fit",children:t})}function Oh(e,t){let n=e.label?.trim().replace(/\\s*[→↓]$/,"").slice(0,52),r=n?n[0].toUpperCase()+n.slice(1)+" "+e.kind:e.kind[0].toUpperCase()+e.kind.slice(1),i=e.name||r;return"label"===t?i+" label":i}new RegExp(`^${Xe.explore}(?=\\\\s|$)`,"i");var Hh=u(v());function Wh(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),t]))}function Bh({node:e,picker:t,path:n=[],live:r}){let i="row"===e.kind||"column"===e.kind,o=n.join("."),a={display:"inline-flex",flexDirection:"column"===e.kind?"column":"row",alignItems:i&&"column"===e.kind?"flex-start":"center",gap:e.space??0,flexWrap:i&&"row"===e.kind?"inherit":void 0,maxWidth:"100%",boxSizing:"border-box",color:e.ink,background:e.fill,border:e.stroke?"1px solid "+e.stroke:void 0,borderRadius:e.radius,padding:e.px||e.py?String(e.py??0)+"px "+String(e.px??0)+"px":void 0,fontSize:e.size?e.size+"px":void 0,fontWeight:e.weight,...Wh(e.style),...Wh(r?.[o])},l=o+"/label",s=!i&&"text"!==e.kind;return(0,Hh.jsxs)("span",{style:a,className:[t&&"sp-piece"].filter(Boolean).join(" ")||void 0,"data-sp-fill":t&&(e.fill||a.backgroundColor)?"":void 0,"data-sp-ink":t&&a.color?"":void 0,"data-scratch-text":"text"===e.kind||void 0,"data-popmelt-label":Oh(e),"data-scratch-part":o,tabIndex:t?-1:void 0,"data-badge-hover":t?.hovered===o||void 0,"data-tagged":t?.selected===o||void 0,children:[t&&(0,Hh.jsx)("button",{type:"button",className:"sp-piece-hit",onClick:()=>t.tag(o),"aria-label":`Tag ${e.kind}${e.label?": "+e.label:""}`,"aria-pressed":t.selected===o}),i?e.children?.map((e,i)=>(0,Hh.jsx)(Bh,{live:r,node:e,path:[...n,i],picker:t},i)):t&&s?(0,Hh.jsx)("button",{type:"button",className:"sp-label-hit","data-popmelt-label":Oh(e,"label"),"data-sp-fill":e.labelStyle?.["background-color"]?"":void 0,"data-sp-ink":e.labelStyle?.color?"":void 0,"data-scratch-text":"",style:Wh(e.labelStyle),"data-scratch-part":l,"data-badge-hover":t.hovered===l||void 0,"data-tagged":t.selected===l||void 0,onClick:()=>t.tag(l),"aria-label":"Tag text: "+e.label,"aria-pressed":t.selected===l,children:r?.[l]?.text??e.label}):s?(0,Hh.jsx)("span",{"data-popmelt-label":Oh(e,"label"),"data-scratch-part":l,style:{display:"inline-block",...Wh(e.labelStyle),...Wh(r?.[l])},children:r?.[l]?.text??e.label}):r?.[o]?.text??e.label]})}var Vh=u(d()),qh=u(v());function Yh({tag:e,framing:t}){let n=(0,Vh.useRef)(null);return(0,qh.jsx)("div",{"data-devtools":"preview-feedback-picker",style:{position:"absolute",inset:0,cursor:e?"crosshair":"default",userSelect:"none"},onPointerDown:e=>{n.current=e.isPrimary&&0===e.button?{id:e.pointerId,x:e.clientX,y:e.clientY,dragged:!1}:null},onPointerMove:e=>{let r=n.current;if(r?.id!==e.pointerId)return;let i=e.clientX-r.x,o=e.clientY-r.y;if(!r.dragged&&Math.hypot(i,o)<=8||(r.dragged=!0,r.x=e.clientX,r.y=e.clientY,"touch"!==e.pointerType||t.getScale()<=1))return;let{width:a,height:l}=e.currentTarget.getBoundingClientRect();if(!a||!l)return;let s=t.getView(a,l);t.setView(s.scale,s.x+i/a,s.y+o/l,a,l)},onPointerLeave:()=>{n.current=null},onPointerCancel:()=>{n.current=null},onPointerUp:t=>{let r=n.current;if(n.current=null,r?.id!==t.pointerId||r.dragged||Math.hypot(t.clientX-r.x,t.clientY-r.y)>8||!e)return;let i=t.currentTarget.parentElement?.querySelector(".sp-fit");if(!i)return;let o=nn(t.clientX,t.clientY,{within:i})?.closest("[data-scratch-part]");o&&e(o.getAttribute("data-scratch-part"),wf(o))}})}var Uh=u(v());function Xh({node:e,fixture:t,readOnly:n,target:r,color:i,framing:o,update:a,tag:l,selectedPart:s,hoveredPart:u,feedbackOnly:c,controlBounds:d,focusRequest:f,preview:p,toggleWorkspace:h}){!function(e){let t=(0,R.useRef)(e);t.current=e,(0,R.useEffect)(()=>{let e=0,n=0,r=r=>{if("Meta"!==r.key&&"Control"!==r.key)return void(n=0);let i=Date.now();n=i-e<ve?n+1:1,n>=2&&(t.current(),n=0),e=i},i=e=>{"Meta"!==e.key&&"Control"!==e.key&&(n=0)};return window.addEventListener("keydown",r),window.addEventListener("keyup",i),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",i)}},[])}(h);let m=!!t,g=(0,Be.useSyncExternalStore)(Ye.subscribe,Ye.matches,Ue),y=c??g,[x,v]=function(e,t){let n=(0,Zc.useContext)(ed),[r,i]=(0,Zc.useReducer)(ud,Jc),o=(0,Zc.useSyncExternalStore)(n?.subscribe??td,n?.getSnapshot??nd,n?.getSnapshot??nd)??r,a=n?.dispatch??i;(0,Zc.useEffect)(()=>{if(!o.isAnnotating)return;let t=t=>{t.defaultPrevented||t.isComposing||t.altKey||t.composedPath().some(e=>e instanceof Element&&(e.matches(\'input, textarea, select, [role="textbox"]\')||e instanceof HTMLElement&&e.isContentEditable||e.hasAttribute("contenteditable")&&"false"!==e.getAttribute("contenteditable")))||(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===be.key&&(t.preventDefault(),t.shiftKey?a({type:"REDO"}):(e?.current?.(),a({type:"UNDO"})))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,o.isAnnotating,e,t]);let l=n?.getUndoHead?n.getUndoHead():o.undoStack.at(-1);return[o,a,l]}();(0,M.useLayoutEffect)(()=>{if(!f)return;let e=document.querySelector(\'[data-scratch-part="\'+CSS.escape(f.part)+\'"]\');e&&(window.frameElement?.scrollIntoView({block:"nearest",inline:"nearest"}),e.focus({preventScroll:!0}))},[f]),(0,M.useLayoutEffect)(()=>{if(y||n)return;let e=()=>{document.documentElement.removeAttribute("data-preview-control-hovered"),document.hasFocus()||window.focus()},t=e=>{if("Enter"!==e.key&&" "!==e.key)return;let t=e.target;!(t instanceof HTMLButtonElement)||!t.matches(".sp-label-hit, .sp-piece-hit")||(e.preventDefault(),e.stopImmediatePropagation(),t.click())};return window.addEventListener("pointermove",e,!0),window.addEventListener("keydown",t,!0),()=>{window.removeEventListener("pointermove",e,!0),window.removeEventListener("keydown",t,!0)}},[y,n]),(0,M.useLayoutEffect)(()=>{v({type:"SET_COLOR",payload:i}),v({type:"SET_TOOL",payload:"sticker"}),v({type:"SET_ANNOTATING",payload:!0})},[i,v]);let b=(0,M.useRef)([]);return(0,M.useLayoutEffect)(()=>()=>fr(b.current),[]),(0,M.useLayoutEffect)(()=>{let e=x.styleModifications;sr(e);let t=[];for(let n of e){let e=lr(n)?.getAttribute("data-scratch-part");if(null!=e)for(let r of ir(n))t.push({part:e,property:r.property,from:r.original,to:r.modified,sticker:r.sticker})}(function(e,t){let n=new Set(t);fr(e.filter(e=>!(n.has(e)||e.paragraphs&&t.some(t=>t.paragraphs&&t.selector===e.selector&&!t.captured)))),function(e){for(let t of e){if(t.captured)continue;let e=cr(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){let n=e;if(!Xn(n)&&JSON.stringify(Qn(n).layout)!==JSON.stringify(t.paragraphs.before))continue;Jn(n,t.paragraphs.after);continue}let n=dr(e,t.textNodePath);n&&n.nodeValue===t.original&&n.nodeValue!==t.modified&&(n.nodeValue=t.modified)}}(t)})(b.current,x.textModifications),b.current=x.textModifications;for(let e of x.textModifications){let n=cr(e),r=n?.getAttribute("data-scratch-part");if(e.paragraphs&&null!=r)t.push({part:r,property:"paragraphs",from:JSON.stringify(e.paragraphs.before),to:JSON.stringify(e.paragraphs.after)});else if(n&&null!=r){let i=r;if(m){let t=n;for(let n of e.textNodePath.slice(0,-1))t=t?.childNodes[n];if(!(t instanceof Element))continue;i=t.getAttribute("data-scratch-part")??r,t.childNodes.length>1&&(i+="/text/"+e.textNodePath.at(-1))}t.push({part:i,property:"text",from:e.original,to:e.modified})}}return a(t),()=>{ur(e,!0)}},[x.styleModifications,x.textModifications,a,m]),(0,Uh.jsxs)(xf,{interactive:!0,framing:o,parentGestureSurface:window.frameElement?.closest(".sp-workspace"),overlay:n||y?(0,Uh.jsx)(Yh,{framing:o,tag:n?void 0:l}):(0,Uh.jsx)(of,{state:x,dispatch:v,nativeFixtureInput:!!t,steerControlBounds:d,showSteerChangeBadges:!1,canEditSteerText:e=>e.hasAttribute("data-scratch-text")||"P"===e.tagName&&!!e.querySelector("[data-scratch-text]"),onSteerPreviewChange:e=>{let t=e?.element.getAttribute("data-scratch-part");p(e&&null!=t?{[t]:Object.fromEntries(e.activeDeclarations.filter(e=>"transition"!==e.property).map(e=>[e.property,e.value]))}:null)},onSteerTargetClick:e=>{let n=e.closest("[data-scratch-part]")?.getAttribute("data-scratch-part");null!=n&&l(n,t?wf(e):void 0)},onScreenshot:async()=>!1}),children:[(0,Uh.jsx)("div",{className:"sp-backdrop","aria-hidden":"true","data-popmelt-canvas-block":""}),t,r&&e&&(0,Uh.jsx)($h,{target:r,onFitScale:o.setFitScale,children:(0,Uh.jsx)(Bh,{node:e,picker:{tag:l,selected:s,hovered:u}})})]})}var Kh=(0,T.createRoot)(document.getElementById("root"));window.addEventListener("pagehide",e=>{e.persisted||Kh.unmount()});var Qh=0;window.startScratchSteer=(e,t,n,r,i,o,a,l)=>{let s=++Qh;return u=>Kh.render((0,Uh.jsx)(Xh,{node:e,target:t,color:n,framing:r,update:i,preview:a,toggleWorkspace:l,tag:o,...u},s))},window.parent!==window&&!window.frameElement&&function(e){let t=n=>{if(n.source!==window.parent||!n.ports[0]||!n.data?.bundle)return;window.removeEventListener("message",t);let r=n.ports[0],i=n.data;for(let e of["localStorage","sessionStorage"]){let t=new Map;Object.defineProperty(window,e,{configurable:!0,value:{get length(){return t.size},key:e=>[...t.keys()][e]??null,getItem:e=>t.get(String(e))??null,setItem(e,n){t.set(String(e),String(n))},removeItem(e){t.delete(String(e))},clear(){t.clear()}}})}let o=gf(null);o.restore(i.framing);let a="",l=o.subscribe(()=>{let e=o.snapshot(),t=JSON.stringify([e,o.getFitScale()]);t!==a&&(a=t,r.postMessage({type:"framing",fit:o.getFitScale(),view:e}))}),s={readOnly:i.readOnly,feedbackOnly:i.feedbackOnly,framing:o,color:i.accent,update:e=>r.postMessage({type:"edits",edits:e}),tag:(e,t)=>r.postMessage({type:"tag",part:e,label:t}),preview:e=>r.postMessage({type:"preview",parts:e}),toggleWorkspace:()=>r.postMessage({type:"toggle"})};window.addEventListener("error",e=>r.postMessage({type:"error",message:e.error?.message||e.message})),window.addEventListener("unhandledrejection",e=>r.postMessage({type:"error",message:String(e.reason)}));let u=(0,Rh.jsx)(Ah,{input:i,port:r,framing:o});r.onmessage=t=>{let n=t.data;if("controlEnter"===n.type&&document.documentElement.setAttribute("data-preview-control-hovered",""),"controls"===n.type&&!i.mirror&&(s.controlBounds=n.bounds,e(s,u)),"framing"===n.type&&o.restore(n.view),"framingGesture"===n.type){let e=document.querySelector("[data-preview-zoom]"),t="wheel"===n.event?new WheelEvent("wheel",n):Object.assign(new Event(n.event),{clientX:n.clientX,clientY:n.clientY,scale:n.scale});e?.dispatchEvent(t)}if("interaction"===n.type&&!i.mirror){"boolean"==typeof n.feedbackOnly&&(s.feedbackOnly=i.feedbackOnly=n.feedbackOnly),s.focusRequest=void 0===n.focus?void 0:{part:n.focus};for(let[e,t]of[["data-tagged",n.selected],["data-badge-hover",n.hovered]])document.querySelectorAll("[data-scratch-part]").forEach(n=>n.toggleAttribute(e,n.getAttribute("data-scratch-part")===t));e(s,u)}},window.addEventListener("keydown",e=>{"Escape"===e.key&&!e.target?.closest?.("input,textarea,[contenteditable=true]")&&r.postMessage({type:"escape"})},!0),window.addEventListener("pagehide",()=>{l(),r.close()},{once:!0}),e(i.mirror?null:s,u)};window.addEventListener("message",t)}((e,t)=>Kh.render(e?(0,Uh.jsx)(Xh,{...e,fixture:t}):t));\n/*! Bundled license information:\n\nreact/cjs/react.production.js:\n (**\n * @license React\n * react.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nscheduler/cjs/scheduler.production.js:\n (**\n * @license React\n * scheduler.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact-dom/cjs/react-dom.production.js:\n (**\n * @license React\n * react-dom.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact-dom/cjs/react-dom-client.production.js:\n (**\n * @license React\n * react-dom-client.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact/cjs/react-jsx-runtime.production.js:\n (**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n*/<\/script>\n </body>\n</html>\n',t=e.replace("\x3c!-- fixture-policy --\x3e","<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; script-src 'unsafe-inline' 'wasm-unsafe-eval' blob:; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data: blob:; worker-src blob:; connect-src data: blob:; frame-src 'none'; base-uri 'none'; form-action 'none'\">");export{e as a,t as b};