@uicopilot/storybook-addon 0.18.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/manager.mjs +4 -4
  2. package/package.json +1 -1
package/dist/manager.mjs CHANGED
@@ -9,7 +9,7 @@ var PD=Object.create;var Mp=Object.defineProperty;var LD=Object.getOwnPropertyDe
9
9
  value: `+(i||"<empty string>")+`
10
10
  --------`+new Array(o.mismatchOffset+1).join("-")+"^",Object.assign(o,l),o.loc={source:r&&r.loc&&r.loc.source||"<unknown>",start:l,end:u},o}});function ud(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===ld&&e.charCodeAt(t+1)===ld}function CC(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===ld&&e.charCodeAt(t+1)!==ld){let r=e.indexOf("-",t+2);if(r!==-1)return e.substring(t,r+1)}return""}function nO(e){if(sd.has(e))return sd.get(e);let t=e.toLowerCase(),r=sd.get(t);if(r===void 0){let n=ud(t,0),o=n?"":CC(t,0);r=Object.freeze({basename:t.substr(o.length),name:t,prefix:o,vendor:o,custom:n})}return sd.set(e,r),r}function oO(e){if(Zs.has(e))return Zs.get(e);let t=e,r=e[0];r==="/"?r=e[1]==="/"?"//":"/":r!=="_"&&r!=="*"&&r!=="$"&&r!=="#"&&r!=="+"&&r!=="&"&&(r="");let n=ud(t,r.length);if(!n&&(t=t.toLowerCase(),Zs.has(t))){let s=Zs.get(t);return Zs.set(e,s),s}let o=n?"":CC(t,r.length),i=t.substr(0,r.length+o.length),a=Object.freeze({basename:t.substr(i.length),name:t.substr(r.length),hack:r,vendor:o,prefix:i,custom:n});return Zs.set(e,a),a}var sd,Zs,ld,cd,P0,pd=H(()=>{"use strict";sd=new Map,Zs=new Map,ld=45,cd=nO,P0=oO});var el,dd=H(()=>{"use strict";el=["initial","inherit","unset","revert","revert-layer"]});function B0(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function Tc(e,t,r){for(;e!==null&&(e.type===13||e.type===25);)e=r(++t);return t}function pa(e,t,r,n){if(!e)return 0;let o=e.value.charCodeAt(t);if(o===Ic||o===ri){if(r)return 0;t++}for(;t<e.value.length;t++)if(!wr(e.value.charCodeAt(t)))return 0;return n+1}function _0(e,t,r){let n=!1,o=Tc(e,t,r);if(e=r(o),e===null)return t;if(e.type!==10)if(B0(e,Ic)||B0(e,ri)){if(n=!0,o=Tc(r(++o),o,r),e=r(o),e===null||e.type!==10)return 0}else return t;if(!n){let i=e.value.charCodeAt(0);if(i!==Ic&&i!==ri)return 0}return pa(e,n?0:1,n,o)}function z0(e,t){let r=0;if(!e)return 0;if(e.type===10)return pa(e,0,aO,r);if(e.type===1&&e.value.charCodeAt(0)===ri){if(!Mi(e.value,1,L0))return 0;switch(e.value.length){case 2:return _0(t(++r),r,t);case 3:return e.value.charCodeAt(2)!==ri?0:(r=Tc(t(++r),r,t),e=t(r),pa(e,0,tl,r));default:return e.value.charCodeAt(2)!==ri?0:pa(e,3,tl,r)}}else if(e.type===1||B0(e,Ic)&&t(r+1).type===1){if(e.type!==1&&(e=t(++r)),e===null||!Mi(e.value,0,L0))return 0;switch(e.value.length){case 1:return _0(t(++r),r,t);case 2:return e.value.charCodeAt(1)!==ri?0:(r=Tc(t(++r),r,t),e=t(r),pa(e,0,tl,r));default:return e.value.charCodeAt(1)!==ri?0:pa(e,2,tl,r)}}else if(e.type===12){let n=e.value.charCodeAt(0),o=n===Ic||n===ri?1:0,i=o;for(;i<e.value.length&&wr(e.value.charCodeAt(i));i++);return i===o||!Mi(e.value,i,L0)?0:i+1===e.value.length?_0(t(++r),r,t):e.value.charCodeAt(i+1)!==ri?0:i+2===e.value.length?(r=Tc(t(++r),r,t),e=t(r),pa(e,0,tl,r)):pa(e,i+2,tl,r)}return 0}var Ic,ri,L0,tl,aO,EC=H(()=>{"use strict";so();Ic=43,ri=45,L0=110,tl=!0,aO=!1});function D0(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function cO(e,t){return e.value.charCodeAt(0)===t}function Rc(e,t,r){let n=0;for(let o=t;o<e.value.length;o++){let i=e.value.charCodeAt(o);if(i===TC&&r&&n!==0)return Rc(e,t+n+1,!1),6;if(!Fn(i)||++n>6)return 0}return n}function fd(e,t,r){if(!e)return 0;for(;D0(r(t),IC);){if(++e>6)return 0;t++}return t}function N0(e,t){let r=0;if(e===null||e.type!==1||!Mi(e.value,0,lO)||(e=t(++r),e===null))return 0;if(D0(e,sO))return e=t(++r),e===null?0:e.type===1?fd(Rc(e,0,!0),++r,t):D0(e,IC)?fd(1,++r,t):0;if(e.type===10){let n=Rc(e,1,!0);return n===0?0:(e=t(++r),e===null?r:e.type===12||e.type===10?!cO(e,TC)||!Rc(e,1,!1)?0:r+1:fd(n,r,t))}return e.type===12?fd(Rc(e,1,!0),++r,t):0}var sO,TC,IC,lO,RC=H(()=>{"use strict";so();sO=43,TC=45,IC=63,lO=117});function Mo(e,t){return t<e.length?e.charCodeAt(t):0}function FC(e,t){return Pi(e,0,e.length,t)}function MC(e,t){for(let r=0;r<t.length;r++)if(FC(e,t[r]))return!0;return!1}function PC(e,t){return t!==e.length-2?!1:Mo(e,t)===92&&wr(Mo(e,t+1))}function gd(e,t,r){if(e&&e.type==="Range"){let n=Number(r!==void 0&&r!==t.length?t.substr(0,r):t);if(isNaN(n)||e.min!==null&&n<e.min&&typeof e.min!="string"||e.max!==null&&n>e.max&&typeof e.max!="string")return!0}return!1}function gO(e,t){let r=0,n=[],o=0;e:do{switch(e.type){case 24:case 22:case 20:if(e.type!==r)break e;if(r=n.pop(),n.length===0){o++;break e}break;case 2:case 21:case 19:case 23:n.push(r),r=V0.get(e.type);break}o++}while(e=t(o));return o}function co(e,t){return function(r,n,o){return r===null?0:r.type===2&&MC(r.value,t)?gO(r,n):e(r,n,o)}}function ar(e){return function(t){return t===null||t.type!==e?0:1}}function mO(e){if(e===null||e.type!==1)return 0;let t=e.value.toLowerCase();return MC(t,el)||FC(t,"default")?0:1}function LC(e){return e===null||e.type!==1||Mo(e.value,0)!==45||Mo(e.value,1)!==45?0:1}function hO(e){return!LC(e)||e.value==="--"?0:1}function xO(e){if(e===null||e.type!==4)return 0;let t=e.value.length;if(t!==4&&t!==5&&t!==7&&t!==9)return 0;for(let r=1;r<t;r++)if(!Fn(Mo(e.value,r)))return 0;return 1}function yO(e){return e===null||e.type!==4||!Vs(Mo(e.value,1),Mo(e.value,2),Mo(e.value,3))?0:1}function bO(e,t){if(!e)return 0;let r=0,n=[],o=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==r)break e;r=n.pop();break;case 17:if(r===0)break e;break;case 9:if(r===0&&e.value==="!")break e;break;case 2:case 21:case 19:case 23:n.push(r),r=V0.get(e.type);break}o++}while(e=t(o));return o}function wO(e,t){if(!e)return 0;let r=0,n=[],o=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==r)break e;r=n.pop();break;case 2:case 21:case 19:case 23:n.push(r),r=V0.get(e.type);break}o++}while(e=t(o));return o}function Di(e){return e&&(e=new Set(e)),function(t,r,n){if(t===null||t.type!==12)return 0;let o=Ga(t.value,0);if(e!==null){let i=t.value.indexOf("\\",o),a=i===-1||!PC(t.value,i)?t.value.substr(o):t.value.substring(o,i);if(e.has(a.toLowerCase())===!1)return 0}return gd(n,t.value,o)?0:1}}function vO(e,t,r){return e===null||e.type!==11||gd(r,e.value,e.value.length-1)?0:1}function _C(e){return typeof e!="function"&&(e=function(){return 0}),function(t,r,n){return t!==null&&t.type===10&&Number(t.value)===0?1:e(t,r,n)}}function SO(e,t,r){if(e===null)return 0;let n=Ga(e.value,0);return!(n===e.value.length)&&!PC(e.value,n)||gd(r,e.value,n)?0:1}function kO(e,t,r){if(e===null||e.type!==10)return 0;let n=Mo(e.value,0)===43||Mo(e.value,0)===45?1:0;for(;n<e.value.length;n++)if(!wr(Mo(e.value,n)))return 0;return gd(r,e.value,n)?0:1}function IO(e){let{angle:t,decibel:r,frequency:n,flex:o,length:i,resolution:a,semitones:s,time:l}=e||{};return{dimension:co(Di(null),zi),angle:co(Di(t),zi),decibel:co(Di(r),zi),frequency:co(Di(n),zi),flex:co(Di(o),zi),length:co(_C(Di(i)),zi),resolution:co(Di(a),zi),semitones:co(Di(s),zi),time:co(Di(l),zi)}}function RO(e){let t=new Set;for(let r of TO)if(Array.isArray(e[r]))for(let n of e[r])t.add(n.toLowerCase());return function(n){return n===null?0:n.type===9&&n.value==="%"||n.type===1&&t.has(n.value.toLowerCase())?1:0}}function BC(e){return{...CO,...EO,...IO(e),"attr-unit":RO(e)}}var O0,$0,H0,uO,pO,dO,U0,j0,AC,fO,zi,V0,CO,EO,TO,zC=H(()=>{"use strict";dd();EC();RC();so();O0=["calc(","-moz-calc(","-webkit-calc("],$0=["min(","max(","clamp("],H0=["round(","mod(","rem("],uO=["sin(","cos(","tan("],pO=["asin(","acos(","atan(","atan2("],dO=["pow(","sqrt(","log(","exp(","sign("],U0=["hypot("],j0=["abs("],AC=[...O0,...$0,...H0,...uO,...dO,...U0,...j0],fO=[...O0,...$0,...H0,...U0,...j0],zi=[...O0,...$0,...H0,...pO,...U0,...j0],V0=new Map([[2,22],[21,22],[19,20],[23,24]]);CO={"ident-token":ar(1),"function-token":ar(2),"at-keyword-token":ar(3),"hash-token":ar(4),"string-token":ar(5),"bad-string-token":ar(6),"url-token":ar(7),"bad-url-token":ar(8),"delim-token":ar(9),"number-token":ar(10),"percentage-token":ar(11),"dimension-token":ar(12),"whitespace-token":ar(13),"CDO-token":ar(14),"CDC-token":ar(15),"colon-token":ar(16),"semicolon-token":ar(17),"comma-token":ar(18),"[-token":ar(19),"]-token":ar(20),"(-token":ar(21),")-token":ar(22),"{-token":ar(23),"}-token":ar(24)},EO={string:ar(5),ident:ar(1),percentage:co(vO,fO),zero:_C(),number:co(SO,AC),integer:co(kO,AC),"custom-ident":mO,"dashed-ident":LC,"custom-property-name":hO,"hex-color":xO,"id-selector":yO,"an-plus-b":z0,urange:N0,"declaration-value":bO,"any-value":wO},TO=["length","angle","time","frequency","resolution","flex","decibel","semitones"]});var md={};Le(md,{angle:()=>FO,decibel:()=>BO,flex:()=>_O,frequency:()=>PO,length:()=>AO,resolution:()=>LO,semitones:()=>zO,time:()=>MO});var AO,FO,MO,PO,LO,_O,BO,zO,DC=H(()=>{"use strict";AO=["cm","mm","q","in","pt","pc","px","em","rem","ex","rex","cap","rcap","ch","rch","ic","ric","lh","rlh","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],FO=["deg","grad","rad","turn"],MO=["s","ms"],PO=["hz","khz"],LO=["dpi","dpcm","dppx","x"],_O=["fr"],BO=["db"],zO=["st"]});function NC(e,t,r){return Object.assign(Ya("SyntaxError",e),{input:t,offset:r,rawMessage:e,message:e+`
11
11
  `+t+`
12
- --`+new Array((r||t.length)+1).join("-")+"^"})}var OC=H(()=>{"use strict";ed()});var DO,NO,OO,$O,HO,$C,hd,HC=H(()=>{"use strict";OC();DO=9,NO=10,OO=12,$O=13,HO=32,$C=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),hd=class{constructor(t){this.str=t,this.pos=0}charCodeAt(t){return t<this.str.length?this.str.charCodeAt(t):0}charCode(){return this.charCodeAt(this.pos)}isNameCharCode(t=this.charCode()){return t<128&&$C[t]===1}nextCharCode(){return this.charCodeAt(this.pos+1)}nextNonWsCode(t){return this.charCodeAt(this.findWsEnd(t))}skipWs(){this.pos=this.findWsEnd(this.pos)}findWsEnd(t){for(;t<this.str.length;t++){let r=this.str.charCodeAt(t);if(r!==$O&&r!==NO&&r!==OO&&r!==HO&&r!==DO)break}return t}substringToPos(t){return this.str.substring(this.pos,this.pos=t)}eat(t){this.charCode()!==t&&this.error("Expect `"+String.fromCharCode(t)+"`"),this.pos++}peek(){return this.pos<this.str.length?this.str.charAt(this.pos++):""}error(t){throw new NC(t,this.str,this.pos)}scanSpaces(){return this.substringToPos(this.findWsEnd(this.pos))}scanWord(){let t=this.pos;for(;t<this.str.length;t++){let r=this.str.charCodeAt(t);if(r>=128||$C[r]===0)break}return this.pos===t&&this.error("Expect a keyword"),this.substringToPos(t)}scanNumber(){let t=this.pos;for(;t<this.str.length;t++){let r=this.str.charCodeAt(t);if(r<48||r>57)break}return this.pos===t&&this.error("Expect a number"),this.substringToPos(t)}scanString(){let t=this.str.indexOf("'",this.pos+1);return t===-1&&(this.pos=this.str.length,this.error("Expect an apostrophe")),this.substringToPos(t+1)}}});function qC(e){let t=null,r=null;return e.eat(bd),e.skipWs(),t=e.scanNumber(e),e.skipWs(),e.charCode()===X0?(e.pos++,e.skipWs(),e.charCode()!==q0&&(r=e.scanNumber(e),e.skipWs())):r=t,e.eat(q0),{min:Number(t),max:r?Number(r):0}}function YO(e){let t=null,r=!1;switch(e.charCode()){case JC:e.pos++,t={min:0,max:0};break;case K0:e.pos++,t={min:1,max:0};break;case yd:e.pos++,t={min:0,max:1};break;case Y0:e.pos++,r=!0,e.charCode()===bd?t=qC(e):e.charCode()===yd?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case bd:t=qC(e);break;default:return null}return{type:"Multiplier",comma:r,min:t.min,max:t.max,term:null}}function Ni(e,t){let r=YO(e);return r!==null?(r.term=t,e.charCode()===Y0&&e.charCodeAt(e.pos-1)===K0||e.charCode()===yd&&e.charCodeAt(e.pos-1)===q0?Ni(e,r):r):t}function W0(e){let t=e.peek();return t===""?null:Ni(e,{type:"Token",value:t})}function KO(e){let t;return e.eat(J0),e.eat(xd),t=e.scanWord(),e.eat(xd),e.eat(G0),Ni(e,{type:"Property",name:t})}function XO(e){let t=null,r=null,n=1;return e.eat(Ac),e.charCode()===jC&&(e.peek(),n=-1),n==-1&&e.charCode()===WC?e.peek():(t=n*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(X0),e.skipWs(),e.charCode()===WC?e.peek():(n=1,e.charCode()===jC&&(e.peek(),n=-1),r=n*Number(e.scanNumber(e)),e.isNameCharCode()&&(r+=e.scanWord())),e.eat(rl),{type:"Range",min:t,max:r}}function JO(e){let t,r=null;if(e.eat(J0),t=e.scanWord(),t==="boolean-expr"){e.eat(Ac);let n=wd(e,rl);return e.eat(rl),e.eat(G0),Ni(e,{type:"Boolean",term:n.terms.length===1?n.terms[0]:n})}return e.charCode()===KC&&e.nextCharCode()===XC&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===Ac&&(e.skipWs(),r=XO(e)),e.eat(G0),Ni(e,{type:"Type",name:t,opts:r})}function QO(e){let t=e.scanWord();return e.charCode()===KC?(e.pos++,{type:"Function",name:t}):Ni(e,{type:"Keyword",name:t})}function ZO(e,t){function r(o,i){return{type:"Group",terms:o,combinator:i,disallowEmpty:!1,explicit:!1}}let n;for(t=Object.keys(t).sort((o,i)=>GC[o]-GC[i]);t.length>0;){n=t.shift();let o=0,i=0;for(;o<e.length;o++){let a=e[o];a.type==="Combinator"&&(a.value===n?(i===-1&&(i=o-1),e.splice(o,1),o--):(i!==-1&&o-i>1&&(e.splice(i,o-i,r(e.slice(i,o),n)),o=i+1),i=-1))}i!==-1&&t.length&&e.splice(i,o-i,r(e.slice(i,o),n))}return n}function wd(e,t=-1){let r=Object.create(null),n=[],o=null,i=e.pos,a=!1;for(;e.charCode()!==t;){let s=a?wd(e,XC):t$(e);if(!s)break;if(s.type!=="Spaces"){if(a){if(s.terms.length===0){a=!1;continue}if(s.combinator===" "){for(;s.terms.length>1;)r[" "]=!0,n.push({type:"Combinator",value:" "},s.terms.shift());s=s.terms[0]}}s.type==="Combinator"?((o===null||o.type==="Combinator")&&(e.pos=i,e.error("Unexpected combinator")),r[s.value]=!0):o!==null&&o.type!=="Combinator"&&(r[" "]=!0,n.push({type:"Combinator",value:" "})),n.push(s),o=s,i=e.pos,a=s.type==="Function"}}return o!==null&&o.type==="Combinator"&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:n,combinator:ZO(n,r)||" ",disallowEmpty:!1,explicit:!1}}function e$(e){let t;return e.eat(Ac),t=wd(e,rl),e.eat(rl),t.explicit=!0,e.charCode()===YC&&(e.pos++,t.disallowEmpty=!0),t}function t$(e){let t=e.charCode();switch(t){case rl:break;case Ac:return Ni(e,e$(e));case J0:return e.nextCharCode()===xd?KO(e):JO(e);case VC:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===VC?2:1))};case UC:return e.pos++,e.eat(UC),{type:"Combinator",value:"&&"};case X0:return e.pos++,{type:"Comma"};case xd:return Ni(e,{type:"String",value:e.scanString()});case GO:case UO:case jO:case WO:case VO:return{type:"Spaces",value:e.scanSpaces()};case qO:return t=e.nextCharCode(),e.isNameCharCode(t)?(e.pos++,{type:"AtKeyword",name:e.scanWord()}):W0(e);case JC:case K0:case yd:case Y0:case YC:break;case bd:if(t=e.nextCharCode(),t<48||t>57)return W0(e);break;default:return e.isNameCharCode(t)?QO(e):W0(e)}}function Fc(e){let t=new hd(e),r=wd(t);return t.pos!==e.length&&t.error("Unexpected input"),r.terms.length===1&&r.terms[0].type==="Group"?r.terms[0]:r}var UO,jO,VO,WO,GO,YC,Y0,UC,xd,KC,XC,JC,K0,X0,jC,J0,G0,yd,qO,Ac,rl,bd,VC,q0,WC,GC,Q0=H(()=>{"use strict";HC();UO=9,jO=10,VO=12,WO=13,GO=32,YC=33,Y0=35,UC=38,xd=39,KC=40,XC=41,JC=42,K0=43,X0=44,jC=45,J0=60,G0=62,yd=63,qO=64,Ac=91,rl=93,bd=123,VC=124,q0=125,WC=8734,GC={" ":1,"&&":2,"||":3,"|":4}});function QC(e){return typeof e=="function"?e:Mc}function Z0(e,t,r){function n(a){switch(o.call(r,a),a.type){case"Group":a.terms.forEach(n);break;case"Multiplier":case"Boolean":n(a.term);break;case"Type":case"Property":case"Keyword":case"AtKeyword":case"Function":case"String":case"Token":case"Comma":break;default:throw new Error("Unknown type: "+a.type)}i.call(r,a)}let o=Mc,i=Mc;if(typeof t=="function"?o=t:t&&(o=QC(t.enter),i=QC(t.leave)),o===Mc&&i===Mc)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");n(e,r)}var Mc,ZC=H(()=>{"use strict";Mc=function(){}});var eh=H(()=>{"use strict";M0();Q0();ZC()});function o$(e){let t=[];return ua(e,(r,n,o)=>t.push({type:r,value:e.slice(n,o),node:null})),t}function e4(e,t){return typeof e=="string"?o$(e):t.generate(e,n$)}var n$,t4=H(()=>{"use strict";so();n$={decorator(e){let t=[],r=null;return{...e,node(n){let o=r;r=n,e.node.call(this,n),r=o},emit(n,o,i){t.push({type:o,value:n,node:i?null:r})},result(){return t}}}}});function cn(e,t,r){return t===Bt&&r===Yt||e===Bt&&t===Bt&&r===Bt?e:(e.type==="If"&&e.else===Yt&&t===Bt&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:r})}function n4(e){return e.length>2&&e.charCodeAt(e.length-2)===i$&&e.charCodeAt(e.length-1)===a$}function r4(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&n4(e.name)}function da(e,t=" ",r=!1){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:r}}function Pc(e,t,r=new Set){if(!r.has(e))switch(r.add(e),e.type){case"If":e.match=Pc(e.match,t,r),e.then=Pc(e.then,t,r),e.else=Pc(e.else,t,r);break;case"Type":return t[e.name]||e}return e}function th(e,t,r){switch(e){case" ":{let n=Bt;for(let o=t.length-1;o>=0;o--){let i=t[o];n=cn(i,n,Yt)}return n}case"|":{let n=Yt,o=null;for(let i=t.length-1;i>=0;i--){let a=t[i];if(r4(a)&&(o===null&&i>0&&r4(t[i-1])&&(o=Object.create(null),n=cn({type:"Enum",map:o},Bt,n)),o!==null)){let s=(n4(a.name)?a.name.slice(0,-1):a.name).toLowerCase();if(!(s in o)){o[s]=a;continue}}o=null,n=cn(a,Bt,n)}return n}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let n=Yt;for(let o=t.length-1;o>=0;o--){let i=t[o],a;t.length>1?a=th(e,t.filter(function(s){return s!==i}),!1):a=Bt,n=cn(i,a,n)}return n}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let n=r?Bt:Yt;for(let o=t.length-1;o>=0;o--){let i=t[o],a;t.length>1?a=th(e,t.filter(function(s){return s!==i}),!0):a=Bt,n=cn(i,a,n)}return n}}}function s$(e){let t=Bt,r=nl(e.term);if(e.max===0)r=cn(r,vd,Yt),t=cn(r,null,Yt),t.then=cn(Bt,Bt,t),e.comma&&(t.then.else=cn({type:"Comma",syntax:e},t,Yt));else for(let n=e.min||1;n<=e.max;n++)e.comma&&t!==Bt&&(t=cn({type:"Comma",syntax:e},t,Yt)),t=cn(r,cn(Bt,Bt,t),Yt);if(e.min===0)t=cn(Bt,Bt,t);else for(let n=0;n<e.min-1;n++)e.comma&&t!==Bt&&(t=cn({type:"Comma",syntax:e},t,Yt)),t=cn(r,t,Yt);return t}function nl(e){if(typeof e=="function")return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=th(e.combinator,e.terms.map(nl),!1);return e.disallowEmpty&&(t=cn(t,vd,Yt)),t}case"Multiplier":return s$(e);case"Boolean":{let t=nl(e.term),r=nl(da([da([{type:"Keyword",name:"not"},{type:"Type",name:"!boolean-group"}]),da([{type:"Type",name:"!boolean-group"},da([{type:"Multiplier",comma:!1,min:0,max:0,term:da([{type:"Keyword",name:"and"},{type:"Type",name:"!boolean-group"}])},{type:"Multiplier",comma:!1,min:0,max:0,term:da([{type:"Keyword",name:"or"},{type:"Type",name:"!boolean-group"}])}],"|")])],"|")),n=nl(da([{type:"Type",name:"!term"},da([{type:"Token",value:"("},{type:"Type",name:"!self"},{type:"Token",value:")"}]),{type:"Type",name:"general-enclosed"}],"|"));return Pc(n,{"!term":t,"!self":r}),Pc(r,{"!boolean-group":n}),r}case"Type":case"Property":return{type:e.type,name:e.name,syntax:e};case"Keyword":return{type:e.type,name:e.name.toLowerCase(),syntax:e};case"AtKeyword":return{type:e.type,name:"@"+e.name.toLowerCase(),syntax:e};case"Function":return{type:e.type,name:e.name.toLowerCase()+"(",syntax:e};case"String":return e.value.length===3?{type:"Token",value:e.value.charAt(1),syntax:e}:{type:e.type,value:e.value.substr(1,e.value.length-2).replace(/\\'/g,"'"),syntax:e};case"Token":return{type:e.type,value:e.value,syntax:e};case"Comma":return{type:e.type,syntax:e};default:throw new Error("Unknown node type:",e.type)}}function Lc(e,t){return typeof e=="string"&&(e=Fc(e)),{type:"MatchGraph",match:nl(e),syntax:t||null,source:e}}var Bt,Yt,vd,i$,a$,rh=H(()=>{"use strict";Q0();Bt={type:"Match"},Yt={type:"Mismatch"},vd={type:"DisallowEmpty"},i$=40,a$=41});function f$(e){let t=null,r=null,n=e;for(;n!==null;)r=n.prev,n.prev=t,t=n,n=r;return t}function nh(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=t.charCodeAt(r),o=e.charCodeAt(r);if(o>=65&&o<=90&&(o=o|32),o!==n)return!1}return!0}function g$(e){return e.type!==9?!1:e.value!=="?"}function s4(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||g$(e)}function l4(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value==="/"}function m$(e,t,r){function n(){do h++,S=h<e.length?e[h]:null;while(S!==null&&(S.type===13||S.type===25))}function o(O){let R=h+O;return R<e.length?e[R]:null}function i(O,R){return{nextState:O,matchStack:z,syntaxStack:d,thenStack:f,tokenIndex:h,prev:R}}function a(O){f={nextState:O,matchStack:z,syntaxStack:d,prev:f}}function s(O){p=i(O,p)}function l(){z={type:c$,syntax:t.syntax,token:S,prev:z},n(),g=null,h>M&&(M=h)}function u(){d={syntax:t.syntax,opts:t.syntax.opts||d!==null&&d.opts||null,prev:d},z={type:oh,syntax:t.syntax,token:z.token,prev:z}}function c(){z.type===oh?z=z.prev:z={type:c4,syntax:d.syntax,token:z.token,prev:z},d=d.prev}let d=null,f=null,p=null,g=null,m=0,T=null,S=null,h=-1,M=0,z={type:l$,syntax:null,token:null,prev:null};for(n();T===null&&++m<a4;)switch(t.type){case"Match":if(f===null){if(S!==null&&(h!==e.length-1||S.value!=="\\0"&&S.value!=="\\9")){t=Yt;break}T=i4;break}if(t=f.nextState,t===vd)if(f.matchStack===z){t=Yt;break}else t=Bt;for(;f.syntaxStack!==d;)c();f=f.prev;break;case"Mismatch":if(g!==null&&g!==!1)(p===null||h>p.tokenIndex)&&(p=g,g=!1);else if(p===null){T=u$;break}t=p.nextState,f=p.thenStack,d=p.syntaxStack,z=p.matchStack,h=p.tokenIndex,S=h<e.length?e[h]:null,p=p.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==Yt&&s(t.else),t.then!==Bt&&a(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{let B=t.syntax.terms;if(t.index===B.length){if(t.mask===0||t.syntax.all){t=Yt;break}t=Bt;break}if(t.mask===(1<<B.length)-1){t=Bt;break}for(;t.index<B.length;t.index++){let x=1<<t.index;if((t.mask&x)===0){s(t),a({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|x}),t=B[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(S!==null){let B=S.value.toLowerCase();if(B.indexOf("\\")!==-1&&(B=B.replace(/\\[09].*$/,"")),o4.call(t.map,B)){t=t.map[B];break}}t=Yt;break;case"Generic":{let B=d!==null?d.opts:null,x=h+Math.floor(t.fn(S,o,B));if(!isNaN(x)&&x>h){for(;h<x;)l();t=Bt}else t=Yt;break}case"Type":case"Property":{let B=t.type==="Type"?"types":"properties",x=o4.call(r,B)?r[B][t.name]:null;if(!x||!x.match)throw new Error("Bad syntax reference: "+(t.type==="Type"?"<"+t.name+">":"<'"+t.name+"'>"));if(g!==!1&&S!==null&&t.type==="Type"&&(t.name==="custom-ident"&&S.type===1||t.name==="length"&&S.value==="0")){g===null&&(g=i(t,p)),t=Yt;break}u(),t=x.matchRef||x.match;break}case"Keyword":{let B=t.name;if(S!==null){let x=S.value;if(x.indexOf("\\")!==-1&&(x=x.replace(/\\[09].*$/,"")),nh(x,B)){l(),t=Bt;break}}t=Yt;break}case"AtKeyword":case"Function":if(S!==null&&nh(S.value,t.name)){l(),t=Bt;break}t=Yt;break;case"Token":if(S!==null&&S.value===t.value){l(),t=Bt;break}t=Yt;break;case"Comma":S!==null&&S.type===18?s4(z.token)?t=Yt:(l(),t=l4(S)?Yt:Bt):t=s4(z.token)||l4(S)?Bt:Yt;break;case"String":let O="",R=h;for(;R<e.length&&O.length<t.value.length;R++)O+=e[R].value;if(nh(O,t.value)){for(;h<R;)l();t=Bt}else t=Yt;break;default:throw new Error("Unknown node type: "+t.type)}switch(d$+=m,T){case null:console.warn("[csstree-match] BREAK after "+a4+" iterations"),T=p$,z=null;break;case i4:for(;d!==null;)c();break;default:z=null}return{tokens:e,reason:T,iterations:m,match:z,longestMatch:M}}function ih(e,t,r){let n=m$(e,t,r||{});if(n.match===null)return n;let o=n.match,i=n.match={syntax:t.syntax||null,match:[]},a=[i];for(o=f$(o).prev;o!==null;){switch(o.type){case oh:i.match.push(i={syntax:o.syntax,match:[]}),a.push(i);break;case c4:a.pop(),i=a[a.length-1];break;default:i.match.push({syntax:o.syntax||null,token:o.token.value,node:o.token.node})}o=o.prev}return n}var o4,l$,c$,oh,c4,i4,u$,p$,a4,d$,u4=H(()=>{"use strict";rh();({hasOwnProperty:o4}=Object.prototype),l$=0,c$=1,oh=2,c4=3,i4="Match",u$="Mismatch",p$="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",a4=15e3,d$=0});var sh={};Le(sh,{getTrace:()=>p4,isKeyword:()=>y$,isProperty:()=>x$,isType:()=>h$});function p4(e){function t(o){return o===null?!1:o.type==="Type"||o.type==="Property"||o.type==="Keyword"}function r(o){if(Array.isArray(o.match)){for(let i=0;i<o.match.length;i++)if(r(o.match[i]))return t(o.syntax)&&n.unshift(o.syntax),!0}else if(o.node===e)return n=t(o.syntax)?[o.syntax]:[],!0;return!1}let n=null;return this.matched!==null&&r(this.matched),n}function h$(e,t){return ah(this,e,r=>r.type==="Type"&&r.name===t)}function x$(e,t){return ah(this,e,r=>r.type==="Property"&&r.name===t)}function y$(e){return ah(this,e,t=>t.type==="Keyword")}function ah(e,t,r){let n=p4.call(e,t);return n===null?!1:n.some(r)}var d4=H(()=>{"use strict"});function f4(e){return"node"in e?e.node:f4(e.match[0])}function g4(e){return"node"in e?e.node:g4(e.match[e.match.length-1])}function lh(e,t,r,n,o){function i(s){if(s.syntax!==null&&s.syntax.type===n&&s.syntax.name===o){let l=f4(s),u=g4(s);e.syntax.walk(t,function(c,d,f){if(c===l){let p=new Kn;do{if(p.appendData(d.data),d.data===u)break;d=d.next}while(d!==null);a.push({parent:f,nodes:p})}})}Array.isArray(s.match)&&s.match.forEach(i)}let a=[];return r.matched!==null&&i(r.matched),a}var m4=H(()=>{"use strict";vc()});function ch(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function h4(e){return!!e&&ch(e.offset)&&ch(e.line)&&ch(e.column)}function b$(e,t){return function(n,o){if(!n||n.constructor!==Object)return o(n,"Type of node should be an Object");for(let i in n){let a=!0;if(_c.call(n,i)!==!1){if(i==="type")n.type!==e&&o(n,"Wrong node type `"+n.type+"`, expected `"+e+"`");else if(i==="loc"){if(n.loc===null)continue;if(n.loc&&n.loc.constructor===Object)if(typeof n.loc.source!="string")i+=".source";else if(!h4(n.loc.start))i+=".start";else if(!h4(n.loc.end))i+=".end";else continue;a=!1}else if(t.hasOwnProperty(i)){a=!1;for(let s=0;!a&&s<t[i].length;s++){let l=t[i][s];switch(l){case String:a=typeof n[i]=="string";break;case Boolean:a=typeof n[i]=="boolean";break;case null:a=n[i]===null;break;default:typeof l=="string"?a=n[i]&&n[i].type===l:Array.isArray(l)&&(a=n[i]instanceof Kn)}}}else o(n,"Unknown field `"+i+"` for "+e+" node type");a||o(n,"Bad value for `"+e+"."+i+"`")}}for(let i in t)_c.call(t,i)&&_c.call(n,i)===!1&&o(n,"Field `"+e+"."+i+"` is missed")}}function x4(e,t){let r=[];for(let n=0;n<e.length;n++){let o=e[n];if(o===String||o===Boolean)r.push(o.name.toLowerCase());else if(o===null)r.push("null");else if(typeof o=="string")r.push(o);else if(Array.isArray(o))r.push("List<"+(x4(o,t)||"any")+">");else throw new Error("Wrong value `"+o+"` in `"+t+"` structure definition")}return r.join(" | ")}function w$(e,t){let r=t.structure,n={type:String,loc:!0},o={type:'"'+e+'"'};for(let i in r){if(_c.call(r,i)===!1)continue;let a=n[i]=Array.isArray(r[i])?r[i].slice():[r[i]];o[i]=x4(a,e+"."+i)}return{docs:o,check:b$(e,n)}}function y4(e){let t={};if(e.node){for(let r in e.node)if(_c.call(e.node,r)){let n=e.node[r];if(n.structure)t[r]=w$(r,n);else throw new Error("Missed `structure` field in `"+r+"` node type definition")}}return t}var _c,b4=H(()=>{"use strict";vc();({hasOwnProperty:_c}=Object.prototype)});function uh(e,t,r){let n={};for(let o in e)e[o].syntax&&(n[o]=r?e[o].syntax:Js(e[o].syntax,{compact:t}));return n}function v$(e,t,r){let n={};for(let[o,i]of Object.entries(e))n[o]={prelude:i.prelude&&(r?i.prelude.syntax:Js(i.prelude.syntax,{compact:t})),descriptors:i.descriptors&&uh(i.descriptors,t,r)};return n}function S$(e){for(let t=0;t<e.length;t++)if(e[t].value.toLowerCase()==="var(")return!0;return!1}function k$(e){let t=e.terms[0];return e.explicit===!1&&e.terms.length===1&&t.type==="Multiplier"&&t.comma===!0}function Po(e,t,r){return{matched:e,iterations:r,error:t,...sh}}function ol(e,t,r,n){let o=e4(r,e.syntax),i;return S$(o)?Po(null,new Error("Matching for a tree with var() is not supported")):(n&&(i=ih(o,e.cssWideKeywordsSyntax,e)),(!n||!i.match)&&(i=ih(o,t.match,e),!i.match)?Po(null,new SC(i.reason,t.syntax,r,i),i.iterations):Po(i.match,null,i.iterations))}var Bc,w4=H(()=>{"use strict";kC();pd();dd();zC();DC();eh();t4();rh();u4();d4();m4();b4();Bc=class{constructor(t,r,n){if(this.cssWideKeywords=el,this.syntax=r,this.generic=!1,this.units={...md},this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=n||y4(t),t){if(t.cssWideKeywords&&(this.cssWideKeywords=t.cssWideKeywords),t.units)for(let o of Object.keys(md))Array.isArray(t.units[o])&&(this.units[o]=t.units[o]);if(t.types)for(let[o,i]of Object.entries(t.types))this.addType_(o,i);if(t.generic){this.generic=!0;for(let[o,i]of Object.entries(BC(this.units)))this.addType_(o,i)}if(t.atrules)for(let[o,i]of Object.entries(t.atrules))this.addAtrule_(o,i);if(t.properties)for(let[o,i]of Object.entries(t.properties))this.addProperty_(o,i)}this.cssWideKeywordsSyntax=Lc(this.cssWideKeywords.join(" | "))}checkStructure(t){function r(i,a){o.push({node:i,message:a})}let n=this.structure,o=[];return this.syntax.walk(t,function(i){n.hasOwnProperty(i.type)?n[i.type].check(i,r):r(i,"Unknown node type `"+i.type+"`")}),o.length?o:!1}createDescriptor(t,r,n,o=null){let i={type:r,name:n},a={type:r,name:n,parent:o,serializable:typeof t=="string"||t&&typeof t.type=="string",syntax:null,match:null,matchRef:null};return typeof t=="function"?a.match=Lc(t,i):(typeof t=="string"?Object.defineProperty(a,"syntax",{get(){return Object.defineProperty(a,"syntax",{value:Fc(t)}),a.syntax}}):a.syntax=t,Object.defineProperty(a,"match",{get(){return Object.defineProperty(a,"match",{value:Lc(a.syntax,i)}),a.match}}),r==="Property"&&Object.defineProperty(a,"matchRef",{get(){let s=a.syntax,l=k$(s)?Lc({...s,terms:[s.terms[0].term]},i):null;return Object.defineProperty(a,"matchRef",{value:l}),l}})),a}addAtrule_(t,r){r&&(this.atrules[t]={type:"Atrule",name:t,prelude:r.prelude?this.createDescriptor(r.prelude,"AtrulePrelude",t):null,descriptors:r.descriptors?Object.keys(r.descriptors).reduce((n,o)=>(n[o]=this.createDescriptor(r.descriptors[o],"AtruleDescriptor",o,t),n),Object.create(null)):null})}addProperty_(t,r){r&&(this.properties[t]=this.createDescriptor(r,"Property",t))}addType_(t,r){r&&(this.types[t]=this.createDescriptor(r,"Type",t))}checkAtruleName(t){if(!this.getAtrule(t))return new Qs("Unknown at-rule","@"+t)}checkAtrulePrelude(t,r){let n=this.checkAtruleName(t);if(n)return n;let o=this.getAtrule(t);if(!o.prelude&&r)return new SyntaxError("At-rule `@"+t+"` should not contain a prelude");if(o.prelude&&!r&&!ol(this,o.prelude,"",!1).matched)return new SyntaxError("At-rule `@"+t+"` should contain a prelude")}checkAtruleDescriptorName(t,r){let n=this.checkAtruleName(t);if(n)return n;let o=this.getAtrule(t),i=cd(r);if(!o.descriptors)return new SyntaxError("At-rule `@"+t+"` has no known descriptors");if(!o.descriptors[i.name]&&!o.descriptors[i.basename])return new Qs("Unknown at-rule descriptor",r)}checkPropertyName(t){if(!this.getProperty(t))return new Qs("Unknown property",t)}matchAtrulePrelude(t,r){let n=this.checkAtrulePrelude(t,r);if(n)return Po(null,n);let o=this.getAtrule(t);return o.prelude?ol(this,o.prelude,r||"",!1):Po(null,null)}matchAtruleDescriptor(t,r,n){let o=this.checkAtruleDescriptorName(t,r);if(o)return Po(null,o);let i=this.getAtrule(t),a=cd(r);return ol(this,i.descriptors[a.name]||i.descriptors[a.basename],n,!1)}matchDeclaration(t){return t.type!=="Declaration"?Po(null,new Error("Not a Declaration node")):this.matchProperty(t.property,t.value)}matchProperty(t,r){if(P0(t).custom)return Po(null,new Error("Lexer matching doesn't applicable for custom properties"));let n=this.checkPropertyName(t);return n?Po(null,n):ol(this,this.getProperty(t),r,!0)}matchType(t,r){let n=this.getType(t);return n?ol(this,n,r,!1):Po(null,new Qs("Unknown type",t))}match(t,r){return typeof t!="string"&&(!t||!t.type)?Po(null,new Qs("Bad syntax")):((typeof t=="string"||!t.match)&&(t=this.createDescriptor(t,"Type","anonymous")),ol(this,t,r,!1))}findValueFragments(t,r,n,o){return lh(this,r,this.matchProperty(t,r),n,o)}findDeclarationValueFragments(t,r,n){return lh(this,t.value,this.matchDeclaration(t),r,n)}findAllFragments(t,r,n){let o=[];return this.syntax.walk(t,{visit:"Declaration",enter:i=>{o.push.apply(o,this.findDeclarationValueFragments(i,r,n))}}),o}getAtrule(t,r=!0){let n=cd(t);return(n.vendor&&r?this.atrules[n.name]||this.atrules[n.basename]:this.atrules[n.name])||null}getAtrulePrelude(t,r=!0){let n=this.getAtrule(t,r);return n&&n.prelude||null}getAtruleDescriptor(t,r){return this.atrules.hasOwnProperty(t)&&this.atrules.declarators&&this.atrules[t].declarators[r]||null}getProperty(t,r=!0){let n=P0(t);return(n.vendor&&r?this.properties[n.name]||this.properties[n.basename]:this.properties[n.name])||null}getType(t){return hasOwnProperty.call(this.types,t)?this.types[t]:null}validate(){function t(l,u){return u?`<${l}>`:`<'${l}'>`}function r(l,u,c,d){if(c.has(u))return c.get(u);c.set(u,!1),d.syntax!==null&&Z0(d.syntax,function(f){if(f.type!=="Type"&&f.type!=="Property")return;let p=f.type==="Type"?l.types:l.properties,g=f.type==="Type"?o:i;hasOwnProperty.call(p,f.name)?r(l,f.name,g,p[f.name])&&(n.push(`${t(u,c===o)} used broken syntax definition ${t(f.name,f.type==="Type")}`),c.set(u,!0)):(n.push(`${t(u,c===o)} used missed syntax definition ${t(f.name,f.type==="Type")}`),c.set(u,!0))},this)}let n=[],o=new Map,i=new Map;for(let l in this.types)r(this,l,o,this.types[l]);for(let l in this.properties)r(this,l,i,this.properties[l]);let a=[...o.keys()].filter(l=>o.get(l)),s=[...i.keys()].filter(l=>i.get(l));return a.length||s.length?{errors:n,types:a,properties:s}:null}dump(t,r){return{generic:this.generic,cssWideKeywords:this.cssWideKeywords,units:this.units,types:uh(this.types,!r,t),properties:uh(this.properties,!r,t),atrules:v$(this.atrules,!r,t)}}toString(){return JSON.stringify(this.dump())}}});function ph(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function C$(e,t){let r=Object.create(null);for(let n of Object.keys(e))t.includes(n)&&(r[n]=e[n]);return r}function dh(e,t,r){let n={...e};for(let[o,i]of Object.entries(t))n[o]={...n[o],...r?C$(i,r):i};return n}function zc(e,t){let r={...e};for(let[n,o]of Object.entries(t))switch(n){case"generic":r[n]=!!o;break;case"cssWideKeywords":r[n]=e[n]?[...e[n],...o]:o||[];break;case"units":r[n]={...e[n]};for(let[i,a]of Object.entries(o))r[n][i]=Array.isArray(a)?a:[];break;case"atrules":r[n]={...e[n]};for(let[i,a]of Object.entries(o)){let s=r[n][i]||{},l=r[n][i]={prelude:s.prelude||null,descriptors:{...s.descriptors}};if(a){l.prelude=a.prelude?ph(l.prelude,a.prelude):l.prelude||null;for(let[u,c]of Object.entries(a.descriptors||{}))l.descriptors[u]=c?ph(l.descriptors[u],c):null;Object.keys(l.descriptors).length||(l.descriptors=null)}}break;case"types":case"properties":r[n]={...e[n]};for(let[i,a]of Object.entries(o))r[n][i]=ph(r[n][i],a);break;case"parseContext":r[n]={...e[n],...o};break;case"scope":case"features":r[n]=dh(e[n],o);break;case"atrule":case"pseudo":r[n]=dh(e[n],o,["parse"]);break;case"node":r[n]=dh(e[n],o,["name","structure","parse","generate","walkContext"]);break}return r}var v4=H(()=>{"use strict"});function S4(e){let t=Dk(e),r=bC(e),n=pC(e),{fromPlainObject:o,toPlainObject:i}=fC(r),a={lexer:null,createLexer:s=>new Bc(s,a,a.lexer.structure),tokenize:ua,parse:t,generate:n,walk:r,find:r.find,findLast:r.findLast,findAll:r.findAll,fromPlainObject:o,toPlainObject:i,fork(s){let l=zc({},e);return S4(typeof s=="function"?s(l):zc(l,s))}};return a.lexer=new Bc({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},a),a}var k4,C4=H(()=>{"use strict";so();Nk();dC();gC();wC();w4();v4();k4=e=>S4(zc({},e))});var E4,T4=H(()=>{"use strict";E4={generic:!0,cssWideKeywords:["initial","inherit","unset","revert","revert-layer"],units:{angle:["deg","grad","rad","turn"],decibel:["db"],flex:["fr"],frequency:["hz","khz"],length:["cm","mm","q","in","pt","pc","px","em","rem","ex","rex","cap","rcap","ch","rch","ic","ric","lh","rlh","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],resolution:["dpi","dpcm","dppx","x"],semitones:["st"],time:["s","ms"]},types:{"abs()":"abs( <calc-sum> )","absolute-size":"xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large","acos()":"acos( <calc-sum> )","alpha-value":"<number>|<percentage>","an+b":"odd|even|<integer>|<n-dimension>|'+'? \u2020 n|-n|<ndashdigit-dimension>|'+'? \u2020 <ndashdigit-ident>|<dashndashdigit-ident>|<n-dimension> <signed-integer>|'+'? \u2020 n <signed-integer>|-n <signed-integer>|<ndash-dimension> <signless-integer>|'+'? \u2020 n- <signless-integer>|-n- <signless-integer>|<n-dimension> ['+'|'-'] <signless-integer>|'+'? \u2020 n ['+'|'-'] <signless-integer>|-n ['+'|'-'] <signless-integer>","anchor()":"anchor( <anchor-name>?&&<anchor-side> , <length-percentage>? )","anchor-name":"<dashed-ident>","anchor-side":"inside|outside|top|left|right|bottom|start|end|self-start|self-end|<percentage>|center","anchor-size":"width|height|block|inline|self-block|self-inline","anchor-size()":"anchor-size( [<anchor-name>||<anchor-size>]? , <length-percentage>? )","angle-percentage":"<angle>|<percentage>","angular-color-hint":"<angle-percentage>|<zero>","angular-color-stop":"<color> <color-stop-angle>?","angular-color-stop-list":"<angular-color-stop> , [<angular-color-hint>? , <angular-color-stop>]#?","animateable-feature":"scroll-position|contents|<custom-ident>","animation-action":"none|play|play-once|play-forwards|play-backwards|pause|reset|replay","asin()":"asin( <calc-sum> )","atan()":"atan( <calc-sum> )","atan2()":"atan2( <calc-sum> , <calc-sum> )",attachment:"scroll|fixed|local","attr()":"attr( <attr-name> <attr-type>? , <declaration-value>? )","attr-matcher":"['~'|'|'|'^'|'$'|'*']? '='","attr-modifier":"i|s","attr-type":"type( <syntax> )|raw-string|number|<attr-unit>","attribute-selector":"'[' <wq-name> ']'|'[' <wq-name> <attr-matcher> [<string-token>|<ident-token>] <attr-modifier>? ']'","auto-repeat":"repeat( [auto-fill|auto-fit] , [<line-names>? <fixed-size>]+ <line-names>? )","auto-track-list":"[<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>? <auto-repeat> [<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>?",axis:"block|inline|x|y","baseline-position":"[first|last]? baseline","basic-shape":"<inset()>|<xywh()>|<rect()>|<circle()>|<ellipse()>|<polygon()>|<path()>","basic-shape-rect":"<inset()>|<rect()>|<xywh()>","bg-clip":"<visual-box>|border-area|text","bg-image":"<image>|none","bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<visual-box>||<visual-box>","bg-position":"[[left|center|right|top|bottom|<length-percentage>]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]|[center|[left|right] <length-percentage>?]&&[center|[top|bottom] <length-percentage>?]]","bg-size":"[<length-percentage [0,\u221E]>|auto]{1,2}|cover|contain","blend-mode":"normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity","blur()":"blur( <length>? )","brightness()":"brightness( [<number>|<percentage>]? )","calc()":"calc( <calc-sum> )","calc-constant":"e|pi|infinity|-infinity|NaN","calc-product":"<calc-value> ['*' <calc-value>|'/' <number>]*","calc-size()":"calc-size( <calc-size-basis> , <calc-sum> )","calc-size-basis":"<intrinsic-size-keyword>|<calc-size()>|any|<calc-sum>","calc-sum":"<calc-product> [['+'|'-'] <calc-product>]*","calc-value":"<number>|<dimension>|<percentage>|<calc-constant>|( <calc-sum> )","cf-final-image":"<image>|<color>","cf-mixing-image":"<percentage>?&&<image>","circle()":"circle( <radial-size>? [at <position>]? )","clamp()":"clamp( <calc-sum>#{3} )","class-selector":"'.' <ident-token>","clip-source":"<url>",color:"<color-base>|currentColor|<system-color>|<device-cmyk()>|<light-dark()>|<-non-standard-color>","color()":"color( <colorspace-params> [/ [<alpha-value>|none]]? )","color-base":"<hex-color>|<color-function>|<named-color>|<color-mix()>|transparent","color-function":"<rgb()>|<rgba()>|<hsl()>|<hsla()>|<hwb()>|<lab()>|<lch()>|<oklab()>|<oklch()>|<color()>","color-interpolation-method":"in [<rectangular-color-space>|<polar-color-space> <hue-interpolation-method>?|<custom-color-space>]","color-mix()":"color-mix( <color-interpolation-method> , [<color>&&<percentage [0,100]>?]#{2} )","color-stop":"<color-stop-length>|<color-stop-angle>","color-stop-angle":"[<angle-percentage>|<zero>]{1,2}","color-stop-length":"<length-percentage>{1,2}","color-stop-list":"<linear-color-stop> , [<linear-color-hint>? , <linear-color-stop>]#?","colorspace-params":"[<predefined-rgb-params>|<xyz-params>]",combinator:"'>'|'+'|'~'|['|' '|']","common-lig-values":"[common-ligatures|no-common-ligatures]","compat-auto":"searchfield|textarea|checkbox|radio|menulist|listbox|meter|progress-bar|button","compat-special":"textfield|menulist-button","complex-selector":"<complex-selector-unit> [<combinator>? <complex-selector-unit>]*","complex-selector-list":"<complex-selector>#","composite-style":"clear|copy|source-over|source-in|source-out|source-atop|destination-over|destination-in|destination-out|destination-atop|xor","compositing-operator":"add|subtract|intersect|exclude","compound-selector":"[<type-selector>? <subclass-selector>*]!","compound-selector-list":"<compound-selector>#","conic-gradient()":"conic-gradient( [<conic-gradient-syntax>] )","conic-gradient-syntax":"[[[from [<angle>|<zero>]]? [at <position>]?]||<color-interpolation-method>]? , <angular-color-stop-list>","container-condition":"not <query-in-parens>|<query-in-parens> [[and <query-in-parens>]*|[or <query-in-parens>]*]","container-name":"<custom-ident>","container-query":"not <query-in-parens>|<query-in-parens> [[and <query-in-parens>]*|[or <query-in-parens>]*]","content-distribution":"space-between|space-around|space-evenly|stretch","content-list":"[<string>|contents|<image>|<counter>|<quote>|<target>|<leader()>|<attr()>]+","content-position":"center|start|end|flex-start|flex-end","content-replacement":"<image>","contextual-alt-values":"[contextual|no-contextual]","contrast()":"contrast( [<number>|<percentage>]? )","coord-box":"content-box|padding-box|border-box|fill-box|stroke-box|view-box","corner-shape-value":"round|scoop|bevel|notch|square|squircle|<superellipse()>","cos()":"cos( <calc-sum> )",counter:"<counter()>|<counters()>","counter()":"counter( <counter-name> , <counter-style>? )","counter-name":"<custom-ident>","counter-style":"<counter-style-name>|symbols( )","counter-style-name":"<custom-ident>","counters()":"counters( <counter-name> , <string> , <counter-style>? )","cross-fade()":"cross-fade( <cf-mixing-image> , <cf-final-image>? )","cubic-bezier()":"cubic-bezier( [<number [0,1]> , <number>]#{2} )","cubic-bezier-easing-function":"ease|ease-in|ease-out|ease-in-out|cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )","cursor-predefined":"auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing","custom-color-space":"<dashed-ident>","custom-params":"<dashed-ident> [<number>|<percentage>|none]+",dasharray:"[[<length-percentage>|<number>]+]#","dashndashdigit-ident":"<ident-token>","deprecated-system-color":"ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonHighlight|ButtonShadow|CaptionText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText","discretionary-lig-values":"[discretionary-ligatures|no-discretionary-ligatures]","display-box":"contents|none","display-inside":"flow|flow-root|table|flex|grid|ruby","display-internal":"table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption|ruby-base|ruby-text|ruby-base-container|ruby-text-container","display-legacy":"inline-block|inline-list-item|inline-table|inline-flex|inline-grid","display-listitem":"<display-outside>?&&[flow|flow-root]?&&list-item","display-outside":"block|inline|run-in","drop-shadow()":"drop-shadow( [<color>?&&<length>{2,3}] )","dynamic-range-limit-mix()":"dynamic-range-limit-mix( [<'dynamic-range-limit'>&&<percentage [0,100]>]#{2,} )","easing-function":"<linear-easing-function>|<cubic-bezier-easing-function>|<step-easing-function>","east-asian-variant-values":"[jis78|jis83|jis90|jis04|simplified|traditional]","east-asian-width-values":"[full-width|proportional-width]","element()":"element( <custom-ident> , [first|start|last|first-except]? )|element( <id-selector> )","ellipse()":"ellipse( <radial-size>? [at <position>]? )","env()":"env( <custom-ident> , <declaration-value>? )","exp()":"exp( <calc-sum> )","explicit-track-list":"[<line-names>? <track-size>]+ <line-names>?","family-name":"<string>|<custom-ident>+","feature-tag-value":"<string> [<integer>|on|off]?","feature-type":"@stylistic|@historical-forms|@styleset|@character-variant|@swash|@ornaments|@annotation","feature-value-block":"<feature-type> '{' <feature-value-declaration-list> '}'","feature-value-block-list":"<feature-value-block>+","feature-value-declaration":"<custom-ident> : <integer>+ ;","feature-value-declaration-list":"<feature-value-declaration>","feature-value-name":"<custom-ident>","filter-function":"<blur()>|<brightness()>|<contrast()>|<drop-shadow()>|<grayscale()>|<hue-rotate()>|<invert()>|<opacity()>|<saturate()>|<sepia()>","filter-value-list":"[<filter-function>|<url>]+","final-bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<visual-box>||<visual-box>||<'background-color'>","fit-content()":"fit-content( <length-percentage [0,\u221E]> )","fixed-breadth":"<length-percentage>","fixed-repeat":"repeat( [<integer [1,\u221E]>] , [<line-names>? <fixed-size>]+ <line-names>? )","fixed-size":"<fixed-breadth>|minmax( <fixed-breadth> , <track-breadth> )|minmax( <inflexible-breadth> , <fixed-breadth> )","font-stretch-absolute":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|<percentage>","font-variant-css2":"normal|small-caps","font-weight-absolute":"normal|bold|<number [1,1000]>","font-width-css3":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded","form-control-identifier":"select","frequency-percentage":"<frequency>|<percentage>","generic-complete":"serif|sans-serif|system-ui|cursive|fantasy|math|monospace","general-enclosed":"[<function-token> <any-value>? )]|[( <any-value>? )]","generic-family":"<generic-script-specific>|<generic-complete>|<generic-incomplete>|<-non-standard-generic-family>","generic-incomplete":"ui-serif|ui-sans-serif|ui-monospace|ui-rounded","geometry-box":"<shape-box>|fill-box|stroke-box|view-box",gradient:"<linear-gradient()>|<repeating-linear-gradient()>|<radial-gradient()>|<repeating-radial-gradient()>|<conic-gradient()>|<repeating-conic-gradient()>|<-legacy-gradient>","grayscale()":"grayscale( [<number>|<percentage>]? )","grid-line":"auto|<custom-ident>|[<integer>&&<custom-ident>?]|[span&&[<integer>||<custom-ident>]]","historical-lig-values":"[historical-ligatures|no-historical-ligatures]","hsl()":"hsl( <hue> , <percentage> , <percentage> , <alpha-value>? )|hsl( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","hsla()":"hsla( <hue> , <percentage> , <percentage> , <alpha-value>? )|hsla( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )",hue:"<number>|<angle>","hue-interpolation-method":"[shorter|longer|increasing|decreasing] hue","hue-rotate()":"hue-rotate( [<angle>|<zero>]? )","hwb()":"hwb( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","hypot()":"hypot( <calc-sum># )",image:"<url>|<image()>|<image-set()>|<element()>|<paint()>|<cross-fade()>|<gradient>","image()":"image( <image-tags>? [<image-src>? , <color>?]! )","image-set()":"image-set( <image-set-option># )","image-set-option":"[<image>|<string>] [<resolution>||type( <string> )]","image-src":"<url>|<string>","image-tags":"ltr|rtl","inflexible-breadth":"<length-percentage>|min-content|max-content|auto","inset()":"inset( <length-percentage>{1,4} [round <'border-radius'>]? )","invert()":"invert( [<number>|<percentage>]? )","keyframe-block":"<keyframe-selector># { <declaration-list> }","keyframe-selector":"from|to|<percentage [0,100]>|<timeline-range-name> <percentage>","keyframes-name":"<custom-ident>|<string>","lab()":"lab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","layer()":"layer( <layer-name> )","layer-name":"<ident> ['.' <ident>]*","lch()":"lch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )","leader()":"leader( <leader-type> )","leader-type":"dotted|solid|space|<string>","length-percentage":"<length>|<percentage>","light-dark()":"light-dark( <color> , <color> )","line-name-list":"[<line-names>|<name-repeat>]+","line-names":"'[' <custom-ident>* ']'","line-style":"none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset","line-width":"<length>|thin|medium|thick","linear()":"linear( [<number>&&<percentage>{0,2}]# )","linear-color-hint":"<length-percentage>","linear-color-stop":"<color> <color-stop-length>?","linear-easing-function":"linear|<linear()>","linear-gradient()":"linear-gradient( [<linear-gradient-syntax>] )","linear-gradient-syntax":"[[<angle>|<zero>|to <side-or-corner>]||<color-interpolation-method>]? , <color-stop-list>","log()":"log( <calc-sum> , <calc-sum>? )","mask-layer":"<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||<geometry-box>||[<geometry-box>|no-clip]||<compositing-operator>||<masking-mode>","mask-position":"[<length-percentage>|left|center|right] [<length-percentage>|top|center|bottom]?","mask-reference":"none|<image>|<mask-source>","mask-source":"<url>","masking-mode":"alpha|luminance|match-source","matrix()":"matrix( <number>#{6} )","matrix3d()":"matrix3d( <number>#{16} )","max()":"max( <calc-sum># )","media-and":"<media-in-parens> [and <media-in-parens>]+","media-condition":"<media-not>|<media-and>|<media-or>|<media-in-parens>","media-condition-without-or":"<media-not>|<media-and>|<media-in-parens>","media-feature":"( [<mf-plain>|<mf-boolean>|<mf-range>] )","media-in-parens":"( <media-condition> )|<media-feature>|<general-enclosed>","media-not":"not <media-in-parens>","media-or":"<media-in-parens> [or <media-in-parens>]+","media-query":"<media-condition>|[not|only]? <media-type> [and <media-condition-without-or>]?","media-query-list":"<media-query>#","media-type":"<ident>","mf-boolean":"<mf-name>","mf-name":"<ident>","mf-plain":"<mf-name> : <mf-value>","mf-range":"<mf-name> ['<'|'>']? '='? <mf-value>|<mf-value> ['<'|'>']? '='? <mf-name>|<mf-value> '<' '='? <mf-name> '<' '='? <mf-value>|<mf-value> '>' '='? <mf-name> '>' '='? <mf-value>","mf-value":"<number>|<dimension>|<ident>|<ratio>","min()":"min( <calc-sum># )","minmax()":"minmax( [<length-percentage>|min-content|max-content|auto] , [<length-percentage>|<flex>|min-content|max-content|auto] )","mod()":"mod( <calc-sum> , <calc-sum> )","n-dimension":"<dimension-token>","name-repeat":"repeat( [<integer [1,\u221E]>|auto-fill] , <line-names>+ )","named-color":"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen","namespace-prefix":"<ident>","ndash-dimension":"<dimension-token>","ndashdigit-dimension":"<dimension-token>","ndashdigit-ident":"<ident-token>","ns-prefix":"[<ident-token>|'*']? '|'","number-percentage":"<number>|<percentage>","numeric-figure-values":"[lining-nums|oldstyle-nums]","numeric-fraction-values":"[diagonal-fractions|stacked-fractions]","numeric-spacing-values":"[proportional-nums|tabular-nums]","offset-path":"<ray()>|<url>|<basic-shape>","oklab()":"oklab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","oklch()":"oklch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )","opacity()":"opacity( [<number>|<percentage>]? )","opacity-value":"<number>|<percentage>","outline-line-style":"none|dotted|dashed|solid|double|groove|ridge|inset|outset","outline-radius":"<length>|<percentage>","overflow-position":"unsafe|safe","page-body":"<declaration>? [; <page-body>]?|<page-margin-box> <page-body>","page-margin-box":"<page-margin-box-type> '{' <declaration-list> '}'","page-margin-box-type":"@top-left-corner|@top-left|@top-center|@top-right|@top-right-corner|@bottom-left-corner|@bottom-left|@bottom-center|@bottom-right|@bottom-right-corner|@left-top|@left-middle|@left-bottom|@right-top|@right-middle|@right-bottom","page-selector":"<pseudo-page>+|<ident> <pseudo-page>*","page-selector-list":"[<page-selector>#]?","page-size":"A5|A4|A3|B5|B4|JIS-B5|JIS-B4|letter|legal|ledger",paint:"none|<color>|<url> [none|<color>]?|context-fill|context-stroke","paint()":"paint( <ident> , <declaration-value>? )","paint-box":"<visual-box>|fill-box|stroke-box","palette-identifier":"<dashed-ident>","palette-mix()":"palette-mix( <color-interpolation-method> , [[normal|light|dark|<palette-identifier>|<palette-mix()>]&&<percentage [0,100]>?]#{2} )","path()":"path( <'fill-rule'>? , <string> )","perspective()":"perspective( [<length [0,\u221E]>|none] )","polar-color-space":"hsl|hwb|lch|oklch","polygon()":"polygon( <'fill-rule'>? , [<length-percentage> <length-percentage>]# )",position:"[[left|center|right]||[top|center|bottom]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]?|[[left|right] <length-percentage>]&&[[top|bottom] <length-percentage>]]","position-area":"[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|center|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|center|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]","pow()":"pow( <calc-sum> , <calc-sum> )","predefined-rgb":"srgb|srgb-linear|display-p3|display-p3-linear|a98-rgb|prophoto-rgb|rec2020","predefined-rgb-params":"<predefined-rgb> [<number>|<percentage>|none]{3}","pseudo-class-selector":"':' <ident-token>|':' <function-token> <any-value> ')'","pseudo-element-selector":"':' <pseudo-class-selector>|<legacy-pseudo-element-selector>","pseudo-page":": [left|right|first|blank]","query-in-parens":"( <container-condition> )|( <size-feature> )|style( <style-query> )|<general-enclosed>",quote:"open-quote|close-quote|no-open-quote|no-close-quote","radial-extent":"closest-corner|closest-side|farthest-corner|farthest-side","radial-gradient()":"radial-gradient( [<radial-gradient-syntax>] )","radial-gradient-syntax":"[[[<radial-shape>||<radial-size>]? [at <position>]?]||<color-interpolation-method>]? , <color-stop-list>","radial-shape":"circle|ellipse","radial-size":"<radial-extent>|<length [0,\u221E]>|<length-percentage [0,\u221E]>{2}",ratio:"<number [0,\u221E]> [/ <number [0,\u221E]>]?","ray()":"ray( <angle>&&<ray-size>?&&contain?&&[at <position>]? )","ray-size":"closest-side|closest-corner|farthest-side|farthest-corner|sides","rect()":"rect( [<length-percentage>|auto]{4} [round <'border-radius'>]? )","rectangular-color-space":"srgb|srgb-linear|display-p3|display-p3-linear|a98-rgb|prophoto-rgb|rec2020|lab|oklab|xyz|xyz-d50|xyz-d65","relative-selector":"<combinator>? <complex-selector>","relative-selector-list":"<relative-selector>#","relative-size":"larger|smaller","rem()":"rem( <calc-sum> , <calc-sum> )","repeat-style":"repeat-x|repeat-y|[repeat|space|round|no-repeat]{1,2}","repeating-conic-gradient()":"repeating-conic-gradient( [<conic-gradient-syntax>] )","repeating-linear-gradient()":"repeating-linear-gradient( [<linear-gradient-syntax>] )","repeating-radial-gradient()":"repeating-radial-gradient( [<radial-gradient-syntax>] )","reversed-counter-name":"reversed( <counter-name> )","rgb()":"rgb( <percentage>#{3} , <alpha-value>? )|rgb( <number>#{3} , <alpha-value>? )|rgb( [<number>|<percentage>|none]{3} [/ [<alpha-value>|none]]? )","rgba()":"rgba( <percentage>#{3} , <alpha-value>? )|rgba( <number>#{3} , <alpha-value>? )|rgba( [<number>|<percentage>|none]{3} [/ [<alpha-value>|none]]? )","rotate()":"rotate( [<angle>|<zero>] )","rotate3d()":"rotate3d( <number> , <number> , <number> , [<angle>|<zero>] )","rotateX()":"rotateX( [<angle>|<zero>] )","rotateY()":"rotateY( [<angle>|<zero>] )","rotateZ()":"rotateZ( [<angle>|<zero>] )","round()":"round( <rounding-strategy>? , <calc-sum> , <calc-sum> )","rounding-strategy":"nearest|up|down|to-zero","saturate()":"saturate( [<number>|<percentage>]? )","scale()":"scale( [<number>|<percentage>]#{1,2} )","scale3d()":"scale3d( [<number>|<percentage>]#{3} )","scaleX()":"scaleX( [<number>|<percentage>] )","scaleY()":"scaleY( [<number>|<percentage>] )","scaleZ()":"scaleZ( [<number>|<percentage>] )","scope-end":"<forgiving-selector-list>","scope-start":"<forgiving-selector-list>","scroll()":"scroll( [<scroller>||<axis>]? )",scroller:"root|nearest|self","scroll-state-feature":"<media-query-list>","scroll-state-in-parens":"( <scroll-state-query> )|( <scroll-state-feature> )|<general-enclosed>","scroll-state-query":"not <scroll-state-in-parens>|<scroll-state-in-parens> [[and <scroll-state-in-parens>]*|[or <scroll-state-in-parens>]*]|<scroll-state-feature>","selector-list":"<complex-selector-list>","self-position":"center|start|end|self-start|self-end|flex-start|flex-end","sepia()":"sepia( [<number>|<percentage>]? )",shadow:"inset?&&<length>{2,4}&&<color>?","shadow-t":"[<length>{2,3}&&<color>?]",shape:"rect( <top> , <right> , <bottom> , <left> )|rect( <top> <right> <bottom> <left> )","shape-box":"<visual-box>|margin-box","side-or-corner":"[left|right]||[top|bottom]","sign()":"sign( <calc-sum> )","signed-integer":"<number-token>","signless-integer":"<number-token>","sin()":"sin( <calc-sum> )","single-animation":"<'animation-duration'>||<easing-function>||<'animation-delay'>||<single-animation-iteration-count>||<single-animation-direction>||<single-animation-fill-mode>||<single-animation-play-state>||[none|<keyframes-name>]||<single-animation-timeline>","single-animation-composition":"replace|add|accumulate","single-animation-direction":"normal|reverse|alternate|alternate-reverse","single-animation-fill-mode":"none|forwards|backwards|both","single-animation-iteration-count":"infinite|<number>","single-animation-play-state":"running|paused","single-animation-timeline":"auto|none|<dashed-ident>|<scroll()>|<view()>","single-transition":"[none|<single-transition-property>]||<time>||<easing-function>||<time>||<transition-behavior-value>","single-transition-property":"all|<custom-ident>",size:"closest-side|farthest-side|closest-corner|farthest-corner|<length>|<length-percentage>{2}","size-feature":"<mf-plain>|<mf-boolean>|<mf-range>","skew()":"skew( [<angle>|<zero>] , [<angle>|<zero>]? )","skewX()":"skewX( [<angle>|<zero>] )","skewY()":"skewY( [<angle>|<zero>] )","sqrt()":"sqrt( <calc-sum> )","step-position":"jump-start|jump-end|jump-none|jump-both|start|end","step-easing-function":"step-start|step-end|<steps()>","steps()":"steps( <integer> , <step-position>? )","style-feature":"<declaration>","style-in-parens":"( <style-condition> )|( <style-feature> )|<general-enclosed>","style-query":"<style-condition>|<style-feature>","subclass-selector":"<id-selector>|<class-selector>|<attribute-selector>|<pseudo-class-selector>","superellipse()":"superellipse( [<number>|infinity|-infinity] )","supports-condition":"not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*","supports-decl":"( <declaration> )","supports-feature":"<supports-decl>|<supports-selector-fn>","supports-in-parens":"( <supports-condition> )|<supports-feature>|<general-enclosed>","supports-selector-fn":"selector( <complex-selector> )",symbol:"<string>|<image>|<custom-ident>","symbols()":"symbols( <symbols-type>? [<string>|<image>]+ )","symbols-type":"cyclic|numeric|alphabetic|symbolic|fixed","system-color":"AccentColor|AccentColorText|ActiveText|ButtonBorder|ButtonFace|ButtonText|Canvas|CanvasText|Field|FieldText|GrayText|Highlight|HighlightText|LinkText|Mark|MarkText|SelectedItem|SelectedItemText|VisitedText","system-family-name":"caption|icon|menu|message-box|small-caption|status-bar","tan()":"tan( <calc-sum> )",target:"<target-counter()>|<target-counters()>|<target-text()>","target-counter()":"target-counter( [<string>|<url>] , <custom-ident> , <counter-style>? )","target-counters()":"target-counters( [<string>|<url>] , <custom-ident> , <string> , <counter-style>? )","target-text()":"target-text( [<string>|<url>] , [content|before|after|first-letter]? )","text-edge":"[text|cap|ex|ideographic|ideographic-ink] [text|alphabetic|ideographic|ideographic-ink]?","time-percentage":"<time>|<percentage>","timeline-range-name":"cover|contain|entry|exit|entry-crossing|exit-crossing","track-breadth":"<length-percentage>|<flex>|min-content|max-content|auto","track-list":"[<line-names>? [<track-size>|<track-repeat>]]+ <line-names>?","track-repeat":"repeat( [<integer [1,\u221E]>] , [<line-names>? <track-size>]+ <line-names>? )","track-size":"<track-breadth>|minmax( <inflexible-breadth> , <track-breadth> )|fit-content( <length-percentage> )","transform-function":"<matrix()>|<translate()>|<translateX()>|<translateY()>|<scale()>|<scaleX()>|<scaleY()>|<rotate()>|<skew()>|<skewX()>|<skewY()>|<matrix3d()>|<translate3d()>|<translateZ()>|<scale3d()>|<scaleZ()>|<rotate3d()>|<rotateX()>|<rotateY()>|<rotateZ()>|<perspective()>","transform-list":"<transform-function>+","transition-behavior-value":"normal|allow-discrete","translate()":"translate( <length-percentage> , <length-percentage>? )","translate3d()":"translate3d( <length-percentage> , <length-percentage> , <length> )","translateX()":"translateX( <length-percentage> )","translateY()":"translateY( <length-percentage> )","translateZ()":"translateZ( <length> )","try-size":"most-width|most-height|most-block-size|most-inline-size","try-tactic":"flip-block||flip-inline||flip-start","type-or-unit":"string|color|url|integer|number|length|angle|time|frequency|cap|ch|em|ex|ic|lh|rlh|rem|vb|vi|vw|vh|vmin|vmax|mm|Q|cm|in|pt|pc|px|deg|grad|rad|turn|ms|s|Hz|kHz|%","type-selector":"<wq-name>|<ns-prefix>? '*'","var()":"var( <custom-property-name> , <declaration-value>? )","view()":"view( [<axis>||<'view-timeline-inset'>]? )","viewport-length":"auto|<length-percentage>","visual-box":"content-box|padding-box|border-box","wq-name":"<ns-prefix>? <ident-token>","xywh()":"xywh( <length-percentage>{2} <length-percentage [0,\u221E]>{2} [round <'border-radius'>]? )",xyz:"xyz|xyz-d50|xyz-d65","xyz-params":"<xyz-space> [<number>|<percentage>|none]{3}","-legacy-gradient":"<-webkit-gradient()>|<-legacy-linear-gradient>|<-legacy-repeating-linear-gradient>|<-legacy-radial-gradient>|<-legacy-repeating-radial-gradient>","-legacy-linear-gradient":"-moz-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-repeating-linear-gradient":"-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-linear-gradient-arguments":"[<angle>|<side-or-corner>]? , <color-stop-list>","-legacy-radial-gradient":"-moz-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-repeating-radial-gradient":"-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-radial-gradient-arguments":"[<position> ,]? [[[<-legacy-radial-gradient-shape>||<-legacy-radial-gradient-size>]|[<length>|<percentage>]{2}] ,]? <color-stop-list>","-legacy-radial-gradient-size":"closest-side|closest-corner|farthest-side|farthest-corner|contain|cover","-legacy-radial-gradient-shape":"circle|ellipse","-non-standard-font":"-apple-system-body|-apple-system-headline|-apple-system-subheadline|-apple-system-caption1|-apple-system-caption2|-apple-system-footnote|-apple-system-short-body|-apple-system-short-headline|-apple-system-short-subheadline|-apple-system-short-caption1|-apple-system-short-footnote|-apple-system-tall-body","-non-standard-color":"-moz-ButtonDefault|-moz-ButtonHoverFace|-moz-ButtonHoverText|-moz-CellHighlight|-moz-CellHighlightText|-moz-Combobox|-moz-ComboboxText|-moz-Dialog|-moz-DialogText|-moz-dragtargetzone|-moz-EvenTreeRow|-moz-Field|-moz-FieldText|-moz-html-CellHighlight|-moz-html-CellHighlightText|-moz-mac-accentdarkestshadow|-moz-mac-accentdarkshadow|-moz-mac-accentface|-moz-mac-accentlightesthighlight|-moz-mac-accentlightshadow|-moz-mac-accentregularhighlight|-moz-mac-accentregularshadow|-moz-mac-chrome-active|-moz-mac-chrome-inactive|-moz-mac-focusring|-moz-mac-menuselect|-moz-mac-menushadow|-moz-mac-menutextselect|-moz-MenuHover|-moz-MenuHoverText|-moz-MenuBarText|-moz-MenuBarHoverText|-moz-nativehyperlinktext|-moz-OddTreeRow|-moz-win-communicationstext|-moz-win-mediatext|-moz-activehyperlinktext|-moz-default-background-color|-moz-default-color|-moz-hyperlinktext|-moz-visitedhyperlinktext|-webkit-activelink|-webkit-focus-ring-color|-webkit-link|-webkit-text","-non-standard-image-rendering":"optimize-contrast|-moz-crisp-edges|-o-crisp-edges|-webkit-optimize-contrast","-non-standard-overflow":"overlay|-moz-scrollbars-none|-moz-scrollbars-horizontal|-moz-scrollbars-vertical|-moz-hidden-unscrollable","-non-standard-size":"intrinsic|min-intrinsic|-webkit-fill-available|-webkit-fit-content|-webkit-min-content|-webkit-max-content|-moz-available|-moz-fit-content|-moz-min-content|-moz-max-content","-webkit-gradient()":"-webkit-gradient( <-webkit-gradient-type> , <-webkit-gradient-point> [, <-webkit-gradient-point>|, <-webkit-gradient-radius> , <-webkit-gradient-point>] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )","-webkit-gradient-color-stop":"from( <color> )|color-stop( [<number-zero-one>|<percentage>] , <color> )|to( <color> )","-webkit-gradient-point":"[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]","-webkit-gradient-radius":"<length>|<percentage>","-webkit-gradient-type":"linear|radial","-webkit-mask-box-repeat":"repeat|stretch|round","-ms-filter-function-list":"<-ms-filter-function>+","-ms-filter-function":"<-ms-filter-function-progid>|<-ms-filter-function-legacy>","-ms-filter-function-progid":"'progid:' [<ident-token> '.']* [<ident-token>|<function-token> <any-value>? )]","-ms-filter-function-legacy":"<ident-token>|<function-token> <any-value>? )",age:"child|young|old","attr-name":"<wq-name>","attr-fallback":"<any-value>",autospace:"no-autospace|[ideograph-alpha||ideograph-numeric||punctuation]||[insert|replace]",bottom:"<length>|auto","generic-voice":"[<age>? <gender> <integer>?]",gender:"male|female|neutral","generic-script-specific":"generic( kai )|generic( fangsong )|generic( nastaliq )","-non-standard-generic-family":"-apple-system|BlinkMacSystemFont","intrinsic-size-keyword":"min-content|max-content|fit-content",left:"<length>|auto","device-cmyk()":"<legacy-device-cmyk-syntax>|<modern-device-cmyk-syntax>","legacy-device-cmyk-syntax":"device-cmyk( <number>#{4} )","modern-device-cmyk-syntax":"device-cmyk( <cmyk-component>{4} [/ [<alpha-value>|none]]? )","cmyk-component":"<number>|<percentage>|none","color-space":"<rectangular-color-space>|<polar-color-space>|<custom-color-space>",right:"<length>|auto","forgiving-selector-list":"<complex-real-selector-list>","forgiving-relative-selector-list":"<relative-real-selector-list>","complex-real-selector-list":"<complex-real-selector>#","simple-selector-list":"<simple-selector>#","relative-real-selector-list":"<relative-real-selector>#","complex-selector-unit":"[<compound-selector>? <pseudo-compound-selector>*]!","complex-real-selector":"<compound-selector> [<combinator>? <compound-selector>]*","relative-real-selector":"<combinator>? <complex-real-selector>","pseudo-compound-selector":"<pseudo-element-selector> <pseudo-class-selector>*","simple-selector":"<type-selector>|<subclass-selector>","legacy-pseudo-element-selector":"':' [before|after|first-line|first-letter]","svg-length":"<percentage>|<length>|<number>","svg-writing-mode":"lr-tb|rl-tb|tb-rl|lr|rl|tb",top:"<length>|auto",x:"<number>",y:"<number>",declaration:"<ident-token> : <declaration-value>? ['!' important]?","declaration-list":"[<declaration>? ';']* <declaration>?",url:"url( <string> <url-modifier>* )|<url-token>","url-modifier":"<ident>|<function-token> <any-value> )","number-zero-one":"<number [0,1]>","number-one-or-greater":"<number [1,\u221E]>","xyz-space":"xyz|xyz-d50|xyz-d65","style-condition":"not <style-in-parens>|<style-in-parens> [[and <style-in-parens>]*|[or <style-in-parens>]*]","-non-standard-display":"-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box","inset-area":"[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]",syntax:"'*'|<syntax-component> [<syntax-combinator> <syntax-component>]*|<syntax-string>","syntax-component":"<syntax-single-component> <syntax-multiplier>?|'<' transform-list '>'","syntax-single-component":"'<' <syntax-type-name> '>'|<ident>","syntax-type-name":"angle|color|custom-ident|image|integer|length|length-percentage|number|percentage|resolution|string|time|url|transform-function","syntax-combinator":"'|'","syntax-multiplier":"'#'|'+'","syntax-string":"<string>"},properties:{"--*":"<declaration-value>","-ms-accelerator":"false|true","-ms-block-progression":"tb|rl|bt|lr","-ms-content-zoom-chaining":"none|chained","-ms-content-zoom-limit":"<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>","-ms-content-zoom-limit-max":"<percentage>","-ms-content-zoom-limit-min":"<percentage>","-ms-content-zoom-snap":"<'-ms-content-zoom-snap-type'>||<'-ms-content-zoom-snap-points'>","-ms-content-zoom-snap-points":"snapInterval( <percentage> , <percentage> )|snapList( <percentage># )","-ms-content-zoom-snap-type":"none|proximity|mandatory","-ms-content-zooming":"none|zoom","-ms-filter":"<string>","-ms-flow-from":"[none|<custom-ident>]#","-ms-flow-into":"[none|<custom-ident>]#","-ms-grid-columns":"none|<track-list>|<auto-track-list>","-ms-grid-rows":"none|<track-list>|<auto-track-list>","-ms-high-contrast-adjust":"auto|none","-ms-hyphenate-limit-chars":"auto|<integer>{1,3}","-ms-hyphenate-limit-lines":"no-limit|<integer>","-ms-hyphenate-limit-zone":"<percentage>|<length>","-ms-ime-align":"auto|after","-ms-overflow-style":"auto|none|scrollbar|-ms-autohiding-scrollbar","-ms-scroll-chaining":"chained|none","-ms-scroll-limit":"<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>","-ms-scroll-limit-x-max":"auto|<length>","-ms-scroll-limit-x-min":"<length>","-ms-scroll-limit-y-max":"auto|<length>","-ms-scroll-limit-y-min":"<length>","-ms-scroll-rails":"none|railed","-ms-scroll-snap-points-x":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-points-y":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-type":"none|proximity|mandatory","-ms-scroll-snap-x":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>","-ms-scroll-snap-y":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>","-ms-scroll-translation":"none|vertical-to-horizontal","-ms-scrollbar-3dlight-color":"<color>","-ms-scrollbar-arrow-color":"<color>","-ms-scrollbar-base-color":"<color>","-ms-scrollbar-darkshadow-color":"<color>","-ms-scrollbar-face-color":"<color>","-ms-scrollbar-highlight-color":"<color>","-ms-scrollbar-shadow-color":"<color>","-ms-scrollbar-track-color":"<color>","-ms-text-autospace":"none|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space","-ms-touch-select":"grippers|none","-ms-user-select":"none|element|text","-ms-wrap-flow":"auto|both|start|end|maximum|clear","-ms-wrap-margin":"<length>","-ms-wrap-through":"wrap|none","-moz-appearance":"none|button|button-arrow-down|button-arrow-next|button-arrow-previous|button-arrow-up|button-bevel|button-focus|caret|checkbox|checkbox-container|checkbox-label|checkmenuitem|dualbutton|groupbox|listbox|listitem|menuarrow|menubar|menucheckbox|menuimage|menuitem|menuitemtext|menulist|menulist-button|menulist-text|menulist-textfield|menupopup|menuradio|menuseparator|meterbar|meterchunk|progressbar|progressbar-vertical|progresschunk|progresschunk-vertical|radio|radio-container|radio-label|radiomenuitem|range|range-thumb|resizer|resizerpanel|scale-horizontal|scalethumbend|scalethumb-horizontal|scalethumbstart|scalethumbtick|scalethumb-vertical|scale-vertical|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|separator|sheet|spinner|spinner-downbutton|spinner-textfield|spinner-upbutton|splitter|statusbar|statusbarpanel|tab|tabpanel|tabpanels|tab-scroll-arrow-back|tab-scroll-arrow-forward|textfield|textfield-multiline|toolbar|toolbarbutton|toolbarbutton-dropdown|toolbargripper|toolbox|tooltip|treeheader|treeheadercell|treeheadersortarrow|treeitem|treeline|treetwisty|treetwistyopen|treeview|-moz-mac-unified-toolbar|-moz-win-borderless-glass|-moz-win-browsertabbar-toolbox|-moz-win-communicationstext|-moz-win-communications-toolbox|-moz-win-exclude-glass|-moz-win-glass|-moz-win-mediatext|-moz-win-media-toolbox|-moz-window-button-box|-moz-window-button-box-maximized|-moz-window-button-close|-moz-window-button-maximize|-moz-window-button-minimize|-moz-window-button-restore|-moz-window-frame-bottom|-moz-window-frame-left|-moz-window-frame-right|-moz-window-titlebar|-moz-window-titlebar-maximized","-moz-binding":"<url>|none","-moz-border-bottom-colors":"<color>+|none","-moz-border-left-colors":"<color>+|none","-moz-border-right-colors":"<color>+|none","-moz-border-top-colors":"<color>+|none","-moz-context-properties":"none|[fill|fill-opacity|stroke|stroke-opacity]#","-moz-float-edge":"border-box|content-box|margin-box|padding-box","-moz-force-broken-image-icon":"0|1","-moz-orient":"inline|block|horizontal|vertical","-moz-outline-radius":"<outline-radius>{1,4} [/ <outline-radius>{1,4}]?","-moz-outline-radius-bottomleft":"<outline-radius>","-moz-outline-radius-bottomright":"<outline-radius>","-moz-outline-radius-topleft":"<outline-radius>","-moz-outline-radius-topright":"<outline-radius>","-moz-stack-sizing":"ignore|stretch-to-fit","-moz-text-blink":"none|blink","-moz-user-focus":"ignore|normal|select-after|select-before|select-menu|select-same|select-all|none","-moz-user-input":"auto|none|enabled|disabled","-moz-user-modify":"read-only|read-write|write-only","-moz-window-dragging":"drag|no-drag","-moz-window-shadow":"default|menu|tooltip|sheet|none","-webkit-appearance":"none|button|button-bevel|caps-lock-indicator|caret|checkbox|default-button|inner-spin-button|listbox|listitem|media-controls-background|media-controls-fullscreen-background|media-current-time-display|media-enter-fullscreen-button|media-exit-fullscreen-button|media-fullscreen-button|media-mute-button|media-overlay-play-button|media-play-button|media-seek-back-button|media-seek-forward-button|media-slider|media-sliderthumb|media-time-remaining-display|media-toggle-closed-captions-button|media-volume-slider|media-volume-slider-container|media-volume-sliderthumb|menulist|menulist-button|menulist-text|menulist-textfield|meter|progress-bar|progress-bar-value|push-button|radio|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbargripper-horizontal|scrollbargripper-vertical|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|searchfield-cancel-button|searchfield-decoration|searchfield-results-button|searchfield-results-decoration|slider-horizontal|slider-vertical|sliderthumb-horizontal|sliderthumb-vertical|square-button|textarea|textfield|-apple-pay-button","-webkit-border-before":"<'border-width'>||<'border-style'>||<color>","-webkit-border-before-color":"<color>","-webkit-border-before-style":"<'border-style'>","-webkit-border-before-width":"<'border-width'>","-webkit-box-reflect":"[above|below|right|left]? <length>? <image>?","-webkit-line-clamp":"none|<integer>","-webkit-mask":"[<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||[<visual-box>|border|padding|content|text]||[<visual-box>|border|padding|content]]#","-webkit-mask-attachment":"<attachment>#","-webkit-mask-clip":"[<coord-box>|no-clip|border|padding|content|text]#","-webkit-mask-composite":"<composite-style>#","-webkit-mask-image":"<mask-reference>#","-webkit-mask-origin":"[<coord-box>|border|padding|content]#","-webkit-mask-position":"<position>#","-webkit-mask-position-x":"[<length-percentage>|left|center|right]#","-webkit-mask-position-y":"[<length-percentage>|top|center|bottom]#","-webkit-mask-repeat":"<repeat-style>#","-webkit-mask-repeat-x":"repeat|no-repeat|space|round","-webkit-mask-repeat-y":"repeat|no-repeat|space|round","-webkit-mask-size":"<bg-size>#","-webkit-overflow-scrolling":"auto|touch","-webkit-tap-highlight-color":"<color>","-webkit-text-fill-color":"<color>","-webkit-text-stroke":"<length>||<color>","-webkit-text-stroke-color":"<color>","-webkit-text-stroke-width":"<length>","-webkit-touch-callout":"default|none","-webkit-user-modify":"read-only|read-write|read-write-plaintext-only","-webkit-user-select":"auto|none|text|all","accent-color":"auto|<color>","align-content":"normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>","align-items":"normal|stretch|<baseline-position>|[<overflow-position>? <self-position>]|anchor-center","align-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? <self-position>|anchor-center","align-tracks":"[normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>]#","alignment-baseline":"auto|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical",all:"initial|inherit|unset|revert|revert-layer","anchor-name":"none|<dashed-ident>#","anchor-scope":"none|all|<dashed-ident>#",animation:"<single-animation>#","animation-composition":"<single-animation-composition>#","animation-delay":"<time>#","animation-direction":"<single-animation-direction>#","animation-duration":"[auto|<time [0s,\u221E]>]#","animation-fill-mode":"<single-animation-fill-mode>#","animation-iteration-count":"<single-animation-iteration-count>#","animation-name":"[none|<keyframes-name>]#","animation-play-state":"<single-animation-play-state>#","animation-range":"[<'animation-range-start'> <'animation-range-end'>?]#","animation-range-end":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","animation-range-start":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","animation-timeline":"<single-animation-timeline>#","animation-timing-function":"<easing-function>#","animation-trigger":"[none|[<dashed-ident> <animation-action>+]+]#",appearance:"none|auto|<compat-auto>|<compat-special>","aspect-ratio":"auto||<ratio>","backdrop-filter":"none|<filter-value-list>","backface-visibility":"visible|hidden",background:"<bg-layer>#? , <final-bg-layer>","background-attachment":"<attachment>#","background-blend-mode":"<blend-mode>#","background-clip":"<bg-clip>#","background-color":"<color>","background-image":"<bg-image>#","background-origin":"<visual-box>#","background-position":"<bg-position>#","background-position-x":"[center|[[left|right|x-start|x-end]? <length-percentage>?]!]#","background-position-y":"[center|[[top|bottom|y-start|y-end]? <length-percentage>?]!]#","background-repeat":"<repeat-style>#","background-size":"<bg-size>#","baseline-shift":"baseline|sub|super|<svg-length>","baseline-source":"auto|first|last","block-size":"<'width'>",border:"<line-width>||<line-style>||<color>","border-block":"<'border-block-start'>","border-block-color":"<'border-top-color'>{1,2}","border-block-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-end-color":"<'border-top-color'>","border-block-end-style":"<'border-top-style'>","border-block-end-width":"<'border-top-width'>","border-block-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-start-color":"<'border-top-color'>","border-block-start-style":"<'border-top-style'>","border-block-start-width":"<'border-top-width'>","border-block-style":"<'border-top-style'>{1,2}","border-block-width":"<'border-top-width'>{1,2}","border-bottom":"<line-width>||<line-style>||<color>","border-bottom-color":"<'border-top-color'>","border-bottom-left-radius":"<length-percentage [0,\u221E]>{1,2}","border-bottom-right-radius":"<length-percentage [0,\u221E]>{1,2}","border-bottom-style":"<line-style>","border-bottom-width":"<line-width>","border-collapse":"separate|collapse","border-color":"<color>{1,4}","border-end-end-radius":"<'border-top-left-radius'>","border-end-start-radius":"<'border-top-left-radius'>","border-image":"<'border-image-source'>||<'border-image-slice'> [/ <'border-image-width'>|/ <'border-image-width'>? / <'border-image-outset'>]?||<'border-image-repeat'>","border-image-outset":"[<length [0,\u221E]>|<number [0,\u221E]>]{1,4}","border-image-repeat":"[stretch|repeat|round|space]{1,2}","border-image-slice":"[<number [0,\u221E]>|<percentage [0,\u221E]>]{1,4}&&fill?","border-image-source":"none|<image>","border-image-width":"[<length-percentage [0,\u221E]>|<number [0,\u221E]>|auto]{1,4}","border-inline":"<'border-block-start'>","border-inline-color":"<'border-top-color'>{1,2}","border-inline-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-end-color":"<'border-top-color'>","border-inline-end-style":"<'border-top-style'>","border-inline-end-width":"<'border-top-width'>","border-inline-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-start-color":"<'border-top-color'>","border-inline-start-style":"<'border-top-style'>","border-inline-start-width":"<'border-top-width'>","border-inline-style":"<'border-top-style'>{1,2}","border-inline-width":"<'border-top-width'>{1,2}","border-left":"<line-width>||<line-style>||<color>","border-left-color":"<color>","border-left-style":"<line-style>","border-left-width":"<line-width>","border-radius":"<length-percentage [0,\u221E]>{1,4} [/ <length-percentage [0,\u221E]>{1,4}]?","border-right":"<line-width>||<line-style>||<color>","border-right-color":"<color>","border-right-style":"<line-style>","border-right-width":"<line-width>","border-spacing":"<length>{1,2}","border-start-end-radius":"<'border-top-left-radius'>","border-start-start-radius":"<'border-top-left-radius'>","border-style":"<line-style>{1,4}","border-top":"<line-width>||<line-style>||<color>","border-top-color":"<color>","border-top-left-radius":"<length-percentage [0,\u221E]>{1,2}","border-top-right-radius":"<length-percentage [0,\u221E]>{1,2}","border-top-style":"<line-style>","border-top-width":"<line-width>","border-width":"<line-width>{1,4}",bottom:"auto|<length-percentage>|<anchor()>|<anchor-size()>","box-align":"start|center|end|baseline|stretch","box-decoration-break":"slice|clone","box-direction":"normal|reverse|inherit","box-flex":"<number>","box-flex-group":"<integer>","box-lines":"single|multiple","box-ordinal-group":"<integer>","box-orient":"horizontal|vertical|inline-axis|block-axis|inherit","box-pack":"start|center|end|justify","box-shadow":"none|<shadow>#","box-sizing":"content-box|border-box","break-after":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-before":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-inside":"auto|avoid|avoid-page|avoid-column|avoid-region","caption-side":"top|bottom",caret:"<'caret-color'>||<'caret-animation'>||<'caret-shape'>","caret-animation":"auto|manual","caret-color":"auto|<color>","caret-shape":"auto|bar|block|underscore",clear:"none|left|right|both|inline-start|inline-end",clip:"<shape>|auto","clip-path":"<clip-source>|[<basic-shape>||<geometry-box>]|none","clip-rule":"nonzero|evenodd",color:"<color>","color-interpolation-filters":"auto|sRGB|linearRGB","color-scheme":"normal|[light|dark|<custom-ident>]+&&only?","column-count":"<integer>|auto","column-fill":"auto|balance","column-gap":"normal|<length-percentage>","column-height":"auto|<length [0,\u221E]>","column-rule":"<'column-rule-width'>||<'column-rule-style'>||<'column-rule-color'>","column-rule-color":"<color>","column-rule-style":"<'border-style'>","column-rule-width":"<'border-width'>","column-span":"none|all","column-width":"auto|<length [0,\u221E]>","column-wrap":"auto|nowrap|wrap",columns:"[<'column-width'>||<'column-count'>] [/ <'column-height'>]?",contain:"none|strict|content|[[size||inline-size]||layout||style||paint]","contain-intrinsic-block-size":"auto? [none|<length>]","contain-intrinsic-height":"auto? [none|<length>]","contain-intrinsic-inline-size":"auto? [none|<length>]","contain-intrinsic-size":"[auto? [none|<length>]]{1,2}","contain-intrinsic-width":"auto? [none|<length>]",container:"<'container-name'> [/ <'container-type'>]?","container-name":"none|<custom-ident>+","container-type":"normal||[size|inline-size]",content:"normal|none|[<content-replacement>|<content-list>] [/ [<string>|<counter>|<attr()>]+]?","content-visibility":"visible|auto|hidden","corner-block-end-shape":"<corner-shape-value>{1,2}","corner-block-start-shape":"<corner-shape-value>{1,2}","corner-bottom-shape":"<corner-shape-value>{1,2}","corner-bottom-left-shape":"<corner-shape-value>","corner-bottom-right-shape":"<corner-shape-value>","corner-end-end-shape":"<corner-shape-value>","corner-end-start-shape":"<corner-shape-value>","corner-inline-end-shape":"<corner-shape-value>{1,2}","corner-inline-start-shape":"<corner-shape-value>{1,2}","corner-left-shape":"<corner-shape-value>{1,2}","corner-right-shape":"<corner-shape-value>{1,2}","corner-shape":"<corner-shape-value>{1,4}","corner-start-start-shape":"<corner-shape-value>","corner-start-end-shape":"<corner-shape-value>","corner-top-shape":"<corner-shape-value>{1,2}","corner-top-left-shape":"<corner-shape-value>","corner-top-right-shape":"<corner-shape-value>","counter-increment":"[<counter-name> <integer>?]+|none","counter-reset":"[<counter-name> <integer>?|<reversed-counter-name> <integer>?]+|none","counter-set":"[<counter-name> <integer>?]+|none",cursor:"[[<url> [<x> <y>]? ,]* [auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing|hand|-webkit-grab|-webkit-grabbing|-webkit-zoom-in|-webkit-zoom-out|-moz-grab|-moz-grabbing|-moz-zoom-in|-moz-zoom-out]]",cx:"<length>|<percentage>",cy:"<length>|<percentage>",d:"none|path( <string> )",direction:"ltr|rtl",display:"[<display-outside>||<display-inside>]|<display-listitem>|<display-internal>|<display-box>|<display-legacy>|<-non-standard-display>","dominant-baseline":"auto|use-script|no-change|reset-size|ideographic|alphabetic|hanging|mathematical|central|middle|text-after-edge|text-before-edge","dynamic-range-limit":"standard|no-limit|constrained|<dynamic-range-limit-mix()>","empty-cells":"show|hide","field-sizing":"content|fixed",fill:"<paint>","fill-opacity":"<number-zero-one>|<percentage>","fill-rule":"nonzero|evenodd",filter:"none|<filter-value-list>|<-ms-filter-function-list>",flex:"none|[<'flex-grow'> <'flex-shrink'>?||<'flex-basis'>]","flex-basis":"content|<'width'>","flex-direction":"row|row-reverse|column|column-reverse","flex-flow":"<'flex-direction'>||<'flex-wrap'>","flex-grow":"<number>","flex-shrink":"<number>","flex-wrap":"nowrap|wrap|wrap-reverse",float:"left|right|none|inline-start|inline-end","flood-color":"<color>","flood-opacity":"<'opacity'>",font:"[[<'font-style'>||<font-variant-css2>||<'font-weight'>||<font-width-css3>]? <'font-size'> [/ <'line-height'>]? <'font-family'>#]|<system-family-name>|<-non-standard-font>","font-family":"[<family-name>|<generic-family>]#","font-feature-settings":"normal|<feature-tag-value>#","font-kerning":"auto|normal|none","font-language-override":"normal|<string>","font-optical-sizing":"auto|none","font-palette":"normal|light|dark|<palette-identifier>|<palette-mix()>","font-size":"<absolute-size>|<relative-size>|<length-percentage [0,\u221E]>|math","font-size-adjust":"none|[ex-height|cap-height|ch-width|ic-width|ic-height]? [from-font|<number>]","font-smooth":"auto|never|always|<absolute-size>|<length>","font-stretch":"<font-stretch-absolute>","font-style":"normal|italic|oblique <angle>?","font-synthesis":"none|[weight||style||small-caps||position]","font-synthesis-position":"auto|none","font-synthesis-small-caps":"auto|none","font-synthesis-style":"auto|none","font-synthesis-weight":"auto|none","font-variant":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>||stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )||[small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps]||<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero||<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-alternates":"normal|[stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )]","font-variant-caps":"normal|small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","font-variant-east-asian":"normal|[<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-emoji":"normal|text|emoji|unicode","font-variant-ligatures":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>]","font-variant-numeric":"normal|[<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero]","font-variant-position":"normal|sub|super","font-variation-settings":"normal|[<string> <number>]#","font-weight":"<font-weight-absolute>|bolder|lighter","font-width":"normal|<percentage [0,\u221E]>|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded","forced-color-adjust":"auto|none|preserve-parent-color",gap:"<'row-gap'> <'column-gap'>?",grid:"<'grid-template'>|<'grid-template-rows'> / [auto-flow&&dense?] <'grid-auto-columns'>?|[auto-flow&&dense?] <'grid-auto-rows'>? / <'grid-template-columns'>","grid-area":"<grid-line> [/ <grid-line>]{0,3}","grid-auto-columns":"<track-size>+","grid-auto-flow":"[row|column]||dense","grid-auto-rows":"<track-size>+","grid-column":"<grid-line> [/ <grid-line>]?","grid-column-end":"<grid-line>","grid-column-gap":"<length-percentage>","grid-column-start":"<grid-line>","grid-gap":"<'grid-row-gap'> <'grid-column-gap'>?","grid-row":"<grid-line> [/ <grid-line>]?","grid-row-end":"<grid-line>","grid-row-gap":"<length-percentage>","grid-row-start":"<grid-line>","grid-template":"none|[<'grid-template-rows'> / <'grid-template-columns'>]|[<line-names>? <string> <track-size>? <line-names>?]+ [/ <explicit-track-list>]?","grid-template-areas":"none|<string>+","grid-template-columns":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","grid-template-rows":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","hanging-punctuation":"none|[first||[force-end|allow-end]||last]",height:"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","hyphenate-character":"auto|<string>","hyphenate-limit-chars":"[auto|<integer>]{1,3}",hyphens:"none|manual|auto","image-orientation":"from-image|<angle>|[<angle>? flip]","image-rendering":"auto|crisp-edges|pixelated|smooth|optimizeSpeed|optimizeQuality|<-non-standard-image-rendering>","image-resolution":"[from-image||<resolution>]&&snap?","ime-mode":"auto|normal|active|inactive|disabled","initial-letter":"normal|[<number> <integer>?]","initial-letter-align":"[auto|alphabetic|hanging|ideographic]","inline-size":"<'width'>",inset:"<'top'>{1,4}","inset-block":"<'top'>{1,2}","inset-block-end":"<'top'>","inset-block-start":"<'top'>","inset-inline":"<'top'>{1,2}","inset-inline-end":"<'top'>","inset-inline-start":"<'top'>","interpolate-size":"numeric-only|allow-keywords",isolation:"auto|isolate",interactivity:"auto|inert","interest-delay":"<'interest-delay-start'>{1,2}","interest-delay-end":"normal|<time>","interest-delay-start":"normal|<time>","justify-content":"normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]","justify-items":"normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|legacy|legacy&&[left|right|center]|anchor-center","justify-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|anchor-center","justify-tracks":"[normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]]#",left:"auto|<length-percentage>|<anchor()>|<anchor-size()>","letter-spacing":"normal|<length-percentage>","lighting-color":"<color>","line-break":"auto|loose|normal|strict|anywhere","line-clamp":"none|<integer>","line-height":"normal|<number>|<length>|<percentage>","line-height-step":"<length>","list-style":"<'list-style-type'>||<'list-style-position'>||<'list-style-image'>","list-style-image":"<image>|none","list-style-position":"inside|outside","list-style-type":"<counter-style>|<string>|none",margin:"<'margin-top'>{1,4}","margin-block":"<'margin-top'>{1,2}","margin-block-end":"<'margin-top'>","margin-block-start":"<'margin-top'>","margin-bottom":"<length-percentage>|auto|<anchor-size()>","margin-inline":"<'margin-top'>{1,2}","margin-inline-end":"<'margin-top'>","margin-inline-start":"<'margin-top'>","margin-left":"<length-percentage>|auto|<anchor-size()>","margin-right":"<length-percentage>|auto|<anchor-size()>","margin-top":"<length-percentage>|auto|<anchor-size()>","margin-trim":"none|in-flow|all",marker:"none|<url>","marker-end":"none|<url>","marker-mid":"none|<url>","marker-start":"none|<url>",mask:"<mask-layer>#","mask-border":"<'mask-border-source'>||<'mask-border-slice'> [/ <'mask-border-width'>? [/ <'mask-border-outset'>]?]?||<'mask-border-repeat'>||<'mask-border-mode'>","mask-border-mode":"luminance|alpha","mask-border-outset":"[<length>|<number>]{1,4}","mask-border-repeat":"[stretch|repeat|round|space]{1,2}","mask-border-slice":"<number-percentage>{1,4} fill?","mask-border-source":"none|<image>","mask-border-width":"[<length-percentage>|<number>|auto]{1,4}","mask-clip":"[<coord-box>|no-clip]#","mask-composite":"<compositing-operator>#","mask-image":"<mask-reference>#","mask-mode":"<masking-mode>#","mask-origin":"<coord-box>#","mask-position":"<position>#","mask-repeat":"<repeat-style>#","mask-size":"<bg-size>#","mask-type":"luminance|alpha","masonry-auto-flow":"[pack|next]||[definite-first|ordered]","math-depth":"auto-add|add( <integer> )|<integer>","math-shift":"normal|compact","math-style":"normal|compact","max-block-size":"<'max-width'>","max-height":"none|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","max-inline-size":"<'max-width'>","max-lines":"none|<integer>","max-width":"none|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","min-block-size":"<'min-width'>","min-height":"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","min-inline-size":"<'min-width'>","min-width":"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","mix-blend-mode":"<blend-mode>|plus-darker|plus-lighter","object-fit":"fill|contain|cover|none|scale-down","object-position":"<position>","object-view-box":"none|<basic-shape-rect>",offset:"[<'offset-position'>? [<'offset-path'> [<'offset-distance'>||<'offset-rotate'>]?]?]! [/ <'offset-anchor'>]?","offset-anchor":"auto|<position>","offset-distance":"<length-percentage>","offset-path":"none|<offset-path>||<coord-box>","offset-position":"normal|auto|<position>","offset-rotate":"[auto|reverse]||<angle>",opacity:"<opacity-value>",order:"<integer>",orphans:"<integer>",outline:"<'outline-width'>||<'outline-style'>||<'outline-color'>","outline-color":"auto|<color>","outline-offset":"<length>","outline-style":"auto|<outline-line-style>","outline-width":"<line-width>",overflow:"[visible|hidden|clip|scroll|auto]{1,2}|<-non-standard-overflow>","overflow-anchor":"auto|none","overflow-block":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-clip-box":"padding-box|content-box","overflow-clip-margin":"<visual-box>||<length [0,\u221E]>","overflow-inline":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-wrap":"normal|break-word|anywhere","overflow-x":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-y":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>",overlay:"none|auto","overscroll-behavior":"[contain|none|auto]{1,2}","overscroll-behavior-block":"contain|none|auto","overscroll-behavior-inline":"contain|none|auto","overscroll-behavior-x":"contain|none|auto","overscroll-behavior-y":"contain|none|auto",padding:"<'padding-top'>{1,4}","padding-block":"<'padding-top'>{1,2}","padding-block-end":"<'padding-top'>","padding-block-start":"<'padding-top'>","padding-bottom":"<length-percentage [0,\u221E]>","padding-inline":"<'padding-top'>{1,2}","padding-inline-end":"<'padding-top'>","padding-inline-start":"<'padding-top'>","padding-left":"<length-percentage [0,\u221E]>","padding-right":"<length-percentage [0,\u221E]>","padding-top":"<length-percentage [0,\u221E]>",page:"auto|<custom-ident>","page-break-after":"auto|always|avoid|left|right|recto|verso","page-break-before":"auto|always|avoid|left|right|recto|verso","page-break-inside":"auto|avoid","paint-order":"normal|[fill||stroke||markers]",perspective:"none|<length>","perspective-origin":"<position>","place-content":"<'align-content'> <'justify-content'>?","place-items":"<'align-items'> <'justify-items'>?","place-self":"<'align-self'> <'justify-self'>?","pointer-events":"auto|none|visiblePainted|visibleFill|visibleStroke|visible|painted|fill|stroke|all|inherit",position:"static|relative|absolute|sticky|fixed|-webkit-sticky","position-anchor":"auto|none|<anchor-name>","position-area":"none|<position-area>","position-try":"<'position-try-order'>? <'position-try-fallbacks'>","position-try-fallbacks":"none|[[<dashed-ident>||<try-tactic>]|<'position-area'>]#","position-try-order":"normal|<try-size>","position-visibility":"always|[anchors-valid||anchors-visible||no-overflow]","print-color-adjust":"economy|exact",quotes:"none|auto|[<string> <string>]+",r:"<length>|<percentage>","reading-flow":"normal|source-order|flex-visual|flex-flow|grid-rows|grid-columns|grid-order","reading-order":"<integer>",resize:"none|both|horizontal|vertical|block|inline",right:"auto|<length-percentage>|<anchor()>|<anchor-size()>",rotate:"none|<angle>|[x|y|z|<number>{3}]&&<angle>","row-gap":"normal|<length-percentage>","ruby-align":"start|center|space-between|space-around","ruby-merge":"separate|collapse|auto","ruby-overhang":"auto|none","ruby-position":"[alternate||[over|under]]|inter-character",rx:"<length>|<percentage>",ry:"<length>|<percentage>",scale:"none|[<number>|<percentage>]{1,3}","scroll-behavior":"auto|smooth","scroll-initial-target":"none|nearest","scroll-margin":"<length>{1,4}","scroll-margin-block":"<length>{1,2}","scroll-margin-block-end":"<length>","scroll-margin-block-start":"<length>","scroll-margin-bottom":"<length>","scroll-margin-inline":"<length>{1,2}","scroll-margin-inline-end":"<length>","scroll-margin-inline-start":"<length>","scroll-margin-left":"<length>","scroll-margin-right":"<length>","scroll-margin-top":"<length>","scroll-marker-group":"none|before|after","scroll-padding":"[auto|<length-percentage>]{1,4}","scroll-padding-block":"[auto|<length-percentage>]{1,2}","scroll-padding-block-end":"auto|<length-percentage>","scroll-padding-block-start":"auto|<length-percentage>","scroll-padding-bottom":"auto|<length-percentage>","scroll-padding-inline":"[auto|<length-percentage>]{1,2}","scroll-padding-inline-end":"auto|<length-percentage>","scroll-padding-inline-start":"auto|<length-percentage>","scroll-padding-left":"auto|<length-percentage>","scroll-padding-right":"auto|<length-percentage>","scroll-padding-top":"auto|<length-percentage>","scroll-snap-align":"[none|start|end|center]{1,2}","scroll-snap-coordinate":"none|<position>#","scroll-snap-destination":"<position>","scroll-snap-points-x":"none|repeat( <length-percentage> )","scroll-snap-points-y":"none|repeat( <length-percentage> )","scroll-snap-stop":"normal|always","scroll-snap-type":"none|[x|y|block|inline|both] [mandatory|proximity]?","scroll-snap-type-x":"none|mandatory|proximity","scroll-snap-type-y":"none|mandatory|proximity","scroll-target-group":"none|auto","scroll-timeline":"[<'scroll-timeline-name'> <'scroll-timeline-axis'>?]#","scroll-timeline-axis":"[block|inline|x|y]#","scroll-timeline-name":"[none|<dashed-ident>]#","scrollbar-color":"auto|<color>{2}","scrollbar-gutter":"auto|stable&&both-edges?","scrollbar-width":"auto|thin|none","shape-image-threshold":"<opacity-value>","shape-margin":"<length-percentage>","shape-outside":"none|[<shape-box>||<basic-shape>]|<image>","shape-rendering":"auto|optimizeSpeed|crispEdges|geometricPrecision","speak-as":"normal|spell-out||digits||[literal-punctuation|no-punctuation]","stop-color":"<'color'>","stop-opacity":"<'opacity'>",stroke:"<paint>","stroke-color":"<color>","stroke-dasharray":"none|[<svg-length>+]#","stroke-dashoffset":"<svg-length>","stroke-linecap":"butt|round|square","stroke-linejoin":"miter|round|bevel","stroke-miterlimit":"<number-one-or-greater>","stroke-opacity":"<'opacity'>","stroke-width":"<svg-length>","tab-size":"<integer>|<length>","table-layout":"auto|fixed","text-align":"start|end|left|right|center|justify|match-parent","text-align-last":"auto|start|end|left|right|center|justify","text-anchor":"start|middle|end","text-autospace":"normal|<autospace>|auto","text-box":"normal|<'text-box-trim'>||<'text-box-edge'>","text-box-edge":"auto|<text-edge>","text-box-trim":"none|trim-start|trim-end|trim-both","text-combine-upright":"none|all|[digits <integer>?]","text-decoration":"<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>","text-decoration-color":"<color>","text-decoration-inset":"<length>{1,2}|auto","text-decoration-line":"none|[underline||overline||line-through||blink]|spelling-error|grammar-error","text-decoration-skip":"none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]","text-decoration-skip-ink":"auto|all|none","text-decoration-style":"solid|double|dotted|dashed|wavy","text-decoration-thickness":"auto|from-font|<length>|<percentage>","text-emphasis":"<'text-emphasis-style'>||<'text-emphasis-color'>","text-emphasis-color":"<color>","text-emphasis-position":"auto|[over|under]&&[right|left]?","text-emphasis-style":"none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>","text-indent":"<length-percentage>&&hanging?&&each-line?","text-justify":"auto|inter-character|inter-word|none","text-orientation":"mixed|upright|sideways","text-overflow":"[clip|ellipsis|<string>]{1,2}","text-rendering":"auto|optimizeSpeed|optimizeLegibility|geometricPrecision","text-shadow":"none|<shadow-t>#","text-size-adjust":"none|auto|<percentage>","text-spacing-trim":"space-all|normal|space-first|trim-start","text-transform":"none|[capitalize|uppercase|lowercase]||full-width||full-size-kana|math-auto","text-underline-offset":"auto|<length>|<percentage>","text-underline-position":"auto|from-font|[under||[left|right]]","text-wrap":"<'text-wrap-mode'>||<'text-wrap-style'>","text-wrap-mode":"wrap|nowrap","text-wrap-style":"auto|balance|stable|pretty","timeline-scope":"none|<dashed-ident>#","timeline-trigger":"none|[<'timeline-trigger-name'> <'timeline-trigger-source'> <'timeline-trigger-range'> ['/' <'timeline-trigger-exit-range'>]?]#","timeline-trigger-name":"none|<dashed-ident>#","timeline-trigger-exit-range":"[<'timeline-trigger-exit-range-start'> <'timeline-trigger-exit-range-end'>?]#","timeline-trigger-exit-range-end":"[auto|normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-exit-range-start":"[auto|normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-range":"[<'timeline-trigger-range-start'> <'timeline-trigger-range-end'>?]#","timeline-trigger-range-end":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-range-start":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-source":"<single-animation-timeline>#",top:"auto|<length-percentage>|<anchor()>|<anchor-size()>","touch-action":"auto|none|[[pan-x|pan-left|pan-right]||[pan-y|pan-up|pan-down]||pinch-zoom]|manipulation",transform:"none|<transform-list>","transform-box":"content-box|border-box|fill-box|stroke-box|view-box","transform-origin":"[<length-percentage>|left|center|right|top|bottom]|[[<length-percentage>|left|center|right]&&[<length-percentage>|top|center|bottom]] <length>?","transform-style":"flat|preserve-3d",transition:"<single-transition>#","transition-behavior":"<transition-behavior-value>#","transition-delay":"<time>#","transition-duration":"<time>#","transition-property":"none|<single-transition-property>#","transition-timing-function":"<easing-function>#",translate:"none|<length-percentage> [<length-percentage> <length>?]?","trigger-scope":"none|all|<dashed-ident>#","unicode-bidi":"normal|embed|isolate|bidi-override|isolate-override|plaintext|-moz-isolate|-moz-isolate-override|-moz-plaintext|-webkit-isolate|-webkit-isolate-override|-webkit-plaintext","user-select":"auto|text|none|all","vector-effect":"none|non-scaling-stroke|non-scaling-size|non-rotation|fixed-position","vertical-align":"baseline|sub|super|text-top|text-bottom|middle|top|bottom|<percentage>|<length>","view-timeline":"[<'view-timeline-name'> [<'view-timeline-axis'>||<'view-timeline-inset'>]?]#","view-timeline-axis":"[block|inline|x|y]#","view-timeline-inset":"[[auto|<length-percentage>]{1,2}]#","view-timeline-name":"[none|<dashed-ident>]#","view-transition-class":"none|<custom-ident>+","view-transition-name":"none|<custom-ident>|match-element",visibility:"visible|hidden|collapse","white-space":"normal|pre|pre-wrap|pre-line|<'white-space-collapse'>||<'text-wrap-mode'>","white-space-collapse":"collapse|preserve|preserve-breaks|preserve-spaces|break-spaces",widows:"<integer>",width:"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","will-change":"auto|<animateable-feature>#","word-break":"normal|break-all|keep-all|break-word|auto-phrase","word-spacing":"normal|<length>","word-wrap":"normal|break-word","writing-mode":"horizontal-tb|vertical-rl|vertical-lr|sideways-rl|sideways-lr|<svg-writing-mode>",x:"<length>|<percentage>",y:"<length>|<percentage>","z-index":"auto|<integer>",zoom:"normal|reset|<number [0,\u221E]>||<percentage [0,\u221E]>","-moz-background-clip":"padding|border","-moz-border-radius-bottomleft":"<'border-bottom-left-radius'>","-moz-border-radius-bottomright":"<'border-bottom-right-radius'>","-moz-border-radius-topleft":"<'border-top-left-radius'>","-moz-border-radius-topright":"<'border-bottom-right-radius'>","-moz-control-character-visibility":"visible|hidden","-moz-osx-font-smoothing":"auto|grayscale","-moz-user-select":"none|text|all|-moz-none","-ms-flex-align":"start|end|center|baseline|stretch","-ms-flex-item-align":"auto|start|end|center|baseline|stretch","-ms-flex-line-pack":"start|end|center|justify|distribute|stretch","-ms-flex-negative":"<'flex-shrink'>","-ms-flex-pack":"start|end|center|justify|distribute","-ms-flex-order":"<integer>","-ms-flex-positive":"<'flex-grow'>","-ms-flex-preferred-size":"<'flex-basis'>","-ms-interpolation-mode":"nearest-neighbor|bicubic","-ms-grid-column-align":"start|end|center|stretch","-ms-grid-row-align":"start|end|center|stretch","-ms-hyphenate-limit-last":"none|always|column|page|spread","-webkit-background-clip":"[<visual-box>|border|padding|content|text]#","-webkit-column-break-after":"always|auto|avoid","-webkit-column-break-before":"always|auto|avoid","-webkit-column-break-inside":"always|auto|avoid","-webkit-font-smoothing":"auto|none|antialiased|subpixel-antialiased","-webkit-mask-box-image":"[<url>|<gradient>|none] [<length-percentage>{4} <-webkit-mask-box-repeat>{2}]?","-webkit-print-color-adjust":"economy|exact","-webkit-text-security":"none|circle|disc|square","-webkit-user-drag":"none|element|auto",behavior:"<url>+",cue:"<'cue-before'> <'cue-after'>?","cue-after":"<url> <decibel>?|none","cue-before":"<url> <decibel>?|none","glyph-orientation-horizontal":"<angle>","glyph-orientation-vertical":"<angle>",kerning:"auto|<svg-length>",pause:"<'pause-before'> <'pause-after'>?","pause-after":"<time>|none|x-weak|weak|medium|strong|x-strong","pause-before":"<time>|none|x-weak|weak|medium|strong|x-strong","position-try-options":"<'position-try-fallbacks'>",rest:"<'rest-before'> <'rest-after'>?","rest-after":"<time>|none|x-weak|weak|medium|strong|x-strong","rest-before":"<time>|none|x-weak|weak|medium|strong|x-strong",speak:"auto|never|always","voice-balance":"<number>|left|center|right|leftwards|rightwards","voice-duration":"auto|<time>","voice-family":"[[<family-name>|<generic-voice>] ,]* [<family-name>|<generic-voice>]|preserve","voice-pitch":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-range":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-rate":"[normal|x-slow|slow|medium|fast|x-fast]||<percentage>","voice-stress":"normal|strong|moderate|none|reduced","voice-volume":"silent|[[x-soft|soft|medium|loud|x-loud]||<decibel>]","white-space-trim":"none|discard-before||discard-after||discard-inner"},atrules:{charset:{prelude:"<string>",descriptors:null},"counter-style":{prelude:"<counter-style-name>",descriptors:{"additive-symbols":"[<integer [0,\u221E]>&&<symbol>]#",fallback:"<counter-style-name>",negative:"<symbol> <symbol>?",pad:"<integer [0,\u221E]>&&<symbol>",prefix:"<symbol>",range:"[[<integer>|infinite]{2}]#|auto","speak-as":"auto|bullets|numbers|words|spell-out|<counter-style-name>",suffix:"<symbol>",symbols:"<symbol>+",system:"cyclic|numeric|alphabetic|symbolic|additive|[fixed <integer>?]|[extends <counter-style-name>]"}},container:{prelude:"[<container-name>]? <container-condition>",descriptors:null},document:{prelude:"[<url>|url-prefix( <string> )|domain( <string> )|media-document( <string> )|regexp( <string> )]#",descriptors:null},"font-face":{prelude:null,descriptors:{"ascent-override":"normal|<percentage>","descent-override":"normal|<percentage>","font-display":"auto|block|swap|fallback|optional","font-family":"<family-name>","font-feature-settings":"normal|<feature-tag-value>#","font-stretch":"<font-stretch-absolute>{1,2}","font-style":"normal|italic|oblique <angle>{0,2}","font-variation-settings":"normal|[<string> <number>]#","font-weight":"<font-weight-absolute>{1,2}","line-gap-override":"normal|<percentage>","size-adjust":"<percentage>",src:"[<url> [format( <string># )]?|local( <family-name> )]#","unicode-range":"<urange>#"}},"font-feature-values":{prelude:"<family-name>#",descriptors:null},"font-palette-values":{prelude:"<dashed-ident>",descriptors:{"base-palette":"light|dark|<integer [0,\u221E]>","font-family":"<family-name>#","override-colors":"[<integer [0,\u221E]> <color>]#"}},import:{prelude:"[<string>|<url>] [layer|layer( <layer-name> )]? [supports( [<supports-condition>|<declaration>] )]? <media-query-list>?",descriptors:null},keyframes:{prelude:"<keyframes-name>",descriptors:null},layer:{prelude:"[<layer-name>#|<layer-name>?]",descriptors:null},media:{prelude:"<media-query-list>",descriptors:null},namespace:{prelude:"<namespace-prefix>? [<string>|<url>]",descriptors:null},page:{prelude:"<page-selector-list>",descriptors:{bleed:"auto|<length>",marks:"none|[crop||cross]","page-orientation":"upright|rotate-left|rotate-right",size:"<length [0,\u221E]>{1,2}|auto|[<page-size>||[portrait|landscape]]"}},"position-try":{prelude:"<dashed-ident>",descriptors:{top:"<'top'>",left:"<'left'>",bottom:"<'bottom'>",right:"<'right'>","inset-block-start":"<'inset-block-start'>","inset-block-end":"<'inset-block-end'>","inset-inline-start":"<'inset-inline-start'>","inset-inline-end":"<'inset-inline-end'>","inset-block":"<'inset-block'>","inset-inline":"<'inset-inline'>",inset:"<'inset'>","margin-top":"<'margin-top'>","margin-left":"<'margin-left'>","margin-bottom":"<'margin-bottom'>","margin-right":"<'margin-right'>","margin-block-start":"<'margin-block-start'>","margin-block-end":"<'margin-block-end'>","margin-inline-start":"<'margin-inline-start'>","margin-inline-end":"<'margin-inline-end'>",margin:"<'margin'>","margin-block":"<'margin-block'>","margin-inline":"<'margin-inline'>",width:"<'width'>",height:"<'height'>","min-width":"<'min-width'>","min-height":"<'min-height'>","max-width":"<'max-width'>","max-height":"<'max-height'>","block-size":"<'block-size'>","inline-size":"<'inline-size'>","min-block-size":"<'min-block-size'>","min-inline-size":"<'min-inline-size'>","max-block-size":"<'max-block-size'>","max-inline-size":"<'max-inline-size'>","align-self":"<'align-self'>|anchor-center","justify-self":"<'justify-self'>|anchor-center"}},property:{prelude:"<custom-property-name>",descriptors:{inherits:"true|false","initial-value":"<declaration-value>?",syntax:"<string>"}},scope:{prelude:"[( <scope-start> )]? [to ( <scope-end> )]?",descriptors:null},"starting-style":{prelude:null,descriptors:null},supports:{prelude:"<supports-condition>",descriptors:null},"view-transition":{prelude:null,descriptors:{navigation:"auto|none",types:"none|<custom-ident>+"}},"font-features-values":{prelude:"[<string>|<custom-ident>]+",descriptors:{"font-display":"auto|block|swap|fallback|optional"}}}}});var mh={};Le(mh,{generate:()=>R$,name:()=>T$,parse:()=>gh,structure:()=>I$});function kd(e,t){let r=this.tokenStart+e,n=this.charCodeAt(r);for((n===ni||n===Xn)&&(t&&this.error("Number sign is not allowed"),r++);r<this.tokenEnd;r++)wr(this.charCodeAt(r))||this.error("Integer is expected",r)}function il(e){return kd.call(this,0,e)}function fa(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let r="";switch(t){case Sd:r="N is expected";break;case Xn:r="HyphenMinus is expected";break}this.error(r,this.tokenStart+e)}}function fh(){let e=0,t=0,r=this.tokenType;for(;r===13||r===25;)r=this.lookupType(++e);if(r!==10)if(this.isDelim(ni,e)||this.isDelim(Xn,e)){t=this.isDelim(ni,e)?ni:Xn;do r=this.lookupType(++e);while(r===13||r===25);r!==10&&(this.skip(e),il.call(this,Xa))}else return null;return e>0&&this.skip(e),t===0&&(r=this.charCodeAt(this.tokenStart),r!==ni&&r!==Xn&&this.error("Number sign is expected")),il.call(this,t!==0),t===Xn?"-"+this.consume(10):this.consume(10)}function gh(){let e=this.tokenStart,t=null,r=null;if(this.tokenType===10)il.call(this,E$),r=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,Xn))switch(t="-1",fa.call(this,1,Sd),this.tokenEnd-this.tokenStart){case 2:this.next(),r=fh.call(this);break;case 3:fa.call(this,2,Xn),this.next(),this.skipSC(),il.call(this,Xa),r="-"+this.consume(10);break;default:fa.call(this,2,Xn),kd.call(this,3,Xa),this.next(),r=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(ni)&&this.lookupType(1)===1){let n=0;switch(t="1",this.isDelim(ni)&&(n=1,this.next()),fa.call(this,0,Sd),this.tokenEnd-this.tokenStart){case 1:this.next(),r=fh.call(this);break;case 2:fa.call(this,1,Xn),this.next(),this.skipSC(),il.call(this,Xa),r="-"+this.consume(10);break;default:fa.call(this,1,Xn),kd.call(this,2,Xa),this.next(),r=this.substrToCursor(e+n+1)}}else if(this.tokenType===12){let n=this.charCodeAt(this.tokenStart),o=n===ni||n===Xn,i=this.tokenStart+o;for(;i<this.tokenEnd&&wr(this.charCodeAt(i));i++);i===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),fa.call(this,i-this.tokenStart,Sd),t=this.substring(e,i),i+1===this.tokenEnd?(this.next(),r=fh.call(this)):(fa.call(this,i-this.tokenStart+1,Xn),i+2===this.tokenEnd?(this.next(),this.skipSC(),il.call(this,Xa),r="-"+this.consume(10)):(kd.call(this,i-this.tokenStart+2,Xa),this.next(),r=this.substrToCursor(i+1)))}else this.error();return t!==null&&t.charCodeAt(0)===ni&&(t=t.substr(1)),r!==null&&r.charCodeAt(0)===ni&&(r=r.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:r}}function R$(e){if(e.a){let t=e.a==="+1"&&"n"||e.a==="1"&&"n"||e.a==="-1"&&"-n"||e.a+"n";if(e.b){let r=e.b[0]==="-"||e.b[0]==="+"?e.b:"+"+e.b;this.tokenize(t+r)}else this.tokenize(t)}else this.tokenize(e.b)}var ni,Xn,Sd,Xa,E$,T$,I$,hh=H(()=>{"use strict";so();ni=43,Xn=45,Sd=110,Xa=!0,E$=!1;T$="AnPlusB",I$={a:[String,null],b:[String,null]}});var yh={};Le(yh,{generate:()=>L$,name:()=>F$,parse:()=>xh,structure:()=>P$,walkContext:()=>M$});function I4(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function A$(){for(let e=1,t;t=this.lookupType(e);e++){if(t===24)return!0;if(t===23||t===3)return!1}return!1}function xh(e=!1){let t=this.tokenStart,r,n,o=null,i=null;switch(this.eat(3),r=this.substrToCursor(t+1),n=r.toLowerCase(),this.skipSC(),this.eof===!1&&this.tokenType!==23&&this.tokenType!==17&&(this.parseAtrulePrelude?o=this.parseWithFallback(this.AtrulePrelude.bind(this,r,e),I4):o=I4.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case 17:this.next();break;case 23:hasOwnProperty.call(this.atrule,n)&&typeof this.atrule[n].block=="function"?i=this.atrule[n].block.call(this,e):i=this.Block(A$.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:r,prelude:o,block:i}}function L$(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}var F$,M$,P$,bh=H(()=>{"use strict";F$="Atrule",M$="atrule",P$={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]}});var vh={};Le(vh,{generate:()=>D$,name:()=>_$,parse:()=>wh,structure:()=>z$,walkContext:()=>B$});function wh(e){let t=null;return e!==null&&(e=e.toLowerCase()),this.skipSC(),hasOwnProperty.call(this.atrule,e)&&typeof this.atrule[e].prelude=="function"?t=this.atrule[e].prelude.call(this):t=this.readSequence(this.scope.AtrulePrelude),this.skipSC(),this.eof!==!0&&this.tokenType!==23&&this.tokenType!==17&&this.error("Semicolon or block is expected"),{type:"AtrulePrelude",loc:this.getLocationFromList(t),children:t}}function D$(e){this.children(e)}var _$,B$,z$,Sh=H(()=>{"use strict";_$="AtrulePrelude",B$="atrulePrelude",z$={children:[[]]}});var Eh={};Le(Eh,{generate:()=>W$,name:()=>j$,parse:()=>Ch,structure:()=>V$});function H$(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(R4)?(t=!0,this.next()):this.isDelim(kh)||this.eat(1),this.isDelim(kh)?this.charCodeAt(this.tokenStart+1)!==Cd?(this.next(),this.eat(1)):t&&this.error("Identifier is expected",this.tokenEnd):t&&this.error("Vertical line is expected"),{type:"Identifier",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function U$(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==Cd&&t!==$$&&t!==O$&&t!==N$&&t!==R4&&t!==kh&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==Cd&&(this.isDelim(Cd)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}function Ch(){let e=this.tokenStart,t,r=null,n=null,o=null;return this.eat(19),this.skipSC(),t=H$.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(r=U$.call(this),this.skipSC(),n=this.tokenType===5?this.String():this.Identifier(),this.skipSC()),this.tokenType===1&&(o=this.consume(1),this.skipSC())),this.eat(20),{type:"AttributeSelector",loc:this.getLocation(e,this.tokenStart),name:t,matcher:r,value:n,flags:o}}function W$(e){this.token(9,"["),this.node(e.name),e.matcher!==null&&(this.tokenize(e.matcher),this.node(e.value)),e.flags!==null&&this.token(1,e.flags),this.token(9,"]")}var N$,R4,Cd,O$,kh,$$,j$,V$,Th=H(()=>{"use strict";N$=36,R4=42,Cd=61,O$=94,kh=124,$$=126;j$="AttributeSelector",V$={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]}});var Rh={};Le(Rh,{generate:()=>J$,name:()=>Y$,parse:()=>Ih,structure:()=>X$,walkContext:()=>K$});function M4(){return this.Raw(null,!0)}function A4(){return this.parseWithFallback(this.Rule,M4)}function F4(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function q$(){if(this.tokenType===17)return F4.call(this,this.tokenIndex);let e=this.parseWithFallback(this.Declaration,F4);return this.tokenType===17&&this.next(),e}function Ih(e){let t=e?q$:A4,r=this.tokenStart,n=this.createList();this.eat(23);e:for(;!this.eof;)switch(this.tokenType){case 24:break e;case 13:case 25:this.next();break;case 3:n.push(this.parseWithFallback(this.Atrule.bind(this,e),M4));break;default:e&&this.isDelim(G$)?n.push(A4.call(this)):n.push(t.call(this))}return this.eof||this.eat(24),{type:"Block",loc:this.getLocation(r,this.tokenStart),children:n}}function J$(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}var G$,Y$,K$,X$,Ah=H(()=>{"use strict";G$=38;Y$="Block",K$="block",X$={children:[["Atrule","Rule","Declaration"]]}});var Mh={};Le(Mh,{generate:()=>eH,name:()=>Q$,parse:()=>Fh,structure:()=>Z$});function Fh(e,t){let r=this.tokenStart,n=null;return this.eat(19),n=e.call(this,t),this.eof||this.eat(20),{type:"Brackets",loc:this.getLocation(r,this.tokenStart),children:n}}function eH(e){this.token(9,"["),this.children(e),this.token(9,"]")}var Q$,Z$,Ph=H(()=>{"use strict";Q$="Brackets",Z$={children:[[]]}});var _h={};Le(_h,{generate:()=>nH,name:()=>tH,parse:()=>Lh,structure:()=>rH});function Lh(){let e=this.tokenStart;return this.eat(15),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function nH(){this.token(15,"-->")}var tH,rH,Bh=H(()=>{"use strict";tH="CDC",rH=[]});var Dh={};Le(Dh,{generate:()=>aH,name:()=>oH,parse:()=>zh,structure:()=>iH});function zh(){let e=this.tokenStart;return this.eat(14),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function aH(){this.token(14,"<!--")}var oH,iH,Nh=H(()=>{"use strict";oH="CDO",iH=[]});var $h={};Le($h,{generate:()=>uH,name:()=>lH,parse:()=>Oh,structure:()=>cH});function Oh(){return this.eatDelim(sH),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function uH(e){this.token(9,"."),this.token(1,e.name)}var sH,lH,cH,Hh=H(()=>{"use strict";sH=46,lH="ClassSelector",cH={name:String}});var jh={};Le(jh,{generate:()=>hH,name:()=>gH,parse:()=>Uh,structure:()=>mH});function Uh(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case dH:case pH:case fH:this.next();break;case P4:this.next(),this.eatIdent("deep"),this.eatDelim(P4);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function hH(e){this.tokenize(e.name)}var pH,P4,dH,fH,gH,mH,Vh=H(()=>{"use strict";pH=43,P4=47,dH=62,fH=126,gH="Combinator",mH={name:String}});var Gh={};Le(Gh,{generate:()=>vH,name:()=>bH,parse:()=>Wh,structure:()=>wH});function Wh(){let e=this.tokenStart,t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===xH&&this.charCodeAt(t-1)===yH&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function vH(e){this.token(25,"/*"+e.value+"*/")}var xH,yH,bH,wH,qh=H(()=>{"use strict";xH=42,yH=47,bH="Comment",wH={value:String}});var Kh={};Le(Kh,{generate:()=>TH,name:()=>kH,parse:()=>Yh,structure:()=>CH});function L4(e){return this.lookupTypeNonSC(1)===1&&SH.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}function Yh(e="media"){let t=this.createList();e:for(;!this.eof;)switch(this.tokenType){case 25:case 13:this.next();continue;case 1:t.push(this.Identifier());break;case 21:{let r=this.parseWithFallback(()=>EH[e].call(this,e),()=>null);r||(r=this.parseWithFallback(()=>{this.eat(21);let n=this.Condition(e);return this.eat(22),n},()=>this.GeneralEnclosed(e))),t.push(r);break}case 2:{let r=this.parseWithFallback(()=>this.FeatureFunction(e),()=>null);r||(r=this.GeneralEnclosed(e)),t.push(r);break}default:break e}return t.isEmpty&&this.error("Condition is expected"),{type:"Condition",loc:this.getLocationFromList(t),kind:e,children:t}}function TH(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(21,"("),this.node(t),this.token(22,")")):this.node(t)})}var SH,kH,CH,EH,Xh=H(()=>{"use strict";SH=new Set([16,22,0]),kH="Condition",CH={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};EH={media:L4,container:L4,supports(){return this.SupportsDeclaration()}}});var Qh={};Le(Qh,{generate:()=>NH,name:()=>BH,parse:()=>Jh,structure:()=>DH,walkContext:()=>zH});function PH(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function LH(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function _H(){let e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==17&&this.isDelim(B4)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}function Jh(){let e=this.tokenStart,t=this.tokenIndex,r=OH.call(this),n=ud(r),o=n?this.parseCustomProperty:this.parseValue,i=n?LH:PH,a=!1,s;this.skipSC(),this.eat(16);let l=this.tokenIndex;if(n||this.skipSC(),o?s=this.parseWithFallback(_H,i):s=i.call(this,this.tokenIndex),n&&s.type==="Value"&&s.children.isEmpty){for(let u=l-this.tokenIndex;u<=0;u++)if(this.lookupType(u)===13){s.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}return this.isDelim(B4)&&(a=$H.call(this),this.skipSC()),this.eof===!1&&this.tokenType!==17&&this.isBalanceEdge(t)===!1&&this.error(),{type:"Declaration",loc:this.getLocation(e,this.tokenStart),important:a,property:r,value:s}}function NH(e){this.token(1,e.property),this.token(16,":"),this.node(e.value),e.important&&(this.token(9,"!"),this.token(1,e.important===!0?"important":e.important))}function OH(){let e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case FH:case RH:case MH:case IH:case AH:this.next();break;case _4:this.next(),this.isDelim(_4)&&this.next();break}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function $H(){this.eat(9),this.skipSC();let e=this.consume(1);return e==="important"?!0:e}var B4,IH,RH,AH,FH,MH,_4,BH,zH,DH,Zh=H(()=>{"use strict";pd();B4=33,IH=35,RH=36,AH=38,FH=42,MH=43,_4=47;BH="Declaration",zH="declaration",DH={important:[Boolean,String],property:String,value:["Value","Raw"]}});var r1={};Le(r1,{generate:()=>VH,name:()=>UH,parse:()=>t1,structure:()=>jH});function e1(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function t1(){let e=this.createList();for(;!this.eof;)switch(this.tokenType){case 13:case 25:case 17:this.next();break;case 3:e.push(this.parseWithFallback(this.Atrule.bind(this,!0),e1));break;default:this.isDelim(HH)?e.push(this.parseWithFallback(this.Rule,e1)):e.push(this.parseWithFallback(this.Declaration,e1))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function VH(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}var HH,UH,jH,n1=H(()=>{"use strict";HH=38;UH="DeclarationList",jH={children:[["Declaration","Atrule","Rule"]]}});var i1={};Le(i1,{generate:()=>qH,name:()=>WH,parse:()=>o1,structure:()=>GH});function o1(){let e=this.tokenStart,t=this.consumeNumber(12);return{type:"Dimension",loc:this.getLocation(e,this.tokenStart),value:t,unit:this.substring(e+t.length,this.tokenStart)}}function qH(e){this.token(12,e.value+e.unit)}var WH,GH,a1=H(()=>{"use strict";WH="Dimension",GH={value:String,unit:String}});var l1={};Le(l1,{generate:()=>JH,name:()=>KH,parse:()=>s1,structure:()=>XH});function s1(e){let t=this.tokenStart,r,n=null;if(this.eat(21),this.skipSC(),r=this.consume(1),this.skipSC(),this.tokenType!==22){switch(this.eat(16),this.skipSC(),this.tokenType){case 10:this.lookupNonWSType(1)===9?n=this.Ratio():n=this.Number();break;case 12:n=this.Dimension();break;case 1:n=this.Identifier();break;case 2:n=this.parseWithFallback(()=>{let o=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(YH)&&this.error(),o},()=>this.Ratio());break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eof||this.eat(22),{type:"Feature",loc:this.getLocation(t,this.tokenStart),kind:e,name:r,value:n}}function JH(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}var YH,KH,XH,c1=H(()=>{"use strict";YH=47,KH="Feature",XH={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]}});var p1={};Le(p1,{generate:()=>tU,name:()=>QH,parse:()=>u1,structure:()=>ZH});function eU(e,t){let n=(this.features[e]||{})[t];return typeof n!="function"&&this.error(`Unknown feature ${t}()`),n}function u1(e="unknown"){let t=this.tokenStart,r=this.consumeFunctionName(),n=eU.call(this,e,r.toLowerCase());this.skipSC();let o=this.parseWithFallback(()=>{let i=this.tokenIndex,a=n.call(this);return this.eof===!1&&this.isBalanceEdge(i)===!1&&this.error(),a},()=>this.Raw(null,!1));return this.eof||this.eat(22),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:r,value:o}}function tU(e){this.token(2,e.feature+"("),this.node(e.value),this.token(22,")")}var QH,ZH,d1=H(()=>{"use strict";QH="FeatureFunction",ZH={kind:String,feature:String,value:["Declaration","Selector"]}});var m1={};Le(m1,{generate:()=>aU,name:()=>oU,parse:()=>g1,structure:()=>iU});function f1(){switch(this.skipSC(),this.tokenType){case 10:return this.isDelim(z4,this.lookupOffsetNonSC(1))?this.Ratio():this.Number();case 12:return this.Dimension();case 1:return this.Identifier();case 2:return this.parseWithFallback(()=>{let e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(z4)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function N4(e){if(this.skipSC(),this.isDelim(rU)||this.isDelim(nU)){let t=this.source[this.tokenStart];return this.next(),this.isDelim(D4)?(this.next(),t+"="):t}if(this.isDelim(D4))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function g1(e="unknown"){let t=this.tokenStart;this.skipSC(),this.eat(21);let r=f1.call(this),n=N4.call(this,r.type==="Identifier"),o=f1.call(this),i=null,a=null;return this.lookupNonWSType(0)!==22&&(i=N4.call(this),a=f1.call(this)),this.skipSC(),this.eat(22),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:r,leftComparison:n,middle:o,rightComparison:i,right:a}}function aU(e){this.token(21,"("),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(22,")")}var z4,rU,D4,nU,oU,iU,h1=H(()=>{"use strict";z4=47,rU=60,D4=61,nU=62,oU="FeatureRange",iU={kind:String,left:["Identifier","Number","Dimension","Ratio","Function"],leftComparison:String,middle:["Identifier","Number","Dimension","Ratio","Function"],rightComparison:[String,null],right:["Identifier","Number","Dimension","Ratio","Function",null]}});var y1={};Le(y1,{generate:()=>uU,name:()=>sU,parse:()=>x1,structure:()=>cU,walkContext:()=>lU});function x1(e,t){let r=this.tokenStart,n=this.consumeFunctionName(),o=n.toLowerCase(),i;return i=t.hasOwnProperty(o)?t[o].call(this,t):e.call(this,t),this.eof||this.eat(22),{type:"Function",loc:this.getLocation(r,this.tokenStart),name:n,children:i}}function uU(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}var sU,lU,cU,b1=H(()=>{"use strict";sU="Function",lU="function",cU={name:String,children:[[]]}});var v1={};Le(v1,{generate:()=>fU,name:()=>pU,parse:()=>w1,structure:()=>dU});function w1(e){let t=this.tokenStart,r=null;this.tokenType===2?r=this.consumeFunctionName():this.eat(21);let n=this.parseWithFallback(()=>{let o=this.tokenIndex,i=this.readSequence(this.scope.Value);return this.eof===!1&&this.isBalanceEdge(o)===!1&&this.error(),i},()=>this.createSingleNodeList(this.Raw(null,!1)));return this.eof||this.eat(22),{type:"GeneralEnclosed",loc:this.getLocation(t,this.tokenStart),kind:e,function:r,children:n}}function fU(e){e.function?this.token(2,e.function+"("):this.token(21,"("),this.children(e),this.token(22,")")}var pU,dU,S1=H(()=>{"use strict";pU="GeneralEnclosed",dU={kind:String,function:[String,null],children:[[]]}});var C1={};Le(C1,{generate:()=>xU,name:()=>mU,parse:()=>k1,structure:()=>hU,xxx:()=>gU});function k1(){let e=this.tokenStart;return this.eat(4),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function xU(e){this.token(4,"#"+e.value)}var gU,mU,hU,E1=H(()=>{"use strict";gU="XXX",mU="Hash",hU={value:String}});var I1={};Le(I1,{generate:()=>wU,name:()=>yU,parse:()=>T1,structure:()=>bU});function T1(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function wU(e){this.token(1,e.name)}var yU,bU,R1=H(()=>{"use strict";yU="Identifier",bU={name:String}});var F1={};Le(F1,{generate:()=>kU,name:()=>vU,parse:()=>A1,structure:()=>SU});function A1(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function kU(e){this.token(9,"#"+e.name)}var vU,SU,M1=H(()=>{"use strict";vU="IdSelector",SU={name:String}});var L1={};Le(L1,{generate:()=>IU,name:()=>EU,parse:()=>P1,structure:()=>TU});function P1(){let e=this.tokenStart,t=this.consume(1);for(;this.isDelim(CU);)this.eat(9),t+="."+this.consume(1);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function IU(e){this.tokenize(e.name)}var CU,EU,TU,_1=H(()=>{"use strict";CU=46,EU="Layer",TU={name:String}});var z1={};Le(z1,{generate:()=>FU,name:()=>RU,parse:()=>B1,structure:()=>AU});function B1(){let e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.Layer()),this.lookupTypeNonSC(0)===18);)this.skipSC(),this.next(),this.skipSC();return{type:"LayerList",loc:this.getLocationFromList(e),children:e}}function FU(e){this.children(e,()=>this.token(18,","))}var RU,AU,D1=H(()=>{"use strict";RU="LayerList",AU={children:[["Layer"]]}});var O1={};Le(O1,{generate:()=>LU,name:()=>MU,parse:()=>N1,structure:()=>PU});function N1(){let e=this.tokenStart,t=null,r=null,n=null;if(this.skipSC(),this.tokenType===1&&this.lookupTypeNonSC(1)!==21){let o=this.consume(1),i=o.toLowerCase();switch(i==="not"||i==="only"?(this.skipSC(),t=i,r=this.consume(1)):r=o,this.lookupTypeNonSC(0)){case 1:{this.skipSC(),this.eatIdent("and"),n=this.Condition("media");break}case 23:case 17:case 18:case 0:break;default:this.error("Identifier or parenthesis is expected")}}else switch(this.tokenType){case 1:case 21:case 2:{n=this.Condition("media");break}case 23:case 17:case 0:break;default:this.error("Identifier or parenthesis is expected")}return{type:"MediaQuery",loc:this.getLocation(e,this.tokenStart),modifier:t,mediaType:r,condition:n}}function LU(e){e.mediaType?(e.modifier&&this.token(1,e.modifier),this.token(1,e.mediaType),e.condition&&(this.token(1,"and"),this.node(e.condition))):e.condition&&this.node(e.condition)}var MU,PU,$1=H(()=>{"use strict";MU="MediaQuery",PU={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]}});var U1={};Le(U1,{generate:()=>zU,name:()=>_U,parse:()=>H1,structure:()=>BU});function H1(){let e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.MediaQuery()),this.tokenType===18);)this.next();return{type:"MediaQueryList",loc:this.getLocationFromList(e),children:e}}function zU(e){this.children(e,()=>this.token(18,","))}var _U,BU,j1=H(()=>{"use strict";_U="MediaQueryList",BU={children:[["MediaQuery"]]}});var W1={};Le(W1,{generate:()=>$U,name:()=>NU,parse:()=>V1,structure:()=>OU});function V1(){let e=this.tokenStart;return this.eatDelim(DU),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function $U(){this.token(9,"&")}var DU,NU,OU,G1=H(()=>{"use strict";DU=38,NU="NestingSelector",OU={}});var Y1={};Le(Y1,{generate:()=>jU,name:()=>HU,parse:()=>q1,structure:()=>UU});function q1(){this.skipSC();let e=this.tokenStart,t=e,r=null,n;return this.lookupValue(0,"odd")||this.lookupValue(0,"even")?n=this.Identifier():n=this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),r=this.SelectorList(),t=this.tokenStart),{type:"Nth",loc:this.getLocation(e,t),nth:n,selector:r}}function jU(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}var HU,UU,K1=H(()=>{"use strict";HU="Nth",UU={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]}});var J1={};Le(J1,{generate:()=>GU,name:()=>VU,parse:()=>X1,structure:()=>WU});function X1(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function GU(e){this.token(10,e.value)}var VU,WU,Q1=H(()=>{"use strict";VU="Number",WU={value:String}});var ex={};Le(ex,{generate:()=>KU,name:()=>qU,parse:()=>Z1,structure:()=>YU});function Z1(){let e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function KU(e){this.tokenize(e.value)}var qU,YU,tx=H(()=>{"use strict";qU="Operator",YU={value:String}});var nx={};Le(nx,{generate:()=>QU,name:()=>XU,parse:()=>rx,structure:()=>JU});function rx(e,t){let r=this.tokenStart,n=null;return this.eat(21),n=e.call(this,t),this.eof||this.eat(22),{type:"Parentheses",loc:this.getLocation(r,this.tokenStart),children:n}}function QU(e){this.token(21,"("),this.children(e),this.token(22,")")}var XU,JU,ox=H(()=>{"use strict";XU="Parentheses",JU={children:[[]]}});var ax={};Le(ax,{generate:()=>tj,name:()=>ZU,parse:()=>ix,structure:()=>ej});function ix(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function tj(e){this.token(11,e.value+"%")}var ZU,ej,sx=H(()=>{"use strict";ZU="Percentage",ej={value:String}});var cx={};Le(cx,{generate:()=>ij,name:()=>rj,parse:()=>lx,structure:()=>oj,walkContext:()=>nj});function lx(){let e=this.tokenStart,t=null,r,n;return this.eat(16),this.tokenType===2?(r=this.consumeFunctionName(),n=r.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,n)?(this.skipSC(),t=this.pseudo[n].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):r=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:r,children:t}}function ij(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var rj,nj,oj,ux=H(()=>{"use strict";rj="PseudoClassSelector",nj="function",oj={name:String,children:[["Raw"],null]}});var dx={};Le(dx,{generate:()=>cj,name:()=>aj,parse:()=>px,structure:()=>lj,walkContext:()=>sj});function px(){let e=this.tokenStart,t=null,r,n;return this.eat(16),this.eat(16),this.tokenType===2?(r=this.consumeFunctionName(),n=r.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,n)?(this.skipSC(),t=this.pseudo[n].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):r=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:r,children:t}}function cj(e){this.token(16,":"),this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var aj,sj,lj,fx=H(()=>{"use strict";aj="PseudoElementSelector",sj="function",lj={name:String,children:[["Raw"],null]}});var mx={};Le(mx,{generate:()=>dj,name:()=>uj,parse:()=>gx,structure:()=>pj});function $4(){switch(this.skipSC(),this.tokenType){case 10:return this.Number();case 2:return this.Function(this.readSequence,this.scope.Value);default:this.error("Number of function is expected")}}function gx(){let e=this.tokenStart,t=$4.call(this),r=null;return this.skipSC(),this.isDelim(O4)&&(this.eatDelim(O4),r=$4.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:r}}function dj(e){this.node(e.left),this.token(9,"/"),e.right?this.node(e.right):this.node(10,1)}var O4,uj,pj,hx=H(()=>{"use strict";O4=47;uj="Ratio",pj={left:["Number","Function"],right:["Number","Function",null]}});var yx={};Le(yx,{generate:()=>hj,name:()=>gj,parse:()=>xx,structure:()=>mj});function fj(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function xx(e,t){let r=this.getTokenStart(this.tokenIndex),n;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>r?n=fj.call(this):n=this.tokenStart,{type:"Raw",loc:this.getLocation(r,n),value:this.substring(r,n)}}function hj(e){this.tokenize(e.value)}var gj,mj,bx=H(()=>{"use strict";gj="Raw",mj={value:String}});var vx={};Le(vx,{generate:()=>vj,name:()=>yj,parse:()=>wx,structure:()=>wj,walkContext:()=>bj});function H4(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function xj(){let e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==23&&this.error(),e}function wx(){let e=this.tokenIndex,t=this.tokenStart,r,n;return this.parseRulePrelude?r=this.parseWithFallback(xj,H4):r=H4.call(this,e),n=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:r,block:n}}function vj(e){this.node(e.prelude),this.node(e.block)}var yj,bj,wj,Sx=H(()=>{"use strict";yj="Rule",bj="rule",wj={prelude:["SelectorList","Raw"],block:["Block"]}});var Cx={};Le(Cx,{generate:()=>Cj,name:()=>Sj,parse:()=>kx,structure:()=>kj});function kx(){let e=null,t=null;this.skipSC();let r=this.tokenStart;return this.tokenType===21&&(this.next(),this.skipSC(),e=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(22)),this.lookupNonWSType(0)===1&&(this.skipSC(),this.eatIdent("to"),this.skipSC(),this.eat(21),this.skipSC(),t=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(22)),{type:"Scope",loc:this.getLocation(r,this.tokenStart),root:e,limit:t}}function Cj(e){e.root&&(this.token(21,"("),this.node(e.root),this.token(22,")")),e.limit&&(this.token(1,"to"),this.token(21,"("),this.node(e.limit),this.token(22,")"))}var Sj,kj,Ex=H(()=>{"use strict";Sj="Scope",kj={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]}});var Ix={};Le(Ix,{generate:()=>Ij,name:()=>Ej,parse:()=>Tx,structure:()=>Tj});function Tx(){let e=this.readSequence(this.scope.Selector);return this.getFirstListNode(e)===null&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(e),children:e}}function Ij(e){this.children(e)}var Ej,Tj,Rx=H(()=>{"use strict";Ej="Selector",Tj={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]}});var Fx={};Le(Fx,{generate:()=>Mj,name:()=>Rj,parse:()=>Ax,structure:()=>Fj,walkContext:()=>Aj});function Ax(){let e=this.createList();for(;!this.eof;){if(e.push(this.Selector()),this.tokenType===18){this.next();continue}break}return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function Mj(e){this.children(e,()=>this.token(18,","))}var Rj,Aj,Fj,Mx=H(()=>{"use strict";Rj="SelectorList",Aj="selector",Fj={children:[["Selector","Raw"]]}});function Ed(e){let t=e.length,r=e.charCodeAt(0),n=r===U4||r===j4?1:0,o=n===1&&t>1&&e.charCodeAt(t-1)===r?t-2:t-1,i="";for(let a=n;a<=o;a++){let s=e.charCodeAt(a);if(s===Px){if(a===o){a!==t-1&&(i=e.substr(a+1));break}if(s=e.charCodeAt(++a),An(Px,s)){let l=a-1,u=Li(e,l);a=u-1,i+=Yp(e.substring(l+1,u))}else s===13&&e.charCodeAt(a+1)===10&&a++}else i+=e[a]}return i}function V4(e,t){let r=t?"'":'"',n=t?j4:U4,o="",i=!1;for(let a=0;a<e.length;a++){let s=e.charCodeAt(a);if(s===0){o+="\uFFFD";continue}if(s<=31||s===127){o+="\\"+s.toString(16),i=!0;continue}s===n||s===Px?(o+="\\"+e.charAt(a),i=!1):(i&&(Fn(s)||ti(s))&&(o+=" "),o+=e.charAt(a),i=!1)}return r+o+r}var Px,U4,j4,Td=H(()=>{"use strict";so();Px=92,U4=34,j4=39});var _x={};Le(_x,{generate:()=>_j,name:()=>Pj,parse:()=>Lx,structure:()=>Lj});function Lx(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:Ed(this.consume(5))}}function _j(e){this.token(5,V4(e.value))}var Pj,Lj,Bx=H(()=>{"use strict";Td();Pj="String",Lj={value:String}});var Dx={};Le(Dx,{generate:()=>Oj,name:()=>zj,parse:()=>zx,structure:()=>Nj,walkContext:()=>Dj});function G4(){return this.Raw(null,!1)}function zx(){let e=this.tokenStart,t=this.createList(),r;for(;!this.eof;){switch(this.tokenType){case 13:this.next();continue;case 25:if(this.charCodeAt(this.tokenStart+2)!==Bj){this.next();continue}r=this.Comment();break;case 14:r=this.CDO();break;case 15:r=this.CDC();break;case 3:r=this.parseWithFallback(this.Atrule,G4);break;default:r=this.parseWithFallback(this.Rule,G4)}t.push(r)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function Oj(e){this.children(e)}var Bj,zj,Dj,Nj,Nx=H(()=>{"use strict";Bj=33;zj="StyleSheet",Dj="stylesheet",Nj={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]}});var $x={};Le($x,{generate:()=>Uj,name:()=>$j,parse:()=>Ox,structure:()=>Hj});function Ox(){let e=this.tokenStart;this.eat(21),this.skipSC();let t=this.Declaration();return this.eof||this.eat(22),{type:"SupportsDeclaration",loc:this.getLocation(e,this.tokenStart),declaration:t}}function Uj(e){this.token(21,"("),this.node(e.declaration),this.token(22,")")}var $j,Hj,Hx=H(()=>{"use strict";$j="SupportsDeclaration",Hj={declaration:"Declaration"}});var Vx={};Le(Vx,{generate:()=>Gj,name:()=>Vj,parse:()=>jx,structure:()=>Wj});function Ux(){this.tokenType!==1&&this.isDelim(jj)===!1&&this.error("Identifier or asterisk is expected"),this.next()}function jx(){let e=this.tokenStart;return this.isDelim(q4)?(this.next(),Ux.call(this)):(Ux.call(this),this.isDelim(q4)&&(this.next(),Ux.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function Gj(e){this.tokenize(e.name)}var jj,q4,Vj,Wj,Wx=H(()=>{"use strict";jj=42,q4=124;Vj="TypeSelector",Wj={name:String}});var Yx={};Le(Yx,{generate:()=>Jj,name:()=>Kj,parse:()=>qx,structure:()=>Xj});function Dc(e,t){let r=0;for(let n=this.tokenStart+e;n<this.tokenEnd;n++){let o=this.charCodeAt(n);if(o===K4&&t&&r!==0)return Dc.call(this,e+r+1,!1),-1;Fn(o)||this.error(t&&r!==0?"Hyphen minus"+(r<6?" or hex digit":"")+" is expected":r<6?"Hex digit is expected":"Unexpected input",n),++r>6&&this.error("Too many hex digits",n)}return this.next(),r}function Id(e){let t=0;for(;this.isDelim(Gx);)++t>e&&this.error("Too many question marks"),this.next()}function qj(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===Y4?"Plus sign":"Hyphen minus")+" is expected")}function Yj(){let e=0;switch(this.tokenType){case 10:if(e=Dc.call(this,1,!0),this.isDelim(Gx)){Id.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){qj.call(this,K4),Dc.call(this,1,!1);break}break;case 12:e=Dc.call(this,1,!0),e>0&&Id.call(this,6-e);break;default:if(this.eatDelim(Y4),this.tokenType===1){e=Dc.call(this,0,!0),e>0&&Id.call(this,6-e);break}if(this.isDelim(Gx)){this.next(),Id.call(this,5);break}this.error("Hex digit or question mark is expected")}}function qx(){let e=this.tokenStart;return this.eatIdent("u"),Yj.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Jj(e){this.tokenize(e.value)}var Y4,K4,Gx,Kj,Xj,Kx=H(()=>{"use strict";so();Y4=43,K4=45,Gx=63;Kj="UnicodeRange",Xj={value:String}});function J4(e){let t=e.length,r=4,n=e.charCodeAt(t-1)===X4?t-2:t-1,o="";for(;r<n&&ti(e.charCodeAt(r));)r++;for(;r<n&&ti(e.charCodeAt(n));)n--;for(let i=r;i<=n;i++){let a=e.charCodeAt(i);if(a===Xx){if(i===n){i!==t-1&&(o=e.substr(i+1));break}if(a=e.charCodeAt(++i),An(Xx,a)){let s=i-1,l=Li(e,s);i=l-1,o+=Yp(e.substring(s+1,l))}else a===13&&e.charCodeAt(i+1)===10&&i++}else o+=e[i]}return o}function Q4(e){let t="",r=!1;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o===0){t+="\uFFFD";continue}if(o<=31||o===127){t+="\\"+o.toString(16),r=!0;continue}o===Qj||o===Xx||o===Zj||o===eV||o===tV||o===X4?(t+="\\"+e.charAt(n),r=!1):(r&&Fn(o)&&(t+=" "),t+=e.charAt(n),r=!1)}return"url("+t+")"}var Qj,Xx,Zj,eV,tV,X4,Jx=H(()=>{"use strict";so();Qj=32,Xx=92,Zj=34,eV=39,tV=40,X4=41});var Zx={};Le(Zx,{generate:()=>oV,name:()=>rV,parse:()=>Qx,structure:()=>nV});function Qx(){let e=this.tokenStart,t;switch(this.tokenType){case 7:t=J4(this.consume(7));break;case 2:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(2),this.skipSC(),t=Ed(this.consume(5)),this.skipSC(),this.eof||this.eat(22);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(e,this.tokenStart),value:t}}function oV(e){this.token(7,Q4(e.value))}var rV,nV,ey=H(()=>{"use strict";Jx();Td();rV="Url",nV={value:String}});var ry={};Le(ry,{generate:()=>sV,name:()=>iV,parse:()=>ty,structure:()=>aV});function ty(){let e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function sV(e){this.children(e)}var iV,aV,ny=H(()=>{"use strict";iV="Value",aV={children:[[]]}});var iy={};Le(iy,{generate:()=>pV,name:()=>cV,parse:()=>oy,structure:()=>uV});function oy(){return this.eat(13),lV}function pV(e){this.token(13,e.value)}var lV,cV,uV,ay=H(()=>{"use strict";lV=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),cV="WhiteSpace",uV={value:String}});var Nc={};Le(Nc,{AnPlusB:()=>mh,Atrule:()=>yh,AtrulePrelude:()=>vh,AttributeSelector:()=>Eh,Block:()=>Rh,Brackets:()=>Mh,CDC:()=>_h,CDO:()=>Dh,ClassSelector:()=>$h,Combinator:()=>jh,Comment:()=>Gh,Condition:()=>Kh,Declaration:()=>Qh,DeclarationList:()=>r1,Dimension:()=>i1,Feature:()=>l1,FeatureFunction:()=>p1,FeatureRange:()=>m1,Function:()=>y1,GeneralEnclosed:()=>v1,Hash:()=>C1,IdSelector:()=>F1,Identifier:()=>I1,Layer:()=>L1,LayerList:()=>z1,MediaQuery:()=>O1,MediaQueryList:()=>U1,NestingSelector:()=>W1,Nth:()=>Y1,Number:()=>J1,Operator:()=>ex,Parentheses:()=>nx,Percentage:()=>ax,PseudoClassSelector:()=>cx,PseudoElementSelector:()=>dx,Ratio:()=>mx,Raw:()=>yx,Rule:()=>vx,Scope:()=>Cx,Selector:()=>Ix,SelectorList:()=>Fx,String:()=>_x,StyleSheet:()=>Dx,SupportsDeclaration:()=>$x,TypeSelector:()=>Vx,UnicodeRange:()=>Yx,Url:()=>Zx,Value:()=>ry,WhiteSpace:()=>iy});var sy=H(()=>{"use strict";hh();bh();Sh();Th();Ah();Ph();Bh();Nh();Hh();Vh();qh();Xh();Zh();n1();a1();c1();d1();h1();b1();S1();E1();R1();M1();_1();D1();$1();j1();G1();K1();Q1();tx();ox();sx();ux();fx();hx();bx();Sx();Ex();Rx();Mx();Bx();Nx();Hx();Wx();Kx();ey();ny();ay()});var eE,tE=H(()=>{"use strict";dd();T4();sy();eE={generic:!0,cssWideKeywords:el,...E4,node:Nc}});function Oc(e){switch(this.tokenType){case 4:return this.Hash();case 18:return this.Operator();case 21:return this.Parentheses(this.readSequence,e.recognizer);case 19:return this.Brackets(this.readSequence,e.recognizer);case 5:return this.String();case 12:return this.Dimension();case 11:return this.Percentage();case 10:return this.Number();case 2:return this.cmpStr(this.tokenStart,this.tokenEnd,"url(")?this.Url():this.Function(this.readSequence,e.recognizer);case 7:return this.Url();case 1:return this.cmpChar(this.tokenStart,hV)&&this.cmpChar(this.tokenStart+1,rE)?this.UnicodeRange():this.Identifier();case 9:{let t=this.charCodeAt(this.tokenStart);if(t===mV||t===fV||t===rE||t===gV)return this.Operator();t===dV&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}var dV,fV,rE,gV,mV,hV,ly=H(()=>{"use strict";dV=35,fV=42,rE=43,gV=45,mV=47,hV=117});var nE,oE=H(()=>{"use strict";ly();nE={getNode:Oc}});function EV(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function TV(){switch(this.tokenType){case 19:return this.AttributeSelector();case 4:return this.IdSelector();case 16:return this.lookupType(1)===16?this.PseudoElementSelector():this.PseudoClassSelector();case 1:return this.TypeSelector();case 10:case 11:return this.Percentage();case 12:this.charCodeAt(this.tokenStart)===iE&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:{switch(this.charCodeAt(this.tokenStart)){case wV:case SV:case CV:case vV:return this.Combinator();case iE:return this.ClassSelector();case bV:case kV:return this.TypeSelector();case xV:return this.IdSelector();case yV:return this.NestingSelector()}break}}}var xV,yV,bV,wV,vV,iE,SV,kV,CV,aE,sE=H(()=>{"use strict";xV=35,yV=38,bV=42,wV=43,vV=47,iE=46,SV=62,kV=124,CV=126;aE={onWhiteSpace:EV,getNode:TV}});function lE(){return this.createSingleNodeList(this.Raw(null,!1))}var cE=H(()=>{"use strict"});function uE(){let e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===18){e.push(this.Operator());let t=this.tokenIndex,r=this.parseCustomProperty?this.Value(null):this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1);if(r.type==="Value"&&r.children.isEmpty){for(let n=t-this.tokenIndex;n<=0;n++)if(this.lookupType(n)===13){r.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}e.push(r)}return e}var pE=H(()=>{"use strict"});function dE(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}var fE,gE=H(()=>{"use strict";ly();cE();pE();fE={getNode:Oc,onWhiteSpace(e,t){dE(e)&&(e.value=" "+e.value),dE(t.last)&&(t.last.value+=" ")},expression:lE,var:uE}});var cy={};Le(cy,{AtrulePrelude:()=>nE,Selector:()=>aE,Value:()=>fE});var mE=H(()=>{"use strict";oE();sE();gE()});var IV,hE,xE=H(()=>{"use strict";IV=new Set(["none","and","not","or"]),hE={parse:{prelude(){let e=this.createList();if(this.tokenType===1){let t=this.substring(this.tokenStart,this.tokenEnd);IV.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}}});var yE,bE=H(()=>{"use strict";yE={parse:{prelude:null,block(){return this.Block(!0)}}}});function uy(e,t){return this.parseWithFallback(()=>{try{return e.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==22&&this.error()}},t||(()=>this.Raw(null,!0)))}var wE,vE,SE=H(()=>{"use strict";wE={layer(){this.skipSC();let e=this.createList(),t=uy.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();let e=this.createList(),t=uy.call(this,this.Declaration,()=>uy.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},vE={parse:{prelude(){let e=this.createList();switch(this.tokenType){case 5:e.push(this.String());break;case 7:case 2:e.push(this.Url());break;default:this.error("String or url() is expected")}return this.skipSC(),this.tokenType===1&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer")?e.push(this.Identifier()):this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer(")&&e.push(this.Function(null,wE)),this.skipSC(),this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,wE)),(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}}});var kE,CE=H(()=>{"use strict";kE={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}}});var EE,TE=H(()=>{"use strict";EE={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}}});var IE,RE=H(()=>{"use strict";IE={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var AE,FE=H(()=>{"use strict";AE={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var ME,PE=H(()=>{"use strict";ME={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}}});var LE,_E=H(()=>{"use strict";LE={parse:{prelude:null,block(e=!1){return this.Block(e)}}}});var BE,zE=H(()=>{"use strict";BE={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}}});var DE,NE=H(()=>{"use strict";xE();bE();SE();CE();TE();RE();FE();PE();_E();zE();DE={container:hE,"font-face":yE,import:vE,layer:kE,media:EE,nest:IE,page:AE,scope:ME,"starting-style":LE,supports:BE}});function OE(){let e=this.createList();this.skipSC();e:for(;!this.eof;){switch(this.tokenType){case 1:e.push(this.Identifier());break;case 5:e.push(this.String());break;case 18:e.push(this.Operator());break;case 22:break e;default:this.error("Identifier, string or comma is expected")}this.skipSC()}return e}var $E=H(()=>{"use strict"});var Ja,py,RV,AV,Rd,HE,UE=H(()=>{"use strict";$E();Ja={parse(){return this.createSingleNodeList(this.SelectorList())}},py={parse(){return this.createSingleNodeList(this.Selector())}},RV={parse(){return this.createSingleNodeList(this.Identifier())}},AV={parse:OE},Rd={parse(){return this.createSingleNodeList(this.Nth())}},HE={dir:RV,has:Ja,lang:AV,matches:Ja,is:Ja,"-moz-any":Ja,"-webkit-any":Ja,where:Ja,not:Ja,"nth-child":Rd,"nth-last-child":Rd,"nth-last-of-type":Rd,"nth-of-type":Rd,slotted:py,host:py,"host-context":py}});var dy={};Le(dy,{AnPlusB:()=>gh,Atrule:()=>xh,AtrulePrelude:()=>wh,AttributeSelector:()=>Ch,Block:()=>Ih,Brackets:()=>Fh,CDC:()=>Lh,CDO:()=>zh,ClassSelector:()=>Oh,Combinator:()=>Uh,Comment:()=>Wh,Condition:()=>Yh,Declaration:()=>Jh,DeclarationList:()=>t1,Dimension:()=>o1,Feature:()=>s1,FeatureFunction:()=>u1,FeatureRange:()=>g1,Function:()=>x1,GeneralEnclosed:()=>w1,Hash:()=>k1,IdSelector:()=>A1,Identifier:()=>T1,Layer:()=>P1,LayerList:()=>B1,MediaQuery:()=>N1,MediaQueryList:()=>H1,NestingSelector:()=>V1,Nth:()=>q1,Number:()=>X1,Operator:()=>Z1,Parentheses:()=>rx,Percentage:()=>ix,PseudoClassSelector:()=>lx,PseudoElementSelector:()=>px,Ratio:()=>gx,Raw:()=>xx,Rule:()=>wx,Scope:()=>kx,Selector:()=>Tx,SelectorList:()=>Ax,String:()=>Lx,StyleSheet:()=>zx,SupportsDeclaration:()=>Ox,TypeSelector:()=>jx,UnicodeRange:()=>qx,Url:()=>Qx,Value:()=>ty,WhiteSpace:()=>oy});var jE=H(()=>{"use strict";hh();bh();Sh();Th();Ah();Ph();Bh();Nh();Hh();Vh();qh();Xh();Zh();n1();a1();c1();d1();h1();b1();S1();E1();R1();M1();_1();D1();$1();j1();G1();K1();Q1();tx();ox();sx();ux();fx();hx();bx();Sx();Ex();Rx();Mx();Bx();Nx();Hx();Wx();Kx();ey();ny();ay()});var VE,WE=H(()=>{"use strict";mE();NE();UE();jE();VE={parseContext:{default:"StyleSheet",stylesheet:"StyleSheet",atrule:"Atrule",atrulePrelude(e){return this.AtrulePrelude(e.atrule?String(e.atrule):null)},mediaQueryList:"MediaQueryList",mediaQuery:"MediaQuery",condition(e){return this.Condition(e.kind)},rule:"Rule",selectorList:"SelectorList",selector:"Selector",block(){return this.Block(!0)},declarationList:"DeclarationList",declaration:"Declaration",value:"Value"},features:{supports:{selector(){return this.Selector()}},container:{style(){return this.Declaration()}}},scope:cy,atrule:DE,pseudo:HE,node:dy}});var GE,qE=H(()=>{"use strict";sy();GE={node:Nc}});var YE,KE=H(()=>{"use strict";C4();tE();WE();qE();YE=k4({...eE,...VE,...GE})});var XE=H(()=>{"use strict"});var JE=H(()=>{"use strict"});var A1e,QE,F1e,M1e,P1e,ZE,L1e,_1e,B1e,z1e,D1e,N1e,eT=H(()=>{"use strict";KE();XE();eh();pd();JE();Td();Jx();({tokenize:A1e,parse:QE,generate:F1e,lexer:M1e,createLexer:P1e,walk:ZE,find:L1e,findLast:_1e,findAll:B1e,toPlainObject:z1e,fromPlainObject:D1e,fork:N1e}=YE)});function LV(e){return e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function rT(e){try{let t=QE(e.trim(),{context:"value"}),r=[];return ZE(t,{enter(n){if(n.type==="Dimension"){let o=parseFloat(n.value);r.push(`${o}${n.unit}`)}else if(n.type==="Number"){let o=parseFloat(n.value);r.push(`${o}`)}else n.type==="Percentage"?r.push(`${parseFloat(n.value)}%`):n.type==="Identifier"?r.push(n.name.toLowerCase()):n.type==="Hash"?r.push(`#${n.value.toLowerCase()}`):n.type}}),r}catch{return[e.trim().toLowerCase()]}}function _V(e,t){let r=LV(e);if(!PV.has(r))return t;let n=rT(t);if(n.length<1||n.length>4)return t;let o=n.map(i=>i==="0"?"0px":i);return o.length===1?`${o[0]} ${o[0]} ${o[0]} ${o[0]}`:o.length===2?`${o[0]} ${o[1]} ${o[0]} ${o[1]}`:o.length===3?`${o[0]} ${o[1]} ${o[2]} ${o[1]}`:o.join(" ")}function tT(e,t){let r=t.trim();if(!r)return"";let n=_V(e,r);return rT(n).map(i=>i==="0"?"0px":i).join(" ")}function nT(e,t,r){let n=tT(e,t),o=tT(e,r);return n!==""&&o!==""&&n===o}var PV,oT=H(()=>{"use strict";eT();PV=new Set(["padding","margin","border-radius","borderradius","inset","border-width","borderwidth"])});function BV(e){let t=e.toLowerCase();return t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function zV(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/);if(!t)return null;let r=parseInt(t[1],10).toString(16).padStart(2,"0"),n=parseInt(t[2],10).toString(16).padStart(2,"0"),o=parseInt(t[3],10).toString(16).padStart(2,"0");return`#${r}${n}${o}`}function iT(e){let t=typeof e=="string"?e:String(e??"");if(!t||t==="[object Object]")return"";let r=t.match(/rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)/);if(r){let i=zV(r[0]);if(i)return i}let n=t.match(/#([0-9a-fA-F]{3,8})/);if(n)return BV(n[0]);let o=t.match(/(-?\d+\.?\d*)(px|em|rem|%|pt|vw|vh)?/g);return o&&o.length>1?o.join(" ").toLowerCase():o&&o.length===1?o[0].toLowerCase():t.toLowerCase().trim().replace(/\s+/g," ")}function Qa(e,t,r){if(!e||!t)return!1;let n=String(e),o=String(t),i=n.toLowerCase(),a=o.toLowerCase(),s=i.includes("none"),l=a.includes("none");if(s!==l)return!1;let u=/\b(fill|stroke)\s*:/i,c=u.test(n),d=u.test(o);if(c!==d)return!1;let f=iT(n),p=iT(o);return!!(f===p||r&&nT(r,n,o))}var fy=H(()=>{"use strict";oT()});function gy(e){let t=e.trim().match(/^#?([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/);if(!t)return null;let r=t[1];return r.length===3||r.length===4?r=r.slice(0,3).split("").map(n=>n+n).join(""):r.length===8&&(r=r.slice(0,6)),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]}function DV(e){let t=e.trim().match(/^rgba?\(\s*([^)]+)\)$/i);if(!t)return null;let r=t[1].replace(/\//g," ").split(/[\s,]+/).filter(Boolean);if(r.length<3)return null;let n=l=>l.endsWith("%")?Math.round(parseFloat(l)/100*255):Math.round(parseFloat(l)),o=n(r[0]),i=n(r[1]),a=n(r[2]);if([o,i,a].some(l=>isNaN(l)))return null;let s=l=>Math.max(0,Math.min(255,l));return[s(o),s(i),s(a)]}function NV(e,t,r){let n=(1-Math.abs(2*r-1))*t,o=(e%360+360)%360/60,i=n*(1-Math.abs(o%2-1)),a=0,s=0,l=0;o<1?[a,s,l]=[n,i,0]:o<2?[a,s,l]=[i,n,0]:o<3?[a,s,l]=[0,n,i]:o<4?[a,s,l]=[0,i,n]:o<5?[a,s,l]=[i,0,n]:[a,s,l]=[n,0,i];let u=r-n/2;return[Math.round((a+u)*255),Math.round((s+u)*255),Math.round((l+u)*255)]}function OV(e){let t=e.trim().match(/^hsla?\(\s*([^)]+)\)$/i);if(!t)return null;let r=t[1].replace(/\//g," ").split(/[\s,]+/).filter(Boolean);if(r.length<3)return null;let n=parseFloat(r[0]),o=parseFloat(r[1]),i=parseFloat(r[2]);return[n,o,i].some(a=>isNaN(a))?null:NV(n,o/100,i/100)}function HV(e){return $V[e.trim().toLowerCase()]??null}function aT(e){return e?gy(e)??DV(e)??OV(e)??my(e)??HV(e):null}function my(e){let t=e.trim().match(/^color\(\s*display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*[\d.]+)?\s*\)$/);if(!t)return null;let r=parseFloat(t[1]),n=parseFloat(t[2]),o=parseFloat(t[3]);if(isNaN(r)||isNaN(n)||isNaN(o))return null;let i=p=>p<=.04045?p/12.92:Math.pow((p+.055)/1.055,2.4),a=i(r),s=i(n),l=i(o),u=1.2249*a-.2247*s+0*l,c=-.042*a+1.0419*s+0*l,d=-.0197*a-.0786*s+1.0983*l,f=p=>{let g=Math.max(0,Math.min(1,p));return g<=.0031308?12.92*g:1.055*Math.pow(g,1/2.4)-.055};return[Math.round(f(u)*255),Math.round(f(c)*255),Math.round(f(d)*255)]}function sT(e,t,r){let n=S=>{let h=S/255;return h<=.04045?h/12.92:Math.pow((h+.055)/1.055,2.4)},o=n(e),i=n(t),a=n(r),s=o*.4124564+i*.3575761+a*.1804375,l=o*.2126729+i*.7151522+a*.072175,u=o*.0193339+i*.119192+a*.9503041,c=.95047,d=1,f=1.08883,p=S=>S>.008856?Math.cbrt(S):7.787*S+16/116,g=p(s/c),m=p(l/d),T=p(u/f);return[116*m-16,500*(g-m),200*(m-T)]}function lT(e,t){let[r,n,o]=sT(...e),[i,a,s]=sT(...t),l=(r+i)/2,u=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+s*s),d=(u+c)/2,f=.5*(1-Math.sqrt(Math.pow(d,7)/(Math.pow(d,7)+Math.pow(25,7)))),p=(1+f)*n,g=(1+f)*a,m=Math.sqrt(p*p+o*o),T=Math.sqrt(g*g+s*s),S=(m+T)/2,h=(Math.atan2(o,p)*180/Math.PI+360)%360,M=(Math.atan2(s,g)*180/Math.PI+360)%360,z=M-h;Math.abs(z)>180&&(z-=Math.sign(z)*360);let O=i-r,R=T-m,B=2*Math.sqrt(m*T)*Math.sin(z*Math.PI/360),x=Math.abs(h-M)>180?(h+M+360)/2:(h+M)/2,v=1-.17*Math.cos((x-30)*Math.PI/180)+.24*Math.cos(2*x*Math.PI/180)+.32*Math.cos((3*x+6)*Math.PI/180)-.2*Math.cos((4*x-63)*Math.PI/180),I=1+.015*Math.pow(l-50,2)/Math.sqrt(20+Math.pow(l-50,2)),L=1+.045*S,E=1+.015*S*v,y=-2*Math.sqrt(Math.pow(S,7)/(Math.pow(S,7)+Math.pow(25,7)))*Math.sin(60*Math.exp(-Math.pow((x-275)/25,2))*Math.PI/180);return Math.sqrt(Math.pow(O/I,2)+Math.pow(R/L,2)+Math.pow(B/E,2)+y*(R/L)*(B/E))}function cT(e){let t=(e.property||"").toLowerCase();if(!(t.includes("color")||t==="fill"||t==="background"||t==="backgroundcolor"))return!1;let n=String(e.expected||e.suggestedValue||""),o=String(e.actual||e.currentValue||""),i=gy(n)??gy(o),a=my(n)??my(o);return!i||!a||n===o?!1:lT(i,a)<5}function $c(e){let t=String(e.expected??e.suggestedValue??""),r=String(e.actual??e.currentValue??"");if(!t||!r||t===r)return null;let n=aT(t),o=aT(r);return!n||!o?null:lT(n,o)}function Hc(e){let t=e.severity||"minor";if(t==="minor")return t;if(cT(e))return"minor";let r=$c(e);if(r!==null)return r<2?"minor":r<5&&t==="critical"?"major":t;let n=["width","height","size","dimension","dimensions","r","cx","cy"],o=["dimension","layout"],i=new Set((e.property||"").replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)),a=(e.type||"").toLowerCase();if(!(n.some(p=>i.has(p))||o.some(p=>a===p)))return t;let l=String(e.expected||e.suggestedValue||""),u=String(e.actual||e.currentValue||""),c=parseFloat(l.replace(/[^0-9.-]/g,"")),d=parseFloat(u.replace(/[^0-9.-]/g,""));if(isNaN(c)||isNaN(d))return t;let f=Math.abs(c-d);return f<5?"minor":f<10&&t==="critical"?"major":t}function Ad(e,t,r){return e>0?"D":t>0?"C":r>0?"B":"A"}function Fd(e){let t=e.filter(r=>!r.dismissed).map(r=>Hc(r));return Ad(t.filter(r=>r==="critical").length,t.filter(r=>r==="major").length,t.filter(r=>r==="minor").length)}function Oi(e,t,r){let n=100-r*1-t*3-e*10,o=Uc[Ad(e,t,r)];return Math.max(0,Math.min(o,n))}var $V,Uc,hy=H(()=>{"use strict";$V={white:[255,255,255],black:[0,0,0],red:[255,0,0],green:[0,128,0],blue:[0,0,255],yellow:[255,255,0],cyan:[0,255,255],aqua:[0,255,255],magenta:[255,0,255],fuchsia:[255,0,255],gray:[128,128,128],grey:[128,128,128],silver:[192,192,192],maroon:[128,0,0],olive:[128,128,0],lime:[0,255,0],teal:[0,128,128],navy:[0,0,128],purple:[128,0,128],orange:[255,165,0],pink:[255,192,203],brown:[165,42,42],gold:[255,215,0],beige:[245,245,220],ivory:[255,255,240],indigo:[75,0,130],violet:[238,130,238],coral:[255,127,80],salmon:[250,128,114],khaki:[240,230,140],crimson:[220,20,60],turquoise:[64,224,208],lightgray:[211,211,211],lightgrey:[211,211,211],darkgray:[169,169,169],darkgrey:[169,169,169],whitesmoke:[245,245,245],gainsboro:[220,220,220]};Uc={A:100,B:99,C:89,D:69}});function al(e,t={}){if(e==null)return"";let r=String(e).split(",")[0].trim().replace(/['"]/g,"").toLowerCase();return t.stripSeparators&&(r=r.replace(/[\s_-]/g,"")),r}function dT(e,t){let r=al(e,{stripSeparators:!0}),n=al(t,{stripSeparators:!0});return!r||!n||r===n?!1:UV.some(o=>o.has(r)&&o.has(n))}function pT(e){if(e==null)return null;let t=String(e).trim().toLowerCase();if(!t)return null;let r=t.replace(/[\s_-]/g,"");if(r in uT)return uT[r];let n=parseFloat(t.replace(/[^0-9.-]/g,""));return isNaN(n)?null:n}function fT(e,t){let r=pT(e),n=pT(t);return r==null||n==null?!1:Math.round(r/100)===Math.round(n/100)}var UV,uT,Md=H(()=>{"use strict";UV=[new Set(["applesystem","blinkmacsystemfont","systemui","webkitsystemfont","sfpro","sfprotext","sfprodisplay","sanfrancisco","sanfranciscopro","sanfranciscotext","sanfranciscodisplay"])];uT={thin:100,hairline:100,extralight:200,ultralight:200,light:300,normal:400,regular:400,book:400,medium:500,semibold:600,demibold:600,demi:600,bold:700,extrabold:800,ultrabold:800,black:900,heavy:900}});function yT(e){let t=String(e.property||"").toLowerCase(),r=String(e.description||"").toLowerCase(),n=String(e.expected||e.suggestedValue||"").toLowerCase(),o=String(e.actual||e.currentValue||"").toLowerCase();if(t.includes("color")||t.includes("fill")||t.includes("background")||r.includes("color")||r.includes("fill"))return!0;let i=a=>/^#[0-9a-f]{3,8}$/i.test(a)||a.includes("rgb")||["white","black","red","blue","green","orange","yellow","transparent"].includes(a);return!!(i(n)||i(o)||e.relatedProperties?.some(a=>{let s=a.property?.toLowerCase()||"";return s.includes("color")||s.includes("fill")||s.includes("background")}))}function qV(e){if(!yT(e))return!1;let t=$c(e);return t!==null&&t<2}function gT(e){if(e.includes("\xD7")||/\d+px\s*x\s*\d+px/i.test(e))return!1;let t=e.match(/\d+px/g);return t?t.length>1:!1}function YV(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),r=String(e.actual||e.currentValue||"").toLowerCase(),n=String(e.property||"").toLowerCase(),o=String(e.description||"").toLowerCase(),i=r.includes("margin")||t.includes("margin")||n==="margin",a=t.includes("gap")||o.includes("gap");return i&&a}function bT(e){return KV.has(e?.toLowerCase()||"")}function XV(e,t,r){if(!e||!t)return!1;let n=typeof e=="string"?e:String(e??""),o=typeof t=="string"?t:String(t??"");if(!n||!o||n==="[object Object]"||o==="[object Object]"||r&&yT(r)||gT(n)||gT(o)||r&&YV(r))return!1;let i=parseFloat(n),a=parseFloat(o);if(isNaN(i)||isNaN(a))return!1;let s=Math.abs(i-a);return n.includes("px")||o.includes("px")?bT(r?.property)?s<hT:s<mT:n.includes("%")||o.includes("%")?s<1:!1}function JV(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase();if(GV.some(a=>t.includes(a))||!VV.some(a=>t.includes(a)))return!1;let o=e.expected||e.suggestedValue,i=e.actual||e.currentValue;return!(o&&i&&!Qa(o,i,e.property))}function QV(e){let t=(e.expected!==void 0?"fill":"").toLowerCase(),r=e.actual!==void 0||e.currentValue!==void 0?"fill":"";if(!(t==="fill"||r==="fill"||e.description?.toLowerCase().includes("fill")||e.title?.toLowerCase().includes("fill")))return!1;let o=String(e.expected||e.suggestedValue||"").toLowerCase();if(!(o==="none"||o==="transparent"||o.includes("no fills")||o.includes("transparent")))return!1;let a=`${e.description||""} ${e.title||""}`.toLowerCase();return a.includes("container")||a.includes("svg ")||a.includes("<svg")||a.includes("wrapper")}function ZV(e){let t=`${e.description||""} ${e.title||""}`.toLowerCase(),r=e.property?.toLowerCase()||"";if(!(t.includes("text ")||t.includes("text layer")||t.includes("text span")||t.includes("span ")||t.includes("label "))||!(r==="width"||r==="height"||r.includes("width")||r.includes("height")||t.includes("width")||t.includes("height")))return!1;let i=e.expected||e.suggestedValue||"",a=e.actual||e.currentValue||"",s=parseFloat(i),l=parseFloat(a);return isNaN(s)||isNaN(l)?!1:Math.abs(s-l)<xT}function eW(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase(),r=String(e.expected||e.suggestedValue||"").toLowerCase(),n=String(e.actual||e.currentValue||"").toLowerCase();if(!WV.some(d=>t.includes(d)||r.includes(d)))return!1;let i=`${t} ${r} ${n}`;if(i.includes("min-width")||i.includes("max-width")||i.includes("min-height")||i.includes("max-height")||i.includes("explicit")||i.includes("constraint")||i.includes("forced"))return!1;let s=r.includes("hug")||r.includes("auto"),l=/\d+\.?\d*px/.test(n);if(!s||!l)return!1;let u=r.match(/(\d+\.?\d*)px/),c=n.match(/(\d+\.?\d*)px/);return!(u&&c&&Math.abs(parseFloat(u[1])-parseFloat(c[1]))>jV)}function tW(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),r=String(e.actual||e.currentValue||"").toLowerCase();return(!r||!t||r.includes("see ")||t.includes("see ")||r.includes("image")||t.includes("image"))&&e.type==="visual"}function wT(e){return(e||"").toLowerCase().replace(/[\s_-]/g,"")==="fontfamily"}function rW(e){return(e||"").toLowerCase().replace(/[\s_-]/g,"")==="fontweight"}function nW(e,t,r){if(!wT(r))return!1;let n=al(e,{stripSeparators:!0}),o=al(t,{stripSeparators:!0});return n.length>0&&o.length>0&&n===o}function oW(e,t,r){return wT(r)?dT(e,t):!1}function iW(e,t,r){return rW(r)?fT(e,t):!1}function jc(e){let t=e.expected||e.suggestedValue,r=e.actual||e.currentValue;return nW(t,r,e.property)?{dismissed:!0,dismissReason:"Auto-dismissed: font-family naming difference (same font)",dismissedBy:"post-ai-validation"}:oW(t,r,e.property)?{dismissed:!0,dismissReason:"Auto-dismissed: system font stack equivalence (-apple-system renders as SF Pro)",dismissedBy:"post-ai-validation"}:iW(t,r,e.property)?{dismissed:!0,dismissReason:"Auto-dismissed: font weight renders identically (same named weight)",dismissedBy:"post-ai-validation"}:e.programmaticallyVerified?{dismissed:!1}:e.fixRequired===!1?{dismissed:!0,dismissReason:"Auto-dismissed: FixRequired is false (no code change needed)",dismissedBy:"post-ai-validation"}:Qa(t,r,e.property)?{dismissed:!0,dismissReason:"Auto-dismissed: expected equals actual (identical values)",dismissedBy:"post-ai-validation"}:qV(e)?{dismissed:!0,dismissReason:`Auto-dismissed: imperceptible color difference (\u0394E < ${2})`,dismissedBy:"post-ai-validation"}:e.fixRequired===!0?{dismissed:!1}:ZV(e)?{dismissed:!0,dismissReason:`Auto-dismissed: text dimension variance (<${xT}px) - font rendering difference, not actionable`,dismissedBy:"post-ai-validation"}:XV(t,r,e)?{dismissed:!0,dismissReason:`Auto-dismissed: negligible difference (<${bT(e.property)?hT:mT}px)`,dismissedBy:"post-ai-validation"}:tW(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no measurable values to compare",dismissedBy:"post-ai-validation"}:JV(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no fix needed",dismissedBy:"post-ai-validation"}:eW(e)?{dismissed:!0,dismissReason:"Auto-dismissed: HUG sizing - CSS auto-sizes content without explicit dimensions",dismissedBy:"post-ai-validation"}:QV(e)?{dismissed:!0,dismissReason:"Auto-dismissed: SVG container fill - child elements use their own fills",dismissedBy:"post-ai-validation"}:{dismissed:!1}}var mT,hT,xT,jV,VV,WV,GV,KV,vT=H(()=>{"use strict";fy();hy();Md();mT=.5,hT=2,xT=2,jV=5,VV=["values match","values already match","already correct","correctly implemented","implementation is correct","css matches","matches figma","identical","same value","no difference","none - ","no changes needed","no fix needed"],WV=["hug","auto (hug)","should be hug","fixed pixel values are being rendered","fixed values are being rendered"],GV=["duplicate","extra","missing","additional","removed","should not exist","does not exist","not in figma","not in storybook","renders 2","renders two","has 1","has one"];KV=new Set(["width","height","minwidth","maxwidth","minheight","maxheight","min-width","max-width","min-height","max-height"])});var ST=H(()=>{"use strict"});var kT=H(()=>{"use strict"});var Pd=H(()=>{"use strict";fy();vT();hy();ST();kT()});var fW,gW,oxe,yy=H(()=>{"use strict";fW=["flex","inline-flex"],gW=["grid","inline-grid"],oxe=[...fW,...gW]});var ET=H(()=>{"use strict";Pd();yy()});var TT=H(()=>{"use strict"});var IT=H(()=>{"use strict"});var RT=H(()=>{"use strict"});var by=H(()=>{"use strict";Md()});var wy=H(()=>{"use strict";by();Pd()});var vy=H(()=>{"use strict"});var Sy=H(()=>{"use strict"});function Ld(e){return typeof e=="string"&&e.startsWith("element:")}function FT(e){return!e||e.length===0?"":` (${e.slice(0,AT).join(", ")}${e.length>AT?", \u2026":""})`}function MT(e){let t=String(e.property).slice(8),[r,n]=hW[t]??[t,`${t}s`],o=Number(e.expected),i=Number(e.actual),a=o>i,s=Math.abs(o-i),l=u=>u===1?r:n;return{title:`${a?"Missing":"Extra"} ${s===1?r:`${s} ${n}`} in code`,description:`Design has ${o} ${l(o)}${FT(e.elements?.figma)}; code renders ${i}${FT(e.elements?.code)}. `+(a?`${s===1?"One is":`${s} are`} in the design but not implemented.`:`${s===1?"One is":`${s} are`} rendered but not in the design.`),suggested:`${o} ${l(o)}`,current:`${i} ${l(i)}`}}var hW,AT,PT=H(()=>{"use strict";hW={icon:["icon","icons"],text:["text element","text elements"],image:["image","images"],shape:["shape","shapes"]},AT=4});var LT=H(()=>{"use strict"});function _T(e,t){let r=e?.split("/").pop()?.trim();return r||(t?.trim()??"")}var BT=H(()=>{"use strict"});var zT=H(()=>{"use strict"});var _d=H(()=>{"use strict";vy();wy()});var DT=H(()=>{"use strict"});var ky=H(()=>{"use strict";_d()});var Cy=H(()=>{"use strict";Sy()});var NT=H(()=>{"use strict";ky();_d();Cy()});var OT=H(()=>{"use strict";IT();RT();by();wy();vy();Sy();PT();LT();BT();zT();_d();DT();ky();Cy();NT()});var $T=H(()=>{"use strict";Md()});var Vc,HT=H(()=>{"use strict";Vc={admin:{enableFixGeneration:!1,enableFixApply:!0,enableAutoMap:!0,enableAutoFigmaLinking:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableAutoFigmaLinking:!0,enableReviewBadges:!0,showCosts:!1,enableParallelReview:!0,enableModelSelection:!1},anonymous:{enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableAutoFigmaLinking:!0,enableReviewBadges:!0,showCosts:!1,enableParallelReview:!0,enableModelSelection:!1}}});var dr=H(()=>{"use strict";c0();wk();vk();Pd();yy();ET();TT();OT();$T();HT()});function yW(e){let{aiPrompt:t,aiResponse:r,...n}=e;return n}function Jn(e){try{let t=e.map(yW),r=JSON.stringify(t,bW);sessionStorage.setItem(Ey,r)}catch(t){w.error("[SessionStorage] Failed to save review history:",t)}}function Ty(){try{let e=sessionStorage.getItem(Ey);if(!e)return[];let t=JSON.parse(e,wW);return Array.isArray(t)?t:[]}catch(e){return w.error("[SessionStorage] Failed to load review history:",e),[]}}function UT(){try{let e=Ty();if(e.length===0)return;let t=!1,r=e.map(n=>{if(n.aiPrompt!==void 0||n.aiResponse!==void 0){t=!0;let{aiPrompt:o,aiResponse:i,...a}=n;return a}return n});t&&(Jn(r),w.debug("[SessionStorage] Stripped aiPrompt/aiResponse from existing review history"))}catch(e){w.error("[SessionStorage] Failed to strip sensitive fields:",e)}}function jT(){try{sessionStorage.removeItem(Ey),w.debug("[SessionStorage] Review history cleared")}catch(e){w.error("[SessionStorage] Failed to clear review history:",e)}}function bW(e,t){return t instanceof Date?{__type:"Date",value:t.toISOString()}:t}function wW(e,t){return t&&t.__type==="Date"?new Date(t.value):t}var Ey,Iy=H(()=>{"use strict";Ne();Ey="uicopilot_review_history"});import vW,{createContext as SW,useContext as kW,useReducer as CW,useMemo as VT,useRef as EW,useEffect as TW}from"react";function Bd(e){let t=e.length>WT?e.slice(e.length-WT):e,r=Math.max(0,t.length-IW);return r===0?t:t.map((n,o)=>{if(o>=r)return n;let i=n.storybookImageData?.startsWith("data:"),a=n.figmaImageData?.startsWith("data:");return!i&&!a?n:{...n,storybookImageData:i?void 0:n.storybookImageData,figmaImageData:a?void 0:n.figmaImageData}})}function RW(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"REQUEST_REVIEW_RETRY":return{...e,reviewRetryNonce:e.reviewRetryNonce+1};case"ADD_STREAMING_MESSAGE":return{...e,streamingMessages:[...e.streamingMessages,t.payload]};case"UPDATE_STREAMING_MESSAGE":return{...e,streamingMessages:e.streamingMessages.map((r,n)=>n===t.payload.index?{...r,content:t.payload.content}:r)};case"CLEAR_STREAMING_MESSAGES":return{...e,streamingMessages:[]};case"TOGGLE_MODEL":{let r=e.selectedModels.includes(t.payload);return r&&e.selectedModels.length===1?e:{...e,selectedModels:r?e.selectedModels.filter(n=>n!==t.payload):[...e.selectedModels,t.payload]}}case"SET_REVIEW_RESULTS":{if(!t.payload)return{...e,reviewResults:null,currentReviewId:null};let r=e.userRole==="admin",n={id:t.payload.id,componentId:t.payload.componentId,storyId:t.payload.storyId,modelId:t.payload.modelId,complianceScore:t.payload.complianceScore,issuesCount:t.payload.issuesCount,issues:t.payload.issues,createdAt:t.payload.createdAt,visualSimilarity:t.payload.visualSimilarity,storybookImageData:t.payload.storybookImageData||e.storybookImageUrl||void 0,figmaImageData:t.payload.figmaImageData||e.figmaImageUrl||void 0,figmaComponentProperties:t.payload.figmaComponentProperties,aiPrompt:r&&e.fullPrompt||void 0,aiResponse:r&&e.fullResponse||void 0,costUsd:t.payload.costUsd,inputTokens:t.payload.inputTokens,outputTokens:t.payload.outputTokens,reviewDurationMs:t.payload.reviewDurationMs},o=e.reviewHistory.findIndex(a=>a.id===t.payload.id),i;return o>=0?i=e.reviewHistory.map((a,s)=>s===o?n:a):i=[...e.reviewHistory,n],i=Bd(i),Jn(i),{...e,reviewResults:t.payload,reviewHistory:i,currentReviewId:t.payload.id,isNewReviewMode:!1}}case"UPDATE_MULTI_MODEL_STREAMING":return e.multiModelResults?{...e,multiModelResults:{...e.multiModelResults,byModel:{...e.multiModelResults.byModel,[t.payload.modelId]:{...e.multiModelResults.byModel[t.payload.modelId],streamingMessages:t.payload.messages}}}}:{...e,multiModelResults:{byModel:{[t.payload.modelId]:{streamingMessages:t.payload.messages}},activeModelId:t.payload.modelId}};case"SET_MODEL_COMPLETED":return e.multiModelResults?{...e,multiModelResults:{...e.multiModelResults,byModel:{...e.multiModelResults.byModel,[t.payload]:{...e.multiModelResults.byModel[t.payload],completed:!0}}}}:e;case"BULK_ADD_REVIEWS":{if(t.payload.length===0)return e;let r=new Map(e.reviewHistory.map(a=>[a.id,a])),n=!1,o=e.reviewHistory.slice();for(let a of t.payload){let s=r.get(a.id);if(!s){o.push(a),n=!0;continue}let l=a.issues?.length??0,u=s.issues?.length??0;if(l>u){let c=o.indexOf(s);c!==-1&&(o[c]=a,n=!0)}}if(!n)return e;let i=Bd(o);return Jn(i),{...e,reviewHistory:i}}case"ADD_REVIEW":{let r=Bd([...e.reviewHistory,t.payload]);return Jn(r),{...e,reviewHistory:r,currentReviewId:t.payload.id,isNewReviewMode:!1}}case"TOGGLE_ISSUE_SELECTION":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>n.id!==e.currentReviewId?n:{...n,issues:n.issues.map(o=>o.id===t.payload?{...o,selectedForFix:!o.selectedForFix}:o)});return Jn(r),{...e,reviewHistory:r}}case"UPDATE_ISSUE_STATUS":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>n.id!==e.currentReviewId?n:{...n,issues:n.issues.map(o=>o.id===t.payload.issueId?{...o,status:t.payload.status,error:t.payload.error}:o)});return Jn(r),{...e,reviewHistory:r}}case"UPDATE_ISSUE_GENERATED_FIX":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>n.id!==e.currentReviewId?n:{...n,issues:n.issues.map(o=>o.id===t.payload.issueId?{...o,generatedFix:o.generatedFix?{...o.generatedFix,...t.payload.generatedFix}:t.payload.generatedFix,selectedForFix:t.payload.generatedFix?.status==="failed"?!1:o.selectedForFix}:o)});return Jn(r),{...e,reviewHistory:r}}case"BATCH_UPDATE_ISSUE_GENERATED_FIXES":{if(!e.currentReviewId)return e;let r=new Map(t.payload.map(o=>[o.issueId,o.generatedFix])),n=e.reviewHistory.map(o=>o.id!==e.currentReviewId?o:{...o,issues:o.issues.map(i=>{let a=r.get(i.id);return a?{...i,generatedFix:i.generatedFix?{...i.generatedFix,...a}:a,selectedForFix:a?.status==="failed"?!1:i.selectedForFix}:i})});return Jn(n),{...e,reviewHistory:n}}case"DISMISS_ISSUE":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>{if(n.id!==e.currentReviewId)return n;let o=n.issues.map(u=>u.id===t.payload.issueId?{...u,dismissed:!0,dismissReason:t.payload.reason,dismissedAt:new Date,dismissedBy:t.payload.dismissedBy}:u),i=o.filter(u=>!u.dismissed),a=i.filter(u=>u.severity==="critical").length,s=i.filter(u=>u.severity==="major").length,l=i.filter(u=>u.severity==="minor").length;return{...n,issues:o,complianceScore:Oi(a,s,l),issuesCount:i.length}});return Jn(r),{...e,reviewHistory:r}}case"UNDISMISS_ISSUE":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>{if(n.id!==e.currentReviewId)return n;let o=n.issues.map(u=>u.id===t.payload?{...u,dismissed:!1,dismissReason:void 0,dismissedAt:void 0}:u),i=o.filter(u=>!u.dismissed),a=i.filter(u=>u.severity==="critical").length,s=i.filter(u=>u.severity==="major").length,l=i.filter(u=>u.severity==="minor").length;return{...n,issues:o,complianceScore:Oi(a,s,l),issuesCount:i.length}});return Jn(r),{...e,reviewHistory:r}}case"RECALCULATE_SCORE":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>{if(n.id!==e.currentReviewId)return n;let o=n.issues.filter(u=>!u.dismissed),i=o.filter(u=>u.severity==="critical").length,a=o.filter(u=>u.severity==="major").length,s=o.filter(u=>u.severity==="minor").length,l=Oi(i,a,s);return w.debug(`[recalculateScore] Active: ${o.length}, score: ${l}`),{...n,complianceScore:l,issuesCount:o.length}});return Jn(r),{...e,reviewHistory:r}}case"UPDATE_REVIEW_SCORE":{let r=e.reviewHistory.map(n=>n.id!==t.payload.reviewId?n:{...n,complianceScore:t.payload.newScore});return Jn(r),{...e,reviewHistory:r}}case"CLEAR_ALL_REVIEWS":return jT(),{...e,reviewHistory:[],currentReviewId:null};case"CLEAR_STALE_REVIEWS":return{...e,currentReviewId:null,reviewResults:null,isNewReviewMode:!1};case"RESET_REVIEW":{let r=e.isReviewing;return{...e,isReviewing:!1,reviewError:null,reviewResults:r?null:e.reviewResults,multiModelResults:null,streamingMessages:[],streamingProgress:0,streamingStatus:"",reviewDetailTab:r?"chat":e.reviewDetailTab,fullPrompt:"",fullResponse:"",figmaImageUrl:r?null:e.figmaImageUrl,storybookImageUrl:r?null:e.storybookImageUrl,currentReviewId:r?null:e.currentReviewId}}case"RESET_PROMPT":return{...e,isGenerating:!1,generatedPrompt:null,promptError:null};case"TRIGGER_SCREENSHOT_REFRESH":return{...e,screenshotRefreshKey:e.screenshotRefreshKey+1};default:return e}}function Ay({children:e}){let[t,r]=CW(RW,LW),n=EW(t);TW(()=>{n.current=t},[t]);let o=VT(()=>({setIsReviewing:a=>r({type:"SET_STATE",payload:{isReviewing:a}}),setReviewingStoryId:a=>r({type:"SET_STATE",payload:{reviewingStoryId:a}}),setReviewError:a=>r({type:"SET_STATE",payload:{reviewError:a}}),requestReviewRetry:()=>r({type:"REQUEST_REVIEW_RETRY"}),bulkAddReviews:a=>r({type:"BULK_ADD_REVIEWS",payload:a}),setReviewResults:a=>r({type:"SET_REVIEW_RESULTS",payload:a}),setMultiModelResults:a=>r({type:"SET_STATE",payload:{multiModelResults:a}}),updateMultiModelStreamingMessages:(a,s)=>r({type:"UPDATE_MULTI_MODEL_STREAMING",payload:{modelId:a,messages:s}}),setModelCompleted:a=>r({type:"SET_MODEL_COMPLETED",payload:a}),setActiveModelId:a=>{let s=n.current;s.multiModelResults&&r({type:"SET_STATE",payload:{multiModelResults:{...s.multiModelResults,activeModelId:a}}})},setShowReviewMenu:a=>r({type:"SET_STATE",payload:{showReviewMenu:a}}),setSeverityFilter:a=>r({type:"SET_STATE",payload:{severityFilter:a}}),setShowStreamingPanel:a=>r({type:"SET_STATE",payload:{showStreamingPanel:a}}),setStreamingPanelCollapsed:a=>r({type:"SET_STATE",payload:{streamingPanelCollapsed:a}}),addStreamingMessage:a=>r({type:"ADD_STREAMING_MESSAGE",payload:a}),updateStreamingMessage:(a,s)=>r({type:"UPDATE_STREAMING_MESSAGE",payload:{index:a,content:s}}),clearStreamingMessages:()=>r({type:"CLEAR_STREAMING_MESSAGES"}),setStreamingProgress:a=>r({type:"SET_STATE",payload:{streamingProgress:a}}),setStreamingStatus:a=>r({type:"SET_STATE",payload:{streamingStatus:a}}),setReviewDetailTab:a=>r({type:"SET_STATE",payload:{reviewDetailTab:a}}),setFullPrompt:a=>r({type:"SET_STATE",payload:{fullPrompt:a}}),setFullResponse:a=>r({type:"SET_STATE",payload:{fullResponse:a}}),setFigmaImageUrl:a=>r({type:"SET_STATE",payload:{figmaImageUrl:a}}),setStorybookImageUrl:a=>r({type:"SET_STATE",payload:{storybookImageUrl:a}}),setFigmaDimensions:a=>r({type:"SET_STATE",payload:{figmaDimensions:a}}),setSelectedModels:a=>r({type:"SET_STATE",payload:{selectedModels:a}}),toggleModel:a=>r({type:"TOGGLE_MODEL",payload:a}),setModelComparisonView:a=>r({type:"SET_STATE",payload:{modelComparisonView:a}}),resetReview:()=>r({type:"RESET_REVIEW"}),addReview:a=>r({type:"ADD_REVIEW",payload:a}),getCurrentReview:()=>{let a=n.current;return a.currentReviewId&&a.reviewHistory.find(s=>s.id===a.currentReviewId)||null},getReviewById:a=>n.current.reviewHistory.find(s=>s.id===a)||null,getParentReview:()=>{let a=n.current,s=a.reviewHistory.find(l=>l.id===a.currentReviewId);return s?.parentReviewId&&a.reviewHistory.find(l=>l.id===s.parentReviewId)||null},hasAppliedFixes:()=>{let a=n.current,s=a.reviewHistory.find(l=>l.id===a.currentReviewId);return!s||!Array.isArray(s.issues)||s.issues.length===0?!1:s.issues.some(l=>l.status==="applied"||l.generatedFix?.status==="applied")},toggleIssueSelection:a=>r({type:"TOGGLE_ISSUE_SELECTION",payload:a}),updateIssueStatus:(a,s,l)=>r({type:"UPDATE_ISSUE_STATUS",payload:{issueId:a,status:s,error:l}}),updateIssueGeneratedFix:(a,s)=>r({type:"UPDATE_ISSUE_GENERATED_FIX",payload:{issueId:a,generatedFix:s}}),batchUpdateIssueGeneratedFixes:a=>r({type:"BATCH_UPDATE_ISSUE_GENERATED_FIXES",payload:a}),dismissIssue:(a,s,l)=>r({type:"DISMISS_ISSUE",payload:{issueId:a,reason:s,dismissedBy:l}}),undismissIssue:a=>r({type:"UNDISMISS_ISSUE",payload:a}),recalculateScore:()=>r({type:"RECALCULATE_SCORE"}),updateReviewScore:(a,s)=>r({type:"UPDATE_REVIEW_SCORE",payload:{reviewId:a,newScore:s}}),clearAllReviews:()=>r({type:"CLEAR_ALL_REVIEWS"}),clearStaleReviewsForStory:a=>r({type:"CLEAR_STALE_REVIEWS",payload:a}),setIsApplying:a=>r({type:"SET_STATE",payload:{isApplying:a}}),setApplyFixesResult:a=>r({type:"SET_STATE",payload:{applyFixesResult:a}}),setIncludeComponentIssues:a=>r({type:"SET_STATE",payload:{includeComponentIssues:a}}),setIncludeTextComparison:a=>r({type:"SET_STATE",payload:{includeTextComparison:a}}),setUsePromptCache:a=>r({type:"SET_STATE",payload:{usePromptCache:a}}),setIsValidating:a=>r({type:"SET_STATE",payload:{isValidating:a}}),setIsSpecChecking:a=>r({type:"SET_STATE",payload:{isSpecChecking:a}}),setReviewHistoryLoading:a=>r({type:"SET_STATE",payload:{reviewHistoryLoading:a}}),setValidationUsage:a=>r({type:"SET_STATE",payload:{validationUsage:a}}),setWorkspacePath:a=>r({type:"SET_STATE",payload:{workspacePath:a}}),triggerScreenshotRefresh:()=>r({type:"TRIGGER_SCREENSHOT_REFRESH"}),setHoveredIssueId:a=>r({type:"SET_STATE",payload:{hoveredIssueId:a}}),setNewReviewMode:a=>r({type:"SET_STATE",payload:{isNewReviewMode:a}}),setPendingSettingsOpen:a=>r({type:"SET_STATE",payload:{pendingSettingsOpen:a}}),setFeatureFlags:a=>r({type:"SET_STATE",payload:{featureFlags:a}}),setUserRole:a=>r({type:"SET_STATE",payload:{userRole:a}}),setRoleOverride:a=>{try{a?localStorage.setItem("uicopilot_role_override",a):localStorage.removeItem("uicopilot_role_override")}catch{}r({type:"SET_STATE",payload:{roleOverride:a}})},setReviewAllConcurrency:a=>{let s=Math.max(1,Math.min(5,a));try{localStorage.setItem("uicopilot_review_all_concurrency",String(s))}catch{}r({type:"SET_STATE",payload:{reviewAllConcurrency:s}})},setIsGenerating:a=>r({type:"SET_STATE",payload:{isGenerating:a}}),setGeneratedPrompt:a=>r({type:"SET_STATE",payload:{generatedPrompt:a}}),setPromptError:a=>r({type:"SET_STATE",payload:{promptError:a}}),resetPrompt:()=>r({type:"RESET_PROMPT"})}),[]),i=VT(()=>({...t,...o}),[t,o]);return vW.createElement(GT.Provider,{value:i},e)}function we(){let e=kW(GT);if(!e)throw new Error("useReviewStore must be used within a ReviewProvider");return e}var WT,IW,AW,FW,Ry,MW,PW,LW,GT,Fy=H(()=>{"use strict";dr();Iy();Ne();WT=20,IW=5;AW=()=>{if(typeof localStorage>"u")return 3;try{let e=localStorage.getItem("uicopilot_review_all_concurrency");if(e)return Math.max(1,Math.min(5,parseInt(e,10)))}catch{}return 3},FW=()=>{if(typeof localStorage>"u")return null;try{let e=localStorage.getItem("uicopilot_role_override");if(e==="admin"||e==="beta")return e}catch{}return null},Ry={enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableAutoFigmaLinking:!1,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1},MW=()=>{if(typeof localStorage>"u")return Ry;try{let e=localStorage.getItem("uicopilot_feature_flags");if(!e)return Ry;let t=JSON.parse(e);return{enableFixGeneration:!!t.enableFixGeneration,enableFixApply:!!t.enableFixApply,enableAutoMap:!!t.enableAutoMap,enableAutoFigmaLinking:!!t.enableAutoFigmaLinking,enableReviewBadges:!!t.enableReviewBadges,showCosts:!!t.showCosts,enableParallelReview:!!t.enableParallelReview,enableModelSelection:!!t.enableModelSelection}}catch{}return Ry},PW=()=>{if(typeof localStorage>"u")return"beta";try{let e=localStorage.getItem("uicopilot_user_role");if(e==="admin"||e==="beta")return e}catch{}return"beta"},LW={isReviewing:!1,reviewingStoryId:null,reviewError:null,reviewRetryNonce:0,reviewResults:null,multiModelResults:null,showReviewMenu:!1,severityFilter:"all",showStreamingPanel:!1,streamingPanelCollapsed:!1,streamingMessages:[],streamingProgress:0,streamingStatus:"",reviewDetailTab:"chat",fullPrompt:"",fullResponse:"",figmaImageUrl:null,storybookImageUrl:null,figmaDimensions:null,selectedModels:["claude-sonnet-4-6"],modelComparisonView:"side-by-side",reviewHistory:Bd(Ty()),currentReviewId:null,includeComponentIssues:!0,includeTextComparison:!1,usePromptCache:!1,isApplying:!1,applyFixesResult:null,screenshotRefreshKey:0,isValidating:!1,isSpecChecking:!1,reviewHistoryLoading:!1,validationUsage:null,lastAiCallTimestamp:null,aiRateLimitSeconds:0,isGenerating:!1,generatedPrompt:null,promptError:null,workspacePath:null,userRole:PW(),roleOverride:FW(),featureFlags:MW(),reviewAllConcurrency:AW(),hoveredIssueId:null,isNewReviewMode:!1,pendingSettingsOpen:!1},GT=SW(null)});import Wc,{useMemo as _W}from"react";function Py({children:e}){return Wc.createElement(n0,null,Wc.createElement(i0,null,Wc.createElement(s0,null,Wc.createElement(Ay,null,Wc.createElement(BW,null),e))))}function qT(e){let t=be(),r=Ge(),n=bt(),o=we(),i=_W(()=>({...t,...r,...n,...o}),[t,r,n,o]);return e?e(i):i}function BW(){return My=qT(),null}var My,Tt,YT=H(()=>{"use strict";o0();a0();l0();Fy();My=null,Tt=Object.assign(qT,{getState:()=>{if(!My)throw new Error("Store not initialized. Make sure StoreProvider is mounted.");return My}})});var Ce=H(()=>{"use strict";YT();o0();a0();l0();Fy()});function q(){return(process.env.STORYBOOK_UICOPILOT_URL||zW).replace(/\/$/,"")}var zW,KT,XT,Fe=H(()=>{"use strict";zW="http://localhost:3000",KT="0.18.0";XT=3.6});async function X(e,t,r=3e4){let n=new AbortController,o=setTimeout(()=>n.abort(),r);try{return await fetch(e,{...t,signal:n.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new Error(`Request timed out after ${r}ms: ${e}`):i}finally{clearTimeout(o)}}var tt=H(()=>{"use strict"});function dl(e){let n=e.ownerDocument?.defaultView;if(!n)return e.firstElementChild??e;let o=e.getBoundingClientRect(),i=l=>{let u=n.getComputedStyle(l);if(u.position==="fixed"||u.display==="none"||u.visibility==="hidden")return!0;let c=l.getBoundingClientRect();return c.width===0||c.height===0||l.children.length===0&&!(l.textContent??"").trim()},a=l=>{if(o.width===0||o.height===0)return!1;let u=l.getBoundingClientRect();return u.width>=o.width*.9&&u.height>=o.height*.9},s=e;for(let l=0;l<6;l+=1){let u=Array.from(s.children).filter(c=>!i(c));if(u.length!==1||s!==e&&!a(s))break;s=u[0]}return s===e?e.firstElementChild??e:s}var $d=H(()=>{"use strict"});function DG(){return!q().startsWith("http://localhost")}function NG(e,t,r){let n=t.createElement("div");n.style.color=e,t.body.appendChild(n);let o=r.getComputedStyle(n).color;return n.remove(),o}function EI(e,t,r){let n=new Map;return e.replace(/(?:color|oklch|oklab|lab|lch)\([^)]+\)/g,o=>{if(n.has(o))return n.get(o);let i=NG(o,t,r);return n.set(o,i),i})}async function OG(){let e=(await import("html2canvas")).default,t=document.getElementById("storybook-preview-iframe");if(!t?.contentDocument||!t.contentWindow)throw new Error("Storybook iframe not accessible");let r=t.contentDocument.getElementById("storybook-root")||t.contentDocument.getElementById("root");if(!r)throw new Error("Story root not found in iframe");let n=dl(r);if(!n)throw new Error("Story element not found in iframe");let o=t.contentWindow,i=t.contentDocument;return(await e(n,{useCORS:!0,logging:!1,backgroundColor:null,scale:1,onclone:s=>{s.querySelectorAll("style").forEach(u=>{let c=u.textContent||"";/(?:color|oklch|oklab|lab|lch)\(/.test(c)&&(u.textContent=EI(c,i,o))});let l=Array.from(i.styleSheets);s.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{let c=u.href,d=l.find(f=>f.href===c);if(d)try{let f="";for(let p of Array.from(d.cssRules))f+=p.cssText+`
12
+ --`+new Array((r||t.length)+1).join("-")+"^"})}var OC=H(()=>{"use strict";ed()});var DO,NO,OO,$O,HO,$C,hd,HC=H(()=>{"use strict";OC();DO=9,NO=10,OO=12,$O=13,HO=32,$C=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),hd=class{constructor(t){this.str=t,this.pos=0}charCodeAt(t){return t<this.str.length?this.str.charCodeAt(t):0}charCode(){return this.charCodeAt(this.pos)}isNameCharCode(t=this.charCode()){return t<128&&$C[t]===1}nextCharCode(){return this.charCodeAt(this.pos+1)}nextNonWsCode(t){return this.charCodeAt(this.findWsEnd(t))}skipWs(){this.pos=this.findWsEnd(this.pos)}findWsEnd(t){for(;t<this.str.length;t++){let r=this.str.charCodeAt(t);if(r!==$O&&r!==NO&&r!==OO&&r!==HO&&r!==DO)break}return t}substringToPos(t){return this.str.substring(this.pos,this.pos=t)}eat(t){this.charCode()!==t&&this.error("Expect `"+String.fromCharCode(t)+"`"),this.pos++}peek(){return this.pos<this.str.length?this.str.charAt(this.pos++):""}error(t){throw new NC(t,this.str,this.pos)}scanSpaces(){return this.substringToPos(this.findWsEnd(this.pos))}scanWord(){let t=this.pos;for(;t<this.str.length;t++){let r=this.str.charCodeAt(t);if(r>=128||$C[r]===0)break}return this.pos===t&&this.error("Expect a keyword"),this.substringToPos(t)}scanNumber(){let t=this.pos;for(;t<this.str.length;t++){let r=this.str.charCodeAt(t);if(r<48||r>57)break}return this.pos===t&&this.error("Expect a number"),this.substringToPos(t)}scanString(){let t=this.str.indexOf("'",this.pos+1);return t===-1&&(this.pos=this.str.length,this.error("Expect an apostrophe")),this.substringToPos(t+1)}}});function qC(e){let t=null,r=null;return e.eat(bd),e.skipWs(),t=e.scanNumber(e),e.skipWs(),e.charCode()===X0?(e.pos++,e.skipWs(),e.charCode()!==q0&&(r=e.scanNumber(e),e.skipWs())):r=t,e.eat(q0),{min:Number(t),max:r?Number(r):0}}function YO(e){let t=null,r=!1;switch(e.charCode()){case JC:e.pos++,t={min:0,max:0};break;case K0:e.pos++,t={min:1,max:0};break;case yd:e.pos++,t={min:0,max:1};break;case Y0:e.pos++,r=!0,e.charCode()===bd?t=qC(e):e.charCode()===yd?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case bd:t=qC(e);break;default:return null}return{type:"Multiplier",comma:r,min:t.min,max:t.max,term:null}}function Ni(e,t){let r=YO(e);return r!==null?(r.term=t,e.charCode()===Y0&&e.charCodeAt(e.pos-1)===K0||e.charCode()===yd&&e.charCodeAt(e.pos-1)===q0?Ni(e,r):r):t}function W0(e){let t=e.peek();return t===""?null:Ni(e,{type:"Token",value:t})}function KO(e){let t;return e.eat(J0),e.eat(xd),t=e.scanWord(),e.eat(xd),e.eat(G0),Ni(e,{type:"Property",name:t})}function XO(e){let t=null,r=null,n=1;return e.eat(Ac),e.charCode()===jC&&(e.peek(),n=-1),n==-1&&e.charCode()===WC?e.peek():(t=n*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(X0),e.skipWs(),e.charCode()===WC?e.peek():(n=1,e.charCode()===jC&&(e.peek(),n=-1),r=n*Number(e.scanNumber(e)),e.isNameCharCode()&&(r+=e.scanWord())),e.eat(rl),{type:"Range",min:t,max:r}}function JO(e){let t,r=null;if(e.eat(J0),t=e.scanWord(),t==="boolean-expr"){e.eat(Ac);let n=wd(e,rl);return e.eat(rl),e.eat(G0),Ni(e,{type:"Boolean",term:n.terms.length===1?n.terms[0]:n})}return e.charCode()===KC&&e.nextCharCode()===XC&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===Ac&&(e.skipWs(),r=XO(e)),e.eat(G0),Ni(e,{type:"Type",name:t,opts:r})}function QO(e){let t=e.scanWord();return e.charCode()===KC?(e.pos++,{type:"Function",name:t}):Ni(e,{type:"Keyword",name:t})}function ZO(e,t){function r(o,i){return{type:"Group",terms:o,combinator:i,disallowEmpty:!1,explicit:!1}}let n;for(t=Object.keys(t).sort((o,i)=>GC[o]-GC[i]);t.length>0;){n=t.shift();let o=0,i=0;for(;o<e.length;o++){let a=e[o];a.type==="Combinator"&&(a.value===n?(i===-1&&(i=o-1),e.splice(o,1),o--):(i!==-1&&o-i>1&&(e.splice(i,o-i,r(e.slice(i,o),n)),o=i+1),i=-1))}i!==-1&&t.length&&e.splice(i,o-i,r(e.slice(i,o),n))}return n}function wd(e,t=-1){let r=Object.create(null),n=[],o=null,i=e.pos,a=!1;for(;e.charCode()!==t;){let s=a?wd(e,XC):t$(e);if(!s)break;if(s.type!=="Spaces"){if(a){if(s.terms.length===0){a=!1;continue}if(s.combinator===" "){for(;s.terms.length>1;)r[" "]=!0,n.push({type:"Combinator",value:" "},s.terms.shift());s=s.terms[0]}}s.type==="Combinator"?((o===null||o.type==="Combinator")&&(e.pos=i,e.error("Unexpected combinator")),r[s.value]=!0):o!==null&&o.type!=="Combinator"&&(r[" "]=!0,n.push({type:"Combinator",value:" "})),n.push(s),o=s,i=e.pos,a=s.type==="Function"}}return o!==null&&o.type==="Combinator"&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:n,combinator:ZO(n,r)||" ",disallowEmpty:!1,explicit:!1}}function e$(e){let t;return e.eat(Ac),t=wd(e,rl),e.eat(rl),t.explicit=!0,e.charCode()===YC&&(e.pos++,t.disallowEmpty=!0),t}function t$(e){let t=e.charCode();switch(t){case rl:break;case Ac:return Ni(e,e$(e));case J0:return e.nextCharCode()===xd?KO(e):JO(e);case VC:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===VC?2:1))};case UC:return e.pos++,e.eat(UC),{type:"Combinator",value:"&&"};case X0:return e.pos++,{type:"Comma"};case xd:return Ni(e,{type:"String",value:e.scanString()});case GO:case UO:case jO:case WO:case VO:return{type:"Spaces",value:e.scanSpaces()};case qO:return t=e.nextCharCode(),e.isNameCharCode(t)?(e.pos++,{type:"AtKeyword",name:e.scanWord()}):W0(e);case JC:case K0:case yd:case Y0:case YC:break;case bd:if(t=e.nextCharCode(),t<48||t>57)return W0(e);break;default:return e.isNameCharCode(t)?QO(e):W0(e)}}function Fc(e){let t=new hd(e),r=wd(t);return t.pos!==e.length&&t.error("Unexpected input"),r.terms.length===1&&r.terms[0].type==="Group"?r.terms[0]:r}var UO,jO,VO,WO,GO,YC,Y0,UC,xd,KC,XC,JC,K0,X0,jC,J0,G0,yd,qO,Ac,rl,bd,VC,q0,WC,GC,Q0=H(()=>{"use strict";HC();UO=9,jO=10,VO=12,WO=13,GO=32,YC=33,Y0=35,UC=38,xd=39,KC=40,XC=41,JC=42,K0=43,X0=44,jC=45,J0=60,G0=62,yd=63,qO=64,Ac=91,rl=93,bd=123,VC=124,q0=125,WC=8734,GC={" ":1,"&&":2,"||":3,"|":4}});function QC(e){return typeof e=="function"?e:Mc}function Z0(e,t,r){function n(a){switch(o.call(r,a),a.type){case"Group":a.terms.forEach(n);break;case"Multiplier":case"Boolean":n(a.term);break;case"Type":case"Property":case"Keyword":case"AtKeyword":case"Function":case"String":case"Token":case"Comma":break;default:throw new Error("Unknown type: "+a.type)}i.call(r,a)}let o=Mc,i=Mc;if(typeof t=="function"?o=t:t&&(o=QC(t.enter),i=QC(t.leave)),o===Mc&&i===Mc)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");n(e,r)}var Mc,ZC=H(()=>{"use strict";Mc=function(){}});var eh=H(()=>{"use strict";M0();Q0();ZC()});function o$(e){let t=[];return ua(e,(r,n,o)=>t.push({type:r,value:e.slice(n,o),node:null})),t}function e4(e,t){return typeof e=="string"?o$(e):t.generate(e,n$)}var n$,t4=H(()=>{"use strict";so();n$={decorator(e){let t=[],r=null;return{...e,node(n){let o=r;r=n,e.node.call(this,n),r=o},emit(n,o,i){t.push({type:o,value:n,node:i?null:r})},result(){return t}}}}});function cn(e,t,r){return t===Bt&&r===Yt||e===Bt&&t===Bt&&r===Bt?e:(e.type==="If"&&e.else===Yt&&t===Bt&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:r})}function n4(e){return e.length>2&&e.charCodeAt(e.length-2)===i$&&e.charCodeAt(e.length-1)===a$}function r4(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&n4(e.name)}function da(e,t=" ",r=!1){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:r}}function Pc(e,t,r=new Set){if(!r.has(e))switch(r.add(e),e.type){case"If":e.match=Pc(e.match,t,r),e.then=Pc(e.then,t,r),e.else=Pc(e.else,t,r);break;case"Type":return t[e.name]||e}return e}function th(e,t,r){switch(e){case" ":{let n=Bt;for(let o=t.length-1;o>=0;o--){let i=t[o];n=cn(i,n,Yt)}return n}case"|":{let n=Yt,o=null;for(let i=t.length-1;i>=0;i--){let a=t[i];if(r4(a)&&(o===null&&i>0&&r4(t[i-1])&&(o=Object.create(null),n=cn({type:"Enum",map:o},Bt,n)),o!==null)){let s=(n4(a.name)?a.name.slice(0,-1):a.name).toLowerCase();if(!(s in o)){o[s]=a;continue}}o=null,n=cn(a,Bt,n)}return n}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let n=Yt;for(let o=t.length-1;o>=0;o--){let i=t[o],a;t.length>1?a=th(e,t.filter(function(s){return s!==i}),!1):a=Bt,n=cn(i,a,n)}return n}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let n=r?Bt:Yt;for(let o=t.length-1;o>=0;o--){let i=t[o],a;t.length>1?a=th(e,t.filter(function(s){return s!==i}),!0):a=Bt,n=cn(i,a,n)}return n}}}function s$(e){let t=Bt,r=nl(e.term);if(e.max===0)r=cn(r,vd,Yt),t=cn(r,null,Yt),t.then=cn(Bt,Bt,t),e.comma&&(t.then.else=cn({type:"Comma",syntax:e},t,Yt));else for(let n=e.min||1;n<=e.max;n++)e.comma&&t!==Bt&&(t=cn({type:"Comma",syntax:e},t,Yt)),t=cn(r,cn(Bt,Bt,t),Yt);if(e.min===0)t=cn(Bt,Bt,t);else for(let n=0;n<e.min-1;n++)e.comma&&t!==Bt&&(t=cn({type:"Comma",syntax:e},t,Yt)),t=cn(r,t,Yt);return t}function nl(e){if(typeof e=="function")return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=th(e.combinator,e.terms.map(nl),!1);return e.disallowEmpty&&(t=cn(t,vd,Yt)),t}case"Multiplier":return s$(e);case"Boolean":{let t=nl(e.term),r=nl(da([da([{type:"Keyword",name:"not"},{type:"Type",name:"!boolean-group"}]),da([{type:"Type",name:"!boolean-group"},da([{type:"Multiplier",comma:!1,min:0,max:0,term:da([{type:"Keyword",name:"and"},{type:"Type",name:"!boolean-group"}])},{type:"Multiplier",comma:!1,min:0,max:0,term:da([{type:"Keyword",name:"or"},{type:"Type",name:"!boolean-group"}])}],"|")])],"|")),n=nl(da([{type:"Type",name:"!term"},da([{type:"Token",value:"("},{type:"Type",name:"!self"},{type:"Token",value:")"}]),{type:"Type",name:"general-enclosed"}],"|"));return Pc(n,{"!term":t,"!self":r}),Pc(r,{"!boolean-group":n}),r}case"Type":case"Property":return{type:e.type,name:e.name,syntax:e};case"Keyword":return{type:e.type,name:e.name.toLowerCase(),syntax:e};case"AtKeyword":return{type:e.type,name:"@"+e.name.toLowerCase(),syntax:e};case"Function":return{type:e.type,name:e.name.toLowerCase()+"(",syntax:e};case"String":return e.value.length===3?{type:"Token",value:e.value.charAt(1),syntax:e}:{type:e.type,value:e.value.substr(1,e.value.length-2).replace(/\\'/g,"'"),syntax:e};case"Token":return{type:e.type,value:e.value,syntax:e};case"Comma":return{type:e.type,syntax:e};default:throw new Error("Unknown node type:",e.type)}}function Lc(e,t){return typeof e=="string"&&(e=Fc(e)),{type:"MatchGraph",match:nl(e),syntax:t||null,source:e}}var Bt,Yt,vd,i$,a$,rh=H(()=>{"use strict";Q0();Bt={type:"Match"},Yt={type:"Mismatch"},vd={type:"DisallowEmpty"},i$=40,a$=41});function f$(e){let t=null,r=null,n=e;for(;n!==null;)r=n.prev,n.prev=t,t=n,n=r;return t}function nh(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=t.charCodeAt(r),o=e.charCodeAt(r);if(o>=65&&o<=90&&(o=o|32),o!==n)return!1}return!0}function g$(e){return e.type!==9?!1:e.value!=="?"}function s4(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||g$(e)}function l4(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value==="/"}function m$(e,t,r){function n(){do h++,S=h<e.length?e[h]:null;while(S!==null&&(S.type===13||S.type===25))}function o(O){let R=h+O;return R<e.length?e[R]:null}function i(O,R){return{nextState:O,matchStack:z,syntaxStack:d,thenStack:f,tokenIndex:h,prev:R}}function a(O){f={nextState:O,matchStack:z,syntaxStack:d,prev:f}}function s(O){p=i(O,p)}function l(){z={type:c$,syntax:t.syntax,token:S,prev:z},n(),g=null,h>M&&(M=h)}function u(){d={syntax:t.syntax,opts:t.syntax.opts||d!==null&&d.opts||null,prev:d},z={type:oh,syntax:t.syntax,token:z.token,prev:z}}function c(){z.type===oh?z=z.prev:z={type:c4,syntax:d.syntax,token:z.token,prev:z},d=d.prev}let d=null,f=null,p=null,g=null,m=0,T=null,S=null,h=-1,M=0,z={type:l$,syntax:null,token:null,prev:null};for(n();T===null&&++m<a4;)switch(t.type){case"Match":if(f===null){if(S!==null&&(h!==e.length-1||S.value!=="\\0"&&S.value!=="\\9")){t=Yt;break}T=i4;break}if(t=f.nextState,t===vd)if(f.matchStack===z){t=Yt;break}else t=Bt;for(;f.syntaxStack!==d;)c();f=f.prev;break;case"Mismatch":if(g!==null&&g!==!1)(p===null||h>p.tokenIndex)&&(p=g,g=!1);else if(p===null){T=u$;break}t=p.nextState,f=p.thenStack,d=p.syntaxStack,z=p.matchStack,h=p.tokenIndex,S=h<e.length?e[h]:null,p=p.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==Yt&&s(t.else),t.then!==Bt&&a(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{let B=t.syntax.terms;if(t.index===B.length){if(t.mask===0||t.syntax.all){t=Yt;break}t=Bt;break}if(t.mask===(1<<B.length)-1){t=Bt;break}for(;t.index<B.length;t.index++){let x=1<<t.index;if((t.mask&x)===0){s(t),a({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|x}),t=B[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(S!==null){let B=S.value.toLowerCase();if(B.indexOf("\\")!==-1&&(B=B.replace(/\\[09].*$/,"")),o4.call(t.map,B)){t=t.map[B];break}}t=Yt;break;case"Generic":{let B=d!==null?d.opts:null,x=h+Math.floor(t.fn(S,o,B));if(!isNaN(x)&&x>h){for(;h<x;)l();t=Bt}else t=Yt;break}case"Type":case"Property":{let B=t.type==="Type"?"types":"properties",x=o4.call(r,B)?r[B][t.name]:null;if(!x||!x.match)throw new Error("Bad syntax reference: "+(t.type==="Type"?"<"+t.name+">":"<'"+t.name+"'>"));if(g!==!1&&S!==null&&t.type==="Type"&&(t.name==="custom-ident"&&S.type===1||t.name==="length"&&S.value==="0")){g===null&&(g=i(t,p)),t=Yt;break}u(),t=x.matchRef||x.match;break}case"Keyword":{let B=t.name;if(S!==null){let x=S.value;if(x.indexOf("\\")!==-1&&(x=x.replace(/\\[09].*$/,"")),nh(x,B)){l(),t=Bt;break}}t=Yt;break}case"AtKeyword":case"Function":if(S!==null&&nh(S.value,t.name)){l(),t=Bt;break}t=Yt;break;case"Token":if(S!==null&&S.value===t.value){l(),t=Bt;break}t=Yt;break;case"Comma":S!==null&&S.type===18?s4(z.token)?t=Yt:(l(),t=l4(S)?Yt:Bt):t=s4(z.token)||l4(S)?Bt:Yt;break;case"String":let O="",R=h;for(;R<e.length&&O.length<t.value.length;R++)O+=e[R].value;if(nh(O,t.value)){for(;h<R;)l();t=Bt}else t=Yt;break;default:throw new Error("Unknown node type: "+t.type)}switch(d$+=m,T){case null:console.warn("[csstree-match] BREAK after "+a4+" iterations"),T=p$,z=null;break;case i4:for(;d!==null;)c();break;default:z=null}return{tokens:e,reason:T,iterations:m,match:z,longestMatch:M}}function ih(e,t,r){let n=m$(e,t,r||{});if(n.match===null)return n;let o=n.match,i=n.match={syntax:t.syntax||null,match:[]},a=[i];for(o=f$(o).prev;o!==null;){switch(o.type){case oh:i.match.push(i={syntax:o.syntax,match:[]}),a.push(i);break;case c4:a.pop(),i=a[a.length-1];break;default:i.match.push({syntax:o.syntax||null,token:o.token.value,node:o.token.node})}o=o.prev}return n}var o4,l$,c$,oh,c4,i4,u$,p$,a4,d$,u4=H(()=>{"use strict";rh();({hasOwnProperty:o4}=Object.prototype),l$=0,c$=1,oh=2,c4=3,i4="Match",u$="Mismatch",p$="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",a4=15e3,d$=0});var sh={};Le(sh,{getTrace:()=>p4,isKeyword:()=>y$,isProperty:()=>x$,isType:()=>h$});function p4(e){function t(o){return o===null?!1:o.type==="Type"||o.type==="Property"||o.type==="Keyword"}function r(o){if(Array.isArray(o.match)){for(let i=0;i<o.match.length;i++)if(r(o.match[i]))return t(o.syntax)&&n.unshift(o.syntax),!0}else if(o.node===e)return n=t(o.syntax)?[o.syntax]:[],!0;return!1}let n=null;return this.matched!==null&&r(this.matched),n}function h$(e,t){return ah(this,e,r=>r.type==="Type"&&r.name===t)}function x$(e,t){return ah(this,e,r=>r.type==="Property"&&r.name===t)}function y$(e){return ah(this,e,t=>t.type==="Keyword")}function ah(e,t,r){let n=p4.call(e,t);return n===null?!1:n.some(r)}var d4=H(()=>{"use strict"});function f4(e){return"node"in e?e.node:f4(e.match[0])}function g4(e){return"node"in e?e.node:g4(e.match[e.match.length-1])}function lh(e,t,r,n,o){function i(s){if(s.syntax!==null&&s.syntax.type===n&&s.syntax.name===o){let l=f4(s),u=g4(s);e.syntax.walk(t,function(c,d,f){if(c===l){let p=new Kn;do{if(p.appendData(d.data),d.data===u)break;d=d.next}while(d!==null);a.push({parent:f,nodes:p})}})}Array.isArray(s.match)&&s.match.forEach(i)}let a=[];return r.matched!==null&&i(r.matched),a}var m4=H(()=>{"use strict";vc()});function ch(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function h4(e){return!!e&&ch(e.offset)&&ch(e.line)&&ch(e.column)}function b$(e,t){return function(n,o){if(!n||n.constructor!==Object)return o(n,"Type of node should be an Object");for(let i in n){let a=!0;if(_c.call(n,i)!==!1){if(i==="type")n.type!==e&&o(n,"Wrong node type `"+n.type+"`, expected `"+e+"`");else if(i==="loc"){if(n.loc===null)continue;if(n.loc&&n.loc.constructor===Object)if(typeof n.loc.source!="string")i+=".source";else if(!h4(n.loc.start))i+=".start";else if(!h4(n.loc.end))i+=".end";else continue;a=!1}else if(t.hasOwnProperty(i)){a=!1;for(let s=0;!a&&s<t[i].length;s++){let l=t[i][s];switch(l){case String:a=typeof n[i]=="string";break;case Boolean:a=typeof n[i]=="boolean";break;case null:a=n[i]===null;break;default:typeof l=="string"?a=n[i]&&n[i].type===l:Array.isArray(l)&&(a=n[i]instanceof Kn)}}}else o(n,"Unknown field `"+i+"` for "+e+" node type");a||o(n,"Bad value for `"+e+"."+i+"`")}}for(let i in t)_c.call(t,i)&&_c.call(n,i)===!1&&o(n,"Field `"+e+"."+i+"` is missed")}}function x4(e,t){let r=[];for(let n=0;n<e.length;n++){let o=e[n];if(o===String||o===Boolean)r.push(o.name.toLowerCase());else if(o===null)r.push("null");else if(typeof o=="string")r.push(o);else if(Array.isArray(o))r.push("List<"+(x4(o,t)||"any")+">");else throw new Error("Wrong value `"+o+"` in `"+t+"` structure definition")}return r.join(" | ")}function w$(e,t){let r=t.structure,n={type:String,loc:!0},o={type:'"'+e+'"'};for(let i in r){if(_c.call(r,i)===!1)continue;let a=n[i]=Array.isArray(r[i])?r[i].slice():[r[i]];o[i]=x4(a,e+"."+i)}return{docs:o,check:b$(e,n)}}function y4(e){let t={};if(e.node){for(let r in e.node)if(_c.call(e.node,r)){let n=e.node[r];if(n.structure)t[r]=w$(r,n);else throw new Error("Missed `structure` field in `"+r+"` node type definition")}}return t}var _c,b4=H(()=>{"use strict";vc();({hasOwnProperty:_c}=Object.prototype)});function uh(e,t,r){let n={};for(let o in e)e[o].syntax&&(n[o]=r?e[o].syntax:Js(e[o].syntax,{compact:t}));return n}function v$(e,t,r){let n={};for(let[o,i]of Object.entries(e))n[o]={prelude:i.prelude&&(r?i.prelude.syntax:Js(i.prelude.syntax,{compact:t})),descriptors:i.descriptors&&uh(i.descriptors,t,r)};return n}function S$(e){for(let t=0;t<e.length;t++)if(e[t].value.toLowerCase()==="var(")return!0;return!1}function k$(e){let t=e.terms[0];return e.explicit===!1&&e.terms.length===1&&t.type==="Multiplier"&&t.comma===!0}function Po(e,t,r){return{matched:e,iterations:r,error:t,...sh}}function ol(e,t,r,n){let o=e4(r,e.syntax),i;return S$(o)?Po(null,new Error("Matching for a tree with var() is not supported")):(n&&(i=ih(o,e.cssWideKeywordsSyntax,e)),(!n||!i.match)&&(i=ih(o,t.match,e),!i.match)?Po(null,new SC(i.reason,t.syntax,r,i),i.iterations):Po(i.match,null,i.iterations))}var Bc,w4=H(()=>{"use strict";kC();pd();dd();zC();DC();eh();t4();rh();u4();d4();m4();b4();Bc=class{constructor(t,r,n){if(this.cssWideKeywords=el,this.syntax=r,this.generic=!1,this.units={...md},this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=n||y4(t),t){if(t.cssWideKeywords&&(this.cssWideKeywords=t.cssWideKeywords),t.units)for(let o of Object.keys(md))Array.isArray(t.units[o])&&(this.units[o]=t.units[o]);if(t.types)for(let[o,i]of Object.entries(t.types))this.addType_(o,i);if(t.generic){this.generic=!0;for(let[o,i]of Object.entries(BC(this.units)))this.addType_(o,i)}if(t.atrules)for(let[o,i]of Object.entries(t.atrules))this.addAtrule_(o,i);if(t.properties)for(let[o,i]of Object.entries(t.properties))this.addProperty_(o,i)}this.cssWideKeywordsSyntax=Lc(this.cssWideKeywords.join(" | "))}checkStructure(t){function r(i,a){o.push({node:i,message:a})}let n=this.structure,o=[];return this.syntax.walk(t,function(i){n.hasOwnProperty(i.type)?n[i.type].check(i,r):r(i,"Unknown node type `"+i.type+"`")}),o.length?o:!1}createDescriptor(t,r,n,o=null){let i={type:r,name:n},a={type:r,name:n,parent:o,serializable:typeof t=="string"||t&&typeof t.type=="string",syntax:null,match:null,matchRef:null};return typeof t=="function"?a.match=Lc(t,i):(typeof t=="string"?Object.defineProperty(a,"syntax",{get(){return Object.defineProperty(a,"syntax",{value:Fc(t)}),a.syntax}}):a.syntax=t,Object.defineProperty(a,"match",{get(){return Object.defineProperty(a,"match",{value:Lc(a.syntax,i)}),a.match}}),r==="Property"&&Object.defineProperty(a,"matchRef",{get(){let s=a.syntax,l=k$(s)?Lc({...s,terms:[s.terms[0].term]},i):null;return Object.defineProperty(a,"matchRef",{value:l}),l}})),a}addAtrule_(t,r){r&&(this.atrules[t]={type:"Atrule",name:t,prelude:r.prelude?this.createDescriptor(r.prelude,"AtrulePrelude",t):null,descriptors:r.descriptors?Object.keys(r.descriptors).reduce((n,o)=>(n[o]=this.createDescriptor(r.descriptors[o],"AtruleDescriptor",o,t),n),Object.create(null)):null})}addProperty_(t,r){r&&(this.properties[t]=this.createDescriptor(r,"Property",t))}addType_(t,r){r&&(this.types[t]=this.createDescriptor(r,"Type",t))}checkAtruleName(t){if(!this.getAtrule(t))return new Qs("Unknown at-rule","@"+t)}checkAtrulePrelude(t,r){let n=this.checkAtruleName(t);if(n)return n;let o=this.getAtrule(t);if(!o.prelude&&r)return new SyntaxError("At-rule `@"+t+"` should not contain a prelude");if(o.prelude&&!r&&!ol(this,o.prelude,"",!1).matched)return new SyntaxError("At-rule `@"+t+"` should contain a prelude")}checkAtruleDescriptorName(t,r){let n=this.checkAtruleName(t);if(n)return n;let o=this.getAtrule(t),i=cd(r);if(!o.descriptors)return new SyntaxError("At-rule `@"+t+"` has no known descriptors");if(!o.descriptors[i.name]&&!o.descriptors[i.basename])return new Qs("Unknown at-rule descriptor",r)}checkPropertyName(t){if(!this.getProperty(t))return new Qs("Unknown property",t)}matchAtrulePrelude(t,r){let n=this.checkAtrulePrelude(t,r);if(n)return Po(null,n);let o=this.getAtrule(t);return o.prelude?ol(this,o.prelude,r||"",!1):Po(null,null)}matchAtruleDescriptor(t,r,n){let o=this.checkAtruleDescriptorName(t,r);if(o)return Po(null,o);let i=this.getAtrule(t),a=cd(r);return ol(this,i.descriptors[a.name]||i.descriptors[a.basename],n,!1)}matchDeclaration(t){return t.type!=="Declaration"?Po(null,new Error("Not a Declaration node")):this.matchProperty(t.property,t.value)}matchProperty(t,r){if(P0(t).custom)return Po(null,new Error("Lexer matching doesn't applicable for custom properties"));let n=this.checkPropertyName(t);return n?Po(null,n):ol(this,this.getProperty(t),r,!0)}matchType(t,r){let n=this.getType(t);return n?ol(this,n,r,!1):Po(null,new Qs("Unknown type",t))}match(t,r){return typeof t!="string"&&(!t||!t.type)?Po(null,new Qs("Bad syntax")):((typeof t=="string"||!t.match)&&(t=this.createDescriptor(t,"Type","anonymous")),ol(this,t,r,!1))}findValueFragments(t,r,n,o){return lh(this,r,this.matchProperty(t,r),n,o)}findDeclarationValueFragments(t,r,n){return lh(this,t.value,this.matchDeclaration(t),r,n)}findAllFragments(t,r,n){let o=[];return this.syntax.walk(t,{visit:"Declaration",enter:i=>{o.push.apply(o,this.findDeclarationValueFragments(i,r,n))}}),o}getAtrule(t,r=!0){let n=cd(t);return(n.vendor&&r?this.atrules[n.name]||this.atrules[n.basename]:this.atrules[n.name])||null}getAtrulePrelude(t,r=!0){let n=this.getAtrule(t,r);return n&&n.prelude||null}getAtruleDescriptor(t,r){return this.atrules.hasOwnProperty(t)&&this.atrules.declarators&&this.atrules[t].declarators[r]||null}getProperty(t,r=!0){let n=P0(t);return(n.vendor&&r?this.properties[n.name]||this.properties[n.basename]:this.properties[n.name])||null}getType(t){return hasOwnProperty.call(this.types,t)?this.types[t]:null}validate(){function t(l,u){return u?`<${l}>`:`<'${l}'>`}function r(l,u,c,d){if(c.has(u))return c.get(u);c.set(u,!1),d.syntax!==null&&Z0(d.syntax,function(f){if(f.type!=="Type"&&f.type!=="Property")return;let p=f.type==="Type"?l.types:l.properties,g=f.type==="Type"?o:i;hasOwnProperty.call(p,f.name)?r(l,f.name,g,p[f.name])&&(n.push(`${t(u,c===o)} used broken syntax definition ${t(f.name,f.type==="Type")}`),c.set(u,!0)):(n.push(`${t(u,c===o)} used missed syntax definition ${t(f.name,f.type==="Type")}`),c.set(u,!0))},this)}let n=[],o=new Map,i=new Map;for(let l in this.types)r(this,l,o,this.types[l]);for(let l in this.properties)r(this,l,i,this.properties[l]);let a=[...o.keys()].filter(l=>o.get(l)),s=[...i.keys()].filter(l=>i.get(l));return a.length||s.length?{errors:n,types:a,properties:s}:null}dump(t,r){return{generic:this.generic,cssWideKeywords:this.cssWideKeywords,units:this.units,types:uh(this.types,!r,t),properties:uh(this.properties,!r,t),atrules:v$(this.atrules,!r,t)}}toString(){return JSON.stringify(this.dump())}}});function ph(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function C$(e,t){let r=Object.create(null);for(let n of Object.keys(e))t.includes(n)&&(r[n]=e[n]);return r}function dh(e,t,r){let n={...e};for(let[o,i]of Object.entries(t))n[o]={...n[o],...r?C$(i,r):i};return n}function zc(e,t){let r={...e};for(let[n,o]of Object.entries(t))switch(n){case"generic":r[n]=!!o;break;case"cssWideKeywords":r[n]=e[n]?[...e[n],...o]:o||[];break;case"units":r[n]={...e[n]};for(let[i,a]of Object.entries(o))r[n][i]=Array.isArray(a)?a:[];break;case"atrules":r[n]={...e[n]};for(let[i,a]of Object.entries(o)){let s=r[n][i]||{},l=r[n][i]={prelude:s.prelude||null,descriptors:{...s.descriptors}};if(a){l.prelude=a.prelude?ph(l.prelude,a.prelude):l.prelude||null;for(let[u,c]of Object.entries(a.descriptors||{}))l.descriptors[u]=c?ph(l.descriptors[u],c):null;Object.keys(l.descriptors).length||(l.descriptors=null)}}break;case"types":case"properties":r[n]={...e[n]};for(let[i,a]of Object.entries(o))r[n][i]=ph(r[n][i],a);break;case"parseContext":r[n]={...e[n],...o};break;case"scope":case"features":r[n]=dh(e[n],o);break;case"atrule":case"pseudo":r[n]=dh(e[n],o,["parse"]);break;case"node":r[n]=dh(e[n],o,["name","structure","parse","generate","walkContext"]);break}return r}var v4=H(()=>{"use strict"});function S4(e){let t=Dk(e),r=bC(e),n=pC(e),{fromPlainObject:o,toPlainObject:i}=fC(r),a={lexer:null,createLexer:s=>new Bc(s,a,a.lexer.structure),tokenize:ua,parse:t,generate:n,walk:r,find:r.find,findLast:r.findLast,findAll:r.findAll,fromPlainObject:o,toPlainObject:i,fork(s){let l=zc({},e);return S4(typeof s=="function"?s(l):zc(l,s))}};return a.lexer=new Bc({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},a),a}var k4,C4=H(()=>{"use strict";so();Nk();dC();gC();wC();w4();v4();k4=e=>S4(zc({},e))});var E4,T4=H(()=>{"use strict";E4={generic:!0,cssWideKeywords:["initial","inherit","unset","revert","revert-layer"],units:{angle:["deg","grad","rad","turn"],decibel:["db"],flex:["fr"],frequency:["hz","khz"],length:["cm","mm","q","in","pt","pc","px","em","rem","ex","rex","cap","rcap","ch","rch","ic","ric","lh","rlh","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],resolution:["dpi","dpcm","dppx","x"],semitones:["st"],time:["s","ms"]},types:{"abs()":"abs( <calc-sum> )","absolute-size":"xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large","acos()":"acos( <calc-sum> )","alpha-value":"<number>|<percentage>","an+b":"odd|even|<integer>|<n-dimension>|'+'? \u2020 n|-n|<ndashdigit-dimension>|'+'? \u2020 <ndashdigit-ident>|<dashndashdigit-ident>|<n-dimension> <signed-integer>|'+'? \u2020 n <signed-integer>|-n <signed-integer>|<ndash-dimension> <signless-integer>|'+'? \u2020 n- <signless-integer>|-n- <signless-integer>|<n-dimension> ['+'|'-'] <signless-integer>|'+'? \u2020 n ['+'|'-'] <signless-integer>|-n ['+'|'-'] <signless-integer>","anchor()":"anchor( <anchor-name>?&&<anchor-side> , <length-percentage>? )","anchor-name":"<dashed-ident>","anchor-side":"inside|outside|top|left|right|bottom|start|end|self-start|self-end|<percentage>|center","anchor-size":"width|height|block|inline|self-block|self-inline","anchor-size()":"anchor-size( [<anchor-name>||<anchor-size>]? , <length-percentage>? )","angle-percentage":"<angle>|<percentage>","angular-color-hint":"<angle-percentage>|<zero>","angular-color-stop":"<color> <color-stop-angle>?","angular-color-stop-list":"<angular-color-stop> , [<angular-color-hint>? , <angular-color-stop>]#?","animateable-feature":"scroll-position|contents|<custom-ident>","animation-action":"none|play|play-once|play-forwards|play-backwards|pause|reset|replay","asin()":"asin( <calc-sum> )","atan()":"atan( <calc-sum> )","atan2()":"atan2( <calc-sum> , <calc-sum> )",attachment:"scroll|fixed|local","attr()":"attr( <attr-name> <attr-type>? , <declaration-value>? )","attr-matcher":"['~'|'|'|'^'|'$'|'*']? '='","attr-modifier":"i|s","attr-type":"type( <syntax> )|raw-string|number|<attr-unit>","attribute-selector":"'[' <wq-name> ']'|'[' <wq-name> <attr-matcher> [<string-token>|<ident-token>] <attr-modifier>? ']'","auto-repeat":"repeat( [auto-fill|auto-fit] , [<line-names>? <fixed-size>]+ <line-names>? )","auto-track-list":"[<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>? <auto-repeat> [<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>?",axis:"block|inline|x|y","baseline-position":"[first|last]? baseline","basic-shape":"<inset()>|<xywh()>|<rect()>|<circle()>|<ellipse()>|<polygon()>|<path()>","basic-shape-rect":"<inset()>|<rect()>|<xywh()>","bg-clip":"<visual-box>|border-area|text","bg-image":"<image>|none","bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<visual-box>||<visual-box>","bg-position":"[[left|center|right|top|bottom|<length-percentage>]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]|[center|[left|right] <length-percentage>?]&&[center|[top|bottom] <length-percentage>?]]","bg-size":"[<length-percentage [0,\u221E]>|auto]{1,2}|cover|contain","blend-mode":"normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity","blur()":"blur( <length>? )","brightness()":"brightness( [<number>|<percentage>]? )","calc()":"calc( <calc-sum> )","calc-constant":"e|pi|infinity|-infinity|NaN","calc-product":"<calc-value> ['*' <calc-value>|'/' <number>]*","calc-size()":"calc-size( <calc-size-basis> , <calc-sum> )","calc-size-basis":"<intrinsic-size-keyword>|<calc-size()>|any|<calc-sum>","calc-sum":"<calc-product> [['+'|'-'] <calc-product>]*","calc-value":"<number>|<dimension>|<percentage>|<calc-constant>|( <calc-sum> )","cf-final-image":"<image>|<color>","cf-mixing-image":"<percentage>?&&<image>","circle()":"circle( <radial-size>? [at <position>]? )","clamp()":"clamp( <calc-sum>#{3} )","class-selector":"'.' <ident-token>","clip-source":"<url>",color:"<color-base>|currentColor|<system-color>|<device-cmyk()>|<light-dark()>|<-non-standard-color>","color()":"color( <colorspace-params> [/ [<alpha-value>|none]]? )","color-base":"<hex-color>|<color-function>|<named-color>|<color-mix()>|transparent","color-function":"<rgb()>|<rgba()>|<hsl()>|<hsla()>|<hwb()>|<lab()>|<lch()>|<oklab()>|<oklch()>|<color()>","color-interpolation-method":"in [<rectangular-color-space>|<polar-color-space> <hue-interpolation-method>?|<custom-color-space>]","color-mix()":"color-mix( <color-interpolation-method> , [<color>&&<percentage [0,100]>?]#{2} )","color-stop":"<color-stop-length>|<color-stop-angle>","color-stop-angle":"[<angle-percentage>|<zero>]{1,2}","color-stop-length":"<length-percentage>{1,2}","color-stop-list":"<linear-color-stop> , [<linear-color-hint>? , <linear-color-stop>]#?","colorspace-params":"[<predefined-rgb-params>|<xyz-params>]",combinator:"'>'|'+'|'~'|['|' '|']","common-lig-values":"[common-ligatures|no-common-ligatures]","compat-auto":"searchfield|textarea|checkbox|radio|menulist|listbox|meter|progress-bar|button","compat-special":"textfield|menulist-button","complex-selector":"<complex-selector-unit> [<combinator>? <complex-selector-unit>]*","complex-selector-list":"<complex-selector>#","composite-style":"clear|copy|source-over|source-in|source-out|source-atop|destination-over|destination-in|destination-out|destination-atop|xor","compositing-operator":"add|subtract|intersect|exclude","compound-selector":"[<type-selector>? <subclass-selector>*]!","compound-selector-list":"<compound-selector>#","conic-gradient()":"conic-gradient( [<conic-gradient-syntax>] )","conic-gradient-syntax":"[[[from [<angle>|<zero>]]? [at <position>]?]||<color-interpolation-method>]? , <angular-color-stop-list>","container-condition":"not <query-in-parens>|<query-in-parens> [[and <query-in-parens>]*|[or <query-in-parens>]*]","container-name":"<custom-ident>","container-query":"not <query-in-parens>|<query-in-parens> [[and <query-in-parens>]*|[or <query-in-parens>]*]","content-distribution":"space-between|space-around|space-evenly|stretch","content-list":"[<string>|contents|<image>|<counter>|<quote>|<target>|<leader()>|<attr()>]+","content-position":"center|start|end|flex-start|flex-end","content-replacement":"<image>","contextual-alt-values":"[contextual|no-contextual]","contrast()":"contrast( [<number>|<percentage>]? )","coord-box":"content-box|padding-box|border-box|fill-box|stroke-box|view-box","corner-shape-value":"round|scoop|bevel|notch|square|squircle|<superellipse()>","cos()":"cos( <calc-sum> )",counter:"<counter()>|<counters()>","counter()":"counter( <counter-name> , <counter-style>? )","counter-name":"<custom-ident>","counter-style":"<counter-style-name>|symbols( )","counter-style-name":"<custom-ident>","counters()":"counters( <counter-name> , <string> , <counter-style>? )","cross-fade()":"cross-fade( <cf-mixing-image> , <cf-final-image>? )","cubic-bezier()":"cubic-bezier( [<number [0,1]> , <number>]#{2} )","cubic-bezier-easing-function":"ease|ease-in|ease-out|ease-in-out|cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )","cursor-predefined":"auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing","custom-color-space":"<dashed-ident>","custom-params":"<dashed-ident> [<number>|<percentage>|none]+",dasharray:"[[<length-percentage>|<number>]+]#","dashndashdigit-ident":"<ident-token>","deprecated-system-color":"ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonHighlight|ButtonShadow|CaptionText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText","discretionary-lig-values":"[discretionary-ligatures|no-discretionary-ligatures]","display-box":"contents|none","display-inside":"flow|flow-root|table|flex|grid|ruby","display-internal":"table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption|ruby-base|ruby-text|ruby-base-container|ruby-text-container","display-legacy":"inline-block|inline-list-item|inline-table|inline-flex|inline-grid","display-listitem":"<display-outside>?&&[flow|flow-root]?&&list-item","display-outside":"block|inline|run-in","drop-shadow()":"drop-shadow( [<color>?&&<length>{2,3}] )","dynamic-range-limit-mix()":"dynamic-range-limit-mix( [<'dynamic-range-limit'>&&<percentage [0,100]>]#{2,} )","easing-function":"<linear-easing-function>|<cubic-bezier-easing-function>|<step-easing-function>","east-asian-variant-values":"[jis78|jis83|jis90|jis04|simplified|traditional]","east-asian-width-values":"[full-width|proportional-width]","element()":"element( <custom-ident> , [first|start|last|first-except]? )|element( <id-selector> )","ellipse()":"ellipse( <radial-size>? [at <position>]? )","env()":"env( <custom-ident> , <declaration-value>? )","exp()":"exp( <calc-sum> )","explicit-track-list":"[<line-names>? <track-size>]+ <line-names>?","family-name":"<string>|<custom-ident>+","feature-tag-value":"<string> [<integer>|on|off]?","feature-type":"@stylistic|@historical-forms|@styleset|@character-variant|@swash|@ornaments|@annotation","feature-value-block":"<feature-type> '{' <feature-value-declaration-list> '}'","feature-value-block-list":"<feature-value-block>+","feature-value-declaration":"<custom-ident> : <integer>+ ;","feature-value-declaration-list":"<feature-value-declaration>","feature-value-name":"<custom-ident>","filter-function":"<blur()>|<brightness()>|<contrast()>|<drop-shadow()>|<grayscale()>|<hue-rotate()>|<invert()>|<opacity()>|<saturate()>|<sepia()>","filter-value-list":"[<filter-function>|<url>]+","final-bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<visual-box>||<visual-box>||<'background-color'>","fit-content()":"fit-content( <length-percentage [0,\u221E]> )","fixed-breadth":"<length-percentage>","fixed-repeat":"repeat( [<integer [1,\u221E]>] , [<line-names>? <fixed-size>]+ <line-names>? )","fixed-size":"<fixed-breadth>|minmax( <fixed-breadth> , <track-breadth> )|minmax( <inflexible-breadth> , <fixed-breadth> )","font-stretch-absolute":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|<percentage>","font-variant-css2":"normal|small-caps","font-weight-absolute":"normal|bold|<number [1,1000]>","font-width-css3":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded","form-control-identifier":"select","frequency-percentage":"<frequency>|<percentage>","generic-complete":"serif|sans-serif|system-ui|cursive|fantasy|math|monospace","general-enclosed":"[<function-token> <any-value>? )]|[( <any-value>? )]","generic-family":"<generic-script-specific>|<generic-complete>|<generic-incomplete>|<-non-standard-generic-family>","generic-incomplete":"ui-serif|ui-sans-serif|ui-monospace|ui-rounded","geometry-box":"<shape-box>|fill-box|stroke-box|view-box",gradient:"<linear-gradient()>|<repeating-linear-gradient()>|<radial-gradient()>|<repeating-radial-gradient()>|<conic-gradient()>|<repeating-conic-gradient()>|<-legacy-gradient>","grayscale()":"grayscale( [<number>|<percentage>]? )","grid-line":"auto|<custom-ident>|[<integer>&&<custom-ident>?]|[span&&[<integer>||<custom-ident>]]","historical-lig-values":"[historical-ligatures|no-historical-ligatures]","hsl()":"hsl( <hue> , <percentage> , <percentage> , <alpha-value>? )|hsl( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","hsla()":"hsla( <hue> , <percentage> , <percentage> , <alpha-value>? )|hsla( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )",hue:"<number>|<angle>","hue-interpolation-method":"[shorter|longer|increasing|decreasing] hue","hue-rotate()":"hue-rotate( [<angle>|<zero>]? )","hwb()":"hwb( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","hypot()":"hypot( <calc-sum># )",image:"<url>|<image()>|<image-set()>|<element()>|<paint()>|<cross-fade()>|<gradient>","image()":"image( <image-tags>? [<image-src>? , <color>?]! )","image-set()":"image-set( <image-set-option># )","image-set-option":"[<image>|<string>] [<resolution>||type( <string> )]","image-src":"<url>|<string>","image-tags":"ltr|rtl","inflexible-breadth":"<length-percentage>|min-content|max-content|auto","inset()":"inset( <length-percentage>{1,4} [round <'border-radius'>]? )","invert()":"invert( [<number>|<percentage>]? )","keyframe-block":"<keyframe-selector># { <declaration-list> }","keyframe-selector":"from|to|<percentage [0,100]>|<timeline-range-name> <percentage>","keyframes-name":"<custom-ident>|<string>","lab()":"lab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","layer()":"layer( <layer-name> )","layer-name":"<ident> ['.' <ident>]*","lch()":"lch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )","leader()":"leader( <leader-type> )","leader-type":"dotted|solid|space|<string>","length-percentage":"<length>|<percentage>","light-dark()":"light-dark( <color> , <color> )","line-name-list":"[<line-names>|<name-repeat>]+","line-names":"'[' <custom-ident>* ']'","line-style":"none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset","line-width":"<length>|thin|medium|thick","linear()":"linear( [<number>&&<percentage>{0,2}]# )","linear-color-hint":"<length-percentage>","linear-color-stop":"<color> <color-stop-length>?","linear-easing-function":"linear|<linear()>","linear-gradient()":"linear-gradient( [<linear-gradient-syntax>] )","linear-gradient-syntax":"[[<angle>|<zero>|to <side-or-corner>]||<color-interpolation-method>]? , <color-stop-list>","log()":"log( <calc-sum> , <calc-sum>? )","mask-layer":"<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||<geometry-box>||[<geometry-box>|no-clip]||<compositing-operator>||<masking-mode>","mask-position":"[<length-percentage>|left|center|right] [<length-percentage>|top|center|bottom]?","mask-reference":"none|<image>|<mask-source>","mask-source":"<url>","masking-mode":"alpha|luminance|match-source","matrix()":"matrix( <number>#{6} )","matrix3d()":"matrix3d( <number>#{16} )","max()":"max( <calc-sum># )","media-and":"<media-in-parens> [and <media-in-parens>]+","media-condition":"<media-not>|<media-and>|<media-or>|<media-in-parens>","media-condition-without-or":"<media-not>|<media-and>|<media-in-parens>","media-feature":"( [<mf-plain>|<mf-boolean>|<mf-range>] )","media-in-parens":"( <media-condition> )|<media-feature>|<general-enclosed>","media-not":"not <media-in-parens>","media-or":"<media-in-parens> [or <media-in-parens>]+","media-query":"<media-condition>|[not|only]? <media-type> [and <media-condition-without-or>]?","media-query-list":"<media-query>#","media-type":"<ident>","mf-boolean":"<mf-name>","mf-name":"<ident>","mf-plain":"<mf-name> : <mf-value>","mf-range":"<mf-name> ['<'|'>']? '='? <mf-value>|<mf-value> ['<'|'>']? '='? <mf-name>|<mf-value> '<' '='? <mf-name> '<' '='? <mf-value>|<mf-value> '>' '='? <mf-name> '>' '='? <mf-value>","mf-value":"<number>|<dimension>|<ident>|<ratio>","min()":"min( <calc-sum># )","minmax()":"minmax( [<length-percentage>|min-content|max-content|auto] , [<length-percentage>|<flex>|min-content|max-content|auto] )","mod()":"mod( <calc-sum> , <calc-sum> )","n-dimension":"<dimension-token>","name-repeat":"repeat( [<integer [1,\u221E]>|auto-fill] , <line-names>+ )","named-color":"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen","namespace-prefix":"<ident>","ndash-dimension":"<dimension-token>","ndashdigit-dimension":"<dimension-token>","ndashdigit-ident":"<ident-token>","ns-prefix":"[<ident-token>|'*']? '|'","number-percentage":"<number>|<percentage>","numeric-figure-values":"[lining-nums|oldstyle-nums]","numeric-fraction-values":"[diagonal-fractions|stacked-fractions]","numeric-spacing-values":"[proportional-nums|tabular-nums]","offset-path":"<ray()>|<url>|<basic-shape>","oklab()":"oklab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","oklch()":"oklch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )","opacity()":"opacity( [<number>|<percentage>]? )","opacity-value":"<number>|<percentage>","outline-line-style":"none|dotted|dashed|solid|double|groove|ridge|inset|outset","outline-radius":"<length>|<percentage>","overflow-position":"unsafe|safe","page-body":"<declaration>? [; <page-body>]?|<page-margin-box> <page-body>","page-margin-box":"<page-margin-box-type> '{' <declaration-list> '}'","page-margin-box-type":"@top-left-corner|@top-left|@top-center|@top-right|@top-right-corner|@bottom-left-corner|@bottom-left|@bottom-center|@bottom-right|@bottom-right-corner|@left-top|@left-middle|@left-bottom|@right-top|@right-middle|@right-bottom","page-selector":"<pseudo-page>+|<ident> <pseudo-page>*","page-selector-list":"[<page-selector>#]?","page-size":"A5|A4|A3|B5|B4|JIS-B5|JIS-B4|letter|legal|ledger",paint:"none|<color>|<url> [none|<color>]?|context-fill|context-stroke","paint()":"paint( <ident> , <declaration-value>? )","paint-box":"<visual-box>|fill-box|stroke-box","palette-identifier":"<dashed-ident>","palette-mix()":"palette-mix( <color-interpolation-method> , [[normal|light|dark|<palette-identifier>|<palette-mix()>]&&<percentage [0,100]>?]#{2} )","path()":"path( <'fill-rule'>? , <string> )","perspective()":"perspective( [<length [0,\u221E]>|none] )","polar-color-space":"hsl|hwb|lch|oklch","polygon()":"polygon( <'fill-rule'>? , [<length-percentage> <length-percentage>]# )",position:"[[left|center|right]||[top|center|bottom]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]?|[[left|right] <length-percentage>]&&[[top|bottom] <length-percentage>]]","position-area":"[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|center|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|center|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]","pow()":"pow( <calc-sum> , <calc-sum> )","predefined-rgb":"srgb|srgb-linear|display-p3|display-p3-linear|a98-rgb|prophoto-rgb|rec2020","predefined-rgb-params":"<predefined-rgb> [<number>|<percentage>|none]{3}","pseudo-class-selector":"':' <ident-token>|':' <function-token> <any-value> ')'","pseudo-element-selector":"':' <pseudo-class-selector>|<legacy-pseudo-element-selector>","pseudo-page":": [left|right|first|blank]","query-in-parens":"( <container-condition> )|( <size-feature> )|style( <style-query> )|<general-enclosed>",quote:"open-quote|close-quote|no-open-quote|no-close-quote","radial-extent":"closest-corner|closest-side|farthest-corner|farthest-side","radial-gradient()":"radial-gradient( [<radial-gradient-syntax>] )","radial-gradient-syntax":"[[[<radial-shape>||<radial-size>]? [at <position>]?]||<color-interpolation-method>]? , <color-stop-list>","radial-shape":"circle|ellipse","radial-size":"<radial-extent>|<length [0,\u221E]>|<length-percentage [0,\u221E]>{2}",ratio:"<number [0,\u221E]> [/ <number [0,\u221E]>]?","ray()":"ray( <angle>&&<ray-size>?&&contain?&&[at <position>]? )","ray-size":"closest-side|closest-corner|farthest-side|farthest-corner|sides","rect()":"rect( [<length-percentage>|auto]{4} [round <'border-radius'>]? )","rectangular-color-space":"srgb|srgb-linear|display-p3|display-p3-linear|a98-rgb|prophoto-rgb|rec2020|lab|oklab|xyz|xyz-d50|xyz-d65","relative-selector":"<combinator>? <complex-selector>","relative-selector-list":"<relative-selector>#","relative-size":"larger|smaller","rem()":"rem( <calc-sum> , <calc-sum> )","repeat-style":"repeat-x|repeat-y|[repeat|space|round|no-repeat]{1,2}","repeating-conic-gradient()":"repeating-conic-gradient( [<conic-gradient-syntax>] )","repeating-linear-gradient()":"repeating-linear-gradient( [<linear-gradient-syntax>] )","repeating-radial-gradient()":"repeating-radial-gradient( [<radial-gradient-syntax>] )","reversed-counter-name":"reversed( <counter-name> )","rgb()":"rgb( <percentage>#{3} , <alpha-value>? )|rgb( <number>#{3} , <alpha-value>? )|rgb( [<number>|<percentage>|none]{3} [/ [<alpha-value>|none]]? )","rgba()":"rgba( <percentage>#{3} , <alpha-value>? )|rgba( <number>#{3} , <alpha-value>? )|rgba( [<number>|<percentage>|none]{3} [/ [<alpha-value>|none]]? )","rotate()":"rotate( [<angle>|<zero>] )","rotate3d()":"rotate3d( <number> , <number> , <number> , [<angle>|<zero>] )","rotateX()":"rotateX( [<angle>|<zero>] )","rotateY()":"rotateY( [<angle>|<zero>] )","rotateZ()":"rotateZ( [<angle>|<zero>] )","round()":"round( <rounding-strategy>? , <calc-sum> , <calc-sum> )","rounding-strategy":"nearest|up|down|to-zero","saturate()":"saturate( [<number>|<percentage>]? )","scale()":"scale( [<number>|<percentage>]#{1,2} )","scale3d()":"scale3d( [<number>|<percentage>]#{3} )","scaleX()":"scaleX( [<number>|<percentage>] )","scaleY()":"scaleY( [<number>|<percentage>] )","scaleZ()":"scaleZ( [<number>|<percentage>] )","scope-end":"<forgiving-selector-list>","scope-start":"<forgiving-selector-list>","scroll()":"scroll( [<scroller>||<axis>]? )",scroller:"root|nearest|self","scroll-state-feature":"<media-query-list>","scroll-state-in-parens":"( <scroll-state-query> )|( <scroll-state-feature> )|<general-enclosed>","scroll-state-query":"not <scroll-state-in-parens>|<scroll-state-in-parens> [[and <scroll-state-in-parens>]*|[or <scroll-state-in-parens>]*]|<scroll-state-feature>","selector-list":"<complex-selector-list>","self-position":"center|start|end|self-start|self-end|flex-start|flex-end","sepia()":"sepia( [<number>|<percentage>]? )",shadow:"inset?&&<length>{2,4}&&<color>?","shadow-t":"[<length>{2,3}&&<color>?]",shape:"rect( <top> , <right> , <bottom> , <left> )|rect( <top> <right> <bottom> <left> )","shape-box":"<visual-box>|margin-box","side-or-corner":"[left|right]||[top|bottom]","sign()":"sign( <calc-sum> )","signed-integer":"<number-token>","signless-integer":"<number-token>","sin()":"sin( <calc-sum> )","single-animation":"<'animation-duration'>||<easing-function>||<'animation-delay'>||<single-animation-iteration-count>||<single-animation-direction>||<single-animation-fill-mode>||<single-animation-play-state>||[none|<keyframes-name>]||<single-animation-timeline>","single-animation-composition":"replace|add|accumulate","single-animation-direction":"normal|reverse|alternate|alternate-reverse","single-animation-fill-mode":"none|forwards|backwards|both","single-animation-iteration-count":"infinite|<number>","single-animation-play-state":"running|paused","single-animation-timeline":"auto|none|<dashed-ident>|<scroll()>|<view()>","single-transition":"[none|<single-transition-property>]||<time>||<easing-function>||<time>||<transition-behavior-value>","single-transition-property":"all|<custom-ident>",size:"closest-side|farthest-side|closest-corner|farthest-corner|<length>|<length-percentage>{2}","size-feature":"<mf-plain>|<mf-boolean>|<mf-range>","skew()":"skew( [<angle>|<zero>] , [<angle>|<zero>]? )","skewX()":"skewX( [<angle>|<zero>] )","skewY()":"skewY( [<angle>|<zero>] )","sqrt()":"sqrt( <calc-sum> )","step-position":"jump-start|jump-end|jump-none|jump-both|start|end","step-easing-function":"step-start|step-end|<steps()>","steps()":"steps( <integer> , <step-position>? )","style-feature":"<declaration>","style-in-parens":"( <style-condition> )|( <style-feature> )|<general-enclosed>","style-query":"<style-condition>|<style-feature>","subclass-selector":"<id-selector>|<class-selector>|<attribute-selector>|<pseudo-class-selector>","superellipse()":"superellipse( [<number>|infinity|-infinity] )","supports-condition":"not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*","supports-decl":"( <declaration> )","supports-feature":"<supports-decl>|<supports-selector-fn>","supports-in-parens":"( <supports-condition> )|<supports-feature>|<general-enclosed>","supports-selector-fn":"selector( <complex-selector> )",symbol:"<string>|<image>|<custom-ident>","symbols()":"symbols( <symbols-type>? [<string>|<image>]+ )","symbols-type":"cyclic|numeric|alphabetic|symbolic|fixed","system-color":"AccentColor|AccentColorText|ActiveText|ButtonBorder|ButtonFace|ButtonText|Canvas|CanvasText|Field|FieldText|GrayText|Highlight|HighlightText|LinkText|Mark|MarkText|SelectedItem|SelectedItemText|VisitedText","system-family-name":"caption|icon|menu|message-box|small-caption|status-bar","tan()":"tan( <calc-sum> )",target:"<target-counter()>|<target-counters()>|<target-text()>","target-counter()":"target-counter( [<string>|<url>] , <custom-ident> , <counter-style>? )","target-counters()":"target-counters( [<string>|<url>] , <custom-ident> , <string> , <counter-style>? )","target-text()":"target-text( [<string>|<url>] , [content|before|after|first-letter]? )","text-edge":"[text|cap|ex|ideographic|ideographic-ink] [text|alphabetic|ideographic|ideographic-ink]?","time-percentage":"<time>|<percentage>","timeline-range-name":"cover|contain|entry|exit|entry-crossing|exit-crossing","track-breadth":"<length-percentage>|<flex>|min-content|max-content|auto","track-list":"[<line-names>? [<track-size>|<track-repeat>]]+ <line-names>?","track-repeat":"repeat( [<integer [1,\u221E]>] , [<line-names>? <track-size>]+ <line-names>? )","track-size":"<track-breadth>|minmax( <inflexible-breadth> , <track-breadth> )|fit-content( <length-percentage> )","transform-function":"<matrix()>|<translate()>|<translateX()>|<translateY()>|<scale()>|<scaleX()>|<scaleY()>|<rotate()>|<skew()>|<skewX()>|<skewY()>|<matrix3d()>|<translate3d()>|<translateZ()>|<scale3d()>|<scaleZ()>|<rotate3d()>|<rotateX()>|<rotateY()>|<rotateZ()>|<perspective()>","transform-list":"<transform-function>+","transition-behavior-value":"normal|allow-discrete","translate()":"translate( <length-percentage> , <length-percentage>? )","translate3d()":"translate3d( <length-percentage> , <length-percentage> , <length> )","translateX()":"translateX( <length-percentage> )","translateY()":"translateY( <length-percentage> )","translateZ()":"translateZ( <length> )","try-size":"most-width|most-height|most-block-size|most-inline-size","try-tactic":"flip-block||flip-inline||flip-start","type-or-unit":"string|color|url|integer|number|length|angle|time|frequency|cap|ch|em|ex|ic|lh|rlh|rem|vb|vi|vw|vh|vmin|vmax|mm|Q|cm|in|pt|pc|px|deg|grad|rad|turn|ms|s|Hz|kHz|%","type-selector":"<wq-name>|<ns-prefix>? '*'","var()":"var( <custom-property-name> , <declaration-value>? )","view()":"view( [<axis>||<'view-timeline-inset'>]? )","viewport-length":"auto|<length-percentage>","visual-box":"content-box|padding-box|border-box","wq-name":"<ns-prefix>? <ident-token>","xywh()":"xywh( <length-percentage>{2} <length-percentage [0,\u221E]>{2} [round <'border-radius'>]? )",xyz:"xyz|xyz-d50|xyz-d65","xyz-params":"<xyz-space> [<number>|<percentage>|none]{3}","-legacy-gradient":"<-webkit-gradient()>|<-legacy-linear-gradient>|<-legacy-repeating-linear-gradient>|<-legacy-radial-gradient>|<-legacy-repeating-radial-gradient>","-legacy-linear-gradient":"-moz-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-repeating-linear-gradient":"-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-linear-gradient-arguments":"[<angle>|<side-or-corner>]? , <color-stop-list>","-legacy-radial-gradient":"-moz-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-repeating-radial-gradient":"-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-radial-gradient-arguments":"[<position> ,]? [[[<-legacy-radial-gradient-shape>||<-legacy-radial-gradient-size>]|[<length>|<percentage>]{2}] ,]? <color-stop-list>","-legacy-radial-gradient-size":"closest-side|closest-corner|farthest-side|farthest-corner|contain|cover","-legacy-radial-gradient-shape":"circle|ellipse","-non-standard-font":"-apple-system-body|-apple-system-headline|-apple-system-subheadline|-apple-system-caption1|-apple-system-caption2|-apple-system-footnote|-apple-system-short-body|-apple-system-short-headline|-apple-system-short-subheadline|-apple-system-short-caption1|-apple-system-short-footnote|-apple-system-tall-body","-non-standard-color":"-moz-ButtonDefault|-moz-ButtonHoverFace|-moz-ButtonHoverText|-moz-CellHighlight|-moz-CellHighlightText|-moz-Combobox|-moz-ComboboxText|-moz-Dialog|-moz-DialogText|-moz-dragtargetzone|-moz-EvenTreeRow|-moz-Field|-moz-FieldText|-moz-html-CellHighlight|-moz-html-CellHighlightText|-moz-mac-accentdarkestshadow|-moz-mac-accentdarkshadow|-moz-mac-accentface|-moz-mac-accentlightesthighlight|-moz-mac-accentlightshadow|-moz-mac-accentregularhighlight|-moz-mac-accentregularshadow|-moz-mac-chrome-active|-moz-mac-chrome-inactive|-moz-mac-focusring|-moz-mac-menuselect|-moz-mac-menushadow|-moz-mac-menutextselect|-moz-MenuHover|-moz-MenuHoverText|-moz-MenuBarText|-moz-MenuBarHoverText|-moz-nativehyperlinktext|-moz-OddTreeRow|-moz-win-communicationstext|-moz-win-mediatext|-moz-activehyperlinktext|-moz-default-background-color|-moz-default-color|-moz-hyperlinktext|-moz-visitedhyperlinktext|-webkit-activelink|-webkit-focus-ring-color|-webkit-link|-webkit-text","-non-standard-image-rendering":"optimize-contrast|-moz-crisp-edges|-o-crisp-edges|-webkit-optimize-contrast","-non-standard-overflow":"overlay|-moz-scrollbars-none|-moz-scrollbars-horizontal|-moz-scrollbars-vertical|-moz-hidden-unscrollable","-non-standard-size":"intrinsic|min-intrinsic|-webkit-fill-available|-webkit-fit-content|-webkit-min-content|-webkit-max-content|-moz-available|-moz-fit-content|-moz-min-content|-moz-max-content","-webkit-gradient()":"-webkit-gradient( <-webkit-gradient-type> , <-webkit-gradient-point> [, <-webkit-gradient-point>|, <-webkit-gradient-radius> , <-webkit-gradient-point>] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )","-webkit-gradient-color-stop":"from( <color> )|color-stop( [<number-zero-one>|<percentage>] , <color> )|to( <color> )","-webkit-gradient-point":"[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]","-webkit-gradient-radius":"<length>|<percentage>","-webkit-gradient-type":"linear|radial","-webkit-mask-box-repeat":"repeat|stretch|round","-ms-filter-function-list":"<-ms-filter-function>+","-ms-filter-function":"<-ms-filter-function-progid>|<-ms-filter-function-legacy>","-ms-filter-function-progid":"'progid:' [<ident-token> '.']* [<ident-token>|<function-token> <any-value>? )]","-ms-filter-function-legacy":"<ident-token>|<function-token> <any-value>? )",age:"child|young|old","attr-name":"<wq-name>","attr-fallback":"<any-value>",autospace:"no-autospace|[ideograph-alpha||ideograph-numeric||punctuation]||[insert|replace]",bottom:"<length>|auto","generic-voice":"[<age>? <gender> <integer>?]",gender:"male|female|neutral","generic-script-specific":"generic( kai )|generic( fangsong )|generic( nastaliq )","-non-standard-generic-family":"-apple-system|BlinkMacSystemFont","intrinsic-size-keyword":"min-content|max-content|fit-content",left:"<length>|auto","device-cmyk()":"<legacy-device-cmyk-syntax>|<modern-device-cmyk-syntax>","legacy-device-cmyk-syntax":"device-cmyk( <number>#{4} )","modern-device-cmyk-syntax":"device-cmyk( <cmyk-component>{4} [/ [<alpha-value>|none]]? )","cmyk-component":"<number>|<percentage>|none","color-space":"<rectangular-color-space>|<polar-color-space>|<custom-color-space>",right:"<length>|auto","forgiving-selector-list":"<complex-real-selector-list>","forgiving-relative-selector-list":"<relative-real-selector-list>","complex-real-selector-list":"<complex-real-selector>#","simple-selector-list":"<simple-selector>#","relative-real-selector-list":"<relative-real-selector>#","complex-selector-unit":"[<compound-selector>? <pseudo-compound-selector>*]!","complex-real-selector":"<compound-selector> [<combinator>? <compound-selector>]*","relative-real-selector":"<combinator>? <complex-real-selector>","pseudo-compound-selector":"<pseudo-element-selector> <pseudo-class-selector>*","simple-selector":"<type-selector>|<subclass-selector>","legacy-pseudo-element-selector":"':' [before|after|first-line|first-letter]","svg-length":"<percentage>|<length>|<number>","svg-writing-mode":"lr-tb|rl-tb|tb-rl|lr|rl|tb",top:"<length>|auto",x:"<number>",y:"<number>",declaration:"<ident-token> : <declaration-value>? ['!' important]?","declaration-list":"[<declaration>? ';']* <declaration>?",url:"url( <string> <url-modifier>* )|<url-token>","url-modifier":"<ident>|<function-token> <any-value> )","number-zero-one":"<number [0,1]>","number-one-or-greater":"<number [1,\u221E]>","xyz-space":"xyz|xyz-d50|xyz-d65","style-condition":"not <style-in-parens>|<style-in-parens> [[and <style-in-parens>]*|[or <style-in-parens>]*]","-non-standard-display":"-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box","inset-area":"[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]",syntax:"'*'|<syntax-component> [<syntax-combinator> <syntax-component>]*|<syntax-string>","syntax-component":"<syntax-single-component> <syntax-multiplier>?|'<' transform-list '>'","syntax-single-component":"'<' <syntax-type-name> '>'|<ident>","syntax-type-name":"angle|color|custom-ident|image|integer|length|length-percentage|number|percentage|resolution|string|time|url|transform-function","syntax-combinator":"'|'","syntax-multiplier":"'#'|'+'","syntax-string":"<string>"},properties:{"--*":"<declaration-value>","-ms-accelerator":"false|true","-ms-block-progression":"tb|rl|bt|lr","-ms-content-zoom-chaining":"none|chained","-ms-content-zoom-limit":"<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>","-ms-content-zoom-limit-max":"<percentage>","-ms-content-zoom-limit-min":"<percentage>","-ms-content-zoom-snap":"<'-ms-content-zoom-snap-type'>||<'-ms-content-zoom-snap-points'>","-ms-content-zoom-snap-points":"snapInterval( <percentage> , <percentage> )|snapList( <percentage># )","-ms-content-zoom-snap-type":"none|proximity|mandatory","-ms-content-zooming":"none|zoom","-ms-filter":"<string>","-ms-flow-from":"[none|<custom-ident>]#","-ms-flow-into":"[none|<custom-ident>]#","-ms-grid-columns":"none|<track-list>|<auto-track-list>","-ms-grid-rows":"none|<track-list>|<auto-track-list>","-ms-high-contrast-adjust":"auto|none","-ms-hyphenate-limit-chars":"auto|<integer>{1,3}","-ms-hyphenate-limit-lines":"no-limit|<integer>","-ms-hyphenate-limit-zone":"<percentage>|<length>","-ms-ime-align":"auto|after","-ms-overflow-style":"auto|none|scrollbar|-ms-autohiding-scrollbar","-ms-scroll-chaining":"chained|none","-ms-scroll-limit":"<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>","-ms-scroll-limit-x-max":"auto|<length>","-ms-scroll-limit-x-min":"<length>","-ms-scroll-limit-y-max":"auto|<length>","-ms-scroll-limit-y-min":"<length>","-ms-scroll-rails":"none|railed","-ms-scroll-snap-points-x":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-points-y":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-type":"none|proximity|mandatory","-ms-scroll-snap-x":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>","-ms-scroll-snap-y":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>","-ms-scroll-translation":"none|vertical-to-horizontal","-ms-scrollbar-3dlight-color":"<color>","-ms-scrollbar-arrow-color":"<color>","-ms-scrollbar-base-color":"<color>","-ms-scrollbar-darkshadow-color":"<color>","-ms-scrollbar-face-color":"<color>","-ms-scrollbar-highlight-color":"<color>","-ms-scrollbar-shadow-color":"<color>","-ms-scrollbar-track-color":"<color>","-ms-text-autospace":"none|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space","-ms-touch-select":"grippers|none","-ms-user-select":"none|element|text","-ms-wrap-flow":"auto|both|start|end|maximum|clear","-ms-wrap-margin":"<length>","-ms-wrap-through":"wrap|none","-moz-appearance":"none|button|button-arrow-down|button-arrow-next|button-arrow-previous|button-arrow-up|button-bevel|button-focus|caret|checkbox|checkbox-container|checkbox-label|checkmenuitem|dualbutton|groupbox|listbox|listitem|menuarrow|menubar|menucheckbox|menuimage|menuitem|menuitemtext|menulist|menulist-button|menulist-text|menulist-textfield|menupopup|menuradio|menuseparator|meterbar|meterchunk|progressbar|progressbar-vertical|progresschunk|progresschunk-vertical|radio|radio-container|radio-label|radiomenuitem|range|range-thumb|resizer|resizerpanel|scale-horizontal|scalethumbend|scalethumb-horizontal|scalethumbstart|scalethumbtick|scalethumb-vertical|scale-vertical|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|separator|sheet|spinner|spinner-downbutton|spinner-textfield|spinner-upbutton|splitter|statusbar|statusbarpanel|tab|tabpanel|tabpanels|tab-scroll-arrow-back|tab-scroll-arrow-forward|textfield|textfield-multiline|toolbar|toolbarbutton|toolbarbutton-dropdown|toolbargripper|toolbox|tooltip|treeheader|treeheadercell|treeheadersortarrow|treeitem|treeline|treetwisty|treetwistyopen|treeview|-moz-mac-unified-toolbar|-moz-win-borderless-glass|-moz-win-browsertabbar-toolbox|-moz-win-communicationstext|-moz-win-communications-toolbox|-moz-win-exclude-glass|-moz-win-glass|-moz-win-mediatext|-moz-win-media-toolbox|-moz-window-button-box|-moz-window-button-box-maximized|-moz-window-button-close|-moz-window-button-maximize|-moz-window-button-minimize|-moz-window-button-restore|-moz-window-frame-bottom|-moz-window-frame-left|-moz-window-frame-right|-moz-window-titlebar|-moz-window-titlebar-maximized","-moz-binding":"<url>|none","-moz-border-bottom-colors":"<color>+|none","-moz-border-left-colors":"<color>+|none","-moz-border-right-colors":"<color>+|none","-moz-border-top-colors":"<color>+|none","-moz-context-properties":"none|[fill|fill-opacity|stroke|stroke-opacity]#","-moz-float-edge":"border-box|content-box|margin-box|padding-box","-moz-force-broken-image-icon":"0|1","-moz-orient":"inline|block|horizontal|vertical","-moz-outline-radius":"<outline-radius>{1,4} [/ <outline-radius>{1,4}]?","-moz-outline-radius-bottomleft":"<outline-radius>","-moz-outline-radius-bottomright":"<outline-radius>","-moz-outline-radius-topleft":"<outline-radius>","-moz-outline-radius-topright":"<outline-radius>","-moz-stack-sizing":"ignore|stretch-to-fit","-moz-text-blink":"none|blink","-moz-user-focus":"ignore|normal|select-after|select-before|select-menu|select-same|select-all|none","-moz-user-input":"auto|none|enabled|disabled","-moz-user-modify":"read-only|read-write|write-only","-moz-window-dragging":"drag|no-drag","-moz-window-shadow":"default|menu|tooltip|sheet|none","-webkit-appearance":"none|button|button-bevel|caps-lock-indicator|caret|checkbox|default-button|inner-spin-button|listbox|listitem|media-controls-background|media-controls-fullscreen-background|media-current-time-display|media-enter-fullscreen-button|media-exit-fullscreen-button|media-fullscreen-button|media-mute-button|media-overlay-play-button|media-play-button|media-seek-back-button|media-seek-forward-button|media-slider|media-sliderthumb|media-time-remaining-display|media-toggle-closed-captions-button|media-volume-slider|media-volume-slider-container|media-volume-sliderthumb|menulist|menulist-button|menulist-text|menulist-textfield|meter|progress-bar|progress-bar-value|push-button|radio|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbargripper-horizontal|scrollbargripper-vertical|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|searchfield-cancel-button|searchfield-decoration|searchfield-results-button|searchfield-results-decoration|slider-horizontal|slider-vertical|sliderthumb-horizontal|sliderthumb-vertical|square-button|textarea|textfield|-apple-pay-button","-webkit-border-before":"<'border-width'>||<'border-style'>||<color>","-webkit-border-before-color":"<color>","-webkit-border-before-style":"<'border-style'>","-webkit-border-before-width":"<'border-width'>","-webkit-box-reflect":"[above|below|right|left]? <length>? <image>?","-webkit-line-clamp":"none|<integer>","-webkit-mask":"[<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||[<visual-box>|border|padding|content|text]||[<visual-box>|border|padding|content]]#","-webkit-mask-attachment":"<attachment>#","-webkit-mask-clip":"[<coord-box>|no-clip|border|padding|content|text]#","-webkit-mask-composite":"<composite-style>#","-webkit-mask-image":"<mask-reference>#","-webkit-mask-origin":"[<coord-box>|border|padding|content]#","-webkit-mask-position":"<position>#","-webkit-mask-position-x":"[<length-percentage>|left|center|right]#","-webkit-mask-position-y":"[<length-percentage>|top|center|bottom]#","-webkit-mask-repeat":"<repeat-style>#","-webkit-mask-repeat-x":"repeat|no-repeat|space|round","-webkit-mask-repeat-y":"repeat|no-repeat|space|round","-webkit-mask-size":"<bg-size>#","-webkit-overflow-scrolling":"auto|touch","-webkit-tap-highlight-color":"<color>","-webkit-text-fill-color":"<color>","-webkit-text-stroke":"<length>||<color>","-webkit-text-stroke-color":"<color>","-webkit-text-stroke-width":"<length>","-webkit-touch-callout":"default|none","-webkit-user-modify":"read-only|read-write|read-write-plaintext-only","-webkit-user-select":"auto|none|text|all","accent-color":"auto|<color>","align-content":"normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>","align-items":"normal|stretch|<baseline-position>|[<overflow-position>? <self-position>]|anchor-center","align-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? <self-position>|anchor-center","align-tracks":"[normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>]#","alignment-baseline":"auto|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical",all:"initial|inherit|unset|revert|revert-layer","anchor-name":"none|<dashed-ident>#","anchor-scope":"none|all|<dashed-ident>#",animation:"<single-animation>#","animation-composition":"<single-animation-composition>#","animation-delay":"<time>#","animation-direction":"<single-animation-direction>#","animation-duration":"[auto|<time [0s,\u221E]>]#","animation-fill-mode":"<single-animation-fill-mode>#","animation-iteration-count":"<single-animation-iteration-count>#","animation-name":"[none|<keyframes-name>]#","animation-play-state":"<single-animation-play-state>#","animation-range":"[<'animation-range-start'> <'animation-range-end'>?]#","animation-range-end":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","animation-range-start":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","animation-timeline":"<single-animation-timeline>#","animation-timing-function":"<easing-function>#","animation-trigger":"[none|[<dashed-ident> <animation-action>+]+]#",appearance:"none|auto|<compat-auto>|<compat-special>","aspect-ratio":"auto||<ratio>","backdrop-filter":"none|<filter-value-list>","backface-visibility":"visible|hidden",background:"<bg-layer>#? , <final-bg-layer>","background-attachment":"<attachment>#","background-blend-mode":"<blend-mode>#","background-clip":"<bg-clip>#","background-color":"<color>","background-image":"<bg-image>#","background-origin":"<visual-box>#","background-position":"<bg-position>#","background-position-x":"[center|[[left|right|x-start|x-end]? <length-percentage>?]!]#","background-position-y":"[center|[[top|bottom|y-start|y-end]? <length-percentage>?]!]#","background-repeat":"<repeat-style>#","background-size":"<bg-size>#","baseline-shift":"baseline|sub|super|<svg-length>","baseline-source":"auto|first|last","block-size":"<'width'>",border:"<line-width>||<line-style>||<color>","border-block":"<'border-block-start'>","border-block-color":"<'border-top-color'>{1,2}","border-block-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-end-color":"<'border-top-color'>","border-block-end-style":"<'border-top-style'>","border-block-end-width":"<'border-top-width'>","border-block-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-start-color":"<'border-top-color'>","border-block-start-style":"<'border-top-style'>","border-block-start-width":"<'border-top-width'>","border-block-style":"<'border-top-style'>{1,2}","border-block-width":"<'border-top-width'>{1,2}","border-bottom":"<line-width>||<line-style>||<color>","border-bottom-color":"<'border-top-color'>","border-bottom-left-radius":"<length-percentage [0,\u221E]>{1,2}","border-bottom-right-radius":"<length-percentage [0,\u221E]>{1,2}","border-bottom-style":"<line-style>","border-bottom-width":"<line-width>","border-collapse":"separate|collapse","border-color":"<color>{1,4}","border-end-end-radius":"<'border-top-left-radius'>","border-end-start-radius":"<'border-top-left-radius'>","border-image":"<'border-image-source'>||<'border-image-slice'> [/ <'border-image-width'>|/ <'border-image-width'>? / <'border-image-outset'>]?||<'border-image-repeat'>","border-image-outset":"[<length [0,\u221E]>|<number [0,\u221E]>]{1,4}","border-image-repeat":"[stretch|repeat|round|space]{1,2}","border-image-slice":"[<number [0,\u221E]>|<percentage [0,\u221E]>]{1,4}&&fill?","border-image-source":"none|<image>","border-image-width":"[<length-percentage [0,\u221E]>|<number [0,\u221E]>|auto]{1,4}","border-inline":"<'border-block-start'>","border-inline-color":"<'border-top-color'>{1,2}","border-inline-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-end-color":"<'border-top-color'>","border-inline-end-style":"<'border-top-style'>","border-inline-end-width":"<'border-top-width'>","border-inline-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-start-color":"<'border-top-color'>","border-inline-start-style":"<'border-top-style'>","border-inline-start-width":"<'border-top-width'>","border-inline-style":"<'border-top-style'>{1,2}","border-inline-width":"<'border-top-width'>{1,2}","border-left":"<line-width>||<line-style>||<color>","border-left-color":"<color>","border-left-style":"<line-style>","border-left-width":"<line-width>","border-radius":"<length-percentage [0,\u221E]>{1,4} [/ <length-percentage [0,\u221E]>{1,4}]?","border-right":"<line-width>||<line-style>||<color>","border-right-color":"<color>","border-right-style":"<line-style>","border-right-width":"<line-width>","border-spacing":"<length>{1,2}","border-start-end-radius":"<'border-top-left-radius'>","border-start-start-radius":"<'border-top-left-radius'>","border-style":"<line-style>{1,4}","border-top":"<line-width>||<line-style>||<color>","border-top-color":"<color>","border-top-left-radius":"<length-percentage [0,\u221E]>{1,2}","border-top-right-radius":"<length-percentage [0,\u221E]>{1,2}","border-top-style":"<line-style>","border-top-width":"<line-width>","border-width":"<line-width>{1,4}",bottom:"auto|<length-percentage>|<anchor()>|<anchor-size()>","box-align":"start|center|end|baseline|stretch","box-decoration-break":"slice|clone","box-direction":"normal|reverse|inherit","box-flex":"<number>","box-flex-group":"<integer>","box-lines":"single|multiple","box-ordinal-group":"<integer>","box-orient":"horizontal|vertical|inline-axis|block-axis|inherit","box-pack":"start|center|end|justify","box-shadow":"none|<shadow>#","box-sizing":"content-box|border-box","break-after":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-before":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-inside":"auto|avoid|avoid-page|avoid-column|avoid-region","caption-side":"top|bottom",caret:"<'caret-color'>||<'caret-animation'>||<'caret-shape'>","caret-animation":"auto|manual","caret-color":"auto|<color>","caret-shape":"auto|bar|block|underscore",clear:"none|left|right|both|inline-start|inline-end",clip:"<shape>|auto","clip-path":"<clip-source>|[<basic-shape>||<geometry-box>]|none","clip-rule":"nonzero|evenodd",color:"<color>","color-interpolation-filters":"auto|sRGB|linearRGB","color-scheme":"normal|[light|dark|<custom-ident>]+&&only?","column-count":"<integer>|auto","column-fill":"auto|balance","column-gap":"normal|<length-percentage>","column-height":"auto|<length [0,\u221E]>","column-rule":"<'column-rule-width'>||<'column-rule-style'>||<'column-rule-color'>","column-rule-color":"<color>","column-rule-style":"<'border-style'>","column-rule-width":"<'border-width'>","column-span":"none|all","column-width":"auto|<length [0,\u221E]>","column-wrap":"auto|nowrap|wrap",columns:"[<'column-width'>||<'column-count'>] [/ <'column-height'>]?",contain:"none|strict|content|[[size||inline-size]||layout||style||paint]","contain-intrinsic-block-size":"auto? [none|<length>]","contain-intrinsic-height":"auto? [none|<length>]","contain-intrinsic-inline-size":"auto? [none|<length>]","contain-intrinsic-size":"[auto? [none|<length>]]{1,2}","contain-intrinsic-width":"auto? [none|<length>]",container:"<'container-name'> [/ <'container-type'>]?","container-name":"none|<custom-ident>+","container-type":"normal||[size|inline-size]",content:"normal|none|[<content-replacement>|<content-list>] [/ [<string>|<counter>|<attr()>]+]?","content-visibility":"visible|auto|hidden","corner-block-end-shape":"<corner-shape-value>{1,2}","corner-block-start-shape":"<corner-shape-value>{1,2}","corner-bottom-shape":"<corner-shape-value>{1,2}","corner-bottom-left-shape":"<corner-shape-value>","corner-bottom-right-shape":"<corner-shape-value>","corner-end-end-shape":"<corner-shape-value>","corner-end-start-shape":"<corner-shape-value>","corner-inline-end-shape":"<corner-shape-value>{1,2}","corner-inline-start-shape":"<corner-shape-value>{1,2}","corner-left-shape":"<corner-shape-value>{1,2}","corner-right-shape":"<corner-shape-value>{1,2}","corner-shape":"<corner-shape-value>{1,4}","corner-start-start-shape":"<corner-shape-value>","corner-start-end-shape":"<corner-shape-value>","corner-top-shape":"<corner-shape-value>{1,2}","corner-top-left-shape":"<corner-shape-value>","corner-top-right-shape":"<corner-shape-value>","counter-increment":"[<counter-name> <integer>?]+|none","counter-reset":"[<counter-name> <integer>?|<reversed-counter-name> <integer>?]+|none","counter-set":"[<counter-name> <integer>?]+|none",cursor:"[[<url> [<x> <y>]? ,]* [auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing|hand|-webkit-grab|-webkit-grabbing|-webkit-zoom-in|-webkit-zoom-out|-moz-grab|-moz-grabbing|-moz-zoom-in|-moz-zoom-out]]",cx:"<length>|<percentage>",cy:"<length>|<percentage>",d:"none|path( <string> )",direction:"ltr|rtl",display:"[<display-outside>||<display-inside>]|<display-listitem>|<display-internal>|<display-box>|<display-legacy>|<-non-standard-display>","dominant-baseline":"auto|use-script|no-change|reset-size|ideographic|alphabetic|hanging|mathematical|central|middle|text-after-edge|text-before-edge","dynamic-range-limit":"standard|no-limit|constrained|<dynamic-range-limit-mix()>","empty-cells":"show|hide","field-sizing":"content|fixed",fill:"<paint>","fill-opacity":"<number-zero-one>|<percentage>","fill-rule":"nonzero|evenodd",filter:"none|<filter-value-list>|<-ms-filter-function-list>",flex:"none|[<'flex-grow'> <'flex-shrink'>?||<'flex-basis'>]","flex-basis":"content|<'width'>","flex-direction":"row|row-reverse|column|column-reverse","flex-flow":"<'flex-direction'>||<'flex-wrap'>","flex-grow":"<number>","flex-shrink":"<number>","flex-wrap":"nowrap|wrap|wrap-reverse",float:"left|right|none|inline-start|inline-end","flood-color":"<color>","flood-opacity":"<'opacity'>",font:"[[<'font-style'>||<font-variant-css2>||<'font-weight'>||<font-width-css3>]? <'font-size'> [/ <'line-height'>]? <'font-family'>#]|<system-family-name>|<-non-standard-font>","font-family":"[<family-name>|<generic-family>]#","font-feature-settings":"normal|<feature-tag-value>#","font-kerning":"auto|normal|none","font-language-override":"normal|<string>","font-optical-sizing":"auto|none","font-palette":"normal|light|dark|<palette-identifier>|<palette-mix()>","font-size":"<absolute-size>|<relative-size>|<length-percentage [0,\u221E]>|math","font-size-adjust":"none|[ex-height|cap-height|ch-width|ic-width|ic-height]? [from-font|<number>]","font-smooth":"auto|never|always|<absolute-size>|<length>","font-stretch":"<font-stretch-absolute>","font-style":"normal|italic|oblique <angle>?","font-synthesis":"none|[weight||style||small-caps||position]","font-synthesis-position":"auto|none","font-synthesis-small-caps":"auto|none","font-synthesis-style":"auto|none","font-synthesis-weight":"auto|none","font-variant":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>||stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )||[small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps]||<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero||<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-alternates":"normal|[stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )]","font-variant-caps":"normal|small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","font-variant-east-asian":"normal|[<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-emoji":"normal|text|emoji|unicode","font-variant-ligatures":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>]","font-variant-numeric":"normal|[<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero]","font-variant-position":"normal|sub|super","font-variation-settings":"normal|[<string> <number>]#","font-weight":"<font-weight-absolute>|bolder|lighter","font-width":"normal|<percentage [0,\u221E]>|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded","forced-color-adjust":"auto|none|preserve-parent-color",gap:"<'row-gap'> <'column-gap'>?",grid:"<'grid-template'>|<'grid-template-rows'> / [auto-flow&&dense?] <'grid-auto-columns'>?|[auto-flow&&dense?] <'grid-auto-rows'>? / <'grid-template-columns'>","grid-area":"<grid-line> [/ <grid-line>]{0,3}","grid-auto-columns":"<track-size>+","grid-auto-flow":"[row|column]||dense","grid-auto-rows":"<track-size>+","grid-column":"<grid-line> [/ <grid-line>]?","grid-column-end":"<grid-line>","grid-column-gap":"<length-percentage>","grid-column-start":"<grid-line>","grid-gap":"<'grid-row-gap'> <'grid-column-gap'>?","grid-row":"<grid-line> [/ <grid-line>]?","grid-row-end":"<grid-line>","grid-row-gap":"<length-percentage>","grid-row-start":"<grid-line>","grid-template":"none|[<'grid-template-rows'> / <'grid-template-columns'>]|[<line-names>? <string> <track-size>? <line-names>?]+ [/ <explicit-track-list>]?","grid-template-areas":"none|<string>+","grid-template-columns":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","grid-template-rows":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","hanging-punctuation":"none|[first||[force-end|allow-end]||last]",height:"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","hyphenate-character":"auto|<string>","hyphenate-limit-chars":"[auto|<integer>]{1,3}",hyphens:"none|manual|auto","image-orientation":"from-image|<angle>|[<angle>? flip]","image-rendering":"auto|crisp-edges|pixelated|smooth|optimizeSpeed|optimizeQuality|<-non-standard-image-rendering>","image-resolution":"[from-image||<resolution>]&&snap?","ime-mode":"auto|normal|active|inactive|disabled","initial-letter":"normal|[<number> <integer>?]","initial-letter-align":"[auto|alphabetic|hanging|ideographic]","inline-size":"<'width'>",inset:"<'top'>{1,4}","inset-block":"<'top'>{1,2}","inset-block-end":"<'top'>","inset-block-start":"<'top'>","inset-inline":"<'top'>{1,2}","inset-inline-end":"<'top'>","inset-inline-start":"<'top'>","interpolate-size":"numeric-only|allow-keywords",isolation:"auto|isolate",interactivity:"auto|inert","interest-delay":"<'interest-delay-start'>{1,2}","interest-delay-end":"normal|<time>","interest-delay-start":"normal|<time>","justify-content":"normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]","justify-items":"normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|legacy|legacy&&[left|right|center]|anchor-center","justify-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|anchor-center","justify-tracks":"[normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]]#",left:"auto|<length-percentage>|<anchor()>|<anchor-size()>","letter-spacing":"normal|<length-percentage>","lighting-color":"<color>","line-break":"auto|loose|normal|strict|anywhere","line-clamp":"none|<integer>","line-height":"normal|<number>|<length>|<percentage>","line-height-step":"<length>","list-style":"<'list-style-type'>||<'list-style-position'>||<'list-style-image'>","list-style-image":"<image>|none","list-style-position":"inside|outside","list-style-type":"<counter-style>|<string>|none",margin:"<'margin-top'>{1,4}","margin-block":"<'margin-top'>{1,2}","margin-block-end":"<'margin-top'>","margin-block-start":"<'margin-top'>","margin-bottom":"<length-percentage>|auto|<anchor-size()>","margin-inline":"<'margin-top'>{1,2}","margin-inline-end":"<'margin-top'>","margin-inline-start":"<'margin-top'>","margin-left":"<length-percentage>|auto|<anchor-size()>","margin-right":"<length-percentage>|auto|<anchor-size()>","margin-top":"<length-percentage>|auto|<anchor-size()>","margin-trim":"none|in-flow|all",marker:"none|<url>","marker-end":"none|<url>","marker-mid":"none|<url>","marker-start":"none|<url>",mask:"<mask-layer>#","mask-border":"<'mask-border-source'>||<'mask-border-slice'> [/ <'mask-border-width'>? [/ <'mask-border-outset'>]?]?||<'mask-border-repeat'>||<'mask-border-mode'>","mask-border-mode":"luminance|alpha","mask-border-outset":"[<length>|<number>]{1,4}","mask-border-repeat":"[stretch|repeat|round|space]{1,2}","mask-border-slice":"<number-percentage>{1,4} fill?","mask-border-source":"none|<image>","mask-border-width":"[<length-percentage>|<number>|auto]{1,4}","mask-clip":"[<coord-box>|no-clip]#","mask-composite":"<compositing-operator>#","mask-image":"<mask-reference>#","mask-mode":"<masking-mode>#","mask-origin":"<coord-box>#","mask-position":"<position>#","mask-repeat":"<repeat-style>#","mask-size":"<bg-size>#","mask-type":"luminance|alpha","masonry-auto-flow":"[pack|next]||[definite-first|ordered]","math-depth":"auto-add|add( <integer> )|<integer>","math-shift":"normal|compact","math-style":"normal|compact","max-block-size":"<'max-width'>","max-height":"none|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","max-inline-size":"<'max-width'>","max-lines":"none|<integer>","max-width":"none|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","min-block-size":"<'min-width'>","min-height":"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","min-inline-size":"<'min-width'>","min-width":"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","mix-blend-mode":"<blend-mode>|plus-darker|plus-lighter","object-fit":"fill|contain|cover|none|scale-down","object-position":"<position>","object-view-box":"none|<basic-shape-rect>",offset:"[<'offset-position'>? [<'offset-path'> [<'offset-distance'>||<'offset-rotate'>]?]?]! [/ <'offset-anchor'>]?","offset-anchor":"auto|<position>","offset-distance":"<length-percentage>","offset-path":"none|<offset-path>||<coord-box>","offset-position":"normal|auto|<position>","offset-rotate":"[auto|reverse]||<angle>",opacity:"<opacity-value>",order:"<integer>",orphans:"<integer>",outline:"<'outline-width'>||<'outline-style'>||<'outline-color'>","outline-color":"auto|<color>","outline-offset":"<length>","outline-style":"auto|<outline-line-style>","outline-width":"<line-width>",overflow:"[visible|hidden|clip|scroll|auto]{1,2}|<-non-standard-overflow>","overflow-anchor":"auto|none","overflow-block":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-clip-box":"padding-box|content-box","overflow-clip-margin":"<visual-box>||<length [0,\u221E]>","overflow-inline":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-wrap":"normal|break-word|anywhere","overflow-x":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-y":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>",overlay:"none|auto","overscroll-behavior":"[contain|none|auto]{1,2}","overscroll-behavior-block":"contain|none|auto","overscroll-behavior-inline":"contain|none|auto","overscroll-behavior-x":"contain|none|auto","overscroll-behavior-y":"contain|none|auto",padding:"<'padding-top'>{1,4}","padding-block":"<'padding-top'>{1,2}","padding-block-end":"<'padding-top'>","padding-block-start":"<'padding-top'>","padding-bottom":"<length-percentage [0,\u221E]>","padding-inline":"<'padding-top'>{1,2}","padding-inline-end":"<'padding-top'>","padding-inline-start":"<'padding-top'>","padding-left":"<length-percentage [0,\u221E]>","padding-right":"<length-percentage [0,\u221E]>","padding-top":"<length-percentage [0,\u221E]>",page:"auto|<custom-ident>","page-break-after":"auto|always|avoid|left|right|recto|verso","page-break-before":"auto|always|avoid|left|right|recto|verso","page-break-inside":"auto|avoid","paint-order":"normal|[fill||stroke||markers]",perspective:"none|<length>","perspective-origin":"<position>","place-content":"<'align-content'> <'justify-content'>?","place-items":"<'align-items'> <'justify-items'>?","place-self":"<'align-self'> <'justify-self'>?","pointer-events":"auto|none|visiblePainted|visibleFill|visibleStroke|visible|painted|fill|stroke|all|inherit",position:"static|relative|absolute|sticky|fixed|-webkit-sticky","position-anchor":"auto|none|<anchor-name>","position-area":"none|<position-area>","position-try":"<'position-try-order'>? <'position-try-fallbacks'>","position-try-fallbacks":"none|[[<dashed-ident>||<try-tactic>]|<'position-area'>]#","position-try-order":"normal|<try-size>","position-visibility":"always|[anchors-valid||anchors-visible||no-overflow]","print-color-adjust":"economy|exact",quotes:"none|auto|[<string> <string>]+",r:"<length>|<percentage>","reading-flow":"normal|source-order|flex-visual|flex-flow|grid-rows|grid-columns|grid-order","reading-order":"<integer>",resize:"none|both|horizontal|vertical|block|inline",right:"auto|<length-percentage>|<anchor()>|<anchor-size()>",rotate:"none|<angle>|[x|y|z|<number>{3}]&&<angle>","row-gap":"normal|<length-percentage>","ruby-align":"start|center|space-between|space-around","ruby-merge":"separate|collapse|auto","ruby-overhang":"auto|none","ruby-position":"[alternate||[over|under]]|inter-character",rx:"<length>|<percentage>",ry:"<length>|<percentage>",scale:"none|[<number>|<percentage>]{1,3}","scroll-behavior":"auto|smooth","scroll-initial-target":"none|nearest","scroll-margin":"<length>{1,4}","scroll-margin-block":"<length>{1,2}","scroll-margin-block-end":"<length>","scroll-margin-block-start":"<length>","scroll-margin-bottom":"<length>","scroll-margin-inline":"<length>{1,2}","scroll-margin-inline-end":"<length>","scroll-margin-inline-start":"<length>","scroll-margin-left":"<length>","scroll-margin-right":"<length>","scroll-margin-top":"<length>","scroll-marker-group":"none|before|after","scroll-padding":"[auto|<length-percentage>]{1,4}","scroll-padding-block":"[auto|<length-percentage>]{1,2}","scroll-padding-block-end":"auto|<length-percentage>","scroll-padding-block-start":"auto|<length-percentage>","scroll-padding-bottom":"auto|<length-percentage>","scroll-padding-inline":"[auto|<length-percentage>]{1,2}","scroll-padding-inline-end":"auto|<length-percentage>","scroll-padding-inline-start":"auto|<length-percentage>","scroll-padding-left":"auto|<length-percentage>","scroll-padding-right":"auto|<length-percentage>","scroll-padding-top":"auto|<length-percentage>","scroll-snap-align":"[none|start|end|center]{1,2}","scroll-snap-coordinate":"none|<position>#","scroll-snap-destination":"<position>","scroll-snap-points-x":"none|repeat( <length-percentage> )","scroll-snap-points-y":"none|repeat( <length-percentage> )","scroll-snap-stop":"normal|always","scroll-snap-type":"none|[x|y|block|inline|both] [mandatory|proximity]?","scroll-snap-type-x":"none|mandatory|proximity","scroll-snap-type-y":"none|mandatory|proximity","scroll-target-group":"none|auto","scroll-timeline":"[<'scroll-timeline-name'> <'scroll-timeline-axis'>?]#","scroll-timeline-axis":"[block|inline|x|y]#","scroll-timeline-name":"[none|<dashed-ident>]#","scrollbar-color":"auto|<color>{2}","scrollbar-gutter":"auto|stable&&both-edges?","scrollbar-width":"auto|thin|none","shape-image-threshold":"<opacity-value>","shape-margin":"<length-percentage>","shape-outside":"none|[<shape-box>||<basic-shape>]|<image>","shape-rendering":"auto|optimizeSpeed|crispEdges|geometricPrecision","speak-as":"normal|spell-out||digits||[literal-punctuation|no-punctuation]","stop-color":"<'color'>","stop-opacity":"<'opacity'>",stroke:"<paint>","stroke-color":"<color>","stroke-dasharray":"none|[<svg-length>+]#","stroke-dashoffset":"<svg-length>","stroke-linecap":"butt|round|square","stroke-linejoin":"miter|round|bevel","stroke-miterlimit":"<number-one-or-greater>","stroke-opacity":"<'opacity'>","stroke-width":"<svg-length>","tab-size":"<integer>|<length>","table-layout":"auto|fixed","text-align":"start|end|left|right|center|justify|match-parent","text-align-last":"auto|start|end|left|right|center|justify","text-anchor":"start|middle|end","text-autospace":"normal|<autospace>|auto","text-box":"normal|<'text-box-trim'>||<'text-box-edge'>","text-box-edge":"auto|<text-edge>","text-box-trim":"none|trim-start|trim-end|trim-both","text-combine-upright":"none|all|[digits <integer>?]","text-decoration":"<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>","text-decoration-color":"<color>","text-decoration-inset":"<length>{1,2}|auto","text-decoration-line":"none|[underline||overline||line-through||blink]|spelling-error|grammar-error","text-decoration-skip":"none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]","text-decoration-skip-ink":"auto|all|none","text-decoration-style":"solid|double|dotted|dashed|wavy","text-decoration-thickness":"auto|from-font|<length>|<percentage>","text-emphasis":"<'text-emphasis-style'>||<'text-emphasis-color'>","text-emphasis-color":"<color>","text-emphasis-position":"auto|[over|under]&&[right|left]?","text-emphasis-style":"none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>","text-indent":"<length-percentage>&&hanging?&&each-line?","text-justify":"auto|inter-character|inter-word|none","text-orientation":"mixed|upright|sideways","text-overflow":"[clip|ellipsis|<string>]{1,2}","text-rendering":"auto|optimizeSpeed|optimizeLegibility|geometricPrecision","text-shadow":"none|<shadow-t>#","text-size-adjust":"none|auto|<percentage>","text-spacing-trim":"space-all|normal|space-first|trim-start","text-transform":"none|[capitalize|uppercase|lowercase]||full-width||full-size-kana|math-auto","text-underline-offset":"auto|<length>|<percentage>","text-underline-position":"auto|from-font|[under||[left|right]]","text-wrap":"<'text-wrap-mode'>||<'text-wrap-style'>","text-wrap-mode":"wrap|nowrap","text-wrap-style":"auto|balance|stable|pretty","timeline-scope":"none|<dashed-ident>#","timeline-trigger":"none|[<'timeline-trigger-name'> <'timeline-trigger-source'> <'timeline-trigger-range'> ['/' <'timeline-trigger-exit-range'>]?]#","timeline-trigger-name":"none|<dashed-ident>#","timeline-trigger-exit-range":"[<'timeline-trigger-exit-range-start'> <'timeline-trigger-exit-range-end'>?]#","timeline-trigger-exit-range-end":"[auto|normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-exit-range-start":"[auto|normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-range":"[<'timeline-trigger-range-start'> <'timeline-trigger-range-end'>?]#","timeline-trigger-range-end":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-range-start":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-source":"<single-animation-timeline>#",top:"auto|<length-percentage>|<anchor()>|<anchor-size()>","touch-action":"auto|none|[[pan-x|pan-left|pan-right]||[pan-y|pan-up|pan-down]||pinch-zoom]|manipulation",transform:"none|<transform-list>","transform-box":"content-box|border-box|fill-box|stroke-box|view-box","transform-origin":"[<length-percentage>|left|center|right|top|bottom]|[[<length-percentage>|left|center|right]&&[<length-percentage>|top|center|bottom]] <length>?","transform-style":"flat|preserve-3d",transition:"<single-transition>#","transition-behavior":"<transition-behavior-value>#","transition-delay":"<time>#","transition-duration":"<time>#","transition-property":"none|<single-transition-property>#","transition-timing-function":"<easing-function>#",translate:"none|<length-percentage> [<length-percentage> <length>?]?","trigger-scope":"none|all|<dashed-ident>#","unicode-bidi":"normal|embed|isolate|bidi-override|isolate-override|plaintext|-moz-isolate|-moz-isolate-override|-moz-plaintext|-webkit-isolate|-webkit-isolate-override|-webkit-plaintext","user-select":"auto|text|none|all","vector-effect":"none|non-scaling-stroke|non-scaling-size|non-rotation|fixed-position","vertical-align":"baseline|sub|super|text-top|text-bottom|middle|top|bottom|<percentage>|<length>","view-timeline":"[<'view-timeline-name'> [<'view-timeline-axis'>||<'view-timeline-inset'>]?]#","view-timeline-axis":"[block|inline|x|y]#","view-timeline-inset":"[[auto|<length-percentage>]{1,2}]#","view-timeline-name":"[none|<dashed-ident>]#","view-transition-class":"none|<custom-ident>+","view-transition-name":"none|<custom-ident>|match-element",visibility:"visible|hidden|collapse","white-space":"normal|pre|pre-wrap|pre-line|<'white-space-collapse'>||<'text-wrap-mode'>","white-space-collapse":"collapse|preserve|preserve-breaks|preserve-spaces|break-spaces",widows:"<integer>",width:"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","will-change":"auto|<animateable-feature>#","word-break":"normal|break-all|keep-all|break-word|auto-phrase","word-spacing":"normal|<length>","word-wrap":"normal|break-word","writing-mode":"horizontal-tb|vertical-rl|vertical-lr|sideways-rl|sideways-lr|<svg-writing-mode>",x:"<length>|<percentage>",y:"<length>|<percentage>","z-index":"auto|<integer>",zoom:"normal|reset|<number [0,\u221E]>||<percentage [0,\u221E]>","-moz-background-clip":"padding|border","-moz-border-radius-bottomleft":"<'border-bottom-left-radius'>","-moz-border-radius-bottomright":"<'border-bottom-right-radius'>","-moz-border-radius-topleft":"<'border-top-left-radius'>","-moz-border-radius-topright":"<'border-bottom-right-radius'>","-moz-control-character-visibility":"visible|hidden","-moz-osx-font-smoothing":"auto|grayscale","-moz-user-select":"none|text|all|-moz-none","-ms-flex-align":"start|end|center|baseline|stretch","-ms-flex-item-align":"auto|start|end|center|baseline|stretch","-ms-flex-line-pack":"start|end|center|justify|distribute|stretch","-ms-flex-negative":"<'flex-shrink'>","-ms-flex-pack":"start|end|center|justify|distribute","-ms-flex-order":"<integer>","-ms-flex-positive":"<'flex-grow'>","-ms-flex-preferred-size":"<'flex-basis'>","-ms-interpolation-mode":"nearest-neighbor|bicubic","-ms-grid-column-align":"start|end|center|stretch","-ms-grid-row-align":"start|end|center|stretch","-ms-hyphenate-limit-last":"none|always|column|page|spread","-webkit-background-clip":"[<visual-box>|border|padding|content|text]#","-webkit-column-break-after":"always|auto|avoid","-webkit-column-break-before":"always|auto|avoid","-webkit-column-break-inside":"always|auto|avoid","-webkit-font-smoothing":"auto|none|antialiased|subpixel-antialiased","-webkit-mask-box-image":"[<url>|<gradient>|none] [<length-percentage>{4} <-webkit-mask-box-repeat>{2}]?","-webkit-print-color-adjust":"economy|exact","-webkit-text-security":"none|circle|disc|square","-webkit-user-drag":"none|element|auto",behavior:"<url>+",cue:"<'cue-before'> <'cue-after'>?","cue-after":"<url> <decibel>?|none","cue-before":"<url> <decibel>?|none","glyph-orientation-horizontal":"<angle>","glyph-orientation-vertical":"<angle>",kerning:"auto|<svg-length>",pause:"<'pause-before'> <'pause-after'>?","pause-after":"<time>|none|x-weak|weak|medium|strong|x-strong","pause-before":"<time>|none|x-weak|weak|medium|strong|x-strong","position-try-options":"<'position-try-fallbacks'>",rest:"<'rest-before'> <'rest-after'>?","rest-after":"<time>|none|x-weak|weak|medium|strong|x-strong","rest-before":"<time>|none|x-weak|weak|medium|strong|x-strong",speak:"auto|never|always","voice-balance":"<number>|left|center|right|leftwards|rightwards","voice-duration":"auto|<time>","voice-family":"[[<family-name>|<generic-voice>] ,]* [<family-name>|<generic-voice>]|preserve","voice-pitch":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-range":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-rate":"[normal|x-slow|slow|medium|fast|x-fast]||<percentage>","voice-stress":"normal|strong|moderate|none|reduced","voice-volume":"silent|[[x-soft|soft|medium|loud|x-loud]||<decibel>]","white-space-trim":"none|discard-before||discard-after||discard-inner"},atrules:{charset:{prelude:"<string>",descriptors:null},"counter-style":{prelude:"<counter-style-name>",descriptors:{"additive-symbols":"[<integer [0,\u221E]>&&<symbol>]#",fallback:"<counter-style-name>",negative:"<symbol> <symbol>?",pad:"<integer [0,\u221E]>&&<symbol>",prefix:"<symbol>",range:"[[<integer>|infinite]{2}]#|auto","speak-as":"auto|bullets|numbers|words|spell-out|<counter-style-name>",suffix:"<symbol>",symbols:"<symbol>+",system:"cyclic|numeric|alphabetic|symbolic|additive|[fixed <integer>?]|[extends <counter-style-name>]"}},container:{prelude:"[<container-name>]? <container-condition>",descriptors:null},document:{prelude:"[<url>|url-prefix( <string> )|domain( <string> )|media-document( <string> )|regexp( <string> )]#",descriptors:null},"font-face":{prelude:null,descriptors:{"ascent-override":"normal|<percentage>","descent-override":"normal|<percentage>","font-display":"auto|block|swap|fallback|optional","font-family":"<family-name>","font-feature-settings":"normal|<feature-tag-value>#","font-stretch":"<font-stretch-absolute>{1,2}","font-style":"normal|italic|oblique <angle>{0,2}","font-variation-settings":"normal|[<string> <number>]#","font-weight":"<font-weight-absolute>{1,2}","line-gap-override":"normal|<percentage>","size-adjust":"<percentage>",src:"[<url> [format( <string># )]?|local( <family-name> )]#","unicode-range":"<urange>#"}},"font-feature-values":{prelude:"<family-name>#",descriptors:null},"font-palette-values":{prelude:"<dashed-ident>",descriptors:{"base-palette":"light|dark|<integer [0,\u221E]>","font-family":"<family-name>#","override-colors":"[<integer [0,\u221E]> <color>]#"}},import:{prelude:"[<string>|<url>] [layer|layer( <layer-name> )]? [supports( [<supports-condition>|<declaration>] )]? <media-query-list>?",descriptors:null},keyframes:{prelude:"<keyframes-name>",descriptors:null},layer:{prelude:"[<layer-name>#|<layer-name>?]",descriptors:null},media:{prelude:"<media-query-list>",descriptors:null},namespace:{prelude:"<namespace-prefix>? [<string>|<url>]",descriptors:null},page:{prelude:"<page-selector-list>",descriptors:{bleed:"auto|<length>",marks:"none|[crop||cross]","page-orientation":"upright|rotate-left|rotate-right",size:"<length [0,\u221E]>{1,2}|auto|[<page-size>||[portrait|landscape]]"}},"position-try":{prelude:"<dashed-ident>",descriptors:{top:"<'top'>",left:"<'left'>",bottom:"<'bottom'>",right:"<'right'>","inset-block-start":"<'inset-block-start'>","inset-block-end":"<'inset-block-end'>","inset-inline-start":"<'inset-inline-start'>","inset-inline-end":"<'inset-inline-end'>","inset-block":"<'inset-block'>","inset-inline":"<'inset-inline'>",inset:"<'inset'>","margin-top":"<'margin-top'>","margin-left":"<'margin-left'>","margin-bottom":"<'margin-bottom'>","margin-right":"<'margin-right'>","margin-block-start":"<'margin-block-start'>","margin-block-end":"<'margin-block-end'>","margin-inline-start":"<'margin-inline-start'>","margin-inline-end":"<'margin-inline-end'>",margin:"<'margin'>","margin-block":"<'margin-block'>","margin-inline":"<'margin-inline'>",width:"<'width'>",height:"<'height'>","min-width":"<'min-width'>","min-height":"<'min-height'>","max-width":"<'max-width'>","max-height":"<'max-height'>","block-size":"<'block-size'>","inline-size":"<'inline-size'>","min-block-size":"<'min-block-size'>","min-inline-size":"<'min-inline-size'>","max-block-size":"<'max-block-size'>","max-inline-size":"<'max-inline-size'>","align-self":"<'align-self'>|anchor-center","justify-self":"<'justify-self'>|anchor-center"}},property:{prelude:"<custom-property-name>",descriptors:{inherits:"true|false","initial-value":"<declaration-value>?",syntax:"<string>"}},scope:{prelude:"[( <scope-start> )]? [to ( <scope-end> )]?",descriptors:null},"starting-style":{prelude:null,descriptors:null},supports:{prelude:"<supports-condition>",descriptors:null},"view-transition":{prelude:null,descriptors:{navigation:"auto|none",types:"none|<custom-ident>+"}},"font-features-values":{prelude:"[<string>|<custom-ident>]+",descriptors:{"font-display":"auto|block|swap|fallback|optional"}}}}});var mh={};Le(mh,{generate:()=>R$,name:()=>T$,parse:()=>gh,structure:()=>I$});function kd(e,t){let r=this.tokenStart+e,n=this.charCodeAt(r);for((n===ni||n===Xn)&&(t&&this.error("Number sign is not allowed"),r++);r<this.tokenEnd;r++)wr(this.charCodeAt(r))||this.error("Integer is expected",r)}function il(e){return kd.call(this,0,e)}function fa(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let r="";switch(t){case Sd:r="N is expected";break;case Xn:r="HyphenMinus is expected";break}this.error(r,this.tokenStart+e)}}function fh(){let e=0,t=0,r=this.tokenType;for(;r===13||r===25;)r=this.lookupType(++e);if(r!==10)if(this.isDelim(ni,e)||this.isDelim(Xn,e)){t=this.isDelim(ni,e)?ni:Xn;do r=this.lookupType(++e);while(r===13||r===25);r!==10&&(this.skip(e),il.call(this,Xa))}else return null;return e>0&&this.skip(e),t===0&&(r=this.charCodeAt(this.tokenStart),r!==ni&&r!==Xn&&this.error("Number sign is expected")),il.call(this,t!==0),t===Xn?"-"+this.consume(10):this.consume(10)}function gh(){let e=this.tokenStart,t=null,r=null;if(this.tokenType===10)il.call(this,E$),r=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,Xn))switch(t="-1",fa.call(this,1,Sd),this.tokenEnd-this.tokenStart){case 2:this.next(),r=fh.call(this);break;case 3:fa.call(this,2,Xn),this.next(),this.skipSC(),il.call(this,Xa),r="-"+this.consume(10);break;default:fa.call(this,2,Xn),kd.call(this,3,Xa),this.next(),r=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(ni)&&this.lookupType(1)===1){let n=0;switch(t="1",this.isDelim(ni)&&(n=1,this.next()),fa.call(this,0,Sd),this.tokenEnd-this.tokenStart){case 1:this.next(),r=fh.call(this);break;case 2:fa.call(this,1,Xn),this.next(),this.skipSC(),il.call(this,Xa),r="-"+this.consume(10);break;default:fa.call(this,1,Xn),kd.call(this,2,Xa),this.next(),r=this.substrToCursor(e+n+1)}}else if(this.tokenType===12){let n=this.charCodeAt(this.tokenStart),o=n===ni||n===Xn,i=this.tokenStart+o;for(;i<this.tokenEnd&&wr(this.charCodeAt(i));i++);i===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),fa.call(this,i-this.tokenStart,Sd),t=this.substring(e,i),i+1===this.tokenEnd?(this.next(),r=fh.call(this)):(fa.call(this,i-this.tokenStart+1,Xn),i+2===this.tokenEnd?(this.next(),this.skipSC(),il.call(this,Xa),r="-"+this.consume(10)):(kd.call(this,i-this.tokenStart+2,Xa),this.next(),r=this.substrToCursor(i+1)))}else this.error();return t!==null&&t.charCodeAt(0)===ni&&(t=t.substr(1)),r!==null&&r.charCodeAt(0)===ni&&(r=r.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:r}}function R$(e){if(e.a){let t=e.a==="+1"&&"n"||e.a==="1"&&"n"||e.a==="-1"&&"-n"||e.a+"n";if(e.b){let r=e.b[0]==="-"||e.b[0]==="+"?e.b:"+"+e.b;this.tokenize(t+r)}else this.tokenize(t)}else this.tokenize(e.b)}var ni,Xn,Sd,Xa,E$,T$,I$,hh=H(()=>{"use strict";so();ni=43,Xn=45,Sd=110,Xa=!0,E$=!1;T$="AnPlusB",I$={a:[String,null],b:[String,null]}});var yh={};Le(yh,{generate:()=>L$,name:()=>F$,parse:()=>xh,structure:()=>P$,walkContext:()=>M$});function I4(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function A$(){for(let e=1,t;t=this.lookupType(e);e++){if(t===24)return!0;if(t===23||t===3)return!1}return!1}function xh(e=!1){let t=this.tokenStart,r,n,o=null,i=null;switch(this.eat(3),r=this.substrToCursor(t+1),n=r.toLowerCase(),this.skipSC(),this.eof===!1&&this.tokenType!==23&&this.tokenType!==17&&(this.parseAtrulePrelude?o=this.parseWithFallback(this.AtrulePrelude.bind(this,r,e),I4):o=I4.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case 17:this.next();break;case 23:hasOwnProperty.call(this.atrule,n)&&typeof this.atrule[n].block=="function"?i=this.atrule[n].block.call(this,e):i=this.Block(A$.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:r,prelude:o,block:i}}function L$(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}var F$,M$,P$,bh=H(()=>{"use strict";F$="Atrule",M$="atrule",P$={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]}});var vh={};Le(vh,{generate:()=>D$,name:()=>_$,parse:()=>wh,structure:()=>z$,walkContext:()=>B$});function wh(e){let t=null;return e!==null&&(e=e.toLowerCase()),this.skipSC(),hasOwnProperty.call(this.atrule,e)&&typeof this.atrule[e].prelude=="function"?t=this.atrule[e].prelude.call(this):t=this.readSequence(this.scope.AtrulePrelude),this.skipSC(),this.eof!==!0&&this.tokenType!==23&&this.tokenType!==17&&this.error("Semicolon or block is expected"),{type:"AtrulePrelude",loc:this.getLocationFromList(t),children:t}}function D$(e){this.children(e)}var _$,B$,z$,Sh=H(()=>{"use strict";_$="AtrulePrelude",B$="atrulePrelude",z$={children:[[]]}});var Eh={};Le(Eh,{generate:()=>W$,name:()=>j$,parse:()=>Ch,structure:()=>V$});function H$(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(R4)?(t=!0,this.next()):this.isDelim(kh)||this.eat(1),this.isDelim(kh)?this.charCodeAt(this.tokenStart+1)!==Cd?(this.next(),this.eat(1)):t&&this.error("Identifier is expected",this.tokenEnd):t&&this.error("Vertical line is expected"),{type:"Identifier",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function U$(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==Cd&&t!==$$&&t!==O$&&t!==N$&&t!==R4&&t!==kh&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==Cd&&(this.isDelim(Cd)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}function Ch(){let e=this.tokenStart,t,r=null,n=null,o=null;return this.eat(19),this.skipSC(),t=H$.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(r=U$.call(this),this.skipSC(),n=this.tokenType===5?this.String():this.Identifier(),this.skipSC()),this.tokenType===1&&(o=this.consume(1),this.skipSC())),this.eat(20),{type:"AttributeSelector",loc:this.getLocation(e,this.tokenStart),name:t,matcher:r,value:n,flags:o}}function W$(e){this.token(9,"["),this.node(e.name),e.matcher!==null&&(this.tokenize(e.matcher),this.node(e.value)),e.flags!==null&&this.token(1,e.flags),this.token(9,"]")}var N$,R4,Cd,O$,kh,$$,j$,V$,Th=H(()=>{"use strict";N$=36,R4=42,Cd=61,O$=94,kh=124,$$=126;j$="AttributeSelector",V$={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]}});var Rh={};Le(Rh,{generate:()=>J$,name:()=>Y$,parse:()=>Ih,structure:()=>X$,walkContext:()=>K$});function M4(){return this.Raw(null,!0)}function A4(){return this.parseWithFallback(this.Rule,M4)}function F4(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function q$(){if(this.tokenType===17)return F4.call(this,this.tokenIndex);let e=this.parseWithFallback(this.Declaration,F4);return this.tokenType===17&&this.next(),e}function Ih(e){let t=e?q$:A4,r=this.tokenStart,n=this.createList();this.eat(23);e:for(;!this.eof;)switch(this.tokenType){case 24:break e;case 13:case 25:this.next();break;case 3:n.push(this.parseWithFallback(this.Atrule.bind(this,e),M4));break;default:e&&this.isDelim(G$)?n.push(A4.call(this)):n.push(t.call(this))}return this.eof||this.eat(24),{type:"Block",loc:this.getLocation(r,this.tokenStart),children:n}}function J$(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}var G$,Y$,K$,X$,Ah=H(()=>{"use strict";G$=38;Y$="Block",K$="block",X$={children:[["Atrule","Rule","Declaration"]]}});var Mh={};Le(Mh,{generate:()=>eH,name:()=>Q$,parse:()=>Fh,structure:()=>Z$});function Fh(e,t){let r=this.tokenStart,n=null;return this.eat(19),n=e.call(this,t),this.eof||this.eat(20),{type:"Brackets",loc:this.getLocation(r,this.tokenStart),children:n}}function eH(e){this.token(9,"["),this.children(e),this.token(9,"]")}var Q$,Z$,Ph=H(()=>{"use strict";Q$="Brackets",Z$={children:[[]]}});var _h={};Le(_h,{generate:()=>nH,name:()=>tH,parse:()=>Lh,structure:()=>rH});function Lh(){let e=this.tokenStart;return this.eat(15),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function nH(){this.token(15,"-->")}var tH,rH,Bh=H(()=>{"use strict";tH="CDC",rH=[]});var Dh={};Le(Dh,{generate:()=>aH,name:()=>oH,parse:()=>zh,structure:()=>iH});function zh(){let e=this.tokenStart;return this.eat(14),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function aH(){this.token(14,"<!--")}var oH,iH,Nh=H(()=>{"use strict";oH="CDO",iH=[]});var $h={};Le($h,{generate:()=>uH,name:()=>lH,parse:()=>Oh,structure:()=>cH});function Oh(){return this.eatDelim(sH),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function uH(e){this.token(9,"."),this.token(1,e.name)}var sH,lH,cH,Hh=H(()=>{"use strict";sH=46,lH="ClassSelector",cH={name:String}});var jh={};Le(jh,{generate:()=>hH,name:()=>gH,parse:()=>Uh,structure:()=>mH});function Uh(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case dH:case pH:case fH:this.next();break;case P4:this.next(),this.eatIdent("deep"),this.eatDelim(P4);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function hH(e){this.tokenize(e.name)}var pH,P4,dH,fH,gH,mH,Vh=H(()=>{"use strict";pH=43,P4=47,dH=62,fH=126,gH="Combinator",mH={name:String}});var Gh={};Le(Gh,{generate:()=>vH,name:()=>bH,parse:()=>Wh,structure:()=>wH});function Wh(){let e=this.tokenStart,t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===xH&&this.charCodeAt(t-1)===yH&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function vH(e){this.token(25,"/*"+e.value+"*/")}var xH,yH,bH,wH,qh=H(()=>{"use strict";xH=42,yH=47,bH="Comment",wH={value:String}});var Kh={};Le(Kh,{generate:()=>TH,name:()=>kH,parse:()=>Yh,structure:()=>CH});function L4(e){return this.lookupTypeNonSC(1)===1&&SH.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}function Yh(e="media"){let t=this.createList();e:for(;!this.eof;)switch(this.tokenType){case 25:case 13:this.next();continue;case 1:t.push(this.Identifier());break;case 21:{let r=this.parseWithFallback(()=>EH[e].call(this,e),()=>null);r||(r=this.parseWithFallback(()=>{this.eat(21);let n=this.Condition(e);return this.eat(22),n},()=>this.GeneralEnclosed(e))),t.push(r);break}case 2:{let r=this.parseWithFallback(()=>this.FeatureFunction(e),()=>null);r||(r=this.GeneralEnclosed(e)),t.push(r);break}default:break e}return t.isEmpty&&this.error("Condition is expected"),{type:"Condition",loc:this.getLocationFromList(t),kind:e,children:t}}function TH(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(21,"("),this.node(t),this.token(22,")")):this.node(t)})}var SH,kH,CH,EH,Xh=H(()=>{"use strict";SH=new Set([16,22,0]),kH="Condition",CH={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};EH={media:L4,container:L4,supports(){return this.SupportsDeclaration()}}});var Qh={};Le(Qh,{generate:()=>NH,name:()=>BH,parse:()=>Jh,structure:()=>DH,walkContext:()=>zH});function PH(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function LH(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function _H(){let e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==17&&this.isDelim(B4)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}function Jh(){let e=this.tokenStart,t=this.tokenIndex,r=OH.call(this),n=ud(r),o=n?this.parseCustomProperty:this.parseValue,i=n?LH:PH,a=!1,s;this.skipSC(),this.eat(16);let l=this.tokenIndex;if(n||this.skipSC(),o?s=this.parseWithFallback(_H,i):s=i.call(this,this.tokenIndex),n&&s.type==="Value"&&s.children.isEmpty){for(let u=l-this.tokenIndex;u<=0;u++)if(this.lookupType(u)===13){s.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}return this.isDelim(B4)&&(a=$H.call(this),this.skipSC()),this.eof===!1&&this.tokenType!==17&&this.isBalanceEdge(t)===!1&&this.error(),{type:"Declaration",loc:this.getLocation(e,this.tokenStart),important:a,property:r,value:s}}function NH(e){this.token(1,e.property),this.token(16,":"),this.node(e.value),e.important&&(this.token(9,"!"),this.token(1,e.important===!0?"important":e.important))}function OH(){let e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case FH:case RH:case MH:case IH:case AH:this.next();break;case _4:this.next(),this.isDelim(_4)&&this.next();break}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function $H(){this.eat(9),this.skipSC();let e=this.consume(1);return e==="important"?!0:e}var B4,IH,RH,AH,FH,MH,_4,BH,zH,DH,Zh=H(()=>{"use strict";pd();B4=33,IH=35,RH=36,AH=38,FH=42,MH=43,_4=47;BH="Declaration",zH="declaration",DH={important:[Boolean,String],property:String,value:["Value","Raw"]}});var r1={};Le(r1,{generate:()=>VH,name:()=>UH,parse:()=>t1,structure:()=>jH});function e1(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function t1(){let e=this.createList();for(;!this.eof;)switch(this.tokenType){case 13:case 25:case 17:this.next();break;case 3:e.push(this.parseWithFallback(this.Atrule.bind(this,!0),e1));break;default:this.isDelim(HH)?e.push(this.parseWithFallback(this.Rule,e1)):e.push(this.parseWithFallback(this.Declaration,e1))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function VH(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}var HH,UH,jH,n1=H(()=>{"use strict";HH=38;UH="DeclarationList",jH={children:[["Declaration","Atrule","Rule"]]}});var i1={};Le(i1,{generate:()=>qH,name:()=>WH,parse:()=>o1,structure:()=>GH});function o1(){let e=this.tokenStart,t=this.consumeNumber(12);return{type:"Dimension",loc:this.getLocation(e,this.tokenStart),value:t,unit:this.substring(e+t.length,this.tokenStart)}}function qH(e){this.token(12,e.value+e.unit)}var WH,GH,a1=H(()=>{"use strict";WH="Dimension",GH={value:String,unit:String}});var l1={};Le(l1,{generate:()=>JH,name:()=>KH,parse:()=>s1,structure:()=>XH});function s1(e){let t=this.tokenStart,r,n=null;if(this.eat(21),this.skipSC(),r=this.consume(1),this.skipSC(),this.tokenType!==22){switch(this.eat(16),this.skipSC(),this.tokenType){case 10:this.lookupNonWSType(1)===9?n=this.Ratio():n=this.Number();break;case 12:n=this.Dimension();break;case 1:n=this.Identifier();break;case 2:n=this.parseWithFallback(()=>{let o=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(YH)&&this.error(),o},()=>this.Ratio());break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eof||this.eat(22),{type:"Feature",loc:this.getLocation(t,this.tokenStart),kind:e,name:r,value:n}}function JH(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}var YH,KH,XH,c1=H(()=>{"use strict";YH=47,KH="Feature",XH={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]}});var p1={};Le(p1,{generate:()=>tU,name:()=>QH,parse:()=>u1,structure:()=>ZH});function eU(e,t){let n=(this.features[e]||{})[t];return typeof n!="function"&&this.error(`Unknown feature ${t}()`),n}function u1(e="unknown"){let t=this.tokenStart,r=this.consumeFunctionName(),n=eU.call(this,e,r.toLowerCase());this.skipSC();let o=this.parseWithFallback(()=>{let i=this.tokenIndex,a=n.call(this);return this.eof===!1&&this.isBalanceEdge(i)===!1&&this.error(),a},()=>this.Raw(null,!1));return this.eof||this.eat(22),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:r,value:o}}function tU(e){this.token(2,e.feature+"("),this.node(e.value),this.token(22,")")}var QH,ZH,d1=H(()=>{"use strict";QH="FeatureFunction",ZH={kind:String,feature:String,value:["Declaration","Selector"]}});var m1={};Le(m1,{generate:()=>aU,name:()=>oU,parse:()=>g1,structure:()=>iU});function f1(){switch(this.skipSC(),this.tokenType){case 10:return this.isDelim(z4,this.lookupOffsetNonSC(1))?this.Ratio():this.Number();case 12:return this.Dimension();case 1:return this.Identifier();case 2:return this.parseWithFallback(()=>{let e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(z4)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function N4(e){if(this.skipSC(),this.isDelim(rU)||this.isDelim(nU)){let t=this.source[this.tokenStart];return this.next(),this.isDelim(D4)?(this.next(),t+"="):t}if(this.isDelim(D4))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function g1(e="unknown"){let t=this.tokenStart;this.skipSC(),this.eat(21);let r=f1.call(this),n=N4.call(this,r.type==="Identifier"),o=f1.call(this),i=null,a=null;return this.lookupNonWSType(0)!==22&&(i=N4.call(this),a=f1.call(this)),this.skipSC(),this.eat(22),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:r,leftComparison:n,middle:o,rightComparison:i,right:a}}function aU(e){this.token(21,"("),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(22,")")}var z4,rU,D4,nU,oU,iU,h1=H(()=>{"use strict";z4=47,rU=60,D4=61,nU=62,oU="FeatureRange",iU={kind:String,left:["Identifier","Number","Dimension","Ratio","Function"],leftComparison:String,middle:["Identifier","Number","Dimension","Ratio","Function"],rightComparison:[String,null],right:["Identifier","Number","Dimension","Ratio","Function",null]}});var y1={};Le(y1,{generate:()=>uU,name:()=>sU,parse:()=>x1,structure:()=>cU,walkContext:()=>lU});function x1(e,t){let r=this.tokenStart,n=this.consumeFunctionName(),o=n.toLowerCase(),i;return i=t.hasOwnProperty(o)?t[o].call(this,t):e.call(this,t),this.eof||this.eat(22),{type:"Function",loc:this.getLocation(r,this.tokenStart),name:n,children:i}}function uU(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}var sU,lU,cU,b1=H(()=>{"use strict";sU="Function",lU="function",cU={name:String,children:[[]]}});var v1={};Le(v1,{generate:()=>fU,name:()=>pU,parse:()=>w1,structure:()=>dU});function w1(e){let t=this.tokenStart,r=null;this.tokenType===2?r=this.consumeFunctionName():this.eat(21);let n=this.parseWithFallback(()=>{let o=this.tokenIndex,i=this.readSequence(this.scope.Value);return this.eof===!1&&this.isBalanceEdge(o)===!1&&this.error(),i},()=>this.createSingleNodeList(this.Raw(null,!1)));return this.eof||this.eat(22),{type:"GeneralEnclosed",loc:this.getLocation(t,this.tokenStart),kind:e,function:r,children:n}}function fU(e){e.function?this.token(2,e.function+"("):this.token(21,"("),this.children(e),this.token(22,")")}var pU,dU,S1=H(()=>{"use strict";pU="GeneralEnclosed",dU={kind:String,function:[String,null],children:[[]]}});var C1={};Le(C1,{generate:()=>xU,name:()=>mU,parse:()=>k1,structure:()=>hU,xxx:()=>gU});function k1(){let e=this.tokenStart;return this.eat(4),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function xU(e){this.token(4,"#"+e.value)}var gU,mU,hU,E1=H(()=>{"use strict";gU="XXX",mU="Hash",hU={value:String}});var I1={};Le(I1,{generate:()=>wU,name:()=>yU,parse:()=>T1,structure:()=>bU});function T1(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function wU(e){this.token(1,e.name)}var yU,bU,R1=H(()=>{"use strict";yU="Identifier",bU={name:String}});var F1={};Le(F1,{generate:()=>kU,name:()=>vU,parse:()=>A1,structure:()=>SU});function A1(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function kU(e){this.token(9,"#"+e.name)}var vU,SU,M1=H(()=>{"use strict";vU="IdSelector",SU={name:String}});var L1={};Le(L1,{generate:()=>IU,name:()=>EU,parse:()=>P1,structure:()=>TU});function P1(){let e=this.tokenStart,t=this.consume(1);for(;this.isDelim(CU);)this.eat(9),t+="."+this.consume(1);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function IU(e){this.tokenize(e.name)}var CU,EU,TU,_1=H(()=>{"use strict";CU=46,EU="Layer",TU={name:String}});var z1={};Le(z1,{generate:()=>FU,name:()=>RU,parse:()=>B1,structure:()=>AU});function B1(){let e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.Layer()),this.lookupTypeNonSC(0)===18);)this.skipSC(),this.next(),this.skipSC();return{type:"LayerList",loc:this.getLocationFromList(e),children:e}}function FU(e){this.children(e,()=>this.token(18,","))}var RU,AU,D1=H(()=>{"use strict";RU="LayerList",AU={children:[["Layer"]]}});var O1={};Le(O1,{generate:()=>LU,name:()=>MU,parse:()=>N1,structure:()=>PU});function N1(){let e=this.tokenStart,t=null,r=null,n=null;if(this.skipSC(),this.tokenType===1&&this.lookupTypeNonSC(1)!==21){let o=this.consume(1),i=o.toLowerCase();switch(i==="not"||i==="only"?(this.skipSC(),t=i,r=this.consume(1)):r=o,this.lookupTypeNonSC(0)){case 1:{this.skipSC(),this.eatIdent("and"),n=this.Condition("media");break}case 23:case 17:case 18:case 0:break;default:this.error("Identifier or parenthesis is expected")}}else switch(this.tokenType){case 1:case 21:case 2:{n=this.Condition("media");break}case 23:case 17:case 0:break;default:this.error("Identifier or parenthesis is expected")}return{type:"MediaQuery",loc:this.getLocation(e,this.tokenStart),modifier:t,mediaType:r,condition:n}}function LU(e){e.mediaType?(e.modifier&&this.token(1,e.modifier),this.token(1,e.mediaType),e.condition&&(this.token(1,"and"),this.node(e.condition))):e.condition&&this.node(e.condition)}var MU,PU,$1=H(()=>{"use strict";MU="MediaQuery",PU={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]}});var U1={};Le(U1,{generate:()=>zU,name:()=>_U,parse:()=>H1,structure:()=>BU});function H1(){let e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.MediaQuery()),this.tokenType===18);)this.next();return{type:"MediaQueryList",loc:this.getLocationFromList(e),children:e}}function zU(e){this.children(e,()=>this.token(18,","))}var _U,BU,j1=H(()=>{"use strict";_U="MediaQueryList",BU={children:[["MediaQuery"]]}});var W1={};Le(W1,{generate:()=>$U,name:()=>NU,parse:()=>V1,structure:()=>OU});function V1(){let e=this.tokenStart;return this.eatDelim(DU),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function $U(){this.token(9,"&")}var DU,NU,OU,G1=H(()=>{"use strict";DU=38,NU="NestingSelector",OU={}});var Y1={};Le(Y1,{generate:()=>jU,name:()=>HU,parse:()=>q1,structure:()=>UU});function q1(){this.skipSC();let e=this.tokenStart,t=e,r=null,n;return this.lookupValue(0,"odd")||this.lookupValue(0,"even")?n=this.Identifier():n=this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),r=this.SelectorList(),t=this.tokenStart),{type:"Nth",loc:this.getLocation(e,t),nth:n,selector:r}}function jU(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}var HU,UU,K1=H(()=>{"use strict";HU="Nth",UU={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]}});var J1={};Le(J1,{generate:()=>GU,name:()=>VU,parse:()=>X1,structure:()=>WU});function X1(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function GU(e){this.token(10,e.value)}var VU,WU,Q1=H(()=>{"use strict";VU="Number",WU={value:String}});var ex={};Le(ex,{generate:()=>KU,name:()=>qU,parse:()=>Z1,structure:()=>YU});function Z1(){let e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function KU(e){this.tokenize(e.value)}var qU,YU,tx=H(()=>{"use strict";qU="Operator",YU={value:String}});var nx={};Le(nx,{generate:()=>QU,name:()=>XU,parse:()=>rx,structure:()=>JU});function rx(e,t){let r=this.tokenStart,n=null;return this.eat(21),n=e.call(this,t),this.eof||this.eat(22),{type:"Parentheses",loc:this.getLocation(r,this.tokenStart),children:n}}function QU(e){this.token(21,"("),this.children(e),this.token(22,")")}var XU,JU,ox=H(()=>{"use strict";XU="Parentheses",JU={children:[[]]}});var ax={};Le(ax,{generate:()=>tj,name:()=>ZU,parse:()=>ix,structure:()=>ej});function ix(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function tj(e){this.token(11,e.value+"%")}var ZU,ej,sx=H(()=>{"use strict";ZU="Percentage",ej={value:String}});var cx={};Le(cx,{generate:()=>ij,name:()=>rj,parse:()=>lx,structure:()=>oj,walkContext:()=>nj});function lx(){let e=this.tokenStart,t=null,r,n;return this.eat(16),this.tokenType===2?(r=this.consumeFunctionName(),n=r.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,n)?(this.skipSC(),t=this.pseudo[n].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):r=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:r,children:t}}function ij(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var rj,nj,oj,ux=H(()=>{"use strict";rj="PseudoClassSelector",nj="function",oj={name:String,children:[["Raw"],null]}});var dx={};Le(dx,{generate:()=>cj,name:()=>aj,parse:()=>px,structure:()=>lj,walkContext:()=>sj});function px(){let e=this.tokenStart,t=null,r,n;return this.eat(16),this.eat(16),this.tokenType===2?(r=this.consumeFunctionName(),n=r.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,n)?(this.skipSC(),t=this.pseudo[n].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):r=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:r,children:t}}function cj(e){this.token(16,":"),this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var aj,sj,lj,fx=H(()=>{"use strict";aj="PseudoElementSelector",sj="function",lj={name:String,children:[["Raw"],null]}});var mx={};Le(mx,{generate:()=>dj,name:()=>uj,parse:()=>gx,structure:()=>pj});function $4(){switch(this.skipSC(),this.tokenType){case 10:return this.Number();case 2:return this.Function(this.readSequence,this.scope.Value);default:this.error("Number of function is expected")}}function gx(){let e=this.tokenStart,t=$4.call(this),r=null;return this.skipSC(),this.isDelim(O4)&&(this.eatDelim(O4),r=$4.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:r}}function dj(e){this.node(e.left),this.token(9,"/"),e.right?this.node(e.right):this.node(10,1)}var O4,uj,pj,hx=H(()=>{"use strict";O4=47;uj="Ratio",pj={left:["Number","Function"],right:["Number","Function",null]}});var yx={};Le(yx,{generate:()=>hj,name:()=>gj,parse:()=>xx,structure:()=>mj});function fj(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function xx(e,t){let r=this.getTokenStart(this.tokenIndex),n;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>r?n=fj.call(this):n=this.tokenStart,{type:"Raw",loc:this.getLocation(r,n),value:this.substring(r,n)}}function hj(e){this.tokenize(e.value)}var gj,mj,bx=H(()=>{"use strict";gj="Raw",mj={value:String}});var vx={};Le(vx,{generate:()=>vj,name:()=>yj,parse:()=>wx,structure:()=>wj,walkContext:()=>bj});function H4(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function xj(){let e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==23&&this.error(),e}function wx(){let e=this.tokenIndex,t=this.tokenStart,r,n;return this.parseRulePrelude?r=this.parseWithFallback(xj,H4):r=H4.call(this,e),n=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:r,block:n}}function vj(e){this.node(e.prelude),this.node(e.block)}var yj,bj,wj,Sx=H(()=>{"use strict";yj="Rule",bj="rule",wj={prelude:["SelectorList","Raw"],block:["Block"]}});var Cx={};Le(Cx,{generate:()=>Cj,name:()=>Sj,parse:()=>kx,structure:()=>kj});function kx(){let e=null,t=null;this.skipSC();let r=this.tokenStart;return this.tokenType===21&&(this.next(),this.skipSC(),e=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(22)),this.lookupNonWSType(0)===1&&(this.skipSC(),this.eatIdent("to"),this.skipSC(),this.eat(21),this.skipSC(),t=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(22)),{type:"Scope",loc:this.getLocation(r,this.tokenStart),root:e,limit:t}}function Cj(e){e.root&&(this.token(21,"("),this.node(e.root),this.token(22,")")),e.limit&&(this.token(1,"to"),this.token(21,"("),this.node(e.limit),this.token(22,")"))}var Sj,kj,Ex=H(()=>{"use strict";Sj="Scope",kj={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]}});var Ix={};Le(Ix,{generate:()=>Ij,name:()=>Ej,parse:()=>Tx,structure:()=>Tj});function Tx(){let e=this.readSequence(this.scope.Selector);return this.getFirstListNode(e)===null&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(e),children:e}}function Ij(e){this.children(e)}var Ej,Tj,Rx=H(()=>{"use strict";Ej="Selector",Tj={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]}});var Fx={};Le(Fx,{generate:()=>Mj,name:()=>Rj,parse:()=>Ax,structure:()=>Fj,walkContext:()=>Aj});function Ax(){let e=this.createList();for(;!this.eof;){if(e.push(this.Selector()),this.tokenType===18){this.next();continue}break}return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function Mj(e){this.children(e,()=>this.token(18,","))}var Rj,Aj,Fj,Mx=H(()=>{"use strict";Rj="SelectorList",Aj="selector",Fj={children:[["Selector","Raw"]]}});function Ed(e){let t=e.length,r=e.charCodeAt(0),n=r===U4||r===j4?1:0,o=n===1&&t>1&&e.charCodeAt(t-1)===r?t-2:t-1,i="";for(let a=n;a<=o;a++){let s=e.charCodeAt(a);if(s===Px){if(a===o){a!==t-1&&(i=e.substr(a+1));break}if(s=e.charCodeAt(++a),An(Px,s)){let l=a-1,u=Li(e,l);a=u-1,i+=Yp(e.substring(l+1,u))}else s===13&&e.charCodeAt(a+1)===10&&a++}else i+=e[a]}return i}function V4(e,t){let r=t?"'":'"',n=t?j4:U4,o="",i=!1;for(let a=0;a<e.length;a++){let s=e.charCodeAt(a);if(s===0){o+="\uFFFD";continue}if(s<=31||s===127){o+="\\"+s.toString(16),i=!0;continue}s===n||s===Px?(o+="\\"+e.charAt(a),i=!1):(i&&(Fn(s)||ti(s))&&(o+=" "),o+=e.charAt(a),i=!1)}return r+o+r}var Px,U4,j4,Td=H(()=>{"use strict";so();Px=92,U4=34,j4=39});var _x={};Le(_x,{generate:()=>_j,name:()=>Pj,parse:()=>Lx,structure:()=>Lj});function Lx(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:Ed(this.consume(5))}}function _j(e){this.token(5,V4(e.value))}var Pj,Lj,Bx=H(()=>{"use strict";Td();Pj="String",Lj={value:String}});var Dx={};Le(Dx,{generate:()=>Oj,name:()=>zj,parse:()=>zx,structure:()=>Nj,walkContext:()=>Dj});function G4(){return this.Raw(null,!1)}function zx(){let e=this.tokenStart,t=this.createList(),r;for(;!this.eof;){switch(this.tokenType){case 13:this.next();continue;case 25:if(this.charCodeAt(this.tokenStart+2)!==Bj){this.next();continue}r=this.Comment();break;case 14:r=this.CDO();break;case 15:r=this.CDC();break;case 3:r=this.parseWithFallback(this.Atrule,G4);break;default:r=this.parseWithFallback(this.Rule,G4)}t.push(r)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function Oj(e){this.children(e)}var Bj,zj,Dj,Nj,Nx=H(()=>{"use strict";Bj=33;zj="StyleSheet",Dj="stylesheet",Nj={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]}});var $x={};Le($x,{generate:()=>Uj,name:()=>$j,parse:()=>Ox,structure:()=>Hj});function Ox(){let e=this.tokenStart;this.eat(21),this.skipSC();let t=this.Declaration();return this.eof||this.eat(22),{type:"SupportsDeclaration",loc:this.getLocation(e,this.tokenStart),declaration:t}}function Uj(e){this.token(21,"("),this.node(e.declaration),this.token(22,")")}var $j,Hj,Hx=H(()=>{"use strict";$j="SupportsDeclaration",Hj={declaration:"Declaration"}});var Vx={};Le(Vx,{generate:()=>Gj,name:()=>Vj,parse:()=>jx,structure:()=>Wj});function Ux(){this.tokenType!==1&&this.isDelim(jj)===!1&&this.error("Identifier or asterisk is expected"),this.next()}function jx(){let e=this.tokenStart;return this.isDelim(q4)?(this.next(),Ux.call(this)):(Ux.call(this),this.isDelim(q4)&&(this.next(),Ux.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function Gj(e){this.tokenize(e.name)}var jj,q4,Vj,Wj,Wx=H(()=>{"use strict";jj=42,q4=124;Vj="TypeSelector",Wj={name:String}});var Yx={};Le(Yx,{generate:()=>Jj,name:()=>Kj,parse:()=>qx,structure:()=>Xj});function Dc(e,t){let r=0;for(let n=this.tokenStart+e;n<this.tokenEnd;n++){let o=this.charCodeAt(n);if(o===K4&&t&&r!==0)return Dc.call(this,e+r+1,!1),-1;Fn(o)||this.error(t&&r!==0?"Hyphen minus"+(r<6?" or hex digit":"")+" is expected":r<6?"Hex digit is expected":"Unexpected input",n),++r>6&&this.error("Too many hex digits",n)}return this.next(),r}function Id(e){let t=0;for(;this.isDelim(Gx);)++t>e&&this.error("Too many question marks"),this.next()}function qj(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===Y4?"Plus sign":"Hyphen minus")+" is expected")}function Yj(){let e=0;switch(this.tokenType){case 10:if(e=Dc.call(this,1,!0),this.isDelim(Gx)){Id.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){qj.call(this,K4),Dc.call(this,1,!1);break}break;case 12:e=Dc.call(this,1,!0),e>0&&Id.call(this,6-e);break;default:if(this.eatDelim(Y4),this.tokenType===1){e=Dc.call(this,0,!0),e>0&&Id.call(this,6-e);break}if(this.isDelim(Gx)){this.next(),Id.call(this,5);break}this.error("Hex digit or question mark is expected")}}function qx(){let e=this.tokenStart;return this.eatIdent("u"),Yj.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Jj(e){this.tokenize(e.value)}var Y4,K4,Gx,Kj,Xj,Kx=H(()=>{"use strict";so();Y4=43,K4=45,Gx=63;Kj="UnicodeRange",Xj={value:String}});function J4(e){let t=e.length,r=4,n=e.charCodeAt(t-1)===X4?t-2:t-1,o="";for(;r<n&&ti(e.charCodeAt(r));)r++;for(;r<n&&ti(e.charCodeAt(n));)n--;for(let i=r;i<=n;i++){let a=e.charCodeAt(i);if(a===Xx){if(i===n){i!==t-1&&(o=e.substr(i+1));break}if(a=e.charCodeAt(++i),An(Xx,a)){let s=i-1,l=Li(e,s);i=l-1,o+=Yp(e.substring(s+1,l))}else a===13&&e.charCodeAt(i+1)===10&&i++}else o+=e[i]}return o}function Q4(e){let t="",r=!1;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o===0){t+="\uFFFD";continue}if(o<=31||o===127){t+="\\"+o.toString(16),r=!0;continue}o===Qj||o===Xx||o===Zj||o===eV||o===tV||o===X4?(t+="\\"+e.charAt(n),r=!1):(r&&Fn(o)&&(t+=" "),t+=e.charAt(n),r=!1)}return"url("+t+")"}var Qj,Xx,Zj,eV,tV,X4,Jx=H(()=>{"use strict";so();Qj=32,Xx=92,Zj=34,eV=39,tV=40,X4=41});var Zx={};Le(Zx,{generate:()=>oV,name:()=>rV,parse:()=>Qx,structure:()=>nV});function Qx(){let e=this.tokenStart,t;switch(this.tokenType){case 7:t=J4(this.consume(7));break;case 2:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(2),this.skipSC(),t=Ed(this.consume(5)),this.skipSC(),this.eof||this.eat(22);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(e,this.tokenStart),value:t}}function oV(e){this.token(7,Q4(e.value))}var rV,nV,ey=H(()=>{"use strict";Jx();Td();rV="Url",nV={value:String}});var ry={};Le(ry,{generate:()=>sV,name:()=>iV,parse:()=>ty,structure:()=>aV});function ty(){let e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function sV(e){this.children(e)}var iV,aV,ny=H(()=>{"use strict";iV="Value",aV={children:[[]]}});var iy={};Le(iy,{generate:()=>pV,name:()=>cV,parse:()=>oy,structure:()=>uV});function oy(){return this.eat(13),lV}function pV(e){this.token(13,e.value)}var lV,cV,uV,ay=H(()=>{"use strict";lV=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),cV="WhiteSpace",uV={value:String}});var Nc={};Le(Nc,{AnPlusB:()=>mh,Atrule:()=>yh,AtrulePrelude:()=>vh,AttributeSelector:()=>Eh,Block:()=>Rh,Brackets:()=>Mh,CDC:()=>_h,CDO:()=>Dh,ClassSelector:()=>$h,Combinator:()=>jh,Comment:()=>Gh,Condition:()=>Kh,Declaration:()=>Qh,DeclarationList:()=>r1,Dimension:()=>i1,Feature:()=>l1,FeatureFunction:()=>p1,FeatureRange:()=>m1,Function:()=>y1,GeneralEnclosed:()=>v1,Hash:()=>C1,IdSelector:()=>F1,Identifier:()=>I1,Layer:()=>L1,LayerList:()=>z1,MediaQuery:()=>O1,MediaQueryList:()=>U1,NestingSelector:()=>W1,Nth:()=>Y1,Number:()=>J1,Operator:()=>ex,Parentheses:()=>nx,Percentage:()=>ax,PseudoClassSelector:()=>cx,PseudoElementSelector:()=>dx,Ratio:()=>mx,Raw:()=>yx,Rule:()=>vx,Scope:()=>Cx,Selector:()=>Ix,SelectorList:()=>Fx,String:()=>_x,StyleSheet:()=>Dx,SupportsDeclaration:()=>$x,TypeSelector:()=>Vx,UnicodeRange:()=>Yx,Url:()=>Zx,Value:()=>ry,WhiteSpace:()=>iy});var sy=H(()=>{"use strict";hh();bh();Sh();Th();Ah();Ph();Bh();Nh();Hh();Vh();qh();Xh();Zh();n1();a1();c1();d1();h1();b1();S1();E1();R1();M1();_1();D1();$1();j1();G1();K1();Q1();tx();ox();sx();ux();fx();hx();bx();Sx();Ex();Rx();Mx();Bx();Nx();Hx();Wx();Kx();ey();ny();ay()});var eE,tE=H(()=>{"use strict";dd();T4();sy();eE={generic:!0,cssWideKeywords:el,...E4,node:Nc}});function Oc(e){switch(this.tokenType){case 4:return this.Hash();case 18:return this.Operator();case 21:return this.Parentheses(this.readSequence,e.recognizer);case 19:return this.Brackets(this.readSequence,e.recognizer);case 5:return this.String();case 12:return this.Dimension();case 11:return this.Percentage();case 10:return this.Number();case 2:return this.cmpStr(this.tokenStart,this.tokenEnd,"url(")?this.Url():this.Function(this.readSequence,e.recognizer);case 7:return this.Url();case 1:return this.cmpChar(this.tokenStart,hV)&&this.cmpChar(this.tokenStart+1,rE)?this.UnicodeRange():this.Identifier();case 9:{let t=this.charCodeAt(this.tokenStart);if(t===mV||t===fV||t===rE||t===gV)return this.Operator();t===dV&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}var dV,fV,rE,gV,mV,hV,ly=H(()=>{"use strict";dV=35,fV=42,rE=43,gV=45,mV=47,hV=117});var nE,oE=H(()=>{"use strict";ly();nE={getNode:Oc}});function EV(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function TV(){switch(this.tokenType){case 19:return this.AttributeSelector();case 4:return this.IdSelector();case 16:return this.lookupType(1)===16?this.PseudoElementSelector():this.PseudoClassSelector();case 1:return this.TypeSelector();case 10:case 11:return this.Percentage();case 12:this.charCodeAt(this.tokenStart)===iE&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:{switch(this.charCodeAt(this.tokenStart)){case wV:case SV:case CV:case vV:return this.Combinator();case iE:return this.ClassSelector();case bV:case kV:return this.TypeSelector();case xV:return this.IdSelector();case yV:return this.NestingSelector()}break}}}var xV,yV,bV,wV,vV,iE,SV,kV,CV,aE,sE=H(()=>{"use strict";xV=35,yV=38,bV=42,wV=43,vV=47,iE=46,SV=62,kV=124,CV=126;aE={onWhiteSpace:EV,getNode:TV}});function lE(){return this.createSingleNodeList(this.Raw(null,!1))}var cE=H(()=>{"use strict"});function uE(){let e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===18){e.push(this.Operator());let t=this.tokenIndex,r=this.parseCustomProperty?this.Value(null):this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1);if(r.type==="Value"&&r.children.isEmpty){for(let n=t-this.tokenIndex;n<=0;n++)if(this.lookupType(n)===13){r.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}e.push(r)}return e}var pE=H(()=>{"use strict"});function dE(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}var fE,gE=H(()=>{"use strict";ly();cE();pE();fE={getNode:Oc,onWhiteSpace(e,t){dE(e)&&(e.value=" "+e.value),dE(t.last)&&(t.last.value+=" ")},expression:lE,var:uE}});var cy={};Le(cy,{AtrulePrelude:()=>nE,Selector:()=>aE,Value:()=>fE});var mE=H(()=>{"use strict";oE();sE();gE()});var IV,hE,xE=H(()=>{"use strict";IV=new Set(["none","and","not","or"]),hE={parse:{prelude(){let e=this.createList();if(this.tokenType===1){let t=this.substring(this.tokenStart,this.tokenEnd);IV.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}}});var yE,bE=H(()=>{"use strict";yE={parse:{prelude:null,block(){return this.Block(!0)}}}});function uy(e,t){return this.parseWithFallback(()=>{try{return e.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==22&&this.error()}},t||(()=>this.Raw(null,!0)))}var wE,vE,SE=H(()=>{"use strict";wE={layer(){this.skipSC();let e=this.createList(),t=uy.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();let e=this.createList(),t=uy.call(this,this.Declaration,()=>uy.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},vE={parse:{prelude(){let e=this.createList();switch(this.tokenType){case 5:e.push(this.String());break;case 7:case 2:e.push(this.Url());break;default:this.error("String or url() is expected")}return this.skipSC(),this.tokenType===1&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer")?e.push(this.Identifier()):this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer(")&&e.push(this.Function(null,wE)),this.skipSC(),this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,wE)),(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}}});var kE,CE=H(()=>{"use strict";kE={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}}});var EE,TE=H(()=>{"use strict";EE={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}}});var IE,RE=H(()=>{"use strict";IE={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var AE,FE=H(()=>{"use strict";AE={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var ME,PE=H(()=>{"use strict";ME={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}}});var LE,_E=H(()=>{"use strict";LE={parse:{prelude:null,block(e=!1){return this.Block(e)}}}});var BE,zE=H(()=>{"use strict";BE={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}}});var DE,NE=H(()=>{"use strict";xE();bE();SE();CE();TE();RE();FE();PE();_E();zE();DE={container:hE,"font-face":yE,import:vE,layer:kE,media:EE,nest:IE,page:AE,scope:ME,"starting-style":LE,supports:BE}});function OE(){let e=this.createList();this.skipSC();e:for(;!this.eof;){switch(this.tokenType){case 1:e.push(this.Identifier());break;case 5:e.push(this.String());break;case 18:e.push(this.Operator());break;case 22:break e;default:this.error("Identifier, string or comma is expected")}this.skipSC()}return e}var $E=H(()=>{"use strict"});var Ja,py,RV,AV,Rd,HE,UE=H(()=>{"use strict";$E();Ja={parse(){return this.createSingleNodeList(this.SelectorList())}},py={parse(){return this.createSingleNodeList(this.Selector())}},RV={parse(){return this.createSingleNodeList(this.Identifier())}},AV={parse:OE},Rd={parse(){return this.createSingleNodeList(this.Nth())}},HE={dir:RV,has:Ja,lang:AV,matches:Ja,is:Ja,"-moz-any":Ja,"-webkit-any":Ja,where:Ja,not:Ja,"nth-child":Rd,"nth-last-child":Rd,"nth-last-of-type":Rd,"nth-of-type":Rd,slotted:py,host:py,"host-context":py}});var dy={};Le(dy,{AnPlusB:()=>gh,Atrule:()=>xh,AtrulePrelude:()=>wh,AttributeSelector:()=>Ch,Block:()=>Ih,Brackets:()=>Fh,CDC:()=>Lh,CDO:()=>zh,ClassSelector:()=>Oh,Combinator:()=>Uh,Comment:()=>Wh,Condition:()=>Yh,Declaration:()=>Jh,DeclarationList:()=>t1,Dimension:()=>o1,Feature:()=>s1,FeatureFunction:()=>u1,FeatureRange:()=>g1,Function:()=>x1,GeneralEnclosed:()=>w1,Hash:()=>k1,IdSelector:()=>A1,Identifier:()=>T1,Layer:()=>P1,LayerList:()=>B1,MediaQuery:()=>N1,MediaQueryList:()=>H1,NestingSelector:()=>V1,Nth:()=>q1,Number:()=>X1,Operator:()=>Z1,Parentheses:()=>rx,Percentage:()=>ix,PseudoClassSelector:()=>lx,PseudoElementSelector:()=>px,Ratio:()=>gx,Raw:()=>xx,Rule:()=>wx,Scope:()=>kx,Selector:()=>Tx,SelectorList:()=>Ax,String:()=>Lx,StyleSheet:()=>zx,SupportsDeclaration:()=>Ox,TypeSelector:()=>jx,UnicodeRange:()=>qx,Url:()=>Qx,Value:()=>ty,WhiteSpace:()=>oy});var jE=H(()=>{"use strict";hh();bh();Sh();Th();Ah();Ph();Bh();Nh();Hh();Vh();qh();Xh();Zh();n1();a1();c1();d1();h1();b1();S1();E1();R1();M1();_1();D1();$1();j1();G1();K1();Q1();tx();ox();sx();ux();fx();hx();bx();Sx();Ex();Rx();Mx();Bx();Nx();Hx();Wx();Kx();ey();ny();ay()});var VE,WE=H(()=>{"use strict";mE();NE();UE();jE();VE={parseContext:{default:"StyleSheet",stylesheet:"StyleSheet",atrule:"Atrule",atrulePrelude(e){return this.AtrulePrelude(e.atrule?String(e.atrule):null)},mediaQueryList:"MediaQueryList",mediaQuery:"MediaQuery",condition(e){return this.Condition(e.kind)},rule:"Rule",selectorList:"SelectorList",selector:"Selector",block(){return this.Block(!0)},declarationList:"DeclarationList",declaration:"Declaration",value:"Value"},features:{supports:{selector(){return this.Selector()}},container:{style(){return this.Declaration()}}},scope:cy,atrule:DE,pseudo:HE,node:dy}});var GE,qE=H(()=>{"use strict";sy();GE={node:Nc}});var YE,KE=H(()=>{"use strict";C4();tE();WE();qE();YE=k4({...eE,...VE,...GE})});var XE=H(()=>{"use strict"});var JE=H(()=>{"use strict"});var A1e,QE,F1e,M1e,P1e,ZE,L1e,_1e,B1e,z1e,D1e,N1e,eT=H(()=>{"use strict";KE();XE();eh();pd();JE();Td();Jx();({tokenize:A1e,parse:QE,generate:F1e,lexer:M1e,createLexer:P1e,walk:ZE,find:L1e,findLast:_1e,findAll:B1e,toPlainObject:z1e,fromPlainObject:D1e,fork:N1e}=YE)});function LV(e){return e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function rT(e){try{let t=QE(e.trim(),{context:"value"}),r=[];return ZE(t,{enter(n){if(n.type==="Dimension"){let o=parseFloat(n.value);r.push(`${o}${n.unit}`)}else if(n.type==="Number"){let o=parseFloat(n.value);r.push(`${o}`)}else n.type==="Percentage"?r.push(`${parseFloat(n.value)}%`):n.type==="Identifier"?r.push(n.name.toLowerCase()):n.type==="Hash"?r.push(`#${n.value.toLowerCase()}`):n.type}}),r}catch{return[e.trim().toLowerCase()]}}function _V(e,t){let r=LV(e);if(!PV.has(r))return t;let n=rT(t);if(n.length<1||n.length>4)return t;let o=n.map(i=>i==="0"?"0px":i);return o.length===1?`${o[0]} ${o[0]} ${o[0]} ${o[0]}`:o.length===2?`${o[0]} ${o[1]} ${o[0]} ${o[1]}`:o.length===3?`${o[0]} ${o[1]} ${o[2]} ${o[1]}`:o.join(" ")}function tT(e,t){let r=t.trim();if(!r)return"";let n=_V(e,r);return rT(n).map(i=>i==="0"?"0px":i).join(" ")}function nT(e,t,r){let n=tT(e,t),o=tT(e,r);return n!==""&&o!==""&&n===o}var PV,oT=H(()=>{"use strict";eT();PV=new Set(["padding","margin","border-radius","borderradius","inset","border-width","borderwidth"])});function BV(e){let t=e.toLowerCase();return t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function zV(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/);if(!t)return null;let r=parseInt(t[1],10).toString(16).padStart(2,"0"),n=parseInt(t[2],10).toString(16).padStart(2,"0"),o=parseInt(t[3],10).toString(16).padStart(2,"0");return`#${r}${n}${o}`}function iT(e){let t=typeof e=="string"?e:String(e??"");if(!t||t==="[object Object]")return"";let r=t.match(/rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)/);if(r){let i=zV(r[0]);if(i)return i}let n=t.match(/#([0-9a-fA-F]{3,8})/);if(n)return BV(n[0]);let o=t.match(/(-?\d+\.?\d*)(px|em|rem|%|pt|vw|vh)?/g);return o&&o.length>1?o.join(" ").toLowerCase():o&&o.length===1?o[0].toLowerCase():t.toLowerCase().trim().replace(/\s+/g," ")}function Qa(e,t,r){if(!e||!t)return!1;let n=String(e),o=String(t),i=n.toLowerCase(),a=o.toLowerCase(),s=i.includes("none"),l=a.includes("none");if(s!==l)return!1;let u=/\b(fill|stroke)\s*:/i,c=u.test(n),d=u.test(o);if(c!==d)return!1;let f=iT(n),p=iT(o);return!!(f===p||r&&nT(r,n,o))}var fy=H(()=>{"use strict";oT()});function gy(e){let t=e.trim().match(/^#?([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/);if(!t)return null;let r=t[1];return r.length===3||r.length===4?r=r.slice(0,3).split("").map(n=>n+n).join(""):r.length===8&&(r=r.slice(0,6)),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]}function DV(e){let t=e.trim().match(/^rgba?\(\s*([^)]+)\)$/i);if(!t)return null;let r=t[1].replace(/\//g," ").split(/[\s,]+/).filter(Boolean);if(r.length<3)return null;let n=l=>l.endsWith("%")?Math.round(parseFloat(l)/100*255):Math.round(parseFloat(l)),o=n(r[0]),i=n(r[1]),a=n(r[2]);if([o,i,a].some(l=>isNaN(l)))return null;let s=l=>Math.max(0,Math.min(255,l));return[s(o),s(i),s(a)]}function NV(e,t,r){let n=(1-Math.abs(2*r-1))*t,o=(e%360+360)%360/60,i=n*(1-Math.abs(o%2-1)),a=0,s=0,l=0;o<1?[a,s,l]=[n,i,0]:o<2?[a,s,l]=[i,n,0]:o<3?[a,s,l]=[0,n,i]:o<4?[a,s,l]=[0,i,n]:o<5?[a,s,l]=[i,0,n]:[a,s,l]=[n,0,i];let u=r-n/2;return[Math.round((a+u)*255),Math.round((s+u)*255),Math.round((l+u)*255)]}function OV(e){let t=e.trim().match(/^hsla?\(\s*([^)]+)\)$/i);if(!t)return null;let r=t[1].replace(/\//g," ").split(/[\s,]+/).filter(Boolean);if(r.length<3)return null;let n=parseFloat(r[0]),o=parseFloat(r[1]),i=parseFloat(r[2]);return[n,o,i].some(a=>isNaN(a))?null:NV(n,o/100,i/100)}function HV(e){return $V[e.trim().toLowerCase()]??null}function aT(e){return e?gy(e)??DV(e)??OV(e)??my(e)??HV(e):null}function my(e){let t=e.trim().match(/^color\(\s*display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*[\d.]+)?\s*\)$/);if(!t)return null;let r=parseFloat(t[1]),n=parseFloat(t[2]),o=parseFloat(t[3]);if(isNaN(r)||isNaN(n)||isNaN(o))return null;let i=p=>p<=.04045?p/12.92:Math.pow((p+.055)/1.055,2.4),a=i(r),s=i(n),l=i(o),u=1.2249*a-.2247*s+0*l,c=-.042*a+1.0419*s+0*l,d=-.0197*a-.0786*s+1.0983*l,f=p=>{let g=Math.max(0,Math.min(1,p));return g<=.0031308?12.92*g:1.055*Math.pow(g,1/2.4)-.055};return[Math.round(f(u)*255),Math.round(f(c)*255),Math.round(f(d)*255)]}function sT(e,t,r){let n=S=>{let h=S/255;return h<=.04045?h/12.92:Math.pow((h+.055)/1.055,2.4)},o=n(e),i=n(t),a=n(r),s=o*.4124564+i*.3575761+a*.1804375,l=o*.2126729+i*.7151522+a*.072175,u=o*.0193339+i*.119192+a*.9503041,c=.95047,d=1,f=1.08883,p=S=>S>.008856?Math.cbrt(S):7.787*S+16/116,g=p(s/c),m=p(l/d),T=p(u/f);return[116*m-16,500*(g-m),200*(m-T)]}function lT(e,t){let[r,n,o]=sT(...e),[i,a,s]=sT(...t),l=(r+i)/2,u=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+s*s),d=(u+c)/2,f=.5*(1-Math.sqrt(Math.pow(d,7)/(Math.pow(d,7)+Math.pow(25,7)))),p=(1+f)*n,g=(1+f)*a,m=Math.sqrt(p*p+o*o),T=Math.sqrt(g*g+s*s),S=(m+T)/2,h=(Math.atan2(o,p)*180/Math.PI+360)%360,M=(Math.atan2(s,g)*180/Math.PI+360)%360,z=M-h;Math.abs(z)>180&&(z-=Math.sign(z)*360);let O=i-r,R=T-m,B=2*Math.sqrt(m*T)*Math.sin(z*Math.PI/360),x=Math.abs(h-M)>180?(h+M+360)/2:(h+M)/2,v=1-.17*Math.cos((x-30)*Math.PI/180)+.24*Math.cos(2*x*Math.PI/180)+.32*Math.cos((3*x+6)*Math.PI/180)-.2*Math.cos((4*x-63)*Math.PI/180),I=1+.015*Math.pow(l-50,2)/Math.sqrt(20+Math.pow(l-50,2)),L=1+.045*S,E=1+.015*S*v,y=-2*Math.sqrt(Math.pow(S,7)/(Math.pow(S,7)+Math.pow(25,7)))*Math.sin(60*Math.exp(-Math.pow((x-275)/25,2))*Math.PI/180);return Math.sqrt(Math.pow(O/I,2)+Math.pow(R/L,2)+Math.pow(B/E,2)+y*(R/L)*(B/E))}function cT(e){let t=(e.property||"").toLowerCase();if(!(t.includes("color")||t==="fill"||t==="background"||t==="backgroundcolor"))return!1;let n=String(e.expected||e.suggestedValue||""),o=String(e.actual||e.currentValue||""),i=gy(n)??gy(o),a=my(n)??my(o);return!i||!a||n===o?!1:lT(i,a)<5}function $c(e){let t=String(e.expected??e.suggestedValue??""),r=String(e.actual??e.currentValue??"");if(!t||!r||t===r)return null;let n=aT(t),o=aT(r);return!n||!o?null:lT(n,o)}function Hc(e){let t=e.severity||"minor";if(t==="minor")return t;if(cT(e))return"minor";let r=$c(e);if(r!==null)return r<2?"minor":r<5&&t==="critical"?"major":t;let n=["width","height","size","dimension","dimensions","r","cx","cy"],o=["dimension","layout"],i=new Set((e.property||"").replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)),a=(e.type||"").toLowerCase();if(!(n.some(p=>i.has(p))||o.some(p=>a===p)))return t;let l=String(e.expected||e.suggestedValue||""),u=String(e.actual||e.currentValue||""),c=parseFloat(l.replace(/[^0-9.-]/g,"")),d=parseFloat(u.replace(/[^0-9.-]/g,""));if(isNaN(c)||isNaN(d))return t;let f=Math.abs(c-d);return f<5?"minor":f<10&&t==="critical"?"major":t}function Ad(e,t,r){return e>0?"D":t>0?"C":r>0?"B":"A"}function Fd(e){let t=e.filter(r=>!r.dismissed).map(r=>Hc(r));return Ad(t.filter(r=>r==="critical").length,t.filter(r=>r==="major").length,t.filter(r=>r==="minor").length)}function Oi(e,t,r){let n=100-r*1-t*3-e*10,o=Uc[Ad(e,t,r)];return Math.max(0,Math.min(o,n))}var $V,Uc,hy=H(()=>{"use strict";$V={white:[255,255,255],black:[0,0,0],red:[255,0,0],green:[0,128,0],blue:[0,0,255],yellow:[255,255,0],cyan:[0,255,255],aqua:[0,255,255],magenta:[255,0,255],fuchsia:[255,0,255],gray:[128,128,128],grey:[128,128,128],silver:[192,192,192],maroon:[128,0,0],olive:[128,128,0],lime:[0,255,0],teal:[0,128,128],navy:[0,0,128],purple:[128,0,128],orange:[255,165,0],pink:[255,192,203],brown:[165,42,42],gold:[255,215,0],beige:[245,245,220],ivory:[255,255,240],indigo:[75,0,130],violet:[238,130,238],coral:[255,127,80],salmon:[250,128,114],khaki:[240,230,140],crimson:[220,20,60],turquoise:[64,224,208],lightgray:[211,211,211],lightgrey:[211,211,211],darkgray:[169,169,169],darkgrey:[169,169,169],whitesmoke:[245,245,245],gainsboro:[220,220,220]};Uc={A:100,B:99,C:89,D:69}});function al(e,t={}){if(e==null)return"";let r=String(e).split(",")[0].trim().replace(/['"]/g,"").toLowerCase();return t.stripSeparators&&(r=r.replace(/[\s_-]/g,"")),r}function dT(e,t){let r=al(e,{stripSeparators:!0}),n=al(t,{stripSeparators:!0});return!r||!n||r===n?!1:UV.some(o=>o.has(r)&&o.has(n))}function pT(e){if(e==null)return null;let t=String(e).trim().toLowerCase();if(!t)return null;let r=t.replace(/[\s_-]/g,"");if(r in uT)return uT[r];let n=parseFloat(t.replace(/[^0-9.-]/g,""));return isNaN(n)?null:n}function fT(e,t){let r=pT(e),n=pT(t);return r==null||n==null?!1:Math.round(r/100)===Math.round(n/100)}var UV,uT,Md=H(()=>{"use strict";UV=[new Set(["applesystem","blinkmacsystemfont","systemui","webkitsystemfont","sfpro","sfprotext","sfprodisplay","sanfrancisco","sanfranciscopro","sanfranciscotext","sanfranciscodisplay"])];uT={thin:100,hairline:100,extralight:200,ultralight:200,light:300,normal:400,regular:400,book:400,medium:500,semibold:600,demibold:600,demi:600,bold:700,extrabold:800,ultrabold:800,black:900,heavy:900}});function yT(e){let t=String(e.property||"").toLowerCase(),r=String(e.description||"").toLowerCase(),n=String(e.expected||e.suggestedValue||"").toLowerCase(),o=String(e.actual||e.currentValue||"").toLowerCase();if(t.includes("color")||t.includes("fill")||t.includes("background")||r.includes("color")||r.includes("fill"))return!0;let i=a=>/^#[0-9a-f]{3,8}$/i.test(a)||a.includes("rgb")||["white","black","red","blue","green","orange","yellow","transparent"].includes(a);return!!(i(n)||i(o)||e.relatedProperties?.some(a=>{let s=a.property?.toLowerCase()||"";return s.includes("color")||s.includes("fill")||s.includes("background")}))}function qV(e){if(!yT(e))return!1;let t=$c(e);return t!==null&&t<2}function gT(e){if(e.includes("\xD7")||/\d+px\s*x\s*\d+px/i.test(e))return!1;let t=e.match(/\d+px/g);return t?t.length>1:!1}function YV(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),r=String(e.actual||e.currentValue||"").toLowerCase(),n=String(e.property||"").toLowerCase(),o=String(e.description||"").toLowerCase(),i=r.includes("margin")||t.includes("margin")||n==="margin",a=t.includes("gap")||o.includes("gap");return i&&a}function bT(e){return KV.has(e?.toLowerCase()||"")}function XV(e,t,r){if(!e||!t)return!1;let n=typeof e=="string"?e:String(e??""),o=typeof t=="string"?t:String(t??"");if(!n||!o||n==="[object Object]"||o==="[object Object]"||r&&yT(r)||gT(n)||gT(o)||r&&YV(r))return!1;let i=parseFloat(n),a=parseFloat(o);if(isNaN(i)||isNaN(a))return!1;let s=Math.abs(i-a);return n.includes("px")||o.includes("px")?bT(r?.property)?s<hT:s<mT:n.includes("%")||o.includes("%")?s<1:!1}function JV(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase();if(GV.some(a=>t.includes(a))||!VV.some(a=>t.includes(a)))return!1;let o=e.expected||e.suggestedValue,i=e.actual||e.currentValue;return!(o&&i&&!Qa(o,i,e.property))}function QV(e){let t=(e.expected!==void 0?"fill":"").toLowerCase(),r=e.actual!==void 0||e.currentValue!==void 0?"fill":"";if(!(t==="fill"||r==="fill"||e.description?.toLowerCase().includes("fill")||e.title?.toLowerCase().includes("fill")))return!1;let o=String(e.expected||e.suggestedValue||"").toLowerCase();if(!(o==="none"||o==="transparent"||o.includes("no fills")||o.includes("transparent")))return!1;let a=`${e.description||""} ${e.title||""}`.toLowerCase();return a.includes("container")||a.includes("svg ")||a.includes("<svg")||a.includes("wrapper")}function ZV(e){let t=`${e.description||""} ${e.title||""}`.toLowerCase(),r=e.property?.toLowerCase()||"";if(!(t.includes("text ")||t.includes("text layer")||t.includes("text span")||t.includes("span ")||t.includes("label "))||!(r==="width"||r==="height"||r.includes("width")||r.includes("height")||t.includes("width")||t.includes("height")))return!1;let i=e.expected||e.suggestedValue||"",a=e.actual||e.currentValue||"",s=parseFloat(i),l=parseFloat(a);return isNaN(s)||isNaN(l)?!1:Math.abs(s-l)<xT}function eW(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase(),r=String(e.expected||e.suggestedValue||"").toLowerCase(),n=String(e.actual||e.currentValue||"").toLowerCase();if(!WV.some(d=>t.includes(d)||r.includes(d)))return!1;let i=`${t} ${r} ${n}`;if(i.includes("min-width")||i.includes("max-width")||i.includes("min-height")||i.includes("max-height")||i.includes("explicit")||i.includes("constraint")||i.includes("forced"))return!1;let s=r.includes("hug")||r.includes("auto"),l=/\d+\.?\d*px/.test(n);if(!s||!l)return!1;let u=r.match(/(\d+\.?\d*)px/),c=n.match(/(\d+\.?\d*)px/);return!(u&&c&&Math.abs(parseFloat(u[1])-parseFloat(c[1]))>jV)}function tW(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),r=String(e.actual||e.currentValue||"").toLowerCase();return(!r||!t||r.includes("see ")||t.includes("see ")||r.includes("image")||t.includes("image"))&&e.type==="visual"}function wT(e){return(e||"").toLowerCase().replace(/[\s_-]/g,"")==="fontfamily"}function rW(e){return(e||"").toLowerCase().replace(/[\s_-]/g,"")==="fontweight"}function nW(e,t,r){if(!wT(r))return!1;let n=al(e,{stripSeparators:!0}),o=al(t,{stripSeparators:!0});return n.length>0&&o.length>0&&n===o}function oW(e,t,r){return wT(r)?dT(e,t):!1}function iW(e,t,r){return rW(r)?fT(e,t):!1}function jc(e){let t=e.expected||e.suggestedValue,r=e.actual||e.currentValue;return nW(t,r,e.property)?{dismissed:!0,dismissReason:"Auto-dismissed: font-family naming difference (same font)",dismissedBy:"post-ai-validation"}:oW(t,r,e.property)?{dismissed:!0,dismissReason:"Auto-dismissed: system font stack equivalence (-apple-system renders as SF Pro)",dismissedBy:"post-ai-validation"}:iW(t,r,e.property)?{dismissed:!0,dismissReason:"Auto-dismissed: font weight renders identically (same named weight)",dismissedBy:"post-ai-validation"}:e.programmaticallyVerified?{dismissed:!1}:e.fixRequired===!1?{dismissed:!0,dismissReason:"Auto-dismissed: FixRequired is false (no code change needed)",dismissedBy:"post-ai-validation"}:Qa(t,r,e.property)?{dismissed:!0,dismissReason:"Auto-dismissed: expected equals actual (identical values)",dismissedBy:"post-ai-validation"}:qV(e)?{dismissed:!0,dismissReason:`Auto-dismissed: imperceptible color difference (\u0394E < ${2})`,dismissedBy:"post-ai-validation"}:e.fixRequired===!0?{dismissed:!1}:ZV(e)?{dismissed:!0,dismissReason:`Auto-dismissed: text dimension variance (<${xT}px) - font rendering difference, not actionable`,dismissedBy:"post-ai-validation"}:XV(t,r,e)?{dismissed:!0,dismissReason:`Auto-dismissed: negligible difference (<${bT(e.property)?hT:mT}px)`,dismissedBy:"post-ai-validation"}:tW(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no measurable values to compare",dismissedBy:"post-ai-validation"}:JV(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no fix needed",dismissedBy:"post-ai-validation"}:eW(e)?{dismissed:!0,dismissReason:"Auto-dismissed: HUG sizing - CSS auto-sizes content without explicit dimensions",dismissedBy:"post-ai-validation"}:QV(e)?{dismissed:!0,dismissReason:"Auto-dismissed: SVG container fill - child elements use their own fills",dismissedBy:"post-ai-validation"}:{dismissed:!1}}var mT,hT,xT,jV,VV,WV,GV,KV,vT=H(()=>{"use strict";fy();hy();Md();mT=.5,hT=2,xT=2,jV=5,VV=["values match","values already match","already correct","correctly implemented","implementation is correct","css matches","matches figma","identical","same value","no difference","none - ","no changes needed","no fix needed"],WV=["hug","auto (hug)","should be hug","fixed pixel values are being rendered","fixed values are being rendered"],GV=["duplicate","extra","missing","additional","removed","should not exist","does not exist","not in figma","not in storybook","renders 2","renders two","has 1","has one"];KV=new Set(["width","height","minwidth","maxwidth","minheight","maxheight","min-width","max-width","min-height","max-height"])});var ST=H(()=>{"use strict"});var kT=H(()=>{"use strict"});var Pd=H(()=>{"use strict";fy();vT();hy();ST();kT()});var fW,gW,oxe,yy=H(()=>{"use strict";fW=["flex","inline-flex"],gW=["grid","inline-grid"],oxe=[...fW,...gW]});var ET=H(()=>{"use strict";Pd();yy()});var TT=H(()=>{"use strict"});var IT=H(()=>{"use strict"});var RT=H(()=>{"use strict"});var by=H(()=>{"use strict";Md()});var wy=H(()=>{"use strict";by();Pd()});var vy=H(()=>{"use strict"});var Sy=H(()=>{"use strict"});function Ld(e){return typeof e=="string"&&e.startsWith("element:")}function FT(e){return!e||e.length===0?"":` (${e.slice(0,AT).join(", ")}${e.length>AT?", \u2026":""})`}function MT(e){let t=String(e.property).slice(8),[r,n]=hW[t]??[t,`${t}s`],o=Number(e.expected),i=Number(e.actual),a=o>i,s=Math.abs(o-i),l=u=>u===1?r:n;return{title:`${a?"Missing":"Extra"} ${s===1?r:`${s} ${n}`} in code`,description:`Design has ${o} ${l(o)}${FT(e.elements?.figma)}; code renders ${i}${FT(e.elements?.code)}. `+(a?`${s===1?"One is":`${s} are`} in the design but not implemented.`:`${s===1?"One is":`${s} are`} rendered but not in the design.`),suggested:`${o} ${l(o)}`,current:`${i} ${l(i)}`}}var hW,AT,PT=H(()=>{"use strict";hW={icon:["icon","icons"],text:["text element","text elements"],image:["image","images"],shape:["shape","shapes"]},AT=4});var LT=H(()=>{"use strict"});function _T(e,t){let r=e?.split("/").pop()?.trim();return r||(t?.trim()??"")}var BT=H(()=>{"use strict"});var zT=H(()=>{"use strict"});var _d=H(()=>{"use strict";vy();wy()});var DT=H(()=>{"use strict"});var ky=H(()=>{"use strict";_d()});var Cy=H(()=>{"use strict";Sy()});var NT=H(()=>{"use strict";ky();_d();Cy()});var OT=H(()=>{"use strict";IT();RT();by();wy();vy();Sy();PT();LT();BT();zT();_d();DT();ky();Cy();NT()});var $T=H(()=>{"use strict";Md()});var Vc,HT=H(()=>{"use strict";Vc={admin:{enableFixGeneration:!1,enableFixApply:!0,enableAutoMap:!0,enableAutoFigmaLinking:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableAutoFigmaLinking:!0,enableReviewBadges:!0,showCosts:!1,enableParallelReview:!0,enableModelSelection:!1},anonymous:{enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableAutoFigmaLinking:!0,enableReviewBadges:!0,showCosts:!1,enableParallelReview:!0,enableModelSelection:!1}}});var dr=H(()=>{"use strict";c0();wk();vk();Pd();yy();ET();TT();OT();$T();HT()});function yW(e){let{aiPrompt:t,aiResponse:r,...n}=e;return n}function Jn(e){try{let t=e.map(yW),r=JSON.stringify(t,bW);sessionStorage.setItem(Ey,r)}catch(t){w.error("[SessionStorage] Failed to save review history:",t)}}function Ty(){try{let e=sessionStorage.getItem(Ey);if(!e)return[];let t=JSON.parse(e,wW);return Array.isArray(t)?t:[]}catch(e){return w.error("[SessionStorage] Failed to load review history:",e),[]}}function UT(){try{let e=Ty();if(e.length===0)return;let t=!1,r=e.map(n=>{if(n.aiPrompt!==void 0||n.aiResponse!==void 0){t=!0;let{aiPrompt:o,aiResponse:i,...a}=n;return a}return n});t&&(Jn(r),w.debug("[SessionStorage] Stripped aiPrompt/aiResponse from existing review history"))}catch(e){w.error("[SessionStorage] Failed to strip sensitive fields:",e)}}function jT(){try{sessionStorage.removeItem(Ey),w.debug("[SessionStorage] Review history cleared")}catch(e){w.error("[SessionStorage] Failed to clear review history:",e)}}function bW(e,t){return t instanceof Date?{__type:"Date",value:t.toISOString()}:t}function wW(e,t){return t&&t.__type==="Date"?new Date(t.value):t}var Ey,Iy=H(()=>{"use strict";Ne();Ey="uicopilot_review_history"});import vW,{createContext as SW,useContext as kW,useReducer as CW,useMemo as VT,useRef as EW,useEffect as TW}from"react";function Bd(e){let t=e.length>WT?e.slice(e.length-WT):e,r=Math.max(0,t.length-IW);return r===0?t:t.map((n,o)=>{if(o>=r)return n;let i=n.storybookImageData?.startsWith("data:"),a=n.figmaImageData?.startsWith("data:");return!i&&!a?n:{...n,storybookImageData:i?void 0:n.storybookImageData,figmaImageData:a?void 0:n.figmaImageData}})}function RW(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"REQUEST_REVIEW_RETRY":return{...e,reviewRetryNonce:e.reviewRetryNonce+1};case"ADD_STREAMING_MESSAGE":return{...e,streamingMessages:[...e.streamingMessages,t.payload]};case"UPDATE_STREAMING_MESSAGE":return{...e,streamingMessages:e.streamingMessages.map((r,n)=>n===t.payload.index?{...r,content:t.payload.content}:r)};case"CLEAR_STREAMING_MESSAGES":return{...e,streamingMessages:[]};case"TOGGLE_MODEL":{let r=e.selectedModels.includes(t.payload);return r&&e.selectedModels.length===1?e:{...e,selectedModels:r?e.selectedModels.filter(n=>n!==t.payload):[...e.selectedModels,t.payload]}}case"SET_REVIEW_RESULTS":{if(!t.payload)return{...e,reviewResults:null,currentReviewId:null};let r=e.userRole==="admin",n={id:t.payload.id,componentId:t.payload.componentId,storyId:t.payload.storyId,modelId:t.payload.modelId,complianceScore:t.payload.complianceScore,issuesCount:t.payload.issuesCount,issues:t.payload.issues,createdAt:t.payload.createdAt,visualSimilarity:t.payload.visualSimilarity,storybookImageData:t.payload.storybookImageData||e.storybookImageUrl||void 0,figmaImageData:t.payload.figmaImageData||e.figmaImageUrl||void 0,figmaComponentProperties:t.payload.figmaComponentProperties,aiPrompt:r&&e.fullPrompt||void 0,aiResponse:r&&e.fullResponse||void 0,costUsd:t.payload.costUsd,inputTokens:t.payload.inputTokens,outputTokens:t.payload.outputTokens,reviewDurationMs:t.payload.reviewDurationMs},o=e.reviewHistory.findIndex(a=>a.id===t.payload.id),i;return o>=0?i=e.reviewHistory.map((a,s)=>s===o?n:a):i=[...e.reviewHistory,n],i=Bd(i),Jn(i),{...e,reviewResults:t.payload,reviewHistory:i,currentReviewId:t.payload.id,isNewReviewMode:!1}}case"UPDATE_MULTI_MODEL_STREAMING":return e.multiModelResults?{...e,multiModelResults:{...e.multiModelResults,byModel:{...e.multiModelResults.byModel,[t.payload.modelId]:{...e.multiModelResults.byModel[t.payload.modelId],streamingMessages:t.payload.messages}}}}:{...e,multiModelResults:{byModel:{[t.payload.modelId]:{streamingMessages:t.payload.messages}},activeModelId:t.payload.modelId}};case"SET_MODEL_COMPLETED":return e.multiModelResults?{...e,multiModelResults:{...e.multiModelResults,byModel:{...e.multiModelResults.byModel,[t.payload]:{...e.multiModelResults.byModel[t.payload],completed:!0}}}}:e;case"BULK_ADD_REVIEWS":{if(t.payload.length===0)return e;let r=new Map(e.reviewHistory.map(a=>[a.id,a])),n=!1,o=e.reviewHistory.slice();for(let a of t.payload){let s=r.get(a.id);if(!s){o.push(a),n=!0;continue}let l=a.issues?.length??0,u=s.issues?.length??0;if(l>u){let c=o.indexOf(s);c!==-1&&(o[c]=a,n=!0)}}if(!n)return e;let i=Bd(o);return Jn(i),{...e,reviewHistory:i}}case"ADD_REVIEW":{let r=Bd([...e.reviewHistory,t.payload]);return Jn(r),{...e,reviewHistory:r,currentReviewId:t.payload.id,isNewReviewMode:!1}}case"TOGGLE_ISSUE_SELECTION":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>n.id!==e.currentReviewId?n:{...n,issues:n.issues.map(o=>o.id===t.payload?{...o,selectedForFix:!o.selectedForFix}:o)});return Jn(r),{...e,reviewHistory:r}}case"UPDATE_ISSUE_STATUS":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>n.id!==e.currentReviewId?n:{...n,issues:n.issues.map(o=>o.id===t.payload.issueId?{...o,status:t.payload.status,error:t.payload.error}:o)});return Jn(r),{...e,reviewHistory:r}}case"UPDATE_ISSUE_GENERATED_FIX":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>n.id!==e.currentReviewId?n:{...n,issues:n.issues.map(o=>o.id===t.payload.issueId?{...o,generatedFix:o.generatedFix?{...o.generatedFix,...t.payload.generatedFix}:t.payload.generatedFix,selectedForFix:t.payload.generatedFix?.status==="failed"?!1:o.selectedForFix}:o)});return Jn(r),{...e,reviewHistory:r}}case"BATCH_UPDATE_ISSUE_GENERATED_FIXES":{if(!e.currentReviewId)return e;let r=new Map(t.payload.map(o=>[o.issueId,o.generatedFix])),n=e.reviewHistory.map(o=>o.id!==e.currentReviewId?o:{...o,issues:o.issues.map(i=>{let a=r.get(i.id);return a?{...i,generatedFix:i.generatedFix?{...i.generatedFix,...a}:a,selectedForFix:a?.status==="failed"?!1:i.selectedForFix}:i})});return Jn(n),{...e,reviewHistory:n}}case"DISMISS_ISSUE":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>{if(n.id!==e.currentReviewId)return n;let o=n.issues.map(u=>u.id===t.payload.issueId?{...u,dismissed:!0,dismissReason:t.payload.reason,dismissedAt:new Date,dismissedBy:t.payload.dismissedBy}:u),i=o.filter(u=>!u.dismissed),a=i.filter(u=>u.severity==="critical").length,s=i.filter(u=>u.severity==="major").length,l=i.filter(u=>u.severity==="minor").length;return{...n,issues:o,complianceScore:Oi(a,s,l),issuesCount:i.length}});return Jn(r),{...e,reviewHistory:r}}case"UNDISMISS_ISSUE":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>{if(n.id!==e.currentReviewId)return n;let o=n.issues.map(u=>u.id===t.payload?{...u,dismissed:!1,dismissReason:void 0,dismissedAt:void 0}:u),i=o.filter(u=>!u.dismissed),a=i.filter(u=>u.severity==="critical").length,s=i.filter(u=>u.severity==="major").length,l=i.filter(u=>u.severity==="minor").length;return{...n,issues:o,complianceScore:Oi(a,s,l),issuesCount:i.length}});return Jn(r),{...e,reviewHistory:r}}case"RECALCULATE_SCORE":{if(!e.currentReviewId)return e;let r=e.reviewHistory.map(n=>{if(n.id!==e.currentReviewId)return n;let o=n.issues.filter(u=>!u.dismissed),i=o.filter(u=>u.severity==="critical").length,a=o.filter(u=>u.severity==="major").length,s=o.filter(u=>u.severity==="minor").length,l=Oi(i,a,s);return w.debug(`[recalculateScore] Active: ${o.length}, score: ${l}`),{...n,complianceScore:l,issuesCount:o.length}});return Jn(r),{...e,reviewHistory:r}}case"UPDATE_REVIEW_SCORE":{let r=e.reviewHistory.map(n=>n.id!==t.payload.reviewId?n:{...n,complianceScore:t.payload.newScore});return Jn(r),{...e,reviewHistory:r}}case"CLEAR_ALL_REVIEWS":return jT(),{...e,reviewHistory:[],currentReviewId:null};case"CLEAR_STALE_REVIEWS":return{...e,currentReviewId:null,reviewResults:null,isNewReviewMode:!1};case"RESET_REVIEW":{let r=e.isReviewing;return{...e,isReviewing:!1,reviewError:null,reviewResults:r?null:e.reviewResults,multiModelResults:null,streamingMessages:[],streamingProgress:0,streamingStatus:"",reviewDetailTab:r?"chat":e.reviewDetailTab,fullPrompt:"",fullResponse:"",figmaImageUrl:r?null:e.figmaImageUrl,storybookImageUrl:r?null:e.storybookImageUrl,currentReviewId:r?null:e.currentReviewId}}case"RESET_PROMPT":return{...e,isGenerating:!1,generatedPrompt:null,promptError:null};case"TRIGGER_SCREENSHOT_REFRESH":return{...e,screenshotRefreshKey:e.screenshotRefreshKey+1};default:return e}}function Ay({children:e}){let[t,r]=CW(RW,LW),n=EW(t);TW(()=>{n.current=t},[t]);let o=VT(()=>({setIsReviewing:a=>r({type:"SET_STATE",payload:{isReviewing:a}}),setReviewingStoryId:a=>r({type:"SET_STATE",payload:{reviewingStoryId:a}}),setReviewError:a=>r({type:"SET_STATE",payload:{reviewError:a}}),requestReviewRetry:()=>r({type:"REQUEST_REVIEW_RETRY"}),bulkAddReviews:a=>r({type:"BULK_ADD_REVIEWS",payload:a}),setReviewResults:a=>r({type:"SET_REVIEW_RESULTS",payload:a}),setMultiModelResults:a=>r({type:"SET_STATE",payload:{multiModelResults:a}}),updateMultiModelStreamingMessages:(a,s)=>r({type:"UPDATE_MULTI_MODEL_STREAMING",payload:{modelId:a,messages:s}}),setModelCompleted:a=>r({type:"SET_MODEL_COMPLETED",payload:a}),setActiveModelId:a=>{let s=n.current;s.multiModelResults&&r({type:"SET_STATE",payload:{multiModelResults:{...s.multiModelResults,activeModelId:a}}})},setShowReviewMenu:a=>r({type:"SET_STATE",payload:{showReviewMenu:a}}),setSeverityFilter:a=>r({type:"SET_STATE",payload:{severityFilter:a}}),setShowStreamingPanel:a=>r({type:"SET_STATE",payload:{showStreamingPanel:a}}),setStreamingPanelCollapsed:a=>r({type:"SET_STATE",payload:{streamingPanelCollapsed:a}}),addStreamingMessage:a=>r({type:"ADD_STREAMING_MESSAGE",payload:a}),updateStreamingMessage:(a,s)=>r({type:"UPDATE_STREAMING_MESSAGE",payload:{index:a,content:s}}),clearStreamingMessages:()=>r({type:"CLEAR_STREAMING_MESSAGES"}),setStreamingProgress:a=>r({type:"SET_STATE",payload:{streamingProgress:a}}),setStreamingStatus:a=>r({type:"SET_STATE",payload:{streamingStatus:a}}),setReviewDetailTab:a=>r({type:"SET_STATE",payload:{reviewDetailTab:a}}),setFullPrompt:a=>r({type:"SET_STATE",payload:{fullPrompt:a}}),setFullResponse:a=>r({type:"SET_STATE",payload:{fullResponse:a}}),setFigmaImageUrl:a=>r({type:"SET_STATE",payload:{figmaImageUrl:a}}),setStorybookImageUrl:a=>r({type:"SET_STATE",payload:{storybookImageUrl:a}}),setFigmaDimensions:a=>r({type:"SET_STATE",payload:{figmaDimensions:a}}),setSelectedModels:a=>r({type:"SET_STATE",payload:{selectedModels:a}}),toggleModel:a=>r({type:"TOGGLE_MODEL",payload:a}),setModelComparisonView:a=>r({type:"SET_STATE",payload:{modelComparisonView:a}}),resetReview:()=>r({type:"RESET_REVIEW"}),addReview:a=>r({type:"ADD_REVIEW",payload:a}),getCurrentReview:()=>{let a=n.current;return a.currentReviewId&&a.reviewHistory.find(s=>s.id===a.currentReviewId)||null},getReviewById:a=>n.current.reviewHistory.find(s=>s.id===a)||null,getParentReview:()=>{let a=n.current,s=a.reviewHistory.find(l=>l.id===a.currentReviewId);return s?.parentReviewId&&a.reviewHistory.find(l=>l.id===s.parentReviewId)||null},hasAppliedFixes:()=>{let a=n.current,s=a.reviewHistory.find(l=>l.id===a.currentReviewId);return!s||!Array.isArray(s.issues)||s.issues.length===0?!1:s.issues.some(l=>l.status==="applied"||l.generatedFix?.status==="applied")},toggleIssueSelection:a=>r({type:"TOGGLE_ISSUE_SELECTION",payload:a}),updateIssueStatus:(a,s,l)=>r({type:"UPDATE_ISSUE_STATUS",payload:{issueId:a,status:s,error:l}}),updateIssueGeneratedFix:(a,s)=>r({type:"UPDATE_ISSUE_GENERATED_FIX",payload:{issueId:a,generatedFix:s}}),batchUpdateIssueGeneratedFixes:a=>r({type:"BATCH_UPDATE_ISSUE_GENERATED_FIXES",payload:a}),dismissIssue:(a,s,l)=>r({type:"DISMISS_ISSUE",payload:{issueId:a,reason:s,dismissedBy:l}}),undismissIssue:a=>r({type:"UNDISMISS_ISSUE",payload:a}),recalculateScore:()=>r({type:"RECALCULATE_SCORE"}),updateReviewScore:(a,s)=>r({type:"UPDATE_REVIEW_SCORE",payload:{reviewId:a,newScore:s}}),clearAllReviews:()=>r({type:"CLEAR_ALL_REVIEWS"}),clearStaleReviewsForStory:a=>r({type:"CLEAR_STALE_REVIEWS",payload:a}),setIsApplying:a=>r({type:"SET_STATE",payload:{isApplying:a}}),setApplyFixesResult:a=>r({type:"SET_STATE",payload:{applyFixesResult:a}}),setIncludeComponentIssues:a=>r({type:"SET_STATE",payload:{includeComponentIssues:a}}),setIncludeTextComparison:a=>r({type:"SET_STATE",payload:{includeTextComparison:a}}),setUsePromptCache:a=>r({type:"SET_STATE",payload:{usePromptCache:a}}),setIsValidating:a=>r({type:"SET_STATE",payload:{isValidating:a}}),setIsSpecChecking:a=>r({type:"SET_STATE",payload:{isSpecChecking:a}}),setReviewHistoryLoading:a=>r({type:"SET_STATE",payload:{reviewHistoryLoading:a}}),setValidationUsage:a=>r({type:"SET_STATE",payload:{validationUsage:a}}),setWorkspacePath:a=>r({type:"SET_STATE",payload:{workspacePath:a}}),triggerScreenshotRefresh:()=>r({type:"TRIGGER_SCREENSHOT_REFRESH"}),setHoveredIssueId:a=>r({type:"SET_STATE",payload:{hoveredIssueId:a}}),setNewReviewMode:a=>r({type:"SET_STATE",payload:{isNewReviewMode:a}}),setPendingSettingsOpen:a=>r({type:"SET_STATE",payload:{pendingSettingsOpen:a}}),setFeatureFlags:a=>r({type:"SET_STATE",payload:{featureFlags:a}}),setUserRole:a=>r({type:"SET_STATE",payload:{userRole:a}}),setRoleOverride:a=>{try{a?localStorage.setItem("uicopilot_role_override",a):localStorage.removeItem("uicopilot_role_override")}catch{}r({type:"SET_STATE",payload:{roleOverride:a}})},setReviewAllConcurrency:a=>{let s=Math.max(1,Math.min(5,a));try{localStorage.setItem("uicopilot_review_all_concurrency",String(s))}catch{}r({type:"SET_STATE",payload:{reviewAllConcurrency:s}})},setIsGenerating:a=>r({type:"SET_STATE",payload:{isGenerating:a}}),setGeneratedPrompt:a=>r({type:"SET_STATE",payload:{generatedPrompt:a}}),setPromptError:a=>r({type:"SET_STATE",payload:{promptError:a}}),resetPrompt:()=>r({type:"RESET_PROMPT"})}),[]),i=VT(()=>({...t,...o}),[t,o]);return vW.createElement(GT.Provider,{value:i},e)}function we(){let e=kW(GT);if(!e)throw new Error("useReviewStore must be used within a ReviewProvider");return e}var WT,IW,AW,FW,Ry,MW,PW,LW,GT,Fy=H(()=>{"use strict";dr();Iy();Ne();WT=20,IW=5;AW=()=>{if(typeof localStorage>"u")return 3;try{let e=localStorage.getItem("uicopilot_review_all_concurrency");if(e)return Math.max(1,Math.min(5,parseInt(e,10)))}catch{}return 3},FW=()=>{if(typeof localStorage>"u")return null;try{let e=localStorage.getItem("uicopilot_role_override");if(e==="admin"||e==="beta")return e}catch{}return null},Ry={enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableAutoFigmaLinking:!1,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1},MW=()=>{if(typeof localStorage>"u")return Ry;try{let e=localStorage.getItem("uicopilot_feature_flags");if(!e)return Ry;let t=JSON.parse(e);return{enableFixGeneration:!!t.enableFixGeneration,enableFixApply:!!t.enableFixApply,enableAutoMap:!!t.enableAutoMap,enableAutoFigmaLinking:!!t.enableAutoFigmaLinking,enableReviewBadges:!!t.enableReviewBadges,showCosts:!!t.showCosts,enableParallelReview:!!t.enableParallelReview,enableModelSelection:!!t.enableModelSelection}}catch{}return Ry},PW=()=>{if(typeof localStorage>"u")return"beta";try{let e=localStorage.getItem("uicopilot_user_role");if(e==="admin"||e==="beta")return e}catch{}return"beta"},LW={isReviewing:!1,reviewingStoryId:null,reviewError:null,reviewRetryNonce:0,reviewResults:null,multiModelResults:null,showReviewMenu:!1,severityFilter:"all",showStreamingPanel:!1,streamingPanelCollapsed:!1,streamingMessages:[],streamingProgress:0,streamingStatus:"",reviewDetailTab:"chat",fullPrompt:"",fullResponse:"",figmaImageUrl:null,storybookImageUrl:null,figmaDimensions:null,selectedModels:["claude-sonnet-4-6"],modelComparisonView:"side-by-side",reviewHistory:Bd(Ty()),currentReviewId:null,includeComponentIssues:!0,includeTextComparison:!1,usePromptCache:!1,isApplying:!1,applyFixesResult:null,screenshotRefreshKey:0,isValidating:!1,isSpecChecking:!1,reviewHistoryLoading:!1,validationUsage:null,lastAiCallTimestamp:null,aiRateLimitSeconds:0,isGenerating:!1,generatedPrompt:null,promptError:null,workspacePath:null,userRole:PW(),roleOverride:FW(),featureFlags:MW(),reviewAllConcurrency:AW(),hoveredIssueId:null,isNewReviewMode:!1,pendingSettingsOpen:!1},GT=SW(null)});import Wc,{useMemo as _W}from"react";function Py({children:e}){return Wc.createElement(n0,null,Wc.createElement(i0,null,Wc.createElement(s0,null,Wc.createElement(Ay,null,Wc.createElement(BW,null),e))))}function qT(e){let t=be(),r=Ge(),n=bt(),o=we(),i=_W(()=>({...t,...r,...n,...o}),[t,r,n,o]);return e?e(i):i}function BW(){return My=qT(),null}var My,Tt,YT=H(()=>{"use strict";o0();a0();l0();Fy();My=null,Tt=Object.assign(qT,{getState:()=>{if(!My)throw new Error("Store not initialized. Make sure StoreProvider is mounted.");return My}})});var Ce=H(()=>{"use strict";YT();o0();a0();l0();Fy()});function q(){return(process.env.STORYBOOK_UICOPILOT_URL||zW).replace(/\/$/,"")}var zW,KT,XT,Fe=H(()=>{"use strict";zW="https://app.uiparity.com",KT="0.18.1";XT=3.6});async function X(e,t,r=3e4){let n=new AbortController,o=setTimeout(()=>n.abort(),r);try{return await fetch(e,{...t,signal:n.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new Error(`Request timed out after ${r}ms: ${e}`):i}finally{clearTimeout(o)}}var tt=H(()=>{"use strict"});function dl(e){let n=e.ownerDocument?.defaultView;if(!n)return e.firstElementChild??e;let o=e.getBoundingClientRect(),i=l=>{let u=n.getComputedStyle(l);if(u.position==="fixed"||u.display==="none"||u.visibility==="hidden")return!0;let c=l.getBoundingClientRect();return c.width===0||c.height===0||l.children.length===0&&!(l.textContent??"").trim()},a=l=>{if(o.width===0||o.height===0)return!1;let u=l.getBoundingClientRect();return u.width>=o.width*.9&&u.height>=o.height*.9},s=e;for(let l=0;l<6;l+=1){let u=Array.from(s.children).filter(c=>!i(c));if(u.length!==1||s!==e&&!a(s))break;s=u[0]}return s===e?e.firstElementChild??e:s}var $d=H(()=>{"use strict"});function DG(){return!q().startsWith("http://localhost")}function NG(e,t,r){let n=t.createElement("div");n.style.color=e,t.body.appendChild(n);let o=r.getComputedStyle(n).color;return n.remove(),o}function EI(e,t,r){let n=new Map;return e.replace(/(?:color|oklch|oklab|lab|lch)\([^)]+\)/g,o=>{if(n.has(o))return n.get(o);let i=NG(o,t,r);return n.set(o,i),i})}async function OG(){let e=(await import("html2canvas")).default,t=document.getElementById("storybook-preview-iframe");if(!t?.contentDocument||!t.contentWindow)throw new Error("Storybook iframe not accessible");let r=t.contentDocument.getElementById("storybook-root")||t.contentDocument.getElementById("root");if(!r)throw new Error("Story root not found in iframe");let n=dl(r);if(!n)throw new Error("Story element not found in iframe");let o=t.contentWindow,i=t.contentDocument;return(await e(n,{useCORS:!0,logging:!1,backgroundColor:null,scale:1,onclone:s=>{s.querySelectorAll("style").forEach(u=>{let c=u.textContent||"";/(?:color|oklch|oklab|lab|lch)\(/.test(c)&&(u.textContent=EI(c,i,o))});let l=Array.from(i.styleSheets);s.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{let c=u.href,d=l.find(f=>f.href===c);if(d)try{let f="";for(let p of Array.from(d.cssRules))f+=p.cssText+`
13
13
  `;if(/(?:color|oklch|oklab|lab|lch)\(/.test(f)){let p=s.createElement("style");p.textContent=EI(f,i,o),u.replaceWith(p)}}catch{}})}})).toDataURL("image/png")}function $G(e){let t=[];for(let[r,n]of Object.entries(e)){if(n===void 0)continue;let o;typeof n=="boolean"?o=`!${n}`:typeof n=="number"?o=String(n):typeof n=="string"?o=encodeURIComponent(n).replace(/%20/g,"+"):o=encodeURIComponent(JSON.stringify(n)),t.push(`${r}:${o}`)}return t.join(";")}async function HG(e,t){w.debug("[Screenshot] Using server-side Chrome capture for:",e);let r={"Content-Type":"application/json"};t?.sessionToken&&(r.Authorization=`Bearer ${t.sessionToken}`);let n=await X(`${zG}/api/screenshot`,{method:"POST",headers:r,body:JSON.stringify({url:e,selector:t?.selector,width:t?.width,height:t?.height,scale:t?.scale||1,figmaWidth:t?.figmaWidth,figmaHeight:t?.figmaHeight})});if(!n.ok){let i=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(i.error||`Screenshot failed: ${n.status}`)}return(await n.json()).screenshot}function UG(e){let t={};if(!e)return t;let r=e.split(";");for(let n of r){let o=n.indexOf(":");if(o===-1)continue;let i=n.slice(0,o),a=n.slice(o+1);typeof a=="string"&&(a==="!true"?a=!0:a==="!false"?a=!1:!isNaN(Number(a))&&a!==""?a=Number(a):a=decodeURIComponent(a.replace(/\+/g," "))),t[i]=a}return t}function jG(e){let t=new URLSearchParams(window.location.search),r=e;if(r||(r=(t.get("path")||"").replace("/story/","").replace("/docs/",""),w.debug("[Screenshot] Warning: Using story ID from URL (fallback):",r)),!r)throw new Error("Could not determine current story ID. Please select a story first.");let n=window.location.origin,o=Date.now(),i=`${n}/iframe.html?viewMode=story&id=${r}&globals=&_cb=${o}`,a=fl();if(!a||Object.keys(a).length===0){let s=t.get("args");s&&(a=UG(s),w.debug("[Screenshot] Parsed args from URL:",a))}if(a&&Object.keys(a).length>0){let s=$G(a);i+=`&args=${s}`,w.debug("[Screenshot] Using URL with current args:",i)}else w.debug("[Screenshot] No current args, using default URL:",i);return i}async function VG(e){try{let t=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(t.status===501)return w.info("[Screenshot] Local Puppeteer not available, falling back"),null;if(!t.ok){let n=await t.json().catch(()=>({error:"Unknown"}));throw new Error(n.error||`Screenshot failed: ${t.status}`)}let r=await t.json();return w.info("[Screenshot] Captured via local Puppeteer (pixel-perfect)"),r.screenshot}catch(t){if(t instanceof TypeError&&t.message.includes("fetch"))return null;throw t}}async function Hd(e){let t=e?.storyId||WG();if(t){let r=Uy.get(t);if(r)return w.debug("[Screenshot] Reusing in-flight capture for",t),r;let n=TI(t,e).finally(()=>{Uy.delete(t)});return Uy.set(t,n),n}return TI(void 0,e)}async function TI(e,t){try{if(e){let r=await VG(e);if(r)return r}if(!DG()){let r=jG(t?.storyId);return await HG(r,{...t,selector:"#storybook-root > *"})}return w.info("[Screenshot] Using client-side capture (html2canvas fallback)"),await OG()}catch(r){throw w.error("Error capturing screenshot:",r),new Error(`Failed to capture screenshot: ${r instanceof Error?r.message:"Unknown error"}`)}}function WG(){return(new URLSearchParams(window.location.search).get("path")||"").replace("/story/","").replace("/docs/","")||void 0}var zG,Uy,jy=H(()=>{"use strict";Fe();gl();Ne();tt();$d();zG=q();Uy=new Map});import{useEffect as ha,useState as Ud,useRef as II,useCallback as Vy}from"react";import{addons as Wy}from"storybook/manager-api";async function GG(e,t,r){let n=`${e}:${t}`,o=Gy.get(n);if(o)return w.debug("[useReviewScreenshots] Reusing in-flight Figma image fetch for",n),o;let i=(async()=>{let a=await X(`${PI}/api/figma/image?projectId=${e}&nodeId=${t}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});return a.ok?a.json():{imageUrl:null}})().finally(()=>{Gy.delete(n)});return Gy.set(n,i),i}function qG(e,t,r){try{sessionStorage.setItem(`${jd}${e}`,JSON.stringify({figmaNodeId:t,imageUrl:r,timestamp:Date.now()}))}catch{}}function YG(e,t){try{let r=sessionStorage.getItem(`${jd}${e}`);if(!r)return null;let n=JSON.parse(r);if(n.figmaNodeId===t&&Date.now()-n.timestamp<1800*1e3)return n.imageUrl;sessionStorage.removeItem(`${jd}${e}`)}catch{}return null}function KG(e){try{let t=sessionStorage.getItem(`${jd}${e}`);if(!t)return null;let r=JSON.parse(t);if(r.imageUrl&&Date.now()-r.timestamp<300*1e3)return r.imageUrl}catch{}return null}var RI,AI,FI,MI,fl,PI,un,qy,Gy,jd,LI,_I,rs,gl=H(()=>{"use strict";Ce();jy();Ne();Fe();tt();RI="storyArgsUpdated",AI="storyRendered",FI="forceRemount",MI=null,fl=()=>MI,PI=q(),un=new Map,qy=null,Gy=new Map;jd="uicopilot-figma-image-";LI=(e,t,r)=>{let n=un.get(e);n?(n.storybookImageUrl=t,r&&(n.figmaImageUrl=r)):un.set(e,{storybookImageUrl:t,figmaImageUrl:r??null}),w.debug("[useReviewScreenshots] Populated historical screenshots for story:",e)},_I=(e,t,r)=>{qy=t;let n=un.get(e);n?n.figmaImageUrl=r:un.set(e,{storybookImageUrl:null,figmaImageUrl:r}),w.debug("[useReviewScreenshots] Pre-set Figma image for mapping:",{storyId:e,figmaNodeId:t,imageUrl:r.substring(0,50)+"..."})},rs=()=>{let[e,t]=Ud(!1),[r,n]=Ud(!1),[o,i]=Ud(!1),[a,s]=Ud(null),l=II(null),{screenshotRefreshKey:u,triggerScreenshotRefresh:c}=we(),d=Vy(()=>{let R=Tt.getState().currentStoryId;R&&(w.debug("[useReviewScreenshots] Refreshing screenshots for story:",R),un.delete(R),l.current=null,i(!0),c())},[c]),f=Vy(()=>{let R=Tt.getState().currentStoryId;if(R){w.debug("[useReviewScreenshots] Refreshing Storybook screenshot only for story:",R);let B=un.get(R);B&&(B.storybookImageUrl=null),l.current=null,i(!0),c()}},[c]),{sessionToken:p}=be(),{selectedProjectId:g}=Ge(),{currentStoryId:m,currentMapping:T,loadingMapping:S}=bt(),{setStorybookImageUrl:h,setFigmaImageUrl:M}=we(),z=II(null);ha(()=>{m&&z.current&&z.current!==m&&(w.debug("[useReviewScreenshots] Story switched, clearing images"),h(""),M("")),z.current=m},[m,h,M]),ha(()=>{!m||S||T||M("")},[m,T,S,M]),ha(()=>{if(!m)return;let R=KG(m);R&&(w.debug("[useReviewScreenshots] Quick-restored Figma image for:",m),M(R))},[m,M]),ha(()=>{if(!m||S)return;let R=T?.figmaFileUrl;if(R){w.debug("[useReviewScreenshots] Restoring Figma image from mapping.figmaFileUrl for:",m),M(R);let B=un.get(m);B?B.figmaImageUrl=R:un.set(m,{storybookImageUrl:null,figmaImageUrl:R})}},[m,T,S,M]),ha(()=>{let R=!1;return(async()=>{if(!p||!g||!m){w.debug("[useReviewScreenshots] Missing required context, skipping auto-load");return}l.current&&l.current!==m&&(w.debug("[useReviewScreenshots] Story changed, clearing stale screenshots"),h(""),M(""));let x=Tt.getState();if(l.current===m&&x.storybookImageUrl&&x.figmaImageUrl){w.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping capture");return}let v=T?.figmaNodeId??null;if(v!==qy){w.debug("[useReviewScreenshots] Figma mapping changed, invalidating Figma image only for story:",m);let P=un.get(m);P&&(P.figmaImageUrl=null),qy=v,l.current=null}let I=T?.figmaNodeId;if(I&&!un.get(m)?.figmaImageUrl){let P=YG(m,I);if(P){w.debug("[useReviewScreenshots] Hydrated Figma image from sessionStorage for story:",m),M(P);let F=un.get(m);F?F.figmaImageUrl=P:un.set(m,{storybookImageUrl:null,figmaImageUrl:P})}}let L=un.get(m),E=L&&L.storybookImageUrl&&L.figmaImageUrl,y=L&&L.storybookImageUrl&&!L.figmaImageUrl,C=L&&!L.storybookImageUrl&&L.figmaImageUrl;if(E){w.debug("[useReviewScreenshots] Using fully cached screenshots for story:",m),h(L.storybookImageUrl),M(L.figmaImageUrl),l.current=m;return}let b=y&&T?.figmaNodeId;b&&(w.debug("[useReviewScreenshots] Using cached Storybook, fetching new Figma for story:",m),h(L.storybookImageUrl));let A=C;if(A&&(w.debug("[useReviewScreenshots] Using cached Figma, recapturing Storybook for story:",m),M(L.figmaImageUrl)),l.current===m&&T?.figmaNodeId){w.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping");return}try{if(s(null),b?n(!0):(A||(t(!0),n(!0)),i(!0)),l.current=m,R)return;let P=A?L.figmaImageUrl:null,F;if(A)w.debug("[useReviewScreenshots] Figma cached (storybookOnlyRefresh), skipping fetch"),n(!1);else if(I){w.debug("[useReviewScreenshots] Found Figma node ID from mapping:",I);let k=null;try{w.debug("[useReviewScreenshots] Fetching Figma image (with caching)...");let N=await GG(g,I,p);k=N.imageUrl||null;let G=N.cached?"(cached)":"(fresh)";w.debug(`[useReviewScreenshots] Figma image fetched ${G}:`,k?"success":"not found")}catch(N){w.warn("[useReviewScreenshots] Failed to fetch Figma image:",N)}if(k)try{w.debug("[useReviewScreenshots] Fetching Figma image via proxy...");let N=`${PI}/api/proxy/image?url=${encodeURIComponent(k)}`,G=await X(N);if(G.ok){let _=await G.blob(),le=new FileReader,$=await new Promise((Q,ge)=>{le.onloadend=()=>Q(le.result),le.onerror=ge,le.readAsDataURL(_)});P=$,M($),w.debug("[useReviewScreenshots] Figma image loaded via proxy");let W=new Image;await new Promise(Q=>{W.onload=()=>{F={width:W.naturalWidth,height:W.naturalHeight},w.debug("[useReviewScreenshots] Figma dimensions:",F),Q()},W.onerror=()=>Q(),W.src=$})}else P=k,M(k),w.warn("[useReviewScreenshots] Proxy failed, using direct URL as fallback")}catch(N){w.warn("[useReviewScreenshots] Proxy error, using direct URL as fallback:",N),P=k,M(k)}else w.warn("[useReviewScreenshots] No thumbnail found for node:",I),M(null);P&&I&&qG(m,I,P),n(!1)}else w.debug("[useReviewScreenshots] No Figma mapping exists for this component"),M(null),n(!1);let D=L?.storybookImageUrl||null;if(D)w.debug("[useReviewScreenshots] Using cached Storybook screenshot"),i(!1);else{w.debug("[useReviewScreenshots] Capturing Storybook screenshot for story:",m);let k=await Hd({storyId:m,sessionToken:p||void 0,...F&&{figmaWidth:F.width,figmaHeight:F.height}});k&&!R?(D=k,h(k),w.debug("[useReviewScreenshots] Storybook screenshot captured at dimensions:",F||"natural")):w.warn("[useReviewScreenshots] Failed to capture Storybook screenshot"),i(!1)}un.set(m,{storybookImageUrl:D,figmaImageUrl:P}),w.debug("[useReviewScreenshots] Screenshots cached for story:",m)}catch(P){w.error("[useReviewScreenshots] Error loading screenshots:",P),s(P instanceof Error?P.message:"Failed to load screenshots"),l.current=null,n(!1),i(!1)}finally{t(!1)}})(),()=>{R=!0}},[p,g,m,T?.figmaNodeId,u]),ha(()=>{let R=Wy.getChannel(),B=null,x=v=>{MI=v.args,w.debug("[useReviewScreenshots] Args updated for story:",v.storyId,"args:",v.args),B&&clearTimeout(B),B=setTimeout(()=>{w.debug("[useReviewScreenshots] Story args changed, refreshing screenshot"),d()},500)};return R.on(RI,x),()=>{R.off(RI,x),B&&clearTimeout(B)}},[d]),ha(()=>{let R=Wy.getChannel(),B=!1,x=null,v=()=>{w.debug("[useReviewScreenshots] FORCE_REMOUNT detected, showing Storybook loader"),B=!0,i(!0)},I=()=>{B&&(w.debug("[useReviewScreenshots] STORY_RENDERED after remount, waiting for styles to settle..."),x&&clearTimeout(x),x=setTimeout(()=>{B=!1,w.debug("[useReviewScreenshots] Refreshing Storybook screenshot after HMR (preserving Figma)"),f()},500))};return R.on(FI,v),R.on(AI,I),()=>{R.off(FI,v),R.off(AI,I),x&&clearTimeout(x)}},[f]),ha(()=>{let R=Wy.getChannel(),B=async x=>{if(!x?.snapshot?.html){w.debug("[useReviewScreenshots] DOM mutated but no snapshot available");return}w.debug("[useReviewScreenshots] DOM mutated, capturing snapshot screenshot"),i(!0);try{let v=Tt.getState().currentStoryId,I=await fetch("/__uicopilot/screenshot-snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...x.snapshot,storyId:v})});if(I.ok){let L=await I.json();if(L.screenshot){h(L.screenshot);let E=Tt.getState().currentStoryId;if(E){let y=un.get(E);y?y.storybookImageUrl=L.screenshot:un.set(E,{storybookImageUrl:L.screenshot,figmaImageUrl:null})}}}else w.error("[useReviewScreenshots] Snapshot screenshot failed:",await I.text())}catch(v){w.error("[useReviewScreenshots] Snapshot screenshot error:",v)}finally{i(!1)}};return R.on("UICOPILOT/STORY_DOM_MUTATED",B),()=>{R.off("UICOPILOT/STORY_DOM_MUTATED",B)}},[]);let O=Vy((R,B,x)=>{w.debug("[useReviewScreenshots] setFigmaImageDirect called - bypassing load"),_I(R,B,x),M(x),n(!1),l.current=R},[M]);return{isLoadingScreenshots:e,isLoadingFigma:r,isLoadingStorybook:o,screenshotError:a,refreshScreenshots:d,refreshStorybookOnly:f,setFigmaImageDirect:O}}});function xn(e){if(e==="transparent"||e==="rgba(0, 0, 0, 0)")return"transparent";let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!t)return e;let[,r,n,o,i]=t,a=i?parseFloat(i):1;return a<1?`rgba(${r}, ${n}, ${o}, ${a})`:`#${[r,n,o].map(l=>parseInt(l).toString(16).padStart(2,"0")).join("")}`}function Dn(e,t){let n={backgroundColor:["transparent","rgba(0, 0, 0, 0)"],border:["none","0px none","0px none rgb(0, 0, 0)"],borderRadius:["0px"],boxShadow:["none"],opacity:["1"],gap:["normal","0px"],flexDirection:["row"],justifyContent:["normal","flex-start"],alignItems:["normal","stretch"],textAlign:["start","left"],letterSpacing:["normal","0px"],margin:["0px","0px 0px 0px 0px"],padding:["0px","0px 0px 0px 0px"]}[e];return n?n.includes(t):!1}function ru(e){return e.split(",").map(r=>r.trim().replace(/['"]/g,""))[0]||e}function u6(e){let t=e.ownerDocument,n=(t.defaultView||window).getComputedStyle(e);if("fonts"in t){let T=n.fontSize||"16px",S=n.fontWeight||"400";if(n.fontFamily.includes("Roboto")){let h=t.fonts.check(`${S} ${T} Roboto`);if(w.debug("[computedStyles] Roboto check:",{cssFamily:n.fontFamily,robotoLoaded:h,fontWeight:S,fontSize:T,isIframe:t!==document,fontStatus:Array.from(t.fonts).map(M=>({family:M.family,status:M.status}))}),h)return"Roboto"}}let o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",a=t.createElement("canvas").getContext("2d");if(!a)return"unknown";let s=n.fontSize,l=n.fontWeight,u=n.fontStyle,c=n.fontFamily.split(",").map(T=>T.trim().replace(/['"]/g,"")),d=["Arial","Helvetica","Helvetica Neue","Times New Roman","Georgia","Courier New","Verdana","Tahoma","Trebuchet MS","sans-serif","serif","monospace"],f=[...new Set([...c,...d])];a.font=`${u} ${l} ${s} monospace`;let p=a.measureText(o).width,g="unknown",m=new Map;for(let T of f){a.font=`${u} ${l} ${s} "${T}", monospace`;let S=a.measureText(o).width;if(m.set(T,S),S!==p){a.font=`${u} ${l} ${s} "${T}"`;let h=a.measureText(o).width;a.font=`${u} ${l} ${s} ${n.fontFamily}`;let M=a.measureText(o).width;if(Math.abs(h-M)<.1){g=T;break}}}return w.debug("[computedStyles] Font detection:",{declared:n.fontFamily,detected:g,declaredFonts:c,fontWidths:Array.from(m.entries()),isIframe:t!==document}),g}var nu=H(()=>{"use strict";Ne()});function yl(e,t){if(!t)return e;let r=t.split(" ").filter(i=>i.trim()),n=r.find(i=>!i.includes("--")),o=r.filter(i=>i.includes("--"));return n&&o.length>0?`${e}.${n}.${o[0]}`:n?`${e}.${n}`:r[0]?`${e}.${r[0]}`:e}function v5(e){let r=(e.ownerDocument.defaultView||window).getComputedStyle(e);return w.debug("[computedStyles] Extracting styles:",{fontFamily:r.fontFamily,fontWeight:r.fontWeight,borderRadius:r.borderRadius,backgroundColor:r.backgroundColor,padding:{top:r.paddingTop,right:r.paddingRight,bottom:r.paddingBottom,left:r.paddingLeft},isIframeContext:e.ownerDocument!==document}),{color:xn(r.color),backgroundColor:xn(r.backgroundColor),borderColor:xn(r.borderColor),padding:{top:r.paddingTop,right:r.paddingRight,bottom:r.paddingBottom,left:r.paddingLeft},margin:{top:r.marginTop,right:r.marginRight,bottom:r.marginBottom,left:r.marginLeft},gap:r.gap,fontFamily:r.fontFamily,renderedFont:u6(e),fontSize:r.fontSize,fontWeight:r.fontWeight,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,textAlign:r.textAlign,textTransform:r.textTransform,width:r.width,height:r.height,minWidth:r.minWidth,minHeight:r.minHeight,maxWidth:r.maxWidth,maxHeight:r.maxHeight,borderWidth:r.borderWidth,borderStyle:r.borderStyle,borderRadius:r.borderRadius,boxShadow:r.boxShadow,textShadow:r.textShadow,display:r.display,flexDirection:r.display==="flex"?r.flexDirection:void 0,justifyContent:r.display==="flex"?r.justifyContent:void 0,alignItems:r.display==="flex"?r.alignItems:void 0,position:r.position,opacity:r.opacity,cursor:r.cursor}}function S5(e,t){let r={width:null,height:null,minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,display:null,flexGrow:null,flexShrink:null,flexBasis:null};try{let n=Array.from(t.styleSheets);for(let i of n)try{let a=i.cssRules||i.rules;if(!a)continue;for(let s of Array.from(a))if(s.type===1){let l=s;try{if(e.matches(l.selectorText)){let u=l.style;u.width&&(r.width=u.width),u.height&&(r.height=u.height),u.minWidth&&(r.minWidth=u.minWidth),u.minHeight&&(r.minHeight=u.minHeight),u.maxWidth&&(r.maxWidth=u.maxWidth),u.maxHeight&&(r.maxHeight=u.maxHeight),u.display&&(r.display=u.display),u.flexGrow&&(r.flexGrow=u.flexGrow),u.flexShrink&&(r.flexShrink=u.flexShrink),u.flexBasis&&(r.flexBasis=u.flexBasis)}}catch{continue}}}catch{continue}let o=e.style;o.width&&(r.width=o.width),o.height&&(r.height=o.height),o.minWidth&&(r.minWidth=o.minWidth),o.minHeight&&(r.minHeight=o.minHeight),o.maxWidth&&(r.maxWidth=o.maxWidth),o.maxHeight&&(r.maxHeight=o.maxHeight),o.display&&(r.display=o.display),o.flexGrow&&(r.flexGrow=o.flexGrow),o.flexShrink&&(r.flexShrink=o.flexShrink),o.flexBasis&&(r.flexBasis=o.flexBasis)}catch(n){w.error("Error extracting declared styles:",n)}return r}var of=H(()=>{"use strict";Ne();nu()});function IK(e){let t=[],r=new Set,n=p6.join(", "),o=e.querySelectorAll(n);for(let i of Array.from(o)){let a=`${i.tagName.toLowerCase()}.${i.className}`;r.has(a)||(r.add(a),t.push(i))}if(p6.includes(e.tagName.toLowerCase())){let i=`${e.tagName.toLowerCase()}.${e.className}`;r.has(i)||t.unshift(e)}return t}function RK(e){let r=(e.ownerDocument.defaultView||window).getComputedStyle(e),n=e.tagName.toLowerCase(),o=e.className,i=typeof o=="string"?o:o?.baseVal||"";return{selector:yl(n,i),tagName:n,className:i,styles:{fontSize:r.fontSize,fontFamily:ru(r.fontFamily),fontWeight:r.fontWeight,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,color:xn(r.color),textAlign:r.textAlign,textTransform:r.textTransform}}}function AK(e,t=2){let r=[e],n=new Set,o=a=>{let s=a.className;return typeof s=="string"?s:s?.baseVal||""};n.add(`${e.tagName}.${o(e)}`);function i(a,s){if(s>=t)return;let l=Array.from(a.children);for(let u of l){let c=u.tagName.toLowerCase();if(["script","style","link","meta","br","hr"].includes(c))continue;let d=`${u.tagName}.${o(u)}`;n.has(d)||(n.add(d),r.push(u),i(u,s+1))}}return i(e,0),r}function FK(e){let r=(e.ownerDocument.defaultView||window).getComputedStyle(e),n=e.tagName.toLowerCase(),o=e.className,i=typeof o=="string"?o:o?.baseVal||"",a=r.borderWidth!=="0px",s=r.backgroundColor!=="transparent"&&r.backgroundColor!=="rgba(0, 0, 0, 0)",l=r.borderRadius!=="0px",u=r.gap!=="normal"&&r.gap!=="0px";if(!a&&!s&&!l&&!u)return null;let c=r.borderWidth,d=r.borderStyle,f=xn(r.borderColor),p=a?`${c} ${d} ${f}`:"none";return{selector:yl(n,i),className:i,border:p,borderRadius:r.borderRadius,backgroundColor:xn(r.backgroundColor),gap:r.gap}}function ou(){w.debug("[computedStyles] extractStoryStyles called - FULL CONTEXT VERSION");try{let e=document.getElementById("storybook-preview-iframe");if(!e||!e.contentDocument)throw new Error("Storybook preview iframe not found");let t=e.contentDocument,r=t.getElementById("storybook-root");if(!r)throw new Error("Story root element not found");let n=r.firstElementChild;if(!n)throw new Error("Component element not found in story root");let o=AK(n,2),i=o.map(FK).filter(s=>s!==null);w.debug("[computedStyles] Extracted visual styles from nested elements:",{total:o.length,withVisuals:i.length,elements:i.map(s=>({selector:s.selector,border:s.border,background:s.backgroundColor,borderRadius:s.borderRadius}))});let a=[];try{let s=IK(n);a=s.map(RK),w.debug("[computedStyles] Text elements found:",{count:s.length,elements:a.map(l=>({selector:l.selector,fontSize:l.styles.fontSize,fontWeight:l.styles.fontWeight}))})}catch(s){w.error("[computedStyles] Error extracting text elements:",s)}return{computed:v5(n),declared:S5(n,t),markup:n.outerHTML,textElementStyles:a,nestedElementStyles:i}}catch(e){return w.error("Error extracting computed styles:",e),null}}var p6,d6=H(()=>{"use strict";Ne();nu();of();p6=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});function k5(e,t,r,n){return e===t&&t===r&&r===n?e:e===r&&t===n?`${e} ${t}`:t===n?`${e} ${t} ${r}`:`${e} ${t} ${r} ${n}`}function PK(e,t,r){if(!(e==="0px"||t==="none"))return`${e} ${t} ${r}`}function LK(e){let r=(e.ownerDocument.defaultView||window).getComputedStyle(e),n={},o=xn(r.backgroundColor);Dn("backgroundColor",o)||(n.backgroundColor=o);let i=PK(r.borderWidth,r.borderStyle,xn(r.borderColor));i&&(n.border=i),Dn("borderRadius",r.borderRadius)||(n.borderRadius=r.borderRadius),Dn("boxShadow",r.boxShadow)||(n.boxShadow=r.boxShadow),Dn("opacity",r.opacity)||(n.opacity=r.opacity);let a=e.tagName.toLowerCase(),s=["svg","circle","rect","ellipse","line","polyline","polygon","path","text","tspan","g","use","defs","clipPath","mask"];if(e instanceof SVGElement||s.includes(a)){for(let T=0;T<e.attributes.length;T++){let S=e.attributes[T];if(["class","style","id","xmlns","xmlns:xlink"].includes(S.name))continue;let h=S.name.replace(/-([a-z])/g,(z,O)=>O.toUpperCase()),M=S.value.startsWith("rgb")?xn(S.value):S.value;h==="d"&&M.length>100?n[h]=M.substring(0,100)+"...":n[h]=M}let p=r.getPropertyValue("fill"),g=r.getPropertyValue("stroke");if(p&&p!=="none"&&(n.fill=p.startsWith("rgb")?xn(p):p),g&&g!=="none"&&(n.stroke=g.startsWith("rgb")?xn(g):g),["circle","ellipse","rect","path","line","polyline","polygon"].includes(a)){let T=e.getBoundingClientRect();T.width>0&&(n.width=`${Math.round(T.width*100)/100}px`),T.height>0&&(n.height=`${Math.round(T.height*100)/100}px`)}}let u=e.textContent&&e.textContent.trim().length>0,c=MK.includes(e.tagName.toLowerCase());(u||c)&&(n.fontSize=r.fontSize,n.fontFamily=ru(r.fontFamily),n.fontWeight=r.fontWeight,n.lineHeight=r.lineHeight,n.color=xn(r.color),Dn("letterSpacing",r.letterSpacing)||(n.letterSpacing=r.letterSpacing),Dn("textAlign",r.textAlign)||(n.textAlign=r.textAlign)),n.display=r.display;let d=k5(r.paddingTop,r.paddingRight,r.paddingBottom,r.paddingLeft);Dn("padding",d)||(n.padding=d);let f=k5(r.marginTop,r.marginRight,r.marginBottom,r.marginLeft);return Dn("margin",f)||(n.margin=f),Dn("gap",r.gap)||(n.gap=r.gap),(r.display==="flex"||r.display==="inline-flex")&&(Dn("flexDirection",r.flexDirection)||(n.flexDirection=r.flexDirection),Dn("justifyContent",r.justifyContent)||(n.justifyContent=r.justifyContent),Dn("alignItems",r.alignItems)||(n.alignItems=r.alignItems)),n.width||(n.width=r.width),n.height||(n.height=r.height),n}function f6(e){let t=1;for(let r of e.children)t+=f6(r);return t}function af(e,t=4){function r(o,i){let a=o.tagName.toLowerCase(),s=o.className,l=typeof s=="string"?s:s?.baseVal||"",u=o.id||void 0,c=o.getAttribute("role")||void 0,d;for(let m of Array.from(o.childNodes))if(m.nodeType===Node.TEXT_NODE){let T=m.textContent?.trim();if(T){d=T.length>50?T.substring(0,50)+"...":T;break}}let f=a;u?f=`${a}#${u}`:l&&(f=yl(a,l));let p=LK(o),g=[];if(i<t){let m=Array.from(o.children);for(let T of m){let S=T.tagName.toLowerCase();if(["script","style","link","meta","br","hr","noscript"].includes(S))continue;let M=(T.ownerDocument.defaultView||window).getComputedStyle(T);M.display==="none"||M.visibility==="hidden"||g.push(r(T,i+1))}}return{selector:f,tagName:a,className:l,id:u,role:c,textContent:d,styles:p,children:g}}w.debug("[computedStyles] Extracting DOM tree with maxDepth:",t);let n=r(e,0);return w.debug("[computedStyles] DOM tree extracted:",{rootSelector:n.selector,childrenCount:n.children.length,totalNodes:f6(n)}),n}function iu(e=4){w.debug("[extractStoryDOMTree] Starting DOM tree extraction...");try{let t=document.getElementById("storybook-preview-iframe");if(w.debug("[extractStoryDOMTree] iframe found:",!!t),!t)throw new Error("Storybook preview iframe not found");if(w.debug("[extractStoryDOMTree] iframe.contentDocument:",!!t.contentDocument),!t.contentDocument)throw new Error("iframe.contentDocument is not accessible (possible cross-origin issue)");let r=t.contentDocument.getElementById("storybook-root");if(w.debug("[extractStoryDOMTree] storyRoot found:",!!r),!r)throw new Error("Story root element not found");let n=dl(r);if(w.debug("[extractStoryDOMTree] componentElement found:",!!n,n?.tagName),!n)throw new Error("Component element not found in story root");let o=af(n,e);return w.debug("[extractStoryDOMTree] DOM tree extracted successfully:",{selector:o.selector,childrenCount:o.children.length}),o}catch(t){return w.error("[extractStoryDOMTree] Error extracting DOM tree:",t),null}}var MK,g6=H(()=>{"use strict";Ne();nu();of();$d();MK=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});var au=H(()=>{"use strict";nu();of();d6();g6()});var y7=oo((vSe,x7)=>{"use strict";x7.exports={compareTwoStrings:h7,findBestMatch:wJ};function h7(e,t){if(e=e.replace(/\s+/g,""),t=t.replace(/\s+/g,""),e===t)return 1;if(e.length<2||t.length<2)return 0;let r=new Map;for(let o=0;o<e.length-1;o++){let i=e.substring(o,o+2),a=r.has(i)?r.get(i)+1:1;r.set(i,a)}let n=0;for(let o=0;o<t.length-1;o++){let i=t.substring(o,o+2),a=r.has(i)?r.get(i):0;a>0&&(r.set(i,a-1),n++)}return 2*n/(e.length+t.length-2)}function wJ(e,t){if(!vJ(e,t))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");let r=[],n=0;for(let i=0;i<t.length;i++){let a=t[i],s=h7(e,a);r.push({target:a,rating:s}),s>r[n].rating&&(n=i)}let o=r[n];return{ratings:r,bestMatch:o,bestMatchIndex:n}}function vJ(e,t){return!(typeof e!="string"||!Array.isArray(t)||!t.length||t.find(function(r){return typeof r!="string"}))}});var OF=oo((vAe,NF)=>{"use strict";var _F=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ure=/\n/g,jre=/^\s*/,Vre=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Wre=/^:\s*/,Gre=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,qre=/^[;\s]*/,Yre=/^\s+|\s+$/g,Kre=`
14
14
  `,BF="/",zF="*",ys="",Xre="comment",Jre="declaration";function Qre(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function o(g){var m=g.match(Ure);m&&(r+=m.length);var T=g.lastIndexOf(Kre);n=~T?g.length-T:n+g.length}function i(){var g={line:r,column:n};return function(m){return m.position=new a(g),u(),m}}function a(g){this.start=g,this.end={line:r,column:n},this.source=t.source}a.prototype.content=e;function s(g){var m=new Error(t.source+":"+r+":"+n+": "+g);if(m.reason=g,m.filename=t.source,m.line=r,m.column=n,m.source=e,!t.silent)throw m}function l(g){var m=g.exec(e);if(m){var T=m[0];return o(T),e=e.slice(T.length),m}}function u(){l(jre)}function c(g){var m;for(g=g||[];m=d();)m!==!1&&g.push(m);return g}function d(){var g=i();if(!(BF!=e.charAt(0)||zF!=e.charAt(1))){for(var m=2;ys!=e.charAt(m)&&(zF!=e.charAt(m)||BF!=e.charAt(m+1));)++m;if(m+=2,ys===e.charAt(m-1))return s("End of comment missing");var T=e.slice(2,m-2);return n+=2,o(T),e=e.slice(m),n+=2,g({type:Xre,comment:T})}}function f(){var g=i(),m=l(Vre);if(m){if(d(),!l(Wre))return s("property missing ':'");var T=l(Gre),S=g({type:Jre,property:DF(m[0].replace(_F,ys)),value:T?DF(T[0].replace(_F,ys)):ys});return l(qre),S}}function p(){var g=[];c(g);for(var m;m=f();)m!==!1&&(g.push(m),c(g));return g}return u(),p()}function DF(e){return e?e.replace(Yre,ys):ys}NF.exports=Qre});var $F=oo(Nu=>{"use strict";var Zre=Nu&&Nu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.default=tne;var ene=Zre(OF());function tne(e,t){let r=null;if(!e||typeof e!="string")return r;let n=(0,ene.default)(e),o=typeof t=="function";return n.forEach(i=>{if(i.type!=="declaration")return;let{property:a,value:s}=i;o?t(a,s,i):s&&(r=r||{},r[a]=s)}),r}});var UF=oo(yg=>{"use strict";Object.defineProperty(yg,"__esModule",{value:!0});yg.camelCase=void 0;var rne=/^--[a-zA-Z0-9_-]+$/,nne=/-([a-z])/g,one=/^[^-]+$/,ine=/^-(webkit|moz|ms|o|khtml)-/,ane=/^-(ms)-/,sne=function(e){return!e||one.test(e)||rne.test(e)},lne=function(e,t){return t.toUpperCase()},HF=function(e,t){return"".concat(t,"-")},cne=function(e,t){return t===void 0&&(t={}),sne(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ane,HF):e=e.replace(ine,HF),e.replace(nne,lne))};yg.camelCase=cne});var VF=oo((kw,jF)=>{"use strict";var une=kw&&kw.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},pne=une($F()),dne=UF();function Sw(e,t){var r={};return!e||typeof e!="string"||(0,pne.default)(e,function(n,o){n&&o&&(r[(0,dne.camelCase)(n,t)]=o)}),r}Sw.default=Sw;jF.exports=Sw});var xP=oo((X9e,hP)=>{"use strict";var Hg=Object.prototype.hasOwnProperty,mP=Object.prototype.toString,cP=Object.defineProperty,uP=Object.getOwnPropertyDescriptor,pP=function(t){return typeof Array.isArray=="function"?Array.isArray(t):mP.call(t)==="[object Array]"},dP=function(t){if(!t||mP.call(t)!=="[object Object]")return!1;var r=Hg.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&Hg.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var o;for(o in t);return typeof o>"u"||Hg.call(t,o)},fP=function(t,r){cP&&r.name==="__proto__"?cP(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},gP=function(t,r){if(r==="__proto__")if(Hg.call(t,r)){if(uP)return uP(t,r).value}else return;return t[r]};hP.exports=function e(){var t,r,n,o,i,a,s=arguments[0],l=1,u=arguments.length,c=!1;for(typeof s=="boolean"&&(c=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<u;++l)if(t=arguments[l],t!=null)for(r in t)n=gP(s,r),o=gP(t,r),s!==o&&(c&&o&&(dP(o)||(i=pP(o)))?(i?(i=!1,a=n&&pP(n)?n:[]):a=n&&dP(n)?n:{},fP(s,{name:r,newValue:e(c,a,o)})):typeof o<"u"&&fP(s,{name:r,newValue:o}));return s}});import to from"react";import{addons as Rp,types as Gm,experimental_getStatusStore as OS}from"storybook/manager-api";import{AddonPanel as AD}from"storybook/internal/components";import{styled as MD}from"storybook/theming";import{styled as ur}from"storybook/theming";var j="#ea580c",Qo="#c2410c",qm="#ff6b35",$S="#A259FF",HS="#8a3de8",US=j,jS="#d1d5db",Ii="#7c3aed",ee={red:"#ef4444",amber:"#f59e0b",green:"#16a34a",linked:"#9ca3af",redText:"#b91c1c",amberText:"#b45309",greenText:"#16a34a",criticalRail:"#dc2626",criticalLabel:"#dc2626",majorLabel:"#f59e0b",minorLabel:"#f59e0b",minorRail:"#fbbf24"},VS="#c4b5fd",Ym="#ffffff",Ri={darkBg:"#1e293b",lightBg:"#f8fafc",darkText:"#e2e8f0",lightText:"#1e293b"},Zo={highText:ee.green,mediumText:"#ca8a04",lowText:ee.criticalRail,highBg:"#dcfce7",mediumBg:"#fef9c3",lowBg:"#fee2e2"},ja={programmaticBg:"#4b5563",aiBg:"#0369a1",userBg:Ii,text:Ym},WS={color:{text:"#1d4ed8",bg:"rgba(59, 130, 246, 0.1)",border:"rgba(59, 130, 246, 0.25)"},spacing:{text:"#c2410c",bg:"rgba(249, 115, 22, 0.1)",border:"rgba(249, 115, 22, 0.25)"},typography:{text:"#be185d",bg:"rgba(236, 72, 153, 0.1)",border:"rgba(236, 72, 153, 0.25)"},border:{text:"#047857",bg:"rgba(16, 185, 129, 0.1)",border:"rgba(16, 185, 129, 0.25)"},layout:{text:"#0f766e",bg:"rgba(20, 184, 166, 0.1)",border:"rgba(20, 184, 166, 0.25)"},sizing:{text:"#6d28d9",bg:"rgba(139, 92, 246, 0.1)",border:"rgba(139, 92, 246, 0.25)"}},Km={spec:"#c2410c",ai:"#6d28d9"},J={card:"#ffffff",green:"#10b981",border:"#e5e7eb",track:"#f1f5f9",muted:"#6b7280",locked:"#9ca3af",text:"#111827",subText:"#374151",formBg:"#fafafa",lockedBtnBg:"#f3f4f6",calloutBg:"#fffbeb",calloutText:"#b45309",accentTint:"#fff7ed"},Va={snapshotBg:"#ede9fe",snapshotText:"#6d28d9",infoBg:"#eff6ff",infoText:"#1d4ed8",dropBg:"#fafafa",dropBgHover:"#f3f4f6"},Wa={pillBg:"#fff7ed",pillBorder:"#f5d0b5",iconFrom:"#d97706",iconTo:Qo,badgeBg:"#fef3c7",badgeText:"#92400e"},js={bgIdle:"#f1f5f9",bgActive:"#eff6ff",iconIdle:"#94a3b8",iconActive:"#3b82f6"};var GS=ur.div(({theme:e})=>({fontFamily:e.typography.fonts.base,height:"100%",display:"flex",flexDirection:"column",backgroundColor:e.background.content,color:e.color.defaultText})),qS=ur.div(({theme:e})=>({flex:1,overflow:"auto",padding:"6px 12px 12px",backgroundColor:e.background.app})),Lp=ur.div({marginBottom:"20px"}),_p=ur.label(({theme:e})=>({display:"block",marginBottom:`${e.layoutMargin*.6}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),pc=ur.input(({theme:e})=>({width:"100%",padding:`${e.layoutMargin*.8}px ${e.layoutMargin}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius*2,backgroundColor:e.input.background,color:e.color.defaultText,"&:focus":{outline:"none",borderColor:e.color.secondary,boxShadow:`0 0 0 2px ${e.color.secondary}20`}})),Rn=ur.select(({theme:e})=>({width:"100%",padding:`${e.layoutMargin*.8}px 32px ${e.layoutMargin*.8}px ${e.layoutMargin}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius*2,backgroundColor:e.input.background,color:e.color.defaultText,cursor:"pointer",appearance:"none",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center",backgroundSize:"12px",transition:"border-color 0.15s, box-shadow 0.15s","&:focus":{outline:"none",borderColor:e.color.secondary,boxShadow:`0 0 0 2px ${e.color.secondary}20`},"&:hover":{borderColor:e.color.mediumdark},"&:disabled":{opacity:.6,cursor:"not-allowed"}})),YS=ur(Rn)(({theme:e})=>({width:"auto",padding:`${e.layoutMargin*.6}px 28px ${e.layoutMargin*.6}px ${e.layoutMargin}px`,fontSize:e.typography.size.s1})),Bp=e=>({padding:`${e.layoutMargin*.8}px ${e.layoutMargin*1.6}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,border:"none",borderRadius:e.appBorderRadius*2,cursor:"pointer",transition:"all 0.15s","&:disabled":{opacity:.5,cursor:"not-allowed"}}),Ai=ur.button(({theme:e})=>({...Bp(e),backgroundColor:e.color.secondary,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),lr=ur.button(({theme:e})=>({...Bp(e),backgroundColor:j,color:e.color.inverseText,boxShadow:`0 2px 4px ${j}4d`,"&:hover:not(:disabled)":{backgroundColor:Qo,transform:"translateY(-1px)",boxShadow:`0 4px 8px ${j}66`}})),ei=ur.button(({theme:e})=>({...Bp(e),backgroundColor:"transparent",border:`1px solid ${e.appBorderColor}`,color:e.color.defaultText,"&:hover:not(:disabled)":{backgroundColor:e.background.hoverable}})),KS=ur.button(({theme:e})=>({...Bp(e),backgroundColor:e.color.negative,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Wn=ur.button(({theme:e})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:`${e.layoutMargin*.4}px`,fontSize:e.typography.size.s2,color:e.color.mediumdark,backgroundColor:"transparent",border:"none",borderRadius:e.appBorderRadius,cursor:"pointer",transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),Xm=ur.button(({theme:e})=>({padding:0,fontSize:e.typography.size.s1,fontFamily:e.typography.fonts.base,color:e.color.secondary,backgroundColor:"transparent",border:"none",cursor:"pointer",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),sa=ur.button(({theme:e,active:t})=>({padding:`${e.layoutMargin*.6}px ${e.layoutMargin*1.2}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:t?e.typography.weight.bold:400,color:t?e.color.secondary:e.color.mediumdark,backgroundColor:"transparent",border:"none",borderBottom:t?`2px solid ${e.color.secondary}`:"2px solid transparent",cursor:"pointer",transition:"all 0.15s","&:hover":{color:t?e.color.secondary:e.color.defaultText}})),la=ur(pc)(({theme:e})=>({paddingLeft:`${e.layoutMargin*3}px`,backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:`${e.layoutMargin}px center`,backgroundSize:"14px"})),rge=ur.div(({theme:e})=>({padding:`${e.layoutMargin*1.6}px`,borderRadius:e.appBorderRadius*2.5,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),XS=ur.h2(({theme:e})=>({margin:`0 0 ${e.layoutMargin*1.6}px`,fontSize:e.typography.size.s3,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),nge=ur.h3(({theme:e})=>({margin:`0 0 ${e.layoutMargin*1.2}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),Jm=ur.p(({theme:e})=>({margin:`0 0 ${e.layoutMargin*.8}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,color:e.color.defaultText,lineHeight:1.5})),oge=ur.div(({theme:e,width:t="100%",height:r="40px"})=>({width:t,height:r,backgroundColor:e.background.hoverable,borderRadius:e.appBorderRadius,position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",top:0,left:0,width:"100%",height:"100%",background:`linear-gradient(90deg, transparent, ${e.color.mediumlight}33, transparent)`,animation:"shimmer 1.5s infinite"},"@keyframes shimmer":{"0%":{transform:"translateX(-100%)"},"100%":{transform:"translateX(100%)"}}})),JS=ur.span(({theme:e,variant:t="default"})=>{let r={default:{bg:e.background.hoverable,color:e.color.defaultText},success:{bg:`${e.color.positive}40`,color:e.color.positive},warning:{bg:`${e.color.warning}40`,color:e.color.warning},error:{bg:`${e.color.negative}40`,color:e.color.negative}};return{display:"inline-block",padding:"2px 8px",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,borderRadius:"3px",backgroundColor:r[t].bg,color:r[t].color}}),ige=ur.div(({theme:e})=>({padding:"40px 20px",textAlign:"center",color:e.color.mediumdark})),age=ur.div(({theme:e})=>({fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,marginBottom:`${e.layoutMargin*.8}px`,color:e.color.defaultText})),sge=ur.div(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.mediumdark}));import mt,{useState as zce,useEffect as p2}from"react";import{styled as wn}from"storybook/theming";import QS from"react";var Qm=({header:e,children:t,footer:r})=>QS.createElement(GS,null,e,QS.createElement(qS,null,t),r);import OD from"react";import{styled as $D}from"storybook/theming";var HD=$D.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:"6px 12px",borderBottom:`1px solid ${e.appBorderColor}`,position:"sticky",top:0,zIndex:100,backgroundColor:e.background.content})),Zm=({toolbar:e})=>OD.createElement(HD,null,e);import xge from"react";import{styled as zp}from"storybook/theming";var wge=zp.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",borderBottom:`1px solid ${e.appBorderColor}`,position:"sticky",top:0,zIndex:100,backgroundColor:e.background.content})),vge=zp.div({display:"flex",flex:1}),Sge=zp(sa)(({theme:e,disabled:t})=>({padding:"6px 12px",...t?{color:e.color.mediumlight,cursor:"not-allowed",opacity:.5,"&:hover":{}}:{}})),kge=zp.div({display:"flex",gap:"8px",alignItems:"center"});import kt,{useState as du,useCallback as L5,useEffect as xf,useRef as FX}from"react";import{styled as Ar}from"storybook/theming";import Ie from"react";var ZS=()=>Ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Ie.createElement("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),Ie.createElement("circle",{cx:"12",cy:"12",r:"3"})),dc=()=>Ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Ie.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),Ie.createElement("circle",{cx:"12",cy:"7",r:"4"})),Gn={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"},fc=()=>Ie.createElement("svg",{...Gn},Ie.createElement("circle",{cx:"11",cy:"11",r:"8"}),Ie.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),ek=()=>Ie.createElement("svg",{...Gn},Ie.createElement("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.71 1.71"}),Ie.createElement("path",{d:"M5.17 11.75l-1.71 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),Ie.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),Ie.createElement("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),Ie.createElement("line",{x1:"16",y1:"22",x2:"16",y2:"19"}),Ie.createElement("line",{x1:"22",y1:"16",x2:"19",y2:"16"})),tk=()=>Ie.createElement("svg",{...Gn},Ie.createElement("polyline",{points:"23 4 23 10 17 10"}),Ie.createElement("polyline",{points:"1 20 1 14 7 14"}),Ie.createElement("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"}));var e0=()=>Ie.createElement("svg",{...Gn},Ie.createElement("circle",{cx:"12",cy:"12",r:"3"}),Ie.createElement("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})),Dp=()=>Ie.createElement("svg",{...Gn},Ie.createElement("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"}),Ie.createElement("path",{d:"M19 14l.7 1.9L21.6 17l-1.9.7L19 19.6l-.7-1.9L16.4 17l1.9-.7L19 14z"})),rk=()=>Ie.createElement("svg",{...Gn},Ie.createElement("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),Ie.createElement("polyline",{points:"12 5 19 12 12 19"})),nk=()=>Ie.createElement("svg",{...Gn},Ie.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),Ie.createElement("polyline",{points:"17 8 12 3 7 8"}),Ie.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),ok=()=>Ie.createElement("svg",{...Gn},Ie.createElement("path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72Z"}),Ie.createElement("path",{d:"m14 7 3 3"}),Ie.createElement("path",{d:"M5 6v4"}),Ie.createElement("path",{d:"M19 14v4"}),Ie.createElement("path",{d:"M10 2v2"}),Ie.createElement("path",{d:"M7 8H3"}),Ie.createElement("path",{d:"M21 16h-4"}),Ie.createElement("path",{d:"M11 3H9"})),ik=()=>Ie.createElement("svg",{...Gn},Ie.createElement("polyline",{points:"6 9 12 15 18 9"})),ak=()=>Ie.createElement("svg",{...Gn},Ie.createElement("polyline",{points:"20 6 9 17 4 12"})),sk=()=>Ie.createElement("svg",{...Gn},Ie.createElement("path",{d:"M7 10v12"}),Ie.createElement("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})),lk=()=>Ie.createElement("svg",{...Gn},Ie.createElement("path",{d:"M3 3v5h5"}),Ie.createElement("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 8"}),Ie.createElement("path",{d:"M12 7v5l4 2"})),t0=()=>Ie.createElement("svg",{...Gn},Ie.createElement("path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5a2 2 0 0 0 2 2h1"}),Ie.createElement("path",{d:"M16 3h1a2 2 0 0 1 2 2v5a2 2 0 0 0 2 2 2 2 0 0 0-2 2v5a2 2 0 0 1-2 2h-1"})),Fi=()=>Ie.createElement("svg",{width:"10",height:"15",viewBox:"0 0 38 57","aria-label":"Figma",role:"img"},Ie.createElement("path",{fill:"#1abcfe",d:"M19 28.5a9.5 9.5 0 1 1 19 0 9.5 9.5 0 0 1-19 0z"}),Ie.createElement("path",{fill:"#0acf83",d:"M0 47.5A9.5 9.5 0 0 1 9.5 38H19v9.5a9.5 9.5 0 1 1-19 0z"}),Ie.createElement("path",{fill:"#ff7262",d:"M19 0v19h9.5a9.5 9.5 0 1 0 0-19H19z"}),Ie.createElement("path",{fill:"#f24e1e",d:"M0 9.5A9.5 9.5 0 0 0 9.5 19H19V0H9.5A9.5 9.5 0 0 0 0 9.5z"}),Ie.createElement("path",{fill:"#a259ff",d:"M0 28.5A9.5 9.5 0 0 0 9.5 38H19V19H9.5A9.5 9.5 0 0 0 0 28.5z"})),r0=()=>Ie.createElement("svg",{width:"13",height:"13",viewBox:"0 0 64 64","aria-label":"Storybook",role:"img"},Ie.createElement("path",{fill:"#ff4785",d:"M8 4l1.5 56L56 62l2-58z"}),Ie.createElement("path",{fill:"#fff",d:"M40.5 18.2c-.2 1.5-3.6 2.4-7.6 2.1-4-.3-7-1.6-6.9-3.1.1-1.4 2.4-2 5.3-2 .8 0 1.2-.4 1.2-1.1 0-1.6-3.6-2.6-7-2.6-7 0-10.6 3.8-10.6 7.6 0 6.6 8.9 7 11.4 7.2 5.5.4 6.9 1.5 6.9 3 0 1.6-2.1 2.6-5 2.6-3.8 0-5.6-1.4-5.7-3.1 0-.6-.4-1-1-1l-3.5.1c-.6 0-1 .4-1 1 .2 4.7 4.3 7.6 11.3 7.6 6.7 0 11.2-3.1 11.2-7.6 0-5.7-5-7-11.1-7.5-4.2-.3-6.5-.6-6.5-2 0-1 1.8-1.8 4.4-1.8 2.5 0 4.2.6 4.4 1.7.1.6.5 1 1.1 1l3.5-.1c.6-.1 1-.5 1-1.1z"}));import ze,{useEffect as JT}from"react";import{styled as It}from"storybook/theming";Ce();Fe();Ne();tt();var QT=It.div({position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4}),ZT=It.div(({theme:e})=>({position:"absolute",top:"100%",right:0,marginTop:"8px",backgroundColor:e.background.content,borderRadius:"12px",width:"360px",maxWidth:"90vw",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",zIndex:10001})),DW=It.div({display:"flex",alignItems:"center",gap:"12px",padding:"16px 16px 12px"}),NW=It.div({width:"36px",height:"36px",borderRadius:"50%",backgroundColor:j,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",fontWeight:700,flexShrink:0}),OW=It.div({display:"flex",flexDirection:"column",gap:"4px"}),$W=It.div(({theme:e})=>({fontSize:"15px",fontWeight:600,color:e.color.defaultText,lineHeight:1.2})),HW=It.span({display:"inline-block",alignSelf:"flex-start",padding:"2px 10px",borderRadius:"6px",fontSize:"11px",fontWeight:600,color:"#7c3aed",backgroundColor:"rgba(124, 58, 237, 0.1)",letterSpacing:"0.3px"}),UW=It.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px 8px",fontSize:"14px",color:e.color.defaultText})),jW=It.span(({theme:e})=>({color:e.textMutedColor,fontSize:"13px"})),VW=It.span(({theme:e})=>({color:e.color.defaultText,fontSize:"15px",fontWeight:600})),WW=It.div(({theme:e})=>({height:"8px",borderRadius:"4px",backgroundColor:e.base==="dark"?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.08)",margin:"0 16px 8px",overflow:"hidden"})),GW=It.div(({percent:e})=>({height:"100%",width:`${Math.min(100,Math.max(0,e))}%`,background:`linear-gradient(90deg, #f59e0b 0%, ${j} 100%)`,transition:"width 0.3s ease"})),qW=It.div(({theme:e})=>({padding:"0 16px 14px",fontSize:"12px",color:e.textMutedColor})),YW=It.div(({theme:e})=>({height:"1px",backgroundColor:e.appBorderColor})),KW=It.button({width:"100%",padding:"14px 16px",background:"transparent",border:"none",color:j,fontSize:"14px",fontWeight:500,textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.03)"}}),eI=It.button(({theme:e})=>({position:"absolute",top:"12px",right:"12px",width:"24px",height:"24px",borderRadius:"4px",border:"none",background:"transparent",color:e.textMutedColor,cursor:"pointer",fontSize:"16px",display:"flex",alignItems:"center",justifyContent:"center","&:hover":{backgroundColor:e.background.hoverable}})),XW=It.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:`1px solid ${e.appBorderColor}`})),JW=It.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",color:e.color.defaultText,fontSize:"14px",fontWeight:500})),QW=It.div(({theme:e})=>({width:"32px",height:"32px",borderRadius:"50%",backgroundColor:j,display:"flex",alignItems:"center",justifyContent:"center",color:e.color.inverseText,fontSize:"14px",fontWeight:600})),ZW=It.div({display:"flex",gap:"8px"}),tI=It(Wn)({fontSize:"18px"}),eG=It.div({padding:"20px 16px"}),tG=It.div(({theme:e})=>({padding:"16px",borderRadius:"8px",background:"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",marginBottom:"16px",color:"#fff"})),rG=It.div({fontSize:"12px",fontWeight:500,opacity:.9,marginBottom:"4px"}),nG=It.div({fontSize:"28px",fontWeight:700}),oG=It.div({fontSize:"11px",opacity:.8,marginTop:"4px"}),iG=It.div(({theme:e})=>({padding:"16px",borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),aG=It.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),sG=It.div({display:"flex",alignItems:"center",gap:"8px"}),lG=It.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),cG=It.span(({theme:e})=>({fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",backgroundColor:j,color:e.color.inverseText})),uG=It.button(({theme:e})=>({background:"none",border:"none",color:j,fontSize:"12px",cursor:"pointer","&:hover":{textDecoration:"underline"}})),pG=It.div(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),dG=It.button(({theme:e,variant:t="primary"})=>({width:"100%",padding:"12px",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",border:"none",marginBottom:"12px",backgroundColor:t==="primary"?j:e.background.hoverable,color:t==="primary"?e.color.inverseText:e.color.defaultText,"&:hover":{opacity:.9}})),fG=30*1e3,rI=({onClose:e})=>{let{sessionToken:t,resetAuth:r,usageData:n,usageLastFetched:o,setUsageData:i}=be(),{featureFlags:a}=we(),s=a.showCosts,l=n,u=!n&&t,c=async(g=!1)=>{if(!t)return;let m=o&&Date.now()-o<fG;if(!(!g&&m&&n))try{let T=q(),S=await X(`${T}/api/addon/account`,{headers:{Authorization:`Bearer ${t}`}});if(S.ok){let h=await S.json();i(h)}}catch(T){w.error("Failed to fetch usage:",T)}};JT(()=>{c()},[t]),JT(()=>{let g=()=>{document.visibilityState==="visible"&&(w.debug("[TokenUsageModal] Tab visible, refreshing balance..."),c(!0))};return document.addEventListener("visibilitychange",g),()=>document.removeEventListener("visibilitychange",g)},[t]);let d=async()=>{if(t){let g=q();try{await fetch(`${g}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${t}`}})}catch{}}r(),e()},f=()=>{let g=q();window.open(`${g}/pricing`,"_blank")},p=()=>{let g=q();window.open(`${g}/pricing#add-credits`,"_blank")};if(t&&!s&&!u){let g=Math.floor(l?.creditBalance??0),T=Math.max(g,10),S=Math.max(0,T-g),h=T>0?g/T*100:0;return ze.createElement(ze.Fragment,null,ze.createElement(QT,{onClick:e}),ze.createElement(ZT,{onClick:M=>M.stopPropagation(),style:{width:"320px"}},ze.createElement(DW,null,ze.createElement(NW,null,(l?.name||l?.email||"U")[0].toUpperCase()),ze.createElement(OW,null,ze.createElement($W,null,l?.name||l?.email||"Your account"),ze.createElement(HW,null,(l?.plan||"FREE").toUpperCase())),ze.createElement("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"2px"}},ze.createElement(eI,{onClick:d,title:"Sign out",style:{position:"static"}},ze.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ze.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ze.createElement("polyline",{points:"16 17 21 12 16 7"}),ze.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ze.createElement(eI,{onClick:e,title:"Close",style:{position:"static"}},"\xD7"))),ze.createElement(UW,null,ze.createElement(jW,null,"Credits"),ze.createElement(VW,null,g," left")),ze.createElement(WW,null,ze.createElement(GW,{percent:h})),ze.createElement(qW,null,S," used \xB7 ",g," remaining"),ze.createElement(YW,null),ze.createElement(KW,{onClick:()=>window.open("mailto:hello@uiparity.com?subject=Credits request","_blank")},"Contact us for credits \u2192")))}return ze.createElement(ze.Fragment,null,ze.createElement(QT,{onClick:e}),ze.createElement(ZT,{onClick:g=>g.stopPropagation()},ze.createElement(XW,null,ze.createElement(JW,null,ze.createElement(QW,null,l?.email?l.email[0].toUpperCase():"U"),ze.createElement("span",null,l?.email||"Loading...")),ze.createElement(ZW,null,ze.createElement(tI,{onClick:d,title:"Sign out"},ze.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ze.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ze.createElement("polyline",{points:"16 17 21 12 16 7"}),ze.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ze.createElement(tI,{onClick:e,title:"Close"},"\xD7"))),ze.createElement(eG,null,u?ze.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Loading..."):t?ze.createElement(ze.Fragment,null,ze.createElement(tG,null,ze.createElement(rG,null,"Credit Balance"),ze.createElement(nG,null,"$",(l?.creditBalance??0).toFixed(2)),ze.createElement(oG,null,(l?.creditBalance??0)<2?"Low balance - consider topping up":"Pay only for what you use")),ze.createElement(iG,null,ze.createElement(aG,null,ze.createElement(sG,null,ze.createElement(lG,null,"Current Plan"),ze.createElement(cG,null,l?.plan||"Free")),ze.createElement(uG,{onClick:f},"View detail >")),ze.createElement(pG,null,"~$0.02-0.05 per review depending on complexity"),ze.createElement(dG,{onClick:p,style:{marginTop:"16px"}},"Add Credits"))):ze.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Please sign in to view usage"))))};dr();Ce();import sl from"react";import{styled as nI}from"storybook/theming";Fe();Ce();tt();Ne();var gG=nI.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}),mG=nI.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark})),oI=()=>{let{userRole:e,roleOverride:t,setRoleOverride:r,setFeatureFlags:n}=we(),{sessionToken:o}=be();return e!=="admin"?null:sl.createElement(gG,null,sl.createElement(mG,null,"View as:"),sl.createElement(YS,{value:t??e,onChange:s=>{let l=s.target.value;if(l===e)r(null),o&&X(`${q()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(u=>u.json()).then(u=>{let c={enableFixGeneration:!!u.enableFixGeneration,enableFixApply:!!u.enableFixApply,enableAutoMap:!!u.enableAutoMap,enableAutoFigmaLinking:!!u.enableAutoFigmaLinking,enableReviewBadges:!!u.enableReviewBadges,showCosts:!!u.showCosts,enableParallelReview:!!u.enableParallelReview,enableModelSelection:!!u.enableModelSelection};n(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c))}catch{}}).catch(u=>w.warn("[RoleSwitcher] Failed to re-fetch flags:",u.message));else{r(l);let u=Vc[l];n(u);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(u))}catch{}}},style:{width:"auto",minWidth:"100px"}},sl.createElement("option",{value:"admin"},"Admin"),sl.createElement("option",{value:"beta"},"Regular user")),t&&sl.createElement(JS,{variant:"warning"},"Previewing as"," ",t==="beta"?"regular user":t))};Fe();Ce();tt();import Ht,{useState as Gc,useCallback as Ly}from"react";import{styled as Lo}from"storybook/theming";var hG="0.5.7",xG=[{value:"bug",label:"\u{1F41E} Bug \u2014 something broke"},{value:"ux",label:"\u{1F9ED} UX \u2014 confusing or slow"},{value:"feature",label:"\u2728 Feature \u2014 missing something"},{value:"praise",label:"\u{1F49A} Praise \u2014 works great"},{value:"other",label:"\u{1F4AC} Other"}],yG=Lo.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center"}),bG=Lo.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"12px",width:"460px",maxWidth:"94%",maxHeight:"90vh",overflow:"auto",boxShadow:"0 16px 48px rgba(0, 0, 0, 0.25)"})),wG=Lo.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px 12px",borderBottom:`1px solid ${e.appBorderColor}`})),vG=Lo.h3(({theme:e})=>({margin:0,fontSize:"15px",fontWeight:600,color:e.color.defaultText,display:"flex",alignItems:"center",gap:"8px"})),SG=Lo.button(({theme:e})=>({background:"transparent",border:"none",fontSize:"20px",color:e.color.mediumdark,cursor:"pointer",padding:"0 6px",lineHeight:1,"&:hover":{color:e.color.defaultText}})),kG=Lo.div({padding:"16px 20px",display:"flex",flexDirection:"column",gap:"14px"}),CG=Lo.textarea(({theme:e})=>({width:"100%",minHeight:"110px",padding:"8px 10px",borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.defaultText,backgroundColor:e.background.app,resize:"vertical",boxSizing:"border-box","&:focus":{outline:"none",borderColor:j}})),iI=Lo.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px 16px",borderTop:`1px solid ${e.appBorderColor}`,gap:"8px"})),aI=Lo.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4})),EG=Lo.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.negative})),TG=Lo.div(({theme:e})=>({padding:"24px 20px",textAlign:"center",display:"flex",flexDirection:"column",gap:"10px","& h4":{margin:0,fontSize:"15px",fontWeight:600,color:e.color.positive},"& p":{margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark}}));function sI({isOpen:e,onClose:t}){let{sessionToken:r,isConnected:n}=be(),{selectedProjectId:o}=Ge(),{currentStoryId:i}=bt(),[a,s]=Gc("other"),[l,u]=Gc(""),[c,d]=Gc(!1),[f,p]=Gc(!1),[g,m]=Gc(null),T=Ly(()=>{u(""),s("other"),p(!1),m(null),d(!1)},[]),S=Ly(()=>{T(),t()},[T,t]),h=Ly(async M=>{if(M.preventDefault(),!l.trim()){m("Please write a message.");return}if(!n||!r){m("Sign in to send feedback.");return}d(!0),m(null);try{let z=await X(`${q()}/api/feedback`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({message:l.trim(),severity:a,projectId:o||void 0,storyId:i||void 0,addonVersion:hG})});if(!z.ok){let O=await z.json().catch(()=>({}));throw new Error(O.error||`Request failed (${z.status})`)}p(!0)}catch(z){m(z instanceof Error?z.message:"Something went wrong")}finally{d(!1)}},[l,a,r,n,o,i]);return e?Ht.createElement(yG,{onClick:S},Ht.createElement(bG,{onClick:M=>M.stopPropagation()},Ht.createElement(wG,null,Ht.createElement(vG,null,Ht.createElement("span",null,"\u{1F4AC}"),"Send feedback"),Ht.createElement(SG,{onClick:S,"aria-label":"Close"},"\xD7")),f?Ht.createElement(Ht.Fragment,null,Ht.createElement(TG,null,Ht.createElement("h4",null,"Thanks \u2014 got it."),Ht.createElement("p",null,"We read every message. If it's a bug, we'll likely follow up by email.")),Ht.createElement(iI,null,Ht.createElement("span",null),Ht.createElement(Ai,{onClick:S},"Close"))):Ht.createElement("form",{onSubmit:h},Ht.createElement(kG,null,Ht.createElement(Lp,null,Ht.createElement(_p,{htmlFor:"feedback-severity"},"Type"),Ht.createElement(Rn,{id:"feedback-severity",value:a,onChange:M=>s(M.target.value),disabled:c},xG.map(M=>Ht.createElement("option",{key:M.value,value:M.value},M.label)))),Ht.createElement(Lp,null,Ht.createElement(_p,{htmlFor:"feedback-message"},"What happened?"),Ht.createElement(CG,{id:"feedback-message",value:l,onChange:M=>u(M.target.value),placeholder:"Tell us what you were doing, what you expected, and what happened.",disabled:c,autoFocus:!0,maxLength:5e3})),Ht.createElement(aI,null,"We auto-attach your current story and project so we can reproduce it. No screenshots sent."),g&&Ht.createElement(EG,null,g)),Ht.createElement(iI,null,Ht.createElement(aI,null,i?`Context: ${i}`:"No story selected"),Ht.createElement("div",{style:{display:"flex",gap:"8px"}},Ht.createElement(Ai,{type:"button",onClick:S,disabled:c},"Cancel"),Ht.createElement(lr,{type:"submit",disabled:c||!l.trim()},c?"Sending\u2026":"Send")))))):null}Ce();import De,{useCallback as O6,useEffect as IX,useState as pu}from"react";import{styled as RX}from"storybook/theming";Fe();tt();Fe();tt();import{useCallback as _y,useEffect as IG,useRef as lI,useState as RG}from"react";var cI=15e3,AG=2e3,By={connected:!1,mapped:0,totalStories:0,crawling:!1,pagesDone:0,pagesTotal:0,errored:!1};function uI(e,t,r){let[n,o]=RG(By),i=lI(null),a=lI(!0),s=_y(async()=>{if(!e||!t)return o(By),cI;let c=q(),d={Authorization:`Bearer ${t}`},f={...By,totalStories:r};try{let[p,g]=await Promise.all([X(`${c}/api/figma/cache-status?projectId=${encodeURIComponent(e)}`,{headers:d}).catch(()=>null),X(`${c}/api/mappings?projectId=${encodeURIComponent(e)}`,{headers:d}).catch(()=>null)]);if(p?.ok){let m=await p.json(),T=m.crawlProgress;f={...f,connected:(m.structureStatus??"none")!=="none",crawling:T?.status==="crawling"||T?.status==="cancelling",pagesDone:T?.pagesDone??0,pagesTotal:T?.pagesTotal??0,...T?.currentPage?{currentPage:T.currentPage}:{},...T?.phase?{phase:T.phase}:{},...T?.setsFound!=null?{setsFound:T.setsFound}:{},errored:T?.status==="error",...T?.error?{error:T.error}:{},...m.structureCachedAt?{lastSyncAt:m.structureCachedAt}:{},...m.componentSetCount!=null?{setsIndexed:m.componentSetCount}:{},...m.totalVariants!=null?{variantsIndexed:m.totalVariants}:{},...m.pageCount!=null?{pagesIndexed:m.pageCount}:{},...m.cacheDiff?.added?.length?{addedCount:m.cacheDiff.added.length}:{},...m.cacheDiff?.removed?.length?{removedCount:m.cacheDiff.removed.length}:{}}}if(g?.ok){let m=await g.json();f.mapped=m.mappings?.length??0,f.mapped>0&&(f.connected=!0)}}catch{}return a.current&&o(f),f.crawling?AG:cI},[e,t,r]),l=_y(()=>{s().then(c=>{a.current&&(i.current=setTimeout(l,c))})},[s]);IG(()=>(a.current=!0,l(),()=>{a.current=!1,i.current&&clearTimeout(i.current)}),[l]);let u=_y(()=>{i.current&&clearTimeout(i.current),l()},[l]);return{status:n,refresh:u}}function pI(e){if(e.crawling){if(e.phase==="repairing")return{text:"Fetching nested variants\u2026",tone:"busy"};let t=e.pagesTotal>0?` ${e.pagesDone}/${e.pagesTotal}`:"";return{text:e.currentPage?`Reading \u201C${e.currentPage}\u201D${t}`:`Importing${t}`,tone:"busy"}}return e.errored?{text:"Figma sync failed",tone:"warn"}:e.connected?e.mapped===0?{text:e.totalStories>0?`Map ${e.totalStories} stories`:"Map stories",tone:"action"}:{text:e.totalStories>0?`${e.mapped}/${e.totalStories}`:`${e.mapped} mapped`,tone:"idle"}:{text:"Connect Figma",tone:"action"}}function zy(e){if(!e)return null;let t=new Date(e).getTime();if(Number.isNaN(t))return null;let r=Math.floor((Date.now()-t)/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;let n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}var oi="data-uic-rollup",Dy="data-uic-frac",FG={success:1,warn:2,error:3},MG=["linked","success","warn","error"];function PG(e){let t=e.indexOf("--");return t===-1?e:e.slice(0,t)}function Ny(e,t,r,n,o,i){let a=new Map,s=0,l=0,u=0,c=0,d=0;e.forEach(g=>{let m=PG(g),T=a.get(m)??{mapped:0,worst:0};T.mapped+=1;let S=r.get(g);if(S&&t.has(g)){T.worst=Math.max(T.worst,FG[S]),S==="success"?s+=1:S==="warn"?l+=1:u+=1;let h=o?.get(g);typeof h=="number"&&(c+=h,d+=1)}a.set(m,T)});let f=[...a.entries()].map(([g,m])=>({id:g,mapped:m.mapped,total:Math.max(n.get(g)??m.mapped,m.mapped),worst:m.worst})),p=0;return i?.forEach(g=>{e.has(g)&&(p+=1)}),{mapped:e.size,reviewed:t.size,pass:s,warn:l,fail:u,incomparable:p,avgScore:d>0?Math.round(c/d):null,components:f}}function dI(e,t,r,n){if(typeof document>"u")return;let o=new Map(Ny(e,t,r,n).components.map(i=>[i.id,i]));document.querySelectorAll('[data-nodetype="component"]').forEach(i=>{let a=i.getAttribute("data-item-id"),s=a?o.get(a):void 0;if(!s){i.removeAttribute(oi),i.removeAttribute(Dy);return}i.setAttribute(oi,MG[s.worst]),i.setAttribute(Dy,`${s.mapped}/${s.total}`),i.setAttribute("title",`${s.mapped} of ${s.total} stories mapped`)})}function fI(){return`
15
15
  [data-nodetype="component"][${oi}] { position: relative; }
@@ -84,7 +84,7 @@ ${fI()}
84
84
  `,document.head.appendChild(e)}import _e,{useState as as,useEffect as L6,useCallback as uo}from"react";import{createPortal as rX}from"react-dom";import{styled as _r}from"storybook/theming";import{useStorybookApi as nX}from"storybook/manager-api";Fe();Fe();Ne();import se,{useState as xl,useEffect as L3,useMemo as l5,useCallback as _3}from"react";import{styled as gt}from"storybook/theming";import{useState as ns,useMemo as GI,useCallback as ml,useEffect as qI,useRef as XG}from"react";Fe();Ne();tt();dr();import{useState as ji,useEffect as Nd,useRef as ul,useCallback as Hy}from"react";var _G=300;function kI({projectId:e,typeFilter:t,search:r,figmaPage:n,limit:o=20,enabled:i=!0}){let[a,s]=ji([]),[l,u]=ji({}),[c,d]=ji(0),[f,p]=ji([]),[g,m]=ji(new Set),[T,S]=ji(!1),[h,M]=ji(!1),[z,O]=ji(null),R=ul(1),B=ul(null),x=ul(null),[v,I]=ji(0),L=ul(!1),E=ul({projectId:e,typeFilter:t,search:r,figmaPage:n,limit:o});E.current={projectId:e,typeFilter:t,search:r,figmaPage:n,limit:o};let y=Hy(async(F,D,k=!1)=>{let{projectId:N,typeFilter:G,search:_,figmaPage:le,limit:$}=E.current;if(!N||!G)return;B.current&&B.current.abort();let W=new AbortController;B.current=W,D?M(!0):S(!0),O(null);try{let Q=q(),ge=localStorage.getItem("uicopilot_session_token");if(!ge)throw new Error(`Not authenticated. Please connect to ${Qt.NAME} first.`);let he=new URLSearchParams({projectId:N,page:String(F),limit:String($)});G&&he.append("type",G),le&&he.append("figmaPage",le),_.trim()&&he.append("search",_.trim()),k&&he.append("refresh","true");let pe=await fetch(`${Q}/api/figma/frames?${he.toString()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${ge}`},signal:W.signal});if(!pe.ok){let ve=await pe.json();throw new Error(ve.error||"Failed to fetch frames")}let fe=await pe.json(),ht=fe.frames||[],je=fe.thumbnails||{},xe=pe.headers.get("X-Cache-Status");if(ht.length===0&&F===1&&!D&&!k&&!L.current&&xe!=="HIT"){w.debug("[useFigmaFrameFetch] Empty result (cache miss), retrying with refresh=true"),L.current=!0,await y(1,!1,!0);return}D?(s(ve=>[...ve,...ht]),u(ve=>({...ve,...je}))):(s(ht),u(je)),d(fe.total||ht.length),fe.pages&&p(fe.pages),fe.cacheDiff?.added&&m(new Set(fe.cacheDiff.added)),R.current=F}catch(Q){if(Q instanceof DOMException&&Q.name==="AbortError")return;let ge=Q instanceof Error?Q.message:"Failed to fetch Figma frames.";O(ge),w.error("Error fetching frames:",Q)}finally{W.signal.aborted||(S(!1),M(!1))}},[]);Nd(()=>{if(!i||!e||!t)return;L.current=!1,x.current&&clearTimeout(x.current);let F=r.trim()?_G:0;return x.current=setTimeout(()=>{R.current=1,y(1,!1)},F),()=>{x.current&&clearTimeout(x.current)}},[e,t,r,n,i,v,y]);let C=ul(new Set);Nd(()=>{if(a.length===0)return;let F={};for(let D of a)D.thumbnailCdnUrl&&!l[D.id]&&(F[D.id]=D.thumbnailCdnUrl);Object.keys(F).length>0&&u(D=>({...D,...F}))},[a]),Nd(()=>{if(a.length===0)return;let F=a.filter(k=>!k.thumbnailCdnUrl&&!l[k.id]&&!C.current.has(k.id)).map(k=>k.id);if(F.length===0)return;F.forEach(k=>C.current.add(k)),(async()=>{try{let{projectId:k}=E.current,N=q(),G=localStorage.getItem("uicopilot_session_token");if(!G||!k)return;let _=await X(`${N}/api/figma/frames?projectId=${k}&thumbnailIds=${F.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${G}`}},6e4);if(_.ok){let le=await _.json();le.thumbnails&&Object.keys(le.thumbnails).length>0&&u($=>({...$,...le.thumbnails}))}}catch(k){F.forEach(N=>C.current.delete(N)),w.error("Failed to fetch frame thumbnails:",k)}})()},[a,l]),Nd(()=>()=>{B.current&&B.current.abort(),x.current&&clearTimeout(x.current)},[]);let b=Hy(async()=>{let F=R.current+1;await y(F,!0)},[y]),A=Hy(()=>{L.current=!1,R.current=1,s([]),u({}),I(F=>F+1)},[]),P=a.length<c;return{frames:a,thumbnails:l,totalFrames:c,availablePages:f,recentlyAdded:g,isLoading:T,loadingMore:h,hasMore:P,loadMore:b,refresh:A,error:z}}Fe();Ne();tt();import{useState as pl,useCallback as Od,useRef as BG}from"react";function CI({projectId:e}){let[t,r]=pl({}),[n,o]=pl({}),[i,a]=pl(new Set),[s,l]=pl(new Set),[u,c]=pl({}),[d,f]=pl(null),p=BG({}),g=Od(async h=>{if(!(!e||i.has(h))){a(M=>new Set(M).add(h));try{let M=q(),z=localStorage.getItem("uicopilot_session_token"),O=await X(`${M}/api/figma/variants?projectId=${e}&componentSetId=${h}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}});if(O.ok){let R=await O.json();if(R.variants){r(x=>({...x,[h]:R.variants}));let B={};for(let x of R.variants)x.thumbnailCdnUrl&&(B[x.id]=x.thumbnailCdnUrl);o(x=>({...x,[h]:{...x[h]||{},...B}})),p.current[h]||(p.current[h]=new Set),Object.keys(B).forEach(x=>p.current[h].add(x))}else o(B=>({...B,[h]:B[h]||{}}))}else o(R=>({...R,[h]:{}}))}catch(M){w.error("Failed to fetch variant metadata:",M),o(z=>({...z,[h]:{}}))}finally{a(M=>{let z=new Set(M);return z.delete(h),z})}}},[e,i]),m=Od(async(h,M)=>{if(!e||M.length===0)return;p.current[h]||(p.current[h]=new Set);let z=n[h]||{},O=M.filter(R=>!p.current[h].has(R)&&!z[R]);if(O.length!==0){O.forEach(R=>p.current[h].add(R)),l(R=>new Set(R).add(h));try{let R=q(),B=localStorage.getItem("uicopilot_session_token"),x=await X(`${R}/api/figma/variants?projectId=${e}&componentSetId=${h}&thumbnailIds=${O.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${B}`}});if(x.ok){let v=await x.json();v.rateLimitError?(f(v.rateLimitError),O.forEach(I=>p.current[h]?.delete(I))):(v.thumbnails&&Object.keys(v.thumbnails).length>0&&o(I=>({...I,[h]:{...I[h]||{},...v.thumbnails}})),Array.isArray(v.failed)&&v.failed.length>0&&c(I=>{let L=new Set(I[h]||[]);for(let E of v.failed)L.add(E);return{...I,[h]:L}}))}}catch(R){w.error("Failed to fetch variant thumbnails:",R),O.forEach(B=>p.current[h]?.delete(B))}finally{l(R=>{let B=new Set(R);return B.delete(h),B})}}},[e]),T=Od(h=>{o(M=>{let z={...M};return delete z[h],z}),r(M=>{let z={...M};return delete z[h],z}),c(M=>{let z={...M};return delete z[h],z}),delete p.current[h]},[]),S=Od(()=>{o({}),r({}),c({}),p.current={}},[]);return{variantChildren:t,variantThumbnails:n,variantFailed:u,loadingVariants:i,loadingThumbnails:s,rateLimitError:d,fetchVariants:g,fetchVariantThumbnails:m,clearVariantsForSet:T,clearAllVariants:S}}Fe();gl();Ce();Ne();tt();import{useState as BI,useEffect as zI,useRef as DI,useCallback as Yy}from"react";function NI({expandedSetId:e,availableFilters:t,filtersReady:r}){let[n,o]=BI(null),[i,a]=BI(!1),s=DI(null),l=DI(new Set),u=Yy(async()=>{if(!e||!r||t.length===0||s.current===e||l.current.has(e))return;let f=fl();if(!f||Object.keys(f).length===0)return;let p=Tt.getState().currentStoryId||"",g=p.replace(/--/g," / ").replace(/-/g," ").replace(/\b\w/g,m=>m.toUpperCase());s.current=e,a(!0),o(null);try{let m=q(),T=localStorage.getItem("uicopilot_session_token"),S=await X(`${m}/api/figma/match-filters`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({storyName:g,storyId:p,storyArgs:f,availableFilters:t.map(h=>({property:h.property,values:h.values}))})});if(S.ok){let h=await S.json();h.confidence>0&&Object.keys(h.suggestedFilters).length>0&&(w.debug("[useFilterSuggestion] Suggestion:",h),o(h))}else S.status===404?w.debug("[useFilterSuggestion] match-filters endpoint not available (404), skipping suggestions"):w.error("[useFilterSuggestion] Unexpected status:",S.status)}catch(m){w.error("[useFilterSuggestion] Error:",m)}finally{a(!1)}},[e,t,r]);zI(()=>{u()},[u]),zI(()=>{e||(o(null),s.current=null)},[e]);let c=Yy(()=>{},[]),d=Yy(()=>{e&&l.current.add(e),o(null)},[e]);return{suggestion:n,isLoading:i,applySuggestion:c,dismissSuggestion:d}}var Vd={search:"",figmaPage:"",showComponentSets:!0,showFrames:!1,showComponents:!1},OI=e=>`uicopilot:figma-browser-prefs:${e}`;function $I(e){if(!e||typeof sessionStorage>"u")return{...Vd};try{let t=sessionStorage.getItem(OI(e));if(!t)return{...Vd};let r=JSON.parse(t);return{...Vd,...r}}catch{return{...Vd}}}function HI(e,t){if(!(!e||typeof sessionStorage>"u"))try{sessionStorage.setItem(OI(e),JSON.stringify(t))}catch{}}function UI(e,t,r){let n=[];return e&&n.push("COMPONENT_SET"),t&&n.push("FRAME"),r&&n.push("COMPONENT"),n.join(",")}function jI(e){let t={};for(let r of Object.values(e))for(let n of r)if(n.variantProperties)for(let[o,i]of Object.entries(n.variantProperties))t[o]||(t[o]=new Set),t[o].add(i);return Object.entries(t).map(([r,n])=>({property:r,values:Array.from(n).sort()}))}function VI(e){let t={},r=n=>{if(n.variantProperties)for(let[o,i]of Object.entries(n.variantProperties))t[o]||(t[o]=new Set),t[o].add(i);n.children?.forEach(r)};return e.forEach(r),Object.entries(t).map(([n,o])=>({property:n,values:Array.from(o).sort()}))}function WI(e,t,r){if(t.length===0||!t.some(o=>o.value))return!0;let n=o=>o.variantProperties?t.every(i=>i.value?o.variantProperties?.[i.property]===i.value:!0):!1;return!!(n(e)||e.children?.some(n)||r?.some(n))}function Kc({projectId:e,limit:t=20,enabled:r=!0}){let[n,o]=ns(!0),[i,a]=ns(!1),[s,l]=ns(!1),[u,c]=ns(""),[d,f]=ns(""),[p,g]=ns([]),[m,T]=ns(new Set),S=ml(xe=>{c(xe),p.length>0&&g([]),m.size>0&&T(new Set)},[p.length,m.size]),h=XG(null);qI(()=>{if(!e||h.current===e)return;let xe=$I(e);c(xe.search),f(xe.figmaPage),o(xe.showComponentSets),a(xe.showFrames),l(xe.showComponents),h.current=e},[e]),qI(()=>{!e||h.current!==e||HI(e,{search:u,figmaPage:d,showComponentSets:n,showFrames:i,showComponents:s})},[e,u,d,n,i,s]);let M=UI(n,i,s),{frames:z,thumbnails:O,totalFrames:R,availablePages:B,recentlyAdded:x,isLoading:v,loadingMore:I,hasMore:L,loadMore:E,refresh:y,error:C}=kI({projectId:e,typeFilter:M,search:u,figmaPage:d||void 0,limit:t,enabled:r&&!!M}),{variantChildren:b,variantThumbnails:A,variantFailed:P,loadingVariants:F,loadingThumbnails:D,rateLimitError:k,fetchVariants:N,fetchVariantThumbnails:G,clearVariantsForSet:_,clearAllVariants:le}=CI({projectId:e}),$=GI(()=>{let xe=jI(b),ve=VI(z),ot={};for(let $t of[...xe,...ve])ot[$t.property]||(ot[$t.property]=new Set),$t.values.forEach(pt=>ot[$t.property].add(pt));return Object.entries(ot).map(([$t,pt])=>({property:$t,values:Array.from(pt).sort()}))},[b,z]),W=m.size===1?Array.from(m)[0]:null,Q=NI({expandedSetId:W,availableFilters:$,filtersReady:$.length>0}),ge=ml(()=>{if(!Q.suggestion)return;let{suggestedFilters:xe}=Q.suggestion,ve=Object.entries(xe).map(([ot,$t])=>({property:ot,value:$t}));g(ve),Q.dismissSuggestion()},[Q.suggestion]),he=GI(()=>p.some(xe=>xe.value)?z.filter(xe=>WI(xe,p,b[xe.id])):z,[z,p,b]),pe=ml((xe,ve)=>{ve.stopPropagation();let ot=!m.has(xe);T($t=>{let pt=new Set($t);return pt.has(xe)?pt.delete(xe):pt.add(xe),pt}),ot&&!b[xe]&&!F.has(xe)?N(xe):ot||_(xe)},[m,b,F,N,_]),fe=ml((xe,ve)=>{let ot=ve===""?null:ve;g($t=>$t.find(dt=>dt.property===xe)?$t.map(dt=>dt.property===xe?{...dt,value:ot}:dt):[...$t,{property:xe,value:ot}])},[]),ht=ml(()=>{g([])},[]),je=ml(xe=>{let ve=z.find(ot=>ot.id===xe);if(ve?.thumbnailCdnUrl)return ve.thumbnailCdnUrl;if(O[xe])return O[xe];for(let ot of Object.values(A))if(ot[xe])return ot[xe]},[O,A]);return{frames:z,filteredFrames:he,thumbnails:O,totalFrames:R,isLoading:v,loadingMore:I,hasMore:L,error:C,loadMore:E,refresh:y,search:u,setSearch:S,figmaPage:d,setFigmaPage:f,availablePages:B,recentlyAdded:x,showComponentSets:n,showFrames:i,showComponents:s,setShowComponentSets:o,setShowFrames:a,setShowComponents:l,variantFilters:p,availableFilters:$,handleFilterChange:fe,clearFilters:ht,expandedSets:m,toggleExpanded:pe,variantChildren:b,variantThumbnails:A,variantFailed:P,loadingVariants:F,loadingThumbnails:D,rateLimitError:k,fetchVariantThumbnails:G,resolveThumbnail:je,filterSuggestion:Q.suggestion,filterSuggestionLoading:Q.isLoading,applySuggestedFilters:ge,dismissFilterSuggestion:Q.dismissSuggestion}}tt();import Xe,{useState as P3,useEffect as JG,memo as QG}from"react";import{styled as Me}from"storybook/theming";var YI=Me.div({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001}),KI=Me.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"6px",width:"90%",maxWidth:"900px",maxHeight:"85vh",display:"flex",flexDirection:"column",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.3)",border:`1px solid ${e.appBorderColor}`})),XI=Me.div(({theme:e})=>({padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"space-between",alignItems:"center"})),JI=Me.h2(({theme:e})=>({margin:0,fontSize:"16px",fontWeight:600,color:e.color.defaultText})),QI=Me(Wn)({fontSize:"20px",padding:"4px 8px"}),ZI=Me.div({flex:1,overflow:"auto",padding:"20px"}),e3=Me(la)({fontSize:"14px",marginBottom:"16px"}),Ky=Me.div({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"}),t3=Me.button(({theme:e})=>({display:"flex",flexDirection:"column",padding:0,border:`2px solid ${e.appBorderColor}`,borderRadius:"8px",backgroundColor:e.background.app,color:e.color.defaultText,cursor:"pointer",overflow:"hidden",transition:"all 0.2s","&:hover":{borderColor:j,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),Xy=Me.div(({theme:e})=>({width:"100%",aspectRatio:"4 / 3",minHeight:"80px",backgroundColor:e.background.app,backgroundImage:`linear-gradient(45deg, ${e.appBorderColor} 25%, transparent 25%), linear-gradient(-45deg, ${e.appBorderColor} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${e.appBorderColor} 75%), linear-gradient(-45deg, transparent 75%, ${e.appBorderColor} 75%)`,backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative"})),r3=Me.div(({theme:e})=>({width:"100%",aspectRatio:"4 / 3",minHeight:"80px",backgroundColor:e.background.app,backgroundImage:`linear-gradient(45deg, ${e.appBorderColor} 25%, transparent 25%), linear-gradient(-45deg, ${e.appBorderColor} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${e.appBorderColor} 75%), linear-gradient(-45deg, transparent 75%, ${e.appBorderColor} 75%)`,backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative"})),n3=Me.img(({theme:e})=>({maxWidth:"100%",maxHeight:"100%",objectFit:"cover",display:"block",backgroundColor:e.background.content,borderRadius:"4px"})),Xc=Me.div(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",height:"100%",minHeight:"80px",backgroundColor:e.base==="dark"?"rgba(255,255,255,0.03)":"rgba(0,0,0,0.02)",color:e.color.mediumdark})),Jy=Me.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTopColor:j,borderRadius:"50%",animation:"thumbnail-spin 0.8s linear infinite","@keyframes thumbnail-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),Jc=Me.div(({theme:e})=>({fontSize:"11px",fontWeight:500,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),Qy=Me.div(({theme:e})=>({fontSize:"32px",opacity:.5,color:e.color.mediumdark})),Zy=Me.div(({theme:e})=>({padding:"12px",textAlign:"left",backgroundColor:e.background.content,borderTop:`1px solid ${e.appBorderColor}`})),e5=Me.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3})),t5=Me.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),o3=Me.div(({theme:e})=>({display:"flex",gap:"16px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),Wd=Me.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer",userSelect:"none","& input":{cursor:"pointer"}})),r5=Me.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"14px"})),i3=Me.div(({theme:e})=>({padding:"20px",backgroundColor:e.background.critical,color:e.color.inverseText,borderRadius:"4px",fontSize:"14px"})),a3=Me.button(({theme:e})=>({position:"absolute",top:"8px",left:"8px",width:"24px",height:"24px",padding:0,background:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:"14px",color:e.color.defaultText,zIndex:10,transition:"all 0.2s","&:hover":{background:e.background.hoverable,borderColor:j}})),s3=Me.button(({theme:e})=>({display:"flex",flexDirection:"column",padding:0,border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${j}`,borderRadius:"6px",backgroundColor:e.background.content,color:e.color.defaultText,cursor:"pointer",overflow:"hidden",transition:"all 0.2s",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.08)",height:"auto",minHeight:"200px","&:hover":{borderColor:j,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),l3=Me.div(({theme:e})=>({position:"absolute",top:"8px",right:"8px",padding:"2px 8px",background:j,color:e.color.lightest,borderRadius:"4px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",zIndex:10})),c3=Me.div({display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px",marginBottom:"4px"}),Ibe=Me.div(({theme:e})=>({padding:"20px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px",backgroundColor:e.background.app,border:`2px dashed ${e.appBorderColor}`,borderRadius:"8px",gridColumn:"1 / -1"})),u3=Me.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${j}`,borderRadius:"6px",backgroundColor:e.background.content,overflow:"hidden",minHeight:"200px"})),p3=Me.div(({theme:e})=>({width:"100%",aspectRatio:"4 / 3",backgroundColor:e.background.hoverable,position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",top:0,left:"-100%",height:"100%",width:"100%",background:`linear-gradient(90deg, transparent, ${e.background.app}40, transparent)`,animation:"shimmer 1.5s infinite"},"@keyframes shimmer":{"0%":{left:"-100%"},"100%":{left:"100%"}}})),n5=Me.div(({theme:e,width:t="70%"})=>({height:"12px",width:t,backgroundColor:e.background.hoverable,borderRadius:"4px",margin:"8px 12px",position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",top:0,left:"-100%",height:"100%",width:"100%",background:`linear-gradient(90deg, transparent, ${e.background.app}40, transparent)`,animation:"shimmer 1.5s infinite"}})),d3=Me.span(({theme:e})=>({display:"inline-block",padding:"3px 8px",background:e.background.app,borderRadius:"4px",fontSize:"11px",color:e.color.defaultText,border:`1px solid ${e.appBorderColor}`,lineHeight:1.2})),f3=Me.span(({theme:e})=>({fontWeight:600,color:e.color.mediumdark})),g3=Me.span(({theme:e})=>({color:e.color.defaultText})),Gd=Me.div(({theme:e,width:t="100%",height:r="40px"})=>({width:t,height:r,backgroundColor:e.appBorderColor,borderRadius:"4px",position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",top:0,left:"-100%",height:"100%",width:"100%",background:`linear-gradient(90deg, transparent, ${e.background.hoverable}, transparent)`,animation:"shimmer 1.5s infinite"},"@keyframes shimmer":{"0%":{left:"-100%"},"100%":{left:"100%"}}})),m3=Me.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`2px solid ${e.appBorderColor}`,borderRadius:"8px",backgroundColor:e.background.app,overflow:"hidden"})),h3=Me.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),x3=Me.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),y3=Me(Rn)({flex:1,width:"auto"}),b3=Me.span(({theme:e,hasMapping:t})=>({fontSize:"12px",color:t?e.color.positive:e.color.mediumdark,fontWeight:t?500:400})),w3=Me.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",marginBottom:"8px",backgroundColor:e.background.hoverable||"#f0f9ff",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,fontSize:e.typography.size.s1,flexWrap:"wrap"})),v3=Me.span(({theme:e})=>({color:e.color.secondary,fontWeight:e.typography.weight.bold})),S3=Me.span(({theme:e})=>({color:e.color.defaultText})),k3=Me.button(({theme:e})=>({padding:"2px 8px",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:e.color.lightest,backgroundColor:e.color.secondary,border:"none",borderRadius:e.appBorderRadius,cursor:"pointer","&:hover":{opacity:.9}})),C3=Me.button(({theme:e})=>({padding:"2px 6px",fontSize:e.typography.size.s1,color:e.color.mediumdark,backgroundColor:"transparent",border:"none",cursor:"pointer","&:hover":{color:e.color.defaultText}})),E3=Me.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,marginBottom:"8px",fontStyle:"italic"})),qd=Me.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px",flexWrap:"wrap"})),Qc=Me.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),hl=Me(Rn)(({theme:e,isActive:t})=>({width:"auto",padding:"6px 28px 6px 10px",fontSize:"12px",...t&&{borderColor:e.color.secondary,backgroundColor:`${e.color.secondary}14`}})),Yd=Me.button(({theme:e})=>({padding:"6px 10px",border:"none",borderRadius:"4px",backgroundColor:"transparent",color:e.color.negative,fontSize:"12px",cursor:"pointer","&:hover":{backgroundColor:`${e.color.negative}15`}})),T3=Me.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",padding:"8px 0",borderBottom:`1px solid ${e.appBorderColor}`})),I3=Me.button(({theme:e})=>({padding:"6px 12px",border:"none",borderRadius:"4px",backgroundColor:"transparent",color:j,fontSize:"12px",cursor:"pointer","&:hover":{backgroundColor:"rgba(234, 88, 12, 0.08)"}})),R3=Me.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),o5=Me.button(({theme:e,isSelected:t})=>({display:"flex",flexDirection:"column",padding:0,border:`2px solid ${t?j:e.appBorderColor}`,borderRadius:"8px",backgroundColor:t?"rgba(234, 88, 12, 0.06)":e.background.app,color:e.color.defaultText,cursor:"pointer",overflow:"hidden",transition:"all 0.2s",position:"relative","&:hover":{borderColor:j,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),i5=Me.div(({theme:e,isSelected:t})=>({position:"absolute",top:"8px",left:"8px",width:"20px",height:"20px",borderRadius:"4px",border:`2px solid ${t?j:e.appBorderColor}`,backgroundColor:t?j:e.background.content,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,fontSize:"12px",color:t?e.color.lightest:"transparent"})),A3=Me.div(({theme:e})=>({padding:"16px 20px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"flex-end",gap:"12px"})),F3=Me.button(({theme:e,disabled:t})=>({padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:t?e.color.mediumdark:j,color:e.color.lightest,fontSize:"14px",fontWeight:500,cursor:t?"not-allowed":"pointer",opacity:t?.6:1,transition:"all 0.2s","&:hover":{backgroundColor:t?e.color.mediumdark:j,opacity:t?.6:.9}})),M3=Me.span(({theme:e})=>({display:"inline-block",padding:"1px 5px",marginLeft:"6px",borderRadius:"3px",fontSize:"9px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.5px",backgroundColor:"rgba(16, 185, 129, 0.15)",color:e.color.positive,verticalAlign:"middle"}));Ne();import{styled as ZG}from"storybook/theming";var eq=ZG.button(({theme:e})=>({gridColumn:"1 / -1",padding:"8px 16px",backgroundColor:"transparent",border:`1px dashed ${e.appBorderColor}`,borderRadius:e.appBorderRadius,color:e.color.mediumdark,fontSize:e.typography.size.s1,cursor:"pointer",transition:"all 0.15s","&:hover":{borderColor:e.color.secondary,color:e.color.secondary}})),a5=QG(({src:e,alt:t,isComponentSet:r,loadingDone:n,failed:o})=>{let[i,a]=P3(!1),[s,l]=P3(!1);return JG(()=>{a(!1),l(!1)},[e]),i?Xe.createElement(Xc,null,Xe.createElement(Qy,null,r?"\u229E":"\u{1F5BC}\uFE0F"),Xe.createElement(Jc,null,"Failed to load")):e?Xe.createElement(Xe.Fragment,null,!s&&Xe.createElement(Xc,{style:{position:"absolute",inset:0}},Xe.createElement(Jy,null),Xe.createElement(Jc,null,"Loading...")),Xe.createElement(n3,{src:e,alt:t,onLoad:()=>l(!0),onError:()=>a(!0),style:{opacity:s?1:0}})):n?Xe.createElement(Xc,null,Xe.createElement(Qy,null,r?"\u229E":"\u{1F5BC}\uFE0F"),Xe.createElement(Jc,null,o?"Render failed":"No preview")):Xe.createElement(Xc,null,Xe.createElement(Jy,null),Xe.createElement(Jc,null,"Loading..."))}),Zc=({frame:e,thumbnail:t,thumbnails:r,variantThumbnails:n,variantChildren:o,variantFailed:i,isLoadingVariants:a=!1,isExpanded:s,isNew:l=!1,onToggleExpand:u,onSelect:c,multiSelect:d=!1,selectedFrames:f=new Set,variantFilters:p=[],variantPage:g=1,onShowMore:m})=>{let S=e.type==="COMPONENT_SET",h=S&&(e.children&&e.children.length>0||(e.childCount??0)>0),M=e.children||o||[],z=Xe.useMemo(()=>M.length===0?[]:p.some(B=>B.value)?M.filter(B=>B.variantProperties?p.every(x=>x.value?B.variantProperties?.[x.property]===x.value:!0):!1):M,[M,p]),O=B=>{if(S){u(e.id,B);return}c(e)},R=d?o5:t3;return Xe.createElement(Xe.Fragment,null,Xe.createElement(R,{onClick:O,title:e.name,isSelected:d?f.has(e.id):void 0,style:{cursor:"pointer"}},d&&!h&&Xe.createElement(i5,{isSelected:f.has(e.id)},f.has(e.id)?"\u2713":""),S?Xe.createElement(r3,null,h&&Xe.createElement(a3,{onClick:B=>u(e.id,B),title:s?"Collapse variants":"Expand variants"},s?"\u25BC":"\u25B6"),h&&Xe.createElement(l3,null,z.length>0&&z.length!==M.length?`${z.length} / ${M.length}`:e.childCount??M.length," ","variants"),Xe.createElement(a5,{src:t,alt:e.name,isComponentSet:!0})):Xe.createElement(Xy,null,Xe.createElement(a5,{src:t,alt:e.name,isComponentSet:!1})),Xe.createElement(Zy,null,Xe.createElement(e5,null,e.name,l&&Xe.createElement(M3,null,"New")),Xe.createElement(t5,null,e.type))),h&&s&&a&&Xe.createElement(Xe.Fragment,null,Array.from({length:Math.min(6,e.childCount??e.children?.length??6)}).map((B,x)=>Xe.createElement(u3,{key:`skeleton-${x}`},Xe.createElement(p3,null),Xe.createElement(n5,{width:"80%"}),Xe.createElement(n5,{width:"50%"})))),h&&s&&!a&&z.slice(0,g*50).map(B=>Xe.createElement(s5,{key:B.id,variant:B,thumbnail:n?.[B.id]||r[B.id],onSelect:c,multiSelect:d,isSelected:f.has(B.id),loadingDone:!!t||n!==void 0&&B.id in(n||{})||!!i?.has(B.id),failed:i?.has(B.id)})),h&&s&&!a&&z.length>g*50&&Xe.createElement(eq,{onClick:()=>m?.(e.id)},"Show more (",z.length-g*50," ","remaining)"))},s5=({variant:e,thumbnail:t,onSelect:r,multiSelect:n=!1,isSelected:o=!1,loadingDone:i=!1,failed:a=!1})=>Xe.createElement(n?o5:s3,{onClick:()=>{w.debug("[VariantCard] Clicked:",e.id,e.name),r(e)},title:e.name,isSelected:n?o:void 0},n&&Xe.createElement(i5,{isSelected:o},o?"\u2713":""),Xe.createElement(Xy,null,Xe.createElement(a5,{src:t,alt:e.name,isComponentSet:!1,loadingDone:i,failed:a})),Xe.createElement(Zy,null,Xe.createElement(e5,null,e.name),e.variantProperties&&Object.keys(e.variantProperties).length>0&&Xe.createElement(c3,null,Object.entries(e.variantProperties).map(([u,c])=>Xe.createElement(d3,{key:u},Xe.createElement(f3,null,u,":")," ",Xe.createElement(g3,null,c)))),Xe.createElement(t5,{style:{marginTop:"6px"}},"VARIANT")));var tq=gt.div({display:"flex",height:"100%",overflow:"hidden"}),rq=gt.div(({theme:e})=>({width:"380px",minWidth:"300px",borderRight:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",overflow:"hidden"})),nq=gt.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}),B3=gt.div(({theme:e})=>({padding:"12px 16px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),z3=gt.h4(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px",margin:0})),Kd=gt.div({display:"flex",gap:"8px",marginTop:"10px"}),oq=gt(Rn)({flex:1,width:"auto"}),D3=gt(la)({flex:1,fontSize:"13px"}),iq=gt.div({flex:1,overflow:"auto",padding:"8px"}),aq=gt.div(({theme:e,selected:t,mapped:r})=>({padding:"12px",marginBottom:"8px",borderRadius:"8px",border:`2px solid ${t?e.color.secondary:r?e.color.positive:e.appBorderColor}`,backgroundColor:t?`${e.color.secondary}10`:e.background.content,cursor:"pointer",transition:"all 0.2s","&:hover":{borderColor:t?e.color.secondary:e.color.mediumlight}})),sq=gt.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"}),lq=gt.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),cq=gt.span(({theme:e,mapped:t})=>({fontSize:"10px",fontWeight:500,padding:"2px 6px",borderRadius:"4px",backgroundColor:t?`${e.color.positive}20`:e.background.hoverable,color:t?e.color.positive:e.color.mediumdark})),uq=gt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),pq=gt.div(({theme:e})=>({marginTop:"8px",padding:"8px",backgroundColor:`${e.color.positive}10`,borderRadius:"6px",fontSize:"11px",color:e.color.positive,display:"flex",alignItems:"center",gap:"8px",position:"relative"})),dq=gt.img(({theme:e})=>({width:"48px",height:"36px",objectFit:"contain",backgroundColor:e.background.content,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`,flexShrink:0})),fq=gt.div({flex:1,overflow:"hidden"}),gq=gt.div({fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),mq=gt.div(({theme:e})=>({position:"absolute",bottom:"100%",left:"0",marginBottom:"8px",backgroundColor:e.background.content,borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)",border:`1px solid ${e.appBorderColor}`,padding:"8px",zIndex:100,maxWidth:"280px",animation:"fadeIn 0.15s ease-out","@keyframes fadeIn":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}})),hq=gt.img(({theme:e})=>({width:"100%",maxWidth:"260px",maxHeight:"200px",objectFit:"contain",borderRadius:"4px",backgroundColor:e.background.app,display:"block"})),xq=gt.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",fontWeight:500,color:e.color.defaultText,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),yq=gt.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}),bq=gt.div({display:"flex",gap:"8px",flexWrap:"wrap"}),c5=gt.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:e.color.mediumdark,cursor:"pointer","& input":{cursor:"pointer"}})),wq=gt.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),u5=20,vq=gt.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"12px 0",borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),Sq=gt.button(({theme:e,disabled:t})=>({padding:"8px 16px",fontSize:"13px",fontWeight:500,color:t?e.color.mediumdark:e.color.secondary,backgroundColor:"transparent",border:`1px solid ${t?e.appBorderColor:e.color.secondary}`,borderRadius:"6px",cursor:t?"not-allowed":"pointer",opacity:t?.5:1,transition:"all 0.2s","&:hover":{backgroundColor:t?"transparent":`${e.color.secondary}10`}})),kq=gt.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",gap:"12px",padding:"8px 12px",backgroundColor:e.background.app,borderRadius:"6px",marginBottom:"8px"})),Cq=gt.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",fontSize:"13px",fontWeight:500,color:e.color.secondary,backgroundColor:"transparent",border:`1px solid ${e.color.secondary}`,borderRadius:"4px",cursor:"pointer",transition:"all 0.2s","&:hover":{backgroundColor:`${e.color.secondary}10`}})),Eq=gt.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),p5=gt.div(({theme:e})=>({gridColumn:"1 / -1",fontSize:"12px",color:e.color.mediumdark,textAlign:"center",padding:"8px 0"})),d5=gt.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px"})),Tq=gt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),Iq=gt.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),N3=gt.div(({theme:e})=>({borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,overflow:"hidden",backgroundColor:e.background.content})),O3=gt.div(({theme:e})=>({width:"100%",aspectRatio:"4 / 3",backgroundColor:e.background.hoverable,animation:"shimmer 1.5s infinite",background:`linear-gradient(90deg, ${e.background.hoverable} 25%, ${e.background.app} 50%, ${e.background.hoverable} 75%)`,backgroundSize:"200% 100%","@keyframes shimmer":{"0%":{backgroundPosition:"200% 0"},"100%":{backgroundPosition:"-200% 0"}}})),$3=gt.div(({theme:e,width:t="70%"})=>({height:"12px",width:t,backgroundColor:e.background.hoverable,borderRadius:"4px",margin:"12px",animation:"shimmer 1.5s infinite",background:`linear-gradient(90deg, ${e.background.hoverable} 25%, ${e.background.app} 50%, ${e.background.hoverable} 75%)`,backgroundSize:"200% 100%","@keyframes shimmer":{"0%":{backgroundPosition:"200% 0"},"100%":{backgroundPosition:"-200% 0"}}})),Rq=()=>se.createElement(Iq,null,Array.from({length:8}).map((e,t)=>se.createElement(N3,{key:t},se.createElement(O3,null),se.createElement($3,{width:`${60+t%3*15}%`})))),Aq=gt.div(({theme:e})=>({padding:"12px 16px",backgroundColor:`${e.color.secondary}10`,borderBottom:`1px solid ${e.appBorderColor}`,fontSize:"13px",color:e.color.defaultText,display:"flex",alignItems:"center",gap:"8px"})),Fq=gt.div({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.8)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:50,gap:"8px"}),Mq=gt.div(({theme:e})=>({width:"24px",height:"24px",border:`3px solid ${e.appBorderColor}`,borderTop:`3px solid ${e.color.secondary}`,borderRadius:"50%",animation:"spin 1s linear infinite","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),Pq=gt.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark})),H3=({stories:e,loading:t,selectedStoryId:r,onSelectStory:n,onStoryMapped:o,projectId:i})=>{let a=Kc({projectId:i,limit:u5,enabled:!!i}),[s,l]=xl("all"),[u,c]=xl(""),[d,f]=xl(null),[p,g]=xl(1),[m,T]=xl(null),[S,h]=xl(!1),M=l5(()=>{let E=new Set;return e.forEach(y=>{y.componentTitle&&E.add(y.componentTitle)}),Array.from(E).sort()},[e]),z=l5(()=>e.filter(E=>{if(s!=="all"&&E.componentTitle!==s)return!1;if(u){let y=u.toLowerCase();return E.name.toLowerCase().includes(y)||E.title.toLowerCase().includes(y)}return!0}),[e,s,u]),O=d?a.frames.find(E=>E.id===d):null,R=l5(()=>{if(!d)return[];let E=a.variantChildren[d]||[];return E.length===0?[]:a.variantFilters.some(y=>y.value)?E.filter(y=>y.variantProperties?a.variantFilters.every(C=>C.value?y.variantProperties?.[C.property]===C.value:!0):!1):E},[d,a.variantChildren,a.variantFilters]),B=R.slice(0,p*u5),x=R.length>p*u5;L3(()=>{if(!d||B.length===0)return;let E=B.map(y=>y.id);a.fetchVariantThumbnails(d,E)},[d,B.length,p]),L3(()=>{h(!1)},[]);let v=_3(async E=>{if(r)try{let y=q(),C=localStorage.getItem("uicopilot_session_token");if(!(await X(`${y}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({projectId:i,storyId:r,figmaNodeId:E.id,name:E.name})})).ok)throw new Error("Failed to save mapping");o(r,E.id,E.name)}catch(y){w.error("[MapStoriesTab] Error saving mapping:",y)}},[r,i,o]),I=_3((E,y)=>{if(y.stopPropagation(),d===E){f(null),g(1);return}f(E),g(1),!a.variantThumbnails[E]&&!a.loadingVariants.has(E)&&a.toggleExpanded(E,y)},[d,a]),L=e.find(E=>E.id===r);return t?se.createElement(Tq,null,"Loading stories..."):se.createElement(tq,null,se.createElement(rq,null,se.createElement(B3,null,se.createElement(z3,null,"Storybook Stories"),se.createElement(Kd,null,se.createElement(oq,{value:s,onChange:E=>l(E.target.value)},se.createElement("option",{value:"all"},"All Components"),M.map(E=>se.createElement("option",{key:E,value:E},E)))),se.createElement(Kd,null,se.createElement(D3,{type:"text",placeholder:"Search stories...",value:u,onChange:E=>c(E.target.value)}))),se.createElement(iq,null,z.length===0?se.createElement(d5,null,"No stories found"):z.map(E=>se.createElement(aq,{key:E.id,selected:E.id===r,mapped:!!E.figmaMapping,onClick:()=>n(E.id)},se.createElement(sq,null,se.createElement(lq,null,E.name),se.createElement(cq,{mapped:!!E.figmaMapping},E.figmaMapping?"Mapped":"Unmapped")),se.createElement(uq,null,E.title),E.figmaMapping&&se.createElement(pq,{onMouseEnter:()=>T(E.id),onMouseLeave:()=>T(null)},(()=>{let y=E.figmaMapping?.figmaNodeId,C=y?a.resolveThumbnail(y):void 0;return se.createElement(se.Fragment,null,C?se.createElement(dq,{src:C,alt:E.figmaMapping?.figmaFrameName||""}):se.createElement("span",null,"\u{1F517}"),m===E.id&&C&&se.createElement(mq,null,se.createElement(hq,{src:C,alt:E.figmaMapping?.figmaFrameName||""}),se.createElement(xq,null,E.figmaMapping?.figmaFrameName)))})(),se.createElement(fq,null,se.createElement(gq,null,E.figmaMapping.figmaFrameName))))))),se.createElement(nq,null,r?se.createElement(se.Fragment,null,se.createElement(Aq,null,se.createElement("span",null,"Click a Figma component below to link it to"," ",se.createElement("strong",null,L?.name))),se.createElement(B3,null,se.createElement(z3,null,"Figma Components"),se.createElement(Kd,null,se.createElement(bq,null,se.createElement(c5,null,se.createElement("input",{type:"checkbox",checked:a.showComponentSets,onChange:E=>a.setShowComponentSets(E.target.checked)}),"Component Sets"),se.createElement(c5,null,se.createElement("input",{type:"checkbox",checked:a.showFrames,onChange:E=>a.setShowFrames(E.target.checked)}),"Frames"),se.createElement(c5,null,se.createElement("input",{type:"checkbox",checked:a.showComponents,onChange:E=>a.setShowComponents(E.target.checked)}),"Components")),a.availablePages.length>1&&se.createElement(hl,{isActive:!!a.figmaPage,value:a.figmaPage,onChange:E=>a.setFigmaPage(E.target.value)},se.createElement("option",{value:""},"All pages"),a.availablePages.map(E=>se.createElement("option",{key:E,value:E},E)))),a.availableFilters.length>0&&se.createElement(qd,null,se.createElement(Qc,null,"Filters:"),a.availableFilters.slice(0,5).map(({property:E,values:y})=>{let C=a.variantFilters.find(b=>b.property===E);return se.createElement(hl,{key:E,isActive:!!C?.value,value:C?.value||"",onChange:b=>a.handleFilterChange(E,b.target.value)},se.createElement("option",{value:""},E),y.map(b=>se.createElement("option",{key:b,value:b},E,"=",b)))}),a.availableFilters.length>5&&se.createElement(Qc,{style:{opacity:.6,fontSize:"11px"}},"+",a.availableFilters.length-5," more"),a.variantFilters.some(E=>E.value)&&se.createElement(Yd,{onClick:a.clearFilters},"Clear All")),se.createElement(Kd,null,se.createElement(D3,{type:"text",placeholder:"Search Figma components...",value:a.search,onChange:E=>a.setSearch(E.target.value)}))),se.createElement(yq,null,S&&se.createElement(Fq,null,se.createElement(Mq,null),se.createElement(Pq,null,"Loading thumbnails...")),a.isLoading?se.createElement(Rq,null):a.filteredFrames.length===0?se.createElement(d5,null,se.createElement("span",null,"No components match. Try a different search term, or check that your Figma file has components defined. We index Figma components (component sets and standalone components) \u2014 plain design frames aren't indexed yet (support planned).")):se.createElement(wq,null,d&&O?se.createElement(se.Fragment,null,se.createElement(kq,null,se.createElement(Cq,{onClick:()=>{f(null),g(1)}},"Back"),se.createElement(Eq,null,O.name)),a.loadingVariants.has(d)?se.createElement(se.Fragment,null,se.createElement(p5,null,"Loading ",O.childCount??"..."," ","variants..."),Array.from({length:Math.min(8,O.childCount??8)}).map((E,y)=>se.createElement(N3,{key:`variant-skeleton-${y}`},se.createElement(O3,null),se.createElement($3,{width:`${60+y%3*15}%`})))):se.createElement(se.Fragment,null,se.createElement(p5,null,"Showing ",B.length," of"," ",R.length," variants"),B.map(E=>se.createElement(s5,{key:E.id,variant:E,thumbnail:a.variantThumbnails[d]?.[E.id]||a.thumbnails[E.id],onSelect:v,loadingDone:a.variantThumbnails[d]!==void 0&&!a.loadingVariants.has(d),failed:a.variantFailed[d]?.has(E.id)})))):se.createElement(se.Fragment,null,se.createElement(p5,null,"Showing ",a.frames.length," of ",a.totalFrames," ","components"),a.filteredFrames.map(E=>se.createElement(Zc,{key:E.id,frame:E,thumbnail:a.thumbnails[E.id],thumbnails:a.thumbnails,variantThumbnails:a.variantThumbnails[E.id],variantChildren:a.variantChildren[E.id],variantFailed:a.variantFailed[E.id],isLoadingVariants:a.loadingVariants.has(E.id),isExpanded:!1,onToggleExpand:I,onSelect:v,variantFilters:a.variantFilters}))),(d?x:a.hasMore)&&se.createElement(vq,null,se.createElement(Sq,{disabled:a.loadingMore,onClick:async()=>{d?g(E=>E+1):await a.loadMore()}},a.loadingMore?"Loading...":"Load More"))))):se.createElement(d5,null,se.createElement("span",null,"\u{1F448} Pick a story from the left, then browse your Figma file to find a matching frame. The mapping is saved per story."))))};Fe();import vt,{useState as eu,useMemo as j3,useCallback as f5}from"react";import{styled as fr}from"storybook/theming";tt();import _n,{useState as Lq,useEffect as _q,useCallback as Bq}from"react";import{styled as Vi,keyframes as U3}from"storybook/theming";var zq=U3({from:{opacity:0},to:{opacity:1}}),Dq=U3({from:{opacity:0,transform:"translate(-50%, -50%) scale(0.95)"},to:{opacity:1,transform:"translate(-50%, -50%) scale(1)"}}),Nq=Vi.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,animation:`${zq} 150ms ease-out`}),Oq=Vi.div(({theme:e})=>({position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:10001,backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,padding:`${e.layoutMargin*2.4}px`,minWidth:"320px",maxWidth:"440px",boxShadow:"0 8px 30px rgba(0, 0, 0, 0.2)",animation:`${Dq} 150ms ease-out`})),$q=Vi.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,color:e.color.defaultText})),Hq=Vi.p(({theme:e})=>({margin:`${e.layoutMargin}px 0 ${e.layoutMargin*2}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,color:e.color.defaultText,lineHeight:1.5})),Uq=Vi.div(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:`${e.layoutMargin*.8}px`})),jq=Vi.input(({theme:e})=>({width:"100%",padding:`${e.layoutMargin*.6}px ${e.layoutMargin*.8}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:e.background.app,color:e.color.defaultText,marginBottom:`${e.layoutMargin}px`,boxSizing:"border-box","&:focus":{outline:"none",borderColor:e.color.secondary}})),Vq=Vi.p(({theme:e})=>({margin:`0 0 ${e.layoutMargin*.6}px`,fontSize:e.typography.size.s1,fontFamily:e.typography.fonts.base,color:e.color.mediumdark})),Wq=Vi.button(({theme:e})=>({padding:`${e.layoutMargin*.8}px ${e.layoutMargin*1.6}px`,fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,cursor:"pointer",backgroundColor:"transparent",color:e.color.defaultText,transition:"background-color 0.15s","&:hover":{backgroundColor:e.background.hoverable}})),Gq=Vi.button(({theme:e,variant:t})=>({padding:`${e.layoutMargin*.8}px ${e.layoutMargin*1.6}px`,fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,border:"none",borderRadius:e.appBorderRadius,cursor:"pointer",transition:"opacity 0.15s",backgroundColor:t==="danger"?e.color.negative:e.color.secondary,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9},"&:disabled":{opacity:.4,cursor:"not-allowed"}})),Bn=({isOpen:e,title:t,message:r,confirmLabel:n="OK",cancelLabel:o="Cancel",variant:i="default",confirmText:a,onConfirm:s,onCancel:l})=>{let[u,c]=Lq(""),d=!!a&&u!==a,f=Bq(p=>{p.key==="Escape"&&l()},[l]);return _q(()=>{if(e)return c(""),document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,f]),e?_n.createElement(_n.Fragment,null,_n.createElement(Nq,{onClick:l}),_n.createElement(Oq,{role:"dialog","aria-modal":"true","aria-label":t},_n.createElement($q,null,t),_n.createElement(Hq,null,r),a&&_n.createElement(_n.Fragment,null,_n.createElement(Vq,null,"Type ",_n.createElement("strong",null,a)," to confirm:"),_n.createElement(jq,{type:"text",value:u,onChange:p=>c(p.target.value),placeholder:a,autoFocus:!0})),_n.createElement(Uq,null,_n.createElement(Wq,{onClick:l},o),_n.createElement(Gq,{variant:i,onClick:s,disabled:d},n)))):null};var qq=fr.div({display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}),Yq=fr.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px 20px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`,flexWrap:"wrap"})),Kq=fr(Rn)({width:"auto",minWidth:"200px"}),Xq=fr(la)({fontSize:"13px",minWidth:"250px"}),Jq=fr.button(({theme:e,active:t})=>({padding:"8px 12px",fontSize:"13px",fontWeight:500,border:`1px solid ${t?e.color.positive:e.appBorderColor}`,borderRadius:"6px",backgroundColor:t?`${e.color.positive}15`:e.background.content,color:t?e.color.positive:e.color.mediumdark,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s","&:hover":{borderColor:e.color.positive}})),Qq=fr.button(({theme:e})=>({marginLeft:"auto",padding:"8px 12px",fontSize:"13px",fontWeight:500,border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.background.content,color:e.color.defaultText,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s","&:hover":{backgroundColor:e.background.hoverable}})),Zq=fr.button(({theme:e})=>({padding:"8px 12px",fontSize:"13px",fontWeight:500,border:`1px solid ${e.color.negative}`,borderRadius:"6px",backgroundColor:e.background.content,color:e.color.negative,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s","&:hover":{backgroundColor:`${e.color.negative}10`},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),eY=fr.div({flex:1,overflow:"auto"}),tY=fr.table(({theme:e})=>({width:"100%",borderCollapse:"collapse",fontSize:"13px"})),rY=fr.thead(({theme:e})=>({position:"sticky",top:0,backgroundColor:e.background.app,zIndex:1})),Xd=fr.th(({theme:e})=>({padding:"12px 20px",textAlign:"left",fontWeight:600,fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.5px",color:e.color.mediumdark,borderBottom:`1px solid ${e.appBorderColor}`})),nY=fr.tbody({}),oY=fr.tr(({theme:e,mapped:t})=>({backgroundColor:t?"transparent":`${e.color.warning}05`,"&:hover":{backgroundColor:e.background.hoverable}})),Jd=fr.td(({theme:e})=>({padding:"14px 20px",borderBottom:`1px solid ${e.appBorderColor}`,verticalAlign:"middle"})),iY=fr.div({display:"flex",flexDirection:"column",gap:"2px"}),aY=fr.div(({theme:e})=>({fontWeight:500,color:e.color.defaultText})),sY=fr.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),lY=fr.div(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumlight,fontWeight:t?500:400,display:"flex",alignItems:"center",gap:"6px"})),cY=fr.div({display:"flex",alignItems:"center",gap:"8px"}),uY=fr.span(({theme:e,mapped:t})=>({width:"10px",height:"10px",borderRadius:"50%",backgroundColor:t?e.color.positive:e.color.mediumlight})),pY=fr.span(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumdark,fontWeight:500})),V3=fr.button(({theme:e,variant:t})=>({padding:"6px 12px",fontSize:"12px",fontWeight:500,border:`1px solid ${t==="link"?e.color.secondary:e.color.negative}`,borderRadius:"4px",backgroundColor:t==="link"?`${e.color.secondary}10`:`${e.color.negative}10`,color:t==="link"?e.color.secondary:e.color.negative,cursor:"pointer",transition:"all 0.2s","&:hover":{backgroundColor:t==="link"?`${e.color.secondary}20`:`${e.color.negative}20`}})),dY=fr.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px",padding:"40px"})),fY=fr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),W3=({stories:e,loading:t,onLink:r,onUnlink:n,onUnlinkAll:o,projectId:i})=>{let[a,s]=eu("all"),[l,u]=eu(""),[c,d]=eu(!0),[f,p]=eu(!1),[g,m]=eu(!1),T=j3(()=>{let R=new Set;return e.forEach(B=>{B.componentTitle&&R.add(B.componentTitle)}),Array.from(R).sort()},[e]),S=j3(()=>e.filter(R=>{if(a!=="all"&&R.componentTitle!==a||!c&&!R.figmaMapping)return!1;if(l){let B=l.toLowerCase();return R.name.toLowerCase().includes(B)||R.title.toLowerCase().includes(B)||(R.figmaMapping?.figmaFrameName?.toLowerCase().includes(B)??!1)}return!0}),[e,a,l,c]),h=f5(async R=>{try{let B=q(),x=localStorage.getItem("uicopilot_session_token");if(!(await X(`${B}/api/mappings?projectId=${i}&storyId=${R}`,{method:"DELETE",headers:{Authorization:`Bearer ${x}`}})).ok)throw new Error("Failed to delete mapping");n(R)}catch(B){console.error("[ViewAllMappingsTab] Error unlinking:",B)}},[i,n]),M=f5(()=>{let R=e.filter(I=>I.figmaMapping).map(I=>({storyId:I.id,storyName:I.name,storyTitle:I.title,figmaNodeId:I.figmaMapping.figmaNodeId,figmaFrameName:I.figmaMapping.figmaFrameName})),B=new Blob([JSON.stringify(R,null,2)],{type:"application/json"}),x=URL.createObjectURL(B),v=document.createElement("a");v.href=x,v.download=`figma-mappings-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(v),v.click(),document.body.removeChild(v),URL.revokeObjectURL(x)},[e]),z=f5(async()=>{m(!0);try{let R=q(),B=localStorage.getItem("uicopilot_session_token");if(!(await X(`${R}/api/mappings/batch?projectId=${i}`,{method:"DELETE",headers:{Authorization:`Bearer ${B}`}})).ok)throw new Error("Failed to delete mappings");o()}catch(R){console.error("[ViewAllMappingsTab] Error unlinking all:",R)}finally{m(!1),p(!1)}},[i,o]);if(t)return vt.createElement(fY,null,"Loading mappings...");let O=e.filter(R=>R.figmaMapping).length;return vt.createElement(qq,null,vt.createElement(Yq,null,vt.createElement(Kq,{value:a,onChange:R=>s(R.target.value)},vt.createElement("option",{value:"all"},"All Components"),T.map(R=>vt.createElement("option",{key:R,value:R},R))),vt.createElement(Xq,{type:"text",placeholder:"\u{1F50D} Search stories or Figma components...",value:l,onChange:R=>u(R.target.value)}),vt.createElement(Jq,{active:c,onClick:()=>d(!c)},c?"\u2611":"\u2610"," Show unmapped"),vt.createElement(Qq,{onClick:M,disabled:O===0},"\u{1F4E5} Export JSON"),O>0&&vt.createElement(Zq,{onClick:()=>p(!0),disabled:g,title:"Remove every story\u2192Figma mapping for this project"},g?"Unlinking\u2026":`\u{1F5D1} Unlink All (${O})`)),S.length===0?vt.createElement(dY,null,vt.createElement("span",null,"\u{1F4ED}"),l?"No stories match your search":"No stories found"):vt.createElement(eY,null,vt.createElement(tY,null,vt.createElement(rY,null,vt.createElement("tr",null,vt.createElement(Xd,{style:{width:"35%"}},"Story"),vt.createElement(Xd,{style:{width:"35%"}},"Figma Component"),vt.createElement(Xd,{style:{width:"15%"}},"Status"),vt.createElement(Xd,{style:{width:"15%"}},"Actions"))),vt.createElement(nY,null,S.map(R=>vt.createElement(oY,{key:R.id,mapped:!!R.figmaMapping},vt.createElement(Jd,null,vt.createElement(iY,null,vt.createElement(aY,null,R.name),vt.createElement(sY,null,R.title))),vt.createElement(Jd,null,vt.createElement(lY,{mapped:!!R.figmaMapping},R.figmaMapping?vt.createElement(vt.Fragment,null,vt.createElement("span",null,"\u{1F3A8}"),R.figmaMapping.figmaFrameName):"\u2014")),vt.createElement(Jd,null,vt.createElement(cY,null,vt.createElement(uY,{mapped:!!R.figmaMapping}),vt.createElement(pY,{mapped:!!R.figmaMapping},R.figmaMapping?"Mapped":"Unmapped"))),vt.createElement(Jd,null,R.figmaMapping?vt.createElement(V3,{variant:"unlink",onClick:()=>h(R.id)},"Unlink"):vt.createElement(V3,{variant:"link",onClick:()=>r(R.id)},"Link"))))))),vt.createElement(Bn,{isOpen:f,variant:"danger",title:"Unlink all mappings?",message:`This removes all ${O} story\u2192Figma mapping${O===1?"":"s"} for this project. Stories stay; only the Figma links are cleared, so you can re-map from scratch. This can't be undone.`,confirmLabel:"Unlink All",cancelLabel:"Cancel",onConfirm:z,onCancel:()=>p(!1)}))};import me,{useState as os,useMemo as e6,useRef as DY,useEffect as NY}from"react";import{styled as at}from"storybook/theming";import qr,{useEffect as gY,useRef as mY}from"react";import{createPortal as hY}from"react-dom";import{styled as Wi}from"storybook/theming";var xY=Wi.div(({theme:e})=>({position:"fixed",zIndex:10050,minWidth:"440px",maxWidth:"620px",maxHeight:"60vh",overflowY:"auto",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,boxShadow:"0 10px 30px rgba(0,0,0,0.22)",padding:`${e.layoutMargin}px`,fontFamily:e.typography.fonts.base})),yY=Wi.div(({theme:e})=>({fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,color:e.color.defaultText,marginBottom:"2px"})),bY=Wi.div(({theme:e})=>({fontFamily:e.typography.fonts.mono,fontSize:"11px",color:e.color.mediumdark,marginBottom:`${e.layoutMargin*.8}px`})),wY=Wi.table({width:"100%",borderCollapse:"collapse",tableLayout:"fixed"}),g5=Wi.th(({theme:e})=>({textAlign:"left",fontFamily:e.typography.fonts.mono,fontSize:"10px",letterSpacing:"0.08em",textTransform:"uppercase",color:e.color.mediumdark,fontWeight:"normal",padding:"0 6px 4px 0",borderBottom:`1px solid ${e.appBorderColor}`})),m5=Wi.td(({theme:e,muted:t})=>({fontFamily:e.typography.fonts.mono,fontSize:"11px",color:t?e.color.mediumdark:e.color.defaultText,padding:"3px 6px 3px 0",verticalAlign:"top",wordBreak:"break-word"})),vY=Wi.tr(({theme:e})=>({"& td":{borderTop:`1px solid ${e.appBorderColor}`,paddingTop:"6px"}})),SY=Wi.span(({theme:e,vouch:t})=>({color:t==="differs"?ee.amber:t==="matched"?ee.green:e.color.mediumdark,fontWeight:e.typography.weight.bold,marginRight:"5px"})),kY=Wi.div(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:`${e.layoutMargin}px`,marginTop:`${e.layoutMargin*.8}px`,paddingTop:"6px",borderTop:`1px solid ${e.appBorderColor}`,fontFamily:e.typography.fonts.mono,fontSize:"10px",color:e.color.mediumdark})),CY={matched:"\u2713",differs:"\u2260","no-evidence":"\xF8"},G3={differs:0,matched:1,"no-evidence":2},q3=({title:e,subtitle:t,verdicts:r,figmaNodeId:n,renderScore:o,anchor:i,onClose:a})=>{let s=mY(null);gY(()=>{let c=f=>{s.current?.contains(f.target)||a()},d=f=>{f.key==="Escape"&&a()};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d)}},[a]);let l=[...r].sort((c,d)=>G3[c.vouch]-G3[d.vouch]||c.prop.localeCompare(d.prop)),u={differs:r.filter(c=>c.vouch==="differs").length,matched:r.filter(c=>c.vouch==="matched").length,none:r.filter(c=>c.vouch==="no-evidence").length};return hY(qr.createElement(xY,{ref:s,role:"dialog","aria-label":`Property comparison for ${e}`,style:{top:i.top,left:i.left}},qr.createElement(yY,null,e),t&&qr.createElement(bY,null,t),qr.createElement(wY,null,qr.createElement("thead",null,qr.createElement("tr",null,qr.createElement(g5,{style:{width:"34%"}},"Property"),qr.createElement(g5,{style:{width:"33%"}},"Figma"),qr.createElement(g5,{style:{width:"33%"}},"Code"))),qr.createElement("tbody",null,l.map((c,d)=>{let f=c.vouch==="no-evidence",p=d>0&&l[d-1].vouch!==c.vouch?vY:"tr";return qr.createElement(p,{key:c.prop},qr.createElement(m5,{muted:f},qr.createElement(SY,{vouch:c.vouch},CY[c.vouch]),c.prop),qr.createElement(m5,{muted:f},c.figma??"\u2014"),qr.createElement(m5,{muted:f},c.code??"\u2014"))}))),qr.createElement(kY,null,qr.createElement("span",null,"node ",n,o!=null&&` \xB7 render ${Math.round(o*100)}%`),qr.createElement("span",null,u.differs," differ \xB7 ",u.matched," agree \xB7 ",u.none," no data"))),document.body)};import Y3 from"react";import{styled as K3,keyframes as EY}from"storybook/theming";var TY=EY`
85
85
  0% { transform: rotate(0deg); }
86
86
  100% { transform: rotate(360deg); }
87
- `,IY=K3.span(({theme:e})=>({display:"inline-block",width:"12px",height:"12px",border:`2px solid ${e.appBorderColor}`,borderTopColor:"currentColor",borderRadius:"50%",animation:`${TY} 0.6s linear infinite`,marginRight:"6px",verticalAlign:"middle"})),RY=K3.button(({theme:e,variant:t="default",disabled:r})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"5px 12px",fontSize:"12px",fontWeight:600,border:`1px solid ${e.color.medium}`,borderRadius:"5px",cursor:r?"not-allowed":"pointer",opacity:r?.6:1,transition:"all 0.2s",whiteSpace:"nowrap",...t==="default"&&{backgroundColor:e.background.content,color:e.color.defaultText,"&:hover":r?{}:{borderColor:e.color.secondary,color:e.color.secondary,backgroundColor:"rgba(30, 167, 253, 0.05)"}},...t==="ghost"&&{backgroundColor:"transparent",border:"none",color:e.color.mediumdark,padding:"5px 8px","&:hover":r?{}:{color:e.color.defaultText,backgroundColor:e.background.hoverable}}})),ii=({loading:e=!1,disabled:t=!1,onClick:r,variant:n="default",children:o,loadingText:i})=>Y3.createElement(RY,{variant:n,disabled:t||e,onClick:r},e&&Y3.createElement(IY,null),e&&i?i:o);Fe();import Yr from"react";import{styled as tu}from"storybook/theming";var X3=tu.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",backgroundColor:e.background.hoverable,borderRadius:"6px",fontFamily:"Inter, sans-serif",fontSize:"11px",color:e.color.mediumdark,gap:"16px"})),AY=tu.div({display:"flex",alignItems:"center",gap:"12px"}),Qd=tu.span({whiteSpace:"nowrap"}),J3=tu.div({display:"flex",alignItems:"center",gap:"8px"}),Zd=tu.span(({theme:e})=>({fontWeight:600,color:e.color.defaultText})),ef=({inputTokens:e,outputTokens:t,costUsd:r,compact:n=!1})=>{let o=e+t,i=r*XT;return n?Yr.createElement(X3,null,Yr.createElement(Qd,null,o.toLocaleString()," tokens"),Yr.createElement(J3,null,Yr.createElement(Zd,null,"$",r.toFixed(4)),Yr.createElement("span",null,"\xB7"),Yr.createElement(Zd,null,"\u20AA",i.toFixed(2)))):Yr.createElement(X3,null,Yr.createElement(AY,null,Yr.createElement(Qd,null,e.toLocaleString()," input"),Yr.createElement("span",null,"+"),Yr.createElement(Qd,null,t.toLocaleString()," output"),Yr.createElement("span",null,"="),Yr.createElement(Qd,null,Yr.createElement("strong",null,o.toLocaleString())," tokens")),Yr.createElement(J3,null,Yr.createElement(Zd,null,"$",r.toFixed(4)),Yr.createElement("span",null,"\xB7"),Yr.createElement(Zd,null,"\u20AA",i.toFixed(2))))};import zn from"react";import{styled as xa}from"storybook/theming";function h5(e){if(typeof e!="string")return e;try{let t=JSON.parse(e);if(t.summary)return t}catch{}return{summary:e}}var FY=xa.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:`${e.layoutMargin*.5}px`})),Q3=xa.div(({theme:e,color:t})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:t||e.color.defaultText,lineHeight:"1.4"})),MY=xa.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.25}px`,flexWrap:"wrap",fontSize:e.typography.size.s1,color:e.color.mediumdark})),PY=xa.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:`${e.layoutMargin*.2}px`,padding:`1px ${e.layoutMargin*.5}px`,borderRadius:e.appBorderRadius,backgroundColor:e.background.hoverable,fontSize:e.typography.size.s1,fontFamily:e.typography.fonts.mono})),LY=xa.span(({theme:e})=>({color:e.color.mediumlight,fontSize:e.typography.size.s1})),_Y=xa.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,fontStyle:"italic"})),BY=xa.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,display:"flex",gap:`${e.layoutMargin*.25}px`})),zY=xa.span(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText})),Z3=({data:e,color:t,compact:r})=>r?zn.createElement(Q3,{color:t},e.summary):zn.createElement(FY,null,zn.createElement(Q3,{color:t},e.summary),e.mappings&&e.mappings.length>0&&zn.createElement(MY,null,e.mappings.map((n,o)=>zn.createElement(zn.Fragment,{key:o},zn.createElement(PY,null,n.from," ",zn.createElement(LY,null,"\u2192")," ",n.to)))),e.candidates!=null&&e.candidates>1&&zn.createElement(_Y,null,e.candidates," candidate variants matched"),e.defaults&&e.defaults.length>0&&zn.createElement(zn.Fragment,null,e.defaults.map((n,o)=>zn.createElement(BY,{key:o},zn.createElement(zY,null,n.choice),zn.createElement("span",null,"\u2014 ",n.why)))));var OY=at.div({display:"flex",flexDirection:"column",flex:1,overflow:"hidden"}),$Y=at.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${e.appBorderColor}`})),HY=at.div({display:"flex",flexDirection:"column",gap:"4px"}),UY=at.div({display:"flex",alignItems:"center",gap:"10px"}),jY=at.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText,letterSpacing:"-0.3px"})),x5=at.span(({theme:e,variant:t})=>({padding:"3px 10px",borderRadius:"20px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,fontWeight:500,backgroundColor:t==="success"?`${e.color.positive}1a`:t==="danger"?`${e.color.negative}1a`:`${e.color.secondary}1a`,color:t==="success"?e.color.positive:t==="danger"?e.color.negative:e.color.secondary})),VY=at.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark})),WY=at.div({display:"flex",gap:"8px"}),GY=at.div(({theme:e})=>({display:"flex",alignItems:"center",padding:"12px 24px",gap:"12px",borderBottom:`1px solid ${e.appBorderColor}`})),qY=at(la)(({theme:e})=>({flex:1,fontSize:e.typography.size.s2})),YY=at.div({display:"flex",gap:"4px"}),tf=at.button(({theme:e,active:t})=>({padding:"6px 12px",borderRadius:"6px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:500,border:t?"none":`1px solid ${e.appBorderColor}`,backgroundColor:t?e.color.defaultText:e.background.content,color:t?e.color.inverseText:e.color.mediumdark,cursor:"pointer",transition:"all 0.15s","&:hover":{backgroundColor:t?e.color.defaultText:e.background.hoverable}})),KY=at.div({display:"flex",flexDirection:"column",flex:1,padding:"16px 24px",gap:"8px",overflowY:"auto"}),t6=at.div({display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",flex:"none"}),r6=at.span(({theme:e})=>({fontSize:"9px",fontWeight:e.typography.weight.bold,letterSpacing:"0.06em",textTransform:"uppercase",color:e.color.mediumdark,whiteSpace:"nowrap"})),XY=at.div(({theme:e,dimmed:t,accent:r})=>{let n=r==="ready"?ee.green:r==="drift"?ee.amber:r==="flag"?e.color.secondary:r==="needyou"?e.color.mediumdark:e.appBorderColor;return{display:"flex",alignItems:"center",padding:"12px 16px",border:`1px solid ${e.appBorderColor}`,borderLeft:`4px solid ${n}`,borderRadius:"10px",gap:"12px",backgroundColor:e.background.content,opacity:t?.6:1,transition:"opacity 0.15s",position:"relative",zIndex:0,"&:hover":{zIndex:10}}}),JY=at.div(({theme:e,checked:t})=>({width:"18px",height:"18px",borderRadius:"4px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.15s",...t?{backgroundColor:e.color.defaultText,color:e.color.inverseText,fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold}:{border:`2px solid ${e.color.mediumlight}`}})),QY=at.div(({theme:e,bgColor:t})=>({width:"48px",height:"40px",borderRadius:"6px",backgroundColor:t||e.background.hoverable,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,overflow:"hidden"})),b5=at.div(({theme:e})=>({width:"120px",height:"80px",borderRadius:"8px",backgroundColor:e.background.hoverable,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,overflow:"hidden",border:`1px solid ${e.appBorderColor}`})),ZY=at.img({width:"100%",height:"100%",objectFit:"contain"}),l6=at.div(({theme:e})=>({width:"16px",height:"16px",border:`2px solid ${e.appBorderColor}`,borderTopColor:e.color.secondary,borderRadius:"50%",animation:"uicopilot-spin 0.8s linear infinite","@keyframes uicopilot-spin":{to:{transform:"rotate(360deg)"}}})),eK=at.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:"9px",letterSpacing:"0.03em",textTransform:"uppercase",color:e.color.mediumdark,textAlign:"center",padding:"4px"})),n6=at.div({flex:1,display:"flex",flexDirection:"column",gap:"2px",minWidth:0}),o6=at.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:500,color:e.color.defaultText,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),y5=at.span(({theme:e,color:t})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:t||e.color.mediumdark,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),Ewe=at.span(({theme:e,color:t})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:t||e.color.mediumdark,lineHeight:1.5,whiteSpace:"pre-line"})),tK=at.div(({theme:e})=>({flexShrink:0,color:e.color.mediumlight,fontSize:"14px"})),rK=at.div({display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px"}),nK=at.span(({theme:e,vouch:t})=>{let r=t==="matched"?ee.green:t==="differs"?ee.amber:e.color.mediumdark;return{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.defaultText,background:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,padding:"1px 6px",opacity:t==="no-evidence"?.65:1,"&::before":{content:'""',width:"6px",height:"6px",borderRadius:"50%",background:r,flexShrink:0}}}),oK=at.div(({theme:e,tone:t})=>({display:"flex",alignItems:"flex-start",gap:"6px",marginTop:"6px",padding:`${e.layoutMargin*.5}px ${e.layoutMargin*.75}px`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,lineHeight:1.45,color:e.color.defaultText,background:e.background.hoverable,borderLeft:`3px solid ${t==="good"?ee.green:ee.amber}`,borderRadius:e.appBorderRadius})),i6=at.span(({tone:e})=>({fontWeight:600,color:e==="good"?ee.green:ee.amber})),iK=at.div(({theme:e})=>({marginTop:"6px",padding:`${e.layoutMargin*.5}px ${e.layoutMargin*.75}px`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,lineHeight:1.45,color:e.color.mediumdark,background:e.background.hoverable,borderLeft:`3px dashed ${e.appBorderColor}`,borderRadius:e.appBorderRadius})),aK=at.div(({theme:e})=>({marginTop:"6px",padding:`${e.layoutMargin*.5}px ${e.layoutMargin*.75}px`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,lineHeight:1.45,color:e.color.defaultText,background:e.background.hoverable,borderLeft:`3px solid ${e.color.secondary}`,borderRadius:e.appBorderRadius})),sK=at.span(({theme:e,level:t})=>({padding:"4px 10px",borderRadius:"20px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,flexShrink:0,backgroundColor:t==="high"?`${e.color.positive}1a`:t==="medium"?`${e.color.warning}1a`:`${e.color.negative}1a`,color:t==="high"?e.color.positive:t==="medium"?e.color.warning:e.color.negative})),lK=at.button(({theme:e})=>({padding:"4px 8px",borderRadius:e.appBorderRadius,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,fontWeight:500,border:`1px solid ${e.appBorderColor}`,backgroundColor:"transparent",color:e.color.mediumdark,cursor:"pointer",flexShrink:0,transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText}})),cK=at.button(({theme:e})=>({padding:"4px 7px",borderRadius:e.appBorderRadius,fontFamily:e.typography.fonts.mono,fontSize:e.typography.size.s1,border:`1px solid ${e.appBorderColor}`,backgroundColor:"transparent",color:e.color.mediumdark,cursor:"pointer",flexShrink:0,transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText}})),uK=at.div(({theme:e})=>({padding:"16px 0",marginTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",gap:"8px"})),pK=at.div({display:"flex",flexWrap:"wrap",gap:"6px"}),dK=at.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",border:`1px dashed ${e.appBorderColor}`,borderRadius:"8px",backgroundColor:e.background.hoverable,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark})),fK=at.span(({theme:e,variant:t})=>({padding:"3px 10px",borderRadius:"20px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,fontWeight:500,backgroundColor:t==="cache"?`${e.color.warning}1a`:`${e.color.positive}1a`,color:t==="cache"?e.color.warning:e.color.positive})),gK=at.div(({theme:e})=>({marginTop:"4px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.warning}));function mK(e){let t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;let n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}var hK=at.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"5px",padding:"5px 12px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:"transparent",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:500,color:e.color.mediumdark,cursor:"pointer",transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),Twe=at.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 24px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.hoverable,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.mediumdark})),a6=({storyId:e,alt:t,src:r,onRequestCapture:n,fallback:o,title:i})=>{let a=DY(null),[s,l]=os(!1);return NY(()=>{if(s||r)return;let u=a.current;if(!u||typeof IntersectionObserver>"u"){l(!0),n?.(e);return}let c=new IntersectionObserver(d=>{d.some(f=>f.isIntersecting)&&(l(!0),n?.(e),c.disconnect())},{root:null,rootMargin:"200px 0px",threshold:.01});return c.observe(u),()=>c.disconnect()},[e,r,s,n]),me.createElement("div",{ref:a},r?me.createElement(b5,{title:i},me.createElement(xK,{src:r,alt:t})):s?me.createElement(b5,{title:i},me.createElement(l6,null)):o)},xK=({src:e,alt:t})=>{let[r,n]=os(!1),[o,i]=os(!1);return o?me.createElement(eK,{title:t},"preview unavailable"):me.createElement(me.Fragment,null,!r&&me.createElement(l6,null),me.createElement(ZY,{src:e,alt:t,onLoad:()=>n(!0),onError:()=>i(!0),style:r?void 0:{position:"absolute",opacity:0}}))};function rf(e){return e.belowFloor?"needyou":e.rendersMoreLike?"flag":e.vouching?.verdicts?.some(t=>t.vouch==="differs")?"drift":"ready"}function s6(e,t){if(t==="all")return!0;let r=rf(e);return t==="ready"?r==="ready"||r==="drift":r===t}function yK(e){return e>=90?"high":e>=70?"medium":"low"}function bK(e){return e==="high"?"#16a34a":e==="medium"?"#d97706":"#ef4444"}var wK={matched:"\u2713",differs:"\u2260","no-evidence":"\xF8"},vK={backgroundColor:"color",color:"color",textColor:"color",fill:"color",borderColor:"border",borderWidth:"border",strokes:"border",strokeWeight:"border",padding:"padding",paddingV:"padding",paddingH:"padding",paddingTop:"padding",paddingRight:"padding",paddingBottom:"padding",paddingLeft:"padding",gap:"padding",itemSpacing:"padding",borderRadius:"radius",cornerRadius:"radius",fontFamily:"type",fontSize:"type",fontWeight:"type",lineHeight:"type",letterSpacing:"type",fontStyle:"type",boxShadow:"shadow",shadow:"shadow",effects:"shadow",opacity:"shadow",icon:"icon",hasIcon:"icon"},SK=["color","border","padding","radius","type","shadow","icon","other"];function kK({vouching:e}){let t=new Map;for(let i of e.verdicts){if(i.vouch==="no-evidence")continue;let a=vK[i.prop]??"other",s=t.get(a)??{differs:!1,matched:!1};i.vouch==="differs"?s.differs=!0:s.matched=!0,t.set(a,s)}let r=SK.filter(i=>t.has(i)).map(i=>{let s=t.get(i).differs?"differs":"matched";return{axis:i,vouch:s}});if(r.length===0)return null;let n=r.filter(i=>i.vouch==="differs"),o=e.specScore!=null?` \xB7 render ${Math.round(e.specScore*100)}%`:"";return me.createElement(me.Fragment,null,me.createElement(rK,null,r.map(i=>me.createElement(nK,{key:i.axis,vouch:i.vouch},i.axis," ",wK[i.vouch]))),me.createElement(oK,{tone:n.length===0?"good":"drift"},n.length===0?me.createElement("span",null,me.createElement(i6,{tone:"good"},"Strong match.")," Every compared axis agrees \u2014 ",r.length," of ",r.length,o,"."):me.createElement("span",null,me.createElement(i6,{tone:"drift"},n.map(i=>i.axis).join(", ")," ",n.length===1?"differs":"differ",".")," ","value drift the review flags, not a mapping problem",o,".")))}var w5=({results:e,stories:t,onApply:r,onCancel:n,onRerun:o,isApplying:i,isRerunning:a,source:s,resolveThumbnail:l,resolveStoryScreenshot:u,isCapturingScreenshots:c,onRequestStoryCapture:d,onRequestFigmaThumbnail:f,onBrowse:p})=>{let[g,m]=os(()=>{let C=new Set;for(let b of e.mappings)b.belowFloor||(b.vouching||b.confidence>=90)&&C.add(b.storyId);return C}),[T,S]=os(""),[h,M]=os("all"),[z,O]=os(null),R=e6(()=>{let C=new Map;for(let b of t)C.set(b.id,{name:b.name,title:b.title});return C},[t]),B=e6(()=>{let C=e.mappings;if(h!=="all"&&(C=C.filter(b=>s6(b,h))),T.trim()){let b=T.toLowerCase();C=C.filter(A=>{let P=R.get(A.storyId);return P?.name.toLowerCase().includes(b)||P?.title.toLowerCase().includes(b)||A.componentSetName.toLowerCase().includes(b)||A.figmaFrameName.toLowerCase().includes(b)})}return C},[e.mappings,h,T,R]),x=C=>{m(b=>{let A=new Set(b);return A.has(C)?A.delete(C):A.add(C),A})},v=()=>{let C=e.mappings.filter(A=>g.has(A.storyId)),b=e.mappings.filter(A=>!g.has(A.storyId)).map(A=>A.storyId);r(C,b)},I=e.mappings.filter(C=>s6(C,"ready")).length,L=e.mappings.filter(C=>rf(C)==="flag").length,E=e.mappings.filter(C=>rf(C)==="needyou").length,y=e.usage;return me.createElement(OY,null,me.createElement($Y,null,me.createElement(HY,null,me.createElement(UY,null,me.createElement(jY,null,s==="deterministic"?"Auto-Link Results":"Auto-Map Results"),me.createElement(x5,{variant:"success"},e.mappings.filter(C=>!C.belowFloor).length," matched"),e.mappings.some(C=>C.belowFloor)&&me.createElement(x5,{variant:"info"},e.mappings.filter(C=>C.belowFloor).length," need you"),e.unmatched.length>0&&me.createElement(x5,{variant:"danger"},e.unmatched.length," unmatched"),s&&me.createElement(fK,{variant:s},s==="cache"?"Loaded from cache":s==="deterministic"?"Deterministic (no AI)":"Fresh analysis")),me.createElement(VY,null,"Review matches below. Uncheck any incorrect mappings before applying."),e.computedAt&&me.createElement(gK,null,"\u26A0 Computed ",mK(e.computedAt)," \u2014 re-run to match against your current Figma file.")),me.createElement(WY,null,o&&me.createElement(hK,{onClick:o,disabled:a},a?"Running\u2026":s==="deterministic"?"\u21BB Run again":"\u21BB Re-run LLM"),me.createElement(ii,{onClick:n,variant:"ghost"},"Cancel"),me.createElement(ii,{loading:i,onClick:v,loadingText:"Applying..."},"Apply ",g.size," Selected"))),me.createElement(GY,null,me.createElement(qY,{type:"text",placeholder:"Filter stories...",value:T,onChange:C=>S(C.target.value)}),me.createElement(YY,null,me.createElement(tf,{active:h==="all",onClick:()=>M("all")},"All ",e.mappings.length),I>0&&me.createElement(tf,{active:h==="ready",onClick:()=>M("ready")},"Ready (",I,")"),L>0&&me.createElement(tf,{active:h==="flag",onClick:()=>M("flag")},"Renders elsewhere (",L,")"),E>0&&me.createElement(tf,{active:h==="needyou",onClick:()=>M("needyou")},"Need you (",E,")"))),me.createElement(KY,null,B.map(C=>{let b=R.get(C.storyId),A=yK(C.confidence),P=g.has(C.storyId),F=A==="low";return me.createElement(XY,{key:C.storyId,dimmed:F&&!P,accent:rf(C)},me.createElement(JY,{checked:P,onClick:()=>x(C.storyId)},P?"\u2713":""),(()=>{let D=u?.(C.storyId),k=me.createElement(a6,{storyId:C.storyId,alt:b?.name||C.storyId,src:D,onRequestCapture:d,fallback:me.createElement(QY,{bgColor:F?js.bgIdle:js.bgActive},me.createElement("span",{style:{fontFamily:"Inter",fontSize:"8px",fontWeight:500,color:F?js.iconIdle:js.iconActive}},(b?.name||"?").substring(0,4)))});return me.createElement(t6,null,k,me.createElement(r6,null,"Storybook"))})(),me.createElement(n6,null,me.createElement(o6,null,b?.name||C.storyId),me.createElement(y5,null,b?.title||"")),me.createElement(tK,null,"\u2192"),(()=>{let D=l?.(C.figmaNodeId),k=h5(C.reason),N=C.vouching?C.figmaFrameName:k.summary+(k.candidates?` (${k.candidates} candidates)`:""),G=me.createElement(a6,{storyId:C.figmaNodeId,alt:C.figmaFrameName,src:D,title:N,onRequestCapture:f,fallback:me.createElement(b5,{title:N},me.createElement("span",{style:{fontFamily:"Inter",fontSize:"10px",fontWeight:500,color:js.iconIdle}},"No thumbnail"))});return me.createElement(t6,null,G,me.createElement(r6,null,"Figma"))})(),me.createElement(n6,null,me.createElement(o6,null,C.componentSetName),C.figmaFrameName!==C.componentSetName&&me.createElement(y5,null,C.figmaFrameName),C.belowFloor?me.createElement(iK,null,"No confident match \u2014 closest is"," ",me.createElement("b",null,C.componentSetName),C.bestScore!=null?` (best ${Math.round(C.bestScore*100)}%)`:"",". Left unselected; map by hand if it's right."):C.vouching?me.createElement(kK,{vouching:C.vouching}):me.createElement(Z3,{data:h5(C.reason),color:bK(A)}),C.rendersMoreLike&&me.createElement(aK,null,"\u2937 renders more like ",me.createElement("b",null,C.rendersMoreLike.name)," (",Math.round(C.rendersMoreLike.score*100),"%) \u2014 name picked this, but check the mapping")),me.createElement(sK,{level:A},C.confidence,"%"),C.vouching?.verdicts?.length?me.createElement(cK,{title:"Compare the Figma and code values behind this match","aria-label":"Compare properties",onClick:D=>{let k=D.currentTarget.getBoundingClientRect();O(N=>N?.storyId===C.storyId?null:{storyId:C.storyId,top:Math.min(k.bottom+6,window.innerHeight-320),left:Math.max(12,k.left-380)})}},"{}"):null,p&&me.createElement(lK,{onClick:()=>p(C.componentSetName)},"Browse"),z?.storyId===C.storyId&&C.vouching?.verdicts&&me.createElement(q3,{title:C.componentSetName,subtitle:C.figmaFrameName!==C.componentSetName?C.figmaFrameName:void 0,verdicts:C.vouching.verdicts,figmaNodeId:C.figmaNodeId,renderScore:C.vouching.specScore,anchor:{top:z.top,left:z.left},onClose:()=>O(null)}))}),e.unmatched.length>0&&me.createElement(uK,null,me.createElement(y5,null,e.unmatched.length," stories couldn't be matched \u2014 map manually after applying"),me.createElement(pK,null,e.unmatched.map(C=>{let b=R.get(C);return me.createElement(dK,{key:C},me.createElement("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#cbd5e1"}}),b?`${b.name} (${b.title})`:C)})))),y&&s!=="cache"&&me.createElement("div",{style:{padding:"8px 24px",borderTop:"1px solid #f0f0f0"}},me.createElement(ef,{inputTokens:y.inputTokens||0,outputTokens:y.outputTokens||0,costUsd:y.costUsd||0})))};Fe();Ne();import{useState as ya,useCallback as ba,useRef as CK}from"react";import{useStorybookApi as EK,addons as TK}from"storybook/manager-api";function c6({projectId:e}){let t=EK(),r=CK(null),[n,o]=ya(!1),[i,a]=ya(!1),[s,l]=ya(!1),[u,c]=ya(null),[d,f]=ya(null),[p,g]=ya(null),[m,T]=ya(""),[S,h]=ya(null),M=ba(async()=>{let L=await fetch("/index.json");if(!L.ok)throw new Error("Failed to fetch Storybook index");let E=await L.json(),y=E.entries||E.stories||{},C=Object.keys(y).filter(P=>y[P].type==="story");w.debug(`[useAutoMap] Found ${C.length} stories in index.json`);let b=[];for(let P of C){let F=y[P],D=t.getData(P),k={...D?.initialArgs||{}},N=D?.argTypes||{};for(let[G,_]of Object.entries(N))if(!(G in k)){let le=_;if(le.defaultValue!==void 0)k[G]=le.defaultValue;else if(le.table?.defaultValue?.summary!==void 0){let $=le.table.defaultValue.summary;$==="false"?k[G]=!1:$==="true"?k[G]=!0:k[G]=$}}b.push({id:P,name:F.name||P.split("--").pop()||P,title:F.title||"",initialArgs:k,argTypes:N})}let A=b.filter(P=>Object.keys(P.initialArgs).length>0);return w.debug(`[useAutoMap] Manifest: ${b.length} stories, ${A.length} with args`),b},[t]),z=ba(async()=>{if(!e)return!1;try{let L=q(),E=localStorage.getItem("uicopilot_session_token");if(!E)return!1;let y=await fetch(`${L}/api/figma/auto-map?projectId=${e}`,{headers:{Authorization:`Bearer ${E}`}});if(!y.ok)return!1;let C=await y.json();return C.hasSuggestions&&C.mappings?.length>0?(f(C),h("cache"),T(`Loaded ${C.mappings.length} saved suggestions`),w.debug(`[useAutoMap] Loaded ${C.mappings.length} existing suggestions from DB`),!0):!1}catch{return!1}},[e]),O=ba(async L=>{o(!0),T("Collecting story information...");let E;try{if(E=await M(),L?.length&&(E=E.filter(C=>!L.includes(C.id)),w.debug(`[useAutoMap] After excluding mapped: ${E.length} stories`)),E.length===0){c("No unmapped stories found"),o(!1);return}g(E)}catch(C){c(C instanceof Error?C.message:"Failed to collect story manifest"),o(!1);return}o(!1),a(!0),T(`Analyzing ${E.length} stories against Figma components...`);let y=new AbortController;r.current=y;try{let C=q(),b=localStorage.getItem("uicopilot_session_token");if(!b)throw new Error("Not authenticated");let A=await fetch(`${C}/api/figma/auto-map`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b}`},body:JSON.stringify({projectId:e,stories:E.map(F=>({id:F.id,name:F.name,title:F.title,initialArgs:F.initialArgs,argTypes:F.argTypes}))}),signal:y.signal});if(!A.ok){let F=await A.json();throw new Error(F.error||"Auto-map failed")}let P=await A.json();f(P),h("llm"),T(`Found ${P.stats.matched} matches (${P.stats.highConfidence} high confidence)`),w.debug(`[useAutoMap] Results: ${P.stats.matched}/${P.stats.total} matched, ${P.unmatched.length} unmatched`)}catch(C){if(C instanceof DOMException&&C.name==="AbortError"){T("Cancelled");return}c(C instanceof Error?C.message:"Auto-map failed")}finally{a(!1),r.current=null}},[e,M]),R=ba(async L=>{if(!e)return;if(c(null),f(null),h(null),o(!0),T("Checking for existing suggestions..."),await z()){o(!1);return}await O(L)},[e,z,O]),B=ba(async L=>{e&&(c(null),f(null),h(null),await O(L))},[e,O]),x=ba(async(L,E=[])=>{if(!(!e||L.length===0)){l(!0),T(`Applying ${L.length} mappings...`);try{let y=q(),C=localStorage.getItem("uicopilot_session_token");if(!C)throw new Error("Not authenticated");let b=await fetch(`${y}/api/mappings/batch`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({projectId:e,mappings:L.map(P=>({storyId:P.storyId,figmaNodeId:P.figmaNodeId,name:P.figmaFrameName||P.componentSetName}))})});if(!b.ok){let P=await b.json().catch(()=>({}));throw new Error(P.error||`Apply failed (${b.status})`)}let{applied:A=L.length}=await b.json();T(`Applied ${A}/${L.length} mappings`),fetch(`${y}/api/figma/auto-map/verdicts`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({projectId:e,accepted:L.map(P=>P.storyId),rejected:E})}).catch(P=>{w.debug("[useAutoMap] verdict recording failed (ignored)",P)}),w.debug(`[useAutoMap] Applied ${A}/${L.length} mappings (batch)`);try{TK.getChannel().emit("uireview/mappings-changed")}catch{}}catch(y){c(y instanceof Error?y.message:"Failed to apply mappings")}finally{l(!1)}}},[e]),v=ba(()=>{r.current?.abort()},[]),I=ba(()=>{f(null),g(null),c(null),T(""),h(null)},[]);return{collectAndMap:R,rerun:B,loadExisting:z,applyMappings:x,cancel:v,reset:I,isCollecting:n,isMapping:i,isApplying:s,error:u,results:d,manifest:p,progress:m,source:S}}Fe();Ne();import{useState as bl,useCallback as su,useRef as lf,useEffect as BK}from"react";async function nf(e,t,r,n){let o=new Array(e.length),i=0;async function a(){for(;i<e.length&&!n();){let s=i++;try{let l=await e[s]();o[s]=l,n()||r(s,l)}catch(l){o[s]=l,n()||r(s,l)}}}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>a())),o}tt();au();$d();Ne();async function sf(e,t){let r=new Map,n=new Set(e.map(f=>f.id)),o=new Set;for(let f of e)o.add(f.id.includes("--")?f.id.split("--")[0]:f.id);let i=new Map;try{let f=await fetch(`${window.location.origin}/index.json`);if(f.ok){let p=await f.json();for(let g of Object.values(p.entries??{})){if(g.type!=="docs")continue;let m=g.id.includes("--")?g.id.split("--")[0]:g.id;i.has(m)||i.set(m,g.id)}}}catch{}let a=[...o],s=Math.min(4,a.length||1),l=Array.from({length:s},()=>{let f=document.createElement("iframe");return f.style.cssText="position:absolute;left:-9999px;top:0;width:1000px;height:800px;border:0;visibility:hidden;",f.setAttribute("aria-hidden","true"),document.body.appendChild(f),f}),u=0,c=0,d=f=>{for(let p of Array.from(f.querySelectorAll(".docs-story"))){let m=p.closest('[id^="anchor--"]')?.id.replace("anchor--","");if(!m||!n.has(m)||r.has(m))continue;let T=p.querySelector(".innerZoomElementWrapper");if(!T||T.querySelectorAll("*").length<=1)continue;let S=dl(T)??T;try{r.set(m,af(S)),u+=1,t?.(u,e.length)}catch(h){w.warn(`[docsBatch] extract failed for ${m}`,h)}}};try{await Promise.all(l.map(async f=>{for(;c<a.length;){let p=a[c++],g=i.get(p)??`${p}--docs`;if(!(i.size>0&&!i.has(p)))try{await _K(f,g),f.contentDocument&&d(f.contentDocument)}catch{}}}))}finally{l.forEach(f=>f.remove())}return r}function _K(e,t,r=2500){return new Promise((n,o)=>{let i=!1,a=u=>{i||(i=!0,clearInterval(s),clearTimeout(l),u?o(u):n())};e.src=`/iframe.html?id=${encodeURIComponent(t)}&viewMode=docs`;let s=setInterval(()=>{let u=e.contentDocument;if(!u)return;let c=Array.from(u.querySelectorAll(".innerZoomElementWrapper"));if(c.length===0)return;c.filter(f=>f.querySelectorAll("*").length>1).length>=c.length&&setTimeout(()=>a(),100)},50),l=setTimeout(()=>a(new Error(`docs render timeout: ${t}`)),r)})}function zK(){try{return localStorage.getItem("uicopilot_docs_batch")==="1"}catch{return!1}}var m6=25,DK=3,NK=3e5;function OK(e){let t=Object.entries(e).filter(([,r])=>r!=null&&r>=.9).map(([r])=>r);return t.length?`matched: ${t.join(", ")}`:"weak signature match"}function $K(e,t){let r=`Signature ${Math.round(e.score*100)}% \u2014 ${OK(e.signals)}`;return t?`${r}; runner-up: ${t.name} (${Math.round(t.score*100)}%)`:r}function h6({projectId:e}){let[t,r]=bl(!1),[n,o]=bl(""),[i,a]=bl(null),[s,l]=bl(null),[u,c]=bl(null),[d,f]=bl(0),p=lf(null),g=lf(null),m=lf(!1),T=lf(!1),S=su(()=>{g.current&&(clearInterval(g.current),g.current=null)},[]);BK(()=>S,[S]);let h=su(async R=>{if(T.current)return;if(!e||R.length===0){l(R.length===0?"No unmapped stories found":null);return}let B=localStorage.getItem("uicopilot_session_token");if(!B){l("Not authenticated");return}T.current=!0,m.current=!1,r(!0),l(null),c(null),p.current=Date.now(),f(0),S(),g.current=setInterval(()=>{p.current!=null&&f(Date.now()-p.current)},500);let x=q(),v=new Map;if(zK()){o("Capturing story renders (docs batch)\u2026"),a({done:0,total:R.length,phase:"capturing"});try{let P=await sf(R,(F,D)=>a({done:F,total:D,phase:"capturing"}));for(let[F,D]of P)v.set(F,D);w.debug(`[useAutoLink] docs-batch captured ${v.size}/${R.length}`)}catch(P){w.warn("[useAutoLink] docs-batch capture failed, server fallback",P)}if(m.current){o("Cancelled"),T.current=!1,r(!1),a(null);return}}o("Preparing match index\u2026 first run can take ~30s, then it is cached"),a({done:0,total:R.length,phase:"index"});let I=0,L=[],E=[],y={},C=[];for(let P=0;P<R.length;P+=m6)C.push(R.slice(P,P+m6));let b=C.map(P=>async()=>{let F=JSON.stringify({projectId:e,stories:P.map(k=>({id:k.id,name:k.name,title:k.title,args:k.args,domTree:v.get(k.id)??void 0}))}),D=async()=>{let k=await X(`${x}/api/figma/suggest-links/batch`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B}`},body:F},NK);if(!k.ok){let N=await k.json().catch(()=>({}));throw new Error(N.error||`suggest-links/batch failed (${k.status})`)}return await k.json()};try{return await D()}catch(k){if(m.current)throw k;return w.warn(`[useAutoLink] chunk retry after: ${k instanceof Error?k.message:k}`),await D()}}),A=P=>{let[F,D]=P.suggestions??[];if(!F){E.push(P.storyId);return}L.push({storyId:P.storyId,figmaNodeId:F.figmaNodeId,figmaFrameName:F.variantName??F.name,componentSetName:F.name,confidence:Math.round(F.score*100),reason:$K(F,D),vouching:P.vouching?.[F.figmaNodeId],belowFloor:P.belowFloor,bestScore:P.bestScore,rendersMoreLike:P.rendersMoreLike?{name:P.rendersMoreLike.name,score:P.rendersMoreLike.score}:null})};try{let P=await nf(b,DK,(G,_)=>{let le=C[G];if(I+=le.length,o("Matching stories\u2026"),a({done:I,total:R.length,phase:"matching"}),_ instanceof Error){w.warn(`[useAutoLink] chunk ${G} (${le.length} stories): ${_.message}`);for(let $ of le)E.push($.id);return}for(let $ of _.results??[])A($);for(let $ of _.unmatched??[])E.includes($)||E.push($)},()=>m.current);if(m.current){o("Cancelled");return}let F=P.find(G=>G instanceof Error);if(L.length===0&&F)throw F;let D=new Set,k=L.filter(G=>D.has(G.storyId)?!1:(D.add(G.storyId),!0));w.debug(`[useAutoLink] ${R.length} stories \u2192 ${L.length} mappings (${k.length} unique)`);let N=[...new Set(k.map(G=>G.figmaNodeId))];if(N.length>0&&!m.current){o("Rendering thumbnails\u2026");try{let G=await X(`${x}/api/figma/thumbnails`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B}`},body:JSON.stringify({projectId:e,nodeIds:N})},12e4);if(G.ok){let{thumbnails:_}=await G.json();Object.assign(y,_??{})}else w.warn(`[useAutoLink] batched thumbnails failed (${G.status})`)}catch(G){w.warn("[useAutoLink] batched thumbnails error",G)}}c({mappings:k,unmatched:E,thumbnailUrls:y,stats:{total:R.length,matched:k.length,highConfidence:k.filter(G=>G.confidence>=90).length}}),o(`Found ${k.length} matches (no AI)`)}catch(P){l(P instanceof Error?P.message:"Auto-link failed")}finally{T.current=!1,r(!1),a(null),S()}},[e]),M=su(()=>{m.current=!0,r(!1),S()},[S]),z=su(()=>{c(null),l(null),o(""),a(null)},[]),O=su(async()=>{if(e)try{let R=q(),B=localStorage.getItem("uicopilot_session_token"),x=await X(`${R}/api/figma/auto-map?projectId=${encodeURIComponent(e)}`,{headers:{Authorization:`Bearer ${B}`}});if(!x.ok)return;let v=await x.json();v?.hasSuggestions&&Array.isArray(v.mappings)&&v.mappings.length>0&&c({mappings:v.mappings,unmatched:v.unmatched??[],thumbnailUrls:v.thumbnailUrls??{},computedAt:v.computedAt??void 0,stats:v.stats??{total:v.mappings.length,matched:v.mappings.filter(I=>!I.belowFloor).length,highConfidence:v.mappings.filter(I=>!I.belowFloor&&I.confidence>=90).length}})}catch(R){w.warn("[useAutoLink] hydrate failed",R)}},[e]);return{run:h,cancel:M,reset:z,hydrate:O,isRunning:t,progress:n,progressCount:i,elapsedMs:d,error:s,results:u}}Ne();import{useState as cf,useEffect as x6,useRef as uf,useCallback as y6}from"react";var HK=2;async function UK(e,t){try{let r=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`,{signal:t});return r.ok&&(await r.json()).screenshot||null}catch{return null}}function b6(){let[e,t]=cf({}),[r,n]=cf(0),[o,i]=cf(0),[a,s]=cf(0),l=uf(null),u=uf(new Set),c=uf([]),d=uf(0);x6(()=>{let g=new AbortController;return l.current=g,()=>g.abort()},[]);let f=y6(()=>{let g=l.current;if(!(!g||g.signal.aborted))for(;d.current<HK&&c.current.length>0;){let m=c.current.shift();d.current+=1,s(d.current),UK(m,g.signal).then(T=>{g.signal.aborted||(T&&t(S=>({...S,[m]:T})),n(S=>S+1))}).finally(()=>{d.current-=1,s(d.current),g.signal.aborted||f()})}},[]),p=y6(g=>{!g||u.current.has(g)||(u.current.add(g),c.current.push(g),i(m=>m+1),f())},[f]);return x6(()=>()=>{w.debug(`[useStoryScreenshots] captured ${Object.keys(e).length} of ${u.current.size} requested`)},[]),{screenshots:e,requestCapture:p,isCapturing:a>0,progress:{done:r,total:o}}}Fe();tt();Ne();import{useCallback as w6,useEffect as jK,useRef as pf,useState as v6}from"react";var S6=new Map,VK=300,k6=120;function C5(e){let t=S6.get(e);return t||(t=new Map,S6.set(e,t)),t}function C6(e){let[t,r]=v6(()=>e?Object.fromEntries(C5(e)):{}),[n,o]=v6(0),i=pf(new Set),a=pf(new Set),s=pf(null),l=pf(null);jK(()=>{let d=new AbortController;return l.current=d,()=>{d.abort(),s.current&&clearTimeout(s.current)}},[]);let u=w6(async()=>{let d=l.current;if(!e||!d||d.signal.aborted)return;let f=[...a.current].slice(0,VK);if(f.length){for(let p of f)a.current.delete(p);o(p=>p+1);try{let p=localStorage.getItem("uicopilot_session_token"),g=await X(`${q()}/api/figma/thumbnails`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${p}`},body:JSON.stringify({projectId:e,nodeIds:f})},12e4);if(!g.ok){w.warn(`[useFigmaThumbnails] batch failed (${g.status})`);return}let{thumbnails:m}=await g.json();if(!m||d.signal.aborted)return;let T=C5(e);for(let[S,h]of Object.entries(m))T.set(S,h);r(S=>({...S,...m}))}catch(p){w.warn("[useFigmaThumbnails] batch error",p)}finally{o(p=>Math.max(0,p-1)),a.current.size>0&&(s.current=setTimeout(()=>{u()},k6))}}},[e]),c=w6(d=>{if(!e||!d||i.current.has(d))return;let f=C5(e).get(d);if(f){i.current.add(d),r(p=>p[d]?p:{...p,[d]:f});return}i.current.add(d),a.current.add(d),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{u()},k6)},[e,u]);return{thumbnails:t,requestThumbnail:c,isRendering:n>0}}import Pe,{useState as E5,useEffect as lu,useMemo as qK,useCallback as YK}from"react";import{styled as KK}from"storybook/theming";Ne();import{useEffect as WK,useState as GK}from"react";function E6(e,t=5e3){let[r,n]=GK(!1);return WK(()=>{if(!e){n(!1);return}let o=setTimeout(()=>n(!0),t);return()=>clearTimeout(o)},[e,t]),r}var XK=KK.button(({theme:e})=>({gridColumn:"1 / -1",padding:"8px 16px",backgroundColor:"transparent",border:`1px dashed ${e.appBorderColor}`,borderRadius:e.appBorderRadius,color:e.color.mediumdark,fontSize:e.typography.size.s1,cursor:"pointer",transition:"all 0.15s","&:hover:not(:disabled)":{borderColor:e.color.secondary,color:e.color.secondary},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),wl=({isOpen:e,onClose:t,onSelect:r,projectId:n,stories:o=[],currentStoryId:i,onStoryChange:a,multiSelect:s=!1,onMultiSelect:l,initialSearch:u})=>{let c=Kc({projectId:n||"",enabled:e&&!!n}),d=E6(c.isLoading),f=Pe.useRef(!1);lu(()=>{e&&u&&!f.current&&(c.setSearch(u),f.current=!0),e||(f.current=!1)},[e,u]);let[p,g]=E5(new Set),[m,T]=E5(i||o[0]?.id||"");lu(()=>{i&&T(i)},[i]);let S=50,h=8,[M,z]=E5({}),O=YK(y=>{z(C=>({...C,[y]:(C[y]||1)+1}))},[]);lu(()=>{z({})},[c.variantFilters]),lu(()=>{c.expandedSets.forEach(y=>{let C=c.variantChildren[y];if(!C||C.length===0)return;let b=C;c.variantFilters.some(F=>F.value)&&(b=C.filter(F=>F.variantProperties?c.variantFilters.every(D=>D.value?F.variantProperties?.[D.property]===D.value:!0):!1));let A=M[y]||1,P=b.slice(0,A*S).map(F=>F.id);for(let F=0;F<P.length;F+=h){let D=P.slice(F,F+h),k=F/h*300;k===0?c.fetchVariantThumbnails(y,D):setTimeout(()=>c.fetchVariantThumbnails(y,D),k)}})},[c.expandedSets,c.variantChildren,c.variantFilters,M]),lu(()=>{g(new Set)},[m]);let R=qK(()=>{let y=[];return c.filteredFrames.forEach(C=>{if(C.type==="COMPONENT_SET"&&C.children){let b=c.variantFilters.some(A=>A.value)?C.children.filter(A=>A.variantProperties?c.variantFilters.every(P=>P.value?A.variantProperties?.[P.property]===P.value:!0):!1):C.children;y.push(...b)}else y.push(C)}),y},[c.filteredFrames,c.variantFilters]),B=y=>{if(s)g(C=>{let b=new Set(C);return b.has(y.id)?b.delete(y.id):b.add(y.id),b});else{let C=c.resolveThumbnail(y.id);try{r({...y,thumbnail:C})}catch(b){w.error("[ComponentBrowserModal] onSelect threw error:",b)}t()}},x=()=>{let y=R.map(b=>b.id),C=y.every(b=>p.has(b));g(C?new Set:new Set(y))},v=()=>{if(l&&p.size>0){let y=R.filter(C=>p.has(C.id)).map(C=>({...C,thumbnail:c.resolveThumbnail(C.id)}));l(y),g(new Set)}},I=y=>{T(y),a?.(y)},L=y=>{y.target===y.currentTarget&&t()},E=o.find(y=>y.id===m);return e?Pe.createElement(YI,{onClick:L},Pe.createElement(KI,null,Pe.createElement(XI,null,Pe.createElement(JI,null,"Link Figma Frames"),Pe.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},Pe.createElement("button",{onClick:()=>c.refresh(),disabled:c.isLoading,style:{padding:"4px 8px",fontSize:"12px",cursor:c.isLoading?"not-allowed":"pointer",background:"transparent",border:"1px solid #ccc",borderRadius:"4px"},title:"Refresh from Figma"},"Refresh"),Pe.createElement(QI,{onClick:t},"\xD7"))),Pe.createElement(ZI,null,c.error&&Pe.createElement(i3,null,c.error),!c.error&&Pe.createElement(Pe.Fragment,null,o.length>0&&Pe.createElement(h3,null,Pe.createElement(x3,null,"Story:"),Pe.createElement(y3,{value:m,onChange:y=>I(y.target.value)},o.map(y=>Pe.createElement("option",{key:y.id,value:y.id},y.name,y.mappingsCount?` (${y.mappingsCount} linked)`:""))),E?.mappingsCount?Pe.createElement(b3,{hasMapping:!0},E.mappingsCount," frames linked"):null),Pe.createElement(o3,null,Pe.createElement(Wd,null,Pe.createElement("input",{type:"checkbox",checked:c.showComponentSets,onChange:y=>c.setShowComponentSets(y.target.checked)}),"Component Sets"),Pe.createElement(Wd,null,Pe.createElement("input",{type:"checkbox",checked:c.showFrames,onChange:y=>c.setShowFrames(y.target.checked)}),"Frames"),Pe.createElement(Wd,null,Pe.createElement("input",{type:"checkbox",checked:c.showComponents,onChange:y=>c.setShowComponents(y.target.checked)}),"Components"),c.availablePages.length>1&&Pe.createElement(hl,{isActive:!!c.figmaPage,value:c.figmaPage,onChange:y=>c.setFigmaPage(y.target.value),style:{marginLeft:"auto"}},Pe.createElement("option",{value:""},"All pages"),c.availablePages.map(y=>Pe.createElement("option",{key:y,value:y},y)))),c.filterSuggestion&&Pe.createElement(w3,null,Pe.createElement(v3,null,"AI suggests:"),Pe.createElement(S3,null,Object.entries(c.filterSuggestion.suggestedFilters).map(([y,C])=>`${y}=${C}`).join(", ")),Pe.createElement(k3,{onClick:c.applySuggestedFilters},"Apply"),Pe.createElement(C3,{onClick:c.dismissFilterSuggestion},"Dismiss")),c.filterSuggestionLoading&&Pe.createElement(E3,null,"Matching story args to Figma filters..."),c.availableFilters.length>0&&Pe.createElement(qd,null,Pe.createElement(Qc,null,"Filters:"),c.availableFilters.map(({property:y,values:C})=>{let b=c.variantFilters.find(A=>A.property===y);return Pe.createElement(hl,{key:y,isActive:!!b?.value,value:b?.value||"",onChange:A=>c.handleFilterChange(y,A.target.value)},Pe.createElement("option",{value:""},y),C.map(A=>Pe.createElement("option",{key:A,value:A},y,"=",A)))}),c.variantFilters.some(y=>y.value)&&Pe.createElement(Yd,{onClick:c.clearFilters},"Clear All")),c.rateLimitError&&Pe.createElement("div",{style:{padding:"8px 12px",marginBottom:"8px",background:"rgba(234, 88, 12, 0.12)",border:"1px solid rgba(234, 88, 12, 0.3)",borderRadius:"6px",fontSize:"12px",color:"#ea580c"}},"\u26A0 Figma thumbnail previews unavailable \u2014"," ",c.rateLimitError,". You can still select by name."),Pe.createElement(e3,{type:"text",placeholder:"Search frames...",value:c.search,onChange:y=>c.setSearch(y.target.value),autoFocus:!0}),s&&R.length>0&&Pe.createElement(T3,null,Pe.createElement(I3,{onClick:x},p.size===R.length?"Deselect All":"Select All Visible"),Pe.createElement(R3,null,p.size>0?`${p.size} selected of `:"Showing ",R.length," frames")),c.isLoading&&d&&Pe.createElement(r5,null,"Indexing your Figma file for the first time. This walks every page and can take a couple of minutes on a large file \u2014 later loads are cached and open in under a second."),c.isLoading&&Pe.createElement(Ky,null,Array.from({length:6}).map((y,C)=>Pe.createElement(m3,{key:C},Pe.createElement("div",{style:{width:"100%",aspectRatio:"4 / 3"}},Pe.createElement(Gd,{width:"100%",height:"100%"})),Pe.createElement("div",{style:{padding:"12px",display:"flex",flexDirection:"column",gap:"8px"}},Pe.createElement(Gd,{width:"80%",height:"16px"}),Pe.createElement(Gd,{width:"50%",height:"12px"}))))),!c.isLoading&&c.filteredFrames.length===0&&Pe.createElement(r5,null,c.search?"No components match your search":"No Figma components found. We index Figma components \u2014 component sets and standalone components. Plain design frames (screens, mockups) aren't included yet \u2014 frame support is planned \u2014 so a file made only of frames will look empty here for now."),!c.isLoading&&c.filteredFrames.length>0&&Pe.createElement(Ky,null,c.filteredFrames.map(y=>Pe.createElement(Zc,{key:y.id,frame:y,thumbnail:c.thumbnails[y.id],thumbnails:c.thumbnails,variantThumbnails:c.variantThumbnails[y.id],variantChildren:c.variantChildren[y.id],variantFailed:c.variantFailed[y.id],isLoadingVariants:c.loadingVariants.has(y.id),isExpanded:c.expandedSets.has(y.id),isNew:c.recentlyAdded.has(y.name),onToggleExpand:c.toggleExpanded,onSelect:B,multiSelect:s,selectedFrames:p,variantFilters:c.variantFilters,variantPage:M[y.id]||1,onShowMore:O})),c.hasMore&&Pe.createElement(XK,{onClick:c.loadMore,disabled:c.loadingMore},c.loadingMore?"Loading...":`Show more (${c.totalFrames-c.frames.length} remaining)`)))),s&&Pe.createElement(A3,null,Pe.createElement(F3,{disabled:p.size===0,onClick:v},"Link ",p.size," Selected")))):null};Ce();tt();import{addons as is}from"storybook/manager-api";var T5="uireview/badge",Gi={REVIEW_START:"uireview/review-start",REVIEW_COMPLETE:"uireview/review-complete",REVIEW_ERROR:"uireview/review-error",REVIEW_CLEAR:"uireview/review-clear"};function JK(e){return e.criticalCount>0||e.majorCount>0?"status-value:error":e.minorCount>0?"status-value:warning":"status-value:success"}function QK(e){return e.criticalCount>0||e.majorCount>0?"error":e.minorCount>0?"warn":"success"}function ZK(e){let t=[`Score: ${e.score}`];return e.criticalCount>0&&t.push(`${e.criticalCount} critical`),e.majorCount>0&&t.push(`${e.majorCount} major`),e.minorCount>0&&t.push(`${e.minorCount} minor`),t.join(" \xB7 ")}function eX(e){let t=e.criticalCount+e.majorCount;return t>0?`\u2717 ${t} major difference${t>1?"s":""} from design`:e.minorCount>0?`\u26A0 ${e.minorCount} minor difference${e.minorCount>1?"s":""}`:"\u2713 Matches design"}function vl(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableReviewBadges:!1}catch{return!1}}function I6(e){if(vl())try{is.getChannel().emit(Gi.REVIEW_START,{storyId:e})}catch{}}function ai(e,t){if(vl())try{is.getChannel().emit(Gi.REVIEW_COMPLETE,{storyId:e,summary:t})}catch{}}function R6(e){if(vl())try{is.getChannel().emit(Gi.REVIEW_ERROR,{storyId:e})}catch{}}function cu(e){try{is.getChannel().emit(Gi.REVIEW_CLEAR,{storyId:e})}catch{}}function I5(e){try{typeof e.unset=="function"?e.unset():typeof e.set=="function"&&e.set([])}catch{}hI()}var T6=null;function A6(e){if(T6!==null)return;let t=is.getChannel(),r=o=>i=>{vl()&&o(i)};t.on(Gi.REVIEW_START,r(({storyId:o})=>{e.set([{value:"status-value:pending",typeId:T5,storyId:o,title:"Reviewing...",description:"AI review in progress"}]),ts(o,!0),zd(o,0)})),t.on(Gi.REVIEW_COMPLETE,r(({storyId:o,summary:i})=>{e.set([{value:JK(i),typeId:T5,storyId:o,title:eX(i),description:ZK(i)}]),ts(o,!0),zd(o,i.issueCount),Yc(o,QK(i)),typeof i.score=="number"&&Dd(o,i.score)})),t.on(Gi.REVIEW_ERROR,r(({storyId:o})=>{e.set([{value:"status-value:error",typeId:T5,storyId:o,title:"Review Failed",description:"An error occurred during review"}]),ts(o,!0),zd(o,0),Yc(o,"error")})),t.on(Gi.REVIEW_CLEAR,({storyId:o})=>{if(o){try{e.unset?.([o])}catch{}xI(o)}else I5(e)});let n=vl();n||I5(e),T6=setInterval(()=>{let o=vl();o!==n&&(n=o,o||I5(e))},1500)}var tX="uireview/mapped",F6="uireview/mappings-updated";function M6(e){try{is.getChannel().emit(F6,{storyIds:e})}catch{}}function P6(e){let t=is.getChannel();t.on(Gi.REVIEW_CLEAR,({storyId:r})=>{try{r?e.unset?.([r]):e.unset?.()}catch{}}),t.on(F6,({storyIds:r})=>{if(!r.length){try{e.unset?.()}catch{}return}for(let n of r)ts(n,!1);e.set(r.map(n=>({value:"status-value:success",typeId:tX,storyId:n,title:"\u{1F517} Linked to Figma (not yet reviewed)",description:"Story has a Figma mapping"})))})}var oX=_r.div({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4}),iX=_r.div(({theme:e})=>({width:"90vw",maxWidth:"1100px",height:"75vh",backgroundColor:e.background.content,borderRadius:"12px",display:"flex",flexDirection:"column",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.3)",overflow:"hidden"})),aX=_r.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),sX=_r.div({display:"flex",alignItems:"center",gap:"20px"}),lX=_r.h2(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,margin:0,display:"flex",alignItems:"center",gap:"8px"})),cX=_r.div({display:"flex",gap:"4px"}),_6=_r(sa)(({theme:e,active:t})=>({padding:"8px 16px",borderBottom:"none",borderRadius:"6px",backgroundColor:t?e.background.hoverable:"transparent","&:hover":{backgroundColor:e.background.hoverable}})),uX=_r(Wn)({width:"32px",height:"32px",fontSize:"20px",borderRadius:"6px"}),pX=_r.div({flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}),dX=_r.div(({theme:e})=>({padding:"12px 20px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,display:"flex",alignItems:"center",justifyContent:"space-between"})),fX=_r.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,display:"flex",gap:"16px"})),R5=_r.div({display:"flex",flexDirection:"column",flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.95)",padding:"40px"}),A5=_r.div({display:"flex",flexDirection:"column",alignItems:"center",gap:"20px",maxWidth:"400px"}),F5=_r.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText,textAlign:"center"})),M5=_r.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark,textAlign:"center"})),B6=_r.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden"})),z6=_r.div(({theme:e,pct:t})=>({width:t!=null?`${Math.max(t,4)}%`:"100%",height:"100%",backgroundColor:e.color.secondary,borderRadius:"4px",transition:"width 0.4s ease",animation:"uicopilot-progress-pulse 1.4s ease-in-out infinite","@keyframes uicopilot-progress-pulse":{"0%, 100%":{opacity:.6},"50%":{opacity:1}}})),D6=_r.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"6px 14px",backgroundColor:e.color.defaultText,color:"white",border:"none",borderRadius:"6px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,cursor:"pointer",transition:"opacity 0.15s","&:hover":{opacity:.85},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),N6=_r.span(({theme:e,type:t})=>({display:"flex",alignItems:"center",gap:"6px","& .dot":{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:t==="mapped"?e.color.positive:t==="unmapped"?e.color.mediumlight:"transparent"}})),df=({isOpen:e,onClose:t,projectId:r,autoRun:n})=>{let[o,i]=as("map"),[a,s]=as([]),[l,u]=as(!0),[c,d]=as(null),[f,p]=as(!1),[g,m]=as(null),T=nX(),S=c6({projectId:r}),h=h6({projectId:r}),[M,z]=as(!1),{refreshMappings:O}=bt(),{featureFlags:R}=we(),B=b6(),x=C6(r),v=uo(async()=>{u(!0);try{let $=await fetch("/index.json");if(!$.ok)throw new Error("Failed to fetch index.json");let W=await $.json(),Q=W.entries||W.stories||{},ge=Object.entries(Q).filter(([,pe])=>pe.type==="story").map(([pe,fe])=>({id:pe,name:fe.name||pe.split("--").pop()||pe,title:fe.title||"",importPath:fe.importPath,componentTitle:fe.title?.split("/").slice(0,-1).join("/")||fe.title,figmaMapping:null}));try{let pe=q(),fe=localStorage.getItem("uicopilot_session_token"),ht=await X(`${pe}/api/mappings?projectId=${r}&_t=${Date.now()}`,{headers:{Authorization:`Bearer ${fe}`}});if(ht.ok){let je=await ht.json(),xe=new Map((je.mappings||[]).map(ve=>[ve.storyId,ve]));ge.forEach(ve=>{let ot=xe.get(ve.id);ot&&ot.figmaNodeId&&(ve.figmaMapping={figmaNodeId:ot.figmaNodeId,figmaFrameName:ot.name||ot.figmaFrameName||""})})}}catch(pe){console.warn("[StoryMappingAssistant] Failed to fetch mappings (stories still loaded):",pe)}s(ge);let he=ge.find(pe=>!pe.figmaMapping);he?d(he.id):ge.length>0&&d(ge[0].id)}catch($){console.error("[StoryMappingAssistant] Error fetching stories:",$)}finally{u(!1)}},[r]);L6(()=>{e&&(v(),h.hydrate())},[e,v,h.hydrate]);let I=uo(($,W,Q)=>{s(pe=>pe.map(fe=>fe.id===$?{...fe,figmaMapping:{figmaNodeId:W,figmaFrameName:Q}}:fe));let ge=a.findIndex(pe=>pe.id===$),he=a.find((pe,fe)=>fe>ge&&!pe.figmaMapping);he&&d(he.id)},[a]),L=uo($=>{s(W=>W.map(Q=>Q.id===$?{...Q,figmaMapping:null}:Q)),cu($)},[]),E=uo($=>{d($),i("map")},[]),y=uo(()=>{let $=a.filter(W=>W.figmaMapping).map(W=>W.id);S.collectAndMap($)},[a,S]),C=uo(()=>{let $=a.filter(W=>W.figmaMapping).map(W=>W.id);p(!1),S.rerun($)},[a,S]),b=uo(async($,W)=>{await S.applyMappings($,W),p(!1),S.reset(),v(),O(),t()},[S,v,O,t]),A=uo(()=>{p(!1),S.reset()},[S]),P=uo(()=>{let $=a.filter(W=>!W.figmaMapping).map(W=>{let Q=T.getData(W.id);return{id:W.id,name:W.name,title:W.title,args:Q?.initialArgs??{}}});h.run($)},[a,h,T]),F=uo(async($,W)=>{await S.applyMappings($,W),z(!1),h.reset(),v(),O(),t()},[S,h,v,O,t]),D=_e.useRef(!1);L6(()=>{!n||D.current||l||a.length===0||(D.current=!0,P())},[n,l,a.length,P]);let k=uo(()=>{z(!1),h.reset()},[h]),N=uo(()=>{z(!1),h.reset(),P()},[h,P]);_e.useEffect(()=>{S.results&&p(!0)},[S.results]),_e.useEffect(()=>{h.results&&z(!0)},[h.results]);let G=$=>{$.target===$.currentTarget&&t()};if(!e)return null;let _=a.filter($=>$.figmaMapping).length,le=a.length;return rX(_e.createElement(_e.Fragment,null,_e.createElement(oX,{onClick:G},_e.createElement(iX,{onClick:$=>$.stopPropagation()},_e.createElement(aX,null,_e.createElement(sX,null,_e.createElement(lX,null,_e.createElement("span",null,"\u{1F517}"),"Link Stories to Figma"),_e.createElement(cX,null,_e.createElement(_6,{active:o==="map",onClick:()=>i("map")},"Map Stories"),_e.createElement(_6,{active:o==="view",onClick:()=>i("view")},"View All Mappings"))),_e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},R.enableAutoMap&&!f&&!S.isCollecting&&!S.isMapping&&_e.createElement(D6,{onClick:y,disabled:l||a.length===0},_e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2"},_e.createElement("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),_e.createElement("path",{d:"M2 17l10 5 10-5"}),_e.createElement("path",{d:"M2 12l10 5 10-5"})),"Auto-Map All"),R.enableAutoFigmaLinking&&!f&&!M&&!h.isRunning&&_e.createElement(D6,{onClick:P,disabled:l||a.length===0,title:"Match stories to Figma sets by structural spec signatures \u2014 no LLM"},_e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2"},_e.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),_e.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})),"Auto-Link (No AI)"),_e.createElement(uX,{onClick:t},"\xD7"))),_e.createElement(pX,null,(S.isCollecting||S.isMapping)&&_e.createElement(R5,null,_e.createElement(A5,null,_e.createElement(B6,null,_e.createElement(z6,null)),_e.createElement(F5,null,"Auto-mapping stories to Figma"),_e.createElement(M5,null,S.progress),_e.createElement(ii,{onClick:S.cancel,variant:"ghost"},"Cancel"))),h.isRunning&&(()=>{let $=h.progressCount,W=$&&$.total>0?Math.round($.done/$.total*100):0,Q=$?.phase==="index",ge=Math.floor(h.elapsedMs/1e3),he=`${Math.floor(ge/60)}:${(ge%60).toString().padStart(2,"0")}`,pe=$?.phase==="capturing"?`Capturing story renders (docs batch) \xB7 ${$.done} of ${$.total} \xB7 ${W}% \xB7 ${he}`:Q?`Building the Figma match index \u2014 reading each variant's design spec from Figma. First run only; on a large library this takes a few minutes. \xB7 ${he}`:$?`Matching stories \xB7 ${$.done} of ${$.total} \xB7 ${W}% \xB7 ${he}`:h.progress;return _e.createElement(R5,null,_e.createElement(A5,null,_e.createElement(B6,null,_e.createElement(z6,{pct:Q?8:W})),_e.createElement(F5,null,"Auto-linking stories to Figma (no AI)"),_e.createElement(M5,null,pe),_e.createElement(ii,{onClick:h.cancel,variant:"ghost"},"Cancel")))})(),h.error&&!h.isRunning&&!M&&_e.createElement(R5,null,_e.createElement(A5,null,_e.createElement(F5,null,"Auto-link failed"),_e.createElement(M5,null,h.error),_e.createElement(ii,{onClick:h.reset,variant:"ghost"},"Dismiss"))),M&&h.results&&_e.createElement(w5,{results:h.results,stories:a,onApply:F,onCancel:k,onRerun:N,isRerunning:h.isRunning,isApplying:S.isApplying,source:"deterministic",resolveThumbnail:$=>x.thumbnails[$]??h.results?.thumbnailUrls?.[$],onRequestFigmaThumbnail:x.requestThumbnail,resolveStoryScreenshot:$=>B.screenshots[$],isCapturingScreenshots:B.isCapturing,onRequestStoryCapture:B.requestCapture,onBrowse:$=>m($)}),f&&S.results&&_e.createElement(w5,{results:S.results,stories:a,onApply:b,onCancel:A,onRerun:C,isApplying:S.isApplying,isRerunning:S.isCollecting||S.isMapping,source:S.source,resolveThumbnail:$=>x.thumbnails[$]??S.results?.thumbnailUrls?.[$],onRequestFigmaThumbnail:x.requestThumbnail,resolveStoryScreenshot:$=>B.screenshots[$],isCapturingScreenshots:B.isCapturing,onRequestStoryCapture:B.requestCapture,onBrowse:$=>m($)}),!f&&!M&&!h.isRunning&&!h.error&&!S.isCollecting&&!S.isMapping&&(o==="map"?_e.createElement(H3,{stories:a,loading:l,selectedStoryId:c,onSelectStory:d,onStoryMapped:I,projectId:r}):_e.createElement(W3,{stories:a,loading:l,onLink:E,onUnlink:L,onUnlinkAll:()=>{cu(),v(),O()},projectId:r}))),_e.createElement(dX,null,_e.createElement(fX,null,_e.createElement("span",null,"Total: ",le," stories"),_e.createElement(N6,{type:"mapped"},_e.createElement("span",{className:"dot"}),_," mapped"),_e.createElement(N6,{type:"unmapped"},_e.createElement("span",{className:"dot"}),le-_," unmapped"))))),_e.createElement(wl,{isOpen:!!g,onClose:()=>m(null),onSelect:()=>m(null),projectId:r,initialSearch:g||void 0})),document.body)};import Bo,{useEffect as gX,useRef as mX,useState as hX}from"react";import{styled as pn}from"storybook/theming";var xX=pn.div({position:"relative",display:"inline-flex"}),yX=pn.button(({theme:e,tone:t,minWidth:r})=>({display:"inline-flex",alignItems:"center",gap:"8px",height:"26px",padding:"0 10px",border:"none",borderRadius:"6px",background:"transparent",cursor:"pointer",whiteSpace:"nowrap",...r?{minWidth:`${r}px`}:{},justifyContent:"flex-start",maxWidth:"320px",overflow:"hidden",fontFamily:e.typography.fonts.base,color:t==="action"?j:t==="error"?e.color.negative:e.color.defaultText,"&:hover":{backgroundColor:e.background.hoverable}})),bX=pn.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,fontSize:"10px",letterSpacing:"0.08em",textTransform:"uppercase",color:e.color.mediumdark})),wX=pn.span(({theme:e})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,overflow:"hidden",textOverflow:"ellipsis"})),vX=pn.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,fontSize:"11px",color:e.color.mediumdark})),SX=pn.span(({tone:e})=>({width:"6px",height:"6px",borderRadius:"50%",backgroundColor:e,flexShrink:0})),kX=pn.span(({theme:e})=>({width:"10px",height:"10px",border:`2px solid ${e.appBorderColor}`,borderTopColor:j,borderRadius:"50%",display:"inline-block",flexShrink:0,animation:"uicopilot-seg-spin 0.8s linear infinite","@keyframes uicopilot-seg-spin":{to:{transform:"rotate(360deg)"}}})),CX=pn.span(({theme:e,width:t})=>({width:`${t}px`,height:"5px",borderRadius:"3px",backgroundColor:e.appBorderColor,overflow:"hidden",display:"flex",flexShrink:0})),EX=pn.span(({pct:e,color:t})=>({width:`${e}%`,backgroundColor:t})),ff=pn.span(({theme:e})=>({width:"1px",height:"20px",backgroundColor:e.appBorderColor,flexShrink:0})),TX=pn.div(({theme:e})=>({position:"absolute",top:"30px",left:0,minWidth:"260px",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",padding:"4px",zIndex:10001})),gf=pn.div(({theme:e})=>({padding:"8px 10px 4px",fontFamily:e.typography.fonts.base,fontSize:"10px",fontWeight:e.typography.weight.bold,letterSpacing:"0.1em",textTransform:"uppercase",color:e.color.mediumdark})),si=pn.div(({theme:e})=>({display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"12px",padding:"3px 10px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.mediumdark,"& b":{color:e.color.defaultText,fontWeight:e.typography.weight.bold}})),uu=pn.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"7px 10px",border:"none",borderRadius:"6px",background:"transparent",textAlign:"left",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.defaultText,cursor:"pointer","&:hover":{backgroundColor:e.background.hoverable},"&:disabled":{opacity:.45,cursor:"not-allowed"}})),P5=pn.div(({theme:e})=>({padding:"6px 10px 8px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.mediumdark,borderTop:`1px solid ${e.appBorderColor}`,marginTop:"4px",lineHeight:1.5})),mf=pn.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`,margin:"5px 0 4px"})),hf=({label:e,value:t,sub:r,dot:n,busy:o,tone:i="idle",bar:a,minWidth:s,title:l,children:u})=>{let[c,d]=hX(!1),f=mX(null);return gX(()=>{if(!c)return;let p=m=>{f.current?.contains(m.target)||d(!1)},g=m=>{m.key==="Escape"&&d(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",g)}},[c]),Bo.createElement(xX,{ref:f},Bo.createElement(yX,{tone:i,minWidth:s,title:l,onClick:()=>u&&d(p=>!p),"aria-haspopup":u?"menu":void 0,"aria-expanded":u?c:void 0},o?Bo.createElement(kX,null):n?Bo.createElement(SX,{tone:n}):null,e&&Bo.createElement(bX,null,e),a&&Bo.createElement(CX,{width:a.width??88},a.bands.map((p,g)=>Bo.createElement(EX,{key:g,pct:p.pct,color:p.color}))),Bo.createElement(wX,null,t),r&&Bo.createElement(vX,null,r),u&&Bo.createElement("span",{"aria-hidden":!0},"\u25BE")),c&&u&&Bo.createElement(TX,{role:"menu",onClick:()=>d(!1)},u))};var AX=RX.div({display:"flex",alignItems:"center",gap:"4px",minWidth:0}),$6=({projectId:e,sessionToken:t,totalStories:r})=>{let{status:n,refresh:o}=uI(e,t,r),[i,a]=pu(null),[s,l]=pu(!1),[u,c]=pu(!1),[d,f]=pu(!1),[p,g]=pu(()=>Ui());IX(()=>{let B=setInterval(()=>g(Ui()),2e3);return()=>clearInterval(B)},[]);let m=O6(async()=>{if(!(!e||!t)){l(!0);try{await X(`${q()}/api/figma/crawl`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({projectId:e})})}catch{}finally{l(!1),o()}}},[e,t,o]),T=O6(async()=>{if(!(!e||!t)){f(!0);try{await X(`${q()}/api/mappings/batch?projectId=${e}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})}catch{}finally{f(!1),c(!1),o()}}},[e,t,o]);if(!e||!t)return null;let{text:S,tone:h}=pI(n),M=n.crawling||s,z=r>0?Math.round(n.mapped/r*100):0,O=p.pass+p.warn+p.fail,R=B=>O>0?B/O*100:0;return De.createElement(AX,null,De.createElement(ff,null),De.createElement(hf,{label:"Figma",value:M||n.errored||!n.connected?S:zy(n.lastSyncAt)??"synced",sub:!M&&n.setsIndexed!=null?`${n.setsIndexed} sets`:void 0,dot:n.errored?ee.red:n.connected?ee.green:j,busy:M,minWidth:230,tone:h==="warn"?"error":h,title:n.error??"Figma sync \u2014 age, contents and actions"},De.createElement(gf,null,"Sync"),De.createElement(si,null,De.createElement("span",null,"Last sync"),De.createElement("b",null,zy(n.lastSyncAt)??"unknown")),n.setsIndexed!=null&&De.createElement(si,null,De.createElement("span",null,"Indexed"),De.createElement("b",null,n.setsIndexed," sets",n.variantsIndexed!=null&&De.createElement(De.Fragment,null," \xB7 ",De.createElement("span",{style:n.variantsIndexed===0?{color:ee.red}:void 0},n.variantsIndexed," variants")))),(n.addedCount!=null||n.removedCount!=null)&&De.createElement(si,null,De.createElement("span",null,"Since last"),De.createElement("b",null,`+${n.addedCount??0} \xB7 \u2212${n.removedCount??0}`)),De.createElement(mf,null),De.createElement(uu,{onClick:m,disabled:M},"\u27F3 ",M?"Importing\u2026":"Reload from Figma"),n.errored&&n.error&&De.createElement(P5,null,"\u26A0 ",n.error)),De.createElement(ff,null),De.createElement(hf,{label:"Coverage",value:`${z}%`,sub:r>0?`${n.mapped}/${r}`:void 0,bar:{width:88,bands:[{pct:z,color:j}]},minWidth:210,title:"Stories paired to a Figma variant"},De.createElement(gf,null,"Coverage"),De.createElement(si,null,De.createElement("span",null,"Mapped"),De.createElement("b",null,n.mapped,r>0?` / ${r}`:"")),De.createElement(si,null,De.createElement("span",null,"Unmapped"),De.createElement("b",null,Math.max(0,r-n.mapped))),De.createElement(mf,null),De.createElement(uu,{onClick:()=>a("auto")},"\u26A1 Auto-Map All"),De.createElement(uu,{onClick:()=>a("browse")},"\u{1F517} Map stories to Figma\u2026"),n.mapped>0&&De.createElement(De.Fragment,null,De.createElement(mf,null),De.createElement(uu,{onClick:()=>c(!0),style:{color:ee.red}},"\u{1F5D1} Clear all ",n.mapped," mappings"))),De.createElement(ff,null),De.createElement(hf,{label:"Parity",value:O>0&&p.avgScore!=null?`${p.avgScore}`:"\u2014",sub:O>0?`${p.pass} \xB7 ${p.warn} \xB7 ${p.fail}`:"not run yet",bar:{width:96,bands:O>0?[{pct:R(p.pass),color:ee.green},{pct:R(p.warn),color:ee.amber},{pct:R(p.fail),color:ee.red}]:[]},minWidth:215,title:"Design-system parity score, and the pass / warn / fail split behind it"},De.createElement(gf,null,"Parity"),De.createElement(si,null,De.createElement("span",null,"Score"),De.createElement("b",null,p.avgScore!=null?`${p.avgScore} / 100`:"\u2014")),De.createElement(si,null,De.createElement("span",null,"Verdicts"),De.createElement("b",null,De.createElement("span",{style:{color:ee.green}},p.pass," pass")," \xB7 ",De.createElement("span",{style:{color:ee.amber}},p.warn," warn")," \xB7 ",De.createElement("span",{style:{color:ee.red}},p.fail," fail"))),De.createElement(si,null,De.createElement("span",null,"Reviewed"),De.createElement("b",null,p.reviewed," of ",p.mapped)),p.incomparable>0&&De.createElement(si,null,De.createElement("span",null,"No overlap"),De.createElement("b",null,p.incomparable)),O===0&&De.createElement(P5,null,"No review has run yet. Map stories to Figma, then Run in the review panel below to populate this.")),De.createElement(Bn,{isOpen:u,title:"Clear all mappings?",message:`This removes all ${n.mapped} story-to-Figma mappings in this project. Auto-Map can recreate them, but any mapping you set by hand will be lost.`,confirmLabel:d?"Clearing\u2026":"Clear all",variant:"danger",onConfirm:T,onCancel:()=>c(!1)}),i&&De.createElement(df,{isOpen:!0,autoRun:i==="auto",onClose:()=>{a(null),o()},projectId:e}))};Fe();tt();dr();var MX=Ar.div({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",gap:"8px"}),PX=Ar.div({display:"inline-flex",alignItems:"center",gap:"6px",minWidth:0,flex:"1 1 auto",userSelect:"none"}),LX=Ar.span(({theme:e})=>({width:"20px",height:"20px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"5px",background:`linear-gradient(135deg, ${qm} 0%, ${j} 100%)`,color:e.color.lightest,fontSize:"11px",fontWeight:900,letterSpacing:"-0.5px",boxShadow:"0 1px 2px rgba(0,0,0,0.15)"})),_X=Ar.span(({theme:e})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,letterSpacing:"-0.2px",color:e.color.defaultText})),BX=Ar.span(({theme:e})=>({fontSize:"10px",fontFamily:e.typography.fonts.mono,color:e.color.mediumdark,opacity:.8,marginLeft:"2px"})),zX=Ar.div({display:"flex",alignItems:"center",gap:"6px",flexShrink:0}),DX=Ar.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"999px",fontSize:"10px",fontWeight:e.typography.weight.bold,lineHeight:1.6,color:e.color.mediumdark,backgroundColor:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,userSelect:"none",cursor:"default","& svg":{width:"11px",height:"11px"}})),NX=Ar.div({position:"relative"}),OX=Ar.button(({theme:e})=>({width:"22px",height:"22px",padding:0,background:e.background.app,border:`1px solid ${e.appBorderColor}`,borderRadius:"50%",color:e.color.defaultText,cursor:"pointer",fontSize:"10px",fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s","&:hover":{backgroundColor:e.background.hoverable}})),$X=Ar.div(({theme:e})=>({position:"absolute",top:"calc(100% + 6px)",right:0,minWidth:"220px",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,boxShadow:"0 8px 24px rgba(0,0,0,0.14)",zIndex:1e3,overflow:"hidden",padding:"4px"})),HX=Ar.div(({theme:e})=>({padding:"8px 10px 10px",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"4px"})),UX=Ar.div(({theme:e})=>({fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),jX=Ar.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:"2px"})),_5=Ar.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"7px 10px",border:"none",borderRadius:e.appBorderRadius,background:"transparent",color:e.color.defaultText,fontSize:e.typography.size.s2,textAlign:"left",cursor:"pointer",transition:"background 0.12s","&:hover":{backgroundColor:e.background.hoverable}})),VX=Ar.div(({theme:e})=>({height:"1px",margin:"4px 0",backgroundColor:e.appBorderColor})),H6=Ar.button(({theme:e,isLow:t})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",background:"transparent",border:"none",borderRadius:e.appBorderRadius,color:t?e.color.warning:ee.green,cursor:"pointer",fontFamily:e.typography.fonts.mono,fontSize:"11px",fontWeight:e.typography.weight.bold,transition:"background 0.15s","&:hover":{backgroundColor:e.background.hoverable}})),U6=Ar.span(({theme:e,isLow:t})=>({width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,backgroundColor:t?e.color.warning:ee.green})),WX=Ar.span({display:"inline-block",width:"12px",height:"12px",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"#fff",borderRadius:"50%",animation:"credit-spin 0.8s linear infinite","@keyframes credit-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}}),GX=Ar.button(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.mediumdark,cursor:"pointer",transition:"all 0.15s","& svg":{width:"14px",height:"14px"},"&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText}})),qX=Ar.button({position:"fixed",bottom:"20px",right:"20px",width:"48px",height:"48px",borderRadius:"50%",backgroundColor:j,color:"white",border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"22px",cursor:"pointer",boxShadow:`0 4px 14px ${j}66, 0 2px 4px rgba(0,0,0,0.1)`,transition:"all 0.2s ease",zIndex:9999,"&:hover":{transform:"scale(1.08)",boxShadow:`0 6px 20px ${j}88, 0 3px 6px rgba(0,0,0,0.15)`},"&:active":{transform:"scale(0.96)"}}),YX=30*1e3,B5=({onOpenSettings:e})=>{let[t,r]=du(!1),[n,o]=du(!1),[i,a]=du(!1),[s,l]=du(!1),u=FX(null),{selectedProjectId:c}=Ge(),[d,f]=du(()=>cl());xf(()=>{let b=setInterval(()=>f(cl()),3e3);return()=>clearInterval(b)},[]);let{usageData:p,usageLastFetched:g,setUsageData:m,sessionToken:T,resetAuth:S}=be(),{userRole:h,roleOverride:M,featureFlags:z}=we(),O=M??h,R=!!T&&T.startsWith("uic_anon_"),B=O==="admin"||!!z.enableAiReview;xf(()=>{(async()=>{if(!(!T||g&&Date.now()-g<YX&&p)){l(!0);try{let P=q(),F=await X(`${P}/api/addon/account`,{headers:{Authorization:`Bearer ${T}`}});if(F.ok){let D=await F.json();m(D)}}catch(P){console.error("Failed to fetch balance:",P)}finally{l(!1)}}})()},[T,g,p,m]),xf(()=>{let b=()=>{document.visibilityState==="visible"&&t&&r(!1)},A=()=>{t&&r(!1)};return document.addEventListener("visibilitychange",b),window.addEventListener("focus",A),()=>{document.removeEventListener("visibilitychange",b),window.removeEventListener("focus",A)}},[t]),xf(()=>{if(!i)return;let b=P=>{u.current&&!u.current.contains(P.target)&&a(!1)},A=P=>{P.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",b),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",A)}},[i]);let x=L5(()=>{r(!0)},[]),v=L5(()=>{r(!1)},[]),I=L5(async()=>{if(a(!1),T)try{await fetch(`${q()}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${T}`}})}catch{}S()},[T,S]),L=p?.creditBalance??0,E=L<2&&!s,y=p?.email,C=(()=>{if(!y)return"?";let b=y.split("@")[0],A=b.split(/[^a-zA-Z0-9]+/).filter(Boolean);return A.length>=2?(A[0][0]+A[1][0]).toUpperCase():b.slice(0,2).toUpperCase()})();return kt.createElement(MX,null,kt.createElement(PX,null,kt.createElement(LX,{"aria-hidden":!0},"\u21CB"),kt.createElement(_X,null,Qt.NAME),kt.createElement(BX,null,"v","0.18.0"),kt.createElement($6,{projectId:c??null,sessionToken:T??null,totalStories:d})),kt.createElement(zX,null,R&&kt.createElement(DX,{title:"Guest session \u2014 sign up to save your work"},kt.createElement("span",{"aria-hidden":!0},kt.createElement(dc,null)),"Guest"),T&&h==="admin"&&O==="admin"&&kt.createElement(oI,null),T&&z.showCosts&&B&&kt.createElement(H6,{onClick:x,isLow:E,title:s?"Loading...":p?E?"Low balance - click to top up":"Credit balance - click for details":"Click to load balance"},s?kt.createElement(WX,null):p?kt.createElement(kt.Fragment,null,kt.createElement(U6,{isLow:E}),"$",L.toFixed(2)):"..."),T&&!z.showCosts&&p&&B&&kt.createElement(H6,{onClick:x,isLow:Math.floor(L)<=3,title:`${Math.floor(L)} review credits \u2014 click for details`},kt.createElement(U6,{isLow:Math.floor(L)<=3}),Math.floor(L)),e&&T&&kt.createElement(GX,{onClick:e,title:"Settings","aria-label":"Settings"},kt.createElement(e0,null)),!R&&kt.createElement(NX,{ref:u},kt.createElement(OX,{title:"Account","aria-label":"Account",onClick:()=>a(b=>!b)},C),i&&kt.createElement($X,{role:"menu"},kt.createElement(HX,null,kt.createElement(UX,null,y||"Account"),p?.plan&&kt.createElement(jX,null,p.plan," plan")),kt.createElement(_5,{role:"menuitem",onClick:()=>{a(!1),x()}},kt.createElement("span",{"aria-hidden":!0},kt.createElement(dc,null))," ","Account & usage"),e&&kt.createElement(_5,{role:"menuitem",onClick:()=>{a(!1),e()}},kt.createElement("span",{"aria-hidden":!0},kt.createElement(e0,null))," ","Settings"),kt.createElement(VX,null),kt.createElement(_5,{role:"menuitem",onClick:I},"Sign out")),t&&kt.createElement(rI,{onClose:v}))),T&&kt.createElement(qX,{onClick:()=>o(!0),title:"Send feedback","aria-label":"Send feedback"},"\u{1F4AC}"),kt.createElement(sI,{isOpen:n,onClose:()=>o(!1)}))};import Ue,{useEffect as Vee,useRef as eg,useState as Wee}from"react";import dn from"react";Ce();Ne();Fe();tt();dr();import{useState as W6,useCallback as zo,useRef as G6,useEffect as z5}from"react";Fe();tt();var KX=q(),Sl=null;function j6(e){Sl=e}async function V6(e){if(!Sl||!e||e===Sl||e.startsWith("uic_anon_"))return null;let t=Sl;Sl=null;try{let r=await X(`${KX}/api/anonymous/claim`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({anonymousToken:t})});if(!r.ok)throw new Error(`claim failed: ${r.status}`);let n=await r.json().catch(()=>({}));return typeof n?.claimedProjects=="number"?n.claimedProjects:0}catch(r){throw Sl=t,r}}var po=q();w.debug("[useAuth] Module loaded, APP_URL:",po);var yf=null,bf=null,fu=null;function gu(){yf&&(clearInterval(yf),yf=null),bf&&(clearTimeout(bf),bf=null)}var Do=()=>{let e=G6(null),t=G6(null),r=zo(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{sessionToken:n,apiKey:o,authMethod:i,deviceCode:a,userCode:s,verificationUri:l,isConnected:u,authError:c,setSessionToken:d,setApiKey:f,setAuthMethod:p,setDeviceCode:g,setUserCode:m,setVerificationUri:T,setPollingInterval:S,setAuthError:h,resetAuth:M}=be(),[z,O]=W6(!1),[R,B]=W6(!1),x=zo(()=>{gu(),fu=null},[]),v=zo(F=>{fu=F,gu();let D=async()=>{let k=fu;if(!k){gu();return}try{let G=await(await fetch(`${po}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:k})})).json();G.status==="authorized"&&G.session_token?(w.debug("[useAuth] \u2705 OAuth poll successful! Got token."),gu(),r(),fu=null,localStorage.setItem("uicopilot_session_token",G.session_token),d(G.session_token),O(!1)):G.status==="expired"&&(w.debug("[useAuth] OAuth poll_code expired"),gu(),r(),fu=null,O(!1))}catch(N){w.error("[useAuth] OAuth poll error:",N)}};yf=setInterval(D,2e3),bf=setTimeout(D,1e3)},[d,r]);z5(()=>{function F(D){if(!D.origin.startsWith(po))return;let k=D.data;if(!k||typeof k!="object")return;let N=k;if(N.type==="UICOPILOT_AUTH_ERROR"){w.debug("[useAuth] Popup reported auth error:",N.step,N.detail),x(),O(!1);let G=typeof N.step=="string"?N.step:"auth",_=typeof N.detail=="string"?N.detail:"Unknown error";h(`${Qt.NAME} auth failed (${G}): ${_}`)}else N.type==="UICOPILOT_AUTH_POLL_CODE"&&typeof N.pollCode=="string"&&N.pollCode&&(w.debug("[useAuth] Popup handed us a fresh poll_code, switching"),h(null),v(N.pollCode))}return window.addEventListener("message",F),()=>window.removeEventListener("message",F)},[v,x,h]);let I=zo(async()=>{let k=Math.max(0,Math.round((window.screen.width-480)/2)),N=Math.max(0,Math.round((window.screen.height-640)/2)),G=`width=480,height=640,left=${k},top=${N},resizable=yes,scrollbars=yes`,_=null;try{_=window.open("about:blank","uiparity-signin",G)}catch{}try{w.debug("[useAuth] Starting OAuth flow, requesting poll_code...");let le;try{le=await X(`${po}/api/addon/auth/oauth-poll`,{method:"POST"})}catch(ge){let pe=ge instanceof Error&&ge.message.includes("timed out")?`Cannot reach ${Qt.NAME} server at ${po}. Is the dashboard running?`:`Connection failed: ${po} is not responding.`;h(pe),w.error("[useAuth]",pe),_?.close();return}if(!le.ok){let ge=`Cannot reach ${Qt.NAME} server. Is the dashboard running?`;h(ge),w.error("[useAuth]",ge),_?.close();return}let{poll_code:$}=await le.json();w.debug("[useAuth] Got poll_code:",$.substring(0,15)+"...");let W=localStorage.getItem("uicopilot_force_sign_in")==="true";W&&localStorage.removeItem("uicopilot_force_sign_in");let Q=`${po}/addon/auth?poll_code=${$}${W?"&force_sign_in=true":""}`;O(!0),_&&!_.closed?_.location.href=Q:window.open(Q,"uiparity-signin",G),r(),t.current=setTimeout(()=>{O(!1),x()},9e4),w.debug("[useAuth] Starting OAuth poll for token..."),v($)}catch(le){w.error("[useAuth] OAuth flow error:",le),h(`Connection failed. Is the dashboard running at ${po}?`),O(!1),_?.close()}},[h,v,r,x]),L=zo(async()=>{try{let F=await fetch(`${po}/api/addon/auth/device`,{method:"POST"});if(!F.ok)throw new Error("Failed to start device code flow");let D=await F.json();g(D.device_code),m(D.user_code),T(D.verification_uri),window.open(D.verification_uri,"_blank"),E(D.device_code,D.interval*1e3)}catch(F){throw w.error("[useAuth] Device code flow error:",F),F}},[g,m,T]),E=zo((F,D)=>{w.debug("[useAuth] Starting polling. Device code:",F,"Interval:",D),e.current&&clearInterval(e.current);let k=async()=>{try{let G=await(await fetch(`${po}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:F})})).json();G.status==="authorized"?(w.debug("[useAuth] Device code authorization successful!"),e.current&&(clearInterval(e.current),e.current=null),g(null),m(null),T(null),localStorage.setItem("uicopilot_session_token",G.session_token),d(G.session_token),O(!1)):(G.status==="expired"||G.status==="denied")&&(w.debug("[useAuth] Device code expired or denied"),e.current&&(clearInterval(e.current),e.current=null),g(null),m(null),T(null))}catch(N){w.error("[useAuth] Polling error:",N)}};e.current=setInterval(k,D),S(D)},[g,m,T,d,S]),y=zo(()=>{e.current&&(clearInterval(e.current),e.current=null),g(null),m(null),T(null),S(null)},[g,m,T,S]),C=zo(F=>{f(F),d(F),localStorage.setItem("uicopilot_api_key",F)},[f,d]),b=zo(async()=>{if(n)try{await X(`${po}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${n}`}})}catch{}M(),O(!1),e.current&&(clearInterval(e.current),e.current=null),x()},[n,M,x]),A=zo(async()=>{B(!0),h(null);try{let F=await X(`${po}/api/anonymous/session`,{method:"POST"});if(!F.ok)throw new Error(`anonymous session ${F.status}`);let D=await F.json();if(!D?.token)throw new Error("anonymous session: no token");d(D.token)}catch{h("Couldn't start a guest session. Please try again.")}finally{B(!1)}},[d,h]),P=zo(()=>{n&&n.startsWith("uic_anon_")&&(j6(n),typeof localStorage<"u"&&localStorage.removeItem("uicopilot_force_sign_in")),I()},[n,I]);return z5(()=>{!n||n.startsWith("uic_anon_")||V6(n).then(F=>{F!==null&&w.info(`[useAuth] Guest work claimed (${F} project${F===1?"":"s"}).`)}).catch(F=>{w.error("[useAuth] Guest claim failed:",F)})},[n]),z5(()=>()=>{e.current&&clearInterval(e.current),r()},[r]),{sessionToken:n,apiKey:o,authMethod:i,deviceCode:a,userCode:s,verificationUri:l,isConnected:u,authError:c,oauthPending:z,anonPending:R,isAnonymous:!!n&&n.startsWith("uic_anon_"),setAuthMethod:p,startOAuth:I,startAnonymous:A,signUpToSave:P,startDeviceCode:L,cancelDeviceCode:y,saveApiKey:C,logout:b}};Ce();Ne();Fe();tt();import{useCallback as wf}from"react";var mu=q(),yn=()=>{let{projects:e,selectedProjectId:t,loadingProjects:r,setProjects:n,setSelectedProjectId:o,setLoadingProjects:i,getSelectedProject:a}=Ge(),{sessionToken:s}=be(),l=wf(async()=>{if(!s){w.debug("[useProjects] No session token, skipping fetch");return}try{i(!0),w.debug("[useProjects] Fetching from:",`${mu}/api/projects`);let f=await X(`${mu}/api/projects`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}});if(f.ok){let p=await f.json();w.debug("[useProjects] Projects:",p.projects),n(p.projects||[])}else w.error("[useProjects] Failed to fetch projects:",f.status,f.statusText)}catch(f){w.error("[useProjects] Error fetching projects:",f)}finally{i(!1)}},[s,n,i]),u=wf(async f=>{if(!s)throw new Error("Not authenticated");let p=await X(`${mu}/api/projects`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(f)});if(!p.ok)throw new Error("Failed to create project");let g=await p.json();return await l(),g.project},[s,l]),c=wf(async(f,p)=>{if(!s)throw new Error("Not authenticated");let g={};if(p.name!==void 0&&(g.name=p.name),p.description!==void 0&&(g.description=p.description),p.figmaFileUrl!==void 0&&(g.figmaFileId=p.figmaFileUrl===""?null:p.figmaFileUrl),!(await X(`${mu}/api/projects/${f}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(g)})).ok)throw new Error("Failed to update project");await l()},[s,l]),d=wf(async f=>{if(!s)throw new Error("Not authenticated");if(!(await X(`${mu}/api/projects/${f}`,{method:"DELETE",headers:{Authorization:`Bearer ${s}`}})).ok)throw new Error("Failed to delete project");await l(),t===f&&o(null)},[s,t,l,o]);return{projects:e,selectedProjectId:t,selectedProject:a(),loadingProjects:r,setSelectedProjectId:o,fetchProjects:l,createProject:u,updateProject:c,deleteProject:d}};Ce();var hu=()=>{let{showComponentBrowser:e,figmaFileUrl:t,currentMapping:r,mappingSource:n,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:a,setFigmaFileUrl:s,setCurrentMapping:l,setMappingSource:u,setLoadingMapping:c,setShowFigmaQuality:d}=bt();return{showComponentBrowser:e,figmaFileUrl:t,currentMapping:r,mappingSource:n,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:a,setFigmaFileUrl:s,setCurrentMapping:l,setMappingSource:u,setLoadingMapping:c,setShowFigmaQuality:d,openComponentBrowser:()=>a(!0),closeComponentBrowser:()=>a(!1)}};Ce();jy();au();import{useCallback as vu,useRef as Rf}from"react";Ne();function vf(){return new Promise(e=>{let t=document.getElementById("storybook-preview-iframe");if(!t||!t.contentWindow){w.warn("[iframeReload] No preview iframe found"),e();return}let r=t.contentWindow.location.href,n=new URL(r);n.searchParams.set("_cb",Date.now().toString());let o=n.toString();w.debug("[iframeReload] Triggering cache-busted reload:",o);let i=setTimeout(()=>{w.warn("[iframeReload] Iframe reload timed out after 5s"),t.removeEventListener("load",a),e()},5e3),a=()=>{clearTimeout(i),t.removeEventListener("load",a),w.debug("[iframeReload] Iframe loaded, waiting for HMR and styles to settle..."),setTimeout(()=>{w.debug("[iframeReload] Iframe reloaded and styles should be fresh"),e()},2e3)};t.addEventListener("load",a),t.contentWindow.location.href=o})}function Sf(e){return e&&e!=="admin"?{"X-UIC-Role-Preview":e}:{}}var kf=BigInt(4294967295),q6=BigInt(32);function XX(e,t=!1){return t?{h:Number(e&kf),l:Number(e>>q6&kf)}:{h:Number(e>>q6&kf)|0,l:Number(e&kf)|0}}function Y6(e,t=!1){let r=e.length,n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){let{h:a,l:s}=XX(e[i],t);[n[i],o[i]]=[a,s]}return[n,o]}var K6=(e,t,r)=>e<<r|t>>>32-r,X6=(e,t,r)=>t<<r|e>>>32-r,J6=(e,t,r)=>t<<r-32|e>>>64-r,Q6=(e,t,r)=>e<<r-32|t>>>64-r;function JX(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function D5(e,t=""){if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new Error(`${r}expected integer >= 0, got ${e}`)}}function Cf(e,t,r=""){let n=JX(e),o=e?.length,i=t!==void 0;if(!n||i&&o!==t){let a=r&&`"${r}" `,s=i?` of length ${t}`:"",l=n?`length=${o}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+s+", got "+l)}return e}function N5(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Z6(e,t){Cf(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function e7(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function O5(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var QX=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ZX(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function eJ(e){for(let t=0;t<e.length;t++)e[t]=ZX(e[t]);return e}var $5=QX?e=>e:eJ;function t7(e,t={}){let r=(o,i)=>e(i).update(o).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=o=>e(o),Object.assign(r,t),Object.freeze(r)}var r7=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var tJ=BigInt(0),xu=BigInt(1),rJ=BigInt(2),nJ=BigInt(7),oJ=BigInt(256),iJ=BigInt(113),i7=[],a7=[],s7=[];for(let e=0,t=xu,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],i7.push(2*(5*n+r)),a7.push((e+1)*(e+2)/2%64);let o=tJ;for(let i=0;i<7;i++)t=(t<<xu^(t>>nJ)*iJ)%oJ,t&rJ&&(o^=xu<<(xu<<BigInt(i))-xu);s7.push(o)}var l7=Y6(s7,!0),aJ=l7[0],sJ=l7[1],n7=(e,t,r)=>r>32?J6(e,t,r):K6(e,t,r),o7=(e,t,r)=>r>32?Q6(e,t,r):X6(e,t,r);function lJ(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let a=0;a<10;a++)r[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){let s=(a+8)%10,l=(a+2)%10,u=r[l],c=r[l+1],d=n7(u,c,1)^r[s],f=o7(u,c,1)^r[s+1];for(let p=0;p<50;p+=10)e[a+p]^=d,e[a+p+1]^=f}let o=e[2],i=e[3];for(let a=0;a<24;a++){let s=a7[a],l=n7(o,i,s),u=o7(o,i,s),c=i7[a];o=e[c],i=e[c+1],e[c]=l,e[c+1]=u}for(let a=0;a<50;a+=10){for(let s=0;s<10;s++)r[s]=e[a+s];for(let s=0;s<10;s++)e[a+s]^=~r[(s+2)%10]&r[(s+4)%10]}e[0]^=aJ[n],e[1]^=sJ[n]}O5(r)}var H5=class e{constructor(t,r,n,o=!1,i=24){io(this,"state");io(this,"pos",0);io(this,"posOut",0);io(this,"finished",!1);io(this,"state32");io(this,"destroyed",!1);io(this,"blockLen");io(this,"suffix");io(this,"outputLen");io(this,"enableXOF",!1);io(this,"rounds");if(this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=i,D5(n,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=e7(this.state)}clone(){return this._cloneInto()}keccak(){$5(this.state32),lJ(this.state32,this.rounds),$5(this.state32),this.posOut=0,this.pos=0}update(t){N5(this),Cf(t);let{blockLen:r,state:n}=this,o=t.length;for(let i=0;i<o;){let a=Math.min(r-this.pos,o-i);for(let s=0;s<a;s++)n[this.pos++]^=t[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:o}=this;t[n]^=r,(r&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){N5(this,!1),Cf(t),this.finish();let r=this.state,{blockLen:n}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-o);t.set(r.subarray(this.posOut,this.posOut+a),o),this.posOut+=a,o+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return D5(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Z6(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,O5(this.state)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:o,rounds:i,enableXOF:a}=this;return t||(t=new e(r,n,o,a,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=o,t.enableXOF=a,t.destroyed=this.destroyed,t}},cJ=(e,t,r,n={})=>t7(()=>new H5(t,e,r),n);var c7=cJ(6,72,64,r7(10));var uJ=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,U5=Math.ceil,go=Math.floor,Nn="[BigNumber Error] ",u7=Nn+"Number primitive has more than 15 significant digits: ",No=1e14,st=14,j5=9007199254740991,V5=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],wa=1e7,Kr=1e9;function p7(e){var t,r,n,o=h.prototype={constructor:h,toString:null,valueOf:null},i=new h(1),a=20,s=4,l=-7,u=21,c=-1e7,d=1e7,f=!1,p=1,g=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},T="0123456789abcdefghijklmnopqrstuvwxyz",S=!0;function h(x,v){var I,L,E,y,C,b,A,P,F=this;if(!(F instanceof h))return new h(x,v);if(v==null){if(x&&x._isBigNumber===!0){F.s=x.s,!x.c||x.e>d?F.c=F.e=null:x.e<c?F.c=[F.e=0]:(F.e=x.e,F.c=x.c.slice());return}if((b=typeof x=="number")&&x*0==0){if(F.s=1/x<0?(x=-x,-1):1,x===~~x){for(y=0,C=x;C>=10;C/=10,y++);y>d?F.c=F.e=null:(F.e=y,F.c=[x]);return}P=String(x)}else{if(!uJ.test(P=String(x)))return n(F,P,b);F.s=P.charCodeAt(0)==45?(P=P.slice(1),-1):1}(y=P.indexOf("."))>-1&&(P=P.replace(".","")),(C=P.search(/e/i))>0?(y<0&&(y=C),y+=+P.slice(C+1),P=P.substring(0,C)):y<0&&(y=P.length)}else{if(hr(v,2,T.length,"Base"),v==10&&S)return F=new h(x),R(F,a+F.e+1,s);if(P=String(x),b=typeof x=="number"){if(x*0!=0)return n(F,P,b,v);if(F.s=1/x<0?(P=P.slice(1),-1):1,h.DEBUG&&P.replace(/^0\.0*|\./,"").length>15)throw Error(u7+x)}else F.s=P.charCodeAt(0)===45?(P=P.slice(1),-1):1;for(I=T.slice(0,v),y=C=0,A=P.length;C<A;C++)if(I.indexOf(L=P.charAt(C))<0){if(L=="."){if(C>y){y=A;continue}}else if(!E&&(P==P.toUpperCase()&&(P=P.toLowerCase())||P==P.toLowerCase()&&(P=P.toUpperCase()))){E=!0,C=-1,y=0;continue}return n(F,String(x),b,v)}b=!1,P=r(P,v,10,F.s),(y=P.indexOf("."))>-1?P=P.replace(".",""):y=P.length}for(C=0;P.charCodeAt(C)===48;C++);for(A=P.length;P.charCodeAt(--A)===48;);if(P=P.slice(C,++A)){if(A-=C,b&&h.DEBUG&&A>15&&(x>j5||x!==go(x)))throw Error(u7+F.s*x);if((y=y-C-1)>d)F.c=F.e=null;else if(y<c)F.c=[F.e=0];else{if(F.e=y,F.c=[],C=(y+1)%st,y<0&&(C+=st),C<A){for(C&&F.c.push(+P.slice(0,C)),A-=st;C<A;)F.c.push(+P.slice(C,C+=st));C=st-(P=P.slice(C)).length}else C-=A;for(;C--;P+="0");F.c.push(+P)}}else F.c=[F.e=0]}h.clone=p7,h.ROUND_UP=0,h.ROUND_DOWN=1,h.ROUND_CEIL=2,h.ROUND_FLOOR=3,h.ROUND_HALF_UP=4,h.ROUND_HALF_DOWN=5,h.ROUND_HALF_EVEN=6,h.ROUND_HALF_CEIL=7,h.ROUND_HALF_FLOOR=8,h.EUCLID=9,h.config=h.set=function(x){var v,I;if(x!=null)if(typeof x=="object"){if(x.hasOwnProperty(v="DECIMAL_PLACES")&&(I=x[v],hr(I,0,Kr,v),a=I),x.hasOwnProperty(v="ROUNDING_MODE")&&(I=x[v],hr(I,0,8,v),s=I),x.hasOwnProperty(v="EXPONENTIAL_AT")&&(I=x[v],I&&I.pop?(hr(I[0],-Kr,0,v),hr(I[1],0,Kr,v),l=I[0],u=I[1]):(hr(I,-Kr,Kr,v),l=-(u=I<0?-I:I))),x.hasOwnProperty(v="RANGE"))if(I=x[v],I&&I.pop)hr(I[0],-Kr,-1,v),hr(I[1],1,Kr,v),c=I[0],d=I[1];else if(hr(I,-Kr,Kr,v),I)c=-(d=I<0?-I:I);else throw Error(Nn+v+" cannot be zero: "+I);if(x.hasOwnProperty(v="CRYPTO"))if(I=x[v],I===!!I)if(I)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=I;else throw f=!I,Error(Nn+"crypto unavailable");else f=I;else throw Error(Nn+v+" not true or false: "+I);if(x.hasOwnProperty(v="MODULO_MODE")&&(I=x[v],hr(I,0,9,v),p=I),x.hasOwnProperty(v="POW_PRECISION")&&(I=x[v],hr(I,0,Kr,v),g=I),x.hasOwnProperty(v="FORMAT"))if(I=x[v],typeof I=="object")m=I;else throw Error(Nn+v+" not an object: "+I);if(x.hasOwnProperty(v="ALPHABET"))if(I=x[v],typeof I=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(I))S=I.slice(0,10)=="0123456789",T=I;else throw Error(Nn+v+" invalid: "+I)}else throw Error(Nn+"Object expected: "+x);return{DECIMAL_PLACES:a,ROUNDING_MODE:s,EXPONENTIAL_AT:[l,u],RANGE:[c,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:g,FORMAT:m,ALPHABET:T}},h.isBigNumber=function(x){if(!x||x._isBigNumber!==!0)return!1;if(!h.DEBUG)return!0;var v,I,L=x.c,E=x.e,y=x.s;e:if({}.toString.call(L)=="[object Array]"){if((y===1||y===-1)&&E>=-Kr&&E<=Kr&&E===go(E)){if(L[0]===0){if(E===0&&L.length===1)return!0;break e}if(v=(E+1)%st,v<1&&(v+=st),String(L[0]).length==v){for(v=0;v<L.length;v++)if(I=L[v],I<0||I>=No||I!==go(I))break e;if(I!==0)return!0}}}else if(L===null&&E===null&&(y===null||y===1||y===-1))return!0;throw Error(Nn+"Invalid BigNumber: "+x)},h.maximum=h.max=function(){return z(arguments,-1)},h.minimum=h.min=function(){return z(arguments,1)},h.random=(function(){var x=9007199254740992,v=Math.random()*x&2097151?function(){return go(Math.random()*x)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(I){var L,E,y,C,b,A=0,P=[],F=new h(i);if(I==null?I=a:hr(I,0,Kr),C=U5(I/st),f)if(crypto.getRandomValues){for(L=crypto.getRandomValues(new Uint32Array(C*=2));A<C;)b=L[A]*131072+(L[A+1]>>>11),b>=9e15?(E=crypto.getRandomValues(new Uint32Array(2)),L[A]=E[0],L[A+1]=E[1]):(P.push(b%1e14),A+=2);A=C/2}else if(crypto.randomBytes){for(L=crypto.randomBytes(C*=7);A<C;)b=(L[A]&31)*281474976710656+L[A+1]*1099511627776+L[A+2]*4294967296+L[A+3]*16777216+(L[A+4]<<16)+(L[A+5]<<8)+L[A+6],b>=9e15?crypto.randomBytes(7).copy(L,A):(P.push(b%1e14),A+=7);A=C/7}else throw f=!1,Error(Nn+"crypto unavailable");if(!f)for(;A<C;)b=v(),b<9e15&&(P[A++]=b%1e14);for(C=P[--A],I%=st,C&&I&&(b=V5[st-I],P[A]=go(C/b)*b);P[A]===0;P.pop(),A--);if(A<0)P=[y=0];else{for(y=-1;P[0]===0;P.splice(0,1),y-=st);for(A=1,b=P[0];b>=10;b/=10,A++);A<st&&(y-=st-A)}return F.e=y,F.c=P,F}})(),h.sum=function(){for(var x=1,v=arguments,I=new h(v[0]);x<v.length;)I=I.plus(v[x++]);return I},r=(function(){var x="0123456789";function v(I,L,E,y){for(var C,b=[0],A,P=0,F=I.length;P<F;){for(A=b.length;A--;b[A]*=L);for(b[0]+=y.indexOf(I.charAt(P++)),C=0;C<b.length;C++)b[C]>E-1&&(b[C+1]==null&&(b[C+1]=0),b[C+1]+=b[C]/E|0,b[C]%=E)}return b.reverse()}return function(I,L,E,y,C){var b,A,P,F,D,k,N,G,_=I.indexOf("."),le=a,$=s;for(_>=0&&(F=g,g=0,I=I.replace(".",""),G=new h(L),k=G.pow(I.length-_),g=F,G.c=v(qi(fo(k.c),k.e,"0"),10,E,x),G.e=G.c.length),N=v(I,L,E,C?(b=T,x):(b=x,T)),P=F=N.length;N[--F]==0;N.pop());if(!N[0])return b.charAt(0);if(_<0?--P:(k.c=N,k.e=P,k.s=y,k=t(k,G,le,$,E),N=k.c,D=k.r,P=k.e),A=P+le+1,_=N[A],F=E/2,D=D||A<0||N[A+1]!=null,D=$<4?(_!=null||D)&&($==0||$==(k.s<0?3:2)):_>F||_==F&&($==4||D||$==6&&N[A-1]&1||$==(k.s<0?8:7)),A<1||!N[0])I=D?qi(b.charAt(1),-le,b.charAt(0)):b.charAt(0);else{if(N.length=A,D)for(--E;++N[--A]>E;)N[A]=0,A||(++P,N=[1].concat(N));for(F=N.length;!N[--F];);for(_=0,I="";_<=F;I+=b.charAt(N[_++]));I=qi(I,P,b.charAt(0))}return I}})(),t=(function(){function x(L,E,y){var C,b,A,P,F=0,D=L.length,k=E%wa,N=E/wa|0;for(L=L.slice();D--;)A=L[D]%wa,P=L[D]/wa|0,C=N*A+P*k,b=k*A+C%wa*wa+F,F=(b/y|0)+(C/wa|0)+N*P,L[D]=b%y;return F&&(L=[F].concat(L)),L}function v(L,E,y,C){var b,A;if(y!=C)A=y>C?1:-1;else for(b=A=0;b<y;b++)if(L[b]!=E[b]){A=L[b]>E[b]?1:-1;break}return A}function I(L,E,y,C){for(var b=0;y--;)L[y]-=b,b=L[y]<E[y]?1:0,L[y]=b*C+L[y]-E[y];for(;!L[0]&&L.length>1;L.splice(0,1));}return function(L,E,y,C,b){var A,P,F,D,k,N,G,_,le,$,W,Q,ge,he,pe,fe,ht,je=L.s==E.s?1:-1,xe=L.c,ve=E.c;if(!xe||!xe[0]||!ve||!ve[0])return new h(!L.s||!E.s||(xe?ve&&xe[0]==ve[0]:!ve)?NaN:xe&&xe[0]==0||!ve?je*0:je/0);for(_=new h(je),le=_.c=[],P=L.e-E.e,je=y+P+1,b||(b=No,P=mo(L.e/st)-mo(E.e/st),je=je/st|0),F=0;ve[F]==(xe[F]||0);F++);if(ve[F]>(xe[F]||0)&&P--,je<0)le.push(1),D=!0;else{for(he=xe.length,fe=ve.length,F=0,je+=2,k=go(b/(ve[0]+1)),k>1&&(ve=x(ve,k,b),xe=x(xe,k,b),fe=ve.length,he=xe.length),ge=fe,$=xe.slice(0,fe),W=$.length;W<fe;$[W++]=0);ht=ve.slice(),ht=[0].concat(ht),pe=ve[0],ve[1]>=b/2&&pe++;do{if(k=0,A=v(ve,$,fe,W),A<0){if(Q=$[0],fe!=W&&(Q=Q*b+($[1]||0)),k=go(Q/pe),k>1)for(k>=b&&(k=b-1),N=x(ve,k,b),G=N.length,W=$.length;v(N,$,G,W)==1;)k--,I(N,fe<G?ht:ve,G,b),G=N.length,A=1;else k==0&&(A=k=1),N=ve.slice(),G=N.length;if(G<W&&(N=[0].concat(N)),I($,N,W,b),W=$.length,A==-1)for(;v(ve,$,fe,W)<1;)k++,I($,fe<W?ht:ve,W,b),W=$.length}else A===0&&(k++,$=[0]);le[F++]=k,$[0]?$[W++]=xe[ge]||0:($=[xe[ge]],W=1)}while((ge++<he||$[0]!=null)&&je--);D=$[0]!=null,le[0]||le.splice(0,1)}if(b==No){for(F=1,je=le[0];je>=10;je/=10,F++);R(_,y+(_.e=F+P*st-1)+1,C,D)}else _.e=P,_.r=+D;return _}})();function M(x,v,I,L){var E,y,C,b,A;if(I==null?I=s:hr(I,0,8),!x.c)return x.toString();if(E=x.c[0],C=x.e,v==null)A=fo(x.c),A=L==1||L==2&&(C<=l||C>=u)?Tf(A,C):qi(A,C,"0");else if(x=R(new h(x),v,I),y=x.e,A=fo(x.c),b=A.length,L==1||L==2&&(v<=y||y<=l)){for(;b<v;A+="0",b++);A=Tf(A,y)}else if(v-=C+(L===2&&y>C),A=qi(A,y,"0"),y+1>b){if(--v>0)for(A+=".";v--;A+="0");}else if(v+=y-b,v>0)for(y+1==b&&(A+=".");v--;A+="0");return x.s<0&&E?"-"+A:A}function z(x,v){for(var I,L,E=1,y=new h(x[0]);E<x.length;E++)L=new h(x[E]),(!L.s||(I=ss(y,L))===v||I===0&&y.s===v)&&(y=L);return y}function O(x,v,I){for(var L=1,E=v.length;!v[--E];v.pop());for(E=v[0];E>=10;E/=10,L++);return(I=L+I*st-1)>d?x.c=x.e=null:I<c?x.c=[x.e=0]:(x.e=I,x.c=v),x}n=(function(){var x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,I=/^\.([^.]+)$/,L=/^-?(Infinity|NaN)$/,E=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(y,C,b,A){var P,F=b?C:C.replace(E,"");if(L.test(F))y.s=isNaN(F)?null:F<0?-1:1;else{if(!b&&(F=F.replace(x,function(D,k,N){return P=(N=N.toLowerCase())=="x"?16:N=="b"?2:8,!A||A==P?k:D}),A&&(P=A,F=F.replace(v,"$1").replace(I,"0.$1")),C!=F))return new h(F,P);if(h.DEBUG)throw Error(Nn+"Not a"+(A?" base "+A:"")+" number: "+C);y.s=null}y.c=y.e=null}})();function R(x,v,I,L){var E,y,C,b,A,P,F,D=x.c,k=V5;if(D){e:{for(E=1,b=D[0];b>=10;b/=10,E++);if(y=v-E,y<0)y+=st,C=v,A=D[P=0],F=go(A/k[E-C-1]%10);else if(P=U5((y+1)/st),P>=D.length)if(L){for(;D.length<=P;D.push(0));A=F=0,E=1,y%=st,C=y-st+1}else break e;else{for(A=b=D[P],E=1;b>=10;b/=10,E++);y%=st,C=y-st+E,F=C<0?0:go(A/k[E-C-1]%10)}if(L=L||v<0||D[P+1]!=null||(C<0?A:A%k[E-C-1]),L=I<4?(F||L)&&(I==0||I==(x.s<0?3:2)):F>5||F==5&&(I==4||L||I==6&&(y>0?C>0?A/k[E-C]:0:D[P-1])%10&1||I==(x.s<0?8:7)),v<1||!D[0])return D.length=0,L?(v-=x.e+1,D[0]=k[(st-v%st)%st],x.e=-v||0):D[0]=x.e=0,x;if(y==0?(D.length=P,b=1,P--):(D.length=P+1,b=k[st-y],D[P]=C>0?go(A/k[E-C]%k[C])*b:0),L)for(;;)if(P==0){for(y=1,C=D[0];C>=10;C/=10,y++);for(C=D[0]+=b,b=1;C>=10;C/=10,b++);y!=b&&(x.e++,D[0]==No&&(D[0]=1));break}else{if(D[P]+=b,D[P]!=No)break;D[P--]=0,b=1}for(y=D.length;D[--y]===0;D.pop());}x.e>d?x.c=x.e=null:x.e<c&&(x.c=[x.e=0])}return x}function B(x){var v,I=x.e;return I===null?x.toString():(v=fo(x.c),v=I<=l||I>=u?Tf(v,I):qi(v,I,"0"),x.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var x=new h(this);return x.s<0&&(x.s=1),x},o.comparedTo=function(x,v){return ss(this,new h(x,v))},o.decimalPlaces=o.dp=function(x,v){var I,L,E,y=this;if(x!=null)return hr(x,0,Kr),v==null?v=s:hr(v,0,8),R(new h(y),x+y.e+1,v);if(!(I=y.c))return null;if(L=((E=I.length-1)-mo(this.e/st))*st,E=I[E])for(;E%10==0;E/=10,L--);return L<0&&(L=0),L},o.dividedBy=o.div=function(x,v){return t(this,new h(x,v),a,s)},o.dividedToIntegerBy=o.idiv=function(x,v){return t(this,new h(x,v),0,1)},o.exponentiatedBy=o.pow=function(x,v){var I,L,E,y,C,b,A,P,F,D=this;if(x=new h(x),x.c&&!x.isInteger())throw Error(Nn+"Exponent not an integer: "+B(x));if(v!=null&&(v=new h(v)),b=x.e>14,!D.c||!D.c[0]||D.c[0]==1&&!D.e&&D.c.length==1||!x.c||!x.c[0])return F=new h(Math.pow(+B(D),b?x.s*(2-Ef(x)):+B(x))),v?F.mod(v):F;if(A=x.s<0,v){if(v.c?!v.c[0]:!v.s)return new h(NaN);L=!A&&D.isInteger()&&v.isInteger(),L&&(D=D.mod(v))}else{if(x.e>9&&(D.e>0||D.e<-1||(D.e==0?D.c[0]>1||b&&D.c[1]>=24e7:D.c[0]<8e13||b&&D.c[0]<=9999975e7)))return y=D.s<0&&Ef(x)?-0:0,D.e>-1&&(y=1/y),new h(A?1/y:y);g&&(y=U5(g/st+2))}for(b?(I=new h(.5),A&&(x.s=1),P=Ef(x)):(E=Math.abs(+B(x)),P=E%2),F=new h(i);;){if(P){if(F=F.times(D),!F.c)break;y?F.c.length>y&&(F.c.length=y):L&&(F=F.mod(v))}if(E){if(E=go(E/2),E===0)break;P=E%2}else if(x=x.times(I),R(x,x.e+1,1),x.e>14)P=Ef(x);else{if(E=+B(x),E===0)break;P=E%2}D=D.times(D),y?D.c&&D.c.length>y&&(D.c.length=y):L&&(D=D.mod(v))}return L?F:(A&&(F=i.div(F)),v?F.mod(v):y?R(F,g,s,C):F)},o.integerValue=function(x){var v=new h(this);return x==null?x=s:hr(x,0,8),R(v,v.e+1,x)},o.isEqualTo=o.eq=function(x,v){return ss(this,new h(x,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(x,v){return ss(this,new h(x,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(x,v){return(v=ss(this,new h(x,v)))===1||v===0},o.isInteger=function(){return!!this.c&&mo(this.e/st)>this.c.length-2},o.isLessThan=o.lt=function(x,v){return ss(this,new h(x,v))<0},o.isLessThanOrEqualTo=o.lte=function(x,v){return(v=ss(this,new h(x,v)))===-1||v===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(x,v){var I,L,E,y,C=this,b=C.s;if(x=new h(x,v),v=x.s,!b||!v)return new h(NaN);if(b!=v)return x.s=-v,C.plus(x);var A=C.e/st,P=x.e/st,F=C.c,D=x.c;if(!A||!P){if(!F||!D)return F?(x.s=-v,x):new h(D?C:NaN);if(!F[0]||!D[0])return D[0]?(x.s=-v,x):new h(F[0]?C:s==3?-0:0)}if(A=mo(A),P=mo(P),F=F.slice(),b=A-P){for((y=b<0)?(b=-b,E=F):(P=A,E=D),E.reverse(),v=b;v--;E.push(0));E.reverse()}else for(L=(y=(b=F.length)<(v=D.length))?b:v,b=v=0;v<L;v++)if(F[v]!=D[v]){y=F[v]<D[v];break}if(y&&(E=F,F=D,D=E,x.s=-x.s),v=(L=D.length)-(I=F.length),v>0)for(;v--;F[I++]=0);for(v=No-1;L>b;){if(F[--L]<D[L]){for(I=L;I&&!F[--I];F[I]=v);--F[I],F[L]+=No}F[L]-=D[L]}for(;F[0]==0;F.splice(0,1),--P);return F[0]?O(x,F,P):(x.s=s==3?-1:1,x.c=[x.e=0],x)},o.modulo=o.mod=function(x,v){var I,L,E=this;return x=new h(x,v),!E.c||!x.s||x.c&&!x.c[0]?new h(NaN):!x.c||E.c&&!E.c[0]?new h(E):(p==9?(L=x.s,x.s=1,I=t(E,x,0,3),x.s=L,I.s*=L):I=t(E,x,0,p),x=E.minus(I.times(x)),!x.c[0]&&p==1&&(x.s=E.s),x)},o.multipliedBy=o.times=function(x,v){var I,L,E,y,C,b,A,P,F,D,k,N,G,_,le,$=this,W=$.c,Q=(x=new h(x,v)).c;if(!W||!Q||!W[0]||!Q[0])return!$.s||!x.s||W&&!W[0]&&!Q||Q&&!Q[0]&&!W?x.c=x.e=x.s=null:(x.s*=$.s,!W||!Q?x.c=x.e=null:(x.c=[0],x.e=0)),x;for(L=mo($.e/st)+mo(x.e/st),x.s*=$.s,A=W.length,D=Q.length,A<D&&(G=W,W=Q,Q=G,E=A,A=D,D=E),E=A+D,G=[];E--;G.push(0));for(_=No,le=wa,E=D;--E>=0;){for(I=0,k=Q[E]%le,N=Q[E]/le|0,C=A,y=E+C;y>E;)P=W[--C]%le,F=W[C]/le|0,b=N*P+F*k,P=k*P+b%le*le+G[y]+I,I=(P/_|0)+(b/le|0)+N*F,G[y--]=P%_;G[y]=I}return I?++L:G.splice(0,1),O(x,G,L)},o.negated=function(){var x=new h(this);return x.s=-x.s||null,x},o.plus=function(x,v){var I,L=this,E=L.s;if(x=new h(x,v),v=x.s,!E||!v)return new h(NaN);if(E!=v)return x.s=-v,L.minus(x);var y=L.e/st,C=x.e/st,b=L.c,A=x.c;if(!y||!C){if(!b||!A)return new h(E/0);if(!b[0]||!A[0])return A[0]?x:new h(b[0]?L:E*0)}if(y=mo(y),C=mo(C),b=b.slice(),E=y-C){for(E>0?(C=y,I=A):(E=-E,I=b),I.reverse();E--;I.push(0));I.reverse()}for(E=b.length,v=A.length,E-v<0&&(I=A,A=b,b=I,v=E),E=0;v;)E=(b[--v]=b[v]+A[v]+E)/No|0,b[v]=No===b[v]?0:b[v]%No;return E&&(b=[E].concat(b),++C),O(x,b,C)},o.precision=o.sd=function(x,v){var I,L,E,y=this;if(x!=null&&x!==!!x)return hr(x,1,Kr),v==null?v=s:hr(v,0,8),R(new h(y),x,v);if(!(I=y.c))return null;if(E=I.length-1,L=E*st+1,E=I[E]){for(;E%10==0;E/=10,L--);for(E=I[0];E>=10;E/=10,L++);}return x&&y.e+1>L&&(L=y.e+1),L},o.shiftedBy=function(x){return hr(x,-j5,j5),this.times("1e"+x)},o.squareRoot=o.sqrt=function(){var x,v,I,L,E,y=this,C=y.c,b=y.s,A=y.e,P=a+4,F=new h("0.5");if(b!==1||!C||!C[0])return new h(!b||b<0&&(!C||C[0])?NaN:C?y:1/0);if(b=Math.sqrt(+B(y)),b==0||b==1/0?(v=fo(C),(v.length+A)%2==0&&(v+="0"),b=Math.sqrt(+v),A=mo((A+1)/2)-(A<0||A%2),b==1/0?v="5e"+A:(v=b.toExponential(),v=v.slice(0,v.indexOf("e")+1)+A),I=new h(v)):I=new h(b+""),I.c[0]){for(A=I.e,b=A+P,b<3&&(b=0);;)if(E=I,I=F.times(E.plus(t(y,E,P,1))),fo(E.c).slice(0,b)===(v=fo(I.c)).slice(0,b))if(I.e<A&&--b,v=v.slice(b-3,b+1),v=="9999"||!L&&v=="4999"){if(!L&&(R(E,E.e+a+2,0),E.times(E).eq(y))){I=E;break}P+=4,b+=4,L=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(R(I,I.e+a+2,1),x=!I.times(I).eq(y));break}}return R(I,I.e+a+1,s,x)},o.toExponential=function(x,v){return x!=null&&(hr(x,0,Kr),x++),M(this,x,v,1)},o.toFixed=function(x,v){return x!=null&&(hr(x,0,Kr),x=x+this.e+1),M(this,x,v)},o.toFormat=function(x,v,I){var L,E=this;if(I==null)x!=null&&v&&typeof v=="object"?(I=v,v=null):x&&typeof x=="object"?(I=x,x=v=null):I=m;else if(typeof I!="object")throw Error(Nn+"Argument not an object: "+I);if(L=E.toFixed(x,v),E.c){var y,C=L.split("."),b=+I.groupSize,A=+I.secondaryGroupSize,P=I.groupSeparator||"",F=C[0],D=C[1],k=E.s<0,N=k?F.slice(1):F,G=N.length;if(A&&(y=b,b=A,A=y,G-=y),b>0&&G>0){for(y=G%b||b,F=N.substr(0,y);y<G;y+=b)F+=P+N.substr(y,b);A>0&&(F+=P+N.slice(y)),k&&(F="-"+F)}L=D?F+(I.decimalSeparator||"")+((A=+I.fractionGroupSize)?D.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(I.fractionGroupSeparator||"")):D):F}return(I.prefix||"")+L+(I.suffix||"")},o.toFraction=function(x){var v,I,L,E,y,C,b,A,P,F,D,k,N=this,G=N.c;if(x!=null&&(b=new h(x),!b.isInteger()&&(b.c||b.s!==1)||b.lt(i)))throw Error(Nn+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+B(b));if(!G)return new h(N);for(v=new h(i),P=I=new h(i),L=A=new h(i),k=fo(G),y=v.e=k.length-N.e-1,v.c[0]=V5[(C=y%st)<0?st+C:C],x=!x||b.comparedTo(v)>0?y>0?v:P:b,C=d,d=1/0,b=new h(k),A.c[0]=0;F=t(b,v,0,1),E=I.plus(F.times(L)),E.comparedTo(x)!=1;)I=L,L=E,P=A.plus(F.times(E=P)),A=E,v=b.minus(F.times(E=v)),b=E;return E=t(x.minus(I),L,0,1),A=A.plus(E.times(P)),I=I.plus(E.times(L)),A.s=P.s=N.s,y=y*2,D=t(P,L,y,s).minus(N).abs().comparedTo(t(A,I,y,s).minus(N).abs())<1?[P,L]:[A,I],d=C,D},o.toNumber=function(){return+B(this)},o.toPrecision=function(x,v){return x!=null&&hr(x,1,Kr),M(this,x,v,2)},o.toString=function(x){var v,I=this,L=I.s,E=I.e;return E===null?L?(v="Infinity",L<0&&(v="-"+v)):v="NaN":(x==null?v=E<=l||E>=u?Tf(fo(I.c),E):qi(fo(I.c),E,"0"):x===10&&S?(I=R(new h(I),a+E+1,s),v=qi(fo(I.c),I.e,"0")):(hr(x,2,T.length,"Base"),v=r(qi(fo(I.c),E,"0"),10,x,L,!0)),L<0&&I.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return B(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&h.set(e),h}function mo(e){var t=e|0;return e>0||e===t?t:t-1}function fo(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=st-t.length;r--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function ss(e,t){var r,n,o=e.c,i=t.c,a=e.s,s=t.s,l=e.e,u=t.e;if(!a||!s)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=l==u,!o||!i)return n?0:!o^r?1:-1;if(!n)return l>u^r?1:-1;for(s=(l=o.length)<(u=i.length)?l:u,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^r?1:-1;return l==u?0:l>u^r?1:-1}function hr(e,t,r,n){if(e<t||e>r||e!==go(e))throw Error(Nn+(n||"Argument")+(typeof e=="number"?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Ef(e){var t=e.c.length-1;return mo(e.e/st)==t&&e.c[t]%2!=0}function Tf(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function qi(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(n=e.length,++t>n){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var pJ=p7(),d7=pJ;var dJ=24,yu=32,fJ=()=>typeof globalThis<"u"&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"?()=>{let e=new Uint32Array(1);return globalThis.crypto.getRandomValues(e),e[0]/4294967296}:Math.random,G5=fJ(),W5=(e=4,t=G5)=>{let r="";for(;r.length<e;)r=r+Math.floor(t()*36).toString(36);return r};function gJ(e){let t=new d7(0);for(let r of e.values())t=t.multipliedBy(256).plus(r);return t}var g7=(e="")=>{let t=new TextEncoder;return gJ(c7(t.encode(e))).toString(36).slice(1)},f7=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),mJ=e=>f7[Math.floor(e()*f7.length)],hJ=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=G5}={})=>{let r=Object.keys(e).toString(),n=r.length?r+W5(yu,t):W5(yu,t);return g7(n).substring(0,yu)},xJ=e=>()=>e++,yJ=476782367,m7=({random:e=G5,counter:t=xJ(Math.floor(e()*yJ)),length:r=dJ,fingerprint:n=hJ({random:e})}={})=>{if(r>yu)throw new Error(`Length must be between 2 and ${yu}. Received: ${r}`);return function(){let i=mJ(e),a=Date.now().toString(36),s=t().toString(36),l=W5(r,e),u=`${a+l+s+n}`;return`${i+g7(u).substring(1,r)}`}},va=bJ(m7);function bJ(e){let t;return()=>(t||(t=e()),t())}var SJ=Pp(y7());dr();Ne();var If=/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g;function kJ(e){return e.replace(/\*\*/g,"").replace(/\*/g,"").replace(/__/g,"").replace(/_/g," ").trim()}function q5(e,t){let r=[],n=e.split(`
87
+ `,IY=K3.span(({theme:e})=>({display:"inline-block",width:"12px",height:"12px",border:`2px solid ${e.appBorderColor}`,borderTopColor:"currentColor",borderRadius:"50%",animation:`${TY} 0.6s linear infinite`,marginRight:"6px",verticalAlign:"middle"})),RY=K3.button(({theme:e,variant:t="default",disabled:r})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"5px 12px",fontSize:"12px",fontWeight:600,border:`1px solid ${e.color.medium}`,borderRadius:"5px",cursor:r?"not-allowed":"pointer",opacity:r?.6:1,transition:"all 0.2s",whiteSpace:"nowrap",...t==="default"&&{backgroundColor:e.background.content,color:e.color.defaultText,"&:hover":r?{}:{borderColor:e.color.secondary,color:e.color.secondary,backgroundColor:"rgba(30, 167, 253, 0.05)"}},...t==="ghost"&&{backgroundColor:"transparent",border:"none",color:e.color.mediumdark,padding:"5px 8px","&:hover":r?{}:{color:e.color.defaultText,backgroundColor:e.background.hoverable}}})),ii=({loading:e=!1,disabled:t=!1,onClick:r,variant:n="default",children:o,loadingText:i})=>Y3.createElement(RY,{variant:n,disabled:t||e,onClick:r},e&&Y3.createElement(IY,null),e&&i?i:o);Fe();import Yr from"react";import{styled as tu}from"storybook/theming";var X3=tu.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",backgroundColor:e.background.hoverable,borderRadius:"6px",fontFamily:"Inter, sans-serif",fontSize:"11px",color:e.color.mediumdark,gap:"16px"})),AY=tu.div({display:"flex",alignItems:"center",gap:"12px"}),Qd=tu.span({whiteSpace:"nowrap"}),J3=tu.div({display:"flex",alignItems:"center",gap:"8px"}),Zd=tu.span(({theme:e})=>({fontWeight:600,color:e.color.defaultText})),ef=({inputTokens:e,outputTokens:t,costUsd:r,compact:n=!1})=>{let o=e+t,i=r*XT;return n?Yr.createElement(X3,null,Yr.createElement(Qd,null,o.toLocaleString()," tokens"),Yr.createElement(J3,null,Yr.createElement(Zd,null,"$",r.toFixed(4)),Yr.createElement("span",null,"\xB7"),Yr.createElement(Zd,null,"\u20AA",i.toFixed(2)))):Yr.createElement(X3,null,Yr.createElement(AY,null,Yr.createElement(Qd,null,e.toLocaleString()," input"),Yr.createElement("span",null,"+"),Yr.createElement(Qd,null,t.toLocaleString()," output"),Yr.createElement("span",null,"="),Yr.createElement(Qd,null,Yr.createElement("strong",null,o.toLocaleString())," tokens")),Yr.createElement(J3,null,Yr.createElement(Zd,null,"$",r.toFixed(4)),Yr.createElement("span",null,"\xB7"),Yr.createElement(Zd,null,"\u20AA",i.toFixed(2))))};import zn from"react";import{styled as xa}from"storybook/theming";function h5(e){if(typeof e!="string")return e;try{let t=JSON.parse(e);if(t.summary)return t}catch{}return{summary:e}}var FY=xa.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:`${e.layoutMargin*.5}px`})),Q3=xa.div(({theme:e,color:t})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:t||e.color.defaultText,lineHeight:"1.4"})),MY=xa.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.25}px`,flexWrap:"wrap",fontSize:e.typography.size.s1,color:e.color.mediumdark})),PY=xa.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:`${e.layoutMargin*.2}px`,padding:`1px ${e.layoutMargin*.5}px`,borderRadius:e.appBorderRadius,backgroundColor:e.background.hoverable,fontSize:e.typography.size.s1,fontFamily:e.typography.fonts.mono})),LY=xa.span(({theme:e})=>({color:e.color.mediumlight,fontSize:e.typography.size.s1})),_Y=xa.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,fontStyle:"italic"})),BY=xa.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,display:"flex",gap:`${e.layoutMargin*.25}px`})),zY=xa.span(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText})),Z3=({data:e,color:t,compact:r})=>r?zn.createElement(Q3,{color:t},e.summary):zn.createElement(FY,null,zn.createElement(Q3,{color:t},e.summary),e.mappings&&e.mappings.length>0&&zn.createElement(MY,null,e.mappings.map((n,o)=>zn.createElement(zn.Fragment,{key:o},zn.createElement(PY,null,n.from," ",zn.createElement(LY,null,"\u2192")," ",n.to)))),e.candidates!=null&&e.candidates>1&&zn.createElement(_Y,null,e.candidates," candidate variants matched"),e.defaults&&e.defaults.length>0&&zn.createElement(zn.Fragment,null,e.defaults.map((n,o)=>zn.createElement(BY,{key:o},zn.createElement(zY,null,n.choice),zn.createElement("span",null,"\u2014 ",n.why)))));var OY=at.div({display:"flex",flexDirection:"column",flex:1,overflow:"hidden"}),$Y=at.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${e.appBorderColor}`})),HY=at.div({display:"flex",flexDirection:"column",gap:"4px"}),UY=at.div({display:"flex",alignItems:"center",gap:"10px"}),jY=at.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText,letterSpacing:"-0.3px"})),x5=at.span(({theme:e,variant:t})=>({padding:"3px 10px",borderRadius:"20px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,fontWeight:500,backgroundColor:t==="success"?`${e.color.positive}1a`:t==="danger"?`${e.color.negative}1a`:`${e.color.secondary}1a`,color:t==="success"?e.color.positive:t==="danger"?e.color.negative:e.color.secondary})),VY=at.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark})),WY=at.div({display:"flex",gap:"8px"}),GY=at.div(({theme:e})=>({display:"flex",alignItems:"center",padding:"12px 24px",gap:"12px",borderBottom:`1px solid ${e.appBorderColor}`})),qY=at(la)(({theme:e})=>({flex:1,fontSize:e.typography.size.s2})),YY=at.div({display:"flex",gap:"4px"}),tf=at.button(({theme:e,active:t})=>({padding:"6px 12px",borderRadius:"6px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:500,border:t?"none":`1px solid ${e.appBorderColor}`,backgroundColor:t?e.color.defaultText:e.background.content,color:t?e.color.inverseText:e.color.mediumdark,cursor:"pointer",transition:"all 0.15s","&:hover":{backgroundColor:t?e.color.defaultText:e.background.hoverable}})),KY=at.div({display:"flex",flexDirection:"column",flex:1,padding:"16px 24px",gap:"8px",overflowY:"auto"}),t6=at.div({display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",flex:"none"}),r6=at.span(({theme:e})=>({fontSize:"9px",fontWeight:e.typography.weight.bold,letterSpacing:"0.06em",textTransform:"uppercase",color:e.color.mediumdark,whiteSpace:"nowrap"})),XY=at.div(({theme:e,dimmed:t,accent:r})=>{let n=r==="ready"?ee.green:r==="drift"?ee.amber:r==="flag"?e.color.secondary:r==="needyou"?e.color.mediumdark:e.appBorderColor;return{display:"flex",alignItems:"center",padding:"12px 16px",border:`1px solid ${e.appBorderColor}`,borderLeft:`4px solid ${n}`,borderRadius:"10px",gap:"12px",backgroundColor:e.background.content,opacity:t?.6:1,transition:"opacity 0.15s",position:"relative",zIndex:0,"&:hover":{zIndex:10}}}),JY=at.div(({theme:e,checked:t})=>({width:"18px",height:"18px",borderRadius:"4px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.15s",...t?{backgroundColor:e.color.defaultText,color:e.color.inverseText,fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold}:{border:`2px solid ${e.color.mediumlight}`}})),QY=at.div(({theme:e,bgColor:t})=>({width:"48px",height:"40px",borderRadius:"6px",backgroundColor:t||e.background.hoverable,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,overflow:"hidden"})),b5=at.div(({theme:e})=>({width:"120px",height:"80px",borderRadius:"8px",backgroundColor:e.background.hoverable,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,overflow:"hidden",border:`1px solid ${e.appBorderColor}`})),ZY=at.img({width:"100%",height:"100%",objectFit:"contain"}),l6=at.div(({theme:e})=>({width:"16px",height:"16px",border:`2px solid ${e.appBorderColor}`,borderTopColor:e.color.secondary,borderRadius:"50%",animation:"uicopilot-spin 0.8s linear infinite","@keyframes uicopilot-spin":{to:{transform:"rotate(360deg)"}}})),eK=at.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:"9px",letterSpacing:"0.03em",textTransform:"uppercase",color:e.color.mediumdark,textAlign:"center",padding:"4px"})),n6=at.div({flex:1,display:"flex",flexDirection:"column",gap:"2px",minWidth:0}),o6=at.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:500,color:e.color.defaultText,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),y5=at.span(({theme:e,color:t})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:t||e.color.mediumdark,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),Ewe=at.span(({theme:e,color:t})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:t||e.color.mediumdark,lineHeight:1.5,whiteSpace:"pre-line"})),tK=at.div(({theme:e})=>({flexShrink:0,color:e.color.mediumlight,fontSize:"14px"})),rK=at.div({display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px"}),nK=at.span(({theme:e,vouch:t})=>{let r=t==="matched"?ee.green:t==="differs"?ee.amber:e.color.mediumdark;return{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.defaultText,background:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,padding:"1px 6px",opacity:t==="no-evidence"?.65:1,"&::before":{content:'""',width:"6px",height:"6px",borderRadius:"50%",background:r,flexShrink:0}}}),oK=at.div(({theme:e,tone:t})=>({display:"flex",alignItems:"flex-start",gap:"6px",marginTop:"6px",padding:`${e.layoutMargin*.5}px ${e.layoutMargin*.75}px`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,lineHeight:1.45,color:e.color.defaultText,background:e.background.hoverable,borderLeft:`3px solid ${t==="good"?ee.green:ee.amber}`,borderRadius:e.appBorderRadius})),i6=at.span(({tone:e})=>({fontWeight:600,color:e==="good"?ee.green:ee.amber})),iK=at.div(({theme:e})=>({marginTop:"6px",padding:`${e.layoutMargin*.5}px ${e.layoutMargin*.75}px`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,lineHeight:1.45,color:e.color.mediumdark,background:e.background.hoverable,borderLeft:`3px dashed ${e.appBorderColor}`,borderRadius:e.appBorderRadius})),aK=at.div(({theme:e})=>({marginTop:"6px",padding:`${e.layoutMargin*.5}px ${e.layoutMargin*.75}px`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,lineHeight:1.45,color:e.color.defaultText,background:e.background.hoverable,borderLeft:`3px solid ${e.color.secondary}`,borderRadius:e.appBorderRadius})),sK=at.span(({theme:e,level:t})=>({padding:"4px 10px",borderRadius:"20px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,flexShrink:0,backgroundColor:t==="high"?`${e.color.positive}1a`:t==="medium"?`${e.color.warning}1a`:`${e.color.negative}1a`,color:t==="high"?e.color.positive:t==="medium"?e.color.warning:e.color.negative})),lK=at.button(({theme:e})=>({padding:"4px 8px",borderRadius:e.appBorderRadius,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,fontWeight:500,border:`1px solid ${e.appBorderColor}`,backgroundColor:"transparent",color:e.color.mediumdark,cursor:"pointer",flexShrink:0,transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText}})),cK=at.button(({theme:e})=>({padding:"4px 7px",borderRadius:e.appBorderRadius,fontFamily:e.typography.fonts.mono,fontSize:e.typography.size.s1,border:`1px solid ${e.appBorderColor}`,backgroundColor:"transparent",color:e.color.mediumdark,cursor:"pointer",flexShrink:0,transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText}})),uK=at.div(({theme:e})=>({padding:"16px 0",marginTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",gap:"8px"})),pK=at.div({display:"flex",flexWrap:"wrap",gap:"6px"}),dK=at.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",border:`1px dashed ${e.appBorderColor}`,borderRadius:"8px",backgroundColor:e.background.hoverable,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark})),fK=at.span(({theme:e,variant:t})=>({padding:"3px 10px",borderRadius:"20px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,fontWeight:500,backgroundColor:t==="cache"?`${e.color.warning}1a`:`${e.color.positive}1a`,color:t==="cache"?e.color.warning:e.color.positive})),gK=at.div(({theme:e})=>({marginTop:"4px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.warning}));function mK(e){let t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;let n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}var hK=at.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"5px",padding:"5px 12px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:"transparent",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:500,color:e.color.mediumdark,cursor:"pointer",transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),Twe=at.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 24px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.hoverable,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.mediumdark})),a6=({storyId:e,alt:t,src:r,onRequestCapture:n,fallback:o,title:i})=>{let a=DY(null),[s,l]=os(!1);return NY(()=>{if(s||r)return;let u=a.current;if(!u||typeof IntersectionObserver>"u"){l(!0),n?.(e);return}let c=new IntersectionObserver(d=>{d.some(f=>f.isIntersecting)&&(l(!0),n?.(e),c.disconnect())},{root:null,rootMargin:"200px 0px",threshold:.01});return c.observe(u),()=>c.disconnect()},[e,r,s,n]),me.createElement("div",{ref:a},r?me.createElement(b5,{title:i},me.createElement(xK,{src:r,alt:t})):s?me.createElement(b5,{title:i},me.createElement(l6,null)):o)},xK=({src:e,alt:t})=>{let[r,n]=os(!1),[o,i]=os(!1);return o?me.createElement(eK,{title:t},"preview unavailable"):me.createElement(me.Fragment,null,!r&&me.createElement(l6,null),me.createElement(ZY,{src:e,alt:t,onLoad:()=>n(!0),onError:()=>i(!0),style:r?void 0:{position:"absolute",opacity:0}}))};function rf(e){return e.belowFloor?"needyou":e.rendersMoreLike?"flag":e.vouching?.verdicts?.some(t=>t.vouch==="differs")?"drift":"ready"}function s6(e,t){if(t==="all")return!0;let r=rf(e);return t==="ready"?r==="ready"||r==="drift":r===t}function yK(e){return e>=90?"high":e>=70?"medium":"low"}function bK(e){return e==="high"?"#16a34a":e==="medium"?"#d97706":"#ef4444"}var wK={matched:"\u2713",differs:"\u2260","no-evidence":"\xF8"},vK={backgroundColor:"color",color:"color",textColor:"color",fill:"color",borderColor:"border",borderWidth:"border",strokes:"border",strokeWeight:"border",padding:"padding",paddingV:"padding",paddingH:"padding",paddingTop:"padding",paddingRight:"padding",paddingBottom:"padding",paddingLeft:"padding",gap:"padding",itemSpacing:"padding",borderRadius:"radius",cornerRadius:"radius",fontFamily:"type",fontSize:"type",fontWeight:"type",lineHeight:"type",letterSpacing:"type",fontStyle:"type",boxShadow:"shadow",shadow:"shadow",effects:"shadow",opacity:"shadow",icon:"icon",hasIcon:"icon"},SK=["color","border","padding","radius","type","shadow","icon","other"];function kK({vouching:e}){let t=new Map;for(let i of e.verdicts){if(i.vouch==="no-evidence")continue;let a=vK[i.prop]??"other",s=t.get(a)??{differs:!1,matched:!1};i.vouch==="differs"?s.differs=!0:s.matched=!0,t.set(a,s)}let r=SK.filter(i=>t.has(i)).map(i=>{let s=t.get(i).differs?"differs":"matched";return{axis:i,vouch:s}});if(r.length===0)return null;let n=r.filter(i=>i.vouch==="differs"),o=e.specScore!=null?` \xB7 render ${Math.round(e.specScore*100)}%`:"";return me.createElement(me.Fragment,null,me.createElement(rK,null,r.map(i=>me.createElement(nK,{key:i.axis,vouch:i.vouch},i.axis," ",wK[i.vouch]))),me.createElement(oK,{tone:n.length===0?"good":"drift"},n.length===0?me.createElement("span",null,me.createElement(i6,{tone:"good"},"Strong match.")," Every compared axis agrees \u2014 ",r.length," of ",r.length,o,"."):me.createElement("span",null,me.createElement(i6,{tone:"drift"},n.map(i=>i.axis).join(", ")," ",n.length===1?"differs":"differ",".")," ","value drift the review flags, not a mapping problem",o,".")))}var w5=({results:e,stories:t,onApply:r,onCancel:n,onRerun:o,isApplying:i,isRerunning:a,source:s,resolveThumbnail:l,resolveStoryScreenshot:u,isCapturingScreenshots:c,onRequestStoryCapture:d,onRequestFigmaThumbnail:f,onBrowse:p})=>{let[g,m]=os(()=>{let C=new Set;for(let b of e.mappings)b.belowFloor||(b.vouching||b.confidence>=90)&&C.add(b.storyId);return C}),[T,S]=os(""),[h,M]=os("all"),[z,O]=os(null),R=e6(()=>{let C=new Map;for(let b of t)C.set(b.id,{name:b.name,title:b.title});return C},[t]),B=e6(()=>{let C=e.mappings;if(h!=="all"&&(C=C.filter(b=>s6(b,h))),T.trim()){let b=T.toLowerCase();C=C.filter(A=>{let P=R.get(A.storyId);return P?.name.toLowerCase().includes(b)||P?.title.toLowerCase().includes(b)||A.componentSetName.toLowerCase().includes(b)||A.figmaFrameName.toLowerCase().includes(b)})}return C},[e.mappings,h,T,R]),x=C=>{m(b=>{let A=new Set(b);return A.has(C)?A.delete(C):A.add(C),A})},v=()=>{let C=e.mappings.filter(A=>g.has(A.storyId)),b=e.mappings.filter(A=>!g.has(A.storyId)).map(A=>A.storyId);r(C,b)},I=e.mappings.filter(C=>s6(C,"ready")).length,L=e.mappings.filter(C=>rf(C)==="flag").length,E=e.mappings.filter(C=>rf(C)==="needyou").length,y=e.usage;return me.createElement(OY,null,me.createElement($Y,null,me.createElement(HY,null,me.createElement(UY,null,me.createElement(jY,null,s==="deterministic"?"Auto-Link Results":"Auto-Map Results"),me.createElement(x5,{variant:"success"},e.mappings.filter(C=>!C.belowFloor).length," matched"),e.mappings.some(C=>C.belowFloor)&&me.createElement(x5,{variant:"info"},e.mappings.filter(C=>C.belowFloor).length," need you"),e.unmatched.length>0&&me.createElement(x5,{variant:"danger"},e.unmatched.length," unmatched"),s&&me.createElement(fK,{variant:s},s==="cache"?"Loaded from cache":s==="deterministic"?"Deterministic (no AI)":"Fresh analysis")),me.createElement(VY,null,"Review matches below. Uncheck any incorrect mappings before applying."),e.computedAt&&me.createElement(gK,null,"\u26A0 Computed ",mK(e.computedAt)," \u2014 re-run to match against your current Figma file.")),me.createElement(WY,null,o&&me.createElement(hK,{onClick:o,disabled:a},a?"Running\u2026":s==="deterministic"?"\u21BB Run again":"\u21BB Re-run LLM"),me.createElement(ii,{onClick:n,variant:"ghost"},"Cancel"),me.createElement(ii,{loading:i,onClick:v,loadingText:"Applying..."},"Apply ",g.size," Selected"))),me.createElement(GY,null,me.createElement(qY,{type:"text",placeholder:"Filter stories...",value:T,onChange:C=>S(C.target.value)}),me.createElement(YY,null,me.createElement(tf,{active:h==="all",onClick:()=>M("all")},"All ",e.mappings.length),I>0&&me.createElement(tf,{active:h==="ready",onClick:()=>M("ready")},"Ready (",I,")"),L>0&&me.createElement(tf,{active:h==="flag",onClick:()=>M("flag")},"Renders elsewhere (",L,")"),E>0&&me.createElement(tf,{active:h==="needyou",onClick:()=>M("needyou")},"Need you (",E,")"))),me.createElement(KY,null,B.map(C=>{let b=R.get(C.storyId),A=yK(C.confidence),P=g.has(C.storyId),F=A==="low";return me.createElement(XY,{key:C.storyId,dimmed:F&&!P,accent:rf(C)},me.createElement(JY,{checked:P,onClick:()=>x(C.storyId)},P?"\u2713":""),(()=>{let D=u?.(C.storyId),k=me.createElement(a6,{storyId:C.storyId,alt:b?.name||C.storyId,src:D,onRequestCapture:d,fallback:me.createElement(QY,{bgColor:F?js.bgIdle:js.bgActive},me.createElement("span",{style:{fontFamily:"Inter",fontSize:"8px",fontWeight:500,color:F?js.iconIdle:js.iconActive}},(b?.name||"?").substring(0,4)))});return me.createElement(t6,null,k,me.createElement(r6,null,"Storybook"))})(),me.createElement(n6,null,me.createElement(o6,null,b?.name||C.storyId),me.createElement(y5,null,b?.title||"")),me.createElement(tK,null,"\u2192"),(()=>{let D=l?.(C.figmaNodeId),k=h5(C.reason),N=C.vouching?C.figmaFrameName:k.summary+(k.candidates?` (${k.candidates} candidates)`:""),G=me.createElement(a6,{storyId:C.figmaNodeId,alt:C.figmaFrameName,src:D,title:N,onRequestCapture:f,fallback:me.createElement(b5,{title:N},me.createElement("span",{style:{fontFamily:"Inter",fontSize:"10px",fontWeight:500,color:js.iconIdle}},"No thumbnail"))});return me.createElement(t6,null,G,me.createElement(r6,null,"Figma"))})(),me.createElement(n6,null,me.createElement(o6,null,C.componentSetName),C.figmaFrameName!==C.componentSetName&&me.createElement(y5,null,C.figmaFrameName),C.belowFloor?me.createElement(iK,null,"No confident match \u2014 closest is"," ",me.createElement("b",null,C.componentSetName),C.bestScore!=null?` (best ${Math.round(C.bestScore*100)}%)`:"",". Left unselected; map by hand if it's right."):C.vouching?me.createElement(kK,{vouching:C.vouching}):me.createElement(Z3,{data:h5(C.reason),color:bK(A)}),C.rendersMoreLike&&me.createElement(aK,null,"\u2937 renders more like ",me.createElement("b",null,C.rendersMoreLike.name)," (",Math.round(C.rendersMoreLike.score*100),"%) \u2014 name picked this, but check the mapping")),me.createElement(sK,{level:A},C.confidence,"%"),C.vouching?.verdicts?.length?me.createElement(cK,{title:"Compare the Figma and code values behind this match","aria-label":"Compare properties",onClick:D=>{let k=D.currentTarget.getBoundingClientRect();O(N=>N?.storyId===C.storyId?null:{storyId:C.storyId,top:Math.min(k.bottom+6,window.innerHeight-320),left:Math.max(12,k.left-380)})}},"{}"):null,p&&me.createElement(lK,{onClick:()=>p(C.componentSetName)},"Browse"),z?.storyId===C.storyId&&C.vouching?.verdicts&&me.createElement(q3,{title:C.componentSetName,subtitle:C.figmaFrameName!==C.componentSetName?C.figmaFrameName:void 0,verdicts:C.vouching.verdicts,figmaNodeId:C.figmaNodeId,renderScore:C.vouching.specScore,anchor:{top:z.top,left:z.left},onClose:()=>O(null)}))}),e.unmatched.length>0&&me.createElement(uK,null,me.createElement(y5,null,e.unmatched.length," stories couldn't be matched \u2014 map manually after applying"),me.createElement(pK,null,e.unmatched.map(C=>{let b=R.get(C);return me.createElement(dK,{key:C},me.createElement("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#cbd5e1"}}),b?`${b.name} (${b.title})`:C)})))),y&&s!=="cache"&&me.createElement("div",{style:{padding:"8px 24px",borderTop:"1px solid #f0f0f0"}},me.createElement(ef,{inputTokens:y.inputTokens||0,outputTokens:y.outputTokens||0,costUsd:y.costUsd||0})))};Fe();Ne();import{useState as ya,useCallback as ba,useRef as CK}from"react";import{useStorybookApi as EK,addons as TK}from"storybook/manager-api";function c6({projectId:e}){let t=EK(),r=CK(null),[n,o]=ya(!1),[i,a]=ya(!1),[s,l]=ya(!1),[u,c]=ya(null),[d,f]=ya(null),[p,g]=ya(null),[m,T]=ya(""),[S,h]=ya(null),M=ba(async()=>{let L=await fetch("/index.json");if(!L.ok)throw new Error("Failed to fetch Storybook index");let E=await L.json(),y=E.entries||E.stories||{},C=Object.keys(y).filter(P=>y[P].type==="story");w.debug(`[useAutoMap] Found ${C.length} stories in index.json`);let b=[];for(let P of C){let F=y[P],D=t.getData(P),k={...D?.initialArgs||{}},N=D?.argTypes||{};for(let[G,_]of Object.entries(N))if(!(G in k)){let le=_;if(le.defaultValue!==void 0)k[G]=le.defaultValue;else if(le.table?.defaultValue?.summary!==void 0){let $=le.table.defaultValue.summary;$==="false"?k[G]=!1:$==="true"?k[G]=!0:k[G]=$}}b.push({id:P,name:F.name||P.split("--").pop()||P,title:F.title||"",initialArgs:k,argTypes:N})}let A=b.filter(P=>Object.keys(P.initialArgs).length>0);return w.debug(`[useAutoMap] Manifest: ${b.length} stories, ${A.length} with args`),b},[t]),z=ba(async()=>{if(!e)return!1;try{let L=q(),E=localStorage.getItem("uicopilot_session_token");if(!E)return!1;let y=await fetch(`${L}/api/figma/auto-map?projectId=${e}`,{headers:{Authorization:`Bearer ${E}`}});if(!y.ok)return!1;let C=await y.json();return C.hasSuggestions&&C.mappings?.length>0?(f(C),h("cache"),T(`Loaded ${C.mappings.length} saved suggestions`),w.debug(`[useAutoMap] Loaded ${C.mappings.length} existing suggestions from DB`),!0):!1}catch{return!1}},[e]),O=ba(async L=>{o(!0),T("Collecting story information...");let E;try{if(E=await M(),L?.length&&(E=E.filter(C=>!L.includes(C.id)),w.debug(`[useAutoMap] After excluding mapped: ${E.length} stories`)),E.length===0){c("No unmapped stories found"),o(!1);return}g(E)}catch(C){c(C instanceof Error?C.message:"Failed to collect story manifest"),o(!1);return}o(!1),a(!0),T(`Analyzing ${E.length} stories against Figma components...`);let y=new AbortController;r.current=y;try{let C=q(),b=localStorage.getItem("uicopilot_session_token");if(!b)throw new Error("Not authenticated");let A=await fetch(`${C}/api/figma/auto-map`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b}`},body:JSON.stringify({projectId:e,stories:E.map(F=>({id:F.id,name:F.name,title:F.title,initialArgs:F.initialArgs,argTypes:F.argTypes}))}),signal:y.signal});if(!A.ok){let F=await A.json();throw new Error(F.error||"Auto-map failed")}let P=await A.json();f(P),h("llm"),T(`Found ${P.stats.matched} matches (${P.stats.highConfidence} high confidence)`),w.debug(`[useAutoMap] Results: ${P.stats.matched}/${P.stats.total} matched, ${P.unmatched.length} unmatched`)}catch(C){if(C instanceof DOMException&&C.name==="AbortError"){T("Cancelled");return}c(C instanceof Error?C.message:"Auto-map failed")}finally{a(!1),r.current=null}},[e,M]),R=ba(async L=>{if(!e)return;if(c(null),f(null),h(null),o(!0),T("Checking for existing suggestions..."),await z()){o(!1);return}await O(L)},[e,z,O]),B=ba(async L=>{e&&(c(null),f(null),h(null),await O(L))},[e,O]),x=ba(async(L,E=[])=>{if(!(!e||L.length===0)){l(!0),T(`Applying ${L.length} mappings...`);try{let y=q(),C=localStorage.getItem("uicopilot_session_token");if(!C)throw new Error("Not authenticated");let b=await fetch(`${y}/api/mappings/batch`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({projectId:e,mappings:L.map(P=>({storyId:P.storyId,figmaNodeId:P.figmaNodeId,name:P.figmaFrameName||P.componentSetName}))})});if(!b.ok){let P=await b.json().catch(()=>({}));throw new Error(P.error||`Apply failed (${b.status})`)}let{applied:A=L.length}=await b.json();T(`Applied ${A}/${L.length} mappings`),fetch(`${y}/api/figma/auto-map/verdicts`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({projectId:e,accepted:L.map(P=>P.storyId),rejected:E})}).catch(P=>{w.debug("[useAutoMap] verdict recording failed (ignored)",P)}),w.debug(`[useAutoMap] Applied ${A}/${L.length} mappings (batch)`);try{TK.getChannel().emit("uireview/mappings-changed")}catch{}}catch(y){c(y instanceof Error?y.message:"Failed to apply mappings")}finally{l(!1)}}},[e]),v=ba(()=>{r.current?.abort()},[]),I=ba(()=>{f(null),g(null),c(null),T(""),h(null)},[]);return{collectAndMap:R,rerun:B,loadExisting:z,applyMappings:x,cancel:v,reset:I,isCollecting:n,isMapping:i,isApplying:s,error:u,results:d,manifest:p,progress:m,source:S}}Fe();Ne();import{useState as bl,useCallback as su,useRef as lf,useEffect as BK}from"react";async function nf(e,t,r,n){let o=new Array(e.length),i=0;async function a(){for(;i<e.length&&!n();){let s=i++;try{let l=await e[s]();o[s]=l,n()||r(s,l)}catch(l){o[s]=l,n()||r(s,l)}}}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>a())),o}tt();au();$d();Ne();async function sf(e,t){let r=new Map,n=new Set(e.map(f=>f.id)),o=new Set;for(let f of e)o.add(f.id.includes("--")?f.id.split("--")[0]:f.id);let i=new Map;try{let f=await fetch(`${window.location.origin}/index.json`);if(f.ok){let p=await f.json();for(let g of Object.values(p.entries??{})){if(g.type!=="docs")continue;let m=g.id.includes("--")?g.id.split("--")[0]:g.id;i.has(m)||i.set(m,g.id)}}}catch{}let a=[...o],s=Math.min(4,a.length||1),l=Array.from({length:s},()=>{let f=document.createElement("iframe");return f.style.cssText="position:absolute;left:-9999px;top:0;width:1000px;height:800px;border:0;visibility:hidden;",f.setAttribute("aria-hidden","true"),document.body.appendChild(f),f}),u=0,c=0,d=f=>{for(let p of Array.from(f.querySelectorAll(".docs-story"))){let m=p.closest('[id^="anchor--"]')?.id.replace("anchor--","");if(!m||!n.has(m)||r.has(m))continue;let T=p.querySelector(".innerZoomElementWrapper");if(!T||T.querySelectorAll("*").length<=1)continue;let S=dl(T)??T;try{r.set(m,af(S)),u+=1,t?.(u,e.length)}catch(h){w.warn(`[docsBatch] extract failed for ${m}`,h)}}};try{await Promise.all(l.map(async f=>{for(;c<a.length;){let p=a[c++],g=i.get(p)??`${p}--docs`;if(!(i.size>0&&!i.has(p)))try{await _K(f,g),f.contentDocument&&d(f.contentDocument)}catch{}}}))}finally{l.forEach(f=>f.remove())}return r}function _K(e,t,r=2500){return new Promise((n,o)=>{let i=!1,a=u=>{i||(i=!0,clearInterval(s),clearTimeout(l),u?o(u):n())};e.src=`/iframe.html?id=${encodeURIComponent(t)}&viewMode=docs`;let s=setInterval(()=>{let u=e.contentDocument;if(!u)return;let c=Array.from(u.querySelectorAll(".innerZoomElementWrapper"));if(c.length===0)return;c.filter(f=>f.querySelectorAll("*").length>1).length>=c.length&&setTimeout(()=>a(),100)},50),l=setTimeout(()=>a(new Error(`docs render timeout: ${t}`)),r)})}function zK(){try{return localStorage.getItem("uicopilot_docs_batch")==="1"}catch{return!1}}var m6=25,DK=3,NK=3e5;function OK(e){let t=Object.entries(e).filter(([,r])=>r!=null&&r>=.9).map(([r])=>r);return t.length?`matched: ${t.join(", ")}`:"weak signature match"}function $K(e,t){let r=`Signature ${Math.round(e.score*100)}% \u2014 ${OK(e.signals)}`;return t?`${r}; runner-up: ${t.name} (${Math.round(t.score*100)}%)`:r}function h6({projectId:e}){let[t,r]=bl(!1),[n,o]=bl(""),[i,a]=bl(null),[s,l]=bl(null),[u,c]=bl(null),[d,f]=bl(0),p=lf(null),g=lf(null),m=lf(!1),T=lf(!1),S=su(()=>{g.current&&(clearInterval(g.current),g.current=null)},[]);BK(()=>S,[S]);let h=su(async R=>{if(T.current)return;if(!e||R.length===0){l(R.length===0?"No unmapped stories found":null);return}let B=localStorage.getItem("uicopilot_session_token");if(!B){l("Not authenticated");return}T.current=!0,m.current=!1,r(!0),l(null),c(null),p.current=Date.now(),f(0),S(),g.current=setInterval(()=>{p.current!=null&&f(Date.now()-p.current)},500);let x=q(),v=new Map;if(zK()){o("Capturing story renders (docs batch)\u2026"),a({done:0,total:R.length,phase:"capturing"});try{let P=await sf(R,(F,D)=>a({done:F,total:D,phase:"capturing"}));for(let[F,D]of P)v.set(F,D);w.debug(`[useAutoLink] docs-batch captured ${v.size}/${R.length}`)}catch(P){w.warn("[useAutoLink] docs-batch capture failed, server fallback",P)}if(m.current){o("Cancelled"),T.current=!1,r(!1),a(null);return}}o("Preparing match index\u2026 first run can take ~30s, then it is cached"),a({done:0,total:R.length,phase:"index"});let I=0,L=[],E=[],y={},C=[];for(let P=0;P<R.length;P+=m6)C.push(R.slice(P,P+m6));let b=C.map(P=>async()=>{let F=JSON.stringify({projectId:e,stories:P.map(k=>({id:k.id,name:k.name,title:k.title,args:k.args,domTree:v.get(k.id)??void 0}))}),D=async()=>{let k=await X(`${x}/api/figma/suggest-links/batch`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B}`},body:F},NK);if(!k.ok){let N=await k.json().catch(()=>({}));throw new Error(N.error||`suggest-links/batch failed (${k.status})`)}return await k.json()};try{return await D()}catch(k){if(m.current)throw k;return w.warn(`[useAutoLink] chunk retry after: ${k instanceof Error?k.message:k}`),await D()}}),A=P=>{let[F,D]=P.suggestions??[];if(!F){E.push(P.storyId);return}L.push({storyId:P.storyId,figmaNodeId:F.figmaNodeId,figmaFrameName:F.variantName??F.name,componentSetName:F.name,confidence:Math.round(F.score*100),reason:$K(F,D),vouching:P.vouching?.[F.figmaNodeId],belowFloor:P.belowFloor,bestScore:P.bestScore,rendersMoreLike:P.rendersMoreLike?{name:P.rendersMoreLike.name,score:P.rendersMoreLike.score}:null})};try{let P=await nf(b,DK,(G,_)=>{let le=C[G];if(I+=le.length,o("Matching stories\u2026"),a({done:I,total:R.length,phase:"matching"}),_ instanceof Error){w.warn(`[useAutoLink] chunk ${G} (${le.length} stories): ${_.message}`);for(let $ of le)E.push($.id);return}for(let $ of _.results??[])A($);for(let $ of _.unmatched??[])E.includes($)||E.push($)},()=>m.current);if(m.current){o("Cancelled");return}let F=P.find(G=>G instanceof Error);if(L.length===0&&F)throw F;let D=new Set,k=L.filter(G=>D.has(G.storyId)?!1:(D.add(G.storyId),!0));w.debug(`[useAutoLink] ${R.length} stories \u2192 ${L.length} mappings (${k.length} unique)`);let N=[...new Set(k.map(G=>G.figmaNodeId))];if(N.length>0&&!m.current){o("Rendering thumbnails\u2026");try{let G=await X(`${x}/api/figma/thumbnails`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B}`},body:JSON.stringify({projectId:e,nodeIds:N})},12e4);if(G.ok){let{thumbnails:_}=await G.json();Object.assign(y,_??{})}else w.warn(`[useAutoLink] batched thumbnails failed (${G.status})`)}catch(G){w.warn("[useAutoLink] batched thumbnails error",G)}}c({mappings:k,unmatched:E,thumbnailUrls:y,stats:{total:R.length,matched:k.length,highConfidence:k.filter(G=>G.confidence>=90).length}}),o(`Found ${k.length} matches (no AI)`)}catch(P){l(P instanceof Error?P.message:"Auto-link failed")}finally{T.current=!1,r(!1),a(null),S()}},[e]),M=su(()=>{m.current=!0,r(!1),S()},[S]),z=su(()=>{c(null),l(null),o(""),a(null)},[]),O=su(async()=>{if(e)try{let R=q(),B=localStorage.getItem("uicopilot_session_token"),x=await X(`${R}/api/figma/auto-map?projectId=${encodeURIComponent(e)}`,{headers:{Authorization:`Bearer ${B}`}});if(!x.ok)return;let v=await x.json();v?.hasSuggestions&&Array.isArray(v.mappings)&&v.mappings.length>0&&c({mappings:v.mappings,unmatched:v.unmatched??[],thumbnailUrls:v.thumbnailUrls??{},computedAt:v.computedAt??void 0,stats:v.stats??{total:v.mappings.length,matched:v.mappings.filter(I=>!I.belowFloor).length,highConfidence:v.mappings.filter(I=>!I.belowFloor&&I.confidence>=90).length}})}catch(R){w.warn("[useAutoLink] hydrate failed",R)}},[e]);return{run:h,cancel:M,reset:z,hydrate:O,isRunning:t,progress:n,progressCount:i,elapsedMs:d,error:s,results:u}}Ne();import{useState as cf,useEffect as x6,useRef as uf,useCallback as y6}from"react";var HK=2;async function UK(e,t){try{let r=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`,{signal:t});return r.ok&&(await r.json()).screenshot||null}catch{return null}}function b6(){let[e,t]=cf({}),[r,n]=cf(0),[o,i]=cf(0),[a,s]=cf(0),l=uf(null),u=uf(new Set),c=uf([]),d=uf(0);x6(()=>{let g=new AbortController;return l.current=g,()=>g.abort()},[]);let f=y6(()=>{let g=l.current;if(!(!g||g.signal.aborted))for(;d.current<HK&&c.current.length>0;){let m=c.current.shift();d.current+=1,s(d.current),UK(m,g.signal).then(T=>{g.signal.aborted||(T&&t(S=>({...S,[m]:T})),n(S=>S+1))}).finally(()=>{d.current-=1,s(d.current),g.signal.aborted||f()})}},[]),p=y6(g=>{!g||u.current.has(g)||(u.current.add(g),c.current.push(g),i(m=>m+1),f())},[f]);return x6(()=>()=>{w.debug(`[useStoryScreenshots] captured ${Object.keys(e).length} of ${u.current.size} requested`)},[]),{screenshots:e,requestCapture:p,isCapturing:a>0,progress:{done:r,total:o}}}Fe();tt();Ne();import{useCallback as w6,useEffect as jK,useRef as pf,useState as v6}from"react";var S6=new Map,VK=300,k6=120;function C5(e){let t=S6.get(e);return t||(t=new Map,S6.set(e,t)),t}function C6(e){let[t,r]=v6(()=>e?Object.fromEntries(C5(e)):{}),[n,o]=v6(0),i=pf(new Set),a=pf(new Set),s=pf(null),l=pf(null);jK(()=>{let d=new AbortController;return l.current=d,()=>{d.abort(),s.current&&clearTimeout(s.current)}},[]);let u=w6(async()=>{let d=l.current;if(!e||!d||d.signal.aborted)return;let f=[...a.current].slice(0,VK);if(f.length){for(let p of f)a.current.delete(p);o(p=>p+1);try{let p=localStorage.getItem("uicopilot_session_token"),g=await X(`${q()}/api/figma/thumbnails`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${p}`},body:JSON.stringify({projectId:e,nodeIds:f})},12e4);if(!g.ok){w.warn(`[useFigmaThumbnails] batch failed (${g.status})`);return}let{thumbnails:m}=await g.json();if(!m||d.signal.aborted)return;let T=C5(e);for(let[S,h]of Object.entries(m))T.set(S,h);r(S=>({...S,...m}))}catch(p){w.warn("[useFigmaThumbnails] batch error",p)}finally{o(p=>Math.max(0,p-1)),a.current.size>0&&(s.current=setTimeout(()=>{u()},k6))}}},[e]),c=w6(d=>{if(!e||!d||i.current.has(d))return;let f=C5(e).get(d);if(f){i.current.add(d),r(p=>p[d]?p:{...p,[d]:f});return}i.current.add(d),a.current.add(d),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{u()},k6)},[e,u]);return{thumbnails:t,requestThumbnail:c,isRendering:n>0}}import Pe,{useState as E5,useEffect as lu,useMemo as qK,useCallback as YK}from"react";import{styled as KK}from"storybook/theming";Ne();import{useEffect as WK,useState as GK}from"react";function E6(e,t=5e3){let[r,n]=GK(!1);return WK(()=>{if(!e){n(!1);return}let o=setTimeout(()=>n(!0),t);return()=>clearTimeout(o)},[e,t]),r}var XK=KK.button(({theme:e})=>({gridColumn:"1 / -1",padding:"8px 16px",backgroundColor:"transparent",border:`1px dashed ${e.appBorderColor}`,borderRadius:e.appBorderRadius,color:e.color.mediumdark,fontSize:e.typography.size.s1,cursor:"pointer",transition:"all 0.15s","&:hover:not(:disabled)":{borderColor:e.color.secondary,color:e.color.secondary},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),wl=({isOpen:e,onClose:t,onSelect:r,projectId:n,stories:o=[],currentStoryId:i,onStoryChange:a,multiSelect:s=!1,onMultiSelect:l,initialSearch:u})=>{let c=Kc({projectId:n||"",enabled:e&&!!n}),d=E6(c.isLoading),f=Pe.useRef(!1);lu(()=>{e&&u&&!f.current&&(c.setSearch(u),f.current=!0),e||(f.current=!1)},[e,u]);let[p,g]=E5(new Set),[m,T]=E5(i||o[0]?.id||"");lu(()=>{i&&T(i)},[i]);let S=50,h=8,[M,z]=E5({}),O=YK(y=>{z(C=>({...C,[y]:(C[y]||1)+1}))},[]);lu(()=>{z({})},[c.variantFilters]),lu(()=>{c.expandedSets.forEach(y=>{let C=c.variantChildren[y];if(!C||C.length===0)return;let b=C;c.variantFilters.some(F=>F.value)&&(b=C.filter(F=>F.variantProperties?c.variantFilters.every(D=>D.value?F.variantProperties?.[D.property]===D.value:!0):!1));let A=M[y]||1,P=b.slice(0,A*S).map(F=>F.id);for(let F=0;F<P.length;F+=h){let D=P.slice(F,F+h),k=F/h*300;k===0?c.fetchVariantThumbnails(y,D):setTimeout(()=>c.fetchVariantThumbnails(y,D),k)}})},[c.expandedSets,c.variantChildren,c.variantFilters,M]),lu(()=>{g(new Set)},[m]);let R=qK(()=>{let y=[];return c.filteredFrames.forEach(C=>{if(C.type==="COMPONENT_SET"&&C.children){let b=c.variantFilters.some(A=>A.value)?C.children.filter(A=>A.variantProperties?c.variantFilters.every(P=>P.value?A.variantProperties?.[P.property]===P.value:!0):!1):C.children;y.push(...b)}else y.push(C)}),y},[c.filteredFrames,c.variantFilters]),B=y=>{if(s)g(C=>{let b=new Set(C);return b.has(y.id)?b.delete(y.id):b.add(y.id),b});else{let C=c.resolveThumbnail(y.id);try{r({...y,thumbnail:C})}catch(b){w.error("[ComponentBrowserModal] onSelect threw error:",b)}t()}},x=()=>{let y=R.map(b=>b.id),C=y.every(b=>p.has(b));g(C?new Set:new Set(y))},v=()=>{if(l&&p.size>0){let y=R.filter(C=>p.has(C.id)).map(C=>({...C,thumbnail:c.resolveThumbnail(C.id)}));l(y),g(new Set)}},I=y=>{T(y),a?.(y)},L=y=>{y.target===y.currentTarget&&t()},E=o.find(y=>y.id===m);return e?Pe.createElement(YI,{onClick:L},Pe.createElement(KI,null,Pe.createElement(XI,null,Pe.createElement(JI,null,"Link Figma Frames"),Pe.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},Pe.createElement("button",{onClick:()=>c.refresh(),disabled:c.isLoading,style:{padding:"4px 8px",fontSize:"12px",cursor:c.isLoading?"not-allowed":"pointer",background:"transparent",border:"1px solid #ccc",borderRadius:"4px"},title:"Refresh from Figma"},"Refresh"),Pe.createElement(QI,{onClick:t},"\xD7"))),Pe.createElement(ZI,null,c.error&&Pe.createElement(i3,null,c.error),!c.error&&Pe.createElement(Pe.Fragment,null,o.length>0&&Pe.createElement(h3,null,Pe.createElement(x3,null,"Story:"),Pe.createElement(y3,{value:m,onChange:y=>I(y.target.value)},o.map(y=>Pe.createElement("option",{key:y.id,value:y.id},y.name,y.mappingsCount?` (${y.mappingsCount} linked)`:""))),E?.mappingsCount?Pe.createElement(b3,{hasMapping:!0},E.mappingsCount," frames linked"):null),Pe.createElement(o3,null,Pe.createElement(Wd,null,Pe.createElement("input",{type:"checkbox",checked:c.showComponentSets,onChange:y=>c.setShowComponentSets(y.target.checked)}),"Component Sets"),Pe.createElement(Wd,null,Pe.createElement("input",{type:"checkbox",checked:c.showFrames,onChange:y=>c.setShowFrames(y.target.checked)}),"Frames"),Pe.createElement(Wd,null,Pe.createElement("input",{type:"checkbox",checked:c.showComponents,onChange:y=>c.setShowComponents(y.target.checked)}),"Components"),c.availablePages.length>1&&Pe.createElement(hl,{isActive:!!c.figmaPage,value:c.figmaPage,onChange:y=>c.setFigmaPage(y.target.value),style:{marginLeft:"auto"}},Pe.createElement("option",{value:""},"All pages"),c.availablePages.map(y=>Pe.createElement("option",{key:y,value:y},y)))),c.filterSuggestion&&Pe.createElement(w3,null,Pe.createElement(v3,null,"AI suggests:"),Pe.createElement(S3,null,Object.entries(c.filterSuggestion.suggestedFilters).map(([y,C])=>`${y}=${C}`).join(", ")),Pe.createElement(k3,{onClick:c.applySuggestedFilters},"Apply"),Pe.createElement(C3,{onClick:c.dismissFilterSuggestion},"Dismiss")),c.filterSuggestionLoading&&Pe.createElement(E3,null,"Matching story args to Figma filters..."),c.availableFilters.length>0&&Pe.createElement(qd,null,Pe.createElement(Qc,null,"Filters:"),c.availableFilters.map(({property:y,values:C})=>{let b=c.variantFilters.find(A=>A.property===y);return Pe.createElement(hl,{key:y,isActive:!!b?.value,value:b?.value||"",onChange:A=>c.handleFilterChange(y,A.target.value)},Pe.createElement("option",{value:""},y),C.map(A=>Pe.createElement("option",{key:A,value:A},y,"=",A)))}),c.variantFilters.some(y=>y.value)&&Pe.createElement(Yd,{onClick:c.clearFilters},"Clear All")),c.rateLimitError&&Pe.createElement("div",{style:{padding:"8px 12px",marginBottom:"8px",background:"rgba(234, 88, 12, 0.12)",border:"1px solid rgba(234, 88, 12, 0.3)",borderRadius:"6px",fontSize:"12px",color:"#ea580c"}},"\u26A0 Figma thumbnail previews unavailable \u2014"," ",c.rateLimitError,". You can still select by name."),Pe.createElement(e3,{type:"text",placeholder:"Search frames...",value:c.search,onChange:y=>c.setSearch(y.target.value),autoFocus:!0}),s&&R.length>0&&Pe.createElement(T3,null,Pe.createElement(I3,{onClick:x},p.size===R.length?"Deselect All":"Select All Visible"),Pe.createElement(R3,null,p.size>0?`${p.size} selected of `:"Showing ",R.length," frames")),c.isLoading&&d&&Pe.createElement(r5,null,"Indexing your Figma file for the first time. This walks every page and can take a couple of minutes on a large file \u2014 later loads are cached and open in under a second."),c.isLoading&&Pe.createElement(Ky,null,Array.from({length:6}).map((y,C)=>Pe.createElement(m3,{key:C},Pe.createElement("div",{style:{width:"100%",aspectRatio:"4 / 3"}},Pe.createElement(Gd,{width:"100%",height:"100%"})),Pe.createElement("div",{style:{padding:"12px",display:"flex",flexDirection:"column",gap:"8px"}},Pe.createElement(Gd,{width:"80%",height:"16px"}),Pe.createElement(Gd,{width:"50%",height:"12px"}))))),!c.isLoading&&c.filteredFrames.length===0&&Pe.createElement(r5,null,c.search?"No components match your search":"No Figma components found. We index Figma components \u2014 component sets and standalone components. Plain design frames (screens, mockups) aren't included yet \u2014 frame support is planned \u2014 so a file made only of frames will look empty here for now."),!c.isLoading&&c.filteredFrames.length>0&&Pe.createElement(Ky,null,c.filteredFrames.map(y=>Pe.createElement(Zc,{key:y.id,frame:y,thumbnail:c.thumbnails[y.id],thumbnails:c.thumbnails,variantThumbnails:c.variantThumbnails[y.id],variantChildren:c.variantChildren[y.id],variantFailed:c.variantFailed[y.id],isLoadingVariants:c.loadingVariants.has(y.id),isExpanded:c.expandedSets.has(y.id),isNew:c.recentlyAdded.has(y.name),onToggleExpand:c.toggleExpanded,onSelect:B,multiSelect:s,selectedFrames:p,variantFilters:c.variantFilters,variantPage:M[y.id]||1,onShowMore:O})),c.hasMore&&Pe.createElement(XK,{onClick:c.loadMore,disabled:c.loadingMore},c.loadingMore?"Loading...":`Show more (${c.totalFrames-c.frames.length} remaining)`)))),s&&Pe.createElement(A3,null,Pe.createElement(F3,{disabled:p.size===0,onClick:v},"Link ",p.size," Selected")))):null};Ce();tt();import{addons as is}from"storybook/manager-api";var T5="uireview/badge",Gi={REVIEW_START:"uireview/review-start",REVIEW_COMPLETE:"uireview/review-complete",REVIEW_ERROR:"uireview/review-error",REVIEW_CLEAR:"uireview/review-clear"};function JK(e){return e.criticalCount>0||e.majorCount>0?"status-value:error":e.minorCount>0?"status-value:warning":"status-value:success"}function QK(e){return e.criticalCount>0||e.majorCount>0?"error":e.minorCount>0?"warn":"success"}function ZK(e){let t=[`Score: ${e.score}`];return e.criticalCount>0&&t.push(`${e.criticalCount} critical`),e.majorCount>0&&t.push(`${e.majorCount} major`),e.minorCount>0&&t.push(`${e.minorCount} minor`),t.join(" \xB7 ")}function eX(e){let t=e.criticalCount+e.majorCount;return t>0?`\u2717 ${t} major difference${t>1?"s":""} from design`:e.minorCount>0?`\u26A0 ${e.minorCount} minor difference${e.minorCount>1?"s":""}`:"\u2713 Matches design"}function vl(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableReviewBadges:!1}catch{return!1}}function I6(e){if(vl())try{is.getChannel().emit(Gi.REVIEW_START,{storyId:e})}catch{}}function ai(e,t){if(vl())try{is.getChannel().emit(Gi.REVIEW_COMPLETE,{storyId:e,summary:t})}catch{}}function R6(e){if(vl())try{is.getChannel().emit(Gi.REVIEW_ERROR,{storyId:e})}catch{}}function cu(e){try{is.getChannel().emit(Gi.REVIEW_CLEAR,{storyId:e})}catch{}}function I5(e){try{typeof e.unset=="function"?e.unset():typeof e.set=="function"&&e.set([])}catch{}hI()}var T6=null;function A6(e){if(T6!==null)return;let t=is.getChannel(),r=o=>i=>{vl()&&o(i)};t.on(Gi.REVIEW_START,r(({storyId:o})=>{e.set([{value:"status-value:pending",typeId:T5,storyId:o,title:"Reviewing...",description:"AI review in progress"}]),ts(o,!0),zd(o,0)})),t.on(Gi.REVIEW_COMPLETE,r(({storyId:o,summary:i})=>{e.set([{value:JK(i),typeId:T5,storyId:o,title:eX(i),description:ZK(i)}]),ts(o,!0),zd(o,i.issueCount),Yc(o,QK(i)),typeof i.score=="number"&&Dd(o,i.score)})),t.on(Gi.REVIEW_ERROR,r(({storyId:o})=>{e.set([{value:"status-value:error",typeId:T5,storyId:o,title:"Review Failed",description:"An error occurred during review"}]),ts(o,!0),zd(o,0),Yc(o,"error")})),t.on(Gi.REVIEW_CLEAR,({storyId:o})=>{if(o){try{e.unset?.([o])}catch{}xI(o)}else I5(e)});let n=vl();n||I5(e),T6=setInterval(()=>{let o=vl();o!==n&&(n=o,o||I5(e))},1500)}var tX="uireview/mapped",F6="uireview/mappings-updated";function M6(e){try{is.getChannel().emit(F6,{storyIds:e})}catch{}}function P6(e){let t=is.getChannel();t.on(Gi.REVIEW_CLEAR,({storyId:r})=>{try{r?e.unset?.([r]):e.unset?.()}catch{}}),t.on(F6,({storyIds:r})=>{if(!r.length){try{e.unset?.()}catch{}return}for(let n of r)ts(n,!1);e.set(r.map(n=>({value:"status-value:success",typeId:tX,storyId:n,title:"\u{1F517} Linked to Figma (not yet reviewed)",description:"Story has a Figma mapping"})))})}var oX=_r.div({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4}),iX=_r.div(({theme:e})=>({width:"90vw",maxWidth:"1100px",height:"75vh",backgroundColor:e.background.content,borderRadius:"12px",display:"flex",flexDirection:"column",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.3)",overflow:"hidden"})),aX=_r.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),sX=_r.div({display:"flex",alignItems:"center",gap:"20px"}),lX=_r.h2(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,margin:0,display:"flex",alignItems:"center",gap:"8px"})),cX=_r.div({display:"flex",gap:"4px"}),_6=_r(sa)(({theme:e,active:t})=>({padding:"8px 16px",borderBottom:"none",borderRadius:"6px",backgroundColor:t?e.background.hoverable:"transparent","&:hover":{backgroundColor:e.background.hoverable}})),uX=_r(Wn)({width:"32px",height:"32px",fontSize:"20px",borderRadius:"6px"}),pX=_r.div({flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}),dX=_r.div(({theme:e})=>({padding:"12px 20px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,display:"flex",alignItems:"center",justifyContent:"space-between"})),fX=_r.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,display:"flex",gap:"16px"})),R5=_r.div({display:"flex",flexDirection:"column",flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.95)",padding:"40px"}),A5=_r.div({display:"flex",flexDirection:"column",alignItems:"center",gap:"20px",maxWidth:"400px"}),F5=_r.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText,textAlign:"center"})),M5=_r.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark,textAlign:"center"})),B6=_r.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden"})),z6=_r.div(({theme:e,pct:t})=>({width:t!=null?`${Math.max(t,4)}%`:"100%",height:"100%",backgroundColor:e.color.secondary,borderRadius:"4px",transition:"width 0.4s ease",animation:"uicopilot-progress-pulse 1.4s ease-in-out infinite","@keyframes uicopilot-progress-pulse":{"0%, 100%":{opacity:.6},"50%":{opacity:1}}})),D6=_r.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"6px 14px",backgroundColor:e.color.defaultText,color:"white",border:"none",borderRadius:"6px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,cursor:"pointer",transition:"opacity 0.15s","&:hover":{opacity:.85},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),N6=_r.span(({theme:e,type:t})=>({display:"flex",alignItems:"center",gap:"6px","& .dot":{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:t==="mapped"?e.color.positive:t==="unmapped"?e.color.mediumlight:"transparent"}})),df=({isOpen:e,onClose:t,projectId:r,autoRun:n})=>{let[o,i]=as("map"),[a,s]=as([]),[l,u]=as(!0),[c,d]=as(null),[f,p]=as(!1),[g,m]=as(null),T=nX(),S=c6({projectId:r}),h=h6({projectId:r}),[M,z]=as(!1),{refreshMappings:O}=bt(),{featureFlags:R}=we(),B=b6(),x=C6(r),v=uo(async()=>{u(!0);try{let $=await fetch("/index.json");if(!$.ok)throw new Error("Failed to fetch index.json");let W=await $.json(),Q=W.entries||W.stories||{},ge=Object.entries(Q).filter(([,pe])=>pe.type==="story").map(([pe,fe])=>({id:pe,name:fe.name||pe.split("--").pop()||pe,title:fe.title||"",importPath:fe.importPath,componentTitle:fe.title?.split("/").slice(0,-1).join("/")||fe.title,figmaMapping:null}));try{let pe=q(),fe=localStorage.getItem("uicopilot_session_token"),ht=await X(`${pe}/api/mappings?projectId=${r}&_t=${Date.now()}`,{headers:{Authorization:`Bearer ${fe}`}});if(ht.ok){let je=await ht.json(),xe=new Map((je.mappings||[]).map(ve=>[ve.storyId,ve]));ge.forEach(ve=>{let ot=xe.get(ve.id);ot&&ot.figmaNodeId&&(ve.figmaMapping={figmaNodeId:ot.figmaNodeId,figmaFrameName:ot.name||ot.figmaFrameName||""})})}}catch(pe){console.warn("[StoryMappingAssistant] Failed to fetch mappings (stories still loaded):",pe)}s(ge);let he=ge.find(pe=>!pe.figmaMapping);he?d(he.id):ge.length>0&&d(ge[0].id)}catch($){console.error("[StoryMappingAssistant] Error fetching stories:",$)}finally{u(!1)}},[r]);L6(()=>{e&&(v(),h.hydrate())},[e,v,h.hydrate]);let I=uo(($,W,Q)=>{s(pe=>pe.map(fe=>fe.id===$?{...fe,figmaMapping:{figmaNodeId:W,figmaFrameName:Q}}:fe));let ge=a.findIndex(pe=>pe.id===$),he=a.find((pe,fe)=>fe>ge&&!pe.figmaMapping);he&&d(he.id)},[a]),L=uo($=>{s(W=>W.map(Q=>Q.id===$?{...Q,figmaMapping:null}:Q)),cu($)},[]),E=uo($=>{d($),i("map")},[]),y=uo(()=>{let $=a.filter(W=>W.figmaMapping).map(W=>W.id);S.collectAndMap($)},[a,S]),C=uo(()=>{let $=a.filter(W=>W.figmaMapping).map(W=>W.id);p(!1),S.rerun($)},[a,S]),b=uo(async($,W)=>{await S.applyMappings($,W),p(!1),S.reset(),v(),O(),t()},[S,v,O,t]),A=uo(()=>{p(!1),S.reset()},[S]),P=uo(()=>{let $=a.filter(W=>!W.figmaMapping).map(W=>{let Q=T.getData(W.id);return{id:W.id,name:W.name,title:W.title,args:Q?.initialArgs??{}}});h.run($)},[a,h,T]),F=uo(async($,W)=>{await S.applyMappings($,W),z(!1),h.reset(),v(),O(),t()},[S,h,v,O,t]),D=_e.useRef(!1);L6(()=>{!n||D.current||l||a.length===0||(D.current=!0,P())},[n,l,a.length,P]);let k=uo(()=>{z(!1),h.reset()},[h]),N=uo(()=>{z(!1),h.reset(),P()},[h,P]);_e.useEffect(()=>{S.results&&p(!0)},[S.results]),_e.useEffect(()=>{h.results&&z(!0)},[h.results]);let G=$=>{$.target===$.currentTarget&&t()};if(!e)return null;let _=a.filter($=>$.figmaMapping).length,le=a.length;return rX(_e.createElement(_e.Fragment,null,_e.createElement(oX,{onClick:G},_e.createElement(iX,{onClick:$=>$.stopPropagation()},_e.createElement(aX,null,_e.createElement(sX,null,_e.createElement(lX,null,_e.createElement("span",null,"\u{1F517}"),"Link Stories to Figma"),_e.createElement(cX,null,_e.createElement(_6,{active:o==="map",onClick:()=>i("map")},"Map Stories"),_e.createElement(_6,{active:o==="view",onClick:()=>i("view")},"View All Mappings"))),_e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},R.enableAutoMap&&!f&&!S.isCollecting&&!S.isMapping&&_e.createElement(D6,{onClick:y,disabled:l||a.length===0},_e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2"},_e.createElement("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),_e.createElement("path",{d:"M2 17l10 5 10-5"}),_e.createElement("path",{d:"M2 12l10 5 10-5"})),"Auto-Map All"),R.enableAutoFigmaLinking&&!f&&!M&&!h.isRunning&&_e.createElement(D6,{onClick:P,disabled:l||a.length===0,title:"Match stories to Figma sets by structural spec signatures \u2014 no LLM"},_e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2"},_e.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),_e.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})),"Auto-Link (No AI)"),_e.createElement(uX,{onClick:t},"\xD7"))),_e.createElement(pX,null,(S.isCollecting||S.isMapping)&&_e.createElement(R5,null,_e.createElement(A5,null,_e.createElement(B6,null,_e.createElement(z6,null)),_e.createElement(F5,null,"Auto-mapping stories to Figma"),_e.createElement(M5,null,S.progress),_e.createElement(ii,{onClick:S.cancel,variant:"ghost"},"Cancel"))),h.isRunning&&(()=>{let $=h.progressCount,W=$&&$.total>0?Math.round($.done/$.total*100):0,Q=$?.phase==="index",ge=Math.floor(h.elapsedMs/1e3),he=`${Math.floor(ge/60)}:${(ge%60).toString().padStart(2,"0")}`,pe=$?.phase==="capturing"?`Capturing story renders (docs batch) \xB7 ${$.done} of ${$.total} \xB7 ${W}% \xB7 ${he}`:Q?`Building the Figma match index \u2014 reading each variant's design spec from Figma. First run only; on a large library this takes a few minutes. \xB7 ${he}`:$?`Matching stories \xB7 ${$.done} of ${$.total} \xB7 ${W}% \xB7 ${he}`:h.progress;return _e.createElement(R5,null,_e.createElement(A5,null,_e.createElement(B6,null,_e.createElement(z6,{pct:Q?8:W})),_e.createElement(F5,null,"Auto-linking stories to Figma (no AI)"),_e.createElement(M5,null,pe),_e.createElement(ii,{onClick:h.cancel,variant:"ghost"},"Cancel")))})(),h.error&&!h.isRunning&&!M&&_e.createElement(R5,null,_e.createElement(A5,null,_e.createElement(F5,null,"Auto-link failed"),_e.createElement(M5,null,h.error),_e.createElement(ii,{onClick:h.reset,variant:"ghost"},"Dismiss"))),M&&h.results&&_e.createElement(w5,{results:h.results,stories:a,onApply:F,onCancel:k,onRerun:N,isRerunning:h.isRunning,isApplying:S.isApplying,source:"deterministic",resolveThumbnail:$=>x.thumbnails[$]??h.results?.thumbnailUrls?.[$],onRequestFigmaThumbnail:x.requestThumbnail,resolveStoryScreenshot:$=>B.screenshots[$],isCapturingScreenshots:B.isCapturing,onRequestStoryCapture:B.requestCapture,onBrowse:$=>m($)}),f&&S.results&&_e.createElement(w5,{results:S.results,stories:a,onApply:b,onCancel:A,onRerun:C,isApplying:S.isApplying,isRerunning:S.isCollecting||S.isMapping,source:S.source,resolveThumbnail:$=>x.thumbnails[$]??S.results?.thumbnailUrls?.[$],onRequestFigmaThumbnail:x.requestThumbnail,resolveStoryScreenshot:$=>B.screenshots[$],isCapturingScreenshots:B.isCapturing,onRequestStoryCapture:B.requestCapture,onBrowse:$=>m($)}),!f&&!M&&!h.isRunning&&!h.error&&!S.isCollecting&&!S.isMapping&&(o==="map"?_e.createElement(H3,{stories:a,loading:l,selectedStoryId:c,onSelectStory:d,onStoryMapped:I,projectId:r}):_e.createElement(W3,{stories:a,loading:l,onLink:E,onUnlink:L,onUnlinkAll:()=>{cu(),v(),O()},projectId:r}))),_e.createElement(dX,null,_e.createElement(fX,null,_e.createElement("span",null,"Total: ",le," stories"),_e.createElement(N6,{type:"mapped"},_e.createElement("span",{className:"dot"}),_," mapped"),_e.createElement(N6,{type:"unmapped"},_e.createElement("span",{className:"dot"}),le-_," unmapped"))))),_e.createElement(wl,{isOpen:!!g,onClose:()=>m(null),onSelect:()=>m(null),projectId:r,initialSearch:g||void 0})),document.body)};import Bo,{useEffect as gX,useRef as mX,useState as hX}from"react";import{styled as pn}from"storybook/theming";var xX=pn.div({position:"relative",display:"inline-flex"}),yX=pn.button(({theme:e,tone:t,minWidth:r})=>({display:"inline-flex",alignItems:"center",gap:"8px",height:"26px",padding:"0 10px",border:"none",borderRadius:"6px",background:"transparent",cursor:"pointer",whiteSpace:"nowrap",...r?{minWidth:`${r}px`}:{},justifyContent:"flex-start",maxWidth:"320px",overflow:"hidden",fontFamily:e.typography.fonts.base,color:t==="action"?j:t==="error"?e.color.negative:e.color.defaultText,"&:hover":{backgroundColor:e.background.hoverable}})),bX=pn.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,fontSize:"10px",letterSpacing:"0.08em",textTransform:"uppercase",color:e.color.mediumdark})),wX=pn.span(({theme:e})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,overflow:"hidden",textOverflow:"ellipsis"})),vX=pn.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,fontSize:"11px",color:e.color.mediumdark})),SX=pn.span(({tone:e})=>({width:"6px",height:"6px",borderRadius:"50%",backgroundColor:e,flexShrink:0})),kX=pn.span(({theme:e})=>({width:"10px",height:"10px",border:`2px solid ${e.appBorderColor}`,borderTopColor:j,borderRadius:"50%",display:"inline-block",flexShrink:0,animation:"uicopilot-seg-spin 0.8s linear infinite","@keyframes uicopilot-seg-spin":{to:{transform:"rotate(360deg)"}}})),CX=pn.span(({theme:e,width:t})=>({width:`${t}px`,height:"5px",borderRadius:"3px",backgroundColor:e.appBorderColor,overflow:"hidden",display:"flex",flexShrink:0})),EX=pn.span(({pct:e,color:t})=>({width:`${e}%`,backgroundColor:t})),ff=pn.span(({theme:e})=>({width:"1px",height:"20px",backgroundColor:e.appBorderColor,flexShrink:0})),TX=pn.div(({theme:e})=>({position:"absolute",top:"30px",left:0,minWidth:"260px",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",padding:"4px",zIndex:10001})),gf=pn.div(({theme:e})=>({padding:"8px 10px 4px",fontFamily:e.typography.fonts.base,fontSize:"10px",fontWeight:e.typography.weight.bold,letterSpacing:"0.1em",textTransform:"uppercase",color:e.color.mediumdark})),si=pn.div(({theme:e})=>({display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"12px",padding:"3px 10px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.mediumdark,"& b":{color:e.color.defaultText,fontWeight:e.typography.weight.bold}})),uu=pn.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"7px 10px",border:"none",borderRadius:"6px",background:"transparent",textAlign:"left",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.defaultText,cursor:"pointer","&:hover":{backgroundColor:e.background.hoverable},"&:disabled":{opacity:.45,cursor:"not-allowed"}})),P5=pn.div(({theme:e})=>({padding:"6px 10px 8px",fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s1,color:e.color.mediumdark,borderTop:`1px solid ${e.appBorderColor}`,marginTop:"4px",lineHeight:1.5})),mf=pn.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`,margin:"5px 0 4px"})),hf=({label:e,value:t,sub:r,dot:n,busy:o,tone:i="idle",bar:a,minWidth:s,title:l,children:u})=>{let[c,d]=hX(!1),f=mX(null);return gX(()=>{if(!c)return;let p=m=>{f.current?.contains(m.target)||d(!1)},g=m=>{m.key==="Escape"&&d(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",g)}},[c]),Bo.createElement(xX,{ref:f},Bo.createElement(yX,{tone:i,minWidth:s,title:l,onClick:()=>u&&d(p=>!p),"aria-haspopup":u?"menu":void 0,"aria-expanded":u?c:void 0},o?Bo.createElement(kX,null):n?Bo.createElement(SX,{tone:n}):null,e&&Bo.createElement(bX,null,e),a&&Bo.createElement(CX,{width:a.width??88},a.bands.map((p,g)=>Bo.createElement(EX,{key:g,pct:p.pct,color:p.color}))),Bo.createElement(wX,null,t),r&&Bo.createElement(vX,null,r),u&&Bo.createElement("span",{"aria-hidden":!0},"\u25BE")),c&&u&&Bo.createElement(TX,{role:"menu",onClick:()=>d(!1)},u))};var AX=RX.div({display:"flex",alignItems:"center",gap:"4px",minWidth:0}),$6=({projectId:e,sessionToken:t,totalStories:r})=>{let{status:n,refresh:o}=uI(e,t,r),[i,a]=pu(null),[s,l]=pu(!1),[u,c]=pu(!1),[d,f]=pu(!1),[p,g]=pu(()=>Ui());IX(()=>{let B=setInterval(()=>g(Ui()),2e3);return()=>clearInterval(B)},[]);let m=O6(async()=>{if(!(!e||!t)){l(!0);try{await X(`${q()}/api/figma/crawl`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({projectId:e})})}catch{}finally{l(!1),o()}}},[e,t,o]),T=O6(async()=>{if(!(!e||!t)){f(!0);try{await X(`${q()}/api/mappings/batch?projectId=${e}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})}catch{}finally{f(!1),c(!1),o()}}},[e,t,o]);if(!e||!t)return null;let{text:S,tone:h}=pI(n),M=n.crawling||s,z=r>0?Math.round(n.mapped/r*100):0,O=p.pass+p.warn+p.fail,R=B=>O>0?B/O*100:0;return De.createElement(AX,null,De.createElement(ff,null),De.createElement(hf,{label:"Figma",value:M||n.errored||!n.connected?S:zy(n.lastSyncAt)??"synced",sub:!M&&n.setsIndexed!=null?`${n.setsIndexed} sets`:void 0,dot:n.errored?ee.red:n.connected?ee.green:j,busy:M,minWidth:230,tone:h==="warn"?"error":h,title:n.error??"Figma sync \u2014 age, contents and actions"},De.createElement(gf,null,"Sync"),De.createElement(si,null,De.createElement("span",null,"Last sync"),De.createElement("b",null,zy(n.lastSyncAt)??"unknown")),n.setsIndexed!=null&&De.createElement(si,null,De.createElement("span",null,"Indexed"),De.createElement("b",null,n.setsIndexed," sets",n.variantsIndexed!=null&&De.createElement(De.Fragment,null," \xB7 ",De.createElement("span",{style:n.variantsIndexed===0?{color:ee.red}:void 0},n.variantsIndexed," variants")))),(n.addedCount!=null||n.removedCount!=null)&&De.createElement(si,null,De.createElement("span",null,"Since last"),De.createElement("b",null,`+${n.addedCount??0} \xB7 \u2212${n.removedCount??0}`)),De.createElement(mf,null),De.createElement(uu,{onClick:m,disabled:M},"\u27F3 ",M?"Importing\u2026":"Reload from Figma"),n.errored&&n.error&&De.createElement(P5,null,"\u26A0 ",n.error)),De.createElement(ff,null),De.createElement(hf,{label:"Coverage",value:`${z}%`,sub:r>0?`${n.mapped}/${r}`:void 0,bar:{width:88,bands:[{pct:z,color:j}]},minWidth:210,title:"Stories paired to a Figma variant"},De.createElement(gf,null,"Coverage"),De.createElement(si,null,De.createElement("span",null,"Mapped"),De.createElement("b",null,n.mapped,r>0?` / ${r}`:"")),De.createElement(si,null,De.createElement("span",null,"Unmapped"),De.createElement("b",null,Math.max(0,r-n.mapped))),De.createElement(mf,null),De.createElement(uu,{onClick:()=>a("auto")},"\u26A1 Auto-Map All"),De.createElement(uu,{onClick:()=>a("browse")},"\u{1F517} Map stories to Figma\u2026"),n.mapped>0&&De.createElement(De.Fragment,null,De.createElement(mf,null),De.createElement(uu,{onClick:()=>c(!0),style:{color:ee.red}},"\u{1F5D1} Clear all ",n.mapped," mappings"))),De.createElement(ff,null),De.createElement(hf,{label:"Parity",value:O>0&&p.avgScore!=null?`${p.avgScore}`:"\u2014",sub:O>0?`${p.pass} \xB7 ${p.warn} \xB7 ${p.fail}`:"not run yet",bar:{width:96,bands:O>0?[{pct:R(p.pass),color:ee.green},{pct:R(p.warn),color:ee.amber},{pct:R(p.fail),color:ee.red}]:[]},minWidth:215,title:"Design-system parity score, and the pass / warn / fail split behind it"},De.createElement(gf,null,"Parity"),De.createElement(si,null,De.createElement("span",null,"Score"),De.createElement("b",null,p.avgScore!=null?`${p.avgScore} / 100`:"\u2014")),De.createElement(si,null,De.createElement("span",null,"Verdicts"),De.createElement("b",null,De.createElement("span",{style:{color:ee.green}},p.pass," pass")," \xB7 ",De.createElement("span",{style:{color:ee.amber}},p.warn," warn")," \xB7 ",De.createElement("span",{style:{color:ee.red}},p.fail," fail"))),De.createElement(si,null,De.createElement("span",null,"Reviewed"),De.createElement("b",null,p.reviewed," of ",p.mapped)),p.incomparable>0&&De.createElement(si,null,De.createElement("span",null,"No overlap"),De.createElement("b",null,p.incomparable)),O===0&&De.createElement(P5,null,"No review has run yet. Map stories to Figma, then Run in the review panel below to populate this.")),De.createElement(Bn,{isOpen:u,title:"Clear all mappings?",message:`This removes all ${n.mapped} story-to-Figma mappings in this project. Auto-Map can recreate them, but any mapping you set by hand will be lost.`,confirmLabel:d?"Clearing\u2026":"Clear all",variant:"danger",onConfirm:T,onCancel:()=>c(!1)}),i&&De.createElement(df,{isOpen:!0,autoRun:i==="auto",onClose:()=>{a(null),o()},projectId:e}))};Fe();tt();dr();var MX=Ar.div({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",gap:"8px"}),PX=Ar.div({display:"inline-flex",alignItems:"center",gap:"6px",minWidth:0,flex:"1 1 auto",userSelect:"none"}),LX=Ar.span(({theme:e})=>({width:"20px",height:"20px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"5px",background:`linear-gradient(135deg, ${qm} 0%, ${j} 100%)`,color:e.color.lightest,fontSize:"11px",fontWeight:900,letterSpacing:"-0.5px",boxShadow:"0 1px 2px rgba(0,0,0,0.15)"})),_X=Ar.span(({theme:e})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,letterSpacing:"-0.2px",color:e.color.defaultText})),BX=Ar.span(({theme:e})=>({fontSize:"10px",fontFamily:e.typography.fonts.mono,color:e.color.mediumdark,opacity:.8,marginLeft:"2px"})),zX=Ar.div({display:"flex",alignItems:"center",gap:"6px",flexShrink:0}),DX=Ar.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"999px",fontSize:"10px",fontWeight:e.typography.weight.bold,lineHeight:1.6,color:e.color.mediumdark,backgroundColor:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,userSelect:"none",cursor:"default","& svg":{width:"11px",height:"11px"}})),NX=Ar.div({position:"relative"}),OX=Ar.button(({theme:e})=>({width:"22px",height:"22px",padding:0,background:e.background.app,border:`1px solid ${e.appBorderColor}`,borderRadius:"50%",color:e.color.defaultText,cursor:"pointer",fontSize:"10px",fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s","&:hover":{backgroundColor:e.background.hoverable}})),$X=Ar.div(({theme:e})=>({position:"absolute",top:"calc(100% + 6px)",right:0,minWidth:"220px",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,boxShadow:"0 8px 24px rgba(0,0,0,0.14)",zIndex:1e3,overflow:"hidden",padding:"4px"})),HX=Ar.div(({theme:e})=>({padding:"8px 10px 10px",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"4px"})),UX=Ar.div(({theme:e})=>({fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),jX=Ar.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:"2px"})),_5=Ar.button(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"7px 10px",border:"none",borderRadius:e.appBorderRadius,background:"transparent",color:e.color.defaultText,fontSize:e.typography.size.s2,textAlign:"left",cursor:"pointer",transition:"background 0.12s","&:hover":{backgroundColor:e.background.hoverable}})),VX=Ar.div(({theme:e})=>({height:"1px",margin:"4px 0",backgroundColor:e.appBorderColor})),H6=Ar.button(({theme:e,isLow:t})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",background:"transparent",border:"none",borderRadius:e.appBorderRadius,color:t?e.color.warning:ee.green,cursor:"pointer",fontFamily:e.typography.fonts.mono,fontSize:"11px",fontWeight:e.typography.weight.bold,transition:"background 0.15s","&:hover":{backgroundColor:e.background.hoverable}})),U6=Ar.span(({theme:e,isLow:t})=>({width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,backgroundColor:t?e.color.warning:ee.green})),WX=Ar.span({display:"inline-block",width:"12px",height:"12px",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"#fff",borderRadius:"50%",animation:"credit-spin 0.8s linear infinite","@keyframes credit-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}}),GX=Ar.button(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.mediumdark,cursor:"pointer",transition:"all 0.15s","& svg":{width:"14px",height:"14px"},"&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText}})),qX=Ar.button({position:"fixed",bottom:"20px",right:"20px",width:"48px",height:"48px",borderRadius:"50%",backgroundColor:j,color:"white",border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"22px",cursor:"pointer",boxShadow:`0 4px 14px ${j}66, 0 2px 4px rgba(0,0,0,0.1)`,transition:"all 0.2s ease",zIndex:9999,"&:hover":{transform:"scale(1.08)",boxShadow:`0 6px 20px ${j}88, 0 3px 6px rgba(0,0,0,0.15)`},"&:active":{transform:"scale(0.96)"}}),YX=30*1e3,B5=({onOpenSettings:e})=>{let[t,r]=du(!1),[n,o]=du(!1),[i,a]=du(!1),[s,l]=du(!1),u=FX(null),{selectedProjectId:c}=Ge(),[d,f]=du(()=>cl());xf(()=>{let b=setInterval(()=>f(cl()),3e3);return()=>clearInterval(b)},[]);let{usageData:p,usageLastFetched:g,setUsageData:m,sessionToken:T,resetAuth:S}=be(),{userRole:h,roleOverride:M,featureFlags:z}=we(),O=M??h,R=!!T&&T.startsWith("uic_anon_"),B=O==="admin"||!!z.enableAiReview;xf(()=>{(async()=>{if(!(!T||g&&Date.now()-g<YX&&p)){l(!0);try{let P=q(),F=await X(`${P}/api/addon/account`,{headers:{Authorization:`Bearer ${T}`}});if(F.ok){let D=await F.json();m(D)}}catch(P){console.error("Failed to fetch balance:",P)}finally{l(!1)}}})()},[T,g,p,m]),xf(()=>{let b=()=>{document.visibilityState==="visible"&&t&&r(!1)},A=()=>{t&&r(!1)};return document.addEventListener("visibilitychange",b),window.addEventListener("focus",A),()=>{document.removeEventListener("visibilitychange",b),window.removeEventListener("focus",A)}},[t]),xf(()=>{if(!i)return;let b=P=>{u.current&&!u.current.contains(P.target)&&a(!1)},A=P=>{P.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",b),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",A)}},[i]);let x=L5(()=>{r(!0)},[]),v=L5(()=>{r(!1)},[]),I=L5(async()=>{if(a(!1),T)try{await fetch(`${q()}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${T}`}})}catch{}S()},[T,S]),L=p?.creditBalance??0,E=L<2&&!s,y=p?.email,C=(()=>{if(!y)return"?";let b=y.split("@")[0],A=b.split(/[^a-zA-Z0-9]+/).filter(Boolean);return A.length>=2?(A[0][0]+A[1][0]).toUpperCase():b.slice(0,2).toUpperCase()})();return kt.createElement(MX,null,kt.createElement(PX,null,kt.createElement(LX,{"aria-hidden":!0},"\u21CB"),kt.createElement(_X,null,Qt.NAME),kt.createElement(BX,null,"v","0.18.1"),kt.createElement($6,{projectId:c??null,sessionToken:T??null,totalStories:d})),kt.createElement(zX,null,R&&kt.createElement(DX,{title:"Guest session \u2014 sign up to save your work"},kt.createElement("span",{"aria-hidden":!0},kt.createElement(dc,null)),"Guest"),T&&h==="admin"&&O==="admin"&&kt.createElement(oI,null),T&&z.showCosts&&B&&kt.createElement(H6,{onClick:x,isLow:E,title:s?"Loading...":p?E?"Low balance - click to top up":"Credit balance - click for details":"Click to load balance"},s?kt.createElement(WX,null):p?kt.createElement(kt.Fragment,null,kt.createElement(U6,{isLow:E}),"$",L.toFixed(2)):"..."),T&&!z.showCosts&&p&&B&&kt.createElement(H6,{onClick:x,isLow:Math.floor(L)<=3,title:`${Math.floor(L)} review credits \u2014 click for details`},kt.createElement(U6,{isLow:Math.floor(L)<=3}),Math.floor(L)),e&&T&&kt.createElement(GX,{onClick:e,title:"Settings","aria-label":"Settings"},kt.createElement(e0,null)),!R&&kt.createElement(NX,{ref:u},kt.createElement(OX,{title:"Account","aria-label":"Account",onClick:()=>a(b=>!b)},C),i&&kt.createElement($X,{role:"menu"},kt.createElement(HX,null,kt.createElement(UX,null,y||"Account"),p?.plan&&kt.createElement(jX,null,p.plan," plan")),kt.createElement(_5,{role:"menuitem",onClick:()=>{a(!1),x()}},kt.createElement("span",{"aria-hidden":!0},kt.createElement(dc,null))," ","Account & usage"),e&&kt.createElement(_5,{role:"menuitem",onClick:()=>{a(!1),e()}},kt.createElement("span",{"aria-hidden":!0},kt.createElement(e0,null))," ","Settings"),kt.createElement(VX,null),kt.createElement(_5,{role:"menuitem",onClick:I},"Sign out")),t&&kt.createElement(rI,{onClose:v}))),T&&kt.createElement(qX,{onClick:()=>o(!0),title:"Send feedback","aria-label":"Send feedback"},"\u{1F4AC}"),kt.createElement(sI,{isOpen:n,onClose:()=>o(!1)}))};import Ue,{useEffect as Vee,useRef as eg,useState as Wee}from"react";import dn from"react";Ce();Ne();Fe();tt();dr();import{useState as W6,useCallback as zo,useRef as G6,useEffect as z5}from"react";Fe();tt();var KX=q(),Sl=null;function j6(e){Sl=e}async function V6(e){if(!Sl||!e||e===Sl||e.startsWith("uic_anon_"))return null;let t=Sl;Sl=null;try{let r=await X(`${KX}/api/anonymous/claim`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({anonymousToken:t})});if(!r.ok)throw new Error(`claim failed: ${r.status}`);let n=await r.json().catch(()=>({}));return typeof n?.claimedProjects=="number"?n.claimedProjects:0}catch(r){throw Sl=t,r}}var po=q();w.debug("[useAuth] Module loaded, APP_URL:",po);var yf=null,bf=null,fu=null;function gu(){yf&&(clearInterval(yf),yf=null),bf&&(clearTimeout(bf),bf=null)}var Do=()=>{let e=G6(null),t=G6(null),r=zo(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{sessionToken:n,apiKey:o,authMethod:i,deviceCode:a,userCode:s,verificationUri:l,isConnected:u,authError:c,setSessionToken:d,setApiKey:f,setAuthMethod:p,setDeviceCode:g,setUserCode:m,setVerificationUri:T,setPollingInterval:S,setAuthError:h,resetAuth:M}=be(),[z,O]=W6(!1),[R,B]=W6(!1),x=zo(()=>{gu(),fu=null},[]),v=zo(F=>{fu=F,gu();let D=async()=>{let k=fu;if(!k){gu();return}try{let G=await(await fetch(`${po}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:k})})).json();G.status==="authorized"&&G.session_token?(w.debug("[useAuth] \u2705 OAuth poll successful! Got token."),gu(),r(),fu=null,localStorage.setItem("uicopilot_session_token",G.session_token),d(G.session_token),O(!1)):G.status==="expired"&&(w.debug("[useAuth] OAuth poll_code expired"),gu(),r(),fu=null,O(!1))}catch(N){w.error("[useAuth] OAuth poll error:",N)}};yf=setInterval(D,2e3),bf=setTimeout(D,1e3)},[d,r]);z5(()=>{function F(D){if(!D.origin.startsWith(po))return;let k=D.data;if(!k||typeof k!="object")return;let N=k;if(N.type==="UICOPILOT_AUTH_ERROR"){w.debug("[useAuth] Popup reported auth error:",N.step,N.detail),x(),O(!1);let G=typeof N.step=="string"?N.step:"auth",_=typeof N.detail=="string"?N.detail:"Unknown error";h(`${Qt.NAME} auth failed (${G}): ${_}`)}else N.type==="UICOPILOT_AUTH_POLL_CODE"&&typeof N.pollCode=="string"&&N.pollCode&&(w.debug("[useAuth] Popup handed us a fresh poll_code, switching"),h(null),v(N.pollCode))}return window.addEventListener("message",F),()=>window.removeEventListener("message",F)},[v,x,h]);let I=zo(async()=>{let k=Math.max(0,Math.round((window.screen.width-480)/2)),N=Math.max(0,Math.round((window.screen.height-640)/2)),G=`width=480,height=640,left=${k},top=${N},resizable=yes,scrollbars=yes`,_=null;try{_=window.open("about:blank","uiparity-signin",G)}catch{}try{w.debug("[useAuth] Starting OAuth flow, requesting poll_code...");let le;try{le=await X(`${po}/api/addon/auth/oauth-poll`,{method:"POST"})}catch(ge){let pe=ge instanceof Error&&ge.message.includes("timed out")?`Cannot reach ${Qt.NAME} server at ${po}. Is the dashboard running?`:`Connection failed: ${po} is not responding.`;h(pe),w.error("[useAuth]",pe),_?.close();return}if(!le.ok){let ge=`Cannot reach ${Qt.NAME} server. Is the dashboard running?`;h(ge),w.error("[useAuth]",ge),_?.close();return}let{poll_code:$}=await le.json();w.debug("[useAuth] Got poll_code:",$.substring(0,15)+"...");let W=localStorage.getItem("uicopilot_force_sign_in")==="true";W&&localStorage.removeItem("uicopilot_force_sign_in");let Q=`${po}/addon/auth?poll_code=${$}${W?"&force_sign_in=true":""}`;O(!0),_&&!_.closed?_.location.href=Q:window.open(Q,"uiparity-signin",G),r(),t.current=setTimeout(()=>{O(!1),x()},9e4),w.debug("[useAuth] Starting OAuth poll for token..."),v($)}catch(le){w.error("[useAuth] OAuth flow error:",le),h(`Connection failed. Is the dashboard running at ${po}?`),O(!1),_?.close()}},[h,v,r,x]),L=zo(async()=>{try{let F=await fetch(`${po}/api/addon/auth/device`,{method:"POST"});if(!F.ok)throw new Error("Failed to start device code flow");let D=await F.json();g(D.device_code),m(D.user_code),T(D.verification_uri),window.open(D.verification_uri,"_blank"),E(D.device_code,D.interval*1e3)}catch(F){throw w.error("[useAuth] Device code flow error:",F),F}},[g,m,T]),E=zo((F,D)=>{w.debug("[useAuth] Starting polling. Device code:",F,"Interval:",D),e.current&&clearInterval(e.current);let k=async()=>{try{let G=await(await fetch(`${po}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:F})})).json();G.status==="authorized"?(w.debug("[useAuth] Device code authorization successful!"),e.current&&(clearInterval(e.current),e.current=null),g(null),m(null),T(null),localStorage.setItem("uicopilot_session_token",G.session_token),d(G.session_token),O(!1)):(G.status==="expired"||G.status==="denied")&&(w.debug("[useAuth] Device code expired or denied"),e.current&&(clearInterval(e.current),e.current=null),g(null),m(null),T(null))}catch(N){w.error("[useAuth] Polling error:",N)}};e.current=setInterval(k,D),S(D)},[g,m,T,d,S]),y=zo(()=>{e.current&&(clearInterval(e.current),e.current=null),g(null),m(null),T(null),S(null)},[g,m,T,S]),C=zo(F=>{f(F),d(F),localStorage.setItem("uicopilot_api_key",F)},[f,d]),b=zo(async()=>{if(n)try{await X(`${po}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${n}`}})}catch{}M(),O(!1),e.current&&(clearInterval(e.current),e.current=null),x()},[n,M,x]),A=zo(async()=>{B(!0),h(null);try{let F=await X(`${po}/api/anonymous/session`,{method:"POST"});if(!F.ok)throw new Error(`anonymous session ${F.status}`);let D=await F.json();if(!D?.token)throw new Error("anonymous session: no token");d(D.token)}catch{h("Couldn't start a guest session. Please try again.")}finally{B(!1)}},[d,h]),P=zo(()=>{n&&n.startsWith("uic_anon_")&&(j6(n),typeof localStorage<"u"&&localStorage.removeItem("uicopilot_force_sign_in")),I()},[n,I]);return z5(()=>{!n||n.startsWith("uic_anon_")||V6(n).then(F=>{F!==null&&w.info(`[useAuth] Guest work claimed (${F} project${F===1?"":"s"}).`)}).catch(F=>{w.error("[useAuth] Guest claim failed:",F)})},[n]),z5(()=>()=>{e.current&&clearInterval(e.current),r()},[r]),{sessionToken:n,apiKey:o,authMethod:i,deviceCode:a,userCode:s,verificationUri:l,isConnected:u,authError:c,oauthPending:z,anonPending:R,isAnonymous:!!n&&n.startsWith("uic_anon_"),setAuthMethod:p,startOAuth:I,startAnonymous:A,signUpToSave:P,startDeviceCode:L,cancelDeviceCode:y,saveApiKey:C,logout:b}};Ce();Ne();Fe();tt();import{useCallback as wf}from"react";var mu=q(),yn=()=>{let{projects:e,selectedProjectId:t,loadingProjects:r,setProjects:n,setSelectedProjectId:o,setLoadingProjects:i,getSelectedProject:a}=Ge(),{sessionToken:s}=be(),l=wf(async()=>{if(!s){w.debug("[useProjects] No session token, skipping fetch");return}try{i(!0),w.debug("[useProjects] Fetching from:",`${mu}/api/projects`);let f=await X(`${mu}/api/projects`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}});if(f.ok){let p=await f.json();w.debug("[useProjects] Projects:",p.projects),n(p.projects||[])}else w.error("[useProjects] Failed to fetch projects:",f.status,f.statusText)}catch(f){w.error("[useProjects] Error fetching projects:",f)}finally{i(!1)}},[s,n,i]),u=wf(async f=>{if(!s)throw new Error("Not authenticated");let p=await X(`${mu}/api/projects`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(f)});if(!p.ok)throw new Error("Failed to create project");let g=await p.json();return await l(),g.project},[s,l]),c=wf(async(f,p)=>{if(!s)throw new Error("Not authenticated");let g={};if(p.name!==void 0&&(g.name=p.name),p.description!==void 0&&(g.description=p.description),p.figmaFileUrl!==void 0&&(g.figmaFileId=p.figmaFileUrl===""?null:p.figmaFileUrl),!(await X(`${mu}/api/projects/${f}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(g)})).ok)throw new Error("Failed to update project");await l()},[s,l]),d=wf(async f=>{if(!s)throw new Error("Not authenticated");if(!(await X(`${mu}/api/projects/${f}`,{method:"DELETE",headers:{Authorization:`Bearer ${s}`}})).ok)throw new Error("Failed to delete project");await l(),t===f&&o(null)},[s,t,l,o]);return{projects:e,selectedProjectId:t,selectedProject:a(),loadingProjects:r,setSelectedProjectId:o,fetchProjects:l,createProject:u,updateProject:c,deleteProject:d}};Ce();var hu=()=>{let{showComponentBrowser:e,figmaFileUrl:t,currentMapping:r,mappingSource:n,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:a,setFigmaFileUrl:s,setCurrentMapping:l,setMappingSource:u,setLoadingMapping:c,setShowFigmaQuality:d}=bt();return{showComponentBrowser:e,figmaFileUrl:t,currentMapping:r,mappingSource:n,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:a,setFigmaFileUrl:s,setCurrentMapping:l,setMappingSource:u,setLoadingMapping:c,setShowFigmaQuality:d,openComponentBrowser:()=>a(!0),closeComponentBrowser:()=>a(!1)}};Ce();jy();au();import{useCallback as vu,useRef as Rf}from"react";Ne();function vf(){return new Promise(e=>{let t=document.getElementById("storybook-preview-iframe");if(!t||!t.contentWindow){w.warn("[iframeReload] No preview iframe found"),e();return}let r=t.contentWindow.location.href,n=new URL(r);n.searchParams.set("_cb",Date.now().toString());let o=n.toString();w.debug("[iframeReload] Triggering cache-busted reload:",o);let i=setTimeout(()=>{w.warn("[iframeReload] Iframe reload timed out after 5s"),t.removeEventListener("load",a),e()},5e3),a=()=>{clearTimeout(i),t.removeEventListener("load",a),w.debug("[iframeReload] Iframe loaded, waiting for HMR and styles to settle..."),setTimeout(()=>{w.debug("[iframeReload] Iframe reloaded and styles should be fresh"),e()},2e3)};t.addEventListener("load",a),t.contentWindow.location.href=o})}function Sf(e){return e&&e!=="admin"?{"X-UIC-Role-Preview":e}:{}}var kf=BigInt(4294967295),q6=BigInt(32);function XX(e,t=!1){return t?{h:Number(e&kf),l:Number(e>>q6&kf)}:{h:Number(e>>q6&kf)|0,l:Number(e&kf)|0}}function Y6(e,t=!1){let r=e.length,n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){let{h:a,l:s}=XX(e[i],t);[n[i],o[i]]=[a,s]}return[n,o]}var K6=(e,t,r)=>e<<r|t>>>32-r,X6=(e,t,r)=>t<<r|e>>>32-r,J6=(e,t,r)=>t<<r-32|e>>>64-r,Q6=(e,t,r)=>e<<r-32|t>>>64-r;function JX(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function D5(e,t=""){if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new Error(`${r}expected integer >= 0, got ${e}`)}}function Cf(e,t,r=""){let n=JX(e),o=e?.length,i=t!==void 0;if(!n||i&&o!==t){let a=r&&`"${r}" `,s=i?` of length ${t}`:"",l=n?`length=${o}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+s+", got "+l)}return e}function N5(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Z6(e,t){Cf(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function e7(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function O5(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var QX=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ZX(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function eJ(e){for(let t=0;t<e.length;t++)e[t]=ZX(e[t]);return e}var $5=QX?e=>e:eJ;function t7(e,t={}){let r=(o,i)=>e(i).update(o).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=o=>e(o),Object.assign(r,t),Object.freeze(r)}var r7=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var tJ=BigInt(0),xu=BigInt(1),rJ=BigInt(2),nJ=BigInt(7),oJ=BigInt(256),iJ=BigInt(113),i7=[],a7=[],s7=[];for(let e=0,t=xu,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],i7.push(2*(5*n+r)),a7.push((e+1)*(e+2)/2%64);let o=tJ;for(let i=0;i<7;i++)t=(t<<xu^(t>>nJ)*iJ)%oJ,t&rJ&&(o^=xu<<(xu<<BigInt(i))-xu);s7.push(o)}var l7=Y6(s7,!0),aJ=l7[0],sJ=l7[1],n7=(e,t,r)=>r>32?J6(e,t,r):K6(e,t,r),o7=(e,t,r)=>r>32?Q6(e,t,r):X6(e,t,r);function lJ(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let a=0;a<10;a++)r[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){let s=(a+8)%10,l=(a+2)%10,u=r[l],c=r[l+1],d=n7(u,c,1)^r[s],f=o7(u,c,1)^r[s+1];for(let p=0;p<50;p+=10)e[a+p]^=d,e[a+p+1]^=f}let o=e[2],i=e[3];for(let a=0;a<24;a++){let s=a7[a],l=n7(o,i,s),u=o7(o,i,s),c=i7[a];o=e[c],i=e[c+1],e[c]=l,e[c+1]=u}for(let a=0;a<50;a+=10){for(let s=0;s<10;s++)r[s]=e[a+s];for(let s=0;s<10;s++)e[a+s]^=~r[(s+2)%10]&r[(s+4)%10]}e[0]^=aJ[n],e[1]^=sJ[n]}O5(r)}var H5=class e{constructor(t,r,n,o=!1,i=24){io(this,"state");io(this,"pos",0);io(this,"posOut",0);io(this,"finished",!1);io(this,"state32");io(this,"destroyed",!1);io(this,"blockLen");io(this,"suffix");io(this,"outputLen");io(this,"enableXOF",!1);io(this,"rounds");if(this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=i,D5(n,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=e7(this.state)}clone(){return this._cloneInto()}keccak(){$5(this.state32),lJ(this.state32,this.rounds),$5(this.state32),this.posOut=0,this.pos=0}update(t){N5(this),Cf(t);let{blockLen:r,state:n}=this,o=t.length;for(let i=0;i<o;){let a=Math.min(r-this.pos,o-i);for(let s=0;s<a;s++)n[this.pos++]^=t[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:o}=this;t[n]^=r,(r&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){N5(this,!1),Cf(t),this.finish();let r=this.state,{blockLen:n}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-o);t.set(r.subarray(this.posOut,this.posOut+a),o),this.posOut+=a,o+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return D5(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Z6(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,O5(this.state)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:o,rounds:i,enableXOF:a}=this;return t||(t=new e(r,n,o,a,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=o,t.enableXOF=a,t.destroyed=this.destroyed,t}},cJ=(e,t,r,n={})=>t7(()=>new H5(t,e,r),n);var c7=cJ(6,72,64,r7(10));var uJ=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,U5=Math.ceil,go=Math.floor,Nn="[BigNumber Error] ",u7=Nn+"Number primitive has more than 15 significant digits: ",No=1e14,st=14,j5=9007199254740991,V5=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],wa=1e7,Kr=1e9;function p7(e){var t,r,n,o=h.prototype={constructor:h,toString:null,valueOf:null},i=new h(1),a=20,s=4,l=-7,u=21,c=-1e7,d=1e7,f=!1,p=1,g=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},T="0123456789abcdefghijklmnopqrstuvwxyz",S=!0;function h(x,v){var I,L,E,y,C,b,A,P,F=this;if(!(F instanceof h))return new h(x,v);if(v==null){if(x&&x._isBigNumber===!0){F.s=x.s,!x.c||x.e>d?F.c=F.e=null:x.e<c?F.c=[F.e=0]:(F.e=x.e,F.c=x.c.slice());return}if((b=typeof x=="number")&&x*0==0){if(F.s=1/x<0?(x=-x,-1):1,x===~~x){for(y=0,C=x;C>=10;C/=10,y++);y>d?F.c=F.e=null:(F.e=y,F.c=[x]);return}P=String(x)}else{if(!uJ.test(P=String(x)))return n(F,P,b);F.s=P.charCodeAt(0)==45?(P=P.slice(1),-1):1}(y=P.indexOf("."))>-1&&(P=P.replace(".","")),(C=P.search(/e/i))>0?(y<0&&(y=C),y+=+P.slice(C+1),P=P.substring(0,C)):y<0&&(y=P.length)}else{if(hr(v,2,T.length,"Base"),v==10&&S)return F=new h(x),R(F,a+F.e+1,s);if(P=String(x),b=typeof x=="number"){if(x*0!=0)return n(F,P,b,v);if(F.s=1/x<0?(P=P.slice(1),-1):1,h.DEBUG&&P.replace(/^0\.0*|\./,"").length>15)throw Error(u7+x)}else F.s=P.charCodeAt(0)===45?(P=P.slice(1),-1):1;for(I=T.slice(0,v),y=C=0,A=P.length;C<A;C++)if(I.indexOf(L=P.charAt(C))<0){if(L=="."){if(C>y){y=A;continue}}else if(!E&&(P==P.toUpperCase()&&(P=P.toLowerCase())||P==P.toLowerCase()&&(P=P.toUpperCase()))){E=!0,C=-1,y=0;continue}return n(F,String(x),b,v)}b=!1,P=r(P,v,10,F.s),(y=P.indexOf("."))>-1?P=P.replace(".",""):y=P.length}for(C=0;P.charCodeAt(C)===48;C++);for(A=P.length;P.charCodeAt(--A)===48;);if(P=P.slice(C,++A)){if(A-=C,b&&h.DEBUG&&A>15&&(x>j5||x!==go(x)))throw Error(u7+F.s*x);if((y=y-C-1)>d)F.c=F.e=null;else if(y<c)F.c=[F.e=0];else{if(F.e=y,F.c=[],C=(y+1)%st,y<0&&(C+=st),C<A){for(C&&F.c.push(+P.slice(0,C)),A-=st;C<A;)F.c.push(+P.slice(C,C+=st));C=st-(P=P.slice(C)).length}else C-=A;for(;C--;P+="0");F.c.push(+P)}}else F.c=[F.e=0]}h.clone=p7,h.ROUND_UP=0,h.ROUND_DOWN=1,h.ROUND_CEIL=2,h.ROUND_FLOOR=3,h.ROUND_HALF_UP=4,h.ROUND_HALF_DOWN=5,h.ROUND_HALF_EVEN=6,h.ROUND_HALF_CEIL=7,h.ROUND_HALF_FLOOR=8,h.EUCLID=9,h.config=h.set=function(x){var v,I;if(x!=null)if(typeof x=="object"){if(x.hasOwnProperty(v="DECIMAL_PLACES")&&(I=x[v],hr(I,0,Kr,v),a=I),x.hasOwnProperty(v="ROUNDING_MODE")&&(I=x[v],hr(I,0,8,v),s=I),x.hasOwnProperty(v="EXPONENTIAL_AT")&&(I=x[v],I&&I.pop?(hr(I[0],-Kr,0,v),hr(I[1],0,Kr,v),l=I[0],u=I[1]):(hr(I,-Kr,Kr,v),l=-(u=I<0?-I:I))),x.hasOwnProperty(v="RANGE"))if(I=x[v],I&&I.pop)hr(I[0],-Kr,-1,v),hr(I[1],1,Kr,v),c=I[0],d=I[1];else if(hr(I,-Kr,Kr,v),I)c=-(d=I<0?-I:I);else throw Error(Nn+v+" cannot be zero: "+I);if(x.hasOwnProperty(v="CRYPTO"))if(I=x[v],I===!!I)if(I)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=I;else throw f=!I,Error(Nn+"crypto unavailable");else f=I;else throw Error(Nn+v+" not true or false: "+I);if(x.hasOwnProperty(v="MODULO_MODE")&&(I=x[v],hr(I,0,9,v),p=I),x.hasOwnProperty(v="POW_PRECISION")&&(I=x[v],hr(I,0,Kr,v),g=I),x.hasOwnProperty(v="FORMAT"))if(I=x[v],typeof I=="object")m=I;else throw Error(Nn+v+" not an object: "+I);if(x.hasOwnProperty(v="ALPHABET"))if(I=x[v],typeof I=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(I))S=I.slice(0,10)=="0123456789",T=I;else throw Error(Nn+v+" invalid: "+I)}else throw Error(Nn+"Object expected: "+x);return{DECIMAL_PLACES:a,ROUNDING_MODE:s,EXPONENTIAL_AT:[l,u],RANGE:[c,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:g,FORMAT:m,ALPHABET:T}},h.isBigNumber=function(x){if(!x||x._isBigNumber!==!0)return!1;if(!h.DEBUG)return!0;var v,I,L=x.c,E=x.e,y=x.s;e:if({}.toString.call(L)=="[object Array]"){if((y===1||y===-1)&&E>=-Kr&&E<=Kr&&E===go(E)){if(L[0]===0){if(E===0&&L.length===1)return!0;break e}if(v=(E+1)%st,v<1&&(v+=st),String(L[0]).length==v){for(v=0;v<L.length;v++)if(I=L[v],I<0||I>=No||I!==go(I))break e;if(I!==0)return!0}}}else if(L===null&&E===null&&(y===null||y===1||y===-1))return!0;throw Error(Nn+"Invalid BigNumber: "+x)},h.maximum=h.max=function(){return z(arguments,-1)},h.minimum=h.min=function(){return z(arguments,1)},h.random=(function(){var x=9007199254740992,v=Math.random()*x&2097151?function(){return go(Math.random()*x)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(I){var L,E,y,C,b,A=0,P=[],F=new h(i);if(I==null?I=a:hr(I,0,Kr),C=U5(I/st),f)if(crypto.getRandomValues){for(L=crypto.getRandomValues(new Uint32Array(C*=2));A<C;)b=L[A]*131072+(L[A+1]>>>11),b>=9e15?(E=crypto.getRandomValues(new Uint32Array(2)),L[A]=E[0],L[A+1]=E[1]):(P.push(b%1e14),A+=2);A=C/2}else if(crypto.randomBytes){for(L=crypto.randomBytes(C*=7);A<C;)b=(L[A]&31)*281474976710656+L[A+1]*1099511627776+L[A+2]*4294967296+L[A+3]*16777216+(L[A+4]<<16)+(L[A+5]<<8)+L[A+6],b>=9e15?crypto.randomBytes(7).copy(L,A):(P.push(b%1e14),A+=7);A=C/7}else throw f=!1,Error(Nn+"crypto unavailable");if(!f)for(;A<C;)b=v(),b<9e15&&(P[A++]=b%1e14);for(C=P[--A],I%=st,C&&I&&(b=V5[st-I],P[A]=go(C/b)*b);P[A]===0;P.pop(),A--);if(A<0)P=[y=0];else{for(y=-1;P[0]===0;P.splice(0,1),y-=st);for(A=1,b=P[0];b>=10;b/=10,A++);A<st&&(y-=st-A)}return F.e=y,F.c=P,F}})(),h.sum=function(){for(var x=1,v=arguments,I=new h(v[0]);x<v.length;)I=I.plus(v[x++]);return I},r=(function(){var x="0123456789";function v(I,L,E,y){for(var C,b=[0],A,P=0,F=I.length;P<F;){for(A=b.length;A--;b[A]*=L);for(b[0]+=y.indexOf(I.charAt(P++)),C=0;C<b.length;C++)b[C]>E-1&&(b[C+1]==null&&(b[C+1]=0),b[C+1]+=b[C]/E|0,b[C]%=E)}return b.reverse()}return function(I,L,E,y,C){var b,A,P,F,D,k,N,G,_=I.indexOf("."),le=a,$=s;for(_>=0&&(F=g,g=0,I=I.replace(".",""),G=new h(L),k=G.pow(I.length-_),g=F,G.c=v(qi(fo(k.c),k.e,"0"),10,E,x),G.e=G.c.length),N=v(I,L,E,C?(b=T,x):(b=x,T)),P=F=N.length;N[--F]==0;N.pop());if(!N[0])return b.charAt(0);if(_<0?--P:(k.c=N,k.e=P,k.s=y,k=t(k,G,le,$,E),N=k.c,D=k.r,P=k.e),A=P+le+1,_=N[A],F=E/2,D=D||A<0||N[A+1]!=null,D=$<4?(_!=null||D)&&($==0||$==(k.s<0?3:2)):_>F||_==F&&($==4||D||$==6&&N[A-1]&1||$==(k.s<0?8:7)),A<1||!N[0])I=D?qi(b.charAt(1),-le,b.charAt(0)):b.charAt(0);else{if(N.length=A,D)for(--E;++N[--A]>E;)N[A]=0,A||(++P,N=[1].concat(N));for(F=N.length;!N[--F];);for(_=0,I="";_<=F;I+=b.charAt(N[_++]));I=qi(I,P,b.charAt(0))}return I}})(),t=(function(){function x(L,E,y){var C,b,A,P,F=0,D=L.length,k=E%wa,N=E/wa|0;for(L=L.slice();D--;)A=L[D]%wa,P=L[D]/wa|0,C=N*A+P*k,b=k*A+C%wa*wa+F,F=(b/y|0)+(C/wa|0)+N*P,L[D]=b%y;return F&&(L=[F].concat(L)),L}function v(L,E,y,C){var b,A;if(y!=C)A=y>C?1:-1;else for(b=A=0;b<y;b++)if(L[b]!=E[b]){A=L[b]>E[b]?1:-1;break}return A}function I(L,E,y,C){for(var b=0;y--;)L[y]-=b,b=L[y]<E[y]?1:0,L[y]=b*C+L[y]-E[y];for(;!L[0]&&L.length>1;L.splice(0,1));}return function(L,E,y,C,b){var A,P,F,D,k,N,G,_,le,$,W,Q,ge,he,pe,fe,ht,je=L.s==E.s?1:-1,xe=L.c,ve=E.c;if(!xe||!xe[0]||!ve||!ve[0])return new h(!L.s||!E.s||(xe?ve&&xe[0]==ve[0]:!ve)?NaN:xe&&xe[0]==0||!ve?je*0:je/0);for(_=new h(je),le=_.c=[],P=L.e-E.e,je=y+P+1,b||(b=No,P=mo(L.e/st)-mo(E.e/st),je=je/st|0),F=0;ve[F]==(xe[F]||0);F++);if(ve[F]>(xe[F]||0)&&P--,je<0)le.push(1),D=!0;else{for(he=xe.length,fe=ve.length,F=0,je+=2,k=go(b/(ve[0]+1)),k>1&&(ve=x(ve,k,b),xe=x(xe,k,b),fe=ve.length,he=xe.length),ge=fe,$=xe.slice(0,fe),W=$.length;W<fe;$[W++]=0);ht=ve.slice(),ht=[0].concat(ht),pe=ve[0],ve[1]>=b/2&&pe++;do{if(k=0,A=v(ve,$,fe,W),A<0){if(Q=$[0],fe!=W&&(Q=Q*b+($[1]||0)),k=go(Q/pe),k>1)for(k>=b&&(k=b-1),N=x(ve,k,b),G=N.length,W=$.length;v(N,$,G,W)==1;)k--,I(N,fe<G?ht:ve,G,b),G=N.length,A=1;else k==0&&(A=k=1),N=ve.slice(),G=N.length;if(G<W&&(N=[0].concat(N)),I($,N,W,b),W=$.length,A==-1)for(;v(ve,$,fe,W)<1;)k++,I($,fe<W?ht:ve,W,b),W=$.length}else A===0&&(k++,$=[0]);le[F++]=k,$[0]?$[W++]=xe[ge]||0:($=[xe[ge]],W=1)}while((ge++<he||$[0]!=null)&&je--);D=$[0]!=null,le[0]||le.splice(0,1)}if(b==No){for(F=1,je=le[0];je>=10;je/=10,F++);R(_,y+(_.e=F+P*st-1)+1,C,D)}else _.e=P,_.r=+D;return _}})();function M(x,v,I,L){var E,y,C,b,A;if(I==null?I=s:hr(I,0,8),!x.c)return x.toString();if(E=x.c[0],C=x.e,v==null)A=fo(x.c),A=L==1||L==2&&(C<=l||C>=u)?Tf(A,C):qi(A,C,"0");else if(x=R(new h(x),v,I),y=x.e,A=fo(x.c),b=A.length,L==1||L==2&&(v<=y||y<=l)){for(;b<v;A+="0",b++);A=Tf(A,y)}else if(v-=C+(L===2&&y>C),A=qi(A,y,"0"),y+1>b){if(--v>0)for(A+=".";v--;A+="0");}else if(v+=y-b,v>0)for(y+1==b&&(A+=".");v--;A+="0");return x.s<0&&E?"-"+A:A}function z(x,v){for(var I,L,E=1,y=new h(x[0]);E<x.length;E++)L=new h(x[E]),(!L.s||(I=ss(y,L))===v||I===0&&y.s===v)&&(y=L);return y}function O(x,v,I){for(var L=1,E=v.length;!v[--E];v.pop());for(E=v[0];E>=10;E/=10,L++);return(I=L+I*st-1)>d?x.c=x.e=null:I<c?x.c=[x.e=0]:(x.e=I,x.c=v),x}n=(function(){var x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,I=/^\.([^.]+)$/,L=/^-?(Infinity|NaN)$/,E=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(y,C,b,A){var P,F=b?C:C.replace(E,"");if(L.test(F))y.s=isNaN(F)?null:F<0?-1:1;else{if(!b&&(F=F.replace(x,function(D,k,N){return P=(N=N.toLowerCase())=="x"?16:N=="b"?2:8,!A||A==P?k:D}),A&&(P=A,F=F.replace(v,"$1").replace(I,"0.$1")),C!=F))return new h(F,P);if(h.DEBUG)throw Error(Nn+"Not a"+(A?" base "+A:"")+" number: "+C);y.s=null}y.c=y.e=null}})();function R(x,v,I,L){var E,y,C,b,A,P,F,D=x.c,k=V5;if(D){e:{for(E=1,b=D[0];b>=10;b/=10,E++);if(y=v-E,y<0)y+=st,C=v,A=D[P=0],F=go(A/k[E-C-1]%10);else if(P=U5((y+1)/st),P>=D.length)if(L){for(;D.length<=P;D.push(0));A=F=0,E=1,y%=st,C=y-st+1}else break e;else{for(A=b=D[P],E=1;b>=10;b/=10,E++);y%=st,C=y-st+E,F=C<0?0:go(A/k[E-C-1]%10)}if(L=L||v<0||D[P+1]!=null||(C<0?A:A%k[E-C-1]),L=I<4?(F||L)&&(I==0||I==(x.s<0?3:2)):F>5||F==5&&(I==4||L||I==6&&(y>0?C>0?A/k[E-C]:0:D[P-1])%10&1||I==(x.s<0?8:7)),v<1||!D[0])return D.length=0,L?(v-=x.e+1,D[0]=k[(st-v%st)%st],x.e=-v||0):D[0]=x.e=0,x;if(y==0?(D.length=P,b=1,P--):(D.length=P+1,b=k[st-y],D[P]=C>0?go(A/k[E-C]%k[C])*b:0),L)for(;;)if(P==0){for(y=1,C=D[0];C>=10;C/=10,y++);for(C=D[0]+=b,b=1;C>=10;C/=10,b++);y!=b&&(x.e++,D[0]==No&&(D[0]=1));break}else{if(D[P]+=b,D[P]!=No)break;D[P--]=0,b=1}for(y=D.length;D[--y]===0;D.pop());}x.e>d?x.c=x.e=null:x.e<c&&(x.c=[x.e=0])}return x}function B(x){var v,I=x.e;return I===null?x.toString():(v=fo(x.c),v=I<=l||I>=u?Tf(v,I):qi(v,I,"0"),x.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var x=new h(this);return x.s<0&&(x.s=1),x},o.comparedTo=function(x,v){return ss(this,new h(x,v))},o.decimalPlaces=o.dp=function(x,v){var I,L,E,y=this;if(x!=null)return hr(x,0,Kr),v==null?v=s:hr(v,0,8),R(new h(y),x+y.e+1,v);if(!(I=y.c))return null;if(L=((E=I.length-1)-mo(this.e/st))*st,E=I[E])for(;E%10==0;E/=10,L--);return L<0&&(L=0),L},o.dividedBy=o.div=function(x,v){return t(this,new h(x,v),a,s)},o.dividedToIntegerBy=o.idiv=function(x,v){return t(this,new h(x,v),0,1)},o.exponentiatedBy=o.pow=function(x,v){var I,L,E,y,C,b,A,P,F,D=this;if(x=new h(x),x.c&&!x.isInteger())throw Error(Nn+"Exponent not an integer: "+B(x));if(v!=null&&(v=new h(v)),b=x.e>14,!D.c||!D.c[0]||D.c[0]==1&&!D.e&&D.c.length==1||!x.c||!x.c[0])return F=new h(Math.pow(+B(D),b?x.s*(2-Ef(x)):+B(x))),v?F.mod(v):F;if(A=x.s<0,v){if(v.c?!v.c[0]:!v.s)return new h(NaN);L=!A&&D.isInteger()&&v.isInteger(),L&&(D=D.mod(v))}else{if(x.e>9&&(D.e>0||D.e<-1||(D.e==0?D.c[0]>1||b&&D.c[1]>=24e7:D.c[0]<8e13||b&&D.c[0]<=9999975e7)))return y=D.s<0&&Ef(x)?-0:0,D.e>-1&&(y=1/y),new h(A?1/y:y);g&&(y=U5(g/st+2))}for(b?(I=new h(.5),A&&(x.s=1),P=Ef(x)):(E=Math.abs(+B(x)),P=E%2),F=new h(i);;){if(P){if(F=F.times(D),!F.c)break;y?F.c.length>y&&(F.c.length=y):L&&(F=F.mod(v))}if(E){if(E=go(E/2),E===0)break;P=E%2}else if(x=x.times(I),R(x,x.e+1,1),x.e>14)P=Ef(x);else{if(E=+B(x),E===0)break;P=E%2}D=D.times(D),y?D.c&&D.c.length>y&&(D.c.length=y):L&&(D=D.mod(v))}return L?F:(A&&(F=i.div(F)),v?F.mod(v):y?R(F,g,s,C):F)},o.integerValue=function(x){var v=new h(this);return x==null?x=s:hr(x,0,8),R(v,v.e+1,x)},o.isEqualTo=o.eq=function(x,v){return ss(this,new h(x,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(x,v){return ss(this,new h(x,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(x,v){return(v=ss(this,new h(x,v)))===1||v===0},o.isInteger=function(){return!!this.c&&mo(this.e/st)>this.c.length-2},o.isLessThan=o.lt=function(x,v){return ss(this,new h(x,v))<0},o.isLessThanOrEqualTo=o.lte=function(x,v){return(v=ss(this,new h(x,v)))===-1||v===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(x,v){var I,L,E,y,C=this,b=C.s;if(x=new h(x,v),v=x.s,!b||!v)return new h(NaN);if(b!=v)return x.s=-v,C.plus(x);var A=C.e/st,P=x.e/st,F=C.c,D=x.c;if(!A||!P){if(!F||!D)return F?(x.s=-v,x):new h(D?C:NaN);if(!F[0]||!D[0])return D[0]?(x.s=-v,x):new h(F[0]?C:s==3?-0:0)}if(A=mo(A),P=mo(P),F=F.slice(),b=A-P){for((y=b<0)?(b=-b,E=F):(P=A,E=D),E.reverse(),v=b;v--;E.push(0));E.reverse()}else for(L=(y=(b=F.length)<(v=D.length))?b:v,b=v=0;v<L;v++)if(F[v]!=D[v]){y=F[v]<D[v];break}if(y&&(E=F,F=D,D=E,x.s=-x.s),v=(L=D.length)-(I=F.length),v>0)for(;v--;F[I++]=0);for(v=No-1;L>b;){if(F[--L]<D[L]){for(I=L;I&&!F[--I];F[I]=v);--F[I],F[L]+=No}F[L]-=D[L]}for(;F[0]==0;F.splice(0,1),--P);return F[0]?O(x,F,P):(x.s=s==3?-1:1,x.c=[x.e=0],x)},o.modulo=o.mod=function(x,v){var I,L,E=this;return x=new h(x,v),!E.c||!x.s||x.c&&!x.c[0]?new h(NaN):!x.c||E.c&&!E.c[0]?new h(E):(p==9?(L=x.s,x.s=1,I=t(E,x,0,3),x.s=L,I.s*=L):I=t(E,x,0,p),x=E.minus(I.times(x)),!x.c[0]&&p==1&&(x.s=E.s),x)},o.multipliedBy=o.times=function(x,v){var I,L,E,y,C,b,A,P,F,D,k,N,G,_,le,$=this,W=$.c,Q=(x=new h(x,v)).c;if(!W||!Q||!W[0]||!Q[0])return!$.s||!x.s||W&&!W[0]&&!Q||Q&&!Q[0]&&!W?x.c=x.e=x.s=null:(x.s*=$.s,!W||!Q?x.c=x.e=null:(x.c=[0],x.e=0)),x;for(L=mo($.e/st)+mo(x.e/st),x.s*=$.s,A=W.length,D=Q.length,A<D&&(G=W,W=Q,Q=G,E=A,A=D,D=E),E=A+D,G=[];E--;G.push(0));for(_=No,le=wa,E=D;--E>=0;){for(I=0,k=Q[E]%le,N=Q[E]/le|0,C=A,y=E+C;y>E;)P=W[--C]%le,F=W[C]/le|0,b=N*P+F*k,P=k*P+b%le*le+G[y]+I,I=(P/_|0)+(b/le|0)+N*F,G[y--]=P%_;G[y]=I}return I?++L:G.splice(0,1),O(x,G,L)},o.negated=function(){var x=new h(this);return x.s=-x.s||null,x},o.plus=function(x,v){var I,L=this,E=L.s;if(x=new h(x,v),v=x.s,!E||!v)return new h(NaN);if(E!=v)return x.s=-v,L.minus(x);var y=L.e/st,C=x.e/st,b=L.c,A=x.c;if(!y||!C){if(!b||!A)return new h(E/0);if(!b[0]||!A[0])return A[0]?x:new h(b[0]?L:E*0)}if(y=mo(y),C=mo(C),b=b.slice(),E=y-C){for(E>0?(C=y,I=A):(E=-E,I=b),I.reverse();E--;I.push(0));I.reverse()}for(E=b.length,v=A.length,E-v<0&&(I=A,A=b,b=I,v=E),E=0;v;)E=(b[--v]=b[v]+A[v]+E)/No|0,b[v]=No===b[v]?0:b[v]%No;return E&&(b=[E].concat(b),++C),O(x,b,C)},o.precision=o.sd=function(x,v){var I,L,E,y=this;if(x!=null&&x!==!!x)return hr(x,1,Kr),v==null?v=s:hr(v,0,8),R(new h(y),x,v);if(!(I=y.c))return null;if(E=I.length-1,L=E*st+1,E=I[E]){for(;E%10==0;E/=10,L--);for(E=I[0];E>=10;E/=10,L++);}return x&&y.e+1>L&&(L=y.e+1),L},o.shiftedBy=function(x){return hr(x,-j5,j5),this.times("1e"+x)},o.squareRoot=o.sqrt=function(){var x,v,I,L,E,y=this,C=y.c,b=y.s,A=y.e,P=a+4,F=new h("0.5");if(b!==1||!C||!C[0])return new h(!b||b<0&&(!C||C[0])?NaN:C?y:1/0);if(b=Math.sqrt(+B(y)),b==0||b==1/0?(v=fo(C),(v.length+A)%2==0&&(v+="0"),b=Math.sqrt(+v),A=mo((A+1)/2)-(A<0||A%2),b==1/0?v="5e"+A:(v=b.toExponential(),v=v.slice(0,v.indexOf("e")+1)+A),I=new h(v)):I=new h(b+""),I.c[0]){for(A=I.e,b=A+P,b<3&&(b=0);;)if(E=I,I=F.times(E.plus(t(y,E,P,1))),fo(E.c).slice(0,b)===(v=fo(I.c)).slice(0,b))if(I.e<A&&--b,v=v.slice(b-3,b+1),v=="9999"||!L&&v=="4999"){if(!L&&(R(E,E.e+a+2,0),E.times(E).eq(y))){I=E;break}P+=4,b+=4,L=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(R(I,I.e+a+2,1),x=!I.times(I).eq(y));break}}return R(I,I.e+a+1,s,x)},o.toExponential=function(x,v){return x!=null&&(hr(x,0,Kr),x++),M(this,x,v,1)},o.toFixed=function(x,v){return x!=null&&(hr(x,0,Kr),x=x+this.e+1),M(this,x,v)},o.toFormat=function(x,v,I){var L,E=this;if(I==null)x!=null&&v&&typeof v=="object"?(I=v,v=null):x&&typeof x=="object"?(I=x,x=v=null):I=m;else if(typeof I!="object")throw Error(Nn+"Argument not an object: "+I);if(L=E.toFixed(x,v),E.c){var y,C=L.split("."),b=+I.groupSize,A=+I.secondaryGroupSize,P=I.groupSeparator||"",F=C[0],D=C[1],k=E.s<0,N=k?F.slice(1):F,G=N.length;if(A&&(y=b,b=A,A=y,G-=y),b>0&&G>0){for(y=G%b||b,F=N.substr(0,y);y<G;y+=b)F+=P+N.substr(y,b);A>0&&(F+=P+N.slice(y)),k&&(F="-"+F)}L=D?F+(I.decimalSeparator||"")+((A=+I.fractionGroupSize)?D.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(I.fractionGroupSeparator||"")):D):F}return(I.prefix||"")+L+(I.suffix||"")},o.toFraction=function(x){var v,I,L,E,y,C,b,A,P,F,D,k,N=this,G=N.c;if(x!=null&&(b=new h(x),!b.isInteger()&&(b.c||b.s!==1)||b.lt(i)))throw Error(Nn+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+B(b));if(!G)return new h(N);for(v=new h(i),P=I=new h(i),L=A=new h(i),k=fo(G),y=v.e=k.length-N.e-1,v.c[0]=V5[(C=y%st)<0?st+C:C],x=!x||b.comparedTo(v)>0?y>0?v:P:b,C=d,d=1/0,b=new h(k),A.c[0]=0;F=t(b,v,0,1),E=I.plus(F.times(L)),E.comparedTo(x)!=1;)I=L,L=E,P=A.plus(F.times(E=P)),A=E,v=b.minus(F.times(E=v)),b=E;return E=t(x.minus(I),L,0,1),A=A.plus(E.times(P)),I=I.plus(E.times(L)),A.s=P.s=N.s,y=y*2,D=t(P,L,y,s).minus(N).abs().comparedTo(t(A,I,y,s).minus(N).abs())<1?[P,L]:[A,I],d=C,D},o.toNumber=function(){return+B(this)},o.toPrecision=function(x,v){return x!=null&&hr(x,1,Kr),M(this,x,v,2)},o.toString=function(x){var v,I=this,L=I.s,E=I.e;return E===null?L?(v="Infinity",L<0&&(v="-"+v)):v="NaN":(x==null?v=E<=l||E>=u?Tf(fo(I.c),E):qi(fo(I.c),E,"0"):x===10&&S?(I=R(new h(I),a+E+1,s),v=qi(fo(I.c),I.e,"0")):(hr(x,2,T.length,"Base"),v=r(qi(fo(I.c),E,"0"),10,x,L,!0)),L<0&&I.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return B(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&h.set(e),h}function mo(e){var t=e|0;return e>0||e===t?t:t-1}function fo(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=st-t.length;r--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function ss(e,t){var r,n,o=e.c,i=t.c,a=e.s,s=t.s,l=e.e,u=t.e;if(!a||!s)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=l==u,!o||!i)return n?0:!o^r?1:-1;if(!n)return l>u^r?1:-1;for(s=(l=o.length)<(u=i.length)?l:u,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^r?1:-1;return l==u?0:l>u^r?1:-1}function hr(e,t,r,n){if(e<t||e>r||e!==go(e))throw Error(Nn+(n||"Argument")+(typeof e=="number"?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Ef(e){var t=e.c.length-1;return mo(e.e/st)==t&&e.c[t]%2!=0}function Tf(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function qi(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(n=e.length,++t>n){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var pJ=p7(),d7=pJ;var dJ=24,yu=32,fJ=()=>typeof globalThis<"u"&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"?()=>{let e=new Uint32Array(1);return globalThis.crypto.getRandomValues(e),e[0]/4294967296}:Math.random,G5=fJ(),W5=(e=4,t=G5)=>{let r="";for(;r.length<e;)r=r+Math.floor(t()*36).toString(36);return r};function gJ(e){let t=new d7(0);for(let r of e.values())t=t.multipliedBy(256).plus(r);return t}var g7=(e="")=>{let t=new TextEncoder;return gJ(c7(t.encode(e))).toString(36).slice(1)},f7=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),mJ=e=>f7[Math.floor(e()*f7.length)],hJ=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=G5}={})=>{let r=Object.keys(e).toString(),n=r.length?r+W5(yu,t):W5(yu,t);return g7(n).substring(0,yu)},xJ=e=>()=>e++,yJ=476782367,m7=({random:e=G5,counter:t=xJ(Math.floor(e()*yJ)),length:r=dJ,fingerprint:n=hJ({random:e})}={})=>{if(r>yu)throw new Error(`Length must be between 2 and ${yu}. Received: ${r}`);return function(){let i=mJ(e),a=Date.now().toString(36),s=t().toString(36),l=W5(r,e),u=`${a+l+s+n}`;return`${i+g7(u).substring(1,r)}`}},va=bJ(m7);function bJ(e){let t;return()=>(t||(t=e()),t())}var SJ=Pp(y7());dr();Ne();var If=/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g;function kJ(e){return e.replace(/\*\*/g,"").replace(/\*/g,"").replace(/__/g,"").replace(/_/g," ").trim()}function q5(e,t){let r=[],n=e.split(`
88
88
  `);for(let a=0;a<n.length;a++){let s=kJ(n[a]),l=If.exec(s);if(l){let[,u,c,,d]=l,f=CJ(c),p=EJ(n,a+1),g={id:va(),reviewId:t,type:u.trim(),severity:f,title:d.trim(),description:p.description,file:p.file,lineNumber:p.lineNumber,property:p.property,currentValue:p.currentValue,suggestedValue:p.suggestedValue,suggestedCode:p.suggestedCode,suggestedFix:p.suggestedFix,fixTarget:p.fixTarget,fixRequired:p.fixRequired,status:"pending",selectedForFix:!1,createdAt:new Date};r.push(g)}If.lastIndex=0}return r.map(a=>{let s=jc(a);return s.dismissed?(w.debug(`[parseIssues] Auto-dismissed: ${a.title} - ${s.dismissReason}`),{...a,dismissed:!0,dismissReason:s.dismissReason,dismissedBy:s.dismissedBy,dismissedAt:new Date}):a})}function CJ(e){let t=e.toLowerCase().trim();return t.includes("critical")||t.includes("high")?"critical":t.includes("major")||t.includes("medium")?"major":"minor"}function EJ(e,t){let r={description:"",file:void 0,lineNumber:void 0,property:void 0,currentValue:void 0,suggestedValue:void 0,suggestedCode:void 0,suggestedFix:void 0,fixTarget:void 0,fixRequired:void 0},n=[];for(let o=t;o<e.length;o++){let i=e[o].trim();if(!i||If.test(i)){If.lastIndex=0;break}if(i.startsWith("Expected:"))r.suggestedValue=i.replace("Expected:","").trim();else if(i.startsWith("Actual:")||i.startsWith("Current:"))r.currentValue=i.replace(/^(Actual|Current):/,"").trim();else if(i.startsWith("File:")){let a=i.replace("File:","").trim(),s=a.match(/^(.+?):(\d+)$/);s?(r.file=s[1],r.lineNumber=parseInt(s[2],10)):r.file=a}else if(i.startsWith("Property:"))r.property=i.replace("Property:","").trim();else if(i.startsWith("FixTarget:")){let a=i.replace("FixTarget:","").trim().toLowerCase();(a==="css"||a==="component")&&(r.fixTarget=a)}else if(i.startsWith("FixRequired:")){let a=i.replace("FixRequired:","").trim().toLowerCase();r.fixRequired=a==="true"}else if(i.startsWith("Fix:"))r.suggestedFix=i.replace("Fix:","").trim();else if(i.startsWith("```")){let a=[];for(o++;o<e.length&&!e[o].trim().startsWith("```");)a.push(e[o]),o++;r.suggestedCode=a.join(`
89
89
  `)}else n.push(i)}return r.description=n.join(" ").trim(),r}Ne();var bu=null,b7=0,TJ=3e4;async function IJ(){let e=Date.now();if(bu&&e-b7<TJ)return bu;try{let t=await fetch("/index.json");if(!t.ok)throw new Error(`Failed to fetch index.json: ${t.status}`);let r=await t.json();return bu=r.entries||r.stories||{},b7=e,w.debug("[storyFilePaths] Fetched index.json, entries:",Object.keys(bu).length),bu}catch(t){throw w.error("[storyFilePaths] Error fetching index.json:",t),t}}async function ls(e){try{let r=(await IJ())[e];if(!r?.importPath)return w.warn("[storyFilePaths] No importPath found for story:",e),null;let n=r.importPath;w.debug("[storyFilePaths] Found importPath:",n);let o=n.replace(/^\.\//,""),i;r.componentPath?(i=r.componentPath.replace(/^\.\//,""),w.debug("[storyFilePaths] Using Storybook componentPath:",i)):(i=`${o.replace(/\.stories\.tsx$/,"").replace(/\.stories\.ts$/,"").replace(/\.stories\.jsx$/,"").replace(/\.stories\.js$/,"")}.tsx`,w.debug("[storyFilePaths] Derived componentFile:",i));let a=i.replace(/\.tsx$/,".css").replace(/\.ts$/,".css").replace(/\.jsx$/,".css").replace(/\.js$/,".css"),s=i.substring(0,i.lastIndexOf("/")),l={storyFile:o,componentFile:i,cssFile:a,baseDir:s};return w.debug("[storyFilePaths] Final paths:",l),l}catch(t){return w.error("[storyFilePaths] Error getting file paths:",t),null}}function Y5(e,t){if(e==="css")return t.cssFile;if(e==="component")return t.componentFile;if(e==="story")return t.storyFile}function RJ(e,t){let r=e.toLowerCase().trim();return["color","spacing","typography","dimension","border","shadow","layout","background","font","size","margin","padding"].some(i=>r.includes(i))?t.cssFile:t.componentFile}function K5(e,t){let r=e.property?.toLowerCase()||"",n=e.domElement?.toLowerCase()||"",o=n.startsWith("svg"),i=n.startsWith("img"),a=r==="width"||r==="height",s=/\[(?:width|height)=/.test(n);return(o||i)&&a||s?(w.debug(`[storyFilePaths] \u{1F50D} INLINE ATTRIBUTE: domElement="${e.domElement}", property="${e.property}" \u2192 component file`),t.componentFile):RJ(e.type,t)}dr();Ne();function AJ(e){let t=(e.description||"").toLowerCase(),r=(e.title||"").toLowerCase(),n=`${t} ${r}`;return n.includes("inner icon")||n.includes("inner vector")?"inner-icon":n.includes("second icon")?"icon-2":n.includes("first icon")?"icon-1":n.includes("icon")||n.includes("vector")||n.includes("svg")?"icon":n.includes("button")?"button":n.includes("text")||n.includes("label")?"text":n.includes("container")||n.includes("wrapper")?"container":"other"}function FJ(e){let t=(e.property||"").toLowerCase(),r=(e.description||"").toLowerCase();return t.includes("width")||t.includes("height")||t.includes("size")||t.includes("dimensions")?"dimensions":t.includes("padding")||t.includes("margin")||t.includes("gap")?"spacing":t.includes("color")||t.includes("background")||t.includes("fill")?"colors":t.includes("font")||t.includes("text")||t.includes("line-height")?"typography":t.includes("border")||t.includes("radius")?"border":r.includes("overall")||r.includes("visual fidelity")||r.includes("pixel similarity")||t.includes("overall")?"summary":"other"}function MJ(e){let t=(e.property||"").toLowerCase(),r=(e.description||"").toLowerCase();return t.includes("overall")||t.includes("visual fidelity")||r.includes("pixel similarity score")||r.includes("primarily explained by")||r.includes("visual discrepancy")}function PJ(e,t,r){let n={critical:3,major:2,minor:1},i=[...e].sort((u,c)=>(n[c.severity]||0)-(n[u.severity]||0))[0],a=e.length,s,l;if(t.includes("icon")&&r==="dimensions"){let u=e.map(d=>d.currentValue).filter(Boolean),c=e.map(d=>d.suggestedValue).filter(Boolean);s=`Icon sizing is incorrect (${a} related issues)`,l=`Icons are rendered at wrong dimensions. Current: ${u[0]||"10px"}, Expected: ${c[0]||"20px"}. This single CSS fix will resolve all ${a} icon dimension issues.`}else s=`${t} ${r} issues (${a} related)`,l=`${a} related ${r} issues for ${t}. ${i.description}`;return{...i,id:`merged-${t}-${r}-${i.id}`,title:s,description:l,currentValue:i.currentValue,suggestedValue:i.suggestedValue,mergedCount:a,mergedIssueIds:e.map(u=>u.id)}}function X5(e){if(!e||e.length===0)return[];let t=e.filter(i=>!MJ(i)),r=[],n=[];for(let i of t){let a=AJ(i),s=FJ(i);a.includes("icon")&&s==="dimensions"?r.push(i):n.push(i)}let o=[];return r.length>0&&(r.length===1?o.push(r[0]):o.push(PJ(r,"icon","dimensions"))),o.push(...n),w.debug("[deduplicateIssues] Input:",e.length,"issues, Output:",o.length,"issues"),w.debug("[deduplicateIssues] Removed",e.length-t.length,"summary issues"),w.debug("[deduplicateIssues] Merged",r.length,"icon issues into",r.length>0?1:0),o}Ne();function w7(){let e="";return{push(t){e+=t;let r=e.split(`
90
90
  `);e=r.pop()||"";let n=[];for(let o of r){if(!o.startsWith("data: "))continue;let i=o.slice(6);if(i==="[DONE]"){n.push({kind:"done"});continue}try{n.push({kind:"event",data:JSON.parse(i),raw:i})}catch(a){n.push({kind:"error",error:a instanceof Error?a:new Error(String(a)),raw:i})}}return n},get pending(){return e}}}dr();var LJ=[/Failed to fetch/i,/NetworkError/i,/network request failed/i,/load failed/i,/ERR_(NETWORK|INTERNET|CONNECTION|NAME_NOT_RESOLVED)/i,/timed out/i,/aborted/i],_J=[/credits?/i,/Rate limit/i,/Figma connection expired/i,/Map.*to Figma|Figma mapping required/i,/No project selected/i,/Not authenticated/i,/No story/i,/Monthly review limit/i,/Upgrade your plan/i];function wu(e){let t=e instanceof Error?e.message:typeof e=="string"?e:"Review failed";return _J.some(r=>r.test(t))?t:LJ.some(r=>r.test(t))?`Can't reach ${Qt.NAME}. Check your internet connection and try again. If the dashboard URL is wrong, fix it in Settings.`:/Unauthorized|401/i.test(t)?"Your session expired. Sign out and back in from Settings to continue.":/Internal Server Error|5\d\d|server error/i.test(t)?`${Qt.NAME}'s servers had a hiccup. Try the review again in a moment. If it keeps failing, send feedback.`:/parsing|SSE|stream|structured result|failed to receive/i.test(t)?"Review completed but the result was malformed. Try again, or send feedback if it keeps happening.":`Review failed: ${t.replace(/\.+\s*$/,"")}. Try again, or send feedback if this keeps happening.`}Fe();var J5=q(),Q5=180;function Sa(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){let t=e;if("value"in t&&typeof t.value=="string")return t.value;if("top"in t||"left"in t){let r=[t.top,t.right,t.bottom,t.left].filter(Boolean);if(r.length>0)return r.join(" ")}return JSON.stringify(e)}return String(e)}var Z5=()=>{let{isReviewing:e,reviewError:t,reviewResults:r,showReviewMenu:n,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:a,streamingMessages:s,streamingProgress:l,streamingStatus:u,selectedModels:c,setIsReviewing:d,setReviewingStoryId:f,setReviewError:p,setReviewResults:g,setShowReviewMenu:m,setSeverityFilter:T,setShowStreamingPanel:S,setStreamingPanelCollapsed:h,addStreamingMessage:M,updateStreamingMessage:z,clearStreamingMessages:O,setStreamingProgress:R,setStreamingStatus:B,setFullPrompt:x,setFullResponse:v,setFigmaImageUrl:I,storybookImageUrl:L,setStorybookImageUrl:E,setFigmaDimensions:y,setMultiModelResults:C,updateMultiModelStreamingMessages:b,setModelCompleted:A,setActiveModelId:P,resetReview:F,addReview:D,setReviewDetailTab:k,includeTextComparison:N,usePromptCache:G,setApplyFixesResult:_,featureFlags:le,roleOverride:$,setPendingSettingsOpen:W}=we(),{sessionToken:Q,usageData:ge,setUsageData:he}=be(),{selectedProjectId:pe}=Ge(),{currentStoryId:fe,currentStoryName:ht}=bt(),je=Rf(ge);je.current=ge;let xe=Rf(null),ve=Rf(null),ot=Rf({}),$t=vu((Zr,Gt)=>{M({role:Zr,content:Gt})},[M]),pt=vu((Zr,Gt)=>{R(Zr),B(Gt)},[R,B]),dt=vu(async Zr=>{let{isIteration:Gt=!1,parentReviewId:mr=null}=Zr||{};if(!Q)throw new Error("Not authenticated");if(!pe)throw new Error("No project selected");if(!fe||!ht)throw new Error("No story is currently selected in Storybook");if(e){w.debug("[useAIReview] Review already in progress, ignoring duplicate request");return}let en=Date.now();try{d(!0),f(fe),p(null),g(null),k("issues"),_(null),fe&&le.enableReviewBadges&&I6(fe),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{w.debug(`[useAIReview] Auto-stopping review after ${Q5}s timeout`),xe.current&&xe.current.abort(),M({role:"system",content:`Review auto-stopped after ${Q5} seconds timeout.`})},Q5*1e3),x(""),v(""),S(!0),h(!1),O(),pt(0,"Starting review..."),pt(5,"Refreshing component preview..."),w.debug("[Review] Forcing iframe reload for fresh styles..."),await vf(),w.debug("[Review] Iframe reloaded, styles should be fresh"),pt(20,"Capturing screenshot & extracting styles..."),w.debug("[Review] Starting parallel data collection...");let[V,ne,ye]=await Promise.all([Hd({sessionToken:Q||void 0}),Promise.resolve(ou()),Promise.resolve(iu())]);if(V&&V!==L&&(E(V),w.debug("[Review] Storybook screenshot captured and set")),!ne)throw new Error("Failed to extract styles from component");let{computed:U,declared:ie,markup:ke,textElementStyles:Z,nestedElementStyles:re}=ne;ye?w.debug("[Review] DOM tree extracted:",{selector:ye.selector,childrenCount:ye.children.length}):(w.error("[Review] DOM tree extraction FAILED - domTree is null"),w.error("[Review] This will cause AI to use comparison table instead of tree comparison")),pt(50,"Preparing metadata..."),w.debug("[Review] Current story:",{id:fe,name:ht});let de=Tt.getState().currentMapping?.figmaNodeId??null,Et=Tt.getState().figmaImageUrl;if(de&&(w.debug("[Review] Using Figma node ID from store:",de),Et&&(pt(65,"Using existing Figma design..."),w.debug("[Review] Reusing already-loaded Figma image"))),!de)try{let ue=await fetch(`${J5}/api/mappings?projectId=${pe}&storyId=${fe}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${Q}`}});if(ue.ok){let ft=await ue.json();ft.mapping?.figmaNodeId?(de=ft.mapping.figmaNodeId,w.debug("[Review] Found Figma node ID from API:",de)):w.debug("[Review] No mapping found for story:",fe)}else w.debug("[Review] Failed to fetch mapping:",ue.status)}catch(ue){w.error("[Review] Error fetching mapping:",ue)}if(de&&!Et){pt(65,"Fetching Figma design...");try{let ue=await fetch(`${J5}/api/figma/frames?projectId=${pe}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${Q}`}});if(ue.ok){let Oe=(await ue.json()).thumbnails?.[de];Oe?(I(Oe),w.debug("[Review] Figma thumbnail fetched and displayed:",Oe)):w.warn("[Review] No thumbnail found for node:",de)}else w.warn("[Review] Failed to fetch Figma frames:",ue.status)}catch(ue){w.error("[Review] Error fetching Figma frames:",ue)}}if(!de)throw new Error('Figma mapping required. Please link this story to a Figma frame using the "Map to Figma" button before reviewing.');pt(80,"AI is analyzing your component..."),w.debug("[Review] Sending to streaming API...");let At={projectId:pe,storyId:fe,storyName:ht,storybookScreenshot:V,computedStyles:U,declaredStyles:ie,textElementStyles:Z,nestedElementStyles:re,componentMarkup:ke,domTree:ye,figmaNodeId:de,figmaImageUrl:Et||void 0,aiModels:c,includeTextComparison:N,usePromptCache:G,parentReviewId:Gt?mr:void 0,isIteration:Gt};w.debug("[Review] Request payload:",{...At,storybookScreenshot:V?`${V.substring(0,50)}...`:null,domTree:ye?{selector:ye.selector,childrenCount:ye.children.length}:null}),xe.current=new AbortController;let qt=await fetch(`${J5}/api/review/stream`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Q}`,...Sf($)},body:JSON.stringify(At),signal:xe.current.signal});if(w.debug("[Review] Response status:",qt.status,qt.statusText),!qt.ok){let ue=await qt.json();if(w.error("[Review] API error response:",ue),qt.status===429){let ft=ue.retryAfter||60;throw new Error(`Rate limit exceeded. Please wait ${ft} seconds before trying again.`)}if(qt.status===402){if(ue.code==="INSUFFICIENT_CREDITS"){let ft=ue.details?.required??1,Oe=ue.details?.balance??0;throw new Error(`Not enough credits. This review requires ${ft} credit(s) but you have ${Oe}. Visit Settings to add more.`)}throw ue.code==="SUBSCRIPTION_LIMIT_EXCEEDED"?new Error(ue.message||"Monthly review limit reached. Upgrade your plan to continue."):new Error(ue.message||"Payment required")}throw qt.status===401&&ue.code==="FIGMA_AUTH_EXPIRED"?(W(!0),new Error("Figma connection expired. Reconnect your Figma account in Settings to continue.")):new Error(ue.error||ue.message||"Review request failed")}let Ur=qt.body?.getReader(),Us=new TextDecoder,cc=w7(),Tn="",We=null,Ti=null,Ua=c.length>1,no={},it={},Ze={};if(!Ur)throw new Error("Response body is not readable");let Pr=Tt.getState().streamingMessages.length;for($t("assistant","");;){let{done:ue,value:ft}=await Ur.read();if(ue)break;for(let Oe of cc.push(Us.decode(ft,{stream:!0})))if(Oe.kind!=="done"){if(Oe.kind==="error"){w.error("[Review] Error parsing SSE data:",{message:Oe.error.message,name:Oe.error.name,stack:Oe.error.stack}),w.error("[Review] Failed to parse data:",Oe.raw.substring(0,200)+(Oe.raw.length>200?"...":"")),Ti=Oe.error;continue}{let rr=Oe.raw;try{let ae=Oe.data;if(ae.type!=="text"&&ae.type!=="content"&&w.debug("[Review] SSE Event received:",ae.type),ae.type==="prompt")ae.prompt&&(x(ae.prompt),w.debug("[Review] Prompt received early"));else if(ae.type==="model_started")w.debug("[Review] Model started:",ae.modelId),no[ae.modelId]||(no[ae.modelId]="",it[ae.modelId]=[{role:"assistant",content:""}]);else if(ae.type==="text"||ae.type==="content")if(Ua&&ae.modelId){no[ae.modelId]||(no[ae.modelId]="",it[ae.modelId]=[{role:"assistant",content:""}]),no[ae.modelId]+=ae.content,it[ae.modelId][0].content=no[ae.modelId],b(ae.modelId,it[ae.modelId]);let jr=Object.entries(no).map(([mn,tn])=>`[${mn}]
@@ -114,7 +114,7 @@ ${tn}`).join(`
114
114
  `,lZ=On.div(({theme:e})=>({position:"absolute",top:"100%",left:"0",marginTop:"6px",padding:"12px",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.2)",zIndex:1e3,minWidth:"220px",fontSize:e.typography.size.s1})),cZ=On.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px",paddingBottom:"8px",borderBottom:`1px solid ${e.appBorderColor}`})),uZ=On.div(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText,fontSize:e.typography.size.s2})),pZ=On.span(({score:e,theme:t})=>{let r=()=>e>=80?t.color.positive:e>=50?t.color.warning:t.color.negative;return{fontWeight:700,fontSize:t.typography.size.s3,color:r()}}),dZ=On.div({display:"flex",flexDirection:"column",gap:"6px",marginBottom:"10px"}),fZ=On.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:e.typography.size.s1,color:e.color.defaultText})),gZ=On.span({display:"flex",alignItems:"center",gap:"4px"}),mZ=On.span(({status:e,theme:t})=>({color:e==="pass"?t.color.positive:e==="warn"?t.color.warning:t.color.negative,fontSize:t.typography.size.s1})),hZ=On.span(({theme:e})=>({fontWeight:500,color:e.color.mediumdark})),xZ=On.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4,fontStyle:"italic"})),yZ=On.ul(({theme:e})=>({margin:"8px 0 0 0",padding:"0 0 0 14px",fontSize:e.typography.size.s1,color:e.color.defaultText,"& li":{marginBottom:"2px"}})),O7=({figmaFileUrl:e})=>{let{selectedProjectId:t}=Ge(),[r,n]=kb(!1),[o,i]=kb(!1),[a,s]=kb(null),l=async()=>{if(!(!e||!t||o)){i(!0);try{let u=q(),c=localStorage.getItem("uicopilot_session_token"),d=await X(`${u}/api/figma/quality-check`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify({projectId:t,figmaFileUrl:e,figmaMetadata:{}})});if(!d.ok)throw new Error("Failed to check quality");let f=await d.json();s(f),n(!0)}catch(u){console.error("[FigmaQualityBadge] Quality check error:",u)}finally{i(!1)}}};return e?Sr.createElement(oZ,{onMouseEnter:()=>a&&n(!0),onMouseLeave:()=>n(!1)},Sr.createElement(aZ,{score:a?.score,isLoading:o,onClick:l,disabled:o||!t,title:a?"Click to refresh quality check":"Click to check Figma design quality"},o?Sr.createElement(Sr.Fragment,null,Sr.createElement(sZ,null)," Checking..."):a?Sr.createElement(Sr.Fragment,null,"\u{1F3A8} ",Math.round(a.score),"%"):Sr.createElement(Sr.Fragment,null,"\u{1F3A8} Check Quality")),r&&a&&Sr.createElement(lZ,null,Sr.createElement(cZ,null,Sr.createElement(uZ,null,"Figma Design Quality"),Sr.createElement(pZ,{score:a.score},Math.round(a.score),"%")),Sr.createElement(dZ,null,Object.entries(a.categories).map(([u,c])=>Sr.createElement(fZ,{key:u},Sr.createElement(gZ,null,Sr.createElement(mZ,{status:c.status},nZ(c.status)),rZ[u]||u),Sr.createElement(hZ,null,c.score)))),a.summary&&Sr.createElement(xZ,null,a.summary),a.recommendations?.length>0&&Sr.createElement(yZ,null,a.recommendations.slice(0,2).map((u,c)=>Sr.createElement("li",{key:c},u))))):null};var wZ=li.div(({theme:e})=>({padding:"12px 16px",marginBottom:"16px"})),vZ=li.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",marginBottom:"8px"}),SZ=li.label(({theme:e})=>({fontSize:"10px",fontWeight:e.typography.weight.bold,letterSpacing:"0.06em",textTransform:"uppercase",color:e.color.mediumdark})),kZ=li.div({display:"flex",gap:"8px",alignItems:"center"}),CZ=li.div({position:"relative",flex:1,display:"flex"}),EZ=li.input(({theme:e})=>({width:"100%","&&":{padding:"8px 36px 8px 12px"},fontSize:"13px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.input.background,color:e.input.color,outline:"none","&:focus":{borderColor:j,boxShadow:`0 0 0 1px ${j}`},"&::placeholder":{color:e.color.mediumlight}})),TZ=li(lr)({whiteSpace:"nowrap"}),IZ=li.button(({theme:e})=>({padding:"8px",backgroundColor:"transparent",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,color:e.color.mediumdark,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"12px",transition:"all 0.15s","&:hover:not(:disabled)":{borderColor:e.color.negative,color:e.color.negative},"&:disabled":{opacity:.4,cursor:"not-allowed"}})),RZ=li.button(({theme:e,copied:t})=>({position:"absolute",top:"50%",right:"5px",transform:"translateY(-50%)",width:"26px",height:"26px",padding:0,border:"none",borderRadius:"5px",background:"transparent",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:t?e.color.positive:e.color.defaultText,transition:"color 0.15s, background 0.15s","&:hover":{color:t?e.color.positive:j,background:e.background.hoverable}})),AZ=()=>zr.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},zr.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),zr.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})),FZ=()=>zr.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},zr.createElement("polyline",{points:"20 6 9 17 4 12"}));function MZ(e){return e?e.includes("figma.com")?e:/^[a-zA-Z0-9]+$/.test(e)?`https://www.figma.com/design/${e}`:e:""}var PZ=li.span(({theme:e,variant:t})=>({fontSize:"12px",color:t==="success"?e.color.positive:e.color.negative,marginTop:"4px",display:"block"})),$7=({onFigmaFileChanged:e})=>{let{selectedProjectId:t,projects:r}=Ge(),{sessionToken:n}=be(),{updateProject:o}=yn(),i=r.find(v=>v.id===t),[a,s]=El(""),[l,u]=El(!1),[c,d]=El(null),[f,p]=El(!1),g=i?.figmaFileUrl||i?.figmaFileId||"",m=MZ(g);bZ(()=>{s(m),d(null)},[i?.id,m]);let T=a!==m,S=Lf(async()=>{if(!t||!T)return;let v=ku(a);if(Ca(v)){d({type:"error",message:Cu(v)??"Invalid Figma URL."});return}try{u(!0),d(null),await o(t,{figmaFileUrl:a.trim()||void 0});let I=q();try{await X(`${I}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:t})})}catch{}X(`${I}/api/figma/crawl`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:t})}).catch(()=>{}),d({type:"success",message:"Saved \u2014 reloading Figma cache\u2026"}),setTimeout(()=>d(null),3e3),e?.()}catch(I){d({type:"error",message:I instanceof Error?I.message:"Failed to save"})}finally{u(!1)}},[t,a,T,o,n,e]),h=Lf(v=>{v.key==="Enter"&&T&&!l&&S()},[T,l,S]),M=Lf(async()=>{if(a)try{await navigator.clipboard.writeText(a),p(!0),setTimeout(()=>p(!1),1500)}catch{}},[a]),[z,O]=El(!1),[R,B]=El(!1),x=Lf(async()=>{if(!(!t||!n))try{B(!0),await o(t,{figmaFileUrl:""});let v=q();await X(`${v}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:t})}).catch(()=>{}),await X(`${v}/api/figma/frames/invalidate?projectId=${t}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}}).catch(()=>{}),s(""),O(!1),d({type:"success",message:"Figma file removed and cache cleared"}),setTimeout(()=>d(null),3e3),e?.()}catch{d({type:"error",message:"Failed to remove Figma file"})}finally{B(!1)}},[t,n,o,e]);return t?zr.createElement(wZ,null,zr.createElement(vZ,null,zr.createElement(SZ,null,"Figma File URL"),zr.createElement(O7,{figmaFileUrl:m})),zr.createElement(kZ,null,zr.createElement(CZ,null,zr.createElement(EZ,{type:"text",value:a,onChange:v=>s(v.target.value),onKeyDown:h,placeholder:"https://www.figma.com/file/..."}),a&&zr.createElement(RZ,{type:"button",copied:f,onClick:M,title:"Copy Figma URL to clipboard"},f?zr.createElement(FZ,null):zr.createElement(AZ,null))),zr.createElement(TZ,{onClick:S,disabled:!T||l},l?"Saving...":"Save"),m&&zr.createElement(IZ,{onClick:()=>O(!0),title:"Remove Figma file and clear cache"},"\u{1F5D1}")),zr.createElement(Bn,{isOpen:z,title:"Remove Figma File",message:"This will remove the Figma file link and clear all cached data (thumbnails, enrichment). Component mappings will be preserved but won't have design data until a new file is linked.",confirmLabel:R?"Removing...":"Remove",variant:"danger",onConfirm:x,onCancel:()=>O(!1)}),c&&zr.createElement(PZ,{variant:c.type},c.message)):null};import Fr,{useState as _f,useEffect as LZ}from"react";import{styled as Qn}from"storybook/theming";Ce();Fe();tt();var H7=Qn.div({display:"flex",flexDirection:"column",gap:"6px",padding:"12px 16px"}),_Z=Qn.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),BZ=Qn.span(({theme:e})=>({fontSize:"10px",fontWeight:e.typography.weight.bold,letterSpacing:"0.06em",textTransform:"uppercase",color:e.color.mediumdark})),zZ=Qn.div({display:"flex",alignItems:"center",gap:"12px",fontSize:"11px"}),DZ=Qn.span(({theme:e,state:t})=>({fontFamily:e.typography.fonts.mono,fontWeight:e.typography.weight.bold,whiteSpace:"nowrap",color:t==="complete"?e.color.positive:t==="partial"?e.color.warning:e.color.mediumdark})),NZ=Qn.div(({theme:e})=>({width:"100%",height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),OZ=Qn.div(({theme:e,percent:t,state:r})=>({width:`${t}%`,height:"100%",borderRadius:"2px",backgroundColor:r==="complete"?e.color.positive:r==="partial"?e.color.warning:e.color.mediumlight,transition:"width 0.3s ease"})),$Z=Qn(Xm)(({theme:e})=>({padding:0,fontSize:"11px",fontWeight:e.typography.weight.bold,color:e.color.defaultText})),HZ=Qn(Xm)(({theme:e})=>({padding:0,fontSize:"11px",fontWeight:e.typography.weight.regular,color:e.color.mediumdark,"&:hover":{textDecoration:"none",color:e.color.defaultText}})),UZ=Qn.div({display:"flex",alignItems:"center",gap:"8px"}),jZ=Qn.span(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontStyle:"italic"})),VZ=Qn.div(({theme:e})=>({width:"14px",height:"14px",border:`2px solid ${e.appBorderColor}`,borderTopColor:j,borderRadius:"50%",animation:"figma-mapping-spin 0.8s linear infinite","@keyframes figma-mapping-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),WZ=Qn.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),U7=({refreshKey:e=0})=>{let[t,r]=_f(!1),[n,o]=_f({totalStories:0,mappedStories:0,loading:!0}),{selectedProjectId:i}=Ge(),{sessionToken:a}=be();LZ(()=>{i&&a?s():o({totalStories:0,mappedStories:0,loading:!1})},[i,a,e]);let s=async()=>{o(R=>({...R,loading:!0}));try{let R=await fetch("/index.json");if(!R.ok)throw new Error("Failed to fetch Storybook index");let B=await R.json(),x=B.entries||B.stories||{},v=Object.keys(x).filter(C=>x[C].type==="story").length,I=Object.keys(x).filter(C=>x[C].type==="story"),L=q(),E=await X(`${L}/api/mappings?projectId=${i}`,{headers:{Authorization:`Bearer ${a}`}}),y=0;if(E.ok){let C=await E.json(),b=C.mappings||C||[];if(Array.isArray(b)){let A=new Set(b.map(P=>P.storyId).filter(Boolean));y=I.filter(P=>A.has(P)).length}else{let A=await X(`${L}/api/mappings/stats?projectId=${i}`,{headers:{Authorization:`Bearer ${a}`}});if(A.ok){let P=await A.json();y=Math.min(P.mappedStoriesCount||0,v)}}}o({totalStories:v,mappedStories:y,loading:!1})}catch(R){console.error("[FigmaMappingsSection] Error fetching stats:",R),o(B=>({...B,loading:!1}))}},[l,u]=_f(!1),[c,d]=_f(!1),f=async()=>{!i||!a||d(!0)},p=async()=>{d(!1),u(!0);try{let R=q();if(!(await X(`${R}/api/mappings/batch?projectId=${i}`,{method:"DELETE",headers:{Authorization:`Bearer ${a}`}})).ok)throw new Error("Failed to unlink all mappings");cu(),s()}catch(R){console.error("[FigmaMappingsSection] Unlink all failed:",R)}finally{u(!1)}},g=()=>r(!0),m=()=>{r(!1),i&&a&&s()};if(!i)return Fr.createElement(H7,null,Fr.createElement(jZ,null,"Select a project to link Figma designs"));let{totalStories:T,loading:S}=n,h=Math.min(n.mappedStories,T),M=h===0?"none":h>=T?"complete":"partial",z=T>0?Math.min(100,Math.round(h/T*100)):0,O=M==="none"?"Link designs":"Manage";return Fr.createElement(Fr.Fragment,null,Fr.createElement(H7,null,Fr.createElement(_Z,null,Fr.createElement(BZ,null,"Figma mappings"),Fr.createElement(zZ,null,S?Fr.createElement(UZ,null,Fr.createElement(VZ,null),Fr.createElement(WZ,null,"Loading\u2026")):Fr.createElement(Fr.Fragment,null,Fr.createElement(DZ,{state:M},`${h} / ${T}`),h>0&&Fr.createElement(HZ,{onClick:f,disabled:S||l},l?"Unlinking\u2026":"Unlink all"),Fr.createElement($Z,{onClick:g,disabled:S},O)))),!S&&Fr.createElement(NZ,null,Fr.createElement(OZ,{percent:z,state:M}))),t&&Fr.createElement(df,{isOpen:t,onClose:m,projectId:i}),Fr.createElement(Bn,{isOpen:c,title:"Unlink All Mappings",message:`Unlink all ${n.mappedStories} Figma mappings?`,confirmLabel:"Unlink All",variant:"danger",onConfirm:p,onCancel:()=>d(!1)}))};Ce();Fe();import K,{useState as Ea,useEffect as Au,useCallback as OR,useRef as Lb}from"react";import{addons as Cee}from"storybook/manager-api";tt();function j7(e){let{loading:t,reloading:r,crawlStatus:n,pagesFailed:o,tries:i,max:a}=e;return t||r||n!=="complete"||(o??0)<=0?!1:i<a}Fe();import{useEffect as GZ,useRef as qZ}from"react";import{addons as YZ}from"storybook/manager-api";var Bf="uicopilot/crawl-started",KZ=3e3,XZ=360*1e3;function V7(e){let t=qZ({});GZ(()=>{let r=YZ.getChannel?.();if(!r)return;let n=a=>{let s=t.current[a];s&&(clearInterval(s),delete t.current[a])},o=a=>{try{e.addNotification?.(a)}catch{}},i=({projectId:a})=>{if(!a||t.current[a])return;let s=localStorage.getItem("uicopilot_session_token");if(!s)return;let l=q(),u=Date.now(),c=setInterval(async()=>{if(Date.now()-u>XZ){n(a);return}try{let d=await fetch(`${l}/api/figma/cache-status?projectId=${a}`,{headers:{Authorization:`Bearer ${s}`}});if(!d.ok)return;let f=await d.json(),p=f?.crawlProgress?.status;if(p==="complete"){n(a);let g=f?.componentSetCount??0;o({id:`uicopilot-crawl-done-${a}-${Date.now()}`,content:{headline:"Figma cache ready",subHeadline:`${g} component set${g===1?"":"s"} cached \u2014 open Settings to map`},duration:8e3})}else p==="error"&&(n(a),o({id:`uicopilot-crawl-error-${a}-${Date.now()}`,content:{headline:"Figma crawl failed",subHeadline:f?.crawlProgress?.error||"Open Settings to retry."},duration:8e3}))}catch{}},KZ);t.current[a]=c};return r.on(Bf,i),()=>{r.off(Bf,i),Object.keys(t.current).forEach(n)}},[e])}import kr,{useState as lee}from"react";import{styled as Zn,keyframes as cee}from"storybook/theming";Ce();Fe();tt();Ne();import{useCallback as JZ,useEffect as QZ,useState as Eu}from"react";var ZZ=q();function zf(e,t){let{sessionToken:r}=be(),[n,o]=Eu([]),[i,a]=Eu(!1),[s,l]=Eu(0),[u,c]=Eu(!1),[d,f]=Eu(null),p=JZ(async()=>{if(!(!e||!r)){c(!0),f(null);try{let g=await X(`${ZZ}/api/figma/pages?projectId=${e}`,{headers:{Authorization:`Bearer ${r}`}}),m=await g.json().catch(()=>({}));if(!g.ok||!m.success)throw new Error(m.error||"Couldn't read the file's pages.");o(Array.isArray(m.pages)?m.pages:[]),a(!!m.published),l(m.totalComponentSets??0)}catch(g){w.error("[useFigmaPages] failed to load pages:",g),f(g instanceof Error?g.message:"Couldn't read the file's pages.")}finally{c(!1)}}},[e,r]);return QZ(()=>{t&&p()},[t,p]),{pages:n,published:i,totalComponentSets:s,loading:u,error:d,reload:p}}Ne();import{useEffect as eee,useState as W7}from"react";function tee(e){let t=e,r=t?.entries??t?.stories;if(!r||typeof r!="object")return[];let n=[],o=new Set;for(let i of Object.values(r)){if(!i||typeof i!="object"||i.type&&i.type!=="story")continue;let a=`${i.title??""}|${i.name??""}`;!i.title&&!i.name||o.has(a)||(o.add(a),n.push({name:i.name,title:i.title}))}return n}function Df(){let[e,t]=W7([]),[r,n]=W7(!1);return eee(()=>{let o=!1;return(async()=>{try{let i=await fetch("/index.json");if(!i.ok)throw new Error(`index.json returned ${i.status}`);let a=tee(await i.json());o||t(a)}catch(i){w.debug("[useStoryNames] could not read story index:",i instanceof Error?i.message:i)}finally{o||n(!0)}})(),()=>{o=!0}},[]),{stories:e,ready:r}}import Ft,{useEffect as aee,useMemo as bR,useRef as see,useState as wR}from"react";dr();function Tl(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function ree(e){let t=_T(e.title,e.name).trim();return t&&Tl(t).length>=3?[t]:[]}function G7(e){return e.length>3&&/(s|x|z|ch|sh)es$/.test(e)?e.slice(0,-2):e.length>3&&e.endsWith("s")?e.slice(0,-1):e}function nee(e,t){let r=Tl(e),n=Tl(t);return!r||!n?!1:G7(r)===G7(n)}function Nf(e,t){if(!e.length||!t.length)return[];let r=[],n=new Set;for(let i of t)for(let a of ree(i)){let s=Tl(a);n.has(s)||(n.add(s),r.push(a))}let o=[];for(let i of e){let a=null;for(let s of r)nee(i.name,s)&&(!a||Tl(s).length>Tl(a).length)&&(a=s);a&&o.push({pageId:i.id,matchedBy:a})}return o}var Cb="uicopilot_figma_pages:";function q7(e,t,r,n){let o=new Set(e.map(i=>i.id));if(r?.length){let i=r.filter(a=>o.has(a));if(i.length)return i}if(t){let i=e.filter(a=>a.componentCount>0).map(a=>a.id);if(i.length)return i}if(n?.length){let i=Nf(e,n).map(a=>a.pageId);if(i.length)return i}return[]}function Il(e){try{let t=localStorage.getItem(Cb+e);if(!t)return;let r=JSON.parse(t);if(Array.isArray(r)&&r.every(n=>typeof n=="string"))return r}catch{}}function Of(e,t){try{localStorage.setItem(Cb+e,JSON.stringify(t))}catch{}}function Y7(e){try{localStorage.removeItem(Cb+e)}catch{}}import $f from"react";import{styled as K7}from"storybook/theming";var oee=K7.span(({state:e})=>({width:"16px",height:"16px",borderRadius:"4px",flex:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",border:e==="none"?`1.5px solid ${J.locked}`:"none",background:e==="none"?J.card:j})),iee=K7.span({width:"8px",height:"2px",background:J.card,borderRadius:"2px"}),Eb=({state:e})=>$f.createElement(oee,{state:e},e==="all"&&$f.createElement("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:J.card,strokeWidth:"3.4","aria-hidden":!0},$f.createElement("path",{d:"M5 13l4 4L19 7"})),e==="some"&&$f.createElement(iee,null));import Rl from"react";import{styled as sr}from"storybook/theming";var X7='ui-monospace, "SF Mono", Menlo, Consolas, monospace',Tb=J.formBg,Hf=sr.div({marginTop:"10px",border:`1px solid ${J.border}`,borderRadius:"6px",overflow:"hidden",background:J.card}),J7=sr.div({display:"flex",alignItems:"center",justifyContent:"space-between",height:"32px",padding:"0 12px",borderBottom:`1px solid ${J.border}`}),Q7=sr.span({fontSize:"10px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:J.muted}),Ib=sr.button({border:"none",background:"none",padding:0,cursor:"pointer",fontSize:"11px",color:J.muted,"&:hover":{color:J.text}}),Z7=sr.div({display:"flex",alignItems:"center",justifyContent:"space-between",height:"32px",padding:"0 12px",background:Tb,borderBottom:`1px solid ${J.border}`}),eR=sr.span({fontSize:"11px",fontWeight:500,color:J.text}),tR=sr.span({fontSize:"10.5px",color:J.muted,fontFamily:X7,fontVariantNumeric:"tabular-nums"}),rR=sr.div({position:"relative",padding:"6px 12px",borderBottom:`1px solid ${J.border}`}),nR=sr.span({position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:J.muted,display:"inline-flex",pointerEvents:"none"}),oR=sr.input({width:"100%",height:"28px",paddingLeft:"20px",border:"none",outline:"none",background:"transparent",fontSize:"12px",color:J.text,"&::placeholder":{color:J.muted}}),iR=sr.button({width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",height:"32px",padding:"0 12px",border:"none",borderBottom:`1px solid ${J.border}`,background:J.accentTint,cursor:"pointer","&:hover":{filter:"brightness(0.97)"}}),Rb=sr.span({display:"inline-flex",alignItems:"center",gap:"10px",minWidth:0}),aR=sr.span({fontSize:"12px",fontWeight:500,color:J.text}),Ab=sr.span({fontSize:"11px",color:J.muted,fontFamily:X7,fontVariantNumeric:"tabular-nums",flex:"none"}),sR=sr.div({maxHeight:"180px",overflowY:"auto"}),lR=sr.button({width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",height:"32px",padding:"0 12px",border:"none",borderBottom:`1px solid ${J.track}`,background:"transparent",cursor:"pointer","&:last-of-type":{borderBottom:"none"},"&:hover":{background:Tb}}),cR=sr.span(({added:e})=>({fontSize:"12px",color:e?j:J.text,fontWeight:e?500:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),uR=sr.span({fontSize:"10px",color:j,flex:"none"}),pR=sr.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 12px",borderTop:`1px solid ${J.border}`,background:Tb}),dR=sr.p({margin:0,fontSize:"10.5px",lineHeight:1.35,color:J.muted}),fR=sr.button(({disabled:e})=>({flex:"none",height:"28px",padding:"0 12px",border:"none",borderRadius:"6px",fontSize:"11px",fontWeight:600,color:J.card,background:j,cursor:e?"not-allowed":"pointer",opacity:e?.5:1,whiteSpace:"nowrap","&:hover":e?{}:{opacity:.9}})),Uf=sr.div({padding:"16px 12px",fontSize:"12px",color:J.muted,textAlign:"center"}),gR=sr.div(({theme:e,tone:t})=>({display:"flex",alignItems:"center",gap:"8px",padding:`${e.layoutMargin*.8}px ${e.layoutMargin*1.2}px`,borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:t==="warn"?`${e.color.warning}14`:`${j}12`,fontSize:e.typography.size.s1,color:e.color.defaultText})),mR=sr.span(({theme:e,tone:t})=>({width:"16px",height:"16px",borderRadius:"4px",flex:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:e.typography.weight.bold,color:e.color.lightest,backgroundColor:t==="warn"?e.color.warning:j})),hR=sr.span({lineHeight:1.4}),xR=sr.span(({theme:e})=>({fontSize:"10px",fontFamily:e.typography.fonts.mono,color:j,backgroundColor:`${j}14`,padding:"1px 6px",borderRadius:"10px",flex:"none",maxWidth:"140px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}));var yR=({value:e,onChange:t,total:r})=>Rl.createElement(rR,null,Rl.createElement(nR,null,Rl.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0},Rl.createElement("circle",{cx:"11",cy:"11",r:"7"}),Rl.createElement("path",{d:"m21 21-4-4"}))),Rl.createElement(oR,{type:"text",value:e,onChange:n=>t(n.target.value),placeholder:`Filter ${r} pages\u2026`,"aria-label":"Filter pages"}));var jf=({pages:e,published:t,loading:r,error:n,busy:o,initialSelection:i,stories:a,ctaVerb:s="Import",highlightAdded:l=!1,emptyHint:u,onReload:c,onCancel:d,onImport:f})=>{let[p,g]=wR(new Set),[m,T]=wR(""),S=see("");aee(()=>{if(!e.length)return;let b=e.map(A=>A.id).join(",");b!==S.current&&(S.current=b,g(new Set(q7(e,t,i,a))))},[e,t,i,a]);let h=bR(()=>a?.length?Nf(e,a):[],[e,a]),M=bR(()=>new Map(h.map(b=>[b.pageId,b.matchedBy])),[h]);if(r)return Ft.createElement(Hf,null,Ft.createElement(Uf,null,"Reading your file\u2019s pages\u2026"));if(n)return Ft.createElement(Hf,null,Ft.createElement(Uf,null,"\u26A0 ",n," ",Ft.createElement(Ib,{onClick:c},"Retry")));let z=!t&&!!a?.length,O=z&&h.length===0,R=e.length>0&&p.size===e.length,B=p.size>0&&!R,x=p.size,v=e.filter(b=>p.has(b.id)).reduce((b,A)=>b+A.componentCount,0),I=b=>g(A=>{let P=new Set(A);return P.has(b)?P.delete(b):P.add(b),P}),L=()=>g(R?new Set:new Set(e.map(b=>b.id))),E=m.trim().toLowerCase(),y=E?e.filter(b=>b.name.toLowerCase().includes(E)):e,C=M.size?[...y.filter(b=>M.has(b.id)),...y.filter(b=>!M.has(b.id))]:y;return Ft.createElement(Hf,null,Ft.createElement(J7,null,Ft.createElement(Q7,null,"Choose pages to import"),d&&Ft.createElement(Ib,{onClick:d},"Cancel")),z&&Ft.createElement(gR,{tone:O?"warn":"ok"},Ft.createElement(mR,{tone:O?"warn":"ok"},O?"!":"\u2713"),Ft.createElement(hR,null,O?"Couldn\u2019t match your stories to page names \u2014 choose the pages you need.":`Matched ${h.length} ${h.length===1?"page":"pages"} to your Storybook.`)),Ft.createElement(Z7,null,Ft.createElement(eR,null,e.length," pages"),Ft.createElement(tR,null,x," selected",t?` \xB7 ~${v} components`:"")),Ft.createElement(yR,{value:m,onChange:T,total:e.length}),Ft.createElement(iR,{type:"button",onClick:L},Ft.createElement(Rb,null,Ft.createElement(Eb,{state:R?"all":B?"some":"none"}),Ft.createElement(aR,null,"Select all")),Ft.createElement(Ab,null,e.length," pages")),Ft.createElement(sR,null,C.length===0?Ft.createElement(Uf,null,"No pages match \u201C",m,"\u201D."):C.map(b=>{let A=l&&p.has(b.id)&&!(i??[]).includes(b.id);return Ft.createElement(lR,{key:b.id,type:"button",onClick:()=>I(b.id)},Ft.createElement(Rb,null,Ft.createElement(Eb,{state:p.has(b.id)?"all":"none"}),Ft.createElement(cR,{added:A},b.name),A&&Ft.createElement(uR,null,"\xB7 just added"),M.has(b.id)&&Ft.createElement(xR,{title:`Matches your story "${M.get(b.id)}"`},M.get(b.id))),t&&Ft.createElement(Ab,null,b.componentCount))})),Ft.createElement(pR,null,Ft.createElement(dR,null,x===0&&u?u:x===0&&O?"Pick the pages holding the components you want to review. Importing every page may exceed Figma\u2019s rate limit.":"Selected pages are fetched at full depth via the Figma API."),Ft.createElement(fR,{type:"button",disabled:x===0||o,onClick:()=>f([...p])},o?"Starting\u2026":`${s} ${x} ${x===1?"page":"pages"}`)))};var Fb=Zn.div({marginTop:"10px"}),uee=Zn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"11px 13px",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius*1.5})),pee=Zn.div({minWidth:0,flex:1}),dee=Zn.div(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.defaultText,"& b":{color:j}})),fee=Zn.div(({theme:e})=>({marginTop:"2px",fontSize:e.typography.size.s1,color:e.color.mediumdark,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),gee=Zn.button(({theme:e})=>({flex:"none",display:"inline-flex",alignItems:"center",gap:"6px",height:"28px",padding:"0 10px",border:`1px solid ${j}`,borderRadius:e.appBorderRadius*1.5,background:"transparent",color:j,fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,cursor:"pointer",whiteSpace:"nowrap","&:hover":{background:`${j}14`}})),mee=cee`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`,hee=Zn.div(({theme:e})=>({padding:"11px 13px",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius*1.5,backgroundColor:e.background.content})),xee=Zn.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),yee=Zn.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"6px",fontSize:e.typography.size.s2,color:e.color.defaultText})),bee=Zn.span({display:"inline-block",width:"12px",height:"12px",border:`1.5px solid ${j}40`,borderTopColor:j,borderRadius:"50%",animation:`${mee} 0.7s linear infinite`}),wee=Zn.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,fontSize:e.typography.size.s1,color:e.color.mediumdark})),vee=Zn.div(({theme:e})=>({marginTop:"8px",height:"4px",borderRadius:"2px",backgroundColor:e.appBorderColor,overflow:"hidden"})),See=Zn.div(({pct:e})=>({width:`${e}%`,height:"100%",backgroundColor:j,transition:"width 0.3s ease"})),vR=({projectId:e,busy:t,importing:r=!1,importPct:n=0,onReimport:o})=>{let[i,a]=lee(!1),s=zf(e,!0),l=Df(),u=Il(e);if(r)return kr.createElement(Fb,null,kr.createElement(hee,null,kr.createElement(xee,null,kr.createElement(yee,null,kr.createElement(bee,null),"Re-reading components from Figma\u2026"),kr.createElement(wee,null,n,"%")),kr.createElement(vee,null,kr.createElement(See,{pct:n}))));if(i)return kr.createElement(Fb,null,kr.createElement(jf,{stories:l.stories,pages:s.pages,published:s.published,loading:s.loading,error:s.error,busy:t,initialSelection:u,ctaVerb:"Re-import",highlightAdded:!0,emptyHint:"Select at least one page \u2014 or use Clear (above) to remove everything.",onReload:s.reload,onCancel:()=>a(!1),onImport:g=>{Of(e,g),o(g),a(!1)}}));let c=s.pages.length,d=u?.length??0,f=u?.length&&s.pages.length?s.pages.find(g=>u.includes(g.id))?.name:void 0,p=c>d?c-d:0;return kr.createElement(Fb,null,kr.createElement(uee,null,kr.createElement(pee,null,kr.createElement(dee,null,d>0?kr.createElement(kr.Fragment,null,"Importing"," ",kr.createElement("b",null,d,c?` of ${c}`:""," ",d===1&&!c?"page":"pages")):"Choose which pages to import"),f&&kr.createElement(fee,null,f,p>0?` \xB7 ${p} pages not imported`:"")),kr.createElement(gee,{onClick:()=>a(!0)},kr.createElement("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0},kr.createElement("path",{d:"M12 5v14M5 12h14"})),"Add or change pages")))};import{styled as zt,keyframes as kee}from"storybook/theming";var Vf=zt.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.content,fontSize:"12px"})),Wf=zt.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),Gf=zt.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"8px",fontSize:"10px",fontWeight:e.typography.weight.bold,letterSpacing:"0.06em",textTransform:"uppercase",color:e.color.mediumdark})),rTe=zt(ei)({padding:"5px 12px",fontSize:"12px"}),SR=zt.dl(({theme:e})=>({display:"grid",gridTemplateColumns:"repeat(4, 1fr)",margin:"0 0 8px",borderRadius:e.appBorderRadius,backgroundColor:e.background.hoverable,overflow:"hidden"})),Tu=zt.div({padding:"8px 10px",minWidth:0}),Mb=zt.div(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark,padding:"4px 0"})),kR=zt.div({display:"flex",flexDirection:"column",gap:"6px",marginTop:"6px"}),CR=zt.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),ER=zt.div({display:"flex",alignItems:"center",gap:"8px"}),TR=zt.span(({theme:e})=>({fontSize:"12px",color:e.color.defaultText})),IR=zt.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,color:e.color.defaultText})),RR=zt.span(({theme:e,ready:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"1px 6px",borderRadius:"3px",fontSize:"9px",fontWeight:e.typography.weight.bold,textTransform:"uppercase",letterSpacing:"0.06em",backgroundColor:t?`${e.color.positive}1a`:e.background.hoverable,color:t?e.color.positive:e.color.mediumdark})),AR=zt.button(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:0,border:"none",background:"transparent",cursor:"pointer",fontSize:"11px",color:e.color.mediumdark,transition:"color 0.15s","&:hover":{color:e.color.defaultText},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),FR=zt.div(({theme:e})=>({width:"100%",height:"4px",borderRadius:"2px",backgroundColor:e.appBorderColor,overflow:"hidden"})),MR=zt.div(({theme:e,pct:t,ready:r})=>({width:`${t}%`,height:"100%",borderRadius:"2px",backgroundColor:r?e.color.positive:e.color.secondary,transition:"width 0.3s ease"})),Iu=zt.dt(({theme:e})=>({fontSize:"9px",fontWeight:e.typography.weight.bold,letterSpacing:"0.06em",textTransform:"uppercase",color:e.color.mediumdark,whiteSpace:"nowrap"})),Ru=zt.dd(({theme:e,plain:t})=>({margin:"2px 0 0",fontSize:"12px",color:e.color.defaultText,fontFamily:t?e.typography.fonts.base:e.typography.fonts.mono,whiteSpace:"nowrap"})),PR=zt.span(({theme:e,status:t})=>({display:"inline-block",padding:"1px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",backgroundColor:t==="cached"?`${e.color.positive}1a`:t==="expired"?`${e.color.warning}1a`:e.background.hoverable,color:t==="cached"?e.color.positive:t==="expired"?e.color.warning:e.color.mediumdark})),LR=kee`
115
115
  from { transform: rotate(0deg); }
116
116
  to { transform: rotate(360deg); }
117
- `,Pb=zt.span(({theme:e,tone:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"1px 6px",borderRadius:"3px",fontSize:"9px",fontWeight:e.typography.weight.bold,textTransform:"uppercase",letterSpacing:"0.05em",backgroundColor:t==="green"?`${e.color.positive}1a`:`${j}1a`,color:t==="green"?e.color.positive:j})),_R=zt.span({display:"inline-block",width:"10px",height:"10px",border:`1.5px solid ${j}40`,borderTopColor:j,borderRadius:"50%",animation:`${LR} 0.6s linear infinite`}),qf=zt.button(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",height:"25px",padding:"2px 8px",border:"none",background:"transparent",borderRadius:e.appBorderRadius,cursor:"pointer",fontSize:"11px",fontFamily:e.typography.fonts.base,color:e.color.mediumdark,transition:"all 0.15s","&:hover:not(:disabled)":{color:e.color.defaultText,backgroundColor:e.background.hoverable},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),Yf=zt.span({display:"inline-block",width:"10px",height:"10px",border:"1.5px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",opacity:.6,animation:`${LR} 0.6s linear infinite`}),BR=zt.div(({theme:e})=>({marginTop:"6px",padding:"6px 8px",backgroundColor:e.background.hoverable,borderRadius:"4px",color:e.color.mediumdark,lineHeight:"1.4"})),Kf=zt.span(({theme:e,type:t})=>({fontWeight:500,color:t==="added"?e.color.positive:t==="removed"?e.color.negative:e.color.warning})),Al=zt.div(({theme:e})=>({marginTop:"8px",padding:"8px 10px",backgroundColor:`${e.color.negative}1a`,border:`1px solid ${e.color.negative}4d`,borderRadius:"4px",fontSize:"12px",color:e.color.negative,lineHeight:"1.4"})),zR=zt.div(({theme:e})=>({marginTop:"8px",padding:"8px 10px",backgroundColor:`${e.color.warning}1a`,border:`1px solid ${e.color.warning}4d`,borderRadius:"4px",fontSize:"12px",color:e.color.warning,lineHeight:"1.4"})),DR=zt.div(({theme:e})=>({marginTop:"8px",padding:"8px 10px",backgroundColor:`${e.color.positive}1a`,border:`1px solid ${e.color.positive}4d`,borderRadius:"4px",fontSize:"12px",color:e.color.positive,lineHeight:"1.4"})),NR=zt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",padding:"6px 8px",borderRadius:e.appBorderRadius,backgroundColor:e.background.hoverable,fontSize:"11px",lineHeight:"1.4",color:e.color.defaultText})),ds=zt.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden",marginTop:"10px"})),fs=zt.div(({percent:e})=>({width:`${e}%`,height:"100%",backgroundColor:j,borderRadius:"3px",transition:"width 0.5s ease"})),Yi=zt.div(({theme:e})=>({display:"flex",justifyContent:"space-between",marginTop:"6px",fontSize:"12px",fontWeight:500,color:e.color.defaultText}));var Eee=()=>K.createElement("svg",{viewBox:"0 0 24 24",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},K.createElement("path",{d:"M20 6 9 17l-5-5"})),Tee=()=>K.createElement("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"currentColor","aria-hidden":!0},K.createElement("path",{d:"M12 2.5l1.6 5.9 5.9 1.6-5.9 1.6L12 17.5l-1.6-5.9L4.5 10l5.9-1.6z"})),Iee=()=>K.createElement("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},K.createElement("path",{d:"M23 4v6h-6M1 20v-6h6"}),K.createElement("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})),$R=new Set,HR=new Map,Ree=2,UR=()=>{let{userRole:e,featureFlags:t}=we(),[r,n]=Ea(null),[o,i]=Ea(!0),[a,s]=Ea(!1),[l,u]=Ea(null),[c,d]=Ea(null),[f,p]=Ea(!1),[g,m]=Ea(!1),[T,S]=Ea(!1),{selectedProjectId:h,projects:M}=Ge(),{sessionToken:z}=be(),O=Lb(null),R=Lb(null),B=Lb(null),x=OR(()=>{O.current&&(clearInterval(O.current),O.current=null),R.current&&(clearInterval(R.current),R.current=null),B.current&&(clearTimeout(B.current),B.current=null)},[]);Au(()=>x,[x]);let v=OR(async()=>{if(!(!h||!z))try{let $=q(),W=await X(`${$}/api/figma/cache-status?projectId=${h}`,{headers:{Authorization:`Bearer ${z}`}});if(W.ok){let Q=await W.json();n(Q)}}catch($){console.error("[FigmaCacheSection] Error:",$)}finally{i(!1)}},[h,z]);Au(()=>{v()},[v]),Au(()=>{if(o||a||!r||r.structureStatus!=="none"||!h||$R.has(h))return;let $=M.find(Q=>Q.id===h);($?.figmaFileUrl||$?.figmaFileId)&&($R.add(h),I())},[o,a,r?.structureStatus,h,M]),Au(()=>{if(!h)return;let $=HR.get(h)??0;j7({loading:o,reloading:a,crawlStatus:r?.crawlProgress?.status,pagesFailed:r?.crawlProgress?.pagesFailed,tries:$,max:Ree})&&(HR.set(h,$+1),I())},[o,a,r?.crawlProgress?.status,r?.crawlProgress?.pagesFailed,h]),Au(()=>{let $=r?.thumbnailProgress?.status,W=r?.enrichmentProgress?.status,Q=r?.thumbnailProgress?.cached??0,ge=r?.thumbnailProgress?.total??0,he=$==="in-progress"||$==="pending"||ge>0&&Q<ge,pe=W==="in-progress"||W==="pending",fe=!r?.thumbnailProgress&&r?.structureStatus==="cached",ht=r?.crawlProgress?.status==="crawling"||r?.crawlProgress?.status==="cancelling";if(!(ht||he||pe||fe)||!ht&&(!r||r.structureStatus==="none"))return;let xe=setInterval(()=>{v()},3e3);return()=>{clearInterval(xe)}},[r?.thumbnailProgress?.status,r?.thumbnailProgress?.cached,r?.thumbnailProgress?.total,r?.enrichmentProgress?.status,r?.crawlProgress?.status,r?.structureStatus,v]);let I=async $=>{if(!h||!z)return;let W=Array.isArray($)?$:void 0;s(!0),u(null),d(null);try{let Q=q(),ge=await X(`${Q}/api/figma/crawl`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify(W?.length?{projectId:h,pageIds:W}:{projectId:h})});if(!ge.ok){if(ge.status===403){let pe=await ge.json().catch(()=>({}));u(pe.requiresAuth?"auth":"generic")}else u("generic");return}let he=await ge.json().catch(()=>({}));if(he?.status==="skipped-unchanged")d("Figma file unchanged \u2014 reused cached structure.");else if(he?.status==="crawl-started"||he?.status==="retry-started"){if(he?.status==="retry-started"){let pe=he.retryPages;d(`Retrying ${pe?`${pe} `:""}page${pe===1?"":"s"} that hit Figma's rate limit\u2026`)}try{Cee.getChannel()?.emit(Bf,{projectId:h})}catch{}}await v()}catch(Q){console.error("[FigmaCacheSection] Crawl start error:",Q),u("generic")}finally{s(!1)}},L=async()=>{if(!(!h||!z)){p(!0);try{let $=q(),W=await X(`${$}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:h})});if(console.log("[FigmaCacheSection] Cache invalidate response:",W.status),!W.ok){u("generic");return}await X(`${$}/api/figma/frames/invalidate?projectId=${h}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}).catch(()=>{}),h&&Y7(h),n({structureStatus:"none",structureCachedAt:null,componentSetCount:0,componentCount:0,pageCount:0,pages:[],cacheDiff:null,thumbnailProgress:null,enrichmentProgress:null,crawlProgress:null})}catch($){console.error("[FigmaCacheSection] Clear cache error:",$)}finally{p(!1)}}},E=async()=>{if(!(!h||!z)){x(),m(!0);try{let $=q();await X(`${$}/api/figma/enrich`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:h})}),O.current=setInterval(async()=>{await v()},3e3),R.current=setInterval(()=>{(r?.enrichmentProgress?.status==="complete"||r?.enrichmentProgress?.status==="error")&&(x(),m(!1),v())},3e3),B.current=setTimeout(()=>{x(),m(!1)},6e5)}catch($){console.error("[FigmaCacheSection] Enrich error:",$),x(),m(!1)}}},y=async()=>{if(!(!h||!z)){S(!0);try{let $=q();await X(`${$}/api/figma/cancel`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:h})}),await v()}catch($){console.error("[FigmaCacheSection] Cancel error:",$)}finally{S(!1),m(!1),s(!1)}}},C=r?.crawlProgress?.status==="crawling"||r?.crawlProgress?.status==="cancelling"||r?.thumbnailProgress?.status==="in-progress"||r?.enrichmentProgress?.status==="in-progress";if(!h)return null;if(o)return K.createElement(Vf,null,K.createElement(Wf,null,K.createElement(Gf,null,"Figma Sync")),K.createElement(Mb,null,"Loading sync status\u2026"),K.createElement(ds,null,K.createElement(fs,{percent:100,style:{opacity:.3}})));if(!r||r.structureStatus==="none")return K.createElement(Vf,null,K.createElement(Wf,null,K.createElement(Gf,null,"Figma Sync"),K.createElement(ii,{loading:a,onClick:I,loadingText:"Loading..."},"\u21BB Load")),r?.crawlProgress?.status==="crawling"?K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:(r.crawlProgress.pagesTotal??0)>0?Math.round(r.crawlProgress.pagesDone/r.crawlProgress.pagesTotal*100):100,style:(r.crawlProgress.pagesTotal??0)>0?void 0:{opacity:.3}})),K.createElement(Yi,null,K.createElement("span",null,"Reading components from Figma\u2026"),K.createElement("span",null,(r.crawlProgress.pagesTotal??0)>0?`page ${r.crawlProgress.pagesDone} of ${r.crawlProgress.pagesTotal}`:"starting\u2026"))):a?K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:100,style:{animation:"none",opacity:.3}})),K.createElement(Yi,null,K.createElement("span",null,"Starting crawl\u2026"))):K.createElement(Mb,null,"No cache \u2014 click Load to fetch from Figma"),r?.crawlProgress?.status==="error"&&K.createElement(Al,null,"Crawl failed",r.crawlProgress.error?`: ${r.crawlProgress.error}`:"",". Try Load again."),l==="auth"&&K.createElement(Al,null,"Figma authentication expired \u2014 reconnect your Figma account in the Figma Integration section above."),l==="generic"&&K.createElement(Al,null,"Failed to load Figma cache. Check the browser console for details."));let b=$=>{let W=Date.now()-new Date($).getTime(),Q=Math.floor(W/6e4);if(Q<1)return"just now";if(Q<60)return`${Q}m ago`;let ge=Math.floor(Q/60);return ge<24?`${ge}h ago`:`${Math.floor(ge/24)}d ago`},A=$=>$>=1024*1024*1024?`${($/1024/1024/1024).toFixed(1)} GB`:$>=1024*1024?`${Math.round($/1024/1024)} MB`:`${Math.max(1,Math.round($/1024))} KB`,P=r.crawlProgress?.bytesDownloaded,F=r.cacheDiff,D=F&&(F.added.length>0||F.removed.length>0||F.renamed.length>0),k=r.crawlProgress,N=k?.pagesTotal??0,G=k?.pagesDone??0,_=k?.status==="crawling"||a,le=N>0?Math.round(G/N*100):a?8:0;return K.createElement(Vf,null,K.createElement(Wf,null,K.createElement(Gf,null,"Figma Sync"," ",r.crawlProgress?.status==="crawling"?K.createElement(Pb,{tone:"orange"},K.createElement(_R,null),"Importing"):r.structureStatus==="cached"?K.createElement(Pb,{tone:"green"},K.createElement(Eee,null),"Synced"):K.createElement(PR,{status:r.structureStatus},r.structureStatus)),K.createElement("div",{style:{display:"flex",gap:"2px"}},e==="admin"&&K.createElement(qf,{onClick:E,disabled:g},g?K.createElement(Yf,null):K.createElement(Tee,null),g?"Enriching\u2026":"Enrich"),K.createElement(qf,{onClick:L,disabled:f},f&&K.createElement(Yf,null),f?"Clearing\u2026":"Clear"),K.createElement(qf,{onClick:()=>I(h?Il(h):void 0),disabled:a},a?K.createElement(Yf,null):K.createElement(Iee,null),a?"Reloading\u2026":"Reload"),C&&K.createElement(ii,{loading:T||r?.crawlProgress?.status==="cancelling",onClick:y,variant:"ghost",loadingText:"Stopping..."},"\u2715 Stop"))),r?.crawlProgress?.status==="crawling"&&!((r.crawlProgress.pagesTotal??0)>0&&r.crawlProgress.pagesDone>=r.crawlProgress.pagesTotal)&&K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:(r.crawlProgress.pagesTotal??0)>0?Math.round(r.crawlProgress.pagesDone/r.crawlProgress.pagesTotal*100):100,style:(r.crawlProgress.pagesTotal??0)>0?void 0:{opacity:.3}})),K.createElement(Yi,null,K.createElement("span",null,r.crawlProgress.phase==="repairing"?"Fetching variants for deeply-nested components\u2026":r.crawlProgress.currentPage?`Reading \u201C${r.crawlProgress.currentPage}\u201D\u2026`:"Re-reading components from Figma\u2026"),K.createElement("span",null,(r.crawlProgress.pagesTotal??0)>0?`page ${r.crawlProgress.pagesDone} of ${r.crawlProgress.pagesTotal}`:"starting\u2026")),(r.crawlProgress.setsFound??0)>0&&K.createElement(Yi,null,K.createElement("span",null,r.crawlProgress.setsFound," component set",r.crawlProgress.setsFound===1?"":"s"," \xB7"," ",r.crawlProgress.variantsFound??0," variant",r.crawlProgress.variantsFound===1?"":"s"," so far"))),a&&r?.crawlProgress?.status!=="crawling"&&K.createElement(Yi,null,K.createElement("span",null,"Starting crawl\u2026")),l==="auth"&&K.createElement(Al,null,"Figma authentication expired \u2014 reconnect your Figma account in the Figma Integration section above."),l==="generic"&&K.createElement(Al,null,"Failed to reload Figma sync. Check the browser console for details."),K.createElement(SR,null,K.createElement(Tu,null,K.createElement(Iu,null,"Component sets"),K.createElement(Ru,null,r.componentSetCount)),K.createElement(Tu,null,K.createElement(Iu,null,"Pages"),K.createElement(Ru,null,r.pageCount)),typeof P=="number"&&P>0&&K.createElement(Tu,null,K.createElement(Iu,null,"Size"),K.createElement(Ru,null,"\u2248 ",A(P))),r.structureCachedAt&&K.createElement(Tu,null,K.createElement(Iu,null,"Updated"),K.createElement(Ru,{plain:!0},b(r.structureCachedAt)))),K.createElement(NR,null,K.createElement("span",{"aria-hidden":!0},"\u2139\uFE0F"),K.createElement("span",null,K.createElement("strong",null,"Components only")," for now \u2014 plain Figma frames aren't indexed yet (support planned).")),h&&K.createElement(vR,{projectId:h,busy:a,importing:_,importPct:le,onReimport:I}),r.crawlProgress?.status==="complete"&&r.crawlProgress.pagesFailed>0&&K.createElement(zR,null,"\u26A0 ",r.crawlProgress.pagesFailed," of"," ",r.crawlProgress.pagesTotal," pages couldn\u2019t be read (Figma rate limit) \u2014 some components may be missing. Reload to retry."),c&&K.createElement(DR,null,"\u2713 ",c),D&&K.createElement(BR,null,"Since last reload:"," ",F.added.length>0&&K.createElement(Kf,{type:"added"},"+",F.added.length," added"),F.added.length>0&&F.removed.length>0&&" \xB7 ",F.removed.length>0&&K.createElement(Kf,{type:"removed"},"\u2212",F.removed.length," removed"),(F.added.length>0||F.removed.length>0)&&F.renamed.length>0&&" \xB7 ",F.renamed.length>0&&K.createElement(Kf,{type:"renamed"},F.renamed.length," renamed")),r.thumbnailProgress&&r.thumbnailProgress.status==="in-progress"&&K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:r.thumbnailProgress.total>0?Math.round(r.thumbnailProgress.cached/r.thumbnailProgress.total*100):0})),K.createElement(Yi,null,K.createElement("span",null,"Preparing thumbnails\u2026",r.thumbnailProgress.currentName&&K.createElement(K.Fragment,null," ",r.thumbnailProgress.currentName)),K.createElement("span",null,r.thumbnailProgress.cached,"/",r.thumbnailProgress.total))),r.thumbnailProgress?.status!=="in-progress"&&(()=>{let $=r.thumbnailProgress,W=$?.cached??0,Q=$?.total??0,ge=Q>0&&W>=Q,he=Q>0&&W<Q,pe=Q>0?Math.min(100,Math.round(W/Q*100)):0;return K.createElement(kR,null,K.createElement(CR,null,K.createElement(ER,null,K.createElement(TR,null,"Thumbnails",Q>0&&K.createElement(K.Fragment,null," ",K.createElement(IR,null,W," / ",Q))),K.createElement(RR,{ready:ge},ge?"\u2713 Ready":he?"Partial":"Not generated")),K.createElement(AR,{onClick:I,disabled:a},"\u21BB ",ge?"Rebuild":"Reload")),Q>0&&K.createElement(FR,null,K.createElement(MR,{pct:ge?100:pe,ready:ge})))})(),r.enrichmentProgress&&r.enrichmentProgress.status==="in-progress"&&K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:r.enrichmentProgress.total>0?Math.round(r.enrichmentProgress.enriched/r.enrichmentProgress.total*100):0})),K.createElement(Yi,null,K.createElement("span",null,"AI descriptions: generating\u2026",r.enrichmentProgress.currentName&&K.createElement(K.Fragment,null," ",r.enrichmentProgress.currentName)),K.createElement("span",null,r.enrichmentProgress.enriched," of"," ",r.enrichmentProgress.total," component sets"))),r.enrichmentProgress&&r.enrichmentProgress.status==="complete"&&K.createElement(K.Fragment,null,K.createElement(Yi,null,K.createElement("span",null,"AI descriptions: ",r.enrichmentProgress.enriched," of"," ",r.enrichmentProgress.total," component sets \u2713"))),r.enrichmentProgress&&r.enrichmentProgress.status==="in-progress"&&t.showCosts&&r.enrichmentProgress.costUsd!=null&&r.enrichmentProgress.costUsd>0&&K.createElement("div",{style:{marginTop:"6px"}},K.createElement(ef,{inputTokens:r.enrichmentProgress.inputTokens||0,outputTokens:r.enrichmentProgress.outputTokens||0,costUsd:r.enrichmentProgress.costUsd,compact:!0})))};import Ut,{useState as Fl}from"react";import{styled as ci}from"storybook/theming";Ce();Fe();tt();var _b=ci.div({padding:"12px 16px"}),Aee=ci.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),jR=ci.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),VR=ci.button(({theme:e})=>({background:"none",border:"none",fontSize:"12px",color:j,cursor:"pointer",padding:0,"&:hover":{textDecoration:"underline"}})),Fee=ci.div({display:"flex",gap:"8px",alignItems:"center"}),Mee=ci.input(({theme:e})=>({flex:1,padding:"8px 12px",fontSize:"13px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.input.background,color:e.input.color,outline:"none",fontFamily:"monospace","&:focus":{borderColor:j,boxShadow:`0 0 0 1px ${j}`},"&::placeholder":{color:e.color.mediumlight,fontFamily:"inherit"}})),WR=ci.span(({theme:e,variant:t})=>({fontSize:"12px",color:t==="success"?e.color.positive:t==="error"?e.color.negative:e.color.mediumdark,marginTop:"6px",display:"block",lineHeight:1.4})),Pee=ci.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",lineHeight:1.5,"& a":{color:j,textDecoration:"none","&:hover":{textDecoration:"underline"}},"& ol":{margin:"4px 0 0 16px",padding:0},"& li":{marginBottom:"2px"}})),Lee=ci.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",borderRadius:"6px",backgroundColor:"#16a34a10",border:"1px solid #16a34a30",fontSize:"12px",color:e.color.defaultText})),_ee=ci.button(({theme:e})=>({background:"none",border:"none",fontSize:"11px",color:"#dc2626",cursor:"pointer",marginLeft:"auto","&:hover":{textDecoration:"underline"}})),GR=({onConnected:e,defaultExpanded:t=!1})=>{let{sessionToken:r}=be(),[n,o]=Fl(t),[i,a]=Fl(""),[s,l]=Fl(!1),[u,c]=Fl(null),[d,f]=Fl(null),[p,g]=Fl(!1),m=async()=>{if(!(!i.trim()||!r)){l(!0),c(null);try{let T=q(),S=await X(`${T}/api/figma/pat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({token:i.trim()})}),h=await S.json();if(!S.ok){c({type:"error",message:h.error||"Failed to save token"});return}f(h.figmaUser?.handle||h.figmaUser?.email||"Connected"),c({type:"success",message:`Connected as ${h.figmaUser?.handle||"Figma user"}`}),a(""),e?.()}catch{c({type:"error",message:"Failed to connect. Check your token and try again."})}finally{l(!1)}}};return d?Ut.createElement(_b,null,Ut.createElement(jR,null,"Figma Personal Access Token"),Ut.createElement(Lee,null,Ut.createElement("span",null,"\u2713 Connected as ",Ut.createElement("strong",null,d)),Ut.createElement(_ee,{onClick:()=>{f(null),c(null)}},"Change token"))):n?Ut.createElement(_b,null,Ut.createElement(Aee,null,Ut.createElement(jR,null,"Figma Personal Access Token"),Ut.createElement(VR,{onClick:()=>g(!p)},p?"Hide instructions":"How to generate")),p&&Ut.createElement(Pee,null,Ut.createElement("ol",null,Ut.createElement("li",null,"Open"," ",Ut.createElement("a",{href:"https://www.figma.com/settings",target:"_blank",rel:"noopener noreferrer"},"Figma Settings")),Ut.createElement("li",null,"Click the ",Ut.createElement("strong",null,"Security")," tab"),Ut.createElement("li",null,"Scroll to ",Ut.createElement("strong",null,"Personal access tokens")),Ut.createElement("li",null,"Click ",Ut.createElement("strong",null,"Generate new token")),Ut.createElement("li",null,"Enable ",Ut.createElement("strong",null,"File content: Read only")," under Scopes"),Ut.createElement("li",null,"Copy the token and paste it below"))),Ut.createElement(Fee,null,Ut.createElement(Mee,{type:"password",value:i,onChange:T=>a(T.target.value),placeholder:"figd_...",onKeyDown:T=>{T.key==="Enter"&&i.trim()&&m()}}),Ut.createElement(lr,{onClick:m,disabled:!i.trim()||s},s?"Verifying...":"Save & Verify")),u&&Ut.createElement(WR,{variant:u.type},u.message),Ut.createElement(WR,{variant:"info"},"Read-only access. Your token is stored securely and never shared.")):Ut.createElement(_b,null,Ut.createElement(VR,{onClick:()=>o(!0)},"Or use a Personal Access Token \u2192"))};Ce();Fe();tt();var Dee=jt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},jt.createElement("path",{d:"M19 28.5C19 23.2533 23.2533 19 28.5 19C33.7467 19 38 23.2533 38 28.5C38 33.7467 33.7467 38 28.5 38C23.2533 38 19 33.7467 19 28.5Z",fill:"#1ABCFE"}),jt.createElement("path",{d:"M0 47.5C0 42.2533 4.25329 38 9.5 38H19V47.5C19 52.7467 14.7467 57 9.5 57C4.25329 57 0 52.7467 0 47.5Z",fill:"#0ACF83"}),jt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),jt.createElement("path",{d:"M0 9.5C0 14.7467 4.25329 19 9.5 19H19V0H9.5C4.25329 0 0 4.25329 0 9.5Z",fill:"#F24E1E"}),jt.createElement("path",{d:"M0 28.5C0 33.7467 4.25329 38 9.5 38H19V19H9.5C4.25329 19 0 23.2533 0 28.5Z",fill:"#A259FF"})),Bb=Ta.div({}),Nee=Ta.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",backgroundColor:e.background.hoverable,borderBottom:`1px solid ${e.appBorderColor}`})),Oee=Ta.div({width:"16px",height:"16px",display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}),$ee=Ta.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,flex:1})),zb=Ta.div({"& > *":{border:"none",borderRadius:0,marginBottom:0,borderBottom:"1px solid rgba(0,0,0,0.06)","&:last-child":{borderBottom:"none"}}}),Hee=Ta.div({padding:"20px 16px",display:"flex",flexDirection:"column",gap:"12px"}),DTe=Ta.button({display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",padding:"8px 16px",backgroundColor:$S,color:"#fff",border:"none",borderRadius:"6px",fontSize:"13px",fontWeight:600,cursor:"pointer","&:hover":{backgroundColor:HS}}),Uee=Ta.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:e.color.mediumdark,"&::before, &::after":{content:'""',flex:1,height:"1px",backgroundColor:e.appBorderColor}})),YR=({hideHeader:e=!1})=>{let{sessionToken:t}=be(),r=!!t&&t.startsWith("uic_anon_"),[n,o]=Fu(!1),[i,a]=Fu(0),[s,l]=Fu(()=>{try{let S=sessionStorage.getItem("uicopilot_figma_connection");if(S){let{connected:h,ts:M}=JSON.parse(S);if(Date.now()-M<300*1e3)return h}}catch{}return null}),[u,c]=Fu(!1),[d,f]=Fu(!1),p=zee();Bee(()=>{if(!t)return;let S=q();X(`${S}/api/figma/connection-status`,{headers:{Authorization:`Bearer ${t}`}}).then(h=>h.json()).then(h=>{let M=!!h.connected;c(!!h.expired),l(M);try{sessionStorage.setItem("uicopilot_figma_connection",JSON.stringify({connected:M,ts:Date.now()}))}catch{}}).catch(()=>l(!1))},[t]);let g=qR(()=>{let S=q(),h=`${S}/api/auth/figma/login?addon=true`;window.open(h,"figma-oauth","width=600,height=700,left=200,top=100");let M=setInterval(async()=>{try{(await(await X(`${S}/api/figma/connection-status`,{headers:t?{Authorization:`Bearer ${t}`}:{}})).json()).connected&&(clearInterval(M),l(!0))}catch{}},2e3);setTimeout(()=>clearInterval(M),300*1e3)},[t]),m=qR(async()=>{try{o(!0);let S=q(),h=await X(`${S}/api/figma/disconnect`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(h.ok||h.status===404){l(!1);try{sessionStorage.removeItem("uicopilot_figma_connection")}catch{}}}catch{}finally{o(!1)}},[t]),T=e?null:jt.createElement(Nee,null,jt.createElement(Oee,null,Dee),jt.createElement($ee,null,"Figma Integration"));return s===null?jt.createElement(Bb,null,T,jt.createElement(zb,null,jt.createElement("div",{style:{padding:"16px",fontSize:"13px",color:p.color.mediumdark}},"Checking Figma connection..."))):s===!1?jt.createElement(Bb,null,T,jt.createElement(zb,null,jt.createElement(Hee,null,u&&jt.createElement("div",{style:{padding:"10px 12px",backgroundColor:"rgba(245, 158, 11, 0.1)",border:"1px solid rgba(245, 158, 11, 0.4)",borderRadius:"6px",fontSize:"12px",color:p.color.warning}},"\u26A0\uFE0F Your Figma access has expired. Please reconnect."),jt.createElement("div",{style:{padding:"8px 10px",backgroundColor:"rgba(100, 116, 139, 0.1)",border:"1px solid rgba(100, 116, 139, 0.3)",borderRadius:"6px",fontSize:"11px",lineHeight:1.4,color:p.color.mediumdark}},"Requires a Figma ",jt.createElement("strong",null,"Dev or Full seat"),". Free/Viewer seats can't grant design-read access."),!r&&jt.createElement(jt.Fragment,null,jt.createElement(lr,{onClick:g,style:{width:"100%"}},u?"Reconnect Figma":"Connect with Figma"),jt.createElement(Uee,null,"or")),jt.createElement(GR,{onConnected:()=>l(!0),defaultExpanded:r})))):jt.createElement(Bb,null,T,jt.createElement(Pf,{connected:!0,label:"Connected to Figma",actionLabel:n?"Disconnecting\u2026":"Disconnect",actionDisabled:n,actionTitle:"Disconnect Figma",onAction:()=>f(!0)}),jt.createElement(Bn,{isOpen:d,title:"Disconnect Figma",message:"Your mappings, cache, and review history will be preserved. You will need to re-authenticate to make new Figma API calls.",confirmLabel:"Disconnect",variant:"danger",onConfirm:()=>{f(!1),m()},onCancel:()=>f(!1)}),jt.createElement(zb,null,jt.createElement($7,{onFigmaFileChanged:()=>a(S=>S+1)}),jt.createElement(U7,{refreshKey:i}),jt.createElement(UR,null)))};Ce();dr();import{styled as gr}from"storybook/theming";var KR=gr.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:1e3,display:"flex",justifyContent:"center",alignItems:"flex-start",paddingTop:"40px"}),XR=gr.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"14px",border:`1px solid ${e.appBorderColor}`,boxShadow:"0 16px 48px rgba(0, 0, 0, 0.22)",width:"820px",maxWidth:"94%",maxHeight:"calc(100vh - 80px)",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"})),JR=gr.header(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",height:"48px",padding:"0 16px",borderBottom:`1px solid ${e.appBorderColor}`,flexShrink:0})),QR=gr.div({display:"flex",alignItems:"center",gap:"8px"}),ZR=gr.span(({theme:e})=>({fontSize:"14px",fontWeight:e.typography.weight.bold,letterSpacing:"-0.01em",color:e.color.defaultText})),eA=gr.span(({theme:e})=>({fontSize:"10px",fontFamily:e.typography.fonts.mono,color:e.color.mediumdark})),tA=gr.button(({theme:e})=>({width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:e.appBorderRadius,color:e.color.mediumdark,backgroundColor:"transparent",border:"none",cursor:"pointer",fontSize:"18px",lineHeight:1,transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable}})),rA=gr.div({display:"flex",flex:1,minHeight:"440px",overflow:"hidden"}),nA=gr.nav(({theme:e})=>({width:"178px",flexShrink:0,backgroundColor:e.background.app,padding:"12px 8px",display:"flex",flexDirection:"column",gap:"2px"})),oA=gr.button(({theme:e,active:t})=>({position:"relative",width:"100%",display:"flex",alignItems:"center",gap:"10px",padding:"0 8px 0 12px",height:"32px",borderRadius:e.appBorderRadius,border:"none",cursor:"pointer",textAlign:"left",backgroundColor:t?e.background.hoverable:"transparent",color:t?e.color.defaultText:e.color.mediumdark,transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable},"& svg":{flexShrink:0}})),iA=gr.span({position:"absolute",left:0,top:"6px",bottom:"6px",width:"2px",borderRadius:"2px",backgroundColor:j}),aA=gr.span(({theme:e})=>({fontSize:"12px",fontWeight:e.typography.weight.bold,lineHeight:1})),sA=gr.div(({theme:e})=>({flex:1,overflowY:"auto",backgroundColor:e.background.content,borderLeft:`1px solid ${e.appBorderColor}`,padding:"20px"})),Xf=gr.header({display:"flex",alignItems:"center",gap:"10px",marginBottom:"16px"}),lA=gr.div({width:"28px",height:"28px",borderRadius:"7px",backgroundColor:j,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:700,letterSpacing:"0.3px",flexShrink:0}),Db=gr.div(({theme:e})=>({width:"28px",height:"28px",borderRadius:"7px",backgroundColor:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,color:e.color.mediumdark,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0})),Jf=gr.h3(({theme:e})=>({margin:0,fontSize:"13px",fontWeight:e.typography.weight.bold,color:e.color.defaultText,lineHeight:1.2})),Qf=gr.p(({theme:e})=>({margin:"3px 0 0",fontSize:"11px",color:e.color.mediumdark,lineHeight:1.2})),Zf=gr.div({display:"flex",flexDirection:"column",gap:"12px",fontSize:"12px","& > div, & > section":{padding:0},'[class*="AuthPanelContainer"], [class*="SectionContainer"]':{padding:0},"h3, h4":{fontSize:"12px",margin:"0 0 6px 0"},label:{fontSize:"12px"},"input, select":{fontSize:"12px",padding:"6px 10px",height:"auto"},button:{fontSize:"11px"},p:{fontSize:"11px",margin:"2px 0"}}),Nb=gr.div(({theme:e})=>({padding:"16px",borderRadius:"10px",border:`1px dashed ${e.appBorderColor}`,backgroundColor:e.background.app,fontSize:"12px",color:e.color.mediumdark,lineHeight:1.5})),cA=gr.footer(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",height:"44px",padding:"0 16px",borderTop:`1px solid ${e.appBorderColor}`,flexShrink:0})),uA=gr.span(({theme:e})=>({fontSize:"10px",fontFamily:e.typography.fonts.mono,color:e.color.mediumdark})),pA=gr.div({display:"flex",alignItems:"center",gap:"6px"}),dA=gr.button(({theme:e})=>({height:"28px",padding:"0 12px",fontSize:"11px",fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,border:"none",borderRadius:e.appBorderRadius*2,background:"transparent",color:e.color.mediumdark,cursor:"pointer",transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable}}));var fA=()=>Ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Ue.createElement("path",{d:"M4 4h5l2 3h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"})),Gee=[{id:"account",label:"Account",icon:dc},{id:"project",label:"Project",icon:fA},{id:"figma",label:"Figma",icon:Fi}],gA=({onClose:e})=>{let{isConnected:t}=be(),{selectedProjectId:r}=Ge(),[n,o]=Wee("account"),i=eg(t),a=eg(!t),s=eg(!1),l=eg(!1);Vee(()=>{a.current&&!s.current&&!i.current&&t&&r&&(s.current=!0,e()),i.current=t},[t,r,e]);let u=()=>n==="account"?Ue.createElement(Ue.Fragment,null,Ue.createElement(Xf,null,Ue.createElement(lA,null,"UI"),Ue.createElement("div",null,Ue.createElement(Jf,null,Qt.NAME," account"),Ue.createElement(Qf,null,"Deterministic Figma \u2194 code comparison"))),Ue.createElement(Zf,null,Ue.createElement(_7,{onConnect:e}))):n==="project"?Ue.createElement(Ue.Fragment,null,Ue.createElement(Xf,null,Ue.createElement(Db,null,Ue.createElement(fA,null)),Ue.createElement("div",null,Ue.createElement(Jf,null,"Project"),Ue.createElement(Qf,null,"The Storybook project being compared"))),t?Ue.createElement(Zf,null,Ue.createElement(D7,null)):Ue.createElement(Nb,null,"Sign in on the ",Ue.createElement("strong",null,"Account")," tab first to choose a project.")):Ue.createElement(Ue.Fragment,null,Ue.createElement(Xf,null,Ue.createElement(Db,null,Ue.createElement(Fi,null)),Ue.createElement("div",null,Ue.createElement(Jf,null,"Figma integration"),Ue.createElement(Qf,null,"Source of truth for design tokens"))),t&&r?Ue.createElement(Zf,null,Ue.createElement(YR,{hideHeader:!0})):Ue.createElement(Nb,null,t?"Select a project on the Project tab before connecting Figma.":"Sign in on the Account tab first, then pick a project to connect Figma."));return Ue.createElement(KR,{onMouseDown:c=>{l.current=c.target===c.currentTarget},onClick:c=>{l.current&&c.target===c.currentTarget&&e()}},Ue.createElement(XR,{onClick:c=>c.stopPropagation()},Ue.createElement(JR,null,Ue.createElement(QR,null,Ue.createElement(ZR,null,"Settings"),Ue.createElement(eA,null,"v","0.18.0")),Ue.createElement(tA,{onClick:e,title:"Close settings","aria-label":"Close"},"\xD7")),Ue.createElement(rA,null,Ue.createElement(nA,null,Gee.map(c=>{let d=c.icon,f=n===c.id;return Ue.createElement(oA,{key:c.id,active:f,onClick:()=>o(c.id)},f&&Ue.createElement(iA,null),Ue.createElement(d,null),Ue.createElement(aA,null,c.label))})),Ue.createElement(sA,null,u())),Ue.createElement(cA,null,Ue.createElement(uA,null,Qt.NAME," \xB7 settings synced"),Ue.createElement(pA,null,Ue.createElement(dA,{onClick:e},"Cancel"),Ue.createElement(lr,{onClick:e},"Done")))))};Ce();dr();import Zt from"react";import Ho from"react";import{styled as xr,keyframes as qee}from"storybook/theming";var Ki=xr.div({marginTop:"10px",padding:"12px",borderRadius:"8px",border:`1px solid ${J.border}`,background:J.formBg,display:"flex",flexDirection:"column",gap:"10px"}),mA=xr.button({display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",padding:"9px",borderRadius:"8px",border:`1px solid ${J.border}`,background:J.card,color:J.text,fontSize:"13px",fontWeight:600,cursor:"pointer","&:hover":{background:J.formBg}}),Mu=xr.div({fontSize:"11px",color:J.muted,textAlign:"center"}),hA=xr.div({display:"flex",alignItems:"center",gap:"8px","&::before, &::after":{content:'""',flex:1,height:"1px",background:J.border},fontSize:"11px",color:J.muted}),xA=xr.button({width:"100%",padding:"9px",borderRadius:"6px",border:`1px dashed ${j}`,background:J.card,color:j,fontSize:"12px",fontWeight:600,cursor:"pointer","&:hover":{background:J.accentTint},"&:disabled":{opacity:.6,cursor:"default"}}),Ia=xr.label({fontSize:"11px",fontWeight:600,color:J.subText,display:"block",marginBottom:"4px"}),gs=xr.input({width:"100%",padding:"7px 10px",fontSize:"12px",borderRadius:"6px",border:`1px solid ${J.border}`,background:J.card,color:J.text,outline:"none","&:focus":{borderColor:j},"&:disabled":{background:J.formBg,color:J.muted}}),yA=xr.select({width:"100%",padding:"7px 10px",fontSize:"12px",borderRadius:"6px",border:`1px solid ${J.border}`,background:J.card,color:J.text}),$o=xr.button(({disabled:e})=>({width:"100%",padding:"8px",borderRadius:"6px",border:"none",fontSize:"12px",fontWeight:600,color:J.card,cursor:e?"not-allowed":"pointer",background:j,opacity:e?.5:1,"&:hover":e?{}:{background:Qo}})),Ob=xr.div({marginTop:"10px",fontSize:"11px",lineHeight:1.4,padding:"8px 10px",borderRadius:"6px",background:J.calloutBg,color:J.calloutText}),bA=xr.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"}),wA=xr.div({display:"flex",flexDirection:"column",gap:"8px",padding:"10px",borderRadius:"6px",border:`1px solid ${J.border}`,background:J.card}),vA=xr.div({display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"11px",color:J.subText}),SA=xr.span({fontVariantNumeric:"tabular-nums",color:J.muted}),tg=xr.div({height:"4px",width:"100%",borderRadius:"999px",background:J.track,overflow:"hidden"}),rg=xr.div(({pct:e})=>({height:"100%",width:`${Math.min(100,Math.max(0,e))}%`,borderRadius:"999px",background:j,transition:"width 0.3s ease"})),Yee=qee`
117
+ `,Pb=zt.span(({theme:e,tone:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"1px 6px",borderRadius:"3px",fontSize:"9px",fontWeight:e.typography.weight.bold,textTransform:"uppercase",letterSpacing:"0.05em",backgroundColor:t==="green"?`${e.color.positive}1a`:`${j}1a`,color:t==="green"?e.color.positive:j})),_R=zt.span({display:"inline-block",width:"10px",height:"10px",border:`1.5px solid ${j}40`,borderTopColor:j,borderRadius:"50%",animation:`${LR} 0.6s linear infinite`}),qf=zt.button(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",height:"25px",padding:"2px 8px",border:"none",background:"transparent",borderRadius:e.appBorderRadius,cursor:"pointer",fontSize:"11px",fontFamily:e.typography.fonts.base,color:e.color.mediumdark,transition:"all 0.15s","&:hover:not(:disabled)":{color:e.color.defaultText,backgroundColor:e.background.hoverable},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),Yf=zt.span({display:"inline-block",width:"10px",height:"10px",border:"1.5px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",opacity:.6,animation:`${LR} 0.6s linear infinite`}),BR=zt.div(({theme:e})=>({marginTop:"6px",padding:"6px 8px",backgroundColor:e.background.hoverable,borderRadius:"4px",color:e.color.mediumdark,lineHeight:"1.4"})),Kf=zt.span(({theme:e,type:t})=>({fontWeight:500,color:t==="added"?e.color.positive:t==="removed"?e.color.negative:e.color.warning})),Al=zt.div(({theme:e})=>({marginTop:"8px",padding:"8px 10px",backgroundColor:`${e.color.negative}1a`,border:`1px solid ${e.color.negative}4d`,borderRadius:"4px",fontSize:"12px",color:e.color.negative,lineHeight:"1.4"})),zR=zt.div(({theme:e})=>({marginTop:"8px",padding:"8px 10px",backgroundColor:`${e.color.warning}1a`,border:`1px solid ${e.color.warning}4d`,borderRadius:"4px",fontSize:"12px",color:e.color.warning,lineHeight:"1.4"})),DR=zt.div(({theme:e})=>({marginTop:"8px",padding:"8px 10px",backgroundColor:`${e.color.positive}1a`,border:`1px solid ${e.color.positive}4d`,borderRadius:"4px",fontSize:"12px",color:e.color.positive,lineHeight:"1.4"})),NR=zt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",padding:"6px 8px",borderRadius:e.appBorderRadius,backgroundColor:e.background.hoverable,fontSize:"11px",lineHeight:"1.4",color:e.color.defaultText})),ds=zt.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden",marginTop:"10px"})),fs=zt.div(({percent:e})=>({width:`${e}%`,height:"100%",backgroundColor:j,borderRadius:"3px",transition:"width 0.5s ease"})),Yi=zt.div(({theme:e})=>({display:"flex",justifyContent:"space-between",marginTop:"6px",fontSize:"12px",fontWeight:500,color:e.color.defaultText}));var Eee=()=>K.createElement("svg",{viewBox:"0 0 24 24",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},K.createElement("path",{d:"M20 6 9 17l-5-5"})),Tee=()=>K.createElement("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"currentColor","aria-hidden":!0},K.createElement("path",{d:"M12 2.5l1.6 5.9 5.9 1.6-5.9 1.6L12 17.5l-1.6-5.9L4.5 10l5.9-1.6z"})),Iee=()=>K.createElement("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},K.createElement("path",{d:"M23 4v6h-6M1 20v-6h6"}),K.createElement("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})),$R=new Set,HR=new Map,Ree=2,UR=()=>{let{userRole:e,featureFlags:t}=we(),[r,n]=Ea(null),[o,i]=Ea(!0),[a,s]=Ea(!1),[l,u]=Ea(null),[c,d]=Ea(null),[f,p]=Ea(!1),[g,m]=Ea(!1),[T,S]=Ea(!1),{selectedProjectId:h,projects:M}=Ge(),{sessionToken:z}=be(),O=Lb(null),R=Lb(null),B=Lb(null),x=OR(()=>{O.current&&(clearInterval(O.current),O.current=null),R.current&&(clearInterval(R.current),R.current=null),B.current&&(clearTimeout(B.current),B.current=null)},[]);Au(()=>x,[x]);let v=OR(async()=>{if(!(!h||!z))try{let $=q(),W=await X(`${$}/api/figma/cache-status?projectId=${h}`,{headers:{Authorization:`Bearer ${z}`}});if(W.ok){let Q=await W.json();n(Q)}}catch($){console.error("[FigmaCacheSection] Error:",$)}finally{i(!1)}},[h,z]);Au(()=>{v()},[v]),Au(()=>{if(o||a||!r||r.structureStatus!=="none"||!h||$R.has(h))return;let $=M.find(Q=>Q.id===h);($?.figmaFileUrl||$?.figmaFileId)&&($R.add(h),I())},[o,a,r?.structureStatus,h,M]),Au(()=>{if(!h)return;let $=HR.get(h)??0;j7({loading:o,reloading:a,crawlStatus:r?.crawlProgress?.status,pagesFailed:r?.crawlProgress?.pagesFailed,tries:$,max:Ree})&&(HR.set(h,$+1),I())},[o,a,r?.crawlProgress?.status,r?.crawlProgress?.pagesFailed,h]),Au(()=>{let $=r?.thumbnailProgress?.status,W=r?.enrichmentProgress?.status,Q=r?.thumbnailProgress?.cached??0,ge=r?.thumbnailProgress?.total??0,he=$==="in-progress"||$==="pending"||ge>0&&Q<ge,pe=W==="in-progress"||W==="pending",fe=!r?.thumbnailProgress&&r?.structureStatus==="cached",ht=r?.crawlProgress?.status==="crawling"||r?.crawlProgress?.status==="cancelling";if(!(ht||he||pe||fe)||!ht&&(!r||r.structureStatus==="none"))return;let xe=setInterval(()=>{v()},3e3);return()=>{clearInterval(xe)}},[r?.thumbnailProgress?.status,r?.thumbnailProgress?.cached,r?.thumbnailProgress?.total,r?.enrichmentProgress?.status,r?.crawlProgress?.status,r?.structureStatus,v]);let I=async $=>{if(!h||!z)return;let W=Array.isArray($)?$:void 0;s(!0),u(null),d(null);try{let Q=q(),ge=await X(`${Q}/api/figma/crawl`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify(W?.length?{projectId:h,pageIds:W}:{projectId:h})});if(!ge.ok){if(ge.status===403){let pe=await ge.json().catch(()=>({}));u(pe.requiresAuth?"auth":"generic")}else u("generic");return}let he=await ge.json().catch(()=>({}));if(he?.status==="skipped-unchanged")d("Figma file unchanged \u2014 reused cached structure.");else if(he?.status==="crawl-started"||he?.status==="retry-started"){if(he?.status==="retry-started"){let pe=he.retryPages;d(`Retrying ${pe?`${pe} `:""}page${pe===1?"":"s"} that hit Figma's rate limit\u2026`)}try{Cee.getChannel()?.emit(Bf,{projectId:h})}catch{}}await v()}catch(Q){console.error("[FigmaCacheSection] Crawl start error:",Q),u("generic")}finally{s(!1)}},L=async()=>{if(!(!h||!z)){p(!0);try{let $=q(),W=await X(`${$}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:h})});if(console.log("[FigmaCacheSection] Cache invalidate response:",W.status),!W.ok){u("generic");return}await X(`${$}/api/figma/frames/invalidate?projectId=${h}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}).catch(()=>{}),h&&Y7(h),n({structureStatus:"none",structureCachedAt:null,componentSetCount:0,componentCount:0,pageCount:0,pages:[],cacheDiff:null,thumbnailProgress:null,enrichmentProgress:null,crawlProgress:null})}catch($){console.error("[FigmaCacheSection] Clear cache error:",$)}finally{p(!1)}}},E=async()=>{if(!(!h||!z)){x(),m(!0);try{let $=q();await X(`${$}/api/figma/enrich`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:h})}),O.current=setInterval(async()=>{await v()},3e3),R.current=setInterval(()=>{(r?.enrichmentProgress?.status==="complete"||r?.enrichmentProgress?.status==="error")&&(x(),m(!1),v())},3e3),B.current=setTimeout(()=>{x(),m(!1)},6e5)}catch($){console.error("[FigmaCacheSection] Enrich error:",$),x(),m(!1)}}},y=async()=>{if(!(!h||!z)){S(!0);try{let $=q();await X(`${$}/api/figma/cancel`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:h})}),await v()}catch($){console.error("[FigmaCacheSection] Cancel error:",$)}finally{S(!1),m(!1),s(!1)}}},C=r?.crawlProgress?.status==="crawling"||r?.crawlProgress?.status==="cancelling"||r?.thumbnailProgress?.status==="in-progress"||r?.enrichmentProgress?.status==="in-progress";if(!h)return null;if(o)return K.createElement(Vf,null,K.createElement(Wf,null,K.createElement(Gf,null,"Figma Sync")),K.createElement(Mb,null,"Loading sync status\u2026"),K.createElement(ds,null,K.createElement(fs,{percent:100,style:{opacity:.3}})));if(!r||r.structureStatus==="none")return K.createElement(Vf,null,K.createElement(Wf,null,K.createElement(Gf,null,"Figma Sync"),K.createElement(ii,{loading:a,onClick:I,loadingText:"Loading..."},"\u21BB Load")),r?.crawlProgress?.status==="crawling"?K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:(r.crawlProgress.pagesTotal??0)>0?Math.round(r.crawlProgress.pagesDone/r.crawlProgress.pagesTotal*100):100,style:(r.crawlProgress.pagesTotal??0)>0?void 0:{opacity:.3}})),K.createElement(Yi,null,K.createElement("span",null,"Reading components from Figma\u2026"),K.createElement("span",null,(r.crawlProgress.pagesTotal??0)>0?`page ${r.crawlProgress.pagesDone} of ${r.crawlProgress.pagesTotal}`:"starting\u2026"))):a?K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:100,style:{animation:"none",opacity:.3}})),K.createElement(Yi,null,K.createElement("span",null,"Starting crawl\u2026"))):K.createElement(Mb,null,"No cache \u2014 click Load to fetch from Figma"),r?.crawlProgress?.status==="error"&&K.createElement(Al,null,"Crawl failed",r.crawlProgress.error?`: ${r.crawlProgress.error}`:"",". Try Load again."),l==="auth"&&K.createElement(Al,null,"Figma authentication expired \u2014 reconnect your Figma account in the Figma Integration section above."),l==="generic"&&K.createElement(Al,null,"Failed to load Figma cache. Check the browser console for details."));let b=$=>{let W=Date.now()-new Date($).getTime(),Q=Math.floor(W/6e4);if(Q<1)return"just now";if(Q<60)return`${Q}m ago`;let ge=Math.floor(Q/60);return ge<24?`${ge}h ago`:`${Math.floor(ge/24)}d ago`},A=$=>$>=1024*1024*1024?`${($/1024/1024/1024).toFixed(1)} GB`:$>=1024*1024?`${Math.round($/1024/1024)} MB`:`${Math.max(1,Math.round($/1024))} KB`,P=r.crawlProgress?.bytesDownloaded,F=r.cacheDiff,D=F&&(F.added.length>0||F.removed.length>0||F.renamed.length>0),k=r.crawlProgress,N=k?.pagesTotal??0,G=k?.pagesDone??0,_=k?.status==="crawling"||a,le=N>0?Math.round(G/N*100):a?8:0;return K.createElement(Vf,null,K.createElement(Wf,null,K.createElement(Gf,null,"Figma Sync"," ",r.crawlProgress?.status==="crawling"?K.createElement(Pb,{tone:"orange"},K.createElement(_R,null),"Importing"):r.structureStatus==="cached"?K.createElement(Pb,{tone:"green"},K.createElement(Eee,null),"Synced"):K.createElement(PR,{status:r.structureStatus},r.structureStatus)),K.createElement("div",{style:{display:"flex",gap:"2px"}},e==="admin"&&K.createElement(qf,{onClick:E,disabled:g},g?K.createElement(Yf,null):K.createElement(Tee,null),g?"Enriching\u2026":"Enrich"),K.createElement(qf,{onClick:L,disabled:f},f&&K.createElement(Yf,null),f?"Clearing\u2026":"Clear"),K.createElement(qf,{onClick:()=>I(h?Il(h):void 0),disabled:a},a?K.createElement(Yf,null):K.createElement(Iee,null),a?"Reloading\u2026":"Reload"),C&&K.createElement(ii,{loading:T||r?.crawlProgress?.status==="cancelling",onClick:y,variant:"ghost",loadingText:"Stopping..."},"\u2715 Stop"))),r?.crawlProgress?.status==="crawling"&&!((r.crawlProgress.pagesTotal??0)>0&&r.crawlProgress.pagesDone>=r.crawlProgress.pagesTotal)&&K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:(r.crawlProgress.pagesTotal??0)>0?Math.round(r.crawlProgress.pagesDone/r.crawlProgress.pagesTotal*100):100,style:(r.crawlProgress.pagesTotal??0)>0?void 0:{opacity:.3}})),K.createElement(Yi,null,K.createElement("span",null,r.crawlProgress.phase==="repairing"?"Fetching variants for deeply-nested components\u2026":r.crawlProgress.currentPage?`Reading \u201C${r.crawlProgress.currentPage}\u201D\u2026`:"Re-reading components from Figma\u2026"),K.createElement("span",null,(r.crawlProgress.pagesTotal??0)>0?`page ${r.crawlProgress.pagesDone} of ${r.crawlProgress.pagesTotal}`:"starting\u2026")),(r.crawlProgress.setsFound??0)>0&&K.createElement(Yi,null,K.createElement("span",null,r.crawlProgress.setsFound," component set",r.crawlProgress.setsFound===1?"":"s"," \xB7"," ",r.crawlProgress.variantsFound??0," variant",r.crawlProgress.variantsFound===1?"":"s"," so far"))),a&&r?.crawlProgress?.status!=="crawling"&&K.createElement(Yi,null,K.createElement("span",null,"Starting crawl\u2026")),l==="auth"&&K.createElement(Al,null,"Figma authentication expired \u2014 reconnect your Figma account in the Figma Integration section above."),l==="generic"&&K.createElement(Al,null,"Failed to reload Figma sync. Check the browser console for details."),K.createElement(SR,null,K.createElement(Tu,null,K.createElement(Iu,null,"Component sets"),K.createElement(Ru,null,r.componentSetCount)),K.createElement(Tu,null,K.createElement(Iu,null,"Pages"),K.createElement(Ru,null,r.pageCount)),typeof P=="number"&&P>0&&K.createElement(Tu,null,K.createElement(Iu,null,"Size"),K.createElement(Ru,null,"\u2248 ",A(P))),r.structureCachedAt&&K.createElement(Tu,null,K.createElement(Iu,null,"Updated"),K.createElement(Ru,{plain:!0},b(r.structureCachedAt)))),K.createElement(NR,null,K.createElement("span",{"aria-hidden":!0},"\u2139\uFE0F"),K.createElement("span",null,K.createElement("strong",null,"Components only")," for now \u2014 plain Figma frames aren't indexed yet (support planned).")),h&&K.createElement(vR,{projectId:h,busy:a,importing:_,importPct:le,onReimport:I}),r.crawlProgress?.status==="complete"&&r.crawlProgress.pagesFailed>0&&K.createElement(zR,null,"\u26A0 ",r.crawlProgress.pagesFailed," of"," ",r.crawlProgress.pagesTotal," pages couldn\u2019t be read (Figma rate limit) \u2014 some components may be missing. Reload to retry."),c&&K.createElement(DR,null,"\u2713 ",c),D&&K.createElement(BR,null,"Since last reload:"," ",F.added.length>0&&K.createElement(Kf,{type:"added"},"+",F.added.length," added"),F.added.length>0&&F.removed.length>0&&" \xB7 ",F.removed.length>0&&K.createElement(Kf,{type:"removed"},"\u2212",F.removed.length," removed"),(F.added.length>0||F.removed.length>0)&&F.renamed.length>0&&" \xB7 ",F.renamed.length>0&&K.createElement(Kf,{type:"renamed"},F.renamed.length," renamed")),r.thumbnailProgress&&r.thumbnailProgress.status==="in-progress"&&K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:r.thumbnailProgress.total>0?Math.round(r.thumbnailProgress.cached/r.thumbnailProgress.total*100):0})),K.createElement(Yi,null,K.createElement("span",null,"Preparing thumbnails\u2026",r.thumbnailProgress.currentName&&K.createElement(K.Fragment,null," ",r.thumbnailProgress.currentName)),K.createElement("span",null,r.thumbnailProgress.cached,"/",r.thumbnailProgress.total))),r.thumbnailProgress?.status!=="in-progress"&&(()=>{let $=r.thumbnailProgress,W=$?.cached??0,Q=$?.total??0,ge=Q>0&&W>=Q,he=Q>0&&W<Q,pe=Q>0?Math.min(100,Math.round(W/Q*100)):0;return K.createElement(kR,null,K.createElement(CR,null,K.createElement(ER,null,K.createElement(TR,null,"Thumbnails",Q>0&&K.createElement(K.Fragment,null," ",K.createElement(IR,null,W," / ",Q))),K.createElement(RR,{ready:ge},ge?"\u2713 Ready":he?"Partial":"Not generated")),K.createElement(AR,{onClick:I,disabled:a},"\u21BB ",ge?"Rebuild":"Reload")),Q>0&&K.createElement(FR,null,K.createElement(MR,{pct:ge?100:pe,ready:ge})))})(),r.enrichmentProgress&&r.enrichmentProgress.status==="in-progress"&&K.createElement(K.Fragment,null,K.createElement(ds,null,K.createElement(fs,{percent:r.enrichmentProgress.total>0?Math.round(r.enrichmentProgress.enriched/r.enrichmentProgress.total*100):0})),K.createElement(Yi,null,K.createElement("span",null,"AI descriptions: generating\u2026",r.enrichmentProgress.currentName&&K.createElement(K.Fragment,null," ",r.enrichmentProgress.currentName)),K.createElement("span",null,r.enrichmentProgress.enriched," of"," ",r.enrichmentProgress.total," component sets"))),r.enrichmentProgress&&r.enrichmentProgress.status==="complete"&&K.createElement(K.Fragment,null,K.createElement(Yi,null,K.createElement("span",null,"AI descriptions: ",r.enrichmentProgress.enriched," of"," ",r.enrichmentProgress.total," component sets \u2713"))),r.enrichmentProgress&&r.enrichmentProgress.status==="in-progress"&&t.showCosts&&r.enrichmentProgress.costUsd!=null&&r.enrichmentProgress.costUsd>0&&K.createElement("div",{style:{marginTop:"6px"}},K.createElement(ef,{inputTokens:r.enrichmentProgress.inputTokens||0,outputTokens:r.enrichmentProgress.outputTokens||0,costUsd:r.enrichmentProgress.costUsd,compact:!0})))};import Ut,{useState as Fl}from"react";import{styled as ci}from"storybook/theming";Ce();Fe();tt();var _b=ci.div({padding:"12px 16px"}),Aee=ci.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),jR=ci.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),VR=ci.button(({theme:e})=>({background:"none",border:"none",fontSize:"12px",color:j,cursor:"pointer",padding:0,"&:hover":{textDecoration:"underline"}})),Fee=ci.div({display:"flex",gap:"8px",alignItems:"center"}),Mee=ci.input(({theme:e})=>({flex:1,padding:"8px 12px",fontSize:"13px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.input.background,color:e.input.color,outline:"none",fontFamily:"monospace","&:focus":{borderColor:j,boxShadow:`0 0 0 1px ${j}`},"&::placeholder":{color:e.color.mediumlight,fontFamily:"inherit"}})),WR=ci.span(({theme:e,variant:t})=>({fontSize:"12px",color:t==="success"?e.color.positive:t==="error"?e.color.negative:e.color.mediumdark,marginTop:"6px",display:"block",lineHeight:1.4})),Pee=ci.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",lineHeight:1.5,"& a":{color:j,textDecoration:"none","&:hover":{textDecoration:"underline"}},"& ol":{margin:"4px 0 0 16px",padding:0},"& li":{marginBottom:"2px"}})),Lee=ci.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",borderRadius:"6px",backgroundColor:"#16a34a10",border:"1px solid #16a34a30",fontSize:"12px",color:e.color.defaultText})),_ee=ci.button(({theme:e})=>({background:"none",border:"none",fontSize:"11px",color:"#dc2626",cursor:"pointer",marginLeft:"auto","&:hover":{textDecoration:"underline"}})),GR=({onConnected:e,defaultExpanded:t=!1})=>{let{sessionToken:r}=be(),[n,o]=Fl(t),[i,a]=Fl(""),[s,l]=Fl(!1),[u,c]=Fl(null),[d,f]=Fl(null),[p,g]=Fl(!1),m=async()=>{if(!(!i.trim()||!r)){l(!0),c(null);try{let T=q(),S=await X(`${T}/api/figma/pat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({token:i.trim()})}),h=await S.json();if(!S.ok){c({type:"error",message:h.error||"Failed to save token"});return}f(h.figmaUser?.handle||h.figmaUser?.email||"Connected"),c({type:"success",message:`Connected as ${h.figmaUser?.handle||"Figma user"}`}),a(""),e?.()}catch{c({type:"error",message:"Failed to connect. Check your token and try again."})}finally{l(!1)}}};return d?Ut.createElement(_b,null,Ut.createElement(jR,null,"Figma Personal Access Token"),Ut.createElement(Lee,null,Ut.createElement("span",null,"\u2713 Connected as ",Ut.createElement("strong",null,d)),Ut.createElement(_ee,{onClick:()=>{f(null),c(null)}},"Change token"))):n?Ut.createElement(_b,null,Ut.createElement(Aee,null,Ut.createElement(jR,null,"Figma Personal Access Token"),Ut.createElement(VR,{onClick:()=>g(!p)},p?"Hide instructions":"How to generate")),p&&Ut.createElement(Pee,null,Ut.createElement("ol",null,Ut.createElement("li",null,"Open"," ",Ut.createElement("a",{href:"https://www.figma.com/settings",target:"_blank",rel:"noopener noreferrer"},"Figma Settings")),Ut.createElement("li",null,"Click the ",Ut.createElement("strong",null,"Security")," tab"),Ut.createElement("li",null,"Scroll to ",Ut.createElement("strong",null,"Personal access tokens")),Ut.createElement("li",null,"Click ",Ut.createElement("strong",null,"Generate new token")),Ut.createElement("li",null,"Enable ",Ut.createElement("strong",null,"File content: Read only")," under Scopes"),Ut.createElement("li",null,"Copy the token and paste it below"))),Ut.createElement(Fee,null,Ut.createElement(Mee,{type:"password",value:i,onChange:T=>a(T.target.value),placeholder:"figd_...",onKeyDown:T=>{T.key==="Enter"&&i.trim()&&m()}}),Ut.createElement(lr,{onClick:m,disabled:!i.trim()||s},s?"Verifying...":"Save & Verify")),u&&Ut.createElement(WR,{variant:u.type},u.message),Ut.createElement(WR,{variant:"info"},"Read-only access. Your token is stored securely and never shared.")):Ut.createElement(_b,null,Ut.createElement(VR,{onClick:()=>o(!0)},"Or use a Personal Access Token \u2192"))};Ce();Fe();tt();var Dee=jt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},jt.createElement("path",{d:"M19 28.5C19 23.2533 23.2533 19 28.5 19C33.7467 19 38 23.2533 38 28.5C38 33.7467 33.7467 38 28.5 38C23.2533 38 19 33.7467 19 28.5Z",fill:"#1ABCFE"}),jt.createElement("path",{d:"M0 47.5C0 42.2533 4.25329 38 9.5 38H19V47.5C19 52.7467 14.7467 57 9.5 57C4.25329 57 0 52.7467 0 47.5Z",fill:"#0ACF83"}),jt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),jt.createElement("path",{d:"M0 9.5C0 14.7467 4.25329 19 9.5 19H19V0H9.5C4.25329 0 0 4.25329 0 9.5Z",fill:"#F24E1E"}),jt.createElement("path",{d:"M0 28.5C0 33.7467 4.25329 38 9.5 38H19V19H9.5C4.25329 19 0 23.2533 0 28.5Z",fill:"#A259FF"})),Bb=Ta.div({}),Nee=Ta.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",backgroundColor:e.background.hoverable,borderBottom:`1px solid ${e.appBorderColor}`})),Oee=Ta.div({width:"16px",height:"16px",display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}),$ee=Ta.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,flex:1})),zb=Ta.div({"& > *":{border:"none",borderRadius:0,marginBottom:0,borderBottom:"1px solid rgba(0,0,0,0.06)","&:last-child":{borderBottom:"none"}}}),Hee=Ta.div({padding:"20px 16px",display:"flex",flexDirection:"column",gap:"12px"}),DTe=Ta.button({display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",padding:"8px 16px",backgroundColor:$S,color:"#fff",border:"none",borderRadius:"6px",fontSize:"13px",fontWeight:600,cursor:"pointer","&:hover":{backgroundColor:HS}}),Uee=Ta.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:e.color.mediumdark,"&::before, &::after":{content:'""',flex:1,height:"1px",backgroundColor:e.appBorderColor}})),YR=({hideHeader:e=!1})=>{let{sessionToken:t}=be(),r=!!t&&t.startsWith("uic_anon_"),[n,o]=Fu(!1),[i,a]=Fu(0),[s,l]=Fu(()=>{try{let S=sessionStorage.getItem("uicopilot_figma_connection");if(S){let{connected:h,ts:M}=JSON.parse(S);if(Date.now()-M<300*1e3)return h}}catch{}return null}),[u,c]=Fu(!1),[d,f]=Fu(!1),p=zee();Bee(()=>{if(!t)return;let S=q();X(`${S}/api/figma/connection-status`,{headers:{Authorization:`Bearer ${t}`}}).then(h=>h.json()).then(h=>{let M=!!h.connected;c(!!h.expired),l(M);try{sessionStorage.setItem("uicopilot_figma_connection",JSON.stringify({connected:M,ts:Date.now()}))}catch{}}).catch(()=>l(!1))},[t]);let g=qR(()=>{let S=q(),h=`${S}/api/auth/figma/login?addon=true`;window.open(h,"figma-oauth","width=600,height=700,left=200,top=100");let M=setInterval(async()=>{try{(await(await X(`${S}/api/figma/connection-status`,{headers:t?{Authorization:`Bearer ${t}`}:{}})).json()).connected&&(clearInterval(M),l(!0))}catch{}},2e3);setTimeout(()=>clearInterval(M),300*1e3)},[t]),m=qR(async()=>{try{o(!0);let S=q(),h=await X(`${S}/api/figma/disconnect`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(h.ok||h.status===404){l(!1);try{sessionStorage.removeItem("uicopilot_figma_connection")}catch{}}}catch{}finally{o(!1)}},[t]),T=e?null:jt.createElement(Nee,null,jt.createElement(Oee,null,Dee),jt.createElement($ee,null,"Figma Integration"));return s===null?jt.createElement(Bb,null,T,jt.createElement(zb,null,jt.createElement("div",{style:{padding:"16px",fontSize:"13px",color:p.color.mediumdark}},"Checking Figma connection..."))):s===!1?jt.createElement(Bb,null,T,jt.createElement(zb,null,jt.createElement(Hee,null,u&&jt.createElement("div",{style:{padding:"10px 12px",backgroundColor:"rgba(245, 158, 11, 0.1)",border:"1px solid rgba(245, 158, 11, 0.4)",borderRadius:"6px",fontSize:"12px",color:p.color.warning}},"\u26A0\uFE0F Your Figma access has expired. Please reconnect."),jt.createElement("div",{style:{padding:"8px 10px",backgroundColor:"rgba(100, 116, 139, 0.1)",border:"1px solid rgba(100, 116, 139, 0.3)",borderRadius:"6px",fontSize:"11px",lineHeight:1.4,color:p.color.mediumdark}},"Requires a Figma ",jt.createElement("strong",null,"Dev or Full seat"),". Free/Viewer seats can't grant design-read access."),!r&&jt.createElement(jt.Fragment,null,jt.createElement(lr,{onClick:g,style:{width:"100%"}},u?"Reconnect Figma":"Connect with Figma"),jt.createElement(Uee,null,"or")),jt.createElement(GR,{onConnected:()=>l(!0),defaultExpanded:r})))):jt.createElement(Bb,null,T,jt.createElement(Pf,{connected:!0,label:"Connected to Figma",actionLabel:n?"Disconnecting\u2026":"Disconnect",actionDisabled:n,actionTitle:"Disconnect Figma",onAction:()=>f(!0)}),jt.createElement(Bn,{isOpen:d,title:"Disconnect Figma",message:"Your mappings, cache, and review history will be preserved. You will need to re-authenticate to make new Figma API calls.",confirmLabel:"Disconnect",variant:"danger",onConfirm:()=>{f(!1),m()},onCancel:()=>f(!1)}),jt.createElement(zb,null,jt.createElement($7,{onFigmaFileChanged:()=>a(S=>S+1)}),jt.createElement(U7,{refreshKey:i}),jt.createElement(UR,null)))};Ce();dr();import{styled as gr}from"storybook/theming";var KR=gr.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:1e3,display:"flex",justifyContent:"center",alignItems:"flex-start",paddingTop:"40px"}),XR=gr.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"14px",border:`1px solid ${e.appBorderColor}`,boxShadow:"0 16px 48px rgba(0, 0, 0, 0.22)",width:"820px",maxWidth:"94%",maxHeight:"calc(100vh - 80px)",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"})),JR=gr.header(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",height:"48px",padding:"0 16px",borderBottom:`1px solid ${e.appBorderColor}`,flexShrink:0})),QR=gr.div({display:"flex",alignItems:"center",gap:"8px"}),ZR=gr.span(({theme:e})=>({fontSize:"14px",fontWeight:e.typography.weight.bold,letterSpacing:"-0.01em",color:e.color.defaultText})),eA=gr.span(({theme:e})=>({fontSize:"10px",fontFamily:e.typography.fonts.mono,color:e.color.mediumdark})),tA=gr.button(({theme:e})=>({width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:e.appBorderRadius,color:e.color.mediumdark,backgroundColor:"transparent",border:"none",cursor:"pointer",fontSize:"18px",lineHeight:1,transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable}})),rA=gr.div({display:"flex",flex:1,minHeight:"440px",overflow:"hidden"}),nA=gr.nav(({theme:e})=>({width:"178px",flexShrink:0,backgroundColor:e.background.app,padding:"12px 8px",display:"flex",flexDirection:"column",gap:"2px"})),oA=gr.button(({theme:e,active:t})=>({position:"relative",width:"100%",display:"flex",alignItems:"center",gap:"10px",padding:"0 8px 0 12px",height:"32px",borderRadius:e.appBorderRadius,border:"none",cursor:"pointer",textAlign:"left",backgroundColor:t?e.background.hoverable:"transparent",color:t?e.color.defaultText:e.color.mediumdark,transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable},"& svg":{flexShrink:0}})),iA=gr.span({position:"absolute",left:0,top:"6px",bottom:"6px",width:"2px",borderRadius:"2px",backgroundColor:j}),aA=gr.span(({theme:e})=>({fontSize:"12px",fontWeight:e.typography.weight.bold,lineHeight:1})),sA=gr.div(({theme:e})=>({flex:1,overflowY:"auto",backgroundColor:e.background.content,borderLeft:`1px solid ${e.appBorderColor}`,padding:"20px"})),Xf=gr.header({display:"flex",alignItems:"center",gap:"10px",marginBottom:"16px"}),lA=gr.div({width:"28px",height:"28px",borderRadius:"7px",backgroundColor:j,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:700,letterSpacing:"0.3px",flexShrink:0}),Db=gr.div(({theme:e})=>({width:"28px",height:"28px",borderRadius:"7px",backgroundColor:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,color:e.color.mediumdark,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0})),Jf=gr.h3(({theme:e})=>({margin:0,fontSize:"13px",fontWeight:e.typography.weight.bold,color:e.color.defaultText,lineHeight:1.2})),Qf=gr.p(({theme:e})=>({margin:"3px 0 0",fontSize:"11px",color:e.color.mediumdark,lineHeight:1.2})),Zf=gr.div({display:"flex",flexDirection:"column",gap:"12px",fontSize:"12px","& > div, & > section":{padding:0},'[class*="AuthPanelContainer"], [class*="SectionContainer"]':{padding:0},"h3, h4":{fontSize:"12px",margin:"0 0 6px 0"},label:{fontSize:"12px"},"input, select":{fontSize:"12px",padding:"6px 10px",height:"auto"},button:{fontSize:"11px"},p:{fontSize:"11px",margin:"2px 0"}}),Nb=gr.div(({theme:e})=>({padding:"16px",borderRadius:"10px",border:`1px dashed ${e.appBorderColor}`,backgroundColor:e.background.app,fontSize:"12px",color:e.color.mediumdark,lineHeight:1.5})),cA=gr.footer(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",height:"44px",padding:"0 16px",borderTop:`1px solid ${e.appBorderColor}`,flexShrink:0})),uA=gr.span(({theme:e})=>({fontSize:"10px",fontFamily:e.typography.fonts.mono,color:e.color.mediumdark})),pA=gr.div({display:"flex",alignItems:"center",gap:"6px"}),dA=gr.button(({theme:e})=>({height:"28px",padding:"0 12px",fontSize:"11px",fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,border:"none",borderRadius:e.appBorderRadius*2,background:"transparent",color:e.color.mediumdark,cursor:"pointer",transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable}}));var fA=()=>Ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Ue.createElement("path",{d:"M4 4h5l2 3h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"})),Gee=[{id:"account",label:"Account",icon:dc},{id:"project",label:"Project",icon:fA},{id:"figma",label:"Figma",icon:Fi}],gA=({onClose:e})=>{let{isConnected:t}=be(),{selectedProjectId:r}=Ge(),[n,o]=Wee("account"),i=eg(t),a=eg(!t),s=eg(!1),l=eg(!1);Vee(()=>{a.current&&!s.current&&!i.current&&t&&r&&(s.current=!0,e()),i.current=t},[t,r,e]);let u=()=>n==="account"?Ue.createElement(Ue.Fragment,null,Ue.createElement(Xf,null,Ue.createElement(lA,null,"UI"),Ue.createElement("div",null,Ue.createElement(Jf,null,Qt.NAME," account"),Ue.createElement(Qf,null,"Deterministic Figma \u2194 code comparison"))),Ue.createElement(Zf,null,Ue.createElement(_7,{onConnect:e}))):n==="project"?Ue.createElement(Ue.Fragment,null,Ue.createElement(Xf,null,Ue.createElement(Db,null,Ue.createElement(fA,null)),Ue.createElement("div",null,Ue.createElement(Jf,null,"Project"),Ue.createElement(Qf,null,"The Storybook project being compared"))),t?Ue.createElement(Zf,null,Ue.createElement(D7,null)):Ue.createElement(Nb,null,"Sign in on the ",Ue.createElement("strong",null,"Account")," tab first to choose a project.")):Ue.createElement(Ue.Fragment,null,Ue.createElement(Xf,null,Ue.createElement(Db,null,Ue.createElement(Fi,null)),Ue.createElement("div",null,Ue.createElement(Jf,null,"Figma integration"),Ue.createElement(Qf,null,"Source of truth for design tokens"))),t&&r?Ue.createElement(Zf,null,Ue.createElement(YR,{hideHeader:!0})):Ue.createElement(Nb,null,t?"Select a project on the Project tab before connecting Figma.":"Sign in on the Account tab first, then pick a project to connect Figma."));return Ue.createElement(KR,{onMouseDown:c=>{l.current=c.target===c.currentTarget},onClick:c=>{l.current&&c.target===c.currentTarget&&e()}},Ue.createElement(XR,{onClick:c=>c.stopPropagation()},Ue.createElement(JR,null,Ue.createElement(QR,null,Ue.createElement(ZR,null,"Settings"),Ue.createElement(eA,null,"v","0.18.1")),Ue.createElement(tA,{onClick:e,title:"Close settings","aria-label":"Close"},"\xD7")),Ue.createElement(rA,null,Ue.createElement(nA,null,Gee.map(c=>{let d=c.icon,f=n===c.id;return Ue.createElement(oA,{key:c.id,active:f,onClick:()=>o(c.id)},f&&Ue.createElement(iA,null),Ue.createElement(d,null),Ue.createElement(aA,null,c.label))})),Ue.createElement(sA,null,u())),Ue.createElement(cA,null,Ue.createElement(uA,null,Qt.NAME," \xB7 settings synced"),Ue.createElement(pA,null,Ue.createElement(dA,{onClick:e},"Cancel"),Ue.createElement(lr,{onClick:e},"Done")))))};Ce();dr();import Zt from"react";import Ho from"react";import{styled as xr,keyframes as qee}from"storybook/theming";var Ki=xr.div({marginTop:"10px",padding:"12px",borderRadius:"8px",border:`1px solid ${J.border}`,background:J.formBg,display:"flex",flexDirection:"column",gap:"10px"}),mA=xr.button({display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",padding:"9px",borderRadius:"8px",border:`1px solid ${J.border}`,background:J.card,color:J.text,fontSize:"13px",fontWeight:600,cursor:"pointer","&:hover":{background:J.formBg}}),Mu=xr.div({fontSize:"11px",color:J.muted,textAlign:"center"}),hA=xr.div({display:"flex",alignItems:"center",gap:"8px","&::before, &::after":{content:'""',flex:1,height:"1px",background:J.border},fontSize:"11px",color:J.muted}),xA=xr.button({width:"100%",padding:"9px",borderRadius:"6px",border:`1px dashed ${j}`,background:J.card,color:j,fontSize:"12px",fontWeight:600,cursor:"pointer","&:hover":{background:J.accentTint},"&:disabled":{opacity:.6,cursor:"default"}}),Ia=xr.label({fontSize:"11px",fontWeight:600,color:J.subText,display:"block",marginBottom:"4px"}),gs=xr.input({width:"100%",padding:"7px 10px",fontSize:"12px",borderRadius:"6px",border:`1px solid ${J.border}`,background:J.card,color:J.text,outline:"none","&:focus":{borderColor:j},"&:disabled":{background:J.formBg,color:J.muted}}),yA=xr.select({width:"100%",padding:"7px 10px",fontSize:"12px",borderRadius:"6px",border:`1px solid ${J.border}`,background:J.card,color:J.text}),$o=xr.button(({disabled:e})=>({width:"100%",padding:"8px",borderRadius:"6px",border:"none",fontSize:"12px",fontWeight:600,color:J.card,cursor:e?"not-allowed":"pointer",background:j,opacity:e?.5:1,"&:hover":e?{}:{background:Qo}})),Ob=xr.div({marginTop:"10px",fontSize:"11px",lineHeight:1.4,padding:"8px 10px",borderRadius:"6px",background:J.calloutBg,color:J.calloutText}),bA=xr.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"}),wA=xr.div({display:"flex",flexDirection:"column",gap:"8px",padding:"10px",borderRadius:"6px",border:`1px solid ${J.border}`,background:J.card}),vA=xr.div({display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"11px",color:J.subText}),SA=xr.span({fontVariantNumeric:"tabular-nums",color:J.muted}),tg=xr.div({height:"4px",width:"100%",borderRadius:"999px",background:J.track,overflow:"hidden"}),rg=xr.div(({pct:e})=>({height:"100%",width:`${Math.min(100,Math.max(0,e))}%`,borderRadius:"999px",background:j,transition:"width 0.3s ease"})),Yee=qee`
118
118
  0% { transform: translateX(-120%); }
119
119
  100% { transform: translateX(520%); }
120
120
  `,kA=xr.div({height:"100%",width:"20%",borderRadius:"999px",background:j,animation:`${Yee} 1.1s ease-in-out infinite`}),CA=xr.span({fontVariantNumeric:"tabular-nums",color:J.muted}),EA=xr.div({fontSize:"11px",color:J.muted}),TA=xr.div({fontSize:"11px",fontStyle:"italic",color:J.muted}),Xi=xr.div({fontSize:"11px",lineHeight:1.4,color:ee.redText}),IA=xr.div({paddingTop:"2px",display:"flex",flexDirection:"column",gap:"8px"}),RA=xr.button({alignSelf:"center",border:"none",background:"transparent",color:J.muted,fontSize:"11px",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:"2px"});var Kee=Ho.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true"},Ho.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.75h3.57c2.08-1.92 3.28-4.74 3.28-8.07z"}),Ho.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.75c-.99.66-2.25 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),Ho.createElement("path",{fill:"#FBBC05",d:"M5.84 14.12A6.6 6.6 0 0 1 5.49 12c0-.74.13-1.46.35-2.12V7.04H2.18A11 11 0 0 0 1 12c0 1.78.43 3.45 1.18 4.96l3.66-2.84z"}),Ho.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.04l3.66 2.84C6.71 7.31 9.14 5.38 12 5.38z"})),AA=()=>{let{startOAuth:e,oauthPending:t,startAnonymous:r,anonPending:n}=Do(),o=t||n;return Ho.createElement(Ki,null,Ho.createElement(mA,{onClick:e,disabled:o},Kee," ",t?"Opening sign-in\u2026":"Continue with Google"),Ho.createElement(Mu,null,"New or returning \u2014 we'll take you to the right place."),Ho.createElement(hA,null,"or"),Ho.createElement(xA,{onClick:r,disabled:o},n?"Starting\u2026":"Try without signing in \u2192"),Ho.createElement(Mu,null,"Explore with your own Figma file \u2014 no sign-up needed. Sign up later to save your work."))};Ce();import Cr,{useEffect as tte,useState as Lu}from"react";import $b from"react";import{styled as Hb,keyframes as Xee}from"storybook/theming";var Jee=Xee`
@@ -275,7 +275,7 @@ ${"=".repeat(40)}
275
275
  &:hover {
276
276
  background: rgba(255, 255, 255, 0.3);
277
277
  }
278
- `,Uce=wn.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",gap:`${e.layoutMargin}px`,height:"28px",padding:`0 ${e.layoutMargin*1.2}px`,borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,fontSize:"10px",color:e.color.mediumdark})),jce=wn.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,opacity:.7})),Vce=wn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*1.2}px`,fontFamily:e.typography.fonts.mono})),v_=wn.span(({theme:e,tone:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",color:t,"& .muted":{color:e.color.mediumdark,fontWeight:400},"& .val":{fontWeight:e.typography.weight.bold}})),S_=wn.div(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 24px",textAlign:"center",gap:"16px"})),k_=wn.div({fontSize:"32px"}),C_=wn.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),E_=wn.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark,maxWidth:"320px",lineHeight:1.5})),T_=wn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",margin:"8px 12px",backgroundColor:`${e.color.warning}15`,border:`1px solid ${e.color.warning}50`,borderRadius:e.appBorderRadius,fontSize:e.typography.size.s2,color:e.color.defaultText})),I_=wn.span({flex:1}),R_=wn.button(({theme:e})=>({padding:"4px 12px",fontSize:11,fontWeight:600,border:`1px solid ${e.color.warning}`,borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.warning,cursor:"pointer",whiteSpace:"nowrap","&:hover":{backgroundColor:`${e.color.warning}15`}})),A_=()=>{let{selectedProjectId:e,projects:t,loadingProjects:r}=Ge(),{isConnected:n,sessionToken:o,authError:i}=be(),{currentStoryId:a}=bt(),{currentReviewId:s,userRole:l,roleOverride:u,setRoleOverride:c,setFeatureFlags:d,pendingSettingsOpen:f,setPendingSettingsOpen:p,reviewHistory:g,validationUsage:m,featureFlags:T}=we(),{figmaExpired:S}=h_(),[h,M]=zce(!1);p2(()=>{b_()},[]),p2(()=>{f&&(M(!0),p(!1))},[f,p]);let z=()=>{c(null),o&&fetch(`${q()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(k=>k.json()).then(k=>{d({enableFixGeneration:!!k.enableFixGeneration,enableFixApply:!!k.enableFixApply,enableAutoMap:!!k.enableAutoMap,enableReviewBadges:!!k.enableReviewBadges,showCosts:!!k.showCosts,enableParallelReview:!!k.enableParallelReview,enableModelSelection:!!k.enableModelSelection,enableAiReview:!!k.enableAiReview})}).catch(()=>{})};tb(),hb(),d_(),m_(),ub(),sb();let{notification:O,dismissNotification:R}=s_();p2(()=>{if(O){let k=setTimeout(R,5e3);return()=>clearTimeout(k)}},[O,R]);let B=t.find(k=>k.id===e),x=n&&!!e&&!!B,{onboarded:v,dismiss:I}=c_(),L=w_({sessionToken:o,selectedProjectId:e,selectedProjectLoaded:!!B,loadingProjects:r,projectsCount:t.length}),{loadingMapping:E}=bt(),y=x&&!!a&&!s&&E,C=g.find(k=>k.id===s),b=(C?.costUsd||0)+(m?.costUsd||0),A=(C?.inputTokens||0)+(C?.outputTokens||0)+(m?.inputTokens||0)+(m?.outputTokens||0),P=!!T.showCosts&&b>0,F=k=>k<.01?k.toFixed(4):k<.1?k.toFixed(3):k.toFixed(2),D=k=>k>=1e3?`${(k/1e3).toFixed(1)}K`:String(k);return mt.createElement(Qm,{header:mt.createElement(Zm,{toolbar:mt.createElement(B5,{onOpenSettings:()=>M(!0)})}),footer:mt.createElement(Uce,null,mt.createElement(jce,null,Qt.NAME," v","0.18.0"),P&&mt.createElement(Vce,null,mt.createElement(v_,{tone:ee.green},mt.createElement("span",{className:"muted"},"cost"),mt.createElement("span",{className:"val"},"$",F(b)),mt.createElement("span",{className:"muted"},"/"),mt.createElement("span",{className:"val"},"\u20AA",F(b*3.65))),A>0&&mt.createElement(v_,{tone:Ii},mt.createElement("span",{className:"val"},"#"),mt.createElement("span",{className:"val"},D(A)),mt.createElement("span",{className:"muted"},"tokens"))))},O&&mt.createElement(Nce,{variant:O.variant||"success"},mt.createElement(Oce,null,O.variant==="error"?"!":O.variant==="warning"?"\u26A0":"+"),mt.createElement($ce,null,O.message),mt.createElement(Hce,{onClick:R},"x")),i&&mt.createElement(T_,null,mt.createElement("span",null,"\u26A0"),mt.createElement(I_,null,i),mt.createElement(R_,{onClick:()=>M(!0)},"Reconnect")),l==="admin"&&u&&mt.createElement(T_,null,mt.createElement("span",null,"\u{1F441}"),mt.createElement(I_,null,"Previewing as ",u),mt.createElement(R_,{onClick:z},"Exit preview")),L||y?mt.createElement(ms,{label:L?"Loading...":"Loading review..."}):i?mt.createElement(S_,null,mt.createElement(k_,null,"\u2699"),mt.createElement(C_,null,"Connection issue"),mt.createElement(E_,null,"Session expired or dashboard unreachable. Please reconnect."),mt.createElement(lr,{onClick:()=>M(!0)},"Reconnect")):v&&!S&&o&&!r&&!e?mt.createElement(S_,null,mt.createElement(k_,null,"\u{1F4C1}"),mt.createElement(C_,null,"No project selected"),mt.createElement(E_,null,"Select or create a project for this Storybook to start reviewing."),mt.createElement(lr,{onClick:()=>M(!0)},"Open Settings")):v&&!S?mt.createElement(n2,null):mt.createElement(T8,{onSkip:I,canSkip:x&&!S,figmaExpired:S}),h&&mt.createElement(gA,{onClose:()=>M(!1)}))};import M_,{useCallback as Wce,useEffect as Gce}from"react";import{useStorybookApi as qce,useStorybookState as Yce}from"storybook/manager-api";import{IconButton as Kce}from"storybook/internal/components";function F_(e){let t=e?.entries??e,r=new Map;if(!t||typeof t!="object")return r;for(let[n,o]of Object.entries(t)){if(!o||typeof o!="object"||o.type!=="story")continue;let i=n.indexOf("--"),a=i===-1?n:n.slice(0,i);r.set(a,(r.get(a)??0)+1)}return r}var Xce="uireview",Jce=`${Xce}/panel`,P_=()=>{let e=qce(),{index:t}=Yce();V7(e),Gce(()=>{if(!t)return;let n=F_(t);n.size&&wI(n)},[t]);let r=Wce(()=>{e.togglePanel(!0),e.setSelectedPanel(Jce)},[e]);return M_.createElement(Kce,{key:"uireview-tool",title:"UI Review - Compare with Figma",onClick:r},M_.createElement(ZS,null))};Ce();import Wt,{useState as As,useCallback as O_,useEffect as im}from"react";import{styled as Go,useTheme as cue}from"storybook/theming";import{addons as up}from"storybook/manager-api";Fe();Ne();import{addons as rue,experimental_getStatusStore as om}from"storybook/manager-api";function Wl(e){let t=e.indexOf("--"),r=t===-1?e:e.slice(0,t),n=r.split("-").filter(Boolean);return n.length>1&&/^(components?|example|stories|pages?|ui)$/i.test(n[0])&&n.shift(),n.map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")||r}Fe();Ne();var L_=q(),Qce="uireview/badge";async function __(e,t,r=3){for(let n=0;n<=r;n++){let o=await fetch(e,t);if(o.status!==429||n===r)return o;let i=Math.pow(2,n)*1e3;w.warn(`[reviewAll] Rate limited, retrying in ${i}ms`),await new Promise(a=>setTimeout(a,i))}throw new Error("Max retries exceeded")}async function Zce(e,t){let r=new TextDecoder,n="",o=null,i=0,a=0,s=0,l=0,u=0,c=0;for(;;){let{done:d,value:f}=await e.read();if(d)break;if(t()){e.cancel();break}n+=r.decode(f,{stream:!0});let p=n.split(`
278
+ `,Uce=wn.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",gap:`${e.layoutMargin}px`,height:"28px",padding:`0 ${e.layoutMargin*1.2}px`,borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,fontSize:"10px",color:e.color.mediumdark})),jce=wn.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,opacity:.7})),Vce=wn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*1.2}px`,fontFamily:e.typography.fonts.mono})),v_=wn.span(({theme:e,tone:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",color:t,"& .muted":{color:e.color.mediumdark,fontWeight:400},"& .val":{fontWeight:e.typography.weight.bold}})),S_=wn.div(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 24px",textAlign:"center",gap:"16px"})),k_=wn.div({fontSize:"32px"}),C_=wn.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),E_=wn.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark,maxWidth:"320px",lineHeight:1.5})),T_=wn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",margin:"8px 12px",backgroundColor:`${e.color.warning}15`,border:`1px solid ${e.color.warning}50`,borderRadius:e.appBorderRadius,fontSize:e.typography.size.s2,color:e.color.defaultText})),I_=wn.span({flex:1}),R_=wn.button(({theme:e})=>({padding:"4px 12px",fontSize:11,fontWeight:600,border:`1px solid ${e.color.warning}`,borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.warning,cursor:"pointer",whiteSpace:"nowrap","&:hover":{backgroundColor:`${e.color.warning}15`}})),A_=()=>{let{selectedProjectId:e,projects:t,loadingProjects:r}=Ge(),{isConnected:n,sessionToken:o,authError:i}=be(),{currentStoryId:a}=bt(),{currentReviewId:s,userRole:l,roleOverride:u,setRoleOverride:c,setFeatureFlags:d,pendingSettingsOpen:f,setPendingSettingsOpen:p,reviewHistory:g,validationUsage:m,featureFlags:T}=we(),{figmaExpired:S}=h_(),[h,M]=zce(!1);p2(()=>{b_()},[]),p2(()=>{f&&(M(!0),p(!1))},[f,p]);let z=()=>{c(null),o&&fetch(`${q()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(k=>k.json()).then(k=>{d({enableFixGeneration:!!k.enableFixGeneration,enableFixApply:!!k.enableFixApply,enableAutoMap:!!k.enableAutoMap,enableReviewBadges:!!k.enableReviewBadges,showCosts:!!k.showCosts,enableParallelReview:!!k.enableParallelReview,enableModelSelection:!!k.enableModelSelection,enableAiReview:!!k.enableAiReview})}).catch(()=>{})};tb(),hb(),d_(),m_(),ub(),sb();let{notification:O,dismissNotification:R}=s_();p2(()=>{if(O){let k=setTimeout(R,5e3);return()=>clearTimeout(k)}},[O,R]);let B=t.find(k=>k.id===e),x=n&&!!e&&!!B,{onboarded:v,dismiss:I}=c_(),L=w_({sessionToken:o,selectedProjectId:e,selectedProjectLoaded:!!B,loadingProjects:r,projectsCount:t.length}),{loadingMapping:E}=bt(),y=x&&!!a&&!s&&E,C=g.find(k=>k.id===s),b=(C?.costUsd||0)+(m?.costUsd||0),A=(C?.inputTokens||0)+(C?.outputTokens||0)+(m?.inputTokens||0)+(m?.outputTokens||0),P=!!T.showCosts&&b>0,F=k=>k<.01?k.toFixed(4):k<.1?k.toFixed(3):k.toFixed(2),D=k=>k>=1e3?`${(k/1e3).toFixed(1)}K`:String(k);return mt.createElement(Qm,{header:mt.createElement(Zm,{toolbar:mt.createElement(B5,{onOpenSettings:()=>M(!0)})}),footer:mt.createElement(Uce,null,mt.createElement(jce,null,Qt.NAME," v","0.18.1"),P&&mt.createElement(Vce,null,mt.createElement(v_,{tone:ee.green},mt.createElement("span",{className:"muted"},"cost"),mt.createElement("span",{className:"val"},"$",F(b)),mt.createElement("span",{className:"muted"},"/"),mt.createElement("span",{className:"val"},"\u20AA",F(b*3.65))),A>0&&mt.createElement(v_,{tone:Ii},mt.createElement("span",{className:"val"},"#"),mt.createElement("span",{className:"val"},D(A)),mt.createElement("span",{className:"muted"},"tokens"))))},O&&mt.createElement(Nce,{variant:O.variant||"success"},mt.createElement(Oce,null,O.variant==="error"?"!":O.variant==="warning"?"\u26A0":"+"),mt.createElement($ce,null,O.message),mt.createElement(Hce,{onClick:R},"x")),i&&mt.createElement(T_,null,mt.createElement("span",null,"\u26A0"),mt.createElement(I_,null,i),mt.createElement(R_,{onClick:()=>M(!0)},"Reconnect")),l==="admin"&&u&&mt.createElement(T_,null,mt.createElement("span",null,"\u{1F441}"),mt.createElement(I_,null,"Previewing as ",u),mt.createElement(R_,{onClick:z},"Exit preview")),L||y?mt.createElement(ms,{label:L?"Loading...":"Loading review..."}):i?mt.createElement(S_,null,mt.createElement(k_,null,"\u2699"),mt.createElement(C_,null,"Connection issue"),mt.createElement(E_,null,"Session expired or dashboard unreachable. Please reconnect."),mt.createElement(lr,{onClick:()=>M(!0)},"Reconnect")):v&&!S&&o&&!r&&!e?mt.createElement(S_,null,mt.createElement(k_,null,"\u{1F4C1}"),mt.createElement(C_,null,"No project selected"),mt.createElement(E_,null,"Select or create a project for this Storybook to start reviewing."),mt.createElement(lr,{onClick:()=>M(!0)},"Open Settings")):v&&!S?mt.createElement(n2,null):mt.createElement(T8,{onSkip:I,canSkip:x&&!S,figmaExpired:S}),h&&mt.createElement(gA,{onClose:()=>M(!1)}))};import M_,{useCallback as Wce,useEffect as Gce}from"react";import{useStorybookApi as qce,useStorybookState as Yce}from"storybook/manager-api";import{IconButton as Kce}from"storybook/internal/components";function F_(e){let t=e?.entries??e,r=new Map;if(!t||typeof t!="object")return r;for(let[n,o]of Object.entries(t)){if(!o||typeof o!="object"||o.type!=="story")continue;let i=n.indexOf("--"),a=i===-1?n:n.slice(0,i);r.set(a,(r.get(a)??0)+1)}return r}var Xce="uireview",Jce=`${Xce}/panel`,P_=()=>{let e=qce(),{index:t}=Yce();V7(e),Gce(()=>{if(!t)return;let n=F_(t);n.size&&wI(n)},[t]);let r=Wce(()=>{e.togglePanel(!0),e.setSelectedPanel(Jce)},[e]);return M_.createElement(Kce,{key:"uireview-tool",title:"UI Review - Compare with Figma",onClick:r},M_.createElement(ZS,null))};Ce();import Wt,{useState as As,useCallback as O_,useEffect as im}from"react";import{styled as Go,useTheme as cue}from"storybook/theming";import{addons as up}from"storybook/manager-api";Fe();Ne();import{addons as rue,experimental_getStatusStore as om}from"storybook/manager-api";function Wl(e){let t=e.indexOf("--"),r=t===-1?e:e.slice(0,t),n=r.split("-").filter(Boolean);return n.length>1&&/^(components?|example|stories|pages?|ui)$/i.test(n[0])&&n.shift(),n.map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")||r}Fe();Ne();var L_=q(),Qce="uireview/badge";async function __(e,t,r=3){for(let n=0;n<=r;n++){let o=await fetch(e,t);if(o.status!==429||n===r)return o;let i=Math.pow(2,n)*1e3;w.warn(`[reviewAll] Rate limited, retrying in ${i}ms`),await new Promise(a=>setTimeout(a,i))}throw new Error("Max retries exceeded")}async function Zce(e,t){let r=new TextDecoder,n="",o=null,i=0,a=0,s=0,l=0,u=0,c=0;for(;;){let{done:d,value:f}=await e.read();if(d)break;if(t()){e.cancel();break}n+=r.decode(f,{stream:!0});let p=n.split(`
279
279
  `);n=p.pop()||"";for(let g of p)if(g.startsWith("data: "))try{let m=JSON.parse(g.slice(6));if(m.type==="complete"){o=m.complianceScore??m.validation?.complianceScore??null;let S=(m.issues||[]).filter(h=>!h.dismissed);i=S.filter(h=>h.severity==="critical").length,a=S.filter(h=>h.severity==="major").length,s=S.filter(h=>h.severity==="minor").length,l=m.costUsd||0,u=m.inputTokens||0,c=m.outputTokens||0}}catch{}}return{score:o,criticalCount:i,majorCount:a,minorCount:s,costUsd:l,inputTokens:u,outputTokens:c}}function Gl(e,t,r,n,o){e&&e.set([{value:r,typeId:Qce,storyId:t,title:n,description:o}])}function B_(e,t,r,n,o,i){let a=n>0||r<70?"status-value:error":o>0||r<90?"status-value:warning":"status-value:success",s=[`Score: ${r}`];n>0&&s.push(`${n} critical`),o>0&&s.push(`${o} major`),i>0&&s.push(`${i} minor`);let l=r>=90?`\u2713 Score ${r}`:r>=70?`\u26A0 Score ${r}`:`\u2717 Score ${r}`;Gl(e,t,a,l,s.join(" \xB7 "));let u=a==="status-value:error"?"error":a==="status-value:warning"?"warn":"success";ts(t,!0),Yc(t,u),Dd(t,r)}async function eue(e,t,r,n,o){let i=await __(`${L_}/api/specs/diff`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({projectId:r,storyId:e.storyId,figmaNodeId:e.figmaNodeId,domTree:n})});if(!i.ok&&i.status!==422)throw new Error(`HTTP ${i.status}`);let a=await i.json().catch(()=>({}));if(i.status===422||a.incomparable===!0){let p=typeof a.skipped=="string"?a.skipped:"no-comparison";return w.warn(`[reviewAll] incomparable: ${e.storyName} \u2014 ${p} \xB7 figmaStyles=${a.figmaStyleCount??"?"} codeStyles=${a.codeStyleCount??"?"} deferred=${a.deferredCount??"?"}`+(a.deferReasons?` \xB7 reasons=${JSON.stringify(a.deferReasons)}`:"")+(a.figmaConfReasons?` \xB7 confReasons=${JSON.stringify(a.figmaConfReasons)}`:"")+(a.figmaNodeType||a.figmaNodeWidth?` \xB7 figmaNode=${a.figmaNodeType??"?"}/${a.figmaNodeWidth??"?"}px`:"")+(a.codeConfReasons?` \xB7 codeConfReasons=${JSON.stringify(a.codeConfReasons)}`:"")+(a.codeRootWidth||a.codeRootHeight?` \xB7 codeRoot=${a.codeRootWidth??"?"}x${a.codeRootHeight??"?"}`:"")+(a.codeRootTag||a.codeRootId||a.codeRootClass?` <${a.codeRootTag??"?"} id="${a.codeRootId??""}" class="${a.codeRootClass??""}">`:"")),Gl(o,e.storyId,"status-value:unknown","Incomparable",typeof a.error=="string"?a.error:"Couldn't compare design and code"),bI(e.storyId),{passed:!1,score:null,incomparable:!0,skipped:p,costUsd:0,inputTokens:0,outputTokens:0}}if(!a.success)throw new Error(a.error||"Spec check failed");let s=a.complianceScore??null,u=(a.issues||[]).filter(p=>!p.dismissed),c=u.filter(p=>p.severity==="critical").length,d=u.filter(p=>p.severity==="major").length,f=u.filter(p=>p.severity==="minor").length;return s!==null?(B_(o,e.storyId,s,c,d,f),{passed:s>=70,score:s,costUsd:0,inputTokens:0,outputTokens:0}):(Gl(o,e.storyId,"status-value:error","Review Failed","No score received"),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0})}async function tue(e,t=!1){let r=window.location.origin;try{let n=await fetch(`${r}/__uicopilot/capture?storyId=${encodeURIComponent(e)}${t?"&domOnly=1":""}`);if(n.ok){let o=await n.json();return{screenshot:o.screenshot||void 0,computedStyles:o.computedStyles||void 0,domTree:o.domTree||void 0}}}catch{}try{let n=await fetch(`${r}/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(n.ok)return{screenshot:(await n.json()).screenshot||void 0}}catch{}return{}}async function z_(e,t,r,n,o,i,a=!0,s){Gl(o,e.storyId,"status-value:pending","Reviewing...",e.storyName);try{let l=s!==void 0?{domTree:s}:await tue(e.storyId,!a);if(console.warn(`[reviewAll] Captured: screenshot=${!!l.screenshot} domTree=${!!l.domTree} styles=${!!l.computedStyles} for: ${e.storyName}`),!a)return await eue(e,t,r,l.domTree,o);let u=await __(`${L_}/api/review/stream`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({projectId:r,storyId:e.storyId,storyName:e.storyName,storybookScreenshot:l.screenshot,computedStyles:l.computedStyles,domTree:l.domTree,aiModels:[n]})});if(console.warn(`[reviewAll] API response for ${e.storyName}: HTTP ${u.status}`),!u.ok)throw new Error(`HTTP ${u.status}`);let c=u.body?.getReader();if(!c)throw new Error("No response body");let d=await Zce(c,i),{score:f,criticalCount:p,majorCount:g,minorCount:m,costUsd:T,inputTokens:S,outputTokens:h}=d;return f!==null?(B_(o,e.storyId,f,p,g,m),{passed:f>=70,score:f,costUsd:T,inputTokens:S,outputTokens:h}):(Gl(o,e.storyId,"status-value:error","Review Failed","No score received"),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0})}catch(l){w.error(`[reviewAll] Failed to review ${e.storyName}:`,l);let u=l instanceof Error?l.message:"Unknown error";return Gl(o,e.storyId,"status-value:error","Review Failed",u),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}}var nue=q(),lp="uireview/badge",d2=9e4,D_=Symbol("review-timed-out");function oue(e,t,r){return new Promise(n=>{let o=!1,i=setTimeout(()=>{o||(o=!0,n(r()))},t),a=s=>{o||(o=!0,clearTimeout(i),n(s))};e.then(a,()=>a(r()))})}function iue(){try{return localStorage.getItem("uicopilot_docs_batch")==="1"}catch{return!1}}function N_(){let e=!1,t=!1;try{let r=rue.getChannel();r.on(g2,async()=>{if(!t){t=!0,e=!1,yI();try{await lue(r,()=>e)}finally{t=!1}}}),r.on(m2,()=>{e=!0})}catch{}}async function f2(){try{let e=localStorage.getItem("uicopilot_session_token"),t=localStorage.getItem("uicopilot_selected_project_id");if(!e||!t)return[];let r=await fetch(`${nue}/api/mappings?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(!r.ok)return[];let i=((await r.json()).mappings||[]).filter(a=>a.figmaNodeId).map(a=>{let s=a;return{storyId:s.storyId,storyName:s.name||s.storyId,figmaNodeId:s.figmaNodeId}});return aue(i),i}catch(e){return w.error("[useReviewAll] Failed to load mapped stories:",e),[]}}function aue(e){try{if(typeof om!="function")return;let t=om(lp);if(!t)return;let r=t.getAll?.()||{},n=new Set(e.map(a=>a.storyId)),o=Object.keys(r).filter(a=>r[a]?.[lp]&&!n.has(a));o.length>0&&t.unset(o);let i=e.filter(a=>{let s=r[a.storyId]?.[lp];return!(s?.value==="status-value:success"||s?.value==="status-value:warning"||s?.value==="status-value:error")}).map(a=>({value:"status-value:pending",typeId:lp,storyId:a.storyId,title:"Mapped to Figma",description:"Ready for UI review \u2014 click Run to start"}));i.length>0&&t.set(i)}catch{}}function sue(){try{let e=localStorage.getItem("uicopilot_review_all_concurrency");if(e)return Math.max(1,Math.min(5,parseInt(e,10)))}catch{}return 5}async function lue(e,t){let r=await f2();if(r.length===0){e.emit(cp,{total:0,passed:0,failed:0});return}let n=localStorage.getItem("uicopilot_session_token"),o=localStorage.getItem("uicopilot_selected_project_id");if(!n||!o)return;let i="claude-sonnet-4-6";try{let B=localStorage.getItem("uicopilot_selected_models");if(B){let x=JSON.parse(B);Array.isArray(x)&&x.length>0&&(i=x[0])}}catch{}let a=null;try{typeof om=="function"&&(a=om(lp))}catch{}let s=_l(),l=sue(),u=0,c=0,d=0,f=0,p=new Map,g=0,m=0,T=0,S=0,h=0;e.emit(Rs,{total:r.length,completed:0,currentStoryName:r[0]?.storyName||"",currentComponent:Wl(r[0]?.storyId||"")});let M=new Map;if(!s&&iue()&&!t()){e.emit(Rs,{total:r.length,completed:0,currentStoryName:"Capturing renders\u2026"});try{let B=await sf(r.map(x=>({id:x.storyId})),(x,v)=>e.emit(Rs,{total:v,completed:x,currentStoryName:"Capturing renders\u2026"}));for(let[x,v]of B)M.set(x,v);w.debug(`[reviewAll] docs-batch captured ${M.size}/${r.length} DOMs`)}catch(B){w.warn("[reviewAll] docs-batch capture failed \u2014 server fallback",B)}}let z=r.map(B=>()=>oue(z_(B,n,o,i,a,t,s,M.get(B.storyId)),d2,()=>(w.warn(`[reviewAll] ${B.storyName} exceeded ${d2}ms \u2014 skipping so the run can finish`),D_)));await nf(z,l,(B,x)=>{if(x===D_)g++;else if(x&&typeof x=="object"&&"score"in x){let v=x;if(v.incomparable){f++;let I=v.skipped||"no-comparison";p.set(I,(p.get(I)??0)+1)}else v.score!==null&&v.score>=90?u++:v.score!==null&&v.score>=70?c++:d++;T+=v.costUsd||0,S+=v.inputTokens||0,h+=v.outputTokens||0}else m++;console.warn(`[reviewAll] Story ${B+1}/${r.length} done:`,r[B].storyName,x),e.emit(Rs,{total:r.length,completed:u+c+d+f+g+m,currentStoryName:r[B].storyName,currentComponent:Wl(r[B].storyId)})},t);let R=`[reviewAll] DONE \u2014 ${u+c+d}/${r.length} reviewed (\u2713${u} \u26A0${c} \u2717${d})`+(f?` \xB7 ${f} nothing-to-compare`:"")+(g?` \xB7 ${g} TIMED OUT (>${d2/1e3}s)`:"")+(m?` \xB7 ${m} capture/transport error`:"");if(g||m?w.warn(R):w.info(R),f>0){let B=[...p.entries()].sort((x,v)=>v[1]-x[1]).map(([x,v])=>`${v} ${x}`).join(" \xB7 ");w.warn(`[reviewAll] INCOMPARABLE breakdown \u2014 ${B}`)}e.emit(cp,{total:r.length,passed:u,failed:d,warnCount:c,incomparable:f,timedOut:g,errored:m,costUsd:T,inputTokens:S,outputTokens:h})}var uue=Go.div({padding:"8px 12px",display:"flex",flexDirection:"column",gap:"6px"}),pue=Go.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),due=Go.span(({theme:e})=>({fontSize:"12px",fontWeight:500,color:e.color.defaultText})),pp=Go.span(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),fue=Go.span(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"})),gue=Go.span(({theme:e})=>({color:e.color.secondary,fontWeight:e.typography.weight.bold})),$_=Go.button(({theme:e,running:t})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",background:t?e.color.warning:e.color.secondary,border:"none",borderRadius:"6px",color:e.color.inverseText,cursor:"pointer",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,transition:"all 0.2s","&:disabled":{opacity:.4,cursor:"not-allowed"},"&:hover:not(:disabled)":{opacity:.9}})),mue=Go.div(({theme:e})=>({width:"100%",height:"3px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),hue=Go.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"2px",transition:"width 0.3s ease"})),H_=Go.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.8}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark})),ql=Go.span(e=>({display:"flex",alignItems:"center",gap:"3px","&::before":{content:'""',display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",backgroundColor:e.dotColor}})),g2="uireview/review-all-start",m2="uireview/review-all-cancel",Rs="uireview/review-all-progress",cp="uireview/review-all-complete";function xue(e){let t=Math.max(0,Math.round(e/1e3)),r=Math.floor(t/60);return r>0?`${r}m${String(t%60).padStart(2,"0")}s`:`${t}s`}function U_(e,t,r){if(t<=0||t>=r)return"";let n=Math.round(e/t*(r-t)/1e3);return n>=60?`~${Math.ceil(n/60)}m left`:`~${Math.max(1,n)}s left`}var j_=()=>{let[e,t]=As(!1),[r,n]=As(null),[o,i]=As(null),[a,s]=As(null),[l,u]=As(_l),[c,d]=As(null),[f,p]=As(()=>Date.now());im(()=>{if(!e)return;let M=setInterval(()=>p(Date.now()),1e3);return()=>clearInterval(M)},[e]),im(()=>{let M;try{M=up.getChannel()}catch{return}let z=O=>u(!!O);return M.on(lg,z),()=>M.off(lg,z)},[]),im(()=>{let M=()=>{f2().then(B=>{s(B.length)}).catch(()=>{})},z=setTimeout(M,3e3),O=null;try{O=up.getChannel(),O.on("storyChanged",M),O.on("uireview/mappings-changed",M)}catch{}let R=setInterval(M,6e4);return()=>{clearTimeout(z),clearInterval(R),O&&(O.off("storyChanged",M),O.off("uireview/mappings-changed",M))}},[]),im(()=>{let M;try{M=up.getChannel()}catch{return}let z=R=>{n(R),t(!0),d(B=>B??Date.now()),p(Date.now())},O=R=>{t(!1),n(null),d(null),i({total:R.total,passed:R.passed,failed:R.failed,warned:R.warnCount||0,timedOut:R.timedOut||0,errored:R.errored||0,costUsd:R.costUsd||0})};return M.on(Rs,z),M.on(cp,O),()=>{M.off(Rs,z),M.off(cp,O)}},[]);let g=O_(()=>{try{up.getChannel().emit(g2),t(!0),i(null)}catch{}},[]),m=O_(()=>{try{up.getChannel().emit(m2)}catch{}t(!1),n(null)},[]),T=r?Math.round(r.completed/r.total*100):0,S=cue(),h=(()=>{try{return!!JSON.parse(localStorage.getItem("uicopilot_feature_flags")||"{}").showCosts}catch{return!1}})();return Wt.createElement(uue,null,Wt.createElement(pue,null,Wt.createElement(due,null,"UI Parity"),e?Wt.createElement($_,{running:!0,onClick:m},"Cancel"):Wt.createElement($_,{onClick:g,disabled:!a||a===0},"Run",a?` (${a})`:"")),!e&&Wt.createElement(pp,null,l?"AI review vs Figma design \xB7 uses credits":"Deterministic \u2014 color, font, spacing vs Figma \xB7 free"),!e&&o?Wt.createElement(Wt.Fragment,null,Wt.createElement(H_,null,Wt.createElement(ql,{dotColor:S.color.positive},"Pass (",o.passed,")"),Wt.createElement(ql,{dotColor:S.color.warning},"Warn (",o.warned,")"),Wt.createElement(ql,{dotColor:S.color.negative},"Fail (",o.failed,")")),(o.timedOut>0||o.errored>0)&&Wt.createElement(pp,{title:"Stories that didn't complete: 'timed out' hit the per-story cap; 'error' = capture/transport failure. The run skipped them and finished."},o.passed+o.warned+o.failed,"/",o.total," reviewed",o.timedOut>0?` \xB7 ${o.timedOut} timed out`:"",o.errored>0?` \xB7 ${o.errored} error`:""),h&&o.costUsd>0&&Wt.createElement(pp,null,"$",o.costUsd.toFixed(3)," \xB7 \u20AA",(o.costUsd*3.6).toFixed(3))):e?null:(()=>{let M=Ui();return Wt.createElement(Wt.Fragment,null,Wt.createElement(H_,null,Wt.createElement(ql,{dotColor:S.color.positive},"Pass",M.reviewed>0?` (${M.pass})`:""),Wt.createElement(ql,{dotColor:S.color.warning},"Warn",M.reviewed>0?` (${M.warn})`:""),Wt.createElement(ql,{dotColor:S.color.negative},"Fail",M.reviewed>0?` (${M.fail})`:"")),M.reviewed>0&&Wt.createElement(pp,null,M.reviewed," of ",a??M.mapped," mapped reviewed",M.avgScore!=null?` \xB7 parity ${M.avgScore}/100`:""))})(),e&&r&&Wt.createElement(Wt.Fragment,null,Wt.createElement(mue,null,Wt.createElement(hue,{percent:T})),Wt.createElement(pp,null,r.completed,"/",r.total,r.currentComponent&&Wt.createElement(Wt.Fragment,null," \xB7 ",Wt.createElement(gue,null,r.currentComponent)),c&&` \xB7 ${xue(f-c)} elapsed`,c&&U_(f-c,r.completed,r.total)&&` \xB7 ${U_(f-c,r.completed,r.total)}`),r.currentStoryName&&r.currentStoryName!=="Capturing renders\u2026"&&Wt.createElement(fue,null,r.currentStoryName)))};import He,{useEffect as mB,useState as hB}from"react";import{useTheme as bue}from"storybook/theming";import{styled as Ot}from"storybook/theming";var h2=Ot.div(({theme:e})=>({maxWidth:"940px",padding:`${e.layoutMargin*1.5}px`,fontFamily:e.typography.fonts.base,color:e.color.defaultText})),x2=Ot.div(({theme:e})=>({background:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:`${e.appBorderRadius*2}px`,padding:`${e.layoutMargin*1.5}px`,marginTop:`${e.layoutMargin}px`})),y2=Ot.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,letterSpacing:"0.06em",textTransform:"uppercase",color:j,marginBottom:"4px"})),b2=Ot.span({width:"12px",height:"12px",borderRadius:"3px",background:j,flex:"none"}),V_=Ot.div(({theme:e})=>({fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,marginBottom:`${e.layoutMargin*.75}px`})),W_=Ot.div(({theme:e})=>({display:"flex",flexWrap:"wrap",alignItems:"center",gap:`${e.layoutMargin*1.5}px`,marginBottom:`${e.layoutMargin*1.5}px`})),G_=Ot.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin}px`,flex:"1 1 auto"})),q_=Ot.div({display:"flex",flexDirection:"column",gap:"2px"}),Y_=Ot.div(({theme:e})=>({fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold})),K_=Ot.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark})),X_=Ot.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,marginBottom:`${e.layoutMargin}px`})),J_=Ot.div(({theme:e})=>({flex:"0 0 auto",border:`1px solid ${e.appBorderColor}`,borderRadius:`${e.appBorderRadius}px`,padding:`${e.layoutMargin}px ${e.layoutMargin*1.25}px`,background:e.background.app})),Q_=Ot.div({display:"flex",alignItems:"baseline",gap:"4px"}),Z_=Ot.span(({theme:e,tone:t})=>({fontSize:e.typography.size.l1,fontWeight:e.typography.weight.bold,lineHeight:1,color:t})),eB=Ot.span(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.mediumdark,fontWeight:e.typography.weight.bold})),tB=Ot.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,marginTop:"2px"})),rB=Ot.div(({theme:e})=>({display:"flex",gap:`${e.layoutMargin}px`,marginBottom:`${e.layoutMargin}px`})),am=Ot.span(({theme:e,tone:t})=>({display:"inline-flex",alignItems:"center",gap:"6px",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,"&::before":{content:'""',width:"9px",height:"9px",borderRadius:"50%",background:t}})),nB=Ot.div(({theme:e})=>({display:"flex",justifyContent:"space-between",marginTop:`${e.layoutMargin}px`,paddingBottom:`${e.layoutMargin*.35}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:e.typography.weight.bold})),oB=Ot.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`})),iB=Ot.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:`${e.layoutMargin*.4}px 0`,borderBottom:`1px solid ${e.appBorderColor}`,fontSize:e.typography.size.s1})),aB=Ot.span(({tone:e})=>({width:"8px",height:"8px",borderRadius:"50%",background:e,flex:"none"})),sB=Ot.span({flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),lB=Ot.span(({theme:e})=>({width:"90px",height:"6px",borderRadius:"999px",background:e.background.hoverable,overflow:"hidden",flex:"none"})),cB=Ot.span({display:"block",height:"100%",borderRadius:"999px"}),uB=Ot.span(({theme:e})=>({fontFamily:e.typography.fonts.mono,fontSize:e.typography.size.s1,color:e.color.mediumdark,width:"40px",textAlign:"right",flex:"none"})),pB=Ot.div(({theme:e})=>({margin:`${e.layoutMargin*.75}px 0`,padding:`${e.layoutMargin*.75}px ${e.layoutMargin}px`,background:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,borderRadius:`${e.appBorderRadius}px`,fontSize:e.typography.size.s2,lineHeight:1.5,color:e.color.defaultText})),dB=Ot.div(({theme:e})=>({marginTop:`${e.layoutMargin*.75}px`,fontSize:e.typography.size.s1,color:e.color.defaultText,"& > div":{marginTop:"3px"}})),fB=Ot.div(({theme:e})=>({marginTop:`${e.layoutMargin}px`,padding:`${e.layoutMargin*.75}px`,background:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,borderRadius:`${e.appBorderRadius}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark})),w2=Ot.b({color:ee.red,fontFamily:"ui-monospace, monospace"}),gB=Ot.div(({theme:e})=>({padding:`${e.layoutMargin}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark}));var xB=[ee.linked,ee.green,ee.amber,ee.red],wue=["mapped, not yet reviewed","matches design","minor differences","differs from design"];function vue(e,t){return!t||t<=0?null:Math.min(100,Math.round(e/t*100))}var Sue=({percent:e})=>{let t=bue(),r=26,n=2*Math.PI*r,o=Math.max(0,Math.min(100,e))/100*n;return He.createElement("svg",{width:"88",height:"88",viewBox:"0 0 64 64",role:"img","aria-label":`${e}% coverage`},He.createElement("circle",{cx:"32",cy:"32",r,fill:"none",stroke:t.appBorderColor,strokeWidth:"8"}),He.createElement("circle",{cx:"32",cy:"32",r,fill:"none",stroke:j,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:`${o} ${n}`,transform:"rotate(-90 32 32)"}),He.createElement("text",{x:"32",y:"34",textAnchor:"middle",dominantBaseline:"middle",fontSize:"15",fontWeight:"700",fill:t.color.defaultText},e,"%"))},yB=()=>{let[e,t]=hB(()=>Ui());mB(()=>{t(Ui());let c=setInterval(()=>t(Ui()),1500);return()=>clearInterval(c)},[]);let[r,n]=hB(()=>cl());mB(()=>{let c=setInterval(()=>n(cl()),1500);return()=>clearInterval(c)},[]);let o=vue(e.mapped,r),i=e.components.filter(c=>c.total>0&&c.mapped>=c.total).length,a=e.components.filter(c=>c.worst>=2).length,s=[...e.components].sort((c,d)=>d.worst!==c.worst?d.worst-c.worst:c.mapped/c.total-d.mapped/d.total),l=r-e.mapped,u=e.avgScore==null?ee.linked:e.avgScore>=90?ee.green:e.avgScore>=70?ee.amber:ee.red;return e.mapped===0?He.createElement(h2,null,He.createElement(y2,null,He.createElement(b2,null)," UI Parity"),He.createElement(gB,null,"No mappings yet \u2014 map stories to Figma to see design parity here.")):He.createElement(h2,null,He.createElement(y2,null,He.createElement(b2,null)," UI Parity"),He.createElement(V_,null,"Design System Parity"),a>0&&He.createElement(pB,null,He.createElement(w2,null,a," of your ",e.components.length," components")," ","drift from design.",o!==null&&He.createElement(He.Fragment,null," ","You've verified ",He.createElement("b",null,o,"%")," of the system \u2014 here's exactly where the gaps are.")),He.createElement(x2,null,He.createElement(W_,null,He.createElement(G_,null,o!==null?He.createElement(He.Fragment,null,He.createElement("span",{title:`Coverage: ${o}% of the ${r} stories in this design system are mapped to a Figma frame.`},He.createElement(Sue,{percent:o})),He.createElement(q_,null,He.createElement(Y_,{title:`${e.mapped} of the ${r} stories are linked to a Figma frame (mapped). ${r-e.mapped} not yet mapped.`},e.mapped," / ",r," stories mapped"),He.createElement(K_,{title:`${e.reviewed} mapped stories got a verdict.${e.incomparable>0?` ${e.incomparable} were reviewed but couldn't be compared \u2014 design and code shared 0 properties (likely a hollow Figma spec).`:""}`},e.reviewed," reviewed",e.incomparable>0?` \xB7 ${e.incomparable} no-overlap`:""," ","\xB7 ",i," of ",e.components.length," components fully mapped"))):He.createElement(X_,null,e.mapped," mapped \xB7 ",e.reviewed," reviewed")),e.avgScore!=null&&He.createElement(J_,{title:"Design-system parity score: the mean of each reviewed story's parity score (0\u2013100). Green \u226590, amber \u226570, red <70."},He.createElement(Q_,null,He.createElement(Z_,{tone:u},e.avgScore),He.createElement(eB,null,"/ 100")),He.createElement(tB,null,"avg parity across ",e.reviewed," reviewed stories"))),He.createElement(rB,null,He.createElement(am,{tone:ee.green,title:"Stories whose render matches the Figma design."},e.pass," pass"),He.createElement(am,{tone:ee.amber,title:"Stories with only minor differences from the Figma design."},e.warn," warn"),He.createElement(am,{tone:ee.red,title:"Stories that differ from the Figma design (major differences)."},e.fail," fail")),(a>0||l>0)&&He.createElement(dB,null,a>0&&He.createElement("div",null,"\u2192 Fix the worst-drifting ",Math.min(3,a)," component",Math.min(3,a)===1?"":"s"," (top of the list)"),l>0&&He.createElement("div",null,"\u2192 Map ",He.createElement("b",null,l)," more stor",l===1?"y":"ies"," to reach 100% coverage"))),He.createElement(x2,null,He.createElement(nB,{title:"Components ranked worst-first: those that differ from design at the top, unmapped ones at the bottom. Dot = worst verdict; bar/fraction = mapped stories of total."},He.createElement("span",null,"Component \u2014 worst first"),He.createElement("span",null,"mapped / stories")),He.createElement(oB,null,s.map(c=>He.createElement(iB,{key:c.id,title:`${Wl(c.id)} \u2014 ${c.mapped}/${c.total} stories mapped \xB7 ${wue[c.worst]}`},He.createElement(aB,{tone:xB[c.worst]}),He.createElement(sB,null,Wl(c.id)),He.createElement(lB,{title:`${c.mapped} of ${c.total} stories mapped`},He.createElement(cB,{style:{width:`${c.total?Math.min(100,c.mapped/c.total*100):0}%`,background:xB[c.worst]}})),He.createElement(uB,null,c.mapped,"/",c.total)))),o!==null&&l>0&&He.createElement(fB,null,He.createElement(w2,null,l)," stories not yet mapped \u2014 the coverage gap to drive down.")))};var Be=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var et=globalThis;var xi="10.46.0";function Fs(){return Ms(et),et}function Ms(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||xi,t[xi]=t[xi]||{}}function qo(e,t,r=et){let n=r.__SENTRY__=r.__SENTRY__||{},o=n[xi]=n[xi]||{};return o[e]||(o[e]=t())}var v2=["debug","info","warn","error","log","assert","trace"],kue="Sentry Logger ",Yl={};function Co(e){if(!("console"in et))return e();let t=et.console,r={},n=Object.keys(Yl);n.forEach(o=>{let i=Yl[o];r[o]=t[o],t[o]=i});try{return e()}finally{n.forEach(o=>{t[o]=r[o]})}}function Cue(){k2().enabled=!0}function Eue(){k2().enabled=!1}function bB(){return k2().enabled}function Tue(...e){S2("log",...e)}function Iue(...e){S2("warn",...e)}function Rue(...e){S2("error",...e)}function S2(e,...t){Be&&bB()&&Co(()=>{et.console[e](`${kue}[${e}]:`,...t)})}function k2(){return Be?qo("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var Se={enable:Cue,disable:Eue,isEnabled:bB,log:Tue,warn:Iue,error:Rue};var wB=/\(error: (.*)\)/,vB=/captureMessage|captureException/;function lm(...e){let t=e.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,o=0)=>{let i=[],a=r.split(`
280
280
  `);for(let s=n;s<a.length;s++){let l=a[s];l.length>1024&&(l=l.slice(0,1024));let u=wB.test(l)?l.replace(wB,"$1"):l;if(!u.match(/\S*Error: /)){for(let c of t){let d=c(u);if(d){i.push(d);break}}if(i.length>=50+o)break}}return SB(i.slice(o))}}function E2(e){return Array.isArray(e)?lm(...e):e}function SB(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(sm(t).function||"")&&t.pop(),t.reverse(),vB.test(sm(t).function||"")&&(t.pop(),vB.test(sm(t).function||"")&&t.pop()),t.slice(0,50).map(r=>({...r,filename:r.filename||sm(t).filename,function:r.function||"?"}))}function sm(e){return e[e.length-1]||{}}var C2="<anonymous>";function Eo(e){try{return!e||typeof e!="function"?C2:e.name||C2}catch{return C2}}function cm(e){let t=e.exception;if(t){let r=[];try{return t.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}function um(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}var pm={},kB={};function vn(e,t){pm[e]=pm[e]||[],pm[e].push(t)}function Sn(e,t){if(!kB[e]){kB[e]=!0;try{t()}catch(r){Be&&Se.error(`Error while instrumenting ${e}`,r)}}}function Nr(e,t){let r=e&&pm[e];if(r)for(let n of r)try{n(t)}catch(o){Be&&Se.error(`Error while triggering instrumentation handler.
281
281
  Type: ${e}