@popmelt.com/core 0.39.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +1 -29
  2. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  3. package/claude-plugin/skills/popmelt-core/SKILL.md +5 -1
  4. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  5. package/codex-plugin/skills/popmelt-core/SKILL.md +5 -1
  6. package/dist/{ExploreAttachment-OA2PUTNR.mjs → ExploreAttachment-ZPC5AR5V.mjs} +1 -1
  7. package/dist/{PagePreviewLayer-HKADULHD.mjs → PagePreviewLayer-C7WBS7IX.mjs} +1 -1
  8. package/dist/ParticipantRuntime-CWE62D2G.mjs +1 -0
  9. package/dist/PhoneHostGate-NWJXZBBP.mjs +1 -0
  10. package/dist/PopmeltTasteConnectedPane-2BNDKMMB.mjs +1 -0
  11. package/dist/{PreviewRuntime-3ANAJNFO.mjs → PreviewRuntime-7EQNIOF5.mjs} +1 -1
  12. package/dist/SamplePlacementOverlay-ULOV22WR.mjs +1 -0
  13. package/dist/ShareProjectPane-KEE7EYMP.mjs +1 -0
  14. package/dist/SuppliedContext-IT25WBGQ.mjs +1 -0
  15. package/dist/ThreadErrorCard-SUFOXXLG.mjs +1 -0
  16. package/dist/ThreadPanel-NNJHQQSD.mjs +1 -0
  17. package/dist/adapter-react-three-fiber.d.mts +4 -37
  18. package/dist/adapter-react-three-fiber.mjs +1 -1
  19. package/dist/adapter-three.d.mts +14 -220
  20. package/dist/adapter-three.mjs +1 -45
  21. package/dist/bridge-entry.mjs +1 -1
  22. package/dist/browser-runtime-G6AEOA4X.mjs +1 -0
  23. package/dist/browser.d.mts +4 -4
  24. package/dist/browser.mjs +1 -1
  25. package/dist/canvas-text.d.mts +38 -0
  26. package/dist/canvas-text.mjs +1 -0
  27. package/dist/{checkFixture-I2ALOQTM.mjs → checkFixture-LBDNT3M5.mjs} +1 -1
  28. package/dist/chunk-2FHGLE7G.mjs +1 -0
  29. package/dist/chunk-32TDB3N4.mjs +1 -0
  30. package/dist/{chunk-W62YY5IT.mjs → chunk-44NLL6X3.mjs} +1 -1
  31. package/dist/chunk-4EDMISUV.mjs +1 -0
  32. package/dist/{chunk-UFUH63SR.mjs → chunk-4MLXPN7W.mjs} +1 -1
  33. package/dist/{chunk-4B6HUJCH.mjs → chunk-53QOGFAT.mjs} +1 -1
  34. package/dist/{chunk-MSWRCFPJ.mjs → chunk-6DU4ITXT.mjs} +1 -1
  35. package/dist/chunk-A4GARXVQ.mjs +1 -0
  36. package/dist/{chunk-6RMM7JB6.mjs → chunk-ADRWR5GI.mjs} +1 -1
  37. package/dist/chunk-AKEVJPGD.mjs +1 -0
  38. package/dist/{chunk-W5JUAOLA.mjs → chunk-BD7DW4UK.mjs} +1 -1
  39. package/dist/{chunk-QDFQPABM.mjs → chunk-CUVWMYUV.mjs} +1 -1
  40. package/dist/{chunk-4LN72RDZ.mjs → chunk-DBCCE7BA.mjs} +1 -1
  41. package/dist/chunk-DSTHM3V5.mjs +30 -0
  42. package/dist/{chunk-V56MNQLF.mjs → chunk-ECWY6Z6K.mjs} +1 -1
  43. package/dist/chunk-EHM2ZBQU.mjs +1 -0
  44. package/dist/{chunk-P3IOAIYB.mjs → chunk-EUFK7B6S.mjs} +1 -1
  45. package/dist/chunk-FR6VIGJ2.mjs +1 -0
  46. package/dist/chunk-HVDJYNQ6.mjs +1 -0
  47. package/dist/{chunk-TVIKC33M.mjs → chunk-KF35YUNZ.mjs} +1 -1
  48. package/dist/{chunk-D3BHAI37.mjs → chunk-KN4GC34I.mjs} +1 -1
  49. package/dist/{chunk-BDUWFDBP.mjs → chunk-KUILFVXZ.mjs} +1 -1
  50. package/dist/{chunk-FD6IIFJC.mjs → chunk-L3QE62SE.mjs} +1 -1
  51. package/dist/{chunk-IWF42SDV.mjs → chunk-MHTX52KW.mjs} +1 -1
  52. package/dist/chunk-N37INB4D.mjs +1 -0
  53. package/dist/chunk-NFPUOL4J.mjs +1 -0
  54. package/dist/{chunk-CPFVBR6Q.mjs → chunk-OECEYJNK.mjs} +1 -1
  55. package/dist/chunk-PRPXMDZ7.mjs +1 -0
  56. package/dist/chunk-Q5MIJ5F2.mjs +1 -0
  57. package/dist/chunk-QYNW5LE2.mjs +1 -0
  58. package/dist/chunk-RAABZFBD.mjs +1 -0
  59. package/dist/{chunk-OL7RDZ2R.mjs → chunk-REPKQAJK.mjs} +1 -1
  60. package/dist/chunk-RIGP4DAV.mjs +1 -0
  61. package/dist/chunk-RXC7B7SX.mjs +1 -0
  62. package/dist/{chunk-VWFST2IX.mjs → chunk-TVS2ZIAW.mjs} +1 -1
  63. package/dist/{chunk-SKM4ZXV5.mjs → chunk-UFU5IA3G.mjs} +1 -1
  64. package/dist/chunk-V7AOJQXQ.mjs +1 -0
  65. package/dist/chunk-VBH2YQLG.mjs +1 -0
  66. package/dist/{chunk-RJWFSAKE.mjs → chunk-VLTK7KWK.mjs} +1 -1
  67. package/dist/chunk-WKQGWQ3P.mjs +1 -0
  68. package/dist/chunk-WPU4472Z.mjs +1 -0
  69. package/dist/chunk-WYQZ7DAK.mjs +1 -0
  70. package/dist/chunk-X6I6KQDG.mjs +1 -0
  71. package/dist/{chunk-G6ITTTFD.mjs → chunk-XVQAHYF2.mjs} +1 -1
  72. package/dist/{chunk-3LZQLRZ2.mjs → chunk-YTIDSDPP.mjs} +1 -1
  73. package/dist/{chunk-ML7YV4RV.mjs → chunk-ZQMKLODZ.mjs} +1 -1
  74. package/dist/cli.mjs +1 -1
  75. package/dist/codex-note-context-GXC2474A.mjs +1 -0
  76. package/dist/codex-project-HVK7FSWQ.mjs +1 -0
  77. package/dist/{codex-store-mount-MNIL3VK6.mjs → codex-store-mount-KHTSSESB.mjs} +1 -1
  78. package/dist/dev-server-QMA23NJQ.mjs +1 -0
  79. package/dist/{focus-inspection-LGIRFL2T.mjs → focus-inspection-FVQ6TVGA.mjs} +1 -1
  80. package/dist/guest-admission.mjs +1 -1
  81. package/dist/guest-live-canvas.mjs +1 -1
  82. package/dist/index.d.mts +5 -5
  83. package/dist/index.mjs +1 -1
  84. package/dist/media.d.mts +3 -3
  85. package/dist/memory-legacy.d.mts +43 -1
  86. package/dist/memory-store.d.mts +5 -162
  87. package/dist/memory.d.mts +3 -531
  88. package/dist/{page-interaction-GC2UN47Y.mjs → page-interaction-YXHXEYOT.mjs} +1 -1
  89. package/dist/{page-planes-9GVbnVZa.d.mts → page-planes-Jz2yR_Wk.d.mts} +6 -1
  90. package/dist/{participantBootstrap-BTcD7XgB.d.mts → participantBootstrap-DDOxY-Cy.d.mts} +2 -2
  91. package/dist/{peer-client-XNTMFSOV.mjs → peer-client-JL754ZR7.mjs} +1 -1
  92. package/dist/plugin-astro.d.mts +1 -1
  93. package/dist/plugin-astro.mjs +1 -1
  94. package/dist/plugin-nuxt.mjs +1 -1
  95. package/dist/plugin-vite.d.mts +1 -1
  96. package/dist/plugin-vite.mjs +1 -1
  97. package/dist/server.d.mts +4 -4
  98. package/dist/server.mjs +1 -1
  99. package/dist/shared-page-QN2XRXUE.mjs +1 -0
  100. package/dist/{subjects-D_yanOQ2.d.mts → subjects-cLtt9-iK.d.mts} +12 -0
  101. package/dist/{types-CggBG-H6.d.mts → types-XKO-uva0.d.mts} +1 -1
  102. package/dist/{index-D6bSXWNT.d.mts → validate-0kt2EgVe.d.mts} +7 -40
  103. package/dist/{video-adapter-CWpR4NSt.d.mts → video-adapter-xL95wukX.d.mts} +1 -1
  104. package/package.json +7 -3
  105. package/dist/ParticipantRuntime-IU2STHIT.mjs +0 -1
  106. package/dist/PhoneHostGate-CS3KFCP5.mjs +0 -1
  107. package/dist/PopmeltTasteConnectedPane-TRQCY5SM.mjs +0 -1
  108. package/dist/SamplePlacementOverlay-SNA4WB6Z.mjs +0 -1
  109. package/dist/ShareProjectPane-QLHMNZNU.mjs +0 -1
  110. package/dist/SuppliedContext-SFOM3R3K.mjs +0 -1
  111. package/dist/ThreadErrorCard-NJUVLWMU.mjs +0 -1
  112. package/dist/ThreadPanel-RVCNMX7B.mjs +0 -1
  113. package/dist/browser-runtime-BUC4RUD7.mjs +0 -1
  114. package/dist/chunk-25EXQOPI.mjs +0 -1
  115. package/dist/chunk-742KV4YS.mjs +0 -1
  116. package/dist/chunk-ADOCYY5I.mjs +0 -1
  117. package/dist/chunk-B3RA4XAR.mjs +0 -1
  118. package/dist/chunk-B4ZKGIGU.mjs +0 -1
  119. package/dist/chunk-CHK24QU5.mjs +0 -1
  120. package/dist/chunk-DKBVNKIG.mjs +0 -24
  121. package/dist/chunk-EOAWCUFT.mjs +0 -1
  122. package/dist/chunk-FPSR4NAR.mjs +0 -1
  123. package/dist/chunk-H4GG2RS4.mjs +0 -1
  124. package/dist/chunk-K2OUXYDM.mjs +0 -1
  125. package/dist/chunk-KY4YVZ3O.mjs +0 -1
  126. package/dist/chunk-LSKP5UC6.mjs +0 -1
  127. package/dist/chunk-MLNC5TMP.mjs +0 -1
  128. package/dist/chunk-RALP6ENI.mjs +0 -30
  129. package/dist/chunk-RRB5IHBT.mjs +0 -1
  130. package/dist/chunk-WNOLXY3Y.mjs +0 -1
  131. package/dist/codex-note-context-4ORRY4CH.mjs +0 -1
  132. package/dist/codex-project-LMAR3FMS.mjs +0 -1
  133. package/dist/dev-server-ZLT7TAUF.mjs +0 -1
  134. package/dist/shared-page-JN7T4DDQ.mjs +0 -1
  135. /package/dist/{chunk-CZJILD7T.mjs → chunk-6RC7JZ73.mjs} +0 -0
  136. /package/dist/{toolbarFonts-JAGSN3DN.mjs → toolbarFonts-33BI56VQ.mjs} +0 -0
  137. /package/dist/{webpEncoder-QJRHTWUU.mjs → webpEncoder-JVMGDKHV.mjs} +0 -0
@@ -0,0 +1 @@
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 v(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 x=v.prototype=new y;x.constructor=v,h(x,g.prototype),x.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 E(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var C=/\\/+/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 j(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 j((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(C,"$&/")+"/"),j(a,r,i,"",function(e){return e})):null!=a&&(E(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(C,"$&/")+"/")+s)),r.push(a)),1;s=0;var u=""===o?".":o+":";if(b(e))for(var c=0;c<e.length;c++)s+=j(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+=j(o=o.value,r,i,l=u+M(o,c++),a);else if("object"===l){if("function"==typeof e.then)return j(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 j(e,r,"","",function(e){return t.call(n,e,i++)}),r}function R(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 I="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(!E(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=v,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=E,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:R}},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,I)}catch(e){I(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,v="function"==typeof clearTimeout?clearTimeout:null,x=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,C||(C=!0,S());else{var t=n(u);null!==t&&I(w,t.startTime-e)}}var S,k,E,C=!1,M=-1,T=5,j=-1;function A(){return!(!g&&e.unstable_now()-j<T)}function R(){if(g=!1,C){var t=e.unstable_now();j=t;var i=!0;try{e:{h=!1,m&&(m=!1,v(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&&I(w,c.startTime-t),i=!1}}break e}finally{d=null,f=o,p=!1}i=void 0}}finally{i?S():C=!1}}}function I(t,n){M=y(function(){t(e.unstable_now())},n)}"function"==typeof x?S=function(){x(R)}:typeof MessageChannel<"u"?(k=new MessageChannel,E=k.port2,k.port1.onmessage=R,S=function(){E.postMessage(null)}):S=function(){y(R,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?(v(M),M=-1):m=!0,I(w,o-a))):(r.sortIndex=l,t(s,r),h||p||(h=!0,C||(C=!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"),v=Symbol.for("react.strict_mode"),x=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"),E=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),A=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function I(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=R&&e[R]||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 x:return"Profiler";case v:return"StrictMode";case E:return"Suspense";case C:return"SuspenseList";case j: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,D=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_={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=_)}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,ve=4194304;function xe(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=xe(r):0!==(a&=l)?i=xe(a):n||0!==(n=l&~e)&&(i=xe(n)):0!==(l=r&~o)?i=xe(l):0!==a?i=xe(a):n||0!==(n=r&~e)&&(i=xe(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 Ee(){var e=ve;return!(62914560&(ve<<=1))&&(ve=4194304),e}function Ce(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 je(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 Re(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function Ie(){var e=D.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,De="__reactEvents$"+Le,_e="__reactListeners$"+Le,Fe="__reactHandles$"+Le,$e="__reactResources$"+Le,Oe="__reactMarker$"+Le;function He(e){delete e[Pe],delete e[ze],delete e[De],delete e[_e],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?xt(e,a,ct(t)):null!=n?xt(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 vt(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 xt(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 Et=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 Ct(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||Et.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&&Ct(e,o,r)}else for(var a in t)t.hasOwnProperty(a)&&Ct(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 jt=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 Rt(e){return At.test(""+e)?"javascript:throw new Error(\'React has blocked a javascript: URL as a security precaution.\')":e}var It=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 Dt=!1;function _t(e,t,n){if(Dt)return e(t,n);Dt=!0;try{return e(t)}finally{if(Dt=!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})),vn=Kt(c({},tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mn})),xn=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,En=null;$t&&"documentMode"in document&&(En=document.documentMode);var Cn=$t&&"TextEvent"in window&&!En,Mn=$t&&(!kn||En&&8<En&&11>=En),Tn=" ",jn=!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 Rn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var In=!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,Dn=null;function _n(e){_c(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),Dn=Nn=null)}function qn(e){if("value"===e.propertyName&&Fn(Dn)){var t=[];zn(t,Dn,e,Lt(e)),_t(_n,t)}}function Yn(e,t,n){"focusin"===e?(Vn(),Dn=n,(Nn=t).attachEvent("onpropertychange",qn)):"focusout"===e&&Vn()}function Un(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Fn(Dn)}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"),vr=pr("transitionstart"),xr=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 Er=new WeakMap;function Cr(e,t){if("object"==typeof e&&null!==e){var n=Er.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ut(t)},Er.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Mr=[],Tr=0,jr=0;function Ar(){for(var e=Tr,t=jr=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 Rr(e,t,n,r){Mr[Tr++]=e,Mr[Tr++]=t,Mr[Tr++]=n,Mr[Tr++]=r,jr|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function Ir(e,t,n,r){return Rr(e,t,n,r),zr(e)}function Lr(e,t){return Rr(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 Dr(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 _r(e,t,n,r){return new Dr(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=_r(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 j:return(e=_r(31,n,t,o)).elementType=j,e.lanes=a,e;case y:return Wr(n.children,o,a,t);case v:l=8,o|=24;break;case x:return(e=_r(12,n,t,2|o)).elementType=x,e.lanes=a,e;case E:return(e=_r(13,n,t,o)).elementType=E,e.lanes=a,e;case C:return(e=_r(19,n,t,o)).elementType=C,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=_r(l,n,t,o)).elementType=e,t.type=r,t.lanes=a,t}function Wr(e,t,n,r){return(e=_r(7,e,r,t)).lanes=n,e}function Br(e,t,n){return(e=_r(6,e,null,t)).lanes=n,e}function Vr(e,t,n){return(t=_r(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(Cr(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),vt(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=vd(e.nextSibling);break e}n--}else"$"!==t&&"$!"!==t&&"$?"!==t||n++;e=e.nextSibling}oi=null}}else 27===n?(n=oi,hd(e.type)?(e=xd,xd=null,oi=e):oi=n):oi=ii?vd(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),vi=null,xi=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 Ei(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 Ci(e){for(e=e.firstContext;null!==e;){if(!Qn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Mi(e){vi=e,xi=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Ti(e){return Ai(vi,e)}function ji(e,t){return null===vi&&Mi(e),Ai(e,t)}function Ai(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===xi){if(null===e)throw Error(i(308));xi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else xi=xi.next=t;return n}var Ri=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()})}},Ii=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 Ri,data:new Map,refCount:0}}function Ni(e){e.refCount--,0===e.refCount&&Ii(Li,function(){e.controller.abort()})}var Di=null,_i=0,Fi=0,$i=null;function Oi(){if(0===--_i&&null!==Di){null!==$i&&($i.status="fulfilled");var e=Di;Di=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===Di){var n=Di=[];_i=0,Fi=Lc(),$i={status:"pending",value:void 0,then:function(e){n.push(e)}}}_i++,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 Rr(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,je(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 vo(){W(go,fu),W(mo,mo.current)}function xo(){fu=go.current,H(mo),H(go)}var bo=0,wo=null,So=null,ko=null,Eo=!1,Co=!1,Mo=!1,To=0,jo=0,Ao=null,Ro=0;function Io(){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,Co&&(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,Eo=!1,jo=0,Ao=null,t)throw Error(i(300));null===e||jl||null!==(e=e.dependencies)&&Ci(e)&&(jl=!0)}function No(e,t,n,r){wo=e;var o=0;do{if(Co&&(Ao=null),jo=0,Co=!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(Co);return a}function Do(){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 _o(){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(Eo){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}Eo=!1}bo=0,ko=So=wo=null,Co=!1,jo=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=jo;return jo+=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)&&(jl=!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)||(jl=!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,jl=!0),o=o.queue,va(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&&_u(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=vd(i.nextSibling))){i=null;break t}}i="F!"===(o=i.data)||"F"===o?i:null}if(i){oi=vd(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 va(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 xa(e,t){ya(8390656,8,e,t)}function ba(e,t){va(2048,8,e,t)}function wa(e,t){return va(4,2,e,t)}function Sa(e,t){return va(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 Ea(e,t,n){n=null!=n?n.concat([e]):null,va(4,4,ka.bind(null,t,e),n)}function Ca(){}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 ja(e,t,n){return void 0===n||1073741824&bo?e.memoizedState=t:(e.memoizedState=n,e=Du(),wo.lanes|=e,hu|=e,n)}function Aa(e,t,n,r){return Qn(n,t)?n:null!==mo.current?(e=ja(e,n,r),Qn(e,t)||(jl=!0),e):42&bo?(e=Du(),wo.lanes|=e,hu|=e,t):(jl=!0,e.memoizedState=n)}function Ra(e,t,n,r,i){var o=D.p;D.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{D.p=o,N.T=a}}function Ia(){}function La(e,t,n,r){if(5!==e.tag)throw Error(i(476));var o=Pa(e).queue;Ra(e,o,t,_,null===n?Ia:function(){return za(e),n(r)})}function Pa(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:_,baseState:_,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:_},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 Da(){return Ho().memoizedState}function _a(){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&&(_u(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=Ir(e,t,n,r))&&(_u(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 Rr(e,t,i,0),null===iu&&Ar(),!1}catch{}if(null!==(n=Ir(e,t,i,r)))return _u(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=Ir(e,n,r,2))&&_u(t,0,2)}function Ba(e){var t=e.alternate;return e===wo||null!==t&&t===wo}function Va(e,t){Co=Eo=!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,je(e,n)}}var Ya={readContext:Ti,use:Bo,useCallback:Io,useContext:Io,useEffect:Io,useImperativeHandle:Io,useLayoutEffect:Io,useInsertionEffect:Io,useMemo:Io,useReducer:Io,useRef:Io,useState:Io,useDebugValue:Io,useDeferredValue:Io,useTransition:Io,useSyncExternalStore:Io,useId:Io,useHostTransitionStatus:Io,useFormState:Io,useActionState:Io,useOptimistic:Io,useMemoCache:Io,useCacheRefresh:Io},Ua={readContext:Ti,use:Bo,useCallback:function(e,t){return Oo().memoizedState=[e,void 0===t?null:t],e},useContext:Ti,useEffect:xa,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:Ca,useDeferredValue:function(e,t){return ja(Oo(),e,t)},useTransition:function(){var e=ta(!1);return e=Ra.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,xa(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=Ro++).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:Ea,useInsertionEffect:wa,useLayoutEffect:Sa,useMemo:Ta,useReducer:Yo,useRef:ga,useState:function(){return Yo(qo)},useDebugValue:Ca,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:Da,useHostTransitionStatus:Na,useFormState:da,useActionState:da,useOptimistic:function(e,t){return na(Ho(),0,e,t)},useMemoCache:Vo,useCacheRefresh:_a},Ka={readContext:Ti,use:Bo,useCallback:Ma,useContext:Ti,useEffect:ba,useImperativeHandle:Ea,useInsertionEffect:wa,useLayoutEffect:Sa,useMemo:Ta,useReducer:Xo,useRef:ga,useState:function(){return Xo(qo)},useDebugValue:Ca,useDeferredValue:function(e,t){var n=Ho();return null===So?ja(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:Da,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:_a},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)||I(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,ji(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)||I(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,ji(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)||I(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,ji(t,r),i);el(t,r)}return null}function v(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 x=c.key;null!==u;){if(u.key===x){if((x=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===x||"object"==typeof x&&null!==x&&x.$$typeof===T&&tl(x)===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(x=c.key;null!==u;){if(u.key===x){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 v(s,u,c=(x=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(I(c)){if("function"!=typeof(x=I(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,v=s.next();null!==h&&!v.done;g++,v=s.next()){h.index>g?(y=h,h=null):y=h.sibling;var x=p(o,h,v.value,u);if(null===x){null===h&&(h=y);break}e&&h&&null===x.alternate&&t(o,h),l=a(x,l,g),null===d?c=x:d.sibling=x,d=x,h=y}if(v.done)return n(o,h),ai&&ei(o,g),c;if(null===h){for(;!v.done;g++,v=s.next())null!==(v=f(o,v.value,u))&&(l=a(v,l,g),null===d?c=v:d.sibling=v,d=v);return ai&&ei(o,g),c}for(h=r(h);!v.done;g++,v=s.next())null!==(v=m(h,o,g,v.value,u))&&(e&&null!==v.alternate&&h.delete(null===v.key?g:v.key),l=a(v,l,g),null===d?c=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(o,e)}),ai&&ei(o,g),c}(s,u,c=x.call(c),d)}if("function"==typeof c.then)return v(s,u,Za(c),d);if(c.$$typeof===S)return v(s,u,ji(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=v(e,t,n,r);return Qa=null,i}catch(t){if(t===Yi||t===Xi)throw t;var o=_r(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))&&(_u(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))&&(_u(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))&&(_u(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 vl="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 xl(e){vl(e)}function bl(e){console.error(e)}function wl(e){vl(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 El(e,t,n){return(n=oo(n)).tag=3,n.payload={element:null},n.callback=function(){Sl(e,t)},n}function Cl(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===Cu?Cu=new Set([this]):Cu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Tl=Error(i(461)),jl=!1;function Al(e,t,n,r){t.child=null===e?il(t,null,n,r):rl(t,e.child,n,r)}function Rl(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=_o(),null===e||jl?(ai&&l&&ni(t),t.flags|=1,Al(e,t,r,i),t.child):(Fo(e,t,i),Ql(e,t,i))}function Il(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(jl=!1,t.pendingProps=r=o,!Gl(e,i))return t.lanes=e.lanes,Ql(e,t,i);131072&e.flags&&(jl=!0)}}return Dl(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):vo(),sl(t)}else null!==o?(Vi(0,o.cachePool),yo(t,o),ul(),t.memoizedState=null):(null!==e&&Vi(0,null),vo(),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),vo(),sl(t),null!==e&&Ei(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 Dl(e,t,n,r,i){return Mi(t),n=Po(e,t,n,r,void 0,i),r=_o(),null===e||jl?(ai&&r&&ni(t),t.flags|=1,Al(e,t,n,i),t.child):(Fo(e,t,i),Ql(e,t,i))}function _l(e,t,n,r,i,o){return Mi(t),t.updateQueue=null,n=No(t,r,n,i),zo(e),r=_o(),null===e||jl?(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&&Ci(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&&Ci(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=vd(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=_r(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(jl||Ei(e,t,n,!1),r=0!==(n&e.childLanes),jl||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),_u(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=vd(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=_r(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(Ei(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)||!Ci(e))}function Zl(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)jl=!0;else{if(!(Gl(e,n)||128&t.flags))return jl=!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))||(Ei(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);jl=!!(131072&e.flags)}else jl=!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=Rl(null,t,r,e,n);break e}if(o===M){t.tag=14,t=Il(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=Dl(null,t,r,e,n))}return t;case 0:return Dl(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=Cr(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=vd(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)?(xd=o,oi=vd(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=vd(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,si),null!==r?(t.stateNode=r,ii=t,oi=vd(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,Do,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=vd(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 Rl(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 Il(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?Ee():536870912,e.lanes|=t,vu|=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),xo(),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),xo(),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),xo(),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 v in n)p=n[v],n.hasOwnProperty(v)&&null!=p&&!r.hasOwnProperty(v)&&Jc(e,t,v,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 vs(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(vs(e,t,n),e=e.sibling;null!==e;)vs(e,t,n),e=e.sibling}function xs(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,Es=null;function Cs(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&&xs(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&&Is(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,js=!1;function As(e,t,n){for(n=n.child;null!==n;)Rs(e,t,n),n=n.sibling}function Rs(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=js;hd(n.type)&&(Ts=n.stateNode,js=!1),As(e,t,n),Sd(n.stateNode),Ts=r,js=i;break;case 5:ws||fs(n,t);case 6:if(r=Ts,i=js,Ts=null,As(e,t,n),js=i,null!==(Ts=r))if(js)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&&(js?(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=js,Ts=n.stateNode.containerInfo,js=!0,As(e,t,n),Ts=r,js=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 Is(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,js=!1;break e}break;case 5:Ts=s.stateNode,js=!1;break e;case 3:case 4:Ts=s.stateNode.containerInfo,js=!0;break e}s=s.return}if(null===Ts)throw Error(i(160));Rs(a,l,o),Ts=null,js=!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),Ds(e),4&r&&(ss(3,e,e.return),ls(3,e),ss(5,e,e.return));break;case 1:Ps(t,e),Ds(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),Ds(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),Ds(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),Ds(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),Ds(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=Cd(t.containerInfo),Ps(t,e),zs=o,Ds(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Af(t.containerInfo)}catch(t){dc(e,e.return,t)}Ss&&(Ss=!1,_s(e));break;case 4:r=zs,zs=Cd(e.stateNode.containerInfo),Ps(t,e),Ds(e),zs=r;break;case 12:default:Ps(t,e),Ds(e);break;case 13:Ps(t,e),Ds(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,Ds(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),Ds(e),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,Ls(e,r));case 30:case 21:}}function Ds(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;vs(e,gs(e),o);break;case 5:var a=n.stateNode;32&n.flags&&(kt(a,""),n.flags&=-33),vs(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 _s(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;_s(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;)Cs(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:xs(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&&Is(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=Rd(n.href),a=e.querySelector(Id(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))&&_d(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=Cd(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];Es=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];Es=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!==Es;){var n=Es;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,Es=r;else e:for(n=e;null!==Es;){var i=(r=Es).sibling,o=r.return;if(Ms(r),r===n){Es=null;break e}if(null!==i){i.return=o,Es=i;break e}Es=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,vu=0,xu=null,bu=null,wu=!1,Su=0,ku=1/0,Eu=null,Cu=null,Mu=0,Tu=null,ju=null,Au=0,Ru=0,Iu=null,Lu=null,Pu=0,zu=null;function Nu(){return 2&ru&&0!==au?au&-au:null!==N.T?0!==Fi?Fi:Lc():Ie()}function Du(){0===yu&&(yu=536870912&au&&!ai?536870912:ke());var e=ol.current;return null!==e&&(e.flags|=32),yu}function _u(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)),Cc(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?(Eu=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),Cc(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 xi=vi=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=xu;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,Eu,wu,t,yu,mu,vu,uu,a,2,-0,0),o)}else $u(r,n,bu,Eu,wu,t,yu,mu,vu,uu,a,0,-0,0)}break}o=Ku(e,t,!1),a=!1}Cc(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 xi=vi=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,vu=yu=gu=mu=hu=pu=0,bu=xu=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,Cr(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)&&(Eu=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++,xi=vi=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=_l(n,t,t.pendingProps,t.type,void 0,au);break;case 11:t=_l(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){xi=vi=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)&&Ei(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(Cr(e=Error(i(422),{cause:r}),n))):(r!==ui&&gi(Cr(t=Error(i(423),{cause:r}),n)),(e=e.current.alternate).flags|=65536,o&=-o,e.lanes|=o,r=Cr(r,n),so(e,o=El(e.stateNode,r,o)),4!==pu&&(pu=2)),!1;var a=Error(i(520),{cause:r});if(a=Cr(a,n),null===xu?xu=[a]:xu.push(a),4!==pu&&(pu=2),null===t)return!0;r=Cr(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,so(n,e=El(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!==Cu&&Cu.has(a))))return n.flags|=65536,o&=-o,n.lanes|=o,Ml(o=Cl(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,Cr(n,e.current)),void(ou=null)}catch(t){if(null!==o)throw ou=o,t;return pu=1,Sl(e,Cr(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|=jr,l,s,u),e===iu&&(ou=iu=null,au=0),ju=t,Tu=e,Au=n,Ru=a,Iu=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=D.p,D.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,Es=t;null!==Es;)if(e=(t=Es).child,1024&t.subtreeFlags&&null!==e)e.return=t,Es=e;else for(;null!==Es;){switch(a=(t=Es).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,Es=e;break}Es=t.return}}(e,t)}finally{ru=l,D.p=o,N.T=r}}Mu=1,ic(),oc(),ac()}}function ic(){if(1===Mu){Mu=0;var e=Tu,t=ju,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=N.T,N.T=null;var r=D.p;D.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),v=Jn(l,g);if(y&&v&&(1!==p.rangeCount||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var x=d.createRange();x.setStart(y.node,y.offset),p.removeAllRanges(),m>g?(p.addRange(x),p.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),p.addRange(x))}}}}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,D.p=r,N.T=n}}e.current=t,Mu=2}}function oc(){if(2===Mu){Mu=0;var e=Tu,t=ju,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=N.T,N.T=null;var r=D.p;D.p=2;var i=ru;ru|=4;try{Cs(e,t.alternate,t)}finally{ru=i,D.p=r,N.T=n}}Mu=3}}function ac(){if(4===Mu||3===Mu){Mu=0,te();var e=Tu,t=ju,n=Au,r=Lu;10256&t.subtreeFlags||10256&t.flags?Mu=5:(Mu=0,ju=Tu=null,lc(e,e.pendingLanes));var i=e.pendingLanes;if(0===i&&(Cu=null),Re(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=D.p,D.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,D.p=i}}!!(3&Au)&&sc(),Cc(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=Ru;Ru=0;var n=Re(Au),r=N.T,o=D.p;try{D.p=32>n?32:n,N.T=null,n=Iu,Iu=null;var a=Tu,l=Au;if(Mu=0,ju=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{D.p=o,N.T=r,lc(e,t)}}function cc(e,t,n){t=Cr(n,t),null!==(e=ao(e,t=El(e.stateNode,t,2),2))&&(Me(e,2),Cc(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===Cu||!Cu.has(r))){e=Cr(n,e),null!==(r=ao(t,n=Cl(2),2))&&(Ml(n,r,t,e),Me(r,2),Cc(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,vu===au&&(vu=0)),Cc(e)}function hc(e,t){0===t&&(t=Ee()),null!==(e=Lr(e,t))&&(Me(e,t),Cc(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,vc,xc=null,bc=null,wc=!1,Sc=!1,kc=!1,Ec=0;function Cc(e){e!==bc&&null===e.next&&(null===bc?xc=bc=e:bc=bc.next=e),Sc=!0,wc||(wc=!0,fd(function(){6&ru?Z(ie,Tc):jc()}))}function Mc(e,t){if(!kc&&Sc){kc=!0;do{for(var n=!1,r=xc;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,Ic(r,o))}else o=au,!(3&(o=be(r,r===iu?o:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||we(r,o)||(n=!0,Ic(r,o));r=r.next}}while(n);kc=!1}}function Tc(){jc()}function jc(){Sc=wc=!1;var e=0;0!==Ec&&(function(){var e=window.event;return e&&"popstate"===e.type?e!==sd&&(sd=e,!0):(sd=null,!1)}()&&(e=Ec),Ec=0);for(var t=ne(),n=null,r=xc;null!==r;){var i=r.next,o=Ac(r,t);0===o?(r.next=null,null===n?xc=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),Re(n)){case 2:case 8:n=oe;break;case 32:default:n=ae;break;case 268435456:n=se}return r=Rc.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 Rc(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?Rc.bind(null,e):null)}function Ic(e,t){if(sc())return null;Fu(e,t,!0)}function Lc(){return 0===Ec&&(Ec=ke()),Ec}function Pc(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:Rt(""+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(vc=0;vc<Sr.length;vc++)kr((yc=Sr[vc]).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(vr,"onTransitionStart"),kr(xr,"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(" "),Dc=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Nc));function _c(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){vl(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){vl(e)}i.currentTarget=null,o=s}}}}function Fc(e,t){var n=t[De];void 0===n&&(n=t[De]=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&&(Dc.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}_t(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=vn;break;case hr:case mr:case gr:u=sn;break;case br:u=xn;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===It||!(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 v=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):(v&&v(e,s,r),"focusout"===e&&r&&"number"===s.type&&null!=r.memoizedProps.value&&xt(s,"number",s.value)),v=r?Ve(r):window,e){case"focusin":(Pn(v)||"true"===v.contentEditable)&&(ir=v,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 x;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 In?An(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Mn&&"ko"!==n.locale&&(In||"onCompositionStart"!==b?"onCompositionEnd"===b&&In&&(x=qt()):(Bt="value"in(Wt=i)?Wt.value:Wt.textContent,In=!0)),0<(v=qc(r,b)).length&&(b=new cn(b,e,null,n,i),l.push({event:b,listeners:v}),(x||null!==(x=Rn(n)))&&(b.data=x))),(x=Cn?function(e,t){switch(e){case"compositionend":return Rn(t);case"keypress":return 32!==t.which?null:(jn=!0,Tn);case"textInput":return(e=t.data)===Tn&&jn?null:e;default:return null}}(e,n):function(e,t){if(In)return"compositionend"===e||!kn&&An(e,t)?(e=qt(),Vt=Bt=Wt=null,In=!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&&(v=new cn("onBeforeInput","beforeinput",null,n,i),l.push({event:v,listeners:b}),v.data=x),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!==Ec){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)}_c(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=Rt(""+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=Rt(""+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=Rt(""+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=jt.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 vt(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 vd(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 xd=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,Ed=new Set;function Cd(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Md=D.d;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),jd("dns-prefetch",e,null)},C:function(e,t){Md.C(e,t),jd("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=Rd(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(Id(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=Rd(e);t=t||"default";var a=i.get(o);if(!a){var l={loading:0,preload:null};if(a=r.querySelector(Id(o)))l.loading=5;else{e=c({rel:"stylesheet",href:e,"data-precedence":t},n),(n=kd.get(o))&&_d(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,Dd(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 jd(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+\'"]\'),Ed.has(i)||(Ed.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)?Cd(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=Rd(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=Rd(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(Id(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 Rd(e){return\'href="\'+gt(e)+\'"\'}function Id(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),Dd(r,n.precedence,e),t.instance=r;case"stylesheet":o=Rd(n.href);var a=e.querySelector(Id(o));if(a)return t.state.loading|=4,t.instance=a,Ye(a),a;r=Ld(n),(o=kd.get(o))&&_d(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,Dd(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,Dd(r,n.precedence,e));return t.instance}function Dd(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 _d(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:_,_currentValue2:_,_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=Ce(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ce(0),this.hiddenUpdates=Ce(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=_r(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))&&(_u(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&&_u(t,0,67108864),tf(e,67108864)}}var rf=!0;function of(e,t,n,r){var i=N.T;N.T=null;var o=D.p;try{D.p=2,lf(e,t,n,r)}finally{D.p=o,N.T=i}}function af(e,t,n,r){var i=N.T;N.T=null;var o=D.p;try{D.p=8,lf(e,t,n,r)}finally{D.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<xf.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=xe(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}Cc(o),!(6&ru)&&(ku=ne()+500,Mc(0,!1))}}break;case 13:null!==(l=Lr(o,2))&&_u(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,vf=[],xf="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=D.p;try{return D.p=e,t()}finally{D.p=n}}(e.priority,function(){if(13===n.tag){var e=Nu();e=Ae(e);var t=Lr(n,e);null!==t&&_u(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);It=r,n.target.dispatchEvent(r),It=null,t.shift()}return!0}function Ef(e,t,n){kf(e)&&n.delete(t)}function Cf(){ff=!1,null!==pf&&kf(pf)&&(pf=null),null!==hf&&kf(hf)&&(hf=null),null!==mf&&kf(mf)&&(mf=null),gf.forEach(Ef),yf.forEach(Ef)}function Mf(e,n){e.blockedOn===n&&(e.blockedOn=null,ff||(ff=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Cf)))}var Tf=null;function jf(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<vf.length;n++){var r=vf[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<vf.length&&null===(n=vf[0]).blockedOn;)Sf(n),null===n.blockedOn&&vf.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||jf(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),jf(n)}}}function Rf(e){this._internalRoot=e}function If(e){this._internalRoot=e}If.prototype.render=Rf.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(i(409));Jd(t.current,Nu(),e,t,null,null)},If.prototype.unmount=Rf.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}},If.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ie();e={blockedOn:null,target:e,priority:t};for(var n=0;n<vf.length&&0!==t&&t<vf[n].priority;n++);vf.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"));D.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=xl,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 Rf(t)},e.hydrateRoot=function(e,t,n){if(!o(e))throw Error(i(299));var r=!1,a="",l=xl,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),Cc(t),e[Ne]=t.current,Hc(e),new If(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()}),v=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}),x=s((e,t)=>{t.exports=v()}),b=l(()=>{e="/__popmelt/guest"});var w,S=l(()=>{w="/popmelt/phone"});function k(e){try{let t=new URL(e),n=E.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 E,C=l(()=>{S(),b(),E=new Map}),M=u(d()),T=u(y()),j=u(d());function A(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 R=A("(any-pointer: coarse) and (not (any-pointer: fine))"),I=A("(max-width: 480px), (pointer: coarse)"),L=()=>!1,P=R.matches,z=u(d()),N=u(d()),D=u(x());function _(e,t){return(0,N.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,D.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 F=_("lucide-a-large-small",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),(0,D.jsx)("path",{d:"M15.697 14h5.606"}),(0,D.jsx)("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),(0,D.jsx)("path",{d:"M3.304 13h6.392"})]})),$=_("lucide-text-align-center lucide-align-center",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M21 5H3"}),(0,D.jsx)("path",{d:"M17 12H7"}),(0,D.jsx)("path",{d:"M19 19H5"})]})),O=_("lucide-align-center-vertical",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M12 2v20"}),(0,D.jsx)("path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4"}),(0,D.jsx)("path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4"}),(0,D.jsx)("path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1"}),(0,D.jsx)("path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1"})]})),H=_("lucide-align-end-vertical",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"16",height:"6",x:"2",y:"4",rx:"2"}),(0,D.jsx)("rect",{width:"9",height:"6",x:"9",y:"14",rx:"2"}),(0,D.jsx)("path",{d:"M22 22V2"})]})),W=_("lucide-align-horizontal-justify-center",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"6",height:"14",x:"2",y:"5",rx:"2"}),(0,D.jsx)("rect",{width:"6",height:"10",x:"16",y:"7",rx:"2"}),(0,D.jsx)("path",{d:"M12 2v20"})]})),B=_("lucide-align-horizontal-justify-end",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"6",height:"14",x:"2",y:"5",rx:"2"}),(0,D.jsx)("rect",{width:"6",height:"10",x:"12",y:"7",rx:"2"}),(0,D.jsx)("path",{d:"M22 2v20"})]})),V=_("lucide-align-horizontal-justify-start",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"6",height:"14",x:"6",y:"5",rx:"2"}),(0,D.jsx)("rect",{width:"6",height:"10",x:"16",y:"7",rx:"2"}),(0,D.jsx)("path",{d:"M2 2v20"})]})),q=_("lucide-align-horizontal-space-around",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"6",height:"10",x:"9",y:"7",rx:"2"}),(0,D.jsx)("path",{d:"M4 22V2"}),(0,D.jsx)("path",{d:"M20 22V2"})]})),Y=_("lucide-align-horizontal-space-between",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"6",height:"14",x:"3",y:"5",rx:"2"}),(0,D.jsx)("rect",{width:"6",height:"10",x:"15",y:"7",rx:"2"}),(0,D.jsx)("path",{d:"M3 2v20"}),(0,D.jsx)("path",{d:"M21 2v20"})]})),U=_("lucide-text-align-justify lucide-align-justify",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M3 5h18"}),(0,D.jsx)("path",{d:"M3 12h18"}),(0,D.jsx)("path",{d:"M3 19h18"})]})),X=_("lucide-text-align-start lucide-text lucide-align-left",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M21 5H3"}),(0,D.jsx)("path",{d:"M15 12H3"}),(0,D.jsx)("path",{d:"M17 19H3"})]})),K=_("lucide-text-align-end lucide-align-right",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M21 5H3"}),(0,D.jsx)("path",{d:"M21 12H9"}),(0,D.jsx)("path",{d:"M21 19H7"})]})),Q=_("lucide-align-start-vertical",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"9",height:"6",x:"6",y:"14",rx:"2"}),(0,D.jsx)("rect",{width:"16",height:"6",x:"6",y:"4",rx:"2"}),(0,D.jsx)("path",{d:"M2 2v20"})]})),G=_("lucide-ban",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,D.jsx)("path",{d:"M4.929 4.929 19.07 19.071"})]})),Z=_("lucide-between-horizontal-start lucide-between-horizonal-start",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"13",height:"7",x:"8",y:"3",rx:"1"}),(0,D.jsx)("path",{d:"m2 9 3 3-3 3"}),(0,D.jsx)("rect",{width:"13",height:"7",x:"8",y:"14",rx:"1"})]})),J=_("lucide-between-vertical-end",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"7",height:"13",x:"3",y:"3",rx:"1"}),(0,D.jsx)("path",{d:"m9 22 3-3 3 3"}),(0,D.jsx)("rect",{width:"7",height:"13",x:"14",y:"3",rx:"1"})]})),ee=_("lucide-blend",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("circle",{cx:"15",cy:"9",r:"7"}),(0,D.jsx)("circle",{cx:"9",cy:"15",r:"7"})]})),te=_("lucide-letter-b lucide-bold",(0,D.jsx)("path",{d:"M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8"})),ne=_("lucide-check",(0,D.jsx)("path",{d:"M20 6 9 17l-5-5"})),re=_("lucide-circle-dashed",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}),(0,D.jsx)("path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}),(0,D.jsx)("path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}),(0,D.jsx)("path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}),(0,D.jsx)("path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}),(0,D.jsx)("path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}),(0,D.jsx)("path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}),(0,D.jsx)("path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"})]})),ie=_("lucide-clock",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,D.jsx)("path",{d:"M12 6v6l4 2"})]})),oe=_("lucide-command",(0,D.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"})),ae=_("lucide-component",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}),(0,D.jsx)("path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}),(0,D.jsx)("path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}),(0,D.jsx)("path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"})]})),le=_("lucide-corner-down-left",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M20 4v7a4 4 0 0 1-4 4H4"}),(0,D.jsx)("path",{d:"m9 10-5 5 5 5"})]})),se=_("lucide-eye",(0,D.jsxs)(D.Fragment,{children:[(0,D.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,D.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})),ue=_("lucide-image",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,D.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,D.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})),ce=_("lucide-message-circle-question-mark lucide-message-circle-question",(0,D.jsxs)(D.Fragment,{children:[(0,D.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,D.jsx)("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),(0,D.jsx)("path",{d:"M12 17h.01"})]})),de=_("lucide-minimize-2",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"m14 10 7-7"}),(0,D.jsx)("path",{d:"M20 10h-6V4"}),(0,D.jsx)("path",{d:"m3 21 7-7"}),(0,D.jsx)("path",{d:"M4 14h6v6"})]})),fe=_("lucide-minus",(0,D.jsx)("path",{d:"M5 12h14"})),pe=_("lucide-move",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M12 2v20"}),(0,D.jsx)("path",{d:"m15 19-3 3-3-3"}),(0,D.jsx)("path",{d:"m19 9 3 3-3 3"}),(0,D.jsx)("path",{d:"M2 12h20"}),(0,D.jsx)("path",{d:"m5 9-3 3 3 3"}),(0,D.jsx)("path",{d:"m9 5 3-3 3 3"})]})),he=_("lucide-move-horizontal",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"m18 8 4 4-4 4"}),(0,D.jsx)("path",{d:"M2 12h20"}),(0,D.jsx)("path",{d:"m6 8-4 4 4 4"})]})),me=_("lucide-move-vertical",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M12 2v20"}),(0,D.jsx)("path",{d:"m8 18 4 4 4-4"}),(0,D.jsx)("path",{d:"m8 6 4-4 4 4"})]})),ge=_("lucide-octagon-alert lucide-alert-octagon",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M12 16h.01"}),(0,D.jsx)("path",{d:"M12 8v4"}),(0,D.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"})]})),ye=_("lucide-palette",(0,D.jsxs)(D.Fragment,{children:[(0,D.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,D.jsx)("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),(0,D.jsx)("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),(0,D.jsx)("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),(0,D.jsx)("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"})]})),ve=_("lucide-plus",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M5 12h14"}),(0,D.jsx)("path",{d:"M12 5v14"})]})),xe=_("lucide-reply",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"}),(0,D.jsx)("path",{d:"m9 17-5-5 5-5"})]})),be=_("lucide-rotate-cw",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),(0,D.jsx)("path",{d:"M21 3v5h-5"})]})),we=_("lucide-scaling",(0,D.jsxs)(D.Fragment,{children:[(0,D.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,D.jsx)("path",{d:"M14 15H9v-5"}),(0,D.jsx)("path",{d:"M16 3h5v5"}),(0,D.jsx)("path",{d:"M21 3 9 15"})]})),Se=_("lucide-send-horizontal lucide-send-horizonal",(0,D.jsxs)(D.Fragment,{children:[(0,D.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,D.jsx)("path",{d:"M6 12h16"})]})),ke=_("lucide-sliders-horizontal",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M10 5H3"}),(0,D.jsx)("path",{d:"M12 19H3"}),(0,D.jsx)("path",{d:"M14 3v4"}),(0,D.jsx)("path",{d:"M16 17v4"}),(0,D.jsx)("path",{d:"M21 12h-9"}),(0,D.jsx)("path",{d:"M21 19h-5"}),(0,D.jsx)("path",{d:"M21 5h-7"}),(0,D.jsx)("path",{d:"M8 10v4"}),(0,D.jsx)("path",{d:"M8 12H3"})]})),Ee=_("lucide-mouse-pointer-2",(0,D.jsx)("path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"})),Ce=_("lucide-stretch-horizontal",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("rect",{width:"20",height:"6",x:"2",y:"4",rx:"2"}),(0,D.jsx)("rect",{width:"20",height:"6",x:"2",y:"14",rx:"2"})]})),Me=_("lucide-triangle-alert lucide-alert-triangle",(0,D.jsxs)(D.Fragment,{children:[(0,D.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,D.jsx)("path",{d:"M12 9v4"}),(0,D.jsx)("path",{d:"M12 17h.01"})]})),Te=_("lucide-x",(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{d:"M18 6 6 18"}),(0,D.jsx)("path",{d:"m6 6 12 12"})]})),je=300,Ae={key:"z",commandOrControl:!0},Re=u(d()),Ie=u(m()),Le=u(x()),Pe=(0,Re.forwardRef)(function({style:e,...t},n){return(0,Le.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}})}),ze=new WeakMap;function Ne(e){return e.closest("[data-popmelt-tooltip-group]")??e.parentElement}function De({hint:e,above:t,anchorRef:n,hoverDelayMs:r,onReveal:i,children:o,...a}){return(0,Le.jsx)(_e,{hint:e??a["aria-label"],above:t,anchorRef:n,hoverDelayMs:r,onReveal:i,children:e=>(0,Le.jsx)("button",{type:"button",...a,"aria-describedby":e,children:o})})}function _e({hint:e,above:t,anchorRef:n,surfaceStyle:r,hoverDelayMs:i=0,onReveal:o,children:a}){let l=(0,Re.useId)(),s=(0,Re.useRef)(null),u=(0,Re.useRef)(null),c=(0,Re.useRef)(!1),d=(0,Re.useRef)(!1),f=(0,Re.useRef)(!1),p=(0,Re.useRef)(void 0);(0,Re.useEffect)(()=>()=>clearTimeout(p.current),[]);let[h,m]=(0,Re.useState)("closed"),g="entering"===h||"instant"===h,y="closed"!==h?s.current:null,v=y?.closest(\'[data-popmelt-tooltip-boundary], [data-devtools="thread-panel"]\'),x=y?.getRootNode(),b=x&&"host"in x?x:y?.ownerDocument.body;function w(t,n,r){if(!e)return;clearTimeout(p.current);let a=Ne(t),l=a&&ze.get(a),s=l&&l.tip!==u.current?l:null,c=!!(n&&s&&(i?r&&"nodeType"in r&&s.host.contains(r)&&s.openedByPointer():Number(t.ownerDocument.defaultView?.getComputedStyle(s.tip).opacity)>0)),d=()=>{s?.close(),f.current=n,m(c?"instant":"entering"),o?.()};n&&i&&!c?(f.current=!1,p.current=setTimeout(d,i)):d()}return(0,Re.useLayoutEffect)(()=>{let e=u.current,t=v?.ownerDocument.defaultView;if(!e||!v||!t)return;let n=t.getComputedStyle(v);for(let t of["--popmelt-thread-action","--popmelt-thread-on-action"])e.style.setProperty(t,n.getPropertyValue(t));void 0===r?.fontFamily&&(e.style.fontFamily=n.fontFamily),void 0===r?.letterSpacing&&(e.style.letterSpacing=n.letterSpacing)}),(0,Re.useLayoutEffect)(()=>{let e=u.current,r=y?.ownerDocument.defaultView;if(!y||!e||!r)return;let i=n?.current??y,o=r.visualViewport,a=()=>{let n=v?.getBoundingClientRect(),a=i.getBoundingClientRect(),l=new r.DOMRect(o?.offsetLeft??0,o?.offsetTop??0,o?.width??r.innerWidth,o?.height??r.innerHeight),s=l.left+8,u=l.right-8,c=l.top+8,d=l.bottom-8;e.style.maxWidth=Math.max(0,Math.min(180,u-s))+"px";let{width:f,height:p}=e.getBoundingClientRect(),h=e=>a.right<=e.left||a.left>=e.right||a.bottom<=e.top||a.top>=e.bottom;if(h(l)||n&&h(n)||f>u-s||p>d-c)return void(e.style.visibility="hidden");let m=(e,t,n)=>Math.max(t,Math.min(e,n)),g=m(a.left+(a.width-f)/2,s,u-f),y=a.top-p-4,x=a.bottom+4,b=m((t?y>=c:x+p>d)?y:x,c,d-p);e.style.left=g+"px",e.style.top=b+"px",e.style.visibility="visible"};a();let l=new r.ResizeObserver(a);l.observe(y),i!==y&&l.observe(i),l.observe(e),v&&l.observe(v);let s=y.getRootNode();return s.addEventListener("scroll",a,!0),r.addEventListener("resize",a),o?.addEventListener("resize",a),o?.addEventListener("scroll",a),()=>{l.disconnect(),s.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),o?.removeEventListener("resize",a),o?.removeEventListener("scroll",a)}},[y,n,v,t,e]),(0,Re.useLayoutEffect)(()=>{let e=y&&Ne(y),t=u.current;if(!e||!t)return;let n={tip:t,host:y,openedByPointer:()=>f.current,close:()=>m("closed")};return ze.set(e,n),()=>{ze.get(e)===n&&ze.delete(e)}},[y]),(0,Re.useLayoutEffect)(()=>{let e=u.current,t=y?.ownerDocument.defaultView;if(!e||!t)return;let n="instant"!==h&&!t.matchMedia("(prefers-reduced-motion: reduce)").matches;if(e.style.transition=n?"opacity 120ms ease-out":"none","entering"===h&&t.getComputedStyle(e).opacity,e.style.opacity=g?"1":"0",!g){if(!n)return void m("closed");let e=t.setTimeout(()=>m("closed"),120);return()=>t.clearTimeout(e)}},[y,g,h]),(0,Re.useEffect)(()=>{let e=s.current?.ownerDocument;if(!g||!e)return;let t=e=>{"Escape"===e.key&&(m("closed"),e.stopPropagation())};return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)},[g]),(0,Le.jsxs)("span",{ref:s,style:{position:"relative",display:"inline-flex",minWidth:0},onPointerEnter:e=>{"touch"!==e.pointerType&&(c.current=!0,w(e.currentTarget,!0,e.relatedTarget))},onPointerLeave:()=>{clearTimeout(p.current),c.current=!1,d.current||m(e=>"closed"===e?e:"leaving")},onFocus:e=>{d.current=e.target.matches(":focus-visible"),d.current&&w(e.currentTarget,!1)},onBlur:()=>{d.current=!1,c.current||m(e=>"closed"===e?e:"leaving")},children:[a(g&&e?l:void 0),b&&e&&(0,Ie.createPortal)((0,Le.jsx)(Pe,{ref:u,id:l,"aria-hidden":!g||void 0,style:{position:"fixed",opacity:0,visibility:"hidden",background:"var(--popmelt-thread-action, #222)",color:"var(--popmelt-thread-on-action, #eee)",whiteSpace:"normal",overflowWrap:"anywhere",zIndex:v?10006:y?.closest(\'[data-devtools="badge-hit-area"]\')?10003:20,width:"max-content",maxWidth:180,pointerEvents:"none",fontSize:12,fontWeight:500,lineHeight:1.35,padding:"5px 8px",borderRadius:8,...r},children:e}),b)]})}var Fe=\'"Popmelt Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif\',$e=\'"Popmelt Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace\',Oe=u(d());async function He(e,t){await We(`${e}/draft-attachments/${encodeURIComponent(t)}`,{method:"DELETE"},5e3)}function We(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(t,n){let r=k(t);if(!r)return n;let i=new Headers(n.headers);for(let[e,t]of Object.entries(r.headers))i.set(e,t);return{...n,headers:i,redirect:"error",credentials:r.phone?/^https:\\/\\/p-[0-9a-f]{32}\\.popmelt\\.com$/.test(location.origin)?"same-origin":"omit":r.pathPrefix===e+"/"?"same-origin":"omit"}}(t,n);if(k(t)?.phone){let e=new URL(t),n=new Headers(r.headers);return n.set("X-Popmelt-Phone-Route",e.pathname.slice(w.length)+e.search),fetch(e.origin+w,{...r,headers:n,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 Be(e,t){try{let n=await We(`${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}}C();var Ve="devtools-toolbar-theme",qe="popmelt-theme-change",Ye="popmelt-theme-project-change",Ue="(prefers-color-scheme: dark)",Xe={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 Ke(e){return"light"===e||"dark"===e?e:"auto"}function Qe(){if(typeof window>"u")return{exists:!1,preference:"auto"};let e,t=nt(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:Ke(e)};let n=window.__POPMELT_PROJECT_ID__;if(n){let e=nt(void 0),r=window.localStorage.getItem(e);if(null!==r){let i=Ke(r);window.localStorage.setItem(t,i),window.localStorage.removeItem(e);let o=rt(void 0);return null!==window.localStorage.getItem(o)&&(window.localStorage.setItem(rt(n),i),window.localStorage.removeItem(o)),{exists:!0,preference:i}}}let r=window.localStorage.getItem(Ve);if(null!==r){let e=Ke(r);return window.__POPMELT_PROJECT_ID__&&(window.localStorage.setItem(t,e),window.localStorage.removeItem(Ve)),{exists:!0,preference:e}}return{exists:!1,preference:"auto"}}function Ge(){return Qe().preference}function Ze(e,t,n){if(typeof window>"u")return;window.localStorage.setItem(nt(t),e);let r=rt(t);n?window.localStorage.setItem(r,e):window.localStorage.removeItem(r)}function Je(){return typeof window>"u"?"auto:light":`${Ge()}:${window.matchMedia(Ue).matches?"dark":"light"}`}function et(e){if(typeof window>"u")return()=>{};let t=t=>{let n=nt(window.__POPMELT_PROJECT_ID__);(t.key===n||t.key===Ve)&&e()},n=window.matchMedia(Ue),r=()=>e();return window.addEventListener("storage",t),window.addEventListener(qe,e),window.addEventListener(Ye,e),n.addEventListener("change",r),()=>{window.removeEventListener("storage",t),window.removeEventListener(qe,e),window.removeEventListener(Ye,e),n.removeEventListener("change",r)}}function tt(e){let t=(0,Oe.useSyncExternalStore)(et,Je,()=>"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,Oe.useEffect)(()=>{if(!e||!o)return;let t=!1;return(async()=>{let n=rt(o),r=window.localStorage.getItem(n);if(null!==r){let n=Ke(r),i=await Be(e,n);return void(!t&&i&&(Ze(i.preferences.theme,o,!1),window.dispatchEvent(new Event(qe))))}let i=await async function(e="http://localhost:1111"){try{let t=await We(`${e}/ui-preferences`,{},5e3);return t.ok?await t.json():null}catch{return null}}(e);if(t||!i)return;let a=Qe();if(!i.exists&&a.exists){let n=await Be(e,a.preference);return void(!t&&n&&(Ze(n.preferences.theme,o,!1),window.dispatchEvent(new Event(qe))))}Ze(i.preferences.theme,o,!1),window.dispatchEvent(new Event(qe))})(),()=>{t=!0}},[e,o]),[i,(0,Oe.useCallback)(t=>{typeof window>"u"||Ge()===t||(Ze(t,o,!(!e||!o)),window.dispatchEvent(new Event(qe)),e&&o&&Be(e,t).then(e=>{e&&(Ze(e.preferences.theme,o,!1),window.dispatchEvent(new Event(qe)))}))},[e,o]),n]}function nt(e){let t=e?.trim()||"default";return`${Ve}:${t}`}function rt(e){return`${nt(e)}:pending-sync`}u(x());var it=u(d());function ot(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 at(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 lt(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 st(e,t){let{left:n,top:r,width:i,height:o}=e,a=ot(t);for(;a;){let e=lt(a);n=e.x+n*e.sx,r=e.y+r*e.sy,i*=e.sx,o*=e.sy,a=ot(a.ownerDocument)}return new DOMRect(n,r,i,o)}function ut(e){return st(e.getBoundingClientRect(),e.ownerDocument)}function ct(e,t,n){let r=[],i=ot(n);for(;i;)r.unshift(i),i=ot(i.ownerDocument);for(let n of r){let r=lt(n);e=(e-r.x)/r.sx,t=(t-r.y)/r.sy}return{x:e,y:t}}function dt(e){return e.ownerDocument.defaultView??window}function ft(e,t=document){if(e===t)return!0;let n=ot(e);return!(!n?.isConnected||n.contentDocument!==e||!ft(n.ownerDocument,t))}function pt(e,t){if(!ft(t))return new DOMRect(0,0,0,0);let n=e.left,r=e.top,i=e.right,o=e.bottom;for(let e=ot(t);e;e=ot(e.ownerDocument)){let t=st({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 ht="@frame(";function mt(e){if(!e.startsWith(ht))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 gt=" >>> ";function yt(e){let t=[];for(let n of e.querySelectorAll("*"))n.shadowRoot&&t.push(n.shadowRoot);return t}function vt(e=document){let t=[e];for(let e of t)t.push(...yt(e));return t}function xt(e,t=document){if(e.startsWith(ht)){let n=mt(e);if(!n)return null;let r=n.selector.startsWith(ht)||n.selector.includes(gt)?[xt(n.selector,t)].filter(e=>!!e):vt(t).flatMap(e=>Array.from(e.querySelectorAll(n.selector))),i=1===r.length?r[0]:null,o=i&&at(i);return o&&o.URL===n.url?xt(n.rest,o):null}let n=e.split(gt);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(...yt(t))}return null}function bt(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return"host"in t?t.host:null}function wt(e,t){return t.startsWith(ht)||t.includes(gt)?xt(t)===e:e.matches(t)}function St(e,t){let n=e;for(;n;){let e=n.closest(t);if(e)return e;let r=n.getRootNode();n=r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in r?r.host:null}return null}function kt(e,t){let n=t;for(;n;){if(n===e)return!0;n=bt(n)}return!1}function Et(e){let t=e.getAttribute("style");return e.style.setProperty("pointer-events","auto","important"),()=>{null===t?e.removeAttribute("style"):e.setAttribute("style",t)}}function Ct(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function Mt(e,t,n,r=e=>[e],i,o){let a=[];for(let r of e.querySelectorAll("iframe")){if(!at(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&&a.push(Et(r))}try{let a=()=>{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)},l=a(),s=l;if(i){let r=function(e,t,n,r){let i=9===e.nodeType?e:e.ownerDocument,o=i.defaultView;if(!o)return;let a=e.querySelector("dialog[open]"),l=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){let i=e;if(r&&i.matches(r)||!a&&i.hasAttribute("inert"))return NodeFilter.FILTER_REJECT;let l=o.getComputedStyle(i);return"none"===l.display||!a&&"svg"===i.localName&&"hidden"===l.overflowX&&"hidden"===l.overflowY&&!Ct(i.getBoundingClientRect(),t,n)?NodeFilter.FILTER_REJECT:i.style&&"none"===l.pointerEvents&&function(e,t,n,r,i){let o=e.getBoundingClientRect();if(!o.width&&!o.height||Ct(o,t,n)||"http://www.w3.org/1999/xhtml"!==e.namespaceURI||"list-item"===i.display)return!0;for(let t of["::before","::after"]){let n=r.getComputedStyle(e,t).content;if(n&&"none"!==n&&"normal"!==n)return!0}for(let r of e.childNodes){if(r.nodeType!==Node.TEXT_NODE||!r.textContent?.trim())continue;let i=e.ownerDocument.createRange();if(i.selectNodeContents(r),!i.getBoundingClientRect||Ct(i.getBoundingClientRect(),t,n))return!0}return!1}(i,t,n,o,l)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),s=[];for(let e=l.nextNode();e;e=l.nextNode())s.push(e);if(!s.length)return;let u=[];try{for(let e of s)u.push(Et(e))}catch(e){throw u.forEach(e=>e()),e}return()=>u.forEach(e=>e())}(e,t,n,o);if(r)try{s=a()}finally{r()}s=s.filter(e=>l.includes(e)||i(e))}return s.flatMap(r)}finally{a.forEach(e=>e())}}function Tt(e,t,n=document,r,i){let o=[],a=new Set,l=9===n.nodeType?n:n.ownerDocument,s=ct(e,t,l);for(let l of vt(n).reverse())if(!(i&&"host"in l&&St(l.host,i)))for(let n of Mt(l,s.x,s.y,n=>{let o=at(n);return o?[...Tt(e,t,o,r,i),n]:[n]},r,i))a.has(n)||(a.add(n),o.push(n));return o}function jt(){return gt}function At(e){return!(!e||"http://www.w3.org/1999/xhtml"!==e.namespaceURI&&"http://www.w3.org/2000/svg"!==e.namespaceURI)}function Rt(e,t){let n=({x:e,y:n})=>{let r=st({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 It=["transition","transform","translate","rotate","scale"];function Lt(e){let[t]=e.getBoxQuads?.({box:"border"})??[];return t?{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}}:Pt(e.getBoundingClientRect())}function Pt(e){return{topLeft:{x:e.left,y:e.top},topRight:{x:e.right,y:e.top},bottomRight:{x:e.right,y:e.bottom},bottomLeft:{x:e.left,y:e.bottom}}}var zt={a:1,b:0,c:0,d:1,e:0,f:0};function Nt(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 Dt(e,t){return{...zt,e:e,f:t}}function _t(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 Ft(e,t){return{a:e,b:0,c:0,d:t,e:0,f:0}}function $t(e,t){if(!e)return 0;let n=Number.parseFloat(e);return Number.isFinite(n)?e.endsWith("%")?n/100*t:n:0}function Ot(e){if(!e)return 1;let t=Number.parseFloat(e);return Number.isFinite(t)?e.endsWith("%")?t/100:t:1}function Ht(e){if(!e||"none"===e)return zt;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 zt}function Wt(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 Bt(e){let t=getComputedStyle(e),n=t.rotate.trim().split(/\\s+/).at(-1)??"0",r=_t(Number.parseFloat(n)||0),[i="1",o=i]=t.scale.trim().split(/\\s+/);return{...Nt(r,Nt(Ft(Ot(i),Ot(o)),Ht(t.transform))),e:0,f:0}}function Vt(e){let t=zt,n=e.assignedSlot??bt(e);for(;n;)At(n)&&(t=Nt(Bt(n),t)),n=n.assignedSlot??bt(n);return t}function qt(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)}}function Yt(e){let t=Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0);if(t.length>1)return t.map(t=>{let n=Pt(t),r=Rt(n,e.ownerDocument);return an(r,Jt(Qt(e,n),n,r))}).join(" ");let n=Lt(e),r=At(e)?Zt(e,n):Gt(n),i=qt({x:0,y:0},{x:r.width,y:0},{x:0,y:r.height}),o=n;if(!e.getBoxQuads&&At(e)){let t=Nt(Vt(e),Bt(e));if(0!==t.b||0!==t.c||t.a<0||t.d<0){let i=e.currentCSSZoom||1;o=qt(ln(n),{x:t.a*r.width*i,y:t.b*r.width*i},{x:t.c*r.height*i,y:t.d*r.height*i})}}let a=Rt(o,e.ownerDocument);return an(a,Jt(Qt(e,i),i,a))}function Ut(e,t){let[n]=e.getBoxQuads?.({box:"border"})??[];if(n)return Lt(e);let r=getComputedStyle(e),{width:i,height:o}=Zt(e,t);if(i<=0||o<=0)return Lt(e);let[a="0",l="0"]=r.translate.trim().split(/\\s+/),s=Dt($t(a,i),$t(l,o)),u=r.rotate.trim().split(/\\s+/).at(-1)??"0",c=_t(Number.parseFloat(u)||0),[d="1",f=d]=r.scale.trim().split(/\\s+/),p=Ft(Ot(d),Ot(f)),h=Ht(r.transform),[m="50%",g="50%"]=r.transformOrigin.trim().split(/\\s+/),y={x:$t(m,i),y:$t(g,o)},v=Nt(Dt(y.x,y.y),Nt(c,Nt(p,Nt(h,Dt(-y.x,-y.y))))),x=Nt(s,v),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,E=e=>{let n=Wt(x,e);return{x:t.topLeft.x+b*n.x+S*n.y,y:t.topLeft.y+w*n.x+k*n.y}};return{topLeft:E({x:0,y:0}),topRight:E({x:i,y:0}),bottomRight:E({x:i,y:o}),bottomLeft:E({x:0,y:o})}}function Xt(e){let t=It.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 It)"transition"!==t&&e.style.setProperty(t,"none","important");let[t]=e.getBoxQuads?.({box:"border"})??[],n=Lt(e);return t?n:function(e,t){let{width:n,height:r}=Zt(e,t);if(n<=0||r<=0)return t;let i=Vt(e);if(0===i.b&&0===i.c&&i.a>0&&i.d>0)return t;let o=e.currentCSSZoom||1,a=Wt(i,{x:n*o,y:0}),l=Wt(i,{x:0,y:r*o});return qt(ln(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&&(e.ownerDocument.defaultView?.getComputedStyle(e).transitionProperty,n.value?e.style.setProperty(n.property,n.value,n.priority):e.style.removeProperty(n.property))}}function Kt(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 Qt(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:Kt(n.borderTopLeftRadius,r,i),topRight:Kt(n.borderTopRightRadius,r,i),bottomRight:Kt(n.borderBottomRightRadius,r,i),bottomLeft:Kt(n.borderBottomLeftRadius,r,i)}}function Gt(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 Zt(e,t){let n=Gt(t);if("offsetWidth"in e)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 Jt(e,t,n){let r=Gt(t),i=Gt(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 en(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 tn(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 nn(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 rn(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 on(e,t){let n=["topLeft","topRight","bottomRight","bottomLeft"],r=rn(t),i=nn(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=tn(l,s,c*i*o),p=tn(l,u,d*i*o);return[t,{x:f.x+p.x-l.x,y:f.y+p.y-l.y}]}))}function an(e,t){let n=.5522847498,r=["topLeft","topRight","bottomRight","bottomLeft"],i=rn(t),o=nn(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=tn(l,c,h),y=tn(l,d,m);return{entry:g,exit:y,entryControl:tn(g,l,h*n),exitControl:tn(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 ln(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 sn(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 un(e,t){let n=sn(e);return n.handle.y>=t/2?{...n,side:"top"}:{...sn(e,28,"bottom"),side:"bottom"}}function cn(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 dn=["top","right","bottom","left"];function fn(e,t,n,r={}){let i=dn.map(n=>({...sn(e,28,n),side:n,distance:cn(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 pn(e){let t=Math.max(1,Math.hypot(e.x,e.y));return{x:e.x/t,y:e.y/t}}function hn(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}}function mn(e){let t=e.match(/^\\/__popmelt\\/planes\\/app\\/[a-f0-9]{32}(?:\\/|$)/)?.[0];return t?t.replace(/\\/?$/,"/"):"/"}function gn(e){return e.slice(mn(e).length-1)||"/"}var yn=["id","data-testid","data-test","data-cy","data-popmelt-media-id","aria-label","name","href"],vn=e=>e.replace(/\\s+/g," ").trim();function xn(e){return"id"===e||"data-popmelt-media-id"===e||/^data-(?:testid|test|cy)(?:-[a-z0-9_-]+)?$/.test(e)}function bn(e,t){return!(!(t&&t.length<=200)||"id"===e&&/^(radix-|:|_r_)/.test(t))}function wn(e){let t={},n=new Set([...yn,...e.getAttributeNames().filter(xn)]);for(let r of n){let n=e.getAttribute(r);n&&bn(r,n)&&(t[r]=n)}let r=vn(e.querySelector("h1,h2,h3,h4,h5,h6")?.textContent??""),i=vn(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 Sn(e,t,n=document){let r=vt(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=wn(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=xt(r,n),i=mt(r),o=Object.entries(t?.attributes??{}).filter(([e])=>xn(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])=>xn(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 kn(e,t,n=document){let r={};if(t)for(let[e,n]of Object.entries({...t.dataAttributes,...t.id?{id:t.id}:{}}))xn(e)&&bn(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=Sn([e,t?.selector].filter(e=>!!e),o,n);return"matched"===a.status?a.element:null}var En=["data-popmelt-frame","data-popmelt-media-id","data-testid","data-test","data-cy"];function Cn(e){let t=e.getRootNode();if(!("querySelectorAll"in t))return null;let n=new Set([...En,...e.getAttributeNames().filter(e=>"id"!==e&&xn(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 Mn(e){if(ot(e.ownerDocument))return Tn(e);let t=Cn(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 Tn(e){return jn(An(e),e.ownerDocument)}function jn(e,t){let n=ot(t);if(n){(!n.id||1!==n.ownerDocument.querySelectorAll(`#${CSS.escape(n.id)}`).length)&&!Cn(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")}"]`:An(n);return function(e,t){return`${ht}${encodeURIComponent(JSON.stringify({selector:e,url:t.URL}))}) `}(ot(n.ownerDocument)?Tn(n):r,t)+e}return e}function An(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=Cn(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(jt().trim()),n=e.host;continue}}if(i){n=i;continue}let o=n.getRootNode();if(!("host"in o))break;t.unshift(jt().trim()),n=o.host}return t.join(" > ").replace(/ > >>> > /g,jt())}function Rn(e){try{return xt(e)}catch{return null}}function In(e){if(!e)return null;try{return xt(e)}catch{return null}}function Ln(e){return(e??"").replace(/\\s+/g," ").trim()}function Pn(e){let t=Ln(e.getAttribute("aria-label"));if(t)return t.slice(0,80);let n=Ln(e.getAttribute("aria-labelledby"));if(n){let e=n.split(/\\s+/).map(e=>Ln(document.getElementById(e)?.textContent)).filter(Boolean).join(" ");if(e)return e.slice(0,80)}let r=Ln(e.getAttribute("title"));return r?r.slice(0,80):Ln(e.textContent).slice(0,80)}function zn(e){if(e instanceof HTMLDetailsElement){let t=Array.from(e.children).find(e=>"summary"===e.tagName.toLowerCase());if(!t)return null;let n=Pn(t);return n?{triggerSelector:Tn(t),targetSelector:Tn(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=Pn(t);return n?{triggerSelector:Tn(t),targetSelector:Tn(e),label:n}:null}function Nn(e){let t=[],n=new Set,r=bt(e);for(;r&&r!==document.body&&r!==document.documentElement;){let e=zn(r);e&&!n.has(e.triggerSelector)&&(n.add(e.triggerSelector),t.push(e)),r=bt(r)}if(0===t.length)return;let i=t.reverse();return{steps:i,location:i.map(e=>e.label)}}function Dn(e){let t=e?.[0]?.revealRecipe;if(t?.steps.length)return t;let n=In(e?.[0]?.selector);return n?Nn(n):void 0}function _n(e){let t=Dn(e)?.location.filter(Boolean);return t?.length?`Inside: ${t.join(" › ")}`:null}function Fn(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 $n(e,t,n){return"true"===t.getAttribute("aria-expanded")||"open"===t.getAttribute("data-state")||(n instanceof HTMLDetailsElement?n.open:Fn(n))}function On(e,t=900){return e?new Promise(n=>{let r=performance.now(),i=()=>{let o=In(e);Fn(o)?n(o):performance.now()-r>=t?n(null):requestAnimationFrame(i)};i()}):Promise.resolve(null)}function Hn(e){let t={targetFingerprint:wn(e),selector:Mn(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=ot(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=ot(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=bt(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 ot(t.ownerDocument)?Mn(t):`${e}#${t.id}`;if(t.id&&!t.id.startsWith("radix-")&&!t.id.startsWith(":"))return ot(t.ownerDocument)?Mn(t):`${e}#${t.id}`;t=bt(t)}return null}(e);s&&(t.context=s);let u=Nn(e);return u&&(t.revealRecipe=u),t}var Wn=new WeakMap;function Bn(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 Wn.get(o)?.(t,n)??r??o;if(Qn(o,t,n,!1,!0))return r??o}return r??e[0]}}function Vn(e,t,n){let r=Kn(e,t,n),i=Bn(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=>Qn(n,e,t)))??null}function qn(e,t,n){if("function"!=typeof document.elementsFromPoint)return!0;for(let r of Kn(t,n)){if(r===e||e.contains(r))return Qn(r,t,n);if(Qn(r,t,n))return!1}return!1}var Yn="[data-popmelt-canvas-block]";function Un(e,t){let n=Tt(e,t).find(e=>"devtools-canvas"!==e.id&&"devtools-scrim"!==e.id);return!(!n||!St(n,Yn))}function Xn(e){return"http://www.w3.org/2000/svg"===e.namespaceURI?e.closest("svg")??e:e}function Kn(e,t,n){let r=n?.within;if(!r&&Un(e,t))return[];let i=new Set,o=Tt(e,t,r?.ownerDocument??document,n=>{if(r&&!r.contains(n))return!1;let i=St(n,"[data-devtools], [data-popmelt-root], [data-popmelt-shadow-host], [data-popmelt-canvas-block]");return(!i||!!r&&i.contains(r))&&Qn(n,e,t,!1)},r?void 0:"[data-devtools], [data-popmelt-canvas-block]"),a=o.map(Xn).filter(e=>{if(i.has(e))return!1;if(i.add(e),r){if(e===r||!r.contains(e))return!1;let t=St(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||St(e,"#devtools-toolbar")||e.hasAttribute("data-devtools")||St(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 Qn(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=bt(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=ct(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=ut(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}function Gn(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 Zn(e){return`[data-popmelt-subject-adapter="${Gn(e.adapter)}"][data-popmelt-subject-key="${Gn(e.key)}"]`}function Jn(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 er(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 tr=class{constructor(e){this.adapters=e,this.appliedCanvases=new Map,this.textPreviews=new Map,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]:[]})}hasLabelActions(e){let t=this.adapters.find(t=>t.id===e.adapter);return!(!t?.renameSubject&&!t?.removeSubject)}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,qn(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={...Hn(r.sourceElement),selector:Tn(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)}sampleableObject(e){let t=Jn(e);if(!t)return null;let n=this.resolve(t),r=n?.adapter.sampleCanvas;return n?.element===e&&r?.objects&&n.subject.sourceElement===r.element?{projection:n,surface:r,objects:r.objects}:null}placementSurface(e,t){let n=this.adapters.flatMap(({id:n,sampleCanvas:r})=>r?.element===e&&r.format===t&&r.objects?.placement?[{surface:r,adapter:n}]:[]);return 1===n.length?n[0]:void 0}sampleableCanvases(e,t=!1){return this.adapters.flatMap(({sampleCanvas:n})=>n&&(t||!n.placementOnly)&&kt(e,n.element)?[n]:[])}editableTextAtPoint(e){let t=this.hitTest(e);if(!t)return null;let{adapter:n,subject:r,element:i,selector:o}=t,a=n.getEditableText?.(r.key);if(!a)return null;let l=this.textPreviews.get(o)?.value??a.value,s=i.firstChild,u=s?.nodeType===Node.TEXT_NODE?s:i.appendChild(i.ownerDocument.createTextNode(l));return u.data!==l&&(u.data=l),i.style.font=a.font??`normal ${Math.max(12,r.bounds.height)}px sans-serif`,i.style.whiteSpace="pre",{projected:t,node:u,beginEdit:a.beginEdit,sourceEditor:a.sourceEditor}}applyTextPreviews(e=[]){let t=new Set;for(let n of e){if(!n.target||n.captured)continue;let{adapter:e,key:r}=n.target,i=this.adapters.find(t=>t.id===e)?.getEditableText?.(r);if(!i||i.value!==n.original)continue;let o=Zn(n.target);t.add(o),this.textPreviews.get(o)?.value!==n.modified&&(i.preview(n.modified),this.textPreviews.set(o,{value:n.modified,clear:()=>i.preview(null)}))}for(let[e,n]of this.textPreviews)t.has(e)||(n.clear(),this.textPreviews.delete(e))}applyCanvasSamples(e=[]){for(let{id:t,sampleCanvas:n}of this.adapters){if(!n)continue;let r=n.element.ownerDocument,i=e.filter(e=>{if(e.pathname!==r.location?.pathname||e.format!==n.format||n.placementOnly&&!e.subject?.inserted||e.subject&&(e.subject.adapter!==t||Zn(e.subject)!==e.selector))return!1;let i=Sn([e.subject?.canvasSelector??e.selector],void 0,r);return"matched"===i.status&&i.element===n.element}),o=this.appliedCanvases.get(n);if(!i.length&&!o)continue;let a=o?.original??n.read(),l=i.find(e=>!e.subject),s=l&&n.accepts(l.value)?l.value:null;for(let e of i){if(!e.subject||!n.objects)continue;let t=s??a,r=e.subject.inserted?n.objects.placement?.insert(t,e.subject.key,e.value):n.objects.replace(t,e.subject.key,e.value);null!=r&&n.accepts(r)&&(s=r)}if(null!==s){if(o?.applied===s)continue;n.write(s),this.appliedCanvases.set(n,{original:a,applied:n.read()})}else o&&(n.read()===o.applied&&n.write(o.original),this.appliedCanvases.delete(n))}}viewKeys(){return this.adapters.flatMap(e=>e.getViewKey?[e.id+":"+e.getViewKey()]:[])}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(){this.applyTextPreviews(),this.applyCanvasSamples(),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),er(i.element,t),i;let o=Zn(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"}),er(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:e.getEditableText?.(t.key)?.value??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=er(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()}))}},nr=("display color background-color font-family font-size font-style font-weight line-height letter-spacing text-align text-decoration-line white-space flex-direction flex-wrap flex-grow align-items justify-content row-gap column-gap "+["top","right","bottom","left"].flatMap(e=>["padding-"+e,"margin-"+e,"border-"+e+"-style","border-"+e+"-color","border-"+e+"-width"]).join(" ")+" border-top-left-radius border-top-right-radius border-bottom-left-radius border-bottom-right-radius").split(" "),rr={"aspect-ratio":"auto","box-sizing":"content-box",width:"auto",height:"auto","max-width":"none","max-height":"none",transform:"none","transform-origin":"50% 50%",translate:"none",rotate:"none",scale:"none","z-index":"auto",visibility:"visible","min-height":"auto","min-width":"auto","box-shadow":"none","text-shadow":"none","text-transform":"none","word-spacing":"0px","overflow-wrap":"normal","word-break":"normal",direction:"ltr","writing-mode":"horizontal-tb","vertical-align":"baseline",opacity:"1","align-self":"auto","justify-self":"auto","align-content":"normal","justify-items":"normal","flex-shrink":"1","flex-basis":"auto",order:"0","grid-template-columns":"none","grid-template-rows":"none","grid-auto-flow":"row","grid-column-start":"auto","grid-column-end":"auto","grid-row-start":"auto","grid-row-end":"auto","overflow-x":"visible","overflow-y":"visible"},ir=["top","right","bottom","left"],or=["width","height","max-width","max-height","object-fit","object-position"],ar=["background-size","background-position","background-repeat","background-origin","background-clip"],lr=new Set([...[...nr,...Object.keys(rr),...ir,...ar,...or].map(e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())),"borderColor","borderRadius","fill","stroke","strokeWidth","strokeDasharray","strokeDashoffset"]),sr=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function ur(e){let t=typeof TextEncoder<"u"?Array.from((new TextEncoder).encode(e)):function(e){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):t.push(224|r>>12,128|r>>6&63,128|63&r)}return t}(e),n=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(let e=7;e>=0;e--)t.push(n/Math.pow(2,8*e)&255);let r=1779033703,i=3144134277,o=1013904242,a=2773480762,l=1359893119,s=2600822924,u=528734635,c=1541459225,d=new Array(64);for(let e=0;e<t.length;e+=64){for(let n=0;n<16;n++){let r=e+4*n;d[n]=(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3])>>>0}for(let e=16;e<64;e++){let t=cr(d[e-15],7)^cr(d[e-15],18)^d[e-15]>>>3,n=cr(d[e-2],17)^cr(d[e-2],19)^d[e-2]>>>10;d[e]=d[e-16]+t+d[e-7]+n>>>0}let n=r,f=i,p=o,h=a,m=l,g=s,y=u,v=c;for(let e=0;e<64;e++){let t=v+(cr(m,6)^cr(m,11)^cr(m,25))+(m&g^~m&y)+sr[e]+d[e]>>>0,r=n&f^n&p^f&p;v=y,y=g,g=m,m=h+t>>>0,h=p,p=f,f=n,n=t+((cr(n,2)^cr(n,13)^cr(n,22))+r>>>0)>>>0}r=r+n>>>0,i=i+f>>>0,o=o+p>>>0,a=a+h>>>0,l=l+m>>>0,s=s+g>>>0,u=u+y>>>0,c=c+v>>>0}return[r,i,o,a,l,s,u,c].map(e=>e.toString(16).padStart(8,"0")).join("")}function cr(e,t){return e>>>t|e<<32-t}var dr=/^[a-f0-9]{64}$/,fr=/^[a-zA-Z0-9 _-]{0,64}$/,pr=3145728,hr=new Map,mr=new Map,gr=new Map;function yr(e,t){return new URL(mn(e.location.pathname)+"_popmelt/samples/"+t+".json",e.location.origin).href}function vr(e){let t=e.getAttribute("data-popmelt-sample-version");if(null===t)return;let n={version:t,variant:e.getAttribute("data-popmelt-sample-variant")??"",props:e.getAttribute("data-popmelt-sample-props")??void 0,dark:!!e.closest(".dark")||"dark"===e.ownerDocument.defaultView?.getComputedStyle(e).colorScheme,label:(e.getAttribute("aria-label")??"").slice(0,256)};if(!function(e){return e&&"string"==typeof e.version&&dr.test(e.version)&&"string"==typeof e.variant&&fr.test(e.variant)&&function(e){if(void 0===e)return!0;if("string"!=typeof e||e.length>8192)return!1;try{let t=JSON.parse(e);return null!==t&&"object"==typeof t&&!Array.isArray(t)}catch{return!1}}(e.props)&&(void 0===e.label||"string"==typeof e.label&&e.label.length<=256)&&"boolean"==typeof e.dark}(n))throw Error("This component has no valid sample revision.");if(!hr.has(t)){let n=yr(e.ownerDocument,t);throw(gr.get(n)??0)>Date.now()?Error("The sampled revision is unavailable."):(mr.has(n)||async function(e,t){let n=hr.get(t);if(n)return n;let r=yr(e,t),i=mr.get(r);if(i)return i;let o=(async()=>{let n=new URL("/_popmelt/samples/"+t+".json",e.location.origin).href,i=await(globalThis.caches?.open("popmelt-component-samples-v1").catch(()=>{})),o=await(i?.match(n)),a=o??await fetch(r,{redirect:"error"});if(!a.ok||Number(a.headers.get("content-length"))>pr)throw Error();let l=a.body?.getReader();if(!l)throw Error();let s=0,u="",c=new TextDecoder("utf-8",{fatal:!0});for(;;){let{done:e,value:t}=await l.read();if(e)break;if(s+=t.length,s>pr)throw await l.cancel(),Error();u+=c.decode(t,{stream:!0})}if(u+=c.decode(),(globalThis.crypto?.subtle?Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(u))),e=>e.toString(16).padStart(2,"0")).join(""):ur(u))!==t)throw Error();let d=JSON.parse(u);if("string"!=typeof d.script||"string"!=typeof d.css)throw Error();return o||await(i?.put(n,new Response(u)).catch(()=>{})),hr.size>=8&&hr.delete(hr.keys().next().value),hr.set(t,d),gr.delete(r),d})().finally(()=>mr.delete(r));return mr.set(r,o),o}(e.ownerDocument,t).catch(()=>gr.set(n,Date.now()+5e3)).finally(()=>{e.ownerDocument.dispatchEvent(new Event("popmelt-sample-ready"))}),Error("Loading this component for sampling."))}return n}function xr(e){return"string"==typeof e&&e.length<=384&&!/[;{}\\\\]|(?:url|var|attr|env)\\s*\\(/i.test(e)}var br=new WeakMap;function wr(e){let t=e.currentSrc||e.src;if(!e.complete||!e.naturalWidth||!e.naturalHeight)throw new Error("The image has not loaded.");let n=br.get(e);if(n?.src===t)return n.pixels;let r=e.ownerDocument.createElement("canvas"),i=Math.min(1,1024/Math.max(e.naturalWidth,e.naturalHeight));for(;;){r.width=Math.max(1,Math.round(e.naturalWidth*i)),r.height=Math.max(1,Math.round(e.naturalHeight*i));let n,o=r.getContext("2d");if(!o)throw new Error("The browser cannot capture this image.");o.drawImage(e,0,0,r.width,r.height);try{n=r.width*r.height<=65536?r.toDataURL("image/png"):"",(!n||n.length>24576)&&(n=r.toDataURL("image/webp",.9))}catch{throw new Error("The image host does not allow its pixels to be copied.")}if(Sr(n))return br.set(e,{src:t,pixels:n}),e.addEventListener("load",()=>br.delete(e),{once:!0}),n;if(1===r.width&&1===r.height)throw new Error("The browser cannot capture this image.");i/=2}}function Sr(e){return"string"==typeof e&&e.length<=24576&&/^data:image\\/(?:png|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(e)}var kr=new WeakMap,Er="http://www.w3.org/2000/svg",Cr=new Set("svg g path rect circle ellipse line polygon polyline defs linearGradient radialGradient stop clipPath title desc".split(" ")),Mr=new Set("viewBox preserveAspectRatio x y width height cx cy r rx ry x1 x2 y1 y2 d points transform pathLength gradientUnits gradientTransform spreadMethod offset fx fy fr clipPathUnits".split(" ")),Tr=new Set("fill stroke stop-color".split(" ")),jr="fill fill-opacity fill-rule stroke stroke-width stroke-opacity stroke-linecap stroke-linejoin stroke-miterlimit stroke-dasharray stroke-dashoffset clip-rule clip-path vector-effect opacity stop-color stop-opacity display visibility".split(" "),Ar=/^url\\(["\']?#([\\w.:-]+)["\']?\\)$/,Rr=/^[\\w.:-]{1,128}$/;function Ir(e,t){return"id"===e?Rr.test(t):"aria-label"===e?t.length<=512:"aria-hidden"===e?"true"===t||"false"===t:Mr.has(e)?/^[\\w\\s.%+,()-]*$/.test(t):Ar.test(t)?Tr.has(e)||"clip-path"===e:"clip-path"===e?"none"===t:Tr.has(e)?/^(?:[a-z]+|#[a-f\\d]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\\([a-z\\d.\\s,%/+-]+\\))$/i.test(t):jr.includes(e)&&/^[a-z\\d.\\s,%+-]+$/i.test(t)}var Lr=class{constructor(){this.ids=new Set,this.references=new Set,this.prefix="pm-svg-"+crypto.randomUUID()+"-"}value(e,t){if("id"===e)return this.ids.has(t)?null:(this.ids.add(t),this.prefix+t);let n=Ar.exec(t)?.[1];return n?(this.references.add(n),"url(#"+this.prefix+n+")"):t}complete(){return[...this.references].every(e=>this.ids.has(e))}},Pr=new Set("article section aside header footer div span h1 h2 h3 h4 h5 h6 p strong em b i small blockquote ul ol li button br picture img figure figcaption code pre".split(" ")),zr={color:"color",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",letterSpacing:"letter-spacing",visibility:"visibility",fill:"fill",stroke:"stroke",strokeWidth:"stroke-width",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset"},Nr=new Set(["div","article","section","aside","figure"]),Dr=new Set(["width","height","max-width","max-height","min-width","min-height","transform","transform-origin","grid-template-columns","grid-template-rows",...ir]);function _r(e,t){let n=e.getBoundingClientRect(),r=(e,r)=>{let i=t.getPropertyValue(e);return i.endsWith("px")?parseFloat(i)+("border-box"===t.boxSizing?0:r.reduce((e,n)=>e+(parseFloat(t.getPropertyValue("padding-"+n))||0)+(parseFloat(t.getPropertyValue("border-"+n+"-width"))||0),0)):n[e]};return{previewWidth:r("width",["left","right"]),previewHeight:r("height",["top","bottom"])}}function Fr(e){let t=e.ownerDocument.defaultView,n=0,r=function e(r,i,o,a){if(!t)throw new Error("The source page is no longer available.");if(i>16||++n>256)throw new Error("This subtree is too large to place in one draft.");let l=o?void 0:vr(r),s=o??(l||r.namespaceURI!==Er||"svg"!==r.localName?void 0:new Lr);if(s?r.namespaceURI!==Er||!Cr.has(r.localName):!function(e){return e.hasAttribute("data-popmelt-sample-version")||("http://www.w3.org/1999/xhtml"===e.namespaceURI&&Pr.has(e.localName)||e.namespaceURI===Er&&"svg"===e.localName)&&!e.shadowRoot}(r))throw new Error(`<${r.localName}> content cannot be placed as an HTML draft.`);let u=t.getComputedStyle(r),c=r.computedStyleMap?.(),d=e=>c?.get(e)?.toString()||u.getPropertyValue(e),f=o?{}:Object.fromEntries(nr.map(e=>[e,u.getPropertyValue(e)]).filter(([,e])=>!!e));for(let[e,t]of Object.entries(o?{}:rr)){let n=Dr.has(e)?d(e):u.getPropertyValue(e);n&&n!==t&&(f[e]=n)}let p,h=o?void 0:function(e,t){let n=/^url\\("(data:image\\/[^"]+)"\\)$/.exec(t)?.[1];if(!n)return;if(Sr(n))return n;let r=kr.get(e);if(r?.src===n){if(r.pixels)return r.pixels;if(r.failed)throw Error("This background image could not be sampled.")}else{let t={src:n};kr.set(e,t);let r=e.ownerDocument.createElement("img");r.src=n,r.decode().then(()=>{t.pixels=wr(r)}).catch(()=>{t.failed=!0}).finally(()=>e.ownerDocument.dispatchEvent(new Event("popmelt-sample-ready")))}throw Error("Loading this image for sampling.")}(r,u.backgroundImage);if(h)for(let e of ar)f[e]=u.getPropertyValue(e);if(s&&(p=function(e,t,n){let r={};for(let t of e.attributes){let{name:e,value:n}=t;if("href"===e||"href"===t.localName)throw new Error("This SVG references other artwork.");(Mr.has(e)||"id"===e||"aria-label"===e||"aria-hidden"===e)&&(r[e]=n)}for(let n of["filter","mask-image","marker-start","marker-mid","marker-end"]){let r=t.getPropertyValue(n)||e.getAttribute(n);if(r&&"none"!==r)throw new Error("This SVG uses an unsupported effect.")}if("rect"===e.localName||"svg"===e.localName)for(let n of["width","height"]){let i=e.computedStyleMap?.().get(n)?.toString()||t.getPropertyValue(n);i&&"auto"!==i&&(r[n]=i)}for(let n of jr){let i=t.getPropertyValue(n)||e.getAttribute(n);i&&(r[n]=i)}for(let[e,t]of Object.entries(r))if(!Ir(e,t)||null===n.value(e,t))throw new Error("This SVG uses an unsupported paint or shape.");return r}(r,u,s)),!l&&"img"===r.localName){let e=r;p={src:wr(e),alt:e.alt}}if(!l&&!o&&("img"===r.localName||s))for(let e of or){let t=u.getPropertyValue(e);t&&(!Dr.has(e)||"img"===r.localName&&"auto"===d(e))&&(f[e]=t)}if(!o&&("relative"===u.position||i>0&&"absolute"===u.position)){f.position=u.position;for(let e of ir){let t=d(e);t&&"auto"!==t&&(f[e]=t)}"absolute"===f.position&&u.clip&&"auto"!==u.clip&&(f.clip=u.clip)}if(l)return{tag:Nr.has(r.localName)?r.localName:"div",style:f,children:[],component:l,backgroundStill:h,..._r(r,u)};let m=function(e){let t=[];for(let n of e.getAnimations?.()??[]){if(!("animationName"in n)&&"popmelt-sampled-motion"!==n.id)continue;let r=n.effect;if(r?.target!==e||r.pseudoElement||"finished"===n.playState)continue;let i=r.getTiming(),o=r.getKeyframes().map(e=>{let t={offset:e.computedOffset,easing:e.easing??"linear"};for(let[n,r]of Object.entries(e))lr.has(n)&&xr(r)&&(t[n]=r);return t});o.some(e=>Object.keys(e).length>2)&&t.push({frames:o,currentTime:"number"==typeof n.currentTime?n.currentTime:void 0,paused:"paused"===n.playState,timing:{duration:Number(i.duration),delay:i.delay??0,endDelay:i.endDelay??0,iterations:i.iterations===1/0?"infinite":i.iterations??1,direction:i.direction??"normal",fill:i.fill??"none",easing:i.easing??"linear"}})}if(t.length){if(!function(e){return Array.isArray(e)&&e.length<=8&&e.every(e=>{let t=e?.timing;return!!(!(!t||"boolean"!=typeof e.paused||void 0!==e.currentTime&&!Number.isFinite(e.currentTime)||!Array.isArray(e.frames)||!e.frames.length||e.frames.length>64||!Number.isFinite(t.duration)||t.duration<0)&&Number.isFinite(t.delay)&&Number.isFinite(t.endDelay)&&("infinite"===t.iterations||Number.isFinite(t.iterations)&&t.iterations>=0)&&["normal","reverse","alternate","alternate-reverse"].includes(t.direction)&&["auto","none","forwards","backwards","both"].includes(t.fill)&&xr(t.easing))&&e.frames.every((t,n)=>t&&Number.isFinite(t.offset)&&t.offset>=(e.frames[n-1]?.offset??0)&&t.offset<=1&&xr(t.easing)&&Object.entries(t).every(([e,t])=>"offset"===e||"easing"===e||lr.has(e)&&xr(t)))})}(t))throw Error("This animation is too complex to sample.");return t}}(r),g=new Set;if(a)for(let e of a.properties){let t=u.getPropertyValue(e),n=r.style.getPropertyValue(e)||(s?r.getAttribute(e):null);t!==a.css.getPropertyValue(e)||n&&"inherit"!==n?t&&Object.hasOwn(rr,e)&&(f[e]=t):(g.add(e),e in f&&(f[e]="inherit"),p&&e in p&&(p[e]="inherit"))}for(let e of m??[])for(let t of e.frames)for(let e of Object.keys(t)){let t=zr[e];t&&g.add(t)}let y=g.size?{css:u,properties:g}:void 0,v=[];for(let t of r.childNodes){if(3===t.nodeType&&t.textContent&&v.push(t.textContent),1!==t.nodeType)continue;let n=t;n.matches("[data-devtools],[data-popmelt-root],[data-popmelt-shadow-host]")||"picture"===r.localName&&"source"===n.localName||v.push(e(n,i+1,s,y))}if(s&&!o&&!s.complete())throw new Error("This SVG references artwork outside the sample.");return o?{tag:r.localName,style:f,children:v,attributes:p,motion:m}:{tag:r.localName,motion:m,backgroundStill:h,attributes:p,style:f,children:v,..."img"===r.localName&&{imageSourceHash:$r(r)},...0===i?_r(r,u):{}}}(e,0);if(JSON.stringify(r).length>65536)throw new Error("This subtree is too large to place in one draft.");return r}function $r(e){let t=e.getAttribute("src")||e.getAttribute("srcset");return t?ur(t):void 0}new Set("main article section aside div ul ol body header footer nav".split(" "));var Or=u(d()),Hr=u(d()),Wr=[4,2],Br=Wr.join(" "),Vr=Wr[0]+Wr[1],qr=u(d()),Yr=u(d()),Ur=(0,u(d()).createContext)(null);function Xr(e=22){return{height:e,minHeight:e,maxHeight:e,boxSizing:"border-box",flexShrink:0}}var Kr=u(x());function Qr({threadId:e,color:t,size:n}){let r=(0,Yr.useContext)(Ur);if(!e||r?.preview?.threadId!==e)return null;let i=r.preview.enabled;return(0,Kr.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:{...Xr(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,Kr.jsx)(se,{size:12,strokeWidth:2.25})})}function Gr(e,t){let n=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","svg"),{x:r,y:i,width:o,height:a}=ut(e);return n.setAttribute("viewBox",[r,i,o,a].join(" ")),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("aria-hidden","true"),n.setAttribute("data-devtools",t),n.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none",n}function Zr(e,t,n,r,i){if(!e.closest("[data-popmelt-hover-painter]"))return;let o=new AbortController,a=new CustomEvent("popmelt:paint-annotation",{bubbles:!0,cancelable:!0,detail:{signal:o.signal,setHitArea:i,createOverlay(e,i){let o=Gr(i,"painted-annotation"),a=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",Yt(e)),a.setAttribute("fill",n?t:"none"),a.setAttribute("fill-opacity",String(n)),a.setAttribute("stroke",t),a.setAttribute("stroke-width",String(1)),a.setAttribute("vector-effect","non-scaling-stroke"),a.setAttribute("stroke-linejoin","round"),"solid"!==r&&a.setAttribute("stroke-dasharray",Br),"marching"===r&&a.setAttribute("data-popmelt-marching-stroke","true"),o.append(a),o}}});if(!e.dispatchEvent(a))return o;o.abort()}var Jr=u(d()),ei=new WeakMap,ti=0,ni="popmelt-scroll-anchor",ri="popmelt-page-paint";function ii(e){if(!(e instanceof HTMLElement&&e.getRootNode()===document&&globalThis.CSS?.supports?.("top","anchor(top)")))return;let t=ei.get(e);if(!t){let n=getComputedStyle(e).getPropertyValue("anchor-name");if(n&&"none"!==n)return;let r="--popmelt-target-"+ ++ti;t={name:r,users:0,previous:e.style.getPropertyValue("anchor-name"),priority:e.style.getPropertyPriority("anchor-name")},ei.set(e,t),e.style.setProperty("anchor-name",r)}let n=t;return n.users++,{name:n.name,element:e,release(){--n.users||(ei.delete(e),e.style.getPropertyValue("anchor-name")===n.name&&e.style.setProperty("anchor-name",n.previous,n.priority))}}}function oi(e){let[t,n]=(0,Jr.useState)();return(0,Jr.useLayoutEffect)(()=>{let t=ii(e);return n(t),t?.release},[e]),t&&t.element===e?t.name:void 0}function ai(e,t,n,r){return e?{"--popmelt-anchor":e,positionAnchor:e,left:`calc(anchor(left, ${t.left}px) + ${n-t.left}px)`,top:`calc(anchor(top, ${t.top}px) + ${r-t.top}px)`}:{left:n,top:r}}var li=(0,u(d()).createContext)(!0);function si(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 ui(e){return si(e).map(e=>`${e}px`).join(" ")}var ci=1.1666666666666667;function di(e){return e.length>2048?`${e.slice(0,2048)}…`:e}var fi=$e;function pi(e){let t=window.innerWidth-e-16;return Math.max(60,Math.min(400,t))}function hi(e,t,n){let r=di(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 mi(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 gi(e,t=12,n,r){let i=t*ci+8,o=e.y-4,a=mi(o,i,n,e.x-8,r);return a===o?e:{...e,y:a+4}}var yi,vi=new Set;function xi(e){if(vi.add(e),!yi){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=at(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])=>at(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 vi)e();o=!0,a&&(l=requestAnimationFrame(u))};u(),yi=()=>{a=!1,cancelAnimationFrame(l);for(let t of e.values())t()}}return()=>{vi.delete(e),vi.size||(yi?.(),yi=void 0)}}function bi(e){let t=window.getComputedStyle(e).display;return"flex"===t||"inline-flex"===t||"grid"===t||"inline-grid"===t}function wi(e){let t=window.getComputedStyle(e);return{row:parseFloat(t.rowGap)||0,column:parseFloat(t.columnGap)||0}}function Si(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 ki(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 Ei(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 Ci(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 Mi(e){let t=window.getComputedStyle(e);return{topLeft:t.borderTopLeftRadius,topRight:t.borderTopRightRadius,bottomRight:t.borderBottomRightRadius,bottomLeft:t.borderBottomLeftRadius}}function Ti(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 ji(e){for(let t of e.childNodes)if(t.nodeType===Node.TEXT_NODE&&(t.textContent||"").trim().length>0)return!0;return!1}function Ai(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 Ri(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 Ii(e){return e.left+e.width}function Li(e){return e.top+e.height}function Pi(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(Ii))-n,height:Math.max(...e.map(Li))-r}}function zi(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(Ii(r),Ii(e)),l=Math.max(Li(r),Li(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 Ni(e){return!!e&&!!e.closest("#devtools-toolbar, #devtools-scrim, #devtools-text-input, [data-devtools], [data-popmelt-panel], [data-popmelt-shadow-host]")}function Di(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 _i(e,t){let n=$i(e),r=n.find(e=>e.textNode===t)??n[0];if(!r)return null;let i=dt(e).getComputedStyle(e),{textRect:o,...a}=Wi(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 Fi(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 $i(e){let t=[],n=r=>{if(r.nodeType===Node.TEXT_NODE){let n=r,i=Fi(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 Oi(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}function Hi(e){let t=e.getBoundingClientRect(),n=dt(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 st({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 Wi(e,t,n,r=!1){let i=Oi(ut(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=>Oi(st(e,n.textNode.ownerDocument)))),e.detach?.()}return zi(t)}(e),a=e[0]?.textNode?function(e,t){let n=e.ownerDocument.createRange();n.selectNodeContents(e);let r=st(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=ut(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=zi(n),a=Pi(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,Li(a)-l.top)},u=Math.max(0,Math.min(s.width,l.left-s.left));return{textRect:a,boundaryRect:Pi(o,r),boundaryRects:o,flowRect:s,firstLineIndent:u}}({display:n.display,singleTextNode:r,fragmentRects:l,elementRect:i,parentContentRect:t.parentElement?Hi(t.parentElement):void 0})}function Bi(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 Vi(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 qi=new WeakMap;function Yi(e){let t=e.closest("p");return t?qi.get(t):void 0}function Ui(e){let t=$i(e);return{root:e,rows:[e],runs:t.map(e=>[e.textNode]),paths:t.map(e=>e.textNodePath),undo:[]}}function Xi(e){let t=qi.get(e)??Ui(e),n=t.runs.map((e,n)=>({path:t.paths[n],parts:e.map(e=>e.data)}));return{group:t,layout:n}}function Ki(e,t,n){let r=t.splitText(n),i=r,o=t.parentElement;for(;;){let n=o,r=o.cloneNode(!1);for(r.removeAttribute("id"),r.removeAttribute("data-pm");i.nextSibling;)r.appendChild(i.nextSibling);if(r.insertBefore(i,r.firstChild),n.after(r),e.undo.push(e=>{if(!e?.has(n)||n.contains(t))for(;r.firstChild;)n.appendChild(r.firstChild);r.remove()}),"P"===o.tagName){r.dataset.popmeltParagraphContinuation="",e.rows.splice(e.rows.indexOf(n)+1,0,r),qi.set(r,e);break}i=r,o=n.parentElement}return r}function Qi(e,t){let n=qi.get(e);if(n&&n.root===e){for(let e of n.rows)e.querySelector("br[data-popmelt-empty-paragraph]")?.remove(),qi.delete(e);for(let e of n.undo.reverse())e(t)}}function Gi(e,t){if("P"!==e.tagName)return;let n=qi.get(e);if((!n||n.root===e)&&(n&&!n.runs.every((e,n)=>e.length===t[n]?.parts.length)&&(Qi(e),n=void 0),n??=Ui(e),n.paths.length===t.length&&t.every((e,t)=>e.parts.length&&e.path.join(".")===n.paths[t].join(".")))){if(!qi.has(e)){qi.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(e=>{e?.has(i)||(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(Ki(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.lastLayout=t,n}}var Zi=new WeakMap,Ji=new WeakMap;function eo(e,t){return At(e)&&(Zi.get(e)?.has(t)??!1)}function to(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 no(e){return e.changes.map((e,t)=>({change:e,index:t})).sort((e,t)=>to(e.change)-to(t.change)||e.index-t.index).map(({change:e})=>e)}function ro(e,t,n){if(At(e)){let r=Ji.get(e);r||(r=new Map,Ji.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 io(e,t,n,r=!1){if(At(e)){let n=r?Ji.get(e)?.get(t):void 0;n?.value?e.style.setProperty(t,n.value,n.priority):e.style.removeProperty(t),Ji.get(e)?.delete(t)}}function oo(e){let t=Rn(e.selector);if(!t&&e.durableSelector&&(t=Rn(e.durableSelector),t)){let n=e.selector.match(/\\[data-pm="([^"]+)"\\]/)?.[1];n&&t.setAttribute("data-pm",n)}return t}function ao(e){for(let t of e){let e=oo(t);if(e)for(let n of no(t))eo(e,n.property)||ro(e,n.property,n.modified)}}function lo(e,t=!1){for(let n of e){let e=Rn(n.selector);if(e)for(let r of n.changes)eo(e,r.property)||io(e,r.property,r.original,t)}}function so(e){let t=Rn(e.selector);if(!t&&e.durableSelector&&(t=Rn(e.durableSelector),t)){let n=e.selector.match(/\\[data-pm="([^"]+)"\\]/)?.[1];n&&t.setAttribute("data-pm",n)}return t}function uo(e,t){let n=e;for(let e of t)n=n?.childNodes[e]??null;return n?.nodeType===Node.TEXT_NODE?n:null}function co(e){for(let t of[...e].reverse()){if(t.captured)continue;let e=so(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){Qi(e),t.paragraphs.before.some(e=>e.parts.length>1)&&Gi(e,t.paragraphs.before);continue}let n=uo(e,t.textNodePath);n&&n.nodeValue===t.modified&&n.nodeValue!==t.original&&(n.nodeValue=t.original)}}function fo(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 po=(0,u(d()).createContext)(0),ho="\\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 mo(e,t,n){let r=e.points[0];if(typeof window>"u"||"text"!==e.type||!r)return!0;let i=e.region?.points,o=i?.length?function(e){if(0===e.length)return{x:0,y:0,width:0,height:0};let t=e.map(e=>e.x),n=e.map(e=>e.y),r=Math.min(...t),i=Math.max(...t),o=Math.min(...n);return{x:r,y:o,width:i-r,height:Math.max(...n)-o}}(i):{...r,width:0,height:0};return o.x+o.width>=t&&o.y+o.height>=n&&o.x<t+window.innerWidth&&o.y<n+window.innerHeight}function go(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 yo(e){return`url("data:image/svg+xml,${encodeURIComponent(e)}")`}var vo=yo(go({x:-100,y:-2,width:104,height:26,radius:10})),xo=yo(go({x:-100,y:-5.929,width:108,height:26,radius:10}));function bo(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 wo=u(x()),So=12;function ko(e){return e>0?16+7.2*String(e).length+16:0}function Eo({stepCount:e,onClear:t,layered:n=!1,submitted:r=!1,style:i}){let[o]=tt(),a=Xe[o];if(e<1)return null;let l=`${e} recorded ${1===e?"action":"actions"}${r?", sent":""}`;return(0,wo.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:fi,fontSize:12,fontWeight:600,padding:n?"0 8px 0 7px":"0 8px 0 5.6px",gap:4,pointerEvents:t?"auto":"none",WebkitMaskImage:n?vo:void 0,maskImage:n?vo:void 0,...i},children:[(0,wo.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,wo.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,wo.jsx)("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})]}),(0,wo.jsx)("span",{children:e})]})}function Co(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 Mo(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 jo({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+So}px - var(--popmelt-scroll-x, ${n}px))`,f=`calc(${t+So}px - var(--popmelt-scroll-y, ${r}px))`;return(0,wo.jsx)("div",{"data-devtools":"badge-hit-area",...s,style:{position:"fixed",left:0,top:0,padding:So,...a,transform:`translate3d(${u}, ${c}, 0)`,willChange:"transform"},children:(0,wo.jsx)("div",{style:{transform:Mo(d,f,{avoidTop:i,avoidBottom:o})},children:l})})}function Ao({bundleCount:e,editingComment:t=!1,style:n,layered:r=!1,compact:i=!1,description:o,replacementText:a,actionLabel:l,actionIcon:s,shortcut:u,onHoverChange:c,onSend:d}){let[f,p]=(0,qr.useState)(!1),[h]=tt(),m=(0,qr.useRef)(null),g=(0,qr.useRef)(!1),y=Xe[h],v=(0,qr.useContext)(po),x=(0,qr.useId)(),b=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl",w=Math.max(1,e),S=i&&!f,k=e=>S?(0,wo.jsx)(Se,{size:12,strokeWidth:2,"aria-hidden":!0}):e?(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)("span",{style:{color:"inherit",fontWeight:600},children:w>1?`Send all ${w}`:"Send"}),(0,wo.jsx)(Se,{size:12,strokeWidth:2,"aria-hidden":!0})]}):(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"inherit",fontWeight:600},children:[!t&&(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)("span",{children:b}),(0,wo.jsx)("span",{children:"+"})]}),(0,wo.jsx)(le,{size:12,strokeWidth:2,"aria-hidden":!0})]}),(0,wo.jsx)("span",{style:{color:y.secondary,fontWeight:600},children:"to"}),(0,wo.jsx)(Se,{size:12,strokeWidth:2,"aria-hidden":!0}),w>1&&(0,wo.jsx)("span",{style:{color:"inherit",fontWeight:600},children:w})]}),E=e=>l?(0,wo.jsxs)(wo.Fragment,{children:[u&&(0,wo.jsxs)("span",{className:"popmelt-action-shortcut","aria-hidden":!0,style:{alignItems:"center",gap:4,fontWeight:500},children:[(0,wo.jsx)("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:u}),(0,wo.jsx)("span",{style:{color:y.secondary},children:"to"})]}),s,(0,wo.jsx)("span",{style:{fontWeight:500},children:l})]}):(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)("span",{className:"popmelt-send-hint-desktop",style:{alignItems:"center",gap:4},children:k(e)}),(0,wo.jsxs)("span",{className:"popmelt-send-hint-mobile",style:{alignItems:"center",gap:4},children:[!S&&(0,wo.jsx)("span",{style:{color:"inherit",fontWeight:600},children:"Send"}),(0,wo.jsx)(Se,{size:12,strokeWidth:2,"aria-hidden":!0})]})]}),C=a?(0,wo.jsx)("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:a}):null,M={...Xr(),lineHeight:"14px",display:"flex",alignItems:"center",boxSizing:"border-box",backgroundColor:y.surface,border:`1px solid ${y.border}`,fontFamily:fi,fontSize:12,color:l&&!d?y.secondary:y.primary,userSelect:"none",padding:r?"0 8px 0 10px":"0 8px",gap:4,whiteSpace:"nowrap",borderRadius:8,letterSpacing:"0.24px",WebkitMaskImage:r?vo:void 0,maskImage:r?vo:void 0},T=w>1?`Send all ${w} pending annotations`:"Send pending annotation";return(0,wo.jsxs)("div",{"data-devtools":"send-hint-hit-area","data-popmelt-send-rejection":v?v%2?"odd":"even":void 0,onMouseEnter:()=>{P()||(p(!0),c?.(!0))},onMouseLeave:()=>{p(!1),c?.(!1)},style:{display:"grid",width:"max-content",...n},children:[(0,wo.jsx)("style",{children:`\\n@keyframes popmelt-send-rejection-odd { ${ho} }\\n@keyframes popmelt-send-rejection-even { ${ho} }\\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-action-shortcut { display: inline-flex; }\\n@media (hover: none) and (pointer: coarse) {\\n .popmelt-action-shortcut { display: none; }\\n}\\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,wo.jsx)("div",{"aria-hidden":!0,style:{...M,gridArea:"1 / 1",visibility:"hidden"},children:E(!1)}),(0,wo.jsxs)("button",{type:"button","data-devtools":"annotation-badge","aria-label":l??T,"aria-describedby":o?x:void 0,disabled:!d,onPointerDown:e=>{g.current=!1,"touch"===e.pointerType&&e.isPrimary&&(m.current={id:e.pointerId,x:e.clientX,y:e.clientY}),e.preventDefault(),e.stopPropagation()},onPointerCancel:()=>{m.current=null},onPointerUp:e=>{let t=m.current;m.current=null,t?.id===e.pointerId&&(g.current=!0,e.preventDefault(),e.stopPropagation(),Math.hypot(e.clientX-t.x,e.clientY-t.y)<=10&&d?.())},onClick:e=>{e.preventDefault(),e.stopPropagation(),g.current&&0!==e.detail?g.current=!1:d?.()},style:{...M,gridArea:"1 / 1",justifySelf:"start",maxWidth:a?"min(320px, calc(100vw - 16px))":void 0,overflow:a?"hidden":void 0,appearance:"none",margin:0,opacity:1,cursor:d?"pointer":"default",touchAction:"manipulation"},children:[o&&(0,wo.jsx)("span",{id:x,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:o}),C??E(f)]})]})}function Ro({count:e,color:t,size:n=22,onHoverChange:r}){return(0,wo.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:fi,fontSize:12,fontWeight:600,lineHeight:1,padding:"0 8px",borderRadius:8,userSelect:"none",whiteSpace:"nowrap"},children:["+",e]})}function Io({scrollX:e,scrollY:t,projected:n,children:r}){let i=(0,qr.useContext)(li),o=(0,qr.useRef)(null);(0,qr.useLayoutEffect)(()=>{let e=o.current;if(!i||n||!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}),()=>{window.removeEventListener("scroll",t),e.style.removeProperty("--popmelt-scroll-x"),e.style.removeProperty("--popmelt-scroll-y")}},[n,i]);let a={"--popmelt-painted-x":`var(--popmelt-scroll-x, ${e}px)`,"--popmelt-painted-y":`var(--popmelt-scroll-y, ${t}px)`,position:"fixed",inset:0,pointerEvents:"none",zIndex:9999};return(0,wo.jsx)("div",{ref:o,part:n?void 0:ri,"data-devtools":"annotation-badge-layer",style:a,children:r})}function Lo({annotations:e,supersededAnnotations:t,inFlightIds:n,approvalThreads:r,orientationLabels:i,activeIds:o,queuePositions:a,scrollX:l,scrollY:s,annotationGroupMap:u,onViewThread:c,onSelectAnnotation:d,onDeleteDraftAnnotation:f,onClearInteractionEpisode:p,onHoverAnnotation:h,canvasRef:m,toolbarRef:g,activeBundleAnnotationIds:y,inactiveBundleOpacity:v=.5,animateBundleOpacity:x=!0,hoverRestoredAnnotationIds:b,nestedAnnotationCountById:w,nestedAnnotationIdsById:S,onHoverNestedAnnotations:k,onHoverSendBundle:E,onSend:C,sendHintAnchorId:M,pendingBundleCount:T=1,parentPinnedAnnotationIds:j,parentPinnedLocationLabels:A,parentPinnedTooltipAnnotationId:R,onActivateAnnotation:I,hiddenAnnotationIds:L,displayAnnotations:P,projected:z=!1}){let N=(0,qr.useContext)(Ur),D=(0,qr.useContext)(li),[_,F]=(0,qr.useState)(0),$=!!(n&&n.size>0&&(void 0===o||o.size>0));(0,qr.useEffect)(()=>{if(!$||!D)return;let e=setInterval(()=>{F(e=>(e+1)%3)},250);return()=>{clearInterval(e)}},[$,D]);let O=[],H=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl";for(let a of e){if("text"!==a.type||!a.text||!a.points[0]||t.has(a)||L?.has(a.id))continue;let c=a.groupId?e.filter(e=>e.groupId===a.groupId):[a],d=a.status??"pending",f=c.map(e=>r?.get(e.id)).find(Boolean),p=!f&&T>0&&a.id===M,h=a.interactionEpisode?.steps.length??0,g=w?.get(a.id)??0,v=S?.get(a.id)??[],x=c.reduce((e,t)=>Math.max(e,t.replyCount??0),0),k="sending"===d||c.some(e=>"sending"===e.status),E="awaiting_review"===d,C=!k&&(!(!n||!n.has(a.id)&&!c.some(e=>n.has(e.id)))||"in_flight"===a.status||c.some(e=>"in_flight"===e.status)),A=c.some(e=>"resolved"===e.status&&(e.replyCount??0)>0||"needs_review"===e.status),R=c.some(e=>e.threadId),I=!!f||!y||c.some(e=>y.has(e.id)||b?.has(e.id));if(!(p||k||f||E||C||"resolved"===d||"failed"===d||"needs_review"===d||A||R||h>0)&&0===g)continue;let z=f??(a.threadId||c.find(e=>e.threadId)?.threadId),N="needs_review"===d||c.some(e=>"needs_review"===e.status),D="waiting_input"===d||c.some(e=>"waiting_input"===e.status),_="failed"===d||c.some(e=>"failed"===e.status),F=p||k||!!f||E||C||N||D||_||x>0||"resolved"===d&&R||h>0;if(!F&&0===g)continue;let $=a.points[0],H=a.fontSize||12,W=H*ci,B=u.get(a.id),V=((P?.find(e=>e.id===a.id)??a).text??a.text).replace(/\\n/g," "),q=void 0!==B?B+". "+V:V,Y=m?.current?.getContext("2d")??document.createElement("canvas").getContext("2d");if(!Y)continue;Y.font=`${H}px ${fi}`;let U=$.x-l,X=j?.has(a.id)?16:0,K=hi(Y,q,Math.max(60,pi(U)-X)),Q=Y.measureText(K).width,G=!f&&C&&!!o&&!o.has(a.id)&&!c.some(e=>o.has(e.id));O.push({id:a.id,threadId:z,visible:mo(a,l,s),x:$.x+Q+X+8+2,y:$.y-4,size:W+8,color:p?"#000000":a.color,isSending:k,isAwaitingReview:E,needsApproval:!!f,isInFlight:C,orientationLabel:i?.get(a.id)??c.map(e=>i?.get(e.id)).find(Boolean),isQueued:G,queuePosition:void 0,isNeedsReview:N,isQuestion:D,isFailed:_,replyCount:x>0?x:"resolved"===d&&R?1:0,isInActiveBundle:I,isSendHint:p,interactionEpisodeStepCount:h,interactionEpisodeSubmitted:"pending"!==d,nestedCount:g,nestedAnnotationIds:v,nestedColor:"pending"===d?a.color:"#8c8c8c",showActionBadge:F,canDeleteDraft:fo(a,e)})}let W=O.filter(e=>e.isQueued);if(W.length>0&&W.forEach((e,t)=>{e.queuePosition=a?.get(e.id)??`(${t+1}/${W.length})`}),0===O.length)return null;let B=m?.current?.getContext("2d")??document.createElement("canvas").getContext("2d"),V=O.map(e=>{B&&(B.font=`12px ${fi}`);let t=e.nestedCount>0?(B?.measureText(`+${e.nestedCount}`).width??7.2*String(e.nestedCount).length+7.2)+16:0,n=ko(e.interactionEpisodeStepCount),r=e.threadId&&N?.preview?.threadId===e.threadId?30:0;if(!e.showActionBadge)return t+n+r;let i,o=R===e.id?A?.get(e.id):void 0;i=o||(e.isSendHint?H:e.needsApproval?"Approval needed":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;B&&(l=B.measureText(i).width);let s=e.isSendHint&&B?B.measureText("to").width:e.isSendHint?14.4:0,u=e.isSendHint&&B?B.measureText("+").width:e.isSendHint?7.2:0,c=e.isSendHint&&T>1&&B?B.measureText(String(T)).width:e.isSendHint&&T>1?7.2:0;return n+t+(o?Math.min(l+16,320):e.isSendHint?l+u+s+c+16+12+12+4+4*(T>1?3:2):6+a+4+l+8)+2*(+(n>0)+ +(t>0)+1-1)+r}),q=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}}(g),Y=[];for(let e=0;e<O.length;e++){let t=O[e].y-s,n=O[e].x-l,r=Co(q,n,V[e]),i=To(t,O[e].size,r),o=i+O[e].size,a=n;for(let t=0;t<e;t++){if(!O[t].visible||!O[e].visible)continue;let n=O[t].y-s,r=Co(q,Y[t],V[t]),l=To(n,O[t].size,r);if(!(i<l+O[t].size&&o>l))continue;let u=Y[t]+V[t];a<u+2&&(a=u+2)}Y.push(a)}return(0,wo.jsxs)(Io,{scrollX:l,scrollY:s,projected:z,children:[(0,wo.jsx)("style",{dangerouslySetInnerHTML:{__html:\'\\n@media (prefers-reduced-motion: no-preference) {\\n [data-devtools="annotation-badge-layer"] [data-devtools="badge-hit-area"] {\\n transition: opacity 160ms ease-out;\\n }\\n}\\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\'}}),O.map((e,t)=>{let n=!!e.threadId,r=A?.get(e.id),i=!!r&&R===e.id,o=n||!!r,a=!!e.threadId&&N?.preview?.threadId===e.threadId,u=e.showActionBadge&&e.isSendHint||a,m=o&&!u,g=()=>{I?I(e.id,e.threadId):(d?.(e.id),e.threadId&&c?.(e.threadId))},y=Co(q,Y[t],V[t]);return(0,wo.jsx)(jo,{inert:!e.visible||void 0,"aria-hidden":!e.visible||void 0,left:Y[t]+l-So,top:e.y-So,scrollX:l,scrollY:s,avoidTop:y.avoidTop,avoidBottom:y.avoidBottom,onMouseDown:e=>e.stopPropagation(),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.canDeleteDraft&&f&&f(e.id)},onClick:o?e=>{e.stopPropagation(),g()}:void 0,onMouseEnter:()=>{h?.(e.id)},onMouseLeave:()=>{h?.(null)},onFocus:()=>h?.(e.id),onBlur:()=>h?.(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:{position:"absolute",opacity:e.visible?1:0,pointerEvents:e.visible?"auto":"none",cursor:o?"pointer":void 0,zIndex:9999,minWidth:e.isSendHint?V[t]:void 0},children:(0,wo.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:2},children:[(0,wo.jsx)(Eo,{stepCount:e.interactionEpisodeStepCount,submitted:e.interactionEpisodeSubmitted,onClear:e.canDeleteDraft&&p?()=>p(e.id):void 0}),e.nestedCount>0&&(0,wo.jsx)(Ro,{count:e.nestedCount,color:e.nestedColor,size:e.size,onHoverChange:t=>k?.(e.id,t?e.nestedAnnotationIds:null)}),(0,wo.jsx)(Qr,{threadId:e.threadId,color:e.color,size:e.size}),e.showActionBadge&&(e.isSendHint?(0,wo.jsx)(Ao,{bundleCount:T,description:r?`${r}. Activate the annotation label to reveal its source.`:void 0,replacementText:i?r:void 0,onHoverChange:E,onSend:C}):(0,wo.jsx)("div",{"data-devtools":"annotation-badge",style:{...Xr(e.size),display:"flex",alignItems:"center",backgroundColor:e.color,fontFamily:fi,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:v,transition:x?"opacity 120ms ease-out":"none"},children:i?(0,wo.jsx)("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:r}):e.needsApproval?(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)(ge,{size:12,"aria-hidden":"true"}),"Approval needed"]}):e.isAwaitingReview?(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)(ie,{size:12,strokeWidth:2.25}),"Awaiting review"]}):e.isQueued?(0,wo.jsxs)("span",{style:{opacity:.6,color:"inherit",display:"inline-flex",alignItems:"center",gap:4},children:[(0,wo.jsx)(ie,{size:12,strokeWidth:2.25}),"Queued",e.queuePosition?` ${e.queuePosition}`:""]}):e.isSending||e.isInFlight?(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle",opacity:.6},children:1===_?(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)("circle",{cx:"7",cy:"7",r:"2"}),(0,wo.jsx)("circle",{cx:"17",cy:"7",r:"2"}),(0,wo.jsx)("circle",{cx:"7",cy:"17",r:"2"}),(0,wo.jsx)("circle",{cx:"17",cy:"17",r:"2"})]}):(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)("circle",{cx:"12",cy:"6",r:"2"}),(0,wo.jsx)("circle",{cx:"6",cy:"12",r:"2"}),(0,wo.jsx)("circle",{cx:"18",cy:"12",r:"2"}),(0,wo.jsx)("circle",{cx:"12",cy:"18",r:"2"})]})}),(0,wo.jsx)("span",{style:{opacity:.6,color:"inherit"},children:e.isSending?"Sending":e.orientationLabel??"Thinking"})]}):(0,wo.jsxs)(wo.Fragment,{children:[e.isQuestion?(0,wo.jsx)(ce,{size:12,strokeWidth:2.25}):e.isFailed?(0,wo.jsx)(Me,{size:12,strokeWidth:2.25}):e.replyCount>0?(0,wo.jsx)(xe,{size:12,strokeWidth:2.25}):(0,wo.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,wo.jsx)("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}),(0,wo.jsx)("path",{d:"M10 21h4"})]}),(0,wo.jsx)("span",{style:{color:"inherit"},children:e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision"})]})}))]})},e.id)})]})}function Po({d:e,color:t,animated:n}){let r=(0,qr.useRef)(null);return(0,qr.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/Vr))*Vr}(e.getTotalLength());void 0===t?e.removeAttribute("pathLength"):e.setAttribute("pathLength",String(t))},[e]),(0,wo.jsx)("path",{ref:r,d:e,fill:"none",stroke:t,strokeWidth:1,strokeDasharray:n?Br:void 0,"data-popmelt-marching-stroke":n||void 0,style:n?{animation:"popmelt-march 0.6s linear infinite"}:void 0})}function zo(){return(0,wo.jsx)("style",{children:`\\n @keyframes popmelt-march {\\n from { stroke-dashoffset: 0; }\\n to { stroke-dashoffset: -${Vr}; }\\n }\\n @media (prefers-reduced-motion: reduce) {\\n [data-popmelt-marching-stroke="true"] { animation: none !important; }\\n }\\n `})}function No({annotations:e,activeIds:t,scrollX:n,scrollY:r,spotlightIds:i,emphasizedIds:o,hoverRestoredIds:a,inactiveOpacity:l=.5}){if(!(0,qr.useContext)(li))return null;let s=e.filter(e=>e.region&&e.region.points.length>=3&&t?.has(e.id));return s.length?(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)(zo,{}),(0,wo.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,wo.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,wo.jsx)("g",{"data-popmelt-region-id":e.id,opacity:t,children:(0,wo.jsx)(Po,{d:`${e.region.points.map((e,t)=>`${t?"L":"M"}${e.x} ${e.y}`).join(" ")} Z`,color:e.color,animated:!0})},e.id)})})})]}):null}var Do=(0,qr.memo)(function({inFlightSelectorColors:e,animated:t=!0,subjectRegistry:n,selectorElementInfo:r}){let i=(0,qr.useContext)(li),[o,a]=(0,qr.useState)([]);return(0,qr.useEffect)(()=>{if(!i)return;if(0===e.size)return void a([]);let o=null,l=new Map,s=new Map,u=typeof ResizeObserver>"u"?void 0:new ResizeObserver(p),c=!0,d=!1,f=()=>{let n=new Set;c=!1,d=!1;let i=[];for(let[o,a]of e){let e=kn(o,r?.get(o)),f=l.get(o);if(f?.element===e&&e?.closest("[data-popmelt-hover-painter]"))continue;if(f?.paint.abort(),l.delete(o),!e){d=!0,c=!0;continue}let p=e.hasAttribute("data-popmelt-subject-adapter");p&&(d=!0);let h=Zr(e,a,0,t?"marching":"solid");if(h){l.set(o,{element:e,paint:h});continue}let m=p?void 0:s.get(e);!m&&!p&&(m=ii(e),m&&(s.set(e,m),u?.observe(e,{box:"border-box"}))),m?n.add(e):c=!0;let g=ut(e);i.push({selector:o,anchor:m?.name,top:g.top,left:g.left,width:g.width,height:g.height,color:a,radius:Ti(e),radiusStyle:Mi(e)})}for(let[e,t]of s)n.has(e)||(u?.unobserve(e),t.release(),s.delete(e));a(e=>e.length||i.length?i:e)};function p(){null===o&&(o=requestAnimationFrame(()=>{o=null,f()}))}let h=()=>{c&&p()};f(),window.addEventListener("scroll",h,{capture:!0,passive:!0}),window.addEventListener("resize",p,!0);let m=new MutationObserver(t=>{l.size===e.size&&t.every(e=>"attributes"===e.type&&"style"===e.attributeName&&e.target instanceof Element&&e.target.closest("[data-popmelt-hover-painter]"))||p()});m.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class"]});let g=n?.subscribeFrame(()=>{d&&f()}),y=[...e.keys()].some(e=>e.startsWith("@frame("))?xi(f):void 0;return()=>{window.removeEventListener("scroll",h,!0),u?.disconnect();for(let e of s.values())e.release();window.removeEventListener("resize",p,!0),m.disconnect();for(let e of l.values())e.paint.abort();g?.(),y?.(),o&&cancelAnimationFrame(o)}},[t,e,n,r,i]),i&&0!==o.length?(0,wo.jsxs)(wo.Fragment,{children:[t&&(0,wo.jsx)(zo,{}),o.map(e=>(0,wo.jsx)("div",{"data-devtools":"marching-ants",part:e.anchor?ni:void 0,style:{position:"fixed",...ai(e.anchor,e,e.left,e.top),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,wo.jsx)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible"},children:(0,wo.jsx)(Po,{d:bo(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))]}):null},(e,t)=>{if(e.animated!==t.animated||e.subjectRegistry!==t.subjectRegistry||e.inFlightSelectorColors.size!==t.inFlightSelectorColors.size)return!1;let n=e.inFlightSelectorColors.entries();for(let[r,i]of t.inFlightSelectorColors){let o=n.next().value;if(o?.[0]!==r||o[1]!==i||e.selectorElementInfo?.get(r)!==t.selectorElementInfo?.get(r))return!1}return!0}),_o=u(x());function Fo({reason:e,layered:t}){return(0,_o.jsx)(_e,{hint:e,children:()=>(0,_o.jsx)(Ao,{bundleCount:1,layered:t,actionIcon:(0,_o.jsx)(G,{size:12,"aria-hidden":!0,style:{marginInlineEnd:1}}),actionLabel:"Can\'t sample",description:e})})}var $o={explore:"/explore"};var Oo=u(m()),Ho=u(d()),Wo=u(d());function Bo(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=gn(window.location.pathname);t.call(window.history,e,n,i),r(o)},o=function(e,t,i){let o=gn(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 Vo(){return gn(window.location.pathname)}function qo(){return(0,Wo.useSyncExternalStore)(Bo,Vo,()=>"/")}var Yo=new WeakMap,Uo=new Set;function Xo(e){let t=e?.closest("[data-popmelt-explore-original],[data-popmelt-explore-scene]");return t?Yo.get(t)??null:null}var Ko=u(d());function Qo(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 Go=u(d()),Zo=u(x());function Jo({painterTarget:e,path:t,polygon:n,bounds:r,clip:i,color:o,selected:a,zIndex:l}){let s=(0,Go.useId)(),u=s+"-contour",c=function(e){let[t,n]=(0,Go.useState)(null),r=(0,Go.useRef)(null);return(0,Go.useLayoutEffect)(()=>{if(n(null),!e)return;let t=Zr(e,"transparent",0,"solid",n);return()=>t?.abort()},[e]),(0,Go.useLayoutEffect)(()=>{let e=r.current;if(!t||!e)return;let n=()=>{let n=t.matches("path")?[t]:t.querySelectorAll("path"),r=0;for(let t of n){let n=t.getAttribute("d"),i=t.getScreenCTM();if(!n||!i||!t.getClientRects().length)continue;let o=e.children[r++];o||(o=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path"),o.setAttribute("vector-effect","non-scaling-stroke"),e.append(o));let a=ot(t.ownerDocument)?st({left:0,top:0,width:1,height:1},t.ownerDocument):null,l=a?.width??1,s=a?.height??1,u=`matrix(${i.a*l} ${i.b*s} ${i.c*l} ${i.d*s} ${i.e*l+(a?.x??0)} ${i.f*s+(a?.y??0)})`;o.getAttribute("d")!==n&&o.setAttribute("d",n),o.getAttribute("transform")!==u&&o.setAttribute("transform",u);let c=t.getAttribute("fill-rule")||"nonzero";o.getAttribute("fill-rule")!==c&&o.setAttribute("fill-rule",c)}for(;e.children.length>r;)e.lastElementChild.remove()},i=new MutationObserver(n);i.observe(t,{subtree:!0,attributes:!0,childList:!0});let o,a=()=>{n(),o=requestAnimationFrame(a)};return a(),()=>{i.disconnect(),cancelAnimationFrame(o),e.replaceChildren()}},[t]),{active:!!t,group:r}}(e),{left:d,top:f,width:p,height:h}=r;return(0,Zo.jsxs)("svg",{"data-devtools":"sample-spotlight","aria-hidden":"true",width:"100%",height:"100%",style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:l},children:[(0,Zo.jsxs)("defs",{children:[i&&(0,Zo.jsx)("clipPath",{id:s+"-clip",children:(0,Zo.jsx)("rect",{x:i.left,y:i.top,width:i.width,height:i.height})}),(0,Zo.jsx)("g",{id:u,clipPath:i?`url(#${s}-clip)`:void 0,children:c.active?(0,Zo.jsx)("g",{ref:c.group}):n?(0,Zo.jsx)("polygon",{points:n,transform:`translate(${d} ${f}) scale(${p} ${h})`,vectorEffect:"non-scaling-stroke"}):t?(0,Zo.jsx)("path",{d:t}):(0,Zo.jsx)("rect",{x:d,y:f,width:p,height:h})}),(0,Zo.jsxs)("mask",{id:s+"-mask",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100%",height:"100%",children:[(0,Zo.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),(0,Zo.jsx)("use",{href:"#"+u,fill:"black"})]})]}),(0,Zo.jsx)("rect",{width:"100%",height:"100%",fill:"black",fillOpacity:.5,mask:`url(#${s}-mask)`}),o&&(0,Zo.jsx)("use",{href:"#"+u,fill:"none",stroke:o,strokeWidth:1,strokeDasharray:a?void 0:Br})]})}var ea=new WeakMap,ta="popmelt:preview-viewport-change";function na(e,t=window){let n=ea.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 ea.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),ea.delete(t)))}}function ra(e,t,n){let r=e.ownerDocument.defaultView??window,i=Xo(e)??e,o=()=>t(i),a=null,l=()=>{null===a&&(a=r.requestAnimationFrame(()=>{a=null,o()}))},s="true"===e.getAttribute("data-popmelt-subject-projection")&&n,u=()=>s?s.subscribeFrame(o):function(e,t,n){let r=e.ownerDocument.defaultView,i=new Set,o=new Set,a=null;function l(){a=null,n();for(let e of o)!e.pending&&"running"!==e.playState&&o.delete(e);o.size&&(a=r.requestAnimationFrame(l))}function s(e){for(let t of e.getAnimations?.()??[])(t.pending||"running"===t.playState)&&o.add(t);o.size&&null===a&&(a=r.requestAnimationFrame(l))}function u(e){e.target===e.currentTarget&&s(e.currentTarget)}let c=typeof ResizeObserver>"u"?null:new ResizeObserver(t),d=new MutationObserver(e=>{e.some(e=>Array.from(e.removedNodes).some(e=>i.has(e)))&&p(),e.some(e=>"style"===e.attributeName)?n():t()});function f(){d.disconnect(),c?.disconnect();for(let e of i)e.removeEventListener("animationstart",u),e.removeEventListener("transitionrun",u);i.clear(),o.clear(),null!==a&&r.cancelAnimationFrame(a),a=null}function p(){f();for(let t=e;t;t=t.assignedSlot??bt(t))i.add(t),c?.observe(t),d.observe(t,{attributes:!0,attributeFilter:["style","class","hidden","open","data-popmelt-hover-painter"],childList:!0}),t.addEventListener("animationstart",u),t.addEventListener("transitionrun",u),s(t)}return p(),f}(i,l,o),c=u(),d=function(e){return Uo.add(e),()=>{Uo.delete(e)}}(()=>{let t=Xo(e)??e;t!==i&&(c(),i=t,c=u(),o())}),f=na(o,r),p=ot(e.ownerDocument)?xi(o):void 0;return o(),()=>{d(),p?.(),f(),c(),null!==a&&r.cancelAnimationFrame(a)}}function ia(e){return"string"==typeof e?e:e.component+e.styles}function oa(e,t){let n="string"==typeof e?0:16;return t(ia(e))+n}function aa(e,t=!1){if(e.subjectLabel)return`<${e.subjectLabel}>`;let n=e.dataAttributes?.["data-popmelt-label"]?.trim();if(n)return n;if(t&&e.reactComponent)return{component:e.reactComponent,styles:""};let r=e.id?`#${e.id}`:"";if(t)return e.tagName+r;let i=(e.className?.match(/\\S+/g)??[]).map(e=>e.replace(/^[\\w.-]+[.-]module__[\\w-]+?__([\\w-]+)$/,"$1"));return e.reactComponent?{component:e.reactComponent,styles:i.length?` (${i.join(", ")})`:""}:[e.tagName+r,...i.slice(0,2)].join(".")}function la(e){return"string"==typeof e?8:4}function sa(e){return{...Xr(),display:"flex",alignItems:"center",gap:4,backgroundColor:e,color:"#fff",fontSize:12,lineHeight:"14px",fontFamily:fi,letterSpacing:"0.24px",padding:"0 8px",borderRadius:8,whiteSpace:"nowrap",maxWidth:400}}var ua={overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},ca=u(x());function da({label:e,prefix:t="",hoverName:n,preview:r="expanded"}){let i="expanded"!==r,o="string"!=typeof e,a=o?e.component:n??e,l=o?e.styles:e.slice(a.length),s=void 0!==n&&!!l;return o||s?(0,ca.jsxs)("span",{"data-popmelt-snap-collapse":s&&"waiting"===r||void 0,"data-popmelt-collapsed":s?i:void 0,style:{display:s?"flex":"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:o?"rgb(255 255 255 / 60%)":void 0},children:[(0,ca.jsxs)("span",{"data-popmelt-component-name":o||void 0,style:{color:"#fff",...s&&{flex:"none",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"}},children:[t,o&&(0,ca.jsx)(ae,{"aria-hidden":"true",size:12,fill:"currentColor",stroke:"none",style:{display:"inline-block",verticalAlign:"-0.12em",marginRight:4}}),a]}),s?(0,ca.jsx)("span",{className:"popmelt-collapsible-badge-detail","aria-hidden":i,children:(0,ca.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",style:{paddingLeft:0,whiteSpace:"pre",maxWidth:400},children:l})}):l]}):t+e}var fa=new WeakMap,pa=new WeakMap,ha=new WeakMap,ma=new WeakMap;function ga(e,t,n="top-left"){t&&(fa.set(e,t),pa.set(t,e),ha.set(t,n)),ma.get(e)?.forEach(e=>e())}function ya(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 va(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function xa(e,t,n,r,i=0,o=Number.POSITIVE_INFINITY){let a=e.top>=t+n,l=e.bottom+n+t<=r;if(e.height>=r&&!a&&!l){let n=e.top<0&&e.bottom<=r;return{anchor:n?"bottom-left":"top-left",horizontalAlignment:"left",left:e.left+8,top:n?e.bottom-t-8:e.top+8}}let s=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 a?{anchor:"right"===s?"top-right":"top-left",horizontalAlignment:s,left:"right"===s?e.right:e.left,top:e.top-t-n}:{anchor:"right"===s?"bottom-right":"bottom-left",horizontalAlignment:s,left:"right"===s?e.right:e.left,top:e.bottom+n}}var ba=u(x()),wa={topLeft:"0px",topRight:"0px",bottomRight:"0px",bottomLeft:"0px"};function Sa(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.path===t.path&&!["left","top","width","height"].some(n=>e.frameClip?.[n]!==t.frameClip?.[n]||e.subjectBounds?.[n]!==t.subjectBounds?.[n])&&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 ka(e,t){if(!e.isConnected||!ft(e.ownerDocument))return{fragments:[],radii:wa};let n=ut(e),r=pt(n,e.ownerDocument);if(ot(e.ownerDocument)&&(!r.width||!r.height))return{fragments:[],radii:wa};let i=t&&ot(e.ownerDocument)?pt(new DOMRect(0,0,window.innerWidth,window.innerHeight),e.ownerDocument):void 0;if("true"===e.getAttribute("data-popmelt-subject-projection"))return{fragments:[{left:r.left,top:r.top,width:r.width,height:r.height}],radii:wa,frameClip:i,subjectBounds:t?n:void 0,outline:e.getAttribute("data-popmelt-subject-outline")??void 0};let o=Array.from(e.getClientRects()).map(t=>pt(st(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:zi(o.length>0?o:[{left:r.left,top:r.top,width:r.width,height:r.height}]),radii:Mi(e),path:t?Yt(e):void 0,frameClip:i}}function Ea({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,tintHoveredSubject:c=!1,spotlight:d=!1,fillOpacity:f=.05,subjectRegistry:p,railGap:h=2,railHeight:m=22,railWidth:g=0,renderRail:y,refreshKey:v,outlineZIndex:x=9996,onActivate:b,onRemove:w}){let S=(0,Ko.useContext)(li);(0,Ko.useLayoutEffect)(()=>{if(!(S&&c&&e&&p))return;let t=Jn(e);if(!t)return;let n=p.resolve(t);return n?.element===e?n.adapter.highlightHover?.(t.key,i):void 0},[e,i,p,c,S]);let[k,E]=(0,Ko.useState)({fragments:[],radii:wa});(0,Ko.useLayoutEffect)(()=>{if(S)return e?ra(e,e=>{let t=ka(e,d);E(e=>Sa(e,t)?e:t)},p):void E({fragments:[],radii:wa})},[S,e,p,d]),(0,Ko.useLayoutEffect)(()=>{if(!S||!e||void 0===v)return;let t=ka(Xo(e)??e,d);E(e=>Sa(e,t)?e:t)},[S,e,v,d]);let{fragments:C,radii:M}=t?{fragments:[t],radii:wa}:k,T=e&&(Xo(e)??e),j=T?.closest("[data-popmelt-hover-painter]"),[A,R]=(0,Ko.useState)(null);(0,Ko.useLayoutEffect)(()=>{if(!S||t||s||d||!T||!j)return void R(null);let e=Zr(T,i,u?0:f,n?"solid":"dashed");return R(e?T:null),()=>e?.abort()},[S,t,s,T,j,i,u,d,f,n]);let I=!!T&&A===T,L=oi(!S||t||1!==C.length||k.outline?null:T),P=L?ni:void 0;if(0===C.length||!e&&!t)return null;let z=Pi(C,C[0]),N=aa({tagName:e?.localName??"",id:e?.id,className:e?.getAttribute("class")??void 0,reactComponent:r?.reactComponent,subjectLabel:e?.hasAttribute("data-popmelt-subject-adapter")?e.getAttribute("data-popmelt-subject-label")??void 0:void 0,dataAttributes:{"data-popmelt-label":e?.getAttribute("data-popmelt-label")??""}}),D=xa({left:z.left,right:z.left+z.width,top:z.top,bottom:z.top+z.height,height:z.height},m,h,window.innerHeight,g,window.innerWidth),_={zIndex:9997,display:"flex",alignItems:"center",gap:6,backgroundColor:i,color:"#fff",fontSize:12,fontFamily:$e,lineHeight:"14px",padding:"4px 8px",paddingLeft:void 0===o?la(N):8,borderRadius:8,pointerEvents:"none",whiteSpace:"nowrap",maxWidth:400,position:"fixed",...ai(L,z,D.left,D.top)},F=!l&&(0,ba.jsxs)("div",{ref:t=>{e&&ga(e,t,D.anchor)},part:P,"data-devtools":"tooltip",style:_,children:[void 0!==o&&(0,ba.jsxs)("span",{children:[o,"."]}),(0,ba.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:(0,ba.jsx)(da,{label:N})}),void 0!==a&&a>0&&(0,ba.jsxs)("span",{style:{opacity:.8},children:["(",a," ",1===a?"change":"changes",")"]})]}),$={borderTopLeftRadius:M.topLeft,borderTopRightRadius:M.topRight,borderBottomRightRadius:M.bottomRight,borderBottomLeftRadius:M.bottomLeft};return(0,ba.jsxs)(ba.Fragment,{children:[d&&(0,ba.jsx)(Jo,{painterTarget:S&&!t&&j?T:null,path:t?void 0:k.path,polygon:t?void 0:k.outline,bounds:!t&&k.subjectBounds||z,clip:t?void 0:k.frameClip,color:s?void 0:i,selected:n,zIndex:x-1}),!s&&C.map((e,t)=>(0,ba.jsx)("div",{part:P,"data-devtools":"highlight",onContextMenu:w?e=>{e.preventDefault(),e.stopPropagation(),w()}:void 0,role:b?"button":void 0,tabIndex:b?0:void 0,"aria-label":b?"Open annotation thread":void 0,onPointerDown:b?e=>{e.preventDefault(),e.stopPropagation()}:void 0,onClick:b?e=>{e.preventDefault(),e.stopPropagation(),b()}:void 0,onKeyDown:b?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),b())}:void 0,style:{position:"fixed",...ai(L,z,e.left,e.top),width:e.width,height:e.height,pointerEvents:b||w?"auto":"none",cursor:b?"pointer":void 0,zIndex:x,overflow:"visible",opacity:I||d?0:void 0},children:(0,ba.jsx)("div",{style:k.outline?{position:"absolute",inset:0,pointerEvents:"none"}:{position:"absolute",inset:0,boxSizing:"border-box",backgroundColor:u||d?"transparent":Qo(i,f),borderColor:i,borderStyle:n?"solid":"dashed",borderWidth:1,...$,pointerEvents:"none"},children:k.outline?(0,ba.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",style:{display:"block",overflow:"visible"},"aria-hidden":"true",children:(0,ba.jsx)("polygon",{points:k.outline,fill:u||d?"transparent":Qo(i,f),stroke:i,strokeWidth:1,strokeDasharray:n?void 0:"4 3",vectorEffect:"non-scaling-stroke"})}):null})},t)),y?y(D,z,L):F]})}var Ca=u(d()),Ma=u(d()),Ta=u(x());function ja(e,t){if(e.style.display=t?"":"none",!t)return;let n=e.querySelector("line"),r=e.querySelector("circle");n.setAttribute("x1",String(t.annotation.x)),n.setAttribute("y1",String(t.annotation.y)),n.setAttribute("x2",String(t.subject.x)),n.setAttribute("y2",String(t.subject.y)),r.setAttribute("cx",String(t.subject.x)),r.setAttribute("cy",String(t.subject.y))}function Aa({groupRef:e,color:t}){return(0,Ta.jsxs)("g",{ref:e,style:{display:"none"},children:[(0,Ta.jsx)("line",{stroke:t,strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Ta.jsx)("circle",{"data-popmelt-subject-draft-point":"",r:"3",fill:t,stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]})}function Ra({element:e,annotationRect:t,subjectAnchor:n,color:r,subjectRegistry:i}){let o=(0,Ma.useRef)(null);return(0,Ma.useEffect)(()=>{let r=o.current;if(!r)return;let a=()=>{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,ut(e));ja(r,i.visible?i:null)};a();let l=i?.subscribeFrame(a),s=i?null:new MutationObserver(a);return s?.observe(e,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("resize",a),()=>{l?.(),s?.disconnect(),window.removeEventListener("resize",a)}},[t,e,n,i]),(0,Ta.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,Ta.jsx)(Aa,{groupRef:o,color:r})})}var Ia=u(x()),La=["topLeft","topRight","bottomRight","bottomLeft"],Pa=[["topLeft","topRight"],["topRight","bottomRight"],["bottomRight","bottomLeft"],["bottomLeft","topLeft"]],za="#000000";function Na(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 Da(e){let t=e.parentElement;for(;t;){let e=Na(getComputedStyle(t).backgroundColor);if(e&&e.alpha>=.95)return(.299*e.red+.587*e.green+.114*e.blue)/255>=.55?za:"#ffffff";t=t.parentElement}return za}function _a(e){return La.map(t=>`${e[t].x},${e[t].y}`).join(" ")}function Fa(e,t,n){return{"data-transform-effective-outline":"","data-transform-effective-scrim":"",fill:e,fillOpacity:t,stroke:e,strokeWidth:1,strokeDasharray:"dashed"===n?Br:void 0}}function $a({element:e,accentColor:t,activeFacet:n,outlineStyle:r,scrimOpacity:i=.05,refreshKey:o}){let a=(0,Ca.useRef)(null),l=(0,Ca.useRef)(null),s=(0,Ca.useContext)(li);return(0,Ca.useLayoutEffect)(()=>{let t=a.current;if(!t||!s)return;let n,r,i,o=null,u=null,c=!1,d=ra(e,a=>{let s=a.isConnected&&ft(a.ownerDocument),d=s?a.closest("[data-popmelt-hover-painter]"):null;if((o!==d||u!==a)&&(r?.abort(),i?.dispose(),i=void 0,o=d,u=a,r=void 0,c=!1,o)){r=new AbortController;let{signal:n}=r;c=!a.dispatchEvent(new CustomEvent("popmelt:paint-hover",{bubbles:!0,cancelable:!0,detail:{signal:n,setConnectorEdges(t,r){n.aborted||!l.current||(i??=function(e,t){let n=null,r=null,i=null,o=()=>{null!==i||!n||(i=requestAnimationFrame(()=>{i=null;let o=function(e){let t=fa.get(e);return t?.isConnected&&pa.get(t)===e&&!t.closest("[inert]")?t.getBoundingClientRect():null}(e),a=o&&n?.isConnected&&n.getScreenCTM();if(!(o&&n&&a&&r))return void ja(t,null);let l=a;if(ot(n.ownerDocument)){let e=st({left:0,top:0,width:1,height:1},n.ownerDocument);l=new DOMMatrix([a.a*e.width,a.b*e.height,a.c*e.width,a.d*e.height,a.e*e.width+e.left,a.f*e.height+e.top])}ja(t,function(e,t,n,r){if(!e.width||!e.height)return null;let i=t.startsWith("top"),o={x:e.left+e.width/2,y:i?e.bottom:e.top},{x:a,y:l}=i?n.top:n.bottom,s={x:r.a*a+r.c*l+r.e,y:r.b*a+r.d*l+r.f};return Math.hypot(s.x-o.x,s.y-o.y)<=8||(i?s.y<o.y:s.y>o.y)?null:{annotation:o,subject:s}}(o,function(e){let t=fa.get(e);return(t&&ha.get(t))??"top-left"}(e),r,l))}))},a=function(e,t){let n=ma.get(e)??new Set;return ma.set(e,n),n.add(t),()=>n.delete(t)}(e,o);return{schedule:o,setEdges(e,i){n=e,r=i,n?o():ja(t,null)},dispose(){a(),null!==i&&cancelAnimationFrame(i),ja(t,null)}}}(e,l.current),i.setEdges(t,r))},createOverlay(e,n){let r=Gr(n,"painted-hover"),i=t.cloneNode(!1);return i.setAttribute("d",Yt(e)),e===n&&(r.style.borderRadius=getComputedStyle(e).borderRadius,i.setAttribute("stroke-width",String(2))),r.append(i),r}}}))}i?.schedule();let f=s&&!c?Yt(a):"";f!==n&&(n=f,t.setAttribute("d",f))});return()=>{d(),r?.abort(),i?.dispose()}},[e,s,o,t,r,i]),s?(0,Ia.jsxs)("svg",{"data-devtools":"element-boundary","data-popmelt-steer-overlay":!0,"data-transform-facet":n,width:"100%",height:"100%",style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:9996},children:[(0,Ia.jsx)("path",{ref:a,...Fa(t,i,r),strokeOpacity:.72}),(0,Ia.jsx)(Aa,{groupRef:l,color:t})]}):null}function Oa(e){return!1===e.showHandles?(0,Ia.jsx)($a,{...e}):(0,Ia.jsx)(Ha,{...e})}function Ha({element:e,activeFacet:t,accentColor:n,outlineStyle:r="solid",showRotateHandle:i=!0,scrimOpacity:o=.05,cursorViewport:a,draggingKind:l,draggingCorner:s,ghostQuad:u,previewTarget:c,refreshKey:d,onHandlePointerDown:f}){let[p,h]=(0,Ca.useState)(null),[m,g]=(0,Ca.useState)(null),[y,v]=(0,Ca.useState)(null),[x,b]=(0,Ca.useState)(null),[w,S]=(0,Ca.useState)(!1),[k,E]=(0,Ca.useState)(za),C=(0,Ca.useRef)("top"),M=(0,Ca.useRef)(null),T=`transform-occlusion-${(0,Ca.useId)().replace(/:/g,"")}`;if((0,Ca.useEffect)(()=>{let t=!1,n=()=>{if(!ft(e.ownerDocument))return void h(null);let n=c&&e.getAnimations?.().some(e=>"transitionProperty"in e&&["transform","translate","scale","rotate"].includes(String(e.transitionProperty))),r=n?c.layoutQuad:At(e)?Xt(e):Lt(e);t=!!n,c&&(c.layoutQuad=r),M.current=r;let i=Rt(r,e.ownerDocument);g(i),b(Jt(Qt(e,r),r,i)),S(en(e)),E(Da(e));let o=Rt(At(e)?Ut(e,r):Lt(e),e.ownerDocument);v(o),h(o)},r=r=>{t&&r.target===e&&n()};e.addEventListener("transitionend",r),e.addEventListener("transitioncancel",r),n(),window.addEventListener(ta,n),window.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n,{passive:!0});let i=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>n());i?.observe(e);let o="",a=ot(e.ownerDocument)?xi(()=>{let t=ut(e),r=JSON.stringify([ft(e.ownerDocument),t.x,t.y,t.width,t.height]);r!==o&&(o=r,n())}):void 0;return()=>{e.removeEventListener("transitionend",r),e.removeEventListener("transitioncancel",r),a?.(),window.removeEventListener(ta,n),window.removeEventListener("scroll",n),window.removeEventListener("resize",n),i?.disconnect()}},[e,c]),(0,Ca.useLayoutEffect)(()=>{let t=c?.layoutQuad??(l&&M.current?M.current:At(e)?Xt(e):Lt(e));M.current=t;let n=Rt(t,e.ownerDocument);g(n),b(Jt(Qt(e,t),t,n)),S(en(e)),E(Da(e));let r=Rt(At(e)?Ut(e,t):Lt(e),e.ownerDocument);v(r),h(r)},[l,e,c,d]),!p)return null;let j=a?fn(p,a,20,{currentSide:C.current,hysteresis:8,viewport:{width:window.innerWidth,height:window.innerHeight}}):un(p,20);"rotate"!==l&&(C.current=j.side);let A="rotate"===l?{...sn(p,void 0,C.current),side:C.current}:j,R={position:"fixed",inset:0,pointerEvents:"none",zIndex:f?9999:9996},I=l?.95:.72,L=!(!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&&x?Jt(x,m,y):x,z=P?on(p,P):p,N=u&&m&&x?Jt(x,m,u):x,D=u&&N?on(u,N):u,_=ln(p),F=u?ln(u):null,$=u?sn(u,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}}}}(_,F,$.handle,A.handle):null,H=w&&y&&P?an(y,P):null,W=H?`url(#${T})`:void 0;return(0,Ia.jsx)("div",{"data-devtools":"transform-handles","data-popmelt-steer-overlay":!0,"data-transform-facet":t,style:R,children:(0,Ia.jsxs)("svg",{width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[H&&(0,Ia.jsx)("defs",{children:(0,Ia.jsxs)("mask",{id:T,maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100%",height:"100%",children:[(0,Ia.jsx)("rect",{width:"100%",height:"100%",fill:"#ffffff"}),(0,Ia.jsx)("path",{"data-transform-occlusion-mask":"",d:H,fill:"#000000"})]})}),L&&m&&x&&(0,Ia.jsx)("path",{"data-transform-layout-plate":"",d:an(m,x),fill:k,fillOpacity:"0.07",stroke:"none",mask:W}),(0,Ia.jsx)("path",{...Fa(n,o,r),d:P?an(p,P):`M ${_a(p)} Z`,strokeOpacity:I}),"translate"===l&&F&&(0,Ia.jsxs)("g",{"data-transform-origin-trace":"translate",children:[(0,Ia.jsx)("line",{x1:F.x,y1:F.y,x2:_.x,y2:_.y,stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Ia.jsx)("circle",{"data-transform-origin-point":"",cx:F.x,cy:F.y,r:"3",fill:"#808080",stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]}),"scale"===l&&s&&D&&(0,Ia.jsxs)("g",{"data-transform-origin-trace":"scale",children:[(0,Ia.jsx)("line",{x1:D[s].x,y1:D[s].y,x2:z[s].x,y2:z[s].y,stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Ia.jsx)("circle",{"data-transform-origin-point":"",cx:D[s].x,cy:D[s].y,r:"3",fill:"#808080",stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]}),"rotate"===l&&O&&(0,Ia.jsxs)("g",{"data-transform-origin-trace":"rotate",children:[(0,Ia.jsx)("path",{"data-transform-rotation-arc":"",d:O.path,fill:"none",stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Ia.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&&Pa.map(([e,t])=>(0,Ia.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}`)),(0,Ia.jsxs)("g",{"data-transform-affordances":"",children:[La.map(e=>(0,Ia.jsxs)("g",{children:[(0,Ia.jsx)("rect",{x:z[e].x-3,y:z[e].y-3,width:6,height:6,fill:n,stroke:"#ffffff",strokeWidth:2}),f&&(0,Ia.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)),i&&(0,Ia.jsxs)(Ia.Fragment,{children:[(0,Ia.jsx)("line",{x1:A.edge.x,y1:A.edge.y,x2:A.handle.x,y2:A.handle.y,stroke:n,strokeWidth:"1",opacity:I}),(0,Ia.jsx)("circle",{cx:A.handle.x,cy:A.handle.y,r:3,fill:n,stroke:"#ffffff",strokeWidth:2}),f&&(0,Ia.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=>{C.current=A.side,f("rotate",null,e,A.side)}})]})]})]})})}var Wa=u(x());function Ba({entry:e,color:t,hasAnnotationLabel:n,subjectRegistry:r}){let i=(0,Ho.useContext)(li),o=qo(),[a,l]=(0,Ho.useState)(null);return(0,Ho.useEffect)(()=>{if(!i)return;let t=function(e,t,n){let r=[],i=(e,t)=>{let n=function(e,t){let n=Sn(e.filter(e=>!e.includes("data-pm=")),t);return"matched"===n.status?n.element:null}(e,t);!n||r.some(e=>e.element===n)||r.push({element:n,elementInfo:Hn(n),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,r),n=new Set,a=typeof IntersectionObserver>"u"?null:new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&t.intersectionRect.width&&t.intersectionRect.height?n.delete(t.target):n.add(t.target);s()}),s=()=>{let r=t.filter(e=>!n.has(e.element)&&function(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=ut(e.element);return n.width>0&&n.height>0&&n.bottom>0&&n.right>0&&n.top<window.innerHeight&&n.left<window.innerWidth}(e));l(t=>t?.entry===e&&t.pathname===o&&t.targets.length===r.length&&t.targets.every((e,t)=>e===r[t])?t:{entry:e,pathname:o,targets:r})};for(let e of t)a?.observe(e.element);s();let u=na(s),c=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}(s);return()=>{a?.disconnect(),u(),c.disconnect()}},[e,o,r,i]),a?.entry!==e||a.pathname!==o?null:(0,Wa.jsx)("div",{"data-devtools":"history-target-preview",style:{pointerEvents:"none"},children:a.targets.map((e,i)=>(0,Wa.jsxs)(Ho.Fragment,{children:[(0,Wa.jsx)(Ea,{element:e.element,elementInfo:e.elementInfo,subjectRegistry:r,tintHoveredSubject:e.subject,hideTooltip:n?.(e.element),hideOutline:!e.subject,color:t}),!e.subject&&(0,Wa.jsx)(Oa,{element:e.element,activeFacet:"translate",accentColor:t,showHandles:!1,outlineStyle:"dashed"})]},i))})}var Va=u(d()),qa=u(d());function Ya(e,t){if(Object.is(e,t))return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t||Array.isArray(e)!==Array.isArray(t))return!1;let n=e,r=t,i=Object.keys(n);return i.length===Object.keys(r).length&&i.every(e=>Object.prototype.hasOwnProperty.call(r,e)&&Ya(n[e],r[e]))}var Ua="devtools-active-text";function Xa(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}var Ka=u(d());function Qa(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Ga(e,t){return function(e,t){return e===t||kt(e,t)||kt(t,e)}(e,t)||null!==bt(e)&&bt(e)===bt(t)}function Za(e,t){return kn(e,t?.[0])}function Ja(e){return!(!e.linkedSelector||"body"!==e.elements?.[0]?.tagName.toLowerCase())}function el(e){let t=xa(e,22,2,window.innerHeight);return{x:t.left+window.scrollX+8,y:t.top+window.scrollY+4}}function tl(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 nl(e,t,n=0,r,i,o=90){let a=e.left+window.scrollX+8,l="top-left"===t?e.top+window.scrollY-2-22-22*n+4:e.bottom+window.scrollY+2+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 rl=u(d());function il(e,t){return t.selectors??(t.targetBindingId?[]:[e])}function ol(e,t,n,r){let i=[...new Set(e)];return 1!==i.length?n:al(i[0],t,r)?.color??n}function al(e,t,n){for(let[n,r]of t)if(il(n,r).includes(e))return r;if(!n)return;let r=n(e);if(r)for(let[e,i]of t)if(il(e,i).some(e=>n(e)===r))return i}function ll(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 sl(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))}var ul=u(d());function cl(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 dl(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 fl(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 pl(e){if(e.length<3)return[];let t=dl(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};fl(o,e)&&n.push(o)}return n}function hl(e){if(e.length<2)return null;let t=e[0],n=e[e.length-1];return t&&n?[t,n]:null}function ml(e,t){let n=Math.min(1,Math.max(0,(t-e.start)/160));return e.to+(e.from-e.to)*(1-n)**2}function gl(e,t,n){return e.map(e=>({x:e.x-t,y:e.y-n}))}function yl(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 vl(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 xl=u(d());function bl(e){if(!e.isConnected||!ft(e.ownerDocument))return!1;let t=pt(ut(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=bt(n)}return!0}function wl(e,t){if(e?.isConnected){let t=Xo(e);if(t&&bl(t))return{element:t,parentPinned:!e.matches("[data-popmelt-explore-original],[data-popmelt-explore-scene]")};let n=e;for(;n&&n!==document.documentElement;){if(bl(n))return{element:n,parentPinned:n!==e};n=bt(n)}}let n=function(e){if(!e)return null;try{return xt(e)}catch{return null}}(t);return n&&bl(n)?{element:n,parentPinned:!0}:null}function Sl(e,t,n){return wl(e,n)?.element===t}function kl(e,t){return`[${e}="${typeof CSS<"u"&&"function"==typeof CSS.escape?CSS.escape(t):t.replace(/["\\\\]/g,"\\\\$&")}"]`}var El=["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"],Cl=["style","class","open","hidden","aria-hidden","data-state"];function Ml(e){let t=new Set(El);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{identityAttributes:[...t],attributes:[...new Set([...t,...Cl])],changesIdentity:e=>"attributes"!==e.type||t.has(e.attributeName??"")}}function Tl({annotations:e,currentPathname:t,dispatch:n,stateRef:r,styleModifications:i,subjectRegistry:o,toolbarRef:a,onTargetResolutionChange:l}){let s=(0,xl.useContext)(li),[u,c]=(0,xl.useState)(()=>new Set),d=(0,xl.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,xl.useMemo)(()=>i.filter(e=>!e.pathname||e.pathname===t).map(e=>e.selector).sort().join("|"),[t,i]);return(0,xl.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=Ml(r.current.annotations.flatMap(e=>[e.linkedSelector,e.elements?.[0]?.selector].filter(e=>!!e))),y=()=>{f=null,p.clear()},v=()=>{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=xt(kl("data-popmelt-media-id",r));if(e)return e;let t=xt(kl("data-popmelt-see-id",r));if(t)return t}return kn(e.linkedSelector,t)}(e));let t=h.get(e.id);n.set(e.id,t);let r=wl(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,v=new Map;for(let{annotation:e,spatialAnchor:t}of o){let n=v.get(t.element)??[];n.push(e),v.set(t.element,n)}let x=new Map;for(let e of v.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),x.set(i.id,r),n+=1}for(let{annotation:t,spatialAnchor:n}of o){let r=n.element,o=g.get(r);o||(o=ut(r),g.set(r,o));let l=y.get(r);void 0===l&&(l=e.some(e=>{if(e.captured)return!1;try{return wt(r,e.selector)}catch{return!1}}),y.set(r,l));let c=(l?1:0)+(x.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 ${fi}`,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)+2?"top-left":"bottom-left",h=r===document.body&&Ja(t)?el(o):nl(o,f,c,a?.current,d),m=s.get(t.id),v=m?.points[0],b=f!==m?.linkedAnchor;v&&(b||Math.abs(h.x-v.x)>1||Math.abs(h.y-v.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}})};v();let x=()=>{y(),i||null!==e||(e=requestAnimationFrame(()=>{e=null,v()}))},b=na(v);window.addEventListener("resize",x,!0),window.addEventListener("load",x),document.addEventListener("transitionend",x,!0),document.addEventListener("animationend",x,!0),document.fonts.ready.then(x);let w=o?.subscribeFrame(v),S=new Set,k=()=>{for(let e of vt())!(e instanceof ShadowRoot)||S.has(e)||(S.add(e),E.observe(e,C))},E=new MutationObserver(e=>{let t=e.filter(e=>{let t=e.target,n=t instanceof Element?t:t.parentElement;return!n||!St(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&&x()}),C={attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:g.attributes};E.observe(document.body,C),k();let M=d.includes("@frame(")?xi(()=>{h.clear(),y(),v()}):void 0;return()=>{i=!0,M?.(),b(),window.removeEventListener("resize",x,!0),window.removeEventListener("load",x),document.removeEventListener("transitionend",x,!0),document.removeEventListener("animationend",x,!0),E.disconnect(),w?.(),e&&cancelAnimationFrame(e)}},[s,t,n,d,f,r,o,a,l]),u}var jl=u(d()),Al=u(d());function Rl(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(void 0===t||function(e,t){return"string"==typeof e.pathname&&e.pathname===t}(e,t))&&"dismissed"!==e.status&&(!i||!n.has(i))})}function Il(e,t,n,r=new Set,i=new Map){let o=new Set;for(let e of Rl(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 Ll=u(d()),Pl=u(d()),zl=u(d()),Nl=Number.MAX_SAFE_INTEGER;function Dl(e){return`${e.pathname??"*"}\\0${e.selector}`}function _l(e,t){return`element:${e??"*"}\\0${t}`}var Fl=u(x());function $l(e){return`${e} image${e>1?"s":""} attached`}function Ol(e){return e<=0?0:32+7.2*String(e).length}function Hl({imageCount:e,color:t,layered:n=!1}){return e<=0?null:(0,Fl.jsxs)("div",{"data-devtools":"active-image-attachment-badge",role:"img","aria-label":$l(e),title:$l(e),style:{position:"relative",flex:"0 0 auto",display:"flex",marginRight:-2,zIndex:2},children:[(0,Fl.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?xo:void 0,WebkitMaskImage:n?xo:void 0},children:(0,Fl.jsx)("span",{style:{width:10,height:10,background:t,transform:"rotate(-45deg)"}})}),(0,Fl.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 ${Fe}`,whiteSpace:"nowrap",maskImage:n?vo:void 0,WebkitMaskImage:n?vo:void 0},children:[(0,Fl.jsx)(ue,{size:12,strokeWidth:2,"aria-hidden":!0}),e]})]})}function Wl({point:e,scroll:t,attachments:n,showAttachments:r,onRemoveAttachment:i}){return(0,Fl.jsx)(Fl.Fragment,{children:r&&n.length>0&&(0,Fl.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,Fl.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," · ",Xa(e.size)," ×"]},e.id))})})}var Bl=u(x());function Vl({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,Bl.jsx)(jo,{"data-popmelt-active-annotation-surface":"true",left:e+t+r.x+2-So,top:n+r.y-So,scrollX:r.x,scrollY:r.y,onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},style:{pointerEvents:"auto",zIndex:10002},children:(0,Bl.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:2},children:[(0,Bl.jsx)(Eo,{stepCount:s,onClear:m}),o>0&&i&&(0,Bl.jsx)(Ro,{count:o,color:l,onHoverChange:e=>p(i,e?a:null)}),(0,Bl.jsxs)("div",{style:{display:"flex",alignItems:"center",isolation:"isolate",marginLeft:u>0?4:0},children:[(0,Bl.jsx)(Hl,{imageCount:u,color:c}),d&&(0,Bl.jsx)(Ao,{editingComment:!0,layered:u>0,bundleCount:Math.max(1,f),onHoverChange:h,onSend:g})]})]})}):null}var ql=u(d()),Yl=u(d());function Ul(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(st(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[st(t.getBoundingClientRect(),t.ownerDocument)]}return t===n?r.slice(-1):r}function Xl(e,t,n,r,i){let o=e[0]?.textNode.ownerDocument;if(!o)return null;let a=ct(t,n,o),l=r.style.pointerEvents,s=i?.style.pointerEvents;r.style.pointerEvents="none",i&&(i.style.pointerEvents="none");try{let t=Di(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 Kl=new WeakMap;var Ql=u(d());var Gl=u(d()),Zl=u(d()),Jl=u(x());function es({inputRef:e,value:t,style:n,command:r,onChange:i,onKeyDown:o,...a}){let l=(0,Gl.useRef)(null),{active:s,complete:u,hintId:c,inputProps:d}=function(e,t){let n=(0,Zl.useId)(),[r,i]=(0,Zl.useState)(-1),[o,a]=(0,Zl.useState)(!1),l=t.some(({suffix:e})=>e);(0,Zl.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,Gl.useLayoutEffect)(()=>{e.current&&r&&p(e.current)},[r,e,t]),(0,Jl.jsxs)(Jl.Fragment,{children:[r&&(0,Jl.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,Jl.jsxs)("strong",{style:{fontWeight:700},children:[r.token,f&&(0,Jl.jsx)("span",{style:{opacity:.55},children:f})]}),r.body]}),(0,Jl.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,Jl.jsxs)("span",{hidden:!0,id:c,children:["Press Tab to complete ",r.token,f,"."]})]})}var ts=u(x());function ns({value:e,enterKeyHint:t,command:n,fontSize:r,prefix:i,inputRef:o,inputStyle:a,target:l,singleTextNode:s,segments:u,canvasRef:c,selectionBackground:d,selectionColor:f,annotationBorderRadius:p,activeColor:h,boundaryRects:m,viewportClip:g,sourceEditor:y,wrapsDomText:v,showEditor:x,rawLeft:b,top:w,baselineOffset:S,onChange:k,onKeyDown:E,onPaste:C,onBlur:M}){let T=function(e,t,n){let[r,i]=(0,Ql.useState)(null),o=(0,Ql.useRef)(null),a=(0,Ql.useRef)(null),l=(0,Ql.useCallback)(t=>{if(!e)return;let n=t.selectionStart,r=t.selectionEnd;i(e=>e?.start===n&&e.end===r?e:{start:n,end:r})},[e]);function s(n,r){if(!e||0!==n.button||!r&&!o.current)return;let i=n.currentTarget,s=Xl(e,n.clientX,n.clientY,i,t.current);if(null===s)return;n.preventDefault(),i.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}}(i.value,s,r?n.detail:o.current.clicks);if(r){a.current=null;let e="backward"===i.selectionDirection?i.selectionEnd:i.selectionStart;o.current={anchor:n.shiftKey?{start:e,end:e}:u,clicks:n.detail}}let c=o.current.anchor;i.setSelectionRange(Math.min(c.start,u.start),Math.max(c.end,u.end),u.start<c.start?"backward":"forward"),l(i)}return(0,Ql.useLayoutEffect)(()=>{let t=n.current;if(!e||!t)return;let r=()=>l(t),i=()=>{t.matches(":focus")&&r()};return r(),t.ownerDocument.addEventListener("selectionchange",i),t.addEventListener("select",r),t.addEventListener("selectionchange",r),()=>{t.ownerDocument.removeEventListener("selectionchange",i),t.removeEventListener("select",r),t.removeEventListener("selectionchange",r)}},[n,e,l]),{selection:r,rects:e&&r?Ul(e,r.start,r.end):[],caret:r?.start===r?.end,events:e?{onKeyDownCapture:function(n){let r=n.currentTarget,i="ArrowUp"===n.key?-1:"ArrowDown"===n.key?1:0,o="Home"===n.key||n.metaKey&&"ArrowLeft"===n.key,s="End"===n.key||n.metaKey&&"ArrowRight"===n.key;if(i||(a.current=null),!e||!i&&!o&&!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=Ul(e,c,c)[0];if(!f)return;let p=zi(Ul(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===a.current&&(a.current=f.left);let n=o?y.left:s?y.left+y.width:a.current??f.left;g=Xl(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 v=n.shiftKey?d:g;r.setSelectionRange(Math.min(v,g),Math.max(v,g),g<v?"backward":"forward"),l(r)},onPointerDown:e=>{"mouse"===e.pointerType&&0===e.button&&e.currentTarget.setPointerCapture(e.pointerId)},onInput:e=>l(e.currentTarget),onSelect:e=>l(e.currentTarget),onMouseDown:e=>s(e,!0),onMouseMove:e=>{1===e.buttons?s(e,!1):o.current=null},onMouseUp:()=>{o.current=null}}:{}}}(x&&!y?u:void 0,c,o),j=function(e,t,n,r,i,o,a){let l=(0,Yl.useRef)({selection:i,color:o,selectionBackground:a}),s=(0,Yl.useRef)(void 0),[u,c]=(0,Yl.useState)(!1);return(0,Yl.useLayoutEffect)(()=>{l.current={selection:i,color:o,selectionBackground:a},s.current?.()},[r,i,o,a]),(0,Yl.useLayoutEffect)(()=>{if(!e?.closest("[data-popmelt-hover-painter]")||!t)return void c(!1);let r=new AbortController,i=new CustomEvent("popmelt:paint-text-edit",{bubbles:!0,cancelable:!0,detail:{signal:r.signal,createOverlay:(e,r)=>function(e,t,n,r,i){let o=Gr(t,"painted-text-edit"),a=n.flatMap(t=>{let n=uo(e,t.textNodePath);return n?[{...t,textNode:n}]:[]});function l(e,t){let n=o.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path"),{left:r,top:a,height:l}=e,s=r+("caret"===t?1:e.width);n.setAttribute("d",`M${r} ${a}H${s}V${a+l}H${r}Z`),n.setAttribute("data-devtools","boundary"===t?"text-edit-active-boundary":`text-edit-${t}`),n.setAttribute("fill","selection"===t?i.selectionBackground:i.color),"boundary"===t&&(n.setAttribute("fill-opacity","0.08"),n.setAttribute("stroke",i.color),n.setAttribute("stroke-width","1"),n.setAttribute("vector-effect","non-scaling-stroke")),o.append(n)}let s=Wi(a,e,dt(e).getComputedStyle(e),r);for(let e of s.boundaryRects)l(e,"boundary");if(i.selection){let{start:e,end:t}=i.selection;for(let n of Ul(a,e,t))l(n,e===t?"caret":"selection")}return o}(e,r,t,n,l.current),setHitArea:t=>{Kl.set(e,t)},setRefresh:e=>{s.current=e}}});return c(!e.dispatchEvent(i)),()=>{s.current=void 0,r.abort(),Kl.delete(e)}},[e,t,n]),u}(l,u,s,e,x?T.selection:null,h,d),A=j||s||1!==m?.length?void 0:l,R=(0,ql.useRef)(null);(0,ql.useLayoutEffect)(()=>{R.current&&A&&R.current.setAttribute("d",Yt(A))},[A,m]);let I=void 0!==m;if(y&&x){let t=m?.[0];return(0,ts.jsx)(es,{id:"devtools-text-input","aria-label":"Edit rendered text",inputRef:o,value:e,onChange:k,onKeyDown:E,onBlur:M,onPaste:C,rows:Math.min(8,Math.max(3,e.split("\\n").length)),wrap:"soft",style:{position:"fixed",zIndex:10002,pointerEvents:"auto",left:`clamp(8px, ${t?.left??b}px, calc(100vw - min(26rem, 100vw - 16px) - 8px))`,top:`clamp(8px, ${(t?.top??w)+(t?.height??0)+6}px, calc(100dvh - min(12rem, 45dvh) - 8px))`,width:"min(26rem, calc(100vw - 16px))",maxHeight:"min(12rem, 45dvh)",boxSizing:"border-box",background:"#191919",color:"#fff",caretColor:h,border:`1px solid ${h}`,borderRadius:8,padding:8,font:"14px/1.4 system-ui",resize:"none",overflow:"auto"}})}return(0,ts.jsxs)("div",{"data-devtools":"text-editor-layer",style:g?{position:"fixed",inset:0,pointerEvents:"none",zIndex:10002,clipPath:`inset(${g.top}px ${Math.max(0,window.innerWidth-g.left-g.width)}px ${Math.max(0,window.innerHeight-g.top-g.height)}px ${g.left}px)`}:{display:"contents"},children:[(0,ts.jsx)("style",{children:`\\n#devtools-text-input::placeholder { color: rgba(255, 255, 255, 0.5); }\\n#devtools-text-input::selection {\\n background: ${d};\\n color: ${f};\\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: ${p}; }\\n}\\n@media (prefers-reduced-motion: reduce) {\\n #devtools-text-input { animation: none !important; }\\n}\\n`}),A&&(0,ts.jsx)("svg",{"aria-hidden":"true",width:"100%",height:"100%",style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:10002},children:(0,ts.jsx)("path",{ref:R,"data-devtools":"text-edit-active-boundary",fill:h,fillOpacity:.08,stroke:h,strokeWidth:1,vectorEffect:"non-scaling-stroke"})}),!j&&!A&&m?.map((e,t)=>(0,ts.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 ${h}`,backgroundColor:Qo(h,.08),boxSizing:"border-box"}},`${e.left}:${e.top}:${t}`)),!j&&x&&T.rects.map((e,t)=>(0,ts.jsx)("div",{"aria-hidden":!0,"data-devtools":T.caret?"text-edit-caret":"text-edit-selection",style:{position:"fixed",left:e.left,top:e.top,width:T.caret?1:e.width,height:e.height,pointerEvents:"none",zIndex:10002,backgroundColor:T.caret?h:d}},`${e.left}:${e.top}:${t}`)),x&&(0,ts.jsx)(es,{id:"devtools-text-input","data-popmelt-active-annotation-surface":I?void 0:"true",inputRef:o,command:n,value:e,enterKeyHint:t,onChange:k,onKeyDown:E,onPaste:C,onBlur:M,placeholder:I?void 0:"Type here...",wrap:I?v?"soft":"off":void 0,spellCheck:!1,...T.events,style:{...a,pointerEvents:"auto",opacity:j||T.rects.length?0:a.opacity}}),x&&!I&&i&&(0,ts.jsx)("span",{"aria-hidden":!0,"data-devtools":"annotation-number",style:{position:"fixed",left:b+8,top:w+4+S,zIndex:10002,pointerEvents:"none",color:"#ffffff",fontFamily:fi,fontSize:r,lineHeight:r*ci+"px",whiteSpace:"pre"},children:i})]})}var rs=u(x());function is({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,rs.jsxs)("div",{"data-popmelt-active-annotation-surface":"true",onContextMenu:h,style:{position:"relative",width:n,height:r,flex:`0 0 ${n}px`},children:[(0,rs.jsx)(es,{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:ui(t?"bottom-left":e),animation:void 0}}),l&&(0,rs.jsx)("span",{"aria-hidden":!0,"data-devtools":"annotation-number",style:{position:"absolute",left:8,top:4,zIndex:1,pointerEvents:"none",color:"#ffffff",fontFamily:fi,fontSize:a,fontWeight:600,lineHeight:a*ci+"px",whiteSpace:"pre"},children:l})]})}var os=u(d()),as=u(x());function ls({color:e,cursorRef:t,tool:n,onHandoff:r,onDone:i}){let o=(0,os.useRef)(null),a=(0,os.useRef)(r);a.current=r,(0,os.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,os.useEffect)(()=>{let e=window.setTimeout(()=>a.current(),120);return()=>window.clearTimeout(e)},[]);let l="inspector"===n;return(0,as.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 ${Qo(e,.42)}) drop-shadow(0 1.25px 1.1px ${Qo(e,.24)})`},children:[(0,as.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,as.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,as.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,as.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 ss=u(d()),us=["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],cs=[50,100,200,300,400,500,600,700,800,900,950],ds=500,fs="neutral",ps=950,hs={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 ms(e,t){return hs[e][t]}function gs(e,t){let n=us.indexOf(e);return us[(n+t+us.length)%us.length]}function ys(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 vs(e,t){let n=ys(e),r=ys(t);return null!==n&&null!==r&&n.every((e,t)=>e===r[t])}var xs=["padding","margin","border","radius","stack","grid","text","color","transform","opacity"],bs=[0,1,2,3,4,6,8,10,12,16],ws=[-16,-12,-10,-8,-6,-4,-3,-2,-1,0,1,2,3,4,6,8,10,12,16],Ss=["vertical","horizontal"],ks=["stretch","start","center","end","baseline"],Es=["start","center","end","between","around","evenly"],Cs=[1,2,3,4,5,6],Ms=["xs","sm","base","lg","xl","2xl","3xl","4xl"],Ts=[300,400,500,600,700,800],js=["none","tight","snug","normal","relaxed","loose"],As=["tighter","tight","normal","wide","wider","widest"],Rs=["left","center","right","justify"],Is=[25,50,75,90,95,100,105,110,125,150],Ls=[-180,-90,-45,-25,-12,-6,-3,-2,-1,0,1,2,3,6,12,25,45,90,180],Ps=[0,5,10,20,25,30,40,50,60,70,75,80,90,95,100],zs=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ns={padding:bs,margin:bs,border:[0,1,2,4,8],radius:bs},Ds={padding:"p",margin:"m",border:"border",radius:"rounded",stack:"flex",grid:"grid",text:"text",color:"text",transform:"transform",opacity:"opacity"},_s={padding:"P",margin:"M",border:"B",radius:"R",stack:"F",grid:"G",text:"FO",color:"BG",transform:"T",opacity:"O"},Fs={padding:"Padding",margin:"Margin",border:"Borders",radius:"Radii",stack:"Flexbox",grid:"Grid",text:"Fonts",color:"Background",transform:"Transform",opacity:"Opacity"},$s={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:us,transform:["translate","scale","rotate"],opacity:["opacity","mix-blend"]},Os={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 Hs(e){return us.includes(e)}function Ws(e,t){return"color"===e||("text"===e||"border"===e)&&("color"===t||Hs(t))}var Bs=e=>encodeURIComponent(e),Vs=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=\'${Bs(e)}\' flood-opacity=\'.42\'/%3E%3CfeDropShadow dx=\'0\' dy=\'1.25\' stdDeviation=\'1.1\' flood-color=\'${Bs(e)}\' flood-opacity=\'.24\'/%3E%3C/filter%3E%3C/defs%3E`;function qs(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${Vs(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=\'${Bs(e)}\' stroke=\'white\' stroke-width=\'1.25\'/%3E%3C/svg%3E") 4 4, pointer`}function Ys(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${Vs(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=\'${Bs(e)}\' stroke=\'white\' stroke-width=\'1.111\'/%3E%3C/svg%3E") 4 4, pointer`}function Us(e,t="all"){let n=Qs(e,t);return"color"===e||("text"===e||"border"===e)&&Ws(e,n)?cs:"stack"===e?"direction"===n?Ss:"align"===n?ks:"justify"===n?Es:bs:"grid"===e?"gap"===n?bs:Cs:"text"===e?"weight"===n?Ts:"line-height"===n?js:"letter-spacing"===n?As:"text-align"===n?Rs:Ms:"transform"===e?"scale"===n?Is:"rotate"===n?Ls:ws:"opacity"===e?"mix-blend"===n?zs:Ps:Ns[e]}function Xs(e,t,n="all"){let r=Us(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 Ks(e){return $s[e]}function Qs(e,t){if("stack"===e&&("vertical"===t||"horizontal"===t))return"direction";if(("text"===e||"border"===e)&&Hs(t))return t;let n=Ks(e);return n.includes(t)?t:n[0]}function Gs(e,t){return"text"===e?"size":"transform"===e?"translate":"opacity"===e?"opacity":Qs(e,t)}function Zs(e,t,n){return"family"===e?"family":"text"!==t&&"border"!==t||"color"!==n?"value":"variant"}function Js(e,t,n,r="all"){let i=Us(e,r),o=Xs(e,t,r),a=i.indexOf(o);return i[(a+n+i.length)%i.length]}function eu(e){return Fs[e]}function tu(e,t){let n=Qs(e,t);return"color"===e||("text"===e||"border"===e)&&Hs(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?eu(e):Os[n]}function nu(e,t){let n=Qs(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||Hs(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||Hs(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 ru(e,t){let n=Qs(e,t);return"color"===e?["background-color"]:"stack"===e||"grid"===e?"gap"===n?["row-gap","column-gap"]:[nu(e,n)]:"text"===e?"color"===n||Hs(n)?["color"]:"line-height"===n||"letter-spacing"===n?[nu(e,n),"font-size"]:[nu(e,n)]:"border"!==e||"color"!==n&&!Hs(n)?"transform"===e||"opacity"===e?[nu(e,n)]:"padding"!==e&&"margin"!==e||"x"!==n?"padding"!==e&&"margin"!==e||"y"!==n?"all"!==n?[nu(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 iu(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 ou(e,t,n){let r=n.trim().toLowerCase();if("text"===e){if("size"===t){let t=iu(n,e);return null===t?null:vu(Ms,e=>hu[e],t)}if("weight"===t){if("normal"===r)return 400;if("bold"===r)return 700;let e=Number(r);return Number.isFinite(e)?vu(Ts,e=>e,e):null}if("text-align"===t)return"start"===r?"left":"end"===r?"right":Rs.includes(r)?r:null}if("transform"===e){if("none"===r)return"scale"===t?100:0;if("translate"===t){let t=iu(n,e);return null===t?null:vu(bs,e=>4*e,t)}if("scale"===t){let e=100*Number.parseFloat(n);return Number.isFinite(e)?vu(Is,e=>e,e):null}if("rotate"===t){let e=Number.parseFloat(n);return Number.isFinite(e)?vu(Ls,e=>e,e):null}}if("opacity"===e){if("mix-blend"===t)return zs.includes(r)?r:null;let e=100*Number.parseFloat(n);return Number.isFinite(e)?vu(Ps,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 au(e,t,n,r){let i=function(e,t,n,r="all"){let i=Qs(e,r);if("color"===e||("text"===e||"border"===e)&&Hs(i)){let e=ms(i,t);return n.length>0&&n.every(t=>vs(t,e))}if("text"===e){if("size"===i){let r=iu(n[0]??"",e);return null!==r&&Math.abs(r-hu[t])<.01}if("weight"===i)return ou(e,i,n[0]??"")===t;if("line-height"===i){let r=(n[0]??"").trim().toLowerCase();if("normal"===r)return"normal"===t;let i=iu(r,e),o=iu(n[1]??"",e);return null!==i&&null!==o&&0!==o&&Math.abs(i/o-gu[t])<.01}if("letter-spacing"===i){let r=(n[0]??"").trim().toLowerCase();if("normal"===r)return"normal"===t;let i=iu(r,e),o=iu(n[1]??"",e);return null!==i&&null!==o&&0!==o&&Math.abs(i/o-yu[t])<.001}return ou(e,i,n[0]??"")===t}if("transform"===e||"opacity"===e||"stack"===e&&"gap"!==i)return ou(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(cu(e,t,i)),a=n.map(t=>iu(t,e));return a.length>0&&a.every(e=>null!==e&&Math.abs(e-o)<.01)}(e,t,ru(e,n).map(r),n),o=pu(e),a=du(e,n,t).every(e=>r(e.property).trim()===e.value),l="border"===e&&!Ws(e,n)&&"number"==typeof t&&t>0?lu(n):null,s=!l||!["","none"].includes(r(l).trim());return i&&(!o||r("display").trim()===o)&&a&&s}function lu(e){let t=Qs("border",e);return"all"===t?"border-style":`border-${t}-style`}function su(e){return"color"===e?"background-color":"border"===e?"border-top-color":"color"}function uu(e,t,n){let r=Qs(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 Hs(r)?`text-${r}-${t}`:"size"===r?`text-${t}`:"weight"===r?mu[t]:"line-height"===r?`leading-${t}`:"letter-spacing"===r?`tracking-${t}`:`text-${t}`;if("border"===e&&Hs(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=Ds[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 cu(e,t,n="all"){let r=Qs(e,n);if("color"===e||("text"===e||"border"===e)&&Hs(r))return ms(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?`${hu[t]}px`:"weight"===r?String(t):"line-height"===r?String(gu[t]):"letter-spacing"===r?`${yu[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 du(e,t,n){let r=Qs(e,t);return"padding"!==e&&"margin"!==e||"x"!==r&&"y"!==r?[]:[{property:"x"===r?`${e}-right`:`${e}-bottom`,value:cu(e,n??0,r),token:uu(e,n??0,r)}]}function fu(e,t,n){if("text"===t&&("size"===n||"all"===n))return String(hu[e]);if("text"===t&&"line-height"===n){let t=gu[e];return String(Number(t.toFixed(1)))}if("text"===t&&"letter-spacing"===n){let t=yu[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 pu(e){return"stack"===e?"flex":"grid"===e?"grid":null}qs(),Ys();var hu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36},mu={300:"font-light",400:"font-normal",500:"font-medium",600:"font-semibold",700:"font-bold",800:"font-extrabold"},gu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},yu={tighter:-.05,tight:-.025,normal:0,wide:.025,wider:.05,widest:.1};function vu(e,t,n){return e.reduce((e,r)=>Math.abs(t(r)-n)<Math.abs(t(e)-n)?r:e)}var xu=Math.SQRT1_2;function bu(e,t){return Us(e,t).filter(e=>"number"==typeof e)}function wu(e,t,n){return bu(e,t).reduce((r,i)=>Math.abs(Number.parseFloat(cu(e,i,t))-n)<Math.abs(Number.parseFloat(cu(e,r,t))-n)?i:r)}function Su(e,t){let n=bu("transform",e),r=t=>"translate"===e?Number.parseFloat(cu("transform",t,e)):t;return n.reduce((e,n)=>Math.abs(r(n)-t)<Math.abs(r(e)-t)?n:e)}function ku(e,t){return t?e:"left"===e||"right"===e?"x":"y"}function Eu(e,t){return t?e:"all"}function Cu(e){return{x:("top-left"===e||"bottom-left"===e?1:-1)*xu,y:("top-left"===e||"top-right"===e?1:-1)*xu}}function Mu(e,t){let n=Math.max(1,t);return(e%n+n)%n}var Tu=u(x()),ju=["top-left","top-right","bottom-right","bottom-left"];function Au({element:e,radius:t,accentColor:n,hoveredCorner:r,draggingCorner:i,cursorViewport:o,onHandlePointerDown:a}){let[l,s]=(0,ss.useState)(null),u=t["top-left"],c=t["top-right"],d=t["bottom-right"],f=t["bottom-left"];if((0,ss.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,ss.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=Cu(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(ju.map(e=>{let n=Cu(e),r=14+t[e],i=g[e];return[e,{x:i.x+n.x*r,y:i.y+n.y*r}]})),v=i??r,x={position:"fixed",top:l.top,left:l.left,width:p,height:h,pointerEvents:"none",zIndex:a?9999:9996,overflow:"visible"};return(0,Tu.jsxs)("div",{"data-devtools":"border-radius-handles","data-popmelt-steer-overlay":!0,style:x,children:[(0,Tu.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${p} ${h}`,children:[(0,Tu.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"}),ju.map(e=>{let t=y[e];return(0,Tu.jsx)("circle",{cx:t.x,cy:t.y,r:e===v?4:3,fill:n,stroke:"#ffffff",strokeWidth:2},e)}),a&&ju.map(e=>{let t=y[e],n=g[e],r="top-left"===e||"bottom-right"===e?"nwse-resize":"nesw-resize";return(0,Tu.jsxs)("g",{children:[(0,Tu.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,Tu.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&&v&&(()=>{let e=Math.round(t[v]);return(0,Tu.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 Ru=u(d()),Iu=u(x());function Lu({centerX:e,centerY:t,orientation:n,accentColor:r,...i}){let o="horizontal"===n?10:6,a="horizontal"===n?6:10;return(0,Iu.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 Pu=u(x());function zu(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 Nu({element:e,gap:t,accentColor:n,hoveredAxis:r,draggingAxis:i,cursorViewport:o,isAutoGap:a=!1,refreshKey:l=0,onHandlePointerDown:s}){let[u,c]=(0,Ru.useState)(null),[d,f]=(0,Ru.useState)([]),[p,h]=(0,Ru.useState)(!1);if((0,Ru.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,Ru.useEffect)(()=>{if(!e)return c(null),void f([]);let t=()=>{c(e.getBoundingClientRect()),f(Si(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,Ru.useLayoutEffect)(()=>{e&&(c(e.getBoundingClientRect()),f(Si(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",v=zu(n,.25),x=zu(n,.1),b=zu(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,Pu.jsxs)("div",{"data-devtools":"gap-handles","data-popmelt-steer-overlay":!0,style:w,children:[(0,Pu.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${m} ${g}`,children:[(0,Pu.jsx)("defs",{children:(0,Pu.jsx)("pattern",{id:y,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Pu.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:v,strokeWidth:"1.5"})})}),(0,Pu.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,Pu.jsxs)("g",{opacity:l?1:.6,children:[(0,Pu.jsx)("rect",{x:r,y:i,width:o,height:a,fill:x}),(0,Pu.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,Pu.jsx)("circle",{"data-gap-handle":e.axis,cx:r,cy:i,r:3,fill:n,stroke:"#ffffff",strokeWidth:2},`gap-handle-${t}`):(0,Pu.jsx)(Lu,{"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,Pu.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,Pu.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 Du=u(d()),_u=new Set(["CANVAS","EMBED","IFRAME","IMG","INPUT","OBJECT","VIDEO"]),Fu=["top","bottom"],$u=["left","right"];var Ou=u(x());function Hu(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 Wu={top:"bottom",bottom:"top",left:"right",right:"left"},Bu="#808080";function Vu({element:e,padding:t,mode:n="padding",accentColor:r,hoveredSide:i,draggingSide:o,activeSides:a,cursorViewport:l,onHandlePointerDown:s}){let[,u]=(0,Du.useReducer)(e=>e+1,0),[c,d]=(0,Du.useState)(!1);(0,Du.useEffect)(()=>{let e=e=>{("Alt"===e.key||"Control"===e.key)&&d(!0)},t=e=>{("Alt"===e.key||"Control"===e.key)&&d(!1)},n=()=>d(!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,Du.useEffect)(()=>na(u),[]);let f=e.getBoundingClientRect(),p=f.width,h=f.height,{top:m,right:g,bottom:y,left:v}=t,x=Math.max(0,m),b=Math.max(0,g),w=Math.max(0,y),S=Math.max(0,v),k="margin"===n,E=k?p+S+b:p,C=k?h+x+w:h,M=k?S:0,T=k?x:0,j=k?"pm-dot-pattern":"pm-stripe-pattern",A=Hu(r,.25),R=Hu(r,.1),I=Hu(r,.2),L=Hu(Bu,.55),P=Hu(Bu,.18),z=Hu(Bu,.9),N=new Set(k?[]:function(e,t=window.getComputedStyle(e)){return function({isHtmlElement:e,tagName:t,display:n,writingMode:r}){return!e||"inline"!==n||_u.has(t)?[]:r.startsWith("horizontal")?Fu:$u}({isHtmlElement:e instanceof HTMLElement,tagName:e.tagName,display:t.display,writingMode:t.writingMode})}(e)),D=N.size>0,_="pm-neutral-stripe-pattern",F={position:"fixed",top:f.top-(k?x:0),left:f.left-(k?S:0),width:E,height:C,pointerEvents:"none",zIndex:s?9999:9996,overflow:"visible"},$=["top","right","bottom","left"],O={top:`0,0 ${E},0 ${E-b},${x} ${S},${x}`,right:`${E},0 ${E},${C} ${E-b},${C-w} ${E-b},${x}`,bottom:`0,${C} ${S},${C-w} ${E-b},${C-w} ${E},${C}`,left:`0,0 ${S},${x} ${S},${C-w} 0,${C}`},H={top:{x:E/2,y:x/2,orientation:"horizontal"},bottom:{x:E/2,y:C-w/2,orientation:"horizontal"},left:{x:S/2,y:C/2,orientation:"vertical"},right:{x:E-b/2,y:C/2,orientation:"vertical"}},W=new Set(a);return o?W.add(o):i&&(W.add(i),c||W.add(Wu[i])),(0,Ou.jsxs)("div",{"data-devtools":"padding-handles","data-popmelt-steer-overlay":!0,style:F,children:[(0,Ou.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${E} ${C}`,children:[(0,Ou.jsxs)("defs",{children:[k?(0,Ou.jsx)("pattern",{id:j,patternUnits:"userSpaceOnUse",width:"4",height:"4",children:(0,Ou.jsx)("circle",{cx:"1",cy:"1",r:"0.65",fill:A})}):(0,Ou.jsx)("pattern",{id:j,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Ou.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:A,strokeWidth:"1.5"})}),D&&(0,Ou.jsx)("pattern",{id:_,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Ou.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:L,strokeWidth:"1.5"})})]}),(0,Ou.jsx)("rect",{x:M+.5,y:T+.5,width:Math.max(0,p-1),height:Math.max(0,h-1),fill:"none",stroke:I,strokeWidth:"1"}),$.map(e=>{if(t[e]<=0)return null;let n=W.has(e),r=N.has(e);return(0,Ou.jsxs)("g",{"data-padding-flow":r?"paint-only":"layout",opacity:n?1:.6,children:[(0,Ou.jsx)("polygon",{points:O[e],fill:r?P:R}),(0,Ou.jsx)("polygon",{points:O[e],fill:`url(#${r?_:j})`})]},e)}),N.has("top")&&x>0&&(0,Ou.jsx)("line",{x1:S,y1:x,x2:E-b,y2:x,stroke:z,strokeWidth:"1"}),N.has("bottom")&&w>0&&(0,Ou.jsx)("line",{x1:S,y1:C-w,x2:E-b,y2:C-w,stroke:z,strokeWidth:"1"}),N.has("left")&&S>0&&(0,Ou.jsx)("line",{x1:S,y1:x,x2:S,y2:C-w,stroke:z,strokeWidth:"1"}),N.has("right")&&b>0&&(0,Ou.jsx)("line",{x1:E-b,y1:x,x2:E-b,y2:C-w,stroke:z,strokeWidth:"1"}),$.map(e=>{let t=H[e];return(0,Ou.jsx)(Lu,{centerX:t.x,centerY:t.y,orientation:t.orientation,accentColor:N.has(e)?Bu:r,"data-padding-flow":N.has(e)?"paint-only":"layout"},`handle-${e}`)}),s&&$.map(e=>{let t=H[e];return(0,Ou.jsx)("rect",{x:t.x-10,y:t.y-10,width:20,height:20,fill:"transparent",style:{pointerEvents:"all",cursor:"grab"},onPointerDown:t=>s(e,t)},`hit-${e}`)})]}),l&&(i||o)&&(()=>{let e=o??i,n=Math.round(t[e]),a=N.has(e);return(0,Ou.jsxs)("div",{style:{position:"fixed",left:l.x+8,top:l.y-28,background:a?Bu: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 qu=u(d()),Yu=u(x()),Uu=["flex-start","center","flex-end"],Xu=["flex-start","center","flex-end"];function Ku(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 Qu({element:e,modifier:t,accentColor:n,refreshKey:r=0}){let[i,o]=(0,qu.useState)(null);if((0,qu.useEffect)(()=>{if(!e)return void o(null);let t=()=>o(Ku(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,qu.useLayoutEffect)(()=>{e&&o(Ku(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=Uu.indexOf(e);"horizontal"===c?(t>0&&f.push("left"),t<Uu.length-1&&f.push("right")):(t>0&&f.push("up"),t<Uu.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=Xu.indexOf(e);"horizontal"===d?(t>0&&f.push("left"),t<Xu.length-1&&f.push("right")):(t>0&&f.push("up"),t<Xu.length-1&&f.push("down"))}}return 0===f.length?null:(0,Yu.jsx)(Yu.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,Yu.jsx)("div",{"data-devtools":"swipe-hint",style:o,children:(0,Yu.jsx)("svg",{width:14,height:14,viewBox:"-7 -7 14 14",style:{overflow:"visible"},children:(0,Yu.jsxs)("g",{transform:`rotate(${i})`,children:[(0,Yu.jsx)("line",{x1:"-5",y1:"0",x2:"3",y2:"0",stroke:"#fff",strokeWidth:"4",strokeLinecap:"round"}),(0,Yu.jsx)("polyline",{points:"0,-4 5,0 0,4",fill:"none",stroke:"#fff",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Yu.jsx)("line",{x1:"-5",y1:"0",x2:"3",y2:"0",stroke:n,strokeWidth:"1.5",strokeLinecap:"round"}),(0,Yu.jsx)("polyline",{points:"0,-4 5,0 0,4",fill:"none",stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})},e)})})}var Gu=u(d()),Zu=u(x());function Ju({element:e,fontSize:t,lineHeight:n,accentColor:r,hoveredProperty:i,draggingProperty:o,cursorViewport:a}){let[l,s]=(0,Gu.useState)(null);if((0,Gu.useEffect)(()=>{if(!e)return void s(null);let t=()=>{s(Ai(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,Gu.useLayoutEffect)(()=>{e&&s(Ai(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,Zu.jsxs)("div",{"data-devtools":"text-handles",style:p,children:[(0,Zu.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${u} ${c}`,children:[(0,Zu.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,Zu.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,Zu.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,Zu.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 ec=u(x());function tc({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:v}){if(!e)return null;let x=p&&!h?Ri(p):null;return(0,ec.jsxs)(ec.Fragment,{children:[n&&(0,ec.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,ec.jsx)(Nu,{element:i,gap:o?{row:o.row,column:o.column}:wi(i),accentColor:t,hoveredAxis:a,draggingAxis:o?.axis??null,cursorViewport:r,isAutoGap:l,refreshKey:s}),u&&(0,ec.jsx)(Qu,{element:u.target,modifier:u.modifier,accentColor:t,refreshKey:s}),!u&&c&&(0,ec.jsx)(Au,{element:c,radius:d?.radius??Ti(c),accentColor:t,hoveredCorner:f,draggingCorner:d?.corner??null,cursorViewport:r}),!u&&p&&(0,ec.jsx)(Ju,{element:p,fontSize:h?.fontSize??x.fontSize,lineHeight:h?.lineHeight??x.lineHeight,accentColor:t,hoveredProperty:m,draggingProperty:h?.property??null,cursorViewport:r}),!u&&g&&(0,ec.jsx)(Vu,{element:g,padding:y?.padding??Ei(g),accentColor:t,hoveredSide:v,draggingSide:y?.side??null,cursorViewport:r,refreshKey:h?h.fontSize+1e3*h.lineHeight:0})]})}var nc=u(d()),rc=u(d()),ic=u(x());function oc({query:e,border:t,background:n,foreground:r,renderIcon:i}){return(0,ic.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,ic.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,ic.jsx)("span",{"data-popmelt-sticker-query-token":"label",style:{color:r,opacity:.72},children:e.label},`${e.label}-${t}`)),e.typed?(0,ic.jsx)("span",{children:e.typed}):(0,ic.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:0,color:r,opacity:.58,fontWeight:500},children:[(0,ic.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,ic.jsx)("span",{children:e.fallback})]}),e.completion&&(0,ic.jsx)("span",{style:{color:r,opacity:.62},children:e.completion}),e.fallback&&e.typed&&(0,ic.jsxs)("span",{style:{color:r,opacity:.68},children:["→ ",e.fallback]})]})}var ac=u(x()),lc=106,sc=32,uc="cubic-bezier(0.16, 1, 0.3, 1)",cc=[0,180,240,300];function dc(e,t,n=42,r=40,i=lc){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 fc(e,t,n,r=42,i=80,o=8,a=lc){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 pc={padding:"padding",margin:"margin",border:"border",radius:"radius",stack:"stack-vertical",grid:"grid",text:"text-size",color:"palette",transform:"transform-translate",opacity:"opacity"},hc={top:0,right:90,bottom:180,left:270},mc={"top-right":0,"bottom-right":90,"bottom-left":180,"top-left":270};function gc({name:e}){switch(e){case"padding":return(0,ac.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,ac.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,ac.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,ac.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,ac.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,ac.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,ac.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,ac.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,ac.jsx)(ac.Fragment,{children:(0,ac.jsx)("path",{d:"M4 1.25H8M4 10.75H8M1.25 8V4M10.75 8V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});case"radius":return(0,ac.jsx)(ac.Fragment,{children:(0,ac.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,ac.jsxs)(ac.Fragment,{children:[(0,ac.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,ac.jsx)("circle",{cx:"1.252",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"10.748",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"1.252",cy:"6",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"10.748",cy:"6",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"1.252",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"10.748",cy:"10.752",r:"0.748",fill:"currentColor"})]});case"gap-y":return(0,ac.jsxs)(ac.Fragment,{children:[(0,ac.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,ac.jsx)("circle",{cx:"1.248",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"1.248",cy:"1.252",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"6",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"6",cy:"1.252",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"10.752",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"10.752",cy:"1.252",r:"0.748",fill:"currentColor"})]});case"border-top":return(0,ac.jsxs)(ac.Fragment,{children:[(0,ac.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,ac.jsx)("circle",{cx:"10.748",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"6.625",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"10.748",cy:"6",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"10.748",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"6.625",cy:"1.248",r:"0.748",fill:"currentColor"})]});case"radius-top-right":return(0,ac.jsxs)(ac.Fragment,{children:[(0,ac.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,ac.jsx)("circle",{cx:"9.748",cy:"9.748",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"2.248",cy:"9.748",r:"0.748",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"2.248",cy:"2.248",r:"0.748",fill:"currentColor"})]});case"stack-vertical":case"stack-horizontal":return(0,ac.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,ac.jsxs)(ac.Fragment,{children:[(0,ac.jsx)("path",{d:"M1 2H11M2.5 5.25H9.5M4 8.5H8",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,ac.jsx)("path",{d:"M6 0.75V10.75",stroke:"currentColor",strokeWidth:"0.75",strokeDasharray:"1 2"})]});case"justify":return(0,ac.jsxs)(ac.Fragment,{children:[(0,ac.jsx)("path",{d:"M1 1.5V10.5M11 1.5V10.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,ac.jsx)("path",{d:"M3 3H9M3 6H9M3 9H9",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]});case"grid":return(0,ac.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,ac.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,ac.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 yc({family:e,size:t=12,step:n,subproperty:r="all"}){let i=function(e,t="all"){return Ws(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:pc[e],rotation:0}:"radius"===e?{name:"radius-top-right",rotation:mc[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)+(hc[t]??0)}}(e,r),o="text-size"===i.name?F:"text-weight"===i.name?te:"text-leading"===i.name?Z:"text-tracking"===i.name?J:"text-align"===i.name?X:"palette"===i.name?ye:"transform-translate"===i.name?pe:"transform-scale"===i.name?we:"transform-rotate"===i.name?be:"opacity"===i.name?re:"mix-blend"===i.name?ee:null;return o?(0,ac.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,ac.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,ac.jsx)(gc,{name:i.name})})}function vc({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,ac.jsxs)("div",{style:{position:"relative",width:96,height:32,overflow:"hidden"},children:[r&&(0,ac.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",left:sc,top:0,width:sc,height:sc,borderRadius:16,background:t.control}}),(0,ac.jsx)("div",{"data-popmelt-sticker-rail":!0,style:{position:"absolute",inset:0,transform:`translateX(${-e*sc}px)`,transition:"transform 250ms ease",willChange:"transform"},children:a.map(r=>{let a=r===e;return(0,ac.jsx)("span",{style:{position:"absolute",left:sc+r*sc,top:0,width:sc,height:sc,display:"flex",alignItems:"center",justifyContent:"center",color:a?i??t.primary:t.mutedStrong,transition:o?"none":`color 400ms ${uc}`},children:n(r,a)},r)})})]})}function xc({family:e,colors:t,showControl:n=!0,activeColor:r,snapActiveColor:i}){let o=(0,rc.useRef)(e),a=(0,rc.useRef)(e),[l,s]=(0,rc.useState)(0);return(0,rc.useLayoutEffect)(()=>{if(a.current===e)return;let t=function(e,t){let n=xs.indexOf(e),r=(xs.indexOf(t)-n+xs.length)%xs.length;return r<=xs.length/2?r:r-xs.length}(a.current,e);a.current=e,s(e=>e+t)},[e]),(0,ac.jsx)(vc,{offset:l,colors:t,showControl:n,activeColor:r,snapActiveColor:i,renderItem:(e,t)=>{let n=function(e,t){let n=(xs.indexOf(e)+t%xs.length+xs.length)%xs.length;return xs[n]}(o.current,e);return(0,ac.jsx)(yc,{family:n,subproperty:"all",size:t?14:12})}})}function bc({color:e,colors:t,showControl:n=!0}){let r=(0,rc.useRef)(e),i=(0,rc.useRef)(e),[o,a]=(0,rc.useState)(0);return(0,rc.useLayoutEffect)(()=>{if(i.current===e)return;let t=function(e,t){let n=us.indexOf(e),r=(us.indexOf(t)-n+us.length)%us.length;return r<=us.length/2?r:r-us.length}(i.current,e);i.current=e,a(e=>e+t)},[e]),(0,ac.jsx)(vc,{offset:o,colors:t,showControl:n,renderItem:(e,t)=>{let n=function(e,t){let n=us.indexOf(e);return us[(n+t%us.length+us.length)%us.length]}(r.current,e),i=t?14:12;return(0,ac.jsx)("span",{"aria-label":n,"data-popmelt-sticker-color":n,style:{width:i,height:i,borderRadius:"50%",background:ms(n,ds),boxShadow:"inset 0 0 0 1px rgb(0 0 0 / 0.08)",transition:"width 250ms ease, height 250ms ease"}})}})}function wc({name:e,size:t}){let n="align-start"===e?Q:"align-center"===e?O:"align-end"===e?H:"align-stretch"===e?Ce:"justify-start"===e?V:"justify-center"===e?W:"justify-end"===e?B:"justify-between"===e?Y:"justify-around"===e?q:"text-align-left"===e?X:"text-align-center"===e?$:"text-align-right"===e?K:"text-align-justify"===e?U:null;return n?(0,ac.jsx)(n,{"aria-hidden":"true","data-popmelt-sticker-step-icon":e,width:t,height:t,strokeWidth:2.25,style:{display:"block"}}):(0,ac.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,ac.jsxs)(ac.Fragment,{children:[(0,ac.jsx)("path",{d:"M1.5 10.5H12.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,ac.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,ac.jsxs)(ac.Fragment,{children:[(0,ac.jsx)("path",{d:"M1.5 2V12M12.5 2V12",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,ac.jsx)("rect",{x:"3.25",y:"4.75",width:"2",height:"4.5",rx:"1",fill:"currentColor"}),(0,ac.jsx)("rect",{x:"8.75",y:"4.75",width:"2",height:"4.5",rx:"1",fill:"currentColor"}),(0,ac.jsx)("circle",{cx:"7",cy:"7",r:"0.75",fill:"currentColor"})]})})}function Sc({family:e,step:t,subproperty:n,colors:r,showControl:i=!0,unavailable:o=!1,activeColor:a,snapActiveColor:l=!1}){let s=(0,rc.useRef)(t),u=(0,rc.useRef)(t),[c,d]=(0,rc.useState)(0);return(0,rc.useEffect)(()=>{if(u.current===t)return;let r=function(e,t,n,r="all"){let i=Us(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,ac.jsx)(vc,{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=Us(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,ac.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,ac.jsx)(wc,{name:a,size:r?14:12}):fu(i,e,n)})}})}function kc(e){return"family"===e?0:35}function Ec(e){return"family"===e?sc/24:1}function Cc(e){return"family"===e?14/(12*Ec(e)):1}function Mc(e,t,n){return`${e}:${t}:${n}`}function Tc(e,t,n){return!!Hs(n)&&("color"===e?"family"!==t:("text"===e||"border"===e)&&"value"===t)}function jc({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 Ws(t,n)?"family"===e?{family:0,variant:-32,value:-64}:"variant"===e?{family:sc,variant:0,value:-32}:{family:64,variant:sc,value:0}:"family"===e?{family:0,variant:-64,value:-32}:{family:sc,variant:-32,value:0}}(r,e,n),c=(0,rc.useRef)(r),d=(0,rc.useRef)(o),f=(0,rc.useRef)(a),[p,h]=(0,rc.useState)(!1),m=f.current!==a;(0,rc.useLayoutEffect)(()=>{f.current=a},[a]),(0,rc.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:sc,transform:`translateY(${e}px)`,transition:m?"none":"transform 250ms ease",willChange:"transform"});return(0,ac.jsxs)("div",{"data-popmelt-sticker-depth-rail":r,style:{position:"relative",width:96,height:40,marginBlock:-4,overflow:"hidden",zIndex:2},children:[(0,ac.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-depth-control":!0,style:{position:"absolute",left:sc,top:4,width:sc,height:sc,borderRadius:16,background:p?i:s.control,transition:p?"none":`background 400ms ${uc}`}}),(0,ac.jsx)("div",{"aria-hidden":"family"!==r,"data-popmelt-sticker-depth-row":"family",style:g(u.family),children:(0,ac.jsx)(xc,{family:e,colors:s,showControl:!1,activeColor:p?s.surface:s.primary,snapActiveColor:p})}),(0,ac.jsx)("div",{"aria-hidden":"variant"!==r,"data-popmelt-sticker-depth-row":"variant",style:g(u.variant),children:Ws(e,n)&&Hs(n)&&(0,ac.jsx)(bc,{color:n,colors:s,showControl:!1})}),(0,ac.jsx)("div",{"aria-hidden":"value"!==r,"data-popmelt-sticker-depth-row":"value",style:g(u.value),children:(0,ac.jsx)(Sc,{family:e,step:t,subproperty:n,colors:s,showControl:!1,unavailable:l,activeColor:p?s.surface:void 0,snapActiveColor:p},Mc(r,e,n))})]})}function Ac(e,t,n=42,r=lc){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 Rc(e,t,n){return n?0:Math.min(e,t)}function Ic({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]=tt(),y=Xe[g],v=`color-mix(in srgb, ${y.actionForeground} 16%, ${y.actionSurface})`,x=function(e,t){let n=Qs(e,t);return"color"===e||("text"===e||"border"===e)&&Hs(n)?n:`${function(e){return _s[e]}(e)}${Os[n]}`}(t,r),b=(0,rc.useRef)(t),w=(0,rc.useRef)(i),S=(0,rc.useRef)(r),k=(0,rc.useRef)(i),E=(0,rc.useRef)(a),C=(0,rc.useRef)(l),M=(0,rc.useRef)(u),T=(0,rc.useRef)(null),j=(0,rc.useRef)(!1),A=(0,rc.useRef)(!1),R=(0,rc.useRef)(0),I=(0,rc.useRef)(0),L=(0,rc.useRef)(0),P=(0,rc.useRef)(0),[z,N]=(0,rc.useState)(null),[D,_]=(0,rc.useState)(!1),[F,$]=(0,rc.useState)(!1),[O,H]=(0,rc.useState)(!1),[W,B]=(0,rc.useState)(null),[V,q]=(0,rc.useState)(!1),[Y,U]=(0,rc.useState)(0),[X,K]=(0,rc.useState)(!1),[Q,G]=(0,rc.useState)(!1);(0,rc.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,rc.useLayoutEffect)(()=>{let e=k.current!==i&&"family"!==i,t="value"===i&&E.current!==a;if(k.current=i,E.current=a,!e&&!t)return;K(!0);let n=window.requestAnimationFrame(()=>K(!1));return()=>window.cancelAnimationFrame(n)},[a,i]),(0,rc.useLayoutEffect)(()=>{let e="family"!==w.current&&"family"===i;w.current=i;let n=(e=!1)=>{R.current&&window.cancelAnimationFrame(R.current),e||window.clearTimeout(I.current),window.clearTimeout(L.current),window.clearTimeout(P.current),R.current=0,e||(I.current=0),L.current=0,P.current=0},r=e=>{let t=e?250:200;L.current=window.setTimeout(()=>{$(e),A.current=!1,_(!1)},750),P.current=window.setTimeout(()=>{j.current=!1,N(null)},750+t+34)};if("family"!==i){if(n(),b.current=t,!j.current)return;return $(!0),A.current=!1,_(!1),void(P.current=window.setTimeout(()=>{j.current=!1,N(null)},250))}if(b.current!==t||e){if(b.current=t,j.current=!0,N(t),e)return n(),$(!1),H(!0),A.current=!0,_(!0),I.current=window.setTimeout(()=>{I.current=0,H(!1)},250),void r(!1);I.current||(n(!0),H(!1),$(!1),A.current||(A.current=!0,_(!0)),r(!1))}},[t,i]),(0,rc.useEffect)(()=>()=>{window.cancelAnimationFrame(R.current),window.clearTimeout(I.current),window.clearTimeout(L.current),window.clearTimeout(P.current)},[]),(0,rc.useEffect)(()=>{let e=C.current!==l;if(C.current=l,!function(e,t,n="all"){return"value"===t||Ws(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=eu(e),r=tu(e,t);return r===n?n:`${n} ${r}`}(t,r):tu(t,r));let n=window.setTimeout(()=>{B(null),q(!1)},750);return()=>window.clearTimeout(n)},[l,t,i,r]),(0,rc.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,rc.useMemo)(()=>Ac(e,p?.viewport??{width:typeof window>"u"?lc:window.innerWidth,height:typeof window>"u"?42:window.innerHeight},te),[te,e,p?.viewport]),re=f?dc(ne,f.getBoundingClientRect(),te):1,ie=h?fc(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+lc<=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,fc(e,ne,n,te,40)),1)??1,le=Rc(Math.min(re,ae),ie,m),se=oe?.top??ne.top,ue={position:"fixed",left:ne.left,top:se,width:lc,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:Fe,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,ac.jsxs)("div",{role:"status","aria-label":d?`Sticker search: ${ce||"search tokens"}`:`Sticker ${i}: ${"family"===i?t:"variant"===i?x:`${n} ${x}`}`,"data-devtools":"sticker-hud","data-popmelt-sticker-hud":!0,"aria-hidden":m||void 0,style:ue,children:[(0,ac.jsx)("style",{children:`@keyframes popmeltStickerReject {\\n ${ho}\\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,ac.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-wheel-shell":!0,style:{position:"absolute",inset:1,borderRadius:21,background:y.surface,zIndex:1}}),(0,ac.jsx)(jc,{family:t,step:n,subproperty:r,stage:i,accentColor:o,applyPulse:a,snapPulse:s,stepUnavailable:c,colors:y}),!d&&(0,ac.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:(lc-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 ${v}`,borderRadius:12,background:y.actionSurface,color:y.actionForeground,transform:`translateY(${kc(i)}px) scale(${Ec(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,ac.jsx)("span",{style:{display:"block",transform:`scale(${Cc(i)})`,transition:"transform 250ms ease",transformOrigin:"center"},children:Tc(t,i,r)?(0,ac.jsx)("span",{"data-popmelt-sticker-color-context":r,style:{display:"block",width:12,height:12,borderRadius:"50%",background:ms(r,"value"===i?n:ds),boxShadow:"inset 0 0 0 1px rgb(255 255 255 / 0.16)"}}):(0,ac.jsx)(yc,{family:t,subproperty:"text"===t&&"variant"===i&&Hs(r)?"color":r})}),(0,ac.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,ac.jsx)(oc,{query:d,border:v,background:y.actionSurface,foreground:y.actionForeground,renderIcon:e=>(0,ac.jsx)(yc,{family:e.family,subproperty:e.subproperty,size:12})}),(0,ac.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-depth-burst":!0,style:{position:"absolute",left:37,top:5,width:sc,height:sc,overflow:"visible",pointerEvents:"none",zIndex:3},children:cc.map(e=>(0,ac.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,ac.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:D?1:0,transform:`translate(-50%, ${F?-35:0}px) scale(${F?.9:1})`,transformOrigin:"center",transition:"transform 250ms ease, opacity 200ms ease",animation:D&&O?"popmeltStickerFamilyLabelEnter 250ms ease":void 0,border:`1px solid ${v}`,borderRadius:12,background:y.actionSurface,color:y.actionForeground,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",willChange:"transform, opacity",zIndex:0},children:eu(z)})]})}function Lc(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 Pc(e,t){let n=e.get(t);return!!n&&(clearTimeout(n),e.delete(t),!0)}function zc(e,t,n){return null!==e&&e.selector===t&&e.expandedIndices.includes(n)}function Nc(e,t){return e?.selector===t?null:e}function Dc({selector:e,label:t,tokens:n}){return JSON.stringify([e,t,n])}function _c({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 Fc=u(x());function $c({cursor:e,stepCount:t,accentColor:n,toolbarElement:r,threadElement:i}){let[o]=tt(),a=Xe[o],[l,s]=(0,nc.useState)(!1);(0,nc.useEffect)(()=>{s(!1);let e=window.setTimeout(()=>s(!0),1e3);return()=>window.clearTimeout(e)},[t]);let u={width:window.innerWidth,height:window.innerHeight},c=Lc(t,!1),d=Ac(e,u,22,c.width),f=r?dc(d,r.getBoundingClientRect(),22,void 0,c.width):1,p=i?fc(e,d,i.getBoundingClientRect(),22,void 0,void 0,c.width):1,h=Math.min(f,p)<1||l,m=Lc(t,h),g=Ac(e,u,22,m.width),y=Rc(r?dc(g,r.getBoundingClientRect(),22,void 0,m.width):1,i?fc(e,g,i.getBoundingClientRect(),22,void 0,void 0,m.width):1,!1),v={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,Fc.jsxs)("div",{role:"status","aria-label":`${m.label}. ${m.accessibleShortcut}`,"data-devtools":"interaction-episode-hud","data-popmelt-interaction-episode-hud":!0,style:v,children:[(0,Fc.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:$e,lineHeight:1.2},children:m.label}),(0,Fc.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:Fe,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,Fc.jsx)(Te,{size:12,strokeWidth:2}):(0,Fc.jsxs)("span",{"data-popmelt-interaction-episode-complete-shortcut":!0,style:{display:"inline-flex",alignItems:"center",gap:2},children:[(0,Fc.jsx)(oe,{size:12,strokeWidth:2}),(0,Fc.jsx)("span",{children:"+"}),(0,Fc.jsx)(le,{size:12,strokeWidth:2})]}):(0,Fc.jsxs)(Fc.Fragment,{children:[(0,Fc.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:[(0,Fc.jsx)(oe,{size:12,strokeWidth:2}),(0,Fc.jsx)("span",{children:"+"}),0===t?(0,Fc.jsx)("span",{children:"esc"}):(0,Fc.jsx)(le,{size:12,strokeWidth:2})]}),(0,Fc.jsx)("span",{style:{color:a.secondary},children:"to"}),0===t?(0,Fc.jsx)(Te,{size:12,strokeWidth:2,color:"red"}):(0,Fc.jsx)(ne,{size:12,strokeWidth:2,color:"#02bd02"})]})})]})}function Oc(e,t){return"string"==typeof t.canvasLabel?t.canvasLabel:[e,t.modified].filter(Boolean).join(" ")}function Hc(e){return function(e,t=96){let n=e.replace(/\\s+/g," ").trim();return n.length>t?`${n.slice(0,Math.max(0,t-3))}...`:n}(e,512)||"Empty text"}var Wc=u(d()),Bc=u(d()),Vc=["reviewing","considering","thinking","zhuzhing","iterating","tweaking","reflecting","noodling","pondering","finessing","polishing","riffing"];function qc(e){return e.isInFlight?"#888888":e.comment?!1===e.comment.pending?"#888888":e.threadAccentColor:e.isInFlight||e.hasThreadState||e.hasStickers?"#888888":e.accentColor}function Yc(e,t,n){if(t)return e?t.jobId===n?t:void 0:t}function Uc(e){if(e.awaitingReview)return{jobId:`suggestion:${e.awaitingReview.submissionId}`,threadId:e.awaitingReview.threadId,status:"awaiting_review",selectors:[e.selector],annotationNumber:e.annotationNumber}}function Xc(e){return e.selection?`${e.selection.family}:${e.selection.subproperty}`:`custom:${e.custom.property}`}function Kc(e,t){return!e||!!t}function Qc(e){return e.sticker?{token:e.sticker.axisSteps?`translate-x-${e.sticker.axisSteps.x}-y-${e.sticker.axisSteps.y}`:uu(e.sticker.family,e.sticker.step,e.sticker.subproperty),selection:e.sticker}:{token:e.modified,custom:{property:e.property,value:e.modified}}}function Gc(e){let t=[];for(let n of e){let e=Qc(n);t.some(t=>Xc(t)===Xc(e))||t.push(e)}return t}var Zc=u(x());function Jc({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,Zc.jsx)(yc,{...t});let a=/(^|-)color$|^(fill|stroke)$/.test(e)?ye:/(^|-)(width|inline-size)$/.test(e)?he:/(^|-)(height|block-size)$/.test(e)?me:ke;return(0,Zc.jsx)(a,{"aria-hidden":"true","data-popmelt-property-icon":e,size:12,strokeWidth:2.5,style:{display:"block"}})}function ed({chip:e}){return e.selection?(0,Zc.jsx)(yc,{...e.selection}):(0,Zc.jsx)(Jc,{property:e.custom.property})}var td=u(x());function nd(e){return e.comment?.threadState??e.threadState}function rd(e,t){let n=e.stickers.map(e=>e.token).join(""),r=e.comment?.text??e.label,i=oa(r,n=>7.2*(t&&!e.comment?e.hoverName??n:n).length);return Math.min(720,44+("string"==typeof r?i:Math.min(i,400))+7.2*n.length)}function id(e,t){return t||!1===e?.pending?0:e?.imageCount??0}function od(e,t,n,r,i,o){let a=`max(0px, ${e}px)`,l="calc(100vw - 100%)";return`translate3d(${"right"===n?`clamp(0px, calc(${a} - 100% + ${r}px), ${l})`:`min(${a}, ${l})`}, min(max(0px, ${t}px, ${void 0!==i?`${i}px`:"0px"}), calc(${void 0!==o?`${o}px`:"100dvh"} - 100%)), 0)`}function ad(e){return e.width>0&&e.height>0&&e.left<window.innerWidth&&e.top<window.innerHeight&&e.left+e.width>0&&e.top+e.height>0}function ld({scrollAnchor:e,priority:t,target:n,bounds:r,left:i,top:o,avoidTop:a,avoidBottom:l,anchor:s,horizontalAlignment:u="left",visualRef:c,suppressed:d=!1,style:f,children:p,...h}){let m=Xo(n)??n,[g,y]=(0,Wc.useState)(null);(0,Wc.useEffect)(()=>{if(!m||typeof IntersectionObserver>"u")return;let e=new IntersectionObserver(e=>{let t=e[e.length-1];t&&y({target:t.target,visible:t.isIntersecting&&t.intersectionRect.width>0&&t.intersectionRect.height>0})},{threshold:[0,1e-5]});return e.observe(m),()=>e.disconnect()},[m]);let v="intent"===t||r.height<window.innerHeight||o+22>0&&o<window.innerHeight,x=!d&&v&&ad(r)&&(!m||typeof IntersectionObserver>"u"||(g?.target===m?g.visible:"intent"===t)),b=function(e){let t=e.startsWith("top-");return{top:t?4:12,right:4,bottom:t?12:4,left:4}}(s),w=i-b.left,S=o-b.top;return(0,td.jsx)("div",{part:e?ni:void 0,"data-devtools":"badge-hit-area","data-popmelt-rail-priority":t,...h,inert:!x||void 0,"aria-hidden":!x||void 0,style:{position:"fixed",...ai(e,r,0,0),padding:`${b.top}px ${b.right}px ${b.bottom}px ${b.left}px`,transform:od(w,S,u,b.left+b.right,a,l),...f,opacity:x?1:0,pointerEvents:x?f?.pointerEvents:"none"},children:(0,td.jsx)("div",{ref:c,children:p})})}function sd({activeCommentInput:e,children:t,...n}){let r=(0,Wc.useRef)(null),[i,o]=(0,Wc.useState)(),{left:a,horizontalAlignment:l}=n,{left:s,width:u}=n.bounds,c=(0,Wc.useCallback)(()=>{let t=r.current,n=e?.current;if(!n||!t)return void o(void 0);let i=t.getBoundingClientRect(),c=n.closest(\'[data-popmelt-rail-priority="history"]\')?.firstElementChild??n,d=n.closest(\'[data-devtools="annotation-composer"]\')?.querySelector(\'[data-devtools="badge-hit-area"][data-popmelt-active-annotation-surface]\')?.firstElementChild,f=[c,d].flatMap(e=>{let t=e?.getBoundingClientRect();return t&&t.width>0&&t.height>0&&t.top<i.bottom&&t.bottom>i.top?[t]:[]}),p=t.querySelector("[data-popmelt-component-name]"),h=p?.closest(\'[data-devtools="steer-element-identifier"]\');if(!f.length||!p||!h)return void o(f.some(e=>va(i,e))?null:void 0);let m=i.width-h.getBoundingClientRect().width,g=Math.ceil(p.getBoundingClientRect().width+12),y=p.nextElementSibling,v=y?.firstElementChild?p.scrollWidth+("true"===y.ariaHidden?0:y.firstElementChild.scrollWidth):p.parentElement.scrollWidth,x=Math.min(400,Math.max(g,v+12))+m,b=function(e,t,n,r,i){let o=window.innerWidth-4,a=(e,n,r)=>Math.max(e,Math.min(t,n-r)),l=a(4,o,n);if(!i.some(e=>l<e.right&&l+n>e.left))return;let s=null;function u(i,o){if(e.left>=o||e.left+e.width<=i)return;let l=Math.max(i,e.left),u=o-l>=r,c=Math.min(n,Math.floor(o-(u?l:i)));if(c<r||c<=0)return;let d=u?l:a(i,o,c);(!s||c>s.width||c===s.width&&Math.abs(d-t)<Math.abs(s.left-t))&&(s={left:d,width:c})}let c=4;for(let e of[...i].sort((e,t)=>e.left-t.left))u(c,Math.min(o,e.left-2)),c=Math.max(c,e.right+2);return u(c,o),s}({left:s,width:u},"right"===l?a-x:a,x,Math.min(x,g+m),f),w=b&&{left:b.left,width:b.width-m};o(e=>e&&w&&e.left===w.left&&e.width===w.width?e:w)},[e,s,u,l,a]),d=(0,Wc.useRef)(c);(0,Wc.useLayoutEffect)(()=>{d.current=c,(e||void 0!==i)&&c()}),(0,Wc.useLayoutEffect)(()=>{let t=e?.current;if(t)return ra(t,()=>d.current())},[e]);let f=e&&i,p=f&&f.left>=s?n.anchor.startsWith("top")?"top-left":"bottom-left":n.anchor;return(0,td.jsx)(ld,{...n,priority:"intent",anchor:p,visualRef:r,left:f?f.left:a,horizontalAlignment:f?"left":l,suppressed:!(!e||null!==i),style:{...n.style,"--popmelt-hover-label-width":f?`${f.width}px`:void 0},children:t(p)})}function ud({historyPreview:e,targetDocument:t,subjectRegistry:n,projectedTargets:r,readOnly:i=!1,focusedSelector:o,threadAccessory:a,styleModifications:l,textModifications:s,sampleTargets:u,stagedComments:c,accentColor:d,annotationNumberBySelector:f,inFlightSelectors:p,inFlightAnnotationIds:h,activeAnnotationIds:m,inFlightSelectorJobIds:g,canvasApprovals:y,inFlightSelectorColors:v,toolbarRef:x,onHoverSelector:b,sendHintSelector:w,pendingBundleCount:S=1,onHoverSendBundle:k,onSend:E,onSelectSticker:C,onDeleteSticker:M,threadStates:T,onViewThread:j,hoveredElement:A,hoveredElementInfo:R,showHoverIdentifier:I=!1,showHoverStyles:L=!0,activeCommentInput:P,hoverRailAction:z,onEditComment:N,onDeleteComment:D,onDeletePeerComment:_,onDeletePeerStyles:F,onDiscardPlacedSample:$,onDiscardTextChanges:O,onArchiveThread:H,onClearInteractionEpisode:W,onEditSubject:B,onDeleteSubject:V,onHoverSubjectLabel:q,activeCommentEntry:Y,refreshKey:U}){let X=(0,Wc.useContext)(li),K=(0,Wc.useContext)(Ur),[Q,G]=(0,Wc.useState)([]),[Z,J]=(0,Wc.useState)(null),[ee,te]=(0,Wc.useState)(null),[ne,re]=(0,Wc.useState)(()=>new Map),oe=(0,Wc.useRef)(new Map),ae=(0,Wc.useRef)(new Map),le=(0,Wc.useRef)(new Map),se=(0,Wc.useRef)(new Map),ue=(0,Wc.useRef)(new Map),de=(0,Wc.useRef)(new Map),fe=(0,Wc.useCallback)(e=>{Pc(ue.current,e)},[]),pe=(0,Wc.useCallback)(e=>{!function(e,t,n,r=1e3){Pc(e,t),e.set(t,setTimeout(()=>{e.delete(t),n()},r))}(ue.current,e,()=>{te(t=>t===e?null:t),J(t=>t?.selector===e?null:t)})},[]),he=(0,Wc.useCallback)((e,t,n)=>{J(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}))},[]),me=(0,Wc.useCallback)(e=>!(!e||!0!==e.inFlight&&!h?.has(e.id)),[h]),ye=(0,Wc.useCallback)(e=>{if(e.comment&&m){if(m.has(e.comment.id))return!0;if(me(e.comment))return!1}return!!p?.has(e.selector)},[m,me,p]),ve=(0,Wc.useCallback)((e,t)=>{if(!y)return;let n=e.comment,r=n&&y.byAnnotation.get(n.id);if(r)return r;if(n?.pending)return;let i=n?.threadId??t?.threadId;if(i)return y.threadIds.has(i)?i:void 0;if(!n&&!e.hasPendingChanges){let t=g?.get(e.selector);if(t)return y.byJob.get(t)?.threadId}},[y,g]),be=(0,Wc.useCallback)((e,t)=>!ye(e)&&(me(e.comment)||"in_flight"===t?.status),[ye,me]),we=(0,Wc.useCallback)(e=>{let t=Yc(e.hasPendingChanges,nd(e),g?.get(e.selector));return ve(e,t)?"approval":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:ye(e),isQueued:be(e,t),threadStatus:t?.status})},[ve,ye,be,g]),Se=Q.filter(e=>e.hasPendingChanges||!!nd(e)||"draft"!==we(e)).map(e=>Dc({selector:e.selector,label:ia(e.label),tokens:[...e.stickers.map(e=>e.token),..."draft"===we(e)?[]:[`status:${we(e)}`]]})).join("|");(0,Wc.useLayoutEffect)(()=>{let e=new Set,t=new Map,n=new Set,r=new Set;for(let i of Q){let o=nd(i),a=we(i);if(!i.hasPendingChanges&&!o&&"draft"===a)continue;e.add(i.selector);let l=Dc({selector:i.selector,label:ia(i.label),tokens:[...i.stickers.map(e=>e.token),..."draft"===a?[]:[`status:${a}`]]});if(oe.current.get(i.selector)===l)continue;oe.current.set(i.selector,l);let s=le.current.get(i.selector);le.current.set(i.selector,a),"working"===a&&"working"!==s&&r.add(i.selector);let u=ae.current.get(i.selector),c=new Map,d=null;for(let e of i.stickers){let t=Xc(e);c.set(t,e.token),u?.get(t)!==e.token&&(d=t)}if(ae.current.set(i.selector,c),!i.hasPendingChanges&&(void 0===s||"draft"===s&&"queued"!==a&&"working"!==a)){let e=se.current.get(i.selector);e&&clearTimeout(e),se.current.delete(i.selector),n.add(i.selector);continue}t.set(i.selector,d);let f=se.current.get(i.selector);f&&clearTimeout(f),se.current.set(i.selector,setTimeout(()=>{re(e=>{if(!e.has(i.selector))return e;let t=new Map(e);return t.delete(i.selector),t}),se.current.delete(i.selector)},1e3))}for(let[t,n]of se.current)e.has(t)||(clearTimeout(n),se.current.delete(t),oe.current.delete(t),ae.current.delete(t),le.current.delete(t));r.size>0&&J(e=>e&&r.has(e.selector)?null:e),re(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})},[Q,Se,we]),(0,Wc.useEffect)(()=>()=>{for(let e of se.current.values())clearTimeout(e);se.current.clear();for(let e of ue.current.values())clearTimeout(e);ue.current.clear(),oe.current.clear(),ae.current.clear(),le.current.clear()},[]);let ke=p&&p.size>0||m&&m.size>0,{charIndex:Ee,word:Ce}=function(e){let t=(0,Bc.useContext)(li),[n,r]=(0,Bc.useState)(0),[i,o]=(0,Bc.useState)(()=>Math.floor(Math.random()*Vc.length));return(0,Bc.useEffect)(()=>{if(!e||!t)return;let n=setInterval(()=>r(e=>(e+1)%3),250),i=setInterval(()=>o(e=>(e+1)%Vc.length),3e3);return()=>{clearInterval(n),clearInterval(i)}},[e,t]),{charIndex:n,word:Vc[i]}}(!!ke);(0,Wc.useEffect)(()=>{if(!X)return;let e=null,i=!1,o=t??document,a=Ml([...(u??[]).map(e=>e.subject?.canvasSelector??e.selector),...c.flatMap(e=>[e.selector,e.element.selector]),...l.flatMap(e=>[e.selector,e.element.selector]),...s.flatMap(e=>[e.selector,e.element.selector]),...Array.from(T??[]).flatMap(([e,t])=>t.selectors??[e])]),d=(e,t)=>r?null:kn(e,t,o),p=()=>{let e=[],i=new Map,a=e=>(i.has(e)||i.set(e,r?null:t?(e=>{try{let t=o.querySelectorAll(e);return 1===t.length?t[0]:null}catch{return null}})(e):Rn(e)),i.get(e)),p=new Map;for(let e of c)p.set(e.selector,{selector:e.selector,element:e.element,styleChangeCount:0,textChangeCount:0,hasPendingChanges:!1!==e.pending,stickers:[],comment:e});for(let e of l){let t=p.get(e.selector),n=[...t?.stickers??[]];if(Kc(e.captured,g?.get(e.selector)))for(let t of Gc(e.changes)){let e=Xc(t);n.some(t=>Xc(t)===e)||n.push(t)}p.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:Uc(e)??t?.threadState,stickers:n,comment:t?.comment})}for(let e of s){let t=p.get(e.selector);p.set(e.selector,{selector:e.selector,element:t?.element??e.element,styleChangeCount:t?.styleChangeCount??0,textChangeCount:1,modifiedText:Oc(t?.modifiedText,e),hasPendingChanges:(t?.hasPendingChanges??!1)||!e.captured,stickers:t?.stickers??[],threadState:t?.threadState,comment:t?.comment})}for(let e of u??[]){let t=a(e.subject?.canvasSelector??e.selector);if(!t||t.localName!==(e.elementTag??"canvas").toLowerCase())continue;let r=e.subject&&n?.resolve(e.subject);if(e.subject&&r?.subject.sourceElement!==t)continue;let i=r?.element??t,o=p.get(e.selector);p.set(e.selector,{selector:e.selector,element:r?.elementInfo??Hn(i),styleChangeCount:0,textChangeCount:0,stickers:[],...o,resolvedElement:i,sampleLabel:e.elementTag?"Placed "+e.elementTag:e.subject?.inserted?"Placed "+r?.subject.label:r?"Sampled "+r.subject.label:"Sampled canvas",hasPendingChanges:!0})}let h=new Set,m=new Set,y=new Set;for(let e of p.values()){let t=e.comment?.threadState;t?.threadId&&m.add(t.threadId),t?.targetBindingId&&y.add(t.targetBindingId)}for(let[e,t]of p){let n=t.resolvedElement??d(e,t.element);n&&(t.resolvedElement=n),n&&h.add(n)}for(let[e,t]of T??[]){if(r||m.has(t.threadId)||t.targetBindingId&&y.has(t.targetBindingId))continue;let n=Sn(t.selectors??[e],t.targetFingerprint,o);if("matched"!==n.status)continue;let{element:i}=n,a=t.selectors?.[0]??e;!i||h.has(i)||(h.add(i),p.set(a,{selector:a,element:{...Hn(i),selector:a},styleChangeCount:0,textChangeCount:0,hasPendingChanges:!1,stickers:[],resolvedElement:i,threadState:t}))}Array.from(p.values()).forEach(t=>{let n=t.transientElement??t.resolvedElement??d(t.selector,t.element),i=r?.get(t.selector);if(!n&&!i)return;let o=function(e){return e.textChangeCount>0&&0===e.styleChangeCount?{label:Hc(e.modifiedText??"")}:{label:e.elementLabel}}({elementLabel:aa(t.element),styleChangeCount:t.styleChangeCount,textChangeCount:t.textChangeCount,modifiedText:t.modifiedText}),l=t.comment?.threadState??t.threadState??(T?al(t.selector,T,a):void 0);e.push({threadState:l,selector:t.selector,label:t.threadState?.title?.trim()||t.sampleLabel||o.label,annotationNumber:t.transientElement?void 0:t.comment?.annotationNumber??l?.annotationNumber??f.get(t.selector),domElement:n,projectedRect:i,hasPendingChanges:t.hasPendingChanges,hasElementChanges:!!t.sampleLabel||t.styleChangeCount>0||t.textChangeCount>0,stickers:t.stickers,transient:!!t.transientElement,comment:t.comment})}),G(t=>function(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.selector===r.selector&&typeof e.label==typeof r.label&&ia(e.label)===ia(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&&Xc(e)===Xc(n)})})}(t,e)?t:e)},h=()=>{i||null!==e||(e=requestAnimationFrame(()=>{e=null,p()}))};if(p(),r)return;window.addEventListener("resize",h,!0);let m=new MutationObserver(h);m.observe(o.body,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:a.identityAttributes}),window.addEventListener("load",h),o.fonts?.ready?.then(h);let y=[...l,...s].some(e=>e.selector.startsWith("@frame("))||c.some(e=>e.selector.startsWith("@frame("))?xi(h):void 0;return()=>{i=!0,y?.(),window.removeEventListener("resize",h,!0),window.removeEventListener("load",h),m.disconnect(),e&&cancelAnimationFrame(e)}},[X,f,u,n,c,l,s,T,g,t,r]);let Te=L?z?.spotlight?"compact":"expanded":"waiting",je="expanded"!==Te,Ae=R&&aa(R),Re=R?ia(aa(R,!0)):void 0,Ie=z?.compactIdentifier?Q.filter(e=>e.domElement!==A):void 0!==Re&&A?Q.map(e=>e.domElement!==A||"string"==typeof e.label&&e.label!==Ae?e:{...e,hoverName:Re}):Q,Le=I&&(!ee||z)&&A&&Ae&&R?.selector&&!Ie.some(e=>e.domElement===A)?{selector:R.selector,label:Ae,hoverName:Re,annotationNumber:void 0,domElement:A,hasPendingChanges:!1,hasElementChanges:!1,stickers:[],transient:!0}:null,Pe=Le?[...Ie,Le]:Ie,ze=e?Q.filter(t=>ye(t)&&(t.comment?.threadId??nd(t)?.threadId)===e.id):[],Ne=e&&(0,td.jsx)(Ba,{entry:e,color:e.marker?.color??d,subjectRegistry:n,hasAnnotationLabel:e=>ze.some(t=>t.domElement===e)});if(!Pe.length)return Ne??null;let _e=X?x?.current?.getBoundingClientRect():void 0,Fe=!!_e&&_e.top<window.innerHeight/2,$e=_e?{avoidTop:Fe?_e.bottom+8:void 0,avoidBottom:Fe?void 0:_e.top-8,avoidLeft:_e.left-8,avoidRight:_e.right+8}:{},Oe=e=>A&&e.domElement===A?z:void 0,He=e=>i&&R?e.domElement===A:!(!e.domElement||!function(e,t){return!(!t||e!==t&&!e.contains(t))}(e.domElement,A)),We=e=>a?.threadId&&a.threadId===(e.comment?.threadId??nd(e)?.threadId)?a:void 0,Be=e=>K?.preview&&K.preview.threadId===(e.comment?.threadId??nd(e)?.threadId),Ve=e=>{let t,n=Yc(e.hasPendingChanges,nd(e),g?.get(e.selector)),r=ve(e,n),i=ye(e),o=!r&&be(e,n),a=e.comment?.awaitingReview||"awaiting_review"===n?.status;return r?t="Approval needed":a?t="Awaiting review":i?t=Ce||"Thinking":o?t="Queued":"waiting_input"===n?.status?t="Question":"failed"===n?.status?t="Failed":n&&(t=n.label??"Replied"),{threadState:n,isInFlight:i,isQueued:o,awaitingReview:a,approvalThread:r,statusLabel:t}},qe=e=>{let t=Y?.element===e.domElement,{threadState:n,isInFlight:r,statusLabel:i}=Ve(e);return(t?Y.width+(Y.trailingWidth??0)+rd(e,je):rd(e,je)+Ol(id(e.comment,r||!!n))+ko(e.comment?.interactionEpisodeStepCount??0))+(We(e)?.width??(i?28+7.2*i.length:0))+(Oe(e)?.width??0)+(Be(e)?30:0)},Ye=Pe.find(e=>Oe(e)),Ue=z?.spotlight&&Ye?[Ye]:Pe,Xe=ze[0]??Ye??Pe.find(e=>e.transient)??Pe.find(e=>He(e)||ee===e.selector||Z?.selector===e.selector)??(i?Pe.find(e=>e.selector===o):void 0),Ke=(()=>{if(!Xe)return null;let e=Xe.projectedRect,t=e?{...e,right:e.left+e.width,bottom:e.top+e.height}:Xe.domElement?ut(Xe.domElement):void 0;if(!t||!ad(t))return null;let n=qe(Xe);return ya(xa(t,22,2,window.innerHeight,n,window.innerWidth),n,22)})(),Qe=sa(d),Ge=ua;return(0,td.jsxs)(td.Fragment,{children:[(0,td.jsx)("style",{dangerouslySetInnerHTML:{__html:\'\\n[data-devtools="badge-hit-area"]:where(:not([data-popmelt-rail-priority="intent"])) {\\n transition: opacity 160ms ease-out;\\n}\\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 [data-devtools="badge-hit-area"],\\n .popmelt-collapsible-badge-detail {\\n transition: none;\\n }\\n}\\n\'}}),Ne,Ue.map(e=>{let t=We(e),r=Oe(e),a=Y?.element===e.domElement,{threadState:c,isInFlight:f,isQueued:h,awaitingReview:g,approvalThread:y,statusLabel:x}=Ve(e),T=y??e.comment?.threadId??c?.threadId,R=function(e,t,n,r){return t?r?.get(e)??n:n}(e.selector,f,d,v),I=function(e,t,n){return n?.color?n.color:!1===t?.pending&&(t.threadState||t.awaitingReview)?t.color:e}(R,e.comment,nd(e)),L=f||h,z=function(e,t){return t?"#888888":e}(I,L),X=He(e)||ze.includes(e),K=ee===e.selector,Q=ne.has(e.selector),G=ne.get(e.selector),re=!!c||!1===e.comment?.pending,oe=_c({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:f,hasThreadState:re,isHovered:i&&o===e.selector||X||K||zc(Z,e.selector,0),hasTimedReveal:Q,isRevealedSticker:!1}),ae=e.stickers.length+1,le=_c({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:f,hasThreadState:re,isHovered:zc(Z,e.selector,ae),hasTimedReveal:Q,isRevealedSticker:!1}),se=_c({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:L,hasThreadState:re,isHovered:i&&o===e.selector||X||K||zc(Z,e.selector,ae),hasTimedReveal:Q,isRevealedSticker:Q||!!y}),ue=qe(e),ye=(a?Y.imageCount:id(e.comment,f||!!c))??0,ve=e.stickers.length>0||ye>0,be=function({hasCommentEntry:e,stagedChangeCount:t}){return e&&0===t?2:6}({hasCommentEntry:a||!!e.comment,stagedChangeCount:e.stickers.length+ +(ye>0)}),we=!!x,Se=!we&&e.selector===w,ke=!(!r||!ve||t||we||Be(e)||Se),Ce=!a&&!r&&oe.annotationCollapsed&&se.stickerCollapsed&&le.sendCompact&&!Q&&Z?.selector!==e.selector,je=Ce?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:we,hasSend:Se,controlGap:be})+Ol(ye)+(Be(e)?28+be:0):ue;return(0,td.jsx)(Ea,{element:e.domElement,projectedRect:e.projectedRect,onRemove:e.comment&&_?()=>_(e.comment.id):F&&l.some(t=>t.selector===e.selector)?()=>F(l.filter(t=>t.selector===e.selector)):void 0,onActivate:e.comment?.threadId||c?.threadId?()=>j?.(e.comment?.threadId??c?.threadId):void 0,hideOutline:!(i&&Xe===e),tintHoveredSubject:i&&A===e.domElement&&Xe===e,spotlight:r?.spotlight,color:I,fillOpacity:.1,outlineZIndex:10002,subjectRegistry:n,hideTooltip:!0,railGap:2,railWidth:ue,refreshKey:U,renderRail:(o,v,w)=>{let A=!1;if(Ce&&Xe!==e&&Ke){let t=de.current.get(e.selector)?.getBoundingClientRect();A=va(t?.width?t:ya(o,ue,22),Ke)}if(!a&&Xe!==e&&Ke&&va(ya(o,je,22),Ke))return null;let R="right"===o.horizontalAlignment?o.left-ue:o.left,L=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:{}}($e,R,ue);if(e.transient){let t=!i&&e.domElement?Jn(e.domElement):null,a=!t||n&&!n.hasLabelActions(t)?null:t;return(0,td.jsx)(sd,{scrollAnchor:w,target:e.domElement,bounds:v,activeCommentInput:P,"data-popmelt-hover-action-rail":!!r||void 0,"data-popmelt-subject-label-action":a?"true":void 0,"data-popmelt-subject-adapter":a?.adapter,"data-popmelt-subject-key":a?.key,left:o.left,top:o.top,avoidTop:L.avoidTop,avoidBottom:L.avoidBottom,anchor:o.anchor,horizontalAlignment:o.horizontalAlignment,style:{zIndex:r?.spotlight?10002:10001,pointerEvents:a||r?"auto":"none",cursor:a?"pointer":void 0},onPointerDown:e=>{a&&e.stopPropagation()},onClick:e=>{a&&(e.preventDefault(),e.stopPropagation(),B?.(a))},onContextMenu:e=>{a&&(e.preventDefault(),e.stopPropagation(),V?.(a))},onMouseEnter:()=>{a&&q?.(a)},onMouseLeave:()=>q?.(null),children:t=>(0,td.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:2},children:[(0,td.jsx)("div",{"data-devtools":"steer-element-identifier",ref:n=>{e.domElement&&ga(e.domElement,n,t)},"data-popmelt-subject-label-action":a?"true":void 0,style:{...Qe,maxWidth:"var(--popmelt-hover-label-width, 400px)",paddingLeft:la(e.label),borderRadius:e.domElement===document.body?ui("bottom-left"):ui(t)},children:(0,td.jsx)("span",{style:Ge,children:(0,td.jsx)(da,{label:e.label,hoverName:e.hoverName,preview:Te})})}),r?.render(!1)]})})}return(0,td.jsx)(ld,{scrollAnchor:w,target:e.domElement,bounds:v,priority:"history","data-popmelt-hover-action-rail":!!r||void 0,"data-popmelt-snap-collapse":A||void 0,visualRef:t=>{t?de.current.set(e.selector,t):de.current.delete(e.selector)},left:o.left,top:o.top,avoidTop:L.avoidTop,avoidBottom:L.avoidBottom,anchor:o.anchor,horizontalAlignment:o.horizontalAlignment,onClick:()=>{if(a)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,T);"edit-comment"===t.type?N?.(t.annotationId):"open-thread"===t.type&&j?.(t.threadId)},onContextMenu:t=>{if(t.preventDefault(),t.stopPropagation(),y)return;let n=!i&&$&&u?.find(t=>t.selector===e.selector&&(t.elementTag||t.subject?.inserted));if(n)return b?.(null),void $?.(n);if(e.comment&&_)_(e.comment.id);else{if(F){let t=l.filter(t=>t.selector===e.selector);if(t.length)return void F(t)}e.comment&&!1!==e.comment.pending&&D?(fe(e.selector),J(t=>Nc(t,e.selector)),te(t=>t===e.selector?null:t),b?.(null),D(e.comment.id)):s.some(t=>t.selector===e.selector&&!t.captured)?O?.(e.selector):!e.hasPendingChanges&&!f&&h&&!i&&T&&(m||p||me(e.comment))?H?.(T,!0):!e.hasPendingChanges&&!f&&!h&&"resolved"===c?.status&&H?.(c.threadId)}},onMouseEnter:()=>{fe(e.selector),te(e.selector),b?.(e.selector)},onMouseLeave:()=>{pe(e.selector),b?.(null)},style:{zIndex:a||r?.spotlight?10002:1e4,cursor:a?"text":"pointer",pointerEvents:"auto"},children:(0,td.jsxs)("div",{ref:t=>{e.domElement&&ga(e.domElement,t,o.anchor)},style:{display:"flex",alignItems:"center",gap:be},children:[a?Y.render(o.anchor):(0,td.jsxs)("div",{"data-devtools":"badge","data-popmelt-collapsed":oe.annotationCollapsed,onMouseEnter:()=>he(e.selector,"annotation",0),style:{...Qe,...t&&{maxWidth:`min(400px, calc(100vw - ${t.width+24}px))`},backgroundColor:qc({accentColor:d,threadAccentColor:I,comment:e.comment,isInFlight:f,hasThreadState:!!c,hasStickers:e.stickers.length>0}),gap:0,letterSpacing:e.comment?0:Qe.letterSpacing,borderRadius:e.domElement===document.body?ui("bottom-left"):ui(o.anchor)},children:[(0,td.jsx)("span",{style:{fontWeight:600},children:e.annotationNumber}),(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",style:{...Ge,paddingLeft:e.comment?0:void 0},children:e.comment?(0,td.jsxs)(td.Fragment,{children:[".",(0,td.jsx)("span",{style:{marginLeft:2},children:t?t.formatText(e.comment.text):e.comment.text})]}):(0,td.jsx)(da,{label:e.label,prefix:". ",hoverName:e.hoverName,preview:Te})})})]}),!ve&&(0,td.jsx)(Eo,{stepCount:a?0:e.comment?.interactionEpisodeStepCount??0,onClear:!1!==e.comment?.pending&&W?()=>W(e.comment.id):void 0,submitted:!1===e.comment?.pending}),ve&&(0,td.jsxs)("div",{className:"popmelt-staged-sticker-group","data-popmelt-tooltip-group":"",children:[e.stickers.map((t,n)=>{let r=Xc(t),o=_c({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:f,hasThreadState:!!c,isHovered:zc(Z,e.selector,n+1),hasTimedReveal:Q,isRevealedSticker:Q&&r===G}),a=function(e,t){return{paddingLeft:0===e?8:10,paddingRight:8,zIndex:t-e+1}}(n,e.stickers.length+ +(ye>0)),l=0===n?void 0:vo;return(0,td.jsxs)("div",{className:"popmelt-staged-sticker-layer",style:{zIndex:a.zIndex},children:[(0,td.jsx)("span",{"aria-hidden":!0,className:"popmelt-staged-sticker-pointer",style:{"--popmelt-staged-accent":z,WebkitMaskImage:0===n?void 0:xo,maskImage:0===n?void 0:xo}}),(0,td.jsxs)(De,{type:"button","data-devtools":"staged-sticker","data-popmelt-style-property":t.custom?.property,hoverDelayMs:500,hint:t.custom?`${t.custom.property}: ${t.custom.value}`:void 0,"data-popmelt-collapsed":o.stickerCollapsed,onReveal:()=>he(e.selector,r,n+1),onBlur:()=>{K||J(t=>Nc(t,e.selector))},"aria-label":t.custom?`Custom ${t.custom.property}: ${t.custom.value}`:`${i?"Staged":"Edit staged"} ${t.token} sticker`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:n=>{n.preventDefault(),n.stopPropagation(),t.selection&&C?.(e.selector,t.selection)},onContextMenu:n=>{n.preventDefault(),n.stopPropagation(),fe(e.selector),J(t=>Nc(t,e.selector)),b?.(null),t.selection&&M?.(e.selector,t.selection)},style:{...Qe,position:"relative",height:"100%",minHeight:22,appearance:"none",border:0,margin:0,paddingLeft:a.paddingLeft,paddingRight:a.paddingRight,gap:0,cursor:t.selection&&(C||M)?"pointer":"default",backgroundColor:z,WebkitMaskImage:l,maskImage:l},children:[(0,td.jsx)(ed,{chip:t}),(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:t.token})})]})]},r)}),(0,td.jsx)(Hl,{imageCount:ye,color:z,layered:e.stickers.length>0}),!a&&(e.comment?.interactionEpisodeStepCount??0)>0&&(0,td.jsx)("div",{className:"popmelt-staged-sticker-layer",style:{zIndex:1},children:(0,td.jsx)(Eo,{stepCount:e.comment.interactionEpisodeStepCount,layered:!0,onClear:!1!==e.comment?.pending&&W?()=>W(e.comment.id):void 0,submitted:!1===e.comment?.pending})}),Se&&(0,td.jsx)(Ao,{bundleCount:S,compact:le.sendCompact,layered:!0,onHoverChange:t=>{t&&he(e.selector,"send",ae),k?.(t)},onSend:E,style:{position:"relative",zIndex:(e.comment?.interactionEpisodeStepCount??0)>0?0:1}}),ke&&r?.render(!0)]}),t?.controls,(0,td.jsx)(Qr,{threadId:e.comment?.threadId??c?.threadId,color:I}),!t&&we&&(0,td.jsx)("button",{type:"button","data-devtools":"annotation-badge","data-popmelt-collapsed":se.stickerCollapsed,onMouseEnter:()=>he(e.selector,"thread-status",ae),"aria-label":T?`${x}. Open thread`:x,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),T&&j?.(T)},style:{...Qe,appearance:"none",border:0,margin:0,cursor:T&&j?"pointer":"default",backgroundColor:I,gap:0},children:y||g?(0,td.jsxs)(td.Fragment,{children:[y?(0,td.jsx)(ge,{size:12,"aria-hidden":"true"}):(0,td.jsx)(ie,{size:12,strokeWidth:2.25}),(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:x})})]}):f?(0,td.jsxs)(td.Fragment,{children:[(0,td.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle"},children:1===Ee?(0,td.jsxs)(td.Fragment,{children:[(0,td.jsx)("circle",{cx:"7",cy:"7",r:"2"}),(0,td.jsx)("circle",{cx:"17",cy:"7",r:"2"}),(0,td.jsx)("circle",{cx:"7",cy:"17",r:"2"}),(0,td.jsx)("circle",{cx:"17",cy:"17",r:"2"})]}):(0,td.jsxs)(td.Fragment,{children:[(0,td.jsx)("circle",{cx:"12",cy:"6",r:"2"}),(0,td.jsx)("circle",{cx:"6",cy:"12",r:"2"}),(0,td.jsx)("circle",{cx:"18",cy:"12",r:"2"}),(0,td.jsx)("circle",{cx:"12",cy:"18",r:"2"})]})}),(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",style:{opacity:.8},children:x})})]}):(0,td.jsxs)(td.Fragment,{children:[h?(0,td.jsx)(ie,{"data-devtools":"queued-status-icon",size:12,strokeWidth:2.25,style:{verticalAlign:"middle",opacity:.6}}):"waiting_input"===c?.status?(0,td.jsx)(ce,{"data-devtools":"question-status-icon",size:12,strokeWidth:2.25,style:{transform:"translateY(-0.5px)",flexShrink:0}}):"failed"===c?.status?(0,td.jsx)(Me,{size:12,strokeWidth:2.25}):(0,td.jsx)(xe,{size:12,strokeWidth:2.25}),(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,td.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:x})})]})}),Se&&!ve&&(0,td.jsx)(Ao,{bundleCount:S,compact:le.sendCompact,onHoverChange:t=>{t&&he(e.selector,"send",ae),k?.(t)},onSend:E}),!ke&&r?.render(!1)]})})}},`${e.transient?"intent":"history"}:${e.selector}`)})]})}var cd=u(d()),dd=u(x());function fd({styleModifications:e,textModifications:t=[],accentColor:n}){let[r,i]=(0,cd.useState)([]);if((0,cd.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=Rn(e.selector);if(!t)continue;o.add(e.selector);let r=ut(t);if(0===r.width&&0===r.height)continue;let i=Ti(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,dd.jsx)(dd.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,dd.jsx)("div",{"data-devtools":"mod-border",style:t},e.selector)})})}var pd=u(d()),hd=u(x()),md=["top","right","bottom","left"];function gd(e){return"all"===e?md:"x"===e?["left","right"]:"y"===e?["top","bottom"]:"top"===e||"right"===e||"bottom"===e||"left"===e?[e]:[]}function yd(e){return"top-left"===e||"top-right"===e||"bottom-right"===e||"bottom-left"===e?e:null}function vd(e,t,n,r){return e&&"value"===n&&"transform"===t&&("translate"===r||"scale"===r||"rotate"===r)}function xd({active:e,accentColor:t,family:n,stage:r,subproperty:i,hoveredElement:o,previewElement:a,transformPreviewTarget:l,previewRevision:s,frameListenerRef:u,cursorViewport:c,drag:d,onGapPointerDown:f,onRadiusPointerDown:p,onSpacingPointerDown:h,onTransformPointerDown:m}){let g=e&&"value"===r,y=o instanceof HTMLElement&&a===o,v=g&&y&&("stack"===n||"grid"===n)&&"gap"===i,x=v&&(ki(o,"row")||ki(o,"column")),b="transform"===d?.family?d.element:o,w=vd(e,n,r,i)?i:null,S=null!==w&&At(b)&&(a===b||l?.element===b||"transform"===d?.family),[k,E]=(0,pd.useState)(0),C=g&&(S||y&&("padding"===n||"margin"===n||"radius"===n||v));(0,pd.useLayoutEffect)(()=>{if(C)return u.current=()=>E(e=>e+1),()=>{u.current=null}},[u,C]);let M=s+k;return(0,hd.jsxs)(hd.Fragment,{children:[g&&("padding"===n||"margin"===n)&&y&&(0,hd.jsx)(Vu,{element:o,padding:"margin"===n?Ci(o):Ei(o),mode:n,accentColor:t,hoveredSide:d?.family===n?d.side??null:null,draggingSide:d?.family===n?d.side??null:null,activeSides:gd(i),refreshKey:M,cursorViewport:d?.cursor,onHandlePointerDown:(e,t)=>h(n,e,t)}),v&&(0,hd.jsx)(Nu,{element:o,gap:wi(o),accentColor:t,hoveredAxis:d?.gapAxis??null,draggingAxis:d?.gapAxis??null,refreshKey:M,cursorViewport:d?.cursor,isAutoGap:x,onHandlePointerDown:x?void 0:f}),g&&"radius"===n&&y&&(0,hd.jsx)(Au,{element:o,radius:Ti(o),accentColor:t,hoveredCorner:yd(i),draggingCorner:d?.corner??null,cursorViewport:d?.cursor,onHandlePointerDown:p}),S&&(0,hd.jsx)(Oa,{element:b,previewTarget:l?.element===b?l:void 0,activeFacet:w,accentColor:t,draggingKind:"transform"===d?.family?d.transformKind??null:null,draggingCorner:"transform"===d?.family?d.transformCorner??null:null,ghostQuad:"transform"===d?.family?d.ghostQuad??null:null,cursorViewport:d?.cursor??c,refreshKey:M,onHandlePointerDown:m})]})}var bd=u(d()),wd=u(x());function Sd(){let e=Math.random()*Math.PI*2,t=5+8*Math.random();return{x:Math.cos(e)*t,y:Math.sin(e)*t}}function kd({onSave:e}){let[t,n]=(0,bd.useState)(!1),[r]=tt(),i=Xe[r];return(0,wd.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:fi,fontSize:12,fontWeight:600,letterSpacing:"0.24px",lineHeight:1,whiteSpace:"nowrap",cursor:"pointer",pointerEvents:"auto",userSelect:"none",touchAction:"manipulation"},children:[(0,wd.jsxs)("span",{className:"popmelt-subject-save-default",children:[(0,wd.jsx)(le,{size:12,strokeWidth:2,"aria-hidden":!0}),(0,wd.jsx)("span",{style:{color:i.secondary},children:"to"}),(0,wd.jsx)(ne,{size:12,strokeWidth:2,"aria-hidden":!0})]}),(0,wd.jsxs)("span",{className:"popmelt-subject-save-hovered",children:[(0,wd.jsx)("span",{children:"Save"}),(0,wd.jsx)(ne,{size:12,strokeWidth:2,"aria-hidden":!0})]})]})}function Ed({accentColor:e,created:t,registry:n,target:r,onCommit:i,onClose:o,onCancelCreated:a}){let l=n.resolve(r),s=(0,bd.useRef)(l?.subject.label??"object"),[u,c]=(0,bd.useState)(s.current),d=l?.subject.trackingAnchors?.map(e=>({...e}))??[],f=(0,bd.useRef)(d),[p,h]=(0,bd.useState)(d),[m,g]=(0,bd.useState)(0),[y,v]=(0,bd.useState)(0),x=(0,bd.useRef)(null),b=(0,bd.useRef)(null),w=(0,bd.useRef)(null),S=(0,bd.useRef)(!1),k=n.resolve(r),E=(0,bd.useMemo)(()=>{let e=typeof document>"u"?null:document.createElement("canvas").getContext("2d");e&&(e.font=`12px ${fi}`);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,bd.useLayoutEffect)(()=>{w.current?.focus(),w.current?.select()},[]),(0,bd.useLayoutEffect)(()=>{if(m)for(let e of b.current?.querySelectorAll("[data-popmelt-tracking-anchor]")??[]){let t=Sd();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,bd.useEffect)(()=>n.subscribeFrame(()=>v(e=>e+1)),[n]),(0,bd.useEffect)(()=>{let e=e=>{let t=x.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})),v(e=>e+1))},t=()=>{x.current=null,v(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 C=()=>{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,j=Math.min(400,E.full),A=j+2+66,R=xa({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),I="right"===R.horizontalAlignment?R.left-A:R.left;return(0,wd.jsxs)(wd.Fragment,{children:[(0,wd.jsx)(Oa,{element:k.element,activeFacet:"translate",accentColor:e,showRotateHandle:!1,refreshKey:y,draggingKind:x.current?.kind??null,draggingCorner:x.current?.corner??null,onHandlePointerDown:(e,t,n)=>{"rotate"!==e&&(n.preventDefault(),n.stopPropagation(),x.current={kind:e,corner:t,start:{x:n.clientX,y:n.clientY},bounds:{...k.subject.bounds}},v(e=>e+1))}}),T&&(0,wd.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,wd.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,wd.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,wd.jsxs)("div",{style:{position:"fixed",left:I,top:R.top,display:"flex",alignItems:"center",gap:2,pointerEvents:"auto",zIndex:1e4},children:[(0,wd.jsxs)("div",{"data-popmelt-subject-label-editor":!0,style:{...sa(e),width:j,gap:0,borderRadius:ui(R.anchor)},children:[(0,wd.jsx)("span",{"aria-hidden":!0,children:"<"}),(0,wd.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:C,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),S.current=!0,t?a():o()):"Enter"===e.key&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),C())},style:{appearance:"none",boxSizing:"content-box",width:Math.min(E.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,wd.jsx)("span",{"aria-hidden":!0,children:">"})]}),(0,wd.jsx)(kd,{onSave:C})]})]})}var Cd=u(d());function Md(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 Td=u(d());function jd(e){return Math.random().toString(36).substring(2,e+2)}function Ad(e){return st({left:0,top:0,width:1,height:1},e.ownerDocument).height*function(e){let t=Nt(Vt(e),Bt(e));return(e.currentCSSZoom||1)*Math.hypot(t.c,t.d)}(e)}function Rd(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?.()??jd(6),o.setAttribute("data-pm",y));let v=jn(`[data-pm="${y}"]`,o.ownerDocument),x=Ad(o),b=e=>e?.endsWith("px")?parseFloat(e)*x+"px":e;return{id:r.createEditId?.()??jd(7),point:{x:u.left+n.x,y:u.top+n.y},text:s,fontSize:m*x,isNew:!0,clickPoint:t,domEdit:{selector:v,durableSelector:Tn(o),element:{...Hn(o),selector:v},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*x*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 Id(e){if(!e||e===document.body||e===document.documentElement||Ni(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 Ld(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 Pd(e){return e.parentElement?Array.from(e.parentElement.children).indexOf(e):-1}function zd(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(e=>e.removeAttribute("data-pm"))}function Nd(e,t,n,r,i=Vn){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&&Id(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=Pd(a);return{parent:o,reference:a,placement:s,index:"before"===s?u:u+1}}function Dd(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 _d(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 Fd(e,t,n,r){let i=e.targetElement;if("P"!==i.tagName)return;let o=Yi(i);if(!o&&void 0===r)return;let a=o?.root??i,{group:l,layout:s}=Xi(a),u=l.rows.indexOf(i),c=jn(Ld(a),a.ownerDocument),d=n.find(e=>e.paragraphs&&!e.captured&&e.selector===c),f=d??(a===i?e:function(){let e=_i(a);return e&&Rd(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(Bi(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,v=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!==v&&(v<u.length||n===e.segments.length-1?(y={parts:c,index:l,offset:Math.min(v,u.length)},v=void 0):v-=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 x=Gi(a,s);if(!x)return;let b={selector:f.selector,durableSelector:f.durableSelector,element:f.element,textNodePath:[],original:_d(p).join("\\n\\n"),modified:_d(s).join("\\n\\n"),paragraphs:{before:p,after:s}},w=y&&x.rows[u+1],S=w&&_i(w);if(!S)return{change:b};let k=Rd(S,{x:S.rect.left,y:S.rect.top},{x:window.scrollX,y:window.scrollY});return k.initialCaret=0,{change:b,next:k}}function $d(e,t,n=!0){let r=new Map(Bi(e.segments,e.originalText,t).map(({segment:e,modifiedText:t})=>[e,t])),i=e.segments.length>1?Hc(t):void 0;return{type:"MODIFY_TEXT_CONTENTS",...n?{}:{saveUndo:!1},payload:e.segments.map(t=>({...e.target&&{target:e.target},selector:e.selector,durableSelector:e.durableSelector,element:e.element,textNodePath:t.textNodePath,...void 0!==i?{canvasLabel:i}:{},original:t.originalText,modified:r.get(t)??t.originalText}))}}function Od(e){return!!(e.text.trim()||e.images?.length||e.attachments?.length||e.interactionEpisode?.steps.length)}function Hd(e,t=e.text){let n=e.images?.length??0,r=e.attachments??[];return e.isNew?{type:"ADD_TEXT",payload:{point:e.point,text:t,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:t,...n>0?{imageCount:n}:{},attachments:r,interactionEpisode:e.interactionEpisode}}}function Wd({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 Bd({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=di(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=di(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*ci,isWrapped:!0}}return{width:c,height:Math.max(1,u.length)*t*ci,isWrapped:!1}}function Vd(e,t,n,r=6){return e.moved?e:{...e,moved:Math.hypot(t-e.startX,n-e.startY)>r}}function qd(e){return!(!e||e.moved)}var Yd=new Set(["text","transform","opacity"]),Ud=new Set(["padding","margin","border","radius","color"]);function Xd(e,t,n){return!!At(e)&&(e instanceof HTMLElement||!("text"===t&&!function(e){return"text-align"!==e}(n))&&(Yd.has(t)||function(e){return e instanceof SVGSVGElement&&!(e.parentElement instanceof SVGElement)}(e)&&Ud.has(t)))}var Kd={"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 Qd=u(d());function Gd(e,t){return e.frames&&0!==t?{...e,frames:e.frames.map(e=>({...e,imageIndex:e.imageIndex+t}))}:e}function Zd(e){let t=e?.replace(/\\s+/g," ").trim();if(t)return t.slice(0,180)}function Jd(e){try{return Tn(e)}catch{return}}function ef(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 tf(e){if(!e||Ni(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=Zd(e.getAttribute("class")),a=Zd(e.getAttribute("aria-label")),l=Zd(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?void 0:e.textContent),s=ef(e);return{selector:Jd(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 nf(e){let{subject:t,target:n,adapter:r}=e,{left:i,top:o,width:a,height:l}=t.bounds,s=ef(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 rf(e,t,n){if("scroll"===e)return"Scrolled the page";let r=n??tf(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 of(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function af(e){return e instanceof Element?e:e.parentElement}function lf(e){return!(!e||e.domEdit||!e.linkedSelector&&!e.target)}function sf(e){return!(!e||"text"!==e.type||"pending"!==(e.status??"pending")||!e.linkedSelector&&!e.target)}var uf={kind:"root"};function cf(e,t){let n=eu(e),r=tu(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 df(e){return"root"===e.kind?xs.flatMap(e=>{let t=function(e){let t=eu(e),n=function(e){return"color"===e?"slate":Ks(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,...Ks(e).filter(e=>!Hs(e)).map(t=>cf(e,t))]}):"family"===e.kind?Ks(e.family).filter(e=>!Hs(e)).map(t=>cf(e.family,t)):"colors"===e.kind?us.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)):Us(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 ff(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ")}function pf(e){return ff(e).replace(/\\s+/g,"")}function hf(e,t){let n=ff(e);if(!n)return 0;let r=ff(t.searchPath),i=ff(t.label),o=pf(e),a=pf(t.searchPath),l=function(e){return ff(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 mf(e,t){if(!t.trim())return null;let n=e=>df(e).map((e,n)=>({candidate:e,index:n,score:hf(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(uf)}function gf(e,t){return t.trim().length<2?null:mf(e,t)}function yf(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 vf(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 xf(e,t){At(e)&&(t.forEach(t=>e.style.removeProperty(t)),e.style.removeProperty("transition"))}function bf(e,t,n){return{property:e,original:`${t}px`,modified:`${n}px`}}var wf=["space-between","space-around","stretch","normal"],Sf={"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 kf(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 Ef(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Cf(e){return"string"==typeof e&&xs.includes(e)}function Mf(e,t){return"string"==typeof t&&Qs(e,t)===t}function Tf(e){if(!Ef(e)||!Cf(e.family))return null;let t=e.family;if(!Mf(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 Us(e,t).includes(n)}(t,n,e.step)?{family:t,subproperty:n,stage:e.stage,step:e.step}:null}function jf(e){if(!Ef(e)||"string"!=typeof e.kind)return null;if("root"===e.kind)return{kind:"root"};if("family"===e.kind&&Cf(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&&Cf(e.family)){let t=e.family;return Mf(t,e.subproperty)?{kind:"values",family:t,subproperty:e.subproperty}:null}return null}function Af(e,t){return"sticker"!==e||!t}var Rf=new Set(["display","border-top-style","border-right-style","border-bottom-style","border-left-style"]);function If(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function Lf(e,t){t.value?e.style.setProperty(t.property,t.value,t.priority):e.style.removeProperty(t.property)}function Pf(e,t){return{property:t,value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}}function zf(e){if(e){!function(e){Zi.delete(e)}(e.element);for(let t of e.declarations)Lf(e.element,t)}}function Nf(e,t,n,r){if(!e?.focus||!e.element.isConnected)return n(t.x,t.y);let{element:i,focus:o}=e;if(Math.hypot(t.x-o.point.x,t.y-o.point.y)<=2)return i;let a,l=If(o.bounds,t.x,t.y),s=l||i.firstElementChild||i.shadowRoot||If(ut(i),t.x,t.y)?n(t.x,t.y):null;if(s===i&&(l||!If(ut(i),o.origin.x,o.origin.y)))return o.point=t,i;if(s&&s!==i&&kt(i,s)&&n(o.point.x,o.point.y)!==s)return s;i.style.setProperty("transition","none","important");try{for(let t of e.declarations)"transition"!==t.property&&Lf(i,t);let l=n(t.x,t.y);return l===i?o.point=t:a=r,l}finally{if(a)a();else{for(let t of e.activeDeclarations)"transition"!==t.property&&Lf(i,t);i.getBoundingClientRect();let t=e.activeDeclarations.find(e=>"transition"===e.property);t&&Lf(i,t)}}}var Df="[data-popmelt-subject-label-action]";function _f(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 Ff(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 $f(e,t,n){for(let r of e.querySelectorAll(Df)){let i=r.getBoundingClientRect();if(t>=i.left&&t<=i.right&&n>=i.top&&n<=i.bottom){let i=Ff(e,r);if(i&&!_f(i,t,n))continue;return r}}return null}var Of=u(d()),Hf=u(d()),Wf={isAnnotating:!1,activeTool:"inspector",activeColor:"oklch(0.628 0.258 29)",strokeWidth:3,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,styleModifications:[],textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]},Bf=(0,Hf.createContext)(null),Vf=()=>()=>{},qf=()=>null;function Yf(){return Math.random().toString(36).substring(2,9)}function Uf(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 Xf(e){return{canvasSamples:e.canvasSamples,annotations:e.annotations,styleModifications:e.styleModifications,textModifications:e.textModifications,domModifications:e.domModifications,spacingTokenChanges:e.spacingTokenChanges,spacingTokenMods:e.spacingTokenMods}}function Kf(e,t){return{...e,undoStack:[...e.undoStack,{...Xf(e),...t&&{textEditSessionId:t}}],redoStack:[]}}function Qf(e,t,n=!0){let{selector:r,durableSelector:i,element:o,changes:a}=t,l=typeof window<"u"?gn(window.location.pathname):"/",s=a.filter(e=>e.original!==e.modified);if(0===s.length)return e;let u=n?Kf(e):e,c=u.styleModifications.findIndex(e=>e.selector===r&&(!e.pathname||e.pathname===l));if(c>=0){let e=u.styleModifications[c],t=e.captured?[]:[...e.changes];for(let e of s){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?{...u,styleModifications:u.styleModifications.filter((e,t)=>t!==c)}:{...u,styleModifications:u.styleModifications.map((e,n)=>n===c?{...e,changes:t,createdAt:e.createdAt??Date.now(),captured:!1,pathname:l}:e)}}return{...u,styleModifications:[...u.styleModifications,{selector:r,durableSelector:i,element:o,changes:s,createdAt:Date.now(),pathname:l}]}}function Gf(e,t){let n=new Map,r=[];for(let i of e){let e=i.sampledTree&&i.referenceSelector?n.get(i.referenceSelector):void 0,o=e&&e.pathname===i.pathname?{...i,referenceSelector:e.referenceSelector,placement:e.placement}:i;i.sampledTree&&t.has(i.id)?(n.set(i.selector,o),n.set(`[data-popmelt-placement-item="${i.id}"]`,o)):r.push(o)}return r.length===e.length?e:r}function Zf(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 Jf(e,t,n=!0){let{selector:r,durableSelector:i,element:o,textNodePath:a,original:l,modified:s}=t,u=typeof window<"u"?gn(window.location.pathname):"/",c=e.textModifications.findIndex(e=>Zf(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?Kf(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,canvasLabel:t.canvasLabel,modified:s,createdAt:e.createdAt??Date.now(),captured:!1,pathname:u}:e)}}let f=n?Kf(e):e;return{...f,textModifications:[...f.textModifications,{selector:r,durableSelector:i,element:o,textNodePath:a,...t.target&&{target:t.target},...t.paragraphs&&{paragraphs:t.paragraphs},...void 0!==t.canvasLabel&&{canvasLabel:t.canvasLabel},original:l,modified:s,createdAt:Date.now(),pathname:u}]}}function ep(e,t,n=!0,r){return 0===t.length?e:t.reduce((e,t)=>Jf(e,t,!1),n?Kf(e,r):e)}function tp(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??Yf(),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"?gn(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:Kf(e),annotations:[...e.annotations,n]}}(e,t.payload);case"UPDATE_TEXT":return function(e,t){return{...Kf(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{...Kf(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=Kf(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?Kf(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?Kf(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{...Kf(e),annotations:[...e.annotations,...t.annotations.map(Uf)]}}(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(Uf(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=Uf(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(Uf);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||[],canvasSamples:t?.canvasSamples,styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],undoStack:e.undoStack.slice(0,-1),redoStack:[...e.redoStack,Xf(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||[],canvasSamples:t?.canvasSamples,styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],redoStack:e.redoStack.slice(0,-1),undoStack:[...e.undoStack,Xf(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){let n=typeof window<"u"?gn(window.location.pathname):"/",r=t?.annotationIds?new Set(t.annotationIds):void 0,i=t?.textModifications??e.textModifications.filter(e=>!e.pathname||e.pathname===n),o=e=>e.filter(e=>!i.some(t=>e.pathname===t.pathname&&Zf(e,t.selector,t.textNodePath,t.pathname??"")&&e.createdAt===t.createdAt&&e.original===t.original&&e.modified===t.modified&&Ya(e.paragraphs,t.paragraphs))),a=(e,t,n=!0)=>t?t.some(t=>Ya(t,e)):n,l=t?.domModifications??e.domModifications.filter(e=>!e.pathname||e.pathname===n),s=e=>!e.captured&&l.some(t=>Ya(t,e))?{...e,captured:!0}:e,u=e=>({...e,textModifications:o(e.textModifications),domModifications:(e.domModifications??[]).map(e=>e.sampledTree?s(e):e)});return{...e,undoStack:e.undoStack.map(u),redoStack:e.redoStack.map(u),annotations:e.annotations.map(e=>r&&!r.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=>a(e,t?.styleModifications,!e.pathname||e.pathname===n)?{...e,captured:!0}:e),textModifications:o(e.textModifications),domModifications:e.domModifications.map(s),spacingTokenChanges:e.spacingTokenChanges.map(e=>a(e,t?.spacingTokenChanges)?{...e,captured:!0}:e),spacingTokenMods:e.spacingTokenMods.map(e=>a(e,t?.spacingTokenMods)?{...e,captured:!0}:e)}}(e,t.payload);case"CLEAR":return function(e){return{...e,canvasSamples:void 0,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]}}(e);case"DISCARD_DRAFT":return function(e){return e.canvasSamples?.length||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)?{...Kf(e),canvasSamples:void 0,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"?gn(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=Kf(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=Kf(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=Kf(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"DISCARD_PLACED_SAMPLE":{let{selector:n,pathname:r}=t.payload,i=e.domModifications.find(e=>e.selector===n&&e.pathname===r&&e.sampledTree&&!e.captured),o=i?Gf(e.domModifications,new Set([i.id])):e.domModifications,a=e.canvasSamples?.filter(e=>!(e.selector===n&&e.pathname===r&&e.subject?.inserted));return o.length===e.domModifications.length&&a?.length===e.canvasSamples?.length?e:{...Kf(e),domModifications:o,canvasSamples:a}}case"PULL_PEER_EDITS":{let{styles:n,texts:r,canvases:i=[],placedElement:o}=t.payload;if(!(n.length||r.length||i.length||o))return e;let a=Kf(e);o&&(a.domModifications=[...e.domModifications,o]),i.length&&(a.canvasSamples=[...(e.canvasSamples??[]).filter(e=>!e.subject||!i.some(t=>!t.subject&&t.pathname===e.pathname&&t.selector===e.subject?.canvasSelector)),...i]);for(let e of n)a=Qf(a,e,!1);return ep(a,r,!1)}case"MODIFY_STYLES_BATCH":return Qf(e,t.payload);case"CLEAR_STYLE":return function(e,t){let{selector:n,property:r}=t,i=typeof window<"u"?gn(window.location.pathname):"/",o=Kf(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"?gn(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=Kf(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:{...Kf(e),styleModifications:[]}}(e);case"RECOVER_PLACEMENT_SLOT":{let{id:n,slot:r}=t.payload,i=e.domModifications.find(e=>e.id===n);return i?.captured&&i.sampledTree&&!i.sourceSlot?{...e,domModifications:e.domModifications.map(e=>e===i?{...e,sourceSlot:r}:e)}:e}case"SETTLE_IMPLEMENTED_PLACEMENTS":return function(e,t){let n=new Set(t),r=new Set;for(let t of[e,...e.undoStack,...e.redoStack])for(let e of t.domModifications??[])e.captured&&e.sampledTree&&n.has(e.id)&&r.add(e.id);if(!r.size)return e;let i=e=>({...e,domModifications:Gf(e.domModifications??[],r)});return{...e,domModifications:Gf(e.domModifications,r),undoStack:e.undoStack.map(i),redoStack:e.redoStack.map(i)}}(e,t.payload.ids);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 Jf(e,t.payload);case"MODIFY_TEXT_CONTENTS":return ep(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=Kf(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"?gn(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)||t.from&&(e.status??"pending")!==t.from?e:{...e,status:t.status})}}(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=Kf(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=Kf(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 np(e){return e instanceof HTMLElement&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||!0===e.isContentEditable||"true"===e.getAttribute("contenteditable"))}function rp(e){return np(e.composedPath?.()[0]??e.target)||np(function(){if(typeof document>"u")return null;let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}())}function ip(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 op=u(d());function ap(e){let t=Ld(e);return{element:e,elementInfo:{...Hn(e),selector:t},selector:t,durableSelector:Tn(e)}}function lp(e){return{x:e.x-window.scrollX,y:e.y-window.scrollY}}function sp(e){ro(e,"transition","none")}var up=u(d());function cp(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 dp=u(d()),fp=u(d());var pp=u(d()),hp=[0,1,2,4,8,12,16,20,24,28,32],mp=[8,10,11,12,13,14,16,18,20,22,24,28,32,36,40,48,56,64,72,80,96];function gp(e){for(let t=0;t<hp.length-1;t++){let n=hp[t],r=hp[t+1];if(e<=(n+r)/2)return n;if(e<r)return r}return 8*Math.round(e/8)}function yp({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:v,setHandDragging:x,setHandHoveredElement:b,setHandHoveredSide:w,setRadiusDragging:S,setRadiusHoveredCorner:k,setRadiusHoveredElement:E,setTextDragging:C,setTextHoveredElement:M,setTextHoveredProperty:T,textDragRef:j,textHoveredElement:A,textHoveredProperty:R}){return(0,pp.useCallback)(({x:I,y:L})=>{o.current={x:I,y:L},v({x:I,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(I-n.startX),t=Math.abs(L-n.startY);if(e<=3&&t<=3)return;n.hasMoved=!0}let i=Nd(I,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=gp(o),a=gp(a)),{axis:r,gap:{row:Math.round(o),column:Math.round(a)},started:i,convertedAuto:i&&e.isAuto}}(e,{x:I,y:L},{isolate:P,snap:z});if(!r)return;return r.started&&(e.hasMoved=!0),r.convertedAuto&&(ro(t,"justify-content","normal"),ro(t,"row-gap",`${e.visualGap}px`),ro(t,"column-gap",`${e.visualGap}px`),y(!1)),ro(t,"row-gap",`${r.gap.row}px`),ro(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=gp(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:I,y:L},{isolate:P,snap:z});if(!n)return;return ro(t,"border-top-left-radius",`${n.radius["top-left"]}px`),ro(t,"border-top-right-radius",`${n.radius["top-right"]}px`),ro(t,"border-bottom-right-radius",`${n.radius["bottom-right"]}px`),ro(t,"border-bottom-left-radius",`${n.radius["bottom-left"]}px`),void S(n)}if(j.current.isDragging){let e=j.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 mp.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:I,y:L},z);if(!n)return;return ro(t,"font-size",`${n.text.fontSize}px`),ro(t,"line-height",""+(n.text.fontSize>0?Math.round(n.text.lineHeight/n.text.fontSize*1e3)/1e3:1.2)),void C({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=gp(t)),i[e]=Math.round(t)}),{side:r,padding:i}}(e,{x:I,y:L},{isolate:P,snap:z});if(!n)return;return ro(t,"padding",`${n.padding.top}px ${n.padding.right}px ${n.padding.bottom}px ${n.padding.left}px`),void x(n)}let N=Vn(I,L);for(;N&&"A"===N.tagName;)N=N.parentElement;let D=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=Ti(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:I,y:L}});if(D)return E(D.element),k(D.corner),l&&b(null),s&&w(null),i&&g(null),r&&m(null),y(!1),A&&M(null),void(R&&T(null));f&&E(null),d&&k(null);let _=function({element:e,point:t,maxCandidates:n=3}){let r=[];e&&bi(e)&&r.push(e);let i=e?.parentElement??null;for(;i&&i!==document.body&&r.length<n;)bi(i)&&r.push(i),i=i.parentElement;for(let e of r){let n=Si(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:ki(e,n.axis)}}return null}({element:N,point:{x:I,y:L}});if(_)return g(_.element),m(_.axis),y(_.isAuto),l&&b(null),s&&w(null),A&&M(null),void(R&&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(!ji(e))continue;let t=Ai(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:I,y:L}});if(F?(M(F.element),T(F.property)):(A&&M(null),R&&T(null)),N!==l&&b(N),N){let e=Ei(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:I,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,v,x,b,w,S,k,E,C,M,T,j,A,R])}var vp=u(d()),xp=u(d());function bp({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])=>cn(i,e,t)<=6))return!0;let l=fn(e,i,r);return cn(i,l.edge,l.handle)<=r/2}(o,r,i,a)||t===e)||(t&&t!==e&&e.contains(t)?If(n,r,i):!!(t&&t.contains(e)&&o&&a&&function(e,t,n,r){let i={x:t,y:n},o=fn(e,i,r);return cn(i,o.edge,o.handle)<=1.5*r}(o,r,i,a))||If(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 wp({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n}){return t&&!n&&("inspector"===e||"sticker"===e)}function Sp({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n,retainSampleRailHover:r,hoveredElement:i,hoveredElementInfo:o,subjectRegistry:a,stickerFamily:l,stickerStage:s,stickerSubproperty:u,steerDragRef:c,stickerPreviewRef:d,transformDragHandoffRef:f,transformPreviewSuppressionRef:p,transformPreviewTargetRef:h,clearStickerPreview:m,isElementInFlight:g,setHoveredElement:y,setHoveredElementInfo:v,setStickerCursor:x,setStickerStep:b}){return(0,xp.useCallback)(({viewportPoint:w,passThrough:S,stopPropagation:k})=>{if(!wp({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n}))return!!n;if("sticker"===e&&(k(),x(e=>e?.x===w.x&&e.y===w.y?e:w)),c.current||r&&i&&function(e,t){let n=fa.get(e);if(!n?.isConnected||pa.get(n)!==e)return!1;let r=n.closest("[data-popmelt-hover-action-rail]")?.getBoundingClientRect();return!!(r&&t.x>=r.left&&t.x<r.right&&t.y>=r.top&&t.y<r.bottom)}(i,w))return!0;if(Un(w.x,w.y))return"sticker"===e&&m(),i&&y(null),o&&v(null),x(null),!0;let E={allowBodyFallback:"inspector"===e},C=S?function(e,t,n){let r=Kn(e,t,n);return Bn(r,e,t)??r.find(n=>Qn(n,e,t))??r.at(-1)??null}(w.x,w.y,E):"sticker"===e&&d.current?.focus&&"transform"!==l?Nf(d.current,w,Vn,f.current?void 0:m):Vn(w.x,w.y,E),M="inspector"===e?a?.hitTest(w):null,T=function(e,t,n,r=16){if(!(e instanceof HTMLImageElement||e instanceof HTMLVideoElement)||t)return!1;let i=ut(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}(C,!!M,w),j=Jn(i),A=function(e,t){return!(!e||!t||e.adapter===t.adapter&&e.key===t.key)}(j,M?.target),R=!M&&j?a?.resolve(j)?.subject.sourceElement:void 0,I=R&&!qn(R,w.x,w.y);if(!T&&!A&&!I&&"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(`${Df}[data-popmelt-subject-adapter][data-popmelt-subject-key]`)).find(e=>e.dataset.popmeltSubjectAdapter===i&&e.dataset.popmeltSubjectKey===o);return!(!a||!_f(t,n,r))&&function(e,t,n,r){let i=ut(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,i,w.x,w.y))return!0;let L=M?.element??C,P="sticker"===e&&"value"===s&&"transform"===l?h.current:null,z=S?{candidate:L,clearDragHandoff:!!f.current,clearPreviewTarget:!!P}:bp({rawElement:L,point:w,dragHandoff:f.current,previewTarget:P,handleHitSize:20});z.clearDragHandoff&&(f.current=null),z.clearPreviewTarget&&(h.current=null);let N=z.candidate,D=function(e,t,n){return t?"sticker"!==e&&n(t)?null:t:null}(e,N,g);if(D===i)return M?.element===D&&function(e,t){return e?.subjectLabel!==t.subjectLabel||e?.textContent!==t.textContent||e?.context!==t.context}(o,M.elementInfo)&&v(M.elementInfo),!0;if("sticker"===e&&m(),"sticker"!==e||!At(D)||"transform"!==l||"translate"!==u&&"scale"!==u&&"rotate"!==u)"transform"===l&&(p.current=null);else{let e=function(e,t){return function(e,t){if("translate"===t)return Su(t,hn(e).x);if("scale"===t){let n=Number.parseFloat(e);return Su(t,Number.isFinite(n)?100*n:100)}let n=Number.parseFloat(e);return Su(t,Number.isFinite(n)?n:0)}(window.getComputedStyle(e).getPropertyValue(t).trim(),t)}(D,u);p.current={element:D,subproperty:u,step:e},b(e)}return y(D),v(M?.element===D?M.elementInfo:D?Hn(D):null),!0},[e,m,i,o,t,g,r,y,v,x,b,c,d,l,s,u,a,n,f,p,h])}function kp(e){let t=yp(e),n=function({annotations:e,dragState:t,resizeState:n,dispatch:r,setDragState:i,setResizeState:o}){return(0,fp.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=Md(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=Md(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=Sp(e),i=(0,dp.useRef)(r),o=(0,dp.useRef)(e.clearPageElementHover),a=(0,dp.useRef)(!1),l=wp({activeTool:e.activeTool,isAnnotating:e.isAnnotating,suspendTargetDiscovery:e.suspendTargetDiscovery});(0,dp.useLayoutEffect)(()=>{i.current=r,o.current=e.clearPageElementHover},[r,e.clearPageElementHover]),(0,dp.useEffect)(()=>{if(l)return function({onSuspend:e,observeResize:t,onRestore:n,suspendedRef:r}){let i,o=()=>{r.current||(r.current=!0,e()),clearTimeout(i),i=setTimeout(()=>{r.current=!1,n()},96)};return window.addEventListener("scroll",o,{capture:!0,passive:!0}),t&&window.addEventListener("resize",o),()=>{t&&window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),clearTimeout(i),r.current=!1}}({observeResize:"sticker"===e.activeTool,onSuspend:()=>o.current(),onRestore:()=>{let t=e.lastCanvasCursorRef.current;t&&i.current({viewportPoint:t,passThrough:!1,stopPropagation:()=>{}})},suspendedRef:a})},[e.activeTool,e.lastCanvasCursorRef,l]);let s=(0,dp.useCallback)(e=>!!a.current||i.current(e),[]);(0,dp.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,dp.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,dp.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,dp.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,dp.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(ta,t),()=>window.removeEventListener(ta,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,vp.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 Ep=u(d());function Cp({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:v,setGapDragging:x,setHandDragging:b,setRadiusDragging:w,setResizeState:S,setSendHintAnchorId:k,setTextDragging:E,textDragRef:C,textDragging:M}){return(0,Ep.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=Nd(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=Tn(s.parent),d=Ld(s.parent),f=Tn(s.reference),p=Ld(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;zd(e),Dd(s.parent,e,u),h=Ld(e),m=Tn(e),g={...Hn(e),selector:h}}else Dd(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?Ld(y):void 0,originalParentDurableSelector:y?Tn(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:Yf,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(C.current.isDragging){let e=function(e,t){return e.element&&t?kf(e,function(e,t,n){xf(e,["font-size","line-height"]);let r=[];if(t.fontSize!==n.fontSize&&(ro(e,"font-size",`${n.fontSize}px`),r.push(bf("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;ro(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}(C.current,M);return e&&i({type:"MODIFY_STYLES_BATCH",payload:e}),C.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 E(null)}if(l.current.isDragging){let e="button"in T&&2===T.button,t=function(e,t,n){return e.element?kf(e,function(e,t,n,r){if(!t.hasMoved){if(r)return[];xf(e,[]);let n=t.justifyContent||"normal",i=wf.indexOf(n),o=wf[(i+1)%wf.length],a=[];return"normal"===o?(ro(e,"justify-content","normal"),a.push({property:"justify-content",original:t.justifyContent,modified:"normal"})):"stretch"===o?(ro(e,"justify-content",o),ro(e,"row-gap","8px"),ro(e,"column-gap","8px"),a.push({property:"justify-content",original:t.justifyContent||"normal",modified:o}),8!==t.row&&a.push(bf("row-gap",t.row,8)),8!==t.column&&a.push(bf("column-gap",t.column,8))):(xf(e,["row-gap","column-gap"]),ro(e,"justify-content",o),a.push({property:"justify-content",original:t.justifyContent||"normal",modified:o}),t.row>0&&a.push(bf("row-gap",t.row,0)),t.column>0&&a.push(bf("column-gap",t.column,0))),a}if(!n)return[];xf(e,["row-gap","column-gap"]);let i=[];return t.isAuto?(xf(e,["justify-content"]),ro(e,"justify-content","normal"),ro(e,"row-gap",`${n.row}px`),ro(e,"column-gap",`${n.column}px`),i.push({property:"justify-content",original:t.justifyContent,modified:"normal"}),i.push(bf("row-gap",0,n.row)),i.push(bf("column-gap",0,n.column)),i):(t.row!==n.row&&(ro(e,"row-gap",`${n.row}px`),i.push(bf("row-gap",t.row,n.row))),t.column!==n.column&&(ro(e,"column-gap",`${n.column}px`),i.push(bf("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 x(null)}if(p.current.isDragging){let e=function(e,t){return e.element&&t?kf(e,function(e,t,n){let r=Object.values(Sf);xf(e,r);let i=[];return Object.keys(Sf).forEach(r=>{if(t[r]===n[r])return;let o=Sf[r];ro(e,o,`${n[r]}px`),i.push(bf(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?kf(e,function(e,t,n){xf(e,["padding"]);let r=[];return Object.keys(t).forEach(i=>{if(t[i]===n[i])return;let o=`padding-${i}`;ro(e,o,`${n[i]}px`),r.push(bf(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 j=e.get(a.annotation.id),A=t.current?.getContext("2d"),R=0;void 0!==j&&A&&(A.font=`${a.annotation.fontSize||12}px ${fi}`,R=A.measureText(`${j}. `).width);let I=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:R});I&&(f.current=null,r.current=null,k(a.annotation.id),I.color&&i({type:"SET_COLOR",payload:I.color}),g(I.activeText)),v(null)},[e,t,n,r,i,o,a,l,s,u,c,d,f,p,h,m,g,y,v,x,b,w,S,k,E,C,M])}var Mp=u(d()),Tp=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)}},jp=u(d());function Ap({subjectRegistry:e,activeText:t,activeTextRef:n,canvasRef:r,clearPageElementHover:i,clearSelection:o,clearSignal:a,commentTextEditCandidateRef:l,cursorPosRef:s,dispatch:u,findTextAtPoint:c,lastPositionedTextId:d,onAttachImages:f,onCloseThread:p,onSend:h,pendingLinkedText:m,releaseActiveTextAttachments:g,setActiveText:y,setDragState:v,setHoveredTextId:x,setPendingLinkedText:b,setSendHintAnchorId:w,state:S,stateRef:k}){(0,jp.useLayoutEffect)(()=>{m&&(y({id:Math.random().toString(36).substring(2,9),point:m.point,subjectAnchor:m.subjectAnchor,text:"",fontSize:12,isNew:!0,linkedSelector:m.linkedSelector,target:m.target,linkedAnchor:m.linkedAnchor,elements:m.elements}),b(null))},[m,y,b]),(0,jp.useEffect)(()=>{let e=e=>{if(t)return;let n=c({x:e.clientX+window.scrollX,y:e.clientY+window.scrollY});x(n?.id??null)};return window.addEventListener("mousemove",e),()=>window.removeEventListener("mousemove",e)},[t,c,x]);let E=(0,jp.useCallback)(()=>{if(!t||n.current?.id!==t.id)return;if(n.current=null,t.domEdit)return void y(null);let e=function(e){if(e.domEdit){let t=e.domEdit;return e.text===t.originalText?{action:null,sendHintAnchorId:null,attachedImages:null}:{action:$d(t,e.text),sendHintAnchorId:null,attachedImages:null}}let t=e.images??[],n=t.length,r=e.attachments??[];if(!Od(e))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:Hd(e,i),sendHintAnchorId:e.id,attachedImages:n>0?{annotationId:e.id,images:t}:null}}(t);e.sendHintAnchorId&&w(e.sendHintAnchorId),e.action&&u(e.action),e.attachedImages&&f&&f(e.attachedImages.annotationId,e.attachedImages.images),y(null)},[t,n,u,f,y,w]),C=(0,jp.useCallback)(()=>{let e=n.current;if(e){if(!e.isNew||e.domEdit)return void E();n.current=null,g(e.attachments),y(null),w(null)}},[n,E,g,y,w]),M=(0,jp.useCallback)(e=>{let t=k.current.annotations.find(t=>t.id===e);if(!t||"text"!==t.type||!t.points[0]||"pending"!==(t.status??"pending"))return;let r=n.current;r&&r.id!==t.id&&C(),o(),i(),d.current=null,s.current=t.text?.length??0,w(t.id),t.color&&u({type:"SET_COLOR",payload:t.color}),y({id:t.id,point:t.points[0],text:t.text||"",fontSize:t.fontSize||12,isNew:!1,groupId:t.groupId,linkedSelector:t.linkedSelector,target:t.target,linkedAnchor:t.linkedAnchor,elements:t.elements,...t.region?{region:t.region}:{},attachments:t.attachments,interactionEpisode:t.interactionEpisode})},[n,i,o,C,s,u,d,y,w,k]),T=(0,jp.useRef)(!1),j=(0,jp.useCallback)(()=>{if(!h)return;let e=n.current;if(function(e){return!!e&&(void 0!==e.originalText?e.text!==e.originalText:e.text.trim().length>0||!(!e.hasInteractionEpisode&&!e.hasAttachments))}(e?{text:e.text,originalText:e.domEdit?.originalText,hasAttachments:!(!e.images?.length&&!e.attachments?.length),hasInteractionEpisode:!!e.interactionEpisode?.steps.length}:null))return T.current=!0,void E();h()},[n,E,h]);(0,jp.useEffect)(()=>{t||!T.current||(T.current=!1,h?.())},[t,h,S.annotations,S.textModifications]);let A=(0,jp.useRef)(a);(0,jp.useEffect)(()=>{if(a===A.current)return;A.current=a;let e=n.current;e?.domEdit&&e.domEdit.segments.forEach(e=>{e.textNode.nodeValue=e.originalText});let t=e?.isNew?e.attachments??[]:[];g(t),T.current=!1,y(null),b(null),w(null),v(null),s.current=null,d.current=null,localStorage.removeItem(Ua)},[n,a,s,d,g,y,v,b,w]);let R=(0,jp.useCallback)((t,n,i,o=!1)=>{let a={x:window.scrollX,y:window.scrollY},l=e?.editableTextAtPoint({x:t,y:n});return l?function(e,t,n){let{projected:r,node:i}=e,{element:o,subject:a,target:l,selector:s}=r,u=a.bounds,c=o.ownerDocument.defaultView.getComputedStyle(o),d=Rd({textNode:i,textNodePath:[0],targetElement:o,segments:[{textNode:i,textNodePath:[0],originalText:i.data}],originalText:i.data,rect:u,boundaryRect:u,boundaryRects:[u],firstLineIndent:0,styles:c,fontSize:parseFloat(c.fontSize)||12,wrapsText:!1},t,n);return Object.assign(d.domEdit,{target:l,beginEdit:e.beginEdit,sourceEditor:e.sourceEditor,selector:s,durableSelector:s,element:{...r.elementInfo,textContent:i.data}}),d}(l,i,a):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=Vn(e,t);if(!n||Ni(n))return null;let i=n?.ownerDocument??document,o=ct(e,t,i),a=Di(i,o.x,o.y)?.node??null;if(a&&!n.contains(a)&&(a=null),!a){let e=n;e&&!Ni(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 _i(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(Ni(l))return null;for(;!r&&l.parentElement&&l!==i.body;){let e=dt(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(Ni(n))break;if(Array.from(n.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.nodeValue?.trim())){l=n;continue}let r=dt(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 _i(s,a);let c=l.tagName.toLowerCase();if("script"===c||"style"===c||"textarea"===c||"input"===c)return null;let d=$i(l).filter(e=>!r||e.textNode===a),f=d.map(e=>e.originalText).join("");if(!f.trim())return null;let p=Fi(l,a);if(!p)return null;let h=dt(l).getComputedStyle(l),m=Wi(d,l,h,r),{textRect:g,boundaryRect:y,boundaryRects:v,flowRect:x,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?v.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:v,flowRect:x,firstLineIndent:b,styles:h,fontSize:w,wrapsText:S,singleTextNode:r}})}(e.clientX,e.clientY,e.canvas,e.singleTextNode);return t?Rd(t,e.clickPoint,e.scroll):null}({singleTextNode:o,clientX:t,clientY:n,clickPoint:i,canvas:r.current,scroll:a})},[r,e]),I=(0,jp.useCallback)(e=>{p?.(),b(null),v(null),w(null),o(),i(),d.current=null;let t=e.domEdit?.targetElement;if("P"===t?.tagName){let n=Yi(t)?.root??t,r=jn(Ld(n),n.ownerDocument),i=window.location.pathname;e.paragraphSession={id:e.id,selector:r,pathname:i,originalDrafts:k.current.textModifications.filter(e=>e.selector===r&&(!e.pathname||e.pathname===i))}}y(e)},[i,o,d,k,p,y,v,b,w]);return(0,jp.useEffect)(()=>{let e=e=>{if(0!==e.button)return;let t=k.current,n=l.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(),l.current=null,I(n.edit)):l.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)}},[l,I,k]),{commitActiveText:E,finishActiveTextForTargetChange:C,createInlineTextEdit:R,enterDomTextEdit:I,editPendingLinkedComment:M,handleSendPendingBundle:j}}var Rp=u(d());var Ip=u(d());var Lp=u(d()),Pp=new Set(["resolved","needs_review","waiting_input","failed"]);function zp(e){return e.linkedSelector??(e.target?Zn(e.target):void 0)}function Np(e,t){let n=e.groupId?t.filter(t=>t.groupId===e.groupId):[e],r=n.find(e=>void 0!==e.status&&Pp.has(e.status)),i=n.find(e=>e.threadId),o=n.find(e=>zp(e)),a=o?zp(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 Dp=u(d()),_p=["flex-start","center","flex-end"],Fp=["flex-start","center","flex-end"];var $p=u(d());function Op(e){return"colors"===e.kind?"variant":"values"===e.kind?"value":void 0}function Hp(e){return"variant"!==e.stage||!Ws(e.family,e.subproperty)||"border"!==e.family&&"color"!==e.family&&"text"!==e.family?"value"===e.stage?{kind:"values",family:e.family,subproperty:e.subproperty}:uf:{kind:"colors",family:e.family}}function Wp({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:v,readColor:x,readStep:b}){(0,$p.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:Hp(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=gf(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=mf(e.scope,e.query);return n?.nextScope?{handled:!0,destination:{mode:"navigate",scope:e.scope,value:n.destination},stage:Op(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()?mf(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:Op(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=mf(e.scope,e.query);return n?n.nextScope?{handled:!0,destination:{mode:"navigate",scope:e.scope,value:n.destination},stage:Op(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=gf(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??Gs(t,e.subproperty);return{next:{family:t,subproperty:n,step:Xs(t,e.step,n),stage:"colors"===o.kind?"variant":"family"},pulseContextLabel:!1}}let a=r.family,l=void 0!==r.step,s=su(a),u=!l&&Ws(a,r.subproperty??"all")?n.readColor(s):null,c=r.subproperty??Gs(a,e.subproperty);"color"===a&&"family"===r.stage&&(c=u?.name??fs),("border"===a||"text"===a)&&"color"===r.subproperty&&(c=u?.name??fs);let d=l?null:u?u.name===c?u.step:ds:n.readStep(a,c);return{next:{family:a,subproperty:c,step:r.step??d??Xs(a,e.step,c),stage:r.stage},pulseContextLabel:"family"!==r.stage}}(m,e,{readColor:x,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&&v.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=xs.indexOf(e);return xs[(n+t+xs.length)%xs.length]}(e.family,n),r="color"===t?fs:Gs(t,e.subproperty);return{handled:!0,next:{family:t,subproperty:r,step:"color"===t?ps:Xs(t,e.step,r),stage:e.stage}}}return"variant"===e.stage&&Ws(e.family,e.subproperty)?{handled:!0,next:{...e,subproperty:gs(e.subproperty,n),step:ds}}:{handled:!0,next:{...e,step:Js(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=Ks(e),i="text"!==e&&"border"!==e||!Hs(t)?Qs(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:ds}};let t=n.readColor(su(e.family));return{handled:!0,next:{...e,subproperty:t?.name??fs,step:t?.step??ps,stage:Zs(e.stage,e.family,o)}}}return{handled:!0,next:{...e,subproperty:o,step:n.readStep(e.family,o)??Xs(e.family,e.step,o),stage:Zs(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??fs,step:t?.step??ps,stage:"variant"}}}if(("text"===e.family||"border"===e.family)&&"color"===e.subproperty){let t=n.readColor(su(e.family));return{handled:!0,next:{...e,subproperty:t?.name??fs,step:t?.step??ps,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:Xs(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:Ws(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&&Ws(e.family,e.subproperty)?"variant":"family"}}:{handled:!1,next:e}}(S.replayAsSteering&&S.restore?S.restore:m,e.key,{readColor:x,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?v.current(e):h(e=>e+1)}};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[e,v,t,m,y,o,x,b,f,d,p,a,c,h,u,l,s,i,n,r,g])}var Bp=u(d()),Vp=u(d());function qp(e,t){let n=(0,Vp.useRef)(t);n.current=t;let{dragRef:r,pointerLockElementRef:i,replaceDrag:o,clearDrag:a,releasePointerLock:l}=e;(0,Vp.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:Mu(e.cursor.x+t.x,n.width),y:Mu(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=Su("translate",e.startTranslate.x+n.x),l=Su("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?ku(e.side,n):e.corner?Eu(e.corner,n):e.subproperty,c=e.transformKind?Su(e.transformKind,s):wu(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?ku(i.side,e):i.corner?Eu(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 Yp=u(d()),Up=u(x());function Xp(e){return 0===e.button&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey}function Kp(e){return e instanceof Element&&null!==e.closest("[data-popmelt-subject-label-action]")}var Qp="__active_text_send_hint__";function Gp({historyPreview:e,onPlaceSample:t,bridgeUrl:n,steeringContextStorageKey:r,state:i,dispatch:o,onScreenshot:a,inFlightAnnotationIds:l,inFlightOrientationLabels:s,canvasApprovals:u,activeAnnotationIds:c,queuePositionMap:d,inFlightStyleSelectors:f,inFlightStyleSelectorJobIds:p,inFlightSelectorColors:h,modifiedElementThreadStates:m,dismissedThreadIds:g,onAttachImages:y,onRemoveImages:v,onCaptureInteractionFrame:x,onSend:b,onViewThread:w,onCloseThread:S,onArchiveThread:k,onDeleteSubmittedAnnotation:E,highlightedAnnotationIds:C,cycleFocusedAnnotationIds:M,onCanvasInteraction:T,focusedThreadAnnotationId:A,openThreadId:I,hasOpenThread:P=!1,externalCanvasRef:z,toolbarRef:N,threadPanelElement:D,clearSignal:_=0,subjectRegistry:F,subjectRegistryReady:$=!0,onFocusTargetChange:O,onFocusActivity:H,commitCommentRef:W,onOpenPhoneComment:B,onUnsentCommentChange:V,showSteerChangeBadges:q=!0,onSteerPreviewChange:Y,onSteerTargetClick:U,nativeFixtureInput:X=!1,steerControlBounds:K,canEditSteerText:Q}){let G=(0,Va.useContext)(li),{canvasRef:Z,redrawAll:J,resizeCanvas:ee}=function(){let e=(0,ul.useRef)(null),t=(0,ul.useCallback)(()=>{let t=e.current;if(!t)return;let n=t.getContext("2d");n&&n.clearRect(0,0,t.width,t.height)},[]),n=(0,ul.useCallback)((t,n,r,i=1,o=!1,a=!1)=>{let l=e.current;if(!l)return;let s=l.getContext("2d");s&&function(e,t,n,r,i=1,o=!1,a=!1){let l=t.status??(t.captured?"in_flight":"pending"),s="pending"===l?t.color:"#8c8c8c";switch(e.save(),e.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([...Wr]),e.stroke(),e.restore()))}(e,t.region.points,s,!a),t.type){case"freehand":((e,t,n,r)=>{let i=hl(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()})(e,t.points,s,t.strokeWidth);break;case"line":((e,t,n,r)=>{let i=hl(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()})(e,t.points,s,t.strokeWidth);break;case"rectangle":((e,t,n,r)=>{let i=hl(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))})(e,t.points,s,t.strokeWidth);break;case"circle":((e,t,n,r)=>{let i=hl(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()})(e,t.points,s,t.strokeWidth);break;case"text":if(t.text&&t.points[0]){let i="pending"===l?"#ffffff":"#dddddd";!function(e,t,n,r,i=12,o,a,l,s="#dddddd",u,c=!1){if(!n)return;let d=i*ci,f=n.replace(/\\n/g," "),p=void 0!==o?o+". "+f:f;e.font=`${i}px ${fi}`,e.textBaseline="middle";let h=void 0!==a?Math.min(400,Math.max(60,window.innerWidth-a-16)):400,m=c?16:0,g=hi(e,p,Math.max(60,h-m)),y=m+e.measureText(g).width,v=gi(t,i,l,y+16);e.fillStyle=r;let x=v.x-8,b=v.y-4,w=y+16,S=d+8;e.beginPath(),e.roundRect(x,b,w,S,si(u)),e.fill();let k=v.y+d/2;if(c){let t=v.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,v.x+m,k)}(e,t.points[0],t.text,s,t.fontSize,n,t.points[0].x,r,i,Ja(t)?"bottom-left":t.linkedAnchor,o)}}e.restore()}(s,t,n,r,i,o,a)},[]),r=(0,ul.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,ul.useRef)(null),o=(0,ul.useRef)(new Map);(0,ul.useEffect)(()=>()=>{null!==i.current&&cancelAnimationFrame(i.current)},[]);let a=(0,ul.useCallback)((a,l,s,u=0,c=0,d,f,p,h,m,g=.5,y,v)=>{null!==i.current&&cancelAnimationFrame(i.current),i.current=null;let x=performance.now(),b=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,w=new Map,S=x;for(let e of a){if("text"!==e.type)continue;let t=Number(mo(e,u,c)),n=o.current.get(e.id),r=n?.to!==t||b?{from:n&&!b?ml(n,x):t,to:t,start:x}:n;w.set(e.id,r),r.from!==t&&(S=Math.max(S,r.start+160))}o.current=w;let k=o=>{let x=e=>{let t=w.get(e);return t?ml(t,o):1};if(t(),a.forEach(e=>{let t=x(e.id);if(0===t)return;let r={...e,points:gl(e.points,u,c),...e.region?{region:{...e.region,points:gl(e.region.points,u,c)}}:{}},i=d?.get(e.id),o=m?.has(e.id)??!1,a=!!f?.size,l=f?.has(e.id)??!1,s=a?l?1:.2:!h||h.has(e.id)||o?1:g;n(r,i,p,s*t,y?.has(e.id),v?.has(e.id))}),l&&l.length>0&&s){let t=e.current?.getContext("2d");for(let e of l){let n=a.find(t=>t.id===e);if(n&&x(n.id)>0){let e=m?.has(n.id)??!1,i=!!f?.size,o=f?.has(n.id)??!1,l=i?o?1:.2:!h||h.has(n.id)||e?1:g,p={...n,points:gl(n.points,u,c)};if(t?.save(),t&&(t.globalAlpha=l*x(n.id)),r(p,s),t&&"text"!==n.type&&d&&(!n.groupId||!a.some(e=>e.groupId===n.groupId&&"text"===e.type))){let e=d.get(n.id);if(void 0!==e){let r=vl(p);if(r){let i="pending"===(n.status??(n.captured?"in_flight":"pending"))?n.color:"#999999";yl(t,r.x,r.y,e,i,s)}}}t?.restore()}}}i.current=o<S?requestAnimationFrame(k):null};k(x)},[t,n,r]),l=(0,ul.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:a,resizeCanvas:l}}(),te=(0,Va.useRef)(null),[ne,re]=(0,Va.useState)(null),[ie,oe]=(0,Va.useState)(0),[ae,le]=(0,Va.useState)(0),se=(0,Va.useCallback)(()=>le(e=>e+1),[]),ue=qo(),ce=(0,Va.useCallback)(e=>{Z.current=e,z&&(z.current=e),re(t=>t===e?t:e)},[z,Z]);(0,Va.useLayoutEffect)(()=>{if(!F||!$)return;let e=!1;for(let t of i.annotations)t.target&&(e=!0,!F.resolve(t.target)&&t.elements?.[0]&&F.restore(t.target,t.elements[0]));e&&oe(e=>e+1)},[i.annotations,F,$]);let de=(0,Va.useRef)(null),fe=(0,Va.useRef)(0),[pe,he]=(0,Va.useState)(null),me=(0,Va.useCallback)(()=>{let e=de.current;de.current=null,he(null),e&&(e.session.cancel(),e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId))},[]),ge=(0,Va.useRef)(!1),[ye,ve]=(0,Va.useState)(!1),xe=(0,Va.useRef)(null),be=(0,Va.useRef)(null),[we,Se]=(0,Va.useState)(!1),ke=(0,Va.useRef)(Promise.resolve()),[Ce,Me]=(0,Va.useState)(0),[Te,je]=(0,Va.useState)(null),Ae=(0,Va.useCallback)(()=>{if(!x)return Promise.resolve(null);let e=ke.current.then(async()=>(await new Promise(e=>window.requestAnimationFrame(()=>e())),x()));return ke.current=e.catch(()=>null),e},[x]),Re=(0,Va.useRef)(i.activeTool),Ie=(0,Va.useRef)(void 0);(0,Va.useEffect)(()=>()=>clearTimeout(Ie.current),[]);let Le=(0,Va.useRef)(null),Pe=(0,Va.useRef)(null),ze=(0,Va.useRef)(null),Ne=(0,Va.useRef)(null),De=(0,Va.useCallback)(()=>{xe.current?.cancel(),xe.current=null,be.current=null,ge.current=!1,ze.current=null,Ne.current=null,ve(!1),Se(!1),Me(0),je(null)},[]),_e=(0,Va.useCallback)(()=>{me(),ge.current=!0,Re.current=i.activeTool,ve(!0)},[me,i.activeTool]);(0,Va.useEffect)(()=>{ge.current&&i.activeTool!==Re.current&&De()},[De,i.activeTool]),(0,Va.useEffect)(()=>{(!i.isAnnotating||"inspector"!==i.activeTool)&&me()},[me,i.activeTool,i.isAnnotating]),(0,Va.useEffect)(()=>()=>{let e=de.current;de.current=null,e?.session.cancel()},[]);let{activeText:Fe,setActiveText:$e,handleTextPaste:Oe,removeActiveTextAttachment:Be,releaseActiveTextAttachments:Ve}=function({bridgeUrl:e,annotations:t,persist:n=!0}){let[r,i]=(0,qa.useState)(()=>n?function(){if(typeof window>"u")return null;try{let e=window.localStorage.getItem(Ua),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,qa.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,qa.useEffect)(()=>{n&&(r&&!r.domEdit?window.localStorage.setItem(Ua,JSON.stringify(r)):window.localStorage.removeItem(Ua))},[r,n]),(0,qa.useEffect)(()=>{let t=r?.attachments?.map(e=>e.id)??[];!e||0===t.length||async function(e,t){0!==t.length&&await We(`${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,qa.useCallback)(t=>{!e||!t?.length||Promise.all(t.map(t=>He(e,t.id).catch(()=>{})))},[e]),a=(0,qa.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 We(`${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,qa.useCallback)(t=>{i(e=>e&&{...e,attachments:e.attachments?.filter(e=>e.id!==t)}),e&&He(e,t).catch(()=>{})},[e]);return{activeText:r,setActiveText:i,handleTextPaste:a,removeActiveTextAttachment:l,releaseActiveTextAttachments:o}}({persist:!X,bridgeUrl:n,annotations:i.annotations}),[qe,Ye]=(0,Va.useState)(null),[Ue,Xe]=(0,Va.useState)(null),[Ke,Qe]=(0,Va.useState)(null),[Ge,Ze]=(0,Va.useState)(0),Je=(0,Va.useRef)(null),et=(0,Va.useRef)(null),tt=(0,Va.useRef)(null),[nt,rt]=(0,Va.useState)(null),[at,lt]=(0,Va.useState)(null),st=(0,Va.useRef)(void 0);void 0===st.current&&(st.current=r&&typeof window<"u"?function(e,t){try{let n=e.getItem(t);if(!n)return null;let r=JSON.parse(n);return Ef(r)&&1===r.version?function(e){let t=Tf(e);if(!t||!Ef(e))return null;if(null===e.query)return{...t,query:null};let n=function(e){if(!Ef(e)||"string"!=typeof e.query||!Array.isArray(e.segments)||!e.segments.every(e=>"string"==typeof e))return null;let t=jf(e.scope),n=Tf(e.origin);if(!t||!n||!Array.isArray(e.history))return null;let r,i=[];for(let t of e.history){if(!Ef(t))return null;let e=jf(t.scope),n=Tf(t.snapshot);if(!e||!n)return null;i.push({scope:e,snapshot:n})}if(void 0!==e.segmentOrigin){let t=Tf(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,r):null);let ct=st.current,[ht,mt]=(0,Va.useState)(()=>ct?.family??"padding"),[gt,yt]=(0,Va.useState)(()=>ct?.step??4),[vt,xt]=(0,Va.useState)(()=>ct?.subproperty??"all"),[St,kt]=(0,Va.useState)(()=>ct?.stage??"family"),[Et,Ct]=(0,Va.useState)(null);!function(e,t){(0,Yp.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])}(et,we?je:i.isAnnotating&&"sticker"===i.activeTool?Ct:void 0);let[Mt,Tt]=(0,Va.useState)(null),jt=(0,Va.useCallback)(e=>{Tt({id:performance.now(),nativeReady:!1,tool:e})},[]),[Rt,It]=(0,Va.useState)(0),[Lt,Pt]=(0,Va.useState)(0),[zt,Nt]=(0,Va.useState)(0),[Dt,_t]=(0,Va.useState)(0),[Ft,$t]=(0,Va.useState)(!1),[Ot,Ht]=(0,Va.useState)(0),[Wt,Bt]=(0,Va.useState)(()=>ct?.query??null);(0,Va.useEffect)(()=>{!r||typeof window>"u"||function(e,t,n){try{e.setItem(t,JSON.stringify({version:1,context:n}))}catch{}}(window.localStorage,r,{family:ht,step:gt,subproperty:vt,stage:St,query:Wt})},[r,ht,Wt,St,gt,vt]);let Vt=(0,Va.useRef)(i.activeTool),qt=(0,Va.useRef)(!1),Yt=(0,Va.useRef)(()=>!1),Kt=(0,Va.useRef)(null),Qt=(0,Va.useRef)(null);(0,Va.useLayoutEffect)(()=>{let e=Kt.current;Y&&Qt.current!==e&&(Qt.current=e,Y(e))},[Ot,Y]);let Gt=(0,Va.useRef)(null),Zt=(0,Va.useRef)(i.styleModifications),Jt=(0,Va.useRef)(null),en=(0,Va.useRef)(null),tn=(0,Va.useRef)(null),nn=(0,Va.useRef)(null),rn=(0,Va.useRef)(null),on=(0,Va.useCallback)(()=>{null!==rn.current&&(cancelAnimationFrame(rn.current),rn.current=null)},[]),an=(0,Va.useCallback)(()=>{if(on(),!G)return;let e,t=n=>{e??=n,function(e){if(e)for(let t of e.activeDeclarations){let n=e.element.style;n.getPropertyValue(t.property)===t.value&&n.getPropertyPriority(t.property)===t.priority||Lf(e.element,t)}}(Kt.current);let r=Jt.current;r&&Kt.current?.element===r.element&&(r.renderedQuad=Ut(r.element,r.layoutQuad)),nn.current?.(),rn.current=n-e<100?requestAnimationFrame(t):null};rn.current=requestAnimationFrame(t)},[on,G]);(0,Va.useEffect)(()=>(G?Kt.current&&an():on(),on),[G,an,on]);let cn=(0,Va.useCallback)(()=>{on();let e=Kt.current;e&&(zf(e),Kt.current=null,Gt.current=null,Ht(e=>e+1))},[on]),{handleShakePointerMove:dn,pendingShakeToolTransitionRef:fn}=function({activeTool:e,isAnnotating:t,clearStickerPreview:n,dispatch:r,setStickerCursor:i,startCursorSwitchPulse:o}){let a=(0,Mp.useRef)(new Tp),l=(0,Mp.useRef)(null);return{handleShakePointerMove:(0,Mp.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:i.activeTool,isAnnotating:i.isAnnotating,clearStickerPreview:cn,dispatch:o,setStickerCursor:Ct,startCursorSwitchPulse:jt});(0,Va.useLayoutEffect)(()=>{let e=Zt.current,t=i.styleModifications;Zt.current=t,e!==t&&Kt.current&&(on(),function(e,t,n){e&&(zf(e),lo(t),ao(n))}(Kt.current,e,t),Kt.current=null,Gt.current=null,Jt.current=null,Ht(e=>e+1))},[i.styleModifications,on]),(0,Va.useLayoutEffect)(()=>{Af(i.activeTool,i.isAnnotating)&&(cn(),en.current=null,tn.current=null)},[cn,i.activeTool,i.isAnnotating]);let mn=(0,Va.useCallback)(()=>{kt("family"),Ct(null),Bt(null)},[]);(0,Va.useLayoutEffect)(()=>{let e=Vt.current,t=i.activeTool,n=fn.current,r=n?.from===e&&n.to===t;fn.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,r,qt.current);qt.current=o.preservedAway,o.shouldReset&&mn()},[fn,mn,i.activeTool]),(0,Va.useLayoutEffect)(()=>{i.isAnnotating||(qt.current=!1,mn())},[mn,i.isAnnotating]);let yn=(0,Va.useCallback)((e,t)=>{if(cn(),!nt)return null;let n=window.getComputedStyle(nt);return function(e,t,n="all"){let r=Qs(e,n);if("color"===e||("text"===e||"border"===e)&&Hs(r)){let e=function(e,t){let n=ys(t);return n?cs.reduce((t,r)=>{let i=ys(hs[e][t]),o=ys(hs[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=ms(r,e);return t.every(e=>vs(e,n))?e:null}if("text"===e){if("line-height"===r&&"normal"===(t[0]??"").trim().toLowerCase())return"normal";if("line-height"===r){let n=iu(t[0]??"",e),r=iu(t[1]??"",e);return null===n||null===r||0===r?null:vu(js,e=>gu[e],n/r)}if("letter-spacing"===r){let n=(t[0]??"").trim().toLowerCase();if("normal"===n)return"normal";let r=iu(n,e),i=iu(t[1]??"",e);return null===r||null===i||0===i?null:vu(As,e=>yu[e],r/i)}return ou(e,r,t[0]??"")}if("transform"===e||"opacity"===e||"stack"===e&&"gap"!==r)return ou(e,r,t[0]??"");if("grid"===e&&"gap"!==r){let e=t[0]?.trim().split(/\\s+/).filter(Boolean).length??0;return Us("grid",r).includes(e)?e:null}let i=t.map(t=>iu(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=Us(e,r).filter(e=>"number"==typeof e);return 0===a.length?null:a.reduce((t,n)=>Math.abs(Number.parseFloat(cu(e,n,r))-o)<Math.abs(Number.parseFloat(cu(e,t,r))-o)?n:t)}(e,ru(e,t).map(e=>n.getPropertyValue(e)),t)},[cn,nt]),vn=(0,Va.useCallback)(e=>(cn(),nt?function(e){let t=ys(e);if(!t)return null;let n=null;for(let e of us)for(let r of cs){let i=ys(hs[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(nt).getPropertyValue(e)):null),[cn,nt]);Wp({active:"sticker"===i.activeTool&&i.isAnnotating,family:ht,step:gt,subproperty:vt,stage:St,query:Wt,setFamily:mt,setStep:yt,setSubproperty:xt,setStage:kt,setQuery:Bt,setCursor:Ct,setContextLabelPulse:Pt,setDepthSnapPulse:Nt,setRejectPulse:_t,lastCursorRef:et,toolbarRef:N,previewRef:Kt,applyStickerRef:Yt,readColor:vn,readStep:yn});let[xn,bn]=(0,Va.useState)(null),[wn,En]=(0,Va.useState)(null),[Cn,Mn]=(0,Va.useState)(null),[Ln,Pn]=(0,Va.useState)(!1),zn=(0,Va.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}),Wn=(0,Va.useRef)({isDragging:!1,hasMoved:!1,mode:"move",startX:0,startY:0,element:null,originalParent:null,originalIndex:-1,selector:null,durableSelector:null,elementInfo:null}),[Bn,qn]=(0,Va.useState)(null),[Yn,Un]=(0,Va.useState)(null),[Xn,Kn]=(0,Va.useState)(null),[Qn,Gn]=(0,Va.useState)(null),er=(0,Va.useRef)({x:0,y:0}),[tr,nr]=(0,Va.useState)({x:0,y:0}),rr=(0,Va.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}),[ir,or]=(0,Va.useState)(null),[ar,lr]=(0,Va.useState)(null),[sr,ur]=(0,Va.useState)(null),[cr,dr]=(0,Va.useState)(!1),[fr,pr]=(0,Va.useState)(0),{swipeHint:hr,clearSwipeHint:mr}=function({enabled:e,dispatch:t,handCursorRef:n,setGapRefreshKey:r}){let[i,o]=(0,Dp.useState)(null),a=(0,Dp.useCallback)(()=>o(null),[]);return(0,Dp.useEffect)(()=>{let i=null,a=!1,l=null,s=null,u=null,c=null,d=0,f=(e,t)=>{let n=Vn(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:Tn(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)},v=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 v=n.clientX-u,x=n.clientY-c,b=Math.abs(v)>=Math.abs(x)?v:x;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(v)<20&&Math.abs(x)<20)return;let w=f(l,s);if(!w)return;let S=Math.abs(v)>=Math.abs(x)?"horizontal":"vertical",k=("horizontal"===S?v:x)>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=_p.indexOf(r)+i;if(o<0||o>=_p.length)return;let a=_p[o],{selector:l,durableSelector:s}=h(e);ro(e,"justify-content",a),t({type:"MODIFY_STYLES_BATCH",payload:{selector:l,durableSelector:s,element:Hn(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);ro(e,"flex-direction",r),t({type:"MODIFY_STYLES_BATCH",payload:{selector:i,durableSelector:a,element:Hn(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=Fp.indexOf(a)+i;if(l<0||l>=Fp.length)return;let s=Fp[l],{selector:u,durableSelector:c}=h(e);ro(e,"align-items",s),t({type:"MODIFY_STYLES_BATCH",payload:{selector:u,durableSelector:c,element:Hn(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)},x=e=>{("Shift"===e.key||"Alt"===e.key)&&g()};return window.addEventListener("keydown",y),window.addEventListener("mousemove",v),window.addEventListener("mousedown",g),window.addEventListener("keyup",x),()=>{window.removeEventListener("keydown",y),window.removeEventListener("mousemove",v),window.removeEventListener("mousedown",g),window.removeEventListener("keyup",x),i&&clearTimeout(i)}},[t,e,n,r]),{swipeHint:i,clearSwipeHint:a}}({enabled:"hand"===i.activeTool&&i.isAnnotating,dispatch:o,handCursorRef:er,setGapRefreshKey:pr}),gr=(0,Va.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}),[yr,vr]=(0,Va.useState)(null),[xr,br]=(0,Va.useState)(null),[wr,Sr]=(0,Va.useState)(null),kr=(0,Va.useRef)({isDragging:!1,property:null,startX:0,startY:0,originalFontSize:0,originalLineHeight:0,originalRatio:1.2,element:null,elementInfo:null,selector:null,durableSelector:null}),[Er,Cr]=(0,Va.useState)(null),[Mr,Tr]=(0,Va.useState)(null),[jr,Ar]=(0,Va.useState)(null),{modifiersRef:Rr,shiftOnly:Ir}=function(){let e=(0,jl.useRef)({shift:!1,cmd:!1}),[t,n]=(0,jl.useState)(!1);return(0,jl.useEffect)(()=>{let t=t=>{let r=t.metaKey||t.ctrlKey;e.current={shift:t.shiftKey,cmd:r},n(t.shiftKey&&!r&&!t.altKey)},r=()=>{e.current={shift:!1,cmd:!1},n(!1)};return window.addEventListener("keydown",t,!0),window.addEventListener("keyup",t,!0),window.addEventListener("pointerover",t,!0),window.addEventListener("blur",r),()=>{window.removeEventListener("keydown",t,!0),window.removeEventListener("keyup",t,!0),window.removeEventListener("pointerover",t,!0),window.removeEventListener("blur",r)}},[]),{modifiersRef:e,shiftOnly:t}}(),Lr=(0,Va.useRef)(h);Lr.current=h;let Pr=(0,Va.useCallback)(e=>{let t=Lr.current;if(!t||0===t.size)return!1;for(let n of t.keys())try{if(wt(e,n))return!0}catch{}return!1},[]),{applySticker:zr,beginSteerGapDrag:Nr,beginSteerRadiusDrag:Dr,beginSteerSpacingDrag:_r,beginSteerTransformDrag:$r,steerDrag:Vr,steerDragRef:qr}=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 v=function(){let[e,t]=(0,Vp.useState)(null),n=(0,Vp.useRef)(e);n.current=e;let r=(0,Vp.useRef)(null),i=(0,Vp.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,Vp.useCallback)((e,r)=>{n.current=e,t(e),i(r)},[i]),a=(0,Vp.useCallback)(e=>{n.current=e,t(e)},[]),l=(0,Vp.useCallback)(()=>{n.current=null,t(null)},[]),s=(0,Vp.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:x,dragRef:b,startDrag:w}=v,S=(0,Bp.useCallback)((e,r)=>{if(!e.isConnected||Ni(e))return u(e=>e+1),!1;t();let i=r?.family??f,o=r?.step??p,a=r?.subproperty??h;if(!Xd(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=nu(t,r),a=cu(t,n,r),l=pu(t),s=du(t,r,n),u="border"===t&&!Ws(t,r)&&"number"==typeof n&&n>0?lu(r):null,c={family:t,subproperty:Qs(t,r),step:n},d=[{property:o,original:i.getPropertyValue(o).trim()||"0px",modified:a,token:uu(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:uu(t,n,r),sticker:c})}return{alreadyApplied:au(t,n,r,e=>i.getPropertyValue(e)),changes:d}}(e,i,o,a);if(s.alreadyApplied)return u(e=>e+1),!1;let c=Ld(e),d=Tn(e);return function(e,t){for(let n of t.changes)ro(e,n.property,n.modified)}(e,s),n({type:"MODIFY_STYLES_BATCH",payload:{selector:c,durableSelector:d,element:{...Hn(e),selector:d},changes:s.changes}}),l(e=>e+1),!0},[t,n,l,u,f,p,h]);e.current=S;let k=(0,Bp.useCallback)((e,n,i)=>{if(!(r instanceof HTMLElement))return;i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId),t();let o="margin"===e?Ci(r):Ei(r),a="left"===n||"right"===n?"x":"y",l=ku(n,i.altKey||i.ctrlKey),s="margin"===e,u="top"===n||"left"===n?s?-1:1:s?1:-1,f=wu(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]),E=(0,Bp.useCallback)((e,n)=>{if(!(r instanceof HTMLElement)||"stack"!==f&&"grid"!==f)return;n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),t();let i=wi(r),o="row"===e?i.row:i.column,a=wu(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]),C=(0,Bp.useCallback)((e,n)=>{if(!(r instanceof HTMLElement))return;n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),t();let i=Eu(e,n.altKey||n.ctrlKey),o=Ti(r)[e],a=wu("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:Cu(e),step:a,hasMoved:!1,corner:e,cursor:{x:n.clientX,y:n.clientY}},n.currentTarget)},[t,r,c,d,w]),M=(0,Bp.useCallback)((e,n,i,o)=>{if(!At(r))return;i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId);let a=window.getComputedStyle(r).getPropertyValue(e).trim(),l="translate"===e?hn(a):void 0,s="scale"===e?100*(Number.parseFloat(a)||1):"translate"===e?l.x:Number.parseFloat(a)||0,u=Su(e,s),f=Xt(r),p=Ut(r,f),h="scale"===e&&n?function(e,t){let n=ln(e);return pn({x:e[t].x-n.x,y:e[t].y-n.y})}(p,n):"rotate"===e?function(e,t){let n=ln(e),{handle:r}=sn(e,28,t),i=pn({x:r.x-n.x,y:r.y-n.y});return{x:-i.y,y:i.x}}(p,o??un(p,20).side):void 0,y=l?{x:Su("translate",l.x),y:Su("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 qp(v,{onSelectionChange:(0,Bp.useCallback)((e,t)=>{d(e),c(t)},[c,d]),onCursorChange:(0,Bp.useCallback)(e=>{i.current=e,s(e)},[i,s]),onCommit:(0,Bp.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(Hn(t.element)))},[e,o,a,m,g,y]),onCancel:(0,Bp.useCallback)(()=>{t(),g.current=null,m.current=null},[t,m,g])}),{applySticker:S,beginSteerGapDrag:E,beginSteerRadiusDrag:C,beginSteerSpacingDrag:k,beginSteerTransformDrag:M,steerDrag:x,steerDragRef:b}}({applyStickerRef:Yt,clearStickerPreview:cn,dispatch:o,hoveredElement:nt,lastCanvasCursorRef:et,setHoveredElement:rt,setHoveredElementInfo:lt,setStickerApplyPulse:It,setStickerCursor:Ct,setStickerRejectPulse:_t,setStickerStep:yt,setStickerSubproperty:xt,stickerFamily:ht,stickerStep:gt,stickerSubproperty:vt,transformDragHandoffRef:tn,transformPreviewSuppressionRef:en,transformPreviewTargetRef:Jt});(0,Va.useEffect)(()=>{$t(!1);let e="transform"===Vr?.family?Vr.element:nt;if(Af(i.activeTool,i.isAnnotating)||"value"!==St||!Xd(e,ht,vt)||Ni(e))return Jt.current=null,void cn();let t={element:e,family:ht,step:gt,subproperty:vt,valueOverride:"translate"===Vr?.transformKind?Vr.translateValue:void 0},n=en.current,r="transform"===ht&&n?.element===e&&n.subproperty===vt&&n.step===gt;if(n&&!r&&(en.current=null),r){if(cn(),Jt.current?.element!==e){let{top:t,right:n,bottom:r,left:i}=e.getBoundingClientRect(),o=Xt(e);Jt.current={element:e,bounds:{top:t,right:n,bottom:r,left:i},layoutQuad:o,renderedQuad:Ut(e,o)},Ht(e=>e+1)}return}if(Kt.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}(Gt.current,t))return;if("transform"===ht){if(Jt.current?.element!==e){zf(Kt.current),Kt.current=null,Gt.current=null;let{top:t,right:n,bottom:r,left:i}=e.getBoundingClientRect(),o=Xt(e);Jt.current={element:e,bounds:{top:t,right:n,bottom:r,left:i},layoutQuad:o,renderedQuad:Ut(e,o)}}}else Jt.current=null;let o=function(e,t,n,r,i=null,o,a){i&&i.element!==e&&(zf(i),i=null);let l=a&&"transform"!==t?{bounds:i?.focus?.bounds??ut(e),origin:i?.focus?.origin??a,point:a}:null,s=window.getComputedStyle(e),u=nu(t,r),c=o?s.getPropertyValue(u).trim()===o:au(t,n,r,e=>s.getPropertyValue(e)),d=pu(t),f=du(t,r,n),p="border"===t&&!Ws(t,r)&&"number"==typeof n&&n>0?lu(r):null,h=[u,...d?["display"]:[],...f.map(e=>e.property),...p?[p]:[]],m=[...new Set(h)],g=new Set([...m,"transition"]),y=new Map(i?.declarations.map(e=>[e.property,e])??[]);for(let t of y.values())g.has(t.property)||Lf(e,t);let v=[...g].map(t=>y.get(t)??Pf(e,t)),x=m.filter(e=>!Rf.has(e));(function(e,t){Zi.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}(m)),x.length>0&&ro(e,"transition",x.map(e=>`${e} 100ms ease-out`).join(", ")),d&&ro(e,"display",d);for(let t of f)ro(e,t.property,t.value);if(ro(e,u,o??cu(t,n,r)),p){let t=window.getComputedStyle(e).getPropertyValue(p).trim();(!t||"none"===t)&&ro(e,p,"solid")}return{preview:{element:e,focus:l,declarations:v,activeDeclarations:[...g].map(t=>Pf(e,t))},stepUnavailable:c}}(e,ht,gt,vt,Kt.current,t.valueOverride,et.current);Kt.current=o.preview,Gt.current=t,$t(o.stepUnavailable),Ht(e=>e+1),an()},[cn,nt,i.activeTool,i.isAnnotating,Vr?.element,Vr?.family,Vr?.transformKind,Vr?.translateValue,ht,St,gt,vt,an]),(0,Va.useEffect)(()=>()=>{on(),zf(Kt.current),Kt.current=null,Gt.current=null,Jt.current=null,en.current=null,tn.current=null},[on]);let Yr=(0,Va.useCallback)(()=>{cn(),Jt.current=null,en.current=null,tn.current=null,rt(null),lt(null),qn(null),Un(null),Kn(null),or(null),lr(null),dr(!1),vr(null),br(null),Cr(null),Tr(null),mr()},[cn,mr]),Ur=(0,Va.useMemo)(()=>function(e,t){let n=t?.domEdit?null:t,r=new Set;for(let t of e)(t.status?"pending"===t.status:!t.captured)&&!t.threadId&&!t.replyCount||(r.add(t.id),t.groupId&&r.add(t.groupId));let i=({id:e,groupId:t})=>!(r.has(e)||t&&r.has(t));return!(!n?.text.trim()||!i(n))||e.some(e=>"text"===e.type&&e.id!==n?.id&&!!e.text?.trim()&&i(e))}(i.annotations,Fe),[i.annotations,Fe]),Xr=!!b&&Ur;(0,Va.useEffect)(()=>{V?.(W?Ur:Xr)},[V,Xr,W,Ur]);let Kr=!(!Fe||Fe.domEdit),Qr=(0,j.useSyncExternalStore)(R.subscribe,R.matches,L),Gr=Kr?Fe?.id:null,[Zr,Jr]=(0,Va.useState)(null);(0,Va.useLayoutEffect)(()=>{let e=window.visualViewport;if(!Gr||!e)return;let t=()=>{let t=Qr||e.height<innerHeight-1||e.width<innerWidth-1;Jr(t?new DOMRect(e.offsetLeft,e.offsetTop,e.width,e.height):null)};return t(),e.addEventListener("resize",t),e.addEventListener("scroll",t),()=>{e.removeEventListener("resize",t),e.removeEventListener("scroll",t)}},[Gr,Qr]);let ei=Ke?`${Ke.target.adapter}:${Ke.target.key}`:null,ti=Gr??ei;(0,Va.useEffect)(()=>{ti&&Yr()},[ti,Yr]);let ii=(0,Va.useCallback)(e=>{bn(e),e&&Yr()},[Yr]),di=(0,Va.useCallback)(e=>{En(e),e&&Yr()},[Yr]),yi=(0,Va.useCallback)((e,t)=>{Mn(t?.length?{ownerId:e,annotationIds:t}:null),t?.length&&Yr()},[Yr]),vi=(0,Va.useCallback)(e=>{Pn(e),e&&Yr()},[Yr]),xi=(0,Va.useCallback)((e,t)=>{cn();let n=Rn(e);Xd(n,t.family,t.subproperty)&&(o({type:"SELECT_ANNOTATION",payload:{id:null}}),o({type:"SET_TOOL",payload:"sticker"}),mt(t.family),xt(t.subproperty),yt(t.step),kt("value"),rt(n),lt(Hn(n)),et.current&&Ct(et.current))},[cn,o]),bi=(0,Va.useCallback)((e,t)=>{cn(),Yr(),En(null),o({type:"CLEAR_STICKER",payload:{selector:e,sticker:t}})},[Yr,cn,o]),ki=(0,Va.useCallback)(e=>{if(!w)return;w(e);let t=0,n=()=>{let e=N?.current?.getRootNode()?.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)},[w,N]),Mi=(0,Va.useRef)(i);Mi.current=i;let ji=Tl({annotations:i.annotations,currentPathname:ue,dispatch:o,stateRef:Mi,styleModifications:i.styleModifications,subjectRegistry:F,toolbarRef:N,onTargetResolutionChange:se}),Ai=(0,Va.useRef)(Fe);Ai.current=Fe;let Ii=(0,Va.useRef)(Fe);(0,Va.useEffect)(()=>{let e=!1,t=t=>{if(e=2===t.button&&t.composedPath().some(e=>e instanceof Element&&e.hasAttribute("data-popmelt-shadow-host")),Ii.current=null,2!==t.button||e)return;let n=Ai.current;Ii.current=lf(n)?n:null},n=t=>{e&&2===t.button&&t.composedPath()[0]===te.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)}},[te]);let{cursorPosRef:Li,inputRef:Pi,lastPositionedTextId:zi}=function({activeText:e,activeTextRef:t,canvasRef:n,visible:r}){let i=(0,Ip.useContext)(li),o=(0,Ip.useRef)(null),a=(0,Ip.useRef)(null),l=(0,Ip.useRef)(null),s=e?.id??null,u=e?.initialCaret??(e?.isNew&&""===e.text?0:void 0);return(0,Ip.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,Ip.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 ${fi}`;let i=function({text:e,fontSize:t,point:n,clickPoint:r,context:i}){let o=e.split("\\n"),a=t*ci,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:Fe,activeTextRef:Ai,canvasRef:te,visible:i.isAnnotating}),Di=Fe?.domEdit?.beginEdit;(0,Va.useEffect)(()=>Di?.(),[Di]),function(e,t,n){let r=(0,Rp.useContext)(li),i=e?.domEdit?.sourceEditor?void 0:e?.domEdit?.textNode,o=e?.domEdit?.targetElement;(0,Rp.useEffect)(()=>{if(!r||!i)return;let e=null,a=()=>{n.current&&o?.isConnected&&i.isConnected&&ft(o.ownerDocument)&&function(e,t){let n=Kl.get(e);if(!n?.isConnected)return!1;let{left:r,top:i,width:o,height:a}=ut(n);return t.style.left=r+"px",t.style.top=i+"px",t.style.width=o+"px",t.style.height=a+"px",!0}(o,n.current)||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||!ft(n.ownerDocument))return null;let c=dt(n).getComputedStyle(n),d=Wi(r,n,c,i),{textRect:f,boundaryRect:p,boundaryRects:h,flowRect:m,firstLineIndent:g}=d;if(Vi(o,f)&&Vi(a,p)&&function(e,t){return e.length===t.length&&e.every((e,n)=>Vi(e,t[n]))}(l,h)&&function(e,t){return e&&t?Vi(e,t):e===t}(s,m)&&Math.abs(u-g)<.5)return e;let y=Ad(n),v=(parseFloat(c.fontSize)||12)*y,x=e=>e?.endsWith("px")?parseFloat(e)*y+"px":e;return{...e,fontSize:v,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*v+"px":x(c.lineHeight),letterSpacing:x(c.letterSpacing),wordSpacing:x(c.wordSpacing)}}}),e=window.requestAnimationFrame(a)};return e=window.requestAnimationFrame(a),()=>{null!==e&&window.cancelAnimationFrame(e)}},[r,i,t,n,o])}(Fe,$e,Pi);let _i=(0,Va.useCallback)(()=>{window.requestAnimationFrame(()=>{Pi.current?.focus();let e=Pi.current?.value.length??0;Pi.current?.setSelectionRange(e,e)})},[Pi]),Fi=(0,Va.useCallback)((e,t=Ii.current)=>{let n=Ai.current,r=F?.hitTest(e)??null,i=r?.element??Vn(e.x,e.y,{allowBodyFallback:!0}),o=r?.target,a=[...Mi.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||!Za(e.linkedSelector,e.elements)?.contains(i)))),l=function(e){let t=e.activationDraft??e.activeDraft;if(lf(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(sf);return n?{kind:"annotation",value:n}:sf(e.annotationAtCursor)?{kind:"annotation",value:e.annotationAtCursor}:null}({activationDraft:t,activeDraft:n,annotations:Mi.current.annotations,selectedAnnotationIds:Mi.current.selectedAnnotationIds,lastSelectedId:Mi.current.lastSelectedId,annotationAtCursor:a});if(Ii.current=null,!l||"inspector"!==Mi.current.activeTool)return!1;let s=l.value;xe.current?.cancel();let u=s.target&&F?F.resolve(s.target):null,c=u?.subject.sourceElement??(s.linkedSelector?Rn(s.linkedSelector):null);return be.current={id:s.id,draft:"draft"===l.kind},xe.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?.()??tf(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||of(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:rf(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=tf(af(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&&!Ni(t.target)?t.target:null),o=r?.state??tf(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&&!Ni(t.target)?t.target:null);if(!i)return;let o=r?.state??tf(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??tf(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:nf(u)}:{},resolveEventTarget:e=>{if(!(e instanceof MouseEvent&&F))return;let t=F.hitTest({x:e.clientX,y:e.clientY});if(!t)return;let n=t.target;return{element:t.subject.sourceElement??null,state:nf(t),captureResult:()=>{let e=F.resolve(n);return e?nf(e):void 0}}},onActionCountChange:Me,captureFrame:x?Ae:void 0}),Yr(),Ye(null),bn(null),En(null),Me(0),je(e),Se(!0),_e(),!0},[Yr,Ae,_e,x,F]),$i=(0,Va.useCallback)(async()=>{let e=xe.current,t=be.current;if(!e||!t||!e.hasActions())return;let{episode:n,frames:r}=await e.finish();if(xe.current=null,t.draft)$e(e=>{if(e?.id!==t.id)return e;let i=e.images?.length??0;return{...e,images:[...e.images??[],...r],interactionEpisode:Gd(n,i)}});else{let e=Mi.current.annotations.find(e=>e.id===t.id);if(e){let t=e.imageCount??0,i=Gd(n,t);r.length>0&&y?.(e.id,r),o({type:"UPDATE_TEXT",payload:{id:e.id,text:e.text??"",imageCount:t+r.length,interactionEpisode:i}})}}De(),t.draft&&_i()},[o,De,_i,y,$e]),Oi=(0,Va.useCallback)(e=>{let t=Ai.current;if(t?.id===e&&($e(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=Mi.current.annotations.find(t=>t.id===e)?.interactionEpisode?.frames?.map(e=>e.imageIndex)??[];n.length>0&&v?.(e,n),o({type:"CLEAR_INTERACTION_EPISODE",payload:{id:e}})},[o,v,$e]),Hi=(0,Va.useCallback)(()=>{let e=be.current?.draft;De(),e&&_i()},[De,_i]);(0,Va.useEffect)(()=>{let e=e=>{if(!ge.current)return;let t=e.metaKey||e.ctrlKey;if("Escape"===e.key&&t)return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),void(xe.current?Hi():De());"Enter"===e.key&&t&&xe.current&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),$i())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[Hi,De,$i]),(0,Va.useEffect)(()=>{if(!we)return;let e=e=>xe.current?.recordEvent(e),t=()=>xe.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)}},[we]);let Bi=(0,Va.useRef)([]);(0,Va.useRef)(a).current=a;let{dragState:qi,resizeState:Ui,setDragState:Xi,setResizeState:Ki}=function(){let[e,t]=(0,Cd.useState)(null),[n,r]=(0,Cd.useState)(null);return{dragState:e,resizeState:n,setDragState:t,setResizeState:r}}(),Qi=i.selectedAnnotationIds;Bi.current=Qi;let Gi=(0,Va.useCallback)((e,t=!1)=>{o({type:"SELECT_ANNOTATION",payload:{id:e,addToSelection:t}})},[o]),Ji=(0,Va.useCallback)(()=>{o({type:"SELECT_ANNOTATION",payload:{id:null}})},[o]),eo=(0,Va.useCallback)(e=>{let t=Mi.current.annotations.find(t=>t.id===e);!t||!fo(t,Mi.current.annotations)||(o({type:"DELETE_ANNOTATION",payload:{id:e}}),Ai.current?.id===e&&(Ve(Ai.current.attachments),$e(null)),Yr(),bn(null),En(null),Mn(null),Pn(!1),Ji())},[Yr,Ji,o,Ve,$e]),to=(0,Va.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}(Mi.current.textModifications,e,ue);t&&(o(t),Yr(),En(null),Mn(null),Pn(!1))},[ue,o,Yr]),no=(0,Va.useRef)({x:window.scrollX,y:window.scrollY}),io=(0,Va.useRef)(null),[oo,so]=(0,Va.useState)(no.current);(0,Va.useLayoutEffect)(()=>{if(G)return ee(),window.addEventListener("resize",ee),window.visualViewport?.addEventListener("resize",ee),()=>{window.removeEventListener("resize",ee),window.visualViewport?.removeEventListener("resize",ee)}},[ee,G]),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,Of.useRef)([]),p=(0,Of.useRef)(0),h=(0,Of.useRef)(null);(0,Of.useEffect)(()=>{let m=m=>{if("Escape"===m.key){if(m.defaultPrevented||m.repeat||n.current||d||rp(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(Id(l)){m.preventDefault();let e=Ld(l);h.current={source:l,sourceSelector:e,sourceDurableSelector:Tn(l),sourceElement:{...Hn(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&&Id(l)?l:e.source,n=t.parentElement;if(n){m.preventDefault();let r=Tn(n),o=Ld(n),a=Tn(t),l=Ld(t),s=Pd(t)+1,u=e.source.cloneNode(!0);if(u instanceof Element){zd(u),Dd(n,u,s);let t=Ld(u),d=Tn(u),f={...Hn(u),selector:t};i({type:"MODIFY_DOM_STRUCTURE",payload:{id:Yf(),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||rp(m)||"Delete"!==m.key&&"Backspace"!==m.key||m.metaKey||m.ctrlKey||m.altKey)){if(0===g.length&&!u)return;let e=ip(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:i,stateRef:Mi,activeTextRef:Ai,selectedIdsRef:Bi,dispatch:o,clearSelection:Ji,selectAnnotation:Gi,handHoveredElement:Bn,onArchiveThread:k,openThreadId:I,currentPathname:ue,hasOpenThread:P});let{pageAnnotations:uo,pageStyleModifications:co,pageTextModifications:po,pendingBundleCount:ho,pendingTextAnnotations:go}=function({state:e,activeText:t,currentPathname:n,dismissedThreadIds:r,modifiedElementThreadStates:i}){let o=(0,Al.useMemo)(()=>Rl(e.annotations,n,r),[e.annotations,n,r]),a=(0,Al.useMemo)(()=>Il(e.styleModifications,e.annotations,n,r,i),[e.annotations,e.styleModifications,n,r,i]),l=(0,Al.useMemo)(()=>Il(e.textModifications,e.annotations,n,r,i),[e.annotations,e.textModifications,n,r,i]),s=(0,Al.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,Al.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,Al.useMemo)(()=>e.annotations.filter(e=>"text"===e.type&&e.text&&"pending"===(e.status??"pending")).sort((e,t)=>t.timestamp-e.timestamp),[e.annotations])}}({state:i,activeText:Fe,currentPathname:ue,dismissedThreadIds:g,modifiedElementThreadStates:m}),{sendHintAnchorId:yo,setSendHintAnchorId:vo}=function({activeText:e,activeTextAnchorId:t,hoveredElement:n,hoveredTextId:r,pendingTextAnnotations:i}){let[o,a]=(0,Pl.useState)(null);return(0,Pl.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,Pl.useEffect)(()=>{if(!r)return;let e=i.find(e=>e.id===r);e&&a(e.id)},[r,i]),(0,Pl.useEffect)(()=>{if(!n)return;let e=i.find(e=>{if(!e.linkedSelector)return!1;try{return wt(n,e.linkedSelector)}catch{return!1}});e&&a(e.id)},[n,i]),{sendHintAnchorId:o,setSendHintAnchorId:a}}({activeText:Fe,activeTextAnchorId:Qp,hoveredElement:nt,hoveredTextId:qe,pendingTextAnnotations:go}),{locationLabels:xo,tooltipAnnotationId:bo,revealAnnotation:wo}=function({annotations:e,annotationIds:t,badgeHoveredAnnotationId:n,hoveredTextId:r}){let i=(0,Ll.useMemo)(()=>{let n=new Map;for(let r of e){if(!t.has(r.id))continue;let e=_n(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,Ll.useState)(null);(0,Ll.useEffect)(()=>{if(l(null),!o)return;let e=window.setTimeout(()=>{l(o)},500);return()=>window.clearTimeout(e)},[o]);let s=(0,Ll.useCallback)(async e=>{let t=await async function(e,t){let n=function(e,t){return In(e)??In(t?.[0]?.selector)}(e,t);if(Fn(n))return n;let r=Dn(t)??(n?Nn(n):void 0);if(!r)return null;for(let e of r.steps){let t=In(e.triggerSelector);if(!(t instanceof HTMLElement))return null;if(!$n(0,t,In(e.targetSelector))&&(t.click(),!await On(e.targetSelector)))return null}return On(e&&In(e)?e:t?.[0]?.selector)}(e.linkedSelector,e.elements);if(!t)return;let n=ut(t);(n.bottom<0||n.top>window.innerHeight)&&t.scrollIntoView({behavior:"smooth",block:"center"})},[]);return{locationLabels:i,tooltipAnnotationId:a,revealAnnotation:s}}({annotations:uo,annotationIds:ji,badgeHoveredAnnotationId:xn,hoveredTextId:qe}),So=(0,Va.useCallback)((e,t)=>{let n=Mi.current.annotations.find(t=>t.id===e);n&&(Gi(e),t&&ki(t),ji.has(e)&&wo(n))},[ki,ji,wo,Gi]),{cycleSpotlightAnnotationIds:Co,emphasizedAnnotationIds:Mo,hoverRestoredAnnotationIds:To,inactiveEmphasisOpacity:jo,statusSpotlightAnnotationIds:Ro}=function({annotations:e,isCreatingAnnotation:t,hoveredTextId:n,badgeHoveredAnnotationId:r,highlightedAnnotationIds:i,cycleFocusedAnnotationIds:o,hoveredElement:a}){let l=(0,Ka.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,Ka.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{wt(a,n.linkedSelector)&&t.add(n.id)}catch{}return tl(e,t)},[e,n,r,i,a]),u=(0,Ka.useMemo)(()=>i?tl(e,i):null,[e,i]),c=(0,Ka.useMemo)(()=>o?tl(e,o):null,[e,o]);return{cycleSpotlightAnnotationIds:c,emphasizedAnnotationIds:u??c??l,hoverRestoredAnnotationIds:s,inactiveEmphasisOpacity:u||c?.2:.5,statusSpotlightAnnotationIds:u}}({annotations:uo,isCreatingAnnotation:!(!Fe?.isNew||Fe.domEdit),hoveredTextId:qe,badgeHoveredAnnotationId:xn,highlightedAnnotationIds:C,cycleFocusedAnnotationIds:M,hoveredElement:nt}),Io=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}}(G?N?.current:null),Po=Io.avoidTop,zo=Io.avoidBottom,_o=Io.avoidLeft,Ho=Io.avoidRight,Wo=(0,Va.useMemo)(()=>({avoidTop:Po,avoidBottom:zo,avoidLeft:_o,avoidRight:Ho}),[Po,zo,_o,Ho]),Bo=function(e,t){return(0,zl.useMemo)(()=>[...(e.canvasSamples??[]).filter(e=>e.pathname===t),...e.domModifications.flatMap(e=>e.sampledTree&&!e.captured&&e.pathname&&e.pathname===t?[{selector:e.selector,pathname:e.pathname,elementTag:e.element.tagName}]:[])],[e.canvasSamples,e.domModifications,t])}(i,ue),{supersededAnnotations:Vo,stagedArtifactOrder:Yo,annotationGroupMap:Uo,pageModificationNumberBySelector:Xo}=function({state:e,pageSampleTargets:t,pageAnnotations:n,pageStyleModifications:r,pageTextModifications:i}){let o=(0,zl.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]),a=(0,zl.useMemo)(()=>function({annotations:e,sampleTargets:t,styleModifications:n,textModifications:r}){let i=new Map,o=0,a=new Map;for(let t of e)t.groupId&&t.linkedSelector&&a.set(t.groupId,{selector:t.linkedSelector,pathname:t.pathname});for(let t of e){let e=t.groupId?a.get(t.groupId):t.linkedSelector?{selector:t.linkedSelector,pathname:t.pathname}:void 0,n=e?_l(e.pathname,e.selector):`annotation:${t.groupId??t.id}`,r=i.get(n);r?(r.createdAt=Math.min(r.createdAt,t.timestamp),r.annotationIds.push(t.id)):i.set(n,{key:n,createdAt:t.timestamp,stableIndex:o++,annotationIds:[t.id]})}let l=e=>{let t=Dl(e),n=`element:${t}`,r=e.createdAt??Nl,a=i.get(n);if(a)return a.createdAt=Math.min(a.createdAt,r),void(a.modificationKey=t);i.set(n,{key:n,createdAt:r,stableIndex:o++,annotationIds:[],modificationKey:t})};n.forEach(l),r.forEach(l),t?.forEach(l);let s=new Map,u=new Map,c=[...i.values()].sort((e,t)=>e.createdAt-t.createdAt||e.stableIndex-t.stableIndex);return c.forEach((e,t)=>{let n=t+1;e.annotationIds.forEach(e=>s.set(e,n)),e.modificationKey&&u.set(e.modificationKey,n)}),{annotationNumberById:s,modificationNumberByKey:u,count:c.length}}({annotations:n.filter(e=>!o.has(e)),sampleTargets:t,styleModifications:r,textModifications:i}),[n,t,r,i,o]),l=(0,zl.useMemo)(()=>{let e=new Map,n=t=>{let n=a.modificationNumberByKey.get(Dl(t));if(void 0===n)return;let r=e.get(t.selector);(void 0===r||n<r)&&e.set(t.selector,n)};return r.forEach(n),i.forEach(n),t?.forEach(n),e},[t,r,i,a.modificationNumberByKey]);return{supersededAnnotations:o,stagedArtifactOrder:a,annotationGroupMap:a.annotationNumberById,pageModificationNumberBySelector:l}}({state:i,pageSampleTargets:Bo,pageAnnotations:uo,pageStyleModifications:co,pageTextModifications:po}),Ko=Jn(nt),Go=!(!Ke||Ko?.adapter!==Ke.target.adapter||Ko.key!==Ke.target.key),Zo=Fe?.linkedSelector&&!Fe.domEdit?Fe:Ue,Jo=Zo?.linkedSelector?Za(Zo.linkedSelector,Zo.elements):null,ea=!!(nt&&Zo&&Sl(Jo,nt,Zo.elements?.[0]?.context)),ta=!(!t||!G||e||Fe||"inspector"!==i.activeTool&&"sticker"!==i.activeTool),na=ta&&Ir&&!Go?nt:null,ra=(0,Va.useCallback)(e=>function(e,t,n,r){try{let i=function(e,t,n,r){let i=gn(t.location.pathname);if(!e.isConnected||gn(e.ownerDocument.location.pathname)!==i)throw new Error("The preview changed. Select the element again.");let o=n?.sampleableObject(e);if(o){let{projection:e,surface:n,objects:i}=o,a=i.read(n.read(),e.target.key);if(null===a)throw new Error("This object cannot be sampled by its renderer.");if(a.length>65536)throw new Error("This object is too large to place.");if(!r?.sampleableCanvases(t.documentElement,!0).some(e=>e.format===n.format&&e.objects?.placement&&(e.objects.placement.canPlace?.(a)??!0)))throw new Error("This object needs a matching scene object on your plane.");return{kind:"object",label:e.subject.label,format:n.format,value:a}}if(Jn(e))throw new Error("This scene object needs a unique identity before it can be sampled.");return{kind:"element",label:e.localName,tree:Fr(e)}}(e,t,n,r),o={pathname:gn(t.location.pathname),id:crypto.randomUUID()};return{sample:"object"===i.kind?{...i,...o}:{...i,...o,sourceSelector:An(e)},reason:null}}catch(e){return{sample:null,reason:e instanceof Error?e.message:"This element cannot be sampled."}}}(e,document,F,F),[F]),ia=(0,Va.useCallback)(e=>ra(e).reason,[ra]),{reason:sa,recheck:ua}=function(e,t){let[n,r]=(0,Hr.useState)(null),i=(0,Hr.useCallback)(()=>{r(e?t(e):null)},[e,t]);return(0,Hr.useLayoutEffect)(()=>{if(i(),!e)return;let t=new MutationObserver(i);return t.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["src","srcset","sizes"]}),e.ownerDocument.addEventListener("popmelt-sample-ready",i),e.addEventListener("load",i,!0),e.addEventListener("error",i,!0),()=>{t.disconnect(),e.ownerDocument.removeEventListener("popmelt-sample-ready",i),e.removeEventListener("load",i,!0),e.removeEventListener("error",i,!0)}},[e,i]),{reason:n,recheck:i}}(na,ia),ca=sa?125:100,da=function(e){let[t,n]=(0,Or.useState)(null);return(0,Or.useEffect)(()=>{if(n(null),!e)return;let t=window.setTimeout(()=>n(e),1e3);return()=>window.clearTimeout(t)},[e]),!(!e||e!==t)}(G&&!e?nt:null),fa=!da||!!na,pa=!(!nt||!at||Go||!na&&(qe||xn||ea)),{hiddenCollidingAnnotationIds:ha,nestedCollidingAnnotationCountById:ma,nestedCollidingAnnotationIdsById:ga,visibleCollisionRepresentativeByAnnotationId:ya}=function({activeText:e,activeTextSendHintId:t,annotationNumberById:n,badgeHoveredAnnotationId:r,canvasRef:i,focusedThreadAnnotationId:o,hoveredElement:a,hoveredElementInfo:l,sampleActionWidth:s=0,compactHoverIdentifier:u=!1,hoveredTextId:c,showHoverElementIdentifier:d,layoutReady:f,layoutRevision:p,pageAnnotations:h,parentPinnedAnnotationIds:m,pendingLinkedText:g,scroll:y,supersededAnnotations:v,textSafeBounds:x}){let b=(0,rl.useRef)(new Map);return(0,rl.useMemo)(()=>{let p=new Set,w=new Map,S=new Map,k=new Map,E=()=>({hiddenCollidingAnnotationIds:p,nestedCollidingAnnotationCountById:w,nestedCollidingAnnotationIdsById:S,visibleCollisionRepresentativeByAnnotationId:k});if(!f)return E();let C=i.current?.getContext("2d");if(!C)return E();let M=(e,t,n,r,i)=>{C.font=`${r}px ${fi}`;let o=(n||"Type here...").replace(/\\n/g," "),a=void 0!==i?`${i}. ${o}`:o,l={x:t.x-y.x,y:t.y-y.y},s=m.has(e)?16:0,u=Math.max(60,pi(l.x)-s),c=hi(C,a,u),d=C.measureText(c).width,f=gi(l,r,x,s+d+16);return{left:f.x-8,top:f.y-4,right:f.x+s+d+8,bottom:f.y+r*ci+4}},T=new Set,j=h.flatMap(e=>{if("text"!==e.type||!e.text||!e.points[0]||!e.linkedSelector||v.has(e))return[];let t=e.elements?.[0]?.selector,r=b.current.get(e.id),i=r?.selector===e.linkedSelector&&r.fallbackSelector===t&&r.element.isConnected,o=i?r.element:Za(e.linkedSelector,e.elements);if(!o)return[];let a=i?r.depth:function(e){let t=0,n=bt(e);for(;n;)t+=1,n=bt(n);return t}(o);return b.current.set(e.id,{selector:e.linkedSelector,fallbackSelector:t,element:o,depth:a}),T.add(e.id),[{id:e.id,annotation:e,element:o,bounds:M(e.id,e.points[0],e.text,e.fontSize||12,n.get(e.id)),depth:a}]});for(let e of b.current.keys())T.has(e)||b.current.delete(e);if(0===j.length)return E();let A=j.map((e,t)=>t),R=e=>{let t=e;for(;A[t]!==t;)t=A[t];for(;A[e]!==e;){let n=A[e];A[e]=t,e=n}return t},I=(e,t)=>{let n=R(e),r=R(t);n!==r&&(A[r]=n)};for(let e=0;e<j.length;e+=1)for(let t=e+1;t<j.length;t+=1){let n=j[e],r=j[t];Ga(n.element,r.element)&&Qa(n.bounds,r.bounds)&&I(e,t)}let L=new Map;j.forEach((e,t)=>{let n=R(t),r=L.get(n)??[];r.push(e),L.set(n,r)});for(let e of L.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&&(w.set(t.id,r.length),S.set(t.id,r))}let P=e?.linkedSelector?{id:e.id,element:Za(e.linkedSelector,e.elements),bounds:M(e.id,e.point,e.text,e.fontSize,n.get(e.id))}:g?.linkedSelector?{id:t,element:Za(g.linkedSelector,g.elements),bounds:M(t,g.point,"",12)}:null,z=null;if(a&&d){let e=ut(a),t=22,n=e.height>=window.innerHeight,r=n?e.top+8:e.top>=t+2?e.top-t-2:e.bottom+2,i=n?e.left+8:e.left,o=l?aa(l,u):a.tagName.toLowerCase();C.font=`12px ${fi}`;let c=Math.min(400,oa(o,e=>C.measureText(e).width)+la(o)+8);z={left:i,top:r,right:i+c+s,bottom:r+t}}let N=(e,t)=>{e.forEach(e=>{e.id!==t&&p.add(e.id),t&&k.set(e.id,t)})};for(let e of L.values()){if(P?.element&&e.some(e=>Ga(P.element,e.element)&&Qa(P.bounds,e.bounds))){let t=new Set,n=e.flatMap(e=>e.element===P.element||!P.element.contains(e.element)||t.has(e.element)?[]:(t.add(e.element),[e.id]));n.length>0&&(w.set(P.id,n.length),S.set(P.id,n)),N(e,e.find(e=>e.id===P.id)?.id);continue}let t=[c,r].find(t=>t&&e.some(e=>e.id===t)),n=e.find(e=>e.id===t);if(n){N(e,n.id);continue}if(a){let t=e.find(e=>e.element===a);if(t){N(e,t.id);continue}if(z&&e.some(e=>!sl(e.annotation)&&!ll(e.annotation)&&"awaiting_review"!==e.annotation.status&&Ga(a,e.element)&&Qa(z,e.bounds))){N(e);continue}}let i=[o].find(t=>t&&e.some(e=>e.id===t));if(i)N(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);N(e,t.id)}}return E()},[e,t,n,r,i,o,a,l,s,u,c,d,f,h,m,g,y.x,y.y,v,x,p])}({activeText:Fe,activeTextSendHintId:Qp,annotationNumberById:Uo,badgeHoveredAnnotationId:xn,canvasRef:te,focusedThreadAnnotationId:A,hoveredElement:nt,hoveredElementInfo:at,hoveredTextId:qe,layoutReady:G&&null!==ne,showHoverElementIdentifier:pa,compactHoverIdentifier:fa,sampleActionWidth:na?ca:0,layoutRevision:ie+ae,pageAnnotations:uo,parentPinnedAnnotationIds:ji,pendingLinkedText:Ue,scroll:oo,supersededAnnotations:Vo,textSafeBounds:Wo}),{activeTextAnnotation:va,activeTextCollisionId:ba,activeTextModifiedRail:wa,activeTextNestedAnnotationCount:Sa,activeTextNestedAnnotationIds:ka,activeTextNestedBadgeColor:Ca,elementRailColorBySelector:Ma,elementRailComments:Ta,hiddenAnnotationBadgeIds:ja,modifiedElementSendHintSelector:Aa,stagedElementComments:Ia,visibleCanvasAnnotations:La,visibleSendHintAnchorId:Pa}=function({resolveElement:e,projectedSelectors:t,standaloneEditor:n,activeText:r,activeColor:i,annotations:o,annotationNumberById:a,focusedThreadAnnotationId:l,hiddenCollidingAnnotationIds:s,modifiedElementThreadStates:u,nestedCollidingAnnotationCountById:c,nestedCollidingAnnotationIdsById:d,pageAnnotations:f,pageStyleModifications:p,pageTextModifications:h,sendHintAnchorId:m,supersededAnnotations:g,visibleCollisionRepresentativeByAnnotationId:y,activeTextSendHintId:v,targetResolutionRevision:x}){let b=(0,Lp.useCallback)((n,r)=>t?null:e?e(n,r):Za(n,r),[x,e,t]),w=(0,Lp.useMemo)(()=>{let e=[],n=new Set,r=[...f].sort((e,t)=>t.timestamp-e.timestamp);for(let i of r){if("text"!==i.type||!i.text||!i.linkedSelector||g.has(i)||s.has(i.id))continue;let r=i.status??(i.captured?"in_flight":"pending");if(!["pending","sending","in_flight","awaiting_review"].includes(r))continue;let o=a.get(i.id);if(void 0===o||n.has(i.linkedSelector))continue;let l=b(i.linkedSelector,i.elements),u=i.elements?.[0];!l&&(!t?.has(i.linkedSelector)||!u)||(n.add(i.linkedSelector),e.push({id:i.id,selector:i.linkedSelector,text:i.text.replace(/\\n/g," "),annotationNumber:o,color:i.color,element:u??Hn(l),pending:"pending"===r,inFlight:"in_flight"===r,awaitingReview:"awaiting_review"===r,threadId:i.threadId,imageCount:i.imageCount??0,interactionEpisodeStepCount:i.interactionEpisode?.steps.length}))}return e},[a,s,f,g,b,t]),S=(0,Lp.useMemo)(()=>new Set(w.map(e=>e.id)),[w]),k=(0,Lp.useMemo)(()=>{let e=new Map;for(let t of f){if("text"!==t.type)continue;let n=Np(t,f);n&&e.set(t.id,n)}return e},[f]),E=(0,Lp.useMemo)(()=>{let e=[],n=new Set,r=[...f].sort((e,t)=>+(t.id===l)-+(e.id===l)||t.timestamp-e.timestamp);for(let i of r){let r=k.get(i.id);if(!r||!ll({...i,status:r.status,threadId:r.threadId,linkedSelector:r.linkedSelector})||!i.text||g.has(i)||s.has(i.id)||n.has(r.linkedSelector))continue;let o=a.get(i.id);if(void 0===o)continue;let l=b(r.linkedSelector,r.elements),u=r.elements?.[0];!l&&(!t?.has(r.linkedSelector)||!u)||(n.add(r.linkedSelector),e.push({id:i.id,selector:r.linkedSelector,text:i.text.replace(/\\n/g," "),annotationNumber:o,color:i.color,element:u??Hn(l),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:o,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},[a,l,s,f,k,g,b,t]),C=(0,Lp.useMemo)(()=>[...w,...E],[E,w]),M=(0,Lp.useMemo)(()=>{let e=new Set,t=new Set,n=new Set,r=new Set;for(let[e,i]of u??[])if("matched"===Sn(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 f){let o=k.get(i.id),a=i.groupId?f.filter(e=>e.groupId===i.groupId):[i],l=a.map(zp).find(e=>!!e),u=a.find(e=>e.threadId)?.threadId,c=a.find(e=>e.targetBindingId)?.targetBindingId;"text"===i.type&&i.text&&l&&!g.has(i)&&!s.has(i.id)&&(u&&t.has(u)||c&&n.has(c)||r.has(l)||o&&ll({...i,status:o.status,threadId:o.threadId,linkedSelector:o.linkedSelector})&&b(o.linkedSelector,o.elements))&&e.add(i.id)}return e},[s,u,f,k,g,b]),T=(0,Lp.useMemo)(()=>{let e=new Set;for(let t of f)sl(t)&&t.linkedSelector&&!g.has(t)&&!s.has(t.id)&&b(t.linkedSelector,t.elements)&&e.add(t.id);return e},[s,f,g,b]),j=(0,Lp.useMemo)(()=>{let e=new Set(T);for(let t of S)e.add(t);for(let t of M)e.add(t);return e},[T,M,S]),A=(0,Lp.useMemo)(()=>new Map(C.map(e=>[e.selector,e.color])),[C]),R=(0,Lp.useMemo)(()=>new Set([...s,...j]),[j,s]),I=(0,Lp.useMemo)(()=>{if(n||!r?.linkedSelector||r.domEdit)return null;let e=b(r.linkedSelector,r.elements);if(!e)return null;let t=[...p,...h].find(t=>!t.captured&&Za(t.selector,[t.element])===e),i=f.find(e=>e.id===r.id),o=!(r.isNew||!i||!sl(i));return t||o?{element:e,selector:t?.selector??r.linkedSelector}:null},[n,r,f,p,h,b]),L=m===v?m:m?y.get(m)??m:null,P=(0,Lp.useMemo)(()=>{if(L===v)return r?.text.trim()?I?.selector??null:null;if(L&&L!==v)return w.find(e=>e.id===L)?.selector??null;for(let e=h.length-1;e>=0;e-=1){let t=h[e];if(t&&!t.captured)return t.selector}for(let e=p.length-1;e>=0;e-=1){let t=p[e];if(t&&!t.captured&&!t.awaitingReview)return t.selector}return null},[r,I,v,p,h,w,L]),z=r?r.isNew?v:r.id:null,N=z?c.get(z)??0:0,D=z?d.get(z)??[]:[],_=r?.isNew?void 0:o.find(e=>e.id===r?.id),F="pending"===(_?.status??(_?.captured?"in_flight":"pending"))?_?.color??i:"#8c8c8c",$=(0,Lp.useMemo)(()=>f.filter(e=>!(g.has(e)||s.has(e.id)||j.has(e.id)||r&&!r.isNew&&e.id===r.id)),[r,j,s,f,g]);return{activeTextAnnotation:_,activeTextCollisionId:z,activeTextModifiedRail:I,activeTextNestedAnnotationCount:N,activeTextNestedAnnotationIds:D,activeTextNestedBadgeColor:F,elementRailColorBySelector:A,elementRailCommentIds:j,elementRailComments:C,hiddenAnnotationBadgeIds:R,modifiedElementSendHintSelector:P,stagedElementComments:w,visibleCanvasAnnotations:$,visibleSendHintAnchorId:L}}({standaloneEditor:Qr,activeText:Fe,activeColor:i.activeColor,annotations:i.annotations,annotationNumberById:Uo,focusedThreadAnnotationId:A,hiddenCollidingAnnotationIds:ha,modifiedElementThreadStates:m,nestedCollidingAnnotationCountById:ma,nestedCollidingAnnotationIdsById:ga,pageAnnotations:uo,pageStyleModifications:co,pageTextModifications:po,sendHintAnchorId:yo,supersededAnnotations:Vo,visibleCollisionRepresentativeByAnnotationId:ya,activeTextSendHintId:Qp,targetResolutionRevision:ie+ae}),za=(0,Va.useMemo)(()=>{if(0===Qi.length)return null;let e=new Map;for(let t of Qi){let n=i.annotations.find(e=>e.id===t);if(!n)continue;let r=n.groupId?i.annotations.filter(e=>e.groupId===n.groupId):[n];for(let t of r)if(t.linkedSelector&&!h?.has(t.linkedSelector)){let n=t.color||i.activeColor;e.set(t.linkedSelector,n)}}return e.size>0?e:null},[Qi,i.annotations,i.activeColor,h]),Na=(0,Va.useCallback)((e=no.current)=>{let t=Z.current;t&&(t.style.setProperty("--popmelt-painted-x",`${e.x}px`),t.style.setProperty("--popmelt-painted-y",`${e.y}px`)),J(La,Qi,8,e.x,e.y,Uo,Ro,Wo,Mo,To,jo,ji,c)},[c,La,Qi,Z,J,Uo,Ro,Wo,Mo,To,jo,ji]),Da=(0,Va.useRef)(Na);(0,Va.useLayoutEffect)(()=>{Da.current=Na,G&&Na(no.current)},[Na,G]),(0,Va.useLayoutEffect)(()=>{if(!G)return;let e=()=>{let e={x:window.scrollX,y:window.scrollY};e.x===no.current.x&&e.y===no.current.y||(no.current=e,Da.current(e),null===io.current&&(io.current=window.requestAnimationFrame(()=>{io.current=null;let e=no.current;so(t=>t.x===e.x&&t.y===e.y?t:e)})))};return e(),so(no.current),window.addEventListener("scroll",e,{passive:!0}),()=>{window.removeEventListener("scroll",e),null!==io.current&&(window.cancelAnimationFrame(io.current),io.current=null)}},[G]);let{findAnnotationAtPoint:_a,findHandleAtPoint:Fa,findTextAtPoint:$a,getPoint:Ha}=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,up.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,up.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(cp(e,a,l,s))return o;continue}if("freehand"===o.type){for(let t=0;t<o.points.length-1;t+=1)if(cp(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(cp(e,{x:u,y:d},{x:c,y:d},s)||cp(e,{x:u,y:f},{x:c,y:f},s)||cp(e,{x:u,y:d},{x:u,y:f},s)||cp(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&&mo(e,i.x,i.y)))return!1;let s=e.fontSize||12;n.font=`${s}px ${fi}`;let u=e.text.replace(/\\n/g," "),c=void 0!==r?`${r}. ${u}`:u,d=l.x-i.x,f=a?16:0,p=hi(n,c,Math.max(60,pi(d)-f)),h=n.measureText(p).width,m=s*ci,g=gi({x:l.x-i.x,y:l.y-i.y},s,o,f+h+16),y=g.x+i.x,v=g.y+i.y;return t.x>=y-8-4&&t.x<=y+f+h+8+4&&t.y>=v-4-4&&t.y<=v+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,up.useCallback)(e=>{let t=f(e);return"text"===t?.type?t:null},[f]),h=(0,up.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:Uo,annotations:i.annotations,canvasRef:te,handleSize:8,hiddenCollidingAnnotationIds:ha,pageAnnotations:uo,parentPinnedAnnotationIds:ji,scroll:oo,selectedAnnotationIds:Qi,supersededAnnotations:Vo,textSafeBounds:Wo}),{commitActiveText:Wa,createInlineTextEdit:Ya,enterDomTextEdit:Xa,editPendingLinkedComment:il,finishActiveTextForTargetChange:al,handleSendPendingBundle:fl}=Ap({subjectRegistry:F,activeText:Fe,activeTextRef:Ai,canvasRef:te,clearPageElementHover:Yr,clearSelection:Ji,clearSignal:_,commentTextEditCandidateRef:tt,cursorPosRef:Li,dispatch:o,findTextAtPoint:$a,lastPositionedTextId:zi,onAttachImages:y,onCloseThread:S,onSend:b,pendingLinkedText:Ue,releaseActiveTextAttachments:Ve,setActiveText:$e,setDragState:Xi,setHoveredTextId:Ye,setPendingLinkedText:Xe,setSendHintAnchorId:vo,state:i,stateRef:Mi});(0,Va.useLayoutEffect)(()=>{if(W)return W.current=Wa,()=>{W.current=null}},[W,Wa]);let xl=(0,Va.useRef)(void 0);(0,Va.useEffect)(()=>{let e=()=>{xl.current=void 0},t=t=>{(!Pi.current||!t.composedPath().includes(Pi.current))&&e()};function n(t){"Tab"===t.key&&e()}return window.addEventListener("pointerdown",t,!0),window.addEventListener("keydown",n,!0),()=>{window.removeEventListener("pointerdown",t,!0),window.removeEventListener("keydown",n,!0)}},[Pi]);let bl=(0,Va.useCallback)(()=>{if(xl.current&&Ai.current?.id===xl.current)return;let e=Ii.current;(function(e,t){return!(!t||e?.id!==t.id)})(Ai.current,e)||Wa()},[Wa]),wl=(0,Va.useCallback)((e,t)=>{let n=Kt.current;if(n?.focus)return Nf(n,{x:e,y:t},Vn);let r=et.current,i=Jt.current?.element;return i?.isConnected&&r&&Math.hypot(e-r.x,t-r.y)<=2?i:Vn(e,t)},[]),kl=function({activeText:e,applySticker:t,steerTargetAt:n,canvasRef:r,clearSelection:i,commentTextEditCandidateRef:o,commitActiveText:a,createInlineTextEdit:l,dispatch:s,domDragRef:u,editPendingLinkedComment:c,finishActiveTextForTargetChange:d,findAnnotationAtPoint:f,findHandleAtPoint:p,findTextAtPoint:h,gapDragRef:m,gapHoveredAxis:g,gapHoveredElement:y,gapIsAuto:v,getPoint:x,handleAnnotationActivation:b,handDragRef:w,handHoveredElement:S,handHoveredSide:k,hoveredElement:E,hoveredElementInfo:C,isElementInFlight:M,onCanvasInteraction:T,openThreadAndFocusReply:j,pageAnnotations:A,modifiedElementThreadStates:R,pageStyleModifications:I,parentPinnedAnnotationIds:L,pointerTargetOverrideRef:P,radiusDragRef:z,radiusHoveredCorner:N,radiusHoveredElement:D,selectAnnotation:_,setDragState:F,setGapDragging:$,setHandDragging:O,setPendingLinkedText:H,setRadiusDragging:W,setResizeState:B,setStickerRejectPulse:V,setTextDragging:q,state:Y,stickerStage:U,textDragRef:X,textHoveredElement:K,textHoveredProperty:Q,toolbarRef:G}){return(0,op.useCallback)(Z=>{if(!Y.isAnnotating||!function(e){return!("button"in e)||0===e.button}(Z))return;T?.();let J=P?.current??null;P&&(P.current=null);let ee=J?.element??E,te=J?.elementInfo??C,ne=x(Z),re="shiftKey"in Z&&Z.shiftKey,ie="clientX"in Z?{x:Z.clientX,y:Z.clientY}:"touches"in Z&&Z.touches[0]?{x:Z.touches[0].clientX,y:Z.touches[0].clientY}:null;if("sticker"===Y.activeTool){if("button"in Z&&0!==Z.button||"value"!==U)return;if(!ie)return void V(e=>e+1);let e=J?.element??n(ie.x,ie.y);return e instanceof HTMLElement||e instanceof SVGElement?(Z.preventDefault(),Z.stopPropagation(),void t(e)):void V(e=>e+1)}if("inspector"!==Y.activeTool||!ie||"button"in Z&&0!==Z.button)o.current=null;else{let e=l(ie.x,ie.y,ne);o.current=e?{edit:e,clientX:ie.x,clientY:ie.y,expiresAt:Date.now()+1e3}:null}let oe=h(ne);if(oe?.points[0]){"inspector"===Y.activeTool?d():e&&a(),re||i();let t=oe.threadId||(oe.groupId?Y.annotations.find(e=>e.groupId===oe.groupId&&e.threadId)?.threadId:void 0);return L.has(oe.id)?(o.current=null,void b(oe.id,t)):(t&&j(t),void F({annotation:oe,startPoint:ne,hasMoved:!1}))}if("inspector"===Y.activeTool){if("button"in Z&&2===Z.button)return;if(ee&&!M(ee)){if(e?.linkedSelector&&!e.domEdit&&kn(e.linkedSelector,e.elements?.[0])===ee)return void Z.preventDefault();d();let t=A.filter(e=>"text"===e.type&&e.linkedSelector).filter(e=>kn(e.linkedSelector,e.elements?.[0])===ee).sort((e,t)=>t.timestamp-e.timestamp)[0];if(t?.points[0]){if("pending"!==(t.status??"pending")||t.threadId){let e=t.threadId||(t.groupId?Y.annotations.find(e=>e.groupId===t.groupId&&e.threadId)?.threadId:void 0);e&&j(e)}else c(t.id);return}let n=Jn(ee),i=new Set;for(let[e,t]of R??[]){let n=Sn(t.selectors??[e],t.targetFingerprint);"matched"===n.status&&n.element===ee&&i.add(t.threadId)}if(1===i.size)return void j([...i][0]);let o=te??Hn(ee),a=n?Zn(n):Tn(ee),l=ut(ee),s=a;if(!n){let e=ee.getAttribute("data-pm");e||(e=Math.random().toString(36).substring(2,8),ee.setAttribute("data-pm",e)),s=jn(`[data-pm="${e}"]`,ee.ownerDocument)}let u,f=(I.some(e=>{if(e.captured)return!1;try{return wt(ee,e.selector)}catch{return!1}})?1:0)+Y.annotations.filter(e=>{if(!e.linkedSelector)return!1;try{return wt(ee,e.linkedSelector)}catch{return!1}}).length,p=l.top>=22*(1+f)+2?"top-left":"bottom-left",h=r.current?.getContext("2d")??document.createElement("canvas").getContext("2d");h&&(h.font=`12px ${fi}`,u=h.measureText("Type here...").width);let m=ee===document.body?el(l):nl(l,p,f,G?.current,u,0);H({point:m,subjectAnchor:n?{x:.5,y:.5}:void 0,linkedSelector:s,target:n,linkedAnchor:p,elements:[{...o,selector:a}]})}return}if("hand"===Y.activeTool&&S&&Id(S)&&!y&&!D&&!K&&!k){let e=S,t=Ld(e),n=Tn(e),r=Hn(e),i="altKey"in Z&&Z.altKey;return u.current={isDragging:!0,hasMoved:!1,mode:i?"copy":"move",startX:ne.x-window.scrollX,startY:ne.y-window.scrollY,element:e,originalParent:e.parentElement,originalIndex:Pd(e),selector:t,durableSelector:n,elementInfo:{...r,selector:t}},void Z.preventDefault()}if("hand"===Y.activeTool&&y&&g){let e=function(e,t,n,r){let i=ap(e),o=lp(n),a=wi(e),l=window.getComputedStyle(e).justifyContent,s=0;if(r){let n=Si(e).find(e=>e.axis===t);s=n?"column"===t?n.w:n.h:0}let u=r?{row:s,column:s}:a;return sp(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}}}(y,g,ne,v);return m.current=e.session,void $(e.dragging)}if("hand"===Y.activeTool&&K&&Q){let e=function(e,t,n){let r=ap(e),i=lp(n),o=Ri(e);return sp(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}}}(K,Q,ne);return X.current=e.session,void q(e.dragging)}if("hand"===Y.activeTool&&D&&N){let e=function(e,t,n){let r=ap(e),i=Ti(e);return sp(e),{session:{...r,isDragging:!0,corner:t,startY:lp(n).y,original:i,maxRadius:Math.floor(e.getBoundingClientRect().height/2)},dragging:{corner:t,radius:{...i}}}}(D,N,ne);return z.current=e.session,void W(e.dragging)}if("hand"===Y.activeTool&&S&&k){let e=function(e,t,n){let r=ap(e),i=lp(n),o=Ei(e);return sp(e),{session:{...r,isDragging:!0,side:t,startX:i.x,startY:i.y,original:o},dragging:{side:t,padding:{...o}}}}(S,k,ne);return w.current=e.session,void O(e.dragging)}let ae=p(ne);if(ae){let e=Y.annotations.find(e=>e.id===ae.annotationId);if(e&&"text"!==e.type&&"pending"===(e.status??"pending"))return void B({annotationId:ae.annotationId,handle:ae.handle,startPoint:ne,originalPoints:[...e.points],hasMoved:!1})}let le=f(ne);if(le?.points[0]){e&&a(),"text"!==le.type?(_(le.id,re),le.color&&"pending"===(le.status??"pending")&&s({type:"SET_COLOR",payload:le.color})):re||i();let t=le.threadId||(le.groupId?Y.annotations.find(e=>e.groupId===le.groupId&&e.threadId)?.threadId:void 0);return t&&"pending"!==(le.status??"pending")&&j(t),void F({annotation:le,startPoint:ne,hasMoved:!1})}re||i()},[e,t,n,r,i,o,a,l,s,u,c,d,f,p,h,m,g,y,v,x,b,w,S,k,E,C,M,T,j,A,R,I,L,P,z,N,D,_,F,$,O,H,W,B,V,q,Y.activeTool,Y.annotations,Y.isAnnotating,U,X,K,Q,G])}({steerTargetAt:wl,activeText:Fe,applySticker:zr,canvasRef:te,clearSelection:Ji,commentTextEditCandidateRef:tt,commitActiveText:Wa,createInlineTextEdit:Ya,dispatch:o,domDragRef:Wn,editPendingLinkedComment:il,finishActiveTextForTargetChange:al,findAnnotationAtPoint:_a,findHandleAtPoint:Fa,findTextAtPoint:$a,gapDragRef:rr,gapHoveredAxis:ar,gapHoveredElement:ir,gapIsAuto:cr,getPoint:Ha,handleAnnotationActivation:So,handDragRef:zn,handHoveredElement:Bn,handHoveredSide:Yn,hoveredElement:nt,hoveredElementInfo:at,isElementInFlight:Pr,onCanvasInteraction:T,openThreadAndFocusReply:ki,pageAnnotations:uo,modifiedElementThreadStates:m,pageStyleModifications:co,parentPinnedAnnotationIds:ji,pointerTargetOverrideRef:Ne,radiusDragRef:gr,radiusHoveredCorner:xr,radiusHoveredElement:yr,selectAnnotation:Gi,setDragState:Xi,setGapDragging:ur,setHandDragging:Gn,setPendingLinkedText:Xe,setRadiusDragging:Sr,setResizeState:Ki,setStickerRejectPulse:_t,setTextDragging:Ar,state:i,stickerStage:St,textDragRef:kr,textHoveredElement:Er,textHoveredProperty:Mr,toolbarRef:N}),El=(0,Va.useCallback)((e,t)=>F?.hitTest({x:e,y:t})?.element??Vn(e,t),[F]),Cl=(0,Va.useCallback)((e,n)=>{if(!t||e===na&&sa)return;let r=ra(e);r.sample?t(r.sample,n):ua()},[t,na,sa,ra,ua]);(0,Va.useEffect)(()=>{if(!ye)return;let e=e=>{if(0===e.button){if(e.target instanceof Element&&Ni(e.target))return void(ze.current=null);H?.(),ze.current={startX:e.clientX,startY:e.clientY,moved:!1}}},t=e=>{(!(e.target instanceof Element)||!Ni(e.target))&&H?.();let t=ze.current;t&&(ze.current=Vd(t,e.clientX,e.clientY))},n=()=>{ze.current=null},r=e=>{let t=ze.current;if(ze.current=null,!qd(t)||0!==e.button||e.target instanceof Element&&Ni(e.target)||xe.current||"inspector"!==i.activeTool&&"sticker"!==i.activeTool)return;if(ta&&Xp(e)){let t=El(e.clientX,e.clientY);if(t)return e.preventDefault(),e.stopImmediatePropagation(),void Cl(t,{x:e.clientX,y:e.clientY})}let n="inspector"===i.activeTool?F?.hitTest({x:e.clientX,y:e.clientY}):null;n&&F?.promote(n.target);let r=n?.element??("sticker"===i.activeTool?wl(e.clientX,e.clientY):Vn(e.clientX,e.clientY,{allowBodyFallback:!0}));!r||Ni(r)||r!==document.documentElement&&("inspector"===i.activeTool&&Pr(r)||"sticker"===i.activeTool&&!(r instanceof HTMLElement)&&!(r instanceof SVGElement)||(Ne.current={element:r,elementInfo:n?.elementInfo??Hn(r)},e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),kl(e)))};return window.addEventListener("pointerdown",e,!0),window.addEventListener("pointermove",t,!0),window.addEventListener("pointercancel",n,!0),window.addEventListener("click",r,!0),()=>{window.removeEventListener("pointerdown",e,!0),window.removeEventListener("pointermove",t,!0),window.removeEventListener("pointercancel",n,!0),window.removeEventListener("click",r,!0)}},[kl,wl,ye,ta,Cl,El,Pr,i.activeTool,F,H]),(0,Va.useEffect)(()=>{!i.isAnnotating&&ge.current&&De()},[De,i.isAnnotating]);let Ml=kp({retainSampleRailHover:!!na,activeTool:i.activeTool,annotations:i.annotations,canvasRef:te,clearPageElementHover:Yr,clearStickerPreview:cn,dispatch:o,domDragRef:Wn,dragState:qi,findTextAtPoint:$a,gapDragRef:rr,gapHoveredAxis:ar,gapHoveredElement:ir,getPoint:Ha,handCursorRef:er,handDragRef:zn,handHoveredElement:Bn,handHoveredSide:Yn,handleShakePointerMove:dn,hoveredElement:nt,hoveredElementInfo:at,isAnnotating:i.isAnnotating,isElementInFlight:Pr,lastCanvasCursorRef:et,modifiersRef:Rr,radiusDragRef:gr,radiusHoveredCorner:xr,radiusHoveredElement:yr,resizeState:Ui,setDomDropPreview:Kn,setDragState:Xi,setGapDragging:ur,setGapHoveredAxis:lr,setGapHoveredElement:or,setGapIsAuto:dr,setHandCursorPos:nr,setHandDragging:Gn,setHandHoveredElement:qn,setHandHoveredSide:Un,setHoveredElement:rt,setHoveredElementInfo:lt,setRadiusDragging:Sr,setRadiusHoveredCorner:br,setRadiusHoveredElement:vr,setResizeState:Ki,setStickerCursor:Ct,setStickerStep:yt,setTextDragging:Ar,setTextHoveredElement:Cr,setTextHoveredProperty:Tr,steerDragRef:qr,stickerPreviewRef:Kt,stickerFamily:ht,stickerStage:St,stickerSubproperty:vt,subjectRegistry:F,suspendTargetDiscovery:!!Ke||Kr&&"inspector"!==i.activeTool||we,textDragRef:kr,textHoveredElement:Er,textHoveredProperty:Mr,transformDragHandoffRef:tn,transformPreviewSuppressionRef:en,transformPreviewTargetRef:Jt}),Fl=Cp({annotationGroupMap:Uo,canvasRef:te,currentPathname:ue,cursorPosRef:Li,dispatch:o,domDragRef:Wn,dragState:qi,gapDragRef:rr,gapDragging:sr,getPoint:Ha,handDragRef:zn,handDragging:Qn,lastPositionedTextId:zi,radiusDragRef:gr,radiusDragging:wr,resizeState:Ui,setActiveText:$e,setDomDropPreview:Kn,setDragState:Xi,setGapDragging:ur,setHandDragging:Gn,setRadiusDragging:Sr,setResizeState:Ki,setSendHintAnchorId:vo,setTextDragging:Ar,textDragRef:kr,textDragging:jr}),$l=function({enabled:e,onRegion:t,onClick:n,onStart:r}){let i=(0,Td.useRef)(null),o=(0,Td.useRef)(null),[a,l]=(0,Td.useState)(null),s=(0,Td.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,Td.useEffect)(()=>{e||s()},[e,s]),(0,Td.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,a=i.current;if(a?.touchPress){let e=t.changedTouches[0],n=a.touchPress;!a.moved&&e&&Math.hypot(e.clientX-n.clientX,e.clientY-n.clientY)<6&&(r=n),s()}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,touchPress:"touch"===t.pointerType?t.nativeEvent:null,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.touchPress||r()),t.touchPress||(t.points=cl(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=cl(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.touchPress?o.current=e.nativeEvent:n(e.nativeEvent);else if(!r.touchPress){let e=function(e,t,n,r=Date.now()){if(e.length<3)return null;let i=dl(e);return i.right-i.left<8||i.bottom-i.top<8||0===pl(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.touchPress||e.preventDefault(),!0},cancel:s,preview:a,active:()=>null!==i.current}}({enabled:i.isAnnotating&&"inspector"===i.activeTool&&!Ke&&!ye&&!we,onStart:()=>{Wa(),Ji(),Yr(),tt.current=null},onClick:e=>{let t=F?.hitTest({x:e.clientX,y:e.clientY});t&&F?.promote(t.target);let n=t?.element??Vn(e.clientX,e.clientY,{allowBodyFallback:!0});!n||Ni(n)||(Ne.current={element:n,elementInfo:t?.elementInfo??(n===nt?at:null)??Hn(n)},"touch"===e.pointerType?((0,Oo.flushSync)(()=>kl(e)),xl.current=Ai.current?.id,Pi.current?.focus({preventScroll:!0})):kl(e),Fl(e))},onRegion:(e,t)=>{let n=new Map;for(let e of pl(t)){if(n.size>=16)break;let t=F?.hitTest(e),r=t?null:Vn(e.x,e.y),i=t?.elementInfo??(r?Hn(r):null);i&&n.set(i.selector,i)}let r=dl(e.points);zi.current=null,Li.current=0,$e({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:[]}),vo(Qp)}}),Hl=$l.cancel;(0,Va.useEffect)(()=>{Hl()},[_,Hl]);let Bl=(0,Va.useCallback)(e=>{if($a(Ha(e))||_a(Ha(e))||!$l.begin(e)){if(i.isAnnotating&&"inspector"===i.activeTool&&0===e.button&&"mouse"===e.pointerType&&F&&!Ke){let t=F.beginCreate({x:e.clientX,y:e.clientY});if(t)return de.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()}kl(e)}},[kl,$a,_a,Ha,$l,i.activeTool,i.isAnnotating,Ke,F]),ql=(0,Va.useCallback)(e=>{if($l.move(e))return;let t=de.current;if(!t||t.pointerId!==e.pointerId)return void Ml(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}),he({adapter:t.adapter.id,key:t.session.key}),Ze(e=>e+1),e.preventDefault()):Ml(e)},[Ml,$l]),Yl=(0,Va.useCallback)(e=>{if($l.end(e))return;let t=de.current;if(t&&t.pointerId!==e.pointerId)return;if(de.current=null,he(null),!t)return void Fl(e);if(t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId),!t.moved){t.session.cancel();let n=F?.hitTest({x:e.clientX,y:e.clientY});return n&&F?.promote(n.target),kl(e),void Fl(e)}t.session.update({x:e.clientX,y:e.clientY});let n=t.session.commit();n&&(fe.current=window.performance.now()+500,Qe({target:{adapter:t.adapter.id,key:n.key},created:!0})),e.preventDefault()},[kl,Fl,F,$l]),Ul=(0,Va.useCallback)(e=>{if(!i.isAnnotating||"inspector"!==i.activeTool||!F)return!1;let t=F.resolve(e);if(!t?.adapter.renameSubject)return!1;let n=Ai.current;return n?.isNew&&n.target?.adapter===t.target.adapter&&n.target.key===t.target.key&&(Ve(n.attachments),$e(null),Xe(null)),Qe({target:t.target,created:!1}),!0},[Ai,Ve,$e,i.activeTool,i.isAnnotating,F]),Xl=(0,Va.useCallback)(e=>{if(window.performance.now()<=fe.current)return fe.current=0,e.preventDefault(),void e.stopPropagation();if(fe.current=0,Q&&i.isAnnotating&&"sticker"===i.activeTool&&0===e.button){let t=Ya(e.clientX,e.clientY,Ha(e),!!X);if(t?.domEdit&&Q(t.domEdit.targetElement))return clearTimeout(Ie.current),cn(),mn(),Xa(t),e.preventDefault(),void e.stopPropagation()}if(!F)return;let t=F.hitTest({x:e.clientX,y:e.clientY});!t||!Ul(t.target)||(e.preventDefault(),e.stopPropagation())},[Q,X,cn,Ya,Xa,Ha,Ul,mn,i.activeTool,i.isAnnotating,F]),[Ql,Gl]=(0,Va.useState)(!1),Zl=X&&"sticker"===i.activeTool&&"family"===St;(0,Va.useEffect)(()=>{if(!Zl)return;let e=!1,t=t=>{t.altKey!==e&&(e=t.altKey,Gl(e))},n=()=>{e=!1,Gl(!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.composedPath()[0]===te.current||!(t.target instanceof Element)||!Vn(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,Zl,te]);let Jl=(0,Va.useCallback)((e,t)=>{Li.current=t;let n=Ai.current;if(n?.domEdit){let t=n.domEdit,r=Fd(t,e,Mi.current.textModifications),i=r?{type:"MODIFY_TEXT_CONTENTS",payload:[r.change],saveUndo:n.text===t.originalText}:$d(t,e,n.text===t.originalText);r||i.payload.forEach(({modified:e},n)=>{let r=t.segments[n].textNode;r.data!==e&&(r.data=e)}),o({...i,textEditSessionId:n.paragraphSession?.id})}$e(t=>t&&{...t,text:e})},[Ai,Li,o,$e,Mi]),es=(0,Va.useCallback)(e=>{if(e.nativeEvent.isComposing||229===e.nativeEvent.keyCode)return;let t=Ai.current,n=t?.domEdit;if(n&&Yi(n.targetElement)&&(e.metaKey||e.ctrlKey)&&"z"===e.key.toLowerCase())return e.preventDefault(),e.stopPropagation(),$e(null),void o({type:e.shiftKey?"REDO":"UNDO"});if("Escape"===e.key)t?.paragraphSession?(e.preventDefault(),e.stopPropagation(),o({type:"CANCEL_PARAGRAPH_EDIT",payload:t.paragraphSession})):Ai.current?.domEdit&&(o($d(Ai.current.domEdit,Ai.current.domEdit.originalText,!1)),Ai.current.domEdit.segments.forEach(e=>{e.textNode.nodeValue=e.originalText})),Ve(Ai.current?.attachments),$e(null);else if(t&&!n&&"Enter"===e.key)!function(e){"Enter"!==e.key||e.shiftKey||e.altKey||e.nativeEvent.isComposing||229===e.nativeEvent.keyCode||(e.preventDefault(),e.stopPropagation(),e.repeat||(e.metaKey||e.ctrlKey||!b?Wa():Od(t)&&fl()))}(e);else if(function(e){return!("Enter"!==e.key||!e.metaKey&&!e.ctrlKey||(e.preventDefault(),e.stopPropagation(),0))}(e))fl();else if("Enter"===e.key&&!e.shiftKey){if(e.preventDefault(),t&&"P"===n?.targetElement.tagName&&Pi.current){let{value:e,selectionStart:r,selectionEnd:i}=Pi.current,a=Fd(n,e.slice(0,r)+e.slice(i),Mi.current.textModifications,r);if(a?.next)return o({type:"MODIFY_TEXT_CONTENTS",payload:[a.change],textEditSessionId:t.paragraphSession?.id}),void $e({...a.next,paragraphSession:t.paragraphSession})}Wa()}},[Wa,o,b,fl,Pi,Mi,Ai,Ve,$e]);!function(e,t,n){let r=(0,it.useRef)(n);(0,it.useLayoutEffect)(()=>{r.current=n}),(0,it.useLayoutEffect)(()=>{let n=e.current;if(!t||!n)return;let i=!1,o=e=>{i="keydown"===e.type&&(e.isComposing||229===e.keyCode||"Enter"===e.key&&(e.shiftKey||e.altKey||e.metaKey||e.ctrlKey))},a=e=>{!r.current||i||e.isComposing||!e.cancelable||!["insertLineBreak","insertParagraph"].includes(e.inputType)||(e.preventDefault(),r.current())};return n.addEventListener("keydown",o),n.addEventListener("keyup",o),n.addEventListener("beforeinput",a),()=>{n.removeEventListener("keydown",o),n.removeEventListener("keyup",o),n.removeEventListener("beforeinput",a)}},[t,e])}(Pi,Qr&&b?Gr:null,()=>{let e=Ai.current;e&&Od(e)&&fl()});let ts=(0,Va.useCallback)(e=>{if(!i.isAnnotating)return;let t=Ii.current;Ii.current=null;let n=$a(Ha(e));if(n&&E&&!fo(n,Mi.current.annotations))return e.preventDefault(),e.stopPropagation(),void E(n.id);if(n&&fo(n,Mi.current.annotations))return e.preventDefault(),e.stopPropagation(),void eo(n.id);if("resolved"===n?.status||"in_flight"===n?.status&&d?.has(n.id)){let t=ip(Mi.current.annotations,[n.id]);if(t.length>0)return e.preventDefault(),e.stopPropagation(),void t.forEach(e=>k?.(e))}e.preventDefault();let r=!!Ai.current,o=Fi({x:e.clientX,y:e.clientY},t);!r&&!o&&_e()},[_e,$a,Ha,eo,k,E,d,Fi,i.isAnnotating]),rs=(0,Va.useMemo)(()=>{if(!nt)return i.activeColor;let e=null;for(let t of uo)!t.linkedSelector||Vo.has(t)||Za(t.linkedSelector,t.elements)!==nt||(!e||t.timestamp>e.timestamp)&&(e=t);let t=e?.color??i.activeColor,n=at?.selector??e?.linkedSelector;return n?ol([n],m??new Map,t,Rn):t},[nt,at?.selector,m,uo,i.activeColor,Vo]),os=function(e,t){return e&&"model"!==t}(i.isAnnotating,i.activeTool),as={position:"fixed",top:0,left:0,width:"100dvw",height:"100dvh",zIndex:9998,pointerEvents:ye||Zl&&Ql||!os?"none":"auto",visibility:os?"visible":"hidden",cursor:Mt&&!Mt.nativeReady?"none":(()=>{if(!i.isAnnotating)return"default";if(Ui){let{handle:e}=Ui;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}(i.activeTool)){let e=sr?.axis??ar;if("row"===e)return"ns-resize";if("column"===e)return"ew-resize";if(wr||xr)return"ns-resize";let t=jr?.property??Mr;if("font-size"===t)return"ew-resize";if("line-height"===t)return"ns-resize";let n=Qn?.side??Yn;return"top"===n||"bottom"===n?"ns-resize":"left"===n||"right"===n?"ew-resize":"default"}return"inspector"===i.activeTool?Ys(rs):"sticker"===i.activeTool?qs(rs):"crosshair"})(),touchAction:"inspector"===i.activeTool?"pan-x pan-y pinch-zoom":"none"},ss=(0,Va.useMemo)(()=>{if(!Fe||Fe.domEdit)return;if(Fe.linkedSelector){let e=Ia.find(e=>e.selector===Fe.linkedSelector)?.annotationNumber??Xo.get(wa?.selector??Fe.linkedSelector);if(void 0!==e)return e}let e=Uo.get(Fe.id);if(void 0!==e)return e;if(Fe.groupId){let e=i.annotations.find(e=>e.groupId===Fe.groupId),t=e?Uo.get(e.id):void 0;if(void 0!==t)return t}return Yo.count+1},[Fe,wa,Uo,Xo,Ia,Yo.count,i.annotations]),ds=void 0!==ss?`${ss}.`:"",fs=(0,Va.useMemo)(()=>{if(!Fe||!ds||Fe.domEdit)return 0;let e=te.current?.getContext("2d");return e&&(e.font=`${Fe.fontSize}px ${fi}`),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:ds,fontSize:Fe.fontSize,railGap:wa?2:void 0,context:e})},[Fe,ds,wa,te]),ps=Fe?.images?.length??i.annotations.find(e=>e.id===Fe?.id)?.imageCount??0,gs=!Fe||Fe.domEdit||wa?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:Ol(r)+(r>0?4:0)+(e>0?36:0)+ko(t)+(n?86:0)+2*Math.max(0,i-1)}({nestedAnnotationCount:Sa,imageCount:ps,interactionEpisodeStepCount:Fe.interactionEpisode?.steps.length??0,reserveSendHint:!!b&&(Qr||yo===Qp&&!!Fe.text.trim())}),xs=!i.isAnnotating||!Fe?.linkedSelector||Fe.target||Fe.domEdit||wa?null:Za(Fe.linkedSelector,Fe.elements),bs=!(!Fe||!Ja(Fe)),ws=function(e){let[t,n]=(0,Qd.useState)();return(0,Qd.useLayoutEffect)(()=>{if(!e)return;let t,r=function(e){if(e.ownerDocument!==document)return!1;for(let t=e;t&&t!==document.documentElement;t=bt(t)){let n=getComputedStyle(t);if("fixed"===n.position||"sticky"===n.position||t!==e&&t!==document.scrollingElement&&/(auto|scroll|hidden)/.test(n.overflowX+n.overflowY)&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth))return!1}return!0}(e),i=()=>{if(!e.isConnected)return;let o=ut(e),a=r?{x:window.scrollX,y:window.scrollY}:void 0;n(t=>t?.element===e&&t.rect.x===o.x&&t.rect.y===o.y&&t.rect.width===o.width&&t.rect.height===o.height&&t.pageScroll?.x===a?.x&&t.pageScroll?.y===a?.y?t:{element:e,rect:o,pageScroll:a}),t=requestAnimationFrame(i)};return i(),()=>cancelAnimationFrame(t)},[e]),t?.element===e?t:void 0}(xs),Ss=ws?.rect,ks=te.current?.getRootNode(),Es=ks&&"host"in ks&&ks.host.hasAttribute("data-popmelt-top-layer-host")?ws?.pageScroll:void 0,Cs=oi(Es?null:xs),Ms=bs&&Ss?xa(Ss,22,2,window.innerHeight):null,Ts=Fe?Ms?Ms.left+8:Ss?Ss.left+8:Fe.point.x-oo.x:0,Rs=Fe?Ss?.right??Fe.point.x-oo.x:0,Is=(0,Va.useMemo)(()=>Fe&&!Fe.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($o).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($o).some(e=>e===t.token.toLowerCase())?{...t,leading:n,body:r}:void 0}(Fe.text):void 0,[Fe]),Ls=(0,Va.useCallback)(()=>{let e=te.current;if(!e||!Fe)return{width:100,height:14,isWrapped:!1};if(Fe.domEdit){let e=Fe.domEdit.flowRect??Fe.domEdit.rect;return{width:Math.max(1,Math.min(e.width,window.innerWidth-e.left)),height:Math.max(1,e.height),isWrapped:Fe.domEdit.wrapsText}}let t=e.getContext("2d");if(!t)return{width:100,height:Fe.fontSize*ci,isWrapped:!1};t.font=`${Fe.fontSize}px ${fi}`;let n=Fe.text+(Is?.suffix??"");if(Qr){let e=(Zr?.width??window.innerWidth)-gs-fs-16-18,r=n.split("\\n").reduce((e,n)=>Math.max(e,t.measureText(n).width),t.measureText("Type here...").width);return{width:Math.max(1,Math.min(320,e,Math.ceil(r)+1)),height:Fe.fontSize*ci,isWrapped:!0}}let r=Fe.point.x-oo.x;if(!wa){let e=!!(Fe.linkedSelector||Fe.target||Fe.region),r=Bd({text:n,fontSize:Fe.fontSize,effectiveMaxWidth:384,annotationPrefixWidth:fs,isModifiedRail:!1,fitToContent:e,context:t}).width+fs+16,i=Wd({anchorLeftX:Ts,anchorRightX:Rs,editorWidth:r,trailingWidth:gs,viewportWidth:window.innerWidth});return Bd({text:n,fontSize:Fe.fontSize,effectiveMaxWidth:Math.max(1,i.maxEditorWidth-16),annotationPrefixWidth:fs,isModifiedRail:!1,fitToContent:e,context:t})}return Bd({text:n,fontSize:Fe.fontSize,effectiveMaxWidth:pi(r),annotationPrefixWidth:fs,isModifiedRail:!!wa,context:t})},[Fe,Is,te,oo.x,fs,wa,gs,Qr,Zr,Ts,Rs])(),[Ps,zs]=(0,Va.useState)(0);(0,Va.useLayoutEffect)(()=>{let e=Pi.current;if(!Qr||!Gr||!e)return;let t=e.style.height,n=e.scrollTop;e.style.height="0px";let r=e.scrollHeight;e.style.height=t,e.scrollTop=n,zs(Math.min(r,Math.max(32,(Zr?.height??window.innerHeight)-16)))},[Qr,Gr,Fe?.text,Fe?.fontSize,fs,Ls.width,Zr,Pi]);let Ns=!!Fe?.domEdit,Ds=Fe?Math.max(1,Fe.text.split("\\n").length)*Fe.fontSize*ci+8:0,_s=Ns?Ls.height:Qr&&Ps?Ps:Ls.height+8,Fs=Ms??(Ss?xa(Ss,_s,2,window.innerHeight):void 0),$s=ui(bs?"bottom-left":Fs?.anchor??Fe?.linkedAnchor),Os=Ls.isWrapped?_s-Ds:0,Bs=Fe?Ns?(Fe.domEdit.flowRect??Fe.domEdit.rect).top:Fs?.top??Fe.point.y-4-oo.y-Os:0,Vs=Fe?Ns?(Fe.domEdit.flowRect??Fe.domEdit.rect).left:Fe.point.x-8-oo.x:0,Xs=Ns?Ls.width:Ls.width+fs+16,Ks=!Fe||Ns||wa?Vs:Wd({anchorLeftX:Ts,anchorRightX:Rs,editorWidth:Xs,trailingWidth:gs,viewportWidth:window.innerWidth}).editorLeft,Gs=Gr?Zr:null,Zs=Gs?Math.max(Gs.left+(Qr?8:0),Math.min(Ks,Gs.right-Xs-gs-(Qr?10:0))):Ks,Js=Fe?Ns?Bs:mi(Bs,_s,Wo,Zs,Xs):0,eu=Gs?Math.max(Gs.top,Math.min(Js,Gs.bottom-_s)):Js,tu=Fe?.domEdit?{image:Fe.domEdit.boundaryRects.map(()=>"linear-gradient(#000 0 0)").join(", "),position:Fe.domEdit.boundaryRects.map(e=>`${e.left-Zs}px ${e.top-eu}px`).join(", "),size:Fe.domEdit.boundaryRects.map(e=>`${e.width}px ${e.height}px`).join(", ")}:void 0,su=!!(Es||Cs&&Ss),fu=su?0:Zs,hu=su?0:eu,mu=Fe?Fe.domEdit?{position:"fixed",left:fu,top:hu,zIndex:10002,width:Xs,height:_s,minHeight:0,padding:0,margin:0,boxSizing:"border-box",appearance:"none",fontSize:Fe.fontSize,fontFamily:Fe.domEdit.fontFamily,fontWeight:Fe.domEdit.fontWeight,fontStyle:Fe.domEdit.fontStyle,color:"transparent",caretColor:i.activeColor,WebkitTextFillColor:"transparent",backgroundColor:"transparent",border:"none",borderRadius:0,outline:"none",boxShadow:"none",lineHeight:Fe.domEdit.lineHeight,textIndent:Fe.domEdit.firstLineIndent,letterSpacing:Fe.domEdit.letterSpacing,textTransform:Fe.domEdit.textTransform,textAlign:Fe.domEdit.textAlign,wordSpacing:Fe.domEdit.wordSpacing,textDecoration:Fe.domEdit.textDecoration,textShadow:Fe.domEdit.textShadow,resize:"none",overflow:"hidden",whiteSpace:Fe.domEdit.wrapsText?Fe.domEdit.whiteSpace:"pre",wordBreak:Fe.domEdit.wordBreak,overflowWrap:Fe.domEdit.overflowWrap,maskImage:tu?.image,maskPosition:tu?.position,maskSize:tu?.size,maskRepeat:"no-repeat",WebkitMaskImage:tu?.image,WebkitMaskPosition:tu?.position,WebkitMaskSize:tu?.size,WebkitMaskRepeat:"no-repeat"}:{position:"fixed",left:fu,top:hu,zIndex:10002,width:Xs,height:_s,padding:"3.5px 8px 4.5px",paddingLeft:8+fs,boxSizing:"border-box",fontSize:Fe.fontSize,fontFamily:fi,color:"#ffffff",backgroundColor:i.activeColor,border:"none",borderRadius:$s,animation:Fe.isNew?"popmeltAnnotationFieldEnter 150ms ease-out both":void 0,outline:"none",boxShadow:"none",lineHeight:ci,resize:"none",overflow:"hidden",overflowY:Qr?"auto":void 0,overflowWrap:Qr?"anywhere":void 0,whiteSpace:Ls.isWrapped?"pre-wrap":"pre",wordBreak:Ls.isWrapped?"break-word":void 0}:{};(0,Va.useLayoutEffect)(()=>{!B||!Fe||Fe.domEdit||(B(Hd(Fe),Zs,eu),$e(null))},[B,Fe,Zs,eu,$e]);let xu=Fe?.target&&Fe.linkedSelector?Za(Fe.linkedSelector,Fe.elements):null,{nestedBadgeOwnerSelector:bu,hoveredLinkedAnnotationId:Mu,hasSelectedHighlightForElement:Tu,ownedInFlightSelectorColors:ju,ownedFocusedSelectorColors:Au,selectorElementInfo:Ru,claimElementOverlay:Iu}=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:v}){let x=new Map;for(let e of o)e.linkedSelector&&e.elements?.[0]&&x.set(e.linkedSelector,e.elements[0]);for(let e of[...l,...s])x.set(e.selector,e.element);for(let n of[e,t])n?.linkedSelector&&n.elements?.[0]&&x.set(n.linkedSelector,n.elements[0]);let b=(e,t)=>Za(e,t??(x.has(e)?[x.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),E=c||d?null:f||p,C=[],M=(e,t)=>{e&&C.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(E){let e=o.find(e=>e.id===E);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)&&v&&!E&&!h&&M(v,"inspector-hover")}let j=function(e){let t=new Map;for(let n of e){let e=t.get(n.target);(!e||Kd[n.owner]>Kd[e])&&t.set(n.target,n.owner)}return t}(C),A=(e,t)=>j.get(e)===t,R=(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},I=new Set;return{selectorElementInfo:x,nestedBadgeOwnerSelector:S,hoveredLinkedAnnotationId:E,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)||Za(n.linkedSelector,n.elements)!==e||(!t||n.timestamp>t.timestamp)&&(t=n);return t},ownedInFlightSelectorColors:R(g,"in-flight"),ownedFocusedSelectorColors:R(y,"selected"),claimElementOverlay:(e,t)=>!(!A(e,t)||I.has(e)||(I.add(e),0))}}({activeText:Fe,pendingLinkedText:Ue,activeTextSendHintId:Qp,activeTool:i.activeTool,isAnnotating:i.isAnnotating,annotations:i.annotations,pageAnnotations:uo,pageStyleModifications:co,pageTextModifications:po,supersededAnnotations:Vo,nestedBadgeHover:Cn,isSendBundleHovered:Ln,badgeHoveredAnnotationId:xn,hoveredTextId:qe,badgeHoveredSelector:wn,focusedThreadAnnotationId:A,inFlightSelectorColors:h,focusedSelectorColors:za,hoveredElement:nt}),Lu=rs,Pu=Fe?.domEdit?Qo(i.activeColor,.28):"#000000",zu=Fe?.domEdit?"transparent":"#ffffff",Nu=Jo??nt,Du=Jo?"selected":"hover",_u=Jo?Zo?.target??Jn(Jo):Ko,Fu=_u?.adapter,$u=_u?.key;(0,Va.useEffect)(()=>(O?.(i.isAnnotating&&Nu?{element:Nu,selection:Du,subject:Fu&&$u?{adapter:Fu,key:$u}:void 0}:null),()=>O?.(null)),[O,i.isAnnotating,Nu,Du,Fu,$u]);let Ou=e=>{Je.current=null,F?.remove(e),rt(null),lt(null),Qe(t=>t?.target.adapter===e.adapter&&t.target.key===e.key?null:t)};if(we){let e=be.current,t=e?.draft?i.activeColor:i.annotations.find(t=>t.id===e?.id)?.color??i.activeColor;return Te?(0,Up.jsx)($c,{cursor:Te,stepCount:Ce,accentColor:t,toolbarElement:N?.current,threadElement:D}):null}let Hu=!i.isAnnotating||Fe||Ue||Ke?null:e,Wu=i.isAnnotating&&"hand"!==i.activeTool&&(q&&(co.length>0||po.length>0||!!Bo?.length)||Ta.length>0||(m?.size??0)>0||pa);return(0,Up.jsxs)(Up.Fragment,{children:[($l.preview||Fe?.region)&&(0,Up.jsx)("svg",{"data-popmelt-lasso":"","aria-hidden":"true",style:{position:"fixed",inset:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:9999},children:(0,Up.jsx)("polygon",{points:($l.preview??Fe.region.points.map(e=>({x:e.x-oo.x,y:e.y-oo.y}))).map(e=>`${e.x},${e.y}`).join(" "),fill:i.activeColor,fillOpacity:.07,fillRule:"evenodd",stroke:i.activeColor,strokeWidth:1,strokeDasharray:Br})}),(0,Up.jsx)("canvas",{ref:ce,part:ri,"data-devtools":"annotation-paint","aria-hidden":"true",style:{...as,pointerEvents:"none"}}),(0,Up.jsx)("canvas",{ref:te,width:1,height:1,id:"devtools-canvas",style:as,onPointerDown:e=>{if(H?.(),Le.current=null,e.isPrimary&&ta&&Xp(e)&&El(e.clientX,e.clientY))return Le.current={startX:e.clientX,startY:e.clientY,moved:!1},void e.preventDefault();if("touch"===e.pointerType&&"sticker"===i.activeTool)return;let t="sticker"===i.activeTool&&e.isPrimary&&0===e.button,n=t&&Q?wl(e.clientX,e.clientY):null;if(X&&"family"!==St&&n?.hasAttribute("data-popmelt-subject-key"))return void U?.(n);let r=n&&Q?.(n);Pe.current=t&&(r||U&&"family"===St)?{startX:e.clientX,startY:e.clientY,moved:!1}:null,(!r||(clearTimeout(Ie.current),"value"!==St))&&Bl(e)},onPointerMove:e=>{Le.current?Le.current=Vd(Le.current,e.clientX,e.clientY):(Pe.current&&(Pe.current=Vd(Pe.current,e.clientX,e.clientY)),H?.(),($l.active()||de.current||!Ko||!$f(e.currentTarget.ownerDocument,e.clientX,e.clientY))&&ql(e))},onTouchEnd:$l.activateTouchTap,onClick:e=>{let t=Le.current;if(Le.current=null,t){if(qd(t)&&ta&&Xp(e)){let t=El(e.clientX,e.clientY);t&&Cl(t,{x:e.clientX,y:e.clientY})}return}let n=Pe.current;if(Pe.current=null,!qd(n))return;let r=wl(e.clientX,e.clientY);r&&(clearTimeout(Ie.current),Q?.(r)?1===e.detail&&(Ie.current=setTimeout(()=>{r.isConnected&&("value"===St&&r instanceof HTMLElement?zr(r):"family"===St&&U?.(r))},350)):"family"===St&&U?.(r))},onPointerUp:e=>{Le.current||Yl(e)},onPointerCancel:e=>{Le.current=null,Pe.current=null,$l.active()?$l.cancel():de.current?me():Fl(e)},onLostPointerCapture:e=>{$l.active()&&$l.cancel(),de.current?.pointerId===e.pointerId&&me()},onDoubleClick:Xl,onPointerLeave:e=>{if(Pe.current=null,de.current||$l.active()||na&&e.relatedTarget instanceof Element&&e.relatedTarget.closest("[data-popmelt-hover-action-rail]")||function(e){return e instanceof Element&&null!==e.closest("[data-popmelt-steer-overlay]")}(e.relatedTarget)||Kp(e.relatedTarget))return;Yl(e),cn(),en.current=null,tn.current=null;let t=()=>{rt(null),lt(null)};if(Jn(nt)){let{clientX:n,clientY:r}=e,i=e.currentTarget.getRootNode();return void window.setTimeout(()=>{Kp(i.elementFromPoint(n,r))||null!==Je.current||t()},100)}t()},onContextMenu:e=>{if(Ko&&$f(e.currentTarget.ownerDocument,e.clientX,e.clientY))return e.preventDefault(),e.stopPropagation(),void Ou(Ko);ts(e)}}),pe&&F&&(()=>{let e=F.resolve(pe);return e?(0,Up.jsx)(Oa,{element:e.element,activeFacet:"translate",accentColor:i.activeColor,showHandles:!1,showRotateHandle:!1,refreshKey:Ge}):null})(),Ke&&F&&(0,Up.jsx)(Ed,{accentColor:i.activeColor,created:Ke.created,registry:F,target:Ke.target,onCommit:e=>{rt(e.element),lt(e.elementInfo),Ze(e=>e+1)},onClose:()=>Qe(null),onCancelCreated:()=>{F.remove(Ke.target),Qe(null)}},`${Ke.target.adapter}:${Ke.target.key}`),Mt&&(0,Up.jsx)(ls,{color:rs,cursorRef:et,tool:Mt.tool,onHandoff:()=>Tt(e=>e?.id===Mt.id?{...e,nativeReady:!0}:e),onDone:()=>Tt(null)},Mt.id),i.isAnnotating&&Fe&&(0,Up.jsxs)("div",{"data-devtools":"annotation-composer",part:Cs?ni:void 0,style:su&&Ss?{position:Es?"absolute":"fixed",...Es?{left:Zs+Es.x,top:eu+Es.y}:ai(Cs,Ss,Zs,eu),width:Xs,height:_s,transform:"translateZ(0)",pointerEvents:"none",zIndex:10002}:{display:"contents"},children:[xu&&Fe.subjectAnchor&&(0,Up.jsx)(Ra,{element:xu,annotationRect:{left:Zs,top:eu,width:Xs,height:_s},subjectAnchor:Fe.subjectAnchor,color:i.activeColor,subjectRegistry:F}),(0,Up.jsx)(ns,{enterKeyHint:Qr&&b&&!Ns?"send":void 0,sourceEditor:Fe.domEdit?.sourceEditor,target:Fe.domEdit?.targetElement,singleTextNode:Fe.domEdit?.singleTextNode,segments:Fe.domEdit?.segments,canvasRef:te,value:Fe.text,command:Is,fontSize:Fe.fontSize,prefix:ds,inputRef:Pi,inputStyle:mu,selectionBackground:Pu,selectionColor:zu,annotationBorderRadius:$s,activeColor:i.activeColor,boundaryRects:Fe.domEdit?.boundaryRects,viewportClip:Fe.domEdit&&ot(Fe.domEdit.targetElement.ownerDocument)?pt(new DOMRect(0,0,window.innerWidth,window.innerHeight),Fe.domEdit.targetElement.ownerDocument):void 0,wrapsDomText:Fe.domEdit?.wrapsText,showEditor:!wa,rawLeft:fu,top:hu,baselineOffset:-.5,onChange:Jl,onKeyDown:es,onPaste:Oe,onBlur:bl},Fe.paragraphSession?.id??Fe.id),!wa&&!Fe.domEdit&&(0,Up.jsx)(Vl,{rawLeft:fu,width:Xs,top:hu,scroll:oo,collisionId:ba,nestedAnnotationCount:Sa,nestedAnnotationIds:ka,nestedBadgeColor:Ca,imageCount:ps,color:i.activeColor,interactionEpisodeStepCount:Fe.interactionEpisode?.steps.length??0,showSendHint:(Qr||yo===Qp)&&!!Fe.text.trim(),bundleCount:ho,onHoverNestedAnnotations:yi,onHoverSendHint:vi,onClearInteractionEpisode:()=>Oi(Fe.id),onSend:b?fl:void 0}),(0,Up.jsx)(Wl,{point:su?{x:8,y:4}:Fe.point,scroll:su?{x:0,y:0}:oo,attachments:Fe.attachments??[],showAttachments:!Fe.domEdit,onRemoveAttachment:Be})]}),Wu&&(0,Up.jsx)(ud,{historyPreview:Hu,subjectRegistry:F,sampleTargets:q?Bo:void 0,styleModifications:q?co:[],textModifications:q?po:[],stagedComments:Ta,accentColor:i.activeColor,annotationNumberBySelector:Xo,inFlightSelectors:f,inFlightAnnotationIds:l,activeAnnotationIds:c,inFlightSelectorJobIds:p,canvasApprovals:u,inFlightSelectorColors:h,toolbarRef:N,onHoverSelector:di,sendHintSelector:Aa,pendingBundleCount:ho,onHoverSendBundle:vi,onSend:b?fl:void 0,onSelectSticker:xi,onDeleteSticker:bi,threadStates:m,onViewThread:w,hoveredElement:e?null:nt,hoveredElementInfo:at,showHoverStyles:da,showHoverIdentifier:pa,hoverRailAction:na&&t?{compactIdentifier:!0,spotlight:!0,width:ca,render:e=>sa?(0,Up.jsx)(Fo,{reason:sa,layered:e}):(0,Up.jsx)(Ao,{bundleCount:1,layered:e,actionLabel:"Sample",shortcut:(0,Up.jsx)(Ee,{size:12,fill:"currentColor","aria-hidden":!0}),description:"Sample a copy to place on your plane.",onSend:()=>Cl(na,et.current??void 0)})}:void 0,activeCommentInput:Kr?Pi:void 0,onEditComment:il,onDeleteComment:eo,onDeletePeerComment:E?e=>{let t=Mi.current.annotations.find(t=>t.id===e);t&&fo(t,Mi.current.annotations)?eo(e):E(e)}:void 0,onDiscardPlacedSample:({selector:e,pathname:t})=>{o({type:"DISCARD_PLACED_SAMPLE",payload:{selector:e,pathname:t}}),Yr(),En(null),Mn(null),Pn(!1)},onDiscardTextChanges:to,onArchiveThread:k,onClearInteractionEpisode:Oi,onEditSubject:Ul,onDeleteSubject:Ou,onHoverSubjectLabel:e=>{Je.current=e},refreshKey:Ot,activeCommentEntry:wa?{element:wa.element,width:Xs,imageCount:ps,trailingWidth:Ol(ps)+ko(Fe?.interactionEpisode?.steps.length??0),render:e=>Fe&&wa?(0,Up.jsxs)(Up.Fragment,{children:[(0,Up.jsx)(is,{anchor:e,insetTopLeft:bs,width:Xs,height:_s,value:Fe.text,command:Is,fontSize:Fe.fontSize,prefix:ds,inputRef:Pi,inputStyle:mu,onChange:Jl,onKeyDown:es,onPaste:Oe,onBlur:bl,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),eo(Fe.id)}}),(0,Up.jsx)(Eo,{stepCount:Fe.interactionEpisode?.steps.length??0,onClear:()=>Oi(Fe.id)})]}):null}:void 0}),"hand"===i.activeTool&&i.isAnnotating&&(co.length>0||po.length>0)&&(0,Up.jsx)(fd,{styleModifications:co.filter(e=>{let t=Rn(e.selector);return!!t&&Iu(t,"pending-change")}),textModifications:po.filter(e=>{let t=Rn(e.selector);return!!t&&Iu(t,"pending-change")}),accentColor:i.activeColor}),q&&i.isAnnotating&&!Fe?.domEdit&&(()=>{let e=new Set;return po.flatMap(t=>{if(t.captured||e.has(t.selector))return[];let n=Rn(t.selector);return n&&Iu(n,"pending-change")?(e.add(t.selector),[(0,Up.jsx)(Ea,{element:n,isSelected:!1,color:i.activeColor,hideTooltip:!0},`pending-text-change-${t.selector}`)]):[]})})(),i.isAnnotating&&!na&&(0,Up.jsx)(Lo,{annotations:uo,displayAnnotations:La,supersededAnnotations:Vo,inFlightIds:l,approvalThreads:u?.byAnnotation,orientationLabels:s,activeIds:c,queuePositions:d,scrollX:oo.x,scrollY:oo.y,annotationGroupMap:Uo,onViewThread:w,onSelectAnnotation:Gi,onDeleteDraftAnnotation:eo,onClearInteractionEpisode:Oi,onHoverAnnotation:ii,canvasRef:te,toolbarRef:N,activeBundleAnnotationIds:Mo,inactiveBundleOpacity:jo,animateBundleOpacity:!Ro&&!Co,hoverRestoredAnnotationIds:To,nestedAnnotationCountById:ma,nestedAnnotationIdsById:ga,onHoverNestedAnnotations:yi,onHoverSendBundle:vi,onSend:b?fl:void 0,sendHintAnchorId:Pa===Qp?null:Pa,pendingBundleCount:ho,parentPinnedAnnotationIds:ji,parentPinnedLocationLabels:xo,parentPinnedTooltipAnnotationId:bo,onActivateAnnotation:So,hiddenAnnotationIds:ja}),i.isAnnotating&&(0,Up.jsx)(No,{annotations:La,activeIds:c,scrollX:oo.x,scrollY:oo.y,spotlightIds:Ro,emphasizedIds:Mo,hoverRestoredIds:To,inactiveOpacity:jo}),i.isAnnotating&&ju&&(0,Up.jsx)(Do,{inFlightSelectorColors:ju,selectorElementInfo:Ru,subjectRegistry:F}),i.isAnnotating&&Au&&(0,Up.jsx)(Do,{inFlightSelectorColors:Au,selectorElementInfo:Ru,animated:!1,subjectRegistry:F}),(0,Up.jsx)(tc,{active:"hand"===i.activeTool&&i.isAnnotating,accentColor:i.activeColor,domDropPreview:Xn,cursorViewport:tr,gapElement:sr?rr.current.element:ir,gapDragging:sr,gapHoveredAxis:ar,gapIsAuto:cr,gapRefreshKey:fr,swipeHint:hr,radiusElement:wr?gr.current.element:yr,radiusDragging:wr,radiusHoveredCorner:xr,textElement:jr?kr.current.element:Er,textDragging:jr,textHoveredProperty:Mr,paddingElement:Qn?zn.current.element:Bn,paddingDragging:Qn,paddingHoveredSide:Yn}),!Wu&&Hu&&(0,Up.jsx)(Ba,{entry:Hu,color:Hu.marker?.color??i.activeColor,subjectRegistry:F}),("inspector"===i.activeTool||"sticker"===i.activeTool)&&i.isAnnotating&&(0,Up.jsx)(Up.Fragment,{children:!e&&nt&&(()=>{let e="sticker"===i.activeTool&&"value"===St&&("padding"===ht||"margin"===ht)&&Kt.current?.element===nt,t=vd("sticker"===i.activeTool,ht,St,vt);if(Tu(nt)||!Iu(nt,"inspector-hover"))return null;let n=ea||uo.some(e=>!(!e.linkedSelector||Vo.has(e))&&Sl(Za(e.linkedSelector,e.elements),nt,e.elements?.[0]?.context)),r=!!qe||!!xn;return(0,Up.jsxs)(Up.Fragment,{children:[!e&&(0,Up.jsx)(Ea,{element:nt,isSelected:!1,elementInfo:at,color:Lu,hideOutline:!Ko,hideFill:!Ko,tintHoveredSubject:!!Ko,subjectRegistry:F,refreshKey:"sticker"===i.activeTool?Ot:void 0,hideTooltip:Go||pa||n||r}),!t&&!Ko&&(0,Up.jsx)(Oa,{element:nt,activeFacet:"translate",accentColor:Lu,showHandles:!1,outlineStyle:"dashed",refreshKey:"sticker"===i.activeTool?Ot:void 0})]})})()}),(0,Up.jsx)(xd,{active:"sticker"===i.activeTool&&i.isAnnotating,accentColor:Lu,family:ht,stage:St,subproperty:vt,hoveredElement:nt,previewElement:Kt.current?.element??null,transformPreviewTarget:Jt.current,previewRevision:Ot,frameListenerRef:nn,cursorViewport:Et,drag:Vr,onGapPointerDown:Nr,onRadiusPointerDown:Dr,onSpacingPointerDown:_r,onTransformPointerDown:$r}),"sticker"===i.activeTool&&i.isAnnotating&&Et&&(0,Up.jsx)(Ic,{cursor:Et,family:ht,step:gt,subproperty:vt,stage:St,accentColor:i.activeColor,applyPulse:Rt,contextLabelPulse:Lt,depthSnapPulse:zt,rejectPulse:Dt,stepUnavailable:Ft,query:Wt?{tokens:Wt.segments.flatMap((e,t)=>{let n=mf(Wt.history[t]?.scope??uf,e);return n?[yf(n)]:[]}),...vf(Wt.query,gf(Wt.scope,Wt.query))}:null,controlBounds:K,toolbarElement:N?.current,threadElement:D,annotationRailHovered:null!==wn||null!==xn||null!==Cn||Ln}),!Cn&&!Ln&&(Fe?.linkedSelector||Ue?.linkedSelector)&&(()=>{let e=Fe?.linkedSelector||Ue?.linkedSelector;if(!e)return null;let t=Za(e,Fe?.elements??Ue?.elements);return t&&Iu(t,"direct-manipulation")?(0,Up.jsx)(Ea,{element:t,isSelected:!0,color:va?.color??i.activeColor,hideTooltip:!0}):null})(),A&&(()=>{if(Ln)return null;let e=i.annotations.find(e=>e.id===A);if(!e?.linkedSelector||bu===e.linkedSelector)return null;let t=Za(e.linkedSelector,e.elements);if(!t||!Iu(t,"thread-focus"))return null;let n=!(!l||!l.has(e.id));return(0,Up.jsx)(Ea,{element:t,isSelected:!n,color:e.color,onActivate:e.threadId?()=>ki(e.threadId):void 0,hideTooltip:!0})})(),Mu&&(()=>{let e=i.annotations.find(e=>e.id===Mu);if(!e?.linkedSelector)return null;let t=Za(e.linkedSelector,e.elements);return t&&Iu(t,"annotation-hover")?(0,Up.jsx)(Ea,{element:t,isSelected:!1,color:e.color,onActivate:e.threadId?()=>ki(e.threadId):void 0,hideTooltip:!0}):null})(),Cn&&!Ln&&(()=>{let e=new Set;return Cn.annotationIds.flatMap(t=>{let n=i.annotations.find(e=>e.id===t);if(!n?.linkedSelector||e.has(n.linkedSelector))return[];let r=Za(n.linkedSelector,n.elements);return r&&Iu(r,"nested-preview")?(e.add(n.linkedSelector),[(0,Up.jsx)(Ea,{element:r,isSelected:!1,color:n.color,hideTooltip:!0},`nested-annotation-${t}`)]):[]})})(),Ln&&(()=>{let e=[],t=new Set,n=(n,r,i,o)=>{if(!r||t.has(r))return;let a=Za(r,i);a&&Iu(a,"bundle-preview")&&(t.add(r),e.push({id:n,element:a,color:o}))};for(let e of uo)"pending"===(e.status??"pending")&&n(e.id,e.linkedSelector,e.elements,e.color);Fe&&!Fe.domEdit&&Fe.text.trim()&&n(Qp,Fe.linkedSelector,Fe.elements,i.activeColor);for(let e of co)e.captured||n(`style-${e.selector}`,e.selector,[e.element],i.activeColor);for(let e of po)e.captured||n(`text-${e.selector}`,e.selector,[e.element],i.activeColor);return e.map(e=>(0,Up.jsx)(Ea,{element:e.element,isSelected:!1,color:e.color,hideTooltip:!0},`send-bundle-${e.id}`))})(),wn&&(()=>{let e=Rn(wn);if(!e||!Iu(e,"badge-hover"))return null;let t=ol([wn],m??new Map,Ma.get(wn)??i.activeColor,Rn);return(0,Up.jsx)(Up.Fragment,{children:(0,Up.jsx)(Ea,{element:e,isSelected:!1,color:t,fillOpacity:.1,hideTooltip:!0,subjectRegistry:F})})})()]})}var Zp=u(d()),Jp=u(x()),eh=[1,1.5,2.25,3.375,4];function th(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 nh({framing:e}){let t=(0,Zp.useSyncExternalStore)(e.subscribe,e.getScale,e.getScale),n=(0,Zp.useSyncExternalStore)(e.subscribe,e.getFitScale,e.getFitScale),r=null===n?[]:eh.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,Jp.jsxs)("div",{"data-preview-zoom-controls":"",role:"group","aria-label":"Preview framing","data-popmelt-canvas-block":"",children:[(0,Jp.jsx)(De,{type:"button","aria-label":"Zoom out",hint:a("out",o),disabled:o===t,onClick:()=>e.setScale(o),children:(0,Jp.jsx)(fe,{size:14})}),(0,Jp.jsx)(De,{type:"button","aria-label":"Zoom in",hint:a("in",i),disabled:i===t,onClick:()=>e.setScale(i),children:(0,Jp.jsx)(ve,{size:14})})]})}function rh({children:e,overlay:t,interactive:n=!1,framing:r,parentGestureSurface:i}){let o=Xe.dark,[a]=(0,Zp.useState)(th),l=r??a,s=(0,Zp.useRef)(null),[u,c]=(0,Zp.useState)(),[d,f]=(0,Zp.useState)({scale:1,x:0,y:0}),p=(0,Zp.useRef)(d);return(0,Zp.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)}},v=null,x=e=>{if(2!==e.touches.length)return void(v=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&&v&&v.distance>0){let t=d(e);h(p.current.scale*o/v.distance,v.x,v.y,t);let n=p.current;t.width&&t.height&&l.setView(n.scale,n.x+(r-v.x)/t.width,n.y+(i-v.y)/t.height,t.width,t.height)}v={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,x,{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,x,!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,Zp.useLayoutEffect)(()=>{n&&s.current&&function(e){let t=e.ownerDocument.defaultView;t&&ea.get(t)?.schedule(),e.dispatchEvent(new Event(ta,{bubbles:!0}))}(s.current)},[n,d,u]),(0,Jp.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,Jp.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,Jp.jsx)(nh,{framing:l}),!n&&d.scale>1&&(0,Jp.jsxs)(Jp.Fragment,{children:[(0,Jp.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,Jp.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,Jp.jsxs)("span",{children:[Math.round(100*d.scale),"%"]}),(0,Jp.jsx)(de,{size:14,"aria-hidden":"true"})]})]})]})}var ih=/^(?:@[a-zA-Z][\\w-]{0,63}|~?(?:0|[1-9]\\d{0,3})(?:\\.(?:0|[1-9]\\d{0,3})){0,31}|)$/;function oh(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 ah(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(oh(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(oh);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 lh="[modern-screenshot]",sh=typeof window<"u",uh=sh&&"Worker"in window,ch=(sh&&window,sh&&window,sh?window.navigator?.userAgent:""),dh=ch.includes("Chrome"),fh=ch.includes("AppleWebKit")&&!dh,ph=ch.includes("Firefox"),hh=e=>"CSSLayerBlockRule"===e.constructor.name,mh=e=>1===e.nodeType,gh=e=>"object"==typeof e.className,yh=e=>"image"===e.tagName,vh=e=>mh(e)&&typeof e.style<"u"&&!gh(e),xh=e=>8===e.nodeType,bh=e=>"IMG"===e.tagName,wh=e=>"VIDEO"===e.tagName,Sh=e=>"SLOT"===e.tagName;function kh(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 Eh=e=>e.startsWith("data:");function Ch(e,t){if(e.match(/^[a-z]+:\\/\\//i))return e;if(sh&&e.match(/^\\/\\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!sh)return e;let n=Mh().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 Mh(e){return(e&&mh(e)?e?.ownerDocument:e)??window.document}var Th="http://www.w3.org/2000/svg",jh=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 Ah(e,t){let n=Mh(t).createElement("img");return n.decoding="sync",n.loading="eager",n.src=e,n}function Rh(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:o,onWarn:a}=t??{},l="string"==typeof e?Ah(e,Mh(i)):e,s=null,u=null;function c(){n(l),s&&clearTimeout(s),u?.()}if(r&&(s=setTimeout(c,r)),wh(l)){let e=l.currentSrc||l.src;if(!e)return l.poster?Rh(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=yh(l)?l.href.baseVal:l.currentSrc||l.src;if(!e)return c();let t=async()=>{if(bh(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(bh(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 Ih=function(){let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)}();function Lh(e){return e?.split(",").map(e=>e.trim().replace(/"|\'/g,"").toLowerCase()).filter(Boolean)}var Ph=0;function zh(e){let t=`${lh}[#${Ph}]`;return Ph++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&((...e)=>console.warn(lh,...e))(...t)}}function Nh(e){return{cache:e?"no-cache":"force-cache"}}async function Dh(e,t){return(e=>e&&"__CONTEXT__"in e)(e)?e:_h(e,{...t,autoDestruct:!0})}async function _h(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},o=!!t?.debug,a=t?.features??!0,l=e.ownerDocument??(sh?window.document:void 0),s=e.ownerDocument?.defaultView??(sh?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:Nh(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:zh(o),node:e,ownerDocument:l,ownerWindow:s,dpi:1===n?null:96*n,svgStyleElement:Fh(l),svgDefsElement:l?.createElementNS(Th,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:uh&&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:`${[kh(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){vh(e)&&(bh(e)||wh(e)?await Rh(e,t):await Promise.all(["img","video"].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>Rh(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(mh(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 Fh(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 $h(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if("data:,"!==t)return Ah(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 Oh=["width","height","-webkit-text-fill-color"],Hh=["stroke","fill"];function Wh(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),o=gh(e)&&"svg"!==i,a=o?Hh.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__${Ih()}`,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(Th,"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);Oh.includes(e)||p.set(e,f.getPropertyValue(e))}return d.body.removeChild(u),r.set(l,p),p}function Bh(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 Vh=["::before","::after"],qh=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"],Yh=new Set(["symbol"]);async function Uh(e,t,n,r,i){if(mh(n)&&((e=>"STYLE"===e.tagName)(n)||(e=>"SCRIPT"===e.tagName)(n))||r.filter&&!r.filter(n))return;Yh.has(t.nodeName)||Yh.has(n.nodeName)?r.currentParentNodeStyle=void 0:r.currentParentNodeStyle=r.currentNodeStyle;let o=await Qh(n,r,!1,i);r.isEnable("restoreScrollPosition")&&function(e,t){if(!vh(e)||!vh(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 Xh(e,t,n,r){let i=e.firstChild;mh(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let o=i;o;o=o.nextSibling)if(!xh(o))if(mh(o)&&Sh(o)&&"function"==typeof o.assignedNodes){let i=o.assignedNodes();for(let o=0;o<i.length;o++)await Uh(e,t,i[o],n,r)}else await Uh(e,t,o,n,r)}var Kh=/^[\\w-:]+$/;async function Qh(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&&mh(e)&&(vh(e)||gh(e))){let r=await function(e,t){return(e=>"CANVAS"===e.tagName)(e)?$h(e,t):(e=>"IFRAME"===e.tagName)(e)?function(e,t){try{if(e?.contentDocument?.documentElement)return Qh(e.contentDocument.documentElement,t)}catch(e){t.log.warn("Failed to clone iframe",e)}return e.cloneNode(!1)}(e,t):bh(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):wh(e)?async function(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return Ah(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 Rh(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?Ah(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?Ah(e.poster,e.ownerDocument):n}return $h(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];Kh.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=Wh(e,null,r);a?.forEach((e,t)=>{u.delete(t)});let c=Bh(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"),dh&&(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=Lh(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=[Ih()],d=Wh(e,n,r);s?.forEach((e,t)=>{d.delete(t)});let f=Bh(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&&(Vh.forEach(u),n&&qh.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),wh(e)||await Xh(e,r,t,c),await(l?.(r)),r}let s=e.cloneNode(!1);return await Xh(e,s,t),await(l?.(s)),s}function Gh(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 Zh(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&&(fh||ph)&&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,v=new Set;t&&r.split(";")[1].split(",").forEach(e=>{g.has(e)&&g.get(e).forEach(e=>v.add(e))});let x=t&&v.size,b={url:a,timeout:l,responseType:x?"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!fh&&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(jh);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 Jh(e,t,n,r){if(!em(e))return e;for(let[i,o]of function(e,t){let n=[];return e.replace(tm,(e,r,i)=>(n.push([i,Ch(i,t)]),e)),n.filter(([e])=>!Eh(e))}(e,t))try{let t=await Zh(n,{url:o,requestType:r?"image":"text",responseType:"dataUrl"});e=e.replace(nm(i),`$1${t}$3`)}catch(e){n.log.warn("Failed to fetch css data url",i,e)}return e}function em(e){return/url\\(([\'"]?)([^\'"]+?)\\1\\)/.test(e)}var tm=/url\\(([\'"]?)([^\'"]+?)\\1\\)/g;function nm(e){let t=e.replace(/([.*+?^${}()|\\[\\]\\/\\\\])/g,"\\\\$1");return new RegExp(`(url\\\\([\'"]?)(${t})([\'"]?\\\\))`,"g")}var rm=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function im(e,t){let{tasks:n}=t;mh(e)&&((bh(e)||yh(e))&&n.push(...function(e,t){if(bh(e)){let n=e.currentSrc||e.src;if(!Eh(n))return[Zh(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(t=>{t&&(e.srcset="",e.dataset.originalSrc=n,e.src=t||"")})];(fh||ph)&&t.drawImageCount++}else if(gh(e)&&!Eh(e.href.baseVal)){let n=e.href.baseVal;return[Zh(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[Zh(t,{url:o,responseType:"text"}).then(e=>{r?.insertAdjacentHTML("beforeend",e)})]}return[]}(e,t))),vh(e)&&n.push(...function(e,t){return rm.map(n=>{let r=e.getPropertyValue(n);return r&&"none"!==r?((fh||ph)&&t.drawImageCount++,Jh(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=>{im(e,t)})}async function om(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=cm(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 Zh(t,{url:n,requestType:"text",responseType:"text"})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(tm,(e,t,r)=>e.replace(r,Ch(r,n)));for(let e of function(e){if(null==e)return[];let t=[],n=e.replace(am,"");for(;;){let e=lm.exec(n);if(!e)break;t.push(e[0])}n=n.replace(lm,"");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=>{dm(e.cssRules,c)}),c.filter(e=>(e=>"CSSFontFaceRule"===e.constructor.name)(e)&&em(e.style.getPropertyValue("src"))&&Lh(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(Jh(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=cm(e,t),o.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}\\n`))}))})}}var am=/(\\/\\*[\\s\\S]*?\\*\\/)/g,lm=/((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})/gi,sm=/url\\([^)]+\\)\\s*format\\((["\']?)([^"\']+)\\1\\)/g,um=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function cm(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(um,e=>{for(;;){let[t,,n]=sm.exec(e)||[];if(!n)return"";if(n===r)return`src: ${t};`}}):e}function dm(e,t=[]){for(let n of Array.from(e))hh(n)?t.push(...dm(n.cssRules)):"cssRules"in n?dm(n.cssRules,t):t.push(n);return t}var fm=/\\bx?link:?href\\s*=\\s*["\'](?!data:)[^"\']+["\']/i;async function pm(e,t){let n=await Dh(e,t);if(mh(n.node)&&gh(n.node)&&!function(e){return fm.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 Qh(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&&mh(m)&&(i.time("embed web font"),await om(0,n),i.timeEnd("embed web font")),i.time("embed node"),im(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 v=function(e,t){let{width:n,height:r}=t,i=function(e,t,n){let r=Mh(n).createElementNS(Th,"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&&v.insertBefore(l,v.children[0]),a&&v.insertBefore(a,v.children[0]),d&&Gh(n),await(h?.(v)),v}async function hm(e,t){let n=await Dh(e,t),r=await pm(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=Fh(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(Th,"defs"),n.svgStyles.clear());let o=Ah(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 Rh(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 mm=u(d()),gm=2e3;function ym(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 vm(...e){let t="THREE."+(e=ym(e)).shift();{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function xm(e,t,n){return Math.max(t,Math.min(n,e))}Math.PI,Math.PI;var bm=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=xm(this.x,e.x,t.x),this.y=xm(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=xm(this.x,e,t),this.y=xm(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(xm(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(xm(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}},wm=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:vm("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(xm(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}},Sm=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(Em.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Em.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=xm(this.x,e.x,t.x),this.y=xm(this.y,e.y,t.y),this.z=xm(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=xm(this.x,e,t),this.y=xm(this.y,e,t),this.z=xm(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(xm(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 km.copy(this).projectOnVector(e),this.sub(km)}reflect(e){return this.sub(km.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(xm(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}},km=new Sm,Em=new wm,Cm=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/Mm.setFromMatrixColumn(e,0).length(),i=1/Mm.setFromMatrixColumn(e,1).length(),o=1/Mm.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(jm,e,Am)}lookAt(e,t,n){let r=this.elements;return Lm.subVectors(e,t),0===Lm.lengthSq()&&(Lm.z=1),Lm.normalize(),Rm.crossVectors(n,Lm),0===Rm.lengthSq()&&(1===Math.abs(n.z)?Lm.x+=1e-4:Lm.z+=1e-4,Lm.normalize(),Rm.crossVectors(n,Lm)),Rm.normalize(),Im.crossVectors(Lm,Rm),r[0]=Rm.x,r[4]=Im.x,r[8]=Lm.x,r[1]=Rm.y,r[5]=Im.y,r[9]=Lm.y,r[2]=Rm.z,r[6]=Im.z,r[10]=Lm.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],v=n[7],x=n[11],b=n[15],w=r[0],S=r[4],k=r[8],E=r[12],C=r[1],M=r[5],T=r[9],j=r[13],A=r[2],R=r[6],I=r[10],L=r[14],P=r[3],z=r[7],N=r[11],D=r[15];return i[0]=o*w+a*C+l*A+s*P,i[4]=o*S+a*M+l*R+s*z,i[8]=o*k+a*T+l*I+s*N,i[12]=o*E+a*j+l*L+s*D,i[1]=u*w+c*C+d*A+f*P,i[5]=u*S+c*M+d*R+f*z,i[9]=u*k+c*T+d*I+f*N,i[13]=u*E+c*j+d*L+f*D,i[2]=p*w+h*C+m*A+g*P,i[6]=p*S+h*M+m*R+g*z,i[10]=p*k+h*T+m*I+g*N,i[14]=p*E+h*j+m*L+g*D,i[3]=y*w+v*C+x*A+b*P,i[7]=y*S+v*M+x*R+b*z,i[11]=y*k+v*T+x*I+b*N,i[15]=y*E+v*j+x*L+b*D,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,v=a*f-s*c,x=a*d-l*c,b=o*f-s*u,w=o*d-l*u,S=o*c-a*u;return t*(h*y-m*v+g*x)-n*(p*y-m*b+g*w)+r*(p*v-h*b+g*S)-i*(p*x-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,v=t*l-r*o,x=t*s-i*o,b=n*l-r*a,w=n*s-i*a,S=r*s-i*l,k=u*h-c*p,E=u*m-d*p,C=u*g-f*p,M=c*m-d*h,T=c*g-f*h,j=d*g-f*m,A=y*j-v*T+x*M+b*C-w*E+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 R=1/A;return e[0]=(a*j-l*T+s*M)*R,e[1]=(r*T-n*j-i*M)*R,e[2]=(h*S-m*w+g*b)*R,e[3]=(d*w-c*S-f*b)*R,e[4]=(l*C-o*j-s*E)*R,e[5]=(t*j-r*C+i*E)*R,e[6]=(m*x-p*S-g*v)*R,e[7]=(u*S-d*x+f*v)*R,e[8]=(o*T-a*C+s*k)*R,e[9]=(n*C-t*T-i*k)*R,e[10]=(p*w-h*x+g*y)*R,e[11]=(c*x-u*w-f*y)*R,e[12]=(a*E-o*M-l*k)*R,e[13]=(t*M-n*E+r*k)*R,e[14]=(h*v-p*b-m*y)*R,e[15]=(u*b-c*v+d*y)*R,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,v=l*u,x=l*c,b=n.x,w=n.y,S=n.z;return r[0]=(1-(h+g))*b,r[1]=(f+x)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-x)*w,r[5]=(1-(d+g))*w,r[6]=(m+y)*w,r[7]=0,r[8]=(p+v)*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=Mm.set(r[0],r[1],r[2]).length(),a=Mm.set(r[4],r[5],r[6]).length(),l=Mm.set(r[8],r[9],r[10]).length();i<0&&(o=-o),Tm.copy(this);let s=1/o,u=1/a,c=1/l;return Tm.elements[0]*=s,Tm.elements[1]*=s,Tm.elements[2]*=s,Tm.elements[4]*=u,Tm.elements[5]*=u,Tm.elements[6]*=u,Tm.elements[8]*=c,Tm.elements[9]*=c,Tm.elements[10]*=c,t.setFromRotationMatrix(Tm),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,i,o,a=gm,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===gm)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=gm,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===gm)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}},Mm=new Sm,Tm=new Cm,jm=new Sm(0,0,0),Am=new Sm(1,1,1),Rm=new Sm,Im=new Sm,Lm=new Sm,Pm=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)}},zm=class{constructor(e=new Sm(1/0,1/0,1/0),t=new Sm(-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(Dm.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Dm.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=Dm.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,Dm):Dm.fromBufferAttribute(r,t),Dm.applyMatrix4(e.matrixWorld),this.expandByPoint(Dm);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),_m.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),_m.copy(n.boundingBox)),_m.applyMatrix4(e.matrixWorld),this.union(_m)}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,Dm),Dm.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(Vm),qm.subVectors(this.max,Vm),Fm.subVectors(e.a,Vm),$m.subVectors(e.b,Vm),Om.subVectors(e.c,Vm),Hm.subVectors($m,Fm),Wm.subVectors(Om,$m),Bm.subVectors(Fm,Om);let t=[0,-Hm.z,Hm.y,0,-Wm.z,Wm.y,0,-Bm.z,Bm.y,Hm.z,0,-Hm.x,Wm.z,0,-Wm.x,Bm.z,0,-Bm.x,-Hm.y,Hm.x,0,-Wm.y,Wm.x,0,-Bm.y,Bm.x,0];return!(!Xm(t,Fm,$m,Om,qm)||(t=[1,0,0,0,1,0,0,0,1],!Xm(t,Fm,$m,Om,qm)))&&(Ym.crossVectors(Hm,Wm),t=[Ym.x,Ym.y,Ym.z],Xm(t,Fm,$m,Om,qm))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Dm).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Dm).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()||(Nm[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Nm[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Nm[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Nm[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Nm[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Nm[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Nm[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Nm[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Nm)),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}},Nm=[new Sm,new Sm,new Sm,new Sm,new Sm,new Sm,new Sm,new Sm],Dm=new Sm,_m=new zm,Fm=new Sm,$m=new Sm,Om=new Sm,Hm=new Sm,Wm=new Sm,Bm=new Sm,Vm=new Sm,qm=new Sm,Ym=new Sm,Um=new Sm;function Xm(e,t,n,r,i){for(let o=0,a=e.length-3;o<=a;o+=3){Um.fromArray(e,o);let a=i.x*Math.abs(Um.x)+i.y*Math.abs(Um.y)+i.z*Math.abs(Um.z),l=t.dot(Um),s=n.dot(Um),u=r.dot(Um);if(Math.max(-Math.max(l,s,u),Math.min(l,s,u))>a)return!1}return!0}var Km=new Sm,Qm=new Sm,Gm=new Sm,Zm=new Sm,Jm=new Sm,eg=new Sm,tg=new Sm,ng=class{constructor(e=new Sm,t=new Sm(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,Km)),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=Km.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Km.copy(this.origin).addScaledVector(this.direction,t),Km.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Qm.copy(e).add(t).multiplyScalar(.5),Gm.copy(t).sub(e).normalize(),Zm.copy(this.origin).sub(Qm);let i,o,a,l,s=.5*e.distanceTo(t),u=-this.direction.dot(Gm),c=Zm.dot(this.direction),d=-Zm.dot(Gm),f=Zm.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(Qm).addScaledVector(Gm,o),a}intersectSphere(e,t){Km.subVectors(e.center,this.origin);let n=Km.dot(this.direction),r=Km.dot(Km)-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,Km)}intersectTriangle(e,t,n,r,i){Jm.subVectors(t,e),eg.subVectors(n,e),tg.crossVectors(Jm,eg);let o,a=this.direction.dot(tg);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}Zm.subVectors(this.origin,e);let l=o*this.direction.dot(eg.crossVectors(Zm,eg));if(l<0)return null;let s=o*this.direction.dot(Jm.cross(Zm));if(s<0||l+s>a)return null;let u=-o*Zm.dot(tg);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)}},rg=new Cm,ig=class{constructor(e,t,n=0,r=1/0){this.ray=new ng(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Pm,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=ym(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 rg.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(rg),this}intersectObject(e,t=!0,n=[]){return ag(e,this,n,t),n.sort(og),n}intersectObjects(e,t=!0,n=[]){for(let r=0,i=e.length;r<i;r++)ag(e[r],this,n,t);return n.sort(og),n}};function og(e,t){return e.distance-t.distance}function ag(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++)ag(r[e],t,n,!0)}}function lg(e){return[e.x,e.y,e.z].map(e=>Number(e.toFixed(4))).join(", ")}function sg(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 ug(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 cg(e){let t=[],n=e;for(;n?.parent;)t.push(ug(n)),n=n.parent;return t.reverse().join("/")}function dg(e){let t=e.userData.popmeltLabel;return"string"==typeof t&&t.trim()?t.trim():e.name.trim()||e.type}function fg(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__?vm("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");var pg=u(x());function hg({input:e,port:t,framing:n}){let r=(0,mm.useRef)(null);return(0,mm.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)),v=Math.min(...m.map(e=>e.top)),x=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,(x-v)/d))),w=(a.left+a.right-g-y)/(2*d),S=(a.top+a.bottom-v-x)/(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])),v=e.parts??{},x=new WeakMap,b=new WeakMap,w=new WeakMap,S=new WeakMap,k=new WeakMap,E=e=>Array.from(e.children).filter(e=>!e.hasAttribute("data-popmelt-paragraph-continuation")&&!e.hasAttribute("data-popmelt-empty-paragraph"));function C(t,n){let r=t.getAttribute("data-explore-part"),i=r&&ih.test("@"+r)?"@"+r:n;if(t instanceof HTMLElement||t instanceof SVGElement){if(x.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),x.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=v[s]?.text??l(v[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===v[t]?.[r]&&(i?e.style.setProperty(r,i):e.style.removeProperty(r),n.delete(r));for(let[r,i]of Object.entries(v[t]??{}))"text"===r||"paragraphs"===r||(n.has(r)||n.set(r,e.style.getPropertyValue(r)),e.style.setProperty(r,i))}(t,i),E(t).forEach((e,t)=>C(e,n?n+"."+t:String(t))),"P"===t.tagName&&t instanceof HTMLElement){let n=y.get(i+"|paragraphs")?.to,r=e.mirror?v[i]?.paragraphs??n:n;k.get(t)!==r&&(r?Gi(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):(Qi(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}))}E(i).forEach((e,t)=>C(e,t?"~"+t:"")),m()}let T,j,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,t){let n,r=e.raycaster??new ig,i=new bm,o=0,a=t=>e.key?.(t)??function(e){let t=e.userData.popmeltId;return"string"==typeof t&&t.trim()?t.trim():cg(e)}(t),l=(t,n)=>{let r=u?.owner(t)??a(t);if(!r)return null;let i=function(e,t,n){let r=(new zm).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 Sm(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 i?{key:r,label:e.label?.(t)??dg(t),sourceElement:e.canvas,bounds:i,context:cg(t),data:{renderer:"Three.js",objectType:t.type,...t.name?{objectName:t.name}:{},scenePath:cg(t),...n&&n!==t?{renderObjectName:n.name.trim()||n.type,renderObjectType:n.type,renderScenePath:cg(n)}:{},position:lg(t.position),rotation:lg(t.rotation),scale:lg(t.scale),visible:String(t.visible),...sg(t)?{material:sg(t)}:{},...Object.fromEntries(Object.entries(e.describe?.(t)??{}).filter(e=>"string"==typeof e[1]&&e[1].length>0))}}:null},s=t=>{let n=null,r=!1,i=t.endsWith("]");return e.scene.traverse(o=>{!e.key&&!i&&("string"!=typeof o.userData.popmeltId||o.userData.popmeltId.trim()!==t)||void 0!==u?.owner(o)||a(o)!==t||(n?r=!0:n=o)}),r?null:n},u=void 0===e.sampleCanvas?t?.createThreeSampling(e,s):void 0,c=e.sampleCanvas??u?.codec,d=e=>u?.placed.get(e)?.object??s(e);return{id:e.id?.trim()||"three",...c&&{sampleCanvas:{...c,element:e.canvas}},hitTest({x:n,y:o}){let a=e.canvas.getBoundingClientRect();if(n<a.left||n>a.right||o<a.top||o>a.bottom)return null;i.set((n-a.left)/a.width*2-1,-(o-a.top)/a.height*2+1),r.setFromCamera(i,e.camera);for(let n of r.intersectObject(e.scene,!0)){let r=e.textSurfaces?.find(e=>e.mesh===n.object);if(r&&t){let i=t.pickTextureText(r,n),o=i&&t.projectTextureText(r,i,e.camera,e.canvas);if(o)return o}let i=u?.owner(n.object),o=void 0!==i?u?.placed.get(i)?.object:e.select?e.select(n.object):fg(n.object);if(!o||!o.visible)continue;let a=l(o,n.object);if(a)return a}return null},...t&&{highlightHover(r,i){if(e.textSurfaces?.some(e=>e.fields.editable(r)))return;let a=d(r);if(!a)return;n?.();let l=t.highlightThreeGeometry(a,i,e,()=>o>0);return n=l,()=>{n===l&&(n=void 0,l())}}},getViewKey(){let t=e.camera;return t.updateWorldMatrix(!0,!1),JSON.stringify([t.type,...t.matrixWorld.elements,...t.projectionMatrix.elements].map(e=>"number"==typeof e?Number(e.toFixed(5)):e))},resolve(n){let r=e.textSurfaces?.find(e=>e.fields.editable(n));if(r&&t)return t.projectTextureText(r,n,e.camera,e.canvas);let i=d(n);return i?l(i):null},...e.captureFrame?{async captureSurfaces(){o++;try{let t=await(e.captureFrame?.());return t?[{element:e.canvas,dataUrl:t}]:[]}finally{o--,n&&e.invalidate?.()}}}:{}}}({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 tr([c]);return a=d,Wn.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),Wn.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),R=URL.createObjectURL(new Blob([e.bundle.script],{type:"text/javascript"})),I=!1;function L(){if(I)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(R).then(async n=>{if(I)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&&(I?r():j=r),!I){M(),e.check&&L();let n=async()=>{if(!I){if(e.mirror&&!i.firstElementChild)return void(T=setTimeout(()=>{n()},16));e.mirror&&await document.fonts.ready,!I&&(M(),t.postMessage({type:"ready"}))}};e.mirror?n():requestAnimationFrame(()=>{I||t.postMessage({type:"ready"})})}}).catch(e=>{I||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 _h(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 hm(p)}finally{Gh(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=>{I||t.postMessage({type:"capture",id:r.id,image:e})},()=>{I||t.postMessage({type:"capture",id:r.id,error:!0})}),"reference"===r.type&&(d(r.reference,r.theme),m()),"styles"===r.type&&(v=r.parts,M())};return t.addEventListener("message",z),()=>{I=!0,A?.(),clearTimeout(T),URL.revokeObjectURL(R),P.disconnect(),f.disconnect(),t.removeEventListener("message",z),"function"==typeof j&&j(),a.remove(),o.remove()}},[e,t,n]),(0,pg.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 mg(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 gg(e,t){let n=mg(e),r=mg(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}var yg=u(d());function vg(e,t){return e.computedStyleMap?.().get(t)?.toString()??("max-width"===t?getComputedStyle(e).maxWidth:function(e,t){if(At(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 xg(e,t){if(e){if(/^[\\d.]+px$/.test(e))return parseFloat(e);if(/^[\\d.]+%$/.test(e))return t*parseFloat(e)/100}}var bg=["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 wg(e){return e.trim().replace(/^([\'"])(.*)\\1$/,"$2").toLowerCase()}function Sg(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(wg(t[1]));return r}(e,n),o=[],a=new Set;for(let e of r.fonts){let n=wg(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(wg(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 kg=u(x());function Eg({target:e,children:t,onFitScale:n}){let r=(0,yg.useRef)(null);return(0,yg.useLayoutEffect)(()=>{let t=r.current,i=window.frameElement?.ownerDocument,o=i?.location.pathname===e.pathname?kn(e.selector,e.element,i):null,a=o&&function(e){let t=[];for(let n=e;n;n=bt(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=xg(vg(i,"width"),r),s=xg(vg(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?Sg(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=Xe[e],n=t.raisedSurface,r=l&&c&&gg(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 bg)"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,kg.jsx)("div",{ref:r,className:"sp-fit",children:t})}function Cg(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(`^${$o.explore}(?=\\\\s|$)`,"i");var Mg=u(x());function Tg(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),t]))}function jg({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,...Tg(e.style),...Tg(r?.[o])},l=o+"/label",s=!i&&"text"!==e.kind;return(0,Mg.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":Cg(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,Mg.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,Mg.jsx)(jg,{live:r,node:e,path:[...n,i],picker:t},i)):t&&s?(0,Mg.jsx)("button",{type:"button",className:"sp-label-hit","data-popmelt-label":Cg(e,"label"),"data-sp-fill":e.labelStyle?.["background-color"]?"":void 0,"data-sp-ink":e.labelStyle?.color?"":void 0,"data-scratch-text":"",style:Tg(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,Mg.jsx)("span",{"data-popmelt-label":Cg(e,"label"),"data-scratch-part":l,style:{display:"inline-block",...Tg(e.labelStyle),...Tg(r?.[l])},children:r?.[l]?.text??e.label}):r?.[o]?.text??e.label]})}var Ag=u(d()),Rg=u(x());function Ig({tag:e,framing:t}){let n=(0,Ag.useRef)(null);return(0,Rg.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=Vn(t.clientX,t.clientY,{within:i})?.closest("[data-scratch-part]");o&&e(o.getAttribute("data-scratch-part"),ah(o))}})}var Lg=u(x());function Pg({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,z.useRef)(e);t.current=e,(0,z.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<je?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,j.useSyncExternalStore)(I.subscribe,I.matches,L),y=c??g,[v,x]=function(e,t){let n=(0,Hf.useContext)(Bf),[r,i]=(0,Hf.useReducer)(tp,Wf),o=(0,Hf.useSyncExternalStore)(n?.subscribe??Vf,n?.getSnapshot??qf,n?.getSnapshot??qf)??r,a=n?.dispatch??i;(0,Hf.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()===Ae.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)(()=>{x({type:"SET_COLOR",payload:i}),x({type:"SET_TOOL",payload:"sticker"}),x({type:"SET_ANNOTATING",payload:!0})},[i,x]);let b=(0,M.useRef)([]);return(0,M.useLayoutEffect)(()=>()=>co(b.current),[]),(0,M.useLayoutEffect)(()=>{let e=v.styleModifications;ao(e);let t=[];for(let n of e){let e=oo(n)?.getAttribute("data-scratch-part");if(null!=e)for(let r of no(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);co(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=so(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){let n=e;if(!Yi(n)&&JSON.stringify(Xi(n).layout)!==JSON.stringify(t.paragraphs.before))continue;Gi(n,t.paragraphs.after);continue}let n=uo(e,t.textNodePath);n&&n.nodeValue===t.original&&n.nodeValue!==t.modified&&(n.nodeValue=t.modified)}}(t)})(b.current,v.textModifications),b.current=v.textModifications;for(let e of v.textModifications){let n=so(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),()=>{lo(e,!0)}},[v.styleModifications,v.textModifications,a,m]),(0,Lg.jsxs)(rh,{interactive:!0,framing:o,parentGestureSurface:window.frameElement?.closest(".sp-workspace"),overlay:n||y?(0,Lg.jsx)(Ig,{framing:o,tag:n?void 0:l}):(0,Lg.jsx)(Gp,{state:v,dispatch:x,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?ah(e):void 0)},onScreenshot:async()=>!1}),children:[(0,Lg.jsx)("div",{className:"sp-backdrop","aria-hidden":"true","data-popmelt-canvas-block":""}),t,r&&e&&(0,Lg.jsx)(Eg,{target:r,onFitScale:o.setFitScale,children:(0,Lg.jsx)(jg,{node:e,picker:{tag:l,selected:s,hovered:u}})})]})}var zg=(0,T.createRoot)(document.getElementById("root"));window.addEventListener("pagehide",e=>{e.persisted||zg.unmount()});var Ng=0;window.startScratchSteer=(e,t,n,r,i,o,a,l)=>{let s=++Ng;return u=>zg.render((0,Lg.jsx)(Pg,{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=th(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,pg.jsx)(hg,{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)=>zg.render(e?(0,Lg.jsx)(Pg,{...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};