@popmelt.com/core 0.40.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.
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/{ExploreAttachment-DBMYVYWK.mjs → ExploreAttachment-ZPC5AR5V.mjs} +1 -1
- package/dist/{PagePreviewLayer-CVUA6CTQ.mjs → PagePreviewLayer-C7WBS7IX.mjs} +1 -1
- package/dist/{ParticipantRuntime-PCBEG3Q2.mjs → ParticipantRuntime-CWE62D2G.mjs} +1 -1
- package/dist/{PhoneHostGate-FZLK4R6M.mjs → PhoneHostGate-NWJXZBBP.mjs} +1 -1
- package/dist/{PopmeltTasteConnectedPane-62LUNNWZ.mjs → PopmeltTasteConnectedPane-2BNDKMMB.mjs} +1 -1
- package/dist/SamplePlacementOverlay-ULOV22WR.mjs +1 -0
- package/dist/{ShareProjectPane-U47UTAOP.mjs → ShareProjectPane-KEE7EYMP.mjs} +1 -1
- package/dist/{SuppliedContext-F7WKJ5XO.mjs → SuppliedContext-IT25WBGQ.mjs} +1 -1
- package/dist/{ThreadErrorCard-KPP7YUFC.mjs → ThreadErrorCard-SUFOXXLG.mjs} +1 -1
- package/dist/ThreadPanel-NNJHQQSD.mjs +1 -0
- package/dist/bridge-entry.mjs +1 -1
- package/dist/browser-runtime-G6AEOA4X.mjs +1 -0
- package/dist/browser.mjs +1 -1
- package/dist/{checkFixture-VDRYDCUX.mjs → checkFixture-LBDNT3M5.mjs} +1 -1
- package/dist/{chunk-UPEEIAVJ.mjs → chunk-2FHGLE7G.mjs} +1 -1
- package/dist/chunk-32TDB3N4.mjs +1 -0
- package/dist/{chunk-RDB75FUD.mjs → chunk-44NLL6X3.mjs} +1 -1
- package/dist/{chunk-27WBFE5X.mjs → chunk-4MLXPN7W.mjs} +1 -1
- package/dist/{chunk-AKUIREET.mjs → chunk-6DU4ITXT.mjs} +1 -1
- package/dist/{chunk-6RMM7JB6.mjs → chunk-ADRWR5GI.mjs} +1 -1
- package/dist/{chunk-VQ76TWRR.mjs → chunk-AKEVJPGD.mjs} +1 -1
- package/dist/{chunk-P2LMCRUN.mjs → chunk-BD7DW4UK.mjs} +1 -1
- package/dist/{chunk-HC2SF7KE.mjs → chunk-CUVWMYUV.mjs} +1 -1
- package/dist/{chunk-FFBBRCPC.mjs → chunk-DBCCE7BA.mjs} +1 -1
- package/dist/{chunk-6GS4BQVU.mjs → chunk-DSTHM3V5.mjs} +3 -3
- package/dist/{chunk-T4WUQPBS.mjs → chunk-ECWY6Z6K.mjs} +1 -1
- package/dist/{chunk-Y2BJZLYU.mjs → chunk-EUFK7B6S.mjs} +1 -1
- package/dist/{chunk-RCY5N5KQ.mjs → chunk-HVDJYNQ6.mjs} +1 -1
- package/dist/{chunk-TVIKC33M.mjs → chunk-KF35YUNZ.mjs} +1 -1
- package/dist/{chunk-FSSHNWMO.mjs → chunk-KN4GC34I.mjs} +1 -1
- package/dist/{chunk-BDUWFDBP.mjs → chunk-KUILFVXZ.mjs} +1 -1
- package/dist/{chunk-CR6TRUUV.mjs → chunk-L3QE62SE.mjs} +1 -1
- package/dist/{chunk-TTOCYOEH.mjs → chunk-N37INB4D.mjs} +1 -1
- package/dist/{chunk-HTQEMKFA.mjs → chunk-NFPUOL4J.mjs} +1 -1
- package/dist/{chunk-V5FCWXMN.mjs → chunk-Q5MIJ5F2.mjs} +1 -1
- package/dist/{chunk-7DXJSJCI.mjs → chunk-RAABZFBD.mjs} +1 -1
- package/dist/{chunk-PQITT2QK.mjs → chunk-REPKQAJK.mjs} +1 -1
- package/dist/{chunk-3EYAVOPH.mjs → chunk-TVS2ZIAW.mjs} +1 -1
- package/dist/{chunk-6U5JWZ4X.mjs → chunk-V7AOJQXQ.mjs} +1 -1
- package/dist/{chunk-NFO2CREV.mjs → chunk-VLTK7KWK.mjs} +1 -1
- package/dist/{chunk-52OTX7DP.mjs → chunk-WKQGWQ3P.mjs} +1 -1
- package/dist/{chunk-ZC2I35WD.mjs → chunk-WPU4472Z.mjs} +1 -1
- package/dist/{chunk-DJFZGYX6.mjs → chunk-XVQAHYF2.mjs} +1 -1
- package/dist/{chunk-3LZQLRZ2.mjs → chunk-YTIDSDPP.mjs} +1 -1
- package/dist/{chunk-UBPJIVWE.mjs → chunk-ZQMKLODZ.mjs} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{codex-note-context-2CHDGTG3.mjs → codex-note-context-GXC2474A.mjs} +1 -1
- package/dist/{codex-project-TIMWOCE5.mjs → codex-project-HVK7FSWQ.mjs} +1 -1
- package/dist/{codex-store-mount-MAQK6VEG.mjs → codex-store-mount-KHTSSESB.mjs} +1 -1
- package/dist/dev-server-QMA23NJQ.mjs +1 -0
- package/dist/{focus-inspection-BMDJJC5K.mjs → focus-inspection-FVQ6TVGA.mjs} +1 -1
- package/dist/guest-admission.mjs +1 -1
- package/dist/guest-live-canvas.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{peer-client-LPDWWFT4.mjs → peer-client-JL754ZR7.mjs} +1 -1
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/infra/phone-pairing/README.md +25 -0
- package/package.json +37 -27
- package/dist/SamplePlacementOverlay-LR7GZVYP.mjs +0 -1
- package/dist/ThreadPanel-GOYQEF3I.mjs +0 -1
- package/dist/browser-runtime-BBQQQLF7.mjs +0 -1
- package/dist/chunk-U5NROUVA.mjs +0 -24
- package/dist/dev-server-ESGE6QNP.mjs +0 -1
- /package/dist/{chunk-ERPJ6LXX.mjs → chunk-6RC7JZ73.mjs} +0 -0
- /package/dist/{chunk-C4AMAM3W.mjs → chunk-QYNW5LE2.mjs} +0 -0
- /package/dist/{toolbarFonts-JAGSN3DN.mjs → toolbarFonts-33BI56VQ.mjs} +0 -0
- /package/dist/{webpEncoder-QJRHTWUU.mjs → webpEncoder-JVMGDKHV.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{e as t}from"./chunk-
|
|
1
|
+
"use client";import{e as t}from"./chunk-Q5MIJ5F2.mjs";import{useState as e,useLayoutEffect as o}from"react";import{createPortal as n}from"react-dom";import{jsxs as i,Fragment as a,jsx as r}from"react/jsx-runtime";function l({children:l}){let[p,s]=e(null);return o(()=>{let e=document.createElement("div");e.setAttribute("data-popmelt-top-layer-host",""),e.setAttribute("data-devtools","overlay-host");let o=e.attachShadow({mode:"open"}),n=document.createElement("div");n.setAttribute("data-devtools","scroll-origin"),n.setAttribute("aria-hidden","true"),n.style.cssText="all: initial !important; position: absolute !important; left: 0 !important; top: 0 !important; width: 0 !important; height: 0 !important; pointer-events: none !important; anchor-name: --popmelt-page-origin !important",document.documentElement.append(n,e);let i=document.createElement("style");return i.textContent=t,document.head.appendChild(i),s(o),()=>{n.remove(),i.remove(),e.remove()}},[]),p?n(i(a,{children:[r("style",{children:'\n:host {\n /* The host itself still matches document selectors. Protect its paint and\n geometry as well as the controls inside its shadow tree. */\n all: initial !important;\n display: block !important;\n position: absolute !important;\n inset: 0 !important;\n width: 100dvw !important;\n height: 100dvh !important;\n pointer-events: none !important;\n z-index: 2147483647 !important;\n direction: ltr !important;\n font: 16px / normal system-ui, sans-serif !important;\n /* all leaves custom properties inherited. Portal tooltips use these fallbacks\n when no Popmelt theme is active. */\n --popmelt-thread-action: initial !important;\n --popmelt-thread-on-action: initial !important;\n --popmelt-thread-raised: initial !important;\n --popmelt-thread-primary: initial !important;\n --popmelt-selection-background: #626262 !important;\n --popmelt-selection-color: #fff !important;\n}\n/* Chrome mounts keep their viewport containing block while page-space editors\n scroll on the same compositor layer as their target. */\n:host > [data-popmelt-shadow-host] { position: fixed !important; top: 0; left: 0; }\n:host([data-popmelt-capture-hidden]) { opacity: 0 !important; }\n:host::before, :host::after { content: none !important; }\n:host * {\n -webkit-user-select: none;\n user-select: none;\n}\n:host [data-popmelt-theme="light"] {\n --popmelt-selection-background: #a3a3a3;\n --popmelt-selection-color: #171717;\n}\n:host ::selection {\n background: var(--popmelt-selection-background);\n color: var(--popmelt-selection-color);\n}\n:host :is(input, textarea, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [data-devtools="thread-panel"]),\n:host :is([contenteditable]:not([contenteditable="false"]), [role="textbox"], [data-devtools="thread-panel"]) * {\n -webkit-user-select: text;\n user-select: text;\n}\n'}),l]}),p):null}export{l as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"./chunk-
|
|
1
|
+
import{c as t}from"./chunk-L3QE62SE.mjs";import{f as r}from"./chunk-4MLXPN7W.mjs";import{r as e}from"./chunk-DSTHM3V5.mjs";import{f as a}from"./chunk-6EO73WJN.mjs";async function o(o,s){let i=await a(o);if(!i||!s)return[];let n=await e(o,s);return n.length?(await Promise.all([i,...i.mountedStores].map(async e=>{try{let a=await t(e,o);if(!a)return[];let{endpoint:s,request:i}=a,m=[];for(let t of n){let a=await r(s,"/participants/read-canvas-receipt",{...i,method:"POST",body:JSON.stringify({receiptId:t})});a.response.ok&&m.push({storeId:e.storeId,receipt:a.body})}return m}catch{return[]}}))).flat():[]}export{o as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{d as e}from"./chunk-5TCWBNV4.mjs";import{E as t,D as n,F as i,H as a,G as r}from"./chunk-VQ76TWRR.mjs";import{a as o}from"./chunk-UPEEIAVJ.mjs";import{b as s,a as d}from"./chunk-TTOCYOEH.mjs";import{a as l}from"./chunk-FR6VIGJ2.mjs";import{n as m,o as c}from"./chunk-EILBHZDX.mjs";import{a as p}from"./chunk-7D4BUDKG.mjs";import{a as u}from"./chunk-B4DYUYX4.mjs";import{w as h,I as y,Pa as f,Q as g,xa as b}from"./chunk-OA63PYHZ.mjs";import{c as v,a as w}from"./chunk-6RMM7JB6.mjs";import{useRef as k,useState as j,useLayoutEffect as x,useId as S,useEffect as I}from"react";import{jsxs as C,jsx as T,Fragment as A}from"react/jsx-runtime";function z(){let e=crypto.getRandomValues(new Uint8Array(32));return{id:crypto.randomUUID(),token:Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}}var R=360,J=120;function E({client:E,storage:N,storageKey:O,onAdmitted:W,theme:q="light",themePreference:F=q,onThemePreferenceChange:B,onJoin:H,guestInvite:L,showHostLinkHelp:P=!1}){let D=k(null),U=k(!1);if(!U.current){U.current=!0;try{O&&(D.current=JSON.parse(N.getItem(O)??"null"))}catch{}}let[$,K]=j(D.current?.name??""),M=k(!1),X=!!L;x(()=>{if(X&&O&&!M.current)try{let e=JSON.parse(N.getItem(O)??"null");"string"==typeof e?.name&&K(e.name)}catch{}},[X,N,O]);let V=!(!H&&!L),[Y,G]=j(V?void 0:D.current?.receipt),[Z,Q]=j(null),[_,ee]=j(),te=L?.color??_,[ne,ie]=j(),ae=L?.shape??ne,re=k(null),[oe,se]=j(V),[de,le]=j(!1),[me,ce]=j(0),[pe,ue]=j(),[he,ye]=j("idle"),[fe,ge]=j(),be=k(!1),[ve,we]=j(""),ke=k(null),je=k(null),xe=k(!1),Se=k(0),Ie=k(!1),Ce=S(),Te=k(!1),Ae=k(0),ze=k(W);ze.current=W;let Re=k(!1),Je=k(null),Ee=k(()=>{});Je.current||(Je.current=new Promise(e=>{Ee.current=e}));let Ne=p[q],Oe=!X&&oe&&!te;I(()=>{let e,t,n=!1,i=()=>{n||(n=!0,Re.current=!0,Ee.current())};"function"==typeof requestAnimationFrame&&(e=requestAnimationFrame(()=>{t=requestAnimationFrame(i)}));let a=window.setTimeout(i,64);return()=>{void 0!==e&&cancelAnimationFrame(e),void 0!==t&&cancelAnimationFrame(t),window.clearTimeout(a),i()}},[]),I(()=>v(document),[]),x(()=>{let e=!0,t=()=>{if(!e||!je.current)return;let t=getComputedStyle(je.current),n=document.createElement("span");Object.assign(n.style,{position:"fixed",visibility:"hidden",pointerEvents:"none",whiteSpace:"nowrap",fontFamily:t.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight}),document.body.append(n);let i=Number.parseFloat(t.paddingLeft)+Number.parseFloat(t.paddingRight);n.textContent="Ask for access";let a=i+12+3+n.getBoundingClientRect().width;n.textContent="Request pending";let r=i+12+3+n.getBoundingClientRect().width;n.textContent="Request declined";let o=i+12+3+n.getBoundingClientRect().width;n.remove(),a>15&&r>15&&o>15&&ge({ask:Math.ceil(a),pending:Math.ceil(r),declined:Math.ceil(o)})};return t(),document.fonts?.ready.then(t),()=>{e=!1}},[q,oe]),I(()=>{if(!me)return;let e=setTimeout(()=>ce(0),R);return()=>clearTimeout(e)},[me]),I(()=>{if(!pe)return;let e=setTimeout(()=>ue(void 0),R);return()=>clearTimeout(e)},[pe]),I(()=>{if("in"!==he)return;let e=setTimeout(()=>ye("idle"),180);return()=>clearTimeout(e)},[he]),I(()=>{if(O){D.current&&delete D.current.color;try{let e=JSON.parse(N.getItem(O)??"null");e&&"object"==typeof e&&"color"in e&&(delete e.color,N.setItem(O,JSON.stringify(e)))}catch{}}},[N,O]);let We=!(!Y||Z&&"pending"!==Z.status&&"granted"!==Z.status),qe=(e,t)=>{D.current={...D.current,name:e,receipt:t},O&&N.setItem(O,JSON.stringify(D.current))};I(()=>{if("cancelled"===Z?.status){D.current={...D.current,name:$,receipt:void 0};try{N.setItem(O,JSON.stringify(D.current))}catch{}G(void 0),Q(null)}},[Z,$,N,O]);let Fe=()=>{if(re.current)return re.current;return re.current=(async()=>{if(!E)throw new Error("Local admission client unavailable");let e,t=JSON.parse(N.getItem(O)??"null"),n=t?.colorIdentity??t?.receipt??z();D.current={name:$,receipt:t?.receipt,colorIdentity:n},N.setItem(O,JSON.stringify(D.current));try{e=await E.reserveAdmissionColor(n)}catch(t){let i=t.status;if(400!==i&&401!==i)throw t;n=z(),D.current={...D.current,colorIdentity:n},N.setItem(O,JSON.stringify(D.current)),e=await E.reserveAdmissionColor(n)}return ee(e.color),ie(c(e)),n})().finally(()=>{re.current=null}),re.current},Be=k(Fe);Be.current=Fe,I(()=>{if(!E||!oe||te)return;let t,n=!1,i=0,a=async()=>{try{await Be.current()}catch{if(n)return;t=setTimeout(()=>{a()},e(++i))}};return a(),()=>{n=!0,clearTimeout(t)}},[E,oe,te,N,O]),I(()=>{if(!oe)return;let e=e=>{e.composedPath().includes(ke.current)||se(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[oe]),I(()=>{if(!E||!Y)return;let t,n,i=!0,a=!1,r=!1,o=()=>{Ae.current+=1,D.current={...D.current,name:$,receipt:void 0};try{N.setItem(O,JSON.stringify(D.current))}catch{}G(void 0),Q(null),se(!1),we("")},s=()=>{r=!0;let t=z(),a=0,o=async()=>{if(i)try{let e=await Be.current();D.current={...D.current,name:$,receipt:t,colorIdentity:e},N.setItem(O,JSON.stringify(D.current));let n=await E.requestAdmission(t,$,e);if(!i)return;Ae.current+=1,G(t),Q(n),we("")}catch{if(!i)return;n=setTimeout(()=>{o()},e(++a))}};o()},d=async()=>{if(a||r||Ie.current||Te.current)return;a=!0;let e=Ae.current;try{let n=await E.admissionStatus(Y);if(!i||e!==Ae.current)return;if("declined"===n.status){if(Re.current||await Je.current,!i||e!==Ae.current)return;r=!0;let n=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,a=()=>{i&&(ye("rejected"),ce(e=>e+1),t=setTimeout(()=>{if(i){if(n)return o(),void ye("idle");ye("rejected-out"),t=setTimeout(()=>{i&&(o(),ye("in"))},J)}},R))};return void(n?a():(ye("pending-out"),t=setTimeout(a,J)))}if("expired"===n.status)return void s();if(Q(n),r="cancelled"===n.status,we(""),n.credential){Ie.current=!0;try{await(ze.current?.(n.credential)),r=!0}finally{Ie.current=!1}}}catch(t){if(!i||e!==Ae.current)return;401===t.status&&s()}finally{a=!1}};d();let l=setInterval(d,1500);return()=>{i=!1,clearInterval(l),clearTimeout(t),clearTimeout(n)}},[E,Y,$,N,O]);return C("div",{ref:ke,"data-devtools":"participant-admission","data-popmelt-font":"sans","data-popmelt-theme":q,style:{display:"contents"},onKeyDown:e=>{"Escape"===e.key&&(se(!1),e.stopPropagation())},children:[T("style",{children:`\n ${t}\n [data-popmelt-entry-dock$="-left"] [data-popmelt-admission-ask] {\n margin-right: 6px;\n }\n [data-popmelt-admission-ask] {\n transition: box-shadow 120ms ease, width 180ms ease;\n }\n [data-popmelt-admission-ask][data-popmelt-admission-rejection="odd"] {\n animation: popmelt-admission-rejection-odd 360ms ease-out;\n }\n [data-popmelt-admission-ask][data-popmelt-admission-rejection="even"] {\n animation: popmelt-admission-rejection-even 360ms ease-out;\n }\n [data-popmelt-admission-submit-rejection="odd"] {\n animation: popmelt-admission-rejection-odd 360ms ease-out;\n }\n [data-popmelt-admission-submit-rejection="even"] {\n animation: popmelt-admission-rejection-even 360ms ease-out;\n }\n @keyframes popmelt-admission-rejection-odd {\n 0%, 100% { transform: translateX(0); }\n 38% { transform: translateX(-3px); }\n }\n @keyframes popmelt-admission-rejection-even {\n 0%, 100% { transform: translateX(0); }\n 38% { transform: translateX(-3px); }\n }\n [data-popmelt-admission-sending-dot] {\n animation-duration: 1.2s;\n animation-iteration-count: infinite;\n animation-timing-function: step-end;\n }\n [data-popmelt-admission-sending-dot="1"] {\n animation-name: popmelt-admission-sending-dot-1;\n }\n [data-popmelt-admission-sending-dot="2"] {\n animation-name: popmelt-admission-sending-dot-2;\n }\n [data-popmelt-admission-sending-dot="3"] {\n animation-name: popmelt-admission-sending-dot-3;\n }\n @keyframes popmelt-admission-sending-dot-1 {\n 0%, 24.99% { opacity: 0; }\n 25%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-sending-dot-2 {\n 0%, 49.99% { opacity: 0; }\n 50%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-sending-dot-3 {\n 0%, 74.99% { opacity: 0; }\n 75%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-send-icon-out {\n 0%, 30% {\n opacity: 1;\n transform: translate(0, -50%);\n }\n 100% {\n opacity: 0;\n transform: translate(10px, -50%);\n }\n }\n [data-devtools="participant-admission"][data-popmelt-theme="${q}"] [data-popmelt-admission-ask]:is([aria-expanded="false"], [data-popmelt-admission-pending]):is(:hover, :focus-visible) {\n box-shadow: inset 0 0 0 100px ${Ne.softHairline};\n }\n [data-popmelt-admission-pending-label],\n [data-popmelt-admission-cancel-label],\n [data-popmelt-admission-declined-label] {\n grid-area: 1 / 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 3px;\n }\n [data-popmelt-admission-cancel-label] { visibility: hidden; }\n [data-popmelt-admission-ask]:is(:hover, :focus-visible, [aria-busy="true"]) [data-popmelt-admission-pending-label] { visibility: hidden; }\n [data-popmelt-admission-ask]:is(:hover, :focus-visible, [aria-busy="true"]) [data-popmelt-admission-cancel-label] { visibility: visible; }\n [data-devtools="participant-admission"][data-popmelt-theme="${q}"] input::placeholder {\n color: ${Ne.secondary};\n opacity: 1;\n }\n [data-devtools="participant-admission"] button[type="submit"] {\n -webkit-user-select: none;\n user-select: none;\n -webkit-touch-callout: none;\n }\n [data-devtools="participant-admission"] button[type="submit"] > * { pointer-events: none; }\n @media (pointer: coarse) {\n [data-devtools="participant-admission"] button[type="submit"] { min-width: 44px; min-height: 44px; touch-action: manipulation; }\n [data-popmelt-admission-name-field] { font-size: 16px; }\n }\n @media (prefers-reduced-motion: reduce) {\n [data-popmelt-admission-ask] { transition: none; animation: none; }\n [data-popmelt-admission-submit-rejection] { animation: none; }\n [data-popmelt-admission-sending-dot] { animation: none; opacity: 1; }\n [data-popmelt-admission-send-icon],\n [data-popmelt-admission-sending-label] { animation: none !important; }\n }\n `}),T(n,{theme:q,themePreference:F,onThemePreferenceChange:B,deemphasizeControls:oe,onCollapse:()=>se(!1),panel:oe||ve?C(A,{children:[oe&&!We&&C("form",{"aria-label":V?"Join session":"Ask for access","data-popmelt-font":"sans","aria-busy":de||void 0,style:{...r(q),flexWrap:"wrap",...X&&{maxWidth:"min(320px, calc(100vw - 24px))",boxSizing:"border-box",padding:12,gap:8,borderRadius:16}},onSubmit:e=>{e.preventDefault();let t=xe.current?"enter":"send";xe.current=!1,(async e=>{if(!$.trim()||Oe||de||We||be.current)return;if(be.current=!0,le(!0),we(""),ue(void 0),L||H){try{if(qe($.trim()),L)return void await L.join($.trim());H&&await H($.trim(),await Fe())}catch(e){we(e instanceof Error?e.message:"Could not join. Please try again.")}return be.current=!1,void le(!1)}try{D.current=JSON.parse(N.getItem(O)??"null")}catch{}let t=!Z&&D.current?.receipt?D.current.receipt:z();try{let e=await Fe();qe($,t),D.current={...D.current,name:$,receipt:t};let n=await E.requestAdmission(t,$.trim(),e);G(t),K(n.name),Q(n),se(!1)}catch{D.current={...D.current,name:$,receipt:t},ue({target:e,pulse:++Se.current})}finally{be.current=!1,le(!1)}})(t)},children:[L?.projectName&&C("span",{style:{flexBasis:"100%",minWidth:0,overflowWrap:"anywhere"},children:["Join ",L.projectName]}),C("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[T(o,{"data-popmelt-entry-avatar":!0,shape:ae&&"circle"!==ae?ae:m(0),color:te??(Oe?Ne.muted:"transparent"),size:l.identitySize}),C("span",{"data-popmelt-admission-name-field":!0,style:{...X&&{fontSize:16},display:"inline-grid",flex:"0 1 auto",minWidth:0},children:[T("span",{"aria-hidden":"true","data-popmelt-admission-name-measure":!0,style:{gridArea:"1 / 1",visibility:"hidden",whiteSpace:"pre",overflow:"hidden",paddingRight:1},children:$||"what’s your name?"}),T("input",{autoFocus:!0,"aria-label":"Your name",placeholder:"what’s your name?",autoComplete:"nickname",enterKeyHint:V?"go":"send",maxLength:48,value:$,disabled:de,onKeyDown:e=>{"Enter"===e.key&&(xe.current=!0)},onKeyUp:e=>{"Enter"===e.key&&(xe.current=!1)},onBlur:()=>{xe.current=!1},onChange:e=>{M.current=!0,K(e.target.value);try{qe(e.target.value,D.current?.receipt)}catch{}},style:{gridArea:"1 / 1",minWidth:"100%",width:0,padding:0,border:0,borderRadius:0,background:"transparent",color:de?Ne.mutedStrong:Ne.primary,WebkitTextFillColor:de?Ne.mutedStrong:Ne.primary,caretColor:de?"transparent":Ne.primary,opacity:1,transition:"color 120ms ease",font:"inherit",fontFamily:w,outline:"none",boxShadow:"none",appearance:"none"}})]}),$.trim().length>0&&T("kbd",{"aria-hidden":"true","data-popmelt-admission-enter-hint":!0,"data-popmelt-admission-submit-rejection":"enter"===pe?.target?pe.pulse%2?"odd":"even":void 0,style:{...i(q),...d,flexShrink:0,color:Ne.primary,opacity:de?0:1,pointerEvents:de?"none":void 0,transition:"opacity 120ms ease"},children:"enter"})]}),C("button",{type:"submit",disabled:de||Oe||!$.trim(),"aria-label":de?"Sending…":V?"Join session":"Send request",onPointerDown:e=>{"mouse"===e.pointerType&&0===e.button&&e.preventDefault()},"aria-keyshortcuts":"Enter","aria-busy":de||void 0,"data-popmelt-admission-submit-rejection":"send"===pe?.target?pe.pulse%2?"odd":"even":void 0,style:{...a(q),...X&&{minWidth:44,minHeight:44,borderRadius:10},position:"relative",boxSizing:"border-box",overflow:"hidden",fontSize:12,color:de||!$.trim()?Ne.muted:Ne.primary,transition:"color 120ms ease"},children:[T("span",{"aria-hidden":"true","data-popmelt-admission-submit-sizer":!0,style:{display:de?"none":"block",width:14,height:14}}),C("span",{"aria-hidden":"true","data-popmelt-admission-submit-content":!0,style:{position:de?"static":"absolute",inset:0,pointerEvents:"none"},children:[T(b,{size:14,"data-popmelt-admission-send-icon":!0,style:{position:"absolute",top:"50%",left:"50%",marginLeft:-7,opacity:de?0:1,transform:de?"translate(10px, -50%)":"translate(0, -50%)",animation:de?"popmelt-admission-send-icon-out 260ms ease both":void 0}}),C("span",{"data-popmelt-admission-sending-label":!0,style:{display:de?"inline-block":"none",opacity:de?1:0},children:["Sending",C("span",{"data-popmelt-admission-sending-dots":!0,"aria-hidden":"true",style:{display:"inline-block"},children:[T("span",{"data-popmelt-admission-sending-dot":"1",children:"."}),T("span",{"data-popmelt-admission-sending-dot":"2",children:"."}),T("span",{"data-popmelt-admission-sending-dot":"3",children:"."})]})]})]})]}),P&&!V&&C("details",{style:{flexBasis:"100%",fontSize:12,color:Ne.secondary},children:[T("summary",{style:{cursor:"pointer"},children:"Using your own project?"}),C("p",{style:{margin:"6px 0 0",overflowWrap:"anywhere"},children:["Open the URL from your project’s"," ",T("code",{children:".popmelt/participant-host-link.json"})," in this browser to link it as a host."]})]}),ve&&T("span",{role:"alert",style:{flexBasis:"100%",fontSize:12},children:ve})]}),!oe&&ve&&T("div",{role:"status",style:{...r(q),fontSize:12},children:ve})]}):null,action:C(A,{children:[T("span",{"aria-hidden":"true","data-popmelt-admission-host":!0,style:{width:22,height:22,marginLeft:5,flexShrink:0,boxSizing:"border-box",border:`1px solid ${Ne.surface}`,borderRadius:"50%",background:u.activeColor,opacity:oe||We?.2:1,transition:Re.current?"opacity 120ms ease":"none"}}),T("button",{ref:je,type:"button","data-popmelt-font":"sans","data-popmelt-admission-ask":!0,"data-popmelt-admission-pending":We?"":void 0,"data-popmelt-admission-declined":"rejected"===he||"rejected-out"===he?"":void 0,"data-popmelt-admission-rejection":me?me%2?"odd":"even":void 0,"data-popmelt-admission-transition":"idle"===he?void 0:he,"data-popmelt-entry-control":!0,"aria-expanded":We?void 0:oe,"aria-label":"rejected"===he||"rejected-out"===he?"Request declined":We?"Cancel request":void 0,"aria-describedby":We?Ce:void 0,"aria-busy":!(!We||!de)||void 0,disabled:We&&(de||"idle"!==he),onClick:()=>"idle"===he&&(We?void(async()=>{if(E&&Y&&!de&&!Te.current){Te.current=!0,Ae.current+=1,le(!0),we("");try{let e=await E.cancelAdmission(Y);Q(e),se(!1)}catch{ce(e=>e+1)}finally{Te.current=!1,le(!1)}}})():(se(!oe),void(oe||we("")))),"aria-description":We?void 0:V?"Enter your name to join the session.":"Ask the host to join in Suggest mode.",style:{...s(q),width:fe?fe["rejected"===he||"rejected-out"===he?"declined":We?"pending":"ask"]:void 0,paddingLeft:3,overflow:"hidden",transition:"box-shadow 120ms ease, width 180ms ease",background:We&&Z?.color?`color-mix(in srgb, ${Z.color} 10%, ${Ne.control})`:Ne.control},children:C("span",{"data-popmelt-entry-content":!0,style:{display:We?"inline-grid":"inline-flex",alignItems:"center",gap:"inherit",opacity:"pending-out"===he||"rejected-out"===he?0:1,transition:Re.current?"opacity 120ms ease":"none"},children:["rejected"===he||"rejected-out"===he?C("span",{id:Ce,"data-popmelt-admission-declined-label":!0,"aria-hidden":"true",children:[T(h,{size:12}),"Request declined"]}):We?C(A,{children:[C("span",{id:Ce,"data-popmelt-admission-pending-label":!0,"aria-hidden":"true",children:[T(y,{size:12,style:{color:Z?.color}}),"Request pending"]}),C("span",{"data-popmelt-admission-cancel-label":!0,"aria-hidden":"true",children:[T(f,{size:12}),"Cancel request"]})]}):T(g,{size:12,"aria-hidden":"true","data-popmelt-admission-wave":!0}),!We&&"Ask for access"]})})]})})]})}export{E as a};
|
|
1
|
+
"use client";import{d as e}from"./chunk-5TCWBNV4.mjs";import{E as t,D as n,F as i,H as a,G as r}from"./chunk-AKEVJPGD.mjs";import{a as o}from"./chunk-2FHGLE7G.mjs";import{b as s,a as d}from"./chunk-N37INB4D.mjs";import{a as l}from"./chunk-FR6VIGJ2.mjs";import{n as m,o as c}from"./chunk-EILBHZDX.mjs";import{a as p}from"./chunk-7D4BUDKG.mjs";import{a as u}from"./chunk-B4DYUYX4.mjs";import{w as h,I as y,Pa as f,Q as g,xa as b}from"./chunk-OA63PYHZ.mjs";import{c as v,a as w}from"./chunk-ADRWR5GI.mjs";import{useRef as k,useState as j,useLayoutEffect as x,useId as S,useEffect as I}from"react";import{jsxs as C,jsx as A,Fragment as T}from"react/jsx-runtime";function z(){let e=crypto.getRandomValues(new Uint8Array(32));return{id:crypto.randomUUID(),token:Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}}var N=360,R=120;function J({client:J,storage:E,storageKey:O,onAdmitted:F,theme:W="light",themePreference:q=W,onThemePreferenceChange:D,onJoin:B,guestInvite:L,showHostLinkHelp:H=!1}){let P=k(null),$=k(!1);if(!$.current){$.current=!0;try{O&&(P.current=JSON.parse(E.getItem(O)??"null"))}catch{}}let[U,K]=j(P.current?.name??""),G=k(!1),X=!!L;x(()=>{if(X&&O&&!G.current)try{let e=JSON.parse(E.getItem(O)??"null");"string"==typeof e?.name&&K(e.name)}catch{}},[X,E,O]);let M=!(!B&&!L),[V,Y]=j(M?void 0:P.current?.receipt),[Z,Q]=j(null),[_,ee]=j(),te=L?.color??_,[ne,ie]=j(),ae=L?.shape??ne,re=k(null),[oe,se]=j(M),[de,le]=j(!1),[me,ce]=j(0),[pe,ue]=j(),[he,ye]=j("idle"),[fe,ge]=j(),be=k(!1),[ve,we]=j(""),ke=k(null),je=k(null),xe=k(!1),Se=k(0),Ie=k(!1),Ce=S(),Ae=k(!1),Te=k(0),ze=k(F);ze.current=F;let Ne=k(!1),Re=k(null),Je=k(()=>{});Re.current||(Re.current=new Promise(e=>{Je.current=e}));let Ee=p[W],Oe=!X&&oe&&!te;I(()=>{let e,t,n=!1,i=()=>{n||(n=!0,Ne.current=!0,Je.current())};"function"==typeof requestAnimationFrame&&(e=requestAnimationFrame(()=>{t=requestAnimationFrame(i)}));let a=window.setTimeout(i,64);return()=>{void 0!==e&&cancelAnimationFrame(e),void 0!==t&&cancelAnimationFrame(t),window.clearTimeout(a),i()}},[]),I(()=>v(document),[]),x(()=>{let e=!0,t=()=>{if(!e||!je.current)return;let t=getComputedStyle(je.current),n=document.createElement("span");Object.assign(n.style,{position:"fixed",visibility:"hidden",pointerEvents:"none",whiteSpace:"nowrap",fontFamily:t.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight}),document.body.append(n);let i=Number.parseFloat(t.paddingLeft)+Number.parseFloat(t.paddingRight);n.textContent="Ask for access";let a=i+12+3+n.getBoundingClientRect().width;n.textContent="Request pending";let r=i+12+3+n.getBoundingClientRect().width;n.textContent="Request declined";let o=i+12+3+n.getBoundingClientRect().width;n.remove(),a>15&&r>15&&o>15&&ge({ask:Math.ceil(a),pending:Math.ceil(r),declined:Math.ceil(o)})};return t(),document.fonts?.ready.then(t),()=>{e=!1}},[W,oe]),I(()=>{if(!me)return;let e=setTimeout(()=>ce(0),N);return()=>clearTimeout(e)},[me]),I(()=>{if(!pe)return;let e=setTimeout(()=>ue(void 0),N);return()=>clearTimeout(e)},[pe]),I(()=>{if("in"!==he)return;let e=setTimeout(()=>ye("idle"),180);return()=>clearTimeout(e)},[he]),I(()=>{if(O){P.current&&delete P.current.color;try{let e=JSON.parse(E.getItem(O)??"null");e&&"object"==typeof e&&"color"in e&&(delete e.color,E.setItem(O,JSON.stringify(e)))}catch{}}},[E,O]);let Fe=!(!V||Z&&"pending"!==Z.status&&"granted"!==Z.status),We=(e,t)=>{P.current={...P.current,name:e,receipt:t},O&&E.setItem(O,JSON.stringify(P.current))};I(()=>{if("cancelled"===Z?.status){P.current={...P.current,name:U,receipt:void 0};try{E.setItem(O,JSON.stringify(P.current))}catch{}Y(void 0),Q(null)}},[Z,U,E,O]);let qe=()=>{if(re.current)return re.current;return re.current=(async()=>{if(!J)throw new Error("Local admission client unavailable");let e,t=JSON.parse(E.getItem(O)??"null"),n=t?.colorIdentity??t?.receipt??z();P.current={name:U,receipt:t?.receipt,colorIdentity:n},E.setItem(O,JSON.stringify(P.current));try{e=await J.reserveAdmissionColor(n)}catch(t){let i=t.status;if(400!==i&&401!==i)throw t;n=z(),P.current={...P.current,colorIdentity:n},E.setItem(O,JSON.stringify(P.current)),e=await J.reserveAdmissionColor(n)}return ee(e.color),ie(c(e)),n})().finally(()=>{re.current=null}),re.current},De=k(qe);De.current=qe,I(()=>{if(!J||!oe||te)return;let t,n=!1,i=0,a=async()=>{try{await De.current()}catch{if(n)return;t=setTimeout(()=>{a()},e(++i))}};return a(),()=>{n=!0,clearTimeout(t)}},[J,oe,te,E,O]),I(()=>{if(!oe)return;let e=e=>{e.composedPath().includes(ke.current)||se(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[oe]),I(()=>{if(!J||!V)return;let t,n,i=!0,a=!1,r=!1,o=()=>{Te.current+=1,P.current={...P.current,name:U,receipt:void 0};try{E.setItem(O,JSON.stringify(P.current))}catch{}Y(void 0),Q(null),se(!1),we("")},s=()=>{r=!0;let t=z(),a=0,o=async()=>{if(i)try{let e=await De.current();P.current={...P.current,name:U,receipt:t,colorIdentity:e},E.setItem(O,JSON.stringify(P.current));let n=await J.requestAdmission(t,U,e);if(!i)return;Te.current+=1,Y(t),Q(n),we("")}catch{if(!i)return;n=setTimeout(()=>{o()},e(++a))}};o()},d=async()=>{if(a||r||Ie.current||Ae.current)return;a=!0;let e=Te.current;try{let n=await J.admissionStatus(V);if(!i||e!==Te.current)return;if("declined"===n.status){if(Ne.current||await Re.current,!i||e!==Te.current)return;r=!0;let n=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,a=()=>{i&&(ye("rejected"),ce(e=>e+1),t=setTimeout(()=>{if(i){if(n)return o(),void ye("idle");ye("rejected-out"),t=setTimeout(()=>{i&&(o(),ye("in"))},R)}},N))};return void(n?a():(ye("pending-out"),t=setTimeout(a,R)))}if("expired"===n.status)return void s();if(Q(n),r="cancelled"===n.status,we(""),n.credential){Ie.current=!0;try{await(ze.current?.(n.credential)),r=!0}finally{Ie.current=!1}}}catch(t){if(!i||e!==Te.current)return;401===t.status&&s()}finally{a=!1}};d();let l=setInterval(d,1500);return()=>{i=!1,clearInterval(l),clearTimeout(t),clearTimeout(n)}},[J,V,U,E,O]);return C("div",{ref:ke,"data-devtools":"participant-admission","data-popmelt-font":"sans","data-popmelt-theme":W,style:{display:"contents"},onKeyDown:e=>{"Escape"===e.key&&(se(!1),e.stopPropagation())},children:[A("style",{children:`\n ${t}\n [data-popmelt-entry-dock$="-left"] [data-popmelt-admission-ask] {\n margin-right: 6px;\n }\n [data-popmelt-admission-ask] {\n transition: box-shadow 120ms ease, width 180ms ease;\n }\n [data-popmelt-admission-ask][data-popmelt-admission-rejection="odd"] {\n animation: popmelt-admission-rejection-odd 360ms ease-out;\n }\n [data-popmelt-admission-ask][data-popmelt-admission-rejection="even"] {\n animation: popmelt-admission-rejection-even 360ms ease-out;\n }\n [data-popmelt-admission-submit-rejection="odd"] {\n animation: popmelt-admission-rejection-odd 360ms ease-out;\n }\n [data-popmelt-admission-submit-rejection="even"] {\n animation: popmelt-admission-rejection-even 360ms ease-out;\n }\n @keyframes popmelt-admission-rejection-odd {\n 0%, 100% { transform: translateX(0); }\n 38% { transform: translateX(-3px); }\n }\n @keyframes popmelt-admission-rejection-even {\n 0%, 100% { transform: translateX(0); }\n 38% { transform: translateX(-3px); }\n }\n [data-popmelt-admission-sending-dot] {\n animation-duration: 1.2s;\n animation-iteration-count: infinite;\n animation-timing-function: step-end;\n }\n [data-popmelt-admission-sending-dot="1"] {\n animation-name: popmelt-admission-sending-dot-1;\n }\n [data-popmelt-admission-sending-dot="2"] {\n animation-name: popmelt-admission-sending-dot-2;\n }\n [data-popmelt-admission-sending-dot="3"] {\n animation-name: popmelt-admission-sending-dot-3;\n }\n @keyframes popmelt-admission-sending-dot-1 {\n 0%, 24.99% { opacity: 0; }\n 25%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-sending-dot-2 {\n 0%, 49.99% { opacity: 0; }\n 50%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-sending-dot-3 {\n 0%, 74.99% { opacity: 0; }\n 75%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-send-icon-out {\n 0%, 30% {\n opacity: 1;\n transform: translate(0, -50%);\n }\n 100% {\n opacity: 0;\n transform: translate(10px, -50%);\n }\n }\n [data-devtools="participant-admission"][data-popmelt-theme="${W}"] [data-popmelt-admission-ask]:is([aria-expanded="false"], [data-popmelt-admission-pending]):is(:hover, :focus-visible) {\n box-shadow: inset 0 0 0 100px ${Ee.softHairline};\n }\n [data-popmelt-admission-pending-label],\n [data-popmelt-admission-cancel-label],\n [data-popmelt-admission-declined-label] {\n grid-area: 1 / 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 3px;\n }\n [data-popmelt-admission-cancel-label] { visibility: hidden; }\n [data-popmelt-admission-ask]:is(:hover, :focus-visible, [aria-busy="true"]) [data-popmelt-admission-pending-label] { visibility: hidden; }\n [data-popmelt-admission-ask]:is(:hover, :focus-visible, [aria-busy="true"]) [data-popmelt-admission-cancel-label] { visibility: visible; }\n [data-devtools="participant-admission"][data-popmelt-theme="${W}"] input::placeholder {\n color: ${Ee.secondary};\n opacity: 1;\n }\n [data-devtools="participant-admission"] button[type="submit"] {\n -webkit-user-select: none;\n user-select: none;\n -webkit-touch-callout: none;\n }\n [data-devtools="participant-admission"] button[type="submit"] > * { pointer-events: none; }\n @media (pointer: coarse) {\n [data-devtools="participant-admission"] button[type="submit"] { min-width: 44px; min-height: 44px; touch-action: manipulation; }\n [data-popmelt-admission-name-field] { font-size: 16px; }\n }\n @media (prefers-reduced-motion: reduce) {\n [data-popmelt-admission-ask] { transition: none; animation: none; }\n [data-popmelt-admission-submit-rejection] { animation: none; }\n [data-popmelt-admission-sending-dot] { animation: none; opacity: 1; }\n [data-popmelt-admission-send-icon],\n [data-popmelt-admission-sending-label] { animation: none !important; }\n }\n `}),A(n,{theme:W,themePreference:q,onThemePreferenceChange:D,deemphasizeControls:oe,onCollapse:()=>se(!1),panel:oe||ve?C(T,{children:[oe&&!Fe&&C("form",{"aria-label":M?"Join session":"Ask for access","data-popmelt-font":"sans","aria-busy":de||void 0,style:{...r(W),flexWrap:"wrap",...X&&{maxWidth:"min(320px, calc(100vw - 24px))",boxSizing:"border-box",padding:12,gap:8,borderRadius:16}},onSubmit:e=>{e.preventDefault();let t=xe.current?"enter":"send";xe.current=!1,(async e=>{if(!U.trim()||Oe||de||Fe||be.current)return;if(be.current=!0,le(!0),we(""),ue(void 0),L||B){try{if(We(U.trim()),L)return void await L.join(U.trim());B&&await B(U.trim(),await qe())}catch(e){we(e instanceof Error?e.message:"Could not join. Please try again.")}return be.current=!1,void le(!1)}try{P.current=JSON.parse(E.getItem(O)??"null")}catch{}let t=!Z&&P.current?.receipt?P.current.receipt:z();try{let e=await qe();We(U,t),P.current={...P.current,name:U,receipt:t};let n=await J.requestAdmission(t,U.trim(),e);Y(t),K(n.name),Q(n),se(!1)}catch{P.current={...P.current,name:U,receipt:t},ue({target:e,pulse:++Se.current})}finally{be.current=!1,le(!1)}})(t)},children:[L?.projectName&&C("span",{style:{flexBasis:"100%",minWidth:0,overflowWrap:"anywhere"},children:["Join ",L.projectName]}),C("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[A(o,{"data-popmelt-entry-avatar":!0,shape:ae&&"circle"!==ae?ae:m(0),color:te??(Oe?Ee.muted:"transparent"),size:l.identitySize}),C("span",{"data-popmelt-admission-name-field":!0,style:{...X&&{fontSize:16},display:"inline-grid",flex:"0 1 auto",minWidth:0},children:[A("span",{"aria-hidden":"true","data-popmelt-admission-name-measure":!0,style:{gridArea:"1 / 1",visibility:"hidden",whiteSpace:"pre",overflow:"hidden",paddingRight:1},children:U||"what’s your name?"}),A("input",{autoFocus:!0,"aria-label":"Your name",placeholder:"what’s your name?",autoComplete:"nickname",enterKeyHint:M?"go":"send",maxLength:48,value:U,disabled:de,onKeyDown:e=>{"Enter"===e.key&&(xe.current=!0)},onKeyUp:e=>{"Enter"===e.key&&(xe.current=!1)},onBlur:()=>{xe.current=!1},onChange:e=>{G.current=!0,K(e.target.value);try{We(e.target.value,P.current?.receipt)}catch{}},style:{gridArea:"1 / 1",minWidth:"100%",width:0,padding:0,border:0,borderRadius:0,background:"transparent",color:de?Ee.mutedStrong:Ee.primary,WebkitTextFillColor:de?Ee.mutedStrong:Ee.primary,caretColor:de?"transparent":Ee.primary,opacity:1,transition:"color 120ms ease",font:"inherit",fontFamily:w,outline:"none",boxShadow:"none",appearance:"none"}})]}),U.trim().length>0&&A("kbd",{"aria-hidden":"true","data-popmelt-admission-enter-hint":!0,"data-popmelt-admission-submit-rejection":"enter"===pe?.target?pe.pulse%2?"odd":"even":void 0,style:{...i(W),...d,flexShrink:0,color:Ee.primary,opacity:de?0:1,pointerEvents:de?"none":void 0,transition:"opacity 120ms ease"},children:"enter"})]}),C("button",{type:"submit",disabled:de||Oe||!U.trim(),"aria-label":de?"Sending…":M?"Join session":"Send request",onPointerDown:e=>{"mouse"===e.pointerType&&0===e.button&&e.preventDefault()},"aria-keyshortcuts":"Enter","aria-busy":de||void 0,"data-popmelt-admission-submit-rejection":"send"===pe?.target?pe.pulse%2?"odd":"even":void 0,style:{...a(W),...X&&{minWidth:44,minHeight:44,borderRadius:10},position:"relative",boxSizing:"border-box",overflow:"hidden",fontSize:12,color:de||!U.trim()?Ee.muted:Ee.primary,transition:"color 120ms ease"},children:[A("span",{"aria-hidden":"true","data-popmelt-admission-submit-sizer":!0,style:{display:de?"none":"block",width:14,height:14}}),C("span",{"aria-hidden":"true","data-popmelt-admission-submit-content":!0,style:{position:de?"static":"absolute",inset:0,pointerEvents:"none"},children:[A(b,{size:14,"data-popmelt-admission-send-icon":!0,style:{position:"absolute",top:"50%",left:"50%",marginLeft:-7,opacity:de?0:1,transform:de?"translate(10px, -50%)":"translate(0, -50%)",animation:de?"popmelt-admission-send-icon-out 260ms ease both":void 0}}),C("span",{"data-popmelt-admission-sending-label":!0,style:{display:de?"inline-block":"none",opacity:de?1:0},children:["Sending",C("span",{"data-popmelt-admission-sending-dots":!0,"aria-hidden":"true",style:{display:"inline-block"},children:[A("span",{"data-popmelt-admission-sending-dot":"1",children:"."}),A("span",{"data-popmelt-admission-sending-dot":"2",children:"."}),A("span",{"data-popmelt-admission-sending-dot":"3",children:"."})]})]})]})]}),H&&!M&&C("details",{style:{flexBasis:"100%",fontSize:12,color:Ee.secondary},children:[A("summary",{style:{cursor:"pointer"},children:"Using your own project?"}),C("p",{style:{margin:"6px 0 0",overflowWrap:"anywhere"},children:["Open the URL from your project’s"," ",A("code",{children:".popmelt/participant-host-link.json"})," in this browser to link it as a host."]})]}),ve&&A("span",{role:"alert",style:{flexBasis:"100%",fontSize:12},children:ve})]}),!oe&&ve&&A("div",{role:"status",style:{...r(W),fontSize:12},children:ve})]}):null,action:C(T,{children:[A("span",{"aria-hidden":"true","data-popmelt-admission-host":!0,style:{width:22,height:22,marginLeft:5,flexShrink:0,boxSizing:"border-box",border:`1px solid ${Ee.surface}`,borderRadius:"50%",background:u.activeColor,opacity:oe||Fe?.2:1,transition:Ne.current?"opacity 120ms ease":"none"}}),A("button",{ref:je,type:"button","data-popmelt-font":"sans","data-popmelt-admission-ask":!0,"data-popmelt-admission-pending":Fe?"":void 0,"data-popmelt-admission-declined":"rejected"===he||"rejected-out"===he?"":void 0,"data-popmelt-admission-rejection":me?me%2?"odd":"even":void 0,"data-popmelt-admission-transition":"idle"===he?void 0:he,"data-popmelt-entry-control":!0,"aria-expanded":Fe?void 0:oe,"aria-label":"rejected"===he||"rejected-out"===he?"Request declined":Fe?"Cancel request":void 0,"aria-describedby":Fe?Ce:void 0,"aria-busy":!(!Fe||!de)||void 0,disabled:Fe&&(de||"idle"!==he),onClick:()=>"idle"===he&&(Fe?void(async()=>{if(J&&V&&!de&&!Ae.current){Ae.current=!0,Te.current+=1,le(!0),we("");try{let e=await J.cancelAdmission(V);Q(e),se(!1)}catch{ce(e=>e+1)}finally{Ae.current=!1,le(!1)}}})():(se(!oe),void(oe||we("")))),"aria-description":Fe?void 0:M?"Enter your name to join the session.":"Ask the host to join in Suggest mode.",style:{...s(W),width:fe?fe["rejected"===he||"rejected-out"===he?"declined":Fe?"pending":"ask"]:void 0,paddingLeft:3,overflow:"hidden",transition:"box-shadow 120ms ease, width 180ms ease",background:Fe&&Z?.color?`color-mix(in srgb, ${Z.color} 10%, ${Ee.control})`:Ee.control},children:C("span",{"data-popmelt-entry-content":!0,style:{display:Fe?"inline-grid":"inline-flex",alignItems:"center",gap:"inherit",opacity:"pending-out"===he||"rejected-out"===he?0:1,transition:Ne.current?"opacity 120ms ease":"none"},children:["rejected"===he||"rejected-out"===he?C("span",{id:Ce,"data-popmelt-admission-declined-label":!0,"aria-hidden":"true",children:[A(h,{size:12}),"Request declined"]}):Fe?C(T,{children:[C("span",{id:Ce,"data-popmelt-admission-pending-label":!0,"aria-hidden":"true",children:[A(y,{size:12,style:{color:Z?.color}}),"Request pending"]}),C("span",{"data-popmelt-admission-cancel-label":!0,"aria-hidden":"true",children:[A(f,{size:12}),"Cancel request"]})]}):A(g,{size:12,"aria-hidden":"true","data-popmelt-admission-wave":!0}),!Fe&&"Ask for access"]})})]})})]})}export{J as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{c as t}from"./chunk-WP2SHSCG.mjs";import{d as e,c as o,m as r}from"./chunk-LH7HKUCK.mjs";import{b as i}from"./chunk-6RMM7JB6.mjs";var n=[4,2],a=n.join(" "),h=n[0]+n[1];function l(t){return"bottom-left"===t?[2,8,8,8]:"bottom-right"===t?[8,2,8,8]:"top-right"===t?[8,8,2,8]:[8,8,8,2]}function f(t){return l(t).map(t=>`${t}px`).join(" ")}var u=1.1666666666666667;function s(t){return t.length>2048?`${t.slice(0,2048)}…`:t}function p(t,e,o){return e.flatMap(e=>function(t,e,o){let r=s(e);if(!r||t.measureText(r).width<=o)return[r];let i=r.split(/\s+/),n=[],a="";for(let e of i){let r=a?`${a} ${e}`:e;a&&t.measureText(r).width>o?(n.push(a),a=e):a=r}return a&&n.push(a),n.length>0?n:[r]}(t,e,o))}var m=i,y=16;function g(t){let e=window.innerWidth-t-16;return Math.max(60,Math.min(400,e))}function x(t,e,o){let r=s(e);if(r===e&&t.measureText(r).width<=o)return r;let i="…",n=0,a=r.endsWith(i)?r.length-1:r.length;for(;n<a;){let e=Math.ceil((n+a)/2);t.measureText(r.slice(0,e)+i).width<=o?n=e:a=e-1}return n>0?r.slice(0,n)+i:i}function b(t,e,o,r,i){let n=0,a=typeof window<"u"?window.innerHeight:9999;o&&function(t,e,o){if(void 0===t||void 0===e||void 0===o.avoidLeft&&void 0===o.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,i=o.avoidLeft??0,n=o.avoidRight??r;return t+e>i&&t<n}(r,i,o)&&(n=o.avoidTop??n,a=o.avoidBottom??a);let h=Math.max(n,a-e);return Math.max(n,Math.min(t,h))}function d(t,e=12,o,r){let i=e*u+8,n=t.y-4,a=b(n,i,o,t.x-8,r);return a===n?t:{...t,y:a+4}}function c(t,e,o,r,i=12,n,a,h,f="#dddddd",s,p=!1){if(!o)return;let y=i*u,g=o.replace(/\n/g," "),b=void 0!==n?n+". "+g:g;t.font=`${i}px ${m}`,t.textBaseline="middle";let c=void 0!==a?Math.min(400,Math.max(60,window.innerWidth-a-16)):400,R=p?16:0,L=x(t,b,Math.max(60,c-R)),w=R+t.measureText(L).width,M=d(e,i,h,w+16);t.fillStyle=r;let v=M.x-8,S=M.y-4,C=w+16,N=y+8;t.beginPath(),t.roundRect(v,S,C,N,l(s)),t.fill();let A=M.y+y/2;if(p){let e=M.x,o=A-6;t.strokeStyle=f,t.lineWidth=1.5,t.lineCap="round",t.lineJoin="round",t.beginPath(),t.moveTo(e+7.5,o+4),t.lineTo(e+10.5,o+6.5),t.lineTo(e+7.5,o+9),t.moveTo(e+1.5,o+1.5),t.lineTo(e+1.5,o+4.5),t.quadraticCurveTo(e+1.5,o+6.5,e+3.5,o+6.5),t.lineTo(e+10.5,o+6.5),t.stroke()}t.fillStyle=f,t.fillText(L,M.x+R,A)}function R(t=22){return{height:t,minHeight:t,maxHeight:t,boxSizing:"border-box",flexShrink:0}}function L(t){let e=t.startsWith("top-");return{top:e?4:12,right:4,bottom:e?12:4,left:4}}function w({hasCommentEntry:t,stagedChangeCount:e}){return t&&0===e?2:6}function M({annotationNumber:t,stickerCount:e,interactionEpisodeStepCount:o,hasStatus:r,hasSend:i,controlGap:n}){let a=16+7.2*Math.max(1,void 0===t?0:String(t).length),h=28*e-2*Math.max(0,e-1),l=o>0?32+7.2*String(o).length:0,f=[e>0?e>0?h+(l>0?l-2:0)+(i?26:0):0:0,0===e?l:0,0===e&&i?28:0,r?28:0].filter(t=>t>0);return a+f.reduce((t,e)=>t+e,0)+f.length*n}function v(t,e,o){let r="right"===t.horizontalAlignment?t.left-e:t.left;return{left:r,top:t.top,right:r+e,bottom:t.top+o}}function S(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function C(t,e,o,r,i,n){let a=n-4,h=(t,o,r)=>Math.max(t,Math.min(e,o-r)),l=h(4,a,o);if(!i.some(t=>l<t.right&&l+o>t.left))return;let f=null;function u(i,n){if(t.left>=n||t.left+t.width<=i)return;let a=Math.max(i,t.left),l=n-a>=r,u=Math.min(o,Math.floor(n-(l?a:i)));if(u<r||u<=0)return;let s=l?a:h(i,n,u);(!f||u>f.width||u===f.width&&Math.abs(s-e)<Math.abs(f.left-e))&&(f={left:s,width:u})}let s=4;for(let t of[...i].sort((t,e)=>t.left-e.left))u(s,Math.min(a,t.left-2)),s=Math.max(s,t.right+2);return u(s,a),f}function N(t,e,o,r,i=0,n=Number.POSITIVE_INFINITY){let a=t.top>=e+o,h=t.bottom+o+e<=r;if(t.height>=r&&!a&&!h){let o=t.top<0&&t.bottom<=r;return{anchor:o?"bottom-left":"top-left",horizontalAlignment:"left",left:t.left+8,top:o?t.bottom-e-8:t.top+8}}let l=function(t,e,o){let r=Math.max(0,t.left+e-o);return Math.max(0,e-t.right)<r?"right":"left"}(t,i,n);return a?{anchor:"right"===l?"top-right":"top-left",horizontalAlignment:l,left:"right"===l?t.right:t.left,top:t.top-e-o}:{anchor:"right"===l?"bottom-right":"bottom-left",horizontalAlignment:l,left:"right"===l?t.right:t.left,top:t.bottom+o}}function A(t,e){let r=({x:t,y:r})=>{let i=o({left:t,top:r,width:0,height:0},e);return{x:i.left,y:i.top}};return{topLeft:r(t.topLeft),topRight:r(t.topRight),bottomRight:r(t.bottomRight),bottomLeft:r(t.bottomLeft)}}var T=12,$=["transition","transform","translate","rotate","scale"];function F(t){let[e]=t.getBoxQuads?.({box:"border"})??[];return e?{topLeft:{x:e.p1.x,y:e.p1.y},topRight:{x:e.p2.x,y:e.p2.y},bottomRight:{x:e.p3.x,y:e.p3.y},bottomLeft:{x:e.p4.x,y:e.p4.y}}:k(t.getBoundingClientRect())}function k(t){return{topLeft:{x:t.left,y:t.top},topRight:{x:t.right,y:t.top},bottomRight:{x:t.right,y:t.bottom},bottomLeft:{x:t.left,y:t.bottom}}}var P={a:1,b:0,c:0,d:1,e:0,f:0};function W(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function j(t,e){return{...P,e:t,f:e}}function B(t){let e=t*Math.PI/180,o=Math.cos(e),r=Math.sin(e);return{a:o,b:r,c:-r,d:o,e:0,f:0}}function I(t,e){return{a:t,b:0,c:0,d:e,e:0,f:0}}function E(t,e){if(!t)return 0;let o=Number.parseFloat(t);return Number.isFinite(o)?t.endsWith("%")?o/100*e:o:0}function H(t){if(!t)return 1;let e=Number.parseFloat(t);return Number.isFinite(e)?t.endsWith("%")?e/100:e:1}function O(t){if(!t||"none"===t)return P;let e=t.match(/^matrix\(([^)]+)\)$/);if(e){let t=e[1].split(",").map(Number);if(6===t.length&&t.every(Number.isFinite)){let[e,o,r,i,n,a]=t;return{a:e,b:o,c:r,d:i,e:n,f:a}}}let o=t.match(/^matrix3d\(([^)]+)\)$/);if(o){let t=o[1].split(",").map(Number);if(16===t.length&&t.every(Number.isFinite))return{a:t[0],b:t[1],c:t[4],d:t[5],e:t[12],f:t[13]}}return P}function z(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function D(t){let e=getComputedStyle(t),o=e.rotate.trim().split(/\s+/).at(-1)??"0",r=B(Number.parseFloat(o)||0),[i="1",n=i]=e.scale.trim().split(/\s+/);return{...W(r,W(I(H(i),H(n)),O(e.transform))),e:0,f:0}}function Q(e){let o=P,i=e.assignedSlot??r(e);for(;i;)t(i)&&(o=W(D(i),o)),i=i.assignedSlot??r(i);return o}function V(t){let e=W(Q(t),D(t));return(t.currentCSSZoom||1)*Math.hypot(e.c,e.d)}function Z(t,e,o){let r=(r,i)=>({x:t.x+(e.x*r+o.x*i)/2,y:t.y+(e.y*r+o.y*i)/2});return{topLeft:r(-1,-1),topRight:r(1,-1),bottomRight:r(1,1),bottomLeft:r(-1,1)}}function G(e){let o=Array.from(e.getClientRects()).filter(t=>t.width>0&&t.height>0);if(o.length>1)return o.map(t=>{let o=k(t),r=A(o,e.ownerDocument);return ht(r,et(X(e,o),o,r))}).join(" ");let r=F(e),i=t(e)?tt(e,r):Y(r),n=Z({x:0,y:0},{x:i.width,y:0},{x:0,y:i.height}),a=r;if(!e.getBoxQuads&&t(e)){let t=W(Q(e),D(e));if(0!==t.b||0!==t.c||t.a<0||t.d<0){let o=e.currentCSSZoom||1;a=Z(lt(r),{x:t.a*i.width*o,y:t.b*i.width*o},{x:t.c*i.height*o,y:t.d*i.height*o})}}let h=A(a,e.ownerDocument);return ht(h,et(X(e,n),n,h))}function J(t,e){let[o]=t.getBoxQuads?.({box:"border"})??[];if(o)return F(t);let r=getComputedStyle(t),{width:i,height:n}=tt(t,e);if(i<=0||n<=0)return F(t);let[a="0",h="0"]=r.translate.trim().split(/\s+/),l=j(E(a,i),E(h,n)),f=r.rotate.trim().split(/\s+/).at(-1)??"0",u=B(Number.parseFloat(f)||0),[s="1",p=s]=r.scale.trim().split(/\s+/),m=I(H(s),H(p)),y=O(r.transform),[g="50%",x="50%"]=r.transformOrigin.trim().split(/\s+/),b={x:E(g,i),y:E(x,n)},d=W(j(b.x,b.y),W(u,W(m,W(y,j(-b.x,-b.y))))),c=W(l,d),R=(e.topRight.x-e.topLeft.x)/i,L=(e.topRight.y-e.topLeft.y)/i,w=(e.bottomLeft.x-e.topLeft.x)/n,M=(e.bottomLeft.y-e.topLeft.y)/n,v=t=>{let o=z(c,t);return{x:e.topLeft.x+R*o.x+w*o.y,y:e.topLeft.y+L*o.x+M*o.y}};return{topLeft:v({x:0,y:0}),topRight:v({x:i,y:0}),bottomRight:v({x:i,y:n}),bottomLeft:v({x:0,y:n})}}function K(t){return J(t,q(t))}function q(t){let e=$.map(e=>({property:e,value:t.style.getPropertyValue(e),priority:t.style.getPropertyPriority(e)}));try{t.style.setProperty("transition","none","important");for(let e of $)"transition"!==e&&t.style.setProperty(e,"none","important");let[e]=t.getBoxQuads?.({box:"border"})??[],o=F(t);return e?o:function(t,e){let{width:o,height:r}=tt(t,e);if(o<=0||r<=0)return e;let i=Q(t);if(0===i.b&&0===i.c&&i.a>0&&i.d>0)return e;let n=t.currentCSSZoom||1,a=z(i,{x:o*n,y:0}),h=z(i,{x:0,y:r*n});return Z(lt(e),a,h)}(t,o)}finally{for(let{property:o,value:r,priority:i}of e.filter(({property:t})=>"transition"!==t))r?t.style.setProperty(o,r,i):t.style.removeProperty(o);let o=e.find(({property:t})=>"transition"===t);o&&(t.ownerDocument.defaultView?.getComputedStyle(t).transitionProperty,o.value?t.style.setProperty(o.property,o.value,o.priority):t.style.removeProperty(o.property))}}function U(t,e,o=1){return["topLeft","topRight","bottomRight","bottomLeft"].some(r=>Math.hypot(t[r].x-e[r].x,t[r].y-e[r].y)>o)}function _(t,e,o){let[r="0",i=r]=t.trim().split(/\s+/),n=(t,e)=>{let o=Number.parseFloat(t);return Number.isFinite(o)?t.endsWith("%")?o/100*e:o:0};return{x:n(r,e),y:n(i,o)}}function X(t,e){let o=getComputedStyle(t),r=(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,i=(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;return{topLeft:_(o.borderTopLeftRadius,r,i),topRight:_(o.borderTopRightRadius,r,i),bottomRight:_(o.borderBottomRightRadius,r,i),bottomLeft:_(o.borderBottomLeftRadius,r,i)}}function Y(t){return{width:(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,height:(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}}function tt(t,e){let o=Y(e);if("offsetWidth"in t)return{width:t.offsetWidth||o.width,height:t.offsetHeight||o.height};let r=getComputedStyle(t),i=Number.parseFloat(r.width),n=Number.parseFloat(r.height);return{width:Number.isFinite(i)&&i>0?i:o.width,height:Number.isFinite(n)&&n>0?n:o.height}}function et(t,e,o){let r=Y(e),i=Y(o),n=r.width>0?i.width/r.width:1,a=r.height>0?i.height/r.height:1;return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,{x:e.x*n,y:e.y*a}]))}function ot(t){let e=getComputedStyle(t);return(!e.backgroundImage||"none"===e.backgroundImage)&&function(t){let e=t.trim().toLowerCase();if(!e||"transparent"===e)return 0;if(e.match(/^#(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/))return 5===e.length?Number.parseInt(e.at(-1).repeat(2),16)/255:9===e.length?Number.parseInt(e.slice(-2),16)/255:1;let o=e.match(/\/\s*([\d.]+%?)\s*\)$/);if(o){let t=Number.parseFloat(o[1]);return o[1].endsWith("%")?t/100:t}let r=e.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([\d.]+%?)\s*\)$/);if(r){let t=Number.parseFloat(r[1]);return r[1].endsWith("%")?t/100:t}return 1}(e.backgroundColor)>=.999}function rt(t,e,o){let r=e.x-t.x,i=e.y-t.y,n=Math.max(1,Math.hypot(r,i));return{x:t.x+r/n*o,y:t.y+i/n*o}}function it(t,e){let o=(t,e)=>Math.hypot(e.x-t.x,e.y-t.y),r=[[o(t.topLeft,t.topRight),e.topLeft.x+e.topRight.x],[o(t.topRight,t.bottomRight),e.topRight.y+e.bottomRight.y],[o(t.bottomRight,t.bottomLeft),e.bottomRight.x+e.bottomLeft.x],[o(t.bottomLeft,t.topLeft),e.bottomLeft.y+e.topLeft.y]];return Math.min(1,...r.map(([t,e])=>e>0?t/e:1))}function nt(t){return{topLeft:[t.topLeft.y,t.topLeft.x],topRight:[t.topRight.x,t.topRight.y],bottomRight:[t.bottomRight.y,t.bottomRight.x],bottomLeft:[t.bottomLeft.x,t.bottomLeft.y]}}function at(t,e){let o=["topLeft","topRight","bottomRight","bottomLeft"],r=nt(e),i=it(t,e),n=1-Math.SQRT1_2;return Object.fromEntries(o.map((e,a)=>{let h=t[e],l=t[o[(a+o.length-1)%o.length]],f=t[o[(a+1)%o.length]],[u,s]=r[e],p=rt(h,l,u*i*n),m=rt(h,f,s*i*n);return[e,{x:p.x+m.x-h.x,y:p.y+m.y-h.y}]}))}function ht(t,e){let o=.5522847498,r=["topLeft","topRight","bottomRight","bottomLeft"],i=nt(e),n=it(t,e),a=r.map((e,a)=>{let h=t[e],l=r[(a+r.length-1)%r.length],f=r[(a+1)%r.length],u=t[l],s=t[f],[p,m]=i[e],y=p*n,g=m*n,x=rt(h,u,y),b=rt(h,s,g);return{entry:x,exit:b,entryControl:rt(x,h,y*o),exitControl:rt(b,h,g*o)}}),h=a[0],l=[`M ${h.exit.x} ${h.exit.y}`];for(let t=1;t<=a.length;t+=1){let e=a[t%a.length];l.push(`L ${e.entry.x} ${e.entry.y}`),l.push(`C ${e.entryControl.x} ${e.entryControl.y} ${e.exitControl.x} ${e.exitControl.y} ${e.exit.x} ${e.exit.y}`)}return l.push("Z"),l.join(" ")}function lt(t){return{x:(t.topLeft.x+t.topRight.x+t.bottomRight.x+t.bottomLeft.x)/4,y:(t.topLeft.y+t.topRight.y+t.bottomRight.y+t.bottomLeft.y)/4}}function ft(t,e=28,o="top"){let[r,i]="top"===o?[t.topLeft,t.topRight]:"right"===o?[t.topRight,t.bottomRight]:"bottom"===o?[t.bottomRight,t.bottomLeft]:[t.bottomLeft,t.topLeft],n={x:(r.x+i.x)/2,y:(r.y+i.y)/2},a=i.x-r.x,h=i.y-r.y,l=Math.max(1,Math.hypot(a,h));return{edge:n,handle:{x:n.x+h/l*e,y:n.y-a/l*e}}}function ut(t,e){let o=ft(t);return o.handle.y>=e/2?{...o,side:"top"}:{...ft(t,28,"bottom"),side:"bottom"}}function st(t,e,o){let r=o.x-e.x,i=o.y-e.y,n=r*r+i*i;if(0===n)return Math.hypot(t.x-e.x,t.y-e.y);let a=Math.max(0,Math.min(1,((t.x-e.x)*r+(t.y-e.y)*i)/n));return Math.hypot(t.x-(e.x+a*r),t.y-(e.y+a*i))}var pt=["top","right","bottom","left"];function mt(t,e,o,r={}){let i=pt.map(o=>({...ft(t,28,o),side:o,distance:st(e,"top"===o?t.topLeft:"right"===o?t.topRight:"bottom"===o?t.bottomRight:t.bottomLeft,"top"===o?t.topRight:"right"===o?t.bottomRight:"bottom"===o?t.bottomLeft:t.topLeft)})),n=r.viewport?i.filter(({handle:t})=>function(t,e,o){let r=e/2;return t.x>=r&&t.x<=o.width-r&&t.y>=r&&t.y<=o.height-r}(t,o,r.viewport)):i,a=n.length>0?n:i,h=a.reduce((t,e)=>e.distance<t.distance?e:t),l=r.currentSide?a.find(({side:t})=>t===r.currentSide):void 0,f=l&&l.distance<=h.distance+(r.hysteresis??8)?l:h;return{edge:f.edge,handle:f.handle,side:f.side}}function yt(t,e,o){let r=e,i=o,n=[t.topLeft,t.topRight,t.bottomRight,t.bottomLeft],a=!1,h=!1;for(let t=0;t<n.length;t+=1){let e=n[t],o=n[(t+1)%n.length],l=(o.x-e.x)*(i-e.y)-(o.y-e.y)*(r-e.x);if(l>.001&&(a=!0),l<-.001&&(h=!0),a&&h)return!1}return!0}function gt(t,e,o,r){let i={x:e,y:o},n=[t.topLeft,t.topRight,t.bottomRight,t.bottomLeft],a=r/2;if(n.some(t=>Math.hypot(e-t.x,o-t.y)<=a)||[[t.topLeft,t.topRight],[t.topRight,t.bottomRight],[t.bottomRight,t.bottomLeft],[t.bottomLeft,t.topLeft]].some(([t,e])=>st(i,t,e)<=6))return!0;let h=mt(t,i,r);return st(i,h.edge,h.handle)<=r/2}function xt(t,e,o,r){let i={x:e,y:o},n=mt(t,i,r);return st(i,n.edge,n.handle)<=1.5*r}function bt(t){let e=Math.max(1,Math.hypot(t.x,t.y));return{x:t.x/e,y:t.y/e}}function dt(t,e){let o=lt(t);return bt({x:t[e].x-o.x,y:t[e].y-o.y})}function ct(t,e){let o=lt(t),{handle:r}=ft(t,28,e),i=bt({x:r.x-o.x,y:r.y-o.y});return{x:-i.y,y:i.x}}function Rt(t,e){if(!e||0===t.x&&0===t.y)return t;let o=Math.PI/4,r=Math.atan2(t.y,t.x),i=Math.round(r/o)*o,n=Math.hypot(t.x,t.y);return{x:Math.cos(i)*n,y:Math.sin(i)*n}}function Lt(t,e,o=8){return Math.hypot(e.x-t.x,e.y-t.y)<=o}function wt(t){if(!t||"none"===t)return{x:0,y:0};let[e="0",o="0"]=t.trim().split(/\s+/);return{x:Number.parseFloat(e)||0,y:Number.parseFloat(o)||0}}function Mt(t,o){let r=t.ownerDocument.createElementNS("http://www.w3.org/2000/svg","svg"),{x:i,y:n,width:a,height:h}=e(t);return r.setAttribute("viewBox",[i,n,a,h].join(" ")),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("aria-hidden","true"),r.setAttribute("data-devtools",o),r.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none",r}function vt(t,e,o,r,i){if(!t.closest("[data-popmelt-hover-painter]"))return;let n=new AbortController,h=new CustomEvent("popmelt:paint-annotation",{bubbles:!0,cancelable:!0,detail:{signal:n.signal,setHitArea:i,createOverlay(t,i){let n=Mt(i,"painted-annotation"),h=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");return h.setAttribute("d",G(t)),h.setAttribute("fill",o?e:"none"),h.setAttribute("fill-opacity",String(o)),h.setAttribute("stroke",e),h.setAttribute("stroke-width",String(1)),h.setAttribute("vector-effect","non-scaling-stroke"),h.setAttribute("stroke-linejoin","round"),"solid"!==r&&h.setAttribute("stroke-dasharray",a),"marching"===r&&h.setAttribute("data-popmelt-marching-stroke","true"),n.append(h),n}}});if(!t.dispatchEvent(h))return n;n.abort()}export{G as A,J as B,K as C,q as D,U as E,X as F,et as G,ot as H,at as I,ht as J,lt as K,ft as L,ut as M,mt as N,yt as O,gt as P,xt as Q,dt as R,ct as S,Rt as T,Lt as U,wt as V,Mt as W,vt as X,n as a,a as b,h as c,f as d,u as e,s as f,p as g,m as h,y as i,g as j,x as k,b as l,d as m,c as n,R as o,L as p,w as q,M as r,v as s,S as t,C as u,N as v,A as w,T as x,F as y,V as z};
|
|
1
|
+
"use client";import{c as t}from"./chunk-WP2SHSCG.mjs";import{d as e,c as o,m as r}from"./chunk-LH7HKUCK.mjs";import{b as i}from"./chunk-ADRWR5GI.mjs";var n=[4,2],a=n.join(" "),h=n[0]+n[1];function l(t){return"bottom-left"===t?[2,8,8,8]:"bottom-right"===t?[8,2,8,8]:"top-right"===t?[8,8,2,8]:[8,8,8,2]}function f(t){return l(t).map(t=>`${t}px`).join(" ")}var u=1.1666666666666667;function s(t){return t.length>2048?`${t.slice(0,2048)}…`:t}function p(t,e,o){return e.flatMap(e=>function(t,e,o){let r=s(e);if(!r||t.measureText(r).width<=o)return[r];let i=r.split(/\s+/),n=[],a="";for(let e of i){let r=a?`${a} ${e}`:e;a&&t.measureText(r).width>o?(n.push(a),a=e):a=r}return a&&n.push(a),n.length>0?n:[r]}(t,e,o))}var m=i,y=16;function g(t){let e=window.innerWidth-t-16;return Math.max(60,Math.min(400,e))}function x(t,e,o){let r=s(e);if(r===e&&t.measureText(r).width<=o)return r;let i="…",n=0,a=r.endsWith(i)?r.length-1:r.length;for(;n<a;){let e=Math.ceil((n+a)/2);t.measureText(r.slice(0,e)+i).width<=o?n=e:a=e-1}return n>0?r.slice(0,n)+i:i}function b(t,e,o,r,i){let n=0,a=typeof window<"u"?window.innerHeight:9999;o&&function(t,e,o){if(void 0===t||void 0===e||void 0===o.avoidLeft&&void 0===o.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,i=o.avoidLeft??0,n=o.avoidRight??r;return t+e>i&&t<n}(r,i,o)&&(n=o.avoidTop??n,a=o.avoidBottom??a);let h=Math.max(n,a-e);return Math.max(n,Math.min(t,h))}function d(t,e=12,o,r){let i=e*u+8,n=t.y-4,a=b(n,i,o,t.x-8,r);return a===n?t:{...t,y:a+4}}function c(t,e,o,r,i=12,n,a,h,f="#dddddd",s,p=!1){if(!o)return;let y=i*u,g=o.replace(/\n/g," "),b=void 0!==n?n+". "+g:g;t.font=`${i}px ${m}`,t.textBaseline="middle";let c=void 0!==a?Math.min(400,Math.max(60,window.innerWidth-a-16)):400,R=p?16:0,L=x(t,b,Math.max(60,c-R)),w=R+t.measureText(L).width,M=d(e,i,h,w+16);t.fillStyle=r;let v=M.x-8,S=M.y-4,C=w+16,N=y+8;t.beginPath(),t.roundRect(v,S,C,N,l(s)),t.fill();let A=M.y+y/2;if(p){let e=M.x,o=A-6;t.strokeStyle=f,t.lineWidth=1.5,t.lineCap="round",t.lineJoin="round",t.beginPath(),t.moveTo(e+7.5,o+4),t.lineTo(e+10.5,o+6.5),t.lineTo(e+7.5,o+9),t.moveTo(e+1.5,o+1.5),t.lineTo(e+1.5,o+4.5),t.quadraticCurveTo(e+1.5,o+6.5,e+3.5,o+6.5),t.lineTo(e+10.5,o+6.5),t.stroke()}t.fillStyle=f,t.fillText(L,M.x+R,A)}function R(t=22){return{height:t,minHeight:t,maxHeight:t,boxSizing:"border-box",flexShrink:0}}function L(t){let e=t.startsWith("top-");return{top:e?4:12,right:4,bottom:e?12:4,left:4}}function w({hasCommentEntry:t,stagedChangeCount:e}){return t&&0===e?2:6}function M({annotationNumber:t,stickerCount:e,interactionEpisodeStepCount:o,hasStatus:r,hasSend:i,controlGap:n}){let a=16+7.2*Math.max(1,void 0===t?0:String(t).length),h=28*e-2*Math.max(0,e-1),l=o>0?32+7.2*String(o).length:0,f=[e>0?e>0?h+(l>0?l-2:0)+(i?26:0):0:0,0===e?l:0,0===e&&i?28:0,r?28:0].filter(t=>t>0);return a+f.reduce((t,e)=>t+e,0)+f.length*n}function v(t,e,o){let r="right"===t.horizontalAlignment?t.left-e:t.left;return{left:r,top:t.top,right:r+e,bottom:t.top+o}}function S(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function C(t,e,o,r,i,n){let a=n-4,h=(t,o,r)=>Math.max(t,Math.min(e,o-r)),l=h(4,a,o);if(!i.some(t=>l<t.right&&l+o>t.left))return;let f=null;function u(i,n){if(t.left>=n||t.left+t.width<=i)return;let a=Math.max(i,t.left),l=n-a>=r,u=Math.min(o,Math.floor(n-(l?a:i)));if(u<r||u<=0)return;let s=l?a:h(i,n,u);(!f||u>f.width||u===f.width&&Math.abs(s-e)<Math.abs(f.left-e))&&(f={left:s,width:u})}let s=4;for(let t of[...i].sort((t,e)=>t.left-e.left))u(s,Math.min(a,t.left-2)),s=Math.max(s,t.right+2);return u(s,a),f}function N(t,e,o,r,i=0,n=Number.POSITIVE_INFINITY){let a=t.top>=e+o,h=t.bottom+o+e<=r;if(t.height>=r&&!a&&!h){let o=t.top<0&&t.bottom<=r;return{anchor:o?"bottom-left":"top-left",horizontalAlignment:"left",left:t.left+8,top:o?t.bottom-e-8:t.top+8}}let l=function(t,e,o){let r=Math.max(0,t.left+e-o);return Math.max(0,e-t.right)<r?"right":"left"}(t,i,n);return a?{anchor:"right"===l?"top-right":"top-left",horizontalAlignment:l,left:"right"===l?t.right:t.left,top:t.top-e-o}:{anchor:"right"===l?"bottom-right":"bottom-left",horizontalAlignment:l,left:"right"===l?t.right:t.left,top:t.bottom+o}}function A(t,e){let r=({x:t,y:r})=>{let i=o({left:t,top:r,width:0,height:0},e);return{x:i.left,y:i.top}};return{topLeft:r(t.topLeft),topRight:r(t.topRight),bottomRight:r(t.bottomRight),bottomLeft:r(t.bottomLeft)}}var T=12,$=["transition","transform","translate","rotate","scale"];function F(t){let[e]=t.getBoxQuads?.({box:"border"})??[];return e?{topLeft:{x:e.p1.x,y:e.p1.y},topRight:{x:e.p2.x,y:e.p2.y},bottomRight:{x:e.p3.x,y:e.p3.y},bottomLeft:{x:e.p4.x,y:e.p4.y}}:k(t.getBoundingClientRect())}function k(t){return{topLeft:{x:t.left,y:t.top},topRight:{x:t.right,y:t.top},bottomRight:{x:t.right,y:t.bottom},bottomLeft:{x:t.left,y:t.bottom}}}var P={a:1,b:0,c:0,d:1,e:0,f:0};function W(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function j(t,e){return{...P,e:t,f:e}}function I(t){let e=t*Math.PI/180,o=Math.cos(e),r=Math.sin(e);return{a:o,b:r,c:-r,d:o,e:0,f:0}}function B(t,e){return{a:t,b:0,c:0,d:e,e:0,f:0}}function E(t,e){if(!t)return 0;let o=Number.parseFloat(t);return Number.isFinite(o)?t.endsWith("%")?o/100*e:o:0}function H(t){if(!t)return 1;let e=Number.parseFloat(t);return Number.isFinite(e)?t.endsWith("%")?e/100:e:1}function D(t){if(!t||"none"===t)return P;let e=t.match(/^matrix\(([^)]+)\)$/);if(e){let t=e[1].split(",").map(Number);if(6===t.length&&t.every(Number.isFinite)){let[e,o,r,i,n,a]=t;return{a:e,b:o,c:r,d:i,e:n,f:a}}}let o=t.match(/^matrix3d\(([^)]+)\)$/);if(o){let t=o[1].split(",").map(Number);if(16===t.length&&t.every(Number.isFinite))return{a:t[0],b:t[1],c:t[4],d:t[5],e:t[12],f:t[13]}}return P}function O(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function z(t){let e=getComputedStyle(t),o=e.rotate.trim().split(/\s+/).at(-1)??"0",r=I(Number.parseFloat(o)||0),[i="1",n=i]=e.scale.trim().split(/\s+/);return{...W(r,W(B(H(i),H(n)),D(e.transform))),e:0,f:0}}function Q(e){let o=P,i=e.assignedSlot??r(e);for(;i;)t(i)&&(o=W(z(i),o)),i=i.assignedSlot??r(i);return o}function G(t){let e=W(Q(t),z(t));return(t.currentCSSZoom||1)*Math.hypot(e.c,e.d)}function V(t,e,o){let r=(r,i)=>({x:t.x+(e.x*r+o.x*i)/2,y:t.y+(e.y*r+o.y*i)/2});return{topLeft:r(-1,-1),topRight:r(1,-1),bottomRight:r(1,1),bottomLeft:r(-1,1)}}function Z(e){let o=Array.from(e.getClientRects()).filter(t=>t.width>0&&t.height>0);if(o.length>1)return o.map(t=>{let o=k(t),r=A(o,e.ownerDocument);return ht(r,et(X(e,o),o,r))}).join(" ");let r=F(e),i=t(e)?tt(e,r):Y(r),n=V({x:0,y:0},{x:i.width,y:0},{x:0,y:i.height}),a=r;if(!e.getBoxQuads&&t(e)){let t=W(Q(e),z(e));if(0!==t.b||0!==t.c||t.a<0||t.d<0){let o=e.currentCSSZoom||1;a=V(lt(r),{x:t.a*i.width*o,y:t.b*i.width*o},{x:t.c*i.height*o,y:t.d*i.height*o})}}let h=A(a,e.ownerDocument);return ht(h,et(X(e,n),n,h))}function K(t,e){let[o]=t.getBoxQuads?.({box:"border"})??[];if(o)return F(t);let r=getComputedStyle(t),{width:i,height:n}=tt(t,e);if(i<=0||n<=0)return F(t);let[a="0",h="0"]=r.translate.trim().split(/\s+/),l=j(E(a,i),E(h,n)),f=r.rotate.trim().split(/\s+/).at(-1)??"0",u=I(Number.parseFloat(f)||0),[s="1",p=s]=r.scale.trim().split(/\s+/),m=B(H(s),H(p)),y=D(r.transform),[g="50%",x="50%"]=r.transformOrigin.trim().split(/\s+/),b={x:E(g,i),y:E(x,n)},d=W(j(b.x,b.y),W(u,W(m,W(y,j(-b.x,-b.y))))),c=W(l,d),R=(e.topRight.x-e.topLeft.x)/i,L=(e.topRight.y-e.topLeft.y)/i,w=(e.bottomLeft.x-e.topLeft.x)/n,M=(e.bottomLeft.y-e.topLeft.y)/n,v=t=>{let o=O(c,t);return{x:e.topLeft.x+R*o.x+w*o.y,y:e.topLeft.y+L*o.x+M*o.y}};return{topLeft:v({x:0,y:0}),topRight:v({x:i,y:0}),bottomRight:v({x:i,y:n}),bottomLeft:v({x:0,y:n})}}function q(t){return K(t,J(t))}function J(t){let e=$.map(e=>({property:e,value:t.style.getPropertyValue(e),priority:t.style.getPropertyPriority(e)}));try{t.style.setProperty("transition","none","important");for(let e of $)"transition"!==e&&t.style.setProperty(e,"none","important");let[e]=t.getBoxQuads?.({box:"border"})??[],o=F(t);return e?o:function(t,e){let{width:o,height:r}=tt(t,e);if(o<=0||r<=0)return e;let i=Q(t);if(0===i.b&&0===i.c&&i.a>0&&i.d>0)return e;let n=t.currentCSSZoom||1,a=O(i,{x:o*n,y:0}),h=O(i,{x:0,y:r*n});return V(lt(e),a,h)}(t,o)}finally{for(let{property:o,value:r,priority:i}of e.filter(({property:t})=>"transition"!==t))r?t.style.setProperty(o,r,i):t.style.removeProperty(o);let o=e.find(({property:t})=>"transition"===t);o&&(t.ownerDocument.defaultView?.getComputedStyle(t).transitionProperty,o.value?t.style.setProperty(o.property,o.value,o.priority):t.style.removeProperty(o.property))}}function U(t,e,o=1){return["topLeft","topRight","bottomRight","bottomLeft"].some(r=>Math.hypot(t[r].x-e[r].x,t[r].y-e[r].y)>o)}function _(t,e,o){let[r="0",i=r]=t.trim().split(/\s+/),n=(t,e)=>{let o=Number.parseFloat(t);return Number.isFinite(o)?t.endsWith("%")?o/100*e:o:0};return{x:n(r,e),y:n(i,o)}}function X(t,e){let o=getComputedStyle(t),r=(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,i=(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;return{topLeft:_(o.borderTopLeftRadius,r,i),topRight:_(o.borderTopRightRadius,r,i),bottomRight:_(o.borderBottomRightRadius,r,i),bottomLeft:_(o.borderBottomLeftRadius,r,i)}}function Y(t){return{width:(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,height:(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}}function tt(t,e){let o=Y(e);if("offsetWidth"in t)return{width:t.offsetWidth||o.width,height:t.offsetHeight||o.height};let r=getComputedStyle(t),i=Number.parseFloat(r.width),n=Number.parseFloat(r.height);return{width:Number.isFinite(i)&&i>0?i:o.width,height:Number.isFinite(n)&&n>0?n:o.height}}function et(t,e,o){let r=Y(e),i=Y(o),n=r.width>0?i.width/r.width:1,a=r.height>0?i.height/r.height:1;return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,{x:e.x*n,y:e.y*a}]))}function ot(t){let e=getComputedStyle(t);return(!e.backgroundImage||"none"===e.backgroundImage)&&function(t){let e=t.trim().toLowerCase();if(!e||"transparent"===e)return 0;if(e.match(/^#(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/))return 5===e.length?Number.parseInt(e.at(-1).repeat(2),16)/255:9===e.length?Number.parseInt(e.slice(-2),16)/255:1;let o=e.match(/\/\s*([\d.]+%?)\s*\)$/);if(o){let t=Number.parseFloat(o[1]);return o[1].endsWith("%")?t/100:t}let r=e.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([\d.]+%?)\s*\)$/);if(r){let t=Number.parseFloat(r[1]);return r[1].endsWith("%")?t/100:t}return 1}(e.backgroundColor)>=.999}function rt(t,e,o){let r=e.x-t.x,i=e.y-t.y,n=Math.max(1,Math.hypot(r,i));return{x:t.x+r/n*o,y:t.y+i/n*o}}function it(t,e){let o=(t,e)=>Math.hypot(e.x-t.x,e.y-t.y),r=[[o(t.topLeft,t.topRight),e.topLeft.x+e.topRight.x],[o(t.topRight,t.bottomRight),e.topRight.y+e.bottomRight.y],[o(t.bottomRight,t.bottomLeft),e.bottomRight.x+e.bottomLeft.x],[o(t.bottomLeft,t.topLeft),e.bottomLeft.y+e.topLeft.y]];return Math.min(1,...r.map(([t,e])=>e>0?t/e:1))}function nt(t){return{topLeft:[t.topLeft.y,t.topLeft.x],topRight:[t.topRight.x,t.topRight.y],bottomRight:[t.bottomRight.y,t.bottomRight.x],bottomLeft:[t.bottomLeft.x,t.bottomLeft.y]}}function at(t,e){let o=["topLeft","topRight","bottomRight","bottomLeft"],r=nt(e),i=it(t,e),n=1-Math.SQRT1_2;return Object.fromEntries(o.map((e,a)=>{let h=t[e],l=t[o[(a+o.length-1)%o.length]],f=t[o[(a+1)%o.length]],[u,s]=r[e],p=rt(h,l,u*i*n),m=rt(h,f,s*i*n);return[e,{x:p.x+m.x-h.x,y:p.y+m.y-h.y}]}))}function ht(t,e){let o=.5522847498,r=["topLeft","topRight","bottomRight","bottomLeft"],i=nt(e),n=it(t,e),a=r.map((e,a)=>{let h=t[e],l=r[(a+r.length-1)%r.length],f=r[(a+1)%r.length],u=t[l],s=t[f],[p,m]=i[e],y=p*n,g=m*n,x=rt(h,u,y),b=rt(h,s,g);return{entry:x,exit:b,entryControl:rt(x,h,y*o),exitControl:rt(b,h,g*o)}}),h=a[0],l=[`M ${h.exit.x} ${h.exit.y}`];for(let t=1;t<=a.length;t+=1){let e=a[t%a.length];l.push(`L ${e.entry.x} ${e.entry.y}`),l.push(`C ${e.entryControl.x} ${e.entryControl.y} ${e.exitControl.x} ${e.exitControl.y} ${e.exit.x} ${e.exit.y}`)}return l.push("Z"),l.join(" ")}function lt(t){return{x:(t.topLeft.x+t.topRight.x+t.bottomRight.x+t.bottomLeft.x)/4,y:(t.topLeft.y+t.topRight.y+t.bottomRight.y+t.bottomLeft.y)/4}}function ft(t,e=28,o="top"){let[r,i]="top"===o?[t.topLeft,t.topRight]:"right"===o?[t.topRight,t.bottomRight]:"bottom"===o?[t.bottomRight,t.bottomLeft]:[t.bottomLeft,t.topLeft],n={x:(r.x+i.x)/2,y:(r.y+i.y)/2},a=i.x-r.x,h=i.y-r.y,l=Math.max(1,Math.hypot(a,h));return{edge:n,handle:{x:n.x+h/l*e,y:n.y-a/l*e}}}function ut(t,e){let o=ft(t);return o.handle.y>=e/2?{...o,side:"top"}:{...ft(t,28,"bottom"),side:"bottom"}}function st(t,e,o){let r=o.x-e.x,i=o.y-e.y,n=r*r+i*i;if(0===n)return Math.hypot(t.x-e.x,t.y-e.y);let a=Math.max(0,Math.min(1,((t.x-e.x)*r+(t.y-e.y)*i)/n));return Math.hypot(t.x-(e.x+a*r),t.y-(e.y+a*i))}var pt=["top","right","bottom","left"];function mt(t,e,o,r={}){let i=pt.map(o=>({...ft(t,28,o),side:o,distance:st(e,"top"===o?t.topLeft:"right"===o?t.topRight:"bottom"===o?t.bottomRight:t.bottomLeft,"top"===o?t.topRight:"right"===o?t.bottomRight:"bottom"===o?t.bottomLeft:t.topLeft)})),n=r.viewport?i.filter(({handle:t})=>function(t,e,o){let r=e/2;return t.x>=r&&t.x<=o.width-r&&t.y>=r&&t.y<=o.height-r}(t,o,r.viewport)):i,a=n.length>0?n:i,h=a.reduce((t,e)=>e.distance<t.distance?e:t),l=r.currentSide?a.find(({side:t})=>t===r.currentSide):void 0,f=l&&l.distance<=h.distance+(r.hysteresis??8)?l:h;return{edge:f.edge,handle:f.handle,side:f.side}}function yt(t,e,o){let r=e,i=o,n=[t.topLeft,t.topRight,t.bottomRight,t.bottomLeft],a=!1,h=!1;for(let t=0;t<n.length;t+=1){let e=n[t],o=n[(t+1)%n.length],l=(o.x-e.x)*(i-e.y)-(o.y-e.y)*(r-e.x);if(l>.001&&(a=!0),l<-.001&&(h=!0),a&&h)return!1}return!0}function gt(t,e,o,r){let i={x:e,y:o},n=[t.topLeft,t.topRight,t.bottomRight,t.bottomLeft],a=r/2;if(n.some(t=>Math.hypot(e-t.x,o-t.y)<=a)||[[t.topLeft,t.topRight],[t.topRight,t.bottomRight],[t.bottomRight,t.bottomLeft],[t.bottomLeft,t.topLeft]].some(([t,e])=>st(i,t,e)<=6))return!0;let h=mt(t,i,r);return st(i,h.edge,h.handle)<=r/2}function xt(t,e,o,r){let i={x:e,y:o},n=mt(t,i,r);return st(i,n.edge,n.handle)<=1.5*r}function bt(t){let e=Math.max(1,Math.hypot(t.x,t.y));return{x:t.x/e,y:t.y/e}}function dt(t,e){let o=lt(t);return bt({x:t[e].x-o.x,y:t[e].y-o.y})}function ct(t,e){let o=lt(t),{handle:r}=ft(t,28,e),i=bt({x:r.x-o.x,y:r.y-o.y});return{x:-i.y,y:i.x}}function Rt(t,e){if(!e||0===t.x&&0===t.y)return t;let o=Math.PI/4,r=Math.atan2(t.y,t.x),i=Math.round(r/o)*o,n=Math.hypot(t.x,t.y);return{x:Math.cos(i)*n,y:Math.sin(i)*n}}function Lt(t,e,o=8){return Math.hypot(e.x-t.x,e.y-t.y)<=o}function wt(t){if(!t||"none"===t)return{x:0,y:0};let[e="0",o="0"]=t.trim().split(/\s+/);return{x:Number.parseFloat(e)||0,y:Number.parseFloat(o)||0}}function Mt(t,o){let r=t.ownerDocument.createElementNS("http://www.w3.org/2000/svg","svg"),{x:i,y:n,width:a,height:h}=e(t);return r.setAttribute("viewBox",[i,n,a,h].join(" ")),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("aria-hidden","true"),r.setAttribute("data-devtools",o),r.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none",r}function vt(t,e,o,r,i){if(!t.closest("[data-popmelt-hover-painter]"))return;let n=new AbortController,h=new CustomEvent("popmelt:paint-annotation",{bubbles:!0,cancelable:!0,detail:{signal:n.signal,setHitArea:i,createOverlay(t,i){let n=Mt(i,"painted-annotation"),h=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");return h.setAttribute("d",Z(t)),h.setAttribute("fill",o?e:"none"),h.setAttribute("fill-opacity",String(o)),h.setAttribute("stroke",e),h.setAttribute("stroke-width",String(1)),h.setAttribute("vector-effect","non-scaling-stroke"),h.setAttribute("stroke-linejoin","round"),"solid"!==r&&h.setAttribute("stroke-dasharray",a),"marching"===r&&h.setAttribute("data-popmelt-marching-stroke","true"),n.append(h),n}}});if(!t.dispatchEvent(h))return n;n.abort()}export{Z as A,K as B,q as C,J as D,U as E,X as F,et as G,ot as H,at as I,ht as J,lt as K,ft as L,ut as M,mt as N,yt as O,gt as P,xt as Q,dt as R,ct as S,Rt as T,Lt as U,wt as V,Mt as W,vt as X,n as a,a as b,h as c,f as d,u as e,s as f,p as g,m as h,y as i,g as j,x as k,b as l,d as m,c as n,R as o,L as p,w as q,M as r,v as s,S as t,C as u,N as v,A as w,T as x,F as y,G as z};
|