@popmelt.com/core 0.37.1 → 0.38.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/THIRD_PARTY_NOTICES.md +236 -0
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/ExploreAttachment-IIEORQP3.mjs +1 -0
- package/dist/{PagePreviewLayer-SIH7DDBF.mjs → PagePreviewLayer-AFSRCBAX.mjs} +1 -1
- package/dist/ParticipantRuntime-ZNEFG34O.mjs +1 -0
- package/dist/PhoneHostGate-OCIMKPLM.mjs +1 -0
- package/dist/PopmeltTasteConnectedPane-N2A5XPRO.mjs +1 -0
- package/dist/PreviewRuntime-3ANAJNFO.mjs +1 -0
- package/dist/QueuedReplies-5YG2DN3W.mjs +1 -0
- package/dist/SamplePlacementOverlay-EOJW6XGE.mjs +1 -0
- package/dist/ShareProjectPane-VYWTF3FW.mjs +1 -0
- package/dist/SuppliedContext-3S4HT6U6.mjs +1 -0
- package/dist/ThreadErrorCard-CTMVMETS.mjs +1 -0
- package/dist/ThreadPanel-G7OKSWD4.mjs +1 -0
- package/dist/adapter-react-three-fiber.d.mts +1 -1
- package/dist/adapter-react-three-fiber.mjs +1 -1
- package/dist/adapter-three.d.mts +2 -0
- package/dist/adapter-three.mjs +3 -3
- package/dist/bridge-entry.mjs +1 -1
- package/dist/bridge-recovery-NUYIGCFV.mjs +1 -0
- package/dist/bridgeSSEStream-HUFNXYPG.mjs +1 -0
- package/dist/bridgeWebSocketStream-AS22Y2FP.mjs +1 -0
- package/dist/browser-runtime-Q26JF5EA.mjs +1 -0
- package/dist/browser.d.mts +4 -4
- package/dist/browser.mjs +1 -1
- package/dist/canvas-chat-note-OLVVP55Y.mjs +1 -0
- package/dist/checkFixture-UNTXJKRN.mjs +1 -0
- package/dist/{chunk-YYODLRV3.mjs → chunk-25EXQOPI.mjs} +1 -1
- package/dist/{chunk-L6S66APQ.mjs → chunk-2F2BVGFH.mjs} +1 -1
- package/dist/chunk-2IWVTTYX.mjs +1 -0
- package/dist/{chunk-JSNK6NX7.mjs → chunk-2WQXHUEQ.mjs} +1 -1
- package/dist/{chunk-76WRZ2NH.mjs → chunk-3LZQLRZ2.mjs} +1 -1
- package/dist/chunk-3OGSLX4V.mjs +1 -0
- package/dist/{chunk-IAXSC2ZN.mjs → chunk-43BZCDGL.mjs} +1 -1
- package/dist/{chunk-7EISKUU7.mjs → chunk-5F34UIKL.mjs} +1 -1
- package/dist/{chunk-ECMLCGAM.mjs → chunk-6RMM7JB6.mjs} +1 -1
- package/dist/{chunk-CVVD2OMQ.mjs → chunk-AEC67LMY.mjs} +1 -1
- package/dist/{chunk-B22WBEQC.mjs → chunk-B3RA4XAR.mjs} +1 -1
- package/dist/{chunk-FON4QY7P.mjs → chunk-BEGAJYOY.mjs} +1 -1
- package/dist/{chunk-6XEEXK3U.mjs → chunk-BJUSVIDN.mjs} +1 -1
- package/dist/chunk-BOZVNUHJ.mjs +1 -0
- package/dist/chunk-CRZEJJI6.mjs +1 -0
- package/dist/{chunk-O2ZQFLNV.mjs → chunk-DBCBG5J6.mjs} +1 -1
- package/dist/{chunk-RUJC32MA.mjs → chunk-EFWBHWHP.mjs} +1 -1
- package/dist/{chunk-UX3DTCHL.mjs → chunk-FQLIJAUB.mjs} +1 -1
- package/dist/{chunk-EZVFCJEG.mjs → chunk-FYURSPM3.mjs} +1 -1
- package/dist/{chunk-HPU2UMVE.mjs → chunk-G6BN5TAZ.mjs} +1 -1
- package/dist/chunk-GTVTUWGH.mjs +1 -0
- package/dist/{chunk-SKKHZBOJ.mjs → chunk-JAMYVQFC.mjs} +1 -1
- package/dist/{chunk-SOT33EQ4.mjs → chunk-JJRKR4X3.mjs} +1 -1
- package/dist/{chunk-EFGQKWSZ.mjs → chunk-KHDXOXYF.mjs} +1 -1
- package/dist/chunk-KL5ODVJA.mjs +1 -0
- package/dist/{chunk-WF3YGZPI.mjs → chunk-L356S4EY.mjs} +1 -1
- package/dist/{chunk-3PSB5BST.mjs → chunk-N3MHDOMU.mjs} +1 -1
- package/dist/{chunk-QV5G3XRE.mjs → chunk-P2WAXWAZ.mjs} +1 -1
- package/dist/{chunk-HBFSPXIC.mjs → chunk-QQPUMPKU.mjs} +1 -1
- package/dist/{chunk-EUFR7R5Q.mjs → chunk-QXFBFKN6.mjs} +1 -1
- package/dist/{chunk-KXVXWEN4.mjs → chunk-RJWFSAKE.mjs} +1 -1
- package/dist/{chunk-FJWWBKCQ.mjs → chunk-RWZ7SVMO.mjs} +1 -1
- package/dist/{chunk-GAUQZAW6.mjs → chunk-SKM4ZXV5.mjs} +1 -1
- package/dist/{chunk-EBJ23A7F.mjs → chunk-TEXVTTWA.mjs} +1 -1
- package/dist/{chunk-QXVMGZFP.mjs → chunk-TSQEBZYO.mjs} +1 -1
- package/dist/{chunk-JEGBAHYK.mjs → chunk-TVIKC33M.mjs} +1 -1
- package/dist/{chunk-4LVGVKSS.mjs → chunk-TXL2CR66.mjs} +1 -1
- package/dist/{chunk-WJHYEACV.mjs → chunk-UOK5LOPJ.mjs} +1 -1
- package/dist/chunk-VG4ZV2OT.mjs +30 -0
- package/dist/{chunk-SBD7GQDN.mjs → chunk-W62YY5IT.mjs} +1 -1
- package/dist/chunk-WC7B5NU3.mjs +24 -0
- package/dist/{chunk-BYASSHKJ.mjs → chunk-WIJSWSNF.mjs} +1 -1
- package/dist/{chunk-NI77Y3WC.mjs → chunk-WJVRGXOS.mjs} +1 -1
- package/dist/{chunk-HAN6CUNB.mjs → chunk-WNOLXY3Y.mjs} +1 -1
- package/dist/chunk-YGP6PPOZ.mjs +1 -0
- package/dist/{chunk-LOUWY55X.mjs → chunk-ZHXTB5IN.mjs} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/codex-note-context-4X7I5AIJ.mjs +1 -0
- package/dist/{codex-project-3GJPU63O.mjs → codex-project-Q6YT5P37.mjs} +1 -1
- package/dist/{codex-store-mount-F6RBC77X.mjs → codex-store-mount-WJAATWHT.mjs} +1 -1
- package/dist/dev-server-NROXLQKM.mjs +1 -0
- package/dist/focus-inspection-LGIRFL2T.mjs +1 -0
- package/dist/guest-admission.mjs +1 -1
- package/dist/guest-live-canvas.mjs +1 -1
- package/dist/index.d.mts +27 -6
- package/dist/index.mjs +1 -1
- package/dist/inviteQr-YK3JAR6U.mjs +1 -0
- package/dist/media.d.mts +3 -3
- package/dist/media.mjs +1 -1
- package/dist/memory-legacy.mjs +1 -1
- package/dist/memory-store.mjs +1 -1
- package/dist/{participantBootstrap-CSLsiQ-C.d.mts → participantBootstrap-BTcD7XgB.d.mts} +2 -2
- package/dist/{peer-client-7X52EKMX.mjs → peer-client-DWC5F6JN.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/dist/{subjects-BQFCkehy.d.mts → subjects-D_yanOQ2.d.mts} +2 -0
- package/dist/taste-proposal-session-AAXK4CFL.mjs +1 -0
- package/dist/toolbarFonts-JAGSN3DN.mjs +1 -0
- package/dist/{video-adapter-C0kSwUir.d.mts → video-adapter-CWpR4NSt.d.mts} +1 -1
- package/dist/webpEncoder-QJRHTWUU.mjs +1 -0
- package/dist/workspace-snapshot-RUGPDEYJ.mjs +1 -0
- package/package.json +26 -35
- package/dist/ExploreAttachment-6AIMXC2K.mjs +0 -1
- package/dist/ParticipantRuntime-RTMEFDKF.mjs +0 -1
- package/dist/PhoneHostGate-RZRGWS2E.mjs +0 -1
- package/dist/PopmeltTasteConnectedPane-FAJXJEQQ.mjs +0 -1
- package/dist/PreviewRuntime-MW33PLMV.mjs +0 -1
- package/dist/QueuedReplies-4APDDNQX.mjs +0 -1
- package/dist/SamplePlacementOverlay-2VLBRDPZ.mjs +0 -1
- package/dist/ShareProjectPane-OR2LS2A3.mjs +0 -1
- package/dist/SuppliedContext-SAQKEDWW.mjs +0 -1
- package/dist/ThreadErrorCard-OSHIWSHR.mjs +0 -1
- package/dist/ThreadPanel-CMC5Q6WM.mjs +0 -1
- package/dist/bridge-recovery-3IQN3U6D.mjs +0 -1
- package/dist/bridgeSSEStream-6OMAFDFW.mjs +0 -1
- package/dist/bridgeWebSocketStream-WIOGOPJW.mjs +0 -1
- package/dist/browser-runtime-5W2ZKUCZ.mjs +0 -1
- package/dist/canvas-chat-note-O3USBECW.mjs +0 -1
- package/dist/checkFixture-DQPLFEUL.mjs +0 -1
- package/dist/chunk-3QYA5LGF.mjs +0 -1
- package/dist/chunk-5GEBVPTA.mjs +0 -1
- package/dist/chunk-7JWADHTH.mjs +0 -1
- package/dist/chunk-CCFTIBCJ.mjs +0 -1
- package/dist/chunk-OIKFQ2FV.mjs +0 -1
- package/dist/chunk-QE5XGXIA.mjs +0 -30
- package/dist/chunk-ROKRMYFR.mjs +0 -1
- package/dist/chunk-VVNZ5IEG.mjs +0 -24
- package/dist/codex-note-context-6QGJT2V3.mjs +0 -1
- package/dist/dev-server-KWVIMLLL.mjs +0 -1
- package/dist/focus-inspection-F25RXWZV.mjs +0 -1
- package/dist/inviteQr-U77MLSEQ.mjs +0 -1
- package/dist/taste-proposal-session-DBOUA54V.mjs +0 -1
- package/dist/toolbarFonts-GVPRHJGB.mjs +0 -1
- package/dist/workspace-snapshot-6LN7U2NJ.mjs +0 -1
- /package/dist/{chunk-PWQB3FIW.mjs → chunk-AWWUJO3N.mjs} +0 -0
- /package/dist/{chunk-TIAPJGX2.mjs → chunk-L45FX4SU.mjs} +0 -0
- /package/dist/{chunk-W2QQVB2H.mjs → chunk-VXRRHXUP.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{d as e,h as t}from"./chunk-W2QQVB2H.mjs";import{c as r}from"./chunk-WP2SHSCG.mjs";import{f as o,e as n}from"./chunk-AAMUU2QA.mjs";import{u as i,l as a,f as l,d as s,c,e as d,g as f}from"./chunk-LH7HKUCK.mjs";var p=("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(" "),u={"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"},h=["top","right","bottom","left"],m=[...h,"height","width","clip"],g=["width","height","max-width","max-height","object-fit","object-position"],y=["background-size","background-position","background-repeat","background-origin","background-clip"],w=new Set([...[...p,...Object.keys(u),...h,...y,...g].map(e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())),"borderColor","borderRadius","fill","stroke","strokeWidth","strokeDasharray","strokeDashoffset"]),b=[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 v(e){let t=typeof TextEncoder<"u"?Array.from((new TextEncoder).encode(e)):function(e){let t=[];for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);o<128?t.push(o):o<2048?t.push(192|o>>6,128|63&o):t.push(224|o>>12,128|o>>6&63,128|63&o)}return t}(e),r=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(let e=7;e>=0;e--)t.push(r/Math.pow(2,8*e)&255);let o=1779033703,n=3144134277,i=1013904242,a=2773480762,l=1359893119,s=2600822924,c=528734635,d=1541459225,f=new Array(64);for(let e=0;e<t.length;e+=64){for(let r=0;r<16;r++){let o=e+4*r;f[r]=(t[o]<<24|t[o+1]<<16|t[o+2]<<8|t[o+3])>>>0}for(let e=16;e<64;e++){let t=x(f[e-15],7)^x(f[e-15],18)^f[e-15]>>>3,r=x(f[e-2],17)^x(f[e-2],19)^f[e-2]>>>10;f[e]=f[e-16]+t+f[e-7]+r>>>0}let r=o,p=n,u=i,h=a,m=l,g=s,y=c,w=d;for(let e=0;e<64;e++){let t=w+(x(m,6)^x(m,11)^x(m,25))+(m&g^~m&y)+b[e]+f[e]>>>0,o=r&p^r&u^p&u;w=y,y=g,g=m,m=h+t>>>0,h=u,u=p,p=r,r=t+((x(r,2)^x(r,13)^x(r,22))+o>>>0)>>>0}o=o+r>>>0,n=n+p>>>0,i=i+u>>>0,a=a+h>>>0,l=l+m>>>0,s=s+g>>>0,c=c+y>>>0,d=d+w>>>0}return[o,n,i,a,l,s,c,d].map(e=>e.toString(16).padStart(8,"0")).join("")}function x(e,t){return e>>>t|e<<32-t}var N=/^[a-f0-9]{64}$/,S=/^[a-zA-Z0-9 _-]{0,64}$/,E=3145728,T=new Map,k=new Map,A=new Map;function M(e){return e&&"string"==typeof e.version&&N.test(e.version)&&"string"==typeof e.variant&&S.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}function P(e,t){return new URL(n(e.location.pathname)+"_popmelt/samples/"+t+".json",e.location.origin).href}async function C(e,t){let r=T.get(t);if(r)return r;let o=P(e,t),n=k.get(o);if(n)return n;let i=(async()=>{let r=new URL("/_popmelt/samples/"+t+".json",e.location.origin).href,n=await(globalThis.caches?.open("popmelt-component-samples-v1").catch(()=>{})),i=await(n?.match(r)),a=i??await fetch(o,{redirect:"error"});if(!a.ok||Number(a.headers.get("content-length"))>E)throw Error();let l=a.body?.getReader();if(!l)throw Error();let s=0,c="",d=new TextDecoder("utf-8",{fatal:!0});for(;;){let{done:e,value:t}=await l.read();if(e)break;if(s+=t.length,s>E)throw await l.cancel(),Error();c+=d.decode(t,{stream:!0})}if(c+=d.decode(),(globalThis.crypto?.subtle?Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(c))),e=>e.toString(16).padStart(2,"0")).join(""):v(c))!==t)throw Error();let f=JSON.parse(c);if("string"!=typeof f.script||"string"!=typeof f.css)throw Error();return i||await(n?.put(r,new Response(c)).catch(()=>{})),T.size>=8&&T.delete(T.keys().next().value),T.set(t,f),A.delete(o),f})().finally(()=>k.delete(o));return k.set(o,i),i}function R(e){return"string"==typeof e&&e.length<=384&&!/[;{}\\]|(?:url|var|attr|env)\s*\(/i.test(e)}function D(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)&&R(t.easing))&&e.frames.every((t,r)=>t&&Number.isFinite(t.offset)&&t.offset>=(e.frames[r-1]?.offset??0)&&t.offset<=1&&R(t.easing)&&Object.entries(t).every(([e,t])=>"offset"===e||"easing"===e||w.has(e)&&R(t)))})}var j=new WeakMap,O=new WeakMap;function V(e,t){for(let{frames:r,timing:o,paused:n,currentTime:i}of t){let t=e.animate(r,{id:"popmelt-sampled-motion",duration:o.duration,delay:o.delay,endDelay:o.endDelay,direction:o.direction,fill:o.fill,easing:o.easing,iterations:"infinite"===o.iterations?1/0:o.iterations});void 0!==i&&(t.currentTime=i),n&&t.pause()}}var F=new WeakMap;function W(e){let t=e.currentSrc||e.src;if(!e.complete||!e.naturalWidth||!e.naturalHeight)throw new Error("The image has not loaded.");let r=F.get(e);if(r?.src===t)return r.pixels;let o=e.ownerDocument.createElement("canvas"),n=Math.min(1,1024/Math.max(e.naturalWidth,e.naturalHeight));for(;;){o.width=Math.max(1,Math.round(e.naturalWidth*n)),o.height=Math.max(1,Math.round(e.naturalHeight*n));let r,i=o.getContext("2d");if(!i)throw new Error("The browser cannot capture this image.");i.drawImage(e,0,0,o.width,o.height);try{r=o.width*o.height<=65536?o.toDataURL("image/png"):"",(!r||r.length>24576)&&(r=o.toDataURL("image/webp",.9))}catch{throw new Error("The image host does not allow its pixels to be copied.")}if(L(r))return F.set(e,{src:t,pixels:r}),e.addEventListener("load",()=>F.delete(e),{once:!0}),r;if(1===o.width&&1===o.height)throw new Error("The browser cannot capture this image.");n/=2}}function L(e){return"string"==typeof e&&e.length<=24576&&/^data:image\/(?:png|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(e)}var z=new WeakMap;var I="http://www.w3.org/2000/svg",H=new Set("svg g path rect circle ellipse line polygon polyline defs linearGradient radialGradient stop clipPath title desc".split(" ")),U=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(" ")),$=new Set("fill stroke stop-color".split(" ")),_="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(" "),q=/^url\(["']?#([\w.:-]+)["']?\)$/,B=/^[\w.:-]{1,128}$/;function J(e,t){return"id"===e?B.test(t):"aria-label"===e?t.length<=512:"aria-hidden"===e?"true"===t||"false"===t:U.has(e)?/^[\w\s.%+,()-]*$/.test(t):q.test(t)?$.has(e)||"clip-path"===e:"clip-path"===e?"none"===t:$.has(e)?/^(?:[a-z]+|#[a-f\d]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([a-z\d.\s,%/+-]+\))$/i.test(t):_.includes(e)&&/^[a-z\d.\s,%+-]+$/i.test(t)}var G=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 r=q.exec(t)?.[1];return r?(this.references.add(r),"url(#"+this.prefix+r+")"):t}complete(){return[...this.references].every(e=>this.ids.has(e))}};var X=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(" ")),K={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"},Q=new Set(["div","article","section","aside","figure"]),Z=65536,Y=new Set(["width","height","max-width","max-height","min-width","min-height","transform","transform-origin","grid-template-columns","grid-template-rows",...h]);function ee(e,t){let r=e.getBoundingClientRect(),o=(e,o)=>{let n=t.getPropertyValue(e);return n.endsWith("px")?parseFloat(n)+("border-box"===t.boxSizing?0:o.reduce((e,r)=>e+(parseFloat(t.getPropertyValue("padding-"+r))||0)+(parseFloat(t.getPropertyValue("border-"+r+"-width"))||0),0)):r[e]};return{previewWidth:o("width",["left","right"]),previewHeight:o("height",["top","bottom"])}}function te(e){return e.hasAttribute("data-popmelt-sample-version")||("http://www.w3.org/1999/xhtml"===e.namespaceURI&&X.has(e.localName)||e.namespaceURI===I&&"svg"===e.localName)&&!e.shadowRoot}function re(e){let t=e.ownerDocument.defaultView,r=0;let o=function e(o,n,i,a){if(!t)throw new Error("The source page is no longer available.");if(n>16||++r>256)throw new Error("This subtree is too large to place in one draft.");let l=i?void 0:function(e){let t=e.getAttribute("data-popmelt-sample-version");if(null===t)return;let r={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(!M(r))throw Error("This component has no valid sample revision.");if(!T.has(t)){let r=P(e.ownerDocument,t);throw(A.get(r)??0)>Date.now()?Error("The sampled revision is unavailable."):(k.has(r)||C(e.ownerDocument,t).catch(()=>A.set(r,Date.now()+5e3)).finally(()=>{e.ownerDocument.dispatchEvent(new Event("popmelt-sample-ready"))}),Error("Loading this component for sampling."))}return r}(o),s=i??(l||o.namespaceURI!==I||"svg"!==o.localName?void 0:new G);if(s?o.namespaceURI!==I||!H.has(o.localName):!te(o))throw new Error(`<${o.localName}> content cannot be placed as an HTML draft.`);let c=t.getComputedStyle(o),d=o.computedStyleMap?.(),f=e=>d?.get(e)?.toString()||c.getPropertyValue(e),m=i?{}:Object.fromEntries(p.map(e=>[e,c.getPropertyValue(e)]).filter(([,e])=>!!e));for(let[e,t]of Object.entries(i?{}:u)){let r=Y.has(e)?f(e):c.getPropertyValue(e);r&&r!==t&&(m[e]=r)}let b,v=i?void 0:function(e,t){let r=/^url\("(data:image\/[^"]+)"\)$/.exec(t)?.[1];if(!r)return;if(L(r))return r;let o=z.get(e);if(o?.src===r){if(o.pixels)return o.pixels;if(o.failed)throw Error("This background image could not be sampled.")}else{let t={src:r};z.set(e,t);let o=e.ownerDocument.createElement("img");o.src=r,o.decode().then(()=>{t.pixels=W(o)}).catch(()=>{t.failed=!0}).finally(()=>e.ownerDocument.dispatchEvent(new Event("popmelt-sample-ready")))}throw Error("Loading this image for sampling.")}(o,c.backgroundImage);if(v)for(let e of y)m[e]=c.getPropertyValue(e);if(s&&(b=function(e,t,r){let o={};for(let t of e.attributes){let{name:e,value:r}=t;if("href"===e||"href"===t.localName)throw new Error("This SVG references other artwork.");(U.has(e)||"id"===e||"aria-label"===e||"aria-hidden"===e)&&(o[e]=r)}for(let r of["filter","mask-image","marker-start","marker-mid","marker-end"]){let o=t.getPropertyValue(r)||e.getAttribute(r);if(o&&"none"!==o)throw new Error("This SVG uses an unsupported effect.")}if("rect"===e.localName||"svg"===e.localName)for(let r of["width","height"]){let n=e.computedStyleMap?.().get(r)?.toString()||t.getPropertyValue(r);n&&"auto"!==n&&(o[r]=n)}for(let r of _){let n=t.getPropertyValue(r)||e.getAttribute(r);n&&(o[r]=n)}for(let[e,t]of Object.entries(o))if(!J(e,t)||null===r.value(e,t))throw new Error("This SVG uses an unsupported paint or shape.");return o}(o,c,s)),!l&&"img"===o.localName){let e=o;b={src:W(e),alt:e.alt}}if(!l&&!i&&("img"===o.localName||s))for(let e of g){let t=c.getPropertyValue(e);t&&(!Y.has(e)||"img"===o.localName&&"auto"===f(e))&&(m[e]=t)}if(!i&&("relative"===c.position||n>0&&"absolute"===c.position)){m.position=c.position;for(let e of h){let t=f(e);t&&"auto"!==t&&(m[e]=t)}"absolute"===m.position&&c.clip&&"auto"!==c.clip&&(m.clip=c.clip)}if(l)return{tag:Q.has(o.localName)?o.localName:"div",style:m,children:[],component:l,backgroundStill:v,...ee(o,c)};let x=function(e){let t=[];for(let r of e.getAnimations?.()??[]){if(!("animationName"in r)&&"popmelt-sampled-motion"!==r.id)continue;let o=r.effect;if(o?.target!==e||o.pseudoElement||"finished"===r.playState)continue;let n=o.getTiming(),i=o.getKeyframes().map(e=>{let t={offset:e.computedOffset,easing:e.easing??"linear"};for(let[r,o]of Object.entries(e))w.has(r)&&R(o)&&(t[r]=o);return t});i.some(e=>Object.keys(e).length>2)&&t.push({frames:i,currentTime:"number"==typeof r.currentTime?r.currentTime:void 0,paused:"paused"===r.playState,timing:{duration:Number(n.duration),delay:n.delay??0,endDelay:n.endDelay??0,iterations:n.iterations===1/0?"infinite":n.iterations??1,direction:n.direction??"normal",fill:n.fill??"none",easing:n.easing??"linear"}})}if(t.length){if(!D(t))throw Error("This animation is too complex to sample.");return t}}(o),N=new Set;if(a)for(let e of a.properties){let t=c.getPropertyValue(e),r=o.style.getPropertyValue(e)||(s?o.getAttribute(e):null);t!==a.css.getPropertyValue(e)||r&&"inherit"!==r?t&&Object.hasOwn(u,e)&&(m[e]=t):(N.add(e),e in m&&(m[e]="inherit"),b&&e in b&&(b[e]="inherit"))}for(let e of x??[])for(let t of e.frames)for(let e of Object.keys(t)){let t=K[e];t&&N.add(t)}let S=N.size?{css:c,properties:N}:void 0,E=[];for(let t of o.childNodes){if(3===t.nodeType&&t.textContent&&E.push(t.textContent),1!==t.nodeType)continue;let r=t;r.matches("[data-devtools],[data-popmelt-root],[data-popmelt-shadow-host]")||"picture"===o.localName&&"source"===r.localName||E.push(e(r,n+1,s,S))}if(s&&!i&&!s.complete())throw new Error("This SVG references artwork outside the sample.");return i?{tag:o.localName,style:m,children:E,attributes:b,motion:x}:{tag:o.localName,motion:x,backgroundStill:v,attributes:b,style:m,children:E,..."img"===o.localName&&{imageSourceHash:le(o)},...0===n?ee(o,c):{}}}(e,0);if(JSON.stringify(o).length>Z)throw new Error("This subtree is too large to place in one draft.");return o}function oe(e,t,r="draft"){let o=0,n=0,i=!1;let a=function e(a,l,s){if(!a||++o>256||l>16||!(s?H.has(a.tag):X.has(a.tag)||"svg"===a.tag)||!Array.isArray(a.children)||!a.style||"object"!=typeof a.style)return null;let c=s??("svg"===a.tag?new G:void 0),d=c?t.createElementNS(I,a.tag):t.createElement(a.tag),f=a.attributes;if(void 0!==f){if(!f||"object"!=typeof f||Array.isArray(f))return null;for(let[e,t]of Object.entries(f))if("string"!=typeof t||(n+=e.length+t.length)>Z)return null}if(c){if(!f||!function(e,t,r){for(let[o,n]of Object.entries(t)){if("string"!=typeof n||!J(o,n))return!1;let t=r.value(o,n);if(null===t)return!1;e.setAttribute(o,t),_.includes(o)&&e.style.setProperty(o,t)}return!0}(d,f,c))return null}else if("img"===a.tag){if(!f||!L(f.src)||"string"!=typeof f.alt||2!==Object.keys(f).length||a.children.length)return null;d.setAttribute("alt",f.alt),d.setAttribute("src",f.src)}else if(f)return null;if(void 0!==a.backgroundStill){if(!L(a.backgroundStill)||(n+=a.backgroundStill.length)>Z)return null;d.style.backgroundImage='url("'+a.backgroundStill+'")'}"button"===d.localName&&d.setAttribute("type","button");let h=a.style.position;if(h&&"relative"!==h&&!(l>0&&"absolute"===h))return null;"absolute"===h&&(i=!0);for(let[e,t]of Object.entries(a.style)){if(!p.includes(e)&&!Object.hasOwn(u,e)&&(!a.backgroundStill||!y.includes(e))&&(!h||"position"!==e&&!m.includes(e))&&("img"!==a.tag&&"svg"!==a.tag||!g.includes(e))||"string"!=typeof t||t.length>1024||(n+=t.length+e.length)>Z)return null;d.style.setProperty(e,t)}if("preview"===r&&!s)for(let[e,t]of[["width",a.previewWidth],["height",a.previewHeight]])"number"!=typeof t||!Number.isFinite(t)||t<0||(d.style.boxSizing="border-box",d.style[e]=t+"px",d.style.setProperty("min-"+e,"0"),d.style.setProperty("max-"+e,"none"));if(void 0!==a.component){if(c||!Q.has(a.tag)||a.children.length||!M(a.component)||(n+=a.component.props?.length??0)>Z)return null;(0===l||!d.style.position)&&(d.style.width=Number.isFinite(a.previewWidth)?a.previewWidth+"px":"100%",d.style.height=Number.isFinite(a.previewHeight)?a.previewHeight+"px":"100%"),d.dataset.popmeltSampleVersion=a.component.version,d.dataset.popmeltSampleVariant=a.component.variant,void 0!==a.component.props&&(d.dataset.popmeltSampleProps=a.component.props),a.component.label&&d.setAttribute("aria-label",a.component.label),function(e,t){let r=e.ownerDocument,o=r.createElement("iframe");o.title=t.label||"Sampled component",o.setAttribute("sandbox","allow-scripts"),o.referrerPolicy="no-referrer",o.style.cssText="display:block;width:100%;height:100%;border:0";let n=t.dark?"dark":"light";o.style.colorScheme=n,e.append(o),C(r,t.version).then(({script:e,css:i})=>{let a=r.createElement("div");a.id="root",a.dataset.variant=t.variant,void 0!==t.props&&(a.dataset.props=t.props),o.addEventListener("load",()=>{!1===r.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&o.animate?.([{opacity:0},{opacity:1}],{duration:160,easing:"ease-out"})},{once:!0}),o.srcdoc='<!doctype html><html class="'+(t.dark?"dark":"")+'" style="color-scheme:'+n+'"><head><meta name="color-scheme" content="'+n+"\"><meta charset=\"utf-8\"><meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; font-src data:; base-uri 'none'; form-action 'none'\"><style>html,body,#root{margin:0;width:100%;height:100%;overflow:hidden}*,*::before,*::after{box-sizing:border-box}"+i.replace(/<\/style/gi,"<\\/style")+"</style></head><body>"+a.outerHTML+"<script>"+e.replace(/<\/script/gi,"<\\/script")+"<\/script></body></html>"}).catch(()=>o.replaceWith(r.createTextNode("Sampled revision unavailable")))}(d,a.component)}for(let r of a.children)if("string"==typeof r){if((n+=r.length)>Z)return null;d.appendChild(t.createTextNode(r))}else{let t=e(r,l+1,c);if(!t)return null;d.appendChild(t)}if(c&&!s&&!c.complete())return null;if(void 0!==a.motion){if(!D(a.motion)||(n+=JSON.stringify(a.motion).length)>Z)return null;try{!function(e,t){if(!e.animate)return;let r=e.ownerDocument,o=O.get(r);if(!o&&r.defaultView?.matchMedia){let e=r.defaultView.matchMedia("(prefers-reduced-motion: reduce)"),t=new Set;e.addEventListener("change",()=>{for(let r of t){let o=r.deref();if(o?.isConnected){for(let e of o.getAnimations())"popmelt-sampled-motion"===e.id&&e.cancel();e.matches||V(o,j.get(o))}else t.delete(r)}}),o={query:e,elements:t},O.set(r,o)}if(o){if(o.elements.size%32==0)for(let e of o.elements)e.deref()||o.elements.delete(e);if(j.set(e,t),o.elements.add(new WeakRef(e)),o.query.matches)return}V(e,t)}(d,a.motion)}catch{return null}}return d}(e,0);return a&&i&&!a.style.position&&(a.style.position="relative"),a}function ne(e){return`[data-pm="placed-${e}"]`}var ie=new Set("main article section aside div ul ol body header footer nav".split(" "));function ae(e,t){return ie.has(e.localName)&&!e.closest("[data-devtools],[data-popmelt-shadow-host]")&&("li"!==t||["ul","ol"].includes(e.localName))}function le(e){let t=e.getAttribute("src")||e.getAttribute("srcset");return t?v(t):void 0}function se(e,t){if(!e.sampledTree||!function(e,t){return"copy"===e.operation&&/^[0-9a-f-]{36}$/.test(e.id)&&e.selector===ne(e.id)&&e.pathname===o(t.location?.pathname??"")}(e,t))return;let r=i([e.targetParentSelector],void 0,t);if("matched"!==r.status||r.element.querySelector(e.selector)||!ae(r.element,e.sampledTree.tag))return;let n=null;if(e.referenceSelector){let o=i([e.referenceSelector],void 0,t);if("matched"!==o.status||o.element.parentElement!==r.element)return;n="before"===e.placement?o.element:o.element.nextSibling}let a=oe(e.sampledTree,t);if(a)if(a.dataset.pm="placed-"+e.id,a.dataset.popmeltPlacement=e.id,["ul","ol"].includes(r.element.localName)&&"li"!==a.localName){let o=t.createElement("li");o.dataset.popmeltPlacementItem=e.id,o.append(a),r.element.insertBefore(o,n)}else r.element.insertBefore(a,n)}function ce(e,t){if(!/^[0-9a-f-]{36}$/.test(e.id)||e.selector!==ne(e.id))return;let r=e.selector+`[data-popmelt-placement="${e.id}"]`,o=e.targetParentSelector.includes(" >>> ")||e.targetParentSelector.startsWith("@frame(")?a(e.targetParentSelector,t)?.querySelector(r):a(r,t);o?.parentElement?.getAttribute("data-popmelt-placement-item")===e.id?o.parentElement.remove():o?.remove()}function de(e){return e.left+e.width}function fe(e){return e.top+e.height}function pe(e,t){if(0===e.length)return t;let r=Math.min(...e.map(e=>e.left)),o=Math.min(...e.map(e=>e.top));return{left:r,top:o,width:Math.max(...e.map(de))-r,height:Math.max(...e.map(fe))-o}}function ue(e){let t=[...e].sort((e,t)=>e.top-t.top||e.left-t.left),r=[];for(let e of t){let t=e.top+e.height/2,o=r.find(r=>{let o=r.top+r.height/2;return Math.abs(t-o)<=.4*Math.max(r.height,e.height)});if(!o){r.push({...e});continue}let n=Math.min(o.left,e.left),i=Math.min(o.top,e.top),a=Math.max(de(o),de(e)),l=Math.max(fe(o),fe(e));o.left=n,o.top=i,o.width=a-n,o.height=l-i}return r.sort((e,t)=>e.top-t.top||e.left-t.left)}function he(e){return!!e&&!!e.closest("#devtools-toolbar, #devtools-scrim, #devtools-text-input, [data-devtools], [data-popmelt-panel], [data-popmelt-shadow-host]")}function me(e,t,r){let o=e.caretPositionFromPoint?.(t,r);if(o?.offsetNode.nodeType===Node.TEXT_NODE)return{node:o.offsetNode,offset:o.offset};let n=e.caretRangeFromPoint?.(t,r);return n?.startContainer.nodeType===Node.TEXT_NODE?{node:n.startContainer,offset:n.startOffset}:null}function ge(e,r,o,n=!1){return function(e,t){if(!e)return t();let r=e.style.pointerEvents;e.style.pointerEvents="none";try{return t()}finally{e.style.pointerEvents=r}}(o,()=>{let o=t(e,r);if(!o||he(o))return null;let i=o?.ownerDocument??document,a=d(e,r,i),s=me(i,a.x,a.y)?.node??null;if(s&&!o.contains(s)&&(s=null),!s){let e=o;e&&!he(e)&&(s=function(e,t,r){let o=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.textContent?.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),n=o.nextNode();for(;n;){let i=n,a=e.ownerDocument.createRange();a.selectNodeContents(i);let l=Array.from(a.getClientRects());if(a.detach?.(),l.some(e=>t>=e.left&&t<=e.right&&r>=e.top&&r<=e.bottom))return i;n=o.nextNode()}return null}(e,a.x,a.y))}if(!s&&o?.closest("p")?.querySelector("[data-popmelt-empty-paragraph]"))return ye(o.closest("p"));if(!s||!f(s.parentElement))return null;let c=s.parentElement;if(he(c))return null;for(;!n&&c.parentElement&&c!==i.body;){let e=l(c).getComputedStyle(c).display,t="inline-block"===e&&1===c.childNodes.length&&c.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==e&&"contents"!==e&&!t)break;let r=c.parentElement;if(he(r))break;if(Array.from(r.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.nodeValue?.trim())){c=r;continue}let o=l(r).getComputedStyle(r).display,n="inline-block"===o&&1===r.childNodes.length&&r.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==o&&"contents"!==o&&!n)break;c=r}let p=s.parentElement?.closest("p"),u=s.parentElement?.closest('button, input, textarea, select, [role="button"]');if(p&&(!u||!p.contains(u)))return ye(p,s);let h=c.tagName.toLowerCase();if("script"===h||"style"===h||"textarea"===h||"input"===h)return null;let m=be(c).filter(e=>!n||e.textNode===s),g=m.map(e=>e.originalText).join("");if(!g.trim())return null;let y=we(c,s);if(!y)return null;let w=l(c).getComputedStyle(c),b=Ne(m,c,w,n),{textRect:v,boundaryRect:x,boundaryRects:N,flowRect:S,firstLineIndent:E}=b;if(v.width<=0||v.height<=0)return null;let T=parseFloat(w.fontSize)||12,k="nowrap"!==w.whiteSpace&&"pre"!==w.whiteSpace&&(n?N.length>1:function(e){let t=e.ownerDocument.createRange();t.selectNodeContents(e);let r=Array.from(t.getClientRects()).filter(e=>e.width>0&&e.height>0).length;return t.detach?.(),r>1}(s)||"inline"!==w.display);return{textNode:s,targetElement:c,textNodePath:y,segments:m,originalText:g,rect:v,boundaryRect:x,boundaryRects:N,flowRect:S,firstLineIndent:E,styles:w,fontSize:T,wrapsText:k,singleTextNode:n}})}function ye(e,t){let r=be(e),o=r.find(e=>e.textNode===t)??r[0];if(!o)return null;let n=l(e).getComputedStyle(e),{textRect:i,...a}=Ne(r,e,n);return{...o,targetElement:e,segments:r,originalText:r.map(e=>e.originalText).join(""),styles:n,rect:i,...a,fontSize:parseFloat(n.fontSize)||12,wrapsText:"nowrap"!==n.whiteSpace&&"pre"!==n.whiteSpace}}function we(e,t){let r=[],o=t;for(;o&&o!==e;){let e=o.parentNode;if(!e)return null;r.unshift(Array.prototype.indexOf.call(e.childNodes,o)),o=e}return o===e?r:null}function be(e){let t=[],r=o=>{if(o.nodeType===Node.TEXT_NODE){let r=o,n=we(e,r);return void(n&&t.push({textNode:r,textNodePath:n,originalText:r.nodeValue??""}))}if(o.nodeType!==Node.ELEMENT_NODE&&o!==e)return;let n=o.tagName?.toLowerCase();"script"===n||"style"===n||o.childNodes.forEach(r)};return e.childNodes.forEach(r),t}function ve(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}function xe(e){let t=e.getBoundingClientRect(),r=l(e).getComputedStyle(e),o=(parseFloat(r.borderLeftWidth)||0)+(parseFloat(r.paddingLeft)||0),n=(parseFloat(r.borderRightWidth)||0)+(parseFloat(r.paddingRight)||0),i=(parseFloat(r.borderTopWidth)||0)+(parseFloat(r.paddingTop)||0),a=(parseFloat(r.borderBottomWidth)||0)+(parseFloat(r.paddingBottom)||0);return c({left:t.left+o,top:t.top+i,width:Math.max(0,t.width-o-n),height:Math.max(0,t.height-i-a)},e.ownerDocument)}function Ne(e,t,r,o=!1){let n=ve(s(t)),i=function(e){let t=[];for(let r of e){if(!r.textNode.isConnected||!r.originalText.trim())continue;let e=r.textNode.ownerDocument.createRange();e.selectNodeContents(r.textNode),t.push(...Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>ve(c(e,r.textNode.ownerDocument)))),e.detach?.()}return ue(t)}(e),a=e[0]?.textNode?function(e,t){let r=e.ownerDocument.createRange();r.selectNodeContents(e);let o=c(r.getBoundingClientRect(),e.ownerDocument);if(r.detach?.(),o.width>0&&o.height>0)return{left:o.left,top:o.top,width:o.width,height:o.height};let n=s(t);return{left:n.left,top:n.top,width:n.width,height:n.height}}(e[0].textNode,t):n,l=i.length>0?i:[a];return function({display:e,singleTextNode:t=!1,fragmentRects:r,elementRect:o,parentContentRect:n}){let i=ue(r),a=pe(i,o);if(!("inline"===e&&i.length>1&&n&&n.width>0))return{textRect:a,boundaryRect:t?a:o,boundaryRects:t?i:[o],firstLineIndent:0};let l=i[0],s={left:n.left,top:l.top,width:n.width,height:Math.max(a.height,fe(a)-l.top)},c=Math.max(0,Math.min(s.width,l.left-s.left));return{textRect:a,boundaryRect:pe(i,o),boundaryRects:i,flowRect:s,firstLineIndent:c}}({display:r.display,singleTextNode:o,fragmentRects:l,elementRect:n,parentContentRect:t.parentElement?xe(t.parentElement):void 0})}function Se(e,t,r){if(t===r||0===e.length)return[];let o=0;for(;o<t.length&&o<r.length&&t[o]===r[o];)o+=1;let n=0;for(;n<t.length-o&&n<r.length-o&&t[t.length-1-n]===r[r.length-1-n];)n+=1;let i=o,a=t.length-n,l=r.slice(o,r.length-n),s=0,c=!1;return e.flatMap((t,r)=>{let o=s,n=o+t.originalText.length;s=n;let d=i===a;if(!(d&&(i>=o&&i<n||r===e.length-1&&i===n))&&!(!d&&n>i&&o<a))return[];let f=Math.max(0,Math.min(t.originalText.length,i-o)),p=Math.max(0,Math.min(t.originalText.length,a-o)),u=t.originalText.slice(0,f);return c||(u+=l,c=!0),u+=t.originalText.slice(p),u===t.originalText?[]:[{segment:t,modifiedText:u}]})}function Ee(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}function Te(e,t){return e&&t?Ee(e,t):e===t}function ke(e,t){return e.length===t.length&&e.every((e,r)=>Ee(e,t[r]))}var Ae=new WeakMap;function Me(e){let t=e.closest("p");return t?Ae.get(t):void 0}function Pe(e){let t=be(e);return{root:e,rows:[e],runs:t.map(e=>[e.textNode]),paths:t.map(e=>e.textNodePath),undo:[]}}function Ce(e){let t=Ae.get(e)??Pe(e),r=t.runs.map((e,r)=>({path:t.paths[r],parts:e.map(e=>e.data)}));return{group:t,layout:r}}function Re(e,t,r){let o=t.splitText(r),n=o,i=t.parentElement;for(;;){let r=i,o=i.cloneNode(!1);for(o.removeAttribute("id"),o.removeAttribute("data-pm");n.nextSibling;)o.appendChild(n.nextSibling);if(o.insertBefore(n,o.firstChild),r.after(o),e.undo.push(e=>{if(!e?.has(r)||r.contains(t))for(;o.firstChild;)r.appendChild(o.firstChild);o.remove()}),"P"===i.tagName){o.dataset.popmeltParagraphContinuation="",e.rows.splice(e.rows.indexOf(r)+1,0,o),Ae.set(o,e);break}n=o,i=r.parentElement}return o}function De(e,t){let r=Ae.get(e);if(r&&r.root===e){for(let e of r.rows)e.querySelector("br[data-popmelt-empty-paragraph]")?.remove(),Ae.delete(e);for(let e of r.undo.reverse())e(t)}}function je(e,t){if("P"!==e.tagName)return;let r=Ae.get(e);if((!r||r.root===e)&&(r&&!r.runs.every((e,r)=>e.length===t[r]?.parts.length)&&(De(e),r=void 0),r??(r=Pe(e)),r.paths.length===t.length&&t.every((e,t)=>e.parts.length&&e.path.join(".")===r.paths[t].join(".")))){if(!Ae.has(e)){Ae.set(e,r);for(let e=0;e<t.length;e++){let o=r.runs[e],n=o[0],i=n.data;r.undo.push(e=>{e?.has(n)||(n.data=i);for(let e of o.slice(1))e.remove()});let a=t[e].parts;for(let e=1;e<a.length;e++){let t=o[e-1];o.push(Re(r,t,t.length))}}}r.runs.forEach((e,r)=>e.forEach((e,o)=>{let n=t[r].parts[o];e.data!==n&&(e.data=n)}));for(let e of r.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 r.lastLayout=t,r}}var Oe=new WeakMap,Ve=new WeakMap;function Fe(e,t){if(r(t))for(let[r,o]of Ve.get(e)??[])o.value?t.style.setProperty(r,o.value,o.priority):t.style.removeProperty(r)}function We(e,t){Oe.set(e,new Set(t))}function Le(e){Oe.delete(e)}function ze(e,t){return r(e)&&(Oe.get(e)?.has(t)??!1)}function Ie(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 He(e){return e.changes.map((e,t)=>({change:e,index:t})).sort((e,t)=>Ie(e.change)-Ie(t.change)||e.index-t.index).map(({change:e})=>e)}function Ue(e,t,o){if(r(e)){let r=Ve.get(e);r||(r=new Map,Ve.set(e,r)),r.has(t)||r.set(t,{value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}),e.style.setProperty(t,o,"important")}}function $e(e,t,o,n=!1){if(r(e)){let r=n?Ve.get(e)?.get(t):void 0;r?.value?e.style.setProperty(t,r.value,r.priority):e.style.removeProperty(t),Ve.get(e)?.delete(t)}}function _e(t){let r=e(t.selector);if(!r&&t.durableSelector&&(r=e(t.durableSelector),r)){let e=t.selector.match(/\[data-pm="([^"]+)"\]/)?.[1];e&&r.setAttribute("data-pm",e)}return r}function qe(e){for(let t of e){let e=_e(t);if(e)for(let r of He(t))ze(e,r.property)||Ue(e,r.property,r.modified)}}function Be(t,r=!1){for(let o of t){let t=e(o.selector);if(t)for(let e of o.changes)ze(t,e.property)||$e(t,e.property,e.original,r)}}function Je(t){let r=e(t.selector);if(!r&&t.durableSelector&&(r=e(t.durableSelector),r)){let e=t.selector.match(/\[data-pm="([^"]+)"\]/)?.[1];e&&r.setAttribute("data-pm",e)}return r}function Ge(e,t){let r=e;for(let e of t)r=r?.childNodes[e]??null;return r?.nodeType===Node.TEXT_NODE?r:null}function Xe(e){for(let t of e){if(t.captured)continue;let e=Je(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){let r=e;if(!Me(r)&&JSON.stringify(Ce(r).layout)!==JSON.stringify(t.paragraphs.before))continue;je(r,t.paragraphs.after);continue}let r=Ge(e,t.textNodePath);r&&r.nodeValue===t.original&&r.nodeValue!==t.modified&&(r.nodeValue=t.modified)}}function Ke(e){for(let t of[...e].reverse()){if(t.captured)continue;let e=Je(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){De(e),t.paragraphs.before.some(e=>e.parts.length>1)&&je(e,t.paragraphs.before);continue}let r=Ge(e,t.textNodePath);r&&r.nodeValue===t.modified&&r.nodeValue!==t.original&&(r.nodeValue=t.original)}}function Qe(e,t){let r=new Set(t);Ke(e.filter(e=>!(r.has(e)||e.paragraphs&&t.some(t=>t.paragraphs&&t.selector===e.selector&&!t.captured)))),Xe(t)}function Ze(t,r){if(!t)return null;let o=e(t);if(!o&&r&&(o=e(r),o)){let e=t.match(/\[data-pm="([^"]+)"\]/)?.[1];e&&o.setAttribute("data-pm",e)}return o}function Ye(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(e=>e.removeAttribute("data-pm"))}function et(e,t){let r=t.match(/\[data-pm="([^"]+)"\]/)?.[1];r&&e.setAttribute("data-pm",r)}function tt(e,t,r){let o=Array.from(e.children).filter(e=>e!==t),n=Math.max(0,Math.min(r,o.length));e.insertBefore(t,o[n]??null)}function rt(e){for(let t of e){if(t.sampledTree){se(t,document);continue}let e=Ze(t.targetParentSelector,t.targetParentDurableSelector);if(!e)continue;if("move"===t.operation){let r=Ze(t.selector,t.durableSelector);if(!r||r===e||r.contains(e))continue;tt(e,r,t.targetIndex);continue}if(Ze(t.selector,t.durableSelector))continue;let r=Ze(t.sourceSelector,t.sourceDurableSelector);if(!r)continue;let o=r.cloneNode(!0);o instanceof Element&&(Ye(o),et(o,t.selector),tt(e,o,t.targetIndex))}}function ot(e,t){let r=0;for(;r<e.length&&r<t.length;){let o=e[r],n=t[r];if(o!==n&&(o.id!==n.id||JSON.stringify(o)!==JSON.stringify(n)))break;r++}return nt(e.slice(r)),t.filter((e,t)=>t>=r||!!e.sampledTree)}function nt(e){for(let t of[...e].reverse()){if(t.sampledTree){ce(t,document);continue}if("copy"===t.operation){Ze(t.selector,t.durableSelector)?.remove();continue}let e=Ze(t.selector,t.durableSelector),r=Ze(t.originalParentSelector,t.originalParentDurableSelector);!e||!r||e===r||e.contains(r)||tt(r,e,t.originalIndex??r.children.length)}}export{Le as A,Ue as B,_e as C,qe as D,Be as E,Je as F,Ge as G,Xe as H,Ke as I,Qe as J,rt as K,ot as L,nt as M,v as a,te as b,re as c,oe as d,ne as e,ae as f,le as g,se as h,ce as i,pe as j,ue as k,he as l,me as m,ge as n,ye as o,Ne as p,Se as q,Ee as r,Te as s,ke as t,Me as u,Ce as v,De as w,je as x,Fe as y,We as z};
|
|
1
|
+
"use client";import{d as e,h as t}from"./chunk-VXRRHXUP.mjs";import{c as r}from"./chunk-WP2SHSCG.mjs";import{f as o,e as n}from"./chunk-AAMUU2QA.mjs";import{u as i,l as a,f as l,d as s,c,e as d,g as f}from"./chunk-LH7HKUCK.mjs";var p=("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(" "),u={"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"},h=["top","right","bottom","left"],m=[...h,"height","width","clip"],g=["width","height","max-width","max-height","object-fit","object-position"],y=["background-size","background-position","background-repeat","background-origin","background-clip"],w=new Set([...[...p,...Object.keys(u),...h,...y,...g].map(e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())),"borderColor","borderRadius","fill","stroke","strokeWidth","strokeDasharray","strokeDashoffset"]),b=[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 v(e){let t=typeof TextEncoder<"u"?Array.from((new TextEncoder).encode(e)):function(e){let t=[];for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);o<128?t.push(o):o<2048?t.push(192|o>>6,128|63&o):t.push(224|o>>12,128|o>>6&63,128|63&o)}return t}(e),r=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(let e=7;e>=0;e--)t.push(r/Math.pow(2,8*e)&255);let o=1779033703,n=3144134277,i=1013904242,a=2773480762,l=1359893119,s=2600822924,c=528734635,d=1541459225,f=new Array(64);for(let e=0;e<t.length;e+=64){for(let r=0;r<16;r++){let o=e+4*r;f[r]=(t[o]<<24|t[o+1]<<16|t[o+2]<<8|t[o+3])>>>0}for(let e=16;e<64;e++){let t=x(f[e-15],7)^x(f[e-15],18)^f[e-15]>>>3,r=x(f[e-2],17)^x(f[e-2],19)^f[e-2]>>>10;f[e]=f[e-16]+t+f[e-7]+r>>>0}let r=o,p=n,u=i,h=a,m=l,g=s,y=c,w=d;for(let e=0;e<64;e++){let t=w+(x(m,6)^x(m,11)^x(m,25))+(m&g^~m&y)+b[e]+f[e]>>>0,o=r&p^r&u^p&u;w=y,y=g,g=m,m=h+t>>>0,h=u,u=p,p=r,r=t+((x(r,2)^x(r,13)^x(r,22))+o>>>0)>>>0}o=o+r>>>0,n=n+p>>>0,i=i+u>>>0,a=a+h>>>0,l=l+m>>>0,s=s+g>>>0,c=c+y>>>0,d=d+w>>>0}return[o,n,i,a,l,s,c,d].map(e=>e.toString(16).padStart(8,"0")).join("")}function x(e,t){return e>>>t|e<<32-t}var N=/^[a-f0-9]{64}$/,S=/^[a-zA-Z0-9 _-]{0,64}$/,E=3145728,T=new Map,k=new Map,A=new Map;function M(e){return e&&"string"==typeof e.version&&N.test(e.version)&&"string"==typeof e.variant&&S.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}function P(e,t){return new URL(n(e.location.pathname)+"_popmelt/samples/"+t+".json",e.location.origin).href}async function R(e,t){let r=T.get(t);if(r)return r;let o=P(e,t),n=k.get(o);if(n)return n;let i=(async()=>{let r=new URL("/_popmelt/samples/"+t+".json",e.location.origin).href,n=await(globalThis.caches?.open("popmelt-component-samples-v1").catch(()=>{})),i=await(n?.match(r)),a=i??await fetch(o,{redirect:"error"});if(!a.ok||Number(a.headers.get("content-length"))>E)throw Error();let l=a.body?.getReader();if(!l)throw Error();let s=0,c="",d=new TextDecoder("utf-8",{fatal:!0});for(;;){let{done:e,value:t}=await l.read();if(e)break;if(s+=t.length,s>E)throw await l.cancel(),Error();c+=d.decode(t,{stream:!0})}if(c+=d.decode(),(globalThis.crypto?.subtle?Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(c))),e=>e.toString(16).padStart(2,"0")).join(""):v(c))!==t)throw Error();let f=JSON.parse(c);if("string"!=typeof f.script||"string"!=typeof f.css)throw Error();return i||await(n?.put(r,new Response(c)).catch(()=>{})),T.size>=8&&T.delete(T.keys().next().value),T.set(t,f),A.delete(o),f})().finally(()=>k.delete(o));return k.set(o,i),i}function C(e){return"string"==typeof e&&e.length<=384&&!/[;{}\\]|(?:url|var|attr|env)\s*\(/i.test(e)}function D(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)&&C(t.easing))&&e.frames.every((t,r)=>t&&Number.isFinite(t.offset)&&t.offset>=(e.frames[r-1]?.offset??0)&&t.offset<=1&&C(t.easing)&&Object.entries(t).every(([e,t])=>"offset"===e||"easing"===e||w.has(e)&&C(t)))})}var j=new WeakMap,O=new WeakMap;function V(e,t){for(let{frames:r,timing:o,paused:n,currentTime:i}of t){let t=e.animate(r,{id:"popmelt-sampled-motion",duration:o.duration,delay:o.delay,endDelay:o.endDelay,direction:o.direction,fill:o.fill,easing:o.easing,iterations:"infinite"===o.iterations?1/0:o.iterations});void 0!==i&&(t.currentTime=i),n&&t.pause()}}var F=new WeakMap;function L(e){let t=e.currentSrc||e.src;if(!e.complete||!e.naturalWidth||!e.naturalHeight)throw new Error("The image has not loaded.");let r=F.get(e);if(r?.src===t)return r.pixels;let o=e.ownerDocument.createElement("canvas"),n=Math.min(1,1024/Math.max(e.naturalWidth,e.naturalHeight));for(;;){o.width=Math.max(1,Math.round(e.naturalWidth*n)),o.height=Math.max(1,Math.round(e.naturalHeight*n));let r,i=o.getContext("2d");if(!i)throw new Error("The browser cannot capture this image.");i.drawImage(e,0,0,o.width,o.height);try{r=o.width*o.height<=65536?o.toDataURL("image/png"):"",(!r||r.length>24576)&&(r=o.toDataURL("image/webp",.9))}catch{throw new Error("The image host does not allow its pixels to be copied.")}if(W(r))return F.set(e,{src:t,pixels:r}),e.addEventListener("load",()=>F.delete(e),{once:!0}),r;if(1===o.width&&1===o.height)throw new Error("The browser cannot capture this image.");n/=2}}function W(e){return"string"==typeof e&&e.length<=24576&&/^data:image\/(?:png|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(e)}var z=new WeakMap;var I="http://www.w3.org/2000/svg",H=new Set("svg g path rect circle ellipse line polygon polyline defs linearGradient radialGradient stop clipPath title desc".split(" ")),U=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(" ")),$=new Set("fill stroke stop-color".split(" ")),_="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(" "),q=/^url\(["']?#([\w.:-]+)["']?\)$/,B=/^[\w.:-]{1,128}$/;function J(e,t){return"id"===e?B.test(t):"aria-label"===e?t.length<=512:"aria-hidden"===e?"true"===t||"false"===t:U.has(e)?/^[\w\s.%+,()-]*$/.test(t):q.test(t)?$.has(e)||"clip-path"===e:"clip-path"===e?"none"===t:$.has(e)?/^(?:[a-z]+|#[a-f\d]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([a-z\d.\s,%/+-]+\))$/i.test(t):_.includes(e)&&/^[a-z\d.\s,%+-]+$/i.test(t)}var G=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 r=q.exec(t)?.[1];return r?(this.references.add(r),"url(#"+this.prefix+r+")"):t}complete(){return[...this.references].every(e=>this.ids.has(e))}};var X=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(" ")),K={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"},Z=new Set(["div","article","section","aside","figure"]),Q=65536,Y=new Set(["width","height","max-width","max-height","min-width","min-height","transform","transform-origin","grid-template-columns","grid-template-rows",...h]);function ee(e,t){let r=e.getBoundingClientRect(),o=(e,o)=>{let n=t.getPropertyValue(e);return n.endsWith("px")?parseFloat(n)+("border-box"===t.boxSizing?0:o.reduce((e,r)=>e+(parseFloat(t.getPropertyValue("padding-"+r))||0)+(parseFloat(t.getPropertyValue("border-"+r+"-width"))||0),0)):r[e]};return{previewWidth:o("width",["left","right"]),previewHeight:o("height",["top","bottom"])}}function te(e){return e.hasAttribute("data-popmelt-sample-version")||("http://www.w3.org/1999/xhtml"===e.namespaceURI&&X.has(e.localName)||e.namespaceURI===I&&"svg"===e.localName)&&!e.shadowRoot}function re(e){let t=e.ownerDocument.defaultView,r=0;let o=function e(o,n,i,a){if(!t)throw new Error("The source page is no longer available.");if(n>16||++r>256)throw new Error("This subtree is too large to place in one draft.");let l=i?void 0:function(e){let t=e.getAttribute("data-popmelt-sample-version");if(null===t)return;let r={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(!M(r))throw Error("This component has no valid sample revision.");if(!T.has(t)){let r=P(e.ownerDocument,t);throw(A.get(r)??0)>Date.now()?Error("The sampled revision is unavailable."):(k.has(r)||R(e.ownerDocument,t).catch(()=>A.set(r,Date.now()+5e3)).finally(()=>{e.ownerDocument.dispatchEvent(new Event("popmelt-sample-ready"))}),Error("Loading this component for sampling."))}return r}(o),s=i??(l||o.namespaceURI!==I||"svg"!==o.localName?void 0:new G);if(s?o.namespaceURI!==I||!H.has(o.localName):!te(o))throw new Error(`<${o.localName}> content cannot be placed as an HTML draft.`);let c=t.getComputedStyle(o),d=o.computedStyleMap?.(),f=e=>d?.get(e)?.toString()||c.getPropertyValue(e),m=i?{}:Object.fromEntries(p.map(e=>[e,c.getPropertyValue(e)]).filter(([,e])=>!!e));for(let[e,t]of Object.entries(i?{}:u)){let r=Y.has(e)?f(e):c.getPropertyValue(e);r&&r!==t&&(m[e]=r)}let b,v=i?void 0:function(e,t){let r=/^url\("(data:image\/[^"]+)"\)$/.exec(t)?.[1];if(!r)return;if(W(r))return r;let o=z.get(e);if(o?.src===r){if(o.pixels)return o.pixels;if(o.failed)throw Error("This background image could not be sampled.")}else{let t={src:r};z.set(e,t);let o=e.ownerDocument.createElement("img");o.src=r,o.decode().then(()=>{t.pixels=L(o)}).catch(()=>{t.failed=!0}).finally(()=>e.ownerDocument.dispatchEvent(new Event("popmelt-sample-ready")))}throw Error("Loading this image for sampling.")}(o,c.backgroundImage);if(v)for(let e of y)m[e]=c.getPropertyValue(e);if(s&&(b=function(e,t,r){let o={};for(let t of e.attributes){let{name:e,value:r}=t;if("href"===e||"href"===t.localName)throw new Error("This SVG references other artwork.");(U.has(e)||"id"===e||"aria-label"===e||"aria-hidden"===e)&&(o[e]=r)}for(let r of["filter","mask-image","marker-start","marker-mid","marker-end"]){let o=t.getPropertyValue(r)||e.getAttribute(r);if(o&&"none"!==o)throw new Error("This SVG uses an unsupported effect.")}if("rect"===e.localName||"svg"===e.localName)for(let r of["width","height"]){let n=e.computedStyleMap?.().get(r)?.toString()||t.getPropertyValue(r);n&&"auto"!==n&&(o[r]=n)}for(let r of _){let n=t.getPropertyValue(r)||e.getAttribute(r);n&&(o[r]=n)}for(let[e,t]of Object.entries(o))if(!J(e,t)||null===r.value(e,t))throw new Error("This SVG uses an unsupported paint or shape.");return o}(o,c,s)),!l&&"img"===o.localName){let e=o;b={src:L(e),alt:e.alt}}if(!l&&!i&&("img"===o.localName||s))for(let e of g){let t=c.getPropertyValue(e);t&&(!Y.has(e)||"img"===o.localName&&"auto"===f(e))&&(m[e]=t)}if(!i&&("relative"===c.position||n>0&&"absolute"===c.position)){m.position=c.position;for(let e of h){let t=f(e);t&&"auto"!==t&&(m[e]=t)}"absolute"===m.position&&c.clip&&"auto"!==c.clip&&(m.clip=c.clip)}if(l)return{tag:Z.has(o.localName)?o.localName:"div",style:m,children:[],component:l,backgroundStill:v,...ee(o,c)};let x=function(e){let t=[];for(let r of e.getAnimations?.()??[]){if(!("animationName"in r)&&"popmelt-sampled-motion"!==r.id)continue;let o=r.effect;if(o?.target!==e||o.pseudoElement||"finished"===r.playState)continue;let n=o.getTiming(),i=o.getKeyframes().map(e=>{let t={offset:e.computedOffset,easing:e.easing??"linear"};for(let[r,o]of Object.entries(e))w.has(r)&&C(o)&&(t[r]=o);return t});i.some(e=>Object.keys(e).length>2)&&t.push({frames:i,currentTime:"number"==typeof r.currentTime?r.currentTime:void 0,paused:"paused"===r.playState,timing:{duration:Number(n.duration),delay:n.delay??0,endDelay:n.endDelay??0,iterations:n.iterations===1/0?"infinite":n.iterations??1,direction:n.direction??"normal",fill:n.fill??"none",easing:n.easing??"linear"}})}if(t.length){if(!D(t))throw Error("This animation is too complex to sample.");return t}}(o),N=new Set;if(a)for(let e of a.properties){let t=c.getPropertyValue(e),r=o.style.getPropertyValue(e)||(s?o.getAttribute(e):null);t!==a.css.getPropertyValue(e)||r&&"inherit"!==r?t&&Object.hasOwn(u,e)&&(m[e]=t):(N.add(e),e in m&&(m[e]="inherit"),b&&e in b&&(b[e]="inherit"))}for(let e of x??[])for(let t of e.frames)for(let e of Object.keys(t)){let t=K[e];t&&N.add(t)}let S=N.size?{css:c,properties:N}:void 0,E=[];for(let t of o.childNodes){if(3===t.nodeType&&t.textContent&&E.push(t.textContent),1!==t.nodeType)continue;let r=t;r.matches("[data-devtools],[data-popmelt-root],[data-popmelt-shadow-host]")||"picture"===o.localName&&"source"===r.localName||E.push(e(r,n+1,s,S))}if(s&&!i&&!s.complete())throw new Error("This SVG references artwork outside the sample.");return i?{tag:o.localName,style:m,children:E,attributes:b,motion:x}:{tag:o.localName,motion:x,backgroundStill:v,attributes:b,style:m,children:E,..."img"===o.localName&&{imageSourceHash:le(o)},...0===n?ee(o,c):{}}}(e,0);if(JSON.stringify(o).length>Q)throw new Error("This subtree is too large to place in one draft.");return o}function oe(e,t,r="draft"){let o=0,n=0,i=!1;let a=function e(a,l,s){if(!a||++o>256||l>16||!(s?H.has(a.tag):X.has(a.tag)||"svg"===a.tag)||!Array.isArray(a.children)||!a.style||"object"!=typeof a.style)return null;let c=s??("svg"===a.tag?new G:void 0),d=c?t.createElementNS(I,a.tag):t.createElement(a.tag),f=a.attributes;if(void 0!==f){if(!f||"object"!=typeof f||Array.isArray(f))return null;for(let[e,t]of Object.entries(f))if("string"!=typeof t||(n+=e.length+t.length)>Q)return null}if(c){if(!f||!function(e,t,r){for(let[o,n]of Object.entries(t)){if("string"!=typeof n||!J(o,n))return!1;let t=r.value(o,n);if(null===t)return!1;e.setAttribute(o,t),_.includes(o)&&e.style.setProperty(o,t)}return!0}(d,f,c))return null}else if("img"===a.tag){if(!f||!W(f.src)||"string"!=typeof f.alt||2!==Object.keys(f).length||a.children.length)return null;d.setAttribute("alt",f.alt),d.setAttribute("src",f.src)}else if(f)return null;if(void 0!==a.backgroundStill){if(!W(a.backgroundStill)||(n+=a.backgroundStill.length)>Q)return null;d.style.backgroundImage='url("'+a.backgroundStill+'")'}"button"===d.localName&&d.setAttribute("type","button");let h=a.style.position;if(h&&"relative"!==h&&!(l>0&&"absolute"===h))return null;"absolute"===h&&(i=!0);for(let[e,t]of Object.entries(a.style)){if(!p.includes(e)&&!Object.hasOwn(u,e)&&(!a.backgroundStill||!y.includes(e))&&(!h||"position"!==e&&!m.includes(e))&&("img"!==a.tag&&"svg"!==a.tag||!g.includes(e))||"string"!=typeof t||t.length>1024||(n+=t.length+e.length)>Q)return null;d.style.setProperty(e,t)}if("preview"===r&&!s)for(let[e,t]of[["width",a.previewWidth],["height",a.previewHeight]])"number"!=typeof t||!Number.isFinite(t)||t<0||(d.style.boxSizing="border-box",d.style[e]=t+"px",d.style.setProperty("min-"+e,"0"),d.style.setProperty("max-"+e,"none"));if(void 0!==a.component){if(c||!Z.has(a.tag)||a.children.length||!M(a.component)||(n+=a.component.props?.length??0)>Q)return null;(0===l||!d.style.position)&&(d.style.width=Number.isFinite(a.previewWidth)?a.previewWidth+"px":"100%",d.style.height=Number.isFinite(a.previewHeight)?a.previewHeight+"px":"100%"),d.dataset.popmeltSampleVersion=a.component.version,d.dataset.popmeltSampleVariant=a.component.variant,void 0!==a.component.props&&(d.dataset.popmeltSampleProps=a.component.props),a.component.label&&d.setAttribute("aria-label",a.component.label),function(e,t){let r=e.ownerDocument,o=r.createElement("iframe");o.title=t.label||"Sampled component",o.setAttribute("sandbox","allow-scripts"),o.referrerPolicy="no-referrer",o.style.cssText="display:block;width:100%;height:100%;border:0";let n=t.dark?"dark":"light";o.style.colorScheme=n,e.append(o),R(r,t.version).then(({script:e,css:i})=>{let a=r.createElement("div");a.id="root",a.dataset.variant=t.variant,void 0!==t.props&&(a.dataset.props=t.props),o.addEventListener("load",()=>{!1===r.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&o.animate?.([{opacity:0},{opacity:1}],{duration:160,easing:"ease-out"})},{once:!0}),o.srcdoc='<!doctype html><html class="'+(t.dark?"dark":"")+'" style="color-scheme:'+n+'"><head><meta name="color-scheme" content="'+n+"\"><meta charset=\"utf-8\"><meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; font-src data:; base-uri 'none'; form-action 'none'\"><style>html,body,#root{margin:0;width:100%;height:100%;overflow:hidden}*,*::before,*::after{box-sizing:border-box}"+i.replace(/<\/style/gi,"<\\/style")+"</style></head><body>"+a.outerHTML+"<script>"+e.replace(/<\/script/gi,"<\\/script")+"<\/script></body></html>"}).catch(()=>o.replaceWith(r.createTextNode("Sampled revision unavailable")))}(d,a.component)}for(let r of a.children)if("string"==typeof r){if((n+=r.length)>Q)return null;d.appendChild(t.createTextNode(r))}else{let t=e(r,l+1,c);if(!t)return null;d.appendChild(t)}if(c&&!s&&!c.complete())return null;if(void 0!==a.motion){if(!D(a.motion)||(n+=JSON.stringify(a.motion).length)>Q)return null;try{!function(e,t){if(!e.animate)return;let r=e.ownerDocument,o=O.get(r);if(!o&&r.defaultView?.matchMedia){let e=r.defaultView.matchMedia("(prefers-reduced-motion: reduce)"),t=new Set;e.addEventListener("change",()=>{for(let r of t){let o=r.deref();if(o?.isConnected){for(let e of o.getAnimations())"popmelt-sampled-motion"===e.id&&e.cancel();e.matches||V(o,j.get(o))}else t.delete(r)}}),o={query:e,elements:t},O.set(r,o)}if(o){if(o.elements.size%32==0)for(let e of o.elements)e.deref()||o.elements.delete(e);if(j.set(e,t),o.elements.add(new WeakRef(e)),o.query.matches)return}V(e,t)}(d,a.motion)}catch{return null}}return d}(e,0);return a&&i&&!a.style.position&&(a.style.position="relative"),a}function ne(e){return`[data-pm="placed-${e}"]`}var ie=new Set("main article section aside div ul ol body header footer nav".split(" "));function ae(e,t){return ie.has(e.localName)&&!e.closest("[data-devtools],[data-popmelt-shadow-host]")&&("li"!==t||["ul","ol"].includes(e.localName))}function le(e){let t=e.getAttribute("src")||e.getAttribute("srcset");return t?v(t):void 0}function se(e,t){if(!e.sampledTree||!function(e,t){return"copy"===e.operation&&/^[0-9a-f-]{36}$/.test(e.id)&&e.selector===ne(e.id)&&e.pathname===o(t.location?.pathname??"")}(e,t))return;let r=i([e.targetParentSelector],void 0,t);if("matched"!==r.status||r.element.querySelector(e.selector)||!ae(r.element,e.sampledTree.tag))return;let n=null;if(e.referenceSelector){let o=i([e.referenceSelector],void 0,t);if("matched"!==o.status||o.element.parentElement!==r.element)return;n="before"===e.placement?o.element:o.element.nextSibling}let a=oe(e.sampledTree,t);if(a)if(a.dataset.pm="placed-"+e.id,a.dataset.popmeltPlacement=e.id,["ul","ol"].includes(r.element.localName)&&"li"!==a.localName){let o=t.createElement("li");o.dataset.popmeltPlacementItem=e.id,o.append(a),r.element.insertBefore(o,n)}else r.element.insertBefore(a,n)}function ce(e,t){if(!/^[0-9a-f-]{36}$/.test(e.id)||e.selector!==ne(e.id))return;let r=e.selector+`[data-popmelt-placement="${e.id}"]`,o=e.targetParentSelector.includes(" >>> ")||e.targetParentSelector.startsWith("@frame(")?a(e.targetParentSelector,t)?.querySelector(r):a(r,t);o?.parentElement?.getAttribute("data-popmelt-placement-item")===e.id?o.parentElement.remove():o?.remove()}function de(e){return e.left+e.width}function fe(e){return e.top+e.height}function pe(e,t){if(0===e.length)return t;let r=Math.min(...e.map(e=>e.left)),o=Math.min(...e.map(e=>e.top));return{left:r,top:o,width:Math.max(...e.map(de))-r,height:Math.max(...e.map(fe))-o}}function ue(e){let t=[...e].sort((e,t)=>e.top-t.top||e.left-t.left),r=[];for(let e of t){let t=e.top+e.height/2,o=r.find(r=>{let o=r.top+r.height/2;return Math.abs(t-o)<=.4*Math.max(r.height,e.height)});if(!o){r.push({...e});continue}let n=Math.min(o.left,e.left),i=Math.min(o.top,e.top),a=Math.max(de(o),de(e)),l=Math.max(fe(o),fe(e));o.left=n,o.top=i,o.width=a-n,o.height=l-i}return r.sort((e,t)=>e.top-t.top||e.left-t.left)}function he(e){return!!e&&!!e.closest("#devtools-toolbar, #devtools-scrim, #devtools-text-input, [data-devtools], [data-popmelt-panel], [data-popmelt-shadow-host]")}function me(e,t,r){let o=e.caretPositionFromPoint?.(t,r);if(o?.offsetNode.nodeType===Node.TEXT_NODE)return{node:o.offsetNode,offset:o.offset};let n=e.caretRangeFromPoint?.(t,r);return n?.startContainer.nodeType===Node.TEXT_NODE?{node:n.startContainer,offset:n.startOffset}:null}function ge(e,r,o,n=!1){return function(e,t){if(!e)return t();let r=e.style.pointerEvents;e.style.pointerEvents="none";try{return t()}finally{e.style.pointerEvents=r}}(o,()=>{let o=t(e,r);if(!o||he(o))return null;let i=o?.ownerDocument??document,a=d(e,r,i),s=me(i,a.x,a.y)?.node??null;if(s&&!o.contains(s)&&(s=null),!s){let e=o;e&&!he(e)&&(s=function(e,t,r){let o=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.textContent?.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),n=o.nextNode();for(;n;){let i=n,a=e.ownerDocument.createRange();a.selectNodeContents(i);let l=Array.from(a.getClientRects());if(a.detach?.(),l.some(e=>t>=e.left&&t<=e.right&&r>=e.top&&r<=e.bottom))return i;n=o.nextNode()}return null}(e,a.x,a.y))}if(!s&&o?.closest("p")?.querySelector("[data-popmelt-empty-paragraph]"))return ye(o.closest("p"));if(!s||!f(s.parentElement))return null;let c=s.parentElement;if(he(c))return null;for(;!n&&c.parentElement&&c!==i.body;){let e=l(c).getComputedStyle(c).display,t="inline-block"===e&&1===c.childNodes.length&&c.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==e&&"contents"!==e&&!t)break;let r=c.parentElement;if(he(r))break;if(Array.from(r.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.nodeValue?.trim())){c=r;continue}let o=l(r).getComputedStyle(r).display,n="inline-block"===o&&1===r.childNodes.length&&r.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==o&&"contents"!==o&&!n)break;c=r}let p=s.parentElement?.closest("p"),u=s.parentElement?.closest('button, input, textarea, select, [role="button"]');if(p&&(!u||!p.contains(u)))return ye(p,s);let h=c.tagName.toLowerCase();if("script"===h||"style"===h||"textarea"===h||"input"===h)return null;let m=be(c).filter(e=>!n||e.textNode===s),g=m.map(e=>e.originalText).join("");if(!g.trim())return null;let y=we(c,s);if(!y)return null;let w=l(c).getComputedStyle(c),b=Ne(m,c,w,n),{textRect:v,boundaryRect:x,boundaryRects:N,flowRect:S,firstLineIndent:E}=b;if(v.width<=0||v.height<=0)return null;let T=parseFloat(w.fontSize)||12,k="nowrap"!==w.whiteSpace&&"pre"!==w.whiteSpace&&(n?N.length>1:function(e){let t=e.ownerDocument.createRange();t.selectNodeContents(e);let r=Array.from(t.getClientRects()).filter(e=>e.width>0&&e.height>0).length;return t.detach?.(),r>1}(s)||"inline"!==w.display);return{textNode:s,targetElement:c,textNodePath:y,segments:m,originalText:g,rect:v,boundaryRect:x,boundaryRects:N,flowRect:S,firstLineIndent:E,styles:w,fontSize:T,wrapsText:k,singleTextNode:n}})}function ye(e,t){let r=be(e),o=r.find(e=>e.textNode===t)??r[0];if(!o)return null;let n=l(e).getComputedStyle(e),{textRect:i,...a}=Ne(r,e,n);return{...o,targetElement:e,segments:r,originalText:r.map(e=>e.originalText).join(""),styles:n,rect:i,...a,fontSize:parseFloat(n.fontSize)||12,wrapsText:"nowrap"!==n.whiteSpace&&"pre"!==n.whiteSpace}}function we(e,t){let r=[],o=t;for(;o&&o!==e;){let e=o.parentNode;if(!e)return null;r.unshift(Array.prototype.indexOf.call(e.childNodes,o)),o=e}return o===e?r:null}function be(e){let t=[],r=o=>{if(o.nodeType===Node.TEXT_NODE){let r=o,n=we(e,r);return void(n&&t.push({textNode:r,textNodePath:n,originalText:r.nodeValue??""}))}if(o.nodeType!==Node.ELEMENT_NODE&&o!==e)return;let n=o.tagName?.toLowerCase();"script"===n||"style"===n||o.childNodes.forEach(r)};return e.childNodes.forEach(r),t}function ve(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}function xe(e){let t=e.getBoundingClientRect(),r=l(e).getComputedStyle(e),o=(parseFloat(r.borderLeftWidth)||0)+(parseFloat(r.paddingLeft)||0),n=(parseFloat(r.borderRightWidth)||0)+(parseFloat(r.paddingRight)||0),i=(parseFloat(r.borderTopWidth)||0)+(parseFloat(r.paddingTop)||0),a=(parseFloat(r.borderBottomWidth)||0)+(parseFloat(r.paddingBottom)||0);return c({left:t.left+o,top:t.top+i,width:Math.max(0,t.width-o-n),height:Math.max(0,t.height-i-a)},e.ownerDocument)}function Ne(e,t,r,o=!1){let n=ve(s(t)),i=function(e){let t=[];for(let r of e){if(!r.textNode.isConnected||!r.originalText.trim())continue;let e=r.textNode.ownerDocument.createRange();e.selectNodeContents(r.textNode),t.push(...Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>ve(c(e,r.textNode.ownerDocument)))),e.detach?.()}return ue(t)}(e),a=e[0]?.textNode?function(e,t){let r=e.ownerDocument.createRange();r.selectNodeContents(e);let o=c(r.getBoundingClientRect(),e.ownerDocument);if(r.detach?.(),o.width>0&&o.height>0)return{left:o.left,top:o.top,width:o.width,height:o.height};let n=s(t);return{left:n.left,top:n.top,width:n.width,height:n.height}}(e[0].textNode,t):n,l=i.length>0?i:[a];return function({display:e,singleTextNode:t=!1,fragmentRects:r,elementRect:o,parentContentRect:n}){let i=ue(r),a=pe(i,o);if(!("inline"===e&&i.length>1&&n&&n.width>0))return{textRect:a,boundaryRect:t?a:o,boundaryRects:t?i:[o],firstLineIndent:0};let l=i[0],s={left:n.left,top:l.top,width:n.width,height:Math.max(a.height,fe(a)-l.top)},c=Math.max(0,Math.min(s.width,l.left-s.left));return{textRect:a,boundaryRect:pe(i,o),boundaryRects:i,flowRect:s,firstLineIndent:c}}({display:r.display,singleTextNode:o,fragmentRects:l,elementRect:n,parentContentRect:t.parentElement?xe(t.parentElement):void 0})}function Se(e,t,r){if(t===r||0===e.length)return[];let o=0;for(;o<t.length&&o<r.length&&t[o]===r[o];)o+=1;let n=0;for(;n<t.length-o&&n<r.length-o&&t[t.length-1-n]===r[r.length-1-n];)n+=1;let i=o,a=t.length-n,l=r.slice(o,r.length-n),s=0,c=!1;return e.flatMap((t,r)=>{let o=s,n=o+t.originalText.length;s=n;let d=i===a;if(!(d&&(i>=o&&i<n||r===e.length-1&&i===n))&&!(!d&&n>i&&o<a))return[];let f=Math.max(0,Math.min(t.originalText.length,i-o)),p=Math.max(0,Math.min(t.originalText.length,a-o)),u=t.originalText.slice(0,f);return c||(u+=l,c=!0),u+=t.originalText.slice(p),u===t.originalText?[]:[{segment:t,modifiedText:u}]})}function Ee(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}function Te(e,t){return e&&t?Ee(e,t):e===t}function ke(e,t){return e.length===t.length&&e.every((e,r)=>Ee(e,t[r]))}var Ae=new WeakMap;function Me(e){let t=e.closest("p");return t?Ae.get(t):void 0}function Pe(e){let t=be(e);return{root:e,rows:[e],runs:t.map(e=>[e.textNode]),paths:t.map(e=>e.textNodePath),undo:[]}}function Re(e){let t=Ae.get(e)??Pe(e),r=t.runs.map((e,r)=>({path:t.paths[r],parts:e.map(e=>e.data)}));return{group:t,layout:r}}function Ce(e,t,r){let o=t.splitText(r),n=o,i=t.parentElement;for(;;){let r=i,o=i.cloneNode(!1);for(o.removeAttribute("id"),o.removeAttribute("data-pm");n.nextSibling;)o.appendChild(n.nextSibling);if(o.insertBefore(n,o.firstChild),r.after(o),e.undo.push(e=>{if(!e?.has(r)||r.contains(t))for(;o.firstChild;)r.appendChild(o.firstChild);o.remove()}),"P"===i.tagName){o.dataset.popmeltParagraphContinuation="",e.rows.splice(e.rows.indexOf(r)+1,0,o),Ae.set(o,e);break}n=o,i=r.parentElement}return o}function De(e,t){let r=Ae.get(e);if(r&&r.root===e){for(let e of r.rows)e.querySelector("br[data-popmelt-empty-paragraph]")?.remove(),Ae.delete(e);for(let e of r.undo.reverse())e(t)}}function je(e,t){if("P"!==e.tagName)return;let r=Ae.get(e);if((!r||r.root===e)&&(r&&!r.runs.every((e,r)=>e.length===t[r]?.parts.length)&&(De(e),r=void 0),r??(r=Pe(e)),r.paths.length===t.length&&t.every((e,t)=>e.parts.length&&e.path.join(".")===r.paths[t].join(".")))){if(!Ae.has(e)){Ae.set(e,r);for(let e=0;e<t.length;e++){let o=r.runs[e],n=o[0],i=n.data;r.undo.push(e=>{e?.has(n)||(n.data=i);for(let e of o.slice(1))e.remove()});let a=t[e].parts;for(let e=1;e<a.length;e++){let t=o[e-1];o.push(Ce(r,t,t.length))}}}r.runs.forEach((e,r)=>e.forEach((e,o)=>{let n=t[r].parts[o];e.data!==n&&(e.data=n)}));for(let e of r.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 r.lastLayout=t,r}}var Oe=new WeakMap,Ve=new WeakMap;function Fe(e,t){if(r(t))for(let[r,o]of Ve.get(e)??[])o.value?t.style.setProperty(r,o.value,o.priority):t.style.removeProperty(r)}function Le(e,t){Oe.set(e,new Set(t))}function We(e){Oe.delete(e)}function ze(e,t){return r(e)&&(Oe.get(e)?.has(t)??!1)}function Ie(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 He(e){return e.changes.map((e,t)=>({change:e,index:t})).sort((e,t)=>Ie(e.change)-Ie(t.change)||e.index-t.index).map(({change:e})=>e)}function Ue(e,t,o){if(r(e)){let r=Ve.get(e);r||(r=new Map,Ve.set(e,r)),r.has(t)||r.set(t,{value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}),e.style.setProperty(t,o,"important")}}function $e(e,t,o,n=!1){if(r(e)){let r=n?Ve.get(e)?.get(t):void 0;r?.value?e.style.setProperty(t,r.value,r.priority):e.style.removeProperty(t),Ve.get(e)?.delete(t)}}function _e(t){let r=e(t.selector);if(!r&&t.durableSelector&&(r=e(t.durableSelector),r)){let e=t.selector.match(/\[data-pm="([^"]+)"\]/)?.[1];e&&r.setAttribute("data-pm",e)}return r}function qe(e){for(let t of e){let e=_e(t);if(e)for(let r of He(t))ze(e,r.property)||Ue(e,r.property,r.modified)}}function Be(t,r=!1){for(let o of t){let t=e(o.selector);if(t)for(let e of o.changes)ze(t,e.property)||$e(t,e.property,e.original,r)}}function Je(t){let r=e(t.selector);if(!r&&t.durableSelector&&(r=e(t.durableSelector),r)){let e=t.selector.match(/\[data-pm="([^"]+)"\]/)?.[1];e&&r.setAttribute("data-pm",e)}return r}function Ge(e,t){let r=e;for(let e of t)r=r?.childNodes[e]??null;return r?.nodeType===Node.TEXT_NODE?r:null}function Xe(e){for(let t of e){if(t.captured)continue;let e=Je(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){let r=e;if(!Me(r)&&JSON.stringify(Re(r).layout)!==JSON.stringify(t.paragraphs.before))continue;je(r,t.paragraphs.after);continue}let r=Ge(e,t.textNodePath);r&&r.nodeValue===t.original&&r.nodeValue!==t.modified&&(r.nodeValue=t.modified)}}function Ke(e){for(let t of[...e].reverse()){if(t.captured)continue;let e=Je(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){De(e),t.paragraphs.before.some(e=>e.parts.length>1)&&je(e,t.paragraphs.before);continue}let r=Ge(e,t.textNodePath);r&&r.nodeValue===t.modified&&r.nodeValue!==t.original&&(r.nodeValue=t.original)}}function Ze(e,t){let r=new Set(t);Ke(e.filter(e=>!(r.has(e)||e.paragraphs&&t.some(t=>t.paragraphs&&t.selector===e.selector&&!t.captured)))),Xe(t)}function Qe(t,r){if(!t)return null;let o=e(t);if(!o&&r&&(o=e(r),o)){let e=t.match(/\[data-pm="([^"]+)"\]/)?.[1];e&&o.setAttribute("data-pm",e)}return o}function Ye(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(e=>e.removeAttribute("data-pm"))}function et(e,t){let r=t.match(/\[data-pm="([^"]+)"\]/)?.[1];r&&e.setAttribute("data-pm",r)}function tt(e,t,r){let o=Array.from(e.children).filter(e=>e!==t),n=Math.max(0,Math.min(r,o.length));e.insertBefore(t,o[n]??null)}function rt(e){for(let t of e){if(t.sampledTree){se(t,document);continue}let e=Qe(t.targetParentSelector,t.targetParentDurableSelector);if(!e)continue;if("move"===t.operation){let r=Qe(t.selector,t.durableSelector);if(!r||r===e||r.contains(e))continue;tt(e,r,t.targetIndex);continue}if(Qe(t.selector,t.durableSelector))continue;let r=Qe(t.sourceSelector,t.sourceDurableSelector);if(!r)continue;let o=r.cloneNode(!0);o instanceof Element&&(Ye(o),et(o,t.selector),tt(e,o,t.targetIndex))}}function ot(e,t){let r=0;for(;r<e.length&&r<t.length;){let o=e[r],n=t[r];if(o!==n&&(o.id!==n.id||JSON.stringify(o)!==JSON.stringify(n)))break;r++}return nt(e.slice(r)),t.filter((e,t)=>t>=r||!!e.sampledTree)}function nt(e){for(let t of[...e].reverse()){if(t.sampledTree){ce(t,document);continue}if("copy"===t.operation){Qe(t.selector,t.durableSelector)?.remove();continue}let e=Qe(t.selector,t.durableSelector),r=Qe(t.originalParentSelector,t.originalParentDurableSelector);!e||!r||e===r||e.contains(r)||tt(r,e,t.originalIndex??r.children.length)}}export{We as A,Ue as B,_e as C,qe as D,Be as E,Je as F,Ge as G,Xe as H,Ke as I,Ze as J,rt as K,ot as L,nt as M,v as a,te as b,re as c,oe as d,ne as e,ae as f,le as g,se as h,ce as i,pe as j,ue as k,he as l,me as m,ge as n,ye as o,Ne as p,Se as q,Ee as r,Te as s,ke as t,Me as u,Re as v,De as w,je as x,Fe as y,Le as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{e}from"./chunk-SOGN7S54.mjs";import{a as t}from"./chunk-
|
|
1
|
+
"use client";import{e}from"./chunk-SOGN7S54.mjs";import{a as t}from"./chunk-25EXQOPI.mjs";import{r}from"./chunk-LH7HKUCK.mjs";function l(e,t){let l=e.split(r()),n=t;try{for(let[e,t]of l.entries()){let r=n.querySelectorAll(t);if(1!==r.length)return null;let o=r[0];if(e===l.length-1)return o;if(!o.shadowRoot)return null;n=o.shadowRoot}}catch{}return null}function n(r,l){return r.targetBindings?.length?r.targetBindings.flatMap(({anchor:e})=>{if("opaque"===e.type){let r={adapter:e.adapter,key:e.key};return[{selector:t(r),subject:r}]}let r=e.structuralSelector??e.runtimeSelector;return e.pathname===l&&r?[{selector:r}]:[]}).slice(0,8):(r.elementIdentifiers??[]).flatMap(t=>{let r=e(t,l);return r?[{selector:r}]:[]}).slice(0,8)}export{l as a,n as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as i}from"./chunk-
|
|
1
|
+
"use client";import{a as i}from"./chunk-WJVRGXOS.mjs";import{a}from"./chunk-6RMM7JB6.mjs";var n={gap:16,padding:12,radius:20,width:360,viewportGutter:32,identitySize:24},r=`calc(100vw - ${n.viewportGutter}px)`,e={gap:6,padding:"4px 8px",radius:8,iconSize:12},p={gap:3,padding:"2px 6px",radius:8,iconSize:12},d={gap:3,padding:"3px 9px 3px 6px",radius:8,iconSize:10},s=d,t={size:21,padding:3,radius:8,iconSize:15},o={padding:"0 4px",height:18,radius:6},g={fontFamily:a,fontSize:12,fontWeight:500,lineHeight:1.3};function c(a){return{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:p.gap,padding:p.padding,borderRadius:p.radius,border:0,flexShrink:0,background:i[a].control,color:i[a].primary,...g,whiteSpace:"nowrap",cursor:"pointer",transition:"box-shadow 120ms ease"}}export{n as a,r as b,e as c,p as d,d as e,s as f,t as g,o as h,g as i,c as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as e}from"crypto";import{readFile as t,readdir as i,realpath as r}from"fs/promises";import{join as a,relative as s}from"path";var n=/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function o(e){return n.test(e)}function d(e,t,i,r){e.push({path:t,code:i,message:r,severity:"error"})}function c(e,t,i,r){e.push({path:t,code:i,message:r,severity:"warning"})}function p(e,t,i){o(i)||d(e,t,"invalid_uuid_v7","Canonical IDs must be UUIDv7 values.")}function l(e,t,i){(!i||Number.isNaN(Date.parse(i)))&&d(e,t,"invalid_timestamp","Timestamps must be parseable ISO-8601 strings.")}function u(e,t,i,r=!1){r&&"contributor"===i.level&&d(e,`${t}.level`,"insufficient_authority","Contributors cannot accept or change normative product truth."),"delegate"===i.level&&!i.grantId&&d(e,`${t}.grantId`,"missing_authority_grant","Delegate authority must reference the grant used for this action.")}var m={observation:new Set(["null->open","open->resolved","open->dismissed","resolved->open","dismissed->open"]),proposal:new Set(["null->draft","draft->pending","pending->accepted","pending->rejected","pending->withdrawn","pending->deferred","deferred->pending"]),decision:new Set(["null->active","active->superseded","active->revoked"]),advisory_explanation:new Set(["null->emerging","null->testing","null->grounded","null->challenged","null->retired","emerging->testing","emerging->grounded","emerging->challenged","emerging->retired","testing->emerging","testing->grounded","testing->challenged","testing->retired","grounded->challenged","grounded->retired","challenged->testing","challenged->retired"]),implementation_attempt:new Set(["null->planned","planned->in_progress","planned->abandoned","in_progress->completed","in_progress->failed","in_progress->abandoned"]),eval_spec:new Set(["null->draft","null->active","draft->active","draft->retired","active->retired"]),verification_attempt:new Set(["null->queued","queued->running","queued->cancelled","running->passed","running->failed","running->inconclusive","running->error","running->cancelled"]),freshness_signal:new Set(["null->open","open->resolved"])},f=new Set(["proposal:accepted","proposal:rejected","decision:superseded","decision:revoked"]);function y(e){let t=[];p(t,"manifest.projectId",e.manifest.projectId),l(t,"manifest.createdAt",e.manifest.createdAt),l(t,"manifest.updatedAt",e.manifest.updatedAt);let i=new Map,r=(e,r)=>{let a=i.get(e);a?d(t,r,"duplicate_id",`ID is already used at ${a}.`):i.set(e,r)};e.records.forEach((i,a)=>{let s=`records[${a}]`;r(i.id,s),function(e,t,i,r){p(e,`${i}.id`,t.id),p(e,`${i}.projectId`,t.projectId),p(e,`${i}.participantId`,t.participantId),l(e,`${i}.createdAt`,t.createdAt),t.projectId!==r&&d(e,`${i}.projectId`,"project_mismatch","Record belongs to another project."),"subjects"in t&&0===t.subjects.length&&d(e,`${i}.subjects`,"missing_subject","Proposals and decisions need a subject."),"subjects"in t&&t.subjects.length>1&&!t.subjectSemantics?.trim()&&d(e,`${i}.subjectSemantics`,"missing_subject_semantics","Multi-subject claims must explain why the subjects are inseparable."),"proposal"===t.recordType&&"inferred"===t.origin.mode&&(!t.origin.sourceText||!t.origin.iterationId||!t.origin.inferredById)&&d(e,`${i}.origin`,"incomplete_inference_provenance","Inferred structure requires source text, iteration, and inferring participant."),"decision"===t.recordType&&(u(e,`${i}.authority`,t.authority,!0),t.claim.trim()||d(e,`${i}.claim`,"empty_claim","Accepted decisions require a claim.")),"authority_grant"===t.recordType&&"owner"===t.level&&c(e,`${i}.level`,"owner_grant_requires_policy_review","Owner grants are valid but should receive explicit policy review."),"advisory_explanation"===t.recordType&&((!t.statement.trim()||!t.rationale.trim())&&d(e,i,"incomplete_advisory_explanation","Advisory explanations need a statement and rationale."),l(e,`${i}.updatedAt`,t.updatedAt),0===t.subjectIds.length&&d(e,`${i}.subjectIds`,"missing_subject","Advisory explanations need a subject."),t.scope.values.some(e=>!e.trim())&&d(e,`${i}.scope.values`,"empty_scope_value","Advisory scope values cannot be empty."),t.concreteBindings.forEach((t,r)=>{(!t.id.trim()||!t.modelPath.trim())&&d(e,`${i}.concreteBindings[${r}]`,"incomplete_concrete_binding","Concrete bindings need an id and model path."),l(e,`${i}.concreteBindings[${r}].createdAt`,t.createdAt),l(e,`${i}.concreteBindings[${r}].updatedAt`,t.updatedAt)})),"freshness_signal"===t.recordType&&"resolved"===t.state&&(!t.resolvedAt||!t.resolvedByEventId)&&d(e,i,"incomplete_freshness_resolution","Resolved freshness signals need a time and resolving event."),"model_projection"===t.recordType&&(l(e,`${i}.appliedAt`,t.appliedAt),u(e,`${i}.authority`,t.authority,!0),0===t.entryIds.length&&d(e,`${i}.entryIds`,"empty_model_projection","Applied model projections need at least one model entry.")),"eval_spec"===t.recordType&&((!t.legacyId.trim()||!t.title.trim()||!t.prompt.trim())&&d(e,i,"incomplete_eval_spec","Eval specs need a stable id, title, and prompt."),(0===t.assertions.length||t.assertions.some(e=>!e.trim()))&&d(e,`${i}.assertions`,"empty_eval_assertions","Eval specs need at least one non-empty assertion."),0===t.targets.length&&0===t.decisionIds.length&&c(e,i,"unbound_eval_spec","Eval spec is not yet bound to canonical product truth."),0===(t.dependencies?.length??0)&&c(e,`${i}.dependencies`,"unscoped_eval_spec","Eval spec has no freshness dependencies."))}(t,i,s,e.manifest.projectId)}),e.events.forEach((i,a)=>{let s=`events[${a}]`;r(i.id,s),function(e,t,i){p(e,`${i}.id`,t.id),p(e,`${i}.projectId`,t.projectId),p(e,`${i}.participantId`,t.participantId),p(e,`${i}.entity.entityId`,t.entity.entityId),l(e,`${i}.createdAt`,t.createdAt),u(e,`${i}.authority`,t.authority);let r=m[t.entity.entityType],a=`${t.fromState??"null"}->${t.toState}`;r&&!r.has(a)&&d(e,i,"invalid_lifecycle_transition",`${t.entity.entityType} does not allow ${a}.`);let s=`${t.entity.entityType}:${t.toState}`;if(f.has(s)&&(u(e,`${i}.authority`,t.authority,!0),t.reason?.trim()||d(e,`${i}.reason`,"missing_normative_reason","Normative acceptance, rejection, supersession, and revocation require a reason.")),"proposal"===t.entity.entityType&&"deferred"===t.toState){let r=t.transitionContext;("proposal_deferral"!==r?.kind||0===r.resurfaceWhen.length)&&d(e,`${i}.transitionContext`,"missing_deferral_policy","Deferred proposals require structured resurfacing conditions."),r?.resurfaceWhen.includes("after_date")&&!r.revisitAfter&&d(e,`${i}.transitionContext.revisitAfter`,"missing_revisit_date","after_date resurfacing requires revisitAfter."),r?.revisitAfter&&l(e,`${i}.transitionContext.revisitAfter`,r.revisitAfter)}}(t,i,s),i.projectId!==e.manifest.projectId&&d(t,`${s}.projectId`,"project_mismatch","Event belongs to another project.")}),e.relationships.forEach((i,a)=>{let s=`relationships[${a}]`;r(i.id,s),function(e,t,i){if(p(e,`${i}.id`,t.id),p(e,`${i}.projectId`,t.projectId),p(e,`${i}.participantId`,t.participantId),p(e,`${i}.from.entityId`,t.from.entityId),p(e,`${i}.to.entityId`,t.to.entityId),void 0!==t.from.storeId&&!t.from.storeId.trim()&&d(e,`${i}.from.storeId`,"invalid_store_reference","Qualified store IDs cannot be empty."),void 0!==t.to.storeId&&!t.to.storeId.trim()&&d(e,`${i}.to.storeId`,"invalid_store_reference","Qualified store IDs cannot be empty."),l(e,`${i}.createdAt`,t.createdAt),t.reason.trim()||d(e,`${i}.reason`,"missing_relationship_reason","Relationships need a reason."),new Set(["supports","contradicts","supersedes","excepts"]).has(t.relationshipType)){let r="decision"===t.from.entityType&&"decision"===t.to.entityType,a="advisory_explanation"===t.from.entityType&&"advisory_explanation"===t.to.entityType;!r&&!a&&d(e,i,"invalid_normative_relationship","These relationships connect decisions to decisions or advisory explanations to advisory explanations."),r&&!t.authority?d(e,`${i}.authority`,"missing_relationship_authority","Normative relationships require explicit authority context."):r&&t.authority&&u(e,`${i}.authority`,t.authority,!0)}["expresses","operationalizes","refines","instantiates"].includes(t.relationshipType)&&("advisory_explanation"!==t.from.entityType||"advisory_explanation"!==t.to.entityType)&&d(e,i,"invalid_advisory_relationship","Advisory topology relationships connect advisory explanations."),"implements"===t.relationshipType&&("implementation_attempt"!==t.from.entityType||"decision"!==t.to.entityType)&&d(e,i,"invalid_implements_relationship","`implements` points from an implementation attempt to a decision."),"verifies"===t.relationshipType&&("verification_attempt"!==t.from.entityType||!["decision","implementation_attempt","model_entry"].includes(t.to.entityType))&&d(e,i,"invalid_verifies_relationship","`verifies` points from a verification attempt to a verifiable target."),"replaces"===t.relationshipType&&t.from.entityType!==t.to.entityType&&d(e,i,"invalid_replaces_relationship","`replaces` connects records of the same entity type.")}(t,i,s),i.projectId!==e.manifest.projectId&&d(t,`${s}.projectId`,"project_mismatch","Relationship belongs to another project.")}),e.artifacts.forEach((e,i)=>{r(e.id,`artifacts[${i}]`),p(t,`artifacts[${i}].id`,e.id)}),e.tombstones.forEach((e,i)=>{let a=`tombstones[${i}]`;r(e.id,a),p(t,`${a}.id`,e.id),p(t,`${a}.objectId`,e.objectId),p(t,`${a}.deletedById`,e.deletedById),l(t,`${a}.deletedAt`,e.deletedAt),u(t,`${a}.authority`,e.authority,!0)});let a=new Set(e.records.map(e=>`${e.recordType}:${e.id}`)),s=new Set(e.tombstones.map(e=>`${e.objectType}:${e.objectId}`)),n=(e,i)=>{if(e.storeId)return;let r=`${e.entityType}:${e.entityId}`;!a.has(r)&&!s.has(r)&&d(t,i,"dangling_entity_reference",`No record or tombstone exists for ${r}.`)};e.events.forEach((e,t)=>n(e.entity,`events[${t}].entity`)),e.relationships.forEach((e,t)=>{n(e.from,`relationships[${t}].from`),n(e.to,`relationships[${t}].to`)});let o=new Set(e.artifacts.map(e=>e.id)),y=(e,i)=>{o.has(e)||d(t,i,"dangling_artifact_reference","No artifact manifest entry exists.")},h=(e,i,r)=>{!a.has(`${e}:${i}`)&&!s.has(`${e}:${i}`)&&d(t,r,"dangling_entity_reference",`No ${e} record or tombstone exists.`)};e.records.forEach((e,i)=>{let r=`records[${i}]`;switch(e.recordType){case"authority_grant":h("participant",e.granteeId,`${r}.granteeId`),h("participant",e.grantedById,`${r}.grantedById`),e.subjectIds.forEach((e,t)=>h("subject",e,`${r}.subjectIds[${t}]`));break;case"observation":e.captureContext.subjectIds.forEach((e,t)=>h("subject",e,`${r}.captureContext.subjectIds[${t}]`)),e.captureContext.artifactIds.forEach((e,t)=>y(e,`${r}.captureContext.artifactIds[${t}]`));break;case"proposal":case"decision":e.subjects.forEach((e,t)=>h("subject",e.subjectId,`${r}.subjects[${t}].subjectId`));break;case"thread":e.messageArtifactIds.forEach((e,t)=>y(e,`${r}.messageArtifactIds[${t}]`)),e.resultRefs.forEach((e,t)=>n(e,`${r}.resultRefs[${t}]`));break;case"iteration":e.threadIds.forEach((e,t)=>h("thread",e,`${r}.threadIds[${t}]`)),e.artifactIds.forEach((e,t)=>y(e,`${r}.artifactIds[${t}]`));break;case"evidence":e.artifactIds.forEach((e,t)=>y(e,`${r}.artifactIds[${t}]`));break;case"advisory_explanation":e.subjectIds.forEach((e,t)=>h("subject",e,`${r}.subjectIds[${t}]`)),e.evidenceIds.forEach((e,t)=>h("evidence",e,`${r}.evidenceIds[${t}]`)),e.supersededById&&h("advisory_explanation",e.supersededById,`${r}.supersededById`);break;case"implementation_attempt":e.iterationIds.forEach((e,t)=>h("iteration",e,`${r}.iterationIds[${t}]`)),e.coverageClaims.forEach((e,t)=>h("decision",e.decisionId,`${r}.coverageClaims[${t}].decisionId`)),e.artifactIds.forEach((e,t)=>y(e,`${r}.artifactIds[${t}]`));break;case"eval_spec":e.replacesSpecId&&h("eval_spec",e.replacesSpecId,`${r}.replacesSpecId`),e.decisionIds.forEach((e,t)=>h("decision",e,`${r}.decisionIds[${t}]`)),e.subjectIds.forEach((e,t)=>h("subject",e,`${r}.subjectIds[${t}]`)),(e.dependencies??[]).forEach((e,t)=>{"subject"===e.kind&&e.subjectId&&h("subject",e.subjectId,`${r}.dependencies[${t}].subjectId`)}),(e.scenarios??[]).forEach((e,t)=>{e.subjectIds?.forEach((e,i)=>h("subject",e,`${r}.scenarios[${t}].subjectIds[${i}]`))}),e.targets.forEach((e,t)=>h(e.entityType,e.entityId,`${r}.targets[${t}]`));break;case"verification_attempt":e.evalSpecId&&h("eval_spec",e.evalSpecId,`${r}.evalSpecId`),e.targets.forEach((e,t)=>h(e.entityType,e.entityId,`${r}.targets[${t}]`)),e.evidenceIds.forEach((e,t)=>h("evidence",e,`${r}.evidenceIds[${t}]`));break;case"model_entry":e.subjectIds.forEach((e,t)=>h("subject",e,`${r}.subjectIds[${t}]`)),e.decisionIds.forEach((e,t)=>h("decision",e,`${r}.decisionIds[${t}]`));break;case"model_projection":u(t,`${r}.authority`,e.authority,!0),h("participant",e.appliedById,`${r}.appliedById`),e.decisionIds.forEach((e,t)=>h("decision",e,`${r}.decisionIds[${t}]`)),e.entryIds.forEach((e,t)=>h("model_entry",e,`${r}.entryIds[${t}]`)),e.coverage.forEach((e,t)=>h("decision",e.decisionId,`${r}.coverage[${t}].decisionId`));break;case"freshness_signal":n(e.target,`${r}.target`),e.evidenceIds.forEach((e,t)=>h("evidence",e,`${r}.evidenceIds[${t}]`))}});let g=new Map(e.events.map(e=>[e.id,e])),v=new Map(e.records.map(e=>[`${e.recordType}:${e.id}`,e])),$=new Map;e.events.forEach((e,i)=>{let r=`${e.entity.entityType}:${e.entity.entityId}:${e.fromState??"null"}`,a=$.get(r)??new Set;a.add(e.toState),$.set(r,a),a.size>1&&d(t,`events[${i}]`,"concurrent_incompatible_transitions","The same entity state has multiple incompatible successor states.")});let I=new Map(e.records.flatMap(e=>"authority_grant"===e.recordType?[[e.id,e]]:[])),b=(e,i,r,a,s)=>{if("delegate"!==e.level||!e.grantId)return;let n=I.get(e.grantId);if(!n)return void d(t,s,"invalid_authority_grant","Delegated authority references a missing grant.");(n.granteeId!==i||"delegate"!==n.level)&&d(t,s,"authority_grantee_mismatch","The grant does not authorize this participant as a delegate.");let o=Date.parse(r);(o<Date.parse(n.startsAt)||n.endsAt&&o>Date.parse(n.endsAt)||n.revokedAt&&o>=Date.parse(n.revokedAt))&&d(t,s,"inactive_authority_grant","The delegated authority grant was not active at this time."),n.subjectIds.length&&a.length&&!a.every(e=>n.subjectIds.includes(e))&&d(t,s,"authority_scope_mismatch","The delegated action exceeds the grant subject scope.")};for(let t of e.records)"decision"===t.recordType&&b(t.authority,t.acceptedById,t.createdAt,t.subjects.map(e=>e.subjectId),`records:${t.id}.authority`);e.events.forEach((e,t)=>{let i=v.get(`${e.entity.entityType}:${e.entity.entityId}`),r=i&&"subjects"in i?i.subjects.map(e=>e.subjectId):[];b(e.authority,e.participantId,e.createdAt,r,`events[${t}].authority`)}),e.relationships.forEach((e,t)=>{if(!e.authority)return;let i=[e.from,e.to].flatMap(e=>{let t=v.get(`${e.entityType}:${e.entityId}`);return t&&"subjects"in t?t.subjects.map(e=>e.subjectId):[]});b(e.authority,e.participantId,e.createdAt,i,`relationships[${t}].authority`)});for(let i of e.records){if("decision"!==i.recordType)continue;let r=g.get(i.acceptanceEventId);(!r||"proposal"!==r.entity.entityType||r.entity.entityId!==i.proposalId||"accepted"!==r.toState)&&d(t,`records:${i.id}.acceptanceEventId`,"invalid_acceptance_event","A decision must reference the proposal event that explicitly accepted it."),r&&r.participantId!==i.acceptedById&&d(t,`records:${i.id}.acceptedById`,"acceptor_mismatch","Decision acceptor must match the acceptance event participant."),v.has(`proposal:${i.proposalId}`)||d(t,`records:${i.id}.proposalId`,"missing_proposal","Accepted decisions must retain their proposal."),"superseded"===i.state&&(e.relationships.some(e=>"supersedes"===e.relationshipType&&"decision"===e.to.entityType&&e.to.entityId===i.id)||d(t,`records:${i.id}.state`,"missing_successor","Superseded decisions require an explicit successor relationship.")),"revoked"===i.state&&(e.events.some(e=>"decision"===e.entity.entityType&&e.entity.entityId===i.id&&"revoked"===e.toState&&!!e.reason?.trim())||d(t,`records:${i.id}.state`,"missing_revocation_event","Revoked decisions require an authorized event with a reason."))}for(let i of e.records)"proposal"===i.recordType&&"accepted"===i.state&&(e.records.some(e=>"decision"===e.recordType&&e.proposalId===i.id)||d(t,`records:${i.id}.state`,"accepted_proposal_without_decision","Every accepted proposal must produce an immutable decision."));return function(e){return{valid:!e.some(e=>"error"===e.severity),issues:e}}(t)}var h=["f5258a13","31ffc15e","3eae3a70","c185e614","33930045","55e04c59","f3bb881b","f8a55928","eac95a7d","e402bdc2","2854624b","cf28ad45","6a494fab","987e901b","ad7293aa","dd1d5d77","14c429d6","48494ad3","d6bbe932","e8b94260","f56fa283","7f1f6cb3","f239f4ac","bd671e61","dbe032ec","c0808b95"];function g(e){return null===e||"object"!=typeof e||Array.isArray(e)?null:e}function v(e,t=0){return new Date(Number.isFinite(e)?e:t).toISOString()}function $(...e){return e.find(e=>!!e?.trim())?.trim()}function I(t,i,r,a){let s=Math.max(0,Math.min(Math.floor(a),0xffffffffffff)).toString(16).padStart(12,"0"),n=e("sha256").update(`${t}\0${i}\0${r}`).digest("hex"),o=(3&Number.parseInt(n[3],16)|8).toString(16);return`${s.slice(0,8)}-${s.slice(8)}-7${n.slice(0,3)}-${o}${n.slice(4,7)}-${n.slice(7,19)}`}async function b(e,i){try{return JSON.parse(await t(e,"utf8"))}catch(t){return i.push({severity:"warning",code:"source_unavailable",source:e,message:t instanceof Error?t.message:String(t)}),null}}function _(e){let t={};for(let i of e)t[i.recordType]=(t[i.recordType]??0)+1;return t}async function j(e){let t=[],n=await r(e.projectRoot).catch(()=>e.projectRoot),o=a(n,".popmelt"),d=await b(a(o,"threads.json"),t),c=await b(a(o,"model.json"),t),p=g(d),l=g(p?.threads)??{},u=Object.entries(l).map(([e,t])=>({key:e,value:g(t)})).filter(e=>!!e.value),m=a(o,"decisions"),f=await i(m).catch(()=>[]),j=[];for(let e of f.filter(e=>e.endsWith(".json")).sort()){let i=g(await b(a(m,e),t));i&&j.push({file:e,value:i})}let T=u.flatMap(({value:e})=>[e.createdAt,e.updatedAt]).filter(e=>"number"==typeof e&&Number.isFinite(e)),A=T.length?Math.min(...T):0,w=e.projectKey??n;e.projectKey||t.push({severity:"info",code:"path_derived_project_identity",message:"Canonical project identity is stable for this path; pass projectKey to preserve it across moves."});let E=I(w,"project",w,A),x=I(w,"participant","legacy-owner",A),S=I(w,"participant","legacy-agent",A),k=I(w,"subject","project",A),q=v(Math.max(A,...T)),B=[],M=[],C=new Map,D=new Map,R=new Map(j.map(e=>[e.value.id??e.file.replace(/^d-|\.json$/g,""),e.value])),N=new Map,P=(e,t,i,r,a)=>{let s=C.get(i);if(s)return s;let n=I(w,"artifact",e,r);return M.push({id:n,kind:t,mediaType:a,location:i,availability:"available"}),C.set(i,n),n};for(let{file:e,value:t}of j){let i=t.id??e.replace(/^d-|\.json$/g,""),r=t.createdAt??A,a=[P(`${i}:envelope`,"other",`.popmelt/decisions/${e}`,r,"application/json")];t.screenshotPath&&a.push(P(`${i}:screenshot`,"screenshot",`.popmelt/${t.screenshotPath.replace(/^\.popmelt\//,"")}`,r,t.screenshotPath.endsWith(".png")?"image/png":"image/webp"));for(let[e,s]of(t.pastedImagePaths??[]).entries())a.push(P(`${i}:image:${e}`,"image",s,r));N.set(i,a)}let F=(e,t,i)=>({id:e,schemaVersion:1,projectId:E,createdAt:q,participantId:t,sourceRefs:i}),O=(e,t)=>{B.push(t);let i=D.get(e)??[];i.push(t.id),D.set(e,i)},Q=[{...F(x,x,[]),recordType:"participant",kind:"human",displayName:"Legacy project owner",status:"active"},{...F(S,S,[]),recordType:"participant",kind:"ai",displayName:"Legacy coding agent",status:"active"}];B.push(...Q),B.push({...F(k,x,[]),recordType:"subject",subjectType:"project",label:s(process.cwd(),n)||n,aliases:[],locators:[{id:I(w,"locator",n,A),kind:"project_root",value:n,status:"current",validFrom:v(A),sourceRefs:[]}]});let z=new Map,L=(e,t)=>{let i=z.get(e);if(i)return i;let r=I(w,"subject",e,t),a={...F(r,x,[{kind:"external",id:e}]),createdAt:v(t),recordType:"subject",subjectType:"element",label:e,aliases:[],locators:[{id:I(w,"locator",e,t),kind:"dom_selector",value:e,status:"current",validFrom:v(t),sourceRefs:[{kind:"external",id:e}]}]};return B.push(a),z.set(e,r),r};for(let{key:e,value:i}of u){let r,a,s=i.id??e,o=i.createdAt??A,d=I(w,"thread",s,o),c={kind:"thread",id:s},p=[],l=[],u=Array.isArray(i.messages)?i.messages:[],m=0;u.forEach((e,u)=>{let f=e.timestamp??o,y=I(w,"artifact",`${s}:message:${u}`,f);if(p.push(y),M.push({id:y,kind:"message",mediaType:"application/json",location:`.popmelt/threads.json#/threads/${s}/messages/${u}`,availability:"available"}),C.set(`.popmelt/threads.json#/threads/${s}/messages/${u}`,y),e.screenshotPath&&P(`${s}:message:${u}:screenshot`,"screenshot",e.screenshotPath,f),"human"===e.role){r=e;let t=e.feedbackSummary??e.replyToQuestion;if(t?.trim()){let e=I(w,"observation",`${s}:${u}`,f),r=i.elementIdentifiers??[],n={...F(e,x,[c,{kind:"message",id:y}]),createdAt:v(f),recordType:"observation",state:"open",statement:t,captureContext:{subjectIds:r.map(e=>L(e,o)),artifactIds:[y]},resolvedByIds:[]};O(s,n),a=e,l.push({entityType:"observation",entityId:e})}return}if("assistant"!==e.role)return;let h=e.jobId??`${s}:${u}`,g=I(w,"iteration",h,f),b=R.get(h),_=e.cancelled?"cancelled":e.error?"failed":e.question?"question_asked":(e.resolutions?.length??0)>0?"completed":"no_change",j={...F(g,S,[c,{kind:"message",id:y},...(N.get(h)??[]).map(e=>({kind:"artifact",id:e}))]),createdAt:v(f),recordType:"iteration",threadIds:[d],startedAt:v(r?.timestamp,f),completedAt:v(f),requestSummary:$(r?.feedbackSummary,r?.replyToQuestion)??"[legacy request unavailable]",responseSummary:e.question??e.error??e.responseText?.slice(0,1e3),outcome:_,execution:{provider:e.provider??b?.provider,model:e.model??b?.model,sessionId:e.sessionId??b?.sessionId},artifactIds:[y,...N.get(h)??[]]};O(s,j),l.push({entityType:"iteration",entityId:g});let T=e.resolutions??b?.resolutions??[];for(let[e,a]of T.entries()){if("resolved"!==a.status||!a.summary?.trim())continue;let d=i.elementIdentifiers??[],p=(d.length?d:[n]).map(e=>({subjectId:e===n?k:L(e,o),role:"governed"})),u=I(w,"proposal",`${h}:${a.annotationId??"resolution"}:${e}`,f),m={...F(u,S,[c,{kind:"iteration",id:g}]),createdAt:v(f),recordType:"proposal",state:"pending",claim:a.summary,subjects:p,subjectSemantics:p.length>1?"Legacy thread grouped these selected elements; independent scope requires owner review.":void 0,origin:{mode:"inferred",sourceText:$(r?.feedbackSummary,r?.replyToQuestion,a.summary),iterationId:g,inferredById:S}};O(s,m),l.push({entityType:"proposal",entityId:u}),t.push({severity:"warning",code:"acceptance_unresolved",source:s,message:`Proposal ${u} remains pending; legacy resolved status proves an outcome, not explicit acceptance.`})}if(T.some(e=>"resolved"===e.status)||b?.gitDiff){let e=I(w,"implementation",h,f),t={...F(e,S,[c,{kind:"iteration",id:g}]),createdAt:v(f),recordType:"implementation_attempt",state:"completed",iterationIds:[g],coverageClaims:[],summary:T.map(e=>e.summary).filter(Boolean).join(" ")||"Legacy implementation outcome.",artifactIds:[]};O(s,t),l.push({entityType:"implementation_attempt",entityId:e}),m+=1}a&&(a=void 0)});let f=u.at(-1),y={...F(d,x,[c]),createdAt:v(o),recordType:"thread",state:f?.question?"open":"resolved",messageArtifactIds:p,outcome:f?.question?"question_unresolved":m?"implementation_only":"no_outcome",resultRefs:l};B.push(y),D.set(s,[d,...D.get(s)??[]])}let W=function(e){let t=g(e);if(!t)return 0;let i=0,r=e=>{let t=g(e);if(t)for(let e of Object.values(t))r(e);else i+=1};for(let e of Object.values(t))r(e);return i}(c);W&&t.push({severity:"warning",code:"model_entries_deferred",source:".popmelt/model.json",message:`${W} model values were not promoted because their accepted decision provenance is unresolved.`});let K={manifest:{formatVersion:1,projectId:E,createdAt:v(A),updatedAt:q,features:["authority","subjects","implementations","portable_artifacts","bounded_retrieval"],writer:{name:"@popmelt.com/core legacy importer",version:e.writerVersion??"0.8.4-dev"}},records:B,events:[],relationships:[],artifacts:M,tombstones:[]},V=y(K),U=(e.proofCaseIds??h).map(e=>({legacyId:e,threadFound:u.some(({key:t,value:i})=>(i.id??t)===e),decisionEnvelopeFound:R.has(e),recordIds:D.get(e)??[]}));return{bundle:K,report:{projectRoot:n,source:{threads:u.length,messages:u.reduce((e,t)=>e+(t.value.messages?.length??0),0),decisionEnvelopes:j.length,modelEntries:W,artifactsReferenced:M.length},imported:_(B),unresolvedAcceptance:t.filter(e=>"acceptance_unresolved"===e.code).length,deferredModelEntries:W,proofCases:U,issues:t,schemaIssues:V.issues}}}export{o as a,y as b,I as c,j as d};
|
|
1
|
+
import{createHash as e}from"crypto";import{readFile as t,readdir as i,realpath as r}from"fs/promises";import{join as a,relative as s}from"path";var n=/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function o(e){return n.test(e)}function d(e,t,i,r){e.push({path:t,code:i,message:r,severity:"error"})}function c(e,t,i,r){e.push({path:t,code:i,message:r,severity:"warning"})}function p(e,t,i){o(i)||d(e,t,"invalid_uuid_v7","Canonical IDs must be UUIDv7 values.")}function l(e,t,i){(!i||Number.isNaN(Date.parse(i)))&&d(e,t,"invalid_timestamp","Timestamps must be parseable ISO-8601 strings.")}function u(e,t,i,r=!1){r&&"contributor"===i.level&&d(e,`${t}.level`,"insufficient_authority","Contributors cannot accept or change normative product truth."),"delegate"===i.level&&!i.grantId&&d(e,`${t}.grantId`,"missing_authority_grant","Delegate authority must reference the grant used for this action.")}var m={observation:new Set(["null->open","open->resolved","open->dismissed","resolved->open","dismissed->open"]),proposal:new Set(["null->draft","draft->pending","pending->accepted","pending->rejected","pending->withdrawn","pending->deferred","deferred->pending"]),decision:new Set(["null->active","active->superseded","active->revoked"]),advisory_explanation:new Set(["null->emerging","null->testing","null->grounded","null->challenged","null->retired","emerging->testing","emerging->grounded","emerging->challenged","emerging->retired","testing->emerging","testing->grounded","testing->challenged","testing->retired","grounded->challenged","grounded->retired","challenged->testing","challenged->retired"]),implementation_attempt:new Set(["null->planned","planned->in_progress","planned->abandoned","in_progress->completed","in_progress->failed","in_progress->abandoned"]),eval_spec:new Set(["null->draft","null->active","draft->active","draft->retired","active->retired"]),verification_attempt:new Set(["null->queued","queued->running","queued->cancelled","running->passed","running->failed","running->inconclusive","running->error","running->cancelled"]),freshness_signal:new Set(["null->open","open->resolved"])},f=new Set(["proposal:accepted","proposal:rejected","decision:superseded","decision:revoked"]);function y(e){let t=[];p(t,"manifest.projectId",e.manifest.projectId),l(t,"manifest.createdAt",e.manifest.createdAt),l(t,"manifest.updatedAt",e.manifest.updatedAt);let i=new Map,r=(e,r)=>{let a=i.get(e);a?d(t,r,"duplicate_id",`ID is already used at ${a}.`):i.set(e,r)};e.records.forEach((i,a)=>{let s=`records[${a}]`;r(i.id,s),function(e,t,i,r){p(e,`${i}.id`,t.id),p(e,`${i}.projectId`,t.projectId),p(e,`${i}.participantId`,t.participantId),l(e,`${i}.createdAt`,t.createdAt),t.projectId!==r&&d(e,`${i}.projectId`,"project_mismatch","Record belongs to another project."),"subjects"in t&&0===t.subjects.length&&d(e,`${i}.subjects`,"missing_subject","Proposals and decisions need a subject."),"subjects"in t&&t.subjects.length>1&&!t.subjectSemantics?.trim()&&d(e,`${i}.subjectSemantics`,"missing_subject_semantics","Multi-subject claims must explain why the subjects are inseparable."),"proposal"===t.recordType&&"inferred"===t.origin.mode&&(!t.origin.sourceText||!t.origin.iterationId||!t.origin.inferredById)&&d(e,`${i}.origin`,"incomplete_inference_provenance","Inferred structure requires source text, iteration, and inferring participant."),"decision"===t.recordType&&(u(e,`${i}.authority`,t.authority,!0),t.claim.trim()||d(e,`${i}.claim`,"empty_claim","Accepted decisions require a claim.")),"authority_grant"===t.recordType&&"owner"===t.level&&c(e,`${i}.level`,"owner_grant_requires_policy_review","Owner grants are valid but should receive explicit policy review."),"advisory_explanation"===t.recordType&&((!t.statement.trim()||!t.rationale.trim())&&d(e,i,"incomplete_advisory_explanation","Advisory explanations need a statement and rationale."),l(e,`${i}.updatedAt`,t.updatedAt),0===t.subjectIds.length&&d(e,`${i}.subjectIds`,"missing_subject","Advisory explanations need a subject."),t.scope.values.some(e=>!e.trim())&&d(e,`${i}.scope.values`,"empty_scope_value","Advisory scope values cannot be empty."),t.concreteBindings.forEach((t,r)=>{(!t.id.trim()||!t.modelPath.trim())&&d(e,`${i}.concreteBindings[${r}]`,"incomplete_concrete_binding","Concrete bindings need an id and model path."),l(e,`${i}.concreteBindings[${r}].createdAt`,t.createdAt),l(e,`${i}.concreteBindings[${r}].updatedAt`,t.updatedAt)})),"freshness_signal"===t.recordType&&"resolved"===t.state&&(!t.resolvedAt||!t.resolvedByEventId)&&d(e,i,"incomplete_freshness_resolution","Resolved freshness signals need a time and resolving event."),"model_projection"===t.recordType&&(l(e,`${i}.appliedAt`,t.appliedAt),u(e,`${i}.authority`,t.authority,!0),0===t.entryIds.length&&d(e,`${i}.entryIds`,"empty_model_projection","Applied model projections need at least one model entry.")),"eval_spec"===t.recordType&&((!t.legacyId.trim()||!t.title.trim()||!t.prompt.trim())&&d(e,i,"incomplete_eval_spec","Eval specs need a stable id, title, and prompt."),(0===t.assertions.length||t.assertions.some(e=>!e.trim()))&&d(e,`${i}.assertions`,"empty_eval_assertions","Eval specs need at least one non-empty assertion."),0===t.targets.length&&0===t.decisionIds.length&&c(e,i,"unbound_eval_spec","Eval spec is not yet bound to canonical product truth."),0===(t.dependencies?.length??0)&&c(e,`${i}.dependencies`,"unscoped_eval_spec","Eval spec has no freshness dependencies."))}(t,i,s,e.manifest.projectId)}),e.events.forEach((i,a)=>{let s=`events[${a}]`;r(i.id,s),function(e,t,i){p(e,`${i}.id`,t.id),p(e,`${i}.projectId`,t.projectId),p(e,`${i}.participantId`,t.participantId),p(e,`${i}.entity.entityId`,t.entity.entityId),l(e,`${i}.createdAt`,t.createdAt),u(e,`${i}.authority`,t.authority);let r=m[t.entity.entityType],a=`${t.fromState??"null"}->${t.toState}`;r&&!r.has(a)&&d(e,i,"invalid_lifecycle_transition",`${t.entity.entityType} does not allow ${a}.`);let s=`${t.entity.entityType}:${t.toState}`;if(f.has(s)&&(u(e,`${i}.authority`,t.authority,!0),t.reason?.trim()||d(e,`${i}.reason`,"missing_normative_reason","Normative acceptance, rejection, supersession, and revocation require a reason.")),"proposal"===t.entity.entityType&&"deferred"===t.toState){let r=t.transitionContext;("proposal_deferral"!==r?.kind||0===r.resurfaceWhen.length)&&d(e,`${i}.transitionContext`,"missing_deferral_policy","Deferred proposals require structured resurfacing conditions."),r?.resurfaceWhen.includes("after_date")&&!r.revisitAfter&&d(e,`${i}.transitionContext.revisitAfter`,"missing_revisit_date","after_date resurfacing requires revisitAfter."),r?.revisitAfter&&l(e,`${i}.transitionContext.revisitAfter`,r.revisitAfter)}}(t,i,s),i.projectId!==e.manifest.projectId&&d(t,`${s}.projectId`,"project_mismatch","Event belongs to another project.")}),e.relationships.forEach((i,a)=>{let s=`relationships[${a}]`;r(i.id,s),function(e,t,i){if(p(e,`${i}.id`,t.id),p(e,`${i}.projectId`,t.projectId),p(e,`${i}.participantId`,t.participantId),p(e,`${i}.from.entityId`,t.from.entityId),p(e,`${i}.to.entityId`,t.to.entityId),void 0!==t.from.storeId&&!t.from.storeId.trim()&&d(e,`${i}.from.storeId`,"invalid_store_reference","Qualified store IDs cannot be empty."),void 0!==t.to.storeId&&!t.to.storeId.trim()&&d(e,`${i}.to.storeId`,"invalid_store_reference","Qualified store IDs cannot be empty."),l(e,`${i}.createdAt`,t.createdAt),t.reason.trim()||d(e,`${i}.reason`,"missing_relationship_reason","Relationships need a reason."),new Set(["supports","contradicts","supersedes","excepts"]).has(t.relationshipType)){let r="decision"===t.from.entityType&&"decision"===t.to.entityType,a="advisory_explanation"===t.from.entityType&&"advisory_explanation"===t.to.entityType;!r&&!a&&d(e,i,"invalid_normative_relationship","These relationships connect decisions to decisions or advisory explanations to advisory explanations."),r&&!t.authority?d(e,`${i}.authority`,"missing_relationship_authority","Normative relationships require explicit authority context."):r&&t.authority&&u(e,`${i}.authority`,t.authority,!0)}["expresses","operationalizes","refines","instantiates"].includes(t.relationshipType)&&("advisory_explanation"!==t.from.entityType||"advisory_explanation"!==t.to.entityType)&&d(e,i,"invalid_advisory_relationship","Advisory topology relationships connect advisory explanations."),"implements"===t.relationshipType&&("implementation_attempt"!==t.from.entityType||"decision"!==t.to.entityType)&&d(e,i,"invalid_implements_relationship","`implements` points from an implementation attempt to a decision."),"verifies"===t.relationshipType&&("verification_attempt"!==t.from.entityType||!["decision","implementation_attempt","model_entry"].includes(t.to.entityType))&&d(e,i,"invalid_verifies_relationship","`verifies` points from a verification attempt to a verifiable target."),"replaces"===t.relationshipType&&t.from.entityType!==t.to.entityType&&d(e,i,"invalid_replaces_relationship","`replaces` connects records of the same entity type.")}(t,i,s),i.projectId!==e.manifest.projectId&&d(t,`${s}.projectId`,"project_mismatch","Relationship belongs to another project.")}),e.artifacts.forEach((e,i)=>{r(e.id,`artifacts[${i}]`),p(t,`artifacts[${i}].id`,e.id)}),e.tombstones.forEach((e,i)=>{let a=`tombstones[${i}]`;r(e.id,a),p(t,`${a}.id`,e.id),p(t,`${a}.objectId`,e.objectId),p(t,`${a}.deletedById`,e.deletedById),l(t,`${a}.deletedAt`,e.deletedAt),u(t,`${a}.authority`,e.authority,!0)});let a=new Set(e.records.map(e=>`${e.recordType}:${e.id}`)),s=new Set(e.tombstones.map(e=>`${e.objectType}:${e.objectId}`)),n=(e,i)=>{if(e.storeId)return;let r=`${e.entityType}:${e.entityId}`;!a.has(r)&&!s.has(r)&&d(t,i,"dangling_entity_reference",`No record or tombstone exists for ${r}.`)};e.events.forEach((e,t)=>n(e.entity,`events[${t}].entity`)),e.relationships.forEach((e,t)=>{n(e.from,`relationships[${t}].from`),n(e.to,`relationships[${t}].to`)});let o=new Set(e.artifacts.map(e=>e.id)),y=(e,i)=>{o.has(e)||d(t,i,"dangling_artifact_reference","No artifact manifest entry exists.")},h=(e,i,r)=>{!a.has(`${e}:${i}`)&&!s.has(`${e}:${i}`)&&d(t,r,"dangling_entity_reference",`No ${e} record or tombstone exists.`)};e.records.forEach((e,i)=>{let r=`records[${i}]`;switch(e.recordType){case"authority_grant":h("participant",e.granteeId,`${r}.granteeId`),h("participant",e.grantedById,`${r}.grantedById`),e.subjectIds.forEach((e,t)=>h("subject",e,`${r}.subjectIds[${t}]`));break;case"observation":e.captureContext.subjectIds.forEach((e,t)=>h("subject",e,`${r}.captureContext.subjectIds[${t}]`)),e.captureContext.artifactIds.forEach((e,t)=>y(e,`${r}.captureContext.artifactIds[${t}]`));break;case"proposal":case"decision":e.subjects.forEach((e,t)=>h("subject",e.subjectId,`${r}.subjects[${t}].subjectId`));break;case"thread":e.messageArtifactIds.forEach((e,t)=>y(e,`${r}.messageArtifactIds[${t}]`)),e.resultRefs.forEach((e,t)=>n(e,`${r}.resultRefs[${t}]`));break;case"iteration":e.threadIds.forEach((e,t)=>h("thread",e,`${r}.threadIds[${t}]`)),e.artifactIds.forEach((e,t)=>y(e,`${r}.artifactIds[${t}]`));break;case"evidence":e.artifactIds.forEach((e,t)=>y(e,`${r}.artifactIds[${t}]`));break;case"advisory_explanation":e.subjectIds.forEach((e,t)=>h("subject",e,`${r}.subjectIds[${t}]`)),e.evidenceIds.forEach((e,t)=>h("evidence",e,`${r}.evidenceIds[${t}]`)),e.supersededById&&h("advisory_explanation",e.supersededById,`${r}.supersededById`);break;case"implementation_attempt":e.iterationIds.forEach((e,t)=>h("iteration",e,`${r}.iterationIds[${t}]`)),e.coverageClaims.forEach((e,t)=>h("decision",e.decisionId,`${r}.coverageClaims[${t}].decisionId`)),e.artifactIds.forEach((e,t)=>y(e,`${r}.artifactIds[${t}]`));break;case"eval_spec":e.replacesSpecId&&h("eval_spec",e.replacesSpecId,`${r}.replacesSpecId`),e.decisionIds.forEach((e,t)=>h("decision",e,`${r}.decisionIds[${t}]`)),e.subjectIds.forEach((e,t)=>h("subject",e,`${r}.subjectIds[${t}]`)),(e.dependencies??[]).forEach((e,t)=>{"subject"===e.kind&&e.subjectId&&h("subject",e.subjectId,`${r}.dependencies[${t}].subjectId`)}),(e.scenarios??[]).forEach((e,t)=>{e.subjectIds?.forEach((e,i)=>h("subject",e,`${r}.scenarios[${t}].subjectIds[${i}]`))}),e.targets.forEach((e,t)=>h(e.entityType,e.entityId,`${r}.targets[${t}]`));break;case"verification_attempt":e.evalSpecId&&h("eval_spec",e.evalSpecId,`${r}.evalSpecId`),e.targets.forEach((e,t)=>h(e.entityType,e.entityId,`${r}.targets[${t}]`)),e.evidenceIds.forEach((e,t)=>h("evidence",e,`${r}.evidenceIds[${t}]`));break;case"model_entry":e.subjectIds.forEach((e,t)=>h("subject",e,`${r}.subjectIds[${t}]`)),e.decisionIds.forEach((e,t)=>h("decision",e,`${r}.decisionIds[${t}]`));break;case"model_projection":u(t,`${r}.authority`,e.authority,!0),h("participant",e.appliedById,`${r}.appliedById`),e.decisionIds.forEach((e,t)=>h("decision",e,`${r}.decisionIds[${t}]`)),e.entryIds.forEach((e,t)=>h("model_entry",e,`${r}.entryIds[${t}]`)),e.coverage.forEach((e,t)=>h("decision",e.decisionId,`${r}.coverage[${t}].decisionId`));break;case"freshness_signal":n(e.target,`${r}.target`),e.evidenceIds.forEach((e,t)=>h("evidence",e,`${r}.evidenceIds[${t}]`))}});let g=new Map(e.events.map(e=>[e.id,e])),v=new Map(e.records.map(e=>[`${e.recordType}:${e.id}`,e])),$=new Map;e.events.forEach((e,i)=>{let r=`${e.entity.entityType}:${e.entity.entityId}:${e.fromState??"null"}`,a=$.get(r)??new Set;a.add(e.toState),$.set(r,a),a.size>1&&d(t,`events[${i}]`,"concurrent_incompatible_transitions","The same entity state has multiple incompatible successor states.")});let I=new Map(e.records.flatMap(e=>"authority_grant"===e.recordType?[[e.id,e]]:[])),b=(e,i,r,a,s)=>{if("delegate"!==e.level||!e.grantId)return;let n=I.get(e.grantId);if(!n)return void d(t,s,"invalid_authority_grant","Delegated authority references a missing grant.");(n.granteeId!==i||"delegate"!==n.level)&&d(t,s,"authority_grantee_mismatch","The grant does not authorize this participant as a delegate.");let o=Date.parse(r);(o<Date.parse(n.startsAt)||n.endsAt&&o>Date.parse(n.endsAt)||n.revokedAt&&o>=Date.parse(n.revokedAt))&&d(t,s,"inactive_authority_grant","The delegated authority grant was not active at this time."),n.subjectIds.length&&a.length&&!a.every(e=>n.subjectIds.includes(e))&&d(t,s,"authority_scope_mismatch","The delegated action exceeds the grant subject scope.")};for(let t of e.records)"decision"===t.recordType&&b(t.authority,t.acceptedById,t.createdAt,t.subjects.map(e=>e.subjectId),`records:${t.id}.authority`);e.events.forEach((e,t)=>{let i=v.get(`${e.entity.entityType}:${e.entity.entityId}`),r=i&&"subjects"in i?i.subjects.map(e=>e.subjectId):[];b(e.authority,e.participantId,e.createdAt,r,`events[${t}].authority`)}),e.relationships.forEach((e,t)=>{if(!e.authority)return;let i=[e.from,e.to].flatMap(e=>{let t=v.get(`${e.entityType}:${e.entityId}`);return t&&"subjects"in t?t.subjects.map(e=>e.subjectId):[]});b(e.authority,e.participantId,e.createdAt,i,`relationships[${t}].authority`)});for(let i of e.records){if("decision"!==i.recordType)continue;let r=g.get(i.acceptanceEventId);(!r||"proposal"!==r.entity.entityType||r.entity.entityId!==i.proposalId||"accepted"!==r.toState)&&d(t,`records:${i.id}.acceptanceEventId`,"invalid_acceptance_event","A decision must reference the proposal event that explicitly accepted it."),r&&r.participantId!==i.acceptedById&&d(t,`records:${i.id}.acceptedById`,"acceptor_mismatch","Decision acceptor must match the acceptance event participant."),v.has(`proposal:${i.proposalId}`)||d(t,`records:${i.id}.proposalId`,"missing_proposal","Accepted decisions must retain their proposal."),"superseded"===i.state&&(e.relationships.some(e=>"supersedes"===e.relationshipType&&"decision"===e.to.entityType&&e.to.entityId===i.id)||d(t,`records:${i.id}.state`,"missing_successor","Superseded decisions require an explicit successor relationship.")),"revoked"===i.state&&(e.events.some(e=>"decision"===e.entity.entityType&&e.entity.entityId===i.id&&"revoked"===e.toState&&!!e.reason?.trim())||d(t,`records:${i.id}.state`,"missing_revocation_event","Revoked decisions require an authorized event with a reason."))}for(let i of e.records)"proposal"===i.recordType&&"accepted"===i.state&&(e.records.some(e=>"decision"===e.recordType&&e.proposalId===i.id)||d(t,`records:${i.id}.state`,"accepted_proposal_without_decision","Every accepted proposal must produce an immutable decision."));return function(e){return{valid:!e.some(e=>"error"===e.severity),issues:e}}(t)}var h=["f5258a13","31ffc15e","3eae3a70","c185e614","33930045","55e04c59","f3bb881b","f8a55928","eac95a7d","e402bdc2","2854624b","cf28ad45","6a494fab","987e901b","ad7293aa","dd1d5d77","14c429d6","48494ad3","d6bbe932","e8b94260","f56fa283","7f1f6cb3","f239f4ac","bd671e61","dbe032ec","c0808b95"];function g(e){return null===e||"object"!=typeof e||Array.isArray(e)?null:e}function v(e,t=0){return new Date(Number.isFinite(e)?e:t).toISOString()}function $(...e){return e.find(e=>!!e?.trim())?.trim()}function I(t,i,r,a){let s=Math.max(0,Math.min(Math.floor(a),0xffffffffffff)).toString(16).padStart(12,"0"),n=e("sha256").update(`${t}\0${i}\0${r}`).digest("hex"),o=(3&Number.parseInt(n[3],16)|8).toString(16);return`${s.slice(0,8)}-${s.slice(8)}-7${n.slice(0,3)}-${o}${n.slice(4,7)}-${n.slice(7,19)}`}async function b(e,i){try{return JSON.parse(await t(e,"utf8"))}catch(t){return i.push({severity:"warning",code:"source_unavailable",source:e,message:t instanceof Error?t.message:String(t)}),null}}function _(e){let t={};for(let i of e)t[i.recordType]=(t[i.recordType]??0)+1;return t}async function j(e){let t=[],n=await r(e.projectRoot).catch(()=>e.projectRoot),o=a(n,".popmelt"),d=await b(a(o,"threads.json"),t),c=await b(a(o,"model.json"),t),p=g(d),l=g(p?.threads)??{},u=Object.entries(l).map(([e,t])=>({key:e,value:g(t)})).filter(e=>!!e.value),m=a(o,"decisions"),f=await i(m).catch(()=>[]),j=[];for(let e of f.filter(e=>e.endsWith(".json")).sort()){let i=g(await b(a(m,e),t));i&&j.push({file:e,value:i})}let T=u.flatMap(({value:e})=>[e.createdAt,e.updatedAt]).filter(e=>"number"==typeof e&&Number.isFinite(e)),A=T.length?Math.min(...T):0,w=e.projectKey??n;e.projectKey||t.push({severity:"info",code:"path_derived_project_identity",message:"Canonical project identity is stable for this path; pass projectKey to preserve it across moves."});let E=I(w,"project",w,A),x=I(w,"participant","legacy-owner",A),S=I(w,"participant","legacy-agent",A),k=I(w,"subject","project",A),q=v(Math.max(A,...T)),B=[],M=[],C=new Map,D=new Map,R=new Map(j.map(e=>[e.value.id??e.file.replace(/^d-|\.json$/g,""),e.value])),N=new Map,P=(e,t,i,r,a)=>{let s=C.get(i);if(s)return s;let n=I(w,"artifact",e,r);return M.push({id:n,kind:t,mediaType:a,location:i,availability:"available"}),C.set(i,n),n};for(let{file:e,value:t}of j){let i=t.id??e.replace(/^d-|\.json$/g,""),r=t.createdAt??A,a=[P(`${i}:envelope`,"other",`.popmelt/decisions/${e}`,r,"application/json")];t.screenshotPath&&a.push(P(`${i}:screenshot`,"screenshot",`.popmelt/${t.screenshotPath.replace(/^\.popmelt\//,"")}`,r,t.screenshotPath.endsWith(".png")?"image/png":"image/webp"));for(let[e,s]of(t.pastedImagePaths??[]).entries())a.push(P(`${i}:image:${e}`,"image",s,r));N.set(i,a)}let F=(e,t,i)=>({id:e,schemaVersion:1,projectId:E,createdAt:q,participantId:t,sourceRefs:i}),O=(e,t)=>{B.push(t);let i=D.get(e)??[];i.push(t.id),D.set(e,i)},Q=[{...F(x,x,[]),recordType:"participant",kind:"human",displayName:"Legacy project owner",status:"active"},{...F(S,S,[]),recordType:"participant",kind:"ai",displayName:"Legacy coding agent",status:"active"}];B.push(...Q),B.push({...F(k,x,[]),recordType:"subject",subjectType:"project",label:s(process.cwd(),n)||n,aliases:[],locators:[{id:I(w,"locator",n,A),kind:"project_root",value:n,status:"current",validFrom:v(A),sourceRefs:[]}]});let V=new Map,z=(e,t)=>{let i=V.get(e);if(i)return i;let r=I(w,"subject",e,t),a={...F(r,x,[{kind:"external",id:e}]),createdAt:v(t),recordType:"subject",subjectType:"element",label:e,aliases:[],locators:[{id:I(w,"locator",e,t),kind:"dom_selector",value:e,status:"current",validFrom:v(t),sourceRefs:[{kind:"external",id:e}]}]};return B.push(a),V.set(e,r),r};for(let{key:e,value:i}of u){let r,a,s=i.id??e,o=i.createdAt??A,d=I(w,"thread",s,o),c={kind:"thread",id:s},p=[],l=[],u=Array.isArray(i.messages)?i.messages:[],m=0,f=new Map;u.forEach((e,u)=>{let y=e.timestamp??o,h=I(w,"artifact",`${s}:message:${u}`,y);p.push(h),M.push({id:h,kind:"message",mediaType:"application/json",location:`.popmelt/threads.json#/threads/${s}/messages/${u}`,availability:"available"}),C.set(`.popmelt/threads.json#/threads/${s}/messages/${u}`,h),e.screenshotPath&&P(`${s}:message:${u}:screenshot`,"screenshot",e.screenshotPath,y);let g=[];if(e.visualComparison&&e.jobId){for(let t of["before","after"]){let i=e.visualComparison[t];i&&g.push(P(`${s}:${e.jobId}:${t}`,"screenshot",i,y,"image/webp"))}f.set(e.jobId,g)}let b=e.reactionToVisualJobId?f.get(e.reactionToVisualJobId)??[]:[];if("human"===e.role){r=e;let t=e.feedbackSummary??e.replyToQuestion;if(t?.trim()){let e=I(w,"observation",`${s}:${u}`,y),r=i.elementIdentifiers??[],n={...F(e,x,[c,{kind:"message",id:h}]),createdAt:v(y),recordType:"observation",state:"open",statement:t,captureContext:{subjectIds:r.map(e=>z(e,o)),artifactIds:[...new Set([h,...g,...b])]},resolvedByIds:[]};O(s,n),a=e,l.push({entityType:"observation",entityId:e})}return}if("assistant"!==e.role)return;let _=e.jobId??`${s}:${u}`,j=I(w,"iteration",_,y),T=R.get(_),A=e.cancelled?"cancelled":e.error?"failed":e.question?"question_asked":(e.resolutions?.length??0)>0?"completed":"no_change",E={...F(j,S,[c,{kind:"message",id:h},...(N.get(_)??[]).map(e=>({kind:"artifact",id:e}))]),createdAt:v(y),recordType:"iteration",threadIds:[d],startedAt:v(r?.timestamp,y),completedAt:v(y),requestSummary:$(r?.feedbackSummary,r?.replyToQuestion)??"[legacy request unavailable]",responseSummary:e.question??e.error??e.responseText?.slice(0,1e3),outcome:A,execution:{provider:e.provider??T?.provider,model:e.model??T?.model,sessionId:e.sessionId??T?.sessionId},artifactIds:[h,...N.get(_)??[]]};O(s,E),l.push({entityType:"iteration",entityId:j});let q=e.resolutions??T?.resolutions??[];for(let[e,a]of q.entries()){if("resolved"!==a.status||!a.summary?.trim())continue;let d=i.elementIdentifiers??[],p=(d.length?d:[n]).map(e=>({subjectId:e===n?k:z(e,o),role:"governed"})),u=I(w,"proposal",`${_}:${a.annotationId??"resolution"}:${e}`,y),m={...F(u,S,[c,{kind:"iteration",id:j}]),createdAt:v(y),recordType:"proposal",state:"pending",claim:a.summary,subjects:p,subjectSemantics:p.length>1?"Legacy thread grouped these selected elements; independent scope requires owner review.":void 0,origin:{mode:"inferred",sourceText:$(r?.feedbackSummary,r?.replyToQuestion,a.summary),iterationId:j,inferredById:S}};O(s,m),l.push({entityType:"proposal",entityId:u}),t.push({severity:"warning",code:"acceptance_unresolved",source:s,message:`Proposal ${u} remains pending; legacy resolved status proves an outcome, not explicit acceptance.`})}if(q.some(e=>"resolved"===e.status)||T?.gitDiff){let e=I(w,"implementation",_,y),t={...F(e,S,[c,{kind:"iteration",id:j}]),createdAt:v(y),recordType:"implementation_attempt",state:"completed",iterationIds:[j],coverageClaims:[],summary:q.map(e=>e.summary).filter(Boolean).join(" ")||"Legacy implementation outcome.",artifactIds:[]};O(s,t),l.push({entityType:"implementation_attempt",entityId:e}),m+=1}a&&(a=void 0)});let y=u.at(-1),h={...F(d,x,[c]),createdAt:v(o),recordType:"thread",state:y?.question?"open":"resolved",messageArtifactIds:p,outcome:y?.question?"question_unresolved":m?"implementation_only":"no_outcome",resultRefs:l};B.push(h),D.set(s,[d,...D.get(s)??[]])}let L=function(e){let t=g(e);if(!t)return 0;let i=0,r=e=>{let t=g(e);if(t)for(let e of Object.values(t))r(e);else i+=1};for(let e of Object.values(t))r(e);return i}(c);L&&t.push({severity:"warning",code:"model_entries_deferred",source:".popmelt/model.json",message:`${L} model values were not promoted because their accepted decision provenance is unresolved.`});let W={manifest:{formatVersion:1,projectId:E,createdAt:v(A),updatedAt:q,features:["authority","subjects","implementations","portable_artifacts","bounded_retrieval"],writer:{name:"@popmelt.com/core legacy importer",version:e.writerVersion??"0.8.4-dev"}},records:B,events:[],relationships:[],artifacts:M,tombstones:[]},J=y(W),K=(e.proofCaseIds??h).map(e=>({legacyId:e,threadFound:u.some(({key:t,value:i})=>(i.id??t)===e),decisionEnvelopeFound:R.has(e),recordIds:D.get(e)??[]}));return{bundle:W,report:{projectRoot:n,source:{threads:u.length,messages:u.reduce((e,t)=>e+(t.value.messages?.length??0),0),decisionEnvelopes:j.length,modelEntries:L,artifactsReferenced:M.length},imported:_(B),unresolvedAcceptance:t.filter(e=>"acceptance_unresolved"===e.code).length,deferredModelEntries:L,proofCases:K,issues:t,schemaIssues:J.issues}}}export{o as a,y as b,I as c,j as d};
|
|
@@ -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-ECMLCGAM.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,L=p?16:0,R=x(t,b,Math.max(60,c-L)),w=L+t.measureText(R).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(R,M.x+L,A)}function L(t=22){return{height:t,minHeight:t,maxHeight:t,boxSizing:"border-box",flexShrink:0}}function R(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 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=I(Number.parseFloat(o)||0),[i="1",n=i]=e.scale.trim().split(/\s+/);return{...W(r,W(B(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 G(t){let e=W(Q(t),D(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),D(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=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),L=(e.topRight.x-e.topLeft.x)/i,R=(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+L*o.x+w*o.y,y:e.topLeft.y+R*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=z(i,{x:o*n,y:0}),h=z(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 Lt(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 Rt(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,Lt as T,Rt 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,L as o,R 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};
|
|
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 +1 @@
|
|
|
1
|
-
"use client";import{e}from"./chunk-
|
|
1
|
+
"use client";import{e}from"./chunk-RJWFSAKE.mjs";import{w as t}from"./chunk-P2WAXWAZ.mjs";import{a as n}from"./chunk-2F2BVGFH.mjs";import{d as r}from"./chunk-RWZ7SVMO.mjs";import{l as o}from"./chunk-5IZHN3A7.mjs";import{h as i}from"./chunk-VXRRHXUP.mjs";import{b as l}from"./chunk-6RMM7JB6.mjs";import{useState as a,useEffect as d,useRef as s,useLayoutEffect as c}from"react";import{jsxs as p,jsx as m,Fragment as u}from"react/jsx-runtime";function v({tree:e,x:t,y:n}){let o=s(null);return c(()=>{let t=o.current,n=t.shadowRoot??t.attachShadow({mode:"open"}),i=r(e,t.ownerDocument,"preview");if(i)return i.style.margin="0",n.replaceChildren(i),()=>n.replaceChildren()},[e]),m("div",{ref:o,"data-devtools":"placement-card-ghost",inert:!0,"aria-hidden":"true",style:{position:"fixed",left:t,top:n,display:"grid",width:"max-content",transform:"translate(-50%, -50%)",pointerEvents:"none",opacity:.48,zIndex:2}})}function f({sample:r,initialPoint:f,getSubjects:h,onPlace:y,onCancel:w,color:x}){let[g,k]=a(null),[E,P]=a("");d(()=>{let e=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopImmediatePropagation(),w())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[w]);let j=s(f),R=s(null),I=(t,n)=>e(r,i(t,n),{x:t,y:n},h());c(()=>{let t=()=>{let t=j.current,n=R.current;if(!n||!t)return k(null);let o=n.getRootNode();if(!n.contains(o.elementFromPoint(t.x,t.y)))return k(null);try{k(e(r,i(t.x,t.y),t,h()))}catch{k(null)}};return t(),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}},[r,h]);let L=g?.objectPlacement,b=g?.payload.canvases?.[0]?.value;c(()=>{if(L?.preview&&void 0!==b)try{L.preview(b)}catch{}},[L,b]),c(()=>()=>{try{L?.preview?.(null)}catch{}},[L]);return p("div",{ref:R,"data-devtools":"sample-placement",style:{position:"fixed",inset:0,zIndex:10003,pointerEvents:"auto",cursor:o(x)},onPointerMove:e=>((e,t)=>{j.current={x:e,y:t};try{k(I(e,t))}catch{k(null)}})(e.clientX,e.clientY),onPointerLeave:()=>{j.current=null,k(null)},onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation(),((e,t)=>{try{let r=I(e,t);if(!r)return;let o=r.payload.placedElement;o&&(o.sourceSlot=n(o,r.target)),y(r.payload)}catch(e){P(e instanceof Error?e.message:"Could not place this sample.")}})(e.clientX,e.clientY)},children:[E&&m("div",{role:"alert",style:{position:"fixed",zIndex:4,left:"50%",top:12,transform:"translateX(-50%)",background:"#111",color:"white",padding:"5px 9px",borderRadius:8,font:`12px/16px ${l}`,pointerEvents:"none"},children:E}),g&&p(u,{children:[m(t,{element:g.target,color:x,spotlight:!0,hideTooltip:!0,hideFill:!0,outlineZIndex:1}),"element"===r.kind&&m(v,{tree:r.tree,x:g.pointer.x,y:g.pointer.y}),g.marker&&m("div",{"data-devtools":"placement-insertion-line",style:{position:"fixed",...g.marker,pointerEvents:"none",zIndex:2,borderRadius:4,backgroundColor:x}})]})]})}export{f as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./chunk-
|
|
1
|
+
import{b as e}from"./chunk-AEC67LMY.mjs";import{J as t,K as a,h as r,o}from"./chunk-VG4ZV2OT.mjs";import{readFile as s,readdir as n,realpath as i,stat as c}from"fs/promises";import{dirname as p,join as l,parse as m,relative as u,resolve as d,sep as f}from"path";async function w(e){return c(e).then(()=>!0,()=>!1)}async function h(e){try{let t=JSON.parse(await s(e,"utf8"));return"@popmelt.com/core"===t.name||["dependencies","devDependencies","peerDependencies"].some(e=>{let a=t[e];return!(!a||"object"!=typeof a||!Object.prototype.hasOwnProperty.call(a,"@popmelt.com/core"))})}catch{return!1}}async function y(e){return i(e).catch(()=>d(e))}async function j(e){let t=new Set;try{let a=await s(l(e,"pnpm-workspace.yaml"),"utf8");for(let r of a.matchAll(/^\s*-\s*['"]?([^'"\r\n]+)['"]?\s*$/gm)){let a=r[1].trim().split(/[*{[]/,1)[0].replace(/\/$/,"");a&&t.add(d(e,a))}}catch{}try{let a=JSON.parse(await s(l(e,"package.json"),"utf8")),r=Array.isArray(a.workspaces)?a.workspaces:a.workspaces?.packages??[];for(let a of r){let r=a.split(/[*{[]/,1)[0].replace(/\/$/,"");r&&t.add(d(e,r))}}catch{}return[...t]}var k=new Set([".git",".next",".turbo","build","coverage","dist","node_modules","vendor"]);async function g(e,t=5){let a=[],r=async(e,o)=>{if(o>t)return;let s;try{s=await n(e,{withFileTypes:!0})}catch{return}s.some(e=>e.isDirectory()&&".popmelt"===e.name)&&a.push(e),await Promise.all(s.flatMap(t=>!t.isDirectory()||".popmelt"===t.name||k.has(t.name)?[]:[r(l(e,t.name),o+1)]))};return await r(e,0),a}function b(e,t){let a=u(e,t);return a?a.split(f).filter(Boolean).length:0}async function I(e=process.cwd()){let a=await y(e),o=a,s=m(o).root,n=new Map,i=(e,t)=>{let a=n.get(e)??new Set;a.add(t),n.set(e,a)},c=[];for(;await w(l(o,".popmelt"))&&i(o,"store"),await w(l(o,".popmelt","ambient.json"))&&i(o,"marker"),await h(l(o,"package.json"))&&i(o,"package"),await h(l(o,"packages","popmelt","package.json"))&&i(o,"workspace_package"),(await j(o)).length&&c.push(o),o!==s;)o=p(o);for(let e of c){let t=await j(e),a=await Promise.all(t.map(e=>g(e)));for(let e of a.flat())i(await y(e),"store")}return(await Promise.all([...n].map(async([e,a])=>{let o=await y(e),s=await t(o),n=[...a].sort();return{root:o,storeId:s.storeId,projectId:r(o),reason:n[0],reasons:n,initialized:a.has("store")}}))).sort((e,t)=>e.initialized!==t.initialized?e.initialized?-1:1:b(a,e.root)-b(a,t.root)||e.root.localeCompare(t.root))}async function O(e=process.cwd()){return(await I(e))[0]??null}function P(){return process.env.POPMELT_EXECUTION_OWNER}function v(){return P()===o}async function E(t){let r=await a(t.root);return{...await e({projectRoot:t.root,detached:!0,manageLease:!1}),storeId:r.storeId}}async function S(e,t,a={}){let r=await fetch(`http://127.0.0.1:${e.port}${t}`,{...a,headers:{"Content-Type":"application/json","X-Popmelt-Project-Id":e.projectId,...a.headers}}),o=await r.json().catch(()=>null);return{response:r,body:o}}export{I as a,O as b,P as c,v as d,E as e,S as f};
|