@hazem3500/komo 0.9.14 → 0.9.16
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/README.md +2 -1
- package/dist/accent-picker-KV4WUTUN.js +1 -0
- package/dist/agent-prompt.js +1 -1
- package/dist/anchors.d.ts +1 -1
- package/dist/chunk-53M6AOAX.js +1 -0
- package/dist/chunk-65SLG7FY.js +1 -0
- package/dist/chunk-WGISPOJV.js +1 -0
- package/dist/design-comment-K2JCM7IT.js +1 -0
- package/dist/design-export-G42ZDP5F.js +1 -0
- package/dist/design-mode-styles.d.ts +1 -1
- package/dist/design-mode.js +1 -1
- package/dist/design-panel-VLR2UILF.js +1 -0
- package/dist/highlight.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/inline-text-editor-Z2N32PER.js +1 -0
- package/dist/node.mjs +1 -1
- package/dist/onboarding-BYM5KIZI.js +1 -0
- package/dist/picker-CMP4UZRF.js +1 -0
- package/dist/react-props-panel-NC7KLZ73.js +1 -0
- package/dist/react.js +1 -1
- package/dist/select-menu-IY5BJMFM.js +1 -0
- package/dist/setup.js +1 -1
- package/dist/tag-editor-ES4VZCEQ.js +1 -0
- package/dist/tag-editor.d.ts +2 -0
- package/dist/token-picker-XXX4L3Y7.js +1 -0
- package/dist/toolbar-runtime-AQBTB2UG.js +1 -0
- package/dist/types.d.ts +9 -0
- package/package.json +1 -1
- package/server/setup-client.txt +51 -51
- package/src/types.ts +7 -0
- package/dist/accent-picker-XA4ZRYML.js +0 -1
- package/dist/chunk-7YUXYVQA.js +0 -1
- package/dist/chunk-I7AUKTXE.js +0 -1
- package/dist/chunk-RCC6R6PS.js +0 -1
- package/dist/design-comment-MPAF2YAN.js +0 -1
- package/dist/design-export-DK7XZXBR.js +0 -1
- package/dist/design-panel-E5I2NED2.js +0 -1
- package/dist/inline-text-editor-TZNY2BNK.js +0 -1
- package/dist/onboarding-XR3ZKGRF.js +0 -1
- package/dist/picker-WQN53YJ5.js +0 -1
- package/dist/react-props-panel-HWQ7WERB.js +0 -1
- package/dist/select-menu-IA6BOUCR.js +0 -1
- package/dist/tag-editor-KGH3ZCAT.js +0 -1
- package/dist/token-picker-XGRBJUNM.js +0 -1
- package/dist/toolbar-runtime-E4B67FWV.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t={type:"spring",duration:.4,bounce:.24},e={duration:.1,ease:[.4,0,.2,1]},i={duration:.25,ease:[.22,1,.36,1]},n={type:"spring",duration:.4,bounce:.3},r={type:"spring",duration:.12,bounce:.3},s=.2,a=.02;function o(t,e){return{width:Math.min(t,t>250?280:200),height:e>52?32:28}}function l(t,e,i,n){return{left:t-i/2,top:e-n,width:i,height:n}}function u(t,e){let i=t.indexOf(e);i>-1&&t.splice(i,1)}var h=(t,e,i)=>i>e?e:i<t?t:i,d={},p=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),m=t=>/^0[^.\s]+$/u.test(t);function c(t){let e;return()=>(void 0===e&&(e=t()),e)}var f=t=>t,g=(...t)=>t.reduce((t,e)=>i=>e(t(i))),y=(t,e,i)=>{let n=e-t;return n?(i-t)/n:1},v=class{constructor(){this.subscriptions=[]}add(t){return function(t,e){-1===t.indexOf(e)&&t.push(e)}(this.subscriptions,t),()=>u(this.subscriptions,t)}notify(t,e,i){let n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,i);else for(let r=0;r<n;r++){let n=this.subscriptions[r];n&&n(t,e,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},b=t=>1e3*t,T=t=>t/1e3,w=(t,e)=>e?t*(1e3/e):0,M=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function S(t,e,i,n){return t===e&&i===n?f:r=>0===r||1===r?r:M((e=>function(t,e,i,n,r){let s,a,o=0;do{a=e+(i-e)/2,s=M(a,n,r)-t,s>0?i=a:e=a}while(Math.abs(s)>1e-7&&++o<12);return a}(e,0,1,t,i))(r),e,n)}var A=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,k=t=>e=>1-t(1-e),V=S(.33,1.53,.69,.99),x=k(V),C=A(x),F=t=>t>=1?1:(t*=2)<1?.5*x(t):.5*(2-Math.pow(2,-10*(t-1))),P=t=>1-Math.sin(Math.acos(t)),R=k(P),E=A(P),D=S(.42,0,1,1),I=S(0,0,.58,1),O=S(.42,0,.58,1),B=t=>Array.isArray(t)&&"number"!=typeof t[0];function N(t,e){return B(t)?t[((t,e,i)=>{let n=e-0;return((i-0)%n+n)%n+0})(0,t.length,e)]:t}var K=t=>Array.isArray(t)&&"number"==typeof t[0],j={linear:f,easeIn:D,easeInOut:O,easeOut:I,circIn:P,circInOut:E,circOut:R,backIn:x,backInOut:C,backOut:V,anticipate:F},W=t=>{if(K(t)){t.length;let[e,i,n,r]=t;return S(e,i,n,r)}return(t=>"string"==typeof t)(t)?j[t]:t},L=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function $(t,e){let i=!1,n=!0,r={delta:0,timestamp:0,isProcessing:!1},s=()=>i=!0,a=L.reduce((t,e)=>(t[e]=function(t){let e=new Set,i=new Set,n=!1,r=!1,s=new WeakSet,a={delta:0,timestamp:0,isProcessing:!1};function o(e){s.has(e)&&(l.schedule(e),t()),e(a)}let l={schedule:(t,r=!1,a=!1)=>{let o=a&&n?e:i;return r&&s.add(t),o.add(t),t},cancel:t=>{i.delete(t),s.delete(t)},process:t=>{if(a=t,n)return void(r=!0);n=!0;let s=e;e=i,i=s,e.forEach(o),e.clear(),n=!1,r&&(r=!1,l.process(t))}};return l}(s),t),{}),{setup:o,read:l,resolveKeyframes:u,preUpdate:h,update:p,preRender:m,render:c,postRender:f}=a,g=()=>{let s=d.useManualTiming,a=s?r.timestamp:performance.now();i=!1,s||(r.delta=n?1e3/60:Math.max(Math.min(a-r.timestamp,40),1)),r.timestamp=a,r.isProcessing=!0,o.process(r),l.process(r),u.process(r),h.process(r),p.process(r),m.process(r),c.process(r),f.process(r),r.isProcessing=!1,i&&e&&(n=!1,t(g))};return{schedule:L.reduce((e,s)=>{let o=a[s];return e[s]=(e,s=!1,a=!1)=>(i||(()=>{i=!0,n=!0,r.isProcessing||t(g)})(),o.schedule(e,s,a)),e},{}),cancel:t=>{for(let e=0;e<L.length;e++)a[L[e]].cancel(t)},state:r,steps:a}}var Y,{schedule:U,cancel:X,state:q,steps:z}=$(typeof requestAnimationFrame<"u"?requestAnimationFrame:f,!0);function Z(){Y=void 0}var _={now:()=>(void 0===Y&&_.set(q.isProcessing||d.useManualTiming?q.timestamp:performance.now()),Y),set:t=>{Y=t,queueMicrotask(Z)}},G=t=>e=>"string"==typeof e&&e.startsWith(t),H=G("--"),J=G("var(--"),Q=t=>!!J(t)&&tt.test(t.split("/*")[0].trim()),tt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function et(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}var it={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},nt={...it,transform:t=>h(0,1,t)},rt={...it,default:1},st=t=>Math.round(1e5*t)/1e5,at=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,ot=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,lt=(t,e)=>i=>!!("string"==typeof i&&ot.test(i)&&i.startsWith(t)||e&&!function(t){return null==t}(i)&&Object.prototype.hasOwnProperty.call(i,e)),ut=(t,e,i)=>n=>{if("string"!=typeof n)return n;let[r,s,a,o]=n.match(at);return{[t]:parseFloat(r),[e]:parseFloat(s),[i]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},ht={...it,transform:t=>Math.round((t=>h(0,255,t))(t))},dt={test:lt("rgb","red"),parse:ut("red","green","blue"),transform:({red:t,green:e,blue:i,alpha:n=1})=>"rgba("+ht.transform(t)+", "+ht.transform(e)+", "+ht.transform(i)+", "+st(nt.transform(n))+")"},pt={test:lt("#"),parse:function(t){let e="",i="",n="",r="";return t.length>5?(e=t.substring(1,3),i=t.substring(3,5),n=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),i=t.substring(2,3),n=t.substring(3,4),r=t.substring(4,5),e+=e,i+=i,n+=n,r+=r),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:r?parseInt(r,16)/255:1}},transform:dt.transform},mt=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),ct=mt("deg"),ft=mt("%"),gt=mt("px"),yt=mt("vh"),vt=mt("vw"),bt={...ft,parse:t=>ft.parse(t)/100,transform:t=>ft.transform(100*t)},Tt={test:lt("hsl","hue"),parse:ut("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:i,alpha:n=1})=>"hsla("+Math.round(t)+", "+ft.transform(st(e))+", "+ft.transform(st(i))+", "+st(nt.transform(n))+")"},wt={test:t=>dt.test(t)||pt.test(t)||Tt.test(t),parse:t=>dt.test(t)?dt.parse(t):Tt.test(t)?Tt.parse(t):pt.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?dt.transform(t):Tt.transform(t),getAnimatableNone:t=>{let e=wt.parse(t);return e.alpha=0,wt.transform(e)}},Mt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,St="number",At="color",kt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Vt(t){let e=t.toString(),i=[],n={color:[],number:[],var:[]},r=[],s=0,a=e.replace(kt,t=>(wt.test(t)?(n.color.push(s),r.push(At),i.push(wt.parse(t))):t.startsWith("var(")?(n.var.push(s),r.push("var"),i.push(t)):(n.number.push(s),r.push(St),i.push(parseFloat(t))),++s,"${}")).split("${}");return{values:i,split:a,indexes:n,types:r}}function xt({split:t,types:e}){let i=t.length;return n=>{let r="";for(let s=0;s<i;s++)if(r+=t[s],void 0!==n[s]){let t=e[s];r+=t===St?st(n[s]):t===At?wt.transform(n[s]):n[s]}return r}}var Ct={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(at)?.length||0)+(t.match(Mt)?.length||0)>0},parse:function(t){return Vt(t).values},createTransformer:function(t){return xt(Vt(t))},getAnimatableNone:function(t){let e=Vt(t);return xt(e)(e.values.map((t,i)=>((t,e)=>"number"==typeof t?e?.trim().endsWith("/")?t:0:(t=>"number"==typeof t?0:wt.test(t)?wt.getAnimatableNone(t):t)(t))(t,e.split[i])))}};function Ft(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function Pt(t,e){return i=>i>0?e:t}var Rt=(t,e,i)=>t+(e-t)*i,Et=(t,e,i)=>{let n=t*t,r=i*(e*e-n)+n;return r<0?0:Math.sqrt(r)},Dt=[pt,dt,Tt];function It(t){let e=(t=>Dt.find(e=>e.test(t)))(t);if(!e)return!1;let i=e.parse(t);return e===Tt&&(i=function({hue:t,saturation:e,lightness:i,alpha:n}){t/=360,i/=100;let r=0,s=0,a=0;if(e/=100){let n=i<.5?i*(1+e):i+e-i*e,o=2*i-n;r=Ft(o,n,t+1/3),s=Ft(o,n,t),a=Ft(o,n,t-1/3)}else r=s=a=i;return{red:Math.round(255*r),green:Math.round(255*s),blue:Math.round(255*a),alpha:n}}(i)),i}var Ot=(t,e)=>{let i=It(t),n=It(e);if(!i||!n)return Pt(t,e);let r={...i};return t=>(r.red=Et(i.red,n.red,t),r.green=Et(i.green,n.green,t),r.blue=Et(i.blue,n.blue,t),r.alpha=Rt(i.alpha,n.alpha,t),dt.transform(r))},Bt=new Set(["none","hidden"]);function Nt(t,e){return i=>Rt(t,e,i)}function Kt(t){return"number"==typeof t?Nt:"string"==typeof t?Q(t)?Pt:wt.test(t)?Ot:Lt:Array.isArray(t)?jt:"object"==typeof t?wt.test(t)?Ot:Wt:Pt}function jt(t,e){let i=[...t],n=i.length,r=t.map((t,i)=>Kt(t)(t,e[i]));return t=>{for(let e=0;e<n;e++)i[e]=r[e](t);return i}}function Wt(t,e){let i={...t,...e},n={};for(let r in i)void 0!==t[r]&&void 0!==e[r]&&(n[r]=Kt(t[r])(t[r],e[r]));return t=>{for(let e in n)i[e]=n[e](t);return i}}var Lt=(t,e)=>{let i=Ct.createTransformer(e),n=Vt(t),r=Vt(e);return n.indexes.var.length===r.indexes.var.length&&n.indexes.color.length===r.indexes.color.length&&n.indexes.number.length>=r.indexes.number.length?Bt.has(t)&&!r.values.length||Bt.has(e)&&!n.values.length?function(t,e){return Bt.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):g(jt(function(t,e){let i=[],n={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){let s=e.types[r],a=t.indexes[s][n[s]],o=t.values[a]??0;i[r]=o,n[s]++}return i}(n,r),r.values),i):Pt(t,e)};function $t(t,e,i){return"number"==typeof t&&"number"==typeof e&&"number"==typeof i?Rt(t,e,i):Kt(t)(t,e)}var Yt=t=>{let e=({timestamp:e})=>t(e);return{start:(t=!0)=>U.update(e,t),stop:()=>X(e),now:()=>q.isProcessing?q.timestamp:_.now()}},Ut=(t,e,i=10)=>{let n="",r=Math.max(Math.round(e/i),2);for(let e=0;e<r;e++)n+=Math.round(1e4*t(e/(r-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`};function Xt(t){let e=0,i=t.next(e);for(;!i.done&&e<2e4;)e+=50,i=t.next(e);return e>=2e4?1/0:e}function qt(t,e=100,i){let n=i({...t,keyframes:[0,e]}),r=Math.min(Xt(n),2e4);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:T(r)}}function zt(t,e){return t*Math.sqrt(1-e*e)}var Zt=.001,_t=["duration","bounce"],Gt=["stiffness","damping","mass"];function Ht(t,e){return e.some(e=>void 0!==t[e])}function Jt(t=.3,e=.3){let i,n,r,s,a,o,l="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t,{restSpeed:u,restDelta:d}=l,p=l.keyframes[0],m=l.keyframes[l.keyframes.length-1],c={done:!1,value:p},{stiffness:f,damping:g,mass:y,duration:v,velocity:w,isResolvedFromDuration:M}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Ht(t,Gt)&&Ht(t,_t))if(e.velocity=0,t.visualDuration){let i=t.visualDuration,n=2*Math.PI/(1.2*i),r=n*n,s=2*h(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:1,stiffness:r,damping:s}}else{let i=function({duration:t=800,bounce:e=.3,velocity:i=0,mass:n=1}){let r,s;b(10);let a=1-e;a=h(.05,1,a),t=h(.01,10,T(t)),a<1?(r=e=>{let n=e*a,r=n*t,s=n-i,o=zt(e,a),l=Math.exp(-r);return Zt-s/o*l},s=e=>{let n=e*a*t,s=n*i+i,o=Math.pow(a,2)*Math.pow(e,2)*t,l=Math.exp(-n),u=zt(Math.pow(e,2),a);return(-r(e)+Zt>0?-1:1)*((s-o)*l)/u}):(r=e=>Math.exp(-e*t)*((e-i)*t+1)-Zt,s=e=>Math.exp(-e*t)*(t*t*(i-e)));let o=function(t,e,i){let n=i;for(let i=1;i<12;i++)n-=t(n)/e(n);return n}(r,s,5/t);if(t=b(t),isNaN(o))return{stiffness:100,damping:10,duration:t};{let e=Math.pow(o,2)*n;return{stiffness:e,damping:2*a*Math.sqrt(n*e),duration:t}}}({...t,velocity:0});e={...e,...i,mass:1},e.isResolvedFromDuration=!0}return e}({...l,velocity:-T(l.velocity||0)}),S=w||0,A=g/(2*Math.sqrt(f*y)),k=m-p,V=T(Math.sqrt(f/y)),x=Math.abs(k)<5;if(u||(u=x?.01:2),d||(d=x?.005:.5),A<1)r=zt(V,A),s=(S+A*V*k)/r,i=t=>{let e=Math.exp(-A*V*t);return m-e*(s*Math.sin(r*t)+k*Math.cos(r*t))},a=A*V*s+k*r,o=A*V*k-s*r,n=t=>Math.exp(-A*V*t)*(a*Math.sin(r*t)+o*Math.cos(r*t));else if(1===A){i=t=>m-Math.exp(-V*t)*(k+(S+V*k)*t);let t=S+V*k;n=e=>Math.exp(-V*e)*(V*t*e-S)}else{let t=V*Math.sqrt(A*A-1);i=e=>{let i=Math.exp(-A*V*e),n=Math.min(t*e,300);return m-i*((S+A*V*k)*Math.sinh(n)+t*k*Math.cosh(n))/t};let e=(S+A*V*k)/t,r=A*V*e-k*t,s=A*V*k-e*t;n=e=>{let i=Math.exp(-A*V*e),n=Math.min(t*e,300);return i*(r*Math.sinh(n)+s*Math.cosh(n))}}let C={calculatedDuration:M&&v||null,velocity:t=>b(n(t)),next:t=>{if(!M&&A<1){let e=Math.exp(-A*V*t),i=Math.sin(r*t),n=Math.cos(r*t),l=m-e*(s*i+k*n),h=b(e*(a*i+o*n));return c.done=Math.abs(h)<=u&&Math.abs(m-l)<=d,c.value=c.done?m:l,c}let e=i(t);if(M)c.done=t>=v;else{let i=b(n(t));c.done=Math.abs(i)<=u&&Math.abs(m-e)<=d}return c.value=c.done?m:e,c},toString:()=>{let t=Math.min(Xt(C),2e4),e=Ut(e=>C.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return C}function Qt(t,e,i){let n=Math.max(e-5,0);return w(i-t(n),e-n)}function te({keyframes:t,velocity:e=0,power:i=.8,timeConstant:n=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:h}){let d=t[0],p={done:!1,value:d},m=t=>void 0===o?l:void 0===l||Math.abs(o-t)<Math.abs(l-t)?o:l,c=i*e,f=d+c,g=void 0===a?f:a(f);g!==f&&(c=g-d);let y,v,b=t=>-c*Math.exp(-t/n),T=t=>g+b(t),w=t=>{let e=b(t),i=T(t);p.done=Math.abs(e)<=u,p.value=p.done?g:i},M=t=>{(t=>void 0!==o&&t<o||void 0!==l&&t>l)(p.value)&&(y=t,v=Jt({keyframes:[p.value,m(p.value)],velocity:Qt(T,t,p.value),damping:r,stiffness:s,restDelta:u,restSpeed:h}))};return M(0),{calculatedDuration:null,next:t=>{let e=!1;return!v&&void 0===y&&(e=!0,w(t),M(t)),void 0!==y&&t>=y?v.next(t-y):(!e&&w(t),p)}}}function ee(t,e){let i=t[t.length-1];for(let n=1;n<=e;n++){let r=y(0,e,n);t.push(Rt(i,1,r))}}function ie(t){let e=[0];return ee(e,t.length-1),e}function ne(t,e){return t.map(()=>e||O).splice(0,t.length-1)}function re({duration:t=300,keyframes:e,times:i,ease:n="easeInOut"}){let r=B(n)?n.map(W):W(n),s={done:!1,value:e[0]},a=function(t,e){return t.map(t=>t*e)}(i&&i.length===e.length?i:ie(e),t),o=function(t,e,{clamp:i=!0,ease:n,mixer:r}={}){let s=t.length;if(e.length,1===s)return()=>e[0];if(2===s&&e[0]===e[1])return()=>e[1];let a=t[0]===t[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());let o=function(t,e,i){let n=[],r=i||d.mix||$t,s=t.length-1;for(let i=0;i<s;i++){let s=r(t[i],t[i+1]);if(e){let t=Array.isArray(e)?e[i]||f:e;s=g(t,s)}n.push(s)}return n}(e,n,r),l=o.length,u=i=>{if(a&&i<t[0])return e[0];let n=0;if(l>1)for(;n<t.length-2&&!(i<t[n+1]);n++);let r=y(t[n],t[n+1],i);return o[n](r)};return i?e=>u(h(t[0],t[s-1],e)):u}(a,e,{ease:Array.isArray(r)?r:ne(e,r)});return{calculatedDuration:t,next:e=>(s.value=o(e),s.done=e>=t,s)}}Jt.applyToOptions=t=>{let e=qt(t,100,Jt);return t.ease=e.ease,t.duration=b(e.duration),t.type="keyframes",t};var se=t=>null!==t;function ae(t,{repeat:e,repeatType:i="loop"},n,r=1){let s=t.filter(se),a=r<0||e&&"loop"!==i&&e%2==1?0:s.length-1;return a&&void 0!==n?n:s[a]}var oe={decay:te,inertia:te,tween:re,keyframes:re,spring:Jt};function le(t){"string"==typeof t.type&&(t.type=oe[t.type])}var ue=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}},he=t=>t/100,de=class extends ue{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:t}=this.options;t&&t.updatedAt!==_.now()&&this.tick(_.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){let{options:t}=this;le(t);let{type:e=re,repeat:i=0,repeatDelay:n=0,repeatType:r,velocity:s=0}=t,{keyframes:a}=t,o=e||re;o!==re&&"number"!=typeof a[0]&&(this.mixKeyframes=g(he,$t(a[0],a[1])),a=[0,100]);let l=o({...t,keyframes:a});"mirror"===r&&(this.mirroredGenerator=o({...t,keyframes:[...a].reverse(),velocity:-s})),null===l.calculatedDuration&&(l.calculatedDuration=Xt(l));let{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+n,this.totalDuration=this.resolvedDuration*(i+1)-n,this.generator=l}updateTime(t){let e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){let{generator:i,totalDuration:n,mixKeyframes:r,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return i.next(0);let{delay:l=0,keyframes:u,repeat:d,repeatType:p,repeatDelay:m,type:c,onUpdate:f,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-n/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);let y=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>n;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let b,T=this.currentTime,w=i;if(d){let t=Math.min(this.currentTime,n)/a,e=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),1===i&&e--,e=Math.min(e,d+1),e%2&&("reverse"===p?(i=1-i,m&&(i-=m/a)):"mirror"===p&&(w=s)),T=h(0,1,i)*a}v?(this.delayState.value=u[0],b=this.delayState):b=w.next(T),r&&!v&&(b.value=r(b.value));let{done:M}=b;!v&&null!==o&&(M=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);let S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&M);return S&&c!==te&&(b.value=ae(u,this.options,g,this.speed)),f&&f(b.value),S&&this.finish(),b}then(t,e){return this.finished.then(t,e)}get duration(){return T(this.calculatedDuration)}get iterationDuration(){let{delay:t=0}=this.options||{};return this.duration+T(t)}get time(){return T(this.currentTime)}set time(t){t=b(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){let t=this.currentTime;return t<=0?this.options.velocity||0:this.generator.velocity?this.generator.velocity(t):Qt(t=>this.generator.next(t).value,t,this.generator.next(t).value)}get speed(){return this.playbackSpeed}set speed(t){let e=this.playbackSpeed!==t;e&&this.driver&&this.updateTime(_.now()),this.playbackSpeed=t,e&&this.driver&&(this.time=T(this.currentTime))}play(){if(this.isStopped)return;let{driver:t=Yt,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();let i=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=i):null!==this.holdTime?this.startTime=i-this.holdTime:this.startTime||(this.startTime=e??i),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(_.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}},pe=t=>180*t/Math.PI,me=t=>{let e=pe(Math.atan2(t[1],t[0]));return fe(e)},ce={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:me,rotateZ:me,skewX:t=>pe(Math.atan(t[1])),skewY:t=>pe(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},fe=t=>((t%=360)<0&&(t+=360),t),ge=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ye=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),ve={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ge,scaleY:ye,scale:t=>(ge(t)+ye(t))/2,rotateX:t=>fe(pe(Math.atan2(t[6],t[5]))),rotateY:t=>fe(pe(Math.atan2(-t[2],t[0]))),rotateZ:me,rotate:me,skewX:t=>pe(Math.atan(t[4])),skewY:t=>pe(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function be(t){return t.includes("scale")?1:0}function Te(t,e){if(!t||"none"===t)return be(e);let i,n,r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(r)i=ve,n=r;else{let e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=ce,n=e}if(!n)return be(e);let s=i[e],a=n[1].split(",").map(we);return"function"==typeof s?s(a):a[s]}function we(t){return parseFloat(t.trim())}var Me=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Se=new Set([...Me,"pathRotation"]),Ae=t=>t===it||t===gt,ke=new Set(["x","y","z"]),Ve=Me.filter(t=>!ke.has(t)),xe={width:({x:t},{paddingLeft:e="0",paddingRight:i="0",boxSizing:n})=>{let r=t.max-t.min;return"border-box"===n?r:r-parseFloat(e)-parseFloat(i)},height:({y:t},{paddingTop:e="0",paddingBottom:i="0",boxSizing:n})=>{let r=t.max-t.min;return"border-box"===n?r:r-parseFloat(e)-parseFloat(i)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Te(e,"x"),y:(t,{transform:e})=>Te(e,"y")};xe.translateX=xe.x,xe.translateY=xe.y;var Ce=new Set,Fe=!1,Pe=!1,Re=!1;function Ee(){if(Pe){let t=Array.from(Ce).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),i=new Map;e.forEach(t=>{let e=function(t){let e=[];return Ve.forEach(i=>{let n=t.getValue(i);void 0!==n&&(e.push([i,n.get()]),n.set(i.startsWith("scale")?1:0))}),e}(t);e.length&&(i.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();let e=i.get(t);e&&e.forEach(([e,i])=>{t.getValue(e)?.set(i)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}Pe=!1,Fe=!1,Ce.forEach(t=>t.complete(Re)),Ce.clear()}function De(){Ce.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pe=!0)})}var Ie=class{constructor(t,e,i,n,r,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=i,this.motionValue=n,this.element=r,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(Ce.add(this),Fe||(Fe=!0,U.read(De),U.resolveKeyframes(Ee))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:t,name:e,element:i,motionValue:n}=this;if(null===t[0]){let r=n?.get(),s=t[t.length-1];if(void 0!==r)t[0]=r;else if(i&&e){let n=i.readValue(e,s);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=s),n&&void 0===r&&n.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ce.delete(this)}cancel(){"scheduled"===this.state&&(Ce.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}};function Oe(t,e,i){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,i):t.style[e]=i}var Be={};function Ne(t,e){let i=c(t);return()=>Be[e]??i()}var Ke=Ne(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),je=Ne(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),We=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,Le={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:We([0,.65,.55,1]),circOut:We([.55,0,1,.45]),backIn:We([.31,.01,.66,-.59]),backOut:We([.33,1.53,.69,.99])};function $e(t,e){if(t)return"function"==typeof t?je()?Ut(t,e):"ease-out":K(t)?We(t):Array.isArray(t)?t.map(t=>$e(t,e)||Le.easeOut):Le[t]}function Ye(t,e,i,{delay:n=0,duration:r=300,repeat:s=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u=void 0){let h={[e]:i};l&&(h.offset=l);let d=$e(o,r);Array.isArray(d)&&(h.easing=d);let p={delay:n,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:"reverse"===a?"alternate":"normal"};return u&&(p.pseudoElement=u),t.animate(h,p)}function Ue(t){return"function"==typeof t&&"applyToOptions"in t}var Xe=class extends ue{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;let{element:e,name:i,keyframes:n,pseudoElement:r,allowFlatten:s=!1,finalKeyframe:a,onComplete:o}=t;this.isPseudoElement=!!r,this.allowFlatten=s,this.options=t,t.type;let l=function({type:t,...e}){return Ue(t)&&je()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Ye(e,i,n,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){let t=ae(n,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(t),Oe(e,i,t),this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:t}=this;"idle"===t||"finished"===t||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){let t=this.animation.effect?.getComputedTiming?.().duration||0;return T(Number(t))}get iterationDuration(){let{delay:t=0}=this.options||{};return this.duration+T(t)}get time(){return T(Number(this.animation.currentTime)||0)}set time(t){let e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=b(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:i,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Ke()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),i&&(this.animation.rangeEnd=i),f):n(this)}},qe={anticipate:F,backInOut:C,circInOut:E},ze=class extends Xe{constructor(t){(function(t){"string"==typeof t.ease&&function(t){return t in qe}(t.ease)&&(t.ease=qe[t.ease])})(t),le(t),super(t),void 0!==t.startTime&&!1!==t.autoplay&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){let{motionValue:e,onUpdate:i,onComplete:n,element:r,...s}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);let a=new de({...s,autoplay:!1}),o=Math.max(10,_.now()-this.startTime),l=h(0,10,o-10),u=a.sample(o).value,{name:d}=this.options;r&&d&&Oe(r,d,u),e.setWithVelocity(a.sample(Math.max(0,o-l)).value,u,l),a.stop()}},Ze=(t,e)=>"zIndex"!==e&&!("number"!=typeof t&&!Array.isArray(t)&&("string"!=typeof t||!Ct.test(t)&&"0"!==t||t.startsWith("url(")));function _e(t){t.duration=0,t.type="keyframes"}var Ge=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),He=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/,Je=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Qe=c(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ti=class extends ue{constructor({autoplay:t=!0,delay:e=0,type:i="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:s="loop",keyframes:a,name:o,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=_.now();let d={autoplay:t,delay:e,type:i,repeat:n,repeatDelay:r,repeatType:s,name:o,motionValue:l,element:u,...h},p=u?.KeyframeResolver||Ie;this.keyframeResolver=new p(a,(t,e,i)=>this.onKeyframesResolved(t,e,d,!i),o,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,i,n){this.keyframeResolver=void 0;let{name:r,type:s,velocity:a,delay:o,isHandoff:l,onUpdate:u}=i;this.resolvedAt=_.now();let h=!0;(function(t,e,i,n){let r=t[0];if(null===r)return!1;if("display"===e||"visibility"===e)return!0;let s=t[t.length-1],a=Ze(r,e),o=Ze(s,e);return!(!a||!o)&&(function(t){let e=t[0];if(1===t.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e)return!0}(t)||("spring"===i||Ue(i))&&n)})(t,r,s,a)||(h=!1,(d.instantAnimations||!o)&&u?.(ae(t,i,e)),t[0]=t[t.length-1],_e(i),i.repeat=0);let p,m={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...i,keyframes:t},c=h&&!l&&function(t){let{motionValue:e,name:i,repeatDelay:n,repeatType:r,damping:s,type:a,keyframes:o}=t,l=e?.owner?.current;if(!(l instanceof HTMLElement||l instanceof SVGElement))return!1;let{onUpdate:u,transformTemplate:h}=e.owner.getProps();return Qe()&&i&&(Ge.has(i)||Je.has(i)&&function(t){for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&He.test(t[e]))return!0;return!1}(o))&&("transform"!==i||!h)&&!u&&!n&&"mirror"!==r&&0!==s&&"inertia"!==a}(m),g=m.motionValue?.owner?.current;if(c)try{p=new ze({...m,element:g})}catch{p=new de(m)}else p=new de(m);p.finished.then(()=>{this.notifyFinished()}).catch(f),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),function(){Re=!0,De(),Ee(),Re=!1}()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},ei=class{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=e}attachTimeline(t){let e=this.animations.map(e=>e.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return ii(this.animations,"duration")}get iterationDuration(){return ii(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}};function ii(t,e){let i=0;for(let n=0;n<t.length;n++){let r=t[n][e];null!==r&&r>i&&(i=r)}return i}var ni=class extends ei{then(t,e){return this.finished.finally(t).then(()=>{})}},ri={current:void 0},si=class{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{let e=_.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){this.current=t,this.updatedAt=_.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(t=>!isNaN(parseFloat(t)))(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new v);let i=this.events[t].add(e);return"change"===t?()=>{i(),U.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(let t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,i){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return ri.current&&ri.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let t=_.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return w(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function ai(t,e){return new si(t,e)}function oi(t,e){if(t?.inherit&&e){let{inherit:i,...n}=t;return{...e,...n}}return t}function li(t,e){let i=t?.[e]??t?.default??t;return i!==t?oi(i,t):i}var ui={type:"spring",stiffness:500,damping:25,restSpeed:10},hi={type:"keyframes",duration:.8},di={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},pi=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]),mi=(t,e,i,n={},r,s)=>a=>{let o=li(n,t)||{},l=o.delay||n.delay||0,{elapsed:u=0}=n;u-=b(l);let h={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-u,onUpdate:t=>{e.set(t),o.onUpdate&&o.onUpdate(t)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:s?void 0:r};(function(t){for(let e in t)if(!pi.has(e))return!0;return!1})(o)||Object.assign(h,((t,{keyframes:e})=>e.length>2?hi:Se.has(t)?t.startsWith("scale")?(t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}))(e[1]):ui:di)(t,h)),h.duration&&(h.duration=b(h.duration)),h.repeatDelay&&(h.repeatDelay=b(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let p=!1;if((!1===h.type||0===h.duration&&!h.repeatDelay)&&(_e(h),0===h.delay&&(p=!0)),(d.instantAnimations||d.skipAnimations||r?.shouldSkipAnimations||o.skipAnimations)&&(p=!0,_e(h),h.delay=0),h.allowFlatten=!o.type&&!o.ease,p&&!s&&void 0!==e.get()){let t=ae(h.keyframes,o);if(void 0!==t)return void U.update(()=>{h.onUpdate(t),h.onComplete()})}return o.isSync?new de(h):new ti(h)},ci=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fi(t,e,i=1){let[n,r]=function(t){let e=ci.exec(t);if(!e)return[,];let[,i,n,r]=e;return[`--${i??n}`,r]}(t);if(!n)return;let s=window.getComputedStyle(e).getPropertyValue(n);if(s){let t=s.trim();return p(t)?parseFloat(t):t}return Q(r)?fi(r,e,i+1):r}function gi(t){let e=[{},{}];return t?.values.forEach((t,i)=>{e[0][i]=t.get(),e[1][i]=t.getVelocity()}),e}function yi(t,e,i,n){if("function"==typeof e){let[r,s]=gi(n);e=e(void 0!==i?i:t.custom,r,s)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){let[r,s]=gi(n);e=e(void 0!==i?i:t.custom,r,s)}return e}var vi=new Set(["width","height","top","left","right","bottom",...Me]);function bi(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,ai(i))}function Ti(t){return(t=>Array.isArray(t))(t)?t[t.length-1]||0:t}var wi=t=>!(!t||!t.getVelocity);function Mi(t,e){let i=t.getValue("willChange");if(function(t){return!(!wi(t)||!t.add)}(i))return i.add(e);if(!i&&d.WillChange){let i=new d.WillChange("auto");t.addValue("willChange",i),i.add(e)}}function Si(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Ai="data-"+Si("framerAppearId");function ki(t){return t.props[Ai]}function Vi({protectedKeys:t,needsAnimating:e},i){let n=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,n}function xi(t,e,{delay:i=0,transitionOverride:n,type:r}={}){let{transition:s,transitionEnd:a,...o}=e,l=t.getDefaultTransition();s=s?oi(s,l):l;let u=s?.reduceMotion,h=s?.skipAnimations;n&&(s=n);let d=[],p=r&&t.animationState&&t.animationState.getState()[r],m=s?.path;m&&m.animateVisualElement(t,o,s,i,d);for(let e in o){let n=t.getValue(e,t.latestValues[e]??null),r=o[e];if(void 0===r||p&&Vi(p,e))continue;let a={delay:i,...li(s||{},e)};h&&(a.skipAnimations=!0);let l=n.get();if(void 0!==l&&!n.isAnimating()&&!Array.isArray(r)&&r===l&&!a.velocity){U.update(()=>n.set(r));continue}let m=!1;if(window.MotionHandoffAnimation){let i=ki(t);if(i){let t=window.MotionHandoffAnimation(i,e,U);null!==t&&(a.startTime=t,m=!0)}}Mi(t,e);let c=u??t.shouldReduceMotion;n.start(mi(e,n,r,c&&vi.has(e)?{type:!1}:a,t,m));let f=n.animation;f&&d.push(f)}if(a){let e=()=>U.update(()=>{a&&function(t,e){let i=function(t,e){let i=t.getProps();return yi(i,e,i.custom,t)}(t,e),{transitionEnd:n={},transition:r={},...s}=i||{};s={...s,...n};for(let e in s)bi(t,e,Ti(s[e]))}(t,a)});d.length?Promise.all(d).then(e):e()}return d}var Ci=t=>e=>e.test(t),Fi=[it,gt,ft,ct,vt,yt,{test:t=>"auto"===t,parse:t=>t}],Pi=t=>Fi.find(Ci(t));function Ri(t){return"number"==typeof t?0===t:null===t||"none"===t||"0"===t||m(t)}var Ei=new Set(["brightness","contrast","saturate","opacity"]);function Di(t){let[e,i]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;let[n]=i.match(at)||[];if(!n)return t;let r=i.replace(n,""),s=Ei.has(e)?1:0;return n!==i&&(s*=100),e+"("+s+r+")"}var Ii=/\b([a-z-]*)\(.*?\)/gu,Oi={...Ct,getAnimatableNone:t=>{let e=t.match(Ii);return e?e.map(Di).join(" "):t}},Bi={...Ct,getAnimatableNone:t=>{let e=Ct.parse(t);return Ct.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},Ni={...it,transform:Math.round},Ki={borderWidth:gt,borderTopWidth:gt,borderRightWidth:gt,borderBottomWidth:gt,borderLeftWidth:gt,borderRadius:gt,borderTopLeftRadius:gt,borderTopRightRadius:gt,borderBottomRightRadius:gt,borderBottomLeftRadius:gt,width:gt,maxWidth:gt,height:gt,maxHeight:gt,top:gt,right:gt,bottom:gt,left:gt,inset:gt,insetBlock:gt,insetBlockStart:gt,insetBlockEnd:gt,insetInline:gt,insetInlineStart:gt,insetInlineEnd:gt,padding:gt,paddingTop:gt,paddingRight:gt,paddingBottom:gt,paddingLeft:gt,paddingBlock:gt,paddingBlockStart:gt,paddingBlockEnd:gt,paddingInline:gt,paddingInlineStart:gt,paddingInlineEnd:gt,margin:gt,marginTop:gt,marginRight:gt,marginBottom:gt,marginLeft:gt,marginBlock:gt,marginBlockStart:gt,marginBlockEnd:gt,marginInline:gt,marginInlineStart:gt,marginInlineEnd:gt,fontSize:gt,backgroundPositionX:gt,backgroundPositionY:gt,rotate:ct,pathRotation:ct,rotateX:ct,rotateY:ct,rotateZ:ct,scale:rt,scaleX:rt,scaleY:rt,scaleZ:rt,skew:ct,skewX:ct,skewY:ct,distance:gt,translateX:gt,translateY:gt,translateZ:gt,x:gt,y:gt,z:gt,perspective:gt,transformPerspective:gt,opacity:nt,originX:bt,originY:bt,originZ:gt,zIndex:Ni,fillOpacity:nt,strokeOpacity:nt,numOctaves:Ni},ji={...Ki,color:wt,backgroundColor:wt,outlineColor:wt,fill:wt,stroke:wt,borderColor:wt,borderTopColor:wt,borderRightColor:wt,borderBottomColor:wt,borderLeftColor:wt,filter:Oi,WebkitFilter:Oi,mask:Bi,WebkitMask:Bi},Wi=t=>ji[t],Li=new Set([Oi,Bi]);function $i(t,e){let i=Wi(t);return Li.has(i)||(i=Ct),i.getAnimatableNone?i.getAnimatableNone(e):void 0}var Yi=new Set(["auto","none","0"]),Ui=class extends Ie{constructor(t,e,i,n,r){super(t,e,i,n,r,!0)}readKeyframes(){let{unresolvedKeyframes:t,element:e,name:i}=this;if(!e||!e.current)return;super.readKeyframes();for(let i=0;i<t.length;i++){let n=t[i];if("string"==typeof n&&(n=n.trim(),Q(n))){let r=fi(n,e.current);void 0!==r&&(t[i]=r),i===t.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!vi.has(i)||2!==t.length)return;let[n,r]=t,s=Pi(n),a=Pi(r);if(et(n)!==et(r)&&xe[i])this.needsMeasurement=!0;else if(s!==a)if(Ae(s)&&Ae(a))for(let e=0;e<t.length;e++){let i=t[e];"string"==typeof i&&(t[e]=parseFloat(i))}else xe[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:t,name:e}=this,i=[];for(let e=0;e<t.length;e++)(null===t[e]||Ri(t[e]))&&i.push(e);i.length&&function(t,e,i){let n,r=0;for(;r<t.length&&!n;){let e=t[r];"string"==typeof e&&!Yi.has(e)&&Vt(e).values.length&&(n=t[r]),r++}if(n&&i)for(let r of e)t[r]=$i(i,n)}(t,i,e)}measureInitialState(){let{element:t,unresolvedKeyframes:e,name:i}=this;if(!t||!t.current)return;"height"===i&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=xe[i](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;let n=e[e.length-1];void 0!==n&&t.getValue(i,n).jump(n,!1)}measureEndState(){let{element:t,name:e,unresolvedKeyframes:i}=this;if(!t||!t.current)return;let n=t.getValue(e);n&&n.jump(this.measuredOrigin,!1);let r=i.length-1,s=i[r];i[r]=xe[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,i])=>{t.getValue(e).set(i)}),this.resolveNoneKeyframes()}},Xi=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:qi,cancel:zi}=$(queueMicrotask,!1);function Zi(t){return(t=>"object"==typeof t&&null!==t)(t)&&"ownerSVGElement"in t}var _i=[...Fi,wt,Ct],Gi=()=>({min:0,max:0}),Hi=()=>({x:Gi(),y:Gi()}),Ji=new WeakMap,Qi=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function tn(t){return function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}(t.animate)||Qi.some(e=>function(t){return"string"==typeof t||Array.isArray(t)}(t[e]))}var en={current:null},nn={current:!1},rn=typeof window<"u";function sn(){if(nn.current=!0,rn)if(window.matchMedia){let t=window.matchMedia("(prefers-reduced-motion)"),e=()=>en.current=t.matches;t.addEventListener("change",e),e()}else en.current=!1}var an=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],on={},ln=class{scrapeMotionValuesFromProps(t,e,i){return{}}constructor({parent:t,props:e,presenceContext:i,reducedMotionConfig:n,skipAnimations:r,blockInitialAnimation:s,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ie,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let t=_.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,U.render(this.render,!1,!0))};let{latestValues:l,renderState:u}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=e.initial?{...l}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=r,this.options=o,this.blockInitialAnimation=!!s,this.isControllingVariants=tn(e),this.isVariantNode=function(t){return!(!tn(t)&&!t.variants)}(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!(!t||!t.current);let{willChange:h,...d}=this.scrapeMotionValuesFromProps(e,{},this);for(let t in d){let e=d[t];void 0!==l[t]&&wi(e)&&e.set(l[t])}}mount(t){if(this.hasBeenMounted)for(let t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,Ji.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(nn.current||sn(),this.shouldReduceMotion=en.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),X(this.notifyUpdate),X(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let t in this.events)this.events[t].clear();for(let t in this.features){let e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),e.accelerate&&Ge.has(t)&&this.current instanceof HTMLElement){let{factory:i,keyframes:n,times:r,ease:s,duration:a}=e.accelerate,o=new Xe({element:this.current,name:t,keyframes:n,times:r,ease:s,duration:b(a)}),l=i(o);return void this.valueSubscriptions.set(t,()=>{l(),o.cancel()})}let i=Se.has(t);i&&this.onBindTransform&&this.onBindTransform();let n,r=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&U.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});typeof window<"u"&&window.MotionCheckAppearSync&&(n=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{r(),n&&n()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in on){let e=on[t];if(!e)continue;let{isEnabled:i,Feature:n}=e;if(!this.features[t]&&n&&i(this.props)&&(this.features[t]=new n(this)),this.features[t]){let e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Hi()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<an.length;e++){let i=an[e];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);let n=t["on"+i];n&&(this.propEventSubscriptions[i]=this.on(i,n))}this.prevMotionValues=function(t,e,i){for(let n in e){let r=e[n],s=i[n];if(wi(r))t.addValue(n,r);else if(wi(s))t.addValue(n,ai(r,{owner:t}));else if(s!==r)if(t.hasValue(n)){let e=t.getValue(n);!0===e.liveStyle?e.jump(r):e.hasAnimated||e.set(r)}else{let e=t.getStaticValue(n);t.addValue(n,ai(void 0!==e?e:r,{owner:t}))}}for(let n in i)void 0===e[n]&&t.removeValue(n);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){let e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){let i=this.values.get(t);e!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);let e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return void 0===i&&void 0!==e&&(i=ai(null===e?void 0:e,{owner:this}),this.addValue(t,i)),i}readValue(t,e){let i=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];return null!=i&&("string"==typeof i&&(p(i)||m(i))?i=parseFloat(i):!(t=>_i.find(Ci(t)))(i)&&Ct.test(e)&&(i=$i(t,e)),this.setBaseTarget(t,wi(i)?i.get():i)),wi(i)?i.get():i}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){let e,{initial:i}=this.props;if("string"==typeof i||"object"==typeof i){let n=yi(this.props,i,this.presenceContext?.custom);n&&(e=n[t])}if(i&&void 0!==e)return e;let n=this.getBaseTargetFromProps(this.props,t);return void 0===n||wi(n)?void 0!==this.initialValues[t]&&void 0===e?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new v),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){qi.render(this.render)}},un=class extends ln{constructor(){super(...arguments),this.KeyframeResolver=Ui}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){let i=t.style;return i?i[e]:void 0}removeValueFromRenderState(t,{vars:e,style:i}){delete e[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:t}=this.props;wi(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}},hn={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},dn=Me.length;function pn(t,e,i){let{style:n,vars:r,transformOrigin:s}=t,a=!1,o=!1;for(let t in e){let i=e[t];if(Se.has(t))a=!0;else if(H(t))r[t]=i;else{let e=Xi(i,Ki[t]);t.startsWith("origin")?(o=!0,s[t]=e):n[t]=e}}if(e.transform||(a||i?n.transform=function(t,e,i){let n="",r=!0;for(let s=0;s<dn;s++){let a=Me[s],o=t[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===(a.startsWith("scale")?1:0);else{let t=parseFloat(o);l=a.startsWith("scale")?1===t:0===t}if(!l||i){let t=Xi(o,Ki[a]);l||(r=!1,n+=`${hn[a]||a}(${t}) `),i&&(e[a]=t)}}let s=t.pathRotation;return s&&(r=!1,n+=`rotate(${Xi(s,Ki.pathRotation)}) `),n=n.trim(),i?n=i(e,r?"":n):r&&(n="none"),n}(e,t.transform,i):n.transform&&(n.transform="none")),o){let{originX:t="50%",originY:e="50%",originZ:i=0}=s;n.transformOrigin=`${t} ${e} ${i}`}}function mn(t,{style:e,vars:i},n,r){let s,a=t.style;for(s in e)a[s]=e[s];for(s in r?.applyProjectionStyles(a,n),i)a.setProperty(s,i[s])}function cn(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}var fn={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!gt.test(t))return t;t=parseFloat(t)}return`${cn(t,e.target.x)}% ${cn(t,e.target.y)}%`}},gn={correct:(t,{treeScale:e,projectionDelta:i})=>{let n=t,r=Ct.parse(t);if(r.length>5)return n;let s=Ct.createTransformer(t),a="number"!=typeof r[0]?1:0,o=i.x.scale*e.x,l=i.y.scale*e.y;r[0+a]/=o,r[1+a]/=l;let u=Rt(o,l,.5);return"number"==typeof r[2+a]&&(r[2+a]/=u),"number"==typeof r[3+a]&&(r[3+a]/=u),s(r)}},yn={borderRadius:{...fn,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"]},borderTopLeftRadius:fn,borderTopRightRadius:fn,borderBottomLeftRadius:fn,borderBottomRightRadius:fn,boxShadow:gn};function vn(t,{layout:e,layoutId:i}){return Se.has(t)||t.startsWith("origin")||(e||void 0!==i)&&(!!yn[t]||"opacity"===t)}function bn(t,e,i){let n=t.style,r=e?.style,s={};if(!n)return s;for(let e in n)(wi(n[e])||r&&wi(r[e])||vn(e,t)||void 0!==i?.getValue(e)?.liveStyle)&&(s[e]=n[e]);return s}var Tn=class extends un{constructor(){super(...arguments),this.type="html",this.renderInstance=mn}mount(t){t.style,super.mount(t)}readValueFromInstance(t,e){if(Se.has(e))return this.projection?.isProjecting?be(e):((t,e)=>{let{transform:i="none"}=getComputedStyle(t);return Te(i,e)})(t,e);{let i=function(t){return window.getComputedStyle(t)}(t),n=(H(e)?i.getPropertyValue(e):i[e])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:i,bottom:n}){return{x:{min:e,max:i},y:{min:t,max:n}}}(function(t,e){if(!e)return t;let i=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:n.y,right:n.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,i){pn(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return bn(t,e,i)}},wn=class extends ln{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){let i=t[e];if("string"==typeof i||"number"==typeof i)return i}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return Hi()}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}},Mn={offset:"stroke-dashoffset",array:"stroke-dasharray"},Sn={offset:"strokeDashoffset",array:"strokeDasharray"},An=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"],kn=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Vn=class extends un{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Hi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Se.has(e)){let t=Wi(e);return t&&t.default||0}return e=kn.has(e)?e:Si(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return function(t,e,i){let n=bn(t,e,i);for(let i in t)(wi(t[i])||wi(e[i]))&&(n[-1!==Me.indexOf(i)?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i]=t[i]);return n}(t,e,i)}build(t,e,i){!function(t,{attrX:e,attrY:i,attrScale:n,pathLength:r,pathSpacing:s=1,pathOffset:a=0,...o},l,u,h){if(pn(t,o,u),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};let{attrs:d,style:p}=t;d.transform&&(p.transform=d.transform,delete d.transform),(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),p.transform&&(p.transformBox=h?.transformBox??"fill-box",delete d.transformBox);for(let t of An)void 0!==d[t]&&(p[t]=d[t],delete d[t]);void 0!==e&&(d.x=e),void 0!==i&&(d.y=i),void 0!==n&&(d.scale=n),void 0!==r&&function(t,e,i=1,n=0,r=!0){t.pathLength=1;let s=r?Mn:Sn;t[s.offset]=""+-n,t[s.array]=`${e} ${i}`}(d,r,s,a,!1)}(t,e,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,e,i,n){!function(t,e,i,n){mn(t,e,void 0,n);for(let i in e.attrs)t.setAttribute(kn.has(i)?i:Si(i),e.attrs[i])}(t,e,0,n)}mount(t){this.isSVGTag=(t=>"string"==typeof t&&"svg"===t.toLowerCase())(t.tagName),super.mount(t)}};function xn(t){return"object"==typeof t&&!Array.isArray(t)}function Cn(t,e,i,n){return null==t?[]:"string"==typeof t&&xn(e)?function(t,e,i){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let n=document;e&&(n=e.current);let r=i?.[t]??n.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t).filter(t=>null!=t)}(t,i,n):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(t=>null!=t):[t]}function Fn(t,e,i){return t*(e+1)+i*e}function Pn(t,e,i,n){return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?i:e.startsWith("<")?Math.max(0,i+parseFloat(e.slice(1))):n.get(e)??t}function Rn(t,e,i,n,r,s){!function(t,e,i){for(let n=0;n<t.length;n++){let r=t[n];r.at>e&&r.at<i&&(u(t,r),n--)}}(t,r,s);for(let a=0;a<e.length;a++)t.push({value:e[a],at:Rt(r,s,n[a]),easing:N(i,a)})}function En(t,e,i=0){let n=e+1+e*i;for(let e=0;e<t.length;e++)t[e]=t[e]/n}function Dn(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function In(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function On(t,e){return e[t]||(e[t]=[]),e[t]}function Bn(t){return Array.isArray(t)?t:[t]}function Nn(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}var Kn=t=>"number"==typeof t,jn=t=>t.every(Kn);function Wn(t){let e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},i=Zi(t)&&!function(t){return Zi(t)&&"svg"===t.tagName}(t)?new Vn(e):new Tn(e);i.mount(t),Ji.set(t,i)}function Ln(t){let e=new wn({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),Ji.set(t,e)}function $n(t,e,i,n){let r=[];if(function(t,e){return wi(t)||"number"==typeof t||"string"==typeof t&&!xn(e)}(t,e))r.push(function(t,e,i){let n=wi(t)?t:ai(t);return n.start(mi("",n,e,i)),n.animation}(t,xn(e)&&e.default||e,i&&(i.default||i)));else{if(null==t)return r;let s=Cn(t,e,n),a=s.length;for(let t=0;t<a;t++){let n=s[t],o=n instanceof Element?Wn:Ln;Ji.has(n)||o(n);let l=Ji.get(n),u={...i};"delay"in u&&"function"==typeof u.delay&&(u.delay=u.delay(t,a)),r.push(...xi(l,{...e,transition:u},{}))}}return r}var Yn=function(t={}){let{scope:e,reduceMotion:i,skipAnimations:n}=t;return function(t,r,s){let a,o=[],l={};if(void 0!==i&&(l.reduceMotion=i),void 0!==n&&(l.skipAnimations=n),function(t){return Array.isArray(t)&&t.some(Array.isArray)}(t)){let{onComplete:i,...n}=r||{};"function"==typeof i&&(a=i),o=function(t,e,i){let n=[];return function(t,{defaultTransition:e={},...i}={},n,r){let s=e.duration||.3,a=new Map,o=new Map,l={},u=new Map,h=0,d=0,p=0;for(let i=0;i<t.length;i++){let a=t[i];if("string"==typeof a){u.set(a,d);continue}if(!Array.isArray(a)){u.set(a.name,Pn(d,a.at,h,u));continue}let[m,c,f={}]=a;void 0!==f.at&&(d=Pn(d,f.at,h,u));let g=0,y=(t,i,n,a=0,o=0)=>{let l=Bn(t),{delay:u=0,times:h=ie(l),type:m=e.type||"keyframes",repeat:c,repeatType:f,repeatDelay:y=0,...v}=i,{ease:T=e.ease||"easeOut",duration:w}=i,M="function"==typeof u?u(a,o):u,S=l.length,A=Ue(m)?m:r?.[m||"keyframes"];if(S<=2&&A){let t=100;if(2===S&&jn(l)){let e=l[1]-l[0];t=Math.abs(e)}let i={...e,...v};void 0!==w&&(i.duration=b(w));let n=qt(i,t,A);T=n.ease,w=n.duration}w??(w=s);let V=d+M;1===h.length&&0===h[0]&&(h[1]=1);let x=h.length-l.length;if(x>0&&ee(h,x),1===l.length&&l.unshift(null),c&&c<20){let t=w>0?y/w:0;w=Fn(w,c,y);let e=[...l],i=[...h];T=Array.isArray(T)?[...T]:[T];let n=[...T],r="reverse"===f||"mirror"===f,s=e,a=n;r&&(s=[...e].reverse(),"reverse"===f&&(a=[...n].reverse().map(t=>"function"==typeof t?k(t):t)));for(let o=0;o<c;o++){let u=r&&o%2==0,d=u?s:e,p=u?a:n,m=(o+1)*(1+t);t>0&&(l.push(l[l.length-1]),h.push(m),T.push("linear")),l.push(...d);for(let t=0;t<d.length;t++)h.push(i[t]+m),T.push(0===t?"linear":N(p,t-1))}En(h,c,t)}let C=V+w;Rn(n,l,T,h,V,C),g=Math.max(M+w,g),p=Math.max(C,p)};if(wi(m))y(c,f,On("default",In(m,o)));else{let t=Cn(m,c,n,l),e=t.length;for(let i=0;i<e;i++){let n=In(t[i],o);for(let t in c)y(c[t],Nn(f,t),On(t,n),i,e)}}h=d,d+=g}return o.forEach((t,n)=>{for(let r in t){let s=t[r];s.sort(Dn);let o=[],l=[],u=[];for(let t=0;t<s.length;t++){let{at:e,value:i,easing:n}=s[t];o.push(i),l.push(y(0,p,e)),u.push(n||"easeOut")}0!==l[0]&&(l.unshift(0),o.unshift(o[0]),u.unshift("easeInOut")),1!==l[l.length-1]&&(l.push(1),o.push(null)),a.has(n)||a.set(n,{keyframes:{},transition:{}});let h=a.get(n);h.keyframes[r]=o;let{type:d,...m}=e;h.transition[r]={...m,duration:p,ease:u,times:l,...i}}}),a}(t.map(t=>{if(Array.isArray(t)&&"function"==typeof t[0]){let e=t[0],i=ai(0);return i.on("change",e),1===t.length?[i,[0,1]]:2===t.length?[i,[0,1],t[1]]:[i,t[1],t[2]]}return t}),e,i,{spring:Jt}).forEach(({keyframes:t,transition:e},i)=>{n.push(...$n(i,t,e))}),n}(t,{...l,...n},e)}else{let{onComplete:i,...n}=s||{};"function"==typeof i&&(a=i),o=$n(t,r,{...l,...n},e)}let h=new ni(o);return a&&h.finished.then(a),e&&(e.animations.push(h),h.finished.then(()=>{u(e.animations,h)})),h}}();export{t as a,e as b,i as c,n as d,r as e,s as f,a as g,o as h,l as i,en as j,nn as k,sn as l,Yn as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=/^Proposed (.+?) changes? \(preview only\)$/,t={style:"Style changes","inline text":"Text change","design-token":"Token changes","React prop":"Prop changes"};function n(t){return t.split("\n").some(t=>e.test(t))}function r(e){try{return e.startsWith('"')?JSON.parse(e):e}catch{return e}}function a(e,t){let n=/^Shared theme (\S+) \((--[\w-]+)\): (.*?) → (.*?)(?:; preview scope .*)?$/.exec(e);if(n)return{label:n[1],token:n[1],before:n[3],after:n[4],apply:{kind:"variable",property:n[2]}};if(n=/^Element ([\w-]+): (.*?) → (.*?)(?: \[([^\]]+)\])*$/.exec(e),n){let t=/\[([\w.-]+)\]/.exec(e.slice(e.indexOf("→")))?.[1];return{label:n[1],before:n[2],after:n[3],...t&&!t.includes(" ")?{token:t}:{},apply:{kind:"style",property:n[1]}}}if(n=/^- (.+?): (.*) → (.*?)(?: \[([^\]]+)\])?$/.exec(e),!n)return null;let[,a,o,i,s]=n;return"inline text"===t?{label:"Text",before:r(o),after:r(i),apply:{kind:"text",property:"text"}}:"React prop"===t?{label:a,before:r(o),after:r(i),...s&&"custom value"!==s?{token:s}:{}}:{label:a,before:o,after:i,apply:{kind:"style",property:a}}}function o(n){let r=[];for(let o of n.split(/\n{2,}/)){let n=o.split("\n"),i=e.exec(n[0]??"");if(!i){o.trim()&&r.push({text:o.trim()});continue}let s=i[1],l={title:t[s]??`${s[0].toUpperCase()}${s.slice(1)} changes`,changes:[]};for(let e of n.slice(1))if(e.startsWith("Target: "))l.target=e.slice(8);else if(e.startsWith("Component: ")){let[,t,n]=/^(.*?)(?: \((.+)\))?$/.exec(e.slice(11));l.component=t,n&&(l.source=n)}else if(e.startsWith("Source: "))l.source=e.slice(8);else{let t=e.includes("→")?a(e,s):null;t&&t.before!==t.after&&l.changes.push(t)}l.changes.length?r.push(l):r.push({text:o.trim()})}return r}function i(e){let t=o(e),n=t.filter(e=>"changes"in e),r=t.find(e=>"text"in e)?.text,a=n.reduce((e,t)=>e+t.changes.length,0),i=n.find(e=>e.target)?.target,l=`Design change · ${a} ${1===a?"edit":"edits"}${i?` on ${s(i)}`:""}`;return r?`${r}\n${l}`:l}function s(e){return(e.split(">").at(-1)??e).trim().replace(/:nth-of-type\(\d+\)/g,"")||e}var l=/^(#[0-9a-f]{3,8}|rgba?\([^)]*\)|hsla?\([^)]*\)|oklch\([^)]*\))$/i,d=new Map,p=new Set,c=new Map;function f(e){let t=c.get(e);t&&(clearTimeout(t.timer),c.delete(e),t.finish())}function g(e,t,n,r=!1){f(e);let a=[],o=[],i=[];for(let e of t){let t=n(e.target);for(let n of e.changes)if(n.apply&&"(unset)"!==n.after)if("variable"===n.apply.kind){let e=document.documentElement,t=e.style.getPropertyValue(n.apply.property);e.style.setProperty(n.apply.property,n.after),a.push(()=>t?e.style.setProperty(n.apply.property,t):e.style.removeProperty(n.apply.property))}else if(t instanceof HTMLElement&&"style"===n.apply.kind){let e=t.style.getPropertyValue(n.apply.property),a=t.style.getPropertyPriority(n.apply.property),s=n.apply.property,l=()=>"(unset)"!==n.before&&(t.style.setProperty(s,n.before,"important"),!0);r&&l()&&getComputedStyle(t).getPropertyValue(s),t.style.setProperty(s,n.after,"important"),i.push(l),o.push(()=>e?t.style.setProperty(n.apply.property,e,a):t.style.removeProperty(n.apply.property))}else if(t instanceof HTMLElement&&"text"===n.apply.kind&&!t.childElementCount){let e=t.firstChild;if(e instanceof Text){let t=e.data;e.data=n.after,a.push(()=>{e.data=t})}}}return d.set(e,{restore:a,restoreStyles:o,pinBefore:i}),a.length+o.length>0}var m,u=["color","background-color","border-color","outline-color","fill","stroke","box-shadow","text-decoration-color"],h="cubic-bezier(.22, 1, .36, 1)";function y(e,t){let n=new Set;for(let r of e)for(let e of r.changes)if("style"===e.apply?.kind)n.add(e.apply.property);else if("variable"===e.apply?.kind)u.forEach(e=>n.add(e));else if("text"===e.apply?.kind){let e=t(r.target);e instanceof HTMLElement&&e.animate?.([{opacity:1},{opacity:.25,offset:.4},{opacity:1}],{duration:360,easing:h})}if(!n.size)return;m&&(clearTimeout(m.timer),m.style.remove());let r=document.createElement("style");r.textContent=`*, *::before, *::after { transition-property: ${[...n].join(", ")} !important; transition-duration: 420ms !important; transition-timing-function: ${h} !important; transition-delay: 0s !important; }`,document.head.append(r),m={style:r,timer:setTimeout(()=>{r.remove(),m=void 0},480)}}function x(e,t=!1){f(e);let n=d.get(e);if(!n)return;d.delete(e);for(let e of n.restore.reverse())e();let r=()=>{for(let e of n.restoreStyles.reverse())e()};if(!t||!n.pinBefore.length)return r();for(let e of n.pinBefore)e();c.set(e,{finish:r,timer:setTimeout(()=>f(e),480)})}function b(e){return d.has(e)||c.has(e)}function w(e=new Set){e.has("draft")||($=void 0);for(let t of[...c.keys()])e.has(t)||f(t);for(let t of[...d.keys()])e.has(t)||x(t)}function v(e){return"text"===e.apply?.kind||!(e.apply||e.token||l.test(e.before)||l.test(e.after))&&(/\s/.test(e.before+e.after)||e.before.length+e.after.length>32)}function k(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;let r=0;for(;r<e.length-n&&r<t.length-n&&e[e.length-1-r]===t[t.length-1-r];)r++;for(;n>0&&!/\s/.test(e[n-1]);)n--;for(;r>0&&!/\s/.test(e[e.length-r]);)r--;let a=e.slice(0,n),o=e.slice(e.length-r),i=document.createElement("p");i.className="design-diff",i.append(a.length>48?`…${a.slice(-40)}`:a);let s=e.slice(n,e.length-r),l=t.slice(n,t.length-r);return s&&i.append(Object.assign(document.createElement("del"),{textContent:s})),l&&i.append(Object.assign(document.createElement("ins"),{textContent:l})),i.append(o.length>48?`${o.slice(0,40)}…`:o),i}function E(e,t){let n=document.createElement("span");n.className="design-value";let r=/^var\((--[\w-]+)\)$/.exec(e);if(t&&r)return n.append(Object.assign(document.createElement("span"),{className:"design-token",textContent:t})),n;if(l.test(e)){let t=document.createElement("span");t.className="design-swatch",t.style.background=e,n.append(t)}return n.append(e),n}function C(e,t,n){let r=o(t),a=r.filter(e=>"changes"in e),i=document.createElement("div");i.className="design-comment",i.append(Object.assign(document.createElement("style"),{textContent:'\n.design-comment { display: grid; gap: 8px; margin: 2px 0 6px; }\n.design-note { margin: 0; white-space: pre-wrap; }\n.design-card { border-radius: 10px; background: #ffffff08; box-shadow: inset 0 0 0 1px #ffffff0d; overflow: hidden; font-size: 12px; }\n.design-card-head { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 7px 8px 7px 12px; }\n.design-card-label { display: grid; min-width: 0; gap: 1px; }\n.design-card-title { font-weight: 600; color: #eee; white-space: nowrap; }\n.design-card-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8a8a8a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; }\n.design-toggle { margin-left: auto; display: inline-flex; padding: 2px; border-radius: 7px; background: #ffffff0a; flex: none; }\n.design-toggle button { border: 0; padding: 0 8px; height: 22px; border-radius: 5px; font: inherit; font-size: 11px; color: #9a9a9a; background: none; cursor: pointer; }\n.design-toggle button[aria-pressed="true"] { color: #fff; background: #ffffff1a; }\n.design-rows { display: grid; border-top: 1px solid #ffffff0a; }\n.design-row { display: grid; grid-template-columns: minmax(64px, 30%) minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 12px; }\n.design-row + .design-row { border-top: 1px solid #ffffff06; }\n.design-row[hidden] { display: none; }\n.design-row-prose { grid-template-columns: 1fr; gap: 3px; }\n.design-diff { margin: 0; line-height: 1.5; color: #ddd; overflow-wrap: anywhere; }\n.design-diff del, .design-diff ins { border-radius: 3px; padding: 0 2px; }\n.design-diff del { color: #f6a19a; background: #f28b8224; text-decoration-color: #f6a19a99; }\n.design-diff ins { color: #b9e6ad; background: #8fd69424; text-decoration: none; }\n.design-prop { color: #9a9a9a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.design-values { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; color: #eee; }\n.design-before { color: #858585; text-decoration: line-through; text-decoration-color: #85858599; }\n.design-arrow { color: #666; }\n.design-value { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow-wrap: anywhere; }\n.design-swatch { width: 12px; height: 12px; flex: none; border-radius: 3px; box-shadow: inset 0 0 0 1px #ffffff26; }\n.design-token { padding: 1px 6px; border-radius: 5px; color: var(--accent, #bda6ef); background: color-mix(in srgb, var(--accent, #bda6ef) 14%, transparent); }\n.design-more { border: 0; width: 100%; padding: 7px 12px; text-align: left; font: inherit; font-size: 11px; color: #9a9a9a; background: none; border-top: 1px solid #ffffff06; cursor: pointer; }\n.design-more:hover, .design-toggle button:hover { color: #fff; }\n.design-source { padding: 0 12px 8px; color: #777; font-size: 11px; }\n[data-compact] { gap: 6px; margin: 11px 0 0; }\n[data-compact] .design-card-head, [data-compact] .design-row, [data-compact] > .design-source { min-height: 0; padding: 4px 10px; }\n[data-compact]:hover > .design-source { color: #eee; text-decoration: underline; }\n'}));let l=!!n.compact;l&&(i.dataset.compact="");let c=l?3:1/0,f=0,m=a.some(e=>e.changes.some(e=>e.apply)),u=[],h=()=>{let e=d.has(n.key);for(let t of u)t.querySelectorAll("button").forEach((t,n)=>t.setAttribute("aria-pressed",String(1===n?e:!e)))};for(let e of r){if("text"in e){let t=document.createElement("p");t.className="design-note",n.note(t,e.text),i.append(t);continue}if(c<=0){f+=e.changes.length;continue}let t=document.createElement("section");t.className="design-card";let r=document.createElement("div");r.className="design-card-head";let o=document.createElement("div");o.className="design-card-label",o.append(Object.assign(document.createElement("span"),{className:"design-card-title",textContent:e.title}));let b=e.target?s(e.target):e.component;if(b){let t=Object.assign(document.createElement("span"),{className:"design-card-target",textContent:b});e.target&&(t.title=e.target),o.append(t)}if(r.append(o),m&&!u.length&&e.changes.some(e=>e.apply)){let e=document.createElement("div");e.className="design-toggle",e.setAttribute("role","group"),e.setAttribute("aria-label","Preview on page");for(let[t,r]of["Before","After"].entries()){let o=Object.assign(document.createElement("button"),{type:"button",textContent:r,title:`${r} · ${t?"→":"←"} or B`});o.addEventListener("click",()=>{let e=1===t;if(e===d.has(n.key))return;let r=n.resolve(a.find(e=>e.target)?.target);e&&r?.scrollIntoView({block:"center",behavior:"smooth"});let o="function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches;o||y(a,n.resolve),e?g(n.key,a,n.resolve,!o):x(n.key,!o),n.onSwitch&&setTimeout(n.onSwitch,o?0:480),h()}),e.append(o)}u.push(e);for(let e of p)e.isConnected||p.delete(e);p.add(e),r.append(e)}t.append(r);let w=document.createElement("div");w.className="design-rows";let C=4;e.changes.forEach((t,n)=>{if(c<=0)return void f++;l&&c--;let r=document.createElement("div");r.className="design-row",r.hidden=!l&&n>=C&&e.changes.length>C+1;let a=Object.assign(document.createElement("span"),{className:"design-prop",textContent:t.label});if(a.title=t.label,v(t))return r.classList.add("design-row-prose"),r.append(a,k(t.before,t.after)),void w.append(r);let o=document.createElement("span");o.className="design-values";let i=E(t.before);i.classList.add("design-before"),o.append(i,Object.assign(document.createElement("span"),{className:"design-arrow",textContent:"→"}),E(t.after,t.token)),r.append(a,o),w.append(r)}),t.append(w);let $=w.querySelectorAll("[hidden]").length;if($){let e=Object.assign(document.createElement("button"),{type:"button",className:"design-more",textContent:`Show ${$} more`});e.addEventListener("click",()=>{w.querySelectorAll("[hidden]").forEach(e=>e.hidden=!1),e.remove()}),t.append(e)}e.source&&!l&&t.append(Object.assign(document.createElement("div"),{className:"design-source",textContent:e.source})),i.append(t)}f&&i.append(Object.assign(document.createElement("span"),{className:"design-source",textContent:`+${f} more`})),h(),e.replaceChildren(i),u.length&&(N||(N=!0,document.addEventListener("keydown",e=>{let t="ArrowLeft"===e.key?0:"ArrowRight"===e.key?1:"b"===e.key.toLowerCase()?-1:null;if(null===t||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.isComposing)return;let n=e.composedPath()[0];if(n instanceof HTMLElement&&(n.isContentEditable||n.matches("input, textarea, select")))return;let r=[...p].reverse().find(e=>e.isConnected),a=r?.querySelectorAll("button"),o=-1===t?r?.querySelector('button[aria-pressed="false"]'):a?.[t];o&&(e.preventDefault(),o.click())})))}var $,N=!1;function S(e,t,n){$!==t&&(x("draft"),$=t,g("draft",o(t).filter(e=>"changes"in e),n)),C(e,t,{key:"draft",resolve:n,note:(e,t)=>e.append(t)})}export{n as isDesignComment,b as isPreviewing,o as parseDesignComment,C as renderDesignComment,S as renderDraftProposal,w as resetDesignPreviews,s as shortTarget,i as summarizeDesignComment};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./chunk-ANKCS6NI.js";function t(e){let t=[];for(let n=e;n;n=n.parentElement){let i=n.id&&!/^radix-|^:r|_r_|«r/.test(n.id)?`#${CSS.escape(n.id)}`:"";if(i&&1===document.querySelectorAll(i).length)return[i,...t].join(" > ");if(n===document.body||!n.parentElement)return[n.tagName.toLowerCase(),...t].join(" > ");let o=n===e?[...n.classList].slice(0,2).map(e=>`.${CSS.escape(e)}`).join(""):"",r=[...n.parentElement.children].filter(e=>e.tagName===n.tagName).indexOf(n)+1;t.unshift(`${n.tagName.toLowerCase()}${o}:nth-of-type(${r})`)}return t.join(" > ")}function n(e,n){return`${t(e)} {\n${[...n].map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`}function i(e,n,i,o,r,s=[]){let a=[...n??[]].filter(([e])=>!o?.has(e)).map(([e,t])=>`- ${e}: ${i(e)||"(unset)"} → ${t}`),l=[a.length?`Proposed style changes (preview only)\nTarget: ${t(e)}\n${a.join("\n")}`:"",...r].filter(e=>!!e);if(l[0]&&s.length){let e=l[0].split("\n"),t=s.filter(t=>!t.startsWith("Component: ")||!e.some(e=>e.startsWith("Component: ")));e.splice(e[1]?.startsWith("Target: ")?2:1,0,...t),l[0]=e.join("\n")}return l.join("\n\n")||void 0}function o(t,n,i,o){if(i.aborted)return;let r=e("div","morphing-menu__tooltip sidebar-tooltip");r.setAttribute("aria-hidden","true"),n.append(r);let s=0,a=()=>{clearTimeout(s),delete r.dataset.open},l=e=>{let t=e.target.closest?.("[data-tip]");if(!t||"focusin"===e.type&&!t.matches(":focus-visible"))return a();clearTimeout(s),s=window.setTimeout(()=>{if(!t.isConnected)return;let e=t.getBoundingClientRect();r.textContent=t.dataset.tip??"";let n=r.offsetWidth/2;r.style.left=`${Math.max(8+n,Math.min(document.documentElement.clientWidth-8-n,e.left+e.width/2))}px`,r.style.top=e.top-8-r.offsetHeight+"px",r.dataset.open="true"},r.dataset.open?0:400)};t.addEventListener("pointerover",l,{signal:i}),t.addEventListener("focusin",l,{signal:i});for(let e of["pointerleave","pointerdown","focusout"])t.addEventListener(e,a,{signal:i});i.addEventListener("abort",()=>{a(),r.remove()}),("focusin"===o.type||t.matches(":hover"))&&l(o)}export{t as cssSelector,n as cssText,i as designProposal,o as footerTips};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const designModeStyles = "\n/* Design mode is deliberately an in-page preview: all controls remain in the\n widget shadow root and never become site styles. */\n.design-outline {\n position:fixed; z-index:1; pointer-events:none; box-sizing:border-box;\n
|
|
1
|
+
export declare const designModeStyles = "\n/* Design mode is deliberately an in-page preview: all controls remain in the\n widget shadow root and never become site styles. */\n.design-outline {\n position:fixed; z-index:1; pointer-events:none; box-sizing:border-box;\n outline:2px solid var(--accent,#bda6ef); outline-offset:2px;\n transition:opacity 80ms ease;\n}\n.design-outline[data-kind=\"hover\"] { outline-style:dashed; opacity:.8; }\n/* The inspector replaces the Comments view inside Komo's shared sidebar surface. */\n.design-inspector {\n position:absolute; inset:0; z-index:9;\n display:flex; flex-direction:column; overflow:hidden; color:#e9e6e1;\n background:#0d0d0d; border-radius:inherit;\n font:12px/1.4 -apple-system,BlinkMacSystemFont,\"Inter\",\"Segoe UI\",sans-serif; color-scheme:dark;\n opacity:0; translate:0 6px; pointer-events:none;\n transition:opacity .15s var(--ease-smooth-out),translate .25s var(--ease-smooth-out);\n}\n.design-inspector[hidden] { display:none; }\n/* Frame docks the inspector in the sidebar column beside the scaled page. */\n:host([data-sidebar=\"background\"]) .design-inspector { position:fixed; inset:0 0 0 auto; width:380px; border-radius:0; }\n/* The floating inspector drags by its heading, like the comment sidebar's grip. */\n:host([data-sidebar=\"edge\"]) .design-inspector__heading { cursor:grab; touch-action:none; padding-top:22px; }\n/* The sidebar's own grip stays visible above the inspector, as it is above Comments. */\n:host(.design-active[data-sidebar=\"edge\"]) .edge-sidebar .edge-sidebar-grip { z-index:10; opacity:1 !important; }\n.design-inspector[data-state=\"active\"] { opacity:1; translate:0 0; pointer-events:auto; }\n.design-inspector[data-state=\"closing\"] { opacity:0; translate:0 4px; }\n.design-inspector button { cursor:pointer; }\n/* Header and icon buttons match the Comments panel's title and icons, on the inspector's 12px gutter. */\n.design-inspector__heading { flex:none; display:flex; align-items:center; gap:4px; min-height:54px; padding:0 8px 0 12px; }\n.design-inspector__identity { min-width:0; flex:1; display:flex; align-items:baseline; gap:6px; white-space:nowrap; }\n.design-inspector__parent { flex:none; max-width:35%; overflow:hidden; text-overflow:ellipsis; margin-left:-6px; padding:2px 6px; border-radius:7px; color:#909090; font-size:15px; font-weight:500; }\n.design-inspector__parent::after { content:'/'; margin-left:6px; color:#555; }\n.design-inspector__target { flex:none; max-width:60%; overflow:hidden; text-overflow:ellipsis; color:#fff; font-weight:600; font-size:15px; }\n.design-inspector__heading small { min-width:0; overflow:hidden; text-overflow:ellipsis; color:#909090; font-size:13px; }\n.design-inspector__close,.design-inspector__fold,.design-inspector__actions button { display:grid; place-items:center; min-width:28px; height:28px; border-radius:7px; color:#909090; }\n.design-inspector__close,.design-inspector__fold { flex:none; }\n.design-inspector__close svg,.design-inspector__fold svg,.design-inspector__actions svg { width:16px; height:16px; }\n.design-inspector__parent:hover,.design-inspector__close:hover,.design-inspector__fold:hover,.design-inspector__actions button:hover:not(:disabled) { background:#161616; color:#eee; }\n.design-inspector__fold { display:none; }\n.design-inspector__fold svg { transition:rotate .25s var(--ease-smooth-out); }\n.design-inspector[data-folded] .design-inspector__fold svg { rotate:180deg; }\n.design-inspector[data-folded] > :not(.design-inspector__heading) { display:none; }\n.design-inspector__controls { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; }\n/* Empty state: the floating sidebar fits a compact, centered hint instead of an empty column. */\n:host([data-sidebar=\"edge\"]) .edge-sidebar[data-design-empty]:not([data-morphing]) { height:auto !important; }\n:host([data-sidebar=\"edge\"]) [data-design-empty] > .design-inspector { position:relative; inset:auto; }\n/* The hidden toolbar docked in the sidebar would otherwise add its height. */\n:host([data-sidebar=\"edge\"]) [data-design-empty]:not([data-morphing]) > .toolbar { position:absolute; }\n.design-inspector[data-empty] .design-inspector__identity { visibility:hidden; }\n.design-inspector[data-empty] .design-inspector__controls { display:grid; place-items:center; }\n.design-inspector[data-empty] .design-inspector__bar:not([data-changes],[data-message]) { display:none; }\n.design-inspector__empty { display:flex; flex-direction:column; align-items:center; gap:4px; padding:0 24px 28px; color:#898680; font-size:11px; text-align:center; }\n.design-inspector__empty > svg { box-sizing:content-box; width:20px; height:20px; margin-bottom:8px; padding:8px; border-radius:10px; background:#ffffff0a; color:#77736f; }\n.design-inspector__empty strong { color:#e9e6e1; font-size:12px; font-weight:600; }\n.design-inspector__empty ul { display:grid; gap:6px; margin:8px 0 0; padding:0; list-style:none; }\n.design-inspector__empty kbd { display:inline-block; min-width:8px; padding:0 5px; border-radius:4px; background:#ffffff0f; box-shadow:inset 0 0 0 1px #ffffff12,inset 0 -1px 0 #ffffff12; color:#c9c5bf; font:inherit; font-size:10px; font-weight:500; line-height:17px; }\n/* One slim bar: a quiet Comment action, plus a change count and tools once something changed. */\n.design-inspector__bar { flex:none; display:flex; align-items:center; gap:8px; min-height:56px; padding:0 12px; border-top:1px solid #ffffff0d; color:#909090; font-size:12px; }\n.design-inspector__count { white-space:nowrap; font-variant-numeric:tabular-nums; }\n/* Before/After: the same segmented control as design comment cards. */\n.design-inspector__compare { display:inline-flex; flex:none; padding:2px; border-radius:7px; background:#ffffff0a; }\n.design-inspector__compare[hidden],.design-inspector__bar[data-message] .design-inspector__compare { display:none; }\n.design-inspector__compare button { height:22px; padding:0 8px; border-radius:5px; color:#9a9a9a; font:inherit; font-size:11px; }\n.design-inspector__compare button:hover { color:#fff; }\n.design-inspector__compare button[aria-pressed=\"true\"] { color:#fff; background:#ffffff1a; }\n.design-inspector__status { display:none; min-width:0; margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; animation:design-status .2s var(--ease-smooth-out); }\n.design-inspector__bar[data-message] .design-inspector__status { display:block; }\n.design-inspector__bar[data-message] .design-inspector__count,.design-inspector__bar:not([data-changes]) .design-inspector__tool { display:none; }\n.design-inspector__actions { display:flex; align-items:center; gap:2px; margin-left:auto; }\n.design-inspector__actions button:disabled { cursor:default; opacity:.35; }\n/* Comment is komo's primary action, as on the Comments panel. */\n.design-inspector__actions button:last-child { min-height:34px; margin-left:6px; padding:0 14px; border-radius:8px; background:var(--accent,#bda6ef); color:#211b2d; font-size:12px; font-weight:500; }\n.design-inspector__actions button:last-child:hover:not(:disabled) { background:var(--accent,#bda6ef); color:#211b2d; filter:brightness(1.08); }\n.design-inspector :focus-visible { outline:2px solid var(--accent,#bda6ef); outline-offset:2px; }\n@keyframes design-status { from { opacity:0; translate:0 2px; } }\n@media (max-width:520px) {\n /* A content-sized bottom sheet; folding it leaves only the heading over the page. */\n .design-inspector {\n position:fixed; inset:auto 12px calc(12px + env(safe-area-inset-bottom,0px));\n max-height:min(58dvh,560px);\n border-radius:24px; box-shadow:0 -1px 0 #ffffff24,0 16px 48px #0005;\n transition:translate 320ms cubic-bezier(.22,1,.36,1),scale 320ms cubic-bezier(.22,1,.36,1),opacity 150ms ease;\n transform-origin:bottom center;\n }\n .design-inspector__heading { height:52px; padding-left:18px; }\n .design-inspector__fold { display:grid; }\n .design-inspector[data-empty] .design-inspector__identity { visibility:visible; }\n .design-inspector .design-field { height:34px; }\n}\n@media (prefers-reduced-motion:reduce) {\n .design-outline,.design-inspector,.design-inspector__fold svg,.design-inspector__status { transition:none; animation:none; }\n}\n";
|
package/dist/design-mode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,j as t}from"./chunk-ANKCS6NI.js";import"./chunk-I7AUKTXE.js";var n=(t,n)=>Object.assign(e("button",t,n),{type:"button"}),i=e=>"function"==typeof matchMedia&&matchMedia(e).matches,o=()=>i("(prefers-reduced-motion: reduce)"),s=e=>`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="${e}"/></svg>`;function a(a){let r=e("style");r.textContent='.design-outline{position:fixed;z-index:1;pointer-events:none;box-sizing:border-box;border:2px solid var(--accent,#bda6ef);border-radius:8px;box-shadow:0 0 0 3px color-mix(in srgb,var(--accent,#bda6ef) 22%,transparent),0 2px 12px #0003;transition:all 80ms ease}.design-outline[data-kind=hover]{border-style:dashed;opacity:.8}.design-inspector{position:absolute;inset:0;z-index:9;display:flex;flex-direction:column;overflow:hidden;color:#e9e6e1;background:#0d0d0d;border-radius:inherit;font:12px/1.4 -apple-system,BlinkMacSystemFont,Inter,Segoe UI,sans-serif;color-scheme:dark;opacity:0;translate:0 6px;pointer-events:none;transition:opacity .15s var(--ease-smooth-out),translate .25s var(--ease-smooth-out)}.design-inspector[hidden]{display:none}:host([data-sidebar="background"]) .design-inspector{position:fixed;inset:0 0 0 auto;width:380px;border-radius:0}:host([data-sidebar="edge"]) .design-inspector__heading{cursor:grab;touch-action:none;padding-top:22px}:host(.design-active[data-sidebar="edge"]) .edge-sidebar .edge-sidebar-grip{z-index:10;opacity:1!important}.design-inspector[data-state=active]{opacity:1;translate:0 0;pointer-events:auto}.design-inspector[data-state=closing]{opacity:0;translate:0 4px}.design-inspector button{cursor:pointer}.design-inspector__heading{flex:none;display:flex;align-items:center;gap:4px;min-height:54px;padding:0 8px 0 12px}.design-inspector__identity{min-width:0;flex:1;display:flex;align-items:baseline;gap:6px;white-space:nowrap}.design-inspector__parent{flex:none;max-width:35%;overflow:hidden;text-overflow:ellipsis;margin-left:-6px;padding:2px 6px;border-radius:7px;color:#909090;font-size:15px;font-weight:500}.design-inspector__parent:after{content:"/";margin-left:6px;color:#555}.design-inspector__target{flex:none;max-width:60%;overflow:hidden;text-overflow:ellipsis;color:#fff;font-weight:600;font-size:15px}.design-inspector__heading small{min-width:0;overflow:hidden;text-overflow:ellipsis;color:#909090;font-size:13px}.design-inspector__close,.design-inspector__fold,.design-inspector__actions button{display:grid;place-items:center;min-width:28px;height:28px;border-radius:7px;color:#909090}.design-inspector__close,.design-inspector__fold{flex:none}.design-inspector__close svg,.design-inspector__fold svg,.design-inspector__actions svg{width:16px;height:16px}.design-inspector__parent:hover,.design-inspector__close:hover,.design-inspector__fold:hover,.design-inspector__actions button:hover:not(:disabled){background:#161616;color:#eee}.design-inspector__fold{display:none}.design-inspector__fold svg{transition:rotate .25s var(--ease-smooth-out)}.design-inspector[data-folded] .design-inspector__fold svg{rotate:180deg}.design-inspector[data-folded]>:not(.design-inspector__heading){display:none}.design-inspector__controls{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}:host([data-sidebar="edge"]) .edge-sidebar[data-design-empty]:not([data-morphing]){height:auto!important}:host([data-sidebar="edge"]) [data-design-empty]>.design-inspector{position:relative;inset:auto}:host([data-sidebar="edge"]) [data-design-empty]:not([data-morphing])>.toolbar{position:absolute}.design-inspector[data-empty] .design-inspector__identity{visibility:hidden}.design-inspector[data-empty] .design-inspector__controls{display:grid;place-items:center}.design-inspector[data-empty] .design-inspector__bar:not([data-changes],[data-message]){display:none}.design-inspector__empty{display:flex;flex-direction:column;align-items:center;gap:4px;padding:0 24px 28px;color:#898680;font-size:11px;text-align:center}.design-inspector__empty>svg{box-sizing:content-box;width:20px;height:20px;margin-bottom:8px;padding:8px;border-radius:10px;background:#ffffff0a;color:#77736f}.design-inspector__empty strong{color:#e9e6e1;font-size:12px;font-weight:600}.design-inspector__empty ul{display:grid;gap:6px;margin:8px 0 0;padding:0;list-style:none}.design-inspector__empty kbd{display:inline-block;min-width:8px;padding:0 5px;border-radius:4px;background:#ffffff0f;box-shadow:inset 0 0 0 1px #ffffff12,inset 0 -1px #ffffff12;color:#c9c5bf;font:inherit;font-size:10px;font-weight:500;line-height:17px}.design-inspector__bar{flex:none;display:flex;align-items:center;gap:8px;min-height:56px;padding:0 12px;border-top:1px solid #ffffff0d;color:#909090;font-size:12px}.design-inspector__count{white-space:nowrap;font-variant-numeric:tabular-nums}.design-inspector__compare{display:inline-flex;flex:none;padding:2px;border-radius:7px;background:#ffffff0a}.design-inspector__compare[hidden],.design-inspector__bar[data-message] .design-inspector__compare{display:none}.design-inspector__compare button{height:22px;padding:0 8px;border-radius:5px;color:#9a9a9a;font:inherit;font-size:11px}.design-inspector__compare button:hover{color:#fff}.design-inspector__compare button[aria-pressed=true]{color:#fff;background:#ffffff1a}.design-inspector__status{display:none;min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;animation:design-status .2s var(--ease-smooth-out)}.design-inspector__bar[data-message] .design-inspector__status{display:block}.design-inspector__bar[data-message] .design-inspector__count,.design-inspector__bar:not([data-changes]) .design-inspector__tool{display:none}.design-inspector__actions{display:flex;align-items:center;gap:2px;margin-left:auto}.design-inspector__actions button:disabled{cursor:default;opacity:.35}.design-inspector__actions button:last-child{min-height:34px;margin-left:6px;padding:0 14px;border-radius:8px;background:var(--accent,#bda6ef);color:#211b2d;font-size:12px;font-weight:500}.design-inspector__actions button:last-child:hover:not(:disabled){background:var(--accent,#bda6ef);color:#211b2d;filter:brightness(1.08)}.design-inspector :focus-visible{outline:2px solid var(--accent,#bda6ef);outline-offset:2px}@keyframes design-status{0%{opacity:0;translate:0 2px}}@media(max-width:520px){.design-inspector{position:fixed;inset:auto 12px calc(12px + env(safe-area-inset-bottom,0px));max-height:min(58dvh,560px);border-radius:24px;box-shadow:0 -1px #ffffff24,0 16px 48px #0005;transition:translate .32s cubic-bezier(.22,1,.36,1),scale .32s cubic-bezier(.22,1,.36,1),opacity .15s ease;transform-origin:bottom center}.design-inspector__heading{height:52px;padding-left:18px}.design-inspector__fold{display:grid}.design-inspector[data-empty] .design-inspector__identity{visibility:visible}.design-inspector .design-field{height:34px}}@media(prefers-reduced-motion:reduce){.design-outline,.design-inspector,.design-inspector__fold svg,.design-inspector__status{transition:none;animation:none}}\n';let d=null,l=import("./design-panel-E5I2NED2.js").then(e=>{r.textContent+=e.designPanelStyles,d=e},()=>{w.textContent="Design controls unavailable · try again"}),p=e("aside","design-inspector");p.setAttribute("role","dialog"),p.setAttribute("aria-label","Design mode inspector"),p.setAttribute("aria-hidden","true"),p.hidden=!0;let c=e("div","design-outline");c.setAttribute("aria-hidden","true");let g=e("div","design-inspector__heading"),u=n("design-inspector__parent");u.hidden=!0;let f=e("span","design-inspector__target"),m=e("small"),h=n("design-inspector__close");h.setAttribute("aria-label","Exit design mode"),h.append(t("close"));let x=n("design-inspector__fold");x.append(t("chevron"));let b=e("div","design-inspector__identity");b.append(u,f,m),g.append(b,x,h);let y=e("div","design-inspector__controls"),v=e("div","design-inspector__bar"),_=e("span","design-inspector__count");_.title="Preview only · resets on exit";let w=e("p","design-inspector__status");w.setAttribute("role","status");let E=e("div","design-inspector__actions"),k=(e,t)=>{let i=n("design-inspector__tool");return i.dataset.tip=e,i.setAttribute("aria-label",e),i.innerHTML=t,i},C=k("Undo",s("M5.5 3.5 2.5 6.5l3 3m-3-3h7a4 4 0 0 1 0 8h-2")),P=k("Reset",s("M2.5 2.5v3h3M3 5.5a5.5 5.5 0 1 1-.5 2.5")),A=k("Copy CSS","");A.append(t("copy"));let T=n("","Comment"),L=n("design-text-edit","Edit text");L.title="Edit text",L.setAttribute("aria-label","Edit selected text inline"),E.append(C,P,A,T);let z=e("div","design-inspector__compare");z.setAttribute("role","group"),z.setAttribute("aria-label","Compare with the page");let S=["Before","After"].map((e,t)=>{let i=n("",e);return i.dataset.tip=`${e} · ${t?"→":"←"} or B`,i.setAttribute("aria-pressed",String(!!t)),i.addEventListener("click",()=>ie(!t)),z.append(i),i});v.append(_,z,w,E),p.append(g,y,v),a.root.append(r,c),(a.panelRoot??a.root).append(p);let D,M=!1,R=0,B=null,$=null,I=null,j=0,K=0,F=null,H="",N=null,O=null,U=new Map,V=new Map,W=new WeakMap,X=new WeakMap,q=new AbortController,Y=()=>import("./design-export-DK7XZXBR.js"),Z=e=>{D??=Y().then(({footerTips:t})=>t(v,a.root,q.signal,e),()=>{D=void 0})};v.addEventListener("pointerover",Z),v.addEventListener("focusin",Z);let Q=new Set,G=[];function J(e,t,n=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t)){let o=U.get(e);o||U.set(e,o=new Map),o.has(t)||o.set(t,{value:n,priority:i,computed:getComputedStyle(e).getPropertyValue(t).trim()})}function ee(e,t){let n=V.get(e);n||V.set(e,n=new Map);let i=e.style.getPropertyValue(t);i===(U.get(e)?.get(t)?.value??"")?n.delete(t):n.set(t,i),n.size||V.delete(e),le(B,"selected")}let te=0;new MutationObserver(()=>{let e=w.textContent??"";w.title=e,v.toggleAttribute("data-message",!!e),clearTimeout(te),e&&(te=window.setTimeout(function e(){I?.element?te=window.setTimeout(e,2600):w.textContent=""},2600))}).observe(w,{childList:!0,characterData:!0,subtree:!0});let ne=!1;function ie(e){if(e===ne)return;e&&I?.element&&xe(),ne=e;let t=!o();for(let[n,i]of V){let o=n.style.transition;t&&(n.style.transition=[...i.keys()].map(e=>`${e} .3s cubic-bezier(.22,1,.36,1)`).join());for(let[t,o]of i){let i=U.get(n)?.get(t);e?oe(n,t,i):n.style.setProperty(t,o,i?.priority)}t&&window.setTimeout(()=>n.style.transition=o,320)}I?.showBefore(e),N?.showDesignBefore(e),S.forEach((t,n)=>t.setAttribute("aria-pressed",String(!n===e))),p.toggleAttribute("data-before",e),he()}function oe(e,t,n){n?.value?e.style.setProperty(t,n.value,n.priority):e.style.removeProperty(t)}function se(e,t,n){B&&(e.setAttribute("aria-invalid",String(null===n)),null!==n&&(J(B,t),N?.noteDesignTokenOverride(B,t,n),B.style.setProperty(t,n,U.get(B)?.get(t)?.priority),ee(B,t),he()))}function ae(e,t,n=!0){if(!B)return;let i={value:B.style.getPropertyValue(t),priority:B.style.getPropertyPriority(t)},o=X.get(e),s=o?.before??W.get(e)??{value:"",priority:""};if(i.value===s.value&&i.priority===s.priority)o&&G.splice(G.indexOf(o),1),X.delete(e);else if(o)o.after=i;else{let n={kind:"style",element:B,property:t,before:s,after:i};G.push(n),X.set(e,n)}n&&(W.set(e,i),X.delete(e)),he()}function re(){if(y.replaceChildren(),de(),!B){let n=e("div","design-inspector__empty"),i=e("strong","","Select an element"),o=e("ul"),s=(...t)=>{let n=e("li");t.forEach((t,i)=>{i%2==0?n.append(t):n.append(e("kbd","",t))}),o.append(n)};return s("","Click"," to inspect"),s("","Double-click"," text to edit"),a.exitKey?s("","Esc"," or ",a.exitKey," to exit"):s("","Esc"," to exit"),n.append(t("design"),i,o),y.append(n),f.textContent="Select an element",m.textContent="",void(u.hidden=!0)}let n=`${B.tagName.toLowerCase()}${B.id?`#${B.id}`:""}`;f.textContent=n,m.textContent=B instanceof HTMLIFrameElement?"Frame only · contents are isolated":B.classList.length?`.${[...B.classList].slice(0,2).join(".")}`:"";let i=B.parentElement;u.hidden=!i||i===document.body||i===document.documentElement,u.textContent=i?.tagName.toLowerCase()??"",u.setAttribute("aria-label",`Select parent ${u.textContent}`);let o=B,s=d;s?(s.renderPanel(y,{element:o,changed:V.get(o),collapsed:Q,editText:L,begin:(e,t)=>W.set(e,{value:o.style.getPropertyValue(t),priority:o.style.getPropertyPriority(t)}),apply:se,commit:ae,rerender:re}),(a.design||o.closest("[data-komo-inspectable], [data-komo-design-tokens]"))&&(O??=import("./react-props-panel-HWQ7WERB.js").then(e=>N=e).catch(e=>{throw O=null,e}),O.then(e=>{if(!M||B!==o||y.querySelector(".design-react-group, .design-theme-group"))return;let t=a.root;e.attachThemeSwitcher(y,a.design,()=>ge(o),t);let n=e.createReactPropsPanel(o,()=>{w.textContent="React state preview · resets on exit",he()},t,ge,a.design);n&&y.append(n),e.attachStyleTokenControls(o,s.fields,y,(e,t,n)=>{J(o,e.property,n),ee(o,e.property),W.set(t,{value:n,priority:o.style.getPropertyPriority(e.property)}),ae(t,e.property)},t,s.valueFor,s.toHex,a.design,e=>{G.push({element:o,undo:e}),he()});let i=e.createDesignThemePanel(o,s,he,t);i&&y.append(i)}).catch(()=>{}))):l.then(()=>{M&&B===o&&re()})}function de(){p.toggleAttribute("data-empty",T.hidden=!B),p.parentElement?.toggleAttribute("data-design-empty",M&&!B)}function le(e,t,n=!1){if(!M||!e?.isConnected)return void(c.hidden=!0);let i=e.getBoundingClientRect();if(i.width&&i.height){if(c.hidden=!1,c.dataset.kind=t,n&&(e!==F||t!==H)){F=e,H=t,clearTimeout(K);let n=p.getBoundingClientRect(),o=e=>i.left<e+n.width&&i.right>e&&i.top<n.bottom&&i.bottom>n.top;a.flip&&n.width&&o(n.left)&&!o(document.documentElement.clientWidth-n.right)&&(K=window.setTimeout(a.flip,"hover"===t?350:0))}Object.assign(c.style,{left:`${i.left}px`,top:`${i.top}px`,width:`${i.width}px`,height:`${i.height}px`})}else c.hidden=!0}function pe(){j||(j=requestAnimationFrame(()=>{j=0,le(B??$,B?"selected":"hover")}))}let ce="function"==typeof ResizeObserver?new ResizeObserver(pe):null;function ge(e){!(e instanceof HTMLElement)||a.host.contains(e)||(I?.element&&I.element!==e&&xe(),ce?.disconnect(),ce?.observe(e),B=e,$=e,re(),le(e,"selected",!0),he())}let ue=()=>i("(max-width:520px)");function fe(e){p.toggleAttribute("data-folded",e&&ue()),x.setAttribute("aria-expanded",String(!p.hasAttribute("data-folded"))),x.setAttribute("aria-label",p.hasAttribute("data-folded")?"Expand inspector":"Collapse inspector")}function me(e){fe(!1),ue()&&requestAnimationFrame(()=>{let t=e.getBoundingClientRect(),n=p.getBoundingClientRect().top-12;t.top>=12&&t.bottom<=n||window.scrollBy({top:t.top-Math.max(12,(n-t.height)/2),behavior:o()?"auto":"smooth"})})}function he(){pe(),C.disabled=!G.length&&!N?.canUndoReactProp(B)&&!N?.canUndoDesignTokenEdit(B),P.disabled=!function(){let e=B,t=e?(V.get(e)?.size??0)+ +!!I?.hasChanges(e)+ +!!N?.hasReactPropChanges(e)||+!!N?.hasDesignTokenEdit(e):0;return _.textContent=t?`${t} change${t>1?"s":""}`:"",v.toggleAttribute("data-changes",t>0||!C.disabled),z.hidden=!t&&!ne,t}(),A.disabled=!B||!V.get(B)?.size,T.disabled=!B,L.disabled=!!I?.busy||!B?.isConnected,L.textContent=I?.isEditing(B)?"Done editing":"Edit text",L.setAttribute("aria-label",I?.isEditing(B)?"Finish inline text editing":"Edit selected text inline")}function xe(e=!1){I?.finish(e),he()}function be(e){if(!e){ie(!1),I?.finish();for(let[e,t]of U)for(let[n,i]of t)oe(e,n,i);U.clear(),V.clear(),G.length=0,I?.restoreAll(),N?.resetPreviews(),he()}clearTimeout(R),R=0,M=e,de(),e?(p.hidden=!1,p.setAttribute("aria-hidden","false"),requestAnimationFrame(()=>{M&&(p.dataset.state="active")}),c.hidden=!B,re(),fe(!B),le(B,"selected"),h.focus({preventScroll:!0})):(c.hidden=!0,p.setAttribute("aria-hidden","true"),p.dataset.state="closing",o()?(p.hidden=!0,delete p.dataset.state):R=window.setTimeout(()=>{R=0,M||(p.hidden=!0,delete p.dataset.state)},250))}L.addEventListener("click",e=>{I||B&&(w.textContent="Loading inline text editor…",import("./inline-text-editor-TZNY2BNK.js").then(t=>{I||!B||!M||(I=t.bindInlineTextTools({button:L,status:w,selected:()=>B,active:()=>M,onChange:he,onCommit(e){G.push({kind:"text",element:e})}}),I.toggle(e))}).catch(()=>{w.textContent="Inline text editing is unavailable."}))}),x.addEventListener("click",()=>fe(!p.hasAttribute("data-folded"))),u.addEventListener("click",()=>ge(B?.parentElement??null)),h.addEventListener("click",()=>{I?.element&&xe(),be(!1),a.onExit()}),C.addEventListener("click",()=>{let e=G.pop();e?e.kind?"text"===e.kind?B===(I?.undo()??e.element)&&re():(oe(e.element,e.property,e.before),N?.syncDesignTokenBinding(e.element,e.property),ee(e.element,e.property),B===e.element&&re(),le(B??$,B?"selected":"hover")):(e.undo(),re()):(B&&(N?.undoDesignTokenEdit(B),N?.undoReactProp(B),re()),w.textContent="React state preview · resets on exit"),he(),(C.disabled?h:C).focus({preventScroll:!0})}),P.addEventListener("click",()=>{if(!B)return;I?.isEditing(B)&&xe(!0);let e=V.get(B),t=I?.hasChanges(B)??!1,n=N?.hasReactPropChanges(B)??!1,i=N?.hasDesignTokenEdit(B)??!1;if(e?.size||t||n||i){t&&I?.reset(B);for(let t of e?.keys()??[])oe(B,t,U.get(B)?.get(t));V.delete(B),n&&N?.resetReactProps(B),i&&N?.resetDesignTokenEdits(B);for(let e=G.length-1;e>=0;e--)G[e].element===B&&G.splice(e,1);re(),le(B,"selected"),he(),h.focus({preventScroll:!0})}}),A.addEventListener("click",()=>{let e=B,t=e?V.get(e):void 0;!e||!t?.size||Y().then(async({cssText:n})=>{let i=n(e,t);try{await navigator.clipboard.writeText(i),w.textContent="CSS copied"}catch{w.textContent=i}})}),T.addEventListener("click",()=>{let e=B;e&&(I?.isEditing(e)&&xe(),Y().then(({designProposal:t})=>a.onComment(e,t(e,V.get(e),t=>U.get(e)?.get(t)?.computed,N?.tokenBoundProperties(e),[I?.proposal(e),N?.proposedDesignChanges(e)],N?.designContext(e,a.design))),()=>{w.textContent="Comment unavailable · try again"}))});let ye=()=>ie(!1);for(let e of[y,E,L])for(let t of["pointerdown","focusin","click"])e.addEventListener(t,ye,!0);return document.addEventListener("pointermove",function(e){if(!M||e.composedPath().includes(a.host))return;let t=a.targetAt(e.clientX,e.clientY);!(t instanceof HTMLElement)||a.host.contains(t)||($=t,B||le($,"hover",!0))},{capture:!0,signal:q.signal}),document.addEventListener("pointerdown",function(e){if(!M||e.composedPath().includes(a.host))return;let t=a.targetAt(e.clientX,e.clientY);!(t instanceof HTMLElement)||a.host.contains(t)||I?.element&&(t===I.element||I.element.contains(t))||(I?.element&&xe(),e.preventDefault(),e.stopImmediatePropagation(),ge(t))},{capture:!0,signal:q.signal}),document.addEventListener("click",function(e){!M||e.composedPath().includes(a.host)||(e.preventDefault(),e.stopImmediatePropagation(),B&&me(B),2===e.detail&&B?.contains(e.target)&&!L.disabled&&!I?.element&&L.dispatchEvent(new MouseEvent("click",e)))},{capture:!0,signal:q.signal}),document.addEventListener("keydown",function(e){if(I?.handleKey(e))return void L.focus({preventScroll:!0});let t=e.key.toLowerCase(),n=e.composedPath()[0];if(M&&!z.hidden&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&("b"===t||"arrowleft"===t||"arrowright"===t)&&!(n instanceof HTMLElement&&(n.isContentEditable||n.matches("input, textarea, select"))))return e.preventDefault(),e.stopImmediatePropagation(),void ie("b"===t?!ne:"arrowleft"===t);if(M&&!I?.element&&("Enter"===e.key||" "===e.key)&&!e.composedPath().includes(a.host)){let t=document.activeElement;if(t instanceof HTMLElement&&t!==document.body&&t!==document.documentElement)return e.preventDefault(),e.stopImmediatePropagation(),ge(t),void me(t)}M&&"Escape"===e.key&&(e.preventDefault(),e.stopImmediatePropagation(),be(!1),a.onExit())},{capture:!0,signal:q.signal}),window.addEventListener("scroll",pe,{capture:!0,passive:!0,signal:q.signal}),window.addEventListener("resize",pe,{passive:!0,signal:q.signal}),{setActive:be,mountPanel(e){p.parentElement!==e&&(p.parentElement?.removeAttribute("data-design-empty"),e.append(p),de())},get active(){return M},ready:l,destroy(){I?.finish(!0),be(!1),clearTimeout(R),clearTimeout(te),clearTimeout(K),ce?.disconnect(),q.abort(),cancelAnimationFrame(j),p.remove(),c.remove(),r.remove()}}}export{a as createDesignMode};
|
|
1
|
+
import{a as e}from"./chunk-53M6AOAX.js";import{i as t,j as n}from"./chunk-ANKCS6NI.js";var i=(e,n)=>Object.assign(t("button",e,n),{type:"button"}),o=e=>"function"==typeof matchMedia&&matchMedia(e).matches,s=()=>o("(prefers-reduced-motion: reduce)"),a=e=>`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="${e}"/></svg>`;function r(r){let d=t("style");d.textContent='.design-outline{position:fixed;z-index:1;pointer-events:none;box-sizing:border-box;outline:2px solid var(--accent,#bda6ef);outline-offset:2px;transition:opacity 80ms ease}.design-outline[data-kind=hover]{outline-style:dashed;opacity:.8}.design-inspector{position:absolute;inset:0;z-index:9;display:flex;flex-direction:column;overflow:hidden;color:#e9e6e1;background:#0d0d0d;border-radius:inherit;font:12px/1.4 -apple-system,BlinkMacSystemFont,Inter,Segoe UI,sans-serif;color-scheme:dark;opacity:0;translate:0 6px;pointer-events:none;transition:opacity .15s var(--ease-smooth-out),translate .25s var(--ease-smooth-out)}.design-inspector[hidden]{display:none}:host([data-sidebar="background"]) .design-inspector{position:fixed;inset:0 0 0 auto;width:380px;border-radius:0}:host([data-sidebar="edge"]) .design-inspector__heading{cursor:grab;touch-action:none;padding-top:22px}:host(.design-active[data-sidebar="edge"]) .edge-sidebar .edge-sidebar-grip{z-index:10;opacity:1!important}.design-inspector[data-state=active]{opacity:1;translate:0 0;pointer-events:auto}.design-inspector[data-state=closing]{opacity:0;translate:0 4px}.design-inspector button{cursor:pointer}.design-inspector__heading{flex:none;display:flex;align-items:center;gap:4px;min-height:54px;padding:0 8px 0 12px}.design-inspector__identity{min-width:0;flex:1;display:flex;align-items:baseline;gap:6px;white-space:nowrap}.design-inspector__parent{flex:none;max-width:35%;overflow:hidden;text-overflow:ellipsis;margin-left:-6px;padding:2px 6px;border-radius:7px;color:#909090;font-size:15px;font-weight:500}.design-inspector__parent:after{content:"/";margin-left:6px;color:#555}.design-inspector__target{flex:none;max-width:60%;overflow:hidden;text-overflow:ellipsis;color:#fff;font-weight:600;font-size:15px}.design-inspector__heading small{min-width:0;overflow:hidden;text-overflow:ellipsis;color:#909090;font-size:13px}.design-inspector__close,.design-inspector__fold,.design-inspector__actions button{display:grid;place-items:center;min-width:28px;height:28px;border-radius:7px;color:#909090}.design-inspector__close,.design-inspector__fold{flex:none}.design-inspector__close svg,.design-inspector__fold svg,.design-inspector__actions svg{width:16px;height:16px}.design-inspector__parent:hover,.design-inspector__close:hover,.design-inspector__fold:hover,.design-inspector__actions button:hover:not(:disabled){background:#161616;color:#eee}.design-inspector__fold{display:none}.design-inspector__fold svg{transition:rotate .25s var(--ease-smooth-out)}.design-inspector[data-folded] .design-inspector__fold svg{rotate:180deg}.design-inspector[data-folded]>:not(.design-inspector__heading){display:none}.design-inspector__controls{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}:host([data-sidebar="edge"]) .edge-sidebar[data-design-empty]:not([data-morphing]){height:auto!important}:host([data-sidebar="edge"]) [data-design-empty]>.design-inspector{position:relative;inset:auto}:host([data-sidebar="edge"]) [data-design-empty]:not([data-morphing])>.toolbar{position:absolute}.design-inspector[data-empty] .design-inspector__identity{visibility:hidden}.design-inspector[data-empty] .design-inspector__controls{display:grid;place-items:center}.design-inspector[data-empty] .design-inspector__bar:not([data-changes],[data-message]){display:none}.design-inspector__empty{display:flex;flex-direction:column;align-items:center;gap:4px;padding:0 24px 28px;color:#898680;font-size:11px;text-align:center}.design-inspector__empty>svg{box-sizing:content-box;width:20px;height:20px;margin-bottom:8px;padding:8px;border-radius:10px;background:#ffffff0a;color:#77736f}.design-inspector__empty strong{color:#e9e6e1;font-size:12px;font-weight:600}.design-inspector__empty ul{display:grid;gap:6px;margin:8px 0 0;padding:0;list-style:none}.design-inspector__empty kbd{display:inline-block;min-width:8px;padding:0 5px;border-radius:4px;background:#ffffff0f;box-shadow:inset 0 0 0 1px #ffffff12,inset 0 -1px #ffffff12;color:#c9c5bf;font:inherit;font-size:10px;font-weight:500;line-height:17px}.design-inspector__bar{flex:none;display:flex;align-items:center;gap:8px;min-height:56px;padding:0 12px;border-top:1px solid #ffffff0d;color:#909090;font-size:12px}.design-inspector__count{white-space:nowrap;font-variant-numeric:tabular-nums}.design-inspector__compare{display:inline-flex;flex:none;padding:2px;border-radius:7px;background:#ffffff0a}.design-inspector__compare[hidden],.design-inspector__bar[data-message] .design-inspector__compare{display:none}.design-inspector__compare button{height:22px;padding:0 8px;border-radius:5px;color:#9a9a9a;font:inherit;font-size:11px}.design-inspector__compare button:hover{color:#fff}.design-inspector__compare button[aria-pressed=true]{color:#fff;background:#ffffff1a}.design-inspector__status{display:none;min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;animation:design-status .2s var(--ease-smooth-out)}.design-inspector__bar[data-message] .design-inspector__status{display:block}.design-inspector__bar[data-message] .design-inspector__count,.design-inspector__bar:not([data-changes]) .design-inspector__tool{display:none}.design-inspector__actions{display:flex;align-items:center;gap:2px;margin-left:auto}.design-inspector__actions button:disabled{cursor:default;opacity:.35}.design-inspector__actions button:last-child{min-height:34px;margin-left:6px;padding:0 14px;border-radius:8px;background:var(--accent,#bda6ef);color:#211b2d;font-size:12px;font-weight:500}.design-inspector__actions button:last-child:hover:not(:disabled){background:var(--accent,#bda6ef);color:#211b2d;filter:brightness(1.08)}.design-inspector :focus-visible{outline:2px solid var(--accent,#bda6ef);outline-offset:2px}@keyframes design-status{0%{opacity:0;translate:0 2px}}@media(max-width:520px){.design-inspector{position:fixed;inset:auto 12px calc(12px + env(safe-area-inset-bottom,0px));max-height:min(58dvh,560px);border-radius:24px;box-shadow:0 -1px #ffffff24,0 16px 48px #0005;transition:translate .32s cubic-bezier(.22,1,.36,1),scale .32s cubic-bezier(.22,1,.36,1),opacity .15s ease;transform-origin:bottom center}.design-inspector__heading{height:52px;padding-left:18px}.design-inspector__fold{display:grid}.design-inspector[data-empty] .design-inspector__identity{visibility:visible}.design-inspector .design-field{height:34px}}@media(prefers-reduced-motion:reduce){.design-outline,.design-inspector,.design-inspector__fold svg,.design-inspector__status{transition:none;animation:none}}\n';let l=null,p=import("./design-panel-VLR2UILF.js").then(e=>{d.textContent+=e.designPanelStyles,l=e},()=>{k.textContent="Design controls unavailable · try again"}),c=t("aside","design-inspector");c.setAttribute("role","dialog"),c.setAttribute("aria-label","Design mode inspector"),c.setAttribute("aria-hidden","true"),c.hidden=!0;let g=t("div","design-outline");g.setAttribute("aria-hidden","true");let u=t("div","design-inspector__heading"),f=i("design-inspector__parent");f.hidden=!0;let m=t("span","design-inspector__target"),h=t("small"),x=i("design-inspector__close");x.setAttribute("aria-label","Exit design mode"),x.append(n("close"));let b=i("design-inspector__fold");b.append(n("chevron"));let y=t("div","design-inspector__identity");y.append(f,m,h),u.append(y,b,x);let v=t("div","design-inspector__controls"),_=t("div","design-inspector__bar"),w=t("span","design-inspector__count");w.title="Preview only · resets on exit";let k=t("p","design-inspector__status");k.setAttribute("role","status");let E=t("div","design-inspector__actions"),C=(e,t)=>{let n=i("design-inspector__tool");return n.dataset.tip=e,n.setAttribute("aria-label",e),n.innerHTML=t,n},P=C("Undo",a("M5.5 3.5 2.5 6.5l3 3m-3-3h7a4 4 0 0 1 0 8h-2")),A=C("Reset",a("M2.5 2.5v3h3M3 5.5a5.5 5.5 0 1 1-.5 2.5")),L=C("Copy CSS","");L.append(n("copy"));let T=i("","Comment"),z=i("design-text-edit","Edit text");z.title="Edit text",z.setAttribute("aria-label","Edit selected text inline"),E.append(P,A,L,T);let M=t("div","design-inspector__compare");M.setAttribute("role","group"),M.setAttribute("aria-label","Compare with the page");let S=["Before","After"].map((e,t)=>{let n=i("",e);return n.dataset.tip=`${e} · ${t?"→":"←"} or B`,n.setAttribute("aria-pressed",String(!!t)),n.addEventListener("click",()=>oe(!t)),M.append(n),n});_.append(w,M,k,E),c.append(u,v,_),r.root.append(d,g),(r.panelRoot??r.root).append(c);let D,R=!1,B=0,I=null,F=null,$=null,j=0,H=0,K=null,O="",N=null,V=null,U=new Map,q=new Map,W=new WeakMap,X=new WeakMap,Z=new AbortController,Y=()=>import("./design-export-G42ZDP5F.js"),G=e=>{D??=Y().then(({footerTips:t})=>t(_,r.root,Z.signal,e),()=>{D=void 0})};_.addEventListener("pointerover",G),_.addEventListener("focusin",G);let J=new Set,Q=[];function ee(e,t,n=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t)){let o=U.get(e);o||U.set(e,o=new Map),o.has(t)||o.set(t,{value:n,priority:i,computed:getComputedStyle(e).getPropertyValue(t).trim()})}function te(e,t){let n=q.get(e);n||q.set(e,n=new Map);let i=e.style.getPropertyValue(t);i===(U.get(e)?.get(t)?.value??"")?n.delete(t):n.set(t,i),n.size||q.delete(e),pe(I,"selected")}let ne=0;new MutationObserver(()=>{let e=k.textContent??"";k.title=e,_.toggleAttribute("data-message",!!e),clearTimeout(ne),e&&(ne=window.setTimeout(function e(){$?.element?ne=window.setTimeout(e,2600):k.textContent=""},2600))}).observe(k,{childList:!0,characterData:!0,subtree:!0});let ie=!1;function oe(e){if(e===ie)return;e&&$?.element&&be(),ie=e;let t=!s();for(let[n,i]of q){let o=n.style.transition;t&&(n.style.transition=[...i.keys()].map(e=>`${e} .3s cubic-bezier(.22,1,.36,1)`).join());for(let[t,o]of i){let i=U.get(n)?.get(t);e?se(n,t,i):n.style.setProperty(t,o,i?.priority)}t&&window.setTimeout(()=>n.style.transition=o,320)}$?.showBefore(e),N?.showDesignBefore(e),S.forEach((t,n)=>t.setAttribute("aria-pressed",String(!n===e))),c.toggleAttribute("data-before",e),xe()}function se(e,t,n){n?.value?e.style.setProperty(t,n.value,n.priority):e.style.removeProperty(t)}function ae(e,t,n){I&&(e.setAttribute("aria-invalid",String(null===n)),null!==n&&(ee(I,t),N?.noteDesignTokenOverride(I,t,n),I.style.setProperty(t,n,U.get(I)?.get(t)?.priority),te(I,t),xe()))}function re(e,t,n=!0){if(!I)return;let i={value:I.style.getPropertyValue(t),priority:I.style.getPropertyPriority(t)},o=X.get(e),s=o?.before??W.get(e)??{value:"",priority:""};if(i.value===s.value&&i.priority===s.priority)o&&Q.splice(Q.indexOf(o),1),X.delete(e);else if(o)o.after=i;else{let n={kind:"style",element:I,property:t,before:s,after:i};Q.push(n),X.set(e,n)}n&&(W.set(e,i),X.delete(e)),xe()}function de(){if(v.replaceChildren(),le(),!I){let e=t("div","design-inspector__empty"),i=t("strong","","Select an element"),o=t("ul"),s=(...e)=>{let n=t("li");e.forEach((e,i)=>{i%2==0?n.append(e):n.append(t("kbd","",e))}),o.append(n)};return s("","Click"," to inspect"),s("","Double-click"," text to edit"),r.exitKey?s("","Esc"," or ",r.exitKey," to exit"):s("","Esc"," to exit"),e.append(n("design"),i,o),v.append(e),m.textContent="Select an element",h.textContent="",void(f.hidden=!0)}let e=`${I.tagName.toLowerCase()}${I.id?`#${I.id}`:""}`;m.textContent=e,h.textContent=I instanceof HTMLIFrameElement?"Frame only · contents are isolated":I.classList.length?`.${[...I.classList].slice(0,2).join(".")}`:"";let i=I.parentElement;f.hidden=!i||i===document.body||i===document.documentElement,f.textContent=i?.tagName.toLowerCase()??"",f.setAttribute("aria-label",`Select parent ${f.textContent}`);let o=I,s=l;s?(s.renderPanel(v,{element:o,changed:q.get(o),collapsed:J,editText:z,begin:(e,t)=>W.set(e,{value:o.style.getPropertyValue(t),priority:o.style.getPropertyPriority(t)}),apply:ae,commit:re,rerender:de}),(r.design||o.closest("[data-komo-inspectable], [data-komo-design-tokens]"))&&(V??=import("./react-props-panel-NC7KLZ73.js").then(e=>N=e).catch(e=>{throw V=null,e}),V.then(e=>{if(!R||I!==o||v.querySelector(".design-react-group, .design-theme-group"))return;let t=r.root;e.attachThemeSwitcher(v,r.design,()=>ue(o),t);let n=e.createReactPropsPanel(o,()=>{k.textContent="React state preview · resets on exit",xe()},t,ue,r.design);n&&v.append(n),e.attachStyleTokenControls(o,s.fields,v,(e,t,n)=>{ee(o,e.property,n),te(o,e.property),W.set(t,{value:n,priority:o.style.getPropertyPriority(e.property)}),re(t,e.property)},t,s.valueFor,s.toHex,r.design,e=>{Q.push({element:o,undo:e}),xe()});let i=e.createDesignThemePanel(o,s,xe,t);i&&v.append(i)}).catch(()=>{}))):p.then(()=>{R&&I===o&&de()})}function le(){c.toggleAttribute("data-empty",T.hidden=!I),c.parentElement?.toggleAttribute("data-design-empty",R&&!I)}function pe(t,n,i=!1){if(!R||!t?.isConnected)return void(g.hidden=!0);let o=t.getBoundingClientRect();if(o.width&&o.height){if(g.hidden=!1,g.dataset.kind=n,i&&(t!==K||n!==O)){K=t,O=n,clearTimeout(H);let e=c.getBoundingClientRect(),i=t=>o.left<t+e.width&&o.right>t&&o.top<e.bottom&&o.bottom>e.top;r.flip&&e.width&&i(e.left)&&!i(document.documentElement.clientWidth-e.right)&&(H=window.setTimeout(r.flip,"hover"===n?350:0))}g.hidden=!e(g,o,t)}else g.hidden=!0}function ce(){j||(j=requestAnimationFrame(()=>{j=0,pe(I??F,I?"selected":"hover")}))}let ge="function"==typeof ResizeObserver?new ResizeObserver(ce):null;function ue(e){!(e instanceof HTMLElement)||r.host.contains(e)||($?.element&&$.element!==e&&be(),ge?.disconnect(),ge?.observe(e),I=e,F=e,de(),pe(e,"selected",!0),xe())}let fe=()=>o("(max-width:520px)");function me(e){c.toggleAttribute("data-folded",e&&fe()),b.setAttribute("aria-expanded",String(!c.hasAttribute("data-folded"))),b.setAttribute("aria-label",c.hasAttribute("data-folded")?"Expand inspector":"Collapse inspector")}function he(e){me(!1),fe()&&requestAnimationFrame(()=>{let t=e.getBoundingClientRect(),n=c.getBoundingClientRect().top-12;t.top>=12&&t.bottom<=n||window.scrollBy({top:t.top-Math.max(12,(n-t.height)/2),behavior:s()?"auto":"smooth"})})}function xe(){ce(),P.disabled=!Q.length&&!N?.canUndoReactProp(I)&&!N?.canUndoDesignTokenEdit(I),A.disabled=!function(){let e=I,t=e?(q.get(e)?.size??0)+ +!!$?.hasChanges(e)+ +!!N?.hasReactPropChanges(e)||+!!N?.hasDesignTokenEdit(e):0;return w.textContent=t?`${t} change${t>1?"s":""}`:"",_.toggleAttribute("data-changes",t>0||!P.disabled),M.hidden=!t&&!ie,t}(),L.disabled=!I||!q.get(I)?.size,T.disabled=!I,z.disabled=!!$?.busy||!I?.isConnected,z.textContent=$?.isEditing(I)?"Done editing":"Edit text",z.setAttribute("aria-label",$?.isEditing(I)?"Finish inline text editing":"Edit selected text inline")}function be(e=!1){$?.finish(e),xe()}function ye(e){if(!e){oe(!1),$?.finish();for(let[e,t]of U)for(let[n,i]of t)se(e,n,i);U.clear(),q.clear(),Q.length=0,$?.restoreAll(),N?.resetPreviews(),xe()}clearTimeout(B),B=0,R=e,le(),e?(c.hidden=!1,c.setAttribute("aria-hidden","false"),requestAnimationFrame(()=>{R&&(c.dataset.state="active")}),g.hidden=!I,de(),me(!I),pe(I,"selected"),x.focus({preventScroll:!0})):(g.hidden=!0,c.setAttribute("aria-hidden","true"),c.dataset.state="closing",s()?(c.hidden=!0,delete c.dataset.state):B=window.setTimeout(()=>{B=0,R||(c.hidden=!0,delete c.dataset.state)},250))}z.addEventListener("click",e=>{$||I&&(k.textContent="Loading inline text editor…",import("./inline-text-editor-Z2N32PER.js").then(t=>{$||!I||!R||($=t.bindInlineTextTools({button:z,status:k,selected:()=>I,active:()=>R,onChange:xe,onCommit(e){Q.push({kind:"text",element:e})}}),$.toggle(e))}).catch(()=>{k.textContent="Inline text editing is unavailable."}))}),b.addEventListener("click",()=>me(!c.hasAttribute("data-folded"))),f.addEventListener("click",()=>ue(I?.parentElement??null)),x.addEventListener("click",()=>{$?.element&&be(),ye(!1),r.onExit()}),P.addEventListener("click",()=>{let e=Q.pop();e?e.kind?"text"===e.kind?I===($?.undo()??e.element)&&de():(se(e.element,e.property,e.before),N?.syncDesignTokenBinding(e.element,e.property),te(e.element,e.property),I===e.element&&de(),pe(I??F,I?"selected":"hover")):(e.undo(),de()):(I&&(N?.undoDesignTokenEdit(I),N?.undoReactProp(I),de()),k.textContent="React state preview · resets on exit"),xe(),(P.disabled?x:P).focus({preventScroll:!0})}),A.addEventListener("click",()=>{if(!I)return;$?.isEditing(I)&&be(!0);let e=q.get(I),t=$?.hasChanges(I)??!1,n=N?.hasReactPropChanges(I)??!1,i=N?.hasDesignTokenEdit(I)??!1;if(e?.size||t||n||i){t&&$?.reset(I);for(let t of e?.keys()??[])se(I,t,U.get(I)?.get(t));q.delete(I),n&&N?.resetReactProps(I),i&&N?.resetDesignTokenEdits(I);for(let e=Q.length-1;e>=0;e--)Q[e].element===I&&Q.splice(e,1);de(),pe(I,"selected"),xe(),x.focus({preventScroll:!0})}}),L.addEventListener("click",()=>{let e=I,t=e?q.get(e):void 0;!e||!t?.size||Y().then(async({cssText:n})=>{let i=n(e,t);try{await navigator.clipboard.writeText(i),k.textContent="CSS copied"}catch{k.textContent=i}})}),T.addEventListener("click",()=>{let e=I;e&&($?.isEditing(e)&&be(),Y().then(({designProposal:t})=>r.onComment(e,t(e,q.get(e),t=>U.get(e)?.get(t)?.computed,N?.tokenBoundProperties(e),[$?.proposal(e),N?.proposedDesignChanges(e)],N?.designContext(e,r.design))),()=>{k.textContent="Comment unavailable · try again"}))});let ve=()=>oe(!1);for(let e of[v,E,z])for(let t of["pointerdown","focusin","click"])e.addEventListener(t,ve,!0);return document.addEventListener("pointermove",function(e){if(!R||e.composedPath().includes(r.host))return;let t=r.targetAt(e.clientX,e.clientY);!(t instanceof HTMLElement)||r.host.contains(t)||(F=t,I||pe(F,"hover",!0))},{capture:!0,signal:Z.signal}),document.addEventListener("pointerdown",function(e){if(!R||e.composedPath().includes(r.host))return;let t=r.targetAt(e.clientX,e.clientY);!(t instanceof HTMLElement)||r.host.contains(t)||$?.element&&(t===$.element||$.element.contains(t))||($?.element&&be(),e.preventDefault(),e.stopImmediatePropagation(),ue(t))},{capture:!0,signal:Z.signal}),document.addEventListener("click",function(e){!R||e.composedPath().includes(r.host)||(e.preventDefault(),e.stopImmediatePropagation(),I&&he(I),2===e.detail&&I?.contains(e.target)&&!z.disabled&&!$?.element&&z.dispatchEvent(new MouseEvent("click",e)))},{capture:!0,signal:Z.signal}),document.addEventListener("keydown",function(e){if($?.handleKey(e))return void z.focus({preventScroll:!0});let t=e.key.toLowerCase(),n=e.composedPath()[0];if(R&&!M.hidden&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&("b"===t||"arrowleft"===t||"arrowright"===t)&&!(n instanceof HTMLElement&&(n.isContentEditable||n.matches("input, textarea, select"))))return e.preventDefault(),e.stopImmediatePropagation(),void oe("b"===t?!ie:"arrowleft"===t);if(R&&!$?.element&&("Enter"===e.key||" "===e.key)&&!e.composedPath().includes(r.host)){let t=document.activeElement;if(t instanceof HTMLElement&&t!==document.body&&t!==document.documentElement)return e.preventDefault(),e.stopImmediatePropagation(),ue(t),void he(t)}R&&"Escape"===e.key&&(e.preventDefault(),e.stopImmediatePropagation(),ye(!1),r.onExit())},{capture:!0,signal:Z.signal}),window.addEventListener("scroll",ce,{capture:!0,passive:!0,signal:Z.signal}),window.addEventListener("resize",ce,{passive:!0,signal:Z.signal}),{setActive:ye,mountPanel(e){c.parentElement!==e&&(c.parentElement?.removeAttribute("data-design-empty"),e.append(c),le())},get active(){return R},ready:p,destroy(){$?.finish(!0),ye(!1),clearTimeout(B),clearTimeout(ne),clearTimeout(H),ge?.disconnect(),Z.abort(),cancelAnimationFrame(j),c.remove(),g.remove(),d.remove()}}}export{r as createDesignMode};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e='.design-inspector__controls>*+*{border-top:1px solid #ffffff0d}.design-group{padding:0 12px 10px}.design-section>.design-group{padding-bottom:12px}.design-group summary{cursor:pointer;display:flex;align-items:center;gap:4px;height:36px;color:#e9e6e1;font-size:11px;font-weight:600;list-style:none}.design-group summary::-webkit-details-marker{display:none}.design-group summary:after{content:"";width:5px;height:5px;margin:-2px 0 0 3px;border:solid #77736f;border-width:0 1.2px 1.2px 0;rotate:45deg;opacity:0;transition:opacity .12s,rotate .2s var(--ease-smooth-out)}.design-group:not([open]) summary:after{rotate:-45deg;margin:0 0 0 2px}.design-group summary:is(:hover,:focus-visible):after,.design-group:not([open]) summary:after{opacity:1}.design-group summary:focus-visible{outline-offset:-2px;border-radius:6px}.design-section{position:relative}.design-section__title{display:flex;align-items:center;height:36px;padding:0 12px;color:#898680;font-size:11px;font-weight:600}.design-section__tools{position:absolute;z-index:1;top:6px;right:8px;display:flex;gap:2px}.design-section__tools button{display:grid;place-items:center;width:24px;height:24px;border-radius:6px;color:#898680;font-size:16px;line-height:1}.design-section__tools button:hover{background:#ffffff12;color:#f1efeb}.design-text-edit{font-size:0!important}.design-text-edit:before{content:"T";font:600 13px/1 Georgia,Times New Roman,serif}.design-text-edit[aria-label^=Finish]{background:#bda6ef33;color:#e6dcfb!important}.design-text-edit:disabled{opacity:.35;cursor:default}.design-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px 8px}.design-field{position:relative;--lead:4px;min-width:0;height:28px;display:flex;align-items:center;border-radius:6px;background:#ffffff0a;color:#898680;transition:box-shadow .12s var(--ease-smooth-out)}.design-field:hover{box-shadow:inset 0 0 0 1px #ffffff1c}.design-field:focus-within{box-shadow:inset 0 0 0 1px #bda6ef}.design-field:has([aria-invalid=true]){box-shadow:inset 0 0 0 1px #fda29b}.design-field[data-wide]{grid-column:1/-1}.design-field:has(.design-field__glyph){--lead:22px}.design-field--color{--lead:26px}.design-field>input:not([type=color]),.design-field>select{flex:1;box-sizing:border-box;width:100%;min-width:0;height:100%;margin:0;padding:0 8px;border:0;border-radius:6px;outline:0;box-shadow:none;background:none;color:#f1efeb;font:inherit;font-size:11px;font-variant-numeric:tabular-nums;text-overflow:ellipsis}.design-field>:is(input,select):focus-visible{outline:0}.design-field input[type=number]{appearance:textfield;-moz-appearance:textfield}.design-field input::-webkit-inner-spin-button{appearance:none}.design-field__glyph{flex:none;display:grid;place-items:center;width:22px;height:100%;margin-right:-6px;color:#77736f;font-size:10px;font-weight:600;cursor:ew-resize;user-select:none;touch-action:none}.design-field__glyph:hover{color:#e9e6e1}.design-field__glyph svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.1}.design-field input[type=color]{flex:none;width:16px;height:16px;margin:0 -2px 0 6px;padding:0;border:0;border-radius:4px;box-shadow:inset 0 0 0 1px #ffffff26;background:none;cursor:pointer}.design-field input[type=color]::-webkit-color-swatch-wrapper{padding:0}.design-field input[type=color]::-webkit-color-swatch{border:0;border-radius:4px;box-shadow:inset 0 0 0 1px #ffffff26}.design-field input[type=color]::-moz-color-swatch{border:0;border-radius:4px}\n',t=[{property:"width",label:"Width",kind:"size",glyph:"W"},{property:"height",label:"Height",kind:"size",glyph:"H"},{property:"padding",label:"Padding",kind:"length",glyph:"M1.5 1.5h9v9h-9zM4.5 4.5h3v3h-3z",max:200},{property:"gap",label:"Gap",kind:"length",glyph:"M1.5 1.5h3v9h-3zM7.5 1.5h3v9h-3z",max:200},{property:"margin",label:"Margin",kind:"length",glyph:"M4 4h4v4H4zM1 3V1h2m6 0h2v2m0 6v2H9m-6 0H1V9",max:200},{property:"border-radius",label:"Corner radius",kind:"length",glyph:"M1.5 10.5V6A4.5 4.5 0 0 1 6 1.5h4.5",max:96},{property:"display",label:"Layout",kind:"select",values:["block","flex","grid","inline-flex","inline-grid"]},{property:"font-family",label:"Font family",kind:"text",wide:!0,placeholder:"system-ui, sans-serif"},{property:"font-size",label:"Font size",kind:"length",glyph:"M2 3V1.5h8V3M6 1.5v9m-1.5 0h3",min:1,max:160},{property:"line-height",label:"Line height",kind:"text",glyph:"M1 1.5h10M1 10.5h10M3.5 8.5 6 3l2.5 5.5",placeholder:"1.4 or 24px"},{property:"font-weight",label:"Weight",kind:"select",values:["300","400","500","600","700","800"]},{property:"text-align",label:"Alignment",kind:"select",values:["left","center","right","justify"]},{property:"color",label:"Text color",kind:"color",wide:!0},{property:"background-color",label:"Fill",kind:"color",wide:!0},{property:"border-width",label:"Border width",kind:"length",glyph:"M1 2.5h10M1 6h10M1 9.5h10",max:24},{property:"border-style",label:"Border style",kind:"select",values:["none","solid","dashed","dotted"]},{property:"border-color",label:"Border color",kind:"color"}],n=import("./select-menu-IY5BJMFM.js").catch(()=>null),i=["font-family","font-size","line-height","font-weight","text-align","color"];function r(e){if(/^#[\da-f]{6}$/i.test(e))return e;if(/^#[\da-f]{3}$/i.test(e))return`#${[...e.slice(1)].map(e=>e+e).join("")}`;let t=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);return t?`#${t.slice(1,4).map(e=>Number(e).toString(16).padStart(2,"0")).join("")}`:"#000000"}function o(e){let t=e.match(/^rgba\(.*,\s*([\d.]+)\)$/)?.[1];return void 0===t?/^rgb\(/.test(e)?r(e):e||"transparent":Number(t)?e:"transparent"}function l(e,t){let n=getComputedStyle(t).getPropertyValue(e.property).trim();if("color"===e.kind)return o(n);if("length"===e.kind||"size"===e.kind){let t=n.match(/^(-?\d+(?:\.\d+)?)px$/);return t?String(Math.round(10*Number(t[1]))/10):"size"===e.kind?n||"auto":"0"}return n}function d(e,t){let{element:n}=t,i=document.createElement("div");i.className=`design-field design-field--${e.kind}`,i.dataset.fieldProperty=e.property,i.toggleAttribute("data-wide",!!e.wide);let o="select"===e.kind?document.createElement("select"):document.createElement("input");if(o instanceof HTMLSelectElement)for(let t of e.values??[]){let e=document.createElement("option");e.value=e.textContent=t,o.append(e)}else o.type="length"===e.kind?"number":"text",o.autocomplete="off",o.spellcheck=!1,o.placeholder=e.placeholder??"","length"===e.kind&&(o.min=String(e.min??0),o.max=String(e.max??1e3),o.setAttribute("inputmode","decimal"));if(o.dataset.property=e.property,o.setAttribute("aria-label",e.label),o.title=e.label,o.value=l(e,n),o instanceof HTMLSelectElement&&!o.value){let t=document.createElement("option");t.value=t.textContent=l(e,n),o.prepend(t),o.value=t.value}let d=()=>t.begin(o,e.property),a=()=>{t.apply(o,e.property,function(e,t){let n=t.value.trim();if("color"===e.kind){let e=document.createElement("span").style;return e.color=n,e.color?n:null}if("length"===e.kind){if(!n)return null;let t=Number(n);return!Number.isFinite(t)||t<(e.min??-200)||t>(e.max??1e3)?null:`${t}px`}return"size"===e.kind||"line-height"===e.property?/^(auto|normal|(?:\d+(?:\.\d+)?)(?:px|%|vw|vh|rem|em)?)$/.test(n)?"size"===e.kind&&/^[\d.]+$/.test(n)?`${n}px`:n:null:n}(e,o)),t.commit(o,e.property,!1)},p=()=>t.commit(o,e.property);if(o.addEventListener("focus",d),o.addEventListener("input",a),o.addEventListener("change",p),o.addEventListener("blur",p),"color"===e.kind){let t=document.createElement("input");t.type="color",t.setAttribute("aria-label",`${e.label} picker`);let n=()=>{t.value=r(o.value)};n(),t.addEventListener("pointerdown",d),t.addEventListener("focus",d),t.addEventListener("input",()=>{o.value=t.value,a()}),t.addEventListener("change",p),o.addEventListener("input",n),i.append(t)}if(e.glyph){let t=t=>{let i=o.value.trim().match(/^(-?\d*\.?\d+)([a-z%]*)$/i),r=i?i[2]:"text"===e.kind?"px":"",l=i?Number(i[1]):parseFloat(getComputedStyle(n).getPropertyValue(e.property))||0,d=Math.round(10*(l+t*("text"!==e.kind||r?1:.1)))/10;"text"!==e.kind&&(d=Math.min(e.max??1e4,Math.max(e.min??0,d))),o.value=`${d}${r}`,a()},r=document.createElement("span");r.className="design-field__glyph",r.setAttribute("aria-hidden","true"),r.title=`${e.label} · drag to adjust`,e.glyph.length>1?r.innerHTML=`<svg viewBox="0 0 12 12"><path d="${e.glyph}"/></svg>`:r.textContent=e.glyph,r.addEventListener("pointerdown",e=>{e.preventDefault(),d(),r.setPointerCapture?.(e.pointerId);let n=e.clientX,i=e=>{let i=Math.trunc((e.clientX-n)/2);i&&(n+=2*i,t(i*(e.shiftKey?10:1)))},o=()=>{r.removeEventListener("pointermove",i),p()};r.addEventListener("pointermove",i),r.addEventListener("pointerup",o,{once:!0}),r.addEventListener("pointercancel",o,{once:!0})}),o.addEventListener("keydown",e=>{"ArrowUp"!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),t(("ArrowUp"===e.key?1:-1)*(e.shiftKey?10:1)))}),i.append(r)}return o instanceof HTMLInputElement&&o.addEventListener("keydown",e=>{"Enter"===e.key&&o.blur()}),i.append(o),i}function a(e,n,i,r=[]){let o=document.createElement("section");o.className="design-section";let l=document.createElement("div");if(l.className="design-section__tools",l.append(...r),!i){let e=document.createElement("span");return e.className="design-section__title",e.textContent=n,o.append(e,l),o}let a=document.createElement("details");a.className="design-group",a.open=!e.collapsed.has(n);let p=document.createElement("summary");p.textContent=n;let s=document.createElement("div");s.className="design-grid";for(let n of i)s.append(d(t.find(e=>e.property===n),e));return a.append(p,s),a.addEventListener("toggle",()=>{a.isConnected&&(a.open?e.collapsed.delete(n):e.collapsed.add(n))}),o.append(l,a),o}function p(e,t){let{element:r,changed:l}=t;n.then(t=>t?.attach(e));let d=getComputedStyle(r),p=e=>e.some(e=>l?.has(e)),s=[...r.childNodes].some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())||/(?:^|;)\s*(?:color|font|line-height|text-align)/.test(r.getAttribute("style")??"")||p(i),c=/flex|grid/.test(d.display)||p(["gap"]),g="transparent"!==o(d.backgroundColor)||p(["background-color"]),u=["top","right","bottom","left"].some(e=>parseFloat(d.getPropertyValue(`border-${e}-width`))>0&&"none"!==d.getPropertyValue(`border-${e}-style`))||p(["border","border-width","border-style","border-color"]),f=(n,i,r,o)=>function(e,t,n){let i=document.createElement("button");return i.type="button",i.title=e,i.setAttribute("aria-label",e),i.textContent=t,i.addEventListener("click",n),i}(`Add ${n}`,"+",()=>{let n=document.createElement("input");t.begin(n,i),t.apply(n,i,r),t.commit(n,i),t.rerender(),e.querySelector(`[data-property="${o}"]`)?.focus()});e.append(a(t,"Layout",["width","height","padding",...c?["gap"]:[],"margin",...u?[]:["border-radius"],"display"])),s&&e.append(a(t,"Typography",i,[t.editText])),e.append(g?a(t,"Fill",["background-color"]):a(t,"Fill",null,[f("fill","background-color","#ffffff","background-color")]),u?a(t,"Border",["border-width","border-radius","border-style","border-color"]):a(t,"Border",null,[f("border","border","1px solid","border-width")]))}export{e as designPanelStyles,d as fieldControl,t as fields,p as renderPanel,r as toHex,l as valueFor};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Box = {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
right: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
};
|
|
7
|
+
/** Paint the full border shape before clipping, so cropped edges do not gain corners. */
|
|
8
|
+
export declare function drawHighlight(node: HTMLElement, rect: Box, element: Element | null, bounds?: Box): boolean;
|
|
9
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as s}from"./chunk-
|
|
1
|
+
import{b as o,c as s}from"./chunk-65SLG7FY.js";import"./chunk-URGMAMH5.js";import"./chunk-DH22G2S5.js";import"./chunk-53M6AOAX.js";import"./chunk-WGISPOJV.js";import"./chunk-ANKCS6NI.js";export{s as initComments,o as initKomo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="script,style,svg,input,textarea,select,[data-private],[data-sensitive]";function t(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(;t.nextNode();)n.push(t.currentNode);return n}function n(e,t,n){if(n&&e.childElementCount)for(let[e,t]of n)e.data=t;else e.textContent=t}function a(){let e=new Map,t=new Map,a=[],r=new Map;return{record(n){!n.reactProp&&n.before!==n.after&&(e.has(n.element)||(e.set(n.element,n.before),t.set(n.element,n.nodes)),a.push(n))},remember(t,n){e.has(t)||e.set(t,n)},original:t=>e.get(t),reconcile(t,n){e.get(t)===n&&e.delete(t)},reset(r){let o=e.get(r);void 0!==o&&n(r,o,t.get(r)),e.delete(r);for(let e=a.length-1;e>=0;e--)a[e].element===r&&a.splice(e,1)},proposal(t){let n=e.get(t),a=t.textContent??"";return void 0!==n&&n!==a?`Proposed inline text change (preview only)\n- Text: ${JSON.stringify(n)} → ${JSON.stringify(a)}\n- Source markup is unchanged; refresh resets this preview.`:void 0},restoreAll(){for(let[a,r]of e)n(a,r,t.get(a));e.clear(),a.length=0},showBefore(a){if(a)for(let[a,o]of e){let e=t.get(a);r.set(a,[a.textContent??"",e?.map(([e])=>[e,e.data])]),n(a,o,e)}else for(let[e,[t,a]]of r)n(e,t,a);a||r.clear()},undo(){let t=a.pop();return t?(n(t.element,t.before,t.nodes),e.get(t.element)===t.before&&e.delete(t.element),t.element):null}}}function r(e){let t=a(),n=null,r=!1;function o(t=!1){let a=n;a&&(n=null,a.finish(t),e.onChange())}return{get element(){return n?.element??null},get busy(){return r},isEditing:e=>!!n&&n.element===e,toggle:async function(a){let l=e.selected();if(n&&n.element===l)return void o();if(!l||!e.active()||r||n)return;let s=i(l);if(s)e.status.textContent=s;else{r=!0,e.status.textContent="Loading inline text editor…",e.onChange();try{let r=await d(l,{loadReactBridge:async()=>await import("./react-props-panel-NC7KLZ73.js"),onFinish(n,a){a||n.reactProp||n.before===n.after?n.reactProp&&(e.status.textContent="React state preview · resets on exit"):(t.record(n),e.onCommit(l),e.status.textContent="Text preview · resets on exit")}});r?e.active()&&e.selected()===l?(n=r,a&&function(e,t,n){let a=document.caretPositionFromPoint?.(t,n),r=a?document.createRange():document.caretRangeFromPoint?.(t,n);if(a&&r&&r.setStart(a.offsetNode,a.offset),!r||!e.contains(r.startContainer))return;r.collapse(!0);let o=document.getSelection();o?.removeAllRanges(),o?.addRange(r)}(l,a.clientX,a.clientY),e.status.textContent=l.hasAttribute("data-komo-text-prop")?"React state preview · resets on exit":"Editing text · preview only"):r.finish(!0):e.status.textContent="This text couldn't be connected to its component prop."}catch{e.status.textContent="Inline text editing is unavailable."}finally{r=!1,e.onChange()}}},finish:o,handleKey(e){if(!n||!e.composedPath().includes(n.element)||!n.handleKey(e))return!1;let t=n.element;return o("Escape"===e.key),t.blur(),!0},hasChanges:e=>void 0!==t.original(e),undo(){let n=t.undo();return e.onChange(),n},reset(n){t.reset(n),e.onChange()},reconcile(n,a){t.reconcile(n,a),e.onChange()},proposal:e=>t.proposal(e),restoreAll(){t.restoreAll()},showBefore:t.showBefore}}function o(e){let t=r(e);return e.button.addEventListener("click",e=>{t.toggle(e)}),t}function i(n){return n.matches("input,textarea,select")?"Form fields can't be edited as text.":n.matches("script,style,svg,canvas,video,audio,iframe")?"Graphics, media, and frames can't be edited.":n.closest("[data-private],[data-sensitive]")?"This text is marked private, so it stays read-only.":n.closest("[contenteditable]")?"This text is already editable on the page.":t(n).some(t=>t.data.trim()&&!t.parentElement?.closest(e))?null:"No text here. Double-click the text itself."}function l(e){return!i(e)}function s(e){let t=e.textContent??"",n=document.getSelection(),a=n?.rangeCount?n.getRangeAt(0):null;return a&&e.contains(a.commonAncestorContainer)?a.startContainer===e?Math.min([...e.childNodes].slice(0,a.startOffset).reduce((e,t)=>e+(t.textContent?.length??0),0),t.length):a.startContainer.nodeType===Node.TEXT_NODE?Math.min(a.startOffset,t.length):t.length:-1}function c(e,t){let n=e.firstChild,a=document.getSelection();if(!n||!a)return;let r=document.createRange();r.setStart(n,Math.min(t,n.textContent?.length??0)),r.collapse(!0),a.removeAllRanges(),a.addRange(r)}async function d(a,r){if(!l(a))return null;let o=null,i=null;if(a.dataset.komoTextProp&&(o=await r.loadReactBridge(),i=o.beginReactTextEdit(a),!i))return null;let d=i?.before??(a.textContent??"").slice(0,500),u=!i&&a.childElementCount>0,g=u?t(a).map(e=>[e,e.data]):void 0,p=a.getAttribute("role"),f=a.getAttribute("aria-label"),m=a.getAttribute("aria-multiline"),h=a.getAttribute("spellcheck"),x=new AbortController,C=!1;let v=-1,b=new MutationObserver(()=>{v>=0&&c(a,v)}),T=()=>{u||(a.childElementCount&&(a.textContent=a.textContent??""),(a.textContent??"").length>500&&(a.textContent=(a.textContent??"").slice(0,500)),i&&o&&(v=s(a),o.previewReactTextEdit(a,i.propName,a.textContent??"")||(a.textContent=d)))},E=(t,n)=>{let r=t.startContainer;if(r!==t.endContainer||!(r instanceof Text)||!a.contains(r)||r.parentElement?.closest(e))return;let o=t.endOffset-t.startOffset,i=n.replace(/[\r\n]+/g," ").slice(0,Math.max(0,500-(a.textContent??"").length+o));r.replaceData(t.startOffset,o,i);let l=document.createRange();l.setStart(r,t.startOffset+i.length);let s=document.getSelection();s?.removeAllRanges(),s?.addRange(l)};a.addEventListener("beforeinput",e=>{if(v=-1,!u||"insertCompositionText"===e.inputType)return;e.preventDefault();let t=e.getTargetRanges()[0],n=e.inputType;t&&(n.startsWith("delete")||"insertText"===n||"insertReplacementText"===n)&&E(t,n.startsWith("delete")?"":e.data??e.dataTransfer?.getData("text/plain")??"")},{signal:x.signal}),a.addEventListener("input",T,{signal:x.signal}),i&&b.observe(a,{childList:!0,characterData:!0,subtree:!0}),a.addEventListener("paste",e=>{e.preventDefault();let t=e.clipboardData?.getData("text/plain")??"",n=document.getSelection();u?n?.rangeCount&&E(n.getRangeAt(0),t):(function(e,t){let n=s(e);if(n<0)return;let a=e.textContent??"",r=t.slice(0,Math.max(0,500-a.length));e.textContent=a.slice(0,n)+r+a.slice(n),c(e,n+r.length)}(a,t.replace(/[\r\n]+/g," ").slice(0,500)),T())},{signal:x.signal}),a.addEventListener("drop",e=>e.preventDefault(),{signal:x.signal}),a.setAttribute("contenteditable","true"),a.setAttribute("role","textbox"),a.setAttribute("aria-label","Inline text preview"),a.setAttribute("aria-multiline","false"),a.dataset.komoInlineEditing="true",a.spellcheck=!1,a.focus({preventScroll:!0});let y=document.getSelection(),R=document.createRange();return R.selectNodeContents(a),R.collapse(!1),y?.removeAllRanges(),y?.addRange(R),{element:a,finish(e=!1){if(C)return;C=!0,x.abort(),b.disconnect(),!u&&a.childElementCount&&(a.textContent=a.textContent??"");let t=(a.textContent??"").slice(0,500);(function(){a.removeAttribute("contenteditable"),a.removeAttribute("data-komo-inline-editing");for(let[e,t]of[["role",p],["aria-label",f],["aria-multiline",m],["spellcheck",h]])null===t?a.removeAttribute(e):a.setAttribute(e,t)})(),e?(i&&o&&o.cancelReactTextEdit(a,i.propName,d),n(a,d,g)):i&&o&&o.finishReactTextEdit(a,i.propName,d,t),r.onFinish({element:a,before:d,after:t,nodes:g,...i?{reactProp:i.propName}:{}},e)},handleKey:e=>!e.isComposing&&(("Enter"===e.key||"Escape"===e.key)&&(e.preventDefault(),e.stopImmediatePropagation(),!0))}}export{o as bindInlineTextTools,l as canEditText,r as createInlineTextTools,a as createTextPreviewHistory,d as startInlineTextEditor,i as textEditBlocker};
|